"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EncodedChunkShapeVTextExperimental = exports.EncodedSpecializedNodeShape = void 0;
const Type = __importStar(require("@sinclair/typebox"));
const index_js_1 = require("../../../../codec/index.js");
const formatGeneric_js_1 = require("./formatGeneric.js");
const formatV1_js_1 = require("./formatV1.js");
const formatV2_js_1 = require("./formatV2.js");
exports.EncodedSpecializedNodeShape = Type.Object({
    /**
     * Index into the enclosing batch's shapes array of the shape this specializes.
     * Must resolve to either an {@link EncodedNodeShape} or another
     * `EncodedSpecializedNodeShape`; chains are followed transitively until a node shape
     * is reached. This restriction is enforced at runtime, not by the schema.
     */
    base: formatGeneric_js_1.ShapeIndex,
    /**
     * Field-level overrides applied to the resolved base's `fields`. Entries whose key
     * matches a base field replace that field's shape index in place; entries with new
     * keys are appended after all base fields, in the order given here. Base field order
     * is preserved — this is the stream consumption order at decode time, so encoders
     * must serialize per-field tokens in the resulting field order, not in this list's order.
     */
    fields: Type.Optional(Type.Array(formatV1_js_1.EncodedFieldShape)),
    /**
     * If absent, inherits the resolved base's value shape. If `null`, the resulting shape
     * has no value shape (explicit clear). Any other value replaces the base's.
     */
    value: Type.Optional(Type.Union([formatV1_js_1.EncodedValueShape, Type.Null()])),
    /**
     * If absent, inherits the resolved base's extraFields shape. If `null`, the resulting
     * shape has no extraFields (explicit clear). Any other value replaces the base's.
     */
    extraFields: Type.Optional(Type.Union([formatGeneric_js_1.ShapeIndex, Type.Null()])),
}, { additionalProperties: false });
exports.EncodedChunkShapeVTextExperimental = Type.Object({
    ...formatV2_js_1.shapesV2,
    f: Type.Optional(exports.EncodedSpecializedNodeShape),
}, index_js_1.unionOptions);
//# sourceMappingURL=formatVText.js.map