@ignifx/core 0.15.0 → 0.17.0

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.
Files changed (54) hide show
  1. package/decoders/draco3dgltf.LICENSE.md +201 -0
  2. package/decoders/draco_decoder.js +116 -0
  3. package/decoders/draco_decoder_gltf.wasm +0 -0
  4. package/decoders/vendored.json +22 -0
  5. package/dist/{decoders-CHJ7vduE.js → decoders-BUQrlS8U.js} +3 -2
  6. package/dist/decoders-BUQrlS8U.js.map +1 -0
  7. package/dist/{environment-DPi0_0SP.js → environment-CMpzGXTz.js} +2 -2
  8. package/dist/{environment-DPi0_0SP.js.map → environment-CMpzGXTz.js.map} +1 -1
  9. package/dist/{ignifx-error-oYdVnT1S.js → ignifx-error-Der0bpHK.js} +7 -1
  10. package/dist/ignifx-error-Der0bpHK.js.map +1 -0
  11. package/dist/index.d.ts +29 -14609
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1715 -4899
  14. package/dist/index.js.map +1 -1
  15. package/dist/{instanced-mesh-instance-NnODkvqK.js → instanced-mesh-instance-BMhREEfx.js} +3 -2
  16. package/dist/{instanced-mesh-instance-NnODkvqK.js.map → instanced-mesh-instance-BMhREEfx.js.map} +1 -1
  17. package/dist/{material-plugin-BUlqLsap.js → material-plugin-B-hartHR.js} +2 -2
  18. package/dist/{material-plugin-BUlqLsap.js.map → material-plugin-B-hartHR.js.map} +1 -1
  19. package/dist/node-DznSvwap.js +301 -0
  20. package/dist/node-DznSvwap.js.map +1 -0
  21. package/dist/{post-effect-BHl7U56q.js → post-effect-CuoYvrhb.js} +3 -30
  22. package/dist/post-effect-CuoYvrhb.js.map +1 -0
  23. package/dist/{post-effect-compiler-CRek8VxQ.js → post-effect-compiler-Bps8QbiJ.js} +3 -3
  24. package/dist/{post-effect-compiler-CRek8VxQ.js.map → post-effect-compiler-Bps8QbiJ.js.map} +1 -1
  25. package/dist/prefab-overrides-76IhcF-e.d.ts +14925 -0
  26. package/dist/prefab-overrides-76IhcF-e.d.ts.map +1 -0
  27. package/dist/prefab-overrides-DGiGTSN-.js +2396 -0
  28. package/dist/prefab-overrides-DGiGTSN-.js.map +1 -0
  29. package/dist/prefab.d.ts +2 -0
  30. package/dist/prefab.js +2 -0
  31. package/dist/reflection-probe-C0pzGrG_.js +1883 -0
  32. package/dist/reflection-probe-C0pzGrG_.js.map +1 -0
  33. package/dist/reflection-probes-B8_vK9YR.js +551 -0
  34. package/dist/reflection-probes-B8_vK9YR.js.map +1 -0
  35. package/dist/{render-texture-C_TnaSz2.js → render-texture-UqRHRLQy.js} +15 -2
  36. package/dist/{render-texture-C_TnaSz2.js.map → render-texture-UqRHRLQy.js.map} +1 -1
  37. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  38. package/dist/{shader-material-B6p66wB8.js → shader-material-Cjfq7nFS.js} +5 -16
  39. package/dist/{shader-material-B6p66wB8.js.map → shader-material-Cjfq7nFS.js.map} +1 -1
  40. package/dist/{shader-material-C0TAUr4t.js → shader-material-DCjYDdkh.js} +2 -2
  41. package/dist/{shader-material-C0TAUr4t.js.map → shader-material-DCjYDdkh.js.map} +1 -1
  42. package/dist/{shader-pragma-BKCoZTTA.js → shader-pragma-cjEC-EPK.js} +2 -2
  43. package/dist/{shader-pragma-BKCoZTTA.js.map → shader-pragma-cjEC-EPK.js.map} +1 -1
  44. package/dist/{surface-shader-BaK0kvBB.js → surface-shader-D40hXQ8c.js} +4 -4
  45. package/dist/{surface-shader-BaK0kvBB.js.map → surface-shader-D40hXQ8c.js.map} +1 -1
  46. package/dist/{vec3-D-0Y2mzE.js → vec3-Cc19wl4r.js} +3 -300
  47. package/dist/vec3-Cc19wl4r.js.map +1 -0
  48. package/package.json +11 -5
  49. package/dist/decoders-CHJ7vduE.js.map +0 -1
  50. package/dist/ignifx-error-oYdVnT1S.js.map +0 -1
  51. package/dist/json-CzZZ6K4x.js +0 -24
  52. package/dist/json-CzZZ6K4x.js.map +0 -1
  53. package/dist/post-effect-BHl7U56q.js.map +0 -1
  54. package/dist/vec3-D-0Y2mzE.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefab-overrides-DGiGTSN-.js","names":["object"],"sources":["../src/assets/address.ts","../src/schema/issues.ts","../src/schema/json.ts","../src/serialization/json-view.ts","../src/schema/internal.ts","../src/schema/encode.ts","../src/schema/describe.ts","../src/serialization/scene-file.ts","../src/serialization/scene-asset.ts","../src/serialization/overrides.ts","../src/serialization/prefab-overrides.ts"],"sourcesContent":["/**\n * Address arithmetic (`docs/architecture/05-assets-and-loading.md` §2): splitting the sub-asset\n * fragment off, recognising the URL forms that bypass the asset root, joining a relative address\n * onto that root, and picking the longest registered extension an address ends with.\n *\n * Everything here is a pure function over strings so the rules can be tested without a service, an\n * app, or a network.\n */\n\n/** The URL schemes §2 accepts verbatim: an address in one of these is never joined to the root. */\nconst ABSOLUTE_PREFIXES: readonly string[] = Object.freeze([\"http://\", \"https://\", \"blob:\", \"data:\"]);\n\n/** The separator between an address and its sub-asset fragment. */\nconst FRAGMENT_SEPARATOR = \"#\";\n\n/** The separator between the asset root and a relative address. */\nconst PATH_SEPARATOR = \"/\";\n\n/**\n * An address split into the part that resolves to a URL and the part loaders interpret.\n *\n * @internal\n */\nexport interface SplitAddress {\n /** The address with the fragment removed. */\n readonly path: string;\n /** The text after the first `#`, or `null` when the address carries none. */\n readonly fragment: string | null;\n}\n\n/**\n * Splits a sub-asset fragment off an address.\n *\n * @remarks\n * Only the *first* `#` separates; everything after it is the fragment, so a grammar such as\n * `#frame:a#b` reaches the loader intact. A `data:` URL is never split: its payload may legitimately\n * contain a `#`, and it has no sub-assets to name.\n *\n * @param address - The address as game code wrote it.\n * @returns The path and the fragment.\n *\n * @example\n * ```ts\n * splitFragment(\"models/hero.glb#animation:Run\"); // { path: \"models/hero.glb\", fragment: \"animation:Run\" }\n * ```\n *\n * @internal\n */\nexport function splitFragment(address: string): SplitAddress {\n if (address.startsWith(\"data:\")) {\n return { path: address, fragment: null };\n }\n const index = address.indexOf(FRAGMENT_SEPARATOR);\n if (index < 0) {\n return { path: address, fragment: null };\n }\n return { path: address.slice(0, index), fragment: address.slice(index + 1) };\n}\n\n/**\n * Reports whether an address is already a URL the service can fetch as it stands.\n *\n * @param path - A fragment-free address.\n * @returns `true` for `http://`, `https://`, `blob:`, and `data:`.\n *\n * @internal\n */\nexport function isAbsoluteAddress(path: string): boolean {\n for (let index = 0; index < ABSOLUTE_PREFIXES.length; index += 1) {\n const prefix = ABSOLUTE_PREFIXES[index];\n if (prefix !== undefined && path.startsWith(prefix)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Joins a relative address onto the asset root with exactly one separator.\n *\n * @param root - The asset root; an empty root leaves the address alone.\n * @param path - A fragment-free relative address.\n * @returns The URL to fetch.\n *\n * @example\n * ```ts\n * joinRoot(\"assets/\", \"models/hero.glb\"); // \"assets/models/hero.glb\"\n * ```\n *\n * @internal\n */\nexport function joinRoot(root: string, path: string): string {\n if (root.length === 0) {\n return path;\n }\n const base = root.endsWith(PATH_SEPARATOR) ? root.slice(0, -1) : root;\n const tail = path.startsWith(PATH_SEPARATOR) ? path.slice(1) : path;\n return `${base}${PATH_SEPARATOR}${tail}`;\n}\n\n/**\n * Picks the longest registered extension an address ends with, so `.scene.json` wins over `.json`.\n *\n * @param path - A fragment-free address.\n * @param extensions - Every registered extension, each with its leading dot.\n * @returns The winning extension in lower case, or `null` when none matches.\n *\n * @example\n * ```ts\n * matchExtension(\"levels/1.scene.json\", [\".json\", \".scene.json\"]); // \".scene.json\"\n * ```\n *\n * @internal\n */\nexport function matchExtension(path: string, extensions: Iterable<string>): string | null {\n const lower = path.toLowerCase();\n let best: string | null = null;\n for (const extension of extensions) {\n if (lower.endsWith(extension) && (best === null || extension.length > best.length)) {\n best = extension;\n }\n }\n return best;\n}\n\n/**\n * Normalises an extension the way the registry stores it: lower case, with a leading dot.\n *\n * @param extension - The extension as an extension author wrote it.\n * @returns The normalised form.\n *\n * @internal\n */\nexport function normalizeExtension(extension: string): string {\n const lower = extension.toLowerCase();\n return lower.startsWith(\".\") ? lower : `.${lower}`;\n}\n\n/**\n * The scheme in-memory assets are registered under (`Assets.register`). An address that starts with\n * it names a value built in code — a `MeshAsset.box(...)`, a `MaterialAsset.pbr(...)` — rather than\n * a file, so nothing fetches it and nothing can write it into a scene file.\n *\n * @internal\n */\nexport const MEMORY_ADDRESS_PREFIX = \"memory:\";\n\n/**\n * Reports whether an address names an in-memory asset rather than a file.\n *\n * @param address - The address to test.\n * @returns `true` when the address carries the `memory:` scheme.\n *\n * @example\n * ```ts\n * isMemoryAddress(\"memory:mesh/01J9Z6M7E5S3A0V2Q4R8T1Y6WX\"); // true\n * ```\n *\n * @internal\n */\nexport function isMemoryAddress(address: string): boolean {\n return address.startsWith(MEMORY_ADDRESS_PREFIX);\n}\n","import { IgnifxError } from \"../errors/ignifx-error.js\";\n\n/**\n * Diagnostic codes this module reports. They live in the `06xx` serialization range registered in\n * `docs/architecture/15-devtools-and-diagnostics.md` §1. Codes `IGX-0601` to `IGX-0604` are already\n * spoken for by the scene loader (`docs/architecture/06-serialization-and-scene-format.md`), so the\n * schema-level checks continue from `IGX-0605`.\n *\n * @public\n */\nexport const SchemaIssueCode = {\n /** A number was `NaN`, `Infinity`, or `-Infinity` and therefore cannot be written to JSON. */\n nonFiniteNumber: \"IGX-0601\",\n /** An entity or component reference could not be resolved to a uid. */\n unresolvedReference: \"IGX-0602\",\n /** A value had the wrong JavaScript or JSON type for the field kind. */\n typeMismatch: \"IGX-0605\",\n /** A value had the right type but fell outside the field's declared value domain. */\n outOfRange: \"IGX-0606\",\n /**\n * A property was supplied that the schema does not declare, or a schema declaration named a field\n * it may not use: not identifier-like, a `Component`/`Script` member, or an `Object.prototype`\n * member such as `constructor` or `__proto__`.\n */\n unknownField: \"IGX-0607\",\n} as const;\n\n/**\n * The union of diagnostic codes this module reports.\n *\n * @public\n */\nexport type SchemaIssueCode = (typeof SchemaIssueCode)[keyof typeof SchemaIssueCode];\n\n/**\n * One problem found while validating, encoding, or decoding a schema value. Issues are plain data:\n * this module never throws for bad *values*, it reports them, and the caller decides whether that\n * is a development-time throw or a logged diagnostic (`CONSTITUTION.md` §3.9).\n *\n * @public\n */\nexport interface SchemaIssue {\n /** Where the problem is, in dotted/bracketed property notation, for example `waypoints[2].x`. */\n readonly path: string;\n /** An actionable description of what went wrong. */\n readonly message: string;\n /** The stable `IGX-####` code for the problem. */\n readonly code: SchemaIssueCode;\n}\n\n/**\n * Builds an issue record.\n *\n * @param code - The diagnostic code.\n * @param path - The property path the problem was found at.\n * @param message - An actionable description.\n * @returns The issue.\n *\n * @internal\n */\nexport function issue(code: SchemaIssueCode, path: string, message: string): SchemaIssue {\n return { path, message, code };\n}\n\n/**\n * Throws for a mistake in a *schema declaration* — as opposed to a bad value, which is reported as\n * a {@link SchemaIssue}. Declarations are authored by hand, so a mistake there is API misuse and\n * must be loud (`CONSTITUTION.md` §3.9).\n *\n * @param code - The diagnostic code carried by the thrown error.\n * @param message - An actionable description of the mistake.\n * @throws IgnifxError carrying `code`. The `06xx` serialization range is registered in\n * `docs/architecture/15-devtools-and-diagnostics.md` section 1.\n *\n * @internal\n */\nexport function throwSchemaError(code: SchemaIssueCode, message: string): never {\n throw new IgnifxError(code, message, {\n hint: \"Schema declarations are authored by hand; fix the declaration rather than the value.\",\n });\n}\n","/**\n * The JSON value model the serializer works in. Scene and prefab files are UTF-8 JSON\n * (`docs/architecture/06-serialization-and-scene-format.md` §1), so every encoded schema value is\n * one of these shapes. The type is recursive rather than `unknown` so that encoders cannot smuggle\n * a `Date`, a `Map`, or an `undefined` into a file (coding standards §5.2 bans `any`).\n *\n * @public\n */\nexport type JsonValue = string | number | boolean | null | JsonArray | JsonObject;\n\n/**\n * A JSON array. Read-only because encoded values are snapshots: callers copy before mutating.\n *\n * @public\n */\nexport type JsonArray = readonly JsonValue[];\n\n/**\n * A JSON object. Keys are emitted in the canonical order defined by\n * `docs/architecture/06-serialization-and-scene-format.md` §1, so two saves of the same state\n * produce byte-identical files.\n *\n * @public\n */\nexport type JsonObject = { readonly [key: string]: JsonValue };\n\n/**\n * Sets a key on an object being built from JSON as an own, enumerable data property — what\n * `JSON.parse` does. A plain `target[key] = value` treats the key `__proto__` as the prototype\n * setter, so a file carrying that key would change the copy's prototype instead of holding data.\n *\n * @param target - The object under construction.\n * @param key - The key, taken from parsed JSON.\n * @param value - The value.\n *\n * @internal\n */\nexport function setOwnJsonProperty<T>(target: Record<string, T>, key: string, value: T): void {\n Object.defineProperty(target, key, { value, enumerable: true, writable: true, configurable: true });\n}\n","import type { JsonArray, JsonObject, JsonValue } from \"../schema/json.js\";\n\n/**\n * Narrows a JSON value to an object. `Array.isArray` alone does not remove `JsonArray` from the\n * `JsonValue` union in a way that lets the object half be indexed by an arbitrary string, so the\n * whole discrimination lives here rather than being repeated with an assertion at every call site.\n *\n * @param value - The JSON to narrow.\n * @returns The object, or `null` when the value is an array, `null`, or a primitive.\n *\n * @internal\n */\nexport function asJsonObject(value: JsonValue | undefined): JsonObject | null {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return null;\n }\n // The guard above is exactly `JsonObject` — an\n // object that is neither `null` nor an array — which is what `JsonValue` leaves in the union.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return value as JsonObject;\n}\n\n/**\n * Narrows a JSON value to an array.\n *\n * @param value - The JSON to narrow.\n * @returns The array, or `null` when the value is not one.\n *\n * @internal\n */\nexport function asJsonArray(value: JsonValue | undefined): JsonArray | null {\n return Array.isArray(value) ? value : null;\n}\n","/**\n * Guards and path helpers shared by validation, encoding, and decoding. Nothing here is exported\n * from the package barrel.\n */\n\n/**\n * The component names of a vector value, in encoded order.\n *\n * @internal\n */\nexport const VECTOR_COMPONENTS = [\"x\", \"y\", \"z\", \"w\"] as const;\n\n/**\n * The channel names of a color value, in encoded order.\n *\n * @internal\n */\nexport const COLOR_CHANNELS = [\"r\", \"g\", \"b\", \"a\"] as const;\n\n/**\n * Extends a property path with a named child.\n *\n * @param path - The parent path, possibly empty.\n * @param name - The child property name.\n * @returns The child path.\n *\n * @internal\n */\nexport function childPath(path: string, name: string): string {\n return path === \"\" ? name : `${path}.${name}`;\n}\n\n/**\n * Extends a property path with an array index or map key.\n *\n * @param path - The parent path.\n * @param key - The index or key.\n * @returns The child path.\n *\n * @internal\n */\nexport function indexPath(path: string, key: number | string): string {\n return typeof key === \"number\" ? `${path}[${key}]` : `${path}[${JSON.stringify(key)}]`;\n}\n\n/**\n * Narrows a value to a read-only array without widening its elements to `any`, which is what the\n * built-in `Array.isArray` predicate does for an `unknown` input.\n *\n * @param value - The value to test.\n * @returns Whether the value is an array.\n *\n * @internal\n */\nexport function isArray(value: unknown): value is readonly unknown[] {\n return Array.isArray(value);\n}\n\n/**\n * Narrows a value to a plain object, excluding arrays and `null`.\n *\n * @param value - The value to test.\n * @returns Whether the value is a plain object.\n *\n * @internal\n */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !isArray(value);\n}\n\n/**\n * Reinterprets a decoded JavaScript value as the field's declared type. Decoders are the JSON\n * boundary coding standards §5.2 allows assertions at: the value was just built from the field's\n * own definition, so it matches by construction, but that fact is not expressible in the type\n * system without threading the value type through every recursive step.\n *\n * @param value - The decoded value.\n * @returns The same value, typed as the field's value type.\n *\n * @internal\n */\n// The type parameter exists so that the caller names the target type; there is no argument to infer\n// it from, which is exactly what makes this an assertion helper rather than a conversion.\n// oxlint-disable-next-line typescript/no-unnecessary-type-parameters\nexport function asFieldValue<T>(value: unknown): T {\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- invariant stated above.\n return value as T;\n}\n","import { isMemoryAddress } from \"../assets/address.js\";\nimport { assertNever } from \"../errors/ignifx-error.js\";\nimport {\n COLOR_CHANNELS,\n VECTOR_COMPONENTS,\n asFieldValue,\n childPath,\n indexPath,\n isArray,\n isPlainObject,\n} from \"./internal.js\";\nimport { SchemaIssueCode, issue } from \"./issues.js\";\nimport { setOwnJsonProperty } from \"./json.js\";\nimport type { SchemaIssue } from \"./issues.js\";\nimport type { JsonObject, JsonValue } from \"./json.js\";\nimport type { FieldDefinition, FieldsOf, PartialFieldsOf, Schema } from \"./types.js\";\n\n/**\n * How the serializer turns a live entity or component reference into the uid written to a file.\n * Reference kinds cannot be encoded without a world, so the kernel implements this and tests pass\n * a fake.\n *\n * @public\n */\nexport interface ReferenceEncoder {\n /**\n * Resolves an entity reference to its file-local uid.\n *\n * @param value - The entity the field points at.\n * @returns The uid, or `null` when the target is not part of the file being written.\n */\n entityUid(value: unknown): string | null;\n /**\n * Resolves a component reference to its file-local uid.\n *\n * @param value - The component the field points at.\n * @returns The uid, or `null` when the target is not part of the file being written.\n */\n componentUid(value: unknown): string | null;\n}\n\n/**\n * How the loader turns a uid read from a file back into a live entity or component.\n *\n * @public\n */\nexport interface ReferenceDecoder {\n /**\n * Looks up an entity by its file-local uid.\n *\n * @param uid - The uid read from the file.\n * @returns The entity, or `null` when the uid is unknown.\n */\n entity(uid: string): unknown;\n /**\n * Looks up a component by its file-local uid.\n *\n * @param uid - The uid read from the file.\n * @returns The component, or `null` when the uid is unknown.\n */\n component(uid: string): unknown;\n /**\n * Resolves an asset address to the loaded handle an `asset()` field should hold\n * (`docs/architecture/05-assets-and-loading.md` §3).\n *\n * @remarks\n * The scene loader answers from the dependency handles the `SceneAsset` already retains, so the\n * field never starts a load of its own and never owns a reference count. A resolver that returns\n * `null` — an address nothing loaded — makes the field `null` and adds an `IGX-0602` issue.\n *\n * @param address - The address the file carries, fragment included.\n * @param type - The asset type the field or the file declared, or `null` when the address's\n * extension identifies it on its own.\n * @returns The handle, or `null` when nothing loaded stands at that address.\n */\n asset(address: string, type: string | null): unknown;\n}\n\n/**\n * What decoding produced: a value that is always usable — the field's default when the JSON could\n * not be read — plus every problem found on the way.\n *\n * @typeParam T - The decoded value type.\n *\n * @public\n */\nexport interface DecodeResult<T> {\n /** The decoded value, or the field's freshly built default when decoding failed. */\n readonly value: T;\n /** Every problem found, in discovery order; empty on a clean decode. */\n readonly issues: readonly SchemaIssue[];\n}\n\n/**\n * Rounds a number to the file format's precision: six decimal places, with `-0` normalized to `0`\n * (`docs/architecture/06-serialization-and-scene-format.md` §3). The rule is idempotent, so\n * save → load → save is byte-identical.\n *\n * @param value - The number to canonicalize.\n * @returns The canonical form of the number.\n *\n * @example\n * ```ts\n * canonicalizeNumber(0.1 + 0.2); // 0.3\n * canonicalizeNumber(-0); // 0\n * ```\n *\n * @public\n */\nexport function canonicalizeNumber(value: number): number {\n const rounded = Math.round(value * 1e6) / 1e6;\n return rounded === 0 ? 0 : rounded;\n}\n\n/**\n * Reports a value that does not match its field and yields the JSON stand-in for it.\n *\n * @param issues - The collector to append to.\n * @param path - The property path the problem was found at.\n * @param message - An actionable description.\n * @returns `null`, the placeholder written for an unrepresentable value.\n *\n * @internal\n */\nfunction unrepresentable(issues: SchemaIssue[], path: string, message: string): null {\n issues.push(issue(SchemaIssueCode.typeMismatch, path, message));\n return null;\n}\n\n/**\n * Encodes one number, reporting `NaN` and the infinities.\n *\n * @param value - The candidate number.\n * @param path - The property path for reported issues.\n * @param issues - The collector to append to.\n * @returns The canonical number, or `null` when it cannot be written.\n *\n * @internal\n */\nfunction encodeNumber(value: unknown, path: string, issues: SchemaIssue[]): JsonValue {\n if (typeof value !== \"number\") {\n return unrepresentable(issues, path, `expected a number, received ${typeof value}.`);\n }\n if (!Number.isFinite(value)) {\n issues.push(issue(SchemaIssueCode.nonFiniteNumber, path, `${String(value)} cannot be written to JSON.`));\n return null;\n }\n return canonicalizeNumber(value);\n}\n\n/**\n * Encodes the named channels of an object value as a JSON number array.\n *\n * @param names - The channel names to read, in encoded order.\n * @param label - How the value is named in messages.\n * @param value - The candidate value.\n * @param path - The property path for reported issues.\n * @param issues - The collector to append to.\n * @returns The number array, or `null` when a channel is missing or unrepresentable.\n *\n * @internal\n */\nfunction encodeChannels(\n names: readonly string[],\n label: string,\n value: unknown,\n path: string,\n issues: SchemaIssue[],\n): JsonValue {\n if (!isPlainObject(value)) {\n return unrepresentable(issues, path, `expected a ${label} object, received ${typeof value}.`);\n }\n const encoded: JsonValue[] = [];\n for (const name of names) {\n const channel = encodeNumber(value[name], childPath(path, name), issues);\n if (channel === null) {\n return null;\n }\n encoded.push(channel);\n }\n return encoded;\n}\n\n/**\n * Encodes one value against one field definition.\n *\n * @param field - The field to encode against.\n * @param value - The value to encode.\n * @param references - How to resolve entity and component references to uids.\n * @param path - The property path for reported issues.\n * @param issues - The collector to append to.\n * @returns The JSON representation.\n *\n * @internal\n */\nfunction encodeInto(\n field: FieldDefinition<unknown>,\n value: unknown,\n references: ReferenceEncoder,\n path: string,\n issues: SchemaIssue[],\n): JsonValue {\n const { spec } = field;\n switch (spec.kind) {\n case \"f32\":\n case \"f64\":\n case \"i32\":\n case \"u32\": {\n return encodeNumber(value, path, issues);\n }\n case \"bool\": {\n return typeof value === \"boolean\"\n ? value\n : unrepresentable(issues, path, `expected a boolean, received ${typeof value}.`);\n }\n case \"str\": {\n return typeof value === \"string\"\n ? value\n : unrepresentable(issues, path, `expected a string, received ${typeof value}.`);\n }\n case \"vec2\":\n case \"vec3\":\n case \"vec4\":\n case \"quat\": {\n return encodeChannels(VECTOR_COMPONENTS.slice(0, spec.components), spec.kind, value, path, issues);\n }\n case \"color\": {\n return encodeChannels(COLOR_CHANNELS, \"color\", value, path, issues);\n }\n case \"enum\": {\n return typeof value === \"string\"\n ? value\n : unrepresentable(issues, path, `expected a string, received ${typeof value}.`);\n }\n case \"entityRef\": {\n if (value === null) {\n return null;\n }\n const uid = references.entityUid(value);\n if (uid === null) {\n issues.push(issue(SchemaIssueCode.unresolvedReference, path, `the referenced entity is not in this file.`));\n return null;\n }\n return { $entity: uid };\n }\n case \"componentRef\": {\n if (value === null) {\n return null;\n }\n const uid = references.componentUid(value);\n if (uid === null) {\n issues.push(issue(SchemaIssueCode.unresolvedReference, path, `the referenced component is not in this file.`));\n return null;\n }\n return { $component: uid };\n }\n case \"asset\": {\n if (value === null) {\n return null;\n }\n if (!isPlainObject(value) || typeof value[\"address\"] !== \"string\") {\n return unrepresentable(issues, path, `expected a loaded asset handle, or null.`);\n }\n const address = value[\"address\"];\n if (isMemoryAddress(address)) {\n // An in-code asset (`Assets.register`, `MeshAsset.box`, `MaterialAsset.pbr`) names no file,\n // so there is nothing a reader could resolve the address against. Writing it would produce\n // a file that loads with a dangling reference; writing `null` and saying so does not.\n issues.push(\n issue(\n SchemaIssueCode.unresolvedReference,\n path,\n `the asset was created in code (${address}) and has no file to reference.`,\n ),\n );\n return null;\n }\n const declared = value[\"type\"];\n const typeName = typeof declared === \"string\" ? declared : spec.typeName;\n return typeName === null ? { $asset: address } : { $asset: address, type: typeName };\n }\n case \"array\": {\n if (!isArray(value)) {\n return unrepresentable(issues, path, `expected an array, received ${typeof value}.`);\n }\n const encoded: JsonValue[] = [];\n for (let index = 0; index < value.length; index += 1) {\n encoded.push(encodeInto(spec.item, value[index], references, indexPath(path, index), issues));\n }\n return encoded;\n }\n case \"record\": {\n if (!isPlainObject(value)) {\n return unrepresentable(issues, path, `expected an object, received ${typeof value}.`);\n }\n return encodeFields(spec.fields, value, references, path, issues);\n }\n case \"map\": {\n if (!isPlainObject(value)) {\n return unrepresentable(issues, path, `expected an object, received ${typeof value}.`);\n }\n const encoded: Record<string, JsonValue> = {};\n for (const key of Object.keys(value).toSorted()) {\n // Defined, not assigned: a map key `__proto__` stays an entry, not a prototype change.\n setOwnJsonProperty(encoded, key, encodeInto(spec.value, value[key], references, indexPath(path, key), issues));\n }\n return encoded;\n }\n case \"optional\": {\n return value === null ? null : encodeInto(spec.inner, value, references, path, issues);\n }\n case \"layerMask\": {\n if (!isArray(value)) {\n return unrepresentable(issues, path, `expected an array of layer names.`);\n }\n const encoded: JsonValue[] = [];\n for (let index = 0; index < value.length; index += 1) {\n const name = value[index];\n if (typeof name !== \"string\") {\n return unrepresentable(issues, indexPath(path, index), `expected a layer name string.`);\n }\n encoded.push(name);\n }\n return encoded;\n }\n case \"curve\": {\n if (!isPlainObject(value)) {\n return unrepresentable(issues, path, `expected a curve object.`);\n }\n const keys = value[\"keys\"];\n const keysAt = childPath(path, \"keys\");\n if (!isArray(keys)) {\n return unrepresentable(issues, keysAt, `expected an array of curve keys.`);\n }\n const encoded: JsonValue[] = [];\n for (let index = 0; index < keys.length; index += 1) {\n const key = keys[index];\n const keyAt = indexPath(keysAt, index);\n if (!isArray(key) || key.length !== 4) {\n return unrepresentable(issues, keyAt, `expected [time, value, inTangent, outTangent].`);\n }\n encoded.push([\n encodeNumber(key[0], indexPath(keyAt, 0), issues),\n encodeNumber(key[1], indexPath(keyAt, 1), issues),\n encodeNumber(key[2], indexPath(keyAt, 2), issues),\n encodeNumber(key[3], indexPath(keyAt, 3), issues),\n ]);\n }\n return { keys: encoded };\n }\n case \"custom\": {\n return spec.codec.serialize(value);\n }\n default: {\n return assertNever(spec, \"schema field kind\");\n }\n }\n}\n\n/**\n * Encodes a bag of values against a schema in canonical (declaration) key order, skipping fields\n * marked `transient` (`docs/architecture/06-serialization-and-scene-format.md` §5).\n *\n * @param schema - The schema that fixes the key order.\n * @param values - The values to encode, keyed by field name; missing names take the field default.\n * @param references - How to resolve entity and component references to uids.\n * @param path - The property path prefix for reported issues.\n * @param issues - The collector to append to.\n * @returns The JSON object.\n *\n * @internal\n */\nfunction encodeFields(\n schema: Schema,\n values: Readonly<Record<string, unknown>>,\n references: ReferenceEncoder,\n path: string,\n issues: SchemaIssue[],\n): JsonObject {\n const encoded: Record<string, JsonValue> = {};\n for (const [name, field] of Object.entries(schema)) {\n if (field.options.transient === true) {\n continue;\n }\n const supplied = values[name];\n const value = supplied === undefined ? field.createDefault() : supplied;\n encoded[name] = encodeInto(field, value, references, childPath(path, name), issues);\n }\n return encoded;\n}\n\n/**\n * Encodes one value into the JSON form the scene format defines\n * (`docs/architecture/06-serialization-and-scene-format.md` §3). Numbers are canonicalized,\n * vectors and colors become arrays, and references become tagged objects.\n *\n * Encoding is total: it always returns valid JSON. A value that cannot be represented — a `NaN`, a\n * reference to something outside the file, a value of the wrong type — is written as `null` and\n * reported through `issues`. Call {@link validateValue} when you want the check without the output.\n *\n * @typeParam T - The field's value type.\n * @param field - The field to encode against.\n * @param value - The value to encode.\n * @param references - How to resolve entity and component references to uids.\n * @param issues - An optional collector; problems are appended to it in discovery order.\n * @returns The JSON representation.\n *\n * @example\n * ```ts\n * encodeValue(vec3(), { x: 1, y: 2.0000004, z: -0 }, references); // [1, 2, 0]\n * ```\n *\n * @public\n */\nexport function encodeValue<T>(\n field: FieldDefinition<T>,\n value: T,\n references: ReferenceEncoder,\n issues: SchemaIssue[] = [],\n): JsonValue {\n return encodeInto(field, value, references, \"\", issues);\n}\n\n/**\n * Encodes a component's props in canonical key order. Fields the schema declares but `props` omits\n * take their default; fields marked `transient` are skipped.\n *\n * @typeParam S - The schema being encoded.\n * @param schema - The schema that fixes the key order.\n * @param props - The values to encode, keyed by field name.\n * @param references - How to resolve entity and component references to uids.\n * @param issues - An optional collector; problems are appended to it in discovery order.\n * @returns The JSON object written under `props` in a scene file.\n *\n * @public\n */\nexport function encodeProps<S extends Schema>(\n schema: S,\n props: PartialFieldsOf<S>,\n references: ReferenceEncoder,\n issues: SchemaIssue[] = [],\n): JsonObject {\n return encodeFields(schema, asFieldValue<Record<string, unknown>>(props), references, \"\", issues);\n}\n\n/**\n * Decodes one JSON value against one field definition.\n *\n * @param field - The field to decode against.\n * @param json - The JSON to read.\n * @param references - How to resolve uids back to entities and components.\n * @param path - The property path for reported issues.\n * @param issues - The collector to append to.\n * @returns The decoded value, or the field's fresh default when the JSON could not be read.\n *\n * @internal\n */\nfunction decodeInto(\n field: FieldDefinition<unknown>,\n json: JsonValue,\n references: ReferenceDecoder,\n path: string,\n issues: SchemaIssue[],\n): unknown {\n const { spec } = field;\n switch (spec.kind) {\n case \"f32\":\n case \"f64\":\n case \"i32\":\n case \"u32\": {\n if (typeof json !== \"number\" || !Number.isFinite(json)) {\n return rejected(field, issues, path, `expected a finite number.`);\n }\n return canonicalizeNumber(json);\n }\n case \"bool\": {\n return typeof json === \"boolean\" ? json : rejected(field, issues, path, `expected a boolean.`);\n }\n case \"str\": {\n return typeof json === \"string\" ? json : rejected(field, issues, path, `expected a string.`);\n }\n case \"vec2\":\n case \"vec3\":\n case \"vec4\":\n case \"quat\": {\n return decodeChannels(VECTOR_COMPONENTS.slice(0, spec.components), field, json, path, issues);\n }\n case \"color\": {\n return decodeChannels(COLOR_CHANNELS, field, json, path, issues);\n }\n case \"enum\": {\n if (typeof json !== \"string\" || !spec.values.includes(json)) {\n return rejected(field, issues, path, `expected one of [${spec.values.join(\", \")}].`);\n }\n return json;\n }\n case \"entityRef\": {\n return decodeReference(field, json, \"$entity\", (uid) => references.entity(uid), path, issues);\n }\n case \"componentRef\": {\n return decodeReference(field, json, \"$component\", (uid) => references.component(uid), path, issues);\n }\n case \"asset\": {\n if (json === null) {\n return null;\n }\n if (!isPlainObject(json) || typeof json[\"$asset\"] !== \"string\") {\n return rejected(field, issues, path, `expected { \"$asset\": \"<address>\" } or null.`);\n }\n const address = json[\"$asset\"];\n const declared = json[\"type\"];\n const typeName = typeof declared === \"string\" ? declared : spec.typeName;\n const handle = references.asset(address, typeName);\n if (handle === null || handle === undefined) {\n issues.push(\n issue(SchemaIssueCode.unresolvedReference, path, `no loaded asset stands at the address \"${address}\".`),\n );\n return null;\n }\n return handle;\n }\n case \"array\": {\n if (!isArray(json)) {\n return rejected(field, issues, path, `expected an array.`);\n }\n const decoded: unknown[] = [];\n for (let index = 0; index < json.length; index += 1) {\n decoded.push(decodeInto(spec.item, json[index] ?? null, references, indexPath(path, index), issues));\n }\n return decoded;\n }\n case \"record\": {\n if (!isPlainObject(json)) {\n return rejected(field, issues, path, `expected an object.`);\n }\n return decodeFields(spec.fields, json, references, path, issues);\n }\n case \"map\": {\n if (!isPlainObject(json)) {\n return rejected(field, issues, path, `expected an object.`);\n }\n const decoded: Record<string, unknown> = {};\n for (const key of Object.keys(json).toSorted()) {\n // Defined, not assigned: a map key `__proto__` from a file stays an entry of the map.\n setOwnJsonProperty(\n decoded,\n key,\n decodeInto(spec.value, json[key] ?? null, references, indexPath(path, key), issues),\n );\n }\n return decoded;\n }\n case \"optional\": {\n return json === null ? null : decodeInto(spec.inner, json, references, path, issues);\n }\n case \"layerMask\": {\n if (!isArray(json)) {\n return rejected(field, issues, path, `expected an array of layer names.`);\n }\n const names: string[] = [];\n for (let index = 0; index < json.length; index += 1) {\n const name = json[index];\n if (typeof name !== \"string\") {\n return rejected(field, issues, indexPath(path, index), `expected a layer name string.`);\n }\n names.push(name);\n }\n return names;\n }\n case \"curve\": {\n if (!isPlainObject(json)) {\n return rejected(field, issues, path, `expected a curve object.`);\n }\n const keysAt = childPath(path, \"keys\");\n const rawKeys = json[\"keys\"];\n if (!isArray(rawKeys)) {\n return rejected(field, issues, keysAt, `expected an array of curve keys.`);\n }\n const keys: (readonly [number, number, number, number])[] = [];\n for (let index = 0; index < rawKeys.length; index += 1) {\n const key = rawKeys[index];\n if (!isArray(key) || key.length !== 4) {\n return rejected(field, issues, indexPath(keysAt, index), `expected [time, value, inTangent, outTangent].`);\n }\n const at = (slot: number): number => {\n const component = key[slot];\n return typeof component === \"number\" && Number.isFinite(component) ? canonicalizeNumber(component) : 0;\n };\n keys.push([at(0), at(1), at(2), at(3)]);\n }\n return { keys };\n }\n case \"custom\": {\n return spec.codec.deserialize(json);\n }\n default: {\n return assertNever(spec, \"schema field kind\");\n }\n }\n}\n\n/**\n * Reports unreadable JSON and yields the field's fresh default in its place.\n *\n * @param field - The field being decoded.\n * @param issues - The collector to append to.\n * @param path - The property path the problem was found at.\n * @param message - An actionable description.\n * @returns A newly built default value.\n *\n * @internal\n */\nfunction rejected(field: FieldDefinition<unknown>, issues: SchemaIssue[], path: string, message: string): unknown {\n issues.push(issue(SchemaIssueCode.typeMismatch, path, message));\n return field.createDefault();\n}\n\n/**\n * Decodes a JSON number array back into a channel object.\n *\n * @param names - The channel names to write, in encoded order.\n * @param field - The field being decoded, used for its default on failure.\n * @param json - The JSON to read.\n * @param path - The property path for reported issues.\n * @param issues - The collector to append to.\n * @returns The channel object, or the field's default.\n *\n * @internal\n */\nfunction decodeChannels(\n names: readonly string[],\n field: FieldDefinition<unknown>,\n json: JsonValue,\n path: string,\n issues: SchemaIssue[],\n): unknown {\n if (!isArray(json) || json.length !== names.length) {\n return rejected(field, issues, path, `expected an array of ${names.length} numbers.`);\n }\n const decoded: Record<string, number> = {};\n for (let index = 0; index < names.length; index += 1) {\n const component = json[index];\n const name = names[index];\n if (typeof component !== \"number\" || !Number.isFinite(component) || name === undefined) {\n return rejected(field, issues, indexPath(path, index), `expected a finite number.`);\n }\n decoded[name] = canonicalizeNumber(component);\n }\n return decoded;\n}\n\n/**\n * Decodes a tagged reference object back into a live target.\n *\n * @param field - The field being decoded, used for its default on failure.\n * @param json - The JSON to read.\n * @param tag - The tag property, `$entity` or `$component`.\n * @param resolve - How to turn a uid into a target.\n * @param path - The property path for reported issues.\n * @param issues - The collector to append to.\n * @returns The resolved target, or `null`.\n *\n * @internal\n */\nfunction decodeReference(\n field: FieldDefinition<unknown>,\n json: JsonValue,\n tag: \"$entity\" | \"$component\",\n resolve: (uid: string) => unknown,\n path: string,\n issues: SchemaIssue[],\n): unknown {\n if (json === null) {\n return null;\n }\n if (!isPlainObject(json) || typeof json[tag] !== \"string\") {\n return rejected(field, issues, path, `expected { \"${tag}\": \"<uid>\" } or null.`);\n }\n const uid = json[tag];\n const target = resolve(uid);\n if (target === null || target === undefined) {\n issues.push(issue(SchemaIssueCode.unresolvedReference, path, `no target in this file has uid \"${uid}\".`));\n return null;\n }\n return target;\n}\n\n/**\n * Decodes a JSON object against a schema, filling omitted fields with their defaults.\n *\n * @param schema - The schema to decode against.\n * @param json - The JSON object to read.\n * @param references - How to resolve uids back to entities and components.\n * @param path - The property path prefix for reported issues.\n * @param issues - The collector to append to.\n * @returns A record holding one value per declared field.\n *\n * @internal\n */\nfunction decodeFields(\n schema: Schema,\n json: JsonObject,\n references: ReferenceDecoder,\n path: string,\n issues: SchemaIssue[],\n): Record<string, unknown> {\n for (const name of Object.keys(json)) {\n if (!Object.hasOwn(schema, name)) {\n issues.push(\n issue(SchemaIssueCode.unknownField, childPath(path, name), `the schema declares no field \"${name}\".`),\n );\n }\n }\n const decoded: Record<string, unknown> = {};\n for (const [name, field] of Object.entries(schema)) {\n const raw = json[name];\n decoded[name] =\n raw === undefined ? field.createDefault() : decodeInto(field, raw, references, childPath(path, name), issues);\n }\n return decoded;\n}\n\n/**\n * Decodes one JSON value back into a field value. Decoding never throws and never returns a broken\n * value: unreadable JSON yields the field's freshly built default plus an issue, so a corrupt file\n * degrades one field rather than failing a whole scene\n * (`docs/architecture/06-serialization-and-scene-format.md` §4).\n *\n * @typeParam T - The field's value type.\n * @param field - The field to decode against.\n * @param json - The JSON to read.\n * @param references - How to resolve uids back to entities and components.\n * @returns The decoded value and every problem found.\n *\n * @example\n * ```ts\n * decodeValue(vec3(), [1, 2, 3], references); // { value: { x: 1, y: 2, z: 3 }, issues: [] }\n * ```\n *\n * @public\n */\nexport function decodeValue<T>(\n field: FieldDefinition<T>,\n json: JsonValue,\n references: ReferenceDecoder,\n): DecodeResult<T> {\n const issues: SchemaIssue[] = [];\n const value = decodeInto(field, json, references, \"\", issues);\n return { value: asFieldValue<T>(value), issues };\n}\n\n/**\n * Decodes a component's `props` object. Fields the file omits take their schema default; names the\n * schema does not declare are reported as `IGX-0607` and ignored.\n *\n * @typeParam S - The schema being decoded.\n * @param schema - The schema to decode against.\n * @param json - The `props` object read from the file.\n * @param references - How to resolve uids back to entities and components.\n * @returns The decoded field object and every problem found.\n *\n * @public\n */\nexport function decodeProps<S extends Schema>(\n schema: S,\n json: JsonObject,\n references: ReferenceDecoder,\n): DecodeResult<FieldsOf<S>> {\n const issues: SchemaIssue[] = [];\n const decoded = decodeFields(schema, json, references, \"\", issues);\n return { value: asFieldValue<FieldsOf<S>>(decoded), issues };\n}\n","import { assertNever } from \"../errors/ignifx-error.js\";\nimport { encodeValue } from \"./encode.js\";\nimport type { ReferenceEncoder } from \"./encode.js\";\nimport type { JsonObject, JsonValue } from \"./json.js\";\nimport type { FieldDefinition, FieldKind, FieldOptions, Schema } from \"./types.js\";\n\n/**\n * One field as the documentation harness and an external inspector see it (`scripts/README.md`,\n * \"Schema discovery convention\"; `docs/architecture/03-scripting-and-components.md` §3).\n *\n * Every member past `kind` is present only when the declaration states it: a field with no\n * `step` has no `step` here. The inspector members mirror {@link FieldOptions}; the others carry\n * what the field's kind declares: an enum's values, an asset's type, a nested field's own description.\n *\n * @public\n */\nexport interface SchemaFieldDescription {\n /** The field kind, for example `f32` or `asset`. */\n readonly kind: FieldKind;\n /** The field's default value, already encoded as JSON. */\n readonly default?: JsonValue;\n /** The field's tooltip, when it declares one. */\n readonly description?: string;\n /** `FieldOptions.min`: the lowest accepted value of a numeric field. */\n readonly min?: number;\n /** `FieldOptions.max`: the highest accepted value of a numeric field. */\n readonly max?: number;\n /**\n * `FieldOptions.step`: the increment of the inspector's drag and spinner controls; in degrees for\n * a `quat` field, which an inspector edits as Euler angles.\n */\n readonly step?: number;\n /** `FieldOptions.hidden`: the inspector leaves the field out; it is still saved. */\n readonly hidden?: boolean;\n /** `FieldOptions.readonly`: the inspector shows the field but does not let it be edited. */\n readonly readonly?: boolean;\n /** `FieldOptions.group`: the inspector group the field folds into. */\n readonly group?: string;\n /** `FieldOptions.transient`: the field is never saved and takes its default on load. */\n readonly transient?: boolean;\n /** An `enum` field's accepted values, in declaration order. */\n readonly values?: readonly string[];\n /**\n * An `asset` field's asset type name (`asset(TextureAsset)` → `\"texture\"`), the `type` an asset\n * reference to it carries. Absent when the asset token names no type.\n */\n readonly assetType?: string;\n /**\n * A `componentRef` field's accepted component, as its `typeId`, or `null` when the class it was\n * declared with carries no `typeId`. Present on every `componentRef` field.\n */\n readonly componentType?: string | null;\n /** An `array` field's element, described the same way. */\n readonly item?: SchemaFieldDescription;\n /** A `record` field's sub-fields, in declaration order, described the same way. */\n readonly fields?: Readonly<Record<string, SchemaFieldDescription>>;\n /** A `map` field's entry value, described the same way. */\n readonly value?: SchemaFieldDescription;\n /** An `optional` field's non-`null` value, described the same way. */\n readonly inner?: SchemaFieldDescription;\n}\n\n/**\n * One component schema as the documentation harness sees it. `pnpm docs:schemas` reads a record of\n * these, keyed by component `typeId`, from each built package's `schemas` export and turns it into\n * `references/formats/<format>.md` and `ignifx.schemas.json`.\n *\n * @public\n */\nexport interface SchemaDescription {\n /** The human-readable name, by default the last segment of the type id. */\n readonly title: string;\n /** The format page the entry is grouped onto; `components` unless overridden. */\n readonly format: string;\n /** A one-line summary of what the component does. */\n readonly description?: string;\n /** Every declared field, in declaration order. */\n readonly fields: Readonly<Record<string, SchemaFieldDescription>>;\n /**\n * Whether an entity may hold more than one of the component (`static allowMultiple`, `true` when\n * the class declares nothing). Set by {@link describeRegisteredSchemas}, or by the caller through\n * {@link SchemaDescriptionMeta}; absent on file formats.\n */\n readonly allowMultiple?: boolean;\n /**\n * Who registered the component: the extension's `name` (the npm package name, for example\n * `@ignifx/3d`), or, for a class the game registered itself, its type id's namespace (`mygame`).\n * Set by {@link describeRegisteredSchemas}, or by the caller through {@link SchemaDescriptionMeta}.\n */\n readonly package?: string;\n /**\n * `true` for the one component every entity carries itself, `ignifx/Transform`: it is never in a\n * scene file's `components` list, an editor cannot add or remove it, and its fields are the\n * entity record's `transform` block, edited whole (the editor protocol's `setTransform`), not\n * prop by prop. Absent on every other component and on file formats.\n */\n readonly builtIn?: boolean;\n /**\n * The components the class lists in `static requires`, as type ids (`null` for a class without a\n * `typeId`), in declaration order. `addComponent` adds each one that is missing, so an editor adds\n * them itself, and a scene file may list them in any order. A component on the entity whose class\n * extends a required class counts as present. Set by {@link describeRegisteredSchemas}, or by the\n * caller through {@link SchemaDescriptionMeta}; absent when the class requires nothing.\n */\n readonly requires?: readonly (string | null)[];\n}\n\n/**\n * Optional overrides for {@link describeSchema}.\n *\n * @public\n */\nexport interface SchemaDescriptionMeta {\n /** Overrides the title derived from the type id. */\n readonly title?: string;\n /** Overrides the default `components` grouping. */\n readonly format?: string;\n /** A one-line summary of what the component does. */\n readonly description?: string;\n /** Whether an entity may hold more than one of the component, copied onto the description. */\n readonly allowMultiple?: boolean;\n /** The package or extension that registered the component, copied onto the description. */\n readonly package?: string;\n /** Whether the component is the entity's own built-in block, copied onto the description. */\n readonly builtIn?: boolean;\n /** The type ids of the components the class requires, copied onto the description. */\n readonly requires?: readonly (string | null)[];\n}\n\n/**\n * A JSON Schema fragment. Kept as a plain JSON object because the generated document is assembled\n * — and validated — by the documentation harness, not by this module\n * (`docs/architecture/06-serialization-and-scene-format.md` §8).\n *\n * @public\n */\nexport type JsonSchemaObject = JsonObject;\n\n/**\n * Resolves references to nothing. Describing a schema means describing its *defaults*, and a\n * reference field's default is always `null`, so no world is needed.\n *\n * @returns An encoder that resolves every reference to `null`.\n *\n * @internal\n */\nfunction noReferences(): ReferenceEncoder {\n return { entityUid: () => null, componentUid: () => null };\n}\n\n/**\n * Builds the JSON Schema fragment for one field, at any depth: its encoded form plus an\n * `x-ignifx-*` keyword for each inspector option it declares. JSON Schema validators ignore\n * keywords they do not know, and the `x-` prefix keeps these clear of any future standard one.\n *\n * @param field - The field to describe.\n * @returns The fragment.\n *\n * @internal\n */\nfunction fieldJsonSchema(field: FieldDefinition<unknown>): JsonSchemaObject {\n const fragment: Record<string, JsonValue> = { ...kindJsonSchema(field) };\n const { step, hidden, readonly, group, transient } = field.options;\n if (step !== undefined) {\n fragment[\"x-ignifx-step\"] = step;\n }\n if (hidden !== undefined) {\n fragment[\"x-ignifx-hidden\"] = hidden;\n }\n if (readonly !== undefined) {\n fragment[\"x-ignifx-readonly\"] = readonly;\n // `readOnly` is the standard annotation generic JSON Schema tools already understand.\n if (readonly) {\n fragment[\"readOnly\"] = true;\n }\n }\n if (group !== undefined) {\n fragment[\"x-ignifx-group\"] = group;\n }\n if (transient !== undefined) {\n fragment[\"x-ignifx-transient\"] = transient;\n }\n return fragment;\n}\n\n/**\n * Builds the JSON Schema fragment for one field's encoded form.\n *\n * @param field - The field to describe.\n * @returns The fragment describing the field's encoded form.\n *\n * @internal\n */\nfunction kindJsonSchema(field: FieldDefinition<unknown>): JsonSchemaObject {\n const { spec } = field;\n switch (spec.kind) {\n case \"f32\":\n case \"f64\": {\n return { type: \"number\" };\n }\n case \"i32\": {\n return { type: \"integer\", minimum: -2147483648, maximum: 2147483647 };\n }\n case \"u32\": {\n return { type: \"integer\", minimum: 0, maximum: 4294967295 };\n }\n case \"bool\": {\n return { type: \"boolean\" };\n }\n case \"str\": {\n return { type: \"string\" };\n }\n case \"vec2\":\n case \"vec3\":\n case \"vec4\":\n case \"quat\": {\n return { type: \"array\", items: { type: \"number\" }, minItems: spec.components, maxItems: spec.components };\n }\n case \"color\": {\n return {\n type: \"array\",\n items: { type: \"number\", minimum: 0, maximum: 1 },\n minItems: 4,\n maxItems: 4,\n };\n }\n case \"enum\": {\n return { type: \"string\", enum: [...spec.values] };\n }\n case \"entityRef\": {\n return taggedReferenceSchema(\"$entity\");\n }\n case \"componentRef\": {\n const typeId = spec.componentType.typeId;\n return {\n ...taggedReferenceSchema(\"$component\"),\n ...(typeId === undefined ? {} : { \"x-ignifx-component-type\": typeId }),\n };\n }\n case \"asset\": {\n return {\n oneOf: [\n {\n type: \"object\",\n properties: { $asset: { type: \"string\" }, type: { type: \"string\" } },\n required: [\"$asset\"],\n additionalProperties: false,\n },\n { type: \"null\" },\n ],\n ...(spec.typeName === null ? {} : { \"x-ignifx-asset-type\": spec.typeName }),\n };\n }\n case \"array\": {\n return { type: \"array\", items: fieldJsonSchema(spec.item) };\n }\n case \"record\": {\n return schemaJsonSchema(spec.fields);\n }\n case \"map\": {\n return { type: \"object\", additionalProperties: fieldJsonSchema(spec.value) };\n }\n case \"optional\": {\n return { oneOf: [fieldJsonSchema(spec.inner), { type: \"null\" }] };\n }\n case \"layerMask\": {\n return { type: \"array\", items: { type: \"string\" } };\n }\n case \"curve\": {\n return {\n type: \"object\",\n properties: {\n keys: {\n type: \"array\",\n items: { type: \"array\", items: { type: \"number\" }, minItems: 4, maxItems: 4 },\n },\n },\n required: [\"keys\"],\n additionalProperties: false,\n };\n }\n case \"custom\": {\n return spec.codec.jsonSchema ?? {};\n }\n default: {\n return assertNever(spec, \"schema field kind\");\n }\n }\n}\n\n/**\n * Builds the fragment for a tagged reference: an object carrying one uid property, or `null`.\n *\n * @param tag - The tag property, `$entity` or `$component`.\n * @returns The fragment.\n *\n * @internal\n */\nfunction taggedReferenceSchema(tag: \"$entity\" | \"$component\"): JsonSchemaObject {\n return {\n oneOf: [\n {\n type: \"object\",\n properties: { [tag]: { type: \"string\" } },\n required: [tag],\n additionalProperties: false,\n },\n { type: \"null\" },\n ],\n };\n}\n\n/**\n * Decorates a field's fragment with the metadata the inspector and the docs already carry.\n *\n * @param field - The field to describe.\n * @returns The fragment plus `default`, `description`, and numeric bounds where they apply.\n *\n * @internal\n */\nfunction annotatedFieldJsonSchema(field: FieldDefinition<unknown>): JsonSchemaObject {\n const base: Record<string, JsonValue> = { ...fieldJsonSchema(field) };\n const { tooltip, min, max } = field.options;\n if (tooltip !== undefined) {\n base[\"description\"] = tooltip;\n }\n if (min !== undefined) {\n base[\"minimum\"] = min;\n }\n if (max !== undefined) {\n base[\"maximum\"] = max;\n }\n base[\"default\"] = encodeValue(field, field.createDefault(), noReferences());\n return base;\n}\n\n/**\n * Builds the object fragment for a whole schema.\n *\n * @param schema - The schema to describe.\n * @returns The fragment.\n *\n * @internal\n */\nfunction schemaJsonSchema(schema: Schema): JsonSchemaObject {\n const properties: Record<string, JsonValue> = {};\n for (const [name, field] of Object.entries(schema)) {\n properties[name] = annotatedFieldJsonSchema(field);\n }\n // Every prop is optional: a file omits a prop that equals its default\n // (docs/architecture/06-serialization-and-scene-format.md §2), so there is no `required` list.\n return { type: \"object\", properties, additionalProperties: false };\n}\n\n/**\n * Describes a component schema in the shape the documentation harness and an external inspector\n * consume. A package exports a record of these keyed by `typeId`; `pnpm docs:schemas` reads it from\n * the built entry point and regenerates the format pages and `ignifx.schemas.json` from it\n * (`scripts/README.md`, `docs/architecture/16-docs-harness-and-skill.md` §3). Each field carries\n * its inspector options and what its kind declares ({@link SchemaFieldDescription}); to describe\n * an app's registered components with `allowMultiple` and `package` filled in, use\n * {@link describeRegisteredSchemas}.\n *\n * @param typeId - The component's namespaced registration id, for example `mygame/Mover`.\n * @param schema - The component's declared fields.\n * @param meta - Overrides for the title, format grouping, and summary, and the component's\n * `allowMultiple`, `package`, `builtIn` and `requires` when the caller knows them.\n * @returns The description entry.\n *\n * @example\n * ```ts\n * export const schemas = {\n * \"mygame/Mover\": describeSchema(\"mygame/Mover\", moverSchema, { description: \"Moves an entity.\" }),\n * };\n * ```\n *\n * @public\n */\nexport function describeSchema(typeId: string, schema: Schema, meta?: SchemaDescriptionMeta): SchemaDescription {\n const derivedTitle = typeId.slice(typeId.lastIndexOf(\"/\") + 1);\n return {\n title: meta?.title ?? derivedTitle,\n format: meta?.format ?? \"components\",\n ...(meta?.description === undefined ? {} : { description: meta.description }),\n fields: describeFields(schema, noReferences()),\n ...(meta?.allowMultiple === undefined ? {} : { allowMultiple: meta.allowMultiple }),\n ...(meta?.package === undefined ? {} : { package: meta.package }),\n ...(meta?.builtIn === undefined ? {} : { builtIn: meta.builtIn }),\n ...(meta?.requires === undefined ? {} : { requires: meta.requires }),\n };\n}\n\n/**\n * Describes every field of a schema, in declaration order.\n *\n * @param schema - The fields.\n * @param references - The encoder for the defaults.\n * @returns The descriptions, keyed by field name.\n *\n * @internal\n */\nfunction describeFields(schema: Schema, references: ReferenceEncoder): Record<string, SchemaFieldDescription> {\n const fields: Record<string, SchemaFieldDescription> = {};\n for (const [name, field] of Object.entries(schema)) {\n fields[name] = describeField(field, references);\n }\n return fields;\n}\n\n/**\n * Describes one field: its kind, default and tooltip, its inspector options, and what its kind\n * declares, recursing into nested fields.\n *\n * @param field - The field.\n * @param references - The encoder for the default.\n * @returns The description.\n *\n * @internal\n */\nfunction describeField(field: FieldDefinition<unknown>, references: ReferenceEncoder): SchemaFieldDescription {\n const { tooltip } = field.options;\n return {\n kind: field.kind,\n default: encodeValue(field, field.createDefault(), references),\n ...(tooltip === undefined ? {} : { description: tooltip }),\n ...describeOptions(field.options),\n ...describeKind(field, references),\n };\n}\n\n/**\n * Copies the inspector options a field declares.\n *\n * @param options - The field's options.\n * @returns Only the declared options.\n *\n * @internal\n */\nfunction describeOptions(options: FieldOptions): Partial<SchemaFieldDescription> {\n const { min, max, step, hidden, readonly, group, transient } = options;\n return {\n ...(min === undefined ? {} : { min }),\n ...(max === undefined ? {} : { max }),\n ...(step === undefined ? {} : { step }),\n ...(hidden === undefined ? {} : { hidden }),\n ...(readonly === undefined ? {} : { readonly }),\n ...(group === undefined ? {} : { group }),\n ...(transient === undefined ? {} : { transient }),\n };\n}\n\n/**\n * Describes what a field's kind declares beyond the kind itself.\n *\n * @param field - The field.\n * @param references - The encoder for nested defaults.\n * @returns The kind's members; empty for a kind that declares nothing more.\n *\n * @internal\n */\nfunction describeKind(field: FieldDefinition<unknown>, references: ReferenceEncoder): Partial<SchemaFieldDescription> {\n const { spec } = field;\n switch (spec.kind) {\n case \"enum\": {\n return { values: [...spec.values] };\n }\n case \"asset\": {\n return spec.typeName === null ? {} : { assetType: spec.typeName };\n }\n case \"componentRef\": {\n return { componentType: spec.componentType.typeId ?? null };\n }\n case \"array\": {\n return { item: describeField(spec.item, references) };\n }\n case \"record\": {\n return { fields: describeFields(spec.fields, references) };\n }\n case \"map\": {\n return { value: describeField(spec.value, references) };\n }\n case \"optional\": {\n return { inner: describeField(spec.inner, references) };\n }\n case \"f32\":\n case \"f64\":\n case \"i32\":\n case \"u32\":\n case \"bool\":\n case \"str\":\n case \"vec2\":\n case \"vec3\":\n case \"vec4\":\n case \"quat\":\n case \"color\":\n case \"entityRef\":\n case \"layerMask\":\n case \"curve\":\n case \"custom\": {\n return {};\n }\n default: {\n return assertNever(spec, \"schema field kind\");\n }\n }\n}\n\n/**\n * Generates the JSON Schema (draft 2020-12) for a component's `props` object. The harness and the\n * Vite plugin assemble these into `ignifx.schemas.json`, which drives build-time validation and\n * editor autocompletion (`docs/architecture/06-serialization-and-scene-format.md` §8).\n *\n * @param schema - The schema to convert.\n * @returns The object fragment describing every declared prop.\n *\n * @public\n */\nexport function toJsonSchema(schema: Schema): JsonSchemaObject {\n return schemaJsonSchema(schema);\n}\n","import { toJsonSchema } from \"../schema/describe.js\";\nimport type { ComponentRegistry } from \"../component/component-registry.js\";\nimport type { SchemaDescription } from \"../schema/describe.js\";\nimport type { JsonObject, JsonValue } from \"../schema/json.js\";\n\n/**\n * The `format` discriminator every scene and prefab file carries\n * (`docs/architecture/06-serialization-and-scene-format.md` §2). Levels (`*.scene.json`) and\n * prefabs (`*.prefab.json`) share it: a prefab is a scene instanced inside another scene\n * (ADR-0005), not a second file type.\n *\n * @public\n */\nexport const SCENE_FILE_FORMAT = \"ignifx.scene\";\n\n/**\n * The `formatVersion` this build writes and is the only one it can read. Before 1.0 the number\n * stays `1` and an incompatible change invalidates files rather than migrating them\n * (`CONSTITUTION.md` §4.2); a file declaring anything else is rejected with `IGX-0603`.\n *\n * @public\n */\nexport const SCENE_FORMAT_VERSION = 1;\n\n/**\n * The file extensions the scene loader claims.\n *\n * @public\n */\nexport const SCENE_FILE_EXTENSIONS: readonly string[] = Object.freeze([\".scene.json\", \".prefab.json\"]);\n\n/**\n * The asset type name the scene loader registers under.\n *\n * @public\n */\nexport const SCENE_ASSET_TYPE = \"scene\";\n\n/**\n * A serialized asset reference: `{ \"$asset\": \"<address>\", \"type\"?: \"<type>\" }`\n * (`docs/architecture/06-serialization-and-scene-format.md` §3).\n *\n * @public\n */\nexport interface SceneFileAssetRef {\n /** The address the asset is registered under. */\n readonly $asset: string;\n /** The asset type name, written only when the address extension does not identify it. */\n readonly type?: string;\n}\n\n/**\n * An entity's local transform, always present in the file and always three plain number arrays\n * (`docs/architecture/06-serialization-and-scene-format.md` §2).\n *\n * @remarks\n * The values are **local** — relative to `parent` — because the file already stores the tree and\n * local values are the ones that survive a parent being moved. The document says only \"arrays\n * `[x, y, z]`, `[x, y, z, w]`, `[x, y, z]`\"; this is the reading that round trips.\n *\n * @public\n */\nexport interface SceneFileTransform {\n /** Local position, `[x, y, z]`, in metres. */\n readonly position: readonly [number, number, number];\n /** Local rotation quaternion, `[x, y, z, w]`. */\n readonly rotation: readonly [number, number, number, number];\n /** Local scale, `[x, y, z]`. */\n readonly scale: readonly [number, number, number];\n}\n\n/**\n * One component of one entity.\n *\n * @public\n */\nexport interface SceneFileComponent {\n /** ULID, unique within the file. */\n readonly uid: string;\n /** The component class's registered `typeId`. */\n readonly type: string;\n /** Omitted when `true`, the default. */\n readonly enabled?: boolean;\n /** Written only when the class's `schemaVersion` differs from `1` (§7). */\n readonly schemaVersion?: number;\n /** Values in the component schema's declaration order (§3). */\n readonly props?: JsonObject;\n}\n\n/**\n * One override patch applied to an instanced scene, addressed by the *instanced* file's uids\n * (`docs/architecture/06-serialization-and-scene-format.md` §2).\n *\n * @remarks\n * `op` defaults to `\"replace\"`, which is why the common case is the two-key\n * `{ path, value }` object shown in the format document.\n *\n * @public\n */\nexport interface SceneFileOverride {\n /** `\"replace\"` (the default) patches a value, `\"remove\"` deletes a component, `\"add\"` appends one. */\n readonly op?: \"replace\" | \"remove\" | \"add\";\n /** The path into the instanced file; see {@link parseOverridePath}. */\n readonly path: string;\n /** The new value, for `\"replace\"` and `\"add\"`. */\n readonly value?: JsonValue;\n}\n\n/**\n * The `instance` entry that turns an entity into the root of an instanced scene — what other\n * engines call a prefab instance (ADR-0005).\n *\n * @remarks\n * When the instanced scene has exactly one root, the entity carrying the entry _is_ that root, as\n * with `world.instantiate`: it gets the root's components, then its own, and keeps its own uid,\n * name, and transform. A scene with several roots is expanded under the entity instead\n * (`docs/architecture/06-serialization-and-scene-format.md` §2).\n *\n * @public\n */\nexport interface SceneFileInstance {\n /** The scene asset to instance. */\n readonly scene: SceneFileAssetRef;\n /** The content hash of that asset at save time; a mismatch reports `IGX-0604`. */\n readonly hash?: string;\n /** The patches applied to the instanced entities, in order. */\n readonly overrides?: readonly SceneFileOverride[];\n}\n\n/**\n * One entity of a scene file. Entities appear in tree order — parents before children, siblings in\n * `children` order — and `parent` names the uid of the parent, or `null` for a root.\n *\n * @public\n */\nexport interface SceneFileEntity {\n /** ULID, unique within the file. */\n readonly uid: string;\n /** The display name. */\n readonly name: string;\n /** The parent's uid, or `null` for a root. */\n readonly parent: string | null;\n /** Omitted when `true`, the default. */\n readonly active?: boolean;\n /** Omitted when `false`, the default. */\n readonly static?: boolean;\n /** The layer **name**, omitted when `\"Default\"`. Names, never indices, so reordering is safe. */\n readonly layer?: string;\n /** The tags, omitted when empty. */\n readonly tags?: readonly string[];\n /** Always present. */\n readonly transform: SceneFileTransform;\n /** Present only on instance roots. */\n readonly instance?: SceneFileInstance;\n /** The entity's own components; on an instance root, the ones added on top of the instance. */\n readonly components?: readonly SceneFileComponent[];\n}\n\n/**\n * A whole scene or prefab file (`docs/architecture/06-serialization-and-scene-format.md` §2).\n *\n * @example\n * ```ts\n * const file = serializeScene(world.activeScene);\n * await app.storage.write(\"save.scene.json\", stringifySceneFile(file));\n * ```\n *\n * @public\n */\nexport interface SceneFile {\n /** Always {@link SCENE_FILE_FORMAT}. */\n readonly format: string;\n /** Always {@link SCENE_FORMAT_VERSION} for files this build writes. */\n readonly formatVersion: number;\n /** The `@ignifx/core` version that wrote the file; informational. */\n readonly engineVersion?: string;\n /** The scene's name. */\n readonly name: string;\n /** Scene-level values interpreted by systems (environment, clear colour, physics overrides). */\n readonly settings?: JsonObject;\n /** Every entity, in tree order. */\n readonly entities: readonly SceneFileEntity[];\n}\n\n/**\n * Writes a scene file as the canonical UTF-8 JSON text: two-space indentation, keys in the order\n * the serializer built them, numbers already canonicalized by\n * {@link canonicalizeNumber}. Two saves of the same state produce byte-identical text\n * (`docs/architecture/06-serialization-and-scene-format.md` §1).\n *\n * @param file - The file object, normally from `serializeScene`.\n * @returns The JSON text, without a trailing newline.\n *\n * @example\n * ```ts\n * stringifySceneFile(serializeScene(instance)) === stringifySceneFile(serializeScene(instance));\n * ```\n *\n * @public\n */\nexport function stringifySceneFile(file: SceneFile): string {\n return JSON.stringify(file, null, 2);\n}\n\n/**\n * Reports whether a parsed JSON value carries the `ignifx.scene` header. It is the cheap check the\n * loader runs before anything else, so a `.json` asset handed to the wrong loader fails with\n * `IGX-0308` rather than a confusing field error.\n *\n * @param value - The parsed JSON.\n * @returns `true` when the value is an object whose `format` is {@link SCENE_FILE_FORMAT}.\n *\n * @public\n */\nexport function isSceneFileHeader(value: unknown): boolean {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return false;\n }\n // The three lines above have established that the\n // value is a non-null, non-array object, which is exactly a string-keyed bag.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const object = value as Record<string, unknown>;\n return object[\"format\"] === SCENE_FILE_FORMAT;\n}\n\n/**\n * The draft 2020-12 JSON Schema for a scene file, with `components[].props` narrowed per registered\n * component `typeId` (`docs/architecture/06-serialization-and-scene-format.md` §8). The Vite plugin\n * and the `ignifx schemas` CLI command emit this into `ignifx.schemas.json`, which drives\n * build-time validation and editor autocompletion.\n *\n * @param registry - The component table whose registered classes narrow `props`. Classes without a\n * schema contribute a `type` match with a free-form `props` object.\n * @returns The schema document.\n *\n * @example\n * ```ts\n * const schema = sceneFileJsonSchema(app.world.registry);\n * await writeFile(\"ignifx.schemas.json\", JSON.stringify(schema, null, 2));\n * ```\n *\n * @public\n */\nexport function sceneFileJsonSchema(registry: ComponentRegistry): JsonObject {\n return {\n $schema: \"https://json-schema.org/draft/2020-12/schema\",\n $id: \"https://ignifx.com/schemas/ignifx.scene.v1.json\",\n title: \"ignifx scene file\",\n type: \"object\",\n required: [\"format\", \"formatVersion\", \"name\", \"entities\"],\n additionalProperties: false,\n properties: {\n format: { const: SCENE_FILE_FORMAT },\n formatVersion: { const: SCENE_FORMAT_VERSION },\n engineVersion: { type: \"string\" },\n name: { type: \"string\" },\n settings: { type: \"object\" },\n entities: { type: \"array\", items: { $ref: \"#/$defs/entity\" } },\n },\n $defs: {\n uid: { type: \"string\", minLength: 1 },\n assetRef: {\n type: \"object\",\n required: [\"$asset\"],\n additionalProperties: false,\n properties: { $asset: { type: \"string\" }, type: { type: \"string\" } },\n },\n transform: {\n type: \"object\",\n required: [\"position\", \"rotation\", \"scale\"],\n additionalProperties: false,\n properties: {\n position: numberTuple(3),\n rotation: numberTuple(4),\n scale: numberTuple(3),\n },\n },\n override: {\n type: \"object\",\n required: [\"path\"],\n additionalProperties: false,\n properties: {\n op: { type: \"string\", enum: [\"replace\", \"remove\", \"add\"] },\n path: { type: \"string\", minLength: 1 },\n value: true,\n },\n },\n instance: {\n type: \"object\",\n required: [\"scene\"],\n additionalProperties: false,\n properties: {\n scene: { $ref: \"#/$defs/assetRef\" },\n hash: { type: \"string\" },\n overrides: { type: \"array\", items: { $ref: \"#/$defs/override\" } },\n },\n },\n component: {\n type: \"object\",\n required: [\"uid\", \"type\"],\n additionalProperties: false,\n properties: {\n uid: { $ref: \"#/$defs/uid\" },\n type: { type: \"string\", minLength: 1 },\n enabled: { type: \"boolean\" },\n schemaVersion: { type: \"integer\", minimum: 1 },\n props: { type: \"object\" },\n },\n allOf: componentPropsBranches(registry),\n },\n entity: {\n type: \"object\",\n required: [\"uid\", \"name\", \"parent\", \"transform\"],\n additionalProperties: false,\n properties: {\n uid: { $ref: \"#/$defs/uid\" },\n name: { type: \"string\" },\n parent: { anyOf: [{ $ref: \"#/$defs/uid\" }, { type: \"null\" }] },\n active: { type: \"boolean\" },\n static: { type: \"boolean\" },\n layer: { type: \"string\" },\n tags: { type: \"array\", items: { type: \"string\" } },\n transform: { $ref: \"#/$defs/transform\" },\n instance: { $ref: \"#/$defs/instance\" },\n components: { type: \"array\", items: { $ref: \"#/$defs/component\" } },\n },\n },\n },\n };\n}\n\n/**\n * The docs-harness description of the scene file format\n * (`scripts/README.md`, \"Schema discovery convention\"), so `pnpm docs:schemas` can render\n * `references/formats/scene.md` beside the component pages.\n *\n * @returns The description of the top-level file fields.\n *\n * @public\n */\nexport function describeSceneFileFormat(): SchemaDescription {\n return {\n title: \"Scene file\",\n format: SCENE_FILE_FORMAT,\n description:\n \"A level or a prefab: a tree of entities with components, instanced scenes, and overrides. One format for both (ADR-0005).\",\n fields: {\n format: { kind: \"str\", default: SCENE_FILE_FORMAT, description: 'Always \"ignifx.scene\".' },\n formatVersion: {\n kind: \"u32\",\n default: SCENE_FORMAT_VERSION,\n description: \"The file format version; 1 before ignifx 1.0.\",\n },\n engineVersion: { kind: \"str\", default: \"\", description: \"The @ignifx/core version that wrote the file.\" },\n name: { kind: \"str\", default: \"\", description: \"The scene's name.\" },\n settings: { kind: \"map\", default: {}, description: \"Scene-level values interpreted by systems.\" },\n entities: { kind: \"array\", default: [], description: \"Every entity, in tree order.\" },\n },\n };\n}\n\n/**\n * A fixed-length JSON Schema array of numbers.\n *\n * @param length - How many entries.\n * @returns The fragment.\n */\nfunction numberTuple(length: number): JsonObject {\n return { type: \"array\", items: { type: \"number\" }, minItems: length, maxItems: length };\n}\n\n/**\n * One `if`/`then` branch per registered component `typeId`, narrowing `props` to that class's\n * generated schema.\n *\n * @param registry - The component table.\n * @returns The branches, in `typeId` order so the document is stable.\n */\nfunction componentPropsBranches(registry: ComponentRegistry): readonly JsonValue[] {\n const branches: JsonValue[] = [];\n const entries: { readonly typeId: string; readonly props: JsonObject }[] = [];\n const registrations = registry.registrations();\n for (let index = 0; index < registrations.length; index += 1) {\n const registration = registrations[index];\n if (registration === undefined) {\n continue;\n }\n const [typeId, type] = registration;\n const schema = registry.describe(type).schema;\n if (schema === null) {\n continue;\n }\n entries.push({ typeId, props: toJsonSchema(schema) });\n }\n entries.sort((left, right) => (left.typeId < right.typeId ? -1 : left.typeId > right.typeId ? 1 : 0));\n for (let index = 0; index < entries.length; index += 1) {\n const entry = entries[index];\n if (entry === undefined) {\n continue;\n }\n branches.push({\n if: { properties: { type: { const: entry.typeId } }, required: [\"type\"] },\n // `then` is JSON Schema's conditional keyword here, not a promise method; the object never\n // reaches an `await`, it is serialized into the schema document.\n // oxlint-disable-next-line unicorn/no-thenable\n then: { properties: { props: entry.props } },\n });\n }\n return branches;\n}\n","import { CoreErrorCode } from \"../errors/error-codes.js\";\nimport { IgnifxError } from \"../errors/ignifx-error.js\";\nimport { stringifySceneFile, SCENE_ASSET_TYPE } from \"./scene-file.js\";\nimport type { SceneFile } from \"./scene-file.js\";\nimport type { AssetHandle } from \"../assets/types.js\";\nimport type { AssetTypeToken } from \"../schema/types.js\";\n\n/**\n * What the scene loader produces for a `*.scene.json` or `*.prefab.json` address: the parsed file,\n * every asset it pulled in, and the content hash instance overrides are recorded against\n * (`docs/architecture/05-assets-and-loading.md` §2, `06-serialization-and-scene-format.md` §2).\n *\n * @remarks\n * The handles are already loaded and retained by the asset. That is what lets\n * `world.instantiate(sceneAsset)` be synchronous: everything the file references — textures,\n * materials, and the scene assets its `instance` entries name — is in memory by the time the\n * `SceneAsset` exists (`02-scene-graph.md` §2).\n *\n * @public\n */\nexport interface SceneAsset {\n /** The address the asset was loaded from. */\n readonly address: string;\n /** The parsed, validated file. */\n readonly file: SceneFile;\n /** Every asset the file references, already loaded, in resolution order. */\n readonly dependencies: readonly AssetHandle[];\n /** The content hash of {@link SceneAsset.file}, as `sha256:<hex>`. */\n readonly hash: string;\n}\n\n/**\n * The `asset()` token for a scene or prefab field. `SceneAsset` is an interface, so it cannot be\n * passed to `asset()` the way a class such as `MeshAsset` can; this token names the type instead:\n *\n * ```ts\n * class Spawner extends Script.define({ prefab: asset(SceneAssetToken) }) {\n * static typeId = \"game/Spawner\";\n * spawn(): void {\n * const value = this.prefab?.value;\n * if (value !== undefined) {\n * this.app.world.instantiate(value, { position: this.transform.position });\n * }\n * }\n * }\n * ```\n *\n * In a scene file the field is written as `{ \"$asset\": \"props/crate.prefab.json\" }`.\n *\n * @public\n */\nexport const SceneAssetToken: AssetTypeToken<SceneAsset> = Object.freeze({ assetType: SCENE_ASSET_TYPE });\n\n/** The hash algorithm and the prefix it is written under. */\nconst HASH_ALGORITHM = \"SHA-256\";\n\n/** The prefix `instance.hash` values carry. */\nconst HASH_PREFIX = \"sha256:\";\n\n/**\n * The content hash of a scene file: SHA-256 over the canonical JSON text, so two saves of the same\n * state hash the same and an edited prefab does not\n * (`docs/architecture/06-serialization-and-scene-format.md` §2).\n *\n * @param file - The file to hash.\n * @returns The hash as `sha256:<64 lowercase hex digits>`.\n * @throws IgnifxError with code `IGX-1420` when the host exposes no Web Crypto `subtle`.\n *\n * @example\n * ```ts\n * const hash = await computeSceneHash(serializeScene(instance)); // \"sha256:9f2c…\"\n * ```\n *\n * @public\n */\nexport async function computeSceneHash(file: SceneFile): Promise<string> {\n // The DOM lib declares `globalThis.crypto` as always present. Node before 19, workers without a\n // secure context, and locked-down embedders do not have `subtle`, so the assertion models the\n // absence the types deny (coding standards §5.2).\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const webCrypto = globalThis.crypto as Crypto | undefined;\n const subtle: SubtleCrypto | undefined = webCrypto?.subtle;\n if (subtle === undefined || typeof subtle.digest !== \"function\") {\n throw new IgnifxError(CoreErrorCode.cryptoUnavailable, \"This host does not expose Web Crypto subtle.\", {\n context: { file: file.name },\n hint: \"Scene content hashes need crypto.subtle; run on a secure context or Node 19+.\",\n });\n }\n const bytes = new TextEncoder().encode(stringifySceneFile(file));\n const digest = await subtle.digest(HASH_ALGORITHM, bytes);\n return HASH_PREFIX + toHex(new Uint8Array(digest));\n}\n\n/**\n * Builds a `SceneAsset` from a file that is already in memory — the shape the loader returns, and\n * the one tests and tools use when there is no asset service in play.\n *\n * @param address - The address the asset stands at.\n * @param file - The parsed file.\n * @param dependencies - Every asset the file references, already loaded.\n * @returns The asset, with its content hash computed.\n *\n * @example\n * ```ts\n * const prefab = await createSceneAsset(\"prefabs/enemy.prefab.json\", enemyFile, []);\n * ```\n *\n * @public\n */\nexport async function createSceneAsset(\n address: string,\n file: SceneFile,\n dependencies: readonly AssetHandle[] = [],\n): Promise<SceneAsset> {\n return { address, file, dependencies, hash: await computeSceneHash(file) };\n}\n\n/**\n * Finds the loaded scene asset an `instance.scene` reference names, among a scene's dependencies.\n *\n * @param asset - The scene whose `instance` entry is being expanded.\n * @param address - The address the reference carries.\n * @returns The dependency handle and its value, or `null` when nothing loaded stands at that\n * address.\n *\n * @internal\n */\nexport function findSceneDependency(\n asset: SceneAsset,\n address: string,\n): { readonly handle: AssetHandle<SceneAsset>; readonly value: SceneAsset } | null {\n const dependencies = asset.dependencies;\n for (let index = 0; index < dependencies.length; index += 1) {\n const handle = dependencies[index];\n if (handle === undefined || handle.address !== address || handle.state !== \"loaded\") {\n continue;\n }\n const value: unknown = handle.value;\n if (!isSceneAsset(value)) {\n continue;\n }\n // Boundary assertion (coding standards §5.2): `isSceneAsset` has just established the shape,\n // and `AssetHandle<T>` differs from `AssetHandle` only in the type of `value`.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return { handle: handle as AssetHandle<SceneAsset>, value };\n }\n return null;\n}\n\n/**\n * Reports whether a loaded asset value is a scene.\n *\n * @param value - The handle's value.\n * @returns `true` when the value carries a scene file and a hash.\n *\n * @internal\n */\nexport function isSceneAsset(value: unknown): value is SceneAsset {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const file: unknown = Reflect.get(value, \"file\");\n return typeof Reflect.get(value, \"hash\") === \"string\" && typeof file === \"object\" && file !== null;\n}\n\n/** Lowercase hexadecimal digits, indexed by nibble. */\nconst HEX_DIGITS = \"0123456789abcdef\";\n\n/**\n * Formats bytes as lowercase hexadecimal.\n *\n * @param bytes - The digest.\n * @returns The hex string.\n */\nfunction toHex(bytes: Uint8Array): string {\n let text = \"\";\n for (let index = 0; index < bytes.length; index += 1) {\n const byte = bytes[index] ?? 0;\n text += (HEX_DIGITS[byte >> 4] ?? \"0\") + (HEX_DIGITS[byte & 0xf] ?? \"0\");\n }\n return text;\n}\n","import { CoreErrorCode } from \"../errors/error-codes.js\";\nimport { IgnifxError } from \"../errors/ignifx-error.js\";\nimport { setOwnJsonProperty } from \"../schema/json.js\";\nimport { asJsonArray, asJsonObject } from \"./json-view.js\";\nimport type { SceneFileComponent, SceneFileEntity, SceneFileOverride, SceneFileTransform } from \"./scene-file.js\";\nimport type { JsonObject, JsonValue } from \"../schema/json.js\";\n\n/**\n * The parsed form of an instance override `path`\n * (`docs/architecture/06-serialization-and-scene-format.md` §2). Every path starts with the uid of\n * an entity **of the instanced file**, so a path survives the per-instance uid remap\n * (`02-scene-graph.md` §10).\n *\n * The grammar, in the order the parser tries it:\n *\n * ```text\n * <uid> → entity (whole entity, \"remove\" only)\n * <uid>/name | active | static | layer | tags → entityField\n * <uid>/transform/position | rotation | scale → transform\n * <uid>/components → componentList (\"add\" only)\n * <uid>/components/<uid> → component (\"remove\" only)\n * <uid>/components/<uid>/enabled → componentField\n * <uid>/components/<uid>/props/<field>[/<key>…] → prop\n * ```\n *\n * @public\n */\nexport type OverridePath =\n | { readonly kind: \"entity\"; readonly entity: string }\n | { readonly kind: \"entityField\"; readonly entity: string; readonly field: EntityOverrideField }\n | { readonly kind: \"transform\"; readonly entity: string; readonly channel: keyof SceneFileTransform }\n | { readonly kind: \"componentList\"; readonly entity: string }\n | { readonly kind: \"component\"; readonly entity: string; readonly component: string }\n | { readonly kind: \"componentField\"; readonly entity: string; readonly component: string }\n | {\n readonly kind: \"prop\";\n readonly entity: string;\n readonly component: string;\n readonly steps: readonly string[];\n };\n\n/**\n * The entity properties an override may patch directly.\n *\n * @public\n */\nexport type EntityOverrideField = \"name\" | \"active\" | \"static\" | \"layer\" | \"tags\";\n\n/** The entity fields the grammar accepts, as an `as const` table so the union derives from it. */\nconst ENTITY_FIELDS: readonly EntityOverrideField[] = Object.freeze([\"name\", \"active\", \"static\", \"layer\", \"tags\"]);\n\n/** The transform channels the grammar accepts. */\nconst TRANSFORM_CHANNELS: readonly (keyof SceneFileTransform)[] = Object.freeze([\"position\", \"rotation\", \"scale\"]);\n\n/**\n * Parses an override path.\n *\n * @param path - The `path` string from the file.\n * @returns The parsed path.\n * @throws IgnifxError with code `IGX-0609` when the path does not match the grammar, or when a\n * property step is `__proto__`.\n *\n * @example\n * ```ts\n * parseOverridePath(\"01J…ROOT/components/01J…AI/props/aggression\");\n * // { kind: \"prop\", entity: \"01J…ROOT\", component: \"01J…AI\", steps: [\"aggression\"] }\n * ```\n *\n * @public\n */\nexport function parseOverridePath(path: string): OverridePath {\n const segments = path.split(\"/\");\n const entity = segments[0];\n if (entity === undefined || entity === \"\") {\n throw invalidPath(path, \"an override path starts with the uid of an entity in the instanced file.\");\n }\n if (segments.length === 1) {\n return { kind: \"entity\", entity };\n }\n const second = segments[1] ?? \"\";\n if (segments.length === 2) {\n if (second === \"components\") {\n return { kind: \"componentList\", entity };\n }\n const field = ENTITY_FIELDS.find((candidate) => candidate === second);\n if (field !== undefined) {\n return { kind: \"entityField\", entity, field };\n }\n throw invalidPath(path, `\"${second}\" is not an entity property an override may patch.`);\n }\n if (second === \"transform\") {\n const channel = TRANSFORM_CHANNELS.find((candidate) => candidate === segments[2]);\n if (channel === undefined || segments.length !== 3) {\n throw invalidPath(path, \"a transform override is <uid>/transform/position, /rotation, or /scale.\");\n }\n return { kind: \"transform\", entity, channel };\n }\n if (second !== \"components\") {\n throw invalidPath(path, `\"${second}\" is not \"components\", \"transform\", or an entity property.`);\n }\n const component = segments[2] ?? \"\";\n if (component === \"\") {\n throw invalidPath(path, \"a component override names the component's uid after /components/.\");\n }\n if (segments.length === 3) {\n return { kind: \"component\", entity, component };\n }\n const fourth = segments[3] ?? \"\";\n if (fourth === \"enabled\" && segments.length === 4) {\n return { kind: \"componentField\", entity, component };\n }\n if (fourth !== \"props\" || segments.length < 5) {\n throw invalidPath(path, \"a property override is <uid>/components/<uid>/props/<field>.\");\n }\n const steps = segments.slice(4);\n if (steps.includes(\"__proto__\")) {\n throw invalidPath(path, '\"__proto__\" is not a property name an override may address.');\n }\n return { kind: \"prop\", entity, component, steps };\n}\n\n/**\n * The `op` an override declares, defaulting to `\"replace\"` as the format document's two-key\n * examples imply.\n *\n * @param override - The override entry.\n * @returns The operation.\n *\n * @internal\n */\nexport function overrideOp(override: SceneFileOverride): \"replace\" | \"remove\" | \"add\" {\n return override.op ?? \"replace\";\n}\n\n/**\n * Applies every override to an expanded entity list, in order\n * (`docs/architecture/06-serialization-and-scene-format.md` §4 step 3).\n *\n * @remarks\n * The patches run on the *file* representation, before any entity exists, so `add`, `remove`, and\n * `replace` all reduce to editing plain JSON. Entities are addressed by the uid they carry in the\n * instanced file; `lookup` maps that uid to the entity object in the expanded list.\n *\n * @param overrides - The patches, in file order.\n * @param lookup - Source uid to the mutable entity record it expanded into.\n * @param report - Called for a patch that names something the instanced file does not contain.\n *\n * @internal\n */\nexport function applyOverrides(\n overrides: readonly SceneFileOverride[],\n lookup: ReadonlyMap<string, OverrideTarget>,\n report: (message: string) => void,\n): void {\n for (let index = 0; index < overrides.length; index += 1) {\n const override = overrides[index];\n if (override === undefined) {\n continue;\n }\n const parsed = parseOverridePath(override.path);\n const target = lookup.get(parsed.entity);\n if (target === undefined) {\n report(`the override path \"${override.path}\" names no entity of the instanced scene.`);\n continue;\n }\n applyOne(overrideOp(override), parsed, override, target, report);\n }\n}\n\n/**\n * One entity an override may address: the record to patch, plus the mapping from the component uids\n * the *instanced file* carries — which is what override paths name — to the fresh uids this copy of\n * the prefab got (`docs/architecture/02-scene-graph.md` §10).\n *\n * @internal\n */\nexport interface OverrideTarget {\n /** The entity record to patch. */\n readonly data: MutableSceneEntity;\n /** Instanced-file component uid to this copy's component uid. */\n readonly components: ReadonlyMap<string, string>;\n}\n\n/**\n * A scene-file entity being built by the expander: the same shape as {@link SceneFileEntity} with\n * the read-only markers dropped, because overrides patch it in place.\n *\n * @internal\n */\nexport interface MutableSceneEntity {\n uid: string;\n name: string;\n parent: string | null;\n active?: boolean;\n static?: boolean;\n layer?: string;\n tags?: string[];\n transform: { position: number[]; rotation: number[]; scale: number[] };\n instance?: SceneFileEntity[\"instance\"];\n components: SceneFileComponent[];\n}\n\n/**\n * Applies one parsed override.\n *\n * @param op - The operation.\n * @param parsed - The parsed path.\n * @param override - The raw entry, for its `value`.\n * @param target - The entity the path resolved to, with its component uid mapping.\n * @param report - Called when the patch cannot be applied.\n */\nfunction applyOne(\n op: \"replace\" | \"remove\" | \"add\",\n parsed: OverridePath,\n override: SceneFileOverride,\n target: OverrideTarget,\n report: (message: string) => void,\n): void {\n const entity = target.data;\n switch (parsed.kind) {\n case \"entity\": {\n report(`\"${override.path}\" addresses a whole entity; overrides patch properties and components.`);\n return;\n }\n case \"entityField\": {\n applyEntityField(parsed.field, override.value ?? null, entity);\n return;\n }\n case \"transform\": {\n const numbers = asJsonArray(override.value);\n if (numbers === null) {\n report(`\"${override.path}\" needs an array of numbers.`);\n return;\n }\n entity.transform[parsed.channel] = numberArray(numbers);\n return;\n }\n case \"componentList\": {\n if (op !== \"add\") {\n report(`\"${override.path}\" is only valid with { \"op\": \"add\" }.`);\n return;\n }\n const added = asComponentEntry(override.value);\n if (added === null) {\n report(`\"${override.path}\" needs a component object with a uid and a type.`);\n return;\n }\n entity.components.push(added);\n return;\n }\n case \"component\": {\n if (op !== \"remove\") {\n report(`\"${override.path}\" addresses a whole component; only { \"op\": \"remove\" } may patch it.`);\n return;\n }\n const at = indexOfComponent(entity, resolve(target, parsed.component));\n if (at < 0) {\n report(`\"${override.path}\" names no component of that entity.`);\n return;\n }\n entity.components.splice(at, 1);\n return;\n }\n case \"componentField\": {\n const uid = resolve(target, parsed.component);\n const component = componentOf(entity, uid);\n if (component === null) {\n report(`\"${override.path}\" names no component of that entity.`);\n return;\n }\n replaceComponent(entity, uid, { ...component, enabled: override.value === true });\n return;\n }\n case \"prop\": {\n const uid = resolve(target, parsed.component);\n const component = componentOf(entity, uid);\n if (component === null) {\n report(`\"${override.path}\" names no component of that entity.`);\n return;\n }\n const props = writeStep(\n component.props ?? {},\n parsed.steps,\n 0,\n op,\n override.value ?? null,\n override.path,\n report,\n );\n replaceComponent(entity, uid, { ...component, props });\n return;\n }\n default: {\n return;\n }\n }\n}\n\n/**\n * Patches one plain entity property.\n *\n * @param field - Which property.\n * @param value - The new JSON value.\n * @param entity - The entity to patch.\n */\nfunction applyEntityField(field: EntityOverrideField, value: JsonValue, entity: MutableSceneEntity): void {\n switch (field) {\n case \"name\": {\n entity.name = typeof value === \"string\" ? value : entity.name;\n return;\n }\n case \"active\": {\n entity.active = value === true;\n return;\n }\n case \"static\": {\n entity.static = value === true;\n return;\n }\n case \"layer\": {\n if (typeof value === \"string\") {\n entity.layer = value;\n }\n return;\n }\n case \"tags\": {\n const list = asJsonArray(value);\n if (list !== null) {\n entity.tags = list.filter((tag): tag is string => typeof tag === \"string\");\n }\n return;\n }\n default: {\n return;\n }\n }\n}\n\n/**\n * Writes one step of a `props/<field>[/<key>…]` path, rebuilding the containers on the way so the\n * instanced file's own JSON is never mutated (two instances of one prefab must not share objects).\n *\n * @param container - The object or array being descended into.\n * @param steps - The remaining path segments.\n * @param at - The index of the segment to apply.\n * @param op - The operation.\n * @param value - The new value.\n * @param path - The whole path, for diagnostics.\n * @param report - Called when the step cannot be applied.\n * @returns The rebuilt container.\n */\nfunction writeStep(\n container: JsonObject,\n steps: readonly string[],\n at: number,\n op: \"replace\" | \"remove\" | \"add\",\n value: JsonValue,\n path: string,\n report: (message: string) => void,\n): JsonObject {\n const key = steps[at];\n if (key === undefined) {\n return container;\n }\n const copy: Record<string, JsonValue> = { ...container };\n if (at === steps.length - 1) {\n if (op === \"remove\") {\n // `delete` on a fresh copy: the container was cloned one line above, so nothing shared is\n // mutated and the key order of the surviving keys is preserved.\n const { [key]: _removed, ...rest } = copy;\n return rest;\n }\n // Defined, not assigned, and read only when own: a key such as `constructor` must not reach\n // `Object.prototype` through the copy (`__proto__` itself is refused by `parseOverridePath`).\n setOwnJsonProperty(copy, key, value);\n return copy;\n }\n const next = Object.hasOwn(copy, key) ? copy[key] : undefined;\n const nextArray = asJsonArray(next);\n if (nextArray !== null) {\n setOwnJsonProperty(copy, key, writeArrayStep(nextArray, steps, at + 1, op, value, path, report));\n return copy;\n }\n const nextObject = asJsonObject(next);\n if (nextObject !== null) {\n setOwnJsonProperty(copy, key, writeStep(nextObject, steps, at + 1, op, value, path, report));\n return copy;\n }\n report(`\"${path}\" descends into ${key}, which is not an object or an array.`);\n return container;\n}\n\n/**\n * The array form of {@link writeStep}.\n *\n * @param container - The array being descended into.\n * @param steps - The remaining path segments.\n * @param at - The index of the segment to apply.\n * @param op - The operation.\n * @param value - The new value.\n * @param path - The whole path, for diagnostics.\n * @param report - Called when the step cannot be applied.\n * @returns The rebuilt array.\n */\nfunction writeArrayStep(\n container: readonly JsonValue[],\n steps: readonly string[],\n at: number,\n op: \"replace\" | \"remove\" | \"add\",\n value: JsonValue,\n path: string,\n report: (message: string) => void,\n): readonly JsonValue[] {\n const key = steps[at];\n if (key === undefined) {\n return container;\n }\n const index = Number.parseInt(key, 10);\n if (!Number.isInteger(index) || index < 0) {\n report(`\"${path}\" indexes an array with \"${key}\", which is not a whole number.`);\n return container;\n }\n const copy = [...container];\n if (at === steps.length - 1) {\n if (op === \"remove\") {\n copy.splice(index, 1);\n return copy;\n }\n if (op === \"add\") {\n copy.splice(index, 0, value);\n return copy;\n }\n copy[index] = value;\n return copy;\n }\n const next = copy[index];\n const nextArray = asJsonArray(next);\n if (nextArray !== null) {\n copy[index] = writeArrayStep(nextArray, steps, at + 1, op, value, path, report);\n return copy;\n }\n const nextObject = asJsonObject(next);\n if (nextObject !== null) {\n copy[index] = writeStep(nextObject, steps, at + 1, op, value, path, report);\n return copy;\n }\n report(`\"${path}\" descends into [${key}], which is not an object or an array.`);\n return container;\n}\n\n/**\n * Resolves the uid an override path names — a uid of the instanced file — to the uid this copy of\n * the prefab gave the same component.\n *\n * @param target - The entity the path resolved to.\n * @param sourceUid - The uid the path names.\n * @returns This copy's uid, or the name itself when the mapping does not know it.\n */\nfunction resolve(target: OverrideTarget, sourceUid: string): string {\n return target.components.get(sourceUid) ?? sourceUid;\n}\n\n/**\n * Finds a component of an entity by uid.\n *\n * @param entity - The entity.\n * @param uid - The component uid.\n * @returns Its index, or `-1`.\n */\nfunction indexOfComponent(entity: MutableSceneEntity, uid: string): number {\n for (let index = 0; index < entity.components.length; index += 1) {\n if (entity.components[index]?.uid === uid) {\n return index;\n }\n }\n return -1;\n}\n\n/**\n * Reads a component of an entity by uid.\n *\n * @param entity - The entity.\n * @param uid - The component uid.\n * @returns The component, or `null`.\n */\nfunction componentOf(entity: MutableSceneEntity, uid: string): SceneFileComponent | null {\n const at = indexOfComponent(entity, uid);\n return at < 0 ? null : (entity.components[at] ?? null);\n}\n\n/**\n * Replaces a component entry in place, keeping its position in the list.\n *\n * @param entity - The entity.\n * @param uid - The component uid.\n * @param replacement - The new entry.\n */\nfunction replaceComponent(entity: MutableSceneEntity, uid: string, replacement: SceneFileComponent): void {\n const at = indexOfComponent(entity, uid);\n if (at >= 0) {\n entity.components[at] = replacement;\n }\n}\n\n/**\n * Reads a JSON value as a component entry.\n *\n * @param value - The candidate.\n * @returns The entry, or `null` when it carries no string `uid` and `type`.\n */\nfunction asComponentEntry(value: JsonValue | undefined): SceneFileComponent | null {\n const object = asJsonObject(value);\n if (object === null || typeof object[\"uid\"] !== \"string\" || typeof object[\"type\"] !== \"string\") {\n return null;\n }\n const enabled = object[\"enabled\"];\n const version = object[\"schemaVersion\"];\n return {\n uid: object[\"uid\"],\n type: object[\"type\"],\n ...(typeof enabled === \"boolean\" ? { enabled } : {}),\n ...(typeof version === \"number\" ? { schemaVersion: version } : {}),\n ...(asJsonObject(object[\"props\"]) === null ? {} : { props: asJsonObject(object[\"props\"]) ?? {} }),\n };\n}\n\n/**\n * Coerces a JSON array to numbers, dropping anything else.\n *\n * @param value - The JSON array.\n * @returns The numbers it holds.\n */\nfunction numberArray(value: readonly JsonValue[]): number[] {\n const numbers: number[] = [];\n for (let index = 0; index < value.length; index += 1) {\n const entry = value[index];\n if (typeof entry === \"number\" && Number.isFinite(entry)) {\n numbers.push(entry);\n }\n }\n return numbers;\n}\n\n/**\n * Builds the `IGX-0609` error.\n *\n * @param path - The offending path.\n * @param reason - What the grammar expected.\n * @returns The error to throw.\n */\nfunction invalidPath(path: string, reason: string): IgnifxError {\n return new IgnifxError(CoreErrorCode.invalidOverridePath, `${path} is not a valid override path: ${reason}`, {\n context: { path },\n hint: 'Override paths read \"<entityUid>/components/<componentUid>/props/<field>\".',\n });\n}\n","import { canonicalizeNumber } from \"../schema/encode.js\";\nimport { asJsonArray, asJsonObject } from \"./json-view.js\";\nimport { applyOverrides, overrideOp, parseOverridePath } from \"./overrides.js\";\nimport { computeSceneHash } from \"./scene-asset.js\";\nimport type { MutableSceneEntity, OverridePath, OverrideTarget } from \"./overrides.js\";\nimport type {\n SceneFile,\n SceneFileComponent,\n SceneFileEntity,\n SceneFileInstance,\n SceneFileOverride,\n} from \"./scene-file.js\";\n\n/**\n * Which overrides of an instance {@link applyOverridesToAsset} and {@link revertOverrides} act on.\n *\n * @public\n */\nexport interface PrefabOverrideSelection {\n /**\n * Override paths to act on. A path selects every override at that path or below it, so\n * `\"<entityUid>\"` selects everything on that entity and `\"<entityUid>/components/<componentUid>\"`\n * selects a component's removal, its `enabled` flag, and its props. An `add` to\n * `<entityUid>/components` sits at `<entityUid>/components/<addedUid>`. Omitted, every override\n * is selected.\n */\n readonly paths?: readonly string[];\n}\n\n/**\n * What {@link applyOverridesToAsset} acts on: the selected overrides and, optionally, the components\n * the instance root carries itself.\n *\n * @public\n */\nexport interface PrefabApplyOptions extends PrefabOverrideSelection {\n /**\n * The components the instance root carries itself: the `components` of the scene-file entity that\n * holds the `instance` entry. They are not overrides (the serializer writes a component added on\n * a single-root instance's root there), so they can only be applied when passed here. Each one\n * that `paths` selects, at `<prefabRootUid>/components/<componentUid>`, is appended to the\n * prefab's root after its own components, which is the order the instance already has them in.\n * Omitted, none is applied.\n */\n readonly rootComponents?: readonly SceneFileComponent[];\n}\n\n/**\n * A component of the instance root that {@link applyOverridesToAsset} left on the instance, and why.\n *\n * @public\n */\nexport interface PrefabComponentSkip {\n /** The component, as the instance root holds it. */\n readonly component: SceneFileComponent;\n /** Why it could not be written into the prefab file. */\n readonly reason: string;\n}\n\n/**\n * An override {@link applyOverridesToAsset} left on the instance, and why.\n *\n * @public\n */\nexport interface PrefabOverrideSkip {\n /** The override, as the instance entry holds it. */\n readonly override: SceneFileOverride;\n /** Why it could not be written into the prefab file. */\n readonly reason: string;\n}\n\n/**\n * What {@link applyOverridesToAsset} returns.\n *\n * @public\n */\nexport interface PrefabApplyResult {\n /** The new prefab file, with the applied overrides written into it. */\n readonly asset: SceneFile;\n /** The content hash of {@link PrefabApplyResult.asset}, as {@link computeSceneHash} writes it. */\n readonly hash: string;\n /**\n * The instance entry without the applied overrides, recording {@link PrefabApplyResult.hash}. It\n * expands to the same values it did before the apply; a component an applied `add` brought now\n * comes from the prefab, so like every prefab component it gets a fresh uid per instance.\n */\n readonly instance: SceneFileInstance;\n /** The overrides written into the prefab, in instance order. */\n readonly applied: readonly SceneFileOverride[];\n /** The selected overrides that stay on the instance, in instance order. */\n readonly skipped: readonly PrefabOverrideSkip[];\n /**\n * The {@link PrefabApplyOptions.rootComponents} written into the prefab's root. Remove them from\n * the instance root: the prefab brings them now.\n */\n readonly appliedComponents: readonly SceneFileComponent[];\n /**\n * The {@link PrefabApplyOptions.rootComponents} that stay on the instance root, in their order:\n * the unselected ones and the skipped ones.\n */\n readonly rootComponents: readonly SceneFileComponent[];\n /** The selected {@link PrefabApplyOptions.rootComponents} that stay on the instance root, and why. */\n readonly skippedComponents: readonly PrefabComponentSkip[];\n}\n\n/**\n * Writes an instance's overrides into the prefab file it instances, so every instance of the prefab\n * gets them — Unity's \"Apply to prefab\" (ADR-0005).\n *\n * @remarks\n * A pure function over the two files: nothing is loaded, and the same input always gives\n * byte-identical output through {@link stringifySceneFile}. The rules:\n *\n * - Property, `enabled`, transform, and entity-field overrides change the prefab's record. An `add`\n * appends the component, keeping its uid; a `remove` deletes the component.\n * - On a prefab with exactly one root, the instance root's own `name`, `transform`, and other entity\n * fields are its placement, not prefab content, so overrides of the root's entity fields and\n * transform are skipped.\n * - Overrides reach only the prefab's own entities. Content of a scene the prefab itself instances\n * is not addressable by an override path, so a nested prefab is never edited: an override that\n * names something the prefab file does not hold is skipped.\n * - An override is skipped when an earlier override that stays on the instance overlaps its path, so\n * the instance keeps the value it had.\n * - A skipped override stays on the returned instance.\n * - The instance root's own components are not overrides. Pass them as\n * {@link PrefabApplyOptions.rootComponents} to apply them too: on a prefab with exactly one root\n * each selected one is appended to that root, keeping its uid, and reported in\n * {@link PrefabApplyResult.appliedComponents}; one whose uid the prefab already uses, or any when\n * the prefab has several roots, is skipped.\n * - Other instances of the prefab keep their overrides, which still win over the new prefab values\n * at the same path. Record {@link PrefabApplyResult.hash} on them, or loading them logs `IGX-0604`.\n * - References inside added components (`$entity`, `$component`) are copied unchanged.\n * - A component an apply moved into the prefab gets a fresh uid per instance from then on, like every\n * prefab component; a scene reference to it uses the instance form\n * `{ \"$component\": \"<instanceRootUid>/<componentUid>\" }`.\n *\n * @param instance - The instance entry whose overrides to apply; its `scene` should name `asset`.\n * @param asset - The prefab file the entry instances.\n * @param selection - Which overrides to apply, all of them by default, and the instance root's own\n * components to apply with them.\n * @returns The new prefab file and its hash, the instance entry without the applied overrides, and\n * what was applied or skipped.\n * @throws IgnifxError with code `IGX-0609` when a selected override path is outside the grammar.\n *\n * @example\n * ```ts\n * const result = await applyOverridesToAsset(spawn.instance, prefabFile, { rootComponents: spawn.components });\n * await app.storage.write(\"prefabs/enemy.prefab.json\", stringifySceneFile(result.asset));\n * ```\n *\n * @public\n */\nexport async function applyOverridesToAsset(\n instance: SceneFileInstance,\n asset: SceneFile,\n selection?: PrefabApplyOptions,\n): Promise<PrefabApplyResult> {\n const overrides = instance.overrides ?? [];\n const records = new Map<string, MutableSceneEntity>();\n const lookup = new Map<string, OverrideTarget>();\n const uids = new Set<string>();\n for (const entity of asset.entities) {\n const data = mutableEntity(entity);\n records.set(entity.uid, data);\n lookup.set(entity.uid, { data, components: new Map<string, string>() });\n uids.add(entity.uid);\n for (const component of entity.components ?? []) {\n uids.add(component.uid);\n }\n }\n const singleRootUid = singleRootOf(asset);\n const touched = new Set<string>();\n const own = applyRootComponents(selection, singleRootUid, records, uids, touched);\n const applied: SceneFileOverride[] = [];\n const skipped: PrefabOverrideSkip[] = [];\n const remaining: SceneFileOverride[] = [];\n for (const override of overrides) {\n if (!isSelected(override, selection)) {\n remaining.push(override);\n continue;\n }\n const parsed = parseOverridePath(override.path);\n let reason = precheck(override, parsed, singleRootUid, uids) ?? shadowedBy(override, remaining);\n if (reason === null) {\n applyOverrides([override], lookup, (message) => {\n reason ??= message;\n });\n }\n if (reason !== null) {\n skipped.push({ override, reason });\n remaining.push(override);\n continue;\n }\n touched.add(parsed.entity);\n const added = addedComponentUid(override);\n if (added !== null) {\n uids.add(added);\n }\n applied.push(override);\n }\n const next: SceneFile =\n touched.size === 0\n ? asset\n : {\n ...asset,\n entities: asset.entities.map((entity) => {\n const data = records.get(entity.uid);\n return data === undefined || !touched.has(entity.uid) ? entity : canonicalEntity(data);\n }),\n };\n const hash = await computeSceneHash(next);\n return {\n asset: next,\n hash,\n instance: withOverrides(instance, remaining, hash),\n applied,\n skipped,\n appliedComponents: own.applied,\n rootComponents: own.kept,\n skippedComponents: own.skipped,\n };\n}\n\n/** What {@link applyRootComponents} did with the instance root's own components. */\ninterface RootComponentOutcome {\n /** Written into the prefab's root. */\n readonly applied: readonly SceneFileComponent[];\n /** Staying on the instance root. */\n readonly kept: readonly SceneFileComponent[];\n /** Selected but staying on the instance root, and why. */\n readonly skipped: readonly PrefabComponentSkip[];\n}\n\n/**\n * Appends the selected components of the instance root to the prefab's single root.\n *\n * @param options - The apply options, holding the components and the selection.\n * @param singleRootUid - The prefab's only root, or `null`.\n * @param records - The prefab's mutable records, by uid.\n * @param uids - Every uid the prefab uses; the appended components are added.\n * @param touched - Filled with the root's uid when anything was appended.\n * @returns What was applied, what stays on the instance root, and why the skipped ones were.\n */\nfunction applyRootComponents(\n options: PrefabApplyOptions | undefined,\n singleRootUid: string | null,\n records: ReadonlyMap<string, MutableSceneEntity>,\n uids: Set<string>,\n touched: Set<string>,\n): RootComponentOutcome {\n const applied: SceneFileComponent[] = [];\n const kept: SceneFileComponent[] = [];\n const skipped: PrefabComponentSkip[] = [];\n const root = singleRootUid === null ? undefined : records.get(singleRootUid);\n for (const component of options?.rootComponents ?? []) {\n const selected =\n singleRootUid === null\n ? options?.paths === undefined\n : isPathSelected(`${singleRootUid}/components/${component.uid}`, options);\n if (!selected) {\n kept.push(component);\n continue;\n }\n const reason =\n root === undefined\n ? `The prefab has no single root, so component ${component.uid} of the instance root has nowhere to go.`\n : uids.has(component.uid)\n ? `Component ${component.uid} of the instance root has a uid the prefab file already uses.`\n : null;\n if (root === undefined || reason !== null) {\n skipped.push({ component, reason: reason ?? \"\" });\n kept.push(component);\n continue;\n }\n root.components.push(component);\n uids.add(component.uid);\n touched.add(root.uid);\n applied.push(component);\n }\n return { applied, kept, skipped };\n}\n\n/**\n * Drops an instance's overrides so it follows its prefab again — Unity's \"Revert\".\n *\n * @remarks\n * A pure function: the entry's `scene` and `hash` are kept, and `overrides` is omitted when none\n * remain. Reverting an `add` also reverts the overrides below the added component when the\n * selection path covers them (`<entityUid>/components/<addedUid>` does).\n *\n * @param instance - The instance entry.\n * @param selection - Which overrides to drop; all of them by default.\n * @returns The entry without the selected overrides, or `instance` itself when none was selected.\n *\n * @example\n * ```ts\n * const reverted = revertOverrides(spawn.instance, { paths: [`${rootUid}/components/${aiUid}`] });\n * ```\n *\n * @public\n */\nexport function revertOverrides(instance: SceneFileInstance, selection?: PrefabOverrideSelection): SceneFileInstance {\n const overrides = instance.overrides ?? [];\n const remaining = overrides.filter((override) => !isSelected(override, selection));\n if (remaining.length === overrides.length) {\n return instance;\n }\n return withOverrides(instance, remaining, instance.hash);\n}\n\n/**\n * Whether a selection covers an override.\n *\n * @param override - The override.\n * @param selection - The selection; absent or without `paths`, everything.\n * @returns `true` when the override's target is a selected path or lies below one.\n */\nfunction isSelected(override: SceneFileOverride, selection: PrefabOverrideSelection | undefined): boolean {\n return isPathSelected(targetPath(override), selection);\n}\n\n/**\n * Whether a selection covers a target path.\n *\n * @param target - The path acted on.\n * @param selection - The selection; absent or without `paths`, everything.\n * @returns `true` when the target is a selected path or lies below one.\n */\nfunction isPathSelected(target: string, selection: PrefabOverrideSelection | undefined): boolean {\n const paths = selection?.paths;\n if (paths === undefined) {\n return true;\n }\n return paths.some((path) => target === path || target.startsWith(`${path}/`));\n}\n\n/**\n * The path an override acts on: its own path, or for an `add` to a component list the path of the\n * component it adds, so a selection can name one added component.\n *\n * @param override - The override.\n * @returns The path.\n */\nfunction targetPath(override: SceneFileOverride): string {\n const added = addedComponentUid(override);\n return added === null ? override.path : `${override.path}/${added}`;\n}\n\n/**\n * The uid of the component an `add` override appends to a component list.\n *\n * @param override - The override.\n * @returns The uid, or `null` when the override is not such an `add` or names no uid.\n */\nfunction addedComponentUid(override: SceneFileOverride): string | null {\n if (overrideOp(override) !== \"add\") {\n return null;\n }\n const segments = override.path.split(\"/\");\n if (segments.length !== 2 || segments[1] !== \"components\") {\n return null;\n }\n const uid = asJsonObject(override.value)?.[\"uid\"];\n return typeof uid === \"string\" ? uid : null;\n}\n\n/**\n * Checks what the override patcher itself accepts silently but a prefab file must not take.\n *\n * @param override - The override.\n * @param parsed - Its parsed path.\n * @param singleRootUid - The prefab's only root, or `null`.\n * @param uids - Every uid the prefab file already uses.\n * @returns Why the override cannot be applied, or `null`.\n */\nfunction precheck(\n override: SceneFileOverride,\n parsed: OverridePath,\n singleRootUid: string | null,\n uids: ReadonlySet<string>,\n): string | null {\n if (parsed.entity === singleRootUid && (parsed.kind === \"entityField\" || parsed.kind === \"transform\")) {\n return `\"${override.path}\" sets the instance root's own ${parsed.kind === \"transform\" ? \"transform\" : parsed.field}, which is its placement, not prefab content.`;\n }\n if (parsed.kind === \"transform\") {\n const numbers = asJsonArray(override.value);\n const length = parsed.channel === \"rotation\" ? 4 : 3;\n if (\n numbers === null ||\n numbers.length !== length ||\n !numbers.every((entry) => typeof entry === \"number\" && Number.isFinite(entry))\n ) {\n return `\"${override.path}\" needs ${String(length)} finite numbers.`;\n }\n }\n const added = addedComponentUid(override);\n if (added !== null && uids.has(added)) {\n return `\"${override.path}\" adds component ${added}, a uid the prefab file already uses.`;\n }\n return null;\n}\n\n/**\n * Why an override must stay on the instance: an earlier override that stays there overlaps it, and\n * once baked into the prefab the applied one would run first and lose to it.\n *\n * @param override - The selected override.\n * @param remaining - The earlier overrides that stay on the instance.\n * @returns Why the override cannot be applied, or `null`.\n */\nfunction shadowedBy(override: SceneFileOverride, remaining: readonly SceneFileOverride[]): string | null {\n const key = overlapKey(override);\n const earlier = remaining.find((candidate) => {\n const other = overlapKey(candidate);\n return (\n addedComponentUid(candidate) === null &&\n (key === other || key.startsWith(`${other}/`) || other.startsWith(`${key}/`))\n );\n });\n return earlier === undefined\n ? null\n : `\"${override.path}\" follows \"${earlier.path}\", which stays on the instance and overlaps it.`;\n}\n\n/**\n * The part of an override's path that decides overlap: cut at the prop field, so array index shifts\n * inside one field count.\n *\n * @param override - The override.\n * @returns The key.\n */\nfunction overlapKey(override: SceneFileOverride): string {\n return override.path.split(\"/\").slice(0, 5).join(\"/\");\n}\n\n/**\n * The uid of a scene file's only root.\n *\n * @param file - The file.\n * @returns The uid, or `null` when the file has no root or several.\n */\nfunction singleRootOf(file: SceneFile): string | null {\n const roots = file.entities.filter((entity) => entity.parent === null);\n return roots.length === 1 ? (roots[0]?.uid ?? null) : null;\n}\n\n/**\n * Copies a file record into the mutable shape the override patcher edits.\n *\n * @param entity - The record.\n * @returns A copy that shares nothing the patcher mutates.\n */\nfunction mutableEntity(entity: SceneFileEntity): MutableSceneEntity {\n return {\n uid: entity.uid,\n name: entity.name,\n parent: entity.parent,\n ...(entity.active === undefined ? {} : { active: entity.active }),\n ...(entity.static === undefined ? {} : { static: entity.static }),\n ...(entity.layer === undefined ? {} : { layer: entity.layer }),\n ...(entity.tags === undefined ? {} : { tags: [...entity.tags] }),\n transform: {\n position: [...entity.transform.position],\n rotation: [...entity.transform.rotation],\n scale: [...entity.transform.scale],\n },\n ...(entity.instance === undefined ? {} : { instance: entity.instance }),\n components: [...(entity.components ?? [])],\n };\n}\n\n/**\n * Writes a patched record back in the serializer's canonical form: its key order, defaults omitted,\n * tags sorted and unique, numbers canonicalized.\n *\n * @param data - The patched record.\n * @returns The file record.\n */\nfunction canonicalEntity(data: MutableSceneEntity): SceneFileEntity {\n const tags = [...new Set(data.tags ?? [])].toSorted();\n return {\n uid: data.uid,\n name: data.name,\n parent: data.parent,\n ...(data.active === false ? { active: false } : {}),\n ...(data.static === true ? { static: true } : {}),\n ...(data.layer === undefined || data.layer === \"Default\" ? {} : { layer: data.layer }),\n ...(tags.length === 0 ? {} : { tags }),\n transform: {\n position: triple(data.transform.position),\n rotation: [\n canonicalNumberAt(data.transform.rotation, 0),\n canonicalNumberAt(data.transform.rotation, 1),\n canonicalNumberAt(data.transform.rotation, 2),\n canonicalNumberAt(data.transform.rotation, 3),\n ],\n scale: triple(data.transform.scale),\n },\n ...(data.instance === undefined ? {} : { instance: data.instance }),\n ...(data.components.length === 0 ? {} : { components: data.components.map(canonicalComponent) }),\n };\n}\n\n/**\n * Writes a component record in the serializer's key order, `enabled` omitted when `true`.\n *\n * @param component - The record.\n * @returns The canonical record.\n */\nfunction canonicalComponent(component: SceneFileComponent): SceneFileComponent {\n return {\n uid: component.uid,\n type: component.type,\n ...(component.enabled === false ? { enabled: false } : {}),\n ...(component.schemaVersion === undefined ? {} : { schemaVersion: component.schemaVersion }),\n ...(component.props === undefined ? {} : { props: component.props }),\n };\n}\n\n/**\n * Reads a three-number transform channel.\n *\n * @param values - The channel.\n * @returns The canonical triple.\n */\nfunction triple(values: readonly number[]): [number, number, number] {\n return [canonicalNumberAt(values, 0), canonicalNumberAt(values, 1), canonicalNumberAt(values, 2)];\n}\n\n/**\n * Reads one canonical number from a transform channel.\n *\n * @param values - The channel.\n * @param index - Which entry.\n * @returns The canonical number; `0` when the entry is missing.\n */\nfunction canonicalNumberAt(values: readonly number[], index: number): number {\n return canonicalizeNumber(values[index] ?? 0);\n}\n\n/**\n * Rebuilds an instance entry with a new override list and hash.\n *\n * @param instance - The entry.\n * @param overrides - The overrides to keep.\n * @param hash - The hash to record, or `undefined` for none.\n * @returns The entry, in the serializer's key order, `overrides` omitted when empty.\n */\nfunction withOverrides(\n instance: SceneFileInstance,\n overrides: readonly SceneFileOverride[],\n hash: string | undefined,\n): SceneFileInstance {\n return {\n scene: instance.scene,\n ...(hash === undefined ? {} : { hash }),\n ...(overrides.length === 0 ? {} : { overrides }),\n };\n}\n"],"mappings":";;;;;;;;;;;AAUA,MAAM,oBAAuC,OAAO,OAAO;CAAC;CAAW;CAAY;CAAS;AAAO,CAAC;;AAGpG,MAAM,qBAAqB;;AAG3B,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;AAgCvB,SAAgB,cAAc,SAA+B;CAC3D,IAAI,QAAQ,WAAW,OAAO,GAC5B,OAAO;EAAE,MAAM;EAAS,UAAU;CAAK;CAEzC,MAAM,QAAQ,QAAQ,QAAQ,kBAAkB;CAChD,IAAI,QAAQ,GACV,OAAO;EAAE,MAAM;EAAS,UAAU;CAAK;CAEzC,OAAO;EAAE,MAAM,QAAQ,MAAM,GAAG,KAAK;EAAG,UAAU,QAAQ,MAAM,QAAQ,CAAC;CAAE;AAC7E;;;;;;;;;AAUA,SAAgB,kBAAkB,MAAuB;CACvD,KAAK,IAAI,QAAQ,GAAG,QAAQ,kBAAkB,QAAQ,SAAS,GAAG;EAChE,MAAM,SAAS,kBAAkB;EACjC,IAAI,WAAW,KAAA,KAAa,KAAK,WAAW,MAAM,GAChD,OAAO;CAEX;CACA,OAAO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EAAC,kBAAkB,QAAQ,CAAC;EAAG,kBAAkB,QAAQ,CAAC;EAAG,kBAAkB,QAAQ,CAAC;CAAC;AAClG;;;;;;;;AASA,SAAS,kBAAkB,QAA2B,OAAuB;CAC3E,OAAO,mBAAmB,OAAO,UAAU,CAAC;AAC9C;;;;;;;;;AAUA,SAAS,cACP,UACA,WACA,MACmB;CACnB,OAAO;EACL,OAAO,SAAS;EAChB,GAAI,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,KAAK;EACrC,GAAI,UAAU,WAAW,IAAI,CAAC,IAAI,EAAE,UAAU;CAChD;AACF"}
