"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSkipMark = exports.inputLength = exports.emptyDelta = void 0;
const core_utils_1 = require("@fluidframework/core-utils");
const delta_1 = require("./delta");
exports.emptyDelta = new Map();
/**
 * Returns the number of nodes in the input tree that the mark affects or skips.
 */
function inputLength(mark) {
    if (isSkipMark(mark)) {
        return mark;
    }
    // Inline into `switch(mark.type)` once we upgrade to TS 4.7
    const type = mark.type;
    switch (type) {
        case delta_1.MarkType.Delete:
        case delta_1.MarkType.MoveOut:
            return mark.count;
        case delta_1.MarkType.Modify:
            return 1;
        case delta_1.MarkType.Insert:
        case delta_1.MarkType.MoveIn:
            return 0;
        default:
            (0, core_utils_1.unreachableCase)(type);
    }
}
exports.inputLength = inputLength;
function isSkipMark(mark) {
    return typeof mark === "number";
}
exports.isSkipMark = isSkipMark;
//# sourceMappingURL=deltaUtil.js.map