import { getNavigatorLocks } from '../shared/navigator.js';
/**
 * @internal
 * @experimental
 */
export const NAVIGATOR_TRIGGER_CLAIM_MANAGER = {
    async obtainClaim(identifier) {
        return new Promise((resolveReleaser) => {
            getNavigatorLocks().request(identifier, async () => {
                await new Promise((releaseLock) => {
                    resolveReleaser(async () => releaseLock());
                });
            });
        });
    },
    async checkClaim(identifier) {
        const currentState = await getNavigatorLocks().query();
        return currentState.held?.find((heldLock) => heldLock.name == identifier) != null;
    }
};