@@ -0,0 +1,2 @@
1
+ import { $i as SceneFile, $o as JsonObject, Qi as SCENE_FORMAT_VERSION, Qo as JsonArray, Ri as canonicalizeNumber, Xi as SCENE_FILE_EXTENSIONS, Zi as SCENE_FILE_FORMAT, a as PrefabOverrideSkip, aa as SceneFileTransform, c as EntityOverrideField, ea as SceneFileAssetRef, es as JsonValue, i as PrefabOverrideSelection, ia as SceneFileOverride, l as OverridePath, la as stringifySceneFile, n as PrefabApplyResult, na as SceneFileEntity, o as applyOverridesToAsset, qi as computeSceneHash, r as PrefabComponentSkip, ra as SceneFileInstance, s as revertOverrides, sa as isSceneFileHeader, t as PrefabApplyOptions, ta as SceneFileComponent, u as parseOverridePath } from "./prefab-overrides-76IhcF-e.js";
2
+ export { type EntityOverrideField, type JsonArray, type JsonObject, type JsonValue, type OverridePath, type PrefabApplyOptions, type PrefabApplyResult, type PrefabComponentSkip, type PrefabOverrideSelection, type PrefabOverrideSkip, SCENE_FILE_EXTENSIONS, SCENE_FILE_FORMAT, SCENE_FORMAT_VERSION, type SceneFile, type SceneFileAssetRef, type SceneFileComponent, type SceneFileEntity, type SceneFileInstance, type SceneFileOverride, type SceneFileTransform, applyOverridesToAsset, canonicalizeNumber, computeSceneHash, isSceneFileHeader, parseOverridePath, revertOverrides, stringifySceneFile };
package/dist/prefab.js ADDED
@@ -0,0 +1,2 @@
1
+ import { d as SCENE_FILE_FORMAT, f as SCENE_FORMAT_VERSION, g as stringifySceneFile, i as parseOverridePath, m as isSceneFileHeader, n as revertOverrides, o as computeSceneHash, t as applyOverridesToAsset, u as SCENE_FILE_EXTENSIONS, y as canonicalizeNumber } from "./prefab-overrides-DGiGTSN-.js";
2
+ export { SCENE_FILE_EXTENSIONS, SCENE_FILE_FORMAT, SCENE_FORMAT_VERSION, applyOverridesToAsset, canonicalizeNumber, computeSceneHash, isSceneFileHeader, parseOverridePath, revertOverrides, stringifySceneFile };