/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { assert } from "@fluidframework/core-utils";
/**
 * @alpha
 */
export function idAllocatorFromMaxId(maxId = undefined) {
    return idAllocatorFromState({ maxId: maxId ?? -1 });
}
export function idAllocatorFromState(state) {
    return (c) => {
        const count = c ?? 1;
        assert(count > 0, 0x5cf /* Must allocate at least one ID */);
        const id = state.maxId + 1;
        state.maxId += count;
        return id;
    };
}
//# sourceMappingURL=idAllocator.js.map