import { localizeWithPath } from '../../../../nls.js';
import { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
import { language } from '../../../../base/common/platform.js';
const ISpeechService = ( createDecorator('speechService'));
const HasSpeechProvider = ( new RawContextKey('hasSpeechProvider', false, { type: 'string', description: ( localizeWithPath(
    'vs/workbench/contrib/speech/common/speechService',
    'hasSpeechProvider',
    "A speech provider is registered to the speech service."
)) }));
const SpeechToTextInProgress = ( new RawContextKey(
    'speechToTextInProgress',
    false,
    { type: 'string', description: ( localizeWithPath(
        'vs/workbench/contrib/speech/common/speechService',
        'speechToTextInProgress',
        "A speech-to-text 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 = {})));
var KeywordRecognitionStatus;
( (function(KeywordRecognitionStatus) {
    KeywordRecognitionStatus[KeywordRecognitionStatus["Recognized"] = 1] = "Recognized";
    KeywordRecognitionStatus[KeywordRecognitionStatus["Stopped"] = 2] = "Stopped";
    KeywordRecognitionStatus[KeywordRecognitionStatus["Canceled"] = 3] = "Canceled";
})(KeywordRecognitionStatus || (KeywordRecognitionStatus = {})));
const SPEECH_LANGUAGE_CONFIG = 'accessibility.voice.speechLanguage';
const SPEECH_LANGUAGES = {
    ['da-DK']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.da-DK',
            "Danish (Denmark)"
        ))
    },
    ['de-DE']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.de-DE',
            "German (Germany)"
        ))
    },
    ['en-AU']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.en-AU',
            "English (Australia)"
        ))
    },
    ['en-CA']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.en-CA',
            "English (Canada)"
        ))
    },
    ['en-GB']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.en-GB',
            "English (United Kingdom)"
        ))
    },
    ['en-IE']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.en-IE',
            "English (Ireland)"
        ))
    },
    ['en-IN']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.en-IN',
            "English (India)"
        ))
    },
    ['en-NZ']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.en-NZ',
            "English (New Zealand)"
        ))
    },
    ['en-US']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.en-US',
            "English (United States)"
        ))
    },
    ['es-ES']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.es-ES',
            "Spanish (Spain)"
        ))
    },
    ['es-MX']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.es-MX',
            "Spanish (Mexico)"
        ))
    },
    ['fr-CA']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.fr-CA',
            "French (Canada)"
        ))
    },
    ['fr-FR']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.fr-FR',
            "French (France)"
        ))
    },
    ['hi-IN']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.hi-IN',
            "Hindi (India)"
        ))
    },
    ['it-IT']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.it-IT',
            "Italian (Italy)"
        ))
    },
    ['ja-JP']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.ja-JP',
            "Japanese (Japan)"
        ))
    },
    ['ko-KR']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.ko-KR',
            "Korean (South Korea)"
        ))
    },
    ['nl-NL']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.nl-NL',
            "Dutch (Netherlands)"
        ))
    },
    ['pt-PT']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.pt-PT',
            "Portuguese (Portugal)"
        ))
    },
    ['pt-BR']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.pt-BR',
            "Portuguese (Brazil)"
        ))
    },
    ['ru-RU']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.ru-RU',
            "Russian (Russia)"
        ))
    },
    ['sv-SE']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.sv-SE',
            "Swedish (Sweden)"
        ))
    },
    ['tr-TR']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.tr-TR',
            "Turkish (Türkiye)"
        ))
    },
    ['zh-CN']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.zh-CN',
            "Chinese (Simplified, China)"
        ))
    },
    ['zh-HK']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.zh-HK',
            "Chinese (Traditional, Hong Kong)"
        ))
    },
    ['zh-TW']: {
        name: ( localizeWithPath(
            'vs/workbench/contrib/speech/common/speechService',
            'speechLanguage.zh-TW',
            "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 { HasSpeechProvider, ISpeechService, KeywordRecognitionStatus, SPEECH_LANGUAGES, SPEECH_LANGUAGE_CONFIG, SpeechToTextInProgress, SpeechToTextStatus, speechLanguageConfigToLanguage };
