"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.newCrossFieldKeyTable = void 0;
const index_js_1 = require("../../core/index.js");
const index_js_2 = require("../../util/index.js");
function newCrossFieldKeyTable() {
    return new index_js_2.RangeMap(offsetCrossFieldKey, subtractCrossFieldKeys);
}
exports.newCrossFieldKeyTable = newCrossFieldKeyTable;
function offsetCrossFieldKey(key, offset) {
    return {
        ...key,
        localId: (0, index_js_2.brand)(key.localId + offset),
    };
}
function subtractCrossFieldKeys(a, b) {
    const cmpTarget = a.target - b.target;
    if (cmpTarget !== 0) {
        return cmpTarget * Number.POSITIVE_INFINITY;
    }
    return (0, index_js_1.subtractChangeAtomIds)(a, b);
}
//# sourceMappingURL=modularChangeTypes.js.map