
import { localize } from '../../../../nls.js';
import { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
import { language } from '../../../../base/common/platform.js';

const HasSpeechProvider = ( new RawContextKey("hasSpeechProvider", false, {
    type: "boolean",
    description: ( localize(12792, "A speech provider is registered to the speech service."))
}));
const SpeechToTextInProgress = ( new RawContextKey("speechToTextInProgress", false, {
    type: "boolean",
    description: ( localize(12793, "A speech-to-text session is in progress."))
}));
const TextToSpeechInProgress = ( new RawContextKey("textToSpeechInProgress", false, {
    type: "boolean",
    description: ( localize(12794, "A text-to-speech session is in progress."))
}));
var SpeechToTextStatus;
(function(SpeechToTextStatus) {
    SpeechToTextStatus[SpeechToTextStatus["Started"] = 1] = "Started";
    SpeechToTextStatus[SpeechToTextStatus["Recognizing"] = 2] = "Recognizing";
    SpeechToTextStatus[SpeechToTextStatus["Recognized"] = 3] = "Recognized";
    SpeechToTextStatus[SpeechToTextStatus["Stopped"] = 4] = "Stopped";
    SpeechToTextStatus[SpeechToTextStatus["Error"] = 5] = "Error";
})(SpeechToTextStatus || (SpeechToTextStatus = {}));
var TextToSpeechStatus;
(function(TextToSpeechStatus) {
    TextToSpeechStatus[TextToSpeechStatus["Started"] = 1] = "Started";
    TextToSpeechStatus[TextToSpeechStatus["Stopped"] = 2] = "Stopped";
    TextToSpeechStatus[TextToSpeechStatus["Error"] = 3] = "Error";
})(TextToSpeechStatus || (TextToSpeechStatus = {}));
var KeywordRecognitionStatus;
(function(KeywordRecognitionStatus) {
    KeywordRecognitionStatus[KeywordRecognitionStatus["Recognized"] = 1] = "Recognized";
    KeywordRecognitionStatus[KeywordRecognitionStatus["Stopped"] = 2] = "Stopped";
    KeywordRecognitionStatus[KeywordRecognitionStatus["Canceled"] = 3] = "Canceled";
})(KeywordRecognitionStatus || (KeywordRecognitionStatus = {}));
var AccessibilityVoiceSettingId;
(function(AccessibilityVoiceSettingId) {
    AccessibilityVoiceSettingId["SpeechTimeout"] = "accessibility.voice.speechTimeout";
    AccessibilityVoiceSettingId["AutoSynthesize"] = "accessibility.voice.autoSynthesize";
    AccessibilityVoiceSettingId["SpeechLanguage"] = "accessibility.voice.speechLanguage";
    AccessibilityVoiceSettingId["IgnoreCodeBlocks"] = "accessibility.voice.ignoreCodeBlocks";
})(AccessibilityVoiceSettingId || (AccessibilityVoiceSettingId = {}));
const SPEECH_LANGUAGE_CONFIG = AccessibilityVoiceSettingId.SpeechLanguage;
const SPEECH_LANGUAGES = {
    ["da-DK"]: {
        name: ( localize(12795, "Danish (Denmark)"))
    },
    ["de-DE"]: {
        name: ( localize(12796, "German (Germany)"))
    },
    ["en-AU"]: {
        name: ( localize(12797, "English (Australia)"))
    },
    ["en-CA"]: {
        name: ( localize(12798, "English (Canada)"))
    },
    ["en-GB"]: {
        name: ( localize(12799, "English (United Kingdom)"))
    },
    ["en-IE"]: {
        name: ( localize(12800, "English (Ireland)"))
    },
    ["en-IN"]: {
        name: ( localize(12801, "English (India)"))
    },
    ["en-NZ"]: {
        name: ( localize(12802, "English (New Zealand)"))
    },
    ["en-US"]: {
        name: ( localize(12803, "English (United States)"))
    },
    ["es-ES"]: {
        name: ( localize(12804, "Spanish (Spain)"))
    },
    ["es-MX"]: {
        name: ( localize(12805, "Spanish (Mexico)"))
    },
    ["fr-CA"]: {
        name: ( localize(12806, "French (Canada)"))
    },
    ["fr-FR"]: {
        name: ( localize(12807, "French (France)"))
    },
    ["hi-IN"]: {
        name: ( localize(12808, "Hindi (India)"))
    },
    ["it-IT"]: {
        name: ( localize(12809, "Italian (Italy)"))
    },
    ["ja-JP"]: {
        name: ( localize(12810, "Japanese (Japan)"))
    },
    ["ko-KR"]: {
        name: ( localize(12811, "Korean (South Korea)"))
    },
    ["nl-NL"]: {
        name: ( localize(12812, "Dutch (Netherlands)"))
    },
    ["pt-PT"]: {
        name: ( localize(12813, "Portuguese (Portugal)"))
    },
    ["pt-BR"]: {
        name: ( localize(12814, "Portuguese (Brazil)"))
    },
    ["ru-RU"]: {
        name: ( localize(12815, "Russian (Russia)"))
    },
    ["sv-SE"]: {
        name: ( localize(12816, "Swedish (Sweden)"))
    },
    ["tr-TR"]: {
        name: ( localize(12817, "Turkish (Türkiye)"))
    },
    ["zh-CN"]: {
        name: ( localize(12818, "Chinese (Simplified, China)"))
    },
    ["zh-HK"]: {
        name: ( localize(12819, "Chinese (Traditional, Hong Kong)"))
    },
    ["zh-TW"]: {
        name: ( localize(12820, "Chinese (Traditional, Taiwan)"))
    }
};
function speechLanguageConfigToLanguage(config, lang = language) {
    if (typeof config === "string") {
        if (config === "auto") {
            if (lang !== "en") {
                const langParts = lang.split("-");
                return speechLanguageConfigToLanguage(`${langParts[0]}-${(langParts[1] ?? langParts[0]).toUpperCase()}`);
            }
        } else {
            if (SPEECH_LANGUAGES[config]) {
                return config;
            }
        }
    }
    return "en-US";
}

export { AccessibilityVoiceSettingId, HasSpeechProvider, KeywordRecognitionStatus, SPEECH_LANGUAGES, SPEECH_LANGUAGE_CONFIG, SpeechToTextInProgress, SpeechToTextStatus, TextToSpeechInProgress, TextToSpeechStatus, speechLanguageConfigToLanguage };
