let pending = null;
const listeners = new Set();
function notify() {
    for (const listener of listeners)
        listener();
}
export function setPendingFeedbackFocus(focus) {
    pending = focus;
    notify();
}
/** Clears the pending focus, or only `focus` if given and a newer one replaced it. */
export function clearPendingFeedbackFocus(focus) {
    if (focus && pending !== focus)
        return;
    if (!pending)
        return;
    pending = null;
    notify();
}
export function getPendingFeedbackFocus() {
    return pending;
}
export function subscribePendingFeedbackFocus(listener) {
    listeners.add(listener);
    return () => {
        listeners.delete(listener);
    };
}
/** Feedback ids are GUIDs that may differ in casing/braces between sources. */
export function feedbackIdsEqual(left, right) {
    const normalize = (value) => (value ?? "").replace(/[{}]/g, "").toLowerCase();
    const normalizedLeft = normalize(left);
    const normalizedRight = normalize(right);
    return (!!normalizedLeft && !!normalizedRight && normalizedLeft === normalizedRight);
}
//# sourceMappingURL=pendingFeedbackFocus.js.map