let nativeRemoteExtensionContext = null;
const waiters = new Set();
export function setNativeRemoteExtensionContext(ctx) {
    nativeRemoteExtensionContext = ctx;
    for (const waiter of waiters) {
        waiter(ctx);
    }
    waiters.clear();
}
export function getNativeRemoteExtensionContext() {
    return nativeRemoteExtensionContext;
}
export function waitForNativeRemoteExtensionContext(timeoutMs = 10_000) {
    if (nativeRemoteExtensionContext) {
        return Promise.resolve(nativeRemoteExtensionContext);
    }
    return new Promise((resolve) => {
        const waiter = (ctx) => {
            clearTimeout(timer);
            waiters.delete(waiter);
            resolve(ctx);
        };
        const timer = setTimeout(() => {
            waiters.delete(waiter);
            resolve(nativeRemoteExtensionContext);
        }, timeoutMs);
        waiters.add(waiter);
    });
}
//# sourceMappingURL=native-remote-ui-context.js.map