// Copyright 2025 The Lynx Authors. All rights reserved.
// Licensed under the Apache License Version 2.0 that can be found in the
// LICENSE file in the root directory of this source tree.
import { deleteElementTemplateNativeRef, setElementTemplateNativeRef } from './registry.js';
// Main-thread IFR allocates ids as consecutive negative integers.
let nextId = -1;
export function reserveElementTemplateId() {
    const id = nextId--;
    return id;
}
export function createElementTemplateWithReservedHandle(handleId, templateKey, bundleUrl, attributeSlots, elementSlots) {
    const nativeRef = __CreateElementTemplate(templateKey, bundleUrl, attributeSlots, elementSlots, handleId);
    setElementTemplateNativeRef(handleId, nativeRef);
    return nativeRef;
}
export function resetTemplateId() {
    nextId = -1;
}
export function destroyElementTemplateId(id) {
    deleteElementTemplateNativeRef(id);
    // __ReleaseElement(nativeRef);
}
//# sourceMappingURL=handle.js.map