let cachedInfo = null;
const ensureBridge = () => {
    const bridge = window.localFileServer;
    if (!bridge?.getInfo) {
        throw new Error('Local file server bridge is unavailable');
    }
    return bridge;
};
export const getLocalFileServerInfo = async () => {
    if (cachedInfo) {
        return cachedInfo;
    }
    const bridge = ensureBridge();
    cachedInfo = await bridge.getInfo();
    return cachedInfo;
};
export const resetCachedLocalFileServerInfo = () => {
    cachedInfo = null;
};
export const electronLocalFileServer = {
    getInfo: getLocalFileServerInfo,
    reset: resetCachedLocalFileServerInfo
};
