"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.brandedSlot = exports.getOrCreateSlotContent = void 0;
const utils_js_1 = require("./utils.js");
/**
 * Version of {@link getOrCreate} with better typing for {@link BrandedMapSubset}.
 * @privateRemarks
 * Only infers type from key to avoid inferring `any` from map's key.
 */
function getOrCreateSlotContent(map, key, defaultValue) {
    return (0, utils_js_1.getOrCreate)(map, key, defaultValue);
}
exports.getOrCreateSlotContent = getOrCreateSlotContent;
/**
 * A counter used to allocate unique numbers (See {@link brandedSlot}) to use as {@link BrandedKey}s.
 * This allows the keys to be small integers, which are efficient to use as keys in maps.
 * See {@link BrandedMapSubset}.
 */
let slotCounter = 0;
/**
 * Define a strongly typed slot in which data can be stored in a {@link BrandedMapSubset}.
 */
function brandedSlot() {
    return slotCounter++;
}
exports.brandedSlot = brandedSlot;
//# sourceMappingURL=brandedMap.js.map