
import { isMacintosh, isNative, isWeb, isLinux } from '../../../base/common/platform.js';
import product$1 from '../../product/common/product.js';

const WindowMinimumSize = {
    WIDTH: 400,
    WIDTH_WITH_VERTICAL_PANEL: 600,
    HEIGHT: 270
};
function isWorkspaceToOpen(uriToOpen) {
    return !!uriToOpen.workspaceUri;
}
function isFolderToOpen(uriToOpen) {
    return !!uriToOpen.folderUri;
}
function isFileToOpen(uriToOpen) {
    return !!uriToOpen.fileUri;
}
function getMenuBarVisibility(configurationService) {
    const nativeTitleBarEnabled = hasNativeTitlebar(configurationService);
    const menuBarVisibility = configurationService.getValue('window.menuBarVisibility');
    if (menuBarVisibility === 'default' || (nativeTitleBarEnabled && menuBarVisibility === 'compact') || (isMacintosh && isNative)) {
        return 'classic';
    }
    else {
        return menuBarVisibility;
    }
}
var TitleBarSetting;
(function (TitleBarSetting) {
    TitleBarSetting["TITLE_BAR_STYLE"] = "window.titleBarStyle";
    TitleBarSetting["CUSTOM_TITLE_BAR_VISIBILITY"] = "window.customTitleBarVisibility";
})(TitleBarSetting || (TitleBarSetting = {}));
var TitlebarStyle;
(function (TitlebarStyle) {
    TitlebarStyle["NATIVE"] = "native";
    TitlebarStyle["CUSTOM"] = "custom";
})(TitlebarStyle || (TitlebarStyle = {}));
var CustomTitleBarVisibility;
(function (CustomTitleBarVisibility) {
    CustomTitleBarVisibility["AUTO"] = "auto";
    CustomTitleBarVisibility["WINDOWED"] = "windowed";
    CustomTitleBarVisibility["NEVER"] = "never";
})(CustomTitleBarVisibility || (CustomTitleBarVisibility = {}));
function hasCustomTitlebar(configurationService, titleBarStyle) {
    return true;
}
function hasNativeTitlebar(configurationService, titleBarStyle) {
    if (!titleBarStyle) {
        titleBarStyle = getTitleBarStyle(configurationService);
    }
    return titleBarStyle === TitlebarStyle.NATIVE;
}
function getTitleBarStyle(configurationService) {
    if (isWeb) {
        return TitlebarStyle.CUSTOM;
    }
    const configuration = configurationService.getValue('window');
    if (configuration) {
        const useNativeTabs = isMacintosh && configuration.nativeTabs === true;
        if (useNativeTabs) {
            return TitlebarStyle.NATIVE;
        }
        const useSimpleFullScreen = isMacintosh && configuration.nativeFullScreen === false;
        if (useSimpleFullScreen) {
            return TitlebarStyle.NATIVE;
        }
        const style = configuration.titleBarStyle;
        if (style === TitlebarStyle.NATIVE || style === TitlebarStyle.CUSTOM) {
            return style;
        }
    }
    return isLinux && product$1.quality === 'stable' ? TitlebarStyle.NATIVE : TitlebarStyle.CUSTOM;
}
const DEFAULT_CUSTOM_TITLEBAR_HEIGHT = 35;
function useWindowControlsOverlay(configurationService) {
    if (isMacintosh || isWeb) {
        return false;
    }
    if (hasNativeTitlebar(configurationService)) {
        return false;
    }
    if (isLinux) {
        const setting = configurationService.getValue('window.experimentalControlOverlay');
        if (typeof setting === 'boolean') {
            return setting;
        }
    }
    return true;
}

export { CustomTitleBarVisibility, DEFAULT_CUSTOM_TITLEBAR_HEIGHT, TitleBarSetting, TitlebarStyle, WindowMinimumSize, getMenuBarVisibility, getTitleBarStyle, hasCustomTitlebar, hasNativeTitlebar, isFileToOpen, isFolderToOpen, isWorkspaceToOpen, useWindowControlsOverlay };
