{"version":3,"sources":["jsdelivr-header.js","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/microsoft.cognitiveservices.speech.sdk.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/Exports.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/CognitiveSubscriptionKeyAuthentication.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Exports.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/AudioSourceEvents.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/PlatformEvent.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Guid.ts","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/index.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/v1.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/rng.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/stringify.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/validate.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/regex.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/v3.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/v35.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/parse.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/md5.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/v4.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/native.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/v5.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/sha1.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/nil.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/uuid/dist/commonjs-browser/version.js","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/ConnectionEvents.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/ConnectionMessage.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Error.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/ConnectionOpenResponse.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/DeferralMap.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/DialogEvents.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Events.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/EventSource.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/IConnection.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/List.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Promise.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Queue.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/RawWebsocketMessage.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/RiffPcmEncoder.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Stream.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/TranslationStatus.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/ChunkedArrayBufferStream.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/Timeout.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/OCSPEvents.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/BackgroundError.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/HeaderNames.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/IAuthentication.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/CognitiveTokenAuthentication.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/IntentConnectionFactory.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/Exports.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/ConsoleLoggingListener.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/LogLevel.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Contracts.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/MicAudioSource.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/AudioStreamFormat.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/FileAudioSource.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/PCMRecorder.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/WebsocketConnection.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/WebsocketMessageAdapter.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/ReplayableAudioNode.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/ProxyInfo.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Exports.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/AudioConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/AudioFileWriter.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/AudioInputStream.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/AudioOutputStream.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/AudioOutputFormat.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisOutputFormat.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/CancellationReason.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/PullAudioInputStreamCallback.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/PushAudioOutputStreamCallback.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/KeywordRecognitionModel.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SessionEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/RecognitionEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/OutputFormat.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/IntentRecognitionEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/RecognitionResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechRecognitionResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/IntentRecognitionResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/LanguageUnderstandingModel.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechRecognitionEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechRecognitionCanceledEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/CancellationEventArgsBase.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TranslationRecognitionEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TranslationSynthesisEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TranslationRecognitionResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TranslationSynthesisResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ResultReason.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechTranslationConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PropertyCollection.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PropertyId.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Recognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/IntentRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/VoiceProfileType.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TranslationRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Connection.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ConnectionMessage.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Translations.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/NoMatchReason.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/NoMatchDetails.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TranslationRecognitionCanceledEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/IntentRecognitionCanceledEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/CancellationDetailsBase.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/CancellationDetails.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/CancellationErrorCodes.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ConnectionEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ServiceEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PhraseListGrammar.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/DialogServiceConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/BotFrameworkConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/CustomCommandsConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/DialogServiceConnector.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/DialogConnectorFactory.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/ConnectionFactoryBase.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/QueryParameterNames.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ActivityReceivedEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/TurnStatusReceivedEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/TurnStatusPayload.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ServicePropertyChannel.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ProfanityOption.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/BaseAudioPlayer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ConnectionMessageEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/VoiceProfile.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/VoiceProfileEnrollmentResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/VoiceProfileResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/VoiceProfilePhraseResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/VoiceProfileClient.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeakerRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeakerIdentificationModel.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeakerVerificationModel.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AutoDetectSourceLanguageConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/LanguageIdMode.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AutoDetectSourceLanguageResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SourceLanguageConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeakerRecognitionResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/Exports.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/Conversation.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationCommon.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationExpirationEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationParticipantsChangedEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationTranslationCanceledEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationTranslationEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationTranslationResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationTranslator.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationTranslatorConnectionFactory.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common/src/common/StringUtils.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationTranscriber.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/IParticipant.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ParticipantChangedReason.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/Meeting.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/MeetingTranscriptionCanceledEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/MeetingTranscriber.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Transcription/src/sdk/Transcription/ConversationTranscriptionResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Synthesizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SynthesisResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisWordBoundaryEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisBookmarkEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisVisemeEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SpeechSynthesisBoundaryType.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/SynthesisVoicesResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/VoiceInfo.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/src/sdk/Audio/SpeakerAudioDestination.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/ConversationTranscriptionCanceledEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/MeetingTranscriptionCanceledEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PronunciationAssessmentGradingSystem.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PronunciationAssessmentGranularity.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PronunciationAssessmentConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/PronunciationAssessmentResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AvatarConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AvatarEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AvatarSynthesizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechSynthesisConnectionFactory.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AvatarVideoFormat.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/AvatarWebRTCConnectionResult.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/src/sdk/Diagnostics.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/RestMessageAdapter.ts","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/bent/src/browser.js","webpack://microsoft-cognitiveservices-speech-sdk/node_modules/bent/src/core.js","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/src/common.browser/RestConfigBase.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeakerRecognitionConnectionFactory.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/RecognitionEvents.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/ServiceRecognizerBase.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechConnectionMessage.Internal.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/ConversationServiceRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/RecognizerConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/WebsocketMessageFormatter.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechConnectionFactory.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/ConversationTranscriberConnectionFactory.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/TranscriberConnectionFactory.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/TranslationConnectionFactory.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/EnumTranslation.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/Enums.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/TranslationSynthesisEnd.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/TranslationHypothesis.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/TranslationPhrase.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/TranslationServiceRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/SpeechDetected.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/SpeechHypothesis.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/SpeechKeyword.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechServiceRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/ConversationTranscriptionServiceRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/TranscriptionServiceRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/DetailedSpeechPhrase.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/SimpleSpeechPhrase.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/AddedLmIntent.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/IntentServiceRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/IntentResponse.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/RequestSession.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/ServiceTelemetryListener.Internal.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechContext.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/DynamicGrammarBuilder.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/DialogServiceAdapter.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/DialogServiceTurnStateManager.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/DialogServiceTurnState.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/ActivityResponsePayload.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/AgentConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/Exports.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationManager.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationConnectionConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationTranslatorRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationConnectionFactory.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationWebsocketMessageFormatter.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationConnectionMessage.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationServiceAdapter.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationRequestSession.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationTranslatorEventArgs.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/ConversationTranslatorInterfaces.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/ServiceMessages/src/common.speech/Transcription/ServiceMessages/Exports.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/ServiceMessages/src/common.speech/Transcription/ServiceMessages/CommandResponsePayload.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/ServiceMessages/src/common.speech/Transcription/ServiceMessages/ParticipantResponsePayload.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/ServiceMessages/src/common.speech/Transcription/ServiceMessages/TranslationResponsePayload.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/Transcription/src/common.speech/Transcription/TranscriberRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceMessages/src/common.speech/ServiceMessages/SynthesisAudioMetadata.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SynthesisTurn.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SynthesisEvents.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SynthesisAdapterBase.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/AvatarSynthesisAdapter.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechSynthesisAdapter.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SynthesisRestAdapter.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SynthesizerConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SynthesisContext.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeakerRecognitionConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeakerServiceRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/VoiceServiceRecognizer.ts","webpack://microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/src/common.speech/SpeechServiceConfig.ts","webpack://microsoft-cognitiveservices-speech-sdk/webpack/bootstrap","/npm/microsoft-cognitiveservices-speech-sdk@1.34.0/distrib/browser/webpack:/microsoft-cognitiveservices-speech-sdk/webpack/runtime/compat get default export","/npm/microsoft-cognitiveservices-speech-sdk@1.34.0/distrib/browser/webpack:/microsoft-cognitiveservices-speech-sdk/webpack/runtime/define property getters","/npm/microsoft-cognitiveservices-speech-sdk@1.34.0/distrib/browser/webpack:/microsoft-cognitiveservices-speech-sdk/webpack/runtime/hasOwnProperty shorthand","/npm/microsoft-cognitiveservices-speech-sdk@1.34.0/distrib/browser/webpack:/microsoft-cognitiveservices-speech-sdk/webpack/runtime/make namespace object","webpack://microsoft-cognitiveservices-speech-sdk/bundleApp.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,+YCCK,IAJL,EAAA,GAIS,aAGT,EAAA,EAAA,IAAA,E,qjBCLA,EAAA,EAAA,GAAA,GACA,EAAA,EAAA,IAAA,GACA,EAAA,EAAA,IAAA,GACA,EAAA,EAAA,IAAA,GACA,EAAA,EAAA,IAAA,GACA,EAAA,EAAA,IAAA,GACA,EAAA,EAAA,KAAA,GACA,EAAA,EAAA,KAAA,GACA,EAAA,EAAA,KAAA,GACA,EAAA,EAAA,KA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ACR,IAAK,+BACD,OAAO,IAAI,EACP,EAAA,eAAe,MACf,EACA,KACA,IACA,GACA,EACA,EACA,iCACA,GACR,IAAK,gCACD,OAAO,IAAI,EACP,EAAA,eAAe,MACf,EACA,KACA,IACA,GACA,EACA,EACA,GACA,GACR,IAAK,kCACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACA,EACA,GACA,GACR,IAAK,mCACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,MACA,EACA,GACA,EACA,GACA,GACR,IAAK,kCACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACA,EACA,GACA,GACR,IAAK,kCACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACA,EACA,GACA,GACR,IAAK,kCACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,MACA,EACA,GACA,EACA,GACA,GACR,IAAK,mCACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,MACA,EACA,GACA,EACA,GACA,GACR,IAAK,gCACD,OAAO,IAAI,EACP,EAAA,eAAe,UACf,EACA,KACA,KACA,EACA,GACA,EACA,GACA,GAER,IAAK,2BACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,IACA,KACA,EACA,GACA,EACA,2BACA,GACR,IAAK,4BACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACA,EACA,4BACA,GACR,IAAK,4BACD,OAAO,IAAI,EACP,EAAA,eAAe,MACf,EACA,IACA,IACA,EACA,EACA,EACA,4BACA,GACR,IAAK,2BACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACA,EACA,4BACA,GACR,IAAK,2BACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACA,EACA,4BACA,GACR,IAAK,0BACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,IACA,KACA,EACA,GACA,EACA,2BACA,GACR,IAAK,4BACD,OAAO,IAAI,EACP,EAAA,eAAe,SACf,EACA,KACA,KACA,EACA,GACA,EACA,GACA,GACR,IAAK,4BACD,OAAO,IAAI,EACP,EAAA,eAAe,SACf,EACA,KACA,KACA,EACA,GACA,EACA,GACA,GACR,IAAK,2BACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACA,EACA,4BACA,GACR,IAAK,4BACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACA,EACA,4BACA,GACR,IAAK,kCACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,MACA,EACA,GACA,EACA,GACA,GACR,IAAK,mCACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,MACA,EACA,GACA,EACA,GACA,GACR,IAAK,4BACD,OAAO,IAAI,EACP,EAAA,eAAe,SACf,EACA,KACA,KACA,EACA,GACA,EACA,GACA,GACR,IAAK,6BACD,OAAO,IAAI,EACP,EAAA,eAAe,UACf,EACA,KACA,IACA,EACA,GACA,EACA,GACA,GACR,IAAK,6BACD,OAAO,IAAI,EACP,EAAA,eAAe,UACf,EACA,KACA,IACA,EACA,GACA,EACA,GACA,GACR,IAAK,oCACD,OAAO,IAAI,EACP,EAAA,eAAe,UACf,EACA,KACA,IACA,EACA,GACA,EACA,GACA,GACR,IAAK,qCACD,OAAO,IAAI,EACP,EAAA,eAAe,KACf,EACA,KACA,IACA,EACA,GACA,EACA,GACA,GACR,IAAK,qCACD,OAAO,IAAI,EACP,EAAA,eAAe,KACf,EACA,KACA,IACA,EACA,GACA,EACA,GACA,GACR,IAAK,qCACD,OAAO,IAAI,EACP,EAAA,eAAe,KACf,EACA,KACA,IACA,EACA,GACA,EACA,GACA,GACR,IAAK,8BACD,OAAO,IAAI,EACP,EAAA,eAAe,KACf,EACA,KACA,KACA,EACA,GACA,EACA,GACA,GACR,IAAK,8BACD,OAAO,IAAI,EACP,EAAA,eAAe,KACf,EACA,KACA,IACA,EACA,GACA,EACA,GACA,GACR,IAAK,gCACD,OAAO,IAAI,EACP,EAAA,eAAe,UACf,EACA,KACA,KACA,EACA,GACA,EACA,GACA,GACR,IAAK,0BACD,OAAO,IAAI,EACP,EAAA,eAAe,KACf,EACA,IACA,IACA,EACA,EACA,EACA,GACA,GACR,IAAK,2BACD,OAAO,IAAI,EACP,EAAA,eAAe,KACf,EACA,IACA,IACA,EACA,EACA,EACA,2BACA,GACR,IAAK,6BACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,MACA,MACA,EACA,GACA,EACA,GACA,GACR,IAAK,8BACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,MACA,MACA,EACA,GACA,EACA,8BACA,GACR,IAAK,6BACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,MACA,MACA,EACA,GACA,EACA,GACA,GACR,IAAK,8BACD,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,MACA,MACA,EACA,GACA,EACA,8BACA,GAER,QACI,OAAO,IAAI,EACP,EAAA,eAAe,IACf,EACA,KACA,KACA,EACA,GACA,4BACA,4BACA,GAEhB,CAEO,6BAAO,GACV,OAAO,EAAsB,sCACN,oBAAX,OAA0B,kCAAoC,4BAC9E,CAgBA,aAAW,GACP,OAAO,KAAK,YAChB,CAQA,UAAW,GACP,GAAI,KAAK,UACL,OAAO,KAAK,UAGpB,CASO,YAAA,CAAa,GAChB,GAAI,KAAK,aAAc,CACnB,MAAM,EAAO,IAAI,SAAS,KAAK,YAC/B,EAAK,UAAU,EAAG,EAAc,KAAK,WAAW,WAAa,GAAG,GAChE,EAAK,UAAU,GAAI,GAAa,E,CAExC,CAQA,4BAAW,GACP,OAAO,KAAK,2BAChB,CAQO,SAAA,CAAU,GACb,IAAK,KAAK,UACN,OAAO,EAEX,KAAK,aAAa,EAAM,YACxB,MAAM,EAAM,IAAI,WAAW,EAAM,WAAa,KA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,CAAA,EAAA,IAAA,OAAA,UAAA,eAAA,KAAA,EAAA,GCCA,EAAA,EAAA,IACA,oBAAA,eAAA,aACA,OAAA,eAAA,EAAA,OAAA,YAAA,CAAuD,MAAA,WAEvD,OAAA,eAAA,EAAA,cAAgD,OAAA,GAAa,E,8CCD7D,OAAA,UAAmB,C","file":"/npm/microsoft-cognitiveservices-speech-sdk@1.34.0/distrib/browser/microsoft.cognitiveservices.speech.sdk.bundle.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/microsoft-cognitiveservices-speech-sdk@1.34.0/distrib/browser/microsoft.cognitiveservices.speech.sdk.bundle.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/* eslint-disable @typescript-eslint/no-unused-vars */\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\nimport { AgentConfig } from \"./src/common.speech/Exports.js\";\r\n\r\n// Note: this instantiation ensures the above import isn't\r\n// removed on compile. The import being absent causes an error on running\r\nvoid new AgentConfig();\r\n\r\n// Speech SDK API\r\nexport * from \"./src/sdk/Exports.js\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// Make sure not to export internal modules.\r\n//\r\nexport * from \"./CognitiveSubscriptionKeyAuthentication.js\";\r\nexport * from \"./CognitiveTokenAuthentication.js\";\r\nexport * from \"./IAuthentication.js\";\r\nexport * from \"./IConnectionFactory.js\";\r\nexport * from \"./ISynthesisConnectionFactory.js\";\r\nexport * from \"./IntentConnectionFactory.js\";\r\nexport * from \"./SpeakerRecognitionConnectionFactory.js\";\r\nexport * from \"./RecognitionEvents.js\";\r\nexport * from \"./ServiceRecognizerBase.js\";\r\nexport * from \"./ConversationServiceRecognizer.js\";\r\nexport * from \"./RecognizerConfig.js\";\r\nexport * from \"./SpeechServiceInterfaces.js\";\r\nexport * from \"./WebsocketMessageFormatter.js\";\r\nexport * from \"./SpeechConnectionFactory.js\";\r\nexport * from \"./ConversationTranscriberConnectionFactory.js\";\r\nexport * from \"./TranscriberConnectionFactory.js\";\r\nexport * from \"./TranslationConnectionFactory.js\";\r\nexport * from \"./SpeechSynthesisConnectionFactory.js\";\r\nexport * from \"./EnumTranslation.js\";\r\nexport * from \"./ServiceMessages/Enums.js\";\r\nexport * from \"./ServiceMessages/TranslationSynthesisEnd.js\";\r\nexport * from \"./ServiceMessages/TranslationHypothesis.js\";\r\nexport * from \"./ServiceMessages/TranslationPhrase.js\";\r\nexport * from \"./TranslationServiceRecognizer.js\";\r\nexport * from \"./ServiceMessages/SpeechDetected.js\";\r\nexport * from \"./ServiceMessages/SpeechHypothesis.js\";\r\nexport * from \"./ServiceMessages/SpeechKeyword.js\";\r\nexport * from \"./SpeechServiceRecognizer.js\";\r\nexport * from \"./ConversationTranscriptionServiceRecognizer.js\";\r\nexport * from \"./TranscriptionServiceRecognizer.js\";\r\nexport * from \"./ServiceMessages/DetailedSpeechPhrase.js\";\r\nexport * from \"./ServiceMessages/SimpleSpeechPhrase.js\";\r\nexport * from \"./AddedLmIntent.js\";\r\nexport * from \"./IntentServiceRecognizer.js\";\r\nexport * from \"./ServiceMessages/IntentResponse.js\";\r\nexport * from \"./ServiceMessages/SpeakerResponse.js\";\r\nexport * from \"./RequestSession.js\";\r\nexport * from \"./SpeechContext.js\";\r\nexport * from \"./DynamicGrammarBuilder.js\";\r\nexport * from \"./DynamicGrammarInterfaces.js\";\r\nexport * from \"./DialogServiceAdapter.js\";\r\nexport * from \"./AgentConfig.js\";\r\nexport * from \"./Transcription/Exports.js\";\r\nexport * from \"./ServiceMessages/SynthesisAudioMetadata.js\";\r\nexport * from \"./SynthesisTurn.js\";\r\nexport * from \"./SynthesisAdapterBase.js\";\r\nexport { AvatarSynthesisAdapter } from \"./AvatarSynthesisAdapter.js\";\r\nexport { SpeechSynthesisAdapter } from \"./SpeechSynthesisAdapter.js\";\r\nexport * from \"./SynthesisRestAdapter.js\";\r\nexport * from \"./SynthesizerConfig.js\";\r\nexport * from \"./SynthesisContext.js\";\r\nexport * from \"./SpeakerRecognitionConfig.js\";\r\nexport * from \"./SpeakerServiceRecognizer.js\";\r\nexport * from \"./VoiceServiceRecognizer.js\";\r\nexport * from \"./SpeechServiceConfig.js\";\r\n\r\nexport const OutputFormatPropertyName: string = \"OutputFormat\";\r\nexport const CancellationErrorCodePropertyName: string = \"CancellationErrorCode\";\r\nexport const ServicePropertiesPropertyName: string = \"ServiceProperties\";\r\nexport const ForceDictationPropertyName: string = \"ForceDictation\";\r\nexport const AutoDetectSourceLanguagesOpenRangeOptionName: string = \"OpenRange\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ArgumentNullError,\r\n} from \"../common/Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport {\r\n    AuthInfo,\r\n    IAuthentication\r\n} from \"./IAuthentication.js\";\r\n\r\n/**\r\n * @class\r\n */\r\nexport class CognitiveSubscriptionKeyAuthentication implements IAuthentication {\r\n    private privAuthInfo: AuthInfo;\r\n\r\n    /**\r\n     * Creates and initializes an instance of the CognitiveSubscriptionKeyAuthentication class.\r\n     * @constructor\r\n     * @param {string} subscriptionKey - The subscription key\r\n     */\r\n    public constructor(subscriptionKey: string) {\r\n        if (!subscriptionKey) {\r\n            throw new ArgumentNullError(\"subscriptionKey\");\r\n        }\r\n\r\n        this.privAuthInfo = new AuthInfo(HeaderNames.AuthKey, subscriptionKey);\r\n    }\r\n\r\n    /**\r\n     * Fetches the subscription key.\r\n     * @member\r\n     * @function\r\n     * @public\r\n     * @param {string} authFetchEventId - The id to fetch.\r\n     */\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    public fetch(authFetchEventId: string): Promise<AuthInfo> {\r\n        return Promise.resolve(this.privAuthInfo);\r\n    }\r\n\r\n    /**\r\n     * Fetches the subscription key.\r\n     * @member\r\n     * @function\r\n     * @public\r\n     * @param {string} authFetchEventId - The id to fetch.\r\n     */\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    public fetchOnExpiry(authFetchEventId: string): Promise<AuthInfo> {\r\n        return Promise.resolve(this.privAuthInfo);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport * from \"./AudioSourceEvents.js\";\r\nexport * from \"./ConnectionEvents.js\";\r\nexport * from \"./ConnectionMessage.js\";\r\nexport * from \"./ConnectionOpenResponse.js\";\r\nexport * from \"./DeferralMap.js\";\r\nexport * from \"./DialogEvents.js\";\r\nexport * from \"./Error.js\";\r\nexport * from \"./Events.js\";\r\nexport * from \"./EventSource.js\";\r\nexport * from \"./Guid.js\";\r\nexport * from \"./IAudioSource.js\";\r\nexport * from \"./IConnection.js\";\r\nexport * from \"./IDetachable.js\";\r\nexport * from \"./IDictionary.js\";\r\nexport * from \"./IDisposable.js\";\r\nexport * from \"./IEventListener.js\";\r\nexport * from \"./IEventSource.js\";\r\nexport * from \"./IErrorMessages.js\";\r\nexport * from \"./ITimer.js\";\r\nexport * from \"./IWebsocketMessageFormatter.js\";\r\nexport * from \"./List.js\";\r\nexport * from \"./PlatformEvent.js\";\r\nexport * from \"./Promise.js\";\r\nexport * from \"./Queue.js\";\r\nexport * from \"./RawWebsocketMessage.js\";\r\nexport * from \"./RiffPcmEncoder.js\";\r\nexport * from \"./Stream.js\";\r\nexport { TranslationStatus } from \"../common.speech/TranslationStatus.js\";\r\nexport * from \"./ChunkedArrayBufferStream.js\";\r\nexport * from \"./IAudioDestination.js\";\r\nexport * from \"./Timeout.js\";\r\nexport * from \"./OCSPEvents.js\";\r\nexport * from \"./BackgroundError.js\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { EventType, PlatformEvent } from \"./PlatformEvent.js\";\r\n\r\nexport class AudioSourceEvent extends PlatformEvent {\r\n    private privAudioSourceId: string;\r\n\r\n    public constructor(eventName: string, audioSourceId: string, eventType: EventType = EventType.Info) {\r\n        super(eventName, eventType);\r\n        this.privAudioSourceId = audioSourceId;\r\n    }\r\n\r\n    public get audioSourceId(): string {\r\n        return this.privAudioSourceId;\r\n    }\r\n}\r\n\r\nexport class AudioSourceInitializingEvent extends AudioSourceEvent {\r\n    public constructor(audioSourceId: string) {\r\n        super(\"AudioSourceInitializingEvent\", audioSourceId);\r\n    }\r\n}\r\n\r\nexport class AudioSourceReadyEvent extends AudioSourceEvent {\r\n    public constructor(audioSourceId: string) {\r\n        super(\"AudioSourceReadyEvent\", audioSourceId);\r\n    }\r\n}\r\n\r\nexport class AudioSourceOffEvent extends AudioSourceEvent {\r\n    public constructor(audioSourceId: string) {\r\n        super(\"AudioSourceOffEvent\", audioSourceId);\r\n    }\r\n}\r\n\r\nexport class AudioSourceErrorEvent extends AudioSourceEvent {\r\n    private privError: string;\r\n\r\n    public constructor(audioSourceId: string, error: string) {\r\n        super(\"AudioSourceErrorEvent\", audioSourceId, EventType.Error);\r\n        this.privError = error;\r\n    }\r\n\r\n    public get error(): string {\r\n        return this.privError;\r\n    }\r\n}\r\n\r\nexport class AudioStreamNodeEvent extends AudioSourceEvent {\r\n    private privAudioNodeId: string;\r\n\r\n    public constructor(eventName: string, audioSourceId: string, audioNodeId: string) {\r\n        super(eventName, audioSourceId);\r\n        this.privAudioNodeId = audioNodeId;\r\n    }\r\n\r\n    public get audioNodeId(): string {\r\n        return this.privAudioNodeId;\r\n    }\r\n}\r\n\r\nexport class AudioStreamNodeAttachingEvent extends AudioStreamNodeEvent {\r\n    public constructor(audioSourceId: string, audioNodeId: string) {\r\n        super(\"AudioStreamNodeAttachingEvent\", audioSourceId, audioNodeId);\r\n    }\r\n}\r\n\r\nexport class AudioStreamNodeAttachedEvent extends AudioStreamNodeEvent {\r\n    public constructor(audioSourceId: string, audioNodeId: string) {\r\n        super(\"AudioStreamNodeAttachedEvent\", audioSourceId, audioNodeId);\r\n    }\r\n}\r\n\r\nexport class AudioStreamNodeDetachedEvent extends AudioStreamNodeEvent {\r\n    public constructor(audioSourceId: string, audioNodeId: string) {\r\n        super(\"AudioStreamNodeDetachedEvent\", audioSourceId, audioNodeId);\r\n    }\r\n}\r\n\r\nexport class AudioStreamNodeErrorEvent extends AudioStreamNodeEvent {\r\n    private privError: string;\r\n\r\n    public constructor(audioSourceId: string, audioNodeId: string, error: string) {\r\n        super(\"AudioStreamNodeErrorEvent\", audioSourceId, audioNodeId);\r\n        this.privError = error;\r\n    }\r\n\r\n    public get error(): string {\r\n        return this.privError;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { createNoDashGuid } from \"./Guid.js\";\r\nimport { IStringDictionary } from \"./IDictionary.js\";\r\n\r\nexport enum EventType {\r\n    Debug,\r\n    Info,\r\n    Warning,\r\n    Error,\r\n    None,\r\n}\r\n\r\nexport class PlatformEvent {\r\n    private privName: string;\r\n    private privEventId: string;\r\n    private privEventTime: string;\r\n    private privEventType: EventType;\r\n    private privMetadata: IStringDictionary<string>;\r\n\r\n    public constructor(eventName: string, eventType: EventType) {\r\n        this.privName = eventName;\r\n        this.privEventId = createNoDashGuid();\r\n        this.privEventTime = new Date().toISOString();\r\n        this.privEventType = eventType;\r\n        this.privMetadata = { };\r\n    }\r\n\r\n    public get name(): string {\r\n        return this.privName;\r\n    }\r\n\r\n    public get eventId(): string {\r\n        return this.privEventId;\r\n    }\r\n\r\n    public get eventTime(): string {\r\n        return this.privEventTime;\r\n    }\r\n\r\n    public get eventType(): EventType {\r\n        return this.privEventType;\r\n    }\r\n\r\n    public get metadata(): IStringDictionary<string> {\r\n        return this.privMetadata;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { v4 as uuid } from \"uuid\";\r\n\r\nconst createGuid: () => string = (): string => uuid();\r\n\r\nconst createNoDashGuid: () => string = (): string => createGuid().replace(new RegExp(\"-\", \"g\"), \"\").toUpperCase();\r\n\r\nexport { createGuid, createNoDashGuid };\r\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nObject.defineProperty(exports, \"NIL\", {\n  enumerable: true,\n  get: function get() {\n    return _nil.default;\n  }\n});\nObject.defineProperty(exports, \"parse\", {\n  enumerable: true,\n  get: function get() {\n    return _parse.default;\n  }\n});\nObject.defineProperty(exports, \"stringify\", {\n  enumerable: true,\n  get: function get() {\n    return _stringify.default;\n  }\n});\nObject.defineProperty(exports, \"v1\", {\n  enumerable: true,\n  get: function get() {\n    return _v.default;\n  }\n});\nObject.defineProperty(exports, \"v3\", {\n  enumerable: true,\n  get: function get() {\n    return _v2.default;\n  }\n});\nObject.defineProperty(exports, \"v4\", {\n  enumerable: true,\n  get: function get() {\n    return _v3.default;\n  }\n});\nObject.defineProperty(exports, \"v5\", {\n  enumerable: true,\n  get: function get() {\n    return _v4.default;\n  }\n});\nObject.defineProperty(exports, \"validate\", {\n  enumerable: true,\n  get: function get() {\n    return _validate.default;\n  }\n});\nObject.defineProperty(exports, \"version\", {\n  enumerable: true,\n  get: function get() {\n    return _version.default;\n  }\n});\n\nvar _v = _interopRequireDefault(require(\"./v1.js\"));\n\nvar _v2 = _interopRequireDefault(require(\"./v3.js\"));\n\nvar _v3 = _interopRequireDefault(require(\"./v4.js\"));\n\nvar _v4 = _interopRequireDefault(require(\"./v5.js\"));\n\nvar _nil = _interopRequireDefault(require(\"./nil.js\"));\n\nvar _version = _interopRequireDefault(require(\"./version.js\"));\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nvar _stringify = _interopRequireDefault(require(\"./stringify.js\"));\n\nvar _parse = _interopRequireDefault(require(\"./parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _stringify = require(\"./stringify.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\nlet _nodeId;\n\nlet _clockseq; // Previous uuid creation time\n\n\nlet _lastMSecs = 0;\nlet _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n  let i = buf && offset || 0;\n  const b = buf || new Array(16);\n  options = options || {};\n  let node = options.node || _nodeId;\n  let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n  // specified.  We do this lazily to minimize issues related to insufficient\n  // system entropy.  See #189\n\n  if (node == null || clockseq == null) {\n    const seedBytes = options.random || (options.rng || _rng.default)();\n\n    if (node == null) {\n      // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n      node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n    }\n\n    if (clockseq == null) {\n      // Per 4.2.2, randomize (14 bit) clockseq\n      clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n    }\n  } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n  // (1582-10-15 00:00).  JSNumbers aren't precise enough for this, so\n  // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n  // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n  let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n  // cycle to simulate higher resolution clock\n\n  let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n  const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n  if (dt < 0 && options.clockseq === undefined) {\n    clockseq = clockseq + 1 & 0x3fff;\n  } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n  // time interval\n\n\n  if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n    nsecs = 0;\n  } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n  if (nsecs >= 10000) {\n    throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n  }\n\n  _lastMSecs = msecs;\n  _lastNSecs = nsecs;\n  _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n  msecs += 12219292800000; // `time_low`\n\n  const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n  b[i++] = tl >>> 24 & 0xff;\n  b[i++] = tl >>> 16 & 0xff;\n  b[i++] = tl >>> 8 & 0xff;\n  b[i++] = tl & 0xff; // `time_mid`\n\n  const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n  b[i++] = tmh >>> 8 & 0xff;\n  b[i++] = tmh & 0xff; // `time_high_and_version`\n\n  b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n  b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n  b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n  b[i++] = clockseq & 0xff; // `node`\n\n  for (let n = 0; n < 6; ++n) {\n    b[i + n] = node[n];\n  }\n\n  return buf || (0, _stringify.unsafeStringify)(b);\n}\n\nvar _default = v1;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = rng;\n// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\n\nfunction rng() {\n  // lazy load so that environments that need to polyfill have a chance to do so\n  if (!getRandomValues) {\n    // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n    getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n    if (!getRandomValues) {\n      throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n    }\n  }\n\n  return getRandomValues(rnds8);\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\nexports.unsafeStringify = unsafeStringify;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n  byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nfunction unsafeStringify(arr, offset = 0) {\n  // Note: Be careful editing this code!  It's been tuned for performance\n  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n  return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n  const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID.  If this throws, it's likely due to one\n  // of the following:\n  // - One or more input array values don't map to a hex octet (leading to\n  // \"undefined\" in the uuid)\n  // - Invalid input values for the RFC `version` or `variant` fields\n\n  if (!(0, _validate.default)(uuid)) {\n    throw TypeError('Stringified UUID is invalid');\n  }\n\n  return uuid;\n}\n\nvar _default = stringify;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _regex = _interopRequireDefault(require(\"./regex.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction validate(uuid) {\n  return typeof uuid === 'string' && _regex.default.test(uuid);\n}\n\nvar _default = validate;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\nvar _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _md = _interopRequireDefault(require(\"./md5.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v3 = (0, _v.default)('v3', 0x30, _md.default);\nvar _default = v3;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.URL = exports.DNS = void 0;\nexports.default = v35;\n\nvar _stringify = require(\"./stringify.js\");\n\nvar _parse = _interopRequireDefault(require(\"./parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction stringToBytes(str) {\n  str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n  const bytes = [];\n\n  for (let i = 0; i < str.length; ++i) {\n    bytes.push(str.charCodeAt(i));\n  }\n\n  return bytes;\n}\n\nconst DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexports.DNS = DNS;\nconst URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexports.URL = URL;\n\nfunction v35(name, version, hashfunc) {\n  function generateUUID(value, namespace, buf, offset) {\n    var _namespace;\n\n    if (typeof value === 'string') {\n      value = stringToBytes(value);\n    }\n\n    if (typeof namespace === 'string') {\n      namespace = (0, _parse.default)(namespace);\n    }\n\n    if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {\n      throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n    } // Compute hash of namespace and value, Per 4.3\n    // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n    // hashfunc([...namespace, ... value])`\n\n\n    let bytes = new Uint8Array(16 + value.length);\n    bytes.set(namespace);\n    bytes.set(value, namespace.length);\n    bytes = hashfunc(bytes);\n    bytes[6] = bytes[6] & 0x0f | version;\n    bytes[8] = bytes[8] & 0x3f | 0x80;\n\n    if (buf) {\n      offset = offset || 0;\n\n      for (let i = 0; i < 16; ++i) {\n        buf[offset + i] = bytes[i];\n      }\n\n      return buf;\n    }\n\n    return (0, _stringify.unsafeStringify)(bytes);\n  } // Function#name is not settable on some platforms (#270)\n\n\n  try {\n    generateUUID.name = name; // eslint-disable-next-line no-empty\n  } catch (err) {} // For CommonJS default export support\n\n\n  generateUUID.DNS = DNS;\n  generateUUID.URL = URL;\n  return generateUUID;\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction parse(uuid) {\n  if (!(0, _validate.default)(uuid)) {\n    throw TypeError('Invalid UUID');\n  }\n\n  let v;\n  const arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n  arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n  arr[1] = v >>> 16 & 0xff;\n  arr[2] = v >>> 8 & 0xff;\n  arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n  arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n  arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n  arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n  arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n  arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n  arr[9] = v & 0xff; // Parse ........-....-....-....-############\n  // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n  arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n  arr[11] = v / 0x100000000 & 0xff;\n  arr[12] = v >>> 24 & 0xff;\n  arr[13] = v >>> 16 & 0xff;\n  arr[14] = v >>> 8 & 0xff;\n  arr[15] = v & 0xff;\n  return arr;\n}\n\nvar _default = parse;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\n/*\n * Browser-compatible JavaScript MD5\n *\n * Modification of JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\nfunction md5(bytes) {\n  if (typeof bytes === 'string') {\n    const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n    bytes = new Uint8Array(msg.length);\n\n    for (let i = 0; i < msg.length; ++i) {\n      bytes[i] = msg.charCodeAt(i);\n    }\n  }\n\n  return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));\n}\n/*\n * Convert an array of little-endian words to an array of bytes\n */\n\n\nfunction md5ToHexEncodedArray(input) {\n  const output = [];\n  const length32 = input.length * 32;\n  const hexTab = '0123456789abcdef';\n\n  for (let i = 0; i < length32; i += 8) {\n    const x = input[i >> 5] >>> i % 32 & 0xff;\n    const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);\n    output.push(hex);\n  }\n\n  return output;\n}\n/**\n * Calculate output length with padding and bit length\n */\n\n\nfunction getOutputLength(inputLength8) {\n  return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;\n}\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\n\n\nfunction wordsToMd5(x, len) {\n  /* append padding */\n  x[len >> 5] |= 0x80 << len % 32;\n  x[getOutputLength(len) - 1] = len;\n  let a = 1732584193;\n  let b = -271733879;\n  let c = -1732584194;\n  let d = 271733878;\n\n  for (let i = 0; i < x.length; i += 16) {\n    const olda = a;\n    const oldb = b;\n    const oldc = c;\n    const oldd = d;\n    a = md5ff(a, b, c, d, x[i], 7, -680876936);\n    d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n    c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n    b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n    a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n    d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n    c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n    b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n    a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n    d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n    c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n    b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n    a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n    d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n    c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n    b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n    a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n    d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n    c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n    b = md5gg(b, c, d, a, x[i], 20, -373897302);\n    a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n    d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n    c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n    b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n    a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n    d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n    c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n    b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n    a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n    d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n    c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n    b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n    a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n    d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n    c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n    b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n    a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n    d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n    c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n    b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n    a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n    d = md5hh(d, a, b, c, x[i], 11, -358537222);\n    c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n    b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n    a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n    d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n    c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n    b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n    a = md5ii(a, b, c, d, x[i], 6, -198630844);\n    d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n    c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n    b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n    a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n    d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n    c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n    b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n    a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n    d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n    c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n    b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n    a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n    d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n    c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n    b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n    a = safeAdd(a, olda);\n    b = safeAdd(b, oldb);\n    c = safeAdd(c, oldc);\n    d = safeAdd(d, oldd);\n  }\n\n  return [a, b, c, d];\n}\n/*\n * Convert an array bytes to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\n\n\nfunction bytesToWords(input) {\n  if (input.length === 0) {\n    return [];\n  }\n\n  const length8 = input.length * 8;\n  const output = new Uint32Array(getOutputLength(length8));\n\n  for (let i = 0; i < length8; i += 8) {\n    output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;\n  }\n\n  return output;\n}\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\n\n\nfunction safeAdd(x, y) {\n  const lsw = (x & 0xffff) + (y & 0xffff);\n  const msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n  return msw << 16 | lsw & 0xffff;\n}\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\n\n\nfunction bitRotateLeft(num, cnt) {\n  return num << cnt | num >>> 32 - cnt;\n}\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\n\n\nfunction md5cmn(q, a, b, x, s, t) {\n  return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\nfunction md5ff(a, b, c, d, x, s, t) {\n  return md5cmn(b & c | ~b & d, a, b, x, s, t);\n}\n\nfunction md5gg(a, b, c, d, x, s, t) {\n  return md5cmn(b & d | c & ~d, a, b, x, s, t);\n}\n\nfunction md5hh(a, b, c, d, x, s, t) {\n  return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\nfunction md5ii(a, b, c, d, x, s, t) {\n  return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\nvar _default = md5;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _native = _interopRequireDefault(require(\"./native.js\"));\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _stringify = require(\"./stringify.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction v4(options, buf, offset) {\n  if (_native.default.randomUUID && !buf && !options) {\n    return _native.default.randomUUID();\n  }\n\n  options = options || {};\n\n  const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n\n  rnds[6] = rnds[6] & 0x0f | 0x40;\n  rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n  if (buf) {\n    offset = offset || 0;\n\n    for (let i = 0; i < 16; ++i) {\n      buf[offset + i] = rnds[i];\n    }\n\n    return buf;\n  }\n\n  return (0, _stringify.unsafeStringify)(rnds);\n}\n\nvar _default = v4;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\nconst randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nvar _default = {\n  randomUUID\n};\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _sha = _interopRequireDefault(require(\"./sha1.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v5 = (0, _v.default)('v5', 0x50, _sha.default);\nvar _default = v5;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\n// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n  switch (s) {\n    case 0:\n      return x & y ^ ~x & z;\n\n    case 1:\n      return x ^ y ^ z;\n\n    case 2:\n      return x & y ^ x & z ^ y & z;\n\n    case 3:\n      return x ^ y ^ z;\n  }\n}\n\nfunction ROTL(x, n) {\n  return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n  const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n  const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n  if (typeof bytes === 'string') {\n    const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n    bytes = [];\n\n    for (let i = 0; i < msg.length; ++i) {\n      bytes.push(msg.charCodeAt(i));\n    }\n  } else if (!Array.isArray(bytes)) {\n    // Convert Array-like to Array\n    bytes = Array.prototype.slice.call(bytes);\n  }\n\n  bytes.push(0x80);\n  const l = bytes.length / 4 + 2;\n  const N = Math.ceil(l / 16);\n  const M = new Array(N);\n\n  for (let i = 0; i < N; ++i) {\n    const arr = new Uint32Array(16);\n\n    for (let j = 0; j < 16; ++j) {\n      arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];\n    }\n\n    M[i] = arr;\n  }\n\n  M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n  M[N - 1][14] = Math.floor(M[N - 1][14]);\n  M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n  for (let i = 0; i < N; ++i) {\n    const W = new Uint32Array(80);\n\n    for (let t = 0; t < 16; ++t) {\n      W[t] = M[i][t];\n    }\n\n    for (let t = 16; t < 80; ++t) {\n      W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);\n    }\n\n    let a = H[0];\n    let b = H[1];\n    let c = H[2];\n    let d = H[3];\n    let e = H[4];\n\n    for (let t = 0; t < 80; ++t) {\n      const s = Math.floor(t / 20);\n      const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;\n      e = d;\n      d = c;\n      c = ROTL(b, 30) >>> 0;\n      b = a;\n      a = T;\n    }\n\n    H[0] = H[0] + a >>> 0;\n    H[1] = H[1] + b >>> 0;\n    H[2] = H[2] + c >>> 0;\n    H[3] = H[3] + d >>> 0;\n    H[4] = H[4] + e >>> 0;\n  }\n\n  return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\nvar _default = sha1;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\nvar _default = '00000000-0000-0000-0000-000000000000';\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction version(uuid) {\n  if (!(0, _validate.default)(uuid)) {\n    throw TypeError('Invalid UUID');\n  }\n\n  return parseInt(uuid.slice(14, 15), 16);\n}\n\nvar _default = version;\nexports.default = _default;","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { ConnectionMessage } from \"./ConnectionMessage.js\";\r\nimport { IStringDictionary } from \"./IDictionary.js\";\r\nimport { EventType, PlatformEvent } from \"./PlatformEvent.js\";\r\n\r\nexport class ServiceEvent extends PlatformEvent {\r\n    private privJsonResult: string;\r\n\r\n    public constructor(eventName: string, jsonstring: string, eventType: EventType = EventType.Info) {\r\n      super(eventName, eventType);\r\n      this.privJsonResult = jsonstring;\r\n    }\r\n\r\n    public get jsonString(): string {\r\n        return this.privJsonResult;\r\n    }\r\n}\r\n\r\nexport class ConnectionEvent extends PlatformEvent {\r\n    private privConnectionId: string;\r\n\r\n    public constructor(eventName: string, connectionId: string, eventType: EventType = EventType.Info) {\r\n        super(eventName, eventType);\r\n        this.privConnectionId = connectionId;\r\n    }\r\n\r\n    public get connectionId(): string {\r\n        return this.privConnectionId;\r\n    }\r\n}\r\n\r\nexport class ConnectionStartEvent extends ConnectionEvent {\r\n    private privUri: string;\r\n    private privHeaders: IStringDictionary<string>;\r\n\r\n    public constructor(connectionId: string, uri: string, headers?: IStringDictionary<string>) {\r\n        super(\"ConnectionStartEvent\", connectionId);\r\n        this.privUri = uri;\r\n        this.privHeaders = headers;\r\n    }\r\n\r\n    public get uri(): string {\r\n        return this.privUri;\r\n    }\r\n\r\n    public get headers(): IStringDictionary<string> {\r\n        return this.privHeaders;\r\n    }\r\n}\r\n\r\nexport class ConnectionEstablishedEvent extends ConnectionEvent {\r\n    public constructor(connectionId: string) {\r\n        super(\"ConnectionEstablishedEvent\", connectionId);\r\n    }\r\n}\r\n\r\nexport class ConnectionClosedEvent extends ConnectionEvent {\r\n    private privReason: string;\r\n    private privStatusCode: number;\r\n\r\n    public constructor(connectionId: string, statusCode: number, reason: string) {\r\n        super(\"ConnectionClosedEvent\", connectionId, EventType.Debug);\r\n        this.privReason = reason;\r\n        this.privStatusCode = statusCode;\r\n    }\r\n\r\n    public get reason(): string {\r\n        return this.privReason;\r\n    }\r\n\r\n    public get statusCode(): number {\r\n        return this.privStatusCode;\r\n    }\r\n}\r\n\r\nexport class ConnectionErrorEvent extends ConnectionEvent {\r\n    private readonly privMessage: string;\r\n    private readonly privType: string;\r\n\r\n    public constructor(connectionId: string, message: string, type: string) {\r\n        super(\"ConnectionErrorEvent\", connectionId, EventType.Debug);\r\n        this.privMessage = message;\r\n        this.privType = type;\r\n    }\r\n\r\n    public get message(): string {\r\n        return this.privMessage;\r\n    }\r\n\r\n    public get type(): string {\r\n        return this.privType;\r\n    }\r\n}\r\n\r\nexport class ConnectionEstablishErrorEvent extends ConnectionEvent {\r\n    private privStatusCode: number;\r\n    private privReason: string;\r\n\r\n    public constructor(connectionId: string, statuscode: number, reason: string) {\r\n        super(\"ConnectionEstablishErrorEvent\", connectionId, EventType.Error);\r\n        this.privStatusCode = statuscode;\r\n        this.privReason = reason;\r\n    }\r\n\r\n    public get reason(): string {\r\n        return this.privReason;\r\n    }\r\n\r\n    public get statusCode(): number {\r\n        return this.privStatusCode;\r\n    }\r\n}\r\n\r\nexport class ConnectionMessageReceivedEvent extends ConnectionEvent {\r\n    private privNetworkReceivedTime: string;\r\n    private privMessage: ConnectionMessage;\r\n\r\n    public constructor(connectionId: string, networkReceivedTimeISO: string, message: ConnectionMessage) {\r\n        super(\"ConnectionMessageReceivedEvent\", connectionId);\r\n        this.privNetworkReceivedTime = networkReceivedTimeISO;\r\n        this.privMessage = message;\r\n    }\r\n\r\n    public get networkReceivedTime(): string {\r\n        return this.privNetworkReceivedTime;\r\n    }\r\n\r\n    public get message(): ConnectionMessage {\r\n        return this.privMessage;\r\n    }\r\n}\r\n\r\nexport class ConnectionMessageSentEvent extends ConnectionEvent {\r\n    private privNetworkSentTime: string;\r\n    private privMessage: ConnectionMessage;\r\n\r\n    public constructor(connectionId: string, networkSentTimeISO: string, message: ConnectionMessage) {\r\n        super(\"ConnectionMessageSentEvent\", connectionId);\r\n        this.privNetworkSentTime = networkSentTimeISO;\r\n        this.privMessage = message;\r\n    }\r\n\r\n    public get networkSentTime(): string {\r\n        return this.privNetworkSentTime;\r\n    }\r\n\r\n    public get message(): ConnectionMessage {\r\n        return this.privMessage;\r\n    }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-return */\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError } from \"./Error.js\";\r\nimport { createNoDashGuid } from \"./Guid.js\";\r\nimport { IStringDictionary } from \"./IDictionary.js\";\r\n\r\nexport enum MessageType {\r\n    Text,\r\n    Binary,\r\n}\r\n\r\nexport class ConnectionMessage {\r\n\r\n    private privMessageType: MessageType;\r\n    private privHeaders: IStringDictionary<string>;\r\n    private privBody: any = null;\r\n    private privSize: number;\r\n\r\n    private privId: string;\r\n\r\n    public constructor(\r\n        messageType: MessageType,\r\n        body: any,\r\n        headers?: IStringDictionary<string>,\r\n        id?: string) {\r\n\r\n        if (messageType === MessageType.Text && body && !(typeof (body) === \"string\")) {\r\n            throw new InvalidOperationError(\"Payload must be a string\");\r\n        }\r\n\r\n        if (messageType === MessageType.Binary && body && !(body instanceof ArrayBuffer)) {\r\n            throw new InvalidOperationError(\"Payload must be ArrayBuffer\");\r\n        }\r\n\r\n        this.privMessageType = messageType;\r\n        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n        this.privBody = body;\r\n        this.privHeaders = headers ? headers : {};\r\n        this.privId = id ? id : createNoDashGuid();\r\n        switch (this.messageType) {\r\n            case MessageType.Binary:\r\n                this.privSize = this.binaryBody !== null ? this.binaryBody.byteLength : 0;\r\n                break;\r\n            case MessageType.Text:\r\n                this.privSize = this.textBody.length;\r\n        }\r\n    }\r\n\r\n    public get messageType(): MessageType {\r\n        return this.privMessageType;\r\n    }\r\n\r\n    public get headers(): IStringDictionary<string> {\r\n        return this.privHeaders;\r\n    }\r\n\r\n    public get body(): any {\r\n        return this.privBody;\r\n    }\r\n\r\n    public get textBody(): string {\r\n        if (this.privMessageType === MessageType.Binary) {\r\n            throw new InvalidOperationError(\"Not supported for binary message\");\r\n        }\r\n\r\n        return this.privBody as string;\r\n    }\r\n\r\n    public get binaryBody(): ArrayBuffer {\r\n        if (this.privMessageType === MessageType.Text) {\r\n            throw new InvalidOperationError(\"Not supported for text message\");\r\n        }\r\n\r\n        return this.privBody;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\n/**\r\n * The error that is thrown when an argument passed in is null.\r\n *\r\n * @export\r\n * @class ArgumentNullError\r\n * @extends {Error}\r\n */\r\nexport class ArgumentNullError extends Error {\r\n\r\n    /**\r\n     * Creates an instance of ArgumentNullError.\r\n     *\r\n     * @param {string} argumentName - Name of the argument that is null\r\n     *\r\n     * @memberOf ArgumentNullError\r\n     */\r\n    public constructor(argumentName: string) {\r\n        super(argumentName);\r\n        this.name = \"ArgumentNull\";\r\n        this.message = argumentName;\r\n    }\r\n}\r\n\r\n/**\r\n * The error that is thrown when an invalid operation is performed in the code.\r\n *\r\n * @export\r\n * @class InvalidOperationError\r\n * @extends {Error}\r\n */\r\nexport class InvalidOperationError extends Error {\r\n\r\n    /**\r\n     * Creates an instance of InvalidOperationError.\r\n     *\r\n     * @param {string} error - The error\r\n     *\r\n     * @memberOf InvalidOperationError\r\n     */\r\n    public constructor(error: string) {\r\n        super(error);\r\n        this.name = \"InvalidOperation\";\r\n        this.message = error;\r\n    }\r\n}\r\n\r\n/**\r\n * The error that is thrown when an object is disposed.\r\n *\r\n * @export\r\n * @class ObjectDisposedError\r\n * @extends {Error}\r\n */\r\nexport class ObjectDisposedError extends Error {\r\n\r\n    /**\r\n     * Creates an instance of ObjectDisposedError.\r\n     *\r\n     * @param {string} objectName - The object that is disposed\r\n     * @param {string} error - The error\r\n     *\r\n     * @memberOf ObjectDisposedError\r\n     */\r\n    public constructor(objectName: string, error?: string) {\r\n        super(error);\r\n        this.name = objectName + \"ObjectDisposed\";\r\n        this.message = error;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport class ConnectionOpenResponse {\r\n    private privStatusCode: number;\r\n    private privReason: string;\r\n\r\n    public constructor(statusCode: number, reason: string) {\r\n        this.privStatusCode = statusCode;\r\n        this.privReason = reason;\r\n    }\r\n\r\n    public get statusCode(): number {\r\n        return this.privStatusCode;\r\n    }\r\n\r\n    public get reason(): string {\r\n        return this.privReason;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Deferred } from \"./Promise.js\";\r\n\r\n/**\r\n * The error that is thrown when an argument passed in is null.\r\n *\r\n * @export\r\n * @class DefferalMap\r\n */\r\n\r\nexport class DeferralMap {\r\n    private privMap: { [id: string]: Deferred<any> } = {};\r\n\r\n    public add<T>(id: string, deferral: Deferred<T>): void {\r\n        this.privMap[id] = deferral;\r\n    }\r\n\r\n    public getId(id: string): Deferred<any> {\r\n        return this.privMap[id];\r\n    }\r\n\r\n    public complete<T>(id: string, result: T): void {\r\n        try {\r\n            this.privMap[id].resolve(result);\r\n        } catch (error) {\r\n            this.privMap[id].reject(error as string);\r\n        } finally {\r\n            this.privMap[id] = undefined;\r\n         }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { AgentConfig } from \"../common.speech/Exports.js\";\r\nimport { EventType, PlatformEvent } from \"./PlatformEvent.js\";\r\n\r\nexport class DialogEvent extends PlatformEvent {\r\n\r\n    public constructor(eventName: string, eventType: EventType = EventType.Info) {\r\n        super(eventName, eventType);\r\n    }\r\n}\r\n\r\nexport class SendingAgentContextMessageEvent extends DialogEvent {\r\n    private privAgentConfig: AgentConfig;\r\n\r\n    public constructor(agentConfig: AgentConfig) {\r\n        super(\"SendingAgentContextMessageEvent\");\r\n        this.privAgentConfig = agentConfig;\r\n    }\r\n\r\n    public get agentConfig(): AgentConfig {\r\n        return this.privAgentConfig;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ArgumentNullError } from \"./Error.js\";\r\nimport { EventSource } from \"./EventSource.js\";\r\nimport { IEventSource } from \"./IEventSource.js\";\r\nimport { PlatformEvent } from \"./PlatformEvent.js\";\r\n\r\nexport class Events {\r\n    private static privInstance: IEventSource<PlatformEvent> = new EventSource<PlatformEvent>();\r\n\r\n    public static setEventSource(eventSource: IEventSource<PlatformEvent>): void {\r\n        if (!eventSource) {\r\n            throw new ArgumentNullError(\"eventSource\");\r\n        }\r\n\r\n        Events.privInstance = eventSource;\r\n    }\r\n\r\n    public static get instance(): IEventSource<PlatformEvent> {\r\n        return Events.privInstance;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ObjectDisposedError } from \"./Error.js\";\r\nimport { createNoDashGuid } from \"./Guid.js\";\r\nimport { IDetachable } from \"./IDetachable.js\";\r\nimport { IStringDictionary } from \"./IDictionary.js\";\r\nimport { IEventListener } from \"./IEventListener.js\";\r\nimport { IEventSource } from \"./IEventSource.js\";\r\nimport { PlatformEvent } from \"./PlatformEvent.js\";\r\n\r\nexport class EventSource<TEvent extends PlatformEvent> implements IEventSource<TEvent> {\r\n    private privEventListeners: IStringDictionary<(event: TEvent) => void> = {};\r\n    private privMetadata: IStringDictionary<string>;\r\n    private privIsDisposed: boolean = false;\r\n    private privConsoleListener: IDetachable = undefined;\r\n\r\n    public constructor(metadata?: IStringDictionary<string>) {\r\n        this.privMetadata = metadata;\r\n    }\r\n\r\n    public onEvent(event: TEvent): void {\r\n        if (this.isDisposed()) {\r\n            throw (new ObjectDisposedError(\"EventSource\"));\r\n        }\r\n\r\n        if (this.metadata) {\r\n            for (const paramName in this.metadata) {\r\n                if (paramName) {\r\n                    if (event.metadata) {\r\n                        if (!event.metadata[paramName]) {\r\n                            event.metadata[paramName] = this.metadata[paramName];\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        for (const eventId in this.privEventListeners) {\r\n            if (eventId && this.privEventListeners[eventId]) {\r\n                this.privEventListeners[eventId](event);\r\n            }\r\n        }\r\n    }\r\n\r\n    public attach(onEventCallback: (event: TEvent) => void): IDetachable {\r\n        const id = createNoDashGuid();\r\n        this.privEventListeners[id] = onEventCallback;\r\n        return {\r\n            detach: (): Promise<void> => {\r\n                delete this.privEventListeners[id];\r\n                return Promise.resolve();\r\n            },\r\n        };\r\n    }\r\n\r\n    public attachListener(listener: IEventListener<TEvent>): IDetachable {\r\n        return this.attach((e: TEvent): void => listener.onEvent(e));\r\n    }\r\n\r\n    public attachConsoleListener(listener: IEventListener<TEvent>): IDetachable {\r\n        if (!!this.privConsoleListener) {\r\n            void this.privConsoleListener.detach(); // Detach implementation for eventListeners is synchronous\r\n        }\r\n        this.privConsoleListener = this.attach((e: TEvent): void => listener.onEvent(e));\r\n        return this.privConsoleListener;\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public dispose(): void {\r\n        this.privEventListeners = null;\r\n        this.privIsDisposed = true;\r\n    }\r\n\r\n    public get metadata(): IStringDictionary<string> {\r\n        return this.privMetadata;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ConnectionEvent } from \"./ConnectionEvents.js\";\r\nimport { ConnectionMessage } from \"./ConnectionMessage.js\";\r\nimport { ConnectionOpenResponse } from \"./ConnectionOpenResponse.js\";\r\nimport { EventSource } from \"./EventSource.js\";\r\n\r\nexport enum ConnectionState {\r\n    None,\r\n    Connected,\r\n    Connecting,\r\n    Disconnected,\r\n}\r\n\r\nexport interface IConnection {\r\n    id: string;\r\n    state(): ConnectionState;\r\n    open(): Promise<ConnectionOpenResponse>;\r\n    send(message: ConnectionMessage): Promise<void>;\r\n    read(): Promise<ConnectionMessage>;\r\n    events: EventSource<ConnectionEvent>;\r\n    dispose(disposing?: string): Promise<void>;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ObjectDisposedError } from \"./Error.js\";\r\nimport { IDetachable } from \"./IDetachable.js\";\r\nimport { IStringDictionary } from \"./IDictionary.js\";\r\nimport { IDisposable } from \"./IDisposable.js\";\r\n\r\nexport interface IList<TItem> extends IDisposable {\r\n    get(itemIndex: number): TItem;\r\n    first(): TItem;\r\n    last(): TItem;\r\n\r\n    add(item: TItem): void;\r\n    insertAt(index: number, item: TItem): void;\r\n\r\n    removeFirst(): TItem;\r\n    removeLast(): TItem;\r\n    removeAt(index: number): TItem;\r\n    remove(index: number, count: number): TItem[];\r\n    clear(): void;\r\n\r\n    length(): number;\r\n\r\n    onAdded(addedCallback: () => void): IDetachable;\r\n    onRemoved(removedCallback: () => void): IDetachable;\r\n    onDisposed(disposedCallback: () => void): IDetachable;\r\n\r\n    join(seperator?: string): string;\r\n\r\n    toArray(): TItem[];\r\n\r\n    any(callback?: (item: TItem, index: number) => boolean): boolean;\r\n    all(callback: (item: TItem) => boolean): boolean;\r\n    forEach(callback: (item: TItem, index: number) => void): void;\r\n    select<T2>(callback: (item: TItem, index: number) => T2): List<T2>;\r\n    where(callback: (item: TItem, index: number) => boolean): List<TItem>;\r\n    orderBy(compareFn: (a: TItem, b: TItem) => number): List<TItem>;\r\n    orderByDesc(compareFn: (a: TItem, b: TItem) => number): List<TItem>;\r\n    clone(): List<TItem>;\r\n    concat(list: List<TItem>): List<TItem>;\r\n    concatArray(array: TItem[]): List<TItem>;\r\n}\r\n\r\nexport class List<TItem> implements IList<TItem>  {\r\n    private privList: TItem[];\r\n    private privSubscriptionIdCounter: number = 0;\r\n    private privAddSubscriptions: IStringDictionary<() => void> = {};\r\n    private privRemoveSubscriptions: IStringDictionary<() => void> = {};\r\n    private privDisposedSubscriptions: IStringDictionary<() => void> = {};\r\n    private privDisposeReason: string = null;\r\n\r\n    public constructor(list?: TItem[]) {\r\n        this.privList = [];\r\n        // copy the list rather than taking as is.\r\n        if (list) {\r\n            for (const item of list) {\r\n                this.privList.push(item);\r\n            }\r\n        }\r\n    }\r\n\r\n    public get(itemIndex: number): TItem {\r\n        this.throwIfDisposed();\r\n        return this.privList[itemIndex];\r\n    }\r\n\r\n    public first(): TItem {\r\n        return this.get(0);\r\n    }\r\n\r\n    public last(): TItem {\r\n        return this.get(this.length() - 1);\r\n    }\r\n\r\n    public add(item: TItem): void {\r\n        this.throwIfDisposed();\r\n        this.insertAt(this.privList.length, item);\r\n    }\r\n\r\n    public insertAt(index: number, item: TItem): void {\r\n        this.throwIfDisposed();\r\n        if (index === 0) {\r\n            this.privList.unshift(item);\r\n        } else if (index === this.privList.length) {\r\n            this.privList.push(item);\r\n        } else {\r\n            this.privList.splice(index, 0, item);\r\n        }\r\n        this.triggerSubscriptions(this.privAddSubscriptions);\r\n    }\r\n\r\n    public removeFirst(): TItem {\r\n        this.throwIfDisposed();\r\n        return this.removeAt(0);\r\n    }\r\n\r\n    public removeLast(): TItem {\r\n        this.throwIfDisposed();\r\n        return this.removeAt(this.length() - 1);\r\n    }\r\n\r\n    public removeAt(index: number): TItem {\r\n        this.throwIfDisposed();\r\n        return this.remove(index, 1)[0];\r\n    }\r\n\r\n    public remove(index: number, count: number): TItem[] {\r\n        this.throwIfDisposed();\r\n        const removedElements = this.privList.splice(index, count);\r\n        this.triggerSubscriptions(this.privRemoveSubscriptions);\r\n        return removedElements;\r\n    }\r\n\r\n    public clear(): void {\r\n        this.throwIfDisposed();\r\n        this.remove(0, this.length());\r\n    }\r\n\r\n    public length(): number {\r\n        this.throwIfDisposed();\r\n        return this.privList.length;\r\n    }\r\n\r\n    public onAdded(addedCallback: () => void): IDetachable {\r\n        this.throwIfDisposed();\r\n        const subscriptionId = this.privSubscriptionIdCounter++;\r\n\r\n        this.privAddSubscriptions[subscriptionId] = addedCallback;\r\n\r\n        return {\r\n            detach: (): Promise<void> => {\r\n                delete this.privAddSubscriptions[subscriptionId];\r\n                return Promise.resolve();\r\n            },\r\n        };\r\n    }\r\n\r\n    public onRemoved(removedCallback: () => void): IDetachable {\r\n        this.throwIfDisposed();\r\n        const subscriptionId = this.privSubscriptionIdCounter++;\r\n\r\n        this.privRemoveSubscriptions[subscriptionId] = removedCallback;\r\n\r\n        return {\r\n            detach: (): Promise<void> => {\r\n                delete this.privRemoveSubscriptions[subscriptionId];\r\n                return Promise.resolve();\r\n            },\r\n        };\r\n    }\r\n\r\n    public onDisposed(disposedCallback: () => void): IDetachable {\r\n        this.throwIfDisposed();\r\n        const subscriptionId = this.privSubscriptionIdCounter++;\r\n\r\n        this.privDisposedSubscriptions[subscriptionId] = disposedCallback;\r\n\r\n        return {\r\n            detach: (): Promise<void> => {\r\n                delete this.privDisposedSubscriptions[subscriptionId];\r\n                return Promise.resolve();\r\n            },\r\n        };\r\n    }\r\n\r\n    public join(seperator?: string): string {\r\n        this.throwIfDisposed();\r\n        return this.privList.join(seperator);\r\n    }\r\n\r\n    public toArray(): TItem[] {\r\n        const cloneCopy = Array<TItem>();\r\n        this.privList.forEach((val: TItem): void => {\r\n            cloneCopy.push(val);\r\n        });\r\n        return cloneCopy;\r\n    }\r\n\r\n    public any(callback?: (item: TItem, index: number) => boolean): boolean {\r\n        this.throwIfDisposed();\r\n        if (callback) {\r\n            return this.where(callback).length() > 0;\r\n        } else {\r\n            return this.length() > 0;\r\n        }\r\n    }\r\n\r\n    public all(callback: (item: TItem) => boolean): boolean {\r\n        this.throwIfDisposed();\r\n        return this.where(callback).length() === this.length();\r\n    }\r\n\r\n    public forEach(callback: (item: TItem, index: number) => void): void {\r\n        this.throwIfDisposed();\r\n        for (let i = 0; i < this.length(); i++) {\r\n            callback(this.privList[i], i);\r\n        }\r\n    }\r\n\r\n    public select<T2>(callback: (item: TItem, index: number) => T2): List<T2> {\r\n        this.throwIfDisposed();\r\n        const selectList: T2[] = [];\r\n        for (let i = 0; i < this.privList.length; i++) {\r\n            selectList.push(callback(this.privList[i], i));\r\n        }\r\n\r\n        return new List<T2>(selectList);\r\n    }\r\n\r\n    public where(callback: (item: TItem, index: number) => boolean): List<TItem> {\r\n        this.throwIfDisposed();\r\n        const filteredList = new List<TItem>();\r\n        for (let i = 0; i < this.privList.length; i++) {\r\n            if (callback(this.privList[i], i)) {\r\n                filteredList.add(this.privList[i]);\r\n            }\r\n        }\r\n        return filteredList;\r\n    }\r\n\r\n    public orderBy(compareFn: (a: TItem, b: TItem) => number): List<TItem> {\r\n        this.throwIfDisposed();\r\n        const clonedArray = this.toArray();\r\n        const orderedArray = clonedArray.sort(compareFn);\r\n        return new List(orderedArray);\r\n    }\r\n\r\n    public orderByDesc(compareFn: (a: TItem, b: TItem) => number): List<TItem> {\r\n        this.throwIfDisposed();\r\n        return this.orderBy((a: TItem, b: TItem): number => compareFn(b, a));\r\n    }\r\n\r\n    public clone(): List<TItem> {\r\n        this.throwIfDisposed();\r\n        return new List<TItem>(this.toArray());\r\n    }\r\n\r\n    public concat(list: List<TItem>): List<TItem> {\r\n        this.throwIfDisposed();\r\n        return new List<TItem>(this.privList.concat(list.toArray()));\r\n    }\r\n\r\n    public concatArray(array: TItem[]): List<TItem> {\r\n        this.throwIfDisposed();\r\n        return new List<TItem>(this.privList.concat(array));\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privList == null;\r\n    }\r\n\r\n    public dispose(reason?: string): void {\r\n        if (!this.isDisposed()) {\r\n            this.privDisposeReason = reason;\r\n            this.privList = null;\r\n            this.privAddSubscriptions = null;\r\n            this.privRemoveSubscriptions = null;\r\n            this.triggerSubscriptions(this.privDisposedSubscriptions);\r\n        }\r\n    }\r\n\r\n    private throwIfDisposed(): void {\r\n        if (this.isDisposed()) {\r\n            throw new ObjectDisposedError(\"List\", this.privDisposeReason);\r\n        }\r\n    }\r\n\r\n    private triggerSubscriptions(subscriptions: IStringDictionary<() => void>): void {\r\n        if (subscriptions) {\r\n            for (const subscriptionId in subscriptions) {\r\n                if (subscriptionId) {\r\n                    subscriptions[subscriptionId]();\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file, @typescript-eslint/typedef */\r\n\r\nexport enum PromiseState {\r\n    None,\r\n    Resolved,\r\n    Rejected,\r\n}\r\n\r\nexport interface IDeferred<T> {\r\n    readonly promise: Promise<T>;\r\n\r\n    resolve(result: T): IDeferred<T>;\r\n\r\n    reject(error: string): IDeferred<T>;\r\n}\r\n\r\nexport class PromiseResult<T> {\r\n    protected privIsCompleted: boolean;\r\n    protected privIsError: boolean;\r\n    protected privError: string;\r\n    protected privResult: T;\r\n\r\n    public constructor(promiseResultEventSource: PromiseResultEventSource<T>) {\r\n        promiseResultEventSource.on((result: T): void => {\r\n            if (!this.privIsCompleted) {\r\n                this.privIsCompleted = true;\r\n                this.privIsError = false;\r\n                this.privResult = result;\r\n            }\r\n        }, (error: string): void => {\r\n            if (!this.privIsCompleted) {\r\n                this.privIsCompleted = true;\r\n                this.privIsError = true;\r\n                this.privError = error;\r\n            }\r\n        });\r\n    }\r\n\r\n    public get isCompleted(): boolean {\r\n        return this.privIsCompleted;\r\n    }\r\n\r\n    public get isError(): boolean {\r\n        return this.privIsError;\r\n    }\r\n\r\n    public get error(): string {\r\n        return this.privError;\r\n    }\r\n\r\n    public get result(): T {\r\n        return this.privResult;\r\n    }\r\n\r\n    public throwIfError = (): void => {\r\n        if (this.isError) {\r\n            throw this.error;\r\n        }\r\n    };\r\n}\r\n\r\nexport class PromiseResultEventSource<T>  {\r\n\r\n    private privOnSetResult: (result: T) => void;\r\n    private privOnSetError: (error: string) => void;\r\n\r\n    public setResult = (result: T): void => {\r\n        this.privOnSetResult(result);\r\n    };\r\n\r\n    public setError = (error: string): void => {\r\n        this.privOnSetError(error);\r\n    };\r\n\r\n    public on = (onSetResult: (result: T) => void, onSetError: (error: string) => void): void => {\r\n        this.privOnSetResult = onSetResult;\r\n        this.privOnSetError = onSetError;\r\n    };\r\n}\r\n\r\nexport class Deferred<T> implements IDeferred<T> {\r\n    private privPromise: Promise<T>;\r\n    private privResolve: (value?: T | PromiseLike<T>) => void;\r\n    private privReject: (reason?: any) => void;\r\n\r\n    public constructor() {\r\n        // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\r\n        this.privPromise = new Promise<T>((resolve: (value: T) => void, reject: (reason: any) => void) => {\r\n            this.privResolve = resolve;\r\n            this.privReject = reject;\r\n        });\r\n    }\r\n\r\n    public get promise(): Promise<T> {\r\n        return this.privPromise;\r\n    }\r\n\r\n    public resolve = (result: T | Promise<T>): Deferred<T> => {\r\n        this.privResolve(result);\r\n        return this;\r\n    };\r\n\r\n    public reject = (error: string): Deferred<T> => {\r\n        this.privReject(error);\r\n        return this;\r\n    };\r\n}\r\n\r\nexport class Sink<T> {\r\n    private privState: PromiseState = PromiseState.None;\r\n    private privPromiseResult: PromiseResult<T> = null;\r\n    private privPromiseResultEvents: PromiseResultEventSource<T> = null;\r\n\r\n    private privSuccessHandlers: ((result: T) => void)[] = [];\r\n    private privErrorHandlers: ((e: string) => void)[] = [];\r\n\r\n    public constructor() {\r\n        this.privPromiseResultEvents = new PromiseResultEventSource();\r\n        this.privPromiseResult = new PromiseResult(this.privPromiseResultEvents);\r\n    }\r\n\r\n    public get state(): PromiseState {\r\n        return this.privState;\r\n    }\r\n\r\n    public get result(): PromiseResult<T> {\r\n        return this.privPromiseResult;\r\n    }\r\n\r\n    public resolve(result: T): void {\r\n        if (this.privState !== PromiseState.None) {\r\n            throw new Error(\"'Cannot resolve a completed promise'\");\r\n        }\r\n\r\n        this.privState = PromiseState.Resolved;\r\n        this.privPromiseResultEvents.setResult(result);\r\n\r\n        for (let i = 0; i < this.privSuccessHandlers.length; i++) {\r\n            this.executeSuccessCallback(result, this.privSuccessHandlers[i], this.privErrorHandlers[i]);\r\n        }\r\n\r\n        this.detachHandlers();\r\n    }\r\n\r\n    public reject(error: string): void {\r\n        if (this.privState !== PromiseState.None) {\r\n            throw new Error(\"'Cannot reject a completed promise'\");\r\n        }\r\n\r\n        this.privState = PromiseState.Rejected;\r\n        this.privPromiseResultEvents.setError(error);\r\n\r\n        for (const errorHandler of this.privErrorHandlers) {\r\n            this.executeErrorCallback(error, errorHandler);\r\n        }\r\n\r\n        this.detachHandlers();\r\n    }\r\n\r\n    public on(\r\n        successCallback: (result: T) => void,\r\n        errorCallback: (error: string) => void): void {\r\n\r\n        if (successCallback == null) {\r\n            // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n            successCallback = (): void => { };\r\n        }\r\n\r\n        if (this.privState === PromiseState.None) {\r\n            this.privSuccessHandlers.push(successCallback);\r\n            this.privErrorHandlers.push(errorCallback);\r\n        } else {\r\n            if (this.privState === PromiseState.Resolved) {\r\n                this.executeSuccessCallback(this.privPromiseResult.result, successCallback, errorCallback);\r\n            } else if (this.privState === PromiseState.Rejected) {\r\n                this.executeErrorCallback(this.privPromiseResult.error, errorCallback);\r\n            }\r\n\r\n            this.detachHandlers();\r\n        }\r\n    }\r\n\r\n    private executeSuccessCallback(result: T, successCallback: (result: T) => void, errorCallback: (error: string) => void): void {\r\n        try {\r\n            successCallback(result);\r\n        } catch (e) {\r\n            this.executeErrorCallback(`'Unhandled callback error: ${e as string}'`, errorCallback);\r\n        }\r\n    }\r\n\r\n    private executeErrorCallback(error: string, errorCallback: (error: string) => void): void {\r\n        if (errorCallback) {\r\n            try {\r\n                errorCallback(error);\r\n            } catch (e) {\r\n                throw new Error(`'Unhandled callback error: ${e as string}. InnerError: ${error}'`);\r\n            }\r\n        } else {\r\n            throw new Error(`'Unhandled error: ${error}'`);\r\n        }\r\n    }\r\n\r\n    private detachHandlers(): void {\r\n        this.privErrorHandlers = [];\r\n        this.privSuccessHandlers = [];\r\n    }\r\n}\r\n\r\n// eslint-disable-next-line prefer-arrow/prefer-arrow-functions\r\nexport function marshalPromiseToCallbacks<T>(\r\n    promise: Promise<T>,\r\n    cb?: (value: T) => void,\r\n    err?: (error: string) => void): void {\r\n    promise.then((val: T): void => {\r\n        try {\r\n            if (!!cb) {\r\n                cb(val);\r\n            }\r\n        } catch (error) {\r\n            if (!!err) {\r\n                try {\r\n                    if (error instanceof Error) {\r\n                        const typedError: Error = error ;\r\n                        err(typedError.name + \": \" + typedError.message);\r\n                    } else {\r\n                        err(error as string);\r\n                    }\r\n                // eslint-disable-next-line no-empty\r\n                } catch (error) { }\r\n            }\r\n        }\r\n    }, (error: any): void => {\r\n        if (!!err) {\r\n            try {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    err(typedError.name + \": \" + typedError.message);\r\n                } else {\r\n                    err(error as string);\r\n                }\r\n            // eslint-disable-next-line no-empty\r\n            } catch (error) { }\r\n        }\r\n    });\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError, ObjectDisposedError } from \"./Error.js\";\r\nimport { IDetachable } from \"./IDetachable.js\";\r\nimport { IDisposable } from \"./IDisposable.js\";\r\nimport { List } from \"./List.js\";\r\nimport {\r\n    Deferred,\r\n} from \"./Promise.js\";\r\nexport interface IQueue<TItem> extends IDisposable {\r\n    enqueue(item: TItem): void;\r\n    enqueueFromPromise(promise: Promise<TItem>): void;\r\n    dequeue(): Promise<TItem>;\r\n    peek(): Promise<TItem>;\r\n    length(): number;\r\n}\r\n\r\nenum SubscriberType {\r\n    Dequeue,\r\n    Peek,\r\n}\r\n\r\nexport class Queue<TItem> implements IQueue<TItem> {\r\n    private privPromiseStore: List<Promise<TItem>> = new List<Promise<TItem>>();\r\n    private privList: List<TItem>;\r\n    private privDetachables: IDetachable[];\r\n    private privSubscribers: List<{ type: SubscriberType; deferral: Deferred<TItem> }>;\r\n    private privIsDrainInProgress: boolean = false;\r\n    private privIsDisposing: boolean = false;\r\n    private privDisposeReason: string = null;\r\n\r\n    public constructor(list?: List<TItem>) {\r\n        this.privList = list ? list : new List<TItem>();\r\n        this.privDetachables = [];\r\n        this.privSubscribers = new List<{ type: SubscriberType; deferral: Deferred<TItem> }>();\r\n        this.privDetachables.push(this.privList.onAdded((): void => this.drain()));\r\n    }\r\n\r\n    public enqueue(item: TItem): void {\r\n        this.throwIfDispose();\r\n        this.enqueueFromPromise(new Promise<TItem>((resolve: (value: TItem) => void): void => resolve(item)));\r\n    }\r\n\r\n    public enqueueFromPromise(promise: Promise<TItem>): void {\r\n        this.throwIfDispose();\r\n        promise.then((val: TItem): void => {\r\n            this.privList.add(val);\r\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n        }, (): void => { });\r\n    }\r\n\r\n    public dequeue(): Promise<TItem> {\r\n        this.throwIfDispose();\r\n        const deferredSubscriber = new Deferred<TItem>();\r\n\r\n        if (this.privSubscribers) {\r\n            this.privSubscribers.add({ deferral: deferredSubscriber, type: SubscriberType.Dequeue });\r\n            this.drain();\r\n        }\r\n\r\n        return deferredSubscriber.promise;\r\n    }\r\n\r\n    public peek(): Promise<TItem> {\r\n        this.throwIfDispose();\r\n        const deferredSubscriber = new Deferred<TItem>();\r\n\r\n        const subs = this.privSubscribers;\r\n        if (subs) {\r\n            this.privSubscribers.add({ deferral: deferredSubscriber, type: SubscriberType.Peek });\r\n            this.drain();\r\n        }\r\n\r\n        return deferredSubscriber.promise;\r\n    }\r\n\r\n    public length(): number {\r\n        this.throwIfDispose();\r\n        return this.privList.length();\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privSubscribers == null;\r\n    }\r\n\r\n    public async drainAndDispose(pendingItemProcessor: (pendingItemInQueue: TItem) => void, reason?: string): Promise<void> {\r\n        if (!this.isDisposed() && !this.privIsDisposing) {\r\n            this.privDisposeReason = reason;\r\n            this.privIsDisposing = true;\r\n\r\n            const subs = this.privSubscribers;\r\n            if (subs) {\r\n                while (subs.length() > 0) {\r\n                    const subscriber = subs.removeFirst();\r\n                    // TODO: this needs work (Resolve(null) instead?).\r\n                    subscriber.deferral.resolve(undefined);\r\n                    // subscriber.deferral.reject(\"Disposed\");\r\n                }\r\n\r\n                // note: this block assumes cooperative multitasking, i.e.,\r\n                // between the if-statement and the assignment there are no\r\n                // thread switches.\r\n                // Reason is that between the initial const = this.; and this\r\n                // point there is the derral.resolve() operation that might have\r\n                // caused recursive calls to the Queue, especially, calling\r\n                // Dispose() on the queue alredy (which would reset the var\r\n                // here to null!).\r\n                // That should generally hold true for javascript...\r\n                if (this.privSubscribers === subs) {\r\n                    this.privSubscribers = subs;\r\n                }\r\n            }\r\n\r\n            for (const detachable of this.privDetachables) {\r\n                await detachable.detach();\r\n            }\r\n\r\n            if (this.privPromiseStore.length() > 0 && pendingItemProcessor) {\r\n                const promiseArray: Promise<TItem>[] = [];\r\n\r\n                this.privPromiseStore.toArray().forEach((wrapper: Promise<TItem>): void => {\r\n                    promiseArray.push(wrapper);\r\n                });\r\n                return Promise.all(promiseArray).finally((): void => {\r\n                    this.privSubscribers = null;\r\n                    this.privList.forEach((item: TItem): void => {\r\n                        pendingItemProcessor(item);\r\n                    });\r\n                    this.privList = null;\r\n                    return;\r\n                }).then<void>();\r\n            } else {\r\n                this.privSubscribers = null;\r\n                this.privList = null;\r\n            }\r\n        }\r\n    }\r\n\r\n    public async dispose(reason?: string): Promise<void> {\r\n        await this.drainAndDispose(null, reason);\r\n    }\r\n\r\n    private drain(): void {\r\n        if (!this.privIsDrainInProgress && !this.privIsDisposing) {\r\n            this.privIsDrainInProgress = true;\r\n\r\n            const subs = this.privSubscribers;\r\n            const lists = this.privList;\r\n            if (subs && lists) {\r\n                while (lists.length() > 0 && subs.length() > 0 && !this.privIsDisposing) {\r\n                    const subscriber = subs.removeFirst();\r\n                    if (subscriber.type === SubscriberType.Peek) {\r\n                        subscriber.deferral.resolve(lists.first());\r\n                    } else {\r\n                        const dequeuedItem = lists.removeFirst();\r\n                        subscriber.deferral.resolve(dequeuedItem);\r\n                    }\r\n                }\r\n\r\n                // note: this block assumes cooperative multitasking, i.e.,\r\n                // between the if-statement and the assignment there are no\r\n                // thread switches.\r\n                // Reason is that between the initial const = this.; and this\r\n                // point there is the derral.resolve() operation that might have\r\n                // caused recursive calls to the Queue, especially, calling\r\n                // Dispose() on the queue alredy (which would reset the var\r\n                // here to null!).\r\n                // That should generally hold true for javascript...\r\n                if (this.privSubscribers === subs) {\r\n                    this.privSubscribers = subs;\r\n                }\r\n\r\n                // note: this block assumes cooperative multitasking, i.e.,\r\n                // between the if-statement and the assignment there are no\r\n                // thread switches.\r\n                // Reason is that between the initial const = this.; and this\r\n                // point there is the derral.resolve() operation that might have\r\n                // caused recursive calls to the Queue, especially, calling\r\n                // Dispose() on the queue alredy (which would reset the var\r\n                // here to null!).\r\n                // That should generally hold true for javascript...\r\n                if (this.privList === lists) {\r\n                    this.privList = lists;\r\n                }\r\n            }\r\n\r\n            this.privIsDrainInProgress = false;\r\n        }\r\n    }\r\n\r\n    private throwIfDispose(): void {\r\n        if (this.isDisposed()) {\r\n            if (this.privDisposeReason) {\r\n                throw new InvalidOperationError(this.privDisposeReason);\r\n            }\r\n\r\n            throw new ObjectDisposedError(\"Queue\");\r\n        } else if (this.privIsDisposing) {\r\n            throw new InvalidOperationError(\"Queue disposing\");\r\n        }\r\n    }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unsafe-assignment */\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { MessageType } from \"./ConnectionMessage.js\";\r\nimport { ArgumentNullError, InvalidOperationError } from \"./Error.js\";\r\nimport { createNoDashGuid } from \"./Guid.js\";\r\n\r\nexport class RawWebsocketMessage {\r\n    private privMessageType: MessageType;\r\n    private privPayload: any = null;\r\n    private privId: string;\r\n\r\n    public constructor(messageType: MessageType, payload: any, id?: string) {\r\n        if (!payload) {\r\n            throw new ArgumentNullError(\"payload\");\r\n        }\r\n\r\n        // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n        if (messageType === MessageType.Binary && payload.__proto__.constructor.name !== \"ArrayBuffer\") {\r\n            throw new InvalidOperationError(\"Payload must be ArrayBuffer\");\r\n        }\r\n\r\n        if (messageType === MessageType.Text && !(typeof (payload) === \"string\")) {\r\n            throw new InvalidOperationError(\"Payload must be a string\");\r\n        }\r\n\r\n        this.privMessageType = messageType;\r\n        this.privPayload = payload;\r\n        this.privId = id ? id : createNoDashGuid();\r\n    }\r\n\r\n    public get messageType(): MessageType {\r\n        return this.privMessageType;\r\n    }\r\n\r\n    public get payload(): any {\r\n        // eslint-disable-next-line @typescript-eslint/no-unsafe-return\r\n        return this.privPayload;\r\n    }\r\n\r\n    public get textContent(): string {\r\n        if (this.privMessageType === MessageType.Binary) {\r\n            throw new InvalidOperationError(\"Not supported for binary message\");\r\n        }\r\n\r\n        return this.privPayload as string;\r\n    }\r\n\r\n    public get binaryContent(): ArrayBuffer {\r\n        if (this.privMessageType === MessageType.Text) {\r\n            throw new InvalidOperationError(\"Not supported for text message\");\r\n        }\r\n\r\n        return this.privPayload as ArrayBuffer;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport class RiffPcmEncoder {\r\n\r\n    private privActualSampleRate: number;\r\n    private privDesiredSampleRate: number;\r\n\r\n    public constructor(actualSampleRate: number, desiredSampleRate: number) {\r\n        this.privActualSampleRate = actualSampleRate;\r\n        this.privDesiredSampleRate = desiredSampleRate;\r\n    }\r\n\r\n    public encode(actualAudioFrame: Float32Array): ArrayBuffer {\r\n\r\n        const audioFrame = this.downSampleAudioFrame(actualAudioFrame, this.privActualSampleRate, this.privDesiredSampleRate);\r\n\r\n        if (!audioFrame) {\r\n            return null;\r\n        }\r\n\r\n        const audioLength = audioFrame.length * 2;\r\n\r\n        const buffer = new ArrayBuffer(audioLength);\r\n        const view = new DataView(buffer);\r\n        this.floatTo16BitPCM(view, 0, audioFrame);\r\n\r\n        return buffer;\r\n    }\r\n\r\n    private setString(view: DataView, offset: number, str: string): void {\r\n        for (let i = 0; i < str.length; i++) {\r\n            view.setUint8(offset + i, str.charCodeAt(i));\r\n        }\r\n    }\r\n\r\n    private floatTo16BitPCM(view: DataView, offset: number, input: Float32Array): void {\r\n        for (let i = 0; i < input.length; i++ , offset += 2) {\r\n            const s = Math.max(-1, Math.min(1, input[i]));\r\n            view.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7FFF, true);\r\n        }\r\n    }\r\n\r\n    private downSampleAudioFrame(\r\n        srcFrame: Float32Array,\r\n        srcRate: number,\r\n        dstRate: number): Float32Array {\r\n\r\n        if (!srcFrame) {\r\n            return null;\r\n        }\r\n\r\n        if (dstRate === srcRate || dstRate > srcRate) {\r\n            return srcFrame;\r\n        }\r\n\r\n        const ratio = srcRate / dstRate;\r\n        const dstLength = Math.round(srcFrame.length / ratio);\r\n        const dstFrame = new Float32Array(dstLength);\r\n        let srcOffset = 0;\r\n        let dstOffset = 0;\r\n        while (dstOffset < dstLength) {\r\n            const nextSrcOffset = Math.round((dstOffset + 1) * ratio);\r\n            let accum = 0;\r\n            let count = 0;\r\n            while (srcOffset < nextSrcOffset && srcOffset < srcFrame.length) {\r\n                accum += srcFrame[srcOffset++];\r\n                count++;\r\n            }\r\n            dstFrame[dstOffset++] = accum / count;\r\n        }\r\n\r\n        return dstFrame;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError } from \"./Error.js\";\r\nimport { createNoDashGuid } from \"./Guid.js\";\r\nimport { Queue } from \"./Queue.js\";\r\n\r\nexport interface IStreamChunk<TBuffer> {\r\n    isEnd: boolean;\r\n    buffer: TBuffer;\r\n    timeReceived: number;\r\n}\r\n\r\nexport class Stream<TBuffer> {\r\n    private privId: string;\r\n    private privIsWriteEnded: boolean = false;\r\n    private privIsReadEnded: boolean = false;\r\n    private privReaderQueue: Queue<IStreamChunk<TBuffer>>;\r\n\r\n    public constructor(streamId?: string) {\r\n        this.privId = streamId ? streamId : createNoDashGuid();\r\n        this.privReaderQueue = new Queue<IStreamChunk<TBuffer>>();\r\n    }\r\n\r\n    public get isClosed(): boolean {\r\n        return this.privIsWriteEnded;\r\n    }\r\n\r\n    public get isReadEnded(): boolean {\r\n        return this.privIsReadEnded;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public close(): void {\r\n        if (!this.privIsWriteEnded) {\r\n            this.writeStreamChunk({\r\n                buffer: null,\r\n                isEnd: true,\r\n                timeReceived: Date.now(),\r\n            });\r\n            this.privIsWriteEnded = true;\r\n        }\r\n    }\r\n\r\n    public writeStreamChunk(streamChunk: IStreamChunk<TBuffer>): void {\r\n        this.throwIfClosed();\r\n        if (!this.privReaderQueue.isDisposed()) {\r\n            try {\r\n                this.privReaderQueue.enqueue(streamChunk);\r\n            } catch (e) {\r\n                // Do nothing\r\n            }\r\n        }\r\n    }\r\n\r\n    public read(): Promise<IStreamChunk<TBuffer>> {\r\n        if (this.privIsReadEnded) {\r\n            throw new InvalidOperationError(\"Stream read has already finished\");\r\n        }\r\n\r\n        return this.privReaderQueue\r\n            .dequeue()\r\n            .then(async (streamChunk: IStreamChunk<TBuffer>): Promise<IStreamChunk<TBuffer>> => {\r\n                if (streamChunk === undefined || streamChunk.isEnd) {\r\n                    await this.privReaderQueue.dispose(\"End of stream reached\");\r\n                }\r\n\r\n                return streamChunk;\r\n            });\r\n    }\r\n    public readEnded(): void {\r\n        if (!this.privIsReadEnded) {\r\n            this.privIsReadEnded = true;\r\n            this.privReaderQueue = new Queue<IStreamChunk<TBuffer>>();\r\n        }\r\n    }\r\n\r\n    private throwIfClosed(): void {\r\n        if (this.privIsWriteEnded) {\r\n            throw new InvalidOperationError(\"Stream closed\");\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines translation status.\r\n * @class TranslationStatus\r\n */\r\nexport enum TranslationStatus {\r\n    /**\r\n     * @member TranslationStatus.Success\r\n     */\r\n    Success = 0,\r\n\r\n    /**\r\n     * @member TranslationStatus.Error\r\n     */\r\n    Error,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStreamChunk, Stream } from \"./Exports.js\";\r\n\r\nexport class ChunkedArrayBufferStream extends Stream<ArrayBuffer> {\r\n    private privTargetChunkSize: number;\r\n    private privNextBufferToWrite: ArrayBuffer;\r\n    private privNextBufferStartTime: number;\r\n    private privNextBufferReadyBytes: number;\r\n\r\n    public constructor(targetChunkSize: number, streamId?: string) {\r\n        super(streamId);\r\n        this.privTargetChunkSize = targetChunkSize;\r\n        this.privNextBufferReadyBytes = 0;\r\n    }\r\n\r\n    public writeStreamChunk(chunk: IStreamChunk<ArrayBuffer>): void {\r\n        // No pending write, and the buffer is the right size so write it.\r\n        if (chunk.isEnd ||\r\n            (0 === this.privNextBufferReadyBytes && chunk.buffer.byteLength === this.privTargetChunkSize)) {\r\n            super.writeStreamChunk(chunk);\r\n            return;\r\n        }\r\n\r\n        let bytesCopiedFromBuffer: number = 0;\r\n\r\n        while (bytesCopiedFromBuffer < chunk.buffer.byteLength) {\r\n            // Fill the next buffer.\r\n            if (undefined === this.privNextBufferToWrite) {\r\n                this.privNextBufferToWrite = new ArrayBuffer(this.privTargetChunkSize);\r\n                this.privNextBufferStartTime = chunk.timeReceived;\r\n            }\r\n\r\n            // Find out how many bytes we can copy into the read buffer.\r\n            const bytesToCopy: number = Math.min(chunk.buffer.byteLength - bytesCopiedFromBuffer, this.privTargetChunkSize - this.privNextBufferReadyBytes);\r\n            const targetView: Uint8Array = new Uint8Array(this.privNextBufferToWrite);\r\n            const sourceView: Uint8Array = new Uint8Array(chunk.buffer.slice(bytesCopiedFromBuffer, bytesToCopy + bytesCopiedFromBuffer));\r\n\r\n            targetView.set(sourceView, this.privNextBufferReadyBytes);\r\n            this.privNextBufferReadyBytes += bytesToCopy;\r\n            bytesCopiedFromBuffer += bytesToCopy;\r\n\r\n            // Are we ready to write?\r\n            if (this.privNextBufferReadyBytes === this.privTargetChunkSize) {\r\n                super.writeStreamChunk({\r\n                    buffer: this.privNextBufferToWrite,\r\n                    isEnd: false,\r\n                    timeReceived: this.privNextBufferStartTime,\r\n                });\r\n                this.privNextBufferReadyBytes = 0;\r\n                this.privNextBufferToWrite = undefined;\r\n            }\r\n        }\r\n    }\r\n\r\n    public close(): void {\r\n        // Send whatever is pending, then close the base class.\r\n        if (0 !== this.privNextBufferReadyBytes && !this.isClosed) {\r\n            super.writeStreamChunk({\r\n                buffer: this.privNextBufferToWrite.slice(0, this.privNextBufferReadyBytes),\r\n                isEnd: false,\r\n                timeReceived: this.privNextBufferStartTime,\r\n            });\r\n        }\r\n\r\n        super.close();\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\ntype TWorkerMessage = ICallNotification | IClearResponse | IErrorNotification | IErrorResponse;\r\n\r\ninterface IClearResponse {\r\n    error: null;\r\n    id: number;\r\n}\r\n\r\ninterface IErrorNotification {\r\n    error: {\r\n        message: string;\r\n    };\r\n    id: null;\r\n    result: null;\r\n}\r\n\r\ninterface IErrorResponse {\r\n    error: {\r\n        message: string;\r\n    };\r\n    id: number;\r\n    result: null;\r\n}\r\n\r\ninterface ICallNotification {\r\n    id: null;\r\n    method: \"call\";\r\n    params: {\r\n        timerId: number;\r\n    };\r\n}\r\n\r\ninterface ISetNotification {\r\n    id: null;\r\n    method: \"set\";\r\n    params: {\r\n        delay: number;\r\n        now: number;\r\n        timerId: number;\r\n    };\r\n}\r\n\r\ninterface IClearRequest {\r\n    id: number;\r\n    method: \"clear\";\r\n    params: {\r\n        timerId: number;\r\n    };\r\n}\r\n\r\ninterface IWorkerEvent extends Event {\r\n    data: TWorkerMessage;\r\n}\r\n\r\ninterface IWorkerTimers {\r\n    clearTimeout: (timerId: number) => void;\r\n    setTimeout: (func: () => any, delay: number) => number;\r\n}\r\n\r\ndeclare type Func = () => any;\r\n\r\nexport class Timeout {\r\n\r\n    private static workerTimers: null | IWorkerTimers = null;\r\n\r\n    public static clearTimeout: IWorkerTimers[\"clearTimeout\"] = (timerId: number): void => Timeout.timers().clearTimeout(timerId);\r\n\r\n    public static setTimeout: IWorkerTimers[\"setTimeout\"] = (func: () => any, delay: number): number => Timeout.timers().setTimeout(func, delay);\r\n\r\n    public static load(): any {\r\n        // Prefilling the Maps with a function indexed by zero is necessary to be compliant with the specification.\r\n        const scheduledTimeoutFunctions: Map<number, number | Func> = new Map([[0, (): void => { }]]); // eslint-disable-line @typescript-eslint/no-empty-function\r\n        const unhandledRequests: Map<number, number> = new Map();\r\n\r\n        // eslint-disable-next-line\r\n        const workerScript = `!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&\"object\"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,\"default\",{enumerable:!0,value:e}),2&t&&\"string\"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,\"a\",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=\"\",n(n.s=14)}([function(e,t,n){\"use strict\";n.d(t,\"a\",(function(){return i})),n.d(t,\"b\",(function(){return u})),n.d(t,\"c\",(function(){return a})),n.d(t,\"d\",(function(){return d}));const r=new Map,o=new Map,i=e=>{const t=r.get(e);if(void 0===t)throw new Error('There is no interval scheduled with the given id \"'.concat(e,'\".'));clearTimeout(t),r.delete(e)},u=e=>{const t=o.get(e);if(void 0===t)throw new Error('There is no timeout scheduled with the given id \"'.concat(e,'\".'));clearTimeout(t),o.delete(e)},f=(e,t)=>{let n,r;if(\"performance\"in self){const o=performance.now();n=o,r=e-Math.max(0,o-t)}else n=Date.now(),r=e;return{expected:n+r,remainingDelay:r}},c=(e,t,n,r)=>{const o=\"performance\"in self?performance.now():Date.now();o>n?postMessage({id:null,method:\"call\",params:{timerId:t}}):e.set(t,setTimeout(c,n-o,e,t,n))},a=(e,t,n)=>{const{expected:o,remainingDelay:i}=f(e,n);r.set(t,setTimeout(c,i,r,t,o))},d=(e,t,n)=>{const{expected:r,remainingDelay:i}=f(e,n);o.set(t,setTimeout(c,i,o,t,r))}},function(e,t,n){\"use strict\";n.r(t);var r=n(2);for(var o in r)\"default\"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(3);for(var o in i)\"default\"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(4);for(var o in u)\"default\"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o);var f=n(5);for(var o in f)\"default\"!==o&&function(e){n.d(t,e,(function(){return f[e]}))}(o);var c=n(6);for(var o in c)\"default\"!==o&&function(e){n.d(t,e,(function(){return c[e]}))}(o);var a=n(7);for(var o in a)\"default\"!==o&&function(e){n.d(t,e,(function(){return a[e]}))}(o);var d=n(8);for(var o in d)\"default\"!==o&&function(e){n.d(t,e,(function(){return d[e]}))}(o);var s=n(9);for(var o in s)\"default\"!==o&&function(e){n.d(t,e,(function(){return s[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){\"use strict\";n.r(t);var r=n(11);for(var o in r)\"default\"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(12);for(var o in i)\"default\"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(13);for(var o in u)\"default\"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){\"use strict\";n.r(t);var r=n(0),o=n(1);for(var i in o)\"default\"!==i&&function(e){n.d(t,e,(function(){return o[e]}))}(i);var u=n(10);for(var i in u)\"default\"!==i&&function(e){n.d(t,e,(function(){return u[e]}))}(i);addEventListener(\"message\",({data:e})=>{try{if(\"clear\"===e.method){const{id:t,params:{timerId:n}}=e;Object(r.b)(n),postMessage({error:null,id:t})}else{if(\"set\"!==e.method)throw new Error('The given method \"'.concat(e.method,'\" is not supported'));{const{params:{delay:t,now:n,timerId:o}}=e;Object(r.d)(t,o,n)}}}catch(t){postMessage({error:{message:t.message},id:e.id,result:null})}})}]);`;\r\n        const workerUrl = \"data:text/javascript;base64,\" + btoa(workerScript);\r\n        const worker = new Worker(workerUrl);\r\n\r\n        worker.addEventListener(\"message\", ({ data }: IWorkerEvent): void => {\r\n            if (Timeout.isCallNotification(data)) {\r\n                const {\r\n                    params: { timerId }\r\n                } = data;\r\n\r\n                const idOrFunc = scheduledTimeoutFunctions.get(timerId);\r\n\r\n                if (typeof idOrFunc === \"number\") {\r\n                    const unhandledTimerId = unhandledRequests.get(idOrFunc);\r\n\r\n                    if (\r\n                        unhandledTimerId === undefined ||\r\n                        unhandledTimerId !== timerId\r\n                    ) {\r\n                        throw new Error(\"The timer is in an undefined state.\");\r\n                    }\r\n                } else if (typeof idOrFunc !== \"undefined\") {\r\n                    idOrFunc();\r\n\r\n                    // A timeout can be safely deleted because it is only called once.\r\n                    scheduledTimeoutFunctions.delete(timerId);\r\n                } else {\r\n                    throw new Error(\"The timer is in an undefined state.\");\r\n                }\r\n            } else if (Timeout.isClearResponse(data)) {\r\n                const { id } = data;\r\n\r\n                const unhandledTimerId = unhandledRequests.get(id);\r\n\r\n                if (unhandledTimerId === undefined) {\r\n                    throw new Error(\"The timer is in an undefined state.\");\r\n                }\r\n\r\n                unhandledRequests.delete(id);\r\n\r\n                scheduledTimeoutFunctions.delete(unhandledTimerId);\r\n            } else {\r\n                const {\r\n                    error: { message }\r\n                } = data;\r\n\r\n                throw new Error(message);\r\n            }\r\n        });\r\n\r\n        const clearTimeout = (timerId: number): void => {\r\n            const id = Math.random();\r\n\r\n            unhandledRequests.set(id, timerId);\r\n            scheduledTimeoutFunctions.set(timerId, id);\r\n\r\n            worker.postMessage({\r\n                id,\r\n                method: \"clear\",\r\n                params: { timerId }\r\n            } as IClearRequest);\r\n        };\r\n\r\n        const setTimeout = (func: () => void, delay: number): number => {\r\n            const timerId = Math.random();\r\n\r\n            scheduledTimeoutFunctions.set(timerId, func);\r\n\r\n            worker.postMessage({\r\n                id: null,\r\n                method: \"set\",\r\n                params: {\r\n                    delay,\r\n                    now: performance.now(),\r\n                    timerId\r\n                }\r\n            } as ISetNotification);\r\n\r\n            return timerId;\r\n        };\r\n\r\n        return {\r\n            clearTimeout,\r\n            setTimeout\r\n        };\r\n    }\r\n\r\n    private static loadWorkerTimers(): () => IWorkerTimers {\r\n        return (): IWorkerTimers => {\r\n            if (Timeout.workerTimers !== null) {\r\n                return Timeout.workerTimers;\r\n            }\r\n\r\n            Timeout.workerTimers = Timeout.load() as IWorkerTimers;\r\n\r\n            return Timeout.workerTimers;\r\n        };\r\n    }\r\n\r\n    public static timers: () => IWorkerTimers = Timeout.loadWorkerTimers();\r\n\r\n    private static isCallNotification(message: TWorkerMessage): message is ICallNotification {\r\n        return (message as ICallNotification).method !== undefined && (message as ICallNotification).method === \"call\";\r\n    }\r\n\r\n    private static isClearResponse(message: TWorkerMessage): message is IClearResponse {\r\n        return (message as IClearResponse).error === null && typeof message.id === \"number\";\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { EventType, PlatformEvent } from \"./PlatformEvent.js\";\r\n\r\nexport class OCSPEvent extends PlatformEvent {\r\n    private privSignature: string;\r\n\r\n    public constructor(eventName: string, eventType: EventType, signature: string) {\r\n        super(eventName, eventType);\r\n\r\n        this.privSignature = signature;\r\n    }\r\n}\r\n\r\nexport class OCSPMemoryCacheHitEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPMemoryCacheHitEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPCacheMissEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPCacheMissEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPDiskCacheHitEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPDiskCacheHitEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPCacheUpdateNeededEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPCacheUpdateNeededEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPMemoryCacheStoreEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPMemoryCacheStoreEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPDiskCacheStoreEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPDiskCacheStoreEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPCacheUpdateCompleteEvent extends OCSPEvent {\r\n    public constructor(signature: string) {\r\n        super(\"OCSPCacheUpdateCompleteEvent\", EventType.Debug, signature);\r\n    }\r\n}\r\n\r\nexport class OCSPStapleReceivedEvent extends OCSPEvent {\r\n    public constructor() {\r\n        super(\"OCSPStapleReceivedEvent\", EventType.Debug, \"\");\r\n    }\r\n}\r\n\r\nexport class OCSPWSUpgradeStartedEvent extends OCSPEvent {\r\n    public constructor(serialNumber: string) {\r\n        super(\"OCSPWSUpgradeStartedEvent\", EventType.Debug, serialNumber);\r\n    }\r\n}\r\n\r\nexport class OCSPCacheEntryExpiredEvent extends OCSPEvent {\r\n    private privExpireTime: number;\r\n\r\n    public constructor(serialNumber: string, expireTime: number) {\r\n        super(\"OCSPCacheEntryExpiredEvent\", EventType.Debug, serialNumber);\r\n        this.privExpireTime = expireTime;\r\n    }\r\n}\r\n\r\nexport class OCSPCacheEntryNeedsRefreshEvent extends OCSPEvent {\r\n    private privExpireTime: number;\r\n    private privStartTime: number;\r\n\r\n    public constructor(serialNumber: string, startTime: number, expireTime: number) {\r\n        super(\"OCSPCacheEntryNeedsRefreshEvent\", EventType.Debug, serialNumber);\r\n        this.privExpireTime = expireTime;\r\n        this.privStartTime = startTime;\r\n    }\r\n}\r\n\r\nexport class OCSPCacheHitEvent extends OCSPEvent {\r\n    private privExpireTime: number;\r\n    private privStartTime: number;\r\n    private privExpireTimeString: string;\r\n    private privStartTimeString: string;\r\n\r\n    public constructor(serialNumber: string, startTime: number, expireTime: number) {\r\n        super(\"OCSPCacheHitEvent\", EventType.Debug, serialNumber);\r\n        this.privExpireTime = expireTime;\r\n        this.privExpireTimeString = new Date(expireTime).toLocaleDateString();\r\n        this.privStartTime = startTime;\r\n        this.privStartTimeString = new Date(startTime).toLocaleTimeString();\r\n    }\r\n}\r\n\r\nexport class OCSPVerificationFailedEvent extends OCSPEvent {\r\n    private privError: string;\r\n\r\n    public constructor(serialNumber: string, error: string) {\r\n        super(\"OCSPVerificationFailedEvent\", EventType.Debug, serialNumber);\r\n        this.privError = error;\r\n    }\r\n}\r\n\r\nexport class OCSPCacheFetchErrorEvent extends OCSPEvent {\r\n    private privError: string;\r\n\r\n    public constructor(serialNumber: string, error: string) {\r\n        super(\"OCSPCacheFetchErrorEvent\", EventType.Debug, serialNumber);\r\n        this.privError = error;\r\n    }\r\n}\r\n\r\nexport class OCSPResponseRetrievedEvent extends OCSPEvent {\r\n    public constructor(serialNumber: string) {\r\n        super(\"OCSPResponseRetrievedEvent\", EventType.Debug, serialNumber);\r\n    }\r\n}\r\n\r\nexport class OCSPCacheUpdateErrorEvent extends OCSPEvent {\r\n    private privError: string;\r\n\r\n    public constructor(serialNumber: string, error: string) {\r\n        super(\"OCSPCacheUpdateErrorEvent\", EventType.Debug, serialNumber);\r\n        this.privError = error;\r\n    }\r\n}\r\n","\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    EventType,\r\n    PlatformEvent\r\n} from \"./Exports.js\";\r\n\r\nexport class BackgroundEvent extends PlatformEvent {\r\n    private privError: string;\r\n\r\n    public constructor(error: string) {\r\n        super(\"BackgroundEvent\", EventType.Error);\r\n        this.privError = error;\r\n    }\r\n\r\n    public get error(): string {\r\n        return this.privError;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport class HeaderNames {\r\n    public static AuthKey: string = \"Ocp-Apim-Subscription-Key\";\r\n    public static Authorization: string = \"Authorization\";\r\n    public static SpIDAuthKey: string = \"Apim-Subscription-Id\";\r\n    public static ConnectionId: string = \"X-ConnectionId\";\r\n    public static ContentType: string = \"Content-Type\";\r\n    public static CustomCommandsAppId: string = \"X-CommandsAppId\";\r\n    public static Path: string = \"Path\";\r\n    public static RequestId: string = \"X-RequestId\";\r\n    public static RequestStreamId: string = \"X-StreamId\";\r\n    public static RequestTimestamp: string = \"X-Timestamp\";\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport interface IAuthentication {\r\n    fetch(authFetchEventId: string): Promise<AuthInfo>;\r\n    fetchOnExpiry(authFetchEventId: string): Promise<AuthInfo>;\r\n}\r\n\r\nexport class AuthInfo {\r\n    private privHeaderName: string;\r\n    private privToken: string;\r\n\r\n    public constructor(headerName: string, token: string) {\r\n        this.privHeaderName = headerName;\r\n        this.privToken = token;\r\n    }\r\n\r\n    public get headerName(): string {\r\n        return this.privHeaderName;\r\n    }\r\n\r\n    public get token(): string {\r\n        return this.privToken;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ArgumentNullError } from \"../common/Exports.js\";\r\nimport { AuthInfo, IAuthentication } from \"./IAuthentication.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\n\r\nexport class CognitiveTokenAuthentication implements IAuthentication {\r\n    private static privTokenPrefix: string = \"Bearer \";\r\n    private privFetchCallback: (authFetchEventId: string) => Promise<string>;\r\n    private privFetchOnExpiryCallback: (authFetchEventId: string) => Promise<string>;\r\n\r\n    public constructor(fetchCallback: (authFetchEventId: string) => Promise<string>, fetchOnExpiryCallback: (authFetchEventId: string) => Promise<string>) {\r\n        if (!fetchCallback) {\r\n            throw new ArgumentNullError(\"fetchCallback\");\r\n        }\r\n\r\n        if (!fetchOnExpiryCallback) {\r\n            throw new ArgumentNullError(\"fetchOnExpiryCallback\");\r\n        }\r\n\r\n        this.privFetchCallback = fetchCallback;\r\n        this.privFetchOnExpiryCallback = fetchOnExpiryCallback;\r\n    }\r\n\r\n    public fetch(authFetchEventId: string): Promise<AuthInfo> {\r\n        return this.privFetchCallback(authFetchEventId).then((token: string): AuthInfo => new AuthInfo(HeaderNames.Authorization, token === undefined ? undefined : CognitiveTokenAuthentication.privTokenPrefix + token));\r\n    }\r\n\r\n    public fetchOnExpiry(authFetchEventId: string): Promise<AuthInfo> {\r\n        return this.privFetchOnExpiryCallback(authFetchEventId).then((token: string): AuthInfo => new AuthInfo(HeaderNames.Authorization, token === undefined ? undefined : CognitiveTokenAuthentication.privTokenPrefix + token));\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection,\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    PropertyId\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    RecognizerConfig,\r\n    WebsocketMessageFormatter,\r\n} from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\n\r\nexport class IntentConnectionFactory extends ConnectionFactoryBase {\r\n\r\n    public create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): IConnection {\r\n\r\n        let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint);\r\n        if (!endpoint) {\r\n            const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_IntentRegion);\r\n            const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n            const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".sr.speech\" + hostSuffix);\r\n            endpoint = host + \"/speech/recognition/interactive/cognitiveservices/v1\";\r\n        }\r\n\r\n        const queryParams: IStringDictionary<string> = {\r\n            format: \"simple\",\r\n            language: config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage),\r\n        };\r\n\r\n        this.setCommonUrlParams(config, queryParams, endpoint);\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n        if (authInfo.token !== undefined && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n\r\n        config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, endpoint);\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n        return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\r\n    }\r\n\r\n    private getSpeechRegionFromIntentRegion(intentRegion: string): string {\r\n        switch (intentRegion) {\r\n            case \"West US\":\r\n            case \"US West\":\r\n            case \"westus\":\r\n                return \"uswest\";\r\n            case \"West US 2\":\r\n            case \"US West 2\":\r\n            case \"westus2\":\r\n                return \"uswest2\";\r\n            case \"South Central US\":\r\n            case \"US South Central\":\r\n            case \"southcentralus\":\r\n                return \"ussouthcentral\";\r\n            case \"West Central US\":\r\n            case \"US West Central\":\r\n            case \"westcentralus\":\r\n                return \"uswestcentral\";\r\n            case \"East US\":\r\n            case \"US East\":\r\n            case \"eastus\":\r\n                return \"useast\";\r\n            case \"East US 2\":\r\n            case \"US East 2\":\r\n            case \"eastus2\":\r\n                return \"useast2\";\r\n            case \"West Europe\":\r\n            case \"Europe West\":\r\n            case \"westeurope\":\r\n                return \"europewest\";\r\n            case \"North Europe\":\r\n            case \"Europe North\":\r\n            case \"northeurope\":\r\n                return \"europenorth\";\r\n            case \"Brazil South\":\r\n            case \"South Brazil\":\r\n            case \"southbrazil\":\r\n                return \"brazilsouth\";\r\n            case \"Australia East\":\r\n            case \"East Australia\":\r\n            case \"eastaustralia\":\r\n                return \"australiaeast\";\r\n            case \"Southeast Asia\":\r\n            case \"Asia Southeast\":\r\n            case \"southeastasia\":\r\n                return \"asiasoutheast\";\r\n            case \"East Asia\":\r\n            case \"Asia East\":\r\n            case \"eastasia\":\r\n                return \"asiaeast\";\r\n            default:\r\n                return intentRegion;\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport * from \"./ConsoleLoggingListener.js\";\r\nexport * from \"./IRecorder.js\";\r\nexport * from \"./MicAudioSource.js\";\r\nexport * from \"./FileAudioSource.js\";\r\nexport * from \"./PCMRecorder.js\";\r\nexport * from \"./WebsocketConnection.js\";\r\nexport * from \"./WebsocketMessageAdapter.js\";\r\nexport * from \"./ReplayableAudioNode.js\";\r\nexport * from \"./ProxyInfo.js\";\r\nexport * from \"./RestMessageAdapter.js\";\r\nexport * from \"./RestConfigBase.js\";\r\n","/* eslint-disable @typescript-eslint/no-unsafe-assignment */\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport * as fs from \"fs\";\r\nimport { LogLevel } from \"../sdk/LogLevel.js\";\r\nimport { IEventListener, PlatformEvent } from \"../common/Exports.js\";\r\nimport { Contracts } from \"../sdk/Contracts.js\";\r\n\r\nexport class ConsoleLoggingListener implements IEventListener<PlatformEvent> {\r\n    private privLogLevelFilter: LogLevel;\r\n    private privLogPath: fs.PathLike = undefined;\r\n    private privEnableConsoleOutput: boolean = true;\r\n\r\n    public constructor(logLevelFilter: LogLevel = LogLevel.None) { // Console output disabled by default\r\n        this.privLogLevelFilter = logLevelFilter;\r\n    }\r\n\r\n    public set logPath(path: fs.PathLike) {\r\n        Contracts.throwIfNullOrUndefined(fs.openSync, \"\\nFile System access not available\");\r\n        this.privLogPath = path;\r\n    }\r\n\r\n    public set enableConsoleOutput(enableOutput: boolean) {\r\n        this.privEnableConsoleOutput = enableOutput;\r\n    }\r\n\r\n    public onEvent(event: PlatformEvent): void {\r\n        if (event.eventType >= this.privLogLevelFilter) {\r\n            const log = this.toString(event);\r\n            if (!!this.privLogPath) {\r\n                fs.writeFileSync(this.privLogPath, log + \"\\n\", { flag: \"a+\" });\r\n            }\r\n\r\n            if (this.privEnableConsoleOutput) {\r\n                switch (event.eventType) {\r\n                    case LogLevel.Debug:\r\n                        // eslint-disable-next-line no-console\r\n                        console.debug(log);\r\n                        break;\r\n                    case LogLevel.Info:\r\n                        // eslint-disable-next-line no-console\r\n                        console.info(log);\r\n                        break;\r\n                    case LogLevel.Warning:\r\n                        // eslint-disable-next-line no-console\r\n                        console.warn(log);\r\n                        break;\r\n                    case LogLevel.Error:\r\n                        // eslint-disable-next-line no-console\r\n                        console.error(log);\r\n                        break;\r\n                    default:\r\n                        // eslint-disable-next-line no-console\r\n                        console.log(log);\r\n                        break;\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    private toString(event: PlatformEvent): string {\r\n        const logFragments = [\r\n            `${event.eventTime}`,\r\n            `${event.name}`,\r\n        ];\r\n\r\n        const e: any = event as any;\r\n        for (const prop in e) {\r\n            if (prop && event.hasOwnProperty(prop) &&\r\n                prop !== \"eventTime\" && prop !== \"eventType\" &&\r\n                prop !== \"eventId\" && prop !== \"name\" &&\r\n                prop !== \"constructor\") {\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n                const value = e[prop];\r\n                let valueToLog = \"<NULL>\";\r\n                if (value !== undefined && value !== null) {\r\n                    if (typeof (value) === \"number\" || typeof (value) === \"string\") {\r\n                        valueToLog = value.toString();\r\n                    } else {\r\n                        valueToLog = JSON.stringify(value);\r\n                    }\r\n                }\r\n\r\n                logFragments.push(`${prop}: ${valueToLog}`);\r\n            }\r\n\r\n        }\r\n\r\n        return logFragments.join(\" | \");\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { EventType } from \"../common/Exports.js\";\r\n\r\n/**\r\n * Define event severity types for setting logging output.\r\n * @class LogLevel\r\n */\r\n\r\nexport { EventType as LogLevel };\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * @class Contracts\r\n * @private\r\n */\r\nexport class Contracts {\r\n    public static throwIfNullOrUndefined(param: any, name: string): void {\r\n        if (param === undefined || param === null) {\r\n            throw new Error(\"throwIfNullOrUndefined:\" + name);\r\n        }\r\n    }\r\n\r\n    public static throwIfNull(param: any, name: string): void {\r\n        if (param === null) {\r\n            throw new Error(\"throwIfNull:\" + name);\r\n        }\r\n    }\r\n\r\n    public static throwIfNullOrWhitespace(param: string, name: string): void {\r\n        Contracts.throwIfNullOrUndefined(param, name);\r\n\r\n        if ((\"\" + param).trim().length < 1) {\r\n            throw new Error(\"throwIfNullOrWhitespace:\" + name);\r\n        }\r\n    }\r\n\r\n    public static throwIfNullOrTooLong(param: string, name: string, maxLength: number): void {\r\n        Contracts.throwIfNullOrUndefined(param, name);\r\n\r\n        if ((\"\" + param).length > maxLength) {\r\n            throw new Error(\"throwIfNullOrTooLong:\" + name + \" (more than \" + maxLength.toString() + \" characters)\");\r\n        }\r\n    }\r\n\r\n    public static throwIfNullOrTooShort(param: string, name: string, minLength: number): void {\r\n        Contracts.throwIfNullOrUndefined(param, name);\r\n\r\n        if ((\"\" + param).length < minLength) {\r\n            throw new Error(\"throwIfNullOrTooShort:\" + name + \" (less than \" + minLength.toString() + \" characters)\");\r\n        }\r\n    }\r\n\r\n    public static throwIfDisposed(isDisposed: boolean): void {\r\n        if (isDisposed) {\r\n            throw new Error(\"the object is already disposed\");\r\n        }\r\n    }\r\n\r\n    public static throwIfArrayEmptyOrWhitespace(array: string[], name: string): void {\r\n        Contracts.throwIfNullOrUndefined(array, name);\r\n\r\n        if (array.length === 0) {\r\n            throw new Error(\"throwIfArrayEmptyOrWhitespace:\" + name);\r\n        }\r\n\r\n        for (const item of array) {\r\n            Contracts.throwIfNullOrWhitespace(item, name);\r\n        }\r\n    }\r\n\r\n    public static throwIfFileDoesNotExist(param: string, name: string): void {\r\n        Contracts.throwIfNullOrWhitespace(param, name);\r\n\r\n        // TODO check for file existence.\r\n    }\r\n\r\n    public static throwIfNotUndefined(param: any, name: string): void {\r\n        if (param !== undefined) {\r\n            throw new Error(\"throwIfNotUndefined:\" + name);\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    connectivity,\r\n    ISpeechConfigAudioDevice,\r\n    type\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    AudioSourceErrorEvent,\r\n    AudioSourceEvent,\r\n    AudioSourceInitializingEvent,\r\n    AudioSourceOffEvent,\r\n    AudioSourceReadyEvent,\r\n    AudioStreamNodeAttachedEvent,\r\n    AudioStreamNodeAttachingEvent,\r\n    AudioStreamNodeDetachedEvent,\r\n    AudioStreamNodeErrorEvent,\r\n    ChunkedArrayBufferStream,\r\n    createNoDashGuid,\r\n    Deferred,\r\n    Events,\r\n    EventSource,\r\n    IAudioSource,\r\n    IAudioStreamNode,\r\n    IStringDictionary,\r\n    Stream,\r\n} from \"../common/Exports.js\";\r\nimport { IStreamChunk } from \"../common/Stream.js\";\r\nimport {\r\n    AudioStreamFormat,\r\n    AudioStreamFormatImpl,\r\n} from \"../sdk/Audio/AudioStreamFormat.js\";\r\nimport { IRecorder } from \"./IRecorder.js\";\r\n\r\n// Extending the default definition with browser specific definitions for backward compatibility\r\ninterface INavigator extends Navigator {\r\n    webkitGetUserMedia: (constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback | undefined, errorCallback: NavigatorUserMediaErrorCallback) => void;\r\n    mozGetUserMedia: (constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback | undefined, errorCallback: NavigatorUserMediaErrorCallback) => void;\r\n    msGetUserMedia: (constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback) => void;\r\n}\r\n\r\nexport const AudioWorkletSourceURLPropertyName = \"MICROPHONE-WorkletSourceUrl\";\r\n\r\nexport class MicAudioSource implements IAudioSource {\r\n\r\n    private static readonly AUDIOFORMAT: AudioStreamFormatImpl = AudioStreamFormat.getDefaultInputFormat() as AudioStreamFormatImpl;\r\n\r\n    private privStreams: IStringDictionary<Stream<ArrayBuffer>> = {};\r\n\r\n    private privId: string;\r\n\r\n    private privEvents: EventSource<AudioSourceEvent>;\r\n\r\n    private privInitializeDeferral: Deferred<void>;\r\n\r\n    private privMediaStream: MediaStream;\r\n\r\n    private privContext: AudioContext;\r\n\r\n    private privMicrophoneLabel: string;\r\n\r\n    private privOutputChunkSize: number;\r\n\r\n    private privIsClosing: boolean;\r\n\r\n    public constructor(\r\n        private readonly privRecorder: IRecorder,\r\n        private readonly deviceId?: string,\r\n        audioSourceId?: string,\r\n        mediaStream?: MediaStream\r\n        ) {\r\n\r\n        this.privOutputChunkSize = MicAudioSource.AUDIOFORMAT.avgBytesPerSec / 10;\r\n        this.privId = audioSourceId ? audioSourceId : createNoDashGuid();\r\n        this.privEvents = new EventSource<AudioSourceEvent>();\r\n        this.privMediaStream = mediaStream || null;\r\n        this.privIsClosing = false;\r\n    }\r\n\r\n    public get format(): Promise<AudioStreamFormatImpl> {\r\n        return Promise.resolve(MicAudioSource.AUDIOFORMAT);\r\n    }\r\n\r\n    public turnOn(): Promise<void> {\r\n        if (this.privInitializeDeferral) {\r\n            return this.privInitializeDeferral.promise;\r\n        }\r\n\r\n        this.privInitializeDeferral = new Deferred<void>();\r\n\r\n        try {\r\n            this.createAudioContext();\r\n        } catch (error) {\r\n            if (error instanceof Error) {\r\n                const typedError: Error = error;\r\n                this.privInitializeDeferral.reject(typedError.name + \": \" + typedError.message);\r\n            } else {\r\n                this.privInitializeDeferral.reject(error as string);\r\n            }\r\n            return this.privInitializeDeferral.promise;\r\n        }\r\n\r\n        const nav = window.navigator as INavigator;\r\n\r\n        let getUserMedia = (\r\n            // eslint-disable-next-line\r\n            nav.getUserMedia ||\r\n            nav.webkitGetUserMedia ||\r\n            nav.mozGetUserMedia ||\r\n            nav.msGetUserMedia\r\n        );\r\n\r\n        if (!!nav.mediaDevices) {\r\n            getUserMedia = (constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void => {\r\n                nav.mediaDevices\r\n                    .getUserMedia(constraints)\r\n                    .then(successCallback)\r\n                    .catch(errorCallback);\r\n            };\r\n        }\r\n\r\n        if (!getUserMedia) {\r\n            const errorMsg = \"Browser does not support getUserMedia.\";\r\n            this.privInitializeDeferral.reject(errorMsg);\r\n            this.onEvent(new AudioSourceErrorEvent(errorMsg, \"\")); // mic initialized error - no streamid at this point\r\n        } else {\r\n            const next = (): void => {\r\n                this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\r\n                if (this.privMediaStream && this.privMediaStream.active) {\r\n                    this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n                    this.privInitializeDeferral.resolve();\r\n                } else {\r\n                    getUserMedia(\r\n                        { audio: this.deviceId ? { deviceId: this.deviceId } : true, video: false },\r\n                        (mediaStream: MediaStream): void => {\r\n                            this.privMediaStream = mediaStream;\r\n                            this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n                            this.privInitializeDeferral.resolve();\r\n                        }, (error: any): void => {\r\n                            const errorMsg = `Error occurred during microphone initialization: ${error as string}`;\r\n                            this.privInitializeDeferral.reject(errorMsg);\r\n                            this.onEvent(new AudioSourceErrorEvent(this.privId, errorMsg));\r\n                        });\r\n                }\r\n            };\r\n\r\n            if (this.privContext.state === \"suspended\") {\r\n                // NOTE: On iOS, the Web Audio API requires sounds to be triggered from an explicit user action.\r\n                // https://github.com/WebAudio/web-audio-api/issues/790\r\n                this.privContext.resume()\r\n                    .then(next)\r\n                    .catch((reason: any): void => {\r\n                        this.privInitializeDeferral.reject(`Failed to initialize audio context: ${reason as string}`);\r\n                    });\r\n            } else {\r\n                next();\r\n            }\r\n        }\r\n\r\n        return this.privInitializeDeferral.promise;\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public attach(audioNodeId: string): Promise<IAudioStreamNode> {\r\n        this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\r\n\r\n        return this.listen(audioNodeId).then<IAudioStreamNode>(\r\n            (stream: Stream<ArrayBuffer>): IAudioStreamNode => {\r\n                this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\r\n                return {\r\n                    detach: async (): Promise<void> => {\r\n                        stream.readEnded();\r\n                        delete this.privStreams[audioNodeId];\r\n                        this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n                        return this.turnOff();\r\n                    },\r\n                    id: (): string => audioNodeId,\r\n                    read: (): Promise<IStreamChunk<ArrayBuffer>> => stream.read(),\r\n                };\r\n            });\r\n    }\r\n\r\n    public detach(audioNodeId: string): void {\r\n        if (audioNodeId && this.privStreams[audioNodeId]) {\r\n            this.privStreams[audioNodeId].close();\r\n            delete this.privStreams[audioNodeId];\r\n            this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n        }\r\n    }\r\n\r\n    public async turnOff(): Promise<void> {\r\n        for (const streamId in this.privStreams) {\r\n            if (streamId) {\r\n                const stream = this.privStreams[streamId];\r\n                if (stream) {\r\n                    stream.close();\r\n                }\r\n            }\r\n        }\r\n\r\n        this.onEvent(new AudioSourceOffEvent(this.privId)); // no stream now\r\n        if (this.privInitializeDeferral) {\r\n            // Correctly handle when browser forces mic off before turnOn() completes\r\n            // eslint-disable-next-line @typescript-eslint/await-thenable\r\n            await this.privInitializeDeferral;\r\n            this.privInitializeDeferral = null;\r\n        }\r\n\r\n        await this.destroyAudioContext();\r\n\r\n        return;\r\n    }\r\n\r\n    public get events(): EventSource<AudioSourceEvent> {\r\n        return this.privEvents;\r\n    }\r\n\r\n    public get deviceInfo(): Promise<ISpeechConfigAudioDevice> {\r\n        return this.getMicrophoneLabel().then((label: string): ISpeechConfigAudioDevice => (\r\n            {\r\n                bitspersample: MicAudioSource.AUDIOFORMAT.bitsPerSample,\r\n                channelcount: MicAudioSource.AUDIOFORMAT.channels,\r\n                connectivity: connectivity.Unknown,\r\n                manufacturer: \"Speech SDK\",\r\n                model: label,\r\n                samplerate: MicAudioSource.AUDIOFORMAT.samplesPerSec,\r\n                type: type.Microphones,\r\n            }\r\n        ));\r\n    }\r\n\r\n    public setProperty(name: string, value: string): void {\r\n        if (name === AudioWorkletSourceURLPropertyName) {\r\n            this.privRecorder.setWorkletUrl(value);\r\n        } else {\r\n            throw new Error(\"Property '\" + name + \"' is not supported on Microphone.\");\r\n        }\r\n    }\r\n\r\n    private getMicrophoneLabel(): Promise<string> {\r\n        const defaultMicrophoneName: string = \"microphone\";\r\n\r\n        // If we did this already, return the value.\r\n        if (this.privMicrophoneLabel !== undefined) {\r\n            return Promise.resolve(this.privMicrophoneLabel);\r\n        }\r\n\r\n        // If the stream isn't currently running, we can't query devices because security.\r\n        if (this.privMediaStream === undefined || !this.privMediaStream.active) {\r\n            return Promise.resolve(defaultMicrophoneName);\r\n        }\r\n\r\n        // Setup a default\r\n        this.privMicrophoneLabel = defaultMicrophoneName;\r\n\r\n        // Get the id of the device running the audio track.\r\n        const microphoneDeviceId: string = this.privMediaStream.getTracks()[0].getSettings().deviceId;\r\n\r\n        // If the browser doesn't support getting the device ID, set a default and return.\r\n        if (undefined === microphoneDeviceId) {\r\n            return Promise.resolve(this.privMicrophoneLabel);\r\n        }\r\n\r\n        const deferred: Deferred<string> = new Deferred<string>();\r\n\r\n        // Enumerate the media devices.\r\n        navigator.mediaDevices.enumerateDevices().then((devices: MediaDeviceInfo[]): void => {\r\n            for (const device of devices) {\r\n                if (device.deviceId === microphoneDeviceId) {\r\n                    // Found the device\r\n                    this.privMicrophoneLabel = device.label;\r\n                    break;\r\n                }\r\n            }\r\n            deferred.resolve(this.privMicrophoneLabel);\r\n        }, (): Deferred<string> => deferred.resolve(this.privMicrophoneLabel));\r\n\r\n        return deferred.promise;\r\n    }\r\n\r\n    private async listen(audioNodeId: string): Promise<Stream<ArrayBuffer>> {\r\n        await this.turnOn();\r\n        const stream = new ChunkedArrayBufferStream(this.privOutputChunkSize, audioNodeId);\r\n        this.privStreams[audioNodeId] = stream;\r\n        try {\r\n            this.privRecorder.record(this.privContext, this.privMediaStream, stream);\r\n        } catch (error) {\r\n            this.onEvent(new AudioStreamNodeErrorEvent(this.privId, audioNodeId, error as string));\r\n            throw error;\r\n        }\r\n        const result: Stream<ArrayBuffer> = stream;\r\n        return result;\r\n    }\r\n\r\n    private onEvent(event: AudioSourceEvent): void {\r\n        this.privEvents.onEvent(event);\r\n        Events.instance.onEvent(event);\r\n    }\r\n\r\n    private createAudioContext(): void {\r\n        if (!!this.privContext) {\r\n            return;\r\n        }\r\n\r\n        this.privContext = AudioStreamFormatImpl.getAudioContext(MicAudioSource.AUDIOFORMAT.samplesPerSec);\r\n    }\r\n\r\n    private async destroyAudioContext(): Promise<void> {\r\n        if (!this.privContext) {\r\n            return;\r\n        }\r\n\r\n        this.privRecorder.releaseMediaResources(this.privContext);\r\n\r\n        // This pattern brought to you by a bug in the TypeScript compiler where it\r\n        // confuses the (\"close\" in this.privContext) with this.privContext always being null as the alternate.\r\n        // https://github.com/Microsoft/TypeScript/issues/11498\r\n        let hasClose: boolean = false;\r\n        if (\"close\" in this.privContext) {\r\n            hasClose = true;\r\n        }\r\n\r\n        if (hasClose) {\r\n            if (!this.privIsClosing) {\r\n                // The audio context close may take enough time that the close is called twice\r\n                this.privIsClosing = true;\r\n                await this.privContext.close();\r\n                this.privContext = null;\r\n                this.privIsClosing = false;\r\n            }\r\n        } else if (null !== this.privContext && this.privContext.state === \"running\") {\r\n            // Suspend actually takes a callback, but analogous to the\r\n            // resume method, it'll be only fired if suspend is called\r\n            // in a direct response to a user action. The later is not always\r\n            // the case, as TurnOff is also called, when we receive an\r\n            // end-of-speech message from the service. So, doing a best effort\r\n            // fire-and-forget here.\r\n            await this.privContext.suspend();\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport enum AudioFormatTag {\r\n    PCM = 1,\r\n    MuLaw,\r\n    Siren,\r\n    MP3,\r\n    SILKSkype,\r\n    OGG_OPUS,\r\n    WEBM_OPUS,\r\n    ALaw,\r\n    FLAC,\r\n    OPUS,\r\n}\r\n\r\n/**\r\n * Represents audio stream format used for custom audio input configurations.\r\n * @class AudioStreamFormat\r\n */\r\nexport abstract class AudioStreamFormat {\r\n    /**\r\n     * Creates an audio stream format object representing the default audio stream\r\n     * format (16KHz 16bit mono PCM).\r\n     * @member AudioStreamFormat.getDefaultInputFormat\r\n     * @function\r\n     * @public\r\n     * @returns {AudioStreamFormat} The audio stream format being created.\r\n     */\r\n    public static getDefaultInputFormat(): AudioStreamFormat {\r\n        return AudioStreamFormatImpl.getDefaultInputFormat();\r\n    }\r\n\r\n    /**\r\n     * Creates an audio stream format object with the specified format characteristics.\r\n     * @member AudioStreamFormat.getWaveFormat\r\n     * @function\r\n     * @public\r\n     * @param {number} samplesPerSecond - Sample rate, in samples per second (Hertz).\r\n     * @param {number} bitsPerSample - Bits per sample, typically 16.\r\n     * @param {number} channels - Number of channels in the waveform-audio data. Monaural data\r\n     * uses one channel and stereo data uses two channels.\r\n     * @param {AudioFormatTag} format - Audio format (PCM, alaw or mulaw).\r\n     * @returns {AudioStreamFormat} The audio stream format being created.\r\n     */\r\n    public static getWaveFormat(samplesPerSecond: number, bitsPerSample: number, channels: number, format: AudioFormatTag): AudioStreamFormat {\r\n        return new AudioStreamFormatImpl(samplesPerSecond, bitsPerSample, channels, format);\r\n    }\r\n\r\n    /**\r\n     * Creates an audio stream format object with the specified pcm waveformat characteristics.\r\n     * @member AudioStreamFormat.getWaveFormatPCM\r\n     * @function\r\n     * @public\r\n     * @param {number} samplesPerSecond - Sample rate, in samples per second (Hertz).\r\n     * @param {number} bitsPerSample - Bits per sample, typically 16.\r\n     * @param {number} channels - Number of channels in the waveform-audio data. Monaural data\r\n     * uses one channel and stereo data uses two channels.\r\n     * @returns {AudioStreamFormat} The audio stream format being created.\r\n     */\r\n    public static getWaveFormatPCM(samplesPerSecond: number, bitsPerSample: number, channels: number): AudioStreamFormat {\r\n        return new AudioStreamFormatImpl(samplesPerSecond, bitsPerSample, channels);\r\n    }\r\n\r\n    /**\r\n     * Explicitly frees any external resource attached to the object\r\n     * @member AudioStreamFormat.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n\r\n/**\r\n * @private\r\n * @class AudioStreamFormatImpl\r\n */\r\nexport class AudioStreamFormatImpl extends AudioStreamFormat {\r\n    protected privHeader: ArrayBuffer;\r\n\r\n    /**\r\n     * Creates an instance with the given values.\r\n     * @constructor\r\n     * @param {number} samplesPerSec - Samples per second.\r\n     * @param {number} bitsPerSample - Bits per sample.\r\n     * @param {number} channels - Number of channels.\r\n     * @param {AudioFormatTag} format - Audio format (PCM, alaw or mulaw).\r\n     */\r\n    public constructor(samplesPerSec: number = 16000, bitsPerSample: number = 16, channels: number = 1, format: AudioFormatTag = AudioFormatTag.PCM) {\r\n        super();\r\n\r\n        let isWavFormat: boolean = true;\r\n        /* 1 for PCM; 6 for alaw; 7 for mulaw */\r\n        switch (format) {\r\n            case AudioFormatTag.PCM:\r\n                this.formatTag = 1;\r\n                break;\r\n            case AudioFormatTag.ALaw:\r\n                this.formatTag = 6;\r\n                break;\r\n            case AudioFormatTag.MuLaw:\r\n                this.formatTag = 7;\r\n                break;\r\n            default:\r\n                isWavFormat = false;\r\n        }\r\n        this.bitsPerSample = bitsPerSample;\r\n        this.samplesPerSec = samplesPerSec;\r\n        this.channels = channels;\r\n        this.avgBytesPerSec = this.samplesPerSec * this.channels * (this.bitsPerSample / 8);\r\n        this.blockAlign = this.channels * Math.max(this.bitsPerSample, 8);\r\n\r\n        if (isWavFormat) {\r\n            this.privHeader = new ArrayBuffer(44);\r\n\r\n            // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView\r\n            const view = new DataView(this.privHeader);\r\n\r\n            /* RIFF identifier */\r\n            this.setString(view, 0, \"RIFF\");\r\n            /* file length */\r\n            view.setUint32(4, 0, true);\r\n            /* RIFF type & Format */\r\n            this.setString(view, 8, \"WAVEfmt \");\r\n            /* format chunk length */\r\n            view.setUint32(16, 16, true);\r\n            /* audio format */\r\n            view.setUint16(20, this.formatTag, true);\r\n            /* channel count */\r\n            view.setUint16(22, this.channels, true);\r\n            /* sample rate */\r\n            view.setUint32(24, this.samplesPerSec, true);\r\n            /* byte rate (sample rate * block align) */\r\n            view.setUint32(28, this.avgBytesPerSec, true);\r\n            /* block align (channel count * bytes per sample) */\r\n            view.setUint16(32, this.channels * (this.bitsPerSample / 8), true);\r\n            /* bits per sample */\r\n            view.setUint16(34, this.bitsPerSample, true);\r\n            /* data chunk identifier */\r\n            this.setString(view, 36, \"data\");\r\n            /* data chunk length */\r\n            view.setUint32(40, 0, true);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Retrieves the default input format.\r\n     * @member AudioStreamFormatImpl.getDefaultInputFormat\r\n     * @function\r\n     * @public\r\n     * @returns {AudioStreamFormatImpl} The default input format.\r\n     */\r\n    public static getDefaultInputFormat(): AudioStreamFormatImpl {\r\n        return new AudioStreamFormatImpl();\r\n    }\r\n\r\n    /**\r\n     * Creates an audio context appropriate to current browser\r\n     * @member AudioStreamFormatImpl.getAudioContext\r\n     * @function\r\n     * @public\r\n     * @returns {AudioContext} An audio context instance\r\n     */\r\n    /* eslint-disable */\r\n    public static getAudioContext(sampleRate?: number): AudioContext {\r\n        // Workaround for Speech SDK bug in Safari.\r\n        const AudioContext = (window as any).AudioContext // our preferred impl\r\n            || (window as any).webkitAudioContext // fallback, mostly when on Safari\r\n            || false; // could not find.\r\n\r\n        // https://developer.mozilla.org/en-US/docs/Web/API/AudioContext\r\n        if (!!AudioContext) {\r\n            if (sampleRate !== undefined && navigator.mediaDevices.getSupportedConstraints().sampleRate) {\r\n                return new AudioContext({ sampleRate });\r\n            } else {\r\n                return new AudioContext();\r\n            }\r\n        } else {\r\n            throw new Error(\"Browser does not support Web Audio API (AudioContext is not available).\");\r\n        }\r\n    }\r\n    /* eslint-enable */\r\n\r\n    /**\r\n     * Closes the configuration object.\r\n     * @member AudioStreamFormatImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * The format of the audio, valid values: 1 (PCM)\r\n     * @member AudioStreamFormatImpl.prototype.formatTag\r\n     * @function\r\n     * @public\r\n     */\r\n    public formatTag: number;\r\n\r\n    /**\r\n     * The number of channels, valid values: 1 (Mono).\r\n     * @member AudioStreamFormatImpl.prototype.channels\r\n     * @function\r\n     * @public\r\n     */\r\n    public channels: number;\r\n\r\n    /**\r\n     * The sample rate, valid values: 16000.\r\n     * @member AudioStreamFormatImpl.prototype.samplesPerSec\r\n     * @function\r\n     * @public\r\n     */\r\n    public samplesPerSec: number;\r\n\r\n    /**\r\n     * The bits per sample, valid values: 16\r\n     * @member AudioStreamFormatImpl.prototype.b\r\n     * @function\r\n     * @public\r\n     */\r\n    public bitsPerSample: number;\r\n\r\n    /**\r\n     * Average bytes per second, usually calculated as nSamplesPerSec * nChannels * ceil(wBitsPerSample, 8).\r\n     * @member AudioStreamFormatImpl.prototype.avgBytesPerSec\r\n     * @function\r\n     * @public\r\n     */\r\n    public avgBytesPerSec: number;\r\n\r\n    /**\r\n     * The size of a single frame, valid values: nChannels * ceil(wBitsPerSample, 8).\r\n     * @member AudioStreamFormatImpl.prototype.blockAlign\r\n     * @function\r\n     * @public\r\n     */\r\n    public blockAlign: number;\r\n\r\n    public get header(): ArrayBuffer {\r\n        return this.privHeader;\r\n    }\r\n\r\n    protected setString(view: DataView, offset: number, str: string): void {\r\n        for (let i = 0; i < str.length; i++) {\r\n            view.setUint8(offset + i, str.charCodeAt(i));\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    connectivity,\r\n    ISpeechConfigAudioDevice,\r\n    type,\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    AudioSourceErrorEvent,\r\n    AudioSourceEvent,\r\n    AudioSourceInitializingEvent,\r\n    AudioSourceOffEvent,\r\n    AudioSourceReadyEvent,\r\n    AudioStreamNodeAttachedEvent,\r\n    AudioStreamNodeAttachingEvent,\r\n    AudioStreamNodeDetachedEvent,\r\n    AudioStreamNodeErrorEvent,\r\n    ChunkedArrayBufferStream,\r\n    createNoDashGuid,\r\n    Deferred,\r\n    Events,\r\n    EventSource,\r\n    IAudioSource,\r\n    IAudioStreamNode,\r\n    IStreamChunk,\r\n    IStringDictionary,\r\n    Stream,\r\n} from \"../common/Exports.js\";\r\nimport { AudioStreamFormat, AudioStreamFormatImpl } from \"../sdk/Audio/AudioStreamFormat.js\";\r\n\r\nexport class FileAudioSource implements IAudioSource {\r\n\r\n    private privAudioFormatPromise: Promise<AudioStreamFormatImpl>;\r\n\r\n    private privStreams: IStringDictionary<Stream<ArrayBuffer>> = {};\r\n\r\n    private privId: string;\r\n\r\n    private privEvents: EventSource<AudioSourceEvent>;\r\n\r\n    private privSource: Blob | Buffer;\r\n\r\n    private privFilename: string;\r\n\r\n    private privHeaderEnd: number = 44;\r\n\r\n    public constructor(file: File | Buffer, filename?: string, audioSourceId?: string) {\r\n        this.privId = audioSourceId ? audioSourceId : createNoDashGuid();\r\n        this.privEvents = new EventSource<AudioSourceEvent>();\r\n        this.privSource = file;\r\n        if (typeof window !== \"undefined\" && typeof Blob !== \"undefined\" && this.privSource instanceof Blob) {\r\n            this.privFilename = (file as File).name;\r\n        } else {\r\n            this.privFilename = filename || \"unknown.wav\";\r\n        }\r\n\r\n        // Read the header.\r\n        this.privAudioFormatPromise = this.readHeader();\r\n    }\r\n\r\n    public get format(): Promise<AudioStreamFormatImpl> {\r\n        return this.privAudioFormatPromise;\r\n    }\r\n\r\n    public turnOn(): Promise<void> {\r\n        if (this.privFilename.lastIndexOf(\".wav\") !== this.privFilename.length - 4) {\r\n            const errorMsg = this.privFilename + \" is not supported. Only WAVE files are allowed at the moment.\";\r\n            this.onEvent(new AudioSourceErrorEvent(errorMsg, \"\"));\r\n            return Promise.reject(errorMsg);\r\n        }\r\n\r\n        this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\r\n        this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n        return;\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public async attach(audioNodeId: string): Promise<IAudioStreamNode> {\r\n        this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\r\n\r\n        const stream: Stream<ArrayBuffer> = await this.upload(audioNodeId);\r\n\r\n        this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\r\n        return Promise.resolve({\r\n            detach: async (): Promise<void> => {\r\n                stream.readEnded();\r\n                delete this.privStreams[audioNodeId];\r\n                this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n                await this.turnOff();\r\n            },\r\n            id: (): string => audioNodeId,\r\n            read: (): Promise<IStreamChunk<ArrayBuffer>> => stream.read(),\r\n        });\r\n    }\r\n\r\n    public detach(audioNodeId: string): void {\r\n        if (audioNodeId && this.privStreams[audioNodeId]) {\r\n            this.privStreams[audioNodeId].close();\r\n            delete this.privStreams[audioNodeId];\r\n            this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n        }\r\n    }\r\n\r\n    public turnOff(): Promise<void> {\r\n        for (const streamId in this.privStreams) {\r\n            if (streamId) {\r\n                const stream = this.privStreams[streamId];\r\n                if (stream && !stream.isClosed) {\r\n                    stream.close();\r\n                }\r\n            }\r\n        }\r\n\r\n        this.onEvent(new AudioSourceOffEvent(this.privId)); // no stream now\r\n        return Promise.resolve();\r\n    }\r\n\r\n    public get events(): EventSource<AudioSourceEvent> {\r\n        return this.privEvents;\r\n    }\r\n\r\n    public get deviceInfo(): Promise<ISpeechConfigAudioDevice> {\r\n        return this.privAudioFormatPromise.then<ISpeechConfigAudioDevice>((result: AudioStreamFormatImpl): Promise<{\r\n            bitspersample: number;\r\n            channelcount: number;\r\n            connectivity: connectivity.Unknown;\r\n            manufacturer: string;\r\n            model: string;\r\n            samplerate: number;\r\n            type: type.File;\r\n        }> => ( Promise.resolve({\r\n                bitspersample: result.bitsPerSample,\r\n                channelcount: result.channels,\r\n                connectivity: connectivity.Unknown,\r\n                manufacturer: \"Speech SDK\",\r\n                model: \"File\",\r\n                samplerate: result.samplesPerSec,\r\n                type: type.File,\r\n            })\r\n        ));\r\n    }\r\n\r\n    private readHeader(): Promise<AudioStreamFormatImpl> {\r\n        // Read the wave header.\r\n        const maxHeaderSize: number = 4296;\r\n        const header: Blob | Buffer = this.privSource.slice(0, maxHeaderSize);\r\n\r\n        const headerResult: Deferred<AudioStreamFormatImpl> = new Deferred<AudioStreamFormatImpl>();\r\n\r\n        const processHeader = (header: ArrayBuffer): void => {\r\n            const view: DataView = new DataView(header);\r\n\r\n            const getWord = (index: number): string => String.fromCharCode(view.getUint8(index), view.getUint8(index + 1), view.getUint8(index + 2), view.getUint8(index + 3));\r\n\r\n            // RIFF 4 bytes.\r\n            if (\"RIFF\" !== getWord(0)) {\r\n                headerResult.reject(\"Invalid WAV header in file, RIFF was not found\");\r\n                return;\r\n            }\r\n\r\n            // length, 4 bytes\r\n            // RIFF Type & fmt 8 bytes\r\n            if (\"WAVE\" !== getWord(8) || \"fmt \" !== getWord(12)) {\r\n                headerResult.reject(\"Invalid WAV header in file, WAVEfmt was not found\");\r\n                return;\r\n            }\r\n\r\n            const formatSize: number = view.getInt32(16, true);\r\n            const channelCount: number = view.getUint16(22, true);\r\n            const sampleRate: number = view.getUint32(24, true);\r\n            const bitsPerSample: number = view.getUint16(34, true);\r\n            // Confirm if header is 44 bytes long.\r\n            let pos: number = 36 + Math.max(formatSize - 16, 0);\r\n            for (; getWord(pos) !== \"data\"; pos += 2) {\r\n                if (pos > maxHeaderSize - 8) {\r\n                    headerResult.reject(\"Invalid WAV header in file, data block was not found\");\r\n                    return;\r\n                }\r\n            }\r\n            this.privHeaderEnd = pos + 8;\r\n            headerResult.resolve(AudioStreamFormat.getWaveFormatPCM(sampleRate, bitsPerSample, channelCount) as AudioStreamFormatImpl);\r\n        };\r\n\r\n        if (typeof window !== \"undefined\" && typeof Blob !== \"undefined\" && header instanceof Blob) {\r\n            const reader: FileReader = new FileReader();\r\n\r\n            reader.onload = (event: Event): void => {\r\n                const header: ArrayBuffer = (event.target as FileReader).result as ArrayBuffer;\r\n                processHeader(header);\r\n            };\r\n\r\n            reader.readAsArrayBuffer(header);\r\n        } else {\r\n            const h: Buffer = header as Buffer;\r\n            processHeader(h.buffer.slice(h.byteOffset, h.byteOffset + h.byteLength));\r\n        }\r\n        return headerResult.promise;\r\n    }\r\n\r\n    private async upload(audioNodeId: string): Promise<Stream<ArrayBuffer>> {\r\n        const onerror = (error: string): void => {\r\n            const errorMsg = `Error occurred while processing '${this.privFilename}'. ${error}`;\r\n            this.onEvent(new AudioStreamNodeErrorEvent(this.privId, audioNodeId, errorMsg));\r\n            throw new Error(errorMsg);\r\n        };\r\n\r\n        try {\r\n            await this.turnOn();\r\n\r\n            const format: AudioStreamFormatImpl = await this.privAudioFormatPromise;\r\n            const stream = new ChunkedArrayBufferStream(format.avgBytesPerSec / 10, audioNodeId);\r\n\r\n            this.privStreams[audioNodeId] = stream;\r\n            const chunk: Blob | Buffer = this.privSource.slice(this.privHeaderEnd);\r\n\r\n            const processFile = (buff: ArrayBuffer): void => {\r\n                if (stream.isClosed) {\r\n                    return; // output stream was closed (somebody called TurnOff). We're done here.\r\n                }\r\n\r\n                stream.writeStreamChunk({\r\n                    buffer: buff,\r\n                    isEnd: false,\r\n                    timeReceived: Date.now(),\r\n                });\r\n                stream.close();\r\n            };\r\n\r\n            if (typeof window !== \"undefined\" && typeof Blob !== \"undefined\" && chunk instanceof Blob) {\r\n                const reader: FileReader = new FileReader();\r\n                reader.onerror = (ev: ProgressEvent<FileReader>): void  =>  onerror(ev.toString());\r\n\r\n                reader.onload = (event: Event): void => {\r\n                    const fileBuffer: ArrayBuffer = (event.target as FileReader).result as ArrayBuffer;\r\n                    processFile(fileBuffer);\r\n                };\r\n\r\n                reader.readAsArrayBuffer(chunk);\r\n            } else {\r\n                const c: Buffer = chunk as Buffer;\r\n                processFile(c.buffer.slice(c.byteOffset, c.byteOffset + c.byteLength));\r\n            }\r\n\r\n            return stream;\r\n        } catch (e) {\r\n            onerror(e as string);\r\n        }\r\n    }\r\n\r\n    private onEvent(event: AudioSourceEvent): void {\r\n        this.privEvents.onEvent(event);\r\n        Events.instance.onEvent(event);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RiffPcmEncoder, Stream } from \"../common/Exports\";\r\nimport { IRecorder } from \"./IRecorder\";\r\n\r\nexport class PcmRecorder implements IRecorder {\r\n    private privMediaResources: IMediaResources;\r\n    private privSpeechProcessorScript: string; // speech-processor.js Url\r\n    private privStopInputOnRelease: boolean;\r\n\r\n    public constructor(stopInputOnRelease: boolean) {\r\n        this.privStopInputOnRelease = stopInputOnRelease;\r\n    }\r\n\r\n    public record(context: AudioContext, mediaStream: MediaStream, outputStream: Stream<ArrayBuffer>): void {\r\n        const desiredSampleRate = 16000;\r\n\r\n        const waveStreamEncoder = new RiffPcmEncoder(context.sampleRate, desiredSampleRate);\r\n\r\n        const micInput = context.createMediaStreamSource(mediaStream);\r\n\r\n        const attachScriptProcessor = (): void => {\r\n            // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\r\n            const scriptNode = (() => {\r\n                let bufferSize = 0;\r\n                try {\r\n                    return context.createScriptProcessor(bufferSize, 1, 1);\r\n                } catch (error) {\r\n                    // Webkit (<= version 31) requires a valid bufferSize.\r\n                    bufferSize = 2048;\r\n                    let audioSampleRate = context.sampleRate;\r\n                    while (bufferSize < 16384 && audioSampleRate >= (2 * desiredSampleRate)) {\r\n                        bufferSize <<= 1;\r\n                        audioSampleRate >>= 1;\r\n                    }\r\n                    return context.createScriptProcessor(bufferSize, 1, 1);\r\n                }\r\n            })();\r\n            scriptNode.onaudioprocess = (event: AudioProcessingEvent): void => {\r\n                const inputFrame = event.inputBuffer.getChannelData(0);\r\n\r\n                if (outputStream && !outputStream.isClosed) {\r\n                    const waveFrame = waveStreamEncoder.encode(inputFrame);\r\n                    if (!!waveFrame) {\r\n                        outputStream.writeStreamChunk({\r\n                            buffer: waveFrame,\r\n                            isEnd: false,\r\n                            timeReceived: Date.now(),\r\n                        });\r\n                    }\r\n                }\r\n            };\r\n            micInput.connect(scriptNode);\r\n            scriptNode.connect(context.destination);\r\n            this.privMediaResources = {\r\n                scriptProcessorNode: scriptNode,\r\n                source: micInput,\r\n                stream: mediaStream,\r\n            };\r\n        };\r\n\r\n        // https://webaudio.github.io/web-audio-api/#audioworklet\r\n        // Using AudioWorklet to improve audio quality and avoid audio glitches due to blocking the UI thread\r\n        const skipAudioWorklet = !!this.privSpeechProcessorScript && this.privSpeechProcessorScript.toLowerCase() === \"ignore\";\r\n\r\n        if (!!context.audioWorklet && !skipAudioWorklet) {\r\n            if (!this.privSpeechProcessorScript) {\r\n                const workletScript = `class SP extends AudioWorkletProcessor {\r\n                    constructor(options) {\r\n                      super(options);\r\n                    }\r\n                    process(inputs, outputs) {\r\n                      const input = inputs[0];\r\n                      const output = [];\r\n                      for (let channel = 0; channel < input.length; channel += 1) {\r\n                        output[channel] = input[channel];\r\n                      }\r\n                      this.port.postMessage(output[0]);\r\n                      return true;\r\n                    }\r\n                  }\r\n                  registerProcessor('speech-processor', SP);`;\r\n                const blob = new Blob([workletScript], { type: \"application/javascript; charset=utf-8\" });\r\n                this.privSpeechProcessorScript = URL.createObjectURL(blob);\r\n            }\r\n\r\n            context.audioWorklet\r\n                .addModule(this.privSpeechProcessorScript)\r\n                .then((): void => {\r\n                    const workletNode = new AudioWorkletNode(context, \"speech-processor\");\r\n                    workletNode.port.onmessage = (ev: MessageEvent): void => {\r\n                        const inputFrame: Float32Array = ev.data as Float32Array;\r\n\r\n                        if (outputStream && !outputStream.isClosed) {\r\n                            const waveFrame = waveStreamEncoder.encode(inputFrame);\r\n                            if (!!waveFrame) {\r\n                                outputStream.writeStreamChunk({\r\n                                    buffer: waveFrame,\r\n                                    isEnd: false,\r\n                                    timeReceived: Date.now(),\r\n                                });\r\n                            }\r\n                        }\r\n                    };\r\n                    micInput.connect(workletNode);\r\n                    workletNode.connect(context.destination);\r\n                    this.privMediaResources = {\r\n                        scriptProcessorNode: workletNode,\r\n                        source: micInput,\r\n                        stream: mediaStream,\r\n                    };\r\n                })\r\n                .catch((): void => {\r\n                    attachScriptProcessor();\r\n                });\r\n        } else {\r\n            try {\r\n                attachScriptProcessor();\r\n            } catch (err) {\r\n                throw new Error(`Unable to start audio worklet node for PCMRecorder: ${err as string}`);\r\n            }\r\n        }\r\n    }\r\n\r\n    public releaseMediaResources(context: AudioContext): void {\r\n        if (this.privMediaResources) {\r\n            if (this.privMediaResources.scriptProcessorNode) {\r\n                this.privMediaResources.scriptProcessorNode.disconnect(context.destination);\r\n                this.privMediaResources.scriptProcessorNode = null;\r\n            }\r\n            if (this.privMediaResources.source) {\r\n                this.privMediaResources.source.disconnect();\r\n                if (this.privStopInputOnRelease) {\r\n                    this.privMediaResources.stream.getTracks().forEach((track: MediaStreamTrack): void => track.stop());\r\n                }\r\n                this.privMediaResources.source = null;\r\n            }\r\n        }\r\n    }\r\n\r\n    public setWorkletUrl(url: string): void {\r\n        this.privSpeechProcessorScript = url;\r\n    }\r\n}\r\n\r\ninterface IMediaResources {\r\n    source: MediaStreamAudioSourceNode;\r\n    scriptProcessorNode: ScriptProcessorNode | AudioWorkletNode;\r\n    stream: MediaStream;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ArgumentNullError,\r\n    ConnectionEvent,\r\n    ConnectionMessage,\r\n    ConnectionOpenResponse,\r\n    ConnectionState,\r\n    createNoDashGuid,\r\n    EventSource,\r\n    IConnection,\r\n    IStringDictionary,\r\n    IWebsocketMessageFormatter,\r\n} from \"../common/Exports.js\";\r\nimport { ProxyInfo } from \"./ProxyInfo.js\";\r\nimport { WebsocketMessageAdapter } from \"./WebsocketMessageAdapter.js\";\r\n\r\nexport class WebsocketConnection implements IConnection {\r\n\r\n    private privUri: string;\r\n    private privMessageFormatter: IWebsocketMessageFormatter;\r\n    private privConnectionMessageAdapter: WebsocketMessageAdapter;\r\n    private privId: string;\r\n    private privIsDisposed: boolean = false;\r\n\r\n    public constructor(\r\n        uri: string,\r\n        queryParameters: IStringDictionary<string>,\r\n        headers: IStringDictionary<string>,\r\n        messageFormatter: IWebsocketMessageFormatter,\r\n        proxyInfo: ProxyInfo,\r\n        enableCompression: boolean = false,\r\n        connectionId?: string) {\r\n\r\n        if (!uri) {\r\n            throw new ArgumentNullError(\"uri\");\r\n        }\r\n\r\n        if (!messageFormatter) {\r\n            throw new ArgumentNullError(\"messageFormatter\");\r\n        }\r\n\r\n        this.privMessageFormatter = messageFormatter;\r\n\r\n        let queryParams = \"\";\r\n        let i = 0;\r\n\r\n        if (queryParameters) {\r\n            for (const paramName in queryParameters) {\r\n                if (paramName) {\r\n                    queryParams += ((i === 0) && (uri.indexOf(\"?\") === -1)) ? \"?\" : \"&\";\r\n\r\n                    const key = encodeURIComponent(paramName);\r\n                    queryParams += key;\r\n\r\n                    let val = queryParameters[paramName];\r\n                    if (val) {\r\n                        val = encodeURIComponent(val);\r\n                        queryParams += `=${val}`;\r\n                    }\r\n\r\n                    i++;\r\n                }\r\n            }\r\n        }\r\n\r\n        if (headers) {\r\n            for (const headerName in headers) {\r\n                if (headerName) {\r\n                    queryParams += ((i === 0) && (uri.indexOf(\"?\") === -1)) ? \"?\" : \"&\";\r\n                    const val = encodeURIComponent(headers[headerName]);\r\n                    queryParams += `${headerName}=${val}`;\r\n                    i++;\r\n                }\r\n            }\r\n        }\r\n\r\n        this.privUri = uri + queryParams;\r\n        this.privId = connectionId ? connectionId : createNoDashGuid();\r\n\r\n        this.privConnectionMessageAdapter = new WebsocketMessageAdapter(\r\n            this.privUri,\r\n            this.id,\r\n            this.privMessageFormatter,\r\n            proxyInfo,\r\n            headers,\r\n            enableCompression);\r\n    }\r\n\r\n    public async dispose(): Promise<void> {\r\n        this.privIsDisposed = true;\r\n\r\n        if (this.privConnectionMessageAdapter) {\r\n            await this.privConnectionMessageAdapter.close();\r\n        }\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public get uri(): string {\r\n        return this.privUri;\r\n    }\r\n\r\n    public state(): ConnectionState {\r\n        return this.privConnectionMessageAdapter.state;\r\n    }\r\n\r\n    public open(): Promise<ConnectionOpenResponse> {\r\n        return this.privConnectionMessageAdapter.open();\r\n    }\r\n\r\n    public send(message: ConnectionMessage): Promise<void> {\r\n        return this.privConnectionMessageAdapter.send(message);\r\n    }\r\n\r\n    public read(): Promise<ConnectionMessage> {\r\n        return this.privConnectionMessageAdapter.read();\r\n    }\r\n\r\n    public get events(): EventSource<ConnectionEvent> {\r\n        return this.privConnectionMessageAdapter.events;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// Node.JS specific web socket / browser support.\r\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\r\nimport * as http from \"http\";\r\nimport * as net from \"net\";\r\nimport * as tls from \"tls\";\r\nimport Agent from \"agent-base\";\r\nimport HttpsProxyAgent from \"https-proxy-agent\";\r\n\r\nimport ws from \"ws\";\r\nimport { HeaderNames } from \"../common.speech/HeaderNames.js\";\r\nimport {\r\n    ArgumentNullError,\r\n    BackgroundEvent,\r\n    ConnectionClosedEvent,\r\n    ConnectionErrorEvent,\r\n    ConnectionEstablishedEvent,\r\n    ConnectionEvent,\r\n    ConnectionMessage,\r\n    ConnectionMessageReceivedEvent,\r\n    ConnectionMessageSentEvent,\r\n    ConnectionOpenResponse,\r\n    ConnectionStartEvent,\r\n    ConnectionState,\r\n    Deferred,\r\n    Events,\r\n    EventSource,\r\n    IWebsocketMessageFormatter,\r\n    MessageType,\r\n    Queue,\r\n    RawWebsocketMessage,\r\n} from \"../common/Exports.js\";\r\nimport { ProxyInfo } from \"./ProxyInfo.js\";\r\n\r\ninterface ISendItem {\r\n    Message: ConnectionMessage;\r\n    RawWebsocketMessage: RawWebsocketMessage;\r\n    sendStatusDeferral: Deferred<void>;\r\n}\r\n\r\nexport class WebsocketMessageAdapter {\r\n    private privConnectionState: ConnectionState;\r\n    private privMessageFormatter: IWebsocketMessageFormatter;\r\n    private privWebsocketClient: WebSocket | ws;\r\n\r\n    private privSendMessageQueue: Queue<ISendItem>;\r\n    private privReceivingMessageQueue: Queue<ConnectionMessage>;\r\n    private privConnectionEstablishDeferral: Deferred<ConnectionOpenResponse>;\r\n    private privCertificateValidatedDeferral: Deferred<void>;\r\n    private privDisconnectDeferral: Deferred<void>;\r\n    private privConnectionEvents: EventSource<ConnectionEvent>;\r\n    private privConnectionId: string;\r\n    private privUri: string;\r\n    private proxyInfo: ProxyInfo;\r\n    private privHeaders: { [key: string]: string };\r\n    private privLastErrorReceived: string;\r\n    private privEnableCompression: boolean;\r\n\r\n    public static forceNpmWebSocket: boolean = false;\r\n\r\n    public constructor(\r\n        uri: string,\r\n        connectionId: string,\r\n        messageFormatter: IWebsocketMessageFormatter,\r\n        proxyInfo: ProxyInfo,\r\n        headers: { [key: string]: string },\r\n        enableCompression: boolean) {\r\n\r\n        if (!uri) {\r\n            throw new ArgumentNullError(\"uri\");\r\n        }\r\n\r\n        if (!messageFormatter) {\r\n            throw new ArgumentNullError(\"messageFormatter\");\r\n        }\r\n\r\n        this.proxyInfo = proxyInfo;\r\n        this.privConnectionEvents = new EventSource<ConnectionEvent>();\r\n        this.privConnectionId = connectionId;\r\n        this.privMessageFormatter = messageFormatter;\r\n        this.privConnectionState = ConnectionState.None;\r\n        this.privUri = uri;\r\n        this.privHeaders = headers;\r\n        this.privEnableCompression = enableCompression;\r\n\r\n        // Add the connection ID to the headers\r\n        this.privHeaders[HeaderNames.ConnectionId] = this.privConnectionId;\r\n\r\n        this.privLastErrorReceived = \"\";\r\n    }\r\n\r\n    public get state(): ConnectionState {\r\n        return this.privConnectionState;\r\n    }\r\n\r\n    public open(): Promise<ConnectionOpenResponse> {\r\n        if (this.privConnectionState === ConnectionState.Disconnected) {\r\n            return Promise.reject<ConnectionOpenResponse>(`Cannot open a connection that is in ${this.privConnectionState} state`);\r\n        }\r\n\r\n        if (this.privConnectionEstablishDeferral) {\r\n            return this.privConnectionEstablishDeferral.promise;\r\n        }\r\n\r\n        this.privConnectionEstablishDeferral = new Deferred<ConnectionOpenResponse>();\r\n        this.privCertificateValidatedDeferral = new Deferred<void>();\r\n\r\n        this.privConnectionState = ConnectionState.Connecting;\r\n\r\n        try {\r\n\r\n            if (typeof WebSocket !== \"undefined\" && !WebsocketMessageAdapter.forceNpmWebSocket) {\r\n                // Browser handles cert checks.\r\n                this.privCertificateValidatedDeferral.resolve();\r\n\r\n                this.privWebsocketClient = new WebSocket(this.privUri);\r\n            } else {\r\n                const options: ws.ClientOptions = { headers: this.privHeaders, perMessageDeflate: this.privEnableCompression };\r\n                // The ocsp library will handle validation for us and fail the connection if needed.\r\n                this.privCertificateValidatedDeferral.resolve();\r\n\r\n                options.agent = this.getAgent();\r\n                // Workaround for https://github.com/microsoft/cognitive-services-speech-sdk-js/issues/465\r\n                // Which is root caused by https://github.com/TooTallNate/node-agent-base/issues/61\r\n                const uri = new URL(this.privUri);\r\n                let protocol: string = uri.protocol;\r\n\r\n                if (protocol?.toLocaleLowerCase() === \"wss:\") {\r\n                    protocol = \"https:\";\r\n                } else if (protocol?.toLocaleLowerCase() === \"ws:\") {\r\n                    protocol = \"http:\";\r\n                }\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n                (options.agent as any).protocol = protocol;\r\n                this.privWebsocketClient = new ws(this.privUri, options);\r\n            }\r\n\r\n            this.privWebsocketClient.binaryType = \"arraybuffer\";\r\n            this.privReceivingMessageQueue = new Queue<ConnectionMessage>();\r\n            this.privDisconnectDeferral = new Deferred<void>();\r\n            this.privSendMessageQueue = new Queue<ISendItem>();\r\n            this.processSendQueue().catch((reason: string): void => {\r\n                Events.instance.onEvent(new BackgroundEvent(reason));\r\n            });\r\n        } catch (error) {\r\n            this.privConnectionEstablishDeferral.resolve(new ConnectionOpenResponse(500, error as string));\r\n            return this.privConnectionEstablishDeferral.promise;\r\n        }\r\n\r\n        this.onEvent(new ConnectionStartEvent(this.privConnectionId, this.privUri));\r\n\r\n        this.privWebsocketClient.onopen = (): void => {\r\n            this.privCertificateValidatedDeferral.promise.then((): void => {\r\n                this.privConnectionState = ConnectionState.Connected;\r\n                this.onEvent(new ConnectionEstablishedEvent(this.privConnectionId));\r\n                this.privConnectionEstablishDeferral.resolve(new ConnectionOpenResponse(200, \"\"));\r\n            }, (error: string): void => {\r\n                this.privConnectionEstablishDeferral.reject(error);\r\n            });\r\n        };\r\n\r\n        this.privWebsocketClient.onerror = (e: { error: any; message: string; type: string; target: WebSocket | ws }): void => {\r\n            this.onEvent(new ConnectionErrorEvent(this.privConnectionId, e.message, e.type));\r\n            this.privLastErrorReceived = e.message;\r\n        };\r\n\r\n        this.privWebsocketClient.onclose = (e: { wasClean: boolean; code: number; reason: string; target: WebSocket | ws }): void => {\r\n            if (this.privConnectionState === ConnectionState.Connecting) {\r\n                this.privConnectionState = ConnectionState.Disconnected;\r\n                // this.onEvent(new ConnectionEstablishErrorEvent(this.connectionId, e.code, e.reason));\r\n                this.privConnectionEstablishDeferral.resolve(new ConnectionOpenResponse(e.code, e.reason + \" \" + this.privLastErrorReceived));\r\n            } else {\r\n                this.privConnectionState = ConnectionState.Disconnected;\r\n                this.privWebsocketClient = null;\r\n                this.onEvent(new ConnectionClosedEvent(this.privConnectionId, e.code, e.reason));\r\n            }\r\n\r\n            this.onClose(e.code, e.reason).catch((reason: string): void => {\r\n                Events.instance.onEvent(new BackgroundEvent(reason));\r\n            });\r\n        };\r\n\r\n        this.privWebsocketClient.onmessage = (e: { data: ws.Data; type: string; target: WebSocket | ws }): void => {\r\n            const networkReceivedTime = new Date().toISOString();\r\n            if (this.privConnectionState === ConnectionState.Connected) {\r\n                const deferred = new Deferred<ConnectionMessage>();\r\n                // let id = ++this.idCounter;\r\n                this.privReceivingMessageQueue.enqueueFromPromise(deferred.promise);\r\n                if (e.data instanceof ArrayBuffer) {\r\n                    const rawMessage = new RawWebsocketMessage(MessageType.Binary, e.data);\r\n                    this.privMessageFormatter\r\n                        .toConnectionMessage(rawMessage)\r\n                        .then((connectionMessage: ConnectionMessage): void => {\r\n                            this.onEvent(new ConnectionMessageReceivedEvent(this.privConnectionId, networkReceivedTime, connectionMessage));\r\n                            deferred.resolve(connectionMessage);\r\n                        }, (error: string): void => {\r\n                            // TODO: Events for these ?\r\n                            deferred.reject(`Invalid binary message format. Error: ${error}`);\r\n                        });\r\n                } else {\r\n                    const rawMessage = new RawWebsocketMessage(MessageType.Text, e.data);\r\n                    this.privMessageFormatter\r\n                        .toConnectionMessage(rawMessage)\r\n                        .then((connectionMessage: ConnectionMessage): void => {\r\n                            this.onEvent(new ConnectionMessageReceivedEvent(this.privConnectionId, networkReceivedTime, connectionMessage));\r\n                            deferred.resolve(connectionMessage);\r\n                        }, (error: string): void => {\r\n                            // TODO: Events for these ?\r\n                            deferred.reject(`Invalid text message format. Error: ${error}`);\r\n                        });\r\n                }\r\n            }\r\n        };\r\n\r\n        return this.privConnectionEstablishDeferral.promise;\r\n    }\r\n\r\n    public send(message: ConnectionMessage): Promise<void> {\r\n        if (this.privConnectionState !== ConnectionState.Connected) {\r\n            return Promise.reject(`Cannot send on connection that is in ${ConnectionState[this.privConnectionState]} state`);\r\n        }\r\n\r\n        const messageSendStatusDeferral = new Deferred<void>();\r\n        const messageSendDeferral = new Deferred<ISendItem>();\r\n\r\n        this.privSendMessageQueue.enqueueFromPromise(messageSendDeferral.promise);\r\n\r\n        this.privMessageFormatter\r\n            .fromConnectionMessage(message)\r\n            .then((rawMessage: RawWebsocketMessage): void => {\r\n                messageSendDeferral.resolve({\r\n                    Message: message,\r\n                    RawWebsocketMessage: rawMessage,\r\n                    sendStatusDeferral: messageSendStatusDeferral,\r\n                });\r\n            }, (error: string): void => {\r\n                messageSendDeferral.reject(`Error formatting the message. ${error}`);\r\n            });\r\n\r\n        return messageSendStatusDeferral.promise;\r\n    }\r\n\r\n    public read(): Promise<ConnectionMessage> {\r\n        if (this.privConnectionState !== ConnectionState.Connected) {\r\n            return Promise.reject<ConnectionMessage>(`Cannot read on connection that is in ${this.privConnectionState} state`);\r\n        }\r\n\r\n        return this.privReceivingMessageQueue.dequeue();\r\n    }\r\n\r\n    public close(reason?: string): Promise<void> {\r\n        if (this.privWebsocketClient) {\r\n            if (this.privConnectionState !== ConnectionState.Disconnected) {\r\n                this.privWebsocketClient.close(1000, reason ? reason : \"Normal closure by client\");\r\n            }\r\n        } else {\r\n            return Promise.resolve();\r\n        }\r\n\r\n        return this.privDisconnectDeferral.promise;\r\n    }\r\n\r\n    public get events(): EventSource<ConnectionEvent> {\r\n        return this.privConnectionEvents;\r\n    }\r\n\r\n    private sendRawMessage(sendItem: ISendItem): Promise<void> {\r\n        try {\r\n            // indicates we are draining the queue and it came with no message;\r\n            if (!sendItem) {\r\n                return Promise.resolve();\r\n            }\r\n\r\n            this.onEvent(new ConnectionMessageSentEvent(this.privConnectionId, new Date().toISOString(), sendItem.Message));\r\n\r\n            // add a check for the ws readystate in order to stop the red console error 'WebSocket is already in CLOSING or CLOSED state' appearing\r\n            if (this.isWebsocketOpen) {\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n                this.privWebsocketClient.send(sendItem.RawWebsocketMessage.payload);\r\n            } else {\r\n                return Promise.reject(\"websocket send error: Websocket not ready \" + this.privConnectionId + \" \" + sendItem.Message.id + \" \" + new Error().stack);\r\n            }\r\n            return Promise.resolve();\r\n\r\n        } catch (e) {\r\n            return Promise.reject(`websocket send error: ${e as string}`);\r\n        }\r\n    }\r\n\r\n    private async onClose(code: number, reason: string): Promise<void> {\r\n        const closeReason = `Connection closed. ${code}: ${reason}`;\r\n        this.privConnectionState = ConnectionState.Disconnected;\r\n        this.privDisconnectDeferral.resolve();\r\n        await this.privReceivingMessageQueue.drainAndDispose((): void => {\r\n            // TODO: Events for these ?\r\n            // Logger.instance.onEvent(new LoggingEvent(LogType.Warning, null, `Failed to process received message. Reason: ${closeReason}, Message: ${JSON.stringify(pendingReceiveItem)}`));\r\n        }, closeReason);\r\n\r\n        await this.privSendMessageQueue.drainAndDispose((pendingSendItem: ISendItem): void => {\r\n            pendingSendItem.sendStatusDeferral.reject(closeReason);\r\n        }, closeReason);\r\n    }\r\n\r\n    private async processSendQueue(): Promise<void> {\r\n        while (true) {\r\n            const itemToSend: Promise<ISendItem> = this.privSendMessageQueue.dequeue();\r\n            const sendItem: ISendItem = await itemToSend;\r\n            // indicates we are draining the queue and it came with no message;\r\n            if (!sendItem) {\r\n                return;\r\n            }\r\n\r\n            try {\r\n                await this.sendRawMessage(sendItem);\r\n                sendItem.sendStatusDeferral.resolve();\r\n            } catch (sendError) {\r\n                sendItem.sendStatusDeferral.reject(sendError as string);\r\n            }\r\n        }\r\n    }\r\n\r\n    private onEvent(event: ConnectionEvent): void {\r\n        this.privConnectionEvents.onEvent(event);\r\n        Events.instance.onEvent(event);\r\n    }\r\n\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    private getAgent(): http.Agent {\r\n        // eslint-disable-next-line @typescript-eslint/unbound-method\r\n        const agent: { proxyInfo: ProxyInfo } = new Agent.Agent(this.createConnection) as unknown as { proxyInfo: ProxyInfo } ;\r\n\r\n        if (this.proxyInfo !== undefined &&\r\n            this.proxyInfo.HostName !== undefined &&\r\n            this.proxyInfo.Port > 0) {\r\n            agent.proxyInfo = this.proxyInfo;\r\n        }\r\n\r\n        return agent as unknown as http.Agent;\r\n    }\r\n\r\n    private static GetProxyAgent(proxyInfo: ProxyInfo): HttpsProxyAgent {\r\n        const httpProxyOptions: HttpsProxyAgent.HttpsProxyAgentOptions = {\r\n            host: proxyInfo.HostName,\r\n            port: proxyInfo.Port,\r\n        };\r\n\r\n        if (!!proxyInfo.UserName) {\r\n            httpProxyOptions.headers = {\r\n                \"Proxy-Authentication\": \"Basic \" + new Buffer(`${proxyInfo.UserName}:${(proxyInfo.Password === undefined) ? \"\" : proxyInfo.Password}`).toString(\"base64\"),\r\n            };\r\n        } else {\r\n            httpProxyOptions.headers = {};\r\n        }\r\n\r\n        httpProxyOptions.headers.requestOCSP = \"true\";\r\n\r\n        const httpProxyAgent: HttpsProxyAgent = new HttpsProxyAgent(httpProxyOptions);\r\n        return httpProxyAgent;\r\n    }\r\n\r\n    private createConnection(request: Agent.ClientRequest, options: Agent.RequestOptions): Promise<net.Socket> {\r\n        let socketPromise: Promise<net.Socket>;\r\n\r\n        options = {\r\n            ...options,\r\n            ...{\r\n                requestOCSP: true,\r\n                servername: options.host\r\n            }\r\n        };\r\n\r\n        if (!!this.proxyInfo) {\r\n            const httpProxyAgent: HttpsProxyAgent = WebsocketMessageAdapter.GetProxyAgent(this.proxyInfo);\r\n            const baseAgent: Agent.Agent = httpProxyAgent as unknown as Agent.Agent;\r\n\r\n            socketPromise = new Promise<net.Socket>((resolve: (value: net.Socket) => void, reject: (error: string | Error) => void): void => {\r\n                baseAgent.callback(request, options, (error: Error, socket: net.Socket): void => {\r\n                    if (!!error) {\r\n                        reject(error);\r\n                    } else {\r\n                        resolve(socket);\r\n                    }\r\n                });\r\n            });\r\n        } else {\r\n            if (!!options.secureEndpoint) {\r\n                socketPromise = Promise.resolve(tls.connect(options));\r\n            } else {\r\n                socketPromise = Promise.resolve(net.connect(options));\r\n            }\r\n        }\r\n\r\n        return socketPromise;\r\n    }\r\n\r\n    private get isWebsocketOpen(): boolean {\r\n        return this.privWebsocketClient && this.privWebsocketClient.readyState === this.privWebsocketClient.OPEN;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nimport {\r\n    IAudioStreamNode,\r\n    IStreamChunk,\r\n} from \"../common/Exports.js\";\r\n\r\nexport class ReplayableAudioNode implements IAudioStreamNode {\r\n    private privAudioNode: IAudioStreamNode;\r\n    private privBytesPerSecond: number;\r\n    private privBuffers: BufferEntry[] = [];\r\n    private privReplayOffset: number = 0;\r\n    private privLastShrinkOffset: number = 0;\r\n    private privBufferStartOffset: number = 0;\r\n    private privBufferSerial: number = 0;\r\n    private privBufferedBytes: number = 0;\r\n    private privReplay: boolean = false;\r\n    private privLastChunkAcquiredTime: number = 0;\r\n\r\n    public constructor(audioSource: IAudioStreamNode, bytesPerSecond: number) {\r\n        this.privAudioNode = audioSource;\r\n        this.privBytesPerSecond = bytesPerSecond;\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privAudioNode.id();\r\n    }\r\n\r\n    // Reads and returns the next chunk of audio buffer.\r\n    // If replay of existing buffers are needed, read() will first seek and replay\r\n    // existing content, and upoin completion it will read new content from the underlying\r\n    // audio node, saving that content into the replayable buffers.\r\n    public read(): Promise<IStreamChunk<ArrayBuffer>> {\r\n        // if there is a replay request to honor.\r\n        if (!!this.privReplay && this.privBuffers.length !== 0) {\r\n            // Find the start point in the buffers.\r\n            // Offsets are in 100ns increments.\r\n            // So how many bytes do we need to seek to get the right offset?\r\n            const offsetToSeek: number = this.privReplayOffset - this.privBufferStartOffset;\r\n\r\n            let bytesToSeek: number = Math.round(offsetToSeek * this.privBytesPerSecond * 1e-7);\r\n            if (0 !== (bytesToSeek % 2)) {\r\n                bytesToSeek++;\r\n            }\r\n\r\n            let i: number = 0;\r\n\r\n            while (i < this.privBuffers.length && bytesToSeek >= this.privBuffers[i].chunk.buffer.byteLength) {\r\n                bytesToSeek -= this.privBuffers[i++].chunk.buffer.byteLength;\r\n            }\r\n\r\n            if (i < this.privBuffers.length) {\r\n                const retVal: ArrayBuffer = this.privBuffers[i].chunk.buffer.slice(bytesToSeek);\r\n\r\n                this.privReplayOffset += (retVal.byteLength / this.privBytesPerSecond) * 1e+7;\r\n\r\n                // If we've reached the end of the buffers, stop replaying.\r\n                if (i === this.privBuffers.length - 1) {\r\n                    this.privReplay = false;\r\n                }\r\n\r\n                return Promise.resolve<IStreamChunk<ArrayBuffer>>({\r\n                    buffer: retVal,\r\n                    isEnd: false,\r\n                    timeReceived: this.privBuffers[i].chunk.timeReceived,\r\n                });\r\n            }\r\n        }\r\n\r\n        return this.privAudioNode.read()\r\n            .then((result: IStreamChunk<ArrayBuffer>): IStreamChunk<ArrayBuffer> => {\r\n                if (result && result.buffer) {\r\n                    this.privBuffers.push(new BufferEntry(result, this.privBufferSerial++, this.privBufferedBytes));\r\n                    this.privBufferedBytes += result.buffer.byteLength;\r\n                }\r\n                return result;\r\n            });\r\n    }\r\n\r\n    public detach(): Promise<void> {\r\n        this.privBuffers = undefined;\r\n        return this.privAudioNode.detach();\r\n    }\r\n\r\n    public replay(): void {\r\n        if (this.privBuffers && 0 !== this.privBuffers.length) {\r\n            this.privReplay = true;\r\n            this.privReplayOffset = this.privLastShrinkOffset;\r\n        }\r\n    }\r\n\r\n    // Shrinks the existing audio buffers to start at the new offset, or at the\r\n    // beginning of the buffer closest to the requested offset.\r\n    // A replay request will start from the last shrink point.\r\n    public shrinkBuffers(offset: number): void {\r\n        if (this.privBuffers === undefined || this.privBuffers.length === 0) {\r\n            return;\r\n        }\r\n\r\n        this.privLastShrinkOffset = offset;\r\n\r\n        // Find the start point in the buffers.\r\n        // Offsets are in 100ns increments.\r\n        // So how many bytes do we need to seek to get the right offset?\r\n        const offsetToSeek: number = offset - this.privBufferStartOffset;\r\n\r\n        let bytesToSeek: number = Math.round(offsetToSeek * this.privBytesPerSecond * 1e-7);\r\n\r\n        let i: number = 0;\r\n\r\n        while (i < this.privBuffers.length && bytesToSeek >= this.privBuffers[i].chunk.buffer.byteLength) {\r\n            bytesToSeek -= this.privBuffers[i++].chunk.buffer.byteLength;\r\n        }\r\n        this.privBufferStartOffset = Math.round(offset - ((bytesToSeek / this.privBytesPerSecond) * 1e+7));\r\n        this.privBuffers = this.privBuffers.slice(i);\r\n    }\r\n\r\n    // Finds the time a buffer of audio was first seen by offset.\r\n    public findTimeAtOffset(offset: number): number {\r\n        if (offset < this.privBufferStartOffset || this.privBuffers === undefined) {\r\n            return 0;\r\n        }\r\n\r\n        for (const value of this.privBuffers) {\r\n            const startOffset: number = (value.byteOffset / this.privBytesPerSecond) * 1e7;\r\n            const endOffset: number = startOffset + ((value.chunk.buffer.byteLength / this.privBytesPerSecond) * 1e7);\r\n\r\n            if (offset >= startOffset && offset <= endOffset) {\r\n                return value.chunk.timeReceived;\r\n            }\r\n        }\r\n\r\n        return 0;\r\n    }\r\n}\r\n\r\n// Primary use of this class is to help debugging problems with the replay\r\n// code. If the memory cost of alloc / dealloc gets too much, drop it and just use\r\n// the ArrayBuffer directly.\r\nclass BufferEntry {\r\n    public chunk: IStreamChunk<ArrayBuffer>;\r\n    public serial: number;\r\n    public byteOffset: number;\r\n\r\n    public constructor(chunk: IStreamChunk<ArrayBuffer>, serial: number, byteOffset: number) {\r\n        this.chunk = chunk;\r\n        this.serial = serial;\r\n        this.byteOffset = byteOffset;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognizerConfig } from \"../common.speech/Exports.js\";\r\nimport { PropertyCollection, PropertyId } from \"../sdk/Exports.js\";\r\n\r\nexport class ProxyInfo {\r\n    private privProxyHostName: string;\r\n    private privProxyPort: number;\r\n    private privProxyUserName: string;\r\n    private privProxyPassword: string;\r\n\r\n    private constructor(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string) {\r\n        this.privProxyHostName = proxyHostName;\r\n        this.privProxyPort = proxyPort;\r\n        this.privProxyUserName = proxyUserName;\r\n        this.privProxyPassword = proxyPassword;\r\n    }\r\n\r\n    public static fromParameters(parameters: PropertyCollection): ProxyInfo {\r\n        return new ProxyInfo(parameters.getProperty(PropertyId.SpeechServiceConnection_ProxyHostName),\r\n            parseInt(parameters.getProperty(PropertyId.SpeechServiceConnection_ProxyPort), 10),\r\n            parameters.getProperty(PropertyId.SpeechServiceConnection_ProxyUserName),\r\n            parameters.getProperty(PropertyId.SpeechServiceConnection_ProxyPassword));\r\n    }\r\n\r\n    public static fromRecognizerConfig(config: RecognizerConfig): ProxyInfo {\r\n        return this.fromParameters(config.parameters);\r\n    }\r\n\r\n    public get HostName(): string {\r\n        return this.privProxyHostName;\r\n    }\r\n\r\n    public get Port(): number {\r\n        return this.privProxyPort;\r\n    }\r\n\r\n    public get UserName(): string {\r\n        return this.privProxyUserName;\r\n    }\r\n\r\n    public get Password(): string {\r\n        return this.privProxyPassword;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport { AudioConfig } from \"./Audio/AudioConfig.js\";\r\nexport { AudioStreamFormat, AudioFormatTag } from \"./Audio/AudioStreamFormat.js\";\r\nexport { AudioInputStream, PullAudioInputStream, PushAudioInputStream } from \"./Audio/AudioInputStream.js\";\r\nexport { AudioOutputStream, PullAudioOutputStream, PushAudioOutputStream} from \"./Audio/AudioOutputStream.js\";\r\nexport { CancellationReason } from \"./CancellationReason.js\";\r\nexport { PullAudioInputStreamCallback } from \"./Audio/PullAudioInputStreamCallback.js\";\r\nexport { PushAudioOutputStreamCallback } from \"./Audio/PushAudioOutputStreamCallback.js\";\r\nexport { KeywordRecognitionModel } from \"./KeywordRecognitionModel.js\";\r\nexport { SessionEventArgs } from \"./SessionEventArgs.js\";\r\nexport { RecognitionEventArgs } from \"./RecognitionEventArgs.js\";\r\nexport { OutputFormat } from \"./OutputFormat.js\";\r\nexport { IntentRecognitionEventArgs } from \"./IntentRecognitionEventArgs.js\";\r\nexport { RecognitionResult } from \"./RecognitionResult.js\";\r\nexport { SpeechRecognitionResult } from \"./SpeechRecognitionResult.js\";\r\nexport { IntentRecognitionResult } from \"./IntentRecognitionResult.js\";\r\nexport { LanguageUnderstandingModel } from \"./LanguageUnderstandingModel.js\";\r\nexport { SpeechRecognitionEventArgs, ConversationTranscriptionEventArgs, MeetingTranscriptionEventArgs } from \"./SpeechRecognitionEventArgs.js\";\r\nexport { SpeechRecognitionCanceledEventArgs } from \"./SpeechRecognitionCanceledEventArgs.js\";\r\nexport { TranslationRecognitionEventArgs } from \"./TranslationRecognitionEventArgs.js\";\r\nexport { TranslationSynthesisEventArgs } from \"./TranslationSynthesisEventArgs.js\";\r\nexport { TranslationRecognitionResult } from \"./TranslationRecognitionResult.js\";\r\nexport { TranslationSynthesisResult } from \"./TranslationSynthesisResult.js\";\r\nexport { ResultReason } from \"./ResultReason.js\";\r\nexport { SpeechConfig, SpeechConfigImpl } from \"./SpeechConfig.js\";\r\nexport { SpeechTranslationConfig, SpeechTranslationConfigImpl } from \"./SpeechTranslationConfig.js\";\r\nexport { PropertyCollection } from \"./PropertyCollection.js\";\r\nexport { PropertyId } from \"./PropertyId.js\";\r\nexport { Recognizer } from \"./Recognizer.js\";\r\nexport { SpeechRecognizer } from \"./SpeechRecognizer.js\";\r\nexport { IntentRecognizer } from \"./IntentRecognizer.js\";\r\nexport { VoiceProfileType } from \"./VoiceProfileType.js\";\r\nexport { TranslationRecognizer } from \"./TranslationRecognizer.js\";\r\nexport { Translations } from \"./Translations.js\";\r\nexport { NoMatchReason } from \"./NoMatchReason.js\";\r\nexport { NoMatchDetails } from \"./NoMatchDetails.js\";\r\nexport { TranslationRecognitionCanceledEventArgs } from \"./TranslationRecognitionCanceledEventArgs.js\";\r\nexport { IntentRecognitionCanceledEventArgs } from \"./IntentRecognitionCanceledEventArgs.js\";\r\nexport { CancellationDetailsBase } from \"./CancellationDetailsBase.js\";\r\nexport { CancellationDetails } from \"./CancellationDetails.js\";\r\nexport { CancellationErrorCode } from \"./CancellationErrorCodes.js\";\r\nexport { ConnectionEventArgs } from \"./ConnectionEventArgs.js\";\r\nexport { ServiceEventArgs } from \"./ServiceEventArgs.js\";\r\nexport { Connection } from \"./Connection.js\";\r\nexport { PhraseListGrammar } from \"./PhraseListGrammar.js\";\r\nexport { DialogServiceConfig } from \"./DialogServiceConfig.js\";\r\nexport { BotFrameworkConfig } from \"./BotFrameworkConfig.js\";\r\nexport { CustomCommandsConfig } from \"./CustomCommandsConfig.js\";\r\nexport { DialogServiceConnector } from \"./DialogServiceConnector.js\";\r\nexport { ActivityReceivedEventArgs } from \"./ActivityReceivedEventArgs.js\";\r\nexport { TurnStatusReceivedEventArgs } from \"./TurnStatusReceivedEventArgs.js\";\r\nexport { ServicePropertyChannel } from \"./ServicePropertyChannel.js\";\r\nexport { ProfanityOption } from \"./ProfanityOption.js\";\r\nexport { BaseAudioPlayer } from \"./Audio/BaseAudioPlayer.js\";\r\nexport { ConnectionMessageEventArgs } from \"./ConnectionMessageEventArgs.js\";\r\nexport { ConnectionMessage } from \"./ConnectionMessage.js\";\r\nexport { VoiceProfile } from \"./VoiceProfile.js\";\r\nexport { VoiceProfileEnrollmentResult, VoiceProfileEnrollmentCancellationDetails } from \"./VoiceProfileEnrollmentResult.js\";\r\nexport { VoiceProfileResult, VoiceProfileCancellationDetails } from \"./VoiceProfileResult.js\";\r\nexport { VoiceProfilePhraseResult } from \"./VoiceProfilePhraseResult.js\";\r\nexport { VoiceProfileClient } from \"./VoiceProfileClient.js\";\r\nexport { SpeakerRecognizer } from \"./SpeakerRecognizer.js\";\r\nexport { SpeakerIdentificationModel } from \"./SpeakerIdentificationModel.js\";\r\nexport { SpeakerVerificationModel } from \"./SpeakerVerificationModel.js\";\r\nexport { AutoDetectSourceLanguageConfig } from \"./AutoDetectSourceLanguageConfig.js\";\r\nexport { AutoDetectSourceLanguageResult } from \"./AutoDetectSourceLanguageResult.js\";\r\nexport { SourceLanguageConfig } from \"./SourceLanguageConfig.js\";\r\nexport { SpeakerRecognitionResult, SpeakerRecognitionResultType, SpeakerRecognitionCancellationDetails } from \"./SpeakerRecognitionResult.js\";\r\nexport { Conversation,\r\n    ConversationExpirationEventArgs,\r\n    ConversationInfo,\r\n    ConversationParticipantsChangedEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    ConversationTranslationEventArgs,\r\n    ConversationTranslationResult,\r\n    ConversationTranslator,\r\n    ConversationTranscriber,\r\n    ConversationTranscriptionResult,\r\n    Meeting,\r\n    MeetingInfo,\r\n    MeetingTranscriber,\r\n    IParticipant,\r\n    Participant,\r\n    ParticipantChangedReason,\r\n    User,\r\n    VoiceSignature\r\n    } from \"./Transcription/Exports.js\";\r\nexport { Synthesizer } from \"./Synthesizer.js\";\r\nexport { SpeechSynthesisOutputFormat } from \"./SpeechSynthesisOutputFormat.js\";\r\nexport { SpeechSynthesizer } from \"./SpeechSynthesizer.js\";\r\nexport { SynthesisResult } from \"./SynthesisResult.js\";\r\nexport { SpeechSynthesisResult } from \"./SpeechSynthesisResult.js\";\r\nexport { SpeechSynthesisEventArgs } from \"./SpeechSynthesisEventArgs.js\";\r\nexport { SpeechSynthesisWordBoundaryEventArgs } from \"./SpeechSynthesisWordBoundaryEventArgs.js\";\r\nexport { SpeechSynthesisBookmarkEventArgs } from \"./SpeechSynthesisBookmarkEventArgs.js\";\r\nexport { SpeechSynthesisVisemeEventArgs } from \"./SpeechSynthesisVisemeEventArgs.js\";\r\nexport { SpeechSynthesisBoundaryType } from \"./SpeechSynthesisBoundaryType.js\";\r\nexport { SynthesisVoicesResult } from \"./SynthesisVoicesResult.js\";\r\nexport { VoiceInfo } from \"./VoiceInfo.js\";\r\nexport { IPlayer } from \"./Audio/IPlayer.js\";\r\nexport { SpeakerAudioDestination } from \"./Audio/SpeakerAudioDestination.js\";\r\nexport { CancellationEventArgs } from \"./CancellationEventArgs.js\";\r\nexport { ConversationTranscriptionCanceledEventArgs } from \"./ConversationTranscriptionCanceledEventArgs.js\";\r\nexport { MeetingTranscriptionCanceledEventArgs } from \"./MeetingTranscriptionCanceledEventArgs.js\";\r\nexport { PronunciationAssessmentGradingSystem } from \"./PronunciationAssessmentGradingSystem.js\";\r\nexport { PronunciationAssessmentGranularity } from \"./PronunciationAssessmentGranularity.js\";\r\nexport { PronunciationAssessmentConfig } from \"./PronunciationAssessmentConfig.js\";\r\nexport { PronunciationAssessmentResult } from \"./PronunciationAssessmentResult.js\";\r\nexport { LanguageIdMode } from \"./LanguageIdMode.js\";\r\nexport { AvatarConfig } from \"./AvatarConfig.js\";\r\nexport { AvatarEventArgs } from \"./AvatarEventArgs.js\";\r\nexport { AvatarSynthesizer } from \"./AvatarSynthesizer.js\";\r\nexport { AvatarVideoFormat, Coordinate } from \"./AvatarVideoFormat.js\";\r\nexport { AvatarWebRTCConnectionResult } from \"./AvatarWebRTCConnectionResult.js\";\r\nexport { Diagnostics } from \"./Diagnostics.js\";\r\nexport { LogLevel } from \"./LogLevel.js\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { PathLike } from \"fs\";\r\nimport {\r\n    FileAudioSource,\r\n    MicAudioSource,\r\n    PcmRecorder,\r\n} from \"../../common.browser/Exports.js\";\r\nimport { ISpeechConfigAudioDevice } from \"../../common.speech/Exports.js\";\r\nimport {\r\n    AudioSourceEvent,\r\n    EventSource,\r\n    IAudioDestination,\r\n    IAudioSource,\r\n    IAudioStreamNode\r\n} from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    AudioInputStream,\r\n    AudioOutputStream,\r\n    AudioStreamFormat,\r\n    IPlayer,\r\n    PullAudioInputStreamCallback,\r\n    PullAudioOutputStream,\r\n    PushAudioOutputStream,\r\n    PushAudioOutputStreamCallback,\r\n    SpeakerAudioDestination\r\n} from \"../Exports.js\";\r\nimport { AudioFileWriter } from \"./AudioFileWriter.js\";\r\nimport { PullAudioInputStreamImpl, PushAudioInputStreamImpl } from \"./AudioInputStream.js\";\r\nimport { PullAudioOutputStreamImpl, PushAudioOutputStreamImpl } from \"./AudioOutputStream.js\";\r\nimport { AudioStreamFormatImpl } from \"./AudioStreamFormat.js\";\r\n\r\n/**\r\n * Represents audio input configuration used for specifying what type of input to use (microphone, file, stream).\r\n * @class AudioConfig\r\n * Updated in version 1.11.0\r\n */\r\nexport abstract class AudioConfig {\r\n    /**\r\n     * Creates an AudioConfig object representing the default microphone on the system.\r\n     * @member AudioConfig.fromDefaultMicrophoneInput\r\n     * @function\r\n     * @public\r\n     * @returns {AudioConfig} The audio input configuration being created.\r\n     */\r\n    public static fromDefaultMicrophoneInput(): AudioConfig {\r\n        const pcmRecorder = new PcmRecorder(true);\r\n        return new AudioConfigImpl(new MicAudioSource(pcmRecorder));\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing a microphone with the specified device ID.\r\n     * @member AudioConfig.fromMicrophoneInput\r\n     * @function\r\n     * @public\r\n     * @param {string | undefined} deviceId - Specifies the device ID of the microphone to be used.\r\n     * Default microphone is used the value is omitted.\r\n     * @returns {AudioConfig} The audio input configuration being created.\r\n     */\r\n    public static fromMicrophoneInput(deviceId?: string): AudioConfig {\r\n        const pcmRecorder = new PcmRecorder(true);\r\n        return new AudioConfigImpl(new MicAudioSource(pcmRecorder, deviceId));\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing the specified file.\r\n     * @member AudioConfig.fromWavFileInput\r\n     * @function\r\n     * @public\r\n     * @param {File} fileName - Specifies the audio input file. Currently, only WAV / PCM is supported.\r\n     * @returns {AudioConfig} The audio input configuration being created.\r\n     */\r\n    public static fromWavFileInput(file: File | Buffer, name: string = \"unnamedBuffer.wav\"): AudioConfig {\r\n        return new AudioConfigImpl(new FileAudioSource(file, name));\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing the specified stream.\r\n     * @member AudioConfig.fromStreamInput\r\n     * @function\r\n     * @public\r\n     * @param {AudioInputStream | PullAudioInputStreamCallback | MediaStream} audioStream - Specifies the custom audio input\r\n     * stream. Currently, only WAV / PCM is supported.\r\n     * @returns {AudioConfig} The audio input configuration being created.\r\n     */\r\n    public static fromStreamInput(audioStream: AudioInputStream | PullAudioInputStreamCallback\r\n        | MediaStream): AudioConfig {\r\n        if (audioStream instanceof PullAudioInputStreamCallback) {\r\n            return new AudioConfigImpl(new PullAudioInputStreamImpl(audioStream));\r\n        }\r\n\r\n        if (audioStream instanceof AudioInputStream) {\r\n            return new AudioConfigImpl(audioStream as PushAudioInputStreamImpl);\r\n        }\r\n        if (typeof MediaStream !== \"undefined\" && audioStream instanceof MediaStream) {\r\n            const pcmRecorder = new PcmRecorder(false);\r\n            return new AudioConfigImpl(new MicAudioSource(pcmRecorder, null, null, audioStream));\r\n        }\r\n\r\n        throw new Error(\"Not Supported Type\");\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing the default speaker.\r\n     * @member AudioConfig.fromDefaultSpeakerOutput\r\n     * @function\r\n     * @public\r\n     * @returns {AudioConfig} The audio output configuration being created.\r\n     * Added in version 1.11.0\r\n     */\r\n    public static fromDefaultSpeakerOutput(): AudioConfig {\r\n        return new AudioOutputConfigImpl(new SpeakerAudioDestination());\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing the custom IPlayer object.\r\n     * You can use the IPlayer object to control pause, resume, etc.\r\n     * @member AudioConfig.fromSpeakerOutput\r\n     * @function\r\n     * @public\r\n     * @param {IPlayer} player - the IPlayer object for playback.\r\n     * @returns {AudioConfig} The audio output configuration being created.\r\n     * Added in version 1.12.0\r\n     */\r\n    public static fromSpeakerOutput(player?: IPlayer): AudioConfig {\r\n        if (player === undefined) {\r\n            return AudioConfig.fromDefaultSpeakerOutput();\r\n        }\r\n        if (player instanceof SpeakerAudioDestination) {\r\n            return new AudioOutputConfigImpl(player);\r\n        }\r\n\r\n        throw new Error(\"Not Supported Type\");\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing a specified output audio file\r\n     * @member AudioConfig.fromAudioFileOutput\r\n     * @function\r\n     * @public\r\n     * @param {PathLike} filename - the filename of the output audio file\r\n     * @returns {AudioConfig} The audio output configuration being created.\r\n     * Added in version 1.11.0\r\n     */\r\n    public static fromAudioFileOutput(filename: PathLike): AudioConfig {\r\n        return new AudioOutputConfigImpl(new AudioFileWriter(filename));\r\n    }\r\n\r\n    /**\r\n     * Creates an AudioConfig object representing a specified audio output stream\r\n     * @member AudioConfig.fromStreamOutput\r\n     * @function\r\n     * @public\r\n     * @param {AudioOutputStream | PushAudioOutputStreamCallback} audioStream - Specifies the custom audio output\r\n     * stream.\r\n     * @returns {AudioConfig} The audio output configuration being created.\r\n     * Added in version 1.11.0\r\n     */\r\n    public static fromStreamOutput(audioStream: AudioOutputStream | PushAudioOutputStreamCallback): AudioConfig {\r\n        if (audioStream instanceof PushAudioOutputStreamCallback) {\r\n            return new AudioOutputConfigImpl(new PushAudioOutputStreamImpl(audioStream));\r\n        }\r\n\r\n        if (audioStream instanceof PushAudioOutputStream) {\r\n            return new AudioOutputConfigImpl(audioStream as PushAudioOutputStreamImpl);\r\n        }\r\n\r\n        if (audioStream instanceof PullAudioOutputStream) {\r\n            return new AudioOutputConfigImpl(audioStream as PullAudioOutputStreamImpl);\r\n        }\r\n\r\n        throw new Error(\"Not Supported Type\");\r\n    }\r\n\r\n    /**\r\n     * Explicitly frees any external resource attached to the object\r\n     * @member AudioConfig.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n\r\n    /**\r\n     * Sets an arbitrary property.\r\n     * @member SpeechConfig.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} name - The name of the property to set.\r\n     * @param {string} value - The new value of the property.\r\n     */\r\n    public abstract setProperty(name: string, value: string): void;\r\n\r\n    /**\r\n     * Returns the current value of an arbitrary property.\r\n     * @member SpeechConfig.prototype.getProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} name - The name of the property to query.\r\n     * @param {string} def - The value to return in case the property is not known.\r\n     * @returns {string} The current value, or provided default, of the given property.\r\n     */\r\n    public abstract getProperty(name: string, def?: string): string;\r\n\r\n}\r\n\r\n/**\r\n * Represents audio input stream used for custom audio input configurations.\r\n * @private\r\n * @class AudioConfigImpl\r\n */\r\nexport class AudioConfigImpl extends AudioConfig implements IAudioSource {\r\n    private privSource: IAudioSource;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {IAudioSource} source - An audio source.\r\n     */\r\n    public constructor(source: IAudioSource) {\r\n        super();\r\n        this.privSource = source;\r\n    }\r\n\r\n    /**\r\n     * Format information for the audio\r\n     */\r\n    public get format(): Promise<AudioStreamFormatImpl> {\r\n        return this.privSource.format;\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, err?: (error: string) => void): void {\r\n        this.privSource.turnOff().then((): void => {\r\n            if (!!cb) {\r\n                cb();\r\n            }\r\n        }, (error: string): void => {\r\n            if (!!err) {\r\n                err(error);\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.id\r\n     * @function\r\n     * @public\r\n     */\r\n    public id(): string {\r\n        return this.privSource.id();\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.turnOn\r\n     * @function\r\n     * @public\r\n     * @returns {Promise<void>} A promise.\r\n     */\r\n    public turnOn(): Promise<void> {\r\n        return this.privSource.turnOn();\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.attach\r\n     * @function\r\n     * @public\r\n     * @param {string} audioNodeId - The audio node id.\r\n     * @returns {Promise<IAudioStreamNode>} A promise.\r\n     */\r\n    public attach(audioNodeId: string): Promise<IAudioStreamNode> {\r\n        return this.privSource.attach(audioNodeId);\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.detach\r\n     * @function\r\n     * @public\r\n     * @param {string} audioNodeId - The audio node id.\r\n     */\r\n    public detach(audioNodeId: string): void {\r\n        return this.privSource.detach(audioNodeId);\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.turnOff\r\n     * @function\r\n     * @public\r\n     * @returns {Promise<void>} A promise.\r\n     */\r\n    public turnOff(): Promise<void> {\r\n        return this.privSource.turnOff();\r\n    }\r\n\r\n    /**\r\n     * @member AudioConfigImpl.prototype.events\r\n     * @function\r\n     * @public\r\n     * @returns {EventSource<AudioSourceEvent>} An event source for audio events.\r\n     */\r\n    public get events(): EventSource<AudioSourceEvent> {\r\n        return this.privSource.events;\r\n    }\r\n\r\n    public setProperty(name: string, value: string): void {\r\n        Contracts.throwIfNull(value, \"value\");\r\n\r\n        if (undefined !== this.privSource.setProperty) {\r\n            this.privSource.setProperty(name, value);\r\n        } else {\r\n            throw new Error(\"This AudioConfig instance does not support setting properties.\");\r\n        }\r\n\r\n    }\r\n\r\n    public getProperty(name: string, def?: string): string {\r\n        if (undefined !== this.privSource.getProperty) {\r\n            return this.privSource.getProperty(name, def);\r\n        } else {\r\n            throw new Error(\"This AudioConfig instance does not support getting properties.\");\r\n        }\r\n\r\n        return def;\r\n    }\r\n\r\n    public get deviceInfo(): Promise<ISpeechConfigAudioDevice> {\r\n        return this.privSource.deviceInfo;\r\n    }\r\n}\r\n\r\nexport class AudioOutputConfigImpl extends AudioConfig implements IAudioDestination {\r\n    private privDestination: IAudioDestination;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {IAudioDestination} destination - An audio destination.\r\n     */\r\n    public constructor(destination: IAudioDestination) {\r\n        super();\r\n        this.privDestination = destination;\r\n    }\r\n\r\n    public set format(format: AudioStreamFormat) {\r\n        this.privDestination.format = format;\r\n    }\r\n\r\n    public write(buffer: ArrayBuffer): void {\r\n        this.privDestination.write(buffer);\r\n    }\r\n\r\n    public close(): void {\r\n        this.privDestination.close();\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privDestination.id();\r\n    }\r\n\r\n    public setProperty(): void {\r\n        throw new Error(\"This AudioConfig instance does not support setting properties.\");\r\n    }\r\n\r\n    public getProperty(): string {\r\n        throw new Error(\"This AudioConfig instance does not support getting properties.\");\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport * as fs from \"fs\";\r\nimport { IAudioDestination } from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport { AudioStreamFormat } from \"../Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"./AudioOutputFormat.js\";\r\n\r\nexport class AudioFileWriter implements IAudioDestination {\r\n    private privAudioFormat: AudioOutputFormatImpl;\r\n    private privFd: number;\r\n    private privId: string;\r\n    private privWriteStream: fs.WriteStream;\r\n\r\n    public constructor(filename: fs.PathLike) {\r\n        Contracts.throwIfNullOrUndefined(fs.openSync, \"\\nFile System access not available, please use Push or PullAudioOutputStream\");\r\n        this.privFd = fs.openSync(filename, \"w\");\r\n    }\r\n\r\n    public set format(format: AudioStreamFormat) {\r\n        Contracts.throwIfNotUndefined(this.privAudioFormat, \"format is already set\");\r\n        this.privAudioFormat = format as AudioOutputFormatImpl;\r\n        let headerOffset: number = 0;\r\n        if (this.privAudioFormat.hasHeader) {\r\n            headerOffset = this.privAudioFormat.header.byteLength;\r\n        }\r\n        if (this.privFd !== undefined) {\r\n            this.privWriteStream = fs.createWriteStream(\"\", {fd: this.privFd, start: headerOffset, autoClose: false});\r\n        }\r\n    }\r\n\r\n    public write(buffer: ArrayBuffer): void {\r\n        Contracts.throwIfNullOrUndefined(this.privAudioFormat, \"must set format before writing.\");\r\n        if (this.privWriteStream !== undefined) {\r\n            this.privWriteStream.write(new Uint8Array(buffer.slice(0)));\r\n        }\r\n    }\r\n\r\n    public close(): void {\r\n        if (this.privFd !== undefined) {\r\n            this.privWriteStream.on(\"finish\", (): void => {\r\n                if (this.privAudioFormat.hasHeader) {\r\n                    this.privAudioFormat.updateHeader(this.privWriteStream.bytesWritten);\r\n                    fs.writeSync(this.privFd,\r\n                        new Int8Array(this.privAudioFormat.header),\r\n                        0,\r\n                        this.privAudioFormat.header.byteLength,\r\n                        0);\r\n                }\r\n                fs.closeSync(this.privFd);\r\n                this.privFd = undefined;\r\n            });\r\n            this.privWriteStream.end();\r\n        }\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    connectivity,\r\n    ISpeechConfigAudioDevice,\r\n    type,\r\n} from \"../../common.speech/Exports.js\";\r\nimport {\r\n    AudioSourceEvent,\r\n    AudioSourceInitializingEvent,\r\n    AudioSourceReadyEvent,\r\n    AudioStreamNodeAttachedEvent,\r\n    AudioStreamNodeAttachingEvent,\r\n    AudioStreamNodeDetachedEvent,\r\n    ChunkedArrayBufferStream,\r\n    Events,\r\n    EventSource,\r\n    IAudioSource,\r\n    IAudioStreamNode,\r\n    IStreamChunk,\r\n    Stream,\r\n} from \"../../common/Exports.js\";\r\nimport { createNoDashGuid } from \"../../common/Guid.js\";\r\nimport { AudioStreamFormat, PullAudioInputStreamCallback } from \"../Exports.js\";\r\nimport { AudioStreamFormatImpl } from \"./AudioStreamFormat.js\";\r\n\r\n/**\r\n * Represents audio input stream used for custom audio input configurations.\r\n * @class AudioInputStream\r\n */\r\nexport abstract class AudioInputStream {\r\n\r\n    /**\r\n     * Creates and initializes an instance.\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Creates a memory backed PushAudioInputStream with the specified audio format.\r\n     * @member AudioInputStream.createPushStream\r\n     * @function\r\n     * @public\r\n     * @param {AudioStreamFormat} format - The audio data format in which audio will be\r\n     * written to the push audio stream's write() method (Required if format is not 16 kHz 16bit mono PCM).\r\n     * @returns {PushAudioInputStream} The audio input stream being created.\r\n     */\r\n    public static createPushStream(format?: AudioStreamFormat): PushAudioInputStream {\r\n        return PushAudioInputStream.create(format);\r\n    }\r\n\r\n    /**\r\n     * Creates a PullAudioInputStream that delegates to the specified callback interface for read()\r\n     * and close() methods.\r\n     * @member AudioInputStream.createPullStream\r\n     * @function\r\n     * @public\r\n     * @param {PullAudioInputStreamCallback} callback - The custom audio input object, derived from\r\n     * PullAudioInputStreamCallback\r\n     * @param {AudioStreamFormat} format - The audio data format in which audio will be returned from\r\n     * the callback's read() method (Required if format is not 16 kHz 16bit mono PCM).\r\n     * @returns {PullAudioInputStream} The audio input stream being created.\r\n     */\r\n    public static createPullStream(callback: PullAudioInputStreamCallback, format?: AudioStreamFormat): PullAudioInputStream {\r\n        return PullAudioInputStream.create(callback, format);\r\n        // throw new Error(\"Oops\");\r\n    }\r\n\r\n    /**\r\n     * Explicitly frees any external resource attached to the object\r\n     * @member AudioInputStream.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n\r\n/**\r\n * Represents memory backed push audio input stream used for custom audio input configurations.\r\n * @class PushAudioInputStream\r\n */\r\nexport abstract class PushAudioInputStream extends AudioInputStream {\r\n\r\n    /**\r\n     * Creates a memory backed PushAudioInputStream with the specified audio format.\r\n     * @member PushAudioInputStream.create\r\n     * @function\r\n     * @public\r\n     * @param {AudioStreamFormat} format - The audio data format in which audio will be written to the\r\n     * push audio stream's write() method (Required if format is not 16 kHz 16bit mono PCM).\r\n     * @returns {PushAudioInputStream} The push audio input stream being created.\r\n     */\r\n    public static create(format?: AudioStreamFormat): PushAudioInputStream {\r\n        return new PushAudioInputStreamImpl(format);\r\n    }\r\n\r\n    /**\r\n     * Writes the audio data specified by making an internal copy of the data.\r\n     * @member PushAudioInputStream.prototype.write\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - The audio buffer of which this function will make a copy.\r\n     */\r\n    public abstract write(dataBuffer: ArrayBuffer): void;\r\n\r\n    /**\r\n     * Closes the stream.\r\n     * @member PushAudioInputStream.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n\r\n/**\r\n * Represents memory backed push audio input stream used for custom audio input configurations.\r\n * @private\r\n * @class PushAudioInputStreamImpl\r\n */\r\nexport class PushAudioInputStreamImpl extends PushAudioInputStream implements IAudioSource {\r\n\r\n    private privFormat: AudioStreamFormatImpl;\r\n    private privId: string;\r\n    private privEvents: EventSource<AudioSourceEvent>;\r\n    private privStream: Stream<ArrayBuffer>;\r\n\r\n    /**\r\n     * Creates and initalizes an instance with the given values.\r\n     * @constructor\r\n     * @param {AudioStreamFormat} format - The audio stream format.\r\n     */\r\n    public constructor(format?: AudioStreamFormat) {\r\n        super();\r\n        if (format === undefined) {\r\n            this.privFormat = AudioStreamFormatImpl.getDefaultInputFormat();\r\n        } else {\r\n            this.privFormat = format as AudioStreamFormatImpl;\r\n        }\r\n        this.privEvents = new EventSource<AudioSourceEvent>();\r\n        this.privId = createNoDashGuid();\r\n        this.privStream = new ChunkedArrayBufferStream(this.privFormat.avgBytesPerSec / 10);\r\n    }\r\n\r\n    /**\r\n     * Format information for the audio\r\n     */\r\n    public get format(): Promise<AudioStreamFormatImpl> {\r\n        return Promise.resolve(this.privFormat);\r\n    }\r\n\r\n    /**\r\n     * Writes the audio data specified by making an internal copy of the data.\r\n     * @member PushAudioInputStreamImpl.prototype.write\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - The audio buffer of which this function will make a copy.\r\n     */\r\n    public write(dataBuffer: ArrayBuffer): void {\r\n        this.privStream.writeStreamChunk({\r\n            buffer: dataBuffer,\r\n            isEnd: false,\r\n            timeReceived: Date.now()\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Closes the stream.\r\n     * @member PushAudioInputStreamImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        this.privStream.close();\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public turnOn(): Promise<void> {\r\n        this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\r\n        this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n        return;\r\n    }\r\n\r\n    public async attach(audioNodeId: string): Promise<IAudioStreamNode> {\r\n        this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\r\n\r\n        await this.turnOn();\r\n        const stream = this.privStream;\r\n        this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\r\n        return {\r\n            detach: async (): Promise<void> => {\r\n                this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n                return this.turnOff();\r\n            },\r\n            id: (): string => audioNodeId,\r\n            read: (): Promise<IStreamChunk<ArrayBuffer>> => stream.read(),\r\n        };\r\n    }\r\n\r\n    public detach(audioNodeId: string): void {\r\n        this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n    }\r\n\r\n    public turnOff(): Promise<void> {\r\n        return;\r\n    }\r\n\r\n    public get events(): EventSource<AudioSourceEvent> {\r\n        return this.privEvents;\r\n    }\r\n\r\n    public get deviceInfo(): Promise<ISpeechConfigAudioDevice> {\r\n        return Promise.resolve({\r\n            bitspersample: this.privFormat.bitsPerSample,\r\n            channelcount: this.privFormat.channels,\r\n            connectivity: connectivity.Unknown,\r\n            manufacturer: \"Speech SDK\",\r\n            model: \"PushStream\",\r\n            samplerate: this.privFormat.samplesPerSec,\r\n            type: type.Stream,\r\n        });\r\n    }\r\n\r\n    private onEvent(event: AudioSourceEvent): void {\r\n        this.privEvents.onEvent(event);\r\n        Events.instance.onEvent(event);\r\n    }\r\n\r\n    private toBuffer(arrayBuffer: ArrayBuffer): Buffer {\r\n        const buf: Buffer = Buffer.alloc(arrayBuffer.byteLength);\r\n        const view: Uint8Array = new Uint8Array(arrayBuffer);\r\n        for (let i = 0; i < buf.length; ++i) {\r\n            buf[i] = view[i];\r\n        }\r\n        return buf;\r\n    }\r\n}\r\n\r\n/*\r\n * Represents audio input stream used for custom audio input configurations.\r\n * @class PullAudioInputStream\r\n */\r\nexport abstract class PullAudioInputStream extends AudioInputStream {\r\n    /**\r\n     * Creates and initializes and instance.\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n super();\r\n}\r\n\r\n    /**\r\n     * Creates a PullAudioInputStream that delegates to the specified callback interface for\r\n     * read() and close() methods, using the default format (16 kHz 16bit mono PCM).\r\n     * @member PullAudioInputStream.create\r\n     * @function\r\n     * @public\r\n     * @param {PullAudioInputStreamCallback} callback - The custom audio input object,\r\n     * derived from PullAudioInputStreamCustomCallback\r\n     * @param {AudioStreamFormat} format - The audio data format in which audio will be\r\n     * returned from the callback's read() method (Required if format is not 16 kHz 16bit mono PCM).\r\n     * @returns {PullAudioInputStream} The push audio input stream being created.\r\n     */\r\n    public static create(callback: PullAudioInputStreamCallback, format?: AudioStreamFormat): PullAudioInputStream {\r\n        return new PullAudioInputStreamImpl(callback, format as AudioStreamFormatImpl);\r\n    }\r\n\r\n    /**\r\n     * Explicitly frees any external resource attached to the object\r\n     * @member PullAudioInputStream.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n\r\n}\r\n\r\n/**\r\n * Represents audio input stream used for custom audio input configurations.\r\n * @private\r\n * @class PullAudioInputStreamImpl\r\n */\r\nexport class PullAudioInputStreamImpl extends PullAudioInputStream implements IAudioSource {\r\n\r\n    private privCallback: PullAudioInputStreamCallback;\r\n    private privFormat: AudioStreamFormatImpl;\r\n    private privId: string;\r\n    private privEvents: EventSource<AudioSourceEvent>;\r\n    private privIsClosed: boolean;\r\n    private privBufferSize: number;\r\n\r\n    /**\r\n     * Creates a PullAudioInputStream that delegates to the specified callback interface for\r\n     * read() and close() methods, using the default format (16 kHz 16bit mono PCM).\r\n     * @constructor\r\n     * @param {PullAudioInputStreamCallback} callback - The custom audio input object,\r\n     * derived from PullAudioInputStreamCustomCallback\r\n     * @param {AudioStreamFormat} format - The audio data format in which audio will be\r\n     * returned from the callback's read() method (Required if format is not 16 kHz 16bit mono PCM).\r\n     */\r\n    public constructor(callback: PullAudioInputStreamCallback, format?: AudioStreamFormatImpl) {\r\n        super();\r\n        if (undefined === format) {\r\n            this.privFormat = AudioStreamFormat.getDefaultInputFormat() as AudioStreamFormatImpl;\r\n        } else {\r\n            this.privFormat = format;\r\n        }\r\n        this.privEvents = new EventSource<AudioSourceEvent>();\r\n        this.privId = createNoDashGuid();\r\n        this.privCallback = callback;\r\n        this.privIsClosed = false;\r\n        this.privBufferSize = this.privFormat.avgBytesPerSec / 10;\r\n    }\r\n\r\n    /**\r\n     * Format information for the audio\r\n     */\r\n    public get format(): Promise<AudioStreamFormatImpl> {\r\n        return Promise.resolve(this.privFormat);\r\n    }\r\n\r\n    /**\r\n     * Closes the stream.\r\n     * @member PullAudioInputStreamImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        this.privIsClosed = true;\r\n        this.privCallback.close();\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public turnOn(): Promise<void> {\r\n        this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\r\n        this.onEvent(new AudioSourceReadyEvent(this.privId));\r\n        return;\r\n    }\r\n\r\n    public async attach(audioNodeId: string): Promise<IAudioStreamNode> {\r\n        this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\r\n\r\n        await this.turnOn();\r\n        this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\r\n        return {\r\n            detach: (): Promise<void> => {\r\n                this.privCallback.close();\r\n                this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n                return this.turnOff();\r\n            },\r\n            id: (): string => audioNodeId,\r\n            read: (): Promise<IStreamChunk<ArrayBuffer>> => {\r\n                let totalBytes: number = 0;\r\n                let transmitBuff: ArrayBuffer;\r\n                // Until we have the minimum number of bytes to send in a transmission, keep asking for more.\r\n                while (totalBytes < this.privBufferSize) {\r\n                    // Sizing the read buffer to the delta between the perfect size and what's left means we won't ever get too much\r\n                    // data back.\r\n                    const readBuff: ArrayBuffer = new ArrayBuffer(this.privBufferSize - totalBytes);\r\n                    const pulledBytes: number = this.privCallback.read(readBuff);\r\n                    // If there is no return buffer yet defined, set the return buffer to the that was just populated.\r\n                    // This was, if we have enough data there's no copy penalty, but if we don't we have a buffer that's the\r\n                    // preferred size allocated.\r\n                    if (undefined === transmitBuff) {\r\n                        transmitBuff = readBuff;\r\n                    } else {\r\n                        // Not the first bite at the apple, so fill the return buffer with the data we got back.\r\n                        const intView: Int8Array = new Int8Array(transmitBuff);\r\n                        intView.set(new Int8Array(readBuff), totalBytes);\r\n                    }\r\n                    // If there are no bytes to read, just break out and be done.\r\n                    if (0 === pulledBytes) {\r\n                        break;\r\n                    }\r\n                    totalBytes += pulledBytes;\r\n                }\r\n                return Promise.resolve<IStreamChunk<ArrayBuffer>>({\r\n                    buffer: transmitBuff.slice(0, totalBytes),\r\n                    isEnd: this.privIsClosed || totalBytes === 0,\r\n                    timeReceived: Date.now(),\r\n                });\r\n            },\r\n        };\r\n    }\r\n\r\n    public detach(audioNodeId: string): void {\r\n        this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\r\n    }\r\n\r\n    public turnOff(): Promise<void> {\r\n        return;\r\n    }\r\n\r\n    public get events(): EventSource<AudioSourceEvent> {\r\n        return this.privEvents;\r\n    }\r\n\r\n    public get deviceInfo(): Promise<ISpeechConfigAudioDevice> {\r\n        return Promise.resolve({\r\n            bitspersample: this.privFormat.bitsPerSample,\r\n            channelcount: this.privFormat.channels,\r\n            connectivity: connectivity.Unknown,\r\n            manufacturer: \"Speech SDK\",\r\n            model: \"PullStream\",\r\n            samplerate: this.privFormat.samplesPerSec,\r\n            type: type.Stream,\r\n        });\r\n    }\r\n\r\n    private onEvent(event: AudioSourceEvent): void {\r\n        this.privEvents.onEvent(event);\r\n        Events.instance.onEvent(event);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    createNoDashGuid,\r\n    IAudioDestination,\r\n    IStreamChunk,\r\n    Stream,\r\n} from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    AudioStreamFormat,\r\n    PushAudioOutputStreamCallback\r\n} from \"../Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"./AudioOutputFormat.js\";\r\n\r\n/**\r\n * Represents audio output stream used for custom audio output configurations.\r\n * @class AudioOutputStream\r\n */\r\nexport abstract class AudioOutputStream {\r\n\r\n    /**\r\n     * Creates and initializes an instance.\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Sets the format of the AudioOutputStream\r\n     * Note: the format is set by the synthesizer before writing. Do not set it before passing it to AudioConfig\r\n     * @member AudioOutputStream.prototype.format\r\n     */\r\n    public abstract set format(format: AudioStreamFormat);\r\n\r\n    /**\r\n     * Creates a memory backed PullAudioOutputStream with the specified audio format.\r\n     * @member AudioOutputStream.createPullStream\r\n     * @function\r\n     * @public\r\n     * @returns {PullAudioOutputStream} The audio output stream being created.\r\n     */\r\n    public static createPullStream(): PullAudioOutputStream {\r\n        return PullAudioOutputStream.create();\r\n    }\r\n\r\n    /**\r\n     * Explicitly frees any external resource attached to the object\r\n     * @member AudioOutputStream.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n\r\n/**\r\n * Represents memory backed push audio output stream used for custom audio output configurations.\r\n * @class PullAudioOutputStream\r\n */\r\nexport abstract class PullAudioOutputStream extends AudioOutputStream {\r\n\r\n    /**\r\n     * Creates a memory backed PullAudioOutputStream with the specified audio format.\r\n     * @member PullAudioOutputStream.create\r\n     * @function\r\n     * @public\r\n     * @returns {PullAudioOutputStream} The push audio output stream being created.\r\n     */\r\n    public static create(): PullAudioOutputStream {\r\n        return new PullAudioOutputStreamImpl();\r\n    }\r\n\r\n    /**\r\n     * Reads audio data from the internal buffer.\r\n     * @member PullAudioOutputStream.prototype.read\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - An ArrayBuffer to store the read data.\r\n     * @returns {Promise<number>} Audio buffer length has been read.\r\n     */\r\n    public abstract read(dataBuffer: ArrayBuffer): Promise<number>;\r\n\r\n    /**\r\n     * Closes the stream.\r\n     * @member PullAudioOutputStream.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n\r\n/**\r\n * Represents memory backed push audio output stream used for custom audio output configurations.\r\n * @private\r\n * @class PullAudioOutputStreamImpl\r\n */\r\nexport class PullAudioOutputStreamImpl extends PullAudioOutputStream implements IAudioDestination {\r\n    private privFormat: AudioOutputFormatImpl;\r\n    private privId: string;\r\n    private privStream: Stream<ArrayBuffer>;\r\n    private privLastChunkView: Int8Array;\r\n\r\n    /**\r\n     * Creates and initializes an instance with the given values.\r\n     * @constructor\r\n     */\r\n    public constructor() {\r\n        super();\r\n        this.privId = createNoDashGuid();\r\n        this.privStream = new Stream<ArrayBuffer>();\r\n    }\r\n\r\n    /**\r\n     * Sets the format information to the stream. For internal use only.\r\n     * @param {AudioStreamFormat} format - the format to be set.\r\n     */\r\n    public set format(format: AudioStreamFormat) {\r\n        if (format === undefined || format === null) {\r\n            this.privFormat = AudioOutputFormatImpl.getDefaultOutputFormat();\r\n        }\r\n        this.privFormat = format as AudioOutputFormatImpl;\r\n    }\r\n\r\n    /**\r\n     * Format information for the audio\r\n     */\r\n    public get format(): AudioStreamFormat {\r\n        return this.privFormat;\r\n    }\r\n\r\n    /**\r\n     * Checks if the stream is closed\r\n     * @member PullAudioOutputStreamImpl.prototype.isClosed\r\n     * @property\r\n     * @public\r\n     */\r\n    public get isClosed(): boolean {\r\n        return this.privStream.isClosed;\r\n    }\r\n\r\n    /**\r\n     * Gets the id of the stream\r\n     * @member PullAudioOutputStreamImpl.prototype.id\r\n     * @property\r\n     * @public\r\n     */\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    /**\r\n     * Reads audio data from the internal buffer.\r\n     * @member PullAudioOutputStreamImpl.prototype.read\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - An ArrayBuffer to store the read data.\r\n     * @returns {Promise<number>} - Audio buffer length has been read.\r\n     */\r\n    public async read(dataBuffer: ArrayBuffer): Promise<number> {\r\n        const intView: Int8Array = new Int8Array(dataBuffer);\r\n        let totalBytes: number = 0;\r\n\r\n        if (this.privLastChunkView !== undefined) {\r\n            if (this.privLastChunkView.length > dataBuffer.byteLength) {\r\n                intView.set(this.privLastChunkView.slice(0, dataBuffer.byteLength));\r\n                this.privLastChunkView = this.privLastChunkView.slice(dataBuffer.byteLength);\r\n                return Promise.resolve(dataBuffer.byteLength);\r\n            }\r\n            intView.set(this.privLastChunkView);\r\n            totalBytes = this.privLastChunkView.length;\r\n            this.privLastChunkView = undefined;\r\n        }\r\n\r\n        // Until we have the minimum number of bytes to send in a transmission, keep asking for more.\r\n        while (totalBytes < dataBuffer.byteLength && !this.privStream.isReadEnded) {\r\n            const chunk: IStreamChunk<ArrayBuffer> = await this.privStream.read();\r\n            if (chunk !== undefined && !chunk.isEnd) {\r\n                let tmpBuffer: ArrayBuffer;\r\n                if (chunk.buffer.byteLength > dataBuffer.byteLength - totalBytes) {\r\n                    tmpBuffer = chunk.buffer.slice(0, dataBuffer.byteLength - totalBytes);\r\n                    this.privLastChunkView = new Int8Array(chunk.buffer.slice(dataBuffer.byteLength - totalBytes));\r\n                } else {\r\n                    tmpBuffer = chunk.buffer;\r\n                }\r\n                intView.set(new Int8Array(tmpBuffer), totalBytes);\r\n                totalBytes += tmpBuffer.byteLength;\r\n            } else {\r\n                this.privStream.readEnded();\r\n            }\r\n        }\r\n        return totalBytes;\r\n    }\r\n\r\n    /**\r\n     * Writes the audio data specified by making an internal copy of the data.\r\n     * @member PullAudioOutputStreamImpl.prototype.write\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - The audio buffer of which this function will make a copy.\r\n     */\r\n    public write(dataBuffer: ArrayBuffer): void {\r\n        Contracts.throwIfNullOrUndefined(this.privStream, \"must set format before writing\");\r\n        this.privStream.writeStreamChunk({\r\n            buffer: dataBuffer,\r\n            isEnd: false,\r\n            timeReceived: Date.now()\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Closes the stream.\r\n     * @member PullAudioOutputStreamImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        this.privStream.close();\r\n    }\r\n}\r\n\r\n/*\r\n * Represents audio output stream used for custom audio output configurations.\r\n * @class PushAudioOutputStream\r\n */\r\nexport abstract class PushAudioOutputStream extends AudioOutputStream {\r\n    /**\r\n     * Creates and initializes and instance.\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n        super();\r\n    }\r\n\r\n    /**\r\n     * Creates a PushAudioOutputStream that delegates to the specified callback interface for\r\n     * write() and close() methods.\r\n     * @member PushAudioOutputStream.create\r\n     * @function\r\n     * @public\r\n     * @param {PushAudioOutputStreamCallback} callback - The custom audio output object,\r\n     * derived from PushAudioOutputStreamCallback\r\n     * @returns {PushAudioOutputStream} The push audio output stream being created.\r\n     */\r\n    public static create(callback: PushAudioOutputStreamCallback): PushAudioOutputStream {\r\n        return new PushAudioOutputStreamImpl(callback);\r\n    }\r\n\r\n    /**\r\n     * Explicitly frees any external resource attached to the object\r\n     * @member PushAudioOutputStream.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n\r\n}\r\n\r\n/**\r\n * Represents audio output stream used for custom audio output configurations.\r\n * @private\r\n * @class PushAudioOutputStreamImpl\r\n */\r\nexport class PushAudioOutputStreamImpl extends PushAudioOutputStream implements IAudioDestination {\r\n    private readonly privId: string;\r\n    private privCallback: PushAudioOutputStreamCallback;\r\n\r\n    /**\r\n     * Creates a PushAudioOutputStream that delegates to the specified callback interface for\r\n     * read() and close() methods.\r\n     * @constructor\r\n     * @param {PushAudioOutputStreamCallback} callback - The custom audio output object,\r\n     * derived from PushAudioOutputStreamCallback\r\n     */\r\n    public constructor(callback: PushAudioOutputStreamCallback) {\r\n        super();\r\n        this.privId = createNoDashGuid();\r\n        this.privCallback = callback;\r\n    }\r\n\r\n    // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n    public set format(format: AudioStreamFormat) { }\r\n\r\n    public write(buffer: ArrayBuffer): void {\r\n        if (!!this.privCallback.write) {\r\n            this.privCallback.write(buffer);\r\n        }\r\n    }\r\n\r\n    public close(): void {\r\n        if (!!this.privCallback.close) {\r\n            this.privCallback.close();\r\n        }\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { INumberDictionary } from \"../../common/Exports.js\";\r\nimport { SpeechSynthesisOutputFormat } from \"../SpeechSynthesisOutputFormat.js\";\r\nimport { AudioFormatTag, AudioStreamFormatImpl } from \"./AudioStreamFormat.js\";\r\n\r\n/**\r\n * @private\r\n * @class AudioOutputFormatImpl\r\n * Updated in version 1.17.0\r\n */\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class AudioOutputFormatImpl extends AudioStreamFormatImpl {\r\n    public static SpeechSynthesisOutputFormatToString: INumberDictionary<string> = {\r\n        [SpeechSynthesisOutputFormat.Raw8Khz8BitMonoMULaw]: \"raw-8khz-8bit-mono-mulaw\",\r\n        [SpeechSynthesisOutputFormat.Riff16Khz16KbpsMonoSiren]: \"riff-16khz-16kbps-mono-siren\",\r\n        [SpeechSynthesisOutputFormat.Audio16Khz16KbpsMonoSiren]: \"audio-16khz-16kbps-mono-siren\",\r\n        [SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3]: \"audio-16khz-32kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Audio16Khz128KBitRateMonoMp3]: \"audio-16khz-128kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Audio16Khz64KBitRateMonoMp3]: \"audio-16khz-64kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3]: \"audio-24khz-48kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3]: \"audio-24khz-96kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Audio24Khz160KBitRateMonoMp3]: \"audio-24khz-160kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Raw16Khz16BitMonoTrueSilk]: \"raw-16khz-16bit-mono-truesilk\",\r\n        [SpeechSynthesisOutputFormat.Riff16Khz16BitMonoPcm]: \"riff-16khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Riff8Khz16BitMonoPcm]: \"riff-8khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm]: \"riff-24khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Riff8Khz8BitMonoMULaw]: \"riff-8khz-8bit-mono-mulaw\",\r\n        [SpeechSynthesisOutputFormat.Raw16Khz16BitMonoPcm]: \"raw-16khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Raw24Khz16BitMonoPcm]: \"raw-24khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Raw8Khz16BitMonoPcm]: \"raw-8khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Ogg16Khz16BitMonoOpus]: \"ogg-16khz-16bit-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Ogg24Khz16BitMonoOpus]: \"ogg-24khz-16bit-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Raw48Khz16BitMonoPcm]: \"raw-48khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Riff48Khz16BitMonoPcm]: \"riff-48khz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Audio48Khz96KBitRateMonoMp3]: \"audio-48khz-96kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Audio48Khz192KBitRateMonoMp3]: \"audio-48khz-192kbitrate-mono-mp3\",\r\n        [SpeechSynthesisOutputFormat.Ogg48Khz16BitMonoOpus]: \"ogg-48khz-16bit-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Webm16Khz16BitMonoOpus]: \"webm-16khz-16bit-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Webm24Khz16BitMonoOpus]: \"webm-24khz-16bit-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Webm24Khz16Bit24KbpsMonoOpus]: \"webm-24khz-16bit-24kbps-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Raw24Khz16BitMonoTrueSilk]: \"raw-24khz-16bit-mono-truesilk\",\r\n        [SpeechSynthesisOutputFormat.Raw8Khz8BitMonoALaw]: \"raw-8khz-8bit-mono-alaw\",\r\n        [SpeechSynthesisOutputFormat.Riff8Khz8BitMonoALaw]: \"riff-8khz-8bit-mono-alaw\",\r\n        [SpeechSynthesisOutputFormat.Audio16Khz16Bit32KbpsMonoOpus]: \"audio-16khz-16bit-32kbps-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Audio24Khz16Bit48KbpsMonoOpus]: \"audio-24khz-16bit-48kbps-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Audio24Khz16Bit24KbpsMonoOpus]: \"audio-24khz-16bit-24kbps-mono-opus\",\r\n        [SpeechSynthesisOutputFormat.Raw22050Hz16BitMonoPcm]: \"raw-22050hz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Riff22050Hz16BitMonoPcm]: \"riff-22050hz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Raw44100Hz16BitMonoPcm]: \"raw-44100hz-16bit-mono-pcm\",\r\n        [SpeechSynthesisOutputFormat.Riff44100Hz16BitMonoPcm]: \"riff-44100hz-16bit-mono-pcm\",\r\n    };\r\n    private priAudioFormatString: string;\r\n    /**\r\n     * audio format string for synthesis request, which may differ from priAudioFormatString.\r\n     * e.g. for riff format, we will request raw format and add a header in SDK side.\r\n     */\r\n    private readonly priRequestAudioFormatString: string;\r\n    private readonly priHasHeader: boolean;\r\n\r\n    /**\r\n     * Creates an instance with the given values.\r\n     * @constructor\r\n     * @param formatTag\r\n     * @param {number} channels - Number of channels.\r\n     * @param {number} samplesPerSec - Samples per second.\r\n     * @param {number} avgBytesPerSec - Average bytes per second.\r\n     * @param {number} blockAlign - Block alignment.\r\n     * @param {number} bitsPerSample - Bits per sample.\r\n     * @param {string} audioFormatString - Audio format string\r\n     * @param {string} requestAudioFormatString - Audio format string sent to service.\r\n     * @param {boolean} hasHeader - If the format has header or not.\r\n     */\r\n    public constructor(formatTag: AudioFormatTag,\r\n                       channels: number,\r\n                       samplesPerSec: number,\r\n                       avgBytesPerSec: number,\r\n                       blockAlign: number,\r\n                       bitsPerSample: number,\r\n                       audioFormatString: string,\r\n                       requestAudioFormatString: string,\r\n                       hasHeader: boolean) {\r\n        super(samplesPerSec, bitsPerSample, channels, formatTag);\r\n        this.formatTag = formatTag;\r\n        this.avgBytesPerSec = avgBytesPerSec;\r\n        this.blockAlign = blockAlign;\r\n        this.priAudioFormatString = audioFormatString;\r\n        this.priRequestAudioFormatString = requestAudioFormatString;\r\n        this.priHasHeader = hasHeader;\r\n    }\r\n\r\n    public static fromSpeechSynthesisOutputFormat(speechSynthesisOutputFormat?: SpeechSynthesisOutputFormat): AudioOutputFormatImpl {\r\n        if (speechSynthesisOutputFormat === undefined) {\r\n            return AudioOutputFormatImpl.getDefaultOutputFormat();\r\n        }\r\n        return AudioOutputFormatImpl.fromSpeechSynthesisOutputFormatString(\r\n            AudioOutputFormatImpl.SpeechSynthesisOutputFormatToString[speechSynthesisOutputFormat]);\r\n    }\r\n\r\n    public static fromSpeechSynthesisOutputFormatString(speechSynthesisOutputFormatString: string): AudioOutputFormatImpl {\r\n        switch (speechSynthesisOutputFormatString) {\r\n            case \"raw-8khz-8bit-mono-mulaw\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MuLaw,\r\n                    1,\r\n                    8000,\r\n                    8000,\r\n                    1,\r\n                    8,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"riff-16khz-16kbps-mono-siren\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.Siren,\r\n                    1,\r\n                    16000,\r\n                    2000,\r\n                    40,\r\n                    0,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"audio-16khz-16kbps-mono-siren\",\r\n                    true);\r\n            case \"audio-16khz-16kbps-mono-siren\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.Siren,\r\n                    1,\r\n                    16000,\r\n                    2000,\r\n                    40,\r\n                    0,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-16khz-32kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    16000,\r\n                    32 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-16khz-128kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    16000,\r\n                    128 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-16khz-64kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    16000,\r\n                    64 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-24khz-48kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    24000,\r\n                    48 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-24khz-96kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    24000,\r\n                    96 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-24khz-160kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    24000,\r\n                    160 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"raw-16khz-16bit-mono-truesilk\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.SILKSkype,\r\n                    1,\r\n                    16000,\r\n                    32000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n\r\n            case \"riff-8khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    8000,\r\n                    16000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-8khz-16bit-mono-pcm\",\r\n                    true);\r\n            case \"riff-24khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    24000,\r\n                    48000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-24khz-16bit-mono-pcm\",\r\n                    true);\r\n            case \"riff-8khz-8bit-mono-mulaw\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MuLaw,\r\n                    1,\r\n                    8000,\r\n                    8000,\r\n                    1,\r\n                    8,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-8khz-8bit-mono-mulaw\",\r\n                    true);\r\n            case \"raw-16khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    16000,\r\n                    32000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-16khz-16bit-mono-pcm\",\r\n                    false);\r\n            case \"raw-24khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    24000,\r\n                    48000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-24khz-16bit-mono-pcm\",\r\n                    false);\r\n            case \"raw-8khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    8000,\r\n                    16000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-8khz-16bit-mono-pcm\",\r\n                    false);\r\n            case \"ogg-16khz-16bit-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.OGG_OPUS,\r\n                    1,\r\n                    16000,\r\n                    8192,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"ogg-24khz-16bit-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.OGG_OPUS,\r\n                    1,\r\n                    24000,\r\n                    8192,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"raw-48khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    48000,\r\n                    96000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-48khz-16bit-mono-pcm\",\r\n                    false);\r\n            case \"riff-48khz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    48000,\r\n                    96000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-48khz-16bit-mono-pcm\",\r\n                    true);\r\n            case \"audio-48khz-96kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    48000,\r\n                    96 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-48khz-192kbitrate-mono-mp3\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.MP3,\r\n                    1,\r\n                    48000,\r\n                    192 << 7,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"ogg-48khz-16bit-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.OGG_OPUS,\r\n                    1,\r\n                    48000,\r\n                    12000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"webm-16khz-16bit-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.WEBM_OPUS,\r\n                    1,\r\n                    16000,\r\n                    4000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"webm-24khz-16bit-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.WEBM_OPUS,\r\n                    1,\r\n                    24000,\r\n                    6000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"webm-24khz-16bit-24kbps-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.WEBM_OPUS,\r\n                    1,\r\n                    24000,\r\n                    3000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-16khz-16bit-32kbps-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.OPUS,\r\n                    1,\r\n                    16000,\r\n                    4000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-24khz-16bit-48kbps-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.OPUS,\r\n                    1,\r\n                    24000,\r\n                    6000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-24khz-16bit-24kbps-mono-opus\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.OPUS,\r\n                    1,\r\n                    24000,\r\n                    3000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-24khz-16bit-mono-flac\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.FLAC,\r\n                    1,\r\n                    24000,\r\n                    24000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"audio-48khz-16bit-mono-flac\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.FLAC,\r\n                    1,\r\n                    48000,\r\n                    30000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"raw-24khz-16bit-mono-truesilk\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.SILKSkype,\r\n                    1,\r\n                    24000,\r\n                    48000,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"raw-8khz-8bit-mono-alaw\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.ALaw,\r\n                    1,\r\n                    8000,\r\n                    8000,\r\n                    1,\r\n                    8,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"riff-8khz-8bit-mono-alaw\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.ALaw,\r\n                    1,\r\n                    8000,\r\n                    8000,\r\n                    1,\r\n                    8,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-8khz-8bit-mono-alaw\",\r\n                    true);\r\n            case \"raw-22050hz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    22050,\r\n                    44100,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"riff-22050hz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    22050,\r\n                    44100,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-22050hz-16bit-mono-pcm\",\r\n                    true);\r\n            case \"raw-44100hz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    44100,\r\n                    88200,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    speechSynthesisOutputFormatString,\r\n                    false);\r\n            case \"riff-44100hz-16bit-mono-pcm\":\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    44100,\r\n                    88200,\r\n                    2,\r\n                    16,\r\n                    speechSynthesisOutputFormatString,\r\n                    \"raw-44100hz-16bit-mono-pcm\",\r\n                    true);\r\n            case \"riff-16khz-16bit-mono-pcm\":\r\n            default:\r\n                return new AudioOutputFormatImpl(\r\n                    AudioFormatTag.PCM,\r\n                    1,\r\n                    16000,\r\n                    32000,\r\n                    2,\r\n                    16,\r\n                    \"riff-16khz-16bit-mono-pcm\",\r\n                    \"raw-16khz-16bit-mono-pcm\",\r\n                    true);\r\n        }\r\n    }\r\n\r\n    public static getDefaultOutputFormat(): AudioOutputFormatImpl {\r\n        return AudioOutputFormatImpl.fromSpeechSynthesisOutputFormatString(\r\n            (typeof window !== \"undefined\") ? \"audio-24khz-48kbitrate-mono-mp3\" : \"riff-16khz-16bit-mono-pcm\");\r\n    }\r\n\r\n    /**\r\n     * The format tag of the audio\r\n     * @AudioFormatTag AudioOutputFormatImpl.prototype.formatTag\r\n     * @function\r\n     * @public\r\n     */\r\n    public formatTag: AudioFormatTag;\r\n\r\n    /**\r\n     * Specifies if this audio output format has a header\r\n     * @boolean AudioOutputFormatImpl.prototype.hasHeader\r\n     * @function\r\n     * @public\r\n     */\r\n    public get hasHeader(): boolean {\r\n        return this.priHasHeader;\r\n    }\r\n\r\n    /**\r\n     * Specifies the header of this format\r\n     * @ArrayBuffer AudioOutputFormatImpl.prototype.header\r\n     * @function\r\n     * @public\r\n     */\r\n    public get header(): ArrayBuffer {\r\n        if (this.hasHeader) {\r\n            return this.privHeader;\r\n        }\r\n        return undefined;\r\n    }\r\n\r\n    /**\r\n     * Updates the header based on the audio length\r\n     * @member AudioOutputFormatImpl.updateHeader\r\n     * @function\r\n     * @public\r\n     * @param {number} audioLength - the audio length\r\n     */\r\n    public updateHeader(audioLength: number): void {\r\n        if (this.priHasHeader) {\r\n            const view = new DataView(this.privHeader);\r\n            view.setUint32(4, audioLength + this.privHeader.byteLength - 8, true);\r\n            view.setUint32(40, audioLength, true);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Specifies the audio format string to be sent to the service\r\n     * @string AudioOutputFormatImpl.prototype.requestAudioFormatString\r\n     * @function\r\n     * @public\r\n     */\r\n    public get requestAudioFormatString(): string {\r\n        return this.priRequestAudioFormatString;\r\n    }\r\n\r\n    /**\r\n     * Adds audio header\r\n     * @param audio the raw audio without header\r\n     * @returns the audio with header if applicable\r\n     */\r\n\r\n    public addHeader(audio: ArrayBuffer): ArrayBuffer {\r\n        if (!this.hasHeader) {\r\n            return audio;\r\n        }\r\n        this.updateHeader(audio.byteLength);\r\n        const tmp = new Uint8Array(audio.byteLength + this.header.byteLength);\r\n        tmp.set(new Uint8Array(this.header), 0);\r\n        tmp.set(new Uint8Array(audio), this.header.byteLength);\r\n        return tmp.buffer;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Define speech synthesis audio output formats.\r\n * @enum SpeechSynthesisOutputFormat\r\n * Updated in version 1.17.0\r\n */\r\nexport enum SpeechSynthesisOutputFormat {\r\n    /**\r\n     * raw-8khz-8bit-mono-mulaw\r\n     * @member SpeechSynthesisOutputFormat.Raw8Khz8BitMonoMULaw,\r\n     */\r\n    Raw8Khz8BitMonoMULaw,\r\n\r\n    /**\r\n     * riff-16khz-16kbps-mono-siren\r\n     * @note Unsupported by the service. Do not use this value.\r\n     * @member SpeechSynthesisOutputFormat.Riff16Khz16KbpsMonoSiren\r\n     */\r\n    Riff16Khz16KbpsMonoSiren,\r\n\r\n    /**\r\n     * audio-16khz-16kbps-mono-siren\r\n     * @note Unsupported by the service. Do not use this value.\r\n     * @member SpeechSynthesisOutputFormat.Audio16Khz16KbpsMonoSiren\r\n     */\r\n    Audio16Khz16KbpsMonoSiren,\r\n\r\n    /**\r\n     * audio-16khz-32kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3\r\n     */\r\n    Audio16Khz32KBitRateMonoMp3,\r\n\r\n    /**\r\n     * audio-16khz-128kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio16Khz128KBitRateMonoMp3\r\n     */\r\n    Audio16Khz128KBitRateMonoMp3,\r\n\r\n    /**\r\n     * audio-16khz-64kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio16Khz64KBitRateMonoMp3\r\n     */\r\n    Audio16Khz64KBitRateMonoMp3,\r\n\r\n    /**\r\n     * audio-24khz-48kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3\r\n     */\r\n    Audio24Khz48KBitRateMonoMp3,\r\n\r\n    /**\r\n     * audio-24khz-96kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3\r\n     */\r\n    Audio24Khz96KBitRateMonoMp3,\r\n\r\n    /**\r\n     * audio-24khz-160kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio24Khz160KBitRateMonoMp3\r\n     */\r\n    Audio24Khz160KBitRateMonoMp3,\r\n\r\n    /**\r\n     * raw-16khz-16bit-mono-truesilk\r\n     * @member SpeechSynthesisOutputFormat.Raw16Khz16BitMonoTrueSilk\r\n     */\r\n    Raw16Khz16BitMonoTrueSilk,\r\n\r\n    /**\r\n     * riff-16khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Riff16Khz16BitMonoPcm\r\n     */\r\n    Riff16Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * riff-8khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Riff8Khz16BitMonoPcm\r\n     */\r\n    Riff8Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * riff-24khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm\r\n     */\r\n    Riff24Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * riff-8khz-8bit-mono-mulaw\r\n     * @member SpeechSynthesisOutputFormat.Riff8Khz8BitMonoMULaw\r\n     */\r\n    Riff8Khz8BitMonoMULaw,\r\n\r\n    /**\r\n     * raw-16khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Raw16Khz16BitMonoPcm\r\n     */\r\n    Raw16Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * raw-24khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Raw24Khz16BitMonoPcm\r\n     */\r\n    Raw24Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * raw-8khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Raw8Khz16BitMonoPcm\r\n     */\r\n    Raw8Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * ogg-16khz-16bit-mono-opus\r\n     * @member SpeechSynthesisOutputFormat.Ogg16Khz16BitMonoOpus\r\n     */\r\n    Ogg16Khz16BitMonoOpus,\r\n\r\n    /**\r\n     * ogg-24khz-16bit-mono-opus\r\n     * @member SpeechSynthesisOutputFormat.Ogg24Khz16BitMonoOpus\r\n     */\r\n    Ogg24Khz16BitMonoOpus,\r\n\r\n    /**\r\n     * raw-48khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Raw48Khz16BitMonoPcm\r\n     */\r\n    Raw48Khz16BitMonoPcm,\r\n\r\n    /**\r\n     * riff-48khz-16bit-mono-pcm\r\n     * @member SpeechSynthesisOutputFormat.Riff48Khz16BitMonoPcm\r\n     */\r\n\r\n    Riff48Khz16BitMonoPcm,\r\n    /**\r\n     * audio-48khz-96kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio48Khz96KBitRateMonoMp3\r\n     */\r\n    Audio48Khz96KBitRateMonoMp3,\r\n\r\n    /**\r\n     * audio-48khz-192kbitrate-mono-mp3\r\n     * @member SpeechSynthesisOutputFormat.Audio48Khz192KBitRateMonoMp3\r\n     */\r\n    Audio48Khz192KBitRateMonoMp3,\r\n\r\n    /**\r\n     * ogg-48khz-16bit-mono-opus\r\n     * Added in version 1.16.0\r\n     * @member SpeechSynthesisOutputFormat.Ogg48Khz16BitMonoOpus\r\n     */\r\n    Ogg48Khz16BitMonoOpus,\r\n\r\n    /**\r\n     * webm-16khz-16bit-mono-opus\r\n     * Added in version 1.16.0\r\n     * @member SpeechSynthesisOutputFormat.Webm16Khz16BitMonoOpus\r\n     */\r\n    Webm16Khz16BitMonoOpus,\r\n\r\n    /**\r\n     * webm-24khz-16bit-mono-opus\r\n     * Added in version 1.16.0\r\n     * @member SpeechSynthesisOutputFormat.Webm24Khz16BitMonoOpus\r\n     */\r\n    Webm24Khz16BitMonoOpus,\r\n\r\n    /**\r\n     * raw-24khz-16bit-mono-truesilk\r\n     * Added in version 1.17.0\r\n     * @member SpeechSynthesisOutputFormat.Raw24Khz16BitMonoTrueSilk\r\n     */\r\n     Raw24Khz16BitMonoTrueSilk,\r\n\r\n    /**\r\n     * raw-8khz-8bit-mono-alaw\r\n     * Added in version 1.17.0\r\n     * @member SpeechSynthesisOutputFormat.Raw8Khz8BitMonoALaw\r\n     */\r\n     Raw8Khz8BitMonoALaw,\r\n\r\n    /**\r\n     * riff-8khz-8bit-mono-alaw\r\n     * Added in version 1.17.0\r\n     * @member SpeechSynthesisOutputFormat.Riff8Khz8BitMonoALaw\r\n     */\r\n     Riff8Khz8BitMonoALaw,\r\n\r\n    /**\r\n     * webm-24khz-16bit-24kbps-mono-opus\r\n     * Audio compressed by OPUS codec in a webm container, with bitrate of 24kbps, optimized for IoT scenario.\r\n     * Added in version 1.19.0\r\n     * @member SpeechSynthesisOutputFormat.Webm24Khz16Bit24KbpsMonoOpus\r\n     */\r\n    Webm24Khz16Bit24KbpsMonoOpus,\r\n\r\n    /**\r\n     * audio-16khz-16bit-32kbps-mono-opus\r\n     * Audio compressed by OPUS codec without container, with bitrate of 32kbps.\r\n     * Added in version 1.20.0\r\n     * @member SpeechSynthesisOutputFormat.Audio16Khz16Bit32KbpsMonoOpus\r\n     */\r\n    Audio16Khz16Bit32KbpsMonoOpus,\r\n\r\n    /**\r\n     * audio-24khz-16bit-48kbps-mono-opus\r\n     * Audio compressed by OPUS codec without container, with bitrate of 48kbps.\r\n     * Added in version 1.20.0\r\n     * @member SpeechSynthesisOutputFormat.Audio24Khz16Bit48KbpsMonoOpus\r\n     */\r\n    Audio24Khz16Bit48KbpsMonoOpus,\r\n\r\n    /**\r\n     * audio-24khz-16bit-24kbps-mono-opus\r\n     * Audio compressed by OPUS codec without container, with bitrate of 24kbps.\r\n     * Added in version 1.20.0\r\n     * @member SpeechSynthesisOutputFormat.Audio24Khz16Bit24KbpsMonoOpus\r\n     */\r\n    Audio24Khz16Bit24KbpsMonoOpus,\r\n\r\n    /**\r\n     * raw-22050hz-16bit-mono-pcm\r\n     * Raw PCM audio at 22050Hz sampling rate and 16-bit depth.\r\n     * Added in version 1.22.0\r\n     * @member SpeechSynthesisOutputFormat.Raw22050Hz16BitMonoPcm\r\n     */\r\n    Raw22050Hz16BitMonoPcm,\r\n\r\n    /**\r\n     * riff-22050hz-16bit-mono-pcm\r\n     * PCM audio at 22050Hz sampling rate and 16-bit depth, with RIFF header.\r\n     * Added in version 1.22.0\r\n     * @member SpeechSynthesisOutputFormat.Riff22050Hz16BitMonoPcm\r\n     */\r\n    Riff22050Hz16BitMonoPcm,\r\n\r\n    /**\r\n     * raw-44100hz-16bit-mono-pcm\r\n     * Raw PCM audio at 44100Hz sampling rate and 16-bit depth.\r\n     * Added in version 1.22.0\r\n     * @member SpeechSynthesisOutputFormat.Raw44100Hz16BitMonoPcm\r\n     */\r\n    Raw44100Hz16BitMonoPcm,\r\n\r\n    /**\r\n     * riff-44100hz-16bit-mono-pcm\r\n     * PCM audio at 44100Hz sampling rate and 16-bit depth, with RIFF header.\r\n     * Added in version 1.22.0\r\n     * @member SpeechSynthesisOutputFormat.Riff44100Hz16BitMonoPcm\r\n     */\r\n    Riff44100Hz16BitMonoPcm\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the possible reasons a recognition result might be canceled.\r\n * @class CancellationReason\r\n */\r\nexport enum CancellationReason {\r\n    /**\r\n     * Indicates that an error occurred during speech recognition.\r\n     * @member CancellationReason.Error\r\n     */\r\n    Error,\r\n\r\n    /**\r\n     * Indicates that the end of the audio stream was reached.\r\n     * @member CancellationReason.EndOfStream\r\n     */\r\n    EndOfStream,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n /**\r\n  * An abstract base class that defines callback methods (read() and close()) for\r\n  * custom audio input streams).\r\n  * @class PullAudioInputStreamCallback\r\n  */\r\nexport abstract class PullAudioInputStreamCallback {\r\n\r\n    /**\r\n     * Reads data from audio input stream into the data buffer. The maximal number of bytes\r\n     * to be read is determined by the size of dataBuffer.\r\n     * @member PullAudioInputStreamCallback.prototype.read\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - The byte array to store the read data.\r\n     * @returns {number} the number of bytes have been read.\r\n     */\r\n    public abstract read(dataBuffer: ArrayBuffer): number;\r\n\r\n    /**\r\n     * Closes the audio input stream.\r\n     * @member PullAudioInputStreamCallback.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n/**\r\n * An abstract base class that defines callback methods (write() and close()) for\r\n * custom audio output streams).\r\n * @class PushAudioOutputStreamCallback\r\n */\r\nexport abstract class PushAudioOutputStreamCallback {\r\n\r\n    /**\r\n     * Writes audio data into the data buffer.\r\n     * @member PushAudioOutputStreamCallback.prototype.write\r\n     * @function\r\n     * @public\r\n     * @param {ArrayBuffer} dataBuffer - The byte array that stores the audio data to write.\r\n     */\r\n    public abstract write(dataBuffer: ArrayBuffer): void;\r\n\r\n    /**\r\n     * Closes the audio output stream.\r\n     * @member PushAudioOutputStreamCallback.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\n\r\n/**\r\n * Represents a keyword recognition model for recognizing when\r\n * the user says a keyword to initiate further speech recognition.\r\n * @class KeywordRecognitionModel\r\n */\r\nexport class KeywordRecognitionModel {\r\n    private privDisposed: boolean = false;\r\n\r\n    /**\r\n     * Create and initializes a new instance.\r\n     * @constructor\r\n     */\r\n    private constructor() {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Creates a keyword recognition model using the specified filename.\r\n     * @member KeywordRecognitionModel.fromFile\r\n     * @function\r\n     * @public\r\n     * @param {string} fileName - A string that represents file name for the keyword recognition model.\r\n     * Note, the file can point to a zip file in which case the model\r\n     * will be extracted from the zip.\r\n     * @returns {KeywordRecognitionModel} The keyword recognition model being created.\r\n     */\r\n    public static fromFile(fileName: string): KeywordRecognitionModel {\r\n        Contracts.throwIfFileDoesNotExist(fileName, \"fileName\");\r\n\r\n        throw new Error(\"Not yet implemented.\");\r\n    }\r\n\r\n    /**\r\n     * Creates a keyword recognition model using the specified filename.\r\n     * @member KeywordRecognitionModel.fromStream\r\n     * @function\r\n     * @public\r\n     * @param {string} file - A File that represents file for the keyword recognition model.\r\n     * Note, the file can point to a zip file in which case the model will be extracted from the zip.\r\n     * @returns {KeywordRecognitionModel} The keyword recognition model being created.\r\n     */\r\n    public static fromStream(file: File): KeywordRecognitionModel {\r\n        Contracts.throwIfNull(file, \"file\");\r\n\r\n        throw new Error(\"Not yet implemented.\");\r\n    }\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member KeywordRecognitionModel.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        if (this.privDisposed) {\r\n            return;\r\n        }\r\n\r\n        this.privDisposed = true;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines content for session events like SessionStarted/Stopped, SoundStarted/Stopped.\r\n * @class SessionEventArgs\r\n */\r\nexport class SessionEventArgs {\r\n    private privSessionId: string;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(sessionId: string) {\r\n        this.privSessionId = sessionId;\r\n    }\r\n\r\n    /**\r\n     * Represents the session identifier.\r\n     * @member SessionEventArgs.prototype.sessionId\r\n     * @function\r\n     * @public\r\n     * @returns {string} Represents the session identifier.\r\n     */\r\n    public get sessionId(): string {\r\n        return this.privSessionId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SessionEventArgs } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines payload for session events like Speech Start/End Detected\r\n * @class\r\n */\r\nexport class RecognitionEventArgs extends SessionEventArgs {\r\n    private privOffset: number;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {number} offset - The offset.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(offset: number, sessionId?: string) {\r\n        super(sessionId);\r\n\r\n        this.privOffset = offset;\r\n    }\r\n\r\n    /**\r\n     * Represents the message offset\r\n     * @member RecognitionEventArgs.prototype.offset\r\n     * @function\r\n     * @public\r\n     */\r\n    public get offset(): number {\r\n        return this.privOffset;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Define Speech Recognizer output formats.\r\n * @class OutputFormat\r\n */\r\nexport enum OutputFormat {\r\n    /**\r\n     * @member OutputFormat.Simple\r\n     */\r\n    Simple = 0,\r\n\r\n    /**\r\n     * @member OutputFormat.Detailed\r\n     */\r\n    Detailed,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IntentRecognitionResult, RecognitionEventArgs } from \"./Exports.js\";\r\n\r\n/**\r\n * Intent recognition result event arguments.\r\n * @class\r\n */\r\nexport class IntentRecognitionEventArgs extends RecognitionEventArgs {\r\n    private privResult: IntentRecognitionResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param result - The result of the intent recognition.\r\n     * @param offset - The offset.\r\n     * @param sessionId - The session id.\r\n     */\r\n    public constructor(result: IntentRecognitionResult, offset?: number, sessionId?: string) {\r\n        super(offset, sessionId);\r\n\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Represents the intent recognition result.\r\n     * @member IntentRecognitionEventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {IntentRecognitionResult} Represents the intent recognition result.\r\n     */\r\n    public get result(): IntentRecognitionResult {\r\n        return this.privResult;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, ResultReason } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines result of speech recognition.\r\n * @class RecognitionResult\r\n */\r\nexport class RecognitionResult {\r\n    private privResultId: string;\r\n    private privReason: ResultReason;\r\n    private privText: string;\r\n    private privDuration: number;\r\n    private privOffset: number;\r\n    private privLanguage: string;\r\n    private privLanguageDetectionConfidence: string;\r\n    private privErrorDetails: string;\r\n    private privJson: string;\r\n    private privProperties: PropertyCollection;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {string} text - The recognized text.\r\n     * @param {number} duration - The duration.\r\n     * @param {number} offset - The offset into the stream.\r\n     * @param {string} language - Primary Language detected, if provided.\r\n     * @param {string} languageDetectionConfidence - Primary Language confidence (\"Unknown,\" \"Low,\" \"Medium,\" \"High\"...), if provided.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {string} json - Additional Json, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     */\r\n    public constructor(resultId?: string, reason?: ResultReason, text?: string, duration?: number,\r\n                offset?: number, language?: string, languageDetectionConfidence?: string, errorDetails?: string, json?: string, properties?: PropertyCollection) {\r\n        this.privResultId = resultId;\r\n        this.privReason = reason;\r\n        this.privText = text;\r\n        this.privDuration = duration;\r\n        this.privOffset = offset;\r\n        this.privLanguage = language;\r\n        this.privLanguageDetectionConfidence = languageDetectionConfidence;\r\n        this.privErrorDetails = errorDetails;\r\n        this.privJson = json;\r\n        this.privProperties = properties;\r\n    }\r\n\r\n    /**\r\n     * Specifies the result identifier.\r\n     * @member RecognitionResult.prototype.resultId\r\n     * @function\r\n     * @public\r\n     * @returns {string} Specifies the result identifier.\r\n     */\r\n    public get resultId(): string {\r\n        return this.privResultId;\r\n    }\r\n\r\n    /**\r\n     * Specifies status of the result.\r\n     * @member RecognitionResult.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {ResultReason} Specifies status of the result.\r\n     */\r\n    public get reason(): ResultReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    /**\r\n     * Presents the recognized text in the result.\r\n     * @member RecognitionResult.prototype.text\r\n     * @function\r\n     * @public\r\n     * @returns {string} Presents the recognized text in the result.\r\n     */\r\n    public get text(): string {\r\n        return this.privText;\r\n    }\r\n\r\n    /**\r\n     * Duration of recognized speech in 100 nano second increments.\r\n     * @member RecognitionResult.prototype.duration\r\n     * @function\r\n     * @public\r\n     * @returns {number} Duration of recognized speech in 100 nano second increments.\r\n     */\r\n    public get duration(): number {\r\n        return this.privDuration;\r\n    }\r\n\r\n    /**\r\n     * Offset of recognized speech in 100 nano second increments.\r\n     * @member RecognitionResult.prototype.offset\r\n     * @function\r\n     * @public\r\n     * @returns {number} Offset of recognized speech in 100 nano second increments.\r\n     */\r\n    public get offset(): number {\r\n        return this.privOffset;\r\n    }\r\n\r\n    /**\r\n     * Primary Language detected.\r\n     * @member RecognitionResult.prototype.language\r\n     * @function\r\n     * @public\r\n     * @returns {string} language detected.\r\n     */\r\n    public get language(): string {\r\n        return this.privLanguage;\r\n    }\r\n\r\n    /**\r\n     * Primary Language detection confidence (Unknown, Low, Medium, High).\r\n     * @member RecognitionResult.prototype.languageDetectionConfidence\r\n     * @function\r\n     * @public\r\n     * @returns {string} detection confidence strength.\r\n     */\r\n    public get languageDetectionConfidence(): string {\r\n        return this.privLanguageDetectionConfidence;\r\n    }\r\n\r\n    /**\r\n     * In case of an unsuccessful recognition, provides details of the occurred error.\r\n     * @member RecognitionResult.prototype.errorDetails\r\n     * @function\r\n     * @public\r\n     * @returns {string} a brief description of an error.\r\n     */\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n\r\n    /**\r\n     * A string containing Json serialized recognition result as it was received from the service.\r\n     * @member RecognitionResult.prototype.json\r\n     * @function\r\n     * @private\r\n     * @returns {string} Json serialized representation of the result.\r\n     */\r\n    public get json(): string {\r\n        return this.privJson;\r\n    }\r\n\r\n    /**\r\n     * The set of properties exposed in the result.\r\n     * @member RecognitionResult.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The set of properties exposed in the result.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, RecognitionResult, ResultReason } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines result of speech recognition.\r\n * @class SpeechRecognitionResult\r\n */\r\nexport class SpeechRecognitionResult extends RecognitionResult {\r\n    private readonly privSpeakerId: string;\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @public\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {string} text - The recognized text.\r\n     * @param {number} duration - The duration.\r\n     * @param {number} offset - The offset into the stream.\r\n     * @param {string} language - Primary Language detected, if provided.\r\n     * @param {string} languageDetectionConfidence - Primary Language confidence (\"Unknown,\" \"Low,\" \"Medium,\" \"High\"...), if provided.\r\n     * @param {string} speakerId - speaker id for conversation transcription, if provided.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {string} json - Additional Json, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     */\r\n    public constructor(resultId?: string, reason?: ResultReason, text?: string,\r\n                       duration?: number, offset?: number, language?: string,\r\n                       languageDetectionConfidence?: string, speakerId?: string, errorDetails?: string,\r\n                       json?: string, properties?: PropertyCollection) {\r\n        super(resultId, reason, text, duration, offset, language, languageDetectionConfidence, errorDetails, json, properties);\r\n        this.privSpeakerId = speakerId;\r\n    }\r\n\r\n    /**\r\n     * speaker id from conversation transcription/id scenarios\r\n     * @member SpeechRecognitionResult.prototype.speakerId\r\n     * @function\r\n     * @public\r\n     * @returns {string} id of speaker in given result\r\n     */\r\n    public get speakerId(): string {\r\n        return this.privSpeakerId;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, ResultReason, SpeechRecognitionResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Intent recognition result.\r\n * @class\r\n */\r\nexport class IntentRecognitionResult extends SpeechRecognitionResult {\r\n    private privIntentId: string;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param intentId - The intent id.\r\n     * @param resultId - The result id.\r\n     * @param reason - The reason.\r\n     * @param text - The recognized text.\r\n     * @param duration - The duration.\r\n     * @param offset - The offset into the stream.\r\n     * @param language - Primary Language detected, if provided.\r\n     * @param languageDetectionConfidence - Primary Language confidence (\"Unknown,\" \"Low,\" \"Medium,\" \"High\"...), if provided.\r\n     * @param errorDetails - Error details, if provided.\r\n     * @param json - Additional Json, if provided.\r\n     * @param properties - Additional properties, if provided.\r\n     */\r\n    public constructor(intentId?: string, resultId?: string, reason?: ResultReason, text?: string,\r\n                duration?: number, offset?: number, language?: string, languageDetectionConfidence?: string,\r\n                errorDetails?: string, json?: string, properties?: PropertyCollection) {\r\n        super(resultId, reason, text, duration, offset, language, languageDetectionConfidence, undefined, errorDetails, json, properties);\r\n\r\n        this.privIntentId = intentId;\r\n    }\r\n\r\n    /**\r\n     * A String that represents the intent identifier being recognized.\r\n     * @member IntentRecognitionResult.prototype.intentId\r\n     * @function\r\n     * @public\r\n     * @returns {string} A String that represents the intent identifier being recognized.\r\n     */\r\n    public get intentId(): string {\r\n        return this.privIntentId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nimport { Contracts } from \"./Contracts.js\";\r\n\r\n/**\r\n * Language understanding model\r\n * @class LanguageUnderstandingModel\r\n */\r\nexport class LanguageUnderstandingModel {\r\n    /**\r\n     * Creates and initializes a new instance\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Creates an language understanding model using the specified endpoint.\r\n     * @member LanguageUnderstandingModel.fromEndpoint\r\n     * @function\r\n     * @public\r\n     * @param {URL} uri - A String that represents the endpoint of the language understanding model.\r\n     * @returns {LanguageUnderstandingModel} The language understanding model being created.\r\n     */\r\n    public static fromEndpoint(uri: URL): LanguageUnderstandingModel {\r\n        Contracts.throwIfNull(uri, \"uri\");\r\n        Contracts.throwIfNullOrWhitespace(uri.hostname, \"uri\");\r\n\r\n        const langModelImp: LanguageUnderstandingModelImpl = new LanguageUnderstandingModelImpl();\r\n        // Need to extract the app ID from the URL.\r\n        // URL is in the format: https://<region>.api.cognitive.microsoft.com/luis/v2.0/apps/<Guid>?subscription-key=<key>&timezoneOffset=-360\r\n\r\n        // Start tearing the string apart.\r\n\r\n        // region can be extracted from the host name.\r\n        const firstDot: number = uri.host.indexOf(\".\");\r\n        if (-1 === firstDot) {\r\n            throw new Error(\"Could not determine region from endpoint\");\r\n        }\r\n        langModelImp.region = uri.host.substr(0, firstDot);\r\n\r\n        // Now the app ID.\r\n\r\n        const lastSegment: number = uri.pathname.lastIndexOf(\"/\") + 1;\r\n        if (-1 === lastSegment) {\r\n            throw new Error(\"Could not determine appId from endpoint\");\r\n        }\r\n\r\n        langModelImp.appId = uri.pathname.substr(lastSegment);\r\n\r\n        // And finally the key.\r\n        langModelImp.subscriptionKey = uri.searchParams.get(\"subscription-key\");\r\n        if (undefined === langModelImp.subscriptionKey) {\r\n            throw new Error(\"Could not determine subscription key from endpoint\");\r\n        }\r\n\r\n        return langModelImp;\r\n    }\r\n\r\n    /**\r\n     * Creates an language understanding model using the application id of Language Understanding service.\r\n     * @member LanguageUnderstandingModel.fromAppId\r\n     * @function\r\n     * @public\r\n     * @param {string} appId - A String that represents the application id of Language Understanding service.\r\n     * @returns {LanguageUnderstandingModel} The language understanding model being created.\r\n     */\r\n    public static fromAppId(appId: string): LanguageUnderstandingModel {\r\n        Contracts.throwIfNullOrWhitespace(appId, \"appId\");\r\n\r\n        const langModelImp: LanguageUnderstandingModelImpl = new LanguageUnderstandingModelImpl();\r\n        langModelImp.appId = appId;\r\n        return langModelImp;\r\n    }\r\n\r\n    /**\r\n     * Creates a language understanding model using hostname, subscription key and application\r\n     * id of Language Understanding service.\r\n     * @member LanguageUnderstandingModel.fromSubscription\r\n     * @function\r\n     * @public\r\n     * @param {string} subscriptionKey - A String that represents the subscription key of\r\n     * Language Understanding service.\r\n     * @param {string} appId - A String that represents the application id of Language\r\n     * Understanding service.\r\n     * @param {LanguageUnderstandingModel} region - A String that represents the region\r\n     * of the Language Understanding service (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {LanguageUnderstandingModel} The language understanding model being created.\r\n     */\r\n    public static fromSubscription(subscriptionKey: string, appId: string, region: string): LanguageUnderstandingModel {\r\n        Contracts.throwIfNullOrWhitespace(subscriptionKey, \"subscriptionKey\");\r\n        Contracts.throwIfNullOrWhitespace(appId, \"appId\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const langModelImp: LanguageUnderstandingModelImpl = new LanguageUnderstandingModelImpl();\r\n        langModelImp.appId = appId;\r\n        langModelImp.region = region;\r\n        langModelImp.subscriptionKey = subscriptionKey;\r\n        return langModelImp;\r\n    }\r\n}\r\n\r\n/**\r\n * @private\r\n * @class LanguageUnderstandingModelImpl\r\n */\r\nexport class LanguageUnderstandingModelImpl extends LanguageUnderstandingModel {\r\n    public appId: string;\r\n    public region: string;\r\n    public subscriptionKey: string;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { RecognitionEventArgs, SpeechRecognitionResult, ConversationTranscriptionResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines contents of speech recognizing/recognized event.\r\n * @class SpeechRecognitionEventArgs\r\n */\r\nexport class SpeechRecognitionEventArgs extends RecognitionEventArgs {\r\n    private privResult: SpeechRecognitionResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {SpeechRecognitionResult} result - The speech recognition result.\r\n     * @param {number} offset - The offset.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(result: SpeechRecognitionResult, offset?: number, sessionId?: string) {\r\n        super(offset, sessionId);\r\n\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Specifies the recognition result.\r\n     * @member SpeechRecognitionEventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {SpeechRecognitionResult} the recognition result.\r\n     */\r\n    public get result(): SpeechRecognitionResult {\r\n        return this.privResult;\r\n    }\r\n}\r\n\r\n/**\r\n * Defines contents of conversation transcribed/transcribing event.\r\n * @class ConversationTranscriptionEventArgs\r\n */\r\nexport class ConversationTranscriptionEventArgs extends RecognitionEventArgs {\r\n    private privResult: ConversationTranscriptionResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {ConversationTranscriptionResult} result - The conversation transcription result.\r\n     * @param {number} offset - The offset.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(result: ConversationTranscriptionResult, offset?: number, sessionId?: string) {\r\n        super(offset, sessionId);\r\n\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Specifies the transcription result.\r\n     * @member ConversationTranscription1EventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {ConversationTranscriptionResult} the recognition result.\r\n     */\r\n        public get result(): ConversationTranscriptionResult {\r\n            return this.privResult;\r\n        }\r\n}\r\n\r\n/**\r\n * Defines contents of meeting transcribed/transcribing event.\r\n * @class MeetingTranscriptionEventArgs\r\n */\r\nexport class MeetingTranscriptionEventArgs extends SpeechRecognitionEventArgs {\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CancellationEventArgsBase,\r\n} from \"./CancellationEventArgsBase.js\";\r\n\r\nexport class SpeechRecognitionCanceledEventArgs extends CancellationEventArgsBase {\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationEventArgs,\r\n    CancellationReason,\r\n    RecognitionEventArgs\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Defines content of a CancellationEvent.\r\n * @class CancellationEventArgsBase\r\n */\r\nexport class CancellationEventArgsBase extends RecognitionEventArgs implements CancellationEventArgs {\r\n    private privReason: CancellationReason;\r\n    private privErrorDetails: string;\r\n    private privErrorCode: CancellationErrorCode;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {CancellationReason} reason - The cancellation reason.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {number} offset - The offset.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(reason: CancellationReason, errorDetails: string,\r\n                       errorCode: CancellationErrorCode, offset?: number, sessionId?: string) {\r\n        super(offset, sessionId);\r\n\r\n        this.privReason = reason;\r\n        this.privErrorDetails = errorDetails;\r\n        this.privErrorCode = errorCode;\r\n    }\r\n\r\n    /**\r\n     * The reason the recognition was canceled.\r\n     * @member CancellationEventArgsBase.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {CancellationReason} Specifies the reason canceled.\r\n     */\r\n    public get reason(): CancellationReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    /**\r\n     * The error code in case of an unsuccessful operation.\r\n     * @return An error code that represents the error reason.\r\n     */\r\n    public get errorCode(): CancellationErrorCode {\r\n        return this.privErrorCode;\r\n    }\r\n\r\n    /**\r\n     * In case of an unsuccessful operation, provides details of the occurred error.\r\n     * @member CancellationEventArgsBase.prototype.errorDetails\r\n     * @function\r\n     * @public\r\n     * @returns {string} A String that represents the error details.\r\n     */\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognitionEventArgs, TranslationRecognitionResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Translation text result event arguments.\r\n * @class TranslationRecognitionEventArgs\r\n */\r\nexport class TranslationRecognitionEventArgs extends RecognitionEventArgs {\r\n    private privResult: TranslationRecognitionResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {TranslationRecognitionResult} result - The translation recognition result.\r\n     * @param {number} offset - The offset.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(result: TranslationRecognitionResult, offset?: number, sessionId?: string) {\r\n        super(offset, sessionId);\r\n\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Specifies the recognition result.\r\n     * @member TranslationRecognitionEventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {TranslationRecognitionResult} the recognition result.\r\n     */\r\n    public get result(): TranslationRecognitionResult {\r\n        return this.privResult;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SessionEventArgs, TranslationSynthesisResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Translation Synthesis event arguments\r\n * @class TranslationSynthesisEventArgs\r\n */\r\nexport class TranslationSynthesisEventArgs extends SessionEventArgs {\r\n    private privResult: TranslationSynthesisResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {TranslationSynthesisResult} result - The translation synthesis result.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(result: TranslationSynthesisResult, sessionId?: string) {\r\n        super(sessionId);\r\n\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Specifies the translation synthesis result.\r\n     * @member TranslationSynthesisEventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {TranslationSynthesisResult} Specifies the translation synthesis result.\r\n     */\r\n    public get result(): TranslationSynthesisResult {\r\n        return this.privResult;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, ResultReason, SpeechRecognitionResult, Translations } from \"./Exports.js\";\r\n\r\n/**\r\n * Translation text result.\r\n * @class TranslationRecognitionResult\r\n */\r\nexport class TranslationRecognitionResult extends SpeechRecognitionResult {\r\n    private privTranslations: Translations;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {Translations} translations - The translations.\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {string} text - The recognized text.\r\n     * @param {number} duration - The duration.\r\n     * @param {number} offset - The offset into the stream.\r\n     * @param {string} language - Primary Language detected, if provided.\r\n     * @param {string} languageDetectionConfidence - Primary Language confidence (\"Unknown,\" \"Low,\" \"Medium,\" \"High\"...), if provided.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {string} json - Additional Json, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     */\r\n    public constructor(translations: Translations, resultId?: string, reason?: ResultReason,\r\n                       text?: string, duration?: number, offset?: number, language?: string,\r\n                       languageDetectionConfidence?: string, errorDetails?: string,\r\n                       json?: string, properties?: PropertyCollection) {\r\n        super(resultId, reason, text, duration, offset, language, languageDetectionConfidence, undefined, errorDetails, json, properties);\r\n\r\n        this.privTranslations = translations;\r\n    }\r\n\r\n    public static fromSpeechRecognitionResult(result: SpeechRecognitionResult): TranslationRecognitionResult {\r\n        return new TranslationRecognitionResult(undefined, result.resultId, result.reason, result.text, result.duration, result.offset, result.language, result.languageDetectionConfidence, result.errorDetails, result.json, result.properties);\r\n    }\r\n\r\n    /**\r\n     * Presents the translation results. Each item in the dictionary represents\r\n     * a translation result in one of target languages, where the key is the name\r\n     * of the target language, in BCP-47 format, and the value is the translation\r\n     * text in the specified language.\r\n     * @member TranslationRecognitionResult.prototype.translations\r\n     * @function\r\n     * @public\r\n     * @returns {Translations} the current translation map that holds all translations requested.\r\n     */\r\n    public get translations(): Translations {\r\n        return this.privTranslations;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ResultReason } from \"./ResultReason.js\";\r\n\r\n/**\r\n * Defines translation synthesis result, i.e. the voice output of the translated\r\n * text in the target language.\r\n * @class TranslationSynthesisResult\r\n */\r\nexport class TranslationSynthesisResult {\r\n    private privReason: ResultReason;\r\n    private privAudio: ArrayBuffer;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {ResultReason} reason - The synthesis reason.\r\n     * @param {ArrayBuffer} audio - The audio data.\r\n     */\r\n    public constructor(reason: ResultReason, audio: ArrayBuffer) {\r\n        this.privReason = reason;\r\n        this.privAudio = audio;\r\n    }\r\n\r\n    /**\r\n     * Translated text in the target language.\r\n     * @member TranslationSynthesisResult.prototype.audio\r\n     * @function\r\n     * @public\r\n     * @returns {ArrayBuffer} Translated audio in the target language.\r\n     */\r\n    public get audio(): ArrayBuffer {\r\n        return this.privAudio;\r\n    }\r\n\r\n    /**\r\n     * The synthesis status.\r\n     * @member TranslationSynthesisResult.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {ResultReason} The synthesis status.\r\n     */\r\n    public get reason(): ResultReason {\r\n        return this.privReason;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the possible reasons a recognition result might be generated.\r\n * @class ResultReason\r\n */\r\nexport enum ResultReason {\r\n    /**\r\n     * Indicates speech could not be recognized. More details\r\n     * can be found in the NoMatchDetails object.\r\n     * @member ResultReason.NoMatch\r\n     */\r\n    NoMatch,\r\n\r\n    /**\r\n     * Indicates that the recognition was canceled. More details\r\n     * can be found using the CancellationDetails object.\r\n     * @member ResultReason.Canceled\r\n     */\r\n    Canceled,\r\n\r\n    /**\r\n     * Indicates the speech result contains hypothesis text.\r\n     * @member ResultReason.RecognizedSpeech\r\n     */\r\n    RecognizingSpeech,\r\n\r\n    /**\r\n     * Indicates the speech result contains final text that has been recognized.\r\n     * Speech Recognition is now complete for this phrase.\r\n     * @member ResultReason.RecognizedSpeech\r\n     */\r\n    RecognizedSpeech,\r\n\r\n    /**\r\n     * Indicates the speech result contains a finalized acceptance of a provided keyword.\r\n     * Speech recognition will continue unless otherwise configured.\r\n     * @member ResultReason.RecognizedKeyword\r\n     */\r\n    RecognizedKeyword,\r\n\r\n    /**\r\n     * Indicates the intent result contains hypothesis text and intent.\r\n     * @member ResultReason.RecognizingIntent\r\n     */\r\n    RecognizingIntent,\r\n\r\n    /**\r\n     * Indicates the intent result contains final text and intent.\r\n     * Speech Recognition and Intent determination are now complete for this phrase.\r\n     * @member ResultReason.RecognizedIntent\r\n     */\r\n    RecognizedIntent,\r\n\r\n    /**\r\n     * Indicates the translation result contains hypothesis text and its translation(s).\r\n     * @member ResultReason.TranslatingSpeech\r\n     */\r\n    TranslatingSpeech,\r\n\r\n    /**\r\n     * Indicates the translation result contains final text and corresponding translation(s).\r\n     * Speech Recognition and Translation are now complete for this phrase.\r\n     * @member ResultReason.TranslatedSpeech\r\n     */\r\n    TranslatedSpeech,\r\n\r\n    /**\r\n     * Indicates the synthesized audio result contains a non-zero amount of audio data\r\n     * @member ResultReason.SynthesizingAudio\r\n     */\r\n    SynthesizingAudio,\r\n\r\n    /**\r\n     * Indicates the synthesized audio is now complete for this phrase.\r\n     * @member ResultReason.SynthesizingAudioCompleted\r\n     */\r\n    SynthesizingAudioCompleted,\r\n\r\n    /**\r\n     * Indicates the speech synthesis is now started\r\n     * @member ResultReason.SynthesizingAudioStarted\r\n     */\r\n    SynthesizingAudioStarted,\r\n\r\n    /**\r\n     * Indicates the voice profile is being enrolled and customers need to send more audio to create a voice profile.\r\n     * @member ResultReason.EnrollingVoiceProfile\r\n     */\r\n    EnrollingVoiceProfile,\r\n\r\n    /**\r\n     * Indicates the voice profile has been enrolled.\r\n     * @member ResultReason.EnrolledVoiceProfile\r\n     */\r\n    EnrolledVoiceProfile,\r\n\r\n    /**\r\n     * Indicates successful identification of some speakers.\r\n     * @member ResultReason.RecognizedSpeakers\r\n     */\r\n    RecognizedSpeakers,\r\n\r\n    /**\r\n     * Indicates successfully verified one speaker.\r\n     * @member ResultReason.RecognizedSpeaker\r\n     */\r\n    RecognizedSpeaker,\r\n\r\n    /**\r\n     * Indicates a voice profile has been reset successfully.\r\n     * @member ResultReason.ResetVoiceProfile\r\n     */\r\n    ResetVoiceProfile,\r\n\r\n    /**\r\n     * Indicates a voice profile has been deleted successfully.\r\n     * @member ResultReason.DeletedVoiceProfile\r\n     */\r\n    DeletedVoiceProfile,\r\n\r\n    /**\r\n     * Indicates synthesis voices list has been successfully retrieved.\r\n     * @member ResultReason.VoicesListRetrieved\r\n     */\r\n    VoicesListRetrieved,\r\n\r\n    /**\r\n     * Indicates the transcription result contains hypothesis text and its translation(s) for\r\n     * other participants in the conversation.\r\n     * @member ResultReason.TranslatingParticipantSpeech\r\n     */\r\n    TranslatingParticipantSpeech,\r\n\r\n    /**\r\n     * Indicates the transcription result contains final text and corresponding translation(s)\r\n     * for other participants in the conversation. Speech Recognition and Translation are now\r\n     * complete for this phrase.\r\n     * @member ResultReason.TranslatedParticipantSpeech\r\n     */\r\n    TranslatedParticipantSpeech,\r\n\r\n    /**\r\n     * <summary>\r\n     * Indicates the transcription result contains the instant message and corresponding\r\n     * translation(s).\r\n     * @member ResultReason.TranslatedInstantMessage\r\n     */\r\n    TranslatedInstantMessage,\r\n\r\n    /**\r\n     * Indicates the transcription result contains the instant message for other participants\r\n     * in the conversation and corresponding translation(s).\r\n     * @member ResultReason.TranslatedParticipantInstantMessage\r\n     */\r\n    TranslatedParticipantInstantMessage,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    ForceDictationPropertyName,\r\n    OutputFormatPropertyName,\r\n    ServicePropertiesPropertyName\r\n} from \"../common.speech/Exports.js\";\r\nimport {IStringDictionary} from \"../common/Exports.js\";\r\nimport {Contracts} from \"./Contracts.js\";\r\nimport {\r\n    OutputFormat,\r\n    ProfanityOption,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ServicePropertyChannel,\r\n    SpeechSynthesisOutputFormat,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Speech configuration.\r\n * @class SpeechConfig\r\n */\r\nexport abstract class SpeechConfig {\r\n    /**\r\n     * Creates and initializes an instance.\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Static instance of SpeechConfig returned by passing subscriptionKey and service region.\r\n     * Note: Please use your LanguageUnderstanding subscription key in case you want to use the Intent recognizer.\r\n     * @member SpeechConfig.fromSubscription\r\n     * @function\r\n     * @public\r\n     * @param {string} subscriptionKey - The subscription key.\r\n     * @param {string} region - The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {SpeechConfig} The speech factory\r\n     */\r\n    public static fromSubscription(subscriptionKey: string, region: string): SpeechConfig {\r\n        Contracts.throwIfNullOrWhitespace(subscriptionKey, \"subscriptionKey\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_IntentRegion, region);\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n\r\n        return speechImpl;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the speech config with specified endpoint and subscription key.\r\n     * This method is intended only for users who use a non-standard service endpoint or parameters.\r\n     * Note: Please use your LanguageUnderstanding subscription key in case you want to use the Intent recognizer.\r\n     * Note: The query parameters specified in the endpoint URL are not changed, even if they are set by any other APIs.\r\n     * For example, if language is defined in the uri as query parameter \"language=de-DE\", and also set by\r\n     * SpeechConfig.speechRecognitionLanguage = \"en-US\", the language setting in uri takes precedence,\r\n     * and the effective language is \"de-DE\". Only the parameters that are not specified in the\r\n     * endpoint URL can be set by other APIs.\r\n     * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\r\n     * fromEndpoint method, and then set authorizationToken=\"token\" on the created SpeechConfig instance to\r\n     * use the authorization token.\r\n     * @member SpeechConfig.fromEndpoint\r\n     * @function\r\n     * @public\r\n     * @param {URL} endpoint - The service endpoint to connect to.\r\n     * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization token must be set.\r\n     * @returns {SpeechConfig} A speech factory instance.\r\n     */\r\n    public static fromEndpoint(endpoint: URL, subscriptionKey?: string): SpeechConfig {\r\n        Contracts.throwIfNull(endpoint, \"endpoint\");\r\n\r\n        const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.href);\r\n\r\n        if (undefined !== subscriptionKey) {\r\n            speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n        }\r\n        return speechImpl;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the speech config with specified host and subscription key.\r\n     * This method is intended only for users who use a non-default service host. Standard resource path will be assumed.\r\n     * For services with a non-standard resource path or no path at all, use fromEndpoint instead.\r\n     * Note: Query parameters are not allowed in the host URI and must be set by other APIs.\r\n     * Note: To use an authorization token with fromHost, use fromHost(URL),\r\n     * and then set the AuthorizationToken property on the created SpeechConfig instance.\r\n     * Note: Added in version 1.9.0.\r\n     * @member SpeechConfig.fromHost\r\n     * @function\r\n     * @public\r\n     * @param {URL} host - The service endpoint to connect to. Format is \"protocol://host:port\" where \":port\" is optional.\r\n     * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization token must be set.\r\n     * @returns {SpeechConfig} A speech factory instance.\r\n     */\r\n    public static fromHost(hostName: URL, subscriptionKey?: string): SpeechConfig {\r\n        Contracts.throwIfNull(hostName, \"hostName\");\r\n\r\n        const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Host, hostName.protocol + \"//\" + hostName.hostname + (hostName.port === \"\" ? \"\" : \":\" + hostName.port));\r\n\r\n        if (undefined !== subscriptionKey) {\r\n            speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n        }\r\n        return speechImpl;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the speech factory with specified initial authorization token and region.\r\n     * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n     * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n     * Note: Please use a token derived from your LanguageUnderstanding subscription key in case you want\r\n     * to use the Intent recognizer. As configuration values are copied when creating a new recognizer,\r\n     * the new token value will not apply to recognizers that have already been created. For recognizers\r\n     * that have been created before, you need to set authorization token of the corresponding recognizer\r\n     * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\r\n     * @member SpeechConfig.fromAuthorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} authorizationToken - The initial authorization token.\r\n     * @param {string} region - The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {SpeechConfig} A speech factory instance.\r\n     */\r\n    public static fromAuthorizationToken(authorizationToken: string, region: string): SpeechConfig {\r\n        Contracts.throwIfNull(authorizationToken, \"authorizationToken\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_IntentRegion, region);\r\n        speechImpl.authorizationToken = authorizationToken;\r\n        return speechImpl;\r\n    }\r\n\r\n    /**\r\n     * Sets the proxy configuration.\r\n     * Only relevant in Node.js environments.\r\n     * Added in version 1.4.0.\r\n     * @param proxyHostName The host name of the proxy server.\r\n     * @param proxyPort The port number of the proxy server.\r\n     */\r\n    public abstract setProxy(proxyHostName: string, proxyPort: number): void;\r\n\r\n    /**\r\n     * Sets the proxy configuration.\r\n     * Only relevant in Node.js environments.\r\n     * Added in version 1.4.0.\r\n     * @param proxyHostName The host name of the proxy server, without the protocol scheme (http://)\r\n     * @param proxyPort The port number of the proxy server.\r\n     * @param proxyUserName The username of the proxy server.\r\n     * @param proxyPassword The password of the proxy server.\r\n     */\r\n    public abstract setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n\r\n    /**\r\n     * Gets the authorization token.\r\n     * @member SpeechConfig.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract get authorizationToken(): string;\r\n\r\n    /**\r\n     * Gets/Sets the authorization token.\r\n     * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n     * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n     * @member SpeechConfig.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The authorization token.\r\n     */\r\n    public abstract set authorizationToken(value: string);\r\n\r\n    /**\r\n     * Returns the configured language.\r\n     * @member SpeechConfig.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract get speechRecognitionLanguage(): string;\r\n\r\n    /**\r\n     * Gets/Sets the input language.\r\n     * @member SpeechConfig.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The authorization token.\r\n     */\r\n    public abstract set speechRecognitionLanguage(value: string);\r\n\r\n    /**\r\n     * Sets an arbitrary property.\r\n     * @member SpeechConfig.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {string | PropertyId} name - The name of the property to set.\r\n     * @param {string} value - The new value of the property.\r\n     */\r\n    public abstract setProperty(name: string | PropertyId, value: string): void;\r\n\r\n    /**\r\n     * Returns the current value of an arbitrary property.\r\n     * @member SpeechConfig.prototype.getProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} name - The name of the property to query.\r\n     * @param {string} def - The value to return in case the property is not known.\r\n     * @returns {string} The current value, or provided default, of the given property.\r\n     */\r\n    public abstract getProperty(name: string, def?: string): string;\r\n\r\n    /**\r\n     * Gets speech recognition output format (simple or detailed).\r\n     * Note: This output format is for speech recognition result, use [SpeechConfig.speechSynthesisOutputFormat] to\r\n     * get synthesized audio output format.\r\n     * @member SpeechConfig.prototype.outputFormat\r\n     * @function\r\n     * @public\r\n     * @returns {OutputFormat} Returns the output format.\r\n     */\r\n    public abstract get outputFormat(): OutputFormat;\r\n\r\n    /**\r\n     * Gets/Sets speech recognition output format (simple or detailed).\r\n     * Note: This output format is for speech recognition result, use [SpeechConfig.speechSynthesisOutputFormat] to\r\n     * set synthesized audio output format.\r\n     * @member SpeechConfig.prototype.outputFormat\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract set outputFormat(format: OutputFormat);\r\n\r\n    /**\r\n     * Gets the endpoint ID of a customized speech model that is used for speech recognition.\r\n     * @member SpeechConfig.prototype.endpointId\r\n     * @function\r\n     * @public\r\n     * @return {string} The endpoint ID\r\n     */\r\n    public abstract get endpointId(): string;\r\n\r\n    /**\r\n     * Gets/Sets the endpoint ID of a customized speech model that is used for speech recognition.\r\n     * @member SpeechConfig.prototype.endpointId\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The endpoint ID\r\n     */\r\n    public abstract set endpointId(value: string);\r\n\r\n    /**\r\n     * Closes the configuration.\r\n     * @member SpeechConfig.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n    public close(): void { }\r\n\r\n    /**\r\n     * @member SpeechConfig.prototype.subscriptionKey\r\n     * @function\r\n     * @public\r\n     * @return {string} The subscription key set on the config.\r\n     */\r\n    public abstract get subscriptionKey(): string;\r\n\r\n    /**\r\n     * @member SpeechConfig.prototype.region\r\n     * @function\r\n     * @public\r\n     * @return {region} The region set on the config.\r\n     */\r\n    public abstract get region(): string;\r\n\r\n    /**\r\n     * Sets a property value that will be passed to service using the specified channel.\r\n     * Added in version 1.7.0.\r\n     * @member SpeechConfig.prototype.setServiceProperty\r\n     * @function\r\n     * @public\r\n     * @param {name} The name of the property.\r\n     * @param {value} Value to set.\r\n     * @param {channel} The channel used to pass the specified property to service.\r\n     */\r\n    public abstract setServiceProperty(name: string, value: string, channel: ServicePropertyChannel): void;\r\n\r\n    /**\r\n     * Sets profanity option.\r\n     * Added in version 1.7.0.\r\n     * @member SpeechConfig.prototype.setProfanity\r\n     * @function\r\n     * @public\r\n     * @param {profanity} Profanity option to set.\r\n     */\r\n    public abstract setProfanity(profanity: ProfanityOption): void;\r\n\r\n    /**\r\n     * Enable audio logging in service.\r\n     * Audio and content logs are stored either in Microsoft-owned storage, or in your own storage account linked\r\n     * to your Cognitive Services subscription (Bring Your Own Storage (BYOS) enabled Speech resource).\r\n     * The logs will be removed after 30 days.\r\n     * Added in version 1.7.0.\r\n     * @member SpeechConfig.prototype.enableAudioLogging\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract enableAudioLogging(): void;\r\n\r\n    /**\r\n     * Includes word-level timestamps.\r\n     * Added in version 1.7.0.\r\n     * @member SpeechConfig.prototype.requestWordLevelTimestamps\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract requestWordLevelTimestamps(): void;\r\n\r\n    /**\r\n     * Enable dictation. Only supported in speech continuous recognition.\r\n     * Added in version 1.7.0.\r\n     * @member SpeechConfig.prototype.enableDictation\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract enableDictation(): void;\r\n\r\n    /**\r\n     * Gets the language of the speech synthesizer.\r\n     * Added in version 1.11.0.\r\n     * @member SpeechConfig.prototype.speechSynthesisLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {string} Returns the speech synthesis language.\r\n     */\r\n    public abstract get speechSynthesisLanguage(): string;\r\n\r\n    /**\r\n     * Sets the language of the speech synthesizer.\r\n     * Added in version 1.11.0.\r\n     * @member SpeechConfig.prototype.speechSynthesisLanguage\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract set speechSynthesisLanguage(language: string);\r\n\r\n    /**\r\n     * Gets the voice of the speech synthesizer.\r\n     * Added in version 1.11.0.\r\n     * @member SpeechConfig.prototype.speechSynthesisVoiceName\r\n     * @function\r\n     * @public\r\n     * @returns {string} Returns the speech synthesis voice.\r\n     */\r\n    public abstract get speechSynthesisVoiceName(): string;\r\n\r\n    /**\r\n     * Sets the voice of the speech synthesizer. (see <a href=\"https://aka.ms/speech/tts-languages\">available voices</a>).\r\n     * Added in version 1.11.0.\r\n     * @member SpeechConfig.prototype.speechSynthesisVoiceName\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract set speechSynthesisVoiceName(voice: string);\r\n\r\n    /**\r\n     * Gets the speech synthesis output format.\r\n     * Added in version 1.11.0.\r\n     * @member SpeechConfig.prototype.speechSynthesisOutputFormat\r\n     * @function\r\n     * @public\r\n     * @returns {SpeechSynthesisOutputFormat} Returns the speech synthesis output format\r\n     */\r\n    public abstract get speechSynthesisOutputFormat(): SpeechSynthesisOutputFormat;\r\n\r\n    /**\r\n     * Sets the speech synthesis output format (e.g. Riff16Khz16BitMonoPcm).\r\n     * The default format is Audio16Khz64KBitRateMonoMp3 for browser and Riff16Khz16BitMonoPcm for Node.JS.\r\n     * Added in version 1.11.0.\r\n     * @member SpeechConfig.prototype.speechSynthesisOutputFormat\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract set speechSynthesisOutputFormat(format: SpeechSynthesisOutputFormat);\r\n}\r\n\r\n/**\r\n * @public\r\n * @class SpeechConfigImpl\r\n */\r\nexport class SpeechConfigImpl extends SpeechConfig {\r\n\r\n    private privProperties: PropertyCollection;\r\n\r\n    public constructor() {\r\n        super();\r\n        this.privProperties = new PropertyCollection();\r\n        this.speechRecognitionLanguage = \"en-US\"; // Should we have a default?\r\n        this.outputFormat = OutputFormat.Simple;\r\n    }\r\n\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public get endPoint(): URL {\r\n        return new URL(this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Endpoint));\r\n    }\r\n\r\n    public get subscriptionKey(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Key);\r\n    }\r\n\r\n    public get region(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n    }\r\n\r\n    public get authorizationToken(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    public set authorizationToken(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n    }\r\n\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    public set speechRecognitionLanguage(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_RecoLanguage, value);\r\n    }\r\n\r\n    public get autoDetectSourceLanguages(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages);\r\n    }\r\n\r\n    public set autoDetectSourceLanguages(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, value);\r\n    }\r\n\r\n    public get outputFormat(): OutputFormat {\r\n        return OutputFormat[this.privProperties.getProperty(OutputFormatPropertyName, undefined) as keyof typeof OutputFormat];\r\n    }\r\n\r\n    public set outputFormat(value: OutputFormat) {\r\n        this.privProperties.setProperty(OutputFormatPropertyName, OutputFormat[value]);\r\n    }\r\n\r\n    public get endpointId(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_EndpointId);\r\n    }\r\n\r\n    public set endpointId(value: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_EndpointId, value);\r\n    }\r\n\r\n    public setProperty(name: string | PropertyId, value: string): void {\r\n        Contracts.throwIfNull(value, \"value\");\r\n\r\n        this.privProperties.setProperty(name, value);\r\n    }\r\n\r\n    public getProperty(name: string | PropertyId, def?: string): string {\r\n\r\n        return this.privProperties.getProperty(name, def);\r\n    }\r\n\r\n    public setProxy(proxyHostName: string, proxyPort: number): void;\r\n    public setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n    public setProxy(proxyHostName: any, proxyPort: any, proxyUserName?: any, proxyPassword?: any): void {\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyHostName], proxyHostName as string);\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPort], proxyPort as string);\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyUserName], proxyUserName as string);\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPassword], proxyPassword as string);\r\n    }\r\n\r\n    public setServiceProperty(name: string, value: string): void {\r\n        const currentProperties: IStringDictionary<string> = JSON.parse(this.privProperties.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n\r\n        currentProperties[name] = value;\r\n\r\n        this.privProperties.setProperty(ServicePropertiesPropertyName, JSON.stringify(currentProperties));\r\n    }\r\n\r\n    public setProfanity(profanity: ProfanityOption): void {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceResponse_ProfanityOption, ProfanityOption[profanity]);\r\n    }\r\n\r\n    public enableAudioLogging(): void {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_EnableAudioLogging, \"true\");\r\n    }\r\n    public requestWordLevelTimestamps(): void {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"true\");\r\n    }\r\n    public enableDictation(): void {\r\n        this.privProperties.setProperty(ForceDictationPropertyName, \"true\");\r\n    }\r\n\r\n    public clone(): SpeechConfigImpl {\r\n        const ret: SpeechConfigImpl = new SpeechConfigImpl();\r\n        ret.privProperties = this.privProperties.clone();\r\n        return ret;\r\n    }\r\n\r\n    public get speechSynthesisLanguage(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_SynthLanguage);\r\n    }\r\n\r\n    public set speechSynthesisLanguage(language: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_SynthLanguage, language);\r\n    }\r\n\r\n    public get speechSynthesisVoiceName(): string {\r\n        return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_SynthVoice);\r\n    }\r\n\r\n    public set speechSynthesisVoiceName(voice: string) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_SynthVoice, voice);\r\n    }\r\n\r\n    public get speechSynthesisOutputFormat(): SpeechSynthesisOutputFormat {\r\n        return SpeechSynthesisOutputFormat[this.privProperties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined) as keyof typeof SpeechSynthesisOutputFormat];\r\n    }\r\n\r\n    public set speechSynthesisOutputFormat(format: SpeechSynthesisOutputFormat) {\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, SpeechSynthesisOutputFormat[format]);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport {\r\n    ForceDictationPropertyName,\r\n    OutputFormatPropertyName,\r\n    ServicePropertiesPropertyName\r\n} from \"../common.speech/Exports.js\";\r\nimport { IStringDictionary } from \"../common/Exports.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    OutputFormat,\r\n    ProfanityOption,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    SpeechConfig,\r\n    SpeechSynthesisOutputFormat,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Speech translation configuration.\r\n * @class SpeechTranslationConfig\r\n */\r\nexport abstract class SpeechTranslationConfig extends SpeechConfig {\r\n\r\n    /**\r\n     * Creates an instance of recognizer config.\r\n     */\r\n    protected constructor() {\r\n        super();\r\n    }\r\n\r\n    /**\r\n     * Static instance of SpeechTranslationConfig returned by passing a subscription key and service region.\r\n     * @member SpeechTranslationConfig.fromSubscription\r\n     * @function\r\n     * @public\r\n     * @param {string} subscriptionKey - The subscription key.\r\n     * @param {string} region - The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {SpeechTranslationConfig} The speech translation config.\r\n     */\r\n    public static fromSubscription(subscriptionKey: string, region: string): SpeechTranslationConfig {\r\n        Contracts.throwIfNullOrWhitespace(subscriptionKey, \"subscriptionKey\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const ret: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n        ret.properties.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n        ret.properties.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n        return ret;\r\n    }\r\n\r\n    /**\r\n     * Static instance of SpeechTranslationConfig returned by passing authorization token and service region.\r\n     * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n     * expires, the caller needs to refresh it by setting the property authorizationToken with a new\r\n     * valid token. Otherwise, all the recognizers created by this SpeechTranslationConfig instance\r\n     * will encounter errors during recognition.\r\n     * As configuration values are copied when creating a new recognizer, the new token value will not apply\r\n     * to recognizers that have already been created.\r\n     * For recognizers that have been created before, you need to set authorization token of the corresponding recognizer\r\n     * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\r\n     * @member SpeechTranslationConfig.fromAuthorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} authorizationToken - The authorization token.\r\n     * @param {string} region - The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {SpeechTranslationConfig} The speech translation config.\r\n     */\r\n    public static fromAuthorizationToken(authorizationToken: string, region: string): SpeechTranslationConfig {\r\n        Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const ret: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n        ret.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\r\n        ret.properties.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n        return ret;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the speech config with specified host and subscription key.\r\n     * This method is intended only for users who use a non-default service host. Standard resource path will be assumed.\r\n     * For services with a non-standard resource path or no path at all, use fromEndpoint instead.\r\n     * Note: Query parameters are not allowed in the host URI and must be set by other APIs.\r\n     * Note: To use an authorization token with fromHost, use fromHost(URL),\r\n     * and then set the AuthorizationToken property on the created SpeechConfig instance.\r\n     * Note: Added in version 1.9.0.\r\n     * @member SpeechConfig.fromHost\r\n     * @function\r\n     * @public\r\n     * @param {URL} host - The service endpoint to connect to. Format is \"protocol://host:port\" where \":port\" is optional.\r\n     * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization token must be set.\r\n     * @returns {SpeechConfig} A speech factory instance.\r\n     */\r\n    public static fromHost(hostName: URL, subscriptionKey?: string): SpeechConfig {\r\n        Contracts.throwIfNull(hostName, \"hostName\");\r\n\r\n        const speechImpl: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n        speechImpl.setProperty(PropertyId.SpeechServiceConnection_Host, hostName.protocol + \"//\" + hostName.hostname + (hostName.port === \"\" ? \"\" : \":\" + hostName.port));\r\n\r\n        if (undefined !== subscriptionKey) {\r\n            speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n        }\r\n        return speechImpl;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the speech translation config with specified endpoint and subscription key.\r\n     * This method is intended only for users who use a non-standard service endpoint or paramters.\r\n     * Note: The query properties specified in the endpoint URL are not changed, even if they are\r\n     * set by any other APIs. For example, if language is defined in the uri as query parameter\r\n     * \"language=de-DE\", and also set by the speechRecognitionLanguage property, the language\r\n     * setting in uri takes precedence, and the effective language is \"de-DE\".\r\n     * Only the properties that are not specified in the endpoint URL can be set by other APIs.\r\n     * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\r\n     * fromEndpoint method, and then set authorizationToken=\"token\" on the created SpeechConfig instance to\r\n     * use the authorization token.\r\n     * @member SpeechTranslationConfig.fromEndpoint\r\n     * @function\r\n     * @public\r\n     * @param {URL} endpoint - The service endpoint to connect to.\r\n     * @param {string} subscriptionKey - The subscription key.\r\n     * @returns {SpeechTranslationConfig} A speech config instance.\r\n     */\r\n    public static fromEndpoint(endpoint: URL, subscriptionKey: string): SpeechTranslationConfig {\r\n        Contracts.throwIfNull(endpoint, \"endpoint\");\r\n        Contracts.throwIfNull(subscriptionKey, \"subscriptionKey\");\r\n\r\n        const ret: SpeechTranslationConfigImpl = new SpeechTranslationConfigImpl();\r\n        ret.properties.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.href);\r\n        ret.properties.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n        return ret;\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token.\r\n     * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n     * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n     * @member SpeechTranslationConfig.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The authorization token.\r\n     */\r\n    public abstract set authorizationToken(value: string);\r\n\r\n    /**\r\n     * Gets/Sets the speech recognition language.\r\n     * @member SpeechTranslationConfig.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The authorization token.\r\n     */\r\n    public abstract set speechRecognitionLanguage(value: string);\r\n\r\n    /**\r\n     * Add a (text) target language to translate into.\r\n     * @member SpeechTranslationConfig.prototype.addTargetLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The language such as de-DE\r\n     */\r\n    public abstract addTargetLanguage(value: string): void;\r\n\r\n    /**\r\n     * Gets the (text) target language to translate into.\r\n     * @member SpeechTranslationConfig.prototype.targetLanguages\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The language such as de-DE\r\n     */\r\n    public abstract get targetLanguages(): string[];\r\n\r\n    /**\r\n     * Gets the selected voice name.\r\n     * @member SpeechTranslationConfig.prototype.voiceName\r\n     * @function\r\n     * @public\r\n     * @returns {string} The voice name.\r\n     */\r\n    public abstract get voiceName(): string;\r\n\r\n    /**\r\n     * Gets/Sets voice of the translated language, enable voice synthesis output.\r\n     * @member SpeechTranslationConfig.prototype.voiceName\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The name of the voice.\r\n     */\r\n    public abstract set voiceName(value: string);\r\n\r\n    /**\r\n     * Sets a named property as value\r\n     * @member SpeechTranslationConfig.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {string | PropertyId} name - The name of the property to set.\r\n     * @param {string} value - The new value of the property.\r\n     */\r\n    public abstract setProperty(name: string | PropertyId, value: string): void;\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member SpeechTranslationConfig.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract close(): void;\r\n}\r\n\r\n/**\r\n * @private\r\n * @class SpeechTranslationConfigImpl\r\n */\r\nexport class SpeechTranslationConfigImpl extends SpeechTranslationConfig {\r\n\r\n    private privSpeechProperties: PropertyCollection;\r\n\r\n    public constructor() {\r\n        super();\r\n        this.privSpeechProperties = new PropertyCollection();\r\n        this.outputFormat = OutputFormat.Simple;\r\n    }\r\n    /**\r\n     * Gets/Sets the authorization token.\r\n     * If this is set, subscription key is ignored.\r\n     * User needs to make sure the provided authorization token is valid and not expired.\r\n     * @member SpeechTranslationConfigImpl.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The authorization token.\r\n     */\r\n    public set authorizationToken(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n    }\r\n\r\n    /**\r\n     * Sets the speech recognition language.\r\n     * @member SpeechTranslationConfigImpl.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The authorization token.\r\n     */\r\n    public set speechRecognitionLanguage(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_RecoLanguage, value);\r\n    }\r\n\r\n    /**\r\n     * Gets the speech recognition language.\r\n     * @member SpeechTranslationConfigImpl.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @return {string} The speechRecognitionLanguage.\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privSpeechProperties.getProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n    }\r\n\r\n    /**\r\n     * @member SpeechTranslationConfigImpl.prototype.subscriptionKey\r\n     * @function\r\n     * @public\r\n     */\r\n    public get subscriptionKey(): string {\r\n        return this.privSpeechProperties.getProperty(PropertyId[PropertyId.SpeechServiceConnection_Key]);\r\n    }\r\n\r\n    /**\r\n     * Gets the output format\r\n     * @member SpeechTranslationConfigImpl.prototype.outputFormat\r\n     * @function\r\n     * @public\r\n     */\r\n    public get outputFormat(): OutputFormat {\r\n        // eslint-disable-next-line\r\n        return (OutputFormat as any)[this.privSpeechProperties.getProperty(OutputFormatPropertyName, undefined)];\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the output format\r\n     * @member SpeechTranslationConfigImpl.prototype.outputFormat\r\n     * @function\r\n     * @public\r\n     */\r\n    public set outputFormat(value: OutputFormat) {\r\n        this.privSpeechProperties.setProperty(OutputFormatPropertyName, OutputFormat[value]);\r\n    }\r\n\r\n    /**\r\n     * Gets the endpoint id.\r\n     * @member SpeechTranslationConfigImpl.prototype.endpointId\r\n     * @function\r\n     * @public\r\n     */\r\n    public get endpointId(): string {\r\n        return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_EndpointId);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the endpoint id.\r\n     * @member SpeechTranslationConfigImpl.prototype.endpointId\r\n     * @function\r\n     * @public\r\n     */\r\n    public set endpointId(value: string) {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_EndpointId, value);\r\n    }\r\n\r\n    /**\r\n     * Add a (text) target language to translate into.\r\n     * @member SpeechTranslationConfigImpl.prototype.addTargetLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The language such as de-DE\r\n     */\r\n    public addTargetLanguage(value: string): void {\r\n        Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n\r\n        const languages: string[] = this.targetLanguages;\r\n        if (!languages.includes(value)) {\r\n            languages.push(value);\r\n            this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, languages.join(\",\"));\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Gets the (text) target language to translate into.\r\n     * @member SpeechTranslationConfigImpl.prototype.targetLanguages\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The language such as de-DE\r\n     */\r\n    public get targetLanguages(): string[] {\r\n\r\n        if (this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined) !== undefined) {\r\n            return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages).split(\",\");\r\n        } else {\r\n            return [];\r\n        }\r\n\r\n    }\r\n\r\n    /**\r\n     * Gets the voice name.\r\n     * @member SpeechTranslationConfigImpl.prototype.voiceName\r\n     * @function\r\n     * @public\r\n     */\r\n    public get voiceName(): string {\r\n        return this.getProperty(PropertyId[PropertyId.SpeechServiceConnection_TranslationVoice]);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the voice of the translated language, enable voice synthesis output.\r\n     * @member SpeechTranslationConfigImpl.prototype.voiceName\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The name of the voice.\r\n     */\r\n    public set voiceName(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_TranslationVoice, value);\r\n    }\r\n\r\n    /**\r\n     * Provides the region.\r\n     * @member SpeechTranslationConfigImpl.prototype.region\r\n     * @function\r\n     * @public\r\n     * @returns {string} The region.\r\n     */\r\n    public get region(): string {\r\n        return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n    }\r\n\r\n    public setProxy(proxyHostName: string, proxyPort: number): void;\r\n    public setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n    public setProxy(proxyHostName: any, proxyPort: any, proxyUserName?: any, proxyPassword?: any): void {\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyHostName], proxyHostName as string);\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPort], proxyPort as string);\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyUserName], proxyUserName as string);\r\n        this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPassword], proxyPassword as string);\r\n    }\r\n\r\n    /**\r\n     * Gets an arbitrary property value.\r\n     * @member SpeechTranslationConfigImpl.prototype.getProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} name - The name of the property.\r\n     * @param {string} def - The default value of the property in case it is not set.\r\n     * @returns {string} The value of the property.\r\n     */\r\n    public getProperty(name: string, def?: string): string {\r\n        return this.privSpeechProperties.getProperty(name, def);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets an arbitrary property value.\r\n     * @member SpeechTranslationConfigImpl.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {string | PropertyId} name - The name of the property to set.\r\n     * @param {string} value - The value of the property.\r\n     */\r\n    public setProperty(name: string | PropertyId, value: string): void {\r\n        this.privSpeechProperties.setProperty(name, value);\r\n    }\r\n\r\n    /**\r\n     * Provides access to custom properties.\r\n     * @member SpeechTranslationConfigImpl.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The properties.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privSpeechProperties;\r\n    }\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member SpeechTranslationConfigImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        return;\r\n    }\r\n\r\n    public setServiceProperty(name: string, value: string): void {\r\n        const currentProperties: IStringDictionary<string> = JSON.parse(this.privSpeechProperties.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n\r\n        currentProperties[name] = value;\r\n\r\n        this.privSpeechProperties.setProperty(ServicePropertiesPropertyName, JSON.stringify(currentProperties));\r\n    }\r\n\r\n    public setProfanity(profanity: ProfanityOption): void {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceResponse_ProfanityOption, ProfanityOption[profanity]);\r\n    }\r\n\r\n    public enableAudioLogging(): void {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_EnableAudioLogging, \"true\");\r\n    }\r\n    public requestWordLevelTimestamps(): void {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"true\");\r\n    }\r\n    public enableDictation(): void {\r\n        this.privSpeechProperties.setProperty(ForceDictationPropertyName, \"true\");\r\n    }\r\n\r\n    public get speechSynthesisLanguage(): string {\r\n        return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_SynthLanguage);\r\n    }\r\n\r\n    public set speechSynthesisLanguage(language: string) {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_SynthLanguage, language);\r\n    }\r\n\r\n    public get speechSynthesisVoiceName(): string {\r\n        return this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_SynthVoice);\r\n    }\r\n\r\n    public set speechSynthesisVoiceName(voice: string) {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_SynthVoice, voice);\r\n    }\r\n\r\n    public get speechSynthesisOutputFormat(): SpeechSynthesisOutputFormat {\r\n        // eslint-disable-next-line\r\n        return (SpeechSynthesisOutputFormat as any)[this.privSpeechProperties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined)];\r\n    }\r\n\r\n    public set speechSynthesisOutputFormat(format: SpeechSynthesisOutputFormat) {\r\n        this.privSpeechProperties.setProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, SpeechSynthesisOutputFormat[format]);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyId } from \"./Exports.js\";\r\n\r\n/**\r\n * Represents collection of properties and their values.\r\n * @class PropertyCollection\r\n */\r\nexport class PropertyCollection {\r\n    private privKeys: string[] = [] as string[];\r\n    private privValues: string[] = [] as string[];\r\n\r\n    /**\r\n     * Returns the property value in type String.\r\n     * Currently only String, int and bool are allowed.\r\n     * If the name is not available, the specified defaultValue is returned.\r\n     * @member PropertyCollection.prototype.getProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} key - The parameter name.\r\n     * @param {string | number | boolean} def - The default value which is returned if the parameter\r\n     * is not available in the collection.\r\n     * @returns {string} value of the parameter.\r\n     */\r\n    public getProperty(key: PropertyId | string, def?: string | number | boolean): string {\r\n        let keyToUse: string;\r\n\r\n        if (typeof key === \"string\") {\r\n            keyToUse = key;\r\n        } else {\r\n            keyToUse = PropertyId[key];\r\n        }\r\n\r\n        for (let n = 0; n < this.privKeys.length; n++) {\r\n            if (this.privKeys[n] === keyToUse) {\r\n                return this.privValues[n];\r\n            }\r\n        }\r\n\r\n        if (def === undefined) {\r\n            return undefined;\r\n        }\r\n\r\n        return String(def);\r\n    }\r\n\r\n    /**\r\n     * Sets the String value of the parameter specified by name.\r\n     * @member PropertyCollection.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} key - The parameter name.\r\n     * @param {string} value - The value of the parameter.\r\n     */\r\n    public setProperty(key: string | PropertyId, value: string): void {\r\n        let keyToUse: string;\r\n\r\n        if (typeof key === \"string\") {\r\n            keyToUse = key;\r\n        } else {\r\n            keyToUse = PropertyId[key];\r\n        }\r\n\r\n        for (let n = 0; n < this.privKeys.length; n++) {\r\n            if (this.privKeys[n] === keyToUse) {\r\n                this.privValues[n] = value;\r\n                return;\r\n            }\r\n        }\r\n\r\n        this.privKeys.push(keyToUse);\r\n        this.privValues.push(value);\r\n    }\r\n\r\n    /**\r\n     * Clones the collection.\r\n     * @member PropertyCollection.prototype.clone\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} A copy of the collection.\r\n     */\r\n    public clone(): PropertyCollection {\r\n        const clonedMap = new PropertyCollection();\r\n\r\n        for (let n = 0; n < this.privKeys.length; n++) {\r\n            clonedMap.privKeys.push(this.privKeys[n]);\r\n            clonedMap.privValues.push(this.privValues[n]);\r\n        }\r\n\r\n        return clonedMap;\r\n    }\r\n\r\n    /**\r\n     * Merges this set of properties into another, no overwrites.\r\n     * @member PropertyCollection.prototype.mergeTo\r\n     * @function\r\n     * @public\r\n     * @param {PropertyCollection}  destinationCollection - The collection to merge into.\r\n     */\r\n    public mergeTo(destinationCollection: PropertyCollection): void {\r\n        this.privKeys.forEach((key: string | PropertyId): void => {\r\n            if (destinationCollection.getProperty(key, undefined) === undefined) {\r\n                const value = this.getProperty(key);\r\n                destinationCollection.setProperty(key, value);\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Get the keys in Property Collection.\r\n     * @member PropertyCollection.prototype.keys\r\n     * @function\r\n     * @public\r\n     * @returns {string []} Keys in the collection.\r\n     */\r\n    public get keys(): string[] {\r\n        return this.privKeys;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines speech property ids.\r\n * @class PropertyId\r\n */\r\nexport enum PropertyId {\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service subscription Key. If you are using an intent recognizer, you need to\r\n     * specify the LUIS endpoint key for your particular LUIS app. Under normal circumstances, you shouldn't\r\n     * have to use this property directly.\r\n     * Instead, use [[SpeechConfig.fromSubscription]].\r\n     * @member PropertyId.SpeechServiceConnection_Key\r\n     */\r\n    SpeechServiceConnection_Key = 0,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service endpoint (url). Under normal circumstances, you shouldn't\r\n     * have to use this property directly.\r\n     * Instead, use [[SpeechConfig.fromEndpoint]].\r\n     * NOTE: This endpoint is not the same as the endpoint used to obtain an access token.\r\n     * @member PropertyId.SpeechServiceConnection_Endpoint\r\n     */\r\n    SpeechServiceConnection_Endpoint,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service region. Under normal circumstances, you shouldn't have to\r\n     * use this property directly.\r\n     * Instead, use [[SpeechConfig.fromSubscription]], [[SpeechConfig.fromEndpoint]], [[SpeechConfig.fromAuthorizationToken]].\r\n     * @member PropertyId.SpeechServiceConnection_Region\r\n     */\r\n    SpeechServiceConnection_Region,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service authorization token (aka access token). Under normal circumstances,\r\n     * you shouldn't have to use this property directly.\r\n     * Instead, use [[SpeechConfig.fromAuthorizationToken]], [[SpeechRecognizer.authorizationToken]],\r\n     * [[IntentRecognizer.authorizationToken]], [[TranslationRecognizer.authorizationToken]], [[SpeakerRecognizer.authorizationToken]].\r\n     * @member PropertyId.SpeechServiceAuthorization_Token\r\n     */\r\n    SpeechServiceAuthorization_Token,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service authorization type. Currently unused.\r\n     * @member PropertyId.SpeechServiceAuthorization_Type\r\n     */\r\n    SpeechServiceAuthorization_Type,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service endpoint id. Under normal circumstances, you shouldn't\r\n     * have to use this property directly.\r\n     * Instead, use [[SpeechConfig.endpointId]].\r\n     * NOTE: The endpoint id is available in the Speech Portal, listed under Endpoint Details.\r\n     * @member PropertyId.SpeechServiceConnection_EndpointId\r\n     */\r\n    SpeechServiceConnection_EndpointId,\r\n\r\n    /**\r\n     * The list of comma separated languages (BCP-47 format) used as target translation languages. Under normal circumstances,\r\n     * you shouldn't have to use this property directly.\r\n     * Instead use [[SpeechTranslationConfig.addTargetLanguage]],\r\n     * [[SpeechTranslationConfig.targetLanguages]], [[TranslationRecognizer.targetLanguages]].\r\n     * @member PropertyId.SpeechServiceConnection_TranslationToLanguages\r\n     */\r\n    SpeechServiceConnection_TranslationToLanguages,\r\n\r\n    /**\r\n     * The name of the Cognitive Service Text to Speech Service Voice. Under normal circumstances, you shouldn't have to use this\r\n     * property directly.\r\n     * Instead, use [[SpeechTranslationConfig.voiceName]].\r\n     * NOTE: Valid voice names can be found <a href=\"https://aka.ms/csspeech/voicenames\">here</a>.\r\n     * @member PropertyId.SpeechServiceConnection_TranslationVoice\r\n     */\r\n    SpeechServiceConnection_TranslationVoice,\r\n\r\n    /**\r\n     * Translation features.\r\n     * @member PropertyId.SpeechServiceConnection_TranslationFeatures\r\n     */\r\n    SpeechServiceConnection_TranslationFeatures,\r\n\r\n    /**\r\n     * The Language Understanding Service Region. Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Instead, use [[LanguageUnderstandingModel]].\r\n     * @member PropertyId.SpeechServiceConnection_IntentRegion\r\n     */\r\n    SpeechServiceConnection_IntentRegion,\r\n\r\n    /**\r\n     * The host name of the proxy server used to connect to the Cognitive Services Speech Service. Only relevant in Node.js environments.\r\n     * You shouldn't have to use this property directly.\r\n     * Instead use <see cref=\"SpeechConfig.SetProxy(string,int,string,string)\"/>.\r\n     * Added in version 1.4.0.\r\n     */\r\n    SpeechServiceConnection_ProxyHostName,\r\n\r\n    /**\r\n     * The port of the proxy server used to connect to the Cognitive Services Speech Service. Only relevant in Node.js environments.\r\n     * You shouldn't have to use this property directly.\r\n     * Instead use <see cref=\"SpeechConfig.SetProxy(string,int,string,string)\"/>.\r\n     * Added in version 1.4.0.\r\n     */\r\n    SpeechServiceConnection_ProxyPort,\r\n\r\n    /**\r\n     * The user name of the proxy server used to connect to the Cognitive Services Speech Service. Only relevant in Node.js environments.\r\n     * You shouldn't have to use this property directly.\r\n     * Instead use <see cref=\"SpeechConfig.SetProxy(string,int,string,string)\"/>.\r\n     * Added in version 1.4.0.\r\n     */\r\n    SpeechServiceConnection_ProxyUserName,\r\n\r\n    /**\r\n     * The password of the proxy server used to connect to the Cognitive Services Speech Service. Only relevant in Node.js environments.\r\n     * You shouldn't have to use this property directly.\r\n     * Instead use <see cref=\"SpeechConfig.SetProxy(string,int,string,string)\"/>.\r\n     * Added in version 1.4.0.\r\n     */\r\n    SpeechServiceConnection_ProxyPassword,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service recognition Mode. Can be \"INTERACTIVE\", \"CONVERSATION\", \"DICTATION\".\r\n     * This property is intended to be read-only. The SDK is using it internally.\r\n     * @member PropertyId.SpeechServiceConnection_RecoMode\r\n     */\r\n    SpeechServiceConnection_RecoMode,\r\n\r\n    /**\r\n     * The spoken language to be recognized (in BCP-47 format). Under normal circumstances, you shouldn't have to use this property\r\n     * directly.\r\n     * Instead, use [[SpeechConfig.speechRecognitionLanguage]].\r\n     * @member PropertyId.SpeechServiceConnection_RecoLanguage\r\n     */\r\n    SpeechServiceConnection_RecoLanguage,\r\n\r\n    /**\r\n     * The session id. This id is a universally unique identifier (aka UUID) representing a specific binding of an audio input stream\r\n     * and the underlying speech recognition instance to which it is bound. Under normal circumstances, you shouldn't have to use this\r\n     * property directly.\r\n     * Instead use [[SessionEventArgs.sessionId]].\r\n     * @member PropertyId.Speech_SessionId\r\n     */\r\n    Speech_SessionId,\r\n\r\n    /**\r\n     * The spoken language to be synthesized (e.g. en-US)\r\n     * @member PropertyId.SpeechServiceConnection_SynthLanguage\r\n     */\r\n    SpeechServiceConnection_SynthLanguage,\r\n\r\n    /**\r\n     * The name of the TTS voice to be used for speech synthesis\r\n     * @member PropertyId.SpeechServiceConnection_SynthVoice\r\n     */\r\n    SpeechServiceConnection_SynthVoice,\r\n\r\n    /**\r\n     * The string to specify TTS output audio format\r\n     * @member PropertyId.SpeechServiceConnection_SynthOutputFormat\r\n     */\r\n    SpeechServiceConnection_SynthOutputFormat,\r\n\r\n    /**\r\n     * The list of comma separated languages used as possible source languages\r\n     * Added in version 1.13.0\r\n     * @member PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages\r\n     */\r\n    SpeechServiceConnection_AutoDetectSourceLanguages,\r\n\r\n    /**\r\n     * The requested Cognitive Services Speech Service response output format (simple or detailed). Under normal circumstances, you shouldn't have\r\n     * to use this property directly.\r\n     * Instead use [[SpeechConfig.outputFormat]].\r\n     * @member PropertyId.SpeechServiceResponse_RequestDetailedResultTrueFalse\r\n     */\r\n    SpeechServiceResponse_RequestDetailedResultTrueFalse,\r\n\r\n    /**\r\n     * The requested Cognitive Services Speech Service response output profanity level. Currently unused.\r\n     * @member PropertyId.SpeechServiceResponse_RequestProfanityFilterTrueFalse\r\n     */\r\n    SpeechServiceResponse_RequestProfanityFilterTrueFalse,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service response output (in JSON format). This property is available on recognition result objects only.\r\n     * @member PropertyId.SpeechServiceResponse_JsonResult\r\n     */\r\n    SpeechServiceResponse_JsonResult,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service error details (in JSON format). Under normal circumstances, you shouldn't have to\r\n     * use this property directly. Instead use [[CancellationDetails.errorDetails]].\r\n     * @member PropertyId.SpeechServiceResponse_JsonErrorDetails\r\n     */\r\n    SpeechServiceResponse_JsonErrorDetails,\r\n\r\n    /**\r\n     * The cancellation reason. Currently unused.\r\n     * @member PropertyId.CancellationDetails_Reason\r\n     */\r\n    CancellationDetails_Reason,\r\n\r\n    /**\r\n     * The cancellation text. Currently unused.\r\n     * @member PropertyId.CancellationDetails_ReasonText\r\n     */\r\n    CancellationDetails_ReasonText,\r\n\r\n    /**\r\n     * The Cancellation detailed text. Currently unused.\r\n     * @member PropertyId.CancellationDetails_ReasonDetailedText\r\n     */\r\n    CancellationDetails_ReasonDetailedText,\r\n\r\n    /**\r\n     * The Language Understanding Service response output (in JSON format). Available via [[IntentRecognitionResult]]\r\n     * @member PropertyId.LanguageUnderstandingServiceResponse_JsonResult\r\n     */\r\n    LanguageUnderstandingServiceResponse_JsonResult,\r\n\r\n    /**\r\n     * The URL string built from speech configuration.\r\n     * This property is intended to be read-only. The SDK is using it internally.\r\n     * NOTE: Added in version 1.7.0.\r\n     */\r\n    SpeechServiceConnection_Url,\r\n\r\n    /**\r\n     * The initial silence timeout value (in milliseconds) used by the service.\r\n     * Added in version 1.7.0\r\n     */\r\n    SpeechServiceConnection_InitialSilenceTimeoutMs,\r\n\r\n    /**\r\n     * The end silence timeout value (in milliseconds) used by the service.\r\n     * Added in version 1.7.0\r\n     */\r\n    SpeechServiceConnection_EndSilenceTimeoutMs,\r\n\r\n    /**\r\n     * A duration of detected silence, measured in milliseconds, after which speech-to-text will determine a spoken\r\n     * phrase has ended and generate a final Recognized result. Configuring this timeout may be helpful in situations\r\n     * where spoken input is significantly faster or slower than usual and default segmentation behavior consistently\r\n     * yields results that are too long or too short. Segmentation timeout values that are inappropriately high or low\r\n     * can negatively affect speech-to-text accuracy; this property should be carefully configured and the resulting\r\n     * behavior should be thoroughly validated as intended.\r\n     *\r\n     * For more information about timeout configuration that includes discussion of default behaviors, please visit\r\n     * https://aka.ms/csspeech/timeouts.\r\n     *\r\n     * Added in version 1.21.0.\r\n     */\r\n    Speech_SegmentationSilenceTimeoutMs,\r\n\r\n    /**\r\n     * A boolean value specifying whether audio logging is enabled in the service or not.\r\n     * Audio and content logs are stored either in Microsoft-owned storage, or in your own storage account linked\r\n     * to your Cognitive Services subscription (Bring Your Own Storage (BYOS) enabled Speech resource).\r\n     * The logs will be removed after 30 days.\r\n     * Added in version 1.7.0\r\n     */\r\n    SpeechServiceConnection_EnableAudioLogging,\r\n\r\n    /**\r\n     * The speech service connection language identifier mode.\r\n     * Can be \"AtStart\" (the default), or \"Continuous\". See Language\r\n     * Identification document https://aka.ms/speech/lid?pivots=programming-language-javascript\r\n     * for more details.\r\n     * Added in 1.25.0\r\n     **/\r\n    SpeechServiceConnection_LanguageIdMode,\r\n\r\n    /**\r\n     * A string value representing the desired endpoint version to target for Speech Recognition.\r\n     * Added in version 1.21.0\r\n     */\r\n    SpeechServiceConnection_RecognitionEndpointVersion,\r\n\r\n    /**\r\n    /**\r\n     * A string value the current speaker recognition scenario/mode (TextIndependentIdentification, etc.).\r\n     * Added in version 1.23.0\r\n     */\r\n    SpeechServiceConnection_SpeakerIdMode,\r\n\r\n    /**\r\n     * The requested Cognitive Services Speech Service response output profanity setting.\r\n     * Allowed values are \"masked\", \"removed\", and \"raw\".\r\n     * Added in version 1.7.0.\r\n     */\r\n    SpeechServiceResponse_ProfanityOption,\r\n\r\n    /**\r\n     * A string value specifying which post processing option should be used by service.\r\n     * Allowed values are \"TrueText\".\r\n     * Added in version 1.7.0\r\n     */\r\n    SpeechServiceResponse_PostProcessingOption,\r\n\r\n    /**\r\n     * A boolean value specifying whether to include word-level timestamps in the response result.\r\n     * Added in version 1.7.0\r\n     */\r\n    SpeechServiceResponse_RequestWordLevelTimestamps,\r\n\r\n    /**\r\n     * The number of times a word has to be in partial results to be returned.\r\n     * Added in version 1.7.0\r\n     */\r\n    SpeechServiceResponse_StablePartialResultThreshold,\r\n\r\n    /**\r\n     * A string value specifying the output format option in the response result. Internal use only.\r\n     * Added in version 1.7.0.\r\n     */\r\n    SpeechServiceResponse_OutputFormatOption,\r\n\r\n    /**\r\n     * A boolean value to request for stabilizing translation partial results by omitting words in the end.\r\n     * Added in version 1.7.0.\r\n     */\r\n    SpeechServiceResponse_TranslationRequestStablePartialResult,\r\n\r\n    /**\r\n     * A boolean value specifying whether to request WordBoundary events.\r\n     * @member PropertyId.SpeechServiceResponse_RequestWordBoundary\r\n     * Added in version 1.21.0.\r\n     */\r\n    SpeechServiceResponse_RequestWordBoundary,\r\n\r\n    /**\r\n     * A boolean value specifying whether to request punctuation boundary in WordBoundary Events. Default is true.\r\n     * @member PropertyId.SpeechServiceResponse_RequestPunctuationBoundary\r\n     * Added in version 1.21.0.\r\n     */\r\n    SpeechServiceResponse_RequestPunctuationBoundary,\r\n\r\n    /**\r\n     * A boolean value specifying whether to request sentence boundary in WordBoundary Events. Default is false.\r\n     * @member PropertyId.SpeechServiceResponse_RequestSentenceBoundary\r\n     * Added in version 1.21.0.\r\n     */\r\n    SpeechServiceResponse_RequestSentenceBoundary,\r\n\r\n    /**\r\n     * Identifier used to connect to the backend service.\r\n     * @member PropertyId.Conversation_ApplicationId\r\n     */\r\n    Conversation_ApplicationId,\r\n\r\n    /**\r\n     * Type of dialog backend to connect to.\r\n     * @member PropertyId.Conversation_DialogType\r\n     */\r\n    Conversation_DialogType,\r\n\r\n    /**\r\n     * Silence timeout for listening\r\n     * @member PropertyId.Conversation_Initial_Silence_Timeout\r\n     */\r\n    Conversation_Initial_Silence_Timeout,\r\n\r\n    /**\r\n     * From Id to add to speech recognition activities.\r\n     * @member PropertyId.Conversation_From_Id\r\n     */\r\n    Conversation_From_Id,\r\n\r\n    /**\r\n     * ConversationId for the session.\r\n     * @member PropertyId.Conversation_Conversation_Id\r\n     */\r\n    Conversation_Conversation_Id,\r\n\r\n    /**\r\n     * Comma separated list of custom voice deployment ids.\r\n     * @member PropertyId.Conversation_Custom_Voice_Deployment_Ids\r\n     */\r\n    Conversation_Custom_Voice_Deployment_Ids,\r\n\r\n    /**\r\n     * Speech activity template, stamp properties from the template on the activity generated by the service for speech.\r\n     * @member PropertyId.Conversation_Speech_Activity_Template\r\n     * Added in version 1.10.0.\r\n     */\r\n    Conversation_Speech_Activity_Template,\r\n\r\n    /**\r\n     * Enables or disables the receipt of turn status messages as obtained on the turnStatusReceived event.\r\n     * @member PropertyId.Conversation_Request_Bot_Status_Messages\r\n     * Added in version 1.15.0.\r\n     */\r\n    Conversation_Request_Bot_Status_Messages,\r\n\r\n    /**\r\n     * Specifies the connection ID to be provided in the Agent configuration message, e.g. a Direct Line token for\r\n     * channel authentication.\r\n     * Added in version 1.15.1.\r\n     */\r\n    Conversation_Agent_Connection_Id,\r\n\r\n    /**\r\n     * The Cognitive Services Speech Service host (url). Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Instead, use [[SpeechConfig.fromHost]].\r\n     */\r\n    SpeechServiceConnection_Host,\r\n\r\n    /**\r\n     * Set the host for service calls to the Conversation Translator REST management and websocket calls.\r\n     */\r\n    ConversationTranslator_Host,\r\n\r\n    /**\r\n     * Optionally set the the host's display name.\r\n     * Used when joining a conversation.\r\n     */\r\n    ConversationTranslator_Name,\r\n\r\n    /**\r\n     * Optionally set a value for the X-CorrelationId request header.\r\n     * Used for troubleshooting errors in the server logs. It should be a valid guid.\r\n     */\r\n    ConversationTranslator_CorrelationId,\r\n\r\n    /**\r\n     * Set the conversation token to be sent to the speech service. This enables the\r\n     * service to service call from the speech service to the Conversation Translator service for relaying\r\n     * recognitions. For internal use.\r\n     */\r\n    ConversationTranslator_Token,\r\n\r\n    /**\r\n     * The reference text of the audio for pronunciation evaluation.\r\n     * For this and the following pronunciation assessment parameters, see\r\n     * https://docs.microsoft.com/azure/cognitive-services/speech-service/rest-speech-to-text#pronunciation-assessment-parameters for details.\r\n     * Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Added in version 1.15.0\r\n     */\r\n    PronunciationAssessment_ReferenceText,\r\n\r\n    /**\r\n     * The point system for pronunciation score calibration (FivePoint or HundredMark).\r\n     * Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Added in version 1.15.0\r\n     */\r\n    PronunciationAssessment_GradingSystem,\r\n\r\n    /**\r\n     * The pronunciation evaluation granularity (Phoneme, Word, or FullText).\r\n     * Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Added in version 1.15.0\r\n     */\r\n    PronunciationAssessment_Granularity,\r\n\r\n    /**\r\n     * Defines if enable miscue calculation.\r\n     * With this enabled, the pronounced words will be compared to the reference text,\r\n     * and will be marked with omission/insertion based on the comparison. The default setting is False.\r\n     * Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Added in version 1.15.0\r\n     */\r\n    PronunciationAssessment_EnableMiscue,\r\n\r\n    /**\r\n     * The json string of pronunciation assessment parameters\r\n     * Under normal circumstances, you shouldn't have to use this property directly.\r\n     * Added in version 1.15.0\r\n     */\r\n    PronunciationAssessment_Json,\r\n\r\n    /**\r\n     * Pronunciation assessment parameters.\r\n     * This property is intended to be read-only. The SDK is using it internally.\r\n     * Added in version 1.15.0\r\n     */\r\n    PronunciationAssessment_Params,\r\n\r\n    /**\r\n     * Version of Speaker Recognition API to use.\r\n     * Added in version 1.18.0\r\n     */\r\n    SpeakerRecognition_Api_Version,\r\n\r\n    /**\r\n     * Specifies whether to allow load of data URL for web worker\r\n     * Allowed values are \"off\" and \"on\". Default is \"on\".\r\n     * Added in version 1.32.0\r\n     */\r\n    WebWorkerLoadType,\r\n\r\n    /**\r\n     * Talking avatar service WebRTC session description protocol.\r\n     * This property is intended to be read-only. The SDK is using it internally.\r\n     * Added in version 1.33.0\r\n     */\r\n    TalkingAvatarService_WebRTC_SDP,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CognitiveSubscriptionKeyAuthentication,\r\n    CognitiveTokenAuthentication,\r\n    Context,\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    OS,\r\n    RecognitionMode,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechServiceConfig,\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    Deferred,\r\n    marshalPromiseToCallbacks\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    Contracts\r\n} from \"./Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    RecognitionEventArgs,\r\n    SessionEventArgs,\r\n    SpeechRecognitionResult,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Defines the base class Recognizer which mainly contains common event handlers.\r\n * @class Recognizer\r\n */\r\nexport abstract class Recognizer {\r\n    private privDisposed: boolean;\r\n    protected audioConfig: AudioConfig;\r\n    protected privReco: ServiceRecognizerBase;\r\n    protected privProperties: PropertyCollection;\r\n    private privConnectionFactory: IConnectionFactory;\r\n\r\n    /**\r\n     * Creates and initializes an instance of a Recognizer\r\n     * @constructor\r\n     * @param {AudioConfig} audioInput - An optional audio input stream associated with the recognizer\r\n     * @param {PropertyCollection} properties - A set of properties to set on the recognizer\r\n     * @param {IConnectionFactory} connectionFactory - The factory class used to create a custom IConnection for the recognizer\r\n     */\r\n    protected constructor(audioConfig: AudioConfig, properties: PropertyCollection, connectionFactory: IConnectionFactory) {\r\n        this.audioConfig = (audioConfig !== undefined) ? audioConfig : AudioConfig.fromDefaultMicrophoneInput();\r\n        this.privDisposed = false;\r\n        this.privProperties = properties.clone();\r\n        this.privConnectionFactory = connectionFactory;\r\n        this.implCommonRecognizerSetup();\r\n    }\r\n\r\n    /**\r\n     * Defines event handler for session started events.\r\n     * @member Recognizer.prototype.sessionStarted\r\n     * @function\r\n     * @public\r\n     */\r\n    public sessionStarted: (sender: Recognizer, event: SessionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for session stopped events.\r\n     * @member Recognizer.prototype.sessionStopped\r\n     * @function\r\n     * @public\r\n     */\r\n    public sessionStopped: (sender: Recognizer, event: SessionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for speech started events.\r\n     * @member Recognizer.prototype.speechStartDetected\r\n     * @function\r\n     * @public\r\n     */\r\n    public speechStartDetected: (sender: Recognizer, event: RecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for speech stopped events.\r\n     * @member Recognizer.prototype.speechEndDetected\r\n     * @function\r\n     * @public\r\n     */\r\n    public speechEndDetected: (sender: Recognizer, event: RecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member Recognizer.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, errorCb?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\r\n    }\r\n\r\n    /**\r\n     * @Internal\r\n     * Internal data member to support fromRecognizer* pattern methods on other classes.\r\n     * Do not use externally, object returned will change without warning or notice.\r\n     */\r\n    public get internalData(): object {\r\n        return this.privReco;\r\n    }\r\n\r\n    /**\r\n     * This method performs cleanup of resources.\r\n     * The Boolean parameter disposing indicates whether the method is called\r\n     * from Dispose (if disposing is true) or from the finalizer (if disposing is false).\r\n     * Derived classes should override this method to dispose resource if needed.\r\n     * @member Recognizer.prototype.dispose\r\n     * @function\r\n     * @public\r\n     * @param {boolean} disposing - Flag to request disposal.\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposed) {\r\n            return;\r\n        }\r\n\r\n        this.privDisposed = true;\r\n\r\n        if (disposing) {\r\n            if (this.privReco) {\r\n                await this.privReco.audioSource.turnOff();\r\n                await this.privReco.dispose();\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * This method returns the current state of the telemetry setting.\r\n     * @member Recognizer.prototype.telemetryEnabled\r\n     * @function\r\n     * @public\r\n     * @returns true if the telemetry is enabled, false otherwise.\r\n     */\r\n    public static get telemetryEnabled(): boolean {\r\n        return ServiceRecognizerBase.telemetryDataEnabled;\r\n    }\r\n\r\n    /**\r\n     * This method globally enables or disables telemetry.\r\n     * @member Recognizer.prototype.enableTelemetry\r\n     * @function\r\n     * @public\r\n     * @param enabled - Global setting for telemetry collection.\r\n     * If set to true, telemetry information like microphone errors,\r\n     * recognition errors are collected and sent to Microsoft.\r\n     * If set to false, no telemetry is sent to Microsoft.\r\n     */\r\n    public static enableTelemetry(enabled: boolean): void {\r\n        ServiceRecognizerBase.telemetryDataEnabled = enabled;\r\n    }\r\n\r\n    //\r\n    // ################################################################################################################\r\n    // IMPLEMENTATION.\r\n    // Move to independent class\r\n    // ################################################################################################################\r\n    //\r\n    protected abstract createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig;\r\n\r\n    // Creates the correct service recognizer for the type\r\n    protected abstract createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase;\r\n\r\n    // Does the generic recognizer setup that is common across all recognizer types.\r\n    protected implCommonRecognizerSetup(): void {\r\n\r\n        let osPlatform = (typeof window !== \"undefined\") ? \"Browser\" : \"Node\";\r\n        let osName = \"unknown\";\r\n        let osVersion = \"unknown\";\r\n\r\n        if (typeof navigator !== \"undefined\") {\r\n            osPlatform = osPlatform + \"/\" + navigator.platform;\r\n            osName = navigator.userAgent;\r\n            osVersion = navigator.appVersion;\r\n        }\r\n\r\n        const recognizerConfig = this.createRecognizerConfig(\r\n            new SpeechServiceConfig(\r\n                new Context(new OS(osPlatform, osName, osVersion))));\r\n\r\n        this.privReco = this.createServiceRecognizer(\r\n            Recognizer.getAuthFromProperties(this.privProperties),\r\n            this.privConnectionFactory,\r\n            this.audioConfig,\r\n            recognizerConfig);\r\n    }\r\n\r\n    protected async recognizeOnceAsyncImpl(recognitionMode: RecognitionMode): Promise<SpeechRecognitionResult> {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n        const ret: Deferred<SpeechRecognitionResult> = new Deferred<SpeechRecognitionResult>();\r\n\r\n        await this.implRecognizerStop();\r\n        await this.privReco.recognize(recognitionMode, ret.resolve, ret.reject);\r\n        const result: SpeechRecognitionResult = await ret.promise;\r\n        await this.implRecognizerStop();\r\n\r\n        return result;\r\n\r\n    }\r\n\r\n    protected async startContinuousRecognitionAsyncImpl(recognitionMode: RecognitionMode): Promise<void> {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n\r\n        await this.implRecognizerStop();\r\n        await this.privReco.recognize(recognitionMode, undefined, undefined);\r\n    }\r\n\r\n    protected async stopContinuousRecognitionAsyncImpl(): Promise<void> {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n        await this.implRecognizerStop();\r\n    }\r\n\r\n    protected async implRecognizerStop(): Promise<void> {\r\n        if (this.privReco) {\r\n            await this.privReco.stopRecognizing();\r\n        }\r\n        return;\r\n    }\r\n\r\n    protected static getAuthFromProperties(properties: PropertyCollection): IAuthentication {\r\n        const subscriptionKey = properties.getProperty(PropertyId.SpeechServiceConnection_Key, undefined);\r\n        const authentication = (subscriptionKey && subscriptionKey !== \"\") ?\r\n            new CognitiveSubscriptionKeyAuthentication(subscriptionKey) :\r\n            new CognitiveTokenAuthentication(\r\n                (): Promise<string> => {\r\n                    const authorizationToken = properties.getProperty(PropertyId.SpeechServiceAuthorization_Token, undefined);\r\n                    return Promise.resolve(authorizationToken);\r\n                },\r\n                (): Promise<string> => {\r\n                    const authorizationToken = properties.getProperty(PropertyId.SpeechServiceAuthorization_Token, undefined);\r\n                    return Promise.resolve(authorizationToken);\r\n                });\r\n\r\n        return authentication;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    OutputFormatPropertyName,\r\n    RecognitionMode,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechConnectionFactory,\r\n    SpeechServiceConfig,\r\n    SpeechServiceRecognizer,\r\n} from \"../common.speech/Exports.js\";\r\nimport { marshalPromiseToCallbacks } from \"../common/Exports.js\";\r\nimport { AudioConfigImpl } from \"./Audio/AudioConfig.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    AutoDetectSourceLanguageConfig,\r\n    KeywordRecognitionModel,\r\n    OutputFormat,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    SpeechRecognitionCanceledEventArgs,\r\n    SpeechRecognitionEventArgs,\r\n    SpeechRecognitionResult,\r\n} from \"./Exports.js\";\r\nimport { SpeechConfig, SpeechConfigImpl } from \"./SpeechConfig.js\";\r\n\r\n/**\r\n * Performs speech recognition from microphone, file, or other audio input streams, and gets transcribed text as result.\r\n * @class SpeechRecognizer\r\n */\r\nexport class SpeechRecognizer extends Recognizer {\r\n    private privDisposedRecognizer: boolean;\r\n\r\n    /**\r\n     * SpeechRecognizer constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - an set of initial properties for this recognizer\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n     */\r\n    public constructor(speechConfig: SpeechConfig, audioConfig?: AudioConfig) {\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        Contracts.throwIfNull(speechConfigImpl, \"speechConfig\");\r\n\r\n        Contracts.throwIfNullOrWhitespace(\r\n            speechConfigImpl.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage),\r\n            PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n\r\n        super(audioConfig, speechConfigImpl.properties, new SpeechConnectionFactory());\r\n        this.privDisposedRecognizer = false;\r\n    }\r\n\r\n    /**\r\n     * SpeechRecognizer constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - an set of initial properties for this recognizer\r\n     * @param {AutoDetectSourceLanguageConfig} autoDetectSourceLanguageConfig - An source language detection configuration associated with the recognizer\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n     */\r\n    public static FromConfig(speechConfig: SpeechConfig, autoDetectSourceLanguageConfig: AutoDetectSourceLanguageConfig, audioConfig?: AudioConfig): SpeechRecognizer {\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        autoDetectSourceLanguageConfig.properties.mergeTo(speechConfigImpl.properties);\r\n        const recognizer = new SpeechRecognizer(speechConfig, audioConfig);\r\n        return recognizer;\r\n    }\r\n\r\n    /**\r\n     * The event recognizing signals that an intermediate recognition result is received.\r\n     * @member SpeechRecognizer.prototype.recognizing\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognizing: (sender: Recognizer, event: SpeechRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event recognized signals that a final recognition result is received.\r\n     * @member SpeechRecognizer.prototype.recognized\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognized: (sender: Recognizer, event: SpeechRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during recognition.\r\n     * @member SpeechRecognizer.prototype.canceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public canceled: (sender: Recognizer, event: SpeechRecognitionCanceledEventArgs) => void;\r\n\r\n    /**\r\n     * Gets the endpoint id of a customized speech model that is used for speech recognition.\r\n     * @member SpeechRecognizer.prototype.endpointId\r\n     * @function\r\n     * @public\r\n     * @returns {string} the endpoint id of a customized speech model that is used for speech recognition.\r\n     */\r\n    public get endpointId(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_EndpointId, \"00000000-0000-0000-0000-000000000000\");\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member SpeechRecognizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * @member SpeechRecognizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} token - Authorization token.\r\n     */\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    /**\r\n     * Gets the spoken language of recognition.\r\n     * @member SpeechRecognizer.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {string} The spoken language of recognition.\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    /**\r\n     * Gets the output format of recognition.\r\n     * @member SpeechRecognizer.prototype.outputFormat\r\n     * @function\r\n     * @public\r\n     * @returns {OutputFormat} The output format of recognition.\r\n     */\r\n    public get outputFormat(): OutputFormat {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        if (this.properties.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]) === OutputFormat[OutputFormat.Simple]) {\r\n            return OutputFormat.Simple;\r\n        } else {\r\n            return OutputFormat.Detailed;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this SpeechRecognizer.\r\n     * @member SpeechRecognizer.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this SpeechRecognizer.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Starts speech recognition, and stops after the first utterance is recognized.\r\n     * The task returns the recognition text as result.\r\n     * Note: RecognizeOnceAsync() returns when the first utterance has been recognized,\r\n     * so it is suitable only for single shot recognition\r\n     * like command or query. For long-running recognition, use StartContinuousRecognitionAsync() instead.\r\n     * @member SpeechRecognizer.prototype.recognizeOnceAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback that received the SpeechRecognitionResult.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public recognizeOnceAsync(cb?: (e: SpeechRecognitionResult) => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.recognizeOnceAsyncImpl(RecognitionMode.Interactive), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Starts speech recognition, until stopContinuousRecognitionAsync() is called.\r\n     * User must subscribe to events to receive recognition results.\r\n     * @member SpeechRecognizer.prototype.startContinuousRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the recognition has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(RecognitionMode.Conversation), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Stops continuous speech recognition.\r\n     * @member SpeechRecognizer.prototype.stopContinuousRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the recognition has stopped.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public stopContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Starts speech recognition with keyword spotting, until\r\n     * stopKeywordRecognitionAsync() is called.\r\n     * User must subscribe to events to receive recognition results.\r\n     * Note: Key word spotting functionality is only available on the\r\n     * Speech Devices SDK. This functionality is currently not included in the SDK itself.\r\n     * @member SpeechRecognizer.prototype.startKeywordRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param {KeywordRecognitionModel} model The keyword recognition model that\r\n     * specifies the keyword to be recognized.\r\n     * @param cb - Callback invoked once the recognition has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public startKeywordRecognitionAsync(model: KeywordRecognitionModel, cb?: () => void, err?: (e: string) => void): void {\r\n        Contracts.throwIfNull(model, \"model\");\r\n\r\n        if (!!err) {\r\n            err(\"Not yet implemented.\");\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Stops continuous speech recognition.\r\n     * Note: Key word spotting functionality is only available on the\r\n     * Speech Devices SDK. This functionality is currently not included in the SDK itself.\r\n     * @member SpeechRecognizer.prototype.stopKeywordRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the recognition has stopped.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public stopKeywordRecognitionAsync(cb?: () => void): void {\r\n        if (!!cb) {\r\n            cb();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * closes all external resources held by an instance of this class.\r\n     * @member SpeechRecognizer.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, errorCb?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\r\n    }\r\n\r\n    /**\r\n     * Disposes any resources held by the object.\r\n     * @member SpeechRecognizer.prototype.dispose\r\n     * @function\r\n     * @public\r\n     * @param {boolean} disposing - true if disposing the object.\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedRecognizer) {\r\n            return;\r\n        }\r\n\r\n        if (disposing) {\r\n            this.privDisposedRecognizer = true;\r\n            await this.implRecognizerStop();\r\n        }\r\n\r\n        await super.dispose(disposing);\r\n    }\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.privProperties);\r\n    }\r\n\r\n    protected createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n        const configImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        return new SpeechServiceRecognizer(authentication, connectionFactory, configImpl, recognizerConfig, this);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    AddedLmIntent,\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    IntentConnectionFactory,\r\n    IntentServiceRecognizer,\r\n    RecognitionMode,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechServiceConfig\r\n} from \"../common.speech/Exports.js\";\r\nimport { marshalPromiseToCallbacks } from \"../common/Exports.js\";\r\nimport { AudioConfigImpl } from \"./Audio/AudioConfig.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    IntentRecognitionCanceledEventArgs,\r\n    IntentRecognitionEventArgs,\r\n    IntentRecognitionResult,\r\n    KeywordRecognitionModel,\r\n    LanguageUnderstandingModel,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    SpeechConfig,\r\n} from \"./Exports.js\";\r\nimport { LanguageUnderstandingModelImpl } from \"./LanguageUnderstandingModel.js\";\r\nimport { SpeechConfigImpl } from \"./SpeechConfig.js\";\r\n\r\n/**\r\n * Intent recognizer.\r\n * @class\r\n */\r\nexport class IntentRecognizer extends Recognizer {\r\n    private privDisposedIntentRecognizer: boolean;\r\n    private privAddedIntents: string[][];\r\n    private privAddedLmIntents: { [id: string]: AddedLmIntent };\r\n    private privUmbrellaIntent: AddedLmIntent;\r\n\r\n    /**\r\n     * Initializes an instance of the IntentRecognizer.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - The set of configuration properties.\r\n     * @param {AudioConfig} audioConfig - An optional audio input config associated with the recognizer\r\n     */\r\n    public constructor(speechConfig: SpeechConfig, audioConfig?: AudioConfig) {\r\n        Contracts.throwIfNullOrUndefined(speechConfig, \"speechConfig\");\r\n        const configImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        Contracts.throwIfNullOrUndefined(configImpl, \"speechConfig\");\r\n\r\n        super(audioConfig, configImpl.properties, new IntentConnectionFactory());\r\n        this.privAddedIntents = [];\r\n        this.privAddedLmIntents = {};\r\n\r\n        this.privDisposedIntentRecognizer = false;\r\n        this.privProperties = configImpl.properties;\r\n\r\n        Contracts.throwIfNullOrWhitespace(this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage), PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n    }\r\n\r\n    /**\r\n     * The event recognizing signals that an intermediate recognition result is received.\r\n     * @member IntentRecognizer.prototype.recognizing\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognizing: (sender: IntentRecognizer, event: IntentRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event recognized signals that a final recognition result is received.\r\n     * @member IntentRecognizer.prototype.recognized\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognized: (sender: IntentRecognizer, event: IntentRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during recognition.\r\n     * @member IntentRecognizer.prototype.canceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public canceled: (sender: IntentRecognizer, event: IntentRecognitionCanceledEventArgs) => void;\r\n\r\n    /**\r\n     * Gets the spoken language of recognition.\r\n     * @member IntentRecognizer.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {string} the spoken language of recognition.\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedIntentRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member IntentRecognizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * Note: Please use a token derived from your LanguageUnderstanding subscription key for the Intent recognizer.\r\n     * @member IntentRecognizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} value - Authorization token.\r\n     */\r\n    public set authorizationToken(value: string) {\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this IntentRecognizer.\r\n     * @member IntentRecognizer.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their\r\n     * values defined for this IntentRecognizer.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Starts intent recognition, and stops after the first utterance is recognized.\r\n     * The task returns the recognition text and intent as result.\r\n     * Note: RecognizeOnceAsync() returns when the first utterance has been recognized,\r\n     * so it is suitable only for single shot recognition like command or query.\r\n     * For long-running recognition, use StartContinuousRecognitionAsync() instead.\r\n     * @member IntentRecognizer.prototype.recognizeOnceAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback that received the recognition has finished with an IntentRecognitionResult.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public recognizeOnceAsync(cb?: (e: IntentRecognitionResult) => void, err?: (e: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposedIntentRecognizer);\r\n\r\n        if (Object.keys(this.privAddedLmIntents).length !== 0 || undefined !== this.privUmbrellaIntent) {\r\n            const context: IIntentContext = this.buildSpeechContext();\r\n\r\n            this.privReco.speechContext.setSection(\"intent\", context.Intent);\r\n            this.privReco.dynamicGrammar.addReferenceGrammar(context.ReferenceGrammars);\r\n\r\n            const intentReco: IntentServiceRecognizer = this.privReco as IntentServiceRecognizer;\r\n            intentReco.setIntents(this.privAddedLmIntents, this.privUmbrellaIntent);\r\n        }\r\n\r\n        marshalPromiseToCallbacks(this.recognizeOnceAsyncImpl(RecognitionMode.Interactive), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Starts speech recognition, until stopContinuousRecognitionAsync() is called.\r\n     * User must subscribe to events to receive recognition results.\r\n     * @member IntentRecognizer.prototype.startContinuousRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the recognition has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        if (Object.keys(this.privAddedLmIntents).length !== 0 || undefined !== this.privUmbrellaIntent) {\r\n            const context: IIntentContext = this.buildSpeechContext();\r\n\r\n            this.privReco.speechContext.setSection(\"intent\", context.Intent);\r\n            this.privReco.dynamicGrammar.addReferenceGrammar(context.ReferenceGrammars);\r\n\r\n            const intentReco: IntentServiceRecognizer = this.privReco as IntentServiceRecognizer;\r\n            intentReco.setIntents(this.privAddedLmIntents, this.privUmbrellaIntent);\r\n        }\r\n\r\n        marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(RecognitionMode.Conversation), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Stops continuous intent recognition.\r\n     * @member IntentRecognizer.prototype.stopContinuousRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the recognition has stopped.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public stopContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Starts speech recognition with keyword spotting, until stopKeywordRecognitionAsync() is called.\r\n     * User must subscribe to events to receive recognition results.\r\n     * Note: Key word spotting functionality is only available on the Speech Devices SDK.\r\n     * This functionality is currently not included in the SDK itself.\r\n     * @member IntentRecognizer.prototype.startKeywordRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param {KeywordRecognitionModel} model - The keyword recognition model that specifies the keyword to be recognized.\r\n     * @param cb - Callback invoked once the recognition has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public startKeywordRecognitionAsync(model: KeywordRecognitionModel, cb?: () => void, err?: (e: string) => void): void {\r\n        Contracts.throwIfNull(model, \"model\");\r\n\r\n        if (!!err) {\r\n            err(\"Not yet implemented.\");\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Stops continuous speech recognition.\r\n     * Note: Key word spotting functionality is only available on the Speech Devices SDK.\r\n     * This functionality is currently not included in the SDK itself.\r\n     * @member IntentRecognizer.prototype.stopKeywordRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the recognition has stopped.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public stopKeywordRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        if (!!cb) {\r\n            try {\r\n                cb();\r\n            } catch (e) {\r\n                if (!!err) {\r\n                    err(e as string);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Adds a phrase that should be recognized as intent.\r\n     * @member IntentRecognizer.prototype.addIntent\r\n     * @function\r\n     * @public\r\n     * @param {string} intentId - A String that represents the identifier of the intent to be recognized.\r\n     * @param {string} phrase - A String that specifies the phrase representing the intent.\r\n     */\r\n    public addIntent(simplePhrase: string, intentId?: string): void {\r\n        Contracts.throwIfDisposed(this.privDisposedIntentRecognizer);\r\n        Contracts.throwIfNullOrWhitespace(intentId, \"intentId\");\r\n        Contracts.throwIfNullOrWhitespace(simplePhrase, \"simplePhrase\");\r\n\r\n        this.privAddedIntents.push([intentId, simplePhrase]);\r\n    }\r\n\r\n    /**\r\n     * Adds an intent from Language Understanding service for recognition.\r\n     * @member IntentRecognizer.prototype.addIntentWithLanguageModel\r\n     * @function\r\n     * @public\r\n     * @param {string} intentId - A String that represents the identifier of the intent\r\n     * to be recognized. Ignored if intentName is empty.\r\n     * @param {string} model - The intent model from Language Understanding service.\r\n     * @param {string} intentName - The intent name defined in the intent model. If it\r\n     * is empty, all intent names defined in the model will be added.\r\n     */\r\n    public addIntentWithLanguageModel(intentId: string, model: LanguageUnderstandingModel, intentName?: string): void {\r\n        Contracts.throwIfDisposed(this.privDisposedIntentRecognizer);\r\n        Contracts.throwIfNullOrWhitespace(intentId, \"intentId\");\r\n        Contracts.throwIfNull(model, \"model\");\r\n\r\n        const modelImpl: LanguageUnderstandingModelImpl = model as LanguageUnderstandingModelImpl;\r\n        Contracts.throwIfNullOrWhitespace(modelImpl.appId, \"model.appId\");\r\n\r\n        this.privAddedLmIntents[intentId] = new AddedLmIntent(modelImpl, intentName);\r\n    }\r\n\r\n    /**\r\n     * @summary Adds all intents from the specified Language Understanding Model.\r\n     * @member IntentRecognizer.prototype.addAllIntents\r\n     * @function\r\n     * @public\r\n     * @function\r\n     * @public\r\n     * @param {LanguageUnderstandingModel} model - The language understanding model containing the intents.\r\n     * @param {string} intentId - A custom id String to be returned in the IntentRecognitionResult's getIntentId() method.\r\n     */\r\n    public addAllIntents(model: LanguageUnderstandingModel, intentId?: string): void {\r\n        Contracts.throwIfNull(model, \"model\");\r\n\r\n        const modelImpl: LanguageUnderstandingModelImpl = model as LanguageUnderstandingModelImpl;\r\n        Contracts.throwIfNullOrWhitespace(modelImpl.appId, \"model.appId\");\r\n\r\n        this.privUmbrellaIntent = new AddedLmIntent(modelImpl, intentId);\r\n    }\r\n\r\n    /**\r\n     * closes all external resources held by an instance of this class.\r\n     * @member IntentRecognizer.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, errorCb?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposedIntentRecognizer);\r\n\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\r\n    }\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.privProperties);\r\n    }\r\n\r\n    protected createServiceRecognizer(authentication: IAuthentication, connectionFactory: IConnectionFactory, audioConfig: AudioConfig, recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n        const audioImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        return new IntentServiceRecognizer(authentication, connectionFactory, audioImpl, recognizerConfig, this);\r\n    }\r\n\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedIntentRecognizer) {\r\n            return;\r\n        }\r\n\r\n        if (disposing) {\r\n            this.privDisposedIntentRecognizer = true;\r\n            await super.dispose(disposing);\r\n        }\r\n    }\r\n\r\n    private buildSpeechContext(): IIntentContext {\r\n        let appId: string;\r\n        let region: string;\r\n        let subscriptionKey: string;\r\n        const refGrammers: string[] = [];\r\n\r\n        if (undefined !== this.privUmbrellaIntent) {\r\n            appId = this.privUmbrellaIntent.modelImpl.appId;\r\n            region = this.privUmbrellaIntent.modelImpl.region;\r\n            subscriptionKey = this.privUmbrellaIntent.modelImpl.subscriptionKey;\r\n        }\r\n\r\n        // Build the reference grammer array.\r\n        for (const intentId of Object.keys(this.privAddedLmIntents)) {\r\n            const addedLmIntent: AddedLmIntent = this.privAddedLmIntents[intentId];\r\n\r\n            // validate all the same model, region, and key...\r\n            if (appId === undefined) {\r\n                appId = addedLmIntent.modelImpl.appId;\r\n            } else {\r\n                if (appId !== addedLmIntent.modelImpl.appId) {\r\n                    throw new Error(\"Intents must all be from the same LUIS model\");\r\n                }\r\n            }\r\n\r\n            if (region === undefined) {\r\n                region = addedLmIntent.modelImpl.region;\r\n            } else {\r\n                if (region !== addedLmIntent.modelImpl.region) {\r\n                    throw new Error(\"Intents must all be from the same LUIS model in a single region\");\r\n                }\r\n            }\r\n\r\n            if (subscriptionKey === undefined) {\r\n                subscriptionKey = addedLmIntent.modelImpl.subscriptionKey;\r\n            } else {\r\n                if (subscriptionKey !== addedLmIntent.modelImpl.subscriptionKey) {\r\n                    throw new Error(\"Intents must all use the same subscription key\");\r\n                }\r\n            }\r\n\r\n            const grammer: string = \"luis/\" + appId + \"-PRODUCTION#\" + intentId;\r\n            refGrammers.push(grammer);\r\n        }\r\n\r\n        return {\r\n            Intent: {\r\n                id: appId,\r\n                key: (subscriptionKey === undefined) ? this.privProperties.getProperty(PropertyId[PropertyId.SpeechServiceConnection_Key]) : subscriptionKey,\r\n                provider: \"LUIS\",\r\n            },\r\n            ReferenceGrammars: (undefined === this.privUmbrellaIntent) ? refGrammers : [\"luis/\" + appId + \"-PRODUCTION\"],\r\n        };\r\n    }\r\n}\r\n\r\ninterface IIntentContext {\r\n    Intent: {\r\n        id: string;\r\n        key: string;\r\n        provider: string;\r\n    };\r\n    ReferenceGrammars: string[];\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Output format\r\n * @class VoiceProfileType\r\n */\r\nexport enum VoiceProfileType {\r\n\r\n    /**\r\n     * Text independent speaker identification\r\n     * @member VoiceProfileType.TextIndependentIdentification\r\n     */\r\n    TextIndependentIdentification,\r\n\r\n    /**\r\n     * Text dependent speaker verification\r\n     * @member VoiceProfileType.TextDependentVerification\r\n     */\r\n    TextDependentVerification,\r\n\r\n    /**\r\n     * Text independent speaker verification\r\n     * @member VoiceProfileType.TextIndependentVerification\r\n     */\r\n    TextIndependentVerification,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    RecognitionMode,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechServiceConfig,\r\n    TranslationConnectionFactory,\r\n    TranslationServiceRecognizer\r\n} from \"../common.speech/Exports.js\";\r\nimport { marshalPromiseToCallbacks } from \"../common/Exports.js\";\r\nimport { AudioConfigImpl } from \"./Audio/AudioConfig.js\";\r\nimport { Connection } from \"./Connection.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    AutoDetectSourceLanguageConfig,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    TranslationRecognitionCanceledEventArgs,\r\n    TranslationRecognitionEventArgs,\r\n    TranslationRecognitionResult,\r\n    TranslationSynthesisEventArgs\r\n} from \"./Exports.js\";\r\nimport { SpeechTranslationConfig, SpeechTranslationConfigImpl } from \"./SpeechTranslationConfig.js\";\r\n\r\n/**\r\n * Translation recognizer\r\n * @class TranslationRecognizer\r\n */\r\nexport class TranslationRecognizer extends Recognizer {\r\n    /**\r\n     * The event recognizing signals that an intermediate recognition result is received.\r\n     * @member TranslationRecognizer.prototype.recognizing\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognizing: (sender: TranslationRecognizer, event: TranslationRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event recognized signals that a final recognition result is received.\r\n     * @member TranslationRecognizer.prototype.recognized\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognized: (sender: TranslationRecognizer, event: TranslationRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during recognition.\r\n     * @member TranslationRecognizer.prototype.canceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public canceled: (sender: TranslationRecognizer, event: TranslationRecognitionCanceledEventArgs) => void;\r\n\r\n    /**\r\n     * The event synthesizing signals that a translation synthesis result is received.\r\n     * @member TranslationRecognizer.prototype.synthesizing\r\n     * @function\r\n     * @public\r\n     */\r\n    public synthesizing: (sender: TranslationRecognizer, event: TranslationSynthesisEventArgs) => void;\r\n\r\n    private privDisposedTranslationRecognizer: boolean;\r\n\r\n    /**\r\n     * Initializes an instance of the TranslationRecognizer.\r\n     * @constructor\r\n     * @param {SpeechTranslationConfig} speechConfig - Set of properties to configure this recognizer.\r\n     * @param {AudioConfig} audioConfig - An optional audio config associated with the recognizer\r\n     * @param {IConnectionFactory} connectionFactory - An optional connection factory to use to generate the endpoint URIs, headers to set, etc...\r\n     */\r\n    public constructor(speechConfig: SpeechTranslationConfig, audioConfig?: AudioConfig, connectionFactory?: IConnectionFactory) {\r\n        const configImpl = speechConfig as SpeechTranslationConfigImpl;\r\n        Contracts.throwIfNull(configImpl, \"speechConfig\");\r\n\r\n        super(audioConfig, configImpl.properties, connectionFactory || new TranslationConnectionFactory());\r\n\r\n        this.privDisposedTranslationRecognizer = false;\r\n\r\n        if (this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined) !== undefined) {\r\n            Contracts.throwIfNullOrWhitespace(\r\n                this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice),\r\n                PropertyId[PropertyId.SpeechServiceConnection_TranslationVoice]);\r\n        }\r\n\r\n        Contracts.throwIfNullOrWhitespace(\r\n            this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages),\r\n            PropertyId[PropertyId.SpeechServiceConnection_TranslationToLanguages]);\r\n\r\n        Contracts.throwIfNullOrWhitespace(this.properties.getProperty(\r\n            PropertyId.SpeechServiceConnection_RecoLanguage),\r\n            PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n\r\n    }\r\n\r\n    /**\r\n     * TranslationRecognizer constructor.\r\n     * @constructor\r\n     * @param {SpeechTranslationConfig} speechTranslationConfig - an set of initial properties for this recognizer\r\n     * @param {AutoDetectSourceLanguageConfig} autoDetectSourceLanguageConfig - An source language detection configuration associated with the recognizer\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n     */\r\n    public static FromConfig(speechTranslationConfig: SpeechTranslationConfig, autoDetectSourceLanguageConfig: AutoDetectSourceLanguageConfig, audioConfig?: AudioConfig): TranslationRecognizer {\r\n        const speechTranslationConfigImpl: SpeechTranslationConfigImpl = speechTranslationConfig as SpeechTranslationConfigImpl;\r\n        autoDetectSourceLanguageConfig.properties.mergeTo(speechTranslationConfigImpl.properties);\r\n        return new TranslationRecognizer(speechTranslationConfig, audioConfig);\r\n    }\r\n\r\n    /**\r\n     * Gets the language name that was set when the recognizer was created.\r\n     * @member TranslationRecognizer.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {string} Gets the language name that was set when the recognizer was created.\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    /**\r\n     * Gets target languages for translation that were set when the recognizer was created.\r\n     * The language is specified in BCP-47 format. The translation will provide translated text for each of language.\r\n     * @member TranslationRecognizer.prototype.targetLanguages\r\n     * @function\r\n     * @public\r\n     * @returns {string[]} Gets target languages for translation that were set when the recognizer was created.\r\n     */\r\n    public get targetLanguages(): string[] {\r\n        Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages).split(\",\");\r\n    }\r\n\r\n    /**\r\n     * Gets the name of output voice.\r\n     * @member TranslationRecognizer.prototype.voiceName\r\n     * @function\r\n     * @public\r\n     * @returns {string} the name of output voice.\r\n     */\r\n    public get voiceName(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined);\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this TranslationRecognizer.\r\n     * @member TranslationRecognizer.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this TranslationRecognizer.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member TranslationRecognizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * @member TranslationRecognizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} value - Authorization token.\r\n     */\r\n    public set authorizationToken(value: string) {\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\r\n    }\r\n\r\n    /**\r\n     * Starts recognition and translation, and stops after the first utterance is recognized.\r\n     * The task returns the translation text as result.\r\n     * Note: recognizeOnceAsync returns when the first utterance has been recognized, so it is suitable only\r\n     * for single shot recognition like command or query. For long-running recognition,\r\n     * use startContinuousRecognitionAsync() instead.\r\n     * @member TranslationRecognizer.prototype.recognizeOnceAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback that received the result when the translation has completed.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public recognizeOnceAsync(cb?: (e: TranslationRecognitionResult) => void, err?: (e: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n        marshalPromiseToCallbacks(this.recognizeOnceAsyncImpl(RecognitionMode.Interactive), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Starts recognition and translation, until stopContinuousRecognitionAsync() is called.\r\n     * User must subscribe to events to receive translation results.\r\n     * @member TranslationRecognizer.prototype.startContinuousRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback that received the translation has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(RecognitionMode.Conversation), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Stops continuous recognition and translation.\r\n     * @member TranslationRecognizer.prototype.stopContinuousRecognitionAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback that received the translation has stopped.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public stopContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * dynamically remove a language from list of target language\r\n     * (can be used while recognition is ongoing)\r\n     * @member TranslationRecognizer.prototype.removeTargetLanguage\r\n     * @function\r\n     * @param lang - language to be removed\r\n     * @public\r\n     */\r\n    public removeTargetLanguage(lang: string): void {\r\n        Contracts.throwIfNullOrUndefined(lang, \"language to be removed\");\r\n        if (this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined) !== undefined) {\r\n            const languages: string[] = this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages).split(\",\");\r\n            const index: number = languages.indexOf(lang);\r\n            if (index > -1) {\r\n                languages.splice(index, 1);\r\n                this.properties.setProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, languages.join(\",\"));\r\n                this.updateLanguages(languages);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * dynamically add a language to list of target language\r\n     * (can be used while recognition is ongoing)\r\n     * @member TranslationRecognizer.prototype.addTargetLanguage\r\n     * @function\r\n     * @param lang - language to be added\r\n     * @public\r\n     */\r\n    public addTargetLanguage(lang: string): void {\r\n        Contracts.throwIfNullOrUndefined(lang, \"language to be added\");\r\n        let languages: string[] = [];\r\n        if (this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined) !== undefined) {\r\n            languages = this.properties.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages).split(\",\");\r\n            if (!languages.includes(lang)) {\r\n                languages.push(lang);\r\n                this.properties.setProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, languages.join(\",\"));\r\n            }\r\n        } else {\r\n            this.properties.setProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, lang);\r\n            languages = [lang];\r\n        }\r\n        this.updateLanguages(languages);\r\n    }\r\n\r\n    /**\r\n     * closes all external resources held by an instance of this class.\r\n     * @member TranslationRecognizer.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, errorCb?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposedTranslationRecognizer);\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\r\n    }\r\n\r\n    /**\r\n     * handles ConnectionEstablishedEvent for conversation translation scenarios.\r\n     * @member TranslationRecognizer.prototype.onConnection\r\n     * @function\r\n     * @public\r\n     */\r\n    // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n    public onConnection(): void { }\r\n\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedTranslationRecognizer) {\r\n            return;\r\n        }\r\n\r\n        this.privDisposedTranslationRecognizer = true;\r\n\r\n        if (disposing) {\r\n            await this.implRecognizerStop();\r\n            await super.dispose(disposing);\r\n        }\r\n    }\r\n\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.privProperties);\r\n    }\r\n\r\n    protected createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n\r\n        const configImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n\r\n        return new TranslationServiceRecognizer(authentication, connectionFactory, configImpl, recognizerConfig, this);\r\n    }\r\n\r\n    private updateLanguages(languages: string[]): void {\r\n        const conn: Connection = Connection.fromRecognizer(this);\r\n        if (!!conn) {\r\n            conn.setMessageProperty(\"speech.context\", \"translationcontext\", {to: languages});\r\n            conn.sendMessageAsync(\"event\", JSON.stringify({\r\n                id: \"translation\",\r\n                name: \"updateLanguage\",\r\n                to: languages\r\n                }));\r\n        }\r\n    }\r\n\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport {\r\n    ServiceRecognizerBase,\r\n    SynthesisAdapterBase,\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    ConnectionEvent,\r\n    ConnectionMessageReceivedEvent,\r\n    ConnectionMessageSentEvent,\r\n    IDetachable,\r\n    marshalPromiseToCallbacks,\r\n    ServiceEvent,\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    ConnectionMessageImpl\r\n} from \"./ConnectionMessage.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    ConnectionEventArgs,\r\n    ConnectionMessageEventArgs,\r\n    ConversationTranscriber,\r\n    Recognizer,\r\n    ServiceEventArgs,\r\n    SpeechSynthesizer,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Connection is a proxy class for managing connection to the speech service of the specified Recognizer.\r\n * By default, a Recognizer autonomously manages connection to service when needed.\r\n * The Connection class provides additional methods for users to explicitly open or close a connection and\r\n * to subscribe to connection status changes.\r\n * The use of Connection is optional, and mainly for scenarios where fine tuning of application\r\n * behavior based on connection status is needed. Users can optionally call Open() to manually set up a connection\r\n * in advance before starting recognition on the Recognizer associated with this Connection.\r\n * If the Recognizer needs to connect or disconnect to service, it will\r\n * setup or shutdown the connection independently. In this case the Connection will be notified by change of connection\r\n * status via Connected/Disconnected events.\r\n * Added in version 1.2.1.\r\n */\r\nexport class Connection {\r\n    private privInternalData: ServiceRecognizerBase | SynthesisAdapterBase;\r\n    private privEventListener: IDetachable;\r\n    private privServiceEventListener: IDetachable;\r\n\r\n    /**\r\n     * Gets the Connection instance from the specified recognizer.\r\n     * @param recognizer The recognizer associated with the connection.\r\n     * @return The Connection instance of the recognizer.\r\n     */\r\n    public static fromRecognizer(recognizer: Recognizer | ConversationTranscriber): Connection {\r\n        const recoBase = recognizer.internalData as ServiceRecognizerBase;\r\n        const ret: Connection = new Connection();\r\n\r\n        ret.privInternalData = recoBase;\r\n        ret.setupEvents();\r\n        return ret;\r\n    }\r\n\r\n    /**\r\n     * Gets the Connection instance from the specified synthesizer.\r\n     * @param synthesizer The synthesizer associated with the connection.\r\n     * @return The Connection instance of the synthesizer.\r\n     */\r\n    public static fromSynthesizer(synthesizer: SpeechSynthesizer): Connection {\r\n        const synthBase: SynthesisAdapterBase = synthesizer.internalData as SynthesisAdapterBase;\r\n\r\n        const ret: Connection = new Connection();\r\n\r\n        ret.privInternalData = synthBase;\r\n        ret.setupEvents();\r\n        return ret;\r\n    }\r\n\r\n    /**\r\n     * Starts to set up connection to the service.\r\n     * Users can optionally call openConnection() to manually set up a connection in advance before starting recognition on the\r\n     * Recognizer associated with this Connection. After starting recognition, calling Open() will have no effect\r\n     *\r\n     * Note: On return, the connection might not be ready yet. Please subscribe to the Connected event to\r\n     * be notified when the connection is established.\r\n     */\r\n    public openConnection(cb?: () => void, err?: (error: string) => void): void {\r\n        marshalPromiseToCallbacks(this.privInternalData.connect(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Closes the connection the service.\r\n     * Users can optionally call closeConnection() to manually shutdown the connection of the associated Recognizer.\r\n     *\r\n     * If closeConnection() is called during recognition, recognition will fail and cancel with an error.\r\n     */\r\n    public closeConnection(cb?: () => void, err?: (error: string) => void): void {\r\n        if (this.privInternalData instanceof SynthesisAdapterBase) {\r\n            throw new Error(\"Disconnecting a synthesizer's connection is currently not supported\");\r\n        } else {\r\n            marshalPromiseToCallbacks(this.privInternalData.disconnect(), cb, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Appends a parameter in a message to service.\r\n     * Added in version 1.12.1.\r\n     * @param path The path of the network message.\r\n     * @param propertyName Name of the property\r\n     * @param propertyValue Value of the property. This is a json string.\r\n     */\r\n    public setMessageProperty(path: string, propertyName: string, propertyValue: string | object): void {\r\n        Contracts.throwIfNullOrWhitespace(propertyName, \"propertyName\");\r\n\r\n        if (this.privInternalData instanceof ServiceRecognizerBase) {\r\n            if (path.toLowerCase() !== \"speech.context\") {\r\n                throw new Error(\"Only speech.context message property sets are currently supported for recognizer\");\r\n            } else {\r\n                this.privInternalData.speechContext.setSection(propertyName, propertyValue);\r\n            }\r\n        } else if (this.privInternalData instanceof SynthesisAdapterBase) {\r\n            if (path.toLowerCase() !== \"synthesis.context\") {\r\n                throw new Error(\"Only synthesis.context message property sets are currently supported for synthesizer\");\r\n            } else {\r\n                this.privInternalData.synthesisContext.setSection(propertyName, propertyValue);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Sends a message to the speech service.\r\n     * Added in version 1.13.0.\r\n     * @param path The WebSocket path of the message\r\n     * @param payload The payload of the message. This is a json string or a ArrayBuffer.\r\n     * @param success A callback to indicate success.\r\n     * @param error A callback to indicate an error.\r\n     */\r\n    public sendMessageAsync(path: string, payload: string | ArrayBuffer, success?: () => void, error?: (error: string) => void): void {\r\n        marshalPromiseToCallbacks(this.privInternalData.sendNetworkMessage(path, payload), success, error);\r\n    }\r\n\r\n    /**\r\n     * Any message from service that is not being processed by any other top level recognizers.\r\n     *\r\n     * Will be removed in 2.0.\r\n     */\r\n    public receivedServiceMessage: (args: ServiceEventArgs) => void;\r\n\r\n    /**\r\n     * Any message received from the Speech Service.\r\n     */\r\n    public messageReceived: (args: ConnectionMessageEventArgs) => void;\r\n\r\n    /**\r\n     * Any message sent to the Speech Service.\r\n     */\r\n    public messageSent: (args: ConnectionMessageEventArgs) => void;\r\n\r\n    /**\r\n     * The Connected event to indicate that the recognizer is connected to service.\r\n     */\r\n    public connected: (args: ConnectionEventArgs) => void;\r\n\r\n    /**\r\n     * The Disconnected event to indicate that the recognizer is disconnected from service.\r\n     */\r\n    public disconnected: (args: ConnectionEventArgs) => void;\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     */\r\n    public close(): void {\r\n        /* eslint-disable no-empty */\r\n    }\r\n\r\n    private setupEvents(): void {\r\n        this.privEventListener = this.privInternalData.connectionEvents.attach((connectionEvent: ConnectionEvent): void => {\r\n            if (connectionEvent.name === \"ConnectionEstablishedEvent\") {\r\n                if (!!this.connected) {\r\n                    this.connected(new ConnectionEventArgs(connectionEvent.connectionId));\r\n                }\r\n            } else if (connectionEvent.name === \"ConnectionClosedEvent\") {\r\n                if (!!this.disconnected) {\r\n                    this.disconnected(new ConnectionEventArgs(connectionEvent.connectionId));\r\n                }\r\n            } else if (connectionEvent.name === \"ConnectionMessageSentEvent\") {\r\n                if (!!this.messageSent) {\r\n                    this.messageSent(new ConnectionMessageEventArgs(new ConnectionMessageImpl((connectionEvent as ConnectionMessageSentEvent).message)));\r\n                }\r\n            } else if (connectionEvent.name === \"ConnectionMessageReceivedEvent\") {\r\n                if (!!this.messageReceived) {\r\n                    this.messageReceived(new ConnectionMessageEventArgs(new ConnectionMessageImpl((connectionEvent as ConnectionMessageReceivedEvent).message)));\r\n                }\r\n            }\r\n        });\r\n\r\n        this.privServiceEventListener = this.privInternalData.serviceEvents.attach((e: ServiceEvent): void => {\r\n            if (!!this.receivedServiceMessage) {\r\n                this.receivedServiceMessage(new ServiceEventArgs(e.jsonString, e.name));\r\n            }\r\n        });\r\n    }\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nimport { HeaderNames } from \"../common.speech/HeaderNames.js\";\r\nimport {\r\n    ConnectionMessage as IntConnectionMessage,\r\n    MessageType\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    PropertyCollection\r\n} from \"./PropertyCollection.js\";\r\nimport { PropertyId } from \"./PropertyId.js\";\r\n\r\n/**\r\n * ConnectionMessage represents implementation specific messages sent to and received from\r\n * the speech service. These messages are provided for debugging purposes and should not\r\n * be used for production use cases with the Azure Cognitive Services Speech Service.\r\n * Messages sent to and received from the Speech Service are subject to change without\r\n * notice. This includes message contents, headers, payloads, ordering, etc.\r\n * Added in version 1.11.0.\r\n */\r\nexport abstract class ConnectionMessage {\r\n    /**\r\n     * The message path.\r\n     */\r\n    public abstract get path(): string;\r\n\r\n    /**\r\n     * Checks to see if the ConnectionMessage is a text message.\r\n     * See also IsBinaryMessage().\r\n     */\r\n    public abstract get isTextMessage(): boolean;\r\n\r\n    /**\r\n     * Checks to see if the ConnectionMessage is a binary message.\r\n     * See also GetBinaryMessage().\r\n     */\r\n    public abstract get isBinaryMessage(): boolean;\r\n\r\n    /**\r\n     * Gets the text message payload. Typically the text message content-type is\r\n     * application/json. To determine other content-types use\r\n     * Properties.GetProperty(\"Content-Type\").\r\n     */\r\n    public abstract get TextMessage(): string;\r\n\r\n    /**\r\n     * Gets the binary message payload.\r\n     */\r\n    public abstract get binaryMessage(): ArrayBuffer;\r\n\r\n    /**\r\n     * A collection of properties and their values defined for this <see cref=\"ConnectionMessage\"/>.\r\n     * Message headers can be accessed via this collection (e.g. \"Content-Type\").\r\n     */\r\n    public abstract get properties(): PropertyCollection;\r\n\r\n    /**\r\n     * Returns a string that represents the connection message.\r\n     */\r\n    public abstract toString(): string;\r\n}\r\n\r\nexport class ConnectionMessageImpl {\r\n\r\n    private privConnectionMessage: IntConnectionMessage;\r\n    private privProperties: PropertyCollection;\r\n\r\n    public constructor(message: IntConnectionMessage) {\r\n        this.privConnectionMessage = message;\r\n        this.privProperties = new PropertyCollection();\r\n        if (!!this.privConnectionMessage.headers[HeaderNames.ConnectionId]) {\r\n            this.privProperties.setProperty(PropertyId.Speech_SessionId, this.privConnectionMessage.headers[HeaderNames.ConnectionId]);\r\n        }\r\n\r\n        Object.keys(this.privConnectionMessage.headers).forEach((header: string): void => {\r\n            this.privProperties.setProperty(header, this.privConnectionMessage.headers[header]);\r\n        });\r\n    }\r\n\r\n    /**\r\n     * The message path.\r\n     */\r\n    public get path(): string {\r\n        return this.privConnectionMessage.headers[Object.keys(this.privConnectionMessage.headers).find((key: string): boolean => key.toLowerCase() === \"path\".toLowerCase())];\r\n    }\r\n\r\n    /**\r\n     * Checks to see if the ConnectionMessage is a text message.\r\n     * See also IsBinaryMessage().\r\n     */\r\n    public get isTextMessage(): boolean {\r\n        return this.privConnectionMessage.messageType === MessageType.Text;\r\n    }\r\n\r\n    /**\r\n     * Checks to see if the ConnectionMessage is a binary message.\r\n     * See also GetBinaryMessage().\r\n     */\r\n    public get isBinaryMessage(): boolean {\r\n        return this.privConnectionMessage.messageType === MessageType.Binary;\r\n    }\r\n\r\n    /**\r\n     * Gets the text message payload. Typically the text message content-type is\r\n     * application/json. To determine other content-types use\r\n     * Properties.GetProperty(\"Content-Type\").\r\n     */\r\n    public get TextMessage(): string {\r\n        return this.privConnectionMessage.textBody;\r\n    }\r\n\r\n    /**\r\n     * Gets the binary message payload.\r\n     */\r\n    public get binaryMessage(): ArrayBuffer {\r\n        return this.privConnectionMessage.binaryBody;\r\n    }\r\n\r\n    /**\r\n     * A collection of properties and their values defined for this <see cref=\"ConnectionMessage\"/>.\r\n     * Message headers can be accessed via this collection (e.g. \"Content-Type\").\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Returns a string that represents the connection message.\r\n     */\r\n    public toString(): string {\r\n        return \"\";\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection } from \"./Exports.js\";\r\n\r\n/**\r\n * Represents collection of parameters and their values.\r\n * @class Translations\r\n */\r\nexport class Translations {\r\n    // Use an PropertyCollection internally, just wrapping it to hide the | enum syntax it has.\r\n    private privMap: PropertyCollection = new PropertyCollection();\r\n\r\n    /**\r\n     * Get the languages in the object in a String array.\r\n     * @member Translations.prototype.languages\r\n     * @function\r\n     * @public\r\n     * @returns {string[]} languages in translations object.\r\n     */\r\n    public get languages(): string[] {\r\n        return this.privMap.keys;\r\n    }\r\n\r\n    /**\r\n     * Returns the parameter value in type String. The parameter must have the same type as String.\r\n     * Currently only String, int and bool are allowed.\r\n     * If the name is not available, the specified defaultValue is returned.\r\n     * @member Translations.prototype.get\r\n     * @function\r\n     * @public\r\n     * @param {string} key - The parameter name.\r\n     * @param {string} def - The default value which is returned if the parameter is not available in the collection.\r\n     * @returns {string} value of the parameter.\r\n     */\r\n    public get(key: string, def?: string): string {\r\n        return this.privMap.getProperty(key, def);\r\n    }\r\n\r\n    /**\r\n     * Sets the String value of the parameter specified by name.\r\n     * @member Translations.prototype.set\r\n     * @function\r\n     * @public\r\n     * @param {string} key - The parameter name.\r\n     * @param {string} value - The value of the parameter.\r\n     */\r\n    public set(key: string, value: string): void {\r\n        this.privMap.setProperty(key, value);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the possible reasons a recognition result might not be recognized.\r\n * @class NoMatchReason\r\n */\r\nexport enum NoMatchReason {\r\n\r\n    /**\r\n     * Indicates that speech was detected, but not recognized.\r\n     * @member NoMatchReason.NotRecognized\r\n     */\r\n    NotRecognized,\r\n\r\n    /**\r\n     * Indicates that the start of the audio stream contained only silence,\r\n     * and the service timed out waiting for speech.\r\n     * @member NoMatchReason.InitialSilenceTimeout\r\n     */\r\n    InitialSilenceTimeout,\r\n\r\n    /**\r\n     * Indicates that the start of the audio stream contained only noise,\r\n     * and the service timed out waiting for speech.\r\n     * @member NoMatchReason.InitialBabbleTimeout\r\n     */\r\n    InitialBabbleTimeout,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognitionStatus, SimpleSpeechPhrase } from \"../../src/common.speech/Exports.js\";\r\nimport { IntentRecognitionResult, NoMatchReason, SpeechRecognitionResult, TranslationRecognitionResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Contains detailed information for NoMatch recognition results.\r\n * @class NoMatchDetails\r\n */\r\nexport class NoMatchDetails {\r\n    private privReason: NoMatchReason;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {NoMatchReason} reason - The no-match reason.\r\n     */\r\n    private constructor(reason: NoMatchReason) {\r\n        this.privReason = reason;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of NoMatchDetails object for the NoMatch SpeechRecognitionResults.\r\n     * @member NoMatchDetails.fromResult\r\n     * @function\r\n     * @public\r\n     * @param {SpeechRecognitionResult | IntentRecognitionResult | TranslationRecognitionResult}\r\n     * result - The recognition result that was not recognized.\r\n     * @returns {NoMatchDetails} The no match details object being created.\r\n     */\r\n    public static fromResult(result: SpeechRecognitionResult | IntentRecognitionResult | TranslationRecognitionResult): NoMatchDetails {\r\n        const simpleSpeech: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(result.json);\r\n\r\n        let reason: NoMatchReason = NoMatchReason.NotRecognized;\r\n\r\n        switch (simpleSpeech.RecognitionStatus) {\r\n            case RecognitionStatus.BabbleTimeout:\r\n                reason = NoMatchReason.InitialBabbleTimeout;\r\n                break;\r\n            case RecognitionStatus.InitialSilenceTimeout:\r\n                reason = NoMatchReason.InitialSilenceTimeout;\r\n                break;\r\n            default:\r\n                reason = NoMatchReason.NotRecognized;\r\n                break;\r\n        }\r\n\r\n        return new NoMatchDetails(reason);\r\n    }\r\n\r\n    /**\r\n     * The reason the recognition was canceled.\r\n     * @member NoMatchDetails.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {NoMatchReason} Specifies the reason canceled.\r\n     */\r\n    public get reason(): NoMatchReason {\r\n        return this.privReason;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { CancellationErrorCode, CancellationReason, TranslationRecognitionResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Define payload of speech recognition canceled result events.\r\n * @class TranslationRecognitionCanceledEventArgs\r\n */\r\nexport class TranslationRecognitionCanceledEventArgs {\r\n    private privResult: TranslationRecognitionResult;\r\n    private privSessionId: string;\r\n    private privCancelReason: CancellationReason;\r\n    private privErrorDetails: string;\r\n    private privErrorCode: CancellationErrorCode;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} sessionid - The session id.\r\n     * @param {CancellationReason} cancellationReason - The cancellation reason.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {TranslationRecognitionResult} result - The result.\r\n     */\r\n    public constructor(\r\n        sessionid: string,\r\n        cancellationReason: CancellationReason,\r\n        errorDetails: string,\r\n        errorCode: CancellationErrorCode,\r\n        result: TranslationRecognitionResult) {\r\n        this.privCancelReason = cancellationReason;\r\n        this.privErrorDetails = errorDetails;\r\n        this.privResult = result;\r\n        this.privSessionId = sessionid;\r\n        this.privErrorCode = errorCode;\r\n    }\r\n\r\n    /**\r\n     * Specifies the recognition result.\r\n     * @member TranslationRecognitionCanceledEventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {TranslationRecognitionResult} the recognition result.\r\n     */\r\n    public get result(): TranslationRecognitionResult {\r\n        return this.privResult;\r\n    }\r\n\r\n    /**\r\n     * Specifies the session identifier.\r\n     * @member TranslationRecognitionCanceledEventArgs.prototype.sessionId\r\n     * @function\r\n     * @public\r\n     * @returns {string} the session identifier.\r\n     */\r\n    public get sessionId(): string {\r\n        return this.privSessionId;\r\n    }\r\n\r\n    /**\r\n     * The reason the recognition was canceled.\r\n     * @member TranslationRecognitionCanceledEventArgs.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {CancellationReason} Specifies the reason canceled.\r\n     */\r\n    public get reason(): CancellationReason {\r\n        return this.privCancelReason;\r\n    }\r\n\r\n    /**\r\n     * The error code in case of an unsuccessful recognition.\r\n     * Added in version 1.1.0.\r\n     * @return An error code that represents the error reason.\r\n     */\r\n    public get errorCode(): CancellationErrorCode {\r\n        return this.privErrorCode;\r\n    }\r\n\r\n    /**\r\n     * In case of an unsuccessful recognition, provides details of the occurred error.\r\n     * @member TranslationRecognitionCanceledEventArgs.prototype.errorDetails\r\n     * @function\r\n     * @public\r\n     * @returns {string} A String that represents the error details.\r\n     */\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { CancellationEventArgs } from \"./CancellationEventArgs.js\";\r\nimport { CancellationErrorCode, CancellationReason, IntentRecognitionEventArgs, IntentRecognitionResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Define payload of intent recognition canceled result events.\r\n * @class IntentRecognitionCanceledEventArgs\r\n */\r\nexport class IntentRecognitionCanceledEventArgs extends IntentRecognitionEventArgs implements CancellationEventArgs {\r\n    private privReason: CancellationReason;\r\n    private privErrorDetails: string;\r\n    private privErrorCode: CancellationErrorCode;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {CancellationReason} result - The result of the intent recognition.\r\n     * @param {string} offset - The offset.\r\n     * @param {IntentRecognitionResult} sessionId - The session id.\r\n     */\r\n    public constructor(\r\n        reason: CancellationReason,\r\n        errorDetails: string,\r\n        errorCode: CancellationErrorCode,\r\n        result?: IntentRecognitionResult,\r\n        offset?: number,\r\n        sessionId?: string) {\r\n        super(result, offset, sessionId);\r\n\r\n        this.privReason = reason;\r\n        this.privErrorDetails = errorDetails;\r\n        this.privErrorCode = errorCode;\r\n    }\r\n\r\n    /**\r\n     * The reason the recognition was canceled.\r\n     * @member IntentRecognitionCanceledEventArgs.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {CancellationReason} Specifies the reason canceled.\r\n     */\r\n    public get reason(): CancellationReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    /**\r\n     * The error code in case of an unsuccessful recognition.\r\n     * Added in version 1.1.0.\r\n     * @return An error code that represents the error reason.\r\n     */\r\n    public get errorCode(): CancellationErrorCode {\r\n        return this.privErrorCode;\r\n    }\r\n\r\n    /**\r\n     * In case of an unsuccessful recognition, provides details of the occurred error.\r\n     * @member IntentRecognitionCanceledEventArgs.prototype.errorDetails\r\n     * @function\r\n     * @public\r\n     * @returns {string} A String that represents the error details.\r\n     */\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Contains detailed information about why a result was canceled.\r\n * @class CancellationDetailsBase\r\n */\r\nexport class CancellationDetailsBase {\r\n    private privReason: CancellationReason;\r\n    private privErrorDetails: string;\r\n    private privErrorCode: CancellationErrorCode;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {CancellationReason} reason - The cancellation reason.\r\n     * @param {string} errorDetails - The error details, if provided.\r\n     */\r\n    protected constructor(reason: CancellationReason, errorDetails: string, errorCode: CancellationErrorCode) {\r\n        this.privReason = reason;\r\n        this.privErrorDetails = errorDetails;\r\n        this.privErrorCode = errorCode;\r\n    }\r\n\r\n    /**\r\n     * The reason the recognition was canceled.\r\n     * @member CancellationDetailsBase.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {CancellationReason} Specifies the reason canceled.\r\n     */\r\n    public get reason(): CancellationReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    /**\r\n     * In case of an unsuccessful recognition, provides details of the occurred error.\r\n     * @member CancellationDetailsBase.prototype.errorDetails\r\n     * @function\r\n     * @public\r\n     * @returns {string} A String that represents the error details.\r\n     */\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n\r\n    /**\r\n     * The error code in case of an unsuccessful recognition.\r\n     * Added in version 1.1.0.\r\n     * @return An error code that represents the error reason.\r\n     */\r\n    public get ErrorCode(): CancellationErrorCode {\r\n        return this.privErrorCode;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { CancellationErrorCodePropertyName, EnumTranslation, SimpleSpeechPhrase } from \"../common.speech/Exports.js\";\r\nimport { CancellationDetailsBase } from \"./CancellationDetailsBase.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    RecognitionResult,\r\n    SpeechSynthesisResult\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Contains detailed information about why a result was canceled.\r\n * @class CancellationDetails\r\n */\r\nexport class CancellationDetails extends CancellationDetailsBase {\r\n\r\n    private constructor(reason: CancellationReason, errorDetails: string, errorCode: CancellationErrorCode) {\r\n        super(reason, errorDetails, errorCode);\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of CancellationDetails object for the canceled RecognitionResult.\r\n     * @member CancellationDetails.fromResult\r\n     * @function\r\n     * @public\r\n     * @param {RecognitionResult | SpeechSynthesisResult} result - The result that was canceled.\r\n     * @returns {CancellationDetails} The cancellation details object being created.\r\n     */\r\n    public static fromResult(result: RecognitionResult | SpeechSynthesisResult): CancellationDetails {\r\n        let reason = CancellationReason.Error;\r\n        let errorCode: CancellationErrorCode = CancellationErrorCode.NoError;\r\n\r\n        if (result instanceof RecognitionResult && !!result.json) {\r\n            const simpleSpeech: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(result.json);\r\n            reason = EnumTranslation.implTranslateCancelResult(simpleSpeech.RecognitionStatus);\r\n        }\r\n\r\n        if (!!result.properties) {\r\n            errorCode = CancellationErrorCode[result.properties.getProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.NoError]) as keyof typeof CancellationErrorCode];\r\n        }\r\n\r\n        return new CancellationDetails(reason, result.errorDetails || EnumTranslation.implTranslateErrorDetails(errorCode), errorCode);\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines error code in case that CancellationReason is Error.\r\n * Added in version 1.1.0.\r\n */\r\nexport enum CancellationErrorCode {\r\n    /**\r\n     * Indicates that no error occurred during speech recognition.\r\n     */\r\n    NoError,\r\n\r\n    /**\r\n     * Indicates an authentication error.\r\n     */\r\n    AuthenticationFailure,\r\n\r\n    /**\r\n     * Indicates that one or more recognition parameters are invalid.\r\n     */\r\n    BadRequestParameters,\r\n\r\n    /**\r\n     * Indicates that the number of parallel requests exceeded the number of allowed\r\n     * concurrent transcriptions for the subscription.\r\n     */\r\n    TooManyRequests,\r\n\r\n    /**\r\n     * Indicates a connection error.\r\n     */\r\n    ConnectionFailure,\r\n\r\n    /**\r\n     * Indicates a time-out error when waiting for response from service.\r\n     */\r\n    ServiceTimeout,\r\n\r\n    /**\r\n     * Indicates that an error is returned by the service.\r\n     */\r\n    ServiceError,\r\n\r\n    /**\r\n     * Indicates an unexpected runtime error.\r\n     */\r\n    RuntimeError,\r\n\r\n    /**\r\n     * Indicates an quota overrun on existing key.\r\n     */\r\n    Forbidden,\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { SessionEventArgs } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines payload for connection events like Connected/Disconnected.\r\n * Added in version 1.2.0\r\n */\r\nexport class ConnectionEventArgs extends SessionEventArgs {\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { SessionEventArgs } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines payload for any Service message event\r\n * Added in version 1.9.0\r\n */\r\n\r\nexport class ServiceEventArgs extends SessionEventArgs {\r\n    private privJsonResult: string;\r\n    private privEventName: string;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} json - json payload of the USP message.\r\n     */\r\n    public constructor(json: string,  name: string, sessionId?: string) {\r\n        super(sessionId);\r\n        this.privJsonResult = json;\r\n        this.privEventName = name;\r\n    }\r\n\r\n    public get jsonString(): string {\r\n        return this.privJsonResult;\r\n    }\r\n\r\n    public get eventName(): string {\r\n        return this.privEventName;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    DynamicGrammarBuilder,\r\n    ServiceRecognizerBase,\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    ConversationTranscriber,\r\n    MeetingTranscriber,\r\n    Recognizer\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Allows additions of new phrases to improve speech recognition.\r\n *\r\n * Phrases added to the recognizer are effective at the start of the next recognition, or the next time the SpeechSDK must reconnect\r\n * to the speech service.\r\n */\r\nexport class PhraseListGrammar {\r\n    private privGrammerBuilder: DynamicGrammarBuilder;\r\n\r\n    private constructor(recogBase: ServiceRecognizerBase) {\r\n        this.privGrammerBuilder = recogBase.dynamicGrammar;\r\n    }\r\n\r\n    /**\r\n     * Creates a PhraseListGrammar from a given speech recognizer. Will accept any recognizer that derives from @class Recognizer.\r\n     * @param recognizer The recognizer to add phrase lists to.\r\n     */\r\n    public static fromRecognizer(recognizer: Recognizer | ConversationTranscriber | MeetingTranscriber): PhraseListGrammar {\r\n        const recoBase = recognizer.internalData as ServiceRecognizerBase;\r\n        return new PhraseListGrammar(recoBase);\r\n    }\r\n\r\n    /**\r\n     * Adds a single phrase to the current recognizer.\r\n     * @param phrase Phrase to add.\r\n     */\r\n    public addPhrase(phrase: string): void {\r\n        this.privGrammerBuilder.addPhrase(phrase);\r\n    }\r\n\r\n    /**\r\n     * Adds multiple phrases to the current recognizer.\r\n     * @param phrases Array of phrases to add.\r\n     */\r\n    public addPhrases(phrases: string[]): void {\r\n        this.privGrammerBuilder.addPhrase(phrases);\r\n    }\r\n\r\n    /**\r\n     * Clears all phrases added to the current recognizer.\r\n     */\r\n    public clear(): void {\r\n        this.privGrammerBuilder.clearPhrases();\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { PropertyCollection, PropertyId, ServicePropertyChannel, SpeechConfigImpl } from \"./Exports.js\";\r\nimport { OutputFormat } from \"./OutputFormat.js\";\r\n\r\n/**\r\n * Class that defines base configurations for dialog service connector\r\n * @class DialogServiceConfig\r\n */\r\nexport abstract class DialogServiceConfig {\r\n\r\n    /**\r\n     * Creates an instance of DialogService config.\r\n     * @constructor\r\n     */\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Sets an arbitrary property.\r\n     * @member DialogServiceConfig.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} name - The name of the property to set.\r\n     * @param {string} value - The new value of the property.\r\n     */\r\n    public abstract setProperty(name: string | PropertyId, value: string): void;\r\n\r\n    /**\r\n     * Returns the current value of an arbitrary property.\r\n     * @member DialogServiceConfig.prototype.getProperty\r\n     * @function\r\n     * @public\r\n     * @param {string} name - The name of the property to query.\r\n     * @param {string} def - The value to return in case the property is not known.\r\n     * @returns {string} The current value, or provided default, of the given property.\r\n     */\r\n    public abstract getProperty(name: string | PropertyId, def?: string): string;\r\n\r\n    /**\r\n     * @member DialogServiceConfig.prototype.setServiceProperty\r\n     * @function\r\n     * @public\r\n     * @param {name} The name of the property.\r\n     * @param {value} Value to set.\r\n     * @param {channel} The channel used to pass the specified property to service.\r\n     * @summary Sets a property value that will be passed to service using the specified channel.\r\n     */\r\n    public abstract setServiceProperty(name: string, value: string, channel: ServicePropertyChannel): void;\r\n\r\n    /**\r\n     * Sets the proxy configuration.\r\n     * Only relevant in Node.js environments.\r\n     * Added in version 1.4.0.\r\n     * @param proxyHostName The host name of the proxy server.\r\n     * @param proxyPort The port number of the proxy server.\r\n     */\r\n    public abstract setProxy(proxyHostName: string, proxyPort: number): void;\r\n\r\n    /**\r\n     * Sets the proxy configuration.\r\n     * Only relevant in Node.js environments.\r\n     * Added in version 1.4.0.\r\n     * @param proxyHostName The host name of the proxy server, without the protocol scheme (http://)\r\n     * @param porxyPort The port number of the proxy server.\r\n     * @param proxyUserName The user name of the proxy server.\r\n     * @param proxyPassword The password of the proxy server.\r\n     */\r\n    public abstract setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\r\n\r\n    /**\r\n     * Returns the configured language.\r\n     * @member DialogServiceConfig.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     */\r\n    public abstract get speechRecognitionLanguage(): string;\r\n\r\n    /**\r\n     * Gets/Sets the input language.\r\n     * @member DialogServiceConfig.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The language to use for recognition.\r\n     */\r\n    public abstract set speechRecognitionLanguage(value: string);\r\n\r\n    /**\r\n     * Sets the corresponding backend application identifier.\r\n     * @member DialogServiceConfig.prototype.Conversation_ApplicationId\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The application identifier to set.\r\n     */\r\n    // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n    public set applicationId(value: string) { }\r\n\r\n    public static get DialogTypes(): { BotFramework: string; CustomCommands: string } {\r\n        return {\r\n            BotFramework: \"bot_framework\",\r\n            CustomCommands: \"custom_commands\"\r\n        };\r\n    }\r\n}\r\n\r\n/**\r\n * Dialog Service configuration.\r\n * @class DialogServiceConfigImpl\r\n */\r\nexport class DialogServiceConfigImpl extends DialogServiceConfig {\r\n\r\n    private privSpeechConfig: SpeechConfigImpl;\r\n\r\n    /**\r\n     * Creates an instance of dialogService config.\r\n     */\r\n    public constructor() {\r\n        super();\r\n        this.privSpeechConfig = new SpeechConfigImpl();\r\n    }\r\n\r\n    /**\r\n     * Provides access to custom properties.\r\n     * @member DialogServiceConfigImpl.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The properties.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privSpeechConfig.properties;\r\n    }\r\n\r\n    /**\r\n     * Gets the speech recognition language.\r\n     * @member DialogServiceConfigImpl.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privSpeechConfig.speechRecognitionLanguage;\r\n    }\r\n\r\n    /**\r\n     * Sets the speech recognition language.\r\n     * @member DialogServiceConfigImpl.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The language to set.\r\n     */\r\n    public set speechRecognitionLanguage(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n        this.privSpeechConfig.speechRecognitionLanguage = value;\r\n    }\r\n\r\n    public get outputFormat(): OutputFormat {\r\n        return this.privSpeechConfig.outputFormat;\r\n    }\r\n\r\n    public set outputFormat(value: OutputFormat) {\r\n        this.privSpeechConfig.outputFormat = value;\r\n    }\r\n\r\n    /**\r\n     * Sets a named property as value\r\n     * @member DialogServiceConfigImpl.prototype.setProperty\r\n     * @function\r\n     * @public\r\n     * @param {PropertyId | string} name - The property to set.\r\n     * @param {string} value - The value.\r\n     */\r\n    public setProperty(name: string | PropertyId, value: string): void {\r\n        this.privSpeechConfig.setProperty(name, value);\r\n    }\r\n\r\n    /**\r\n     * Sets a named property as value\r\n     * @member DialogServiceConfigImpl.prototype.getProperty\r\n     * @function\r\n     * @public\r\n     * @param {PropertyId | string} name - The property to get.\r\n     * @param {string} def - The default value to return in case the property is not known.\r\n     * @returns {string} The current value, or provided default, of the given property.\r\n     */\r\n    public getProperty(name: string | PropertyId, def?: string): string {\r\n        void def;\r\n        return this.privSpeechConfig.getProperty(name);\r\n    }\r\n\r\n    /**\r\n     * Sets the proxy configuration.\r\n     * Only relevant in Node.js environments.\r\n     * Added in version 1.4.0.\r\n     * @param proxyHostName The host name of the proxy server, without the protocol scheme (http://)\r\n     * @param proxyPort The port number of the proxy server.\r\n     * @param proxyUserName The user name of the proxy server.\r\n     * @param proxyPassword The password of the proxy server.\r\n     */\r\n    public setProxy(proxyHostName: string, proxyPort: number, proxyUserName?: string, proxyPassword?: string): void {\r\n        this.setProperty(PropertyId.SpeechServiceConnection_ProxyHostName, proxyHostName);\r\n        this.setProperty(PropertyId.SpeechServiceConnection_ProxyPort, `${proxyPort}`);\r\n        if (proxyUserName) {\r\n            this.setProperty(PropertyId.SpeechServiceConnection_ProxyUserName, proxyUserName);\r\n        }\r\n        if (proxyPassword) {\r\n            this.setProperty(PropertyId.SpeechServiceConnection_ProxyPassword, proxyPassword);\r\n        }\r\n    }\r\n\r\n    public setServiceProperty(name: string, value: string, channel: ServicePropertyChannel): void {\r\n        void channel;\r\n        this.privSpeechConfig.setServiceProperty(name, value);\r\n    }\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member DialogServiceConfigImpl.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(): void {\r\n        return;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { DialogServiceConfig, DialogServiceConfigImpl } from \"./DialogServiceConfig.js\";\r\nimport { PropertyId } from \"./Exports.js\";\r\n\r\n/**\r\n * Class that defines configurations for the dialog service connector object for using a Bot Framework backend.\r\n * @class BotFrameworkConfig\r\n */\r\nexport class BotFrameworkConfig extends DialogServiceConfigImpl {\r\n\r\n    /**\r\n     * Creates an instance of BotFrameworkConfig.\r\n     */\r\n    public constructor() {\r\n        super();\r\n    }\r\n\r\n    /**\r\n     * Creates a bot framework configuration instance with the provided subscription information.\r\n     * @member BotFrameworkConfig.fromSubscription\r\n     * @function\r\n     * @public\r\n     * @param subscription Subscription key associated with the bot\r\n     * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\r\n     * resource name.\r\n     * @returns {BotFrameworkConfig} A new bot framework configuration instance.\r\n     */\r\n    public static fromSubscription(subscription: string, region: string, botId?: string): BotFrameworkConfig {\r\n        Contracts.throwIfNullOrWhitespace(subscription, \"subscription\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\r\n        botFrameworkConfig.setProperty(\r\n            PropertyId.Conversation_DialogType,\r\n            DialogServiceConfig.DialogTypes.BotFramework);\r\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscription);\r\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n\r\n        if (botId) {\r\n            botFrameworkConfig.setProperty(PropertyId.Conversation_ApplicationId, botId);\r\n        }\r\n\r\n        return botFrameworkConfig;\r\n    }\r\n\r\n    /**\r\n     * Creates a bot framework configuration instance for the specified authorization token and region.\r\n     * Note: The caller must ensure that an authorization token is valid. Before an authorization token expires, the\r\n     * caller must refresh it by setting the authorizationToken property on the corresponding\r\n     * DialogServiceConnector instance created with this config. The contents of configuration objects are copied\r\n     * when connectors are created, so setting authorizationToken on a DialogServiceConnector will not update the\r\n     * original configuration's authorization token. Create a new configuration instance or set the\r\n     * SpeechServiceAuthorization_Token property to update an existing instance if it will be used to create\r\n     * further DialogServiceConnectors.\r\n     * @member BotFrameworkConfig.fromAuthorizationToken\r\n     * @function\r\n     * @public\r\n     * @param authorizationToken The authorization token associated with the bot\r\n     * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\r\n     * resource name.\r\n     * @returns {BotFrameworkConfig} A new bot framework configuration instance.\r\n     */\r\n    public static fromAuthorizationToken(\r\n        authorizationToken: string, region: string, botId?: string\r\n    ): BotFrameworkConfig {\r\n        Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\r\n        botFrameworkConfig.setProperty(\r\n            PropertyId.Conversation_DialogType,\r\n            DialogServiceConfig.DialogTypes.BotFramework);\r\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\r\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n\r\n        if (botId) {\r\n            botFrameworkConfig.setProperty(PropertyId.Conversation_ApplicationId, botId);\r\n        }\r\n\r\n        return botFrameworkConfig;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of a BotFrameworkConfig.\r\n     * This method is intended only for users who use a non-default service host. The standard resource path will be\r\n     * assumed. For services with a non-standard resource path or no path at all, use fromEndpoint instead.\r\n     * Note: Query parameters are not allowed in the host URI and must be set by other APIs.\r\n     * Note: To use an authorization token with fromHost, use fromHost(URL) and then set the AuthorizationToken\r\n     * property on the created BotFrameworkConfig instance.\r\n     * Note: Added in version 1.15.0.\r\n     * @member BotFrameworkConfig.fromHost\r\n     * @function\r\n     * @public\r\n     * @param {URL | string} host - If a URL is provided, the fully-qualified host with protocol (e.g.\r\n     * wss://your.host.com:1234) will be used. If a string is provided, it will be embedded in\r\n     * wss://{host}.convai.speech.azure.us.\r\n     * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization\r\n     * token must be set.\r\n     * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\r\n     * resource name.\r\n     * @returns {BotFrameworkConfig} A new bot framework configuration instance.\r\n     */\r\n    public static fromHost(\r\n        host: URL | string,\r\n        subscriptionKey?: string,\r\n        botId?: string): BotFrameworkConfig {\r\n\r\n        void botId;\r\n        Contracts.throwIfNullOrUndefined(host, \"host\");\r\n        const resolvedHost: URL = host instanceof URL ? host : new URL(`wss://${host}.convai.speech.azure.us`);\r\n        Contracts.throwIfNullOrUndefined(resolvedHost, \"resolvedHost\");\r\n\r\n        const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\r\n        botFrameworkConfig.setProperty(\r\n            PropertyId.Conversation_DialogType,\r\n            DialogServiceConfig.DialogTypes.BotFramework);\r\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Host, resolvedHost.toString());\r\n\r\n        if (undefined !== subscriptionKey) {\r\n            botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n        }\r\n\r\n        return botFrameworkConfig;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of a BotFrameworkConfig.\r\n     * This method is intended only for users who use a non-standard service endpoint or parameters.\r\n     * Note: The query parameters specified in the endpoint URL are not changed, even if they are set by any other APIs.\r\n     * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\r\n     * fromEndpoint method, and then set authorizationToken=\"token\" on the created BotFrameworkConfig instance to\r\n     * use the authorization token.\r\n     * Note: Added in version 1.15.0.\r\n     * @member BotFrameworkConfig.fromEndpoint\r\n     * @function\r\n     * @public\r\n     * @param {URL} endpoint - The service endpoint to connect to.\r\n     * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization\r\n     * token must be set.\r\n     * @returns {BotFrameworkConfig} - A new bot framework configuration instance using the provided endpoint.\r\n     */\r\n    public static fromEndpoint(endpoint: URL, subscriptionKey?: string): BotFrameworkConfig {\r\n        Contracts.throwIfNull(endpoint, \"endpoint\");\r\n\r\n        const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\r\n        botFrameworkConfig.setProperty(\r\n            PropertyId.Conversation_DialogType,\r\n            DialogServiceConfig.DialogTypes.BotFramework);\r\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.toString());\r\n\r\n        if (undefined !== subscriptionKey) {\r\n            botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\r\n        }\r\n\r\n        return botFrameworkConfig;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { DialogServiceConfig, DialogServiceConfigImpl } from \"./DialogServiceConfig.js\";\r\nimport { PropertyId } from \"./Exports.js\";\r\n\r\n/**\r\n * Class that defines configurations for the dialog service connector object for using a CustomCommands backend.\r\n * @class CustomCommandsConfig\r\n */\r\nexport class CustomCommandsConfig extends DialogServiceConfigImpl {\r\n\r\n    /**\r\n     * Creates an instance of CustomCommandsConfig.\r\n     */\r\n    public constructor() {\r\n        super();\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the bot framework config with the specified subscription and region.\r\n     * @member CustomCommandsConfig.fromSubscription\r\n     * @function\r\n     * @public\r\n     * @param applicationId Speech Commands application id.\r\n     * @param subscription Subscription key associated with the bot\r\n     * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {CustomCommandsConfig} A new bot framework config.\r\n     */\r\n    public static fromSubscription(applicationId: string, subscription: string, region: string): CustomCommandsConfig {\r\n        Contracts.throwIfNullOrWhitespace(applicationId, \"applicationId\");\r\n        Contracts.throwIfNullOrWhitespace(subscription, \"subscription\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const customCommandsConfig: CustomCommandsConfig = new DialogServiceConfigImpl();\r\n        customCommandsConfig.setProperty(PropertyId.Conversation_DialogType, DialogServiceConfig.DialogTypes.CustomCommands);\r\n        customCommandsConfig.setProperty(PropertyId.Conversation_ApplicationId, applicationId);\r\n        customCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscription);\r\n        customCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n        return customCommandsConfig;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the bot framework config with the specified Speech Commands application id, authorization token and region.\r\n     * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n     * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\n     * As configuration values are copied when creating a new recognizer, the new token value will not apply to recognizers that have already been created.\r\n     * For recognizers that have been created before, you need to set authorization token of the corresponding recognizer\r\n     * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\r\n     * @member CustomCommandsConfig.fromAuthorizationToken\r\n     * @function\r\n     * @public\r\n     * @param applicationId Speech Commands application id.\r\n     * @param authorizationToken The authorization token associated with the application.\r\n     * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n     * @returns {CustomCommandsConfig} A new speech commands config.\r\n     */\r\n    public static fromAuthorizationToken(applicationId: string, authorizationToken: string, region: string): CustomCommandsConfig {\r\n        Contracts.throwIfNullOrWhitespace(applicationId, \"applicationId\");\r\n        Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\r\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n        const customCommandsConfig: CustomCommandsConfig = new DialogServiceConfigImpl();\r\n        customCommandsConfig.setProperty(PropertyId.Conversation_DialogType, DialogServiceConfig.DialogTypes.CustomCommands);\r\n        customCommandsConfig.setProperty(PropertyId.Conversation_ApplicationId, applicationId);\r\n        customCommandsConfig.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\r\n        customCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n        return customCommandsConfig;\r\n    }\r\n\r\n    /**\r\n     * Sets the corresponding backend application identifier.\r\n     * @member CustomCommandsConfig.prototype.Conversation_ApplicationId\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The application identifier to set.\r\n     */\r\n    public set applicationId(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n        this.setProperty(PropertyId.Conversation_ApplicationId, value);\r\n    }\r\n\r\n    /**\r\n     * Gets the corresponding backend application identifier.\r\n     * @member CustomCommandsConfig.prototype.Conversation_ApplicationId\r\n     * @function\r\n     * @public\r\n     * @param {string} value - The application identifier to get.\r\n     */\r\n    public get applicationId(): string {\r\n        return this.getProperty(PropertyId.Conversation_ApplicationId);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { DialogConnectionFactory } from \"../common.speech/DialogConnectorFactory.js\";\r\nimport {\r\n    DialogServiceAdapter,\r\n    IAgentConfig,\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    RecognitionMode,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechServiceConfig\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    Deferred,\r\n    marshalPromiseToCallbacks\r\n} from \"../common/Exports.js\";\r\nimport { ActivityReceivedEventArgs } from \"./ActivityReceivedEventArgs.js\";\r\nimport { AudioConfigImpl } from \"./Audio/AudioConfig.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { DialogServiceConfig, DialogServiceConfigImpl } from \"./DialogServiceConfig.js\";\r\nimport {\r\n    AudioConfig,\r\n    PropertyCollection,\r\n    Recognizer,\r\n    SpeechRecognitionCanceledEventArgs,\r\n    SpeechRecognitionEventArgs,\r\n    SpeechRecognitionResult\r\n} from \"./Exports.js\";\r\nimport { PropertyId } from \"./PropertyId.js\";\r\nimport { TurnStatusReceivedEventArgs } from \"./TurnStatusReceivedEventArgs.js\";\r\n\r\n/**\r\n * Dialog Service Connector\r\n * @class DialogServiceConnector\r\n */\r\nexport class DialogServiceConnector extends Recognizer {\r\n    private privIsDisposed: boolean;\r\n    private isTurnComplete: boolean;\r\n\r\n    /**\r\n     * Initializes an instance of the DialogServiceConnector.\r\n     * @constructor\r\n     * @param {DialogServiceConfig} dialogConfig - Set of properties to configure this recognizer.\r\n     * @param {AudioConfig} audioConfig - An optional audio config associated with the recognizer\r\n     */\r\n    public constructor(dialogConfig: DialogServiceConfig, audioConfig?: AudioConfig) {\r\n        const dialogServiceConfigImpl = dialogConfig as DialogServiceConfigImpl;\r\n        Contracts.throwIfNull(dialogConfig, \"dialogConfig\");\r\n\r\n        super(audioConfig, dialogServiceConfigImpl.properties, new DialogConnectionFactory());\r\n\r\n        this.isTurnComplete = true;\r\n        this.privIsDisposed = false;\r\n        this.privProperties = dialogServiceConfigImpl.properties.clone();\r\n\r\n        const agentConfig = this.buildAgentConfig();\r\n        this.privReco.agentConfig.set(agentConfig);\r\n    }\r\n\r\n    /**\r\n     * The event recognizing signals that an intermediate recognition result is received.\r\n     * @member DialogServiceConnector.prototype.recognizing\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognizing: (sender: DialogServiceConnector, event: SpeechRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event recognized signals that a final recognition result is received.\r\n     * @member DialogServiceConfig.prototype.recognized\r\n     * @function\r\n     * @public\r\n     */\r\n    public recognized: (sender: DialogServiceConnector, event: SpeechRecognitionEventArgs) => void;\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during recognition.\r\n     * @member DialogServiceConnector.prototype.canceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public canceled: (sender: DialogServiceConnector, event: SpeechRecognitionCanceledEventArgs) => void;\r\n\r\n    /**\r\n     * The event activityReceived signals that an activity has been received.\r\n     * @member DialogServiceConnector.prototype.activityReceived\r\n     * @function\r\n     * @public\r\n     */\r\n    public activityReceived: (sender: DialogServiceConnector, event: ActivityReceivedEventArgs) => void;\r\n\r\n    /**\r\n     * The event turnStatusReceived signals that a turn status message has been received. These messages are\r\n     * associated with both an interaction and a conversation. They are used to notify the client in the event\r\n     * of an interaction failure with the dialog backend, e.g. in the event of a network issue, timeout, crash,\r\n     * or other problem.\r\n     * @member DialogServiceConnector.prototype.turnStatusReceived\r\n     * @function\r\n     * @public\r\n     */\r\n    public turnStatusReceived: (sender: DialogServiceConnector, event: TurnStatusReceivedEventArgs) => void;\r\n\r\n    /**\r\n     * Starts a connection to the service.\r\n     * Users can optionally call connect() to manually set up a connection in advance, before starting interactions.\r\n     *\r\n     * Note: On return, the connection might not be ready yet. Please subscribe to the Connected event to\r\n     * be notified when the connection is established.\r\n     * @member DialogServiceConnector.prototype.connect\r\n     * @function\r\n     * @public\r\n     */\r\n    public connect(cb?: () => void, err?: (error: string) => void): void {\r\n        marshalPromiseToCallbacks(this.privReco.connect(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Closes the connection the service.\r\n     * Users can optionally call disconnect() to manually shutdown the connection of the associated DialogServiceConnector.\r\n     *\r\n     * If disconnect() is called during a recognition, recognition will fail and cancel with an error.\r\n     */\r\n    public disconnect(cb?: () => void, err?: (error: string) => void): void {\r\n        marshalPromiseToCallbacks(this.privReco.disconnect(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member DialogServiceConnector.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Sets the authorization token used to communicate with the service.\r\n     * @member DialogServiceConnector.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} token - Authorization token.\r\n     */\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this DialogServiceConnector.\r\n     * @member DialogServiceConnector.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this DialogServiceConnector.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /** Gets the template for the activity generated by service from speech.\r\n     * Properties from the template will be stamped on the generated activity.\r\n     * It can be empty\r\n     */\r\n    public get speechActivityTemplate(): string {\r\n        return this.properties.getProperty(PropertyId.Conversation_Speech_Activity_Template);\r\n    }\r\n\r\n    /** Sets the template for the activity generated by service from speech.\r\n     * Properties from the template will be stamped on the generated activity.\r\n     * It can be null or empty.\r\n     * Note: it has to be a valid Json object.\r\n     */\r\n    public set speechActivityTemplate(speechActivityTemplate: string) {\r\n        this.properties.setProperty(PropertyId.Conversation_Speech_Activity_Template, speechActivityTemplate);\r\n    }\r\n\r\n    /**\r\n     * Starts recognition and stops after the first utterance is recognized.\r\n     * @member DialogServiceConnector.prototype.listenOnceAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback that received the result when the reco has completed.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public listenOnceAsync(cb?: (e: SpeechRecognitionResult) => void, err?: (e: string) => void): void {\r\n        if (this.isTurnComplete) {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            const callbackHolder = async (): Promise<SpeechRecognitionResult> => {\r\n                await this.privReco.connect();\r\n                await this.implRecognizerStop();\r\n                this.isTurnComplete = false;\r\n\r\n                const ret: Deferred<SpeechRecognitionResult> = new Deferred<SpeechRecognitionResult>();\r\n                await this.privReco.recognize(RecognitionMode.Conversation, ret.resolve, ret.reject);\r\n\r\n                const e: SpeechRecognitionResult = await ret.promise;\r\n                await this.implRecognizerStop();\r\n\r\n                return e;\r\n            };\r\n\r\n            const retPromise: Promise<SpeechRecognitionResult> = callbackHolder();\r\n\r\n            retPromise.catch((): void => {\r\n                // Destroy the recognizer.\r\n                // We've done all we can here.\r\n                // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n                this.dispose(true).catch((): void => { });\r\n            });\r\n\r\n            marshalPromiseToCallbacks(retPromise.finally((): void => {\r\n                this.isTurnComplete = true;\r\n            }), cb, err);\r\n        }\r\n    }\r\n\r\n    public sendActivityAsync(activity: string, cb?: () => void, errCb?: (error: string) => void): void {\r\n        marshalPromiseToCallbacks((this.privReco as DialogServiceAdapter).sendMessage(activity), cb, errCb);\r\n    }\r\n\r\n    /**\r\n     * closes all external resources held by an instance of this class.\r\n     * @member DialogServiceConnector.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, err?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privIsDisposed);\r\n\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, err);\r\n    }\r\n\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privIsDisposed) {\r\n            return;\r\n        }\r\n\r\n        if (disposing) {\r\n            this.privIsDisposed = true;\r\n            await this.implRecognizerStop();\r\n            await super.dispose(disposing);\r\n        }\r\n    }\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.privProperties);\r\n    }\r\n\r\n    protected createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n\r\n        const audioSource: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n\r\n        return new DialogServiceAdapter(authentication, connectionFactory, audioSource, recognizerConfig, this);\r\n    }\r\n\r\n    private buildAgentConfig(): IAgentConfig {\r\n        const communicationType = this.properties.getProperty(\"Conversation_Communication_Type\", \"Default\");\r\n\r\n        return {\r\n            botInfo: {\r\n                commType: communicationType,\r\n                commandsCulture: undefined,\r\n                connectionId: this.properties.getProperty(PropertyId.Conversation_Agent_Connection_Id),\r\n                conversationId: this.properties.getProperty(PropertyId.Conversation_Conversation_Id, undefined),\r\n                fromId: this.properties.getProperty(PropertyId.Conversation_From_Id, undefined),\r\n                ttsAudioFormat: this.properties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined)\r\n            },\r\n            version: 0.2\r\n        };\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection,\r\n} from \"../common.browser/Exports.js\";\r\nimport { OutputFormatPropertyName } from \"../common.speech/Exports.js\";\r\nimport { IConnection, IStringDictionary } from \"../common/Exports.js\";\r\nimport { DialogServiceConfig, OutputFormat, PropertyId } from \"../sdk/Exports.js\";\r\nimport { ConnectionFactoryBase } from \"./ConnectionFactoryBase.js\";\r\nimport { AuthInfo, RecognizerConfig, WebsocketMessageFormatter } from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport { QueryParameterNames } from \"./QueryParameterNames.js\";\r\n\r\nexport class DialogConnectionFactory extends ConnectionFactoryBase {\r\n\r\n    private static readonly ApiKey: string = \"api\";\r\n    private static readonly BaseUrl: string = \"convai.speech\";\r\n\r\n    public create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): IConnection {\r\n\r\n        const applicationId: string = config.parameters.getProperty(PropertyId.Conversation_ApplicationId, \"\");\r\n        const dialogType: string = config.parameters.getProperty(PropertyId.Conversation_DialogType);\r\n        const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n        const language: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, \"en-US\");\r\n        const requestTurnStatus: string = config.parameters.getProperty(PropertyId.Conversation_Request_Bot_Status_Messages, \"true\");\r\n\r\n        const queryParams: IStringDictionary<string> = {};\r\n        queryParams[HeaderNames.ConnectionId] = connectionId;\r\n        queryParams[QueryParameterNames.Format] = config.parameters.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]).toLowerCase();\r\n        queryParams[QueryParameterNames.Language] = language;\r\n        queryParams[QueryParameterNames.RequestBotStatusMessages] = requestTurnStatus;\r\n        if (applicationId) {\r\n            queryParams[QueryParameterNames.BotId] = applicationId;\r\n            if (dialogType === DialogServiceConfig.DialogTypes.CustomCommands) {\r\n                queryParams[HeaderNames.CustomCommandsAppId] = applicationId;\r\n            }\r\n        }\r\n\r\n        const resourceInfix: string =\r\n            dialogType === DialogServiceConfig.DialogTypes.CustomCommands ? \"commands/\"\r\n            : \"\";\r\n        const version: string =\r\n            dialogType === DialogServiceConfig.DialogTypes.CustomCommands ? \"v1\"\r\n            : dialogType === DialogServiceConfig.DialogTypes.BotFramework ? \"v3\"\r\n            : \"v0\";\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n\r\n        if (authInfo.token != null && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n\r\n        // The URL used for connection is chosen in a priority order of specification:\r\n        //  1. If a custom endpoint is provided, that URL is used verbatim.\r\n        //  2. If a custom host is provided (e.g. \"wss://my.custom.endpoint.com:1123\"), a URL is constructed from it.\r\n        //  3. If no custom connection details are provided, a URL is constructed from default values.\r\n        let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, \"\");\r\n        if (!endpoint) {\r\n            const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n            const host: string = config.parameters.getProperty(\r\n                PropertyId.SpeechServiceConnection_Host,\r\n                `wss://${region}.${DialogConnectionFactory.BaseUrl}${hostSuffix}`);\r\n            const standardizedHost: string = host.endsWith(\"/\") ? host : host + \"/\";\r\n            endpoint = `${standardizedHost}${resourceInfix}${DialogConnectionFactory.ApiKey}/${version}`;\r\n        }\r\n\r\n        this.setCommonUrlParams(config, queryParams, endpoint);\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n        return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ServicePropertiesPropertyName,\r\n} from \"../common.speech/Exports.js\";\r\nimport { IConnection, IStringDictionary } from \"../common/Exports.js\";\r\nimport { PropertyId } from \"../sdk/Exports.js\";\r\nimport { AuthInfo, IConnectionFactory, RecognizerConfig } from \"./Exports.js\";\r\nimport { QueryParameterNames } from \"./QueryParameterNames.js\";\r\n\r\nexport abstract class ConnectionFactoryBase implements IConnectionFactory {\r\n\r\n    public static getHostSuffix(region: string): string {\r\n        if (!!region) {\r\n            if (region.toLowerCase().startsWith(\"china\")) {\r\n                return \".azure.cn\";\r\n            }\r\n            if (region.toLowerCase().startsWith(\"usgov\")) {\r\n                return \".azure.us\";\r\n            }\r\n        }\r\n        return \".microsoft.com\";\r\n    }\r\n\r\n    public abstract create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): IConnection;\r\n\r\n    protected setCommonUrlParams(\r\n        config: RecognizerConfig,\r\n        queryParams: IStringDictionary<string>,\r\n        endpoint: string): void {\r\n\r\n        const propertyIdToParameterMap: Map<number, string> = new Map([\r\n            [PropertyId.Speech_SegmentationSilenceTimeoutMs, QueryParameterNames.SegmentationSilenceTimeoutMs],\r\n            [PropertyId.SpeechServiceConnection_EnableAudioLogging, QueryParameterNames.EnableAudioLogging],\r\n            [PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs, QueryParameterNames.EndSilenceTimeoutMs],\r\n            [PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs, QueryParameterNames.InitialSilenceTimeoutMs],\r\n            [PropertyId.SpeechServiceResponse_PostProcessingOption, QueryParameterNames.Postprocessing],\r\n            [PropertyId.SpeechServiceResponse_ProfanityOption, QueryParameterNames.Profanity],\r\n            [PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, QueryParameterNames.EnableWordLevelTimestamps],\r\n            [PropertyId.SpeechServiceResponse_StablePartialResultThreshold, QueryParameterNames.StableIntermediateThreshold],\r\n        ]);\r\n\r\n        propertyIdToParameterMap.forEach((parameterName: string, propertyId: PropertyId): void => {\r\n            this.setUrlParameter(propertyId, parameterName, config, queryParams, endpoint);\r\n        });\r\n\r\n\r\n        const serviceProperties: IStringDictionary<string> = JSON.parse(config.parameters.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n\r\n        Object.keys(serviceProperties).forEach((value: string): void => {\r\n            queryParams[value] = serviceProperties[value];\r\n        });\r\n    }\r\n\r\n    protected setUrlParameter(\r\n        propId: PropertyId,\r\n        parameterName: string,\r\n        config: RecognizerConfig,\r\n        queryParams: IStringDictionary<string>,\r\n        endpoint: string): void {\r\n\r\n        const value: string = config.parameters.getProperty(propId, undefined);\r\n\r\n        // FIXME: The .search() check will incorrectly match parameter name anywhere in the string\r\n        //        including e.g. the path portion, or even as a substring of other query parameters\r\n        if (value && (!endpoint || endpoint.search(parameterName) === -1)) {\r\n            queryParams[parameterName] = value.toLocaleLowerCase();\r\n        }\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport class QueryParameterNames {\r\n    public static BotId: string = \"botid\";\r\n    public static CustomSpeechDeploymentId: string = \"cid\";\r\n    public static CustomVoiceDeploymentId: string = \"deploymentId\";\r\n    public static EnableAudioLogging: string = \"storeAudio\";\r\n    public static EnableLanguageId: string = \"lidEnabled\";\r\n    public static EnableWordLevelTimestamps: string = \"wordLevelTimestamps\";\r\n    public static EndSilenceTimeoutMs: string = \"endSilenceTimeoutMs\";\r\n    public static SegmentationSilenceTimeoutMs: string = \"segmentationSilenceTimeoutMs\";\r\n    public static Format: string = \"format\";\r\n    public static InitialSilenceTimeoutMs: string = \"initialSilenceTimeoutMs\";\r\n    public static Language: string = \"language\";\r\n    public static Profanity: string = \"profanity\";\r\n    public static RequestBotStatusMessages: string = \"enableBotMessageStatus\";\r\n    public static StableIntermediateThreshold: string = \"stableIntermediateThreshold\";\r\n    public static StableTranslation: string = \"stableTranslation\";\r\n    public static TestHooks: string = \"testhooks\";\r\n    public static Postprocessing: string = \"postprocessing\";\r\n    public static CtsMeetingId: string = \"meetingId\";\r\n    public static CtsDeviceId: string = \"deviceId\";\r\n    public static CtsIsParticipant: string = \"isParticipant\";\r\n    public static EnableAvatar: string = \"enableTalkingAvatar\";\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { PullAudioOutputStream } from \"./Audio/AudioOutputStream.js\";\r\n\r\ninterface IActivity {\r\n    conversation?: any;\r\n    id?: string;\r\n    replyToId?: string;\r\n    type?: string;\r\n    text?: string;\r\n    speak?: any;\r\n}\r\n\r\n/**\r\n * Defines contents of received message/events.\r\n * @class ActivityReceivedEventArgs\r\n */\r\nexport class ActivityReceivedEventArgs {\r\n    private privActivity: IActivity;\r\n    private privAudioStream: PullAudioOutputStream;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {any} activity - The activity..\r\n     */\r\n    public constructor(activity: any, audioStream?: PullAudioOutputStream) {\r\n        this.privActivity = activity as IActivity;\r\n        this.privAudioStream = audioStream;\r\n    }\r\n\r\n    /**\r\n     * Gets the received activity\r\n     * @member ActivityReceivedEventArgs.prototype.activity\r\n     * @function\r\n     * @public\r\n     * @returns {any} the received activity.\r\n     */\r\n    public get activity(): any {\r\n        return this.privActivity;\r\n    }\r\n\r\n    public get audioStream(): PullAudioOutputStream {\r\n        return this.privAudioStream;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ITurnStatusResponsePayload,\r\n    TurnStatusResponsePayload\r\n    } from \"../common.speech/ServiceMessages/TurnStatusPayload.js\";\r\n\r\n/**\r\n * Defines contents of received message/events.\r\n * @class TurnStatusReceivedEventArgs\r\n */\r\nexport class TurnStatusReceivedEventArgs {\r\n    private privTurnStatus: ITurnStatusResponsePayload;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} turnStatus - The JSON-encoded turn status message.\r\n     */\r\n    public constructor(turnStatus: string) {\r\n        this.privTurnStatus = TurnStatusResponsePayload.fromJSON(turnStatus);\r\n    }\r\n\r\n    /**\r\n     * Gets the interaction identifier associated with this turn status event.\r\n     * @member TurnStatusReceivedEventArgs.prototype.interactionId\r\n     * @function\r\n     * @public\r\n     * @returns {any} the received interaction id.\r\n     */\r\n    public get interactionId(): any {\r\n        return this.privTurnStatus.interactionId;\r\n    }\r\n\r\n    /**\r\n     * Gets the conversation identifier associated with this turn status event.\r\n     * @member TurnStatusReceivedEventArgs.prototype.conversationId\r\n     * @function\r\n     * @public\r\n     * @returns {any} the received conversation id.\r\n     */\r\n    public get conversationId(): any {\r\n        return this.privTurnStatus.conversationId;\r\n    }\r\n\r\n    /**\r\n     * Gets the received turn status code.\r\n     * @member TurnStatusReceivedEventArgs.prototype.statusCode\r\n     * @function\r\n     * @public\r\n     * @returns {number} the received turn status.\r\n     */\r\n    public get statusCode(): number {\r\n        return this.privTurnStatus.statusCode; // eslint-disable-line @typescript-eslint/no-unsafe-return\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport interface ITurnStatusResponsePayload {\r\n    interactionId: string;\r\n    conversationId: string;\r\n    statusCode: any;\r\n}\r\n\r\nexport class TurnStatusResponsePayload implements ITurnStatusResponsePayload {\r\n    private privMessageStatusResponse: ITurnStatusResponsePayload;\r\n\r\n    private constructor(json: string) {\r\n        this.privMessageStatusResponse = JSON.parse(json) as ITurnStatusResponsePayload;\r\n    }\r\n\r\n    public static fromJSON(json: string): TurnStatusResponsePayload {\r\n        return new TurnStatusResponsePayload(json);\r\n    }\r\n\r\n    public get interactionId(): string {\r\n        return this.privMessageStatusResponse.interactionId;\r\n    }\r\n\r\n    public get conversationId(): string {\r\n        return this.privMessageStatusResponse.conversationId;\r\n    }\r\n\r\n    public get statusCode(): any {\r\n        // Payloads may contain a limited set of textual representations or a numeric status\r\n        // code. The textual values are here converted into numeric ones.\r\n        switch (this.privMessageStatusResponse.statusCode) {\r\n            case \"Success\":\r\n                return 200;\r\n            case \"Failed\":\r\n                return 400;\r\n            case \"TimedOut\":\r\n                return 429;\r\n            default:\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-return\r\n                return this.privMessageStatusResponse.statusCode;\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines channels used to pass property settings to service.\r\n * Added in version 1.7.0.\r\n */\r\nexport enum ServicePropertyChannel {\r\n    /**\r\n     * Uses URI query parameter to pass property settings to service.\r\n     */\r\n    UriQueryParameter = 0.\r\n}\r\n","// Copyright (c) Microsoft Corporation.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Profanity option.\r\n * Added in version 1.7.0.\r\n */\r\nexport enum ProfanityOption {\r\n    Masked = 0,\r\n    Removed = 1,\r\n    Raw = 2\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError } from \"../../common/Error.js\";\r\nimport { AudioStreamFormat } from \"../Exports.js\";\r\nimport { AudioStreamFormatImpl } from \"./AudioStreamFormat.js\";\r\n\r\ntype AudioDataTypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array;\r\n/**\r\n * Base audio player class\r\n * TODO: Plays only PCM for now.\r\n * @class\r\n */\r\nexport class BaseAudioPlayer {\r\n\r\n    private audioContext: AudioContext = null;\r\n    private gainNode: GainNode = null;\r\n    private audioFormat: AudioStreamFormatImpl;\r\n    private autoUpdateBufferTimer: any = 0;\r\n    private samples: Float32Array;\r\n    private startTime: number;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {AudioStreamFormat} audioFormat audio stream format recognized by the player.\r\n     */\r\n    public constructor(audioFormat?: AudioStreamFormat) {\r\n        if (audioFormat === undefined) {\r\n            audioFormat = AudioStreamFormat.getDefaultInputFormat();\r\n        }\r\n        this.init(audioFormat);\r\n    }\r\n\r\n    /**\r\n     * play Audio sample\r\n     * @param newAudioData audio data to be played.\r\n     */\r\n    public playAudioSample(newAudioData: ArrayBuffer, cb?: () => void, err?: (error: string) => void): void {\r\n        try {\r\n            this.ensureInitializedContext();\r\n            const audioData = this.formatAudioData(newAudioData);\r\n            const newSamplesData = new Float32Array(this.samples.length + audioData.length);\r\n            newSamplesData.set(this.samples, 0);\r\n            newSamplesData.set(audioData, this.samples.length);\r\n            this.samples = newSamplesData;\r\n            if (!!cb) {\r\n                cb();\r\n            }\r\n        } catch (e) {\r\n            if (!!err) {\r\n                err(e as string);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * stops audio and clears the buffers\r\n     */\r\n    public stopAudio(cb?: () => void, err?: (error: string) => void): void {\r\n        if (this.audioContext !== null) {\r\n            this.samples = new Float32Array();\r\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n            clearInterval(this.autoUpdateBufferTimer);\r\n            this.audioContext.close().then((): void => {\r\n                if (!!cb) {\r\n                    cb();\r\n                }\r\n            }, (error: string): void => {\r\n                if (!!err) {\r\n                    err(error);\r\n                }\r\n            });\r\n            this.audioContext = null;\r\n        }\r\n    }\r\n\r\n    private init(audioFormat: AudioStreamFormat): void {\r\n        this.audioFormat = audioFormat as AudioStreamFormatImpl;\r\n        this.samples = new Float32Array();\r\n    }\r\n\r\n    private ensureInitializedContext(): void {\r\n        if (this.audioContext === null) {\r\n            this.createAudioContext();\r\n            const timerPeriod = 200;\r\n            this.autoUpdateBufferTimer = setInterval((): void => {\r\n                this.updateAudioBuffer();\r\n            }, timerPeriod);\r\n        }\r\n    }\r\n\r\n    private createAudioContext(): void {\r\n        // new ((window as any).AudioContext || (window as any).webkitAudioContext)();\r\n        this.audioContext = AudioStreamFormatImpl.getAudioContext();\r\n\r\n        // TODO: Various examples shows this gain node, it does not seem to be needed unless we plan\r\n        // to control the volume, not likely\r\n        this.gainNode = this.audioContext.createGain();\r\n        this.gainNode.gain.value = 1;\r\n        this.gainNode.connect(this.audioContext.destination);\r\n        this.startTime = this.audioContext.currentTime;\r\n    }\r\n\r\n    private formatAudioData(audioData: ArrayBuffer): Float32Array {\r\n        switch (this.audioFormat.bitsPerSample) {\r\n            case 8:\r\n                return this.formatArrayBuffer(new Int8Array(audioData), 128);\r\n            case 16:\r\n                return this.formatArrayBuffer(new Int16Array(audioData), 32768);\r\n            case 32:\r\n                return this.formatArrayBuffer(new Int32Array(audioData), 2147483648);\r\n            default:\r\n                throw new InvalidOperationError(\"Only WAVE_FORMAT_PCM (8/16/32 bps) format supported at this time\");\r\n        }\r\n    }\r\n\r\n    private formatArrayBuffer(audioData: AudioDataTypedArray, maxValue: number): Float32Array {\r\n        const float32Data = new Float32Array(audioData.length);\r\n        for (let i = 0; i < audioData.length; i++) {\r\n            float32Data[i] = audioData[i] / maxValue;\r\n        }\r\n        return float32Data;\r\n    }\r\n\r\n    private updateAudioBuffer(): void {\r\n        if (this.samples.length === 0) {\r\n            return;\r\n        }\r\n\r\n        const channelCount = this.audioFormat.channels;\r\n        const bufferSource = this.audioContext.createBufferSource();\r\n        const frameCount = this.samples.length / channelCount;\r\n        const audioBuffer = this.audioContext.createBuffer(channelCount, frameCount, this.audioFormat.samplesPerSec);\r\n\r\n        // TODO: Should we do the conversion in the pushAudioSample instead?\r\n        for (let channel = 0; channel < channelCount; channel++) {\r\n            // Fill in individual channel data\r\n            let channelOffset = channel;\r\n            const audioData = audioBuffer.getChannelData(channel);\r\n            for (let i = 0; i < this.samples.length; i++, channelOffset += channelCount) {\r\n                audioData[i] = this.samples[channelOffset];\r\n            }\r\n        }\r\n\r\n        if (this.startTime < this.audioContext.currentTime) {\r\n            this.startTime = this.audioContext.currentTime;\r\n        }\r\n\r\n        bufferSource.buffer = audioBuffer;\r\n        bufferSource.connect(this.gainNode);\r\n        bufferSource.start(this.startTime);\r\n\r\n        // Make sure we play the next sample after the current one.\r\n        this.startTime += audioBuffer.duration;\r\n\r\n        // Clear the samples for the next pushed data.\r\n        this.samples = new Float32Array();\r\n    }\r\n\r\n    private async playAudio(audioData: ArrayBuffer): Promise<void> {\r\n        if (this.audioContext === null) {\r\n            this.createAudioContext();\r\n        }\r\n        const source: AudioBufferSourceNode = this.audioContext.createBufferSource();\r\n        const destination: AudioDestinationNode = this.audioContext.destination;\r\n        await this.audioContext.decodeAudioData(audioData, (newBuffer: AudioBuffer): void => {\r\n            source.buffer = newBuffer;\r\n            source.connect(destination);\r\n            source.start(0);\r\n        });\r\n    }\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport {\r\n    ConnectionMessage\r\n} from \"./Exports.js\";\r\n\r\nexport class ConnectionMessageEventArgs {\r\n\r\n    private privConnectionMessage: ConnectionMessage;\r\n\r\n    public constructor(message: ConnectionMessage) {\r\n        this.privConnectionMessage = message;\r\n    }\r\n\r\n    /**\r\n     * Gets the <see cref=\"ConnectionMessage\"/> associated with this <see cref=\"ConnectionMessageEventArgs\"/>.\r\n     */\r\n    public get message(): ConnectionMessage {\r\n        return this.privConnectionMessage;\r\n    }\r\n\r\n    /**\r\n     * Returns a string that represents the connection message event.\r\n     */\r\n    public toString(): string {\r\n        return \"Message: \" + this.privConnectionMessage.toString();\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { VoiceProfileType } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines Voice Profile class for Speaker Recognition\r\n * @class VoiceProfile\r\n */\r\nexport class VoiceProfile {\r\n    private privId: string;\r\n    private privProfileType: VoiceProfileType;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} profileId - profileId of this Voice Profile.\r\n     * @param {VoiceProfileType} profileType - profileType of this Voice Profile.\r\n     */\r\n    public constructor(profileId: string, profileType: VoiceProfileType) {\r\n        this.privId = profileId;\r\n        this.privProfileType = profileType;\r\n    }\r\n\r\n    /**\r\n     * profileId of this Voice Profile instance\r\n     * @member VoiceProfile.prototype.profileId\r\n     * @function\r\n     * @public\r\n     * @returns {string} profileId of this Voice Profile instance.\r\n     */\r\n    public get profileId(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    /**\r\n     * profileType of this Voice Profile instance\r\n     * @member VoiceProfile.prototype.profileType\r\n     * @function\r\n     * @public\r\n     * @returns {VoiceProfileType} profile type of this Voice Profile instance.\r\n     */\r\n    public get profileType(): VoiceProfileType {\r\n        return this.privProfileType;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { CancellationErrorCodePropertyName } from \"../common.speech/Exports.js\";\r\nimport {\r\n    CancellationDetailsBase,\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    PropertyCollection,\r\n    ResultReason\r\n} from \"./Exports.js\";\r\n\r\nexport interface EnrollmentResultDetails {\r\n    profileId: string;\r\n    enrollmentsCount: number;\r\n    enrollmentsLength: number;\r\n    enrollmentsSpeechLength: number;\r\n    remainingEnrollmentsCount: number;\r\n    remainingEnrollmentsSpeechLength: number;\r\n    audioLength: number;\r\n    audioSpeechLength: number;\r\n    enrollmentStatus: string;\r\n}\r\n\r\nexport interface EnrollmentResultJSON {\r\n    profileId: string;\r\n    enrollmentsCount: number;\r\n    enrollmentsLength: string;\r\n    enrollmentsSpeechLength: string;\r\n    remainingEnrollmentsCount: number;\r\n    remainingEnrollmentsSpeechLength: string;\r\n    audioLength: string;\r\n    audioSpeechLength: string;\r\n    enrollmentStatus: string;\r\n    remainingEnrollments?: number;\r\n    identificationProfileId?: string;\r\n    verificationProfileId?: string;\r\n}\r\n\r\n/**\r\n * Output format\r\n * @class VoiceProfileEnrollmentResult\r\n */\r\nexport class VoiceProfileEnrollmentResult {\r\n    private privReason: ResultReason;\r\n    private privDetails: EnrollmentResultDetails;\r\n    private privProperties: PropertyCollection;\r\n    private privErrorDetails: string;\r\n\r\n    public constructor(reason: ResultReason, json: string, statusText: string) {\r\n        this.privReason = reason;\r\n        this.privProperties = new PropertyCollection();\r\n        if (this.privReason !== ResultReason.Canceled) {\r\n            if (!!json) {\r\n                this.privDetails = JSON.parse(json) as EnrollmentResultDetails;\r\n                if (this.privDetails.enrollmentStatus.toLowerCase() === \"enrolling\") {\r\n                    this.privReason = ResultReason.EnrollingVoiceProfile;\r\n                }\r\n            }\r\n        } else {\r\n            this.privErrorDetails = statusText;\r\n            this.privProperties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.ServiceError]);\r\n        }\r\n    }\r\n\r\n    public get reason(): ResultReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    public get enrollmentsCount(): number {\r\n        return this.privDetails.enrollmentsCount;\r\n    }\r\n\r\n    public get enrollmentsLength(): number {\r\n        return this.privDetails.enrollmentsLength;\r\n    }\r\n\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public get enrollmentResultDetails(): EnrollmentResultDetails {\r\n        return this.privDetails;\r\n    }\r\n\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n\r\n    public static FromIdentificationProfileList(json: { value: EnrollmentResultJSON[] }): VoiceProfileEnrollmentResult[] {\r\n        const results: VoiceProfileEnrollmentResult[] = [];\r\n        for (const item of json.value) {\r\n            const reason: ResultReason = item.enrollmentStatus.toLowerCase() === \"enrolling\" ?\r\n                ResultReason.EnrollingVoiceProfile : item.enrollmentStatus.toLowerCase() === \"enrolled\" ?\r\n                ResultReason.EnrolledVoiceProfile : ResultReason.Canceled;\r\n            const result = new VoiceProfileEnrollmentResult(reason, null, null);\r\n            result.privDetails = this.getIdentificationDetails(item) as EnrollmentResultDetails;\r\n            results.push(result);\r\n        }\r\n        return results;\r\n    }\r\n\r\n    public static FromVerificationProfileList(json: { value: EnrollmentResultJSON[] }): VoiceProfileEnrollmentResult[] {\r\n        const results: VoiceProfileEnrollmentResult[] = [];\r\n        for (const item of json.value) {\r\n            const reason: ResultReason = item.enrollmentStatus.toLowerCase() === \"enrolling\" ?\r\n                ResultReason.EnrollingVoiceProfile : item.enrollmentStatus.toLowerCase() === \"enrolled\" ?\r\n                ResultReason.EnrolledVoiceProfile : ResultReason.Canceled;\r\n            const result = new VoiceProfileEnrollmentResult(reason, null, null);\r\n            result.privDetails = this.getVerificationDetails(item) as EnrollmentResultDetails;\r\n            results.push(result);\r\n        }\r\n        return results;\r\n    }\r\n\r\n    private static getIdentificationDetails(json: EnrollmentResultJSON): unknown {\r\n        return {\r\n            audioLength: json.audioLength ? parseFloat(json.audioLength) : 0,\r\n            audioSpeechLength: json.audioSpeechLength ? parseFloat(json.audioSpeechLength) : 0,\r\n            enrollmentStatus: json.enrollmentStatus,\r\n            enrollmentsCount: json.enrollmentsCount || 0,\r\n            enrollmentsLength: json.enrollmentsLength ? parseFloat(json.enrollmentsLength) : 0,\r\n            enrollmentsSpeechLength: json.enrollmentsSpeechLength ? parseFloat(json.enrollmentsSpeechLength) : 0,\r\n            profileId: json.profileId || json.identificationProfileId,\r\n            remainingEnrollmentsSpeechLength: json.remainingEnrollmentsSpeechLength ? parseFloat(json.remainingEnrollmentsSpeechLength) : 0\r\n        };\r\n    }\r\n\r\n    private static getVerificationDetails(json: EnrollmentResultJSON): unknown {\r\n        return {\r\n            audioLength: json.audioLength ? parseFloat(json.audioLength) : 0,\r\n            audioSpeechLength: json.audioSpeechLength ? parseFloat(json.audioSpeechLength) : 0,\r\n            enrollmentStatus: json.enrollmentStatus,\r\n            enrollmentsCount: json.enrollmentsCount,\r\n            enrollmentsLength: json.enrollmentsLength ? parseFloat(json.enrollmentsLength) : 0,\r\n            enrollmentsSpeechLength: json.enrollmentsSpeechLength ? parseFloat(json.enrollmentsSpeechLength) : 0,\r\n            profileId: json.profileId || json.verificationProfileId,\r\n            remainingEnrollmentsCount: json.remainingEnrollments || json.remainingEnrollmentsCount,\r\n            remainingEnrollmentsSpeechLength: json.remainingEnrollmentsSpeechLength ? parseFloat(json.remainingEnrollmentsSpeechLength) : 0\r\n        };\r\n    }\r\n}\r\n\r\n/**\r\n * @class VoiceProfileEnrollmentCancellationDetails\r\n */\r\nexport class VoiceProfileEnrollmentCancellationDetails extends CancellationDetailsBase {\r\n\r\n    private constructor(reason: CancellationReason, errorDetails: string, errorCode: CancellationErrorCode) {\r\n        super(reason, errorDetails, errorCode);\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of VoiceProfileEnrollmentCancellationDetails object for the canceled VoiceProfileEnrollmentResult.\r\n     * @member VoiceProfileEnrollmentCancellationDetails.fromResult\r\n     * @function\r\n     * @public\r\n     * @param {VoiceProfileEnrollmentResult} result - The result that was canceled.\r\n     * @returns {VoiceProfileEnrollmentCancellationDetails} The cancellation details object being created.\r\n     */\r\n    public static fromResult(result: VoiceProfileEnrollmentResult): VoiceProfileEnrollmentCancellationDetails {\r\n        const reason = CancellationReason.Error;\r\n        let errorCode: CancellationErrorCode = CancellationErrorCode.NoError;\r\n\r\n        if (!!result.properties) {\r\n            errorCode = (CancellationErrorCode as any)[result.properties.getProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.NoError])]; //eslint-disable-line\r\n        }\r\n\r\n        return new VoiceProfileEnrollmentCancellationDetails(reason, result.errorDetails, errorCode);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { CancellationErrorCodePropertyName } from \"../common.speech/Exports.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    CancellationDetailsBase,\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    PropertyCollection,\r\n    ResultReason\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Output format\r\n * @class VoiceProfileResult\r\n */\r\nexport class VoiceProfileResult {\r\n    private privReason: ResultReason;\r\n    private privProperties: PropertyCollection;\r\n    private privErrorDetails: string;\r\n\r\n    public constructor(reason: ResultReason, statusText: string) {\r\n        this.privReason = reason;\r\n        this.privProperties = new PropertyCollection();\r\n        if (reason === ResultReason.Canceled) {\r\n            Contracts.throwIfNullOrUndefined(statusText, \"statusText\");\r\n            this.privErrorDetails = statusText;\r\n            this.privProperties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.ServiceError]);\r\n        }\r\n    }\r\n\r\n    public get reason(): ResultReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n}\r\n\r\n/**\r\n * @class VoiceProfileCancellationDetails\r\n */\r\nexport class VoiceProfileCancellationDetails extends CancellationDetailsBase {\r\n\r\n    private constructor(reason: CancellationReason, errorDetails: string, errorCode: CancellationErrorCode) {\r\n        super(reason, errorDetails, errorCode);\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of VoiceProfileCancellationDetails object for the canceled VoiceProfileResult.\r\n     * @member VoiceProfileCancellationDetails.fromResult\r\n     * @function\r\n     * @public\r\n     * @param {VoiceProfileResult} result - The result that was canceled.\r\n     * @returns {VoiceProfileCancellationDetails} The cancellation details object being created.\r\n     */\r\n    public static fromResult(result: VoiceProfileResult): VoiceProfileCancellationDetails {\r\n        const reason = CancellationReason.Error;\r\n        let errorCode: CancellationErrorCode = CancellationErrorCode.NoError;\r\n\r\n        if (!!result.properties) {\r\n            errorCode = (CancellationErrorCode as any)[result.properties.getProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.NoError])]; //eslint-disable-line\r\n        }\r\n\r\n        return new VoiceProfileCancellationDetails(reason, result.errorDetails, errorCode);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    ResultReason,\r\n    VoiceProfileResult\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Output format\r\n * @class VoiceProfilePhraseResult\r\n */\r\nexport class VoiceProfilePhraseResult extends VoiceProfileResult {\r\n    private privPhrases: string[] = [];\r\n    private privType: string;\r\n\r\n    public constructor(reason: ResultReason, statusText: string, type: string, phraseArray: string[]) {\r\n        super(reason, statusText);\r\n        Contracts.throwIfNullOrUndefined(phraseArray, \"phrase array\");\r\n        this.privType = type;\r\n        if (!!phraseArray && !!phraseArray[0]) {\r\n            this.privPhrases = phraseArray;\r\n        }\r\n    }\r\n\r\n    public get phrases(): string[] {\r\n        return this.privPhrases;\r\n    }\r\n\r\n    public get type(): string {\r\n        return this.privType;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    IRestResponse\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechServiceConfig,\r\n    VoiceProfileConnectionFactory,\r\n    VoiceServiceRecognizer\r\n} from \"../common.speech/Exports.js\";\r\nimport { AudioConfig, AudioConfigImpl } from \"./Audio/AudioConfig.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    AudioInputStream,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    ResultReason,\r\n    VoiceProfile,\r\n    VoiceProfileEnrollmentResult,\r\n    VoiceProfilePhraseResult,\r\n    VoiceProfileResult,\r\n    VoiceProfileType\r\n} from \"./Exports.js\";\r\nimport { SpeechConfig, SpeechConfigImpl } from \"./SpeechConfig.js\";\r\n\r\n/**\r\n * Defines VoiceProfileClient class for Speaker Recognition\r\n * Handles operations from user for Voice Profile operations (e.g. createProfile, deleteProfile)\r\n * @class VoiceProfileClient\r\n */\r\nexport class VoiceProfileClient extends Recognizer {\r\n    protected privProperties: PropertyCollection;\r\n    private privVoiceAdapter: VoiceServiceRecognizer;\r\n    private privDisposedVoiceAdapter: boolean;\r\n\r\n    /**\r\n     * VoiceProfileClient constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - An set of initial properties for this synthesizer (authentication key, region, &c)\r\n     */\r\n    public constructor(speechConfig: SpeechConfig) {\r\n        Contracts.throwIfNullOrUndefined(speechConfig, \"speechConfig\");\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        Contracts.throwIfNull(speechConfigImpl, \"speechConfig\");\r\n\r\n        super(AudioConfig.fromStreamInput(AudioInputStream.createPushStream()), speechConfigImpl.properties, new VoiceProfileConnectionFactory());\r\n\r\n        this.privProperties = speechConfigImpl.properties.clone();\r\n        this.privVoiceAdapter = this.privReco as VoiceServiceRecognizer;\r\n        this.privDisposedVoiceAdapter = false;\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this VoiceProfileClient.\r\n     * @member VoiceProfileClient.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this VoiceProfileClient.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member VoiceProfileClient.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * @member VoiceProfileClient.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} token - Authorization token.\r\n     */\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    /**\r\n     * Create a speaker recognition voice profile\r\n     * @member VoiceProfileClient.prototype.createProfileAsync\r\n     * @function\r\n     * @public\r\n     * @async\r\n     * @param {VoiceProfileType} profileType Type of Voice Profile to be created\r\n     * @param {string} lang Language string (locale) for Voice Profile\r\n     * @return {Promise<VoiceProfile>} - Promise of a VoiceProfile.\r\n     */\r\n    public async createProfileAsync(profileType: VoiceProfileType, lang: string): Promise<VoiceProfile> {\r\n        const profileIds: string[] = await this.privVoiceAdapter.createProfile(profileType, lang);\r\n        return new VoiceProfile(profileIds[0], profileType);\r\n    }\r\n\r\n    /**\r\n     * Get current information of a voice profile\r\n     * @member VoiceProfileClient.prototype.retrieveEnrollmentResultAsync\r\n     * @function\r\n     * @public\r\n     * @async\r\n     * @param {VoiceProfile} profile Voice Profile to retrieve info for\r\n     * @return {Promise<VoiceProfileEnrollmentResult>} - Promise of a VoiceProfileEnrollmentResult.\r\n     */\r\n    public async retrieveEnrollmentResultAsync(profile: VoiceProfile): Promise<VoiceProfileEnrollmentResult> {\r\n        return this.privVoiceAdapter.retrieveEnrollmentResult(profile);\r\n    }\r\n\r\n    /**\r\n     * Get all voice profiles on account with given voice profile type\r\n     * @member VoiceProfileClient.prototype.getAllProfilesAsync\r\n     * @function\r\n     * @public\r\n     * @async\r\n     * @param {VoiceProfileType} profileType profile type (identification/verification) for which to list profiles\r\n     * @return {Promise<VoiceProfileEnrollmentResult[]>} - Promise of an array of VoiceProfileEnrollmentResults.\r\n     */\r\n    public async getAllProfilesAsync(profileType: VoiceProfileType): Promise<VoiceProfileEnrollmentResult[]> {\r\n        return this.privVoiceAdapter.getAllProfiles(profileType);\r\n        /*\r\n        const result: { json: { value: EnrollmentResultJSON[] } } = await this.privAdapter.getProfiles(profileType);\r\n        if (profileType === VoiceProfileType.TextIndependentIdentification) {\r\n            return VoiceProfileEnrollmentResult.FromIdentificationProfileList(result.json);\r\n        }\r\n        return VoiceProfileEnrollmentResult.FromVerificationProfileList(result.json);\r\n        */\r\n    }\r\n\r\n    /**\r\n     * Get valid authorization phrases for voice profile enrollment\r\n     * @member VoiceProfileClient.prototype.getActivationPhrasesAsync\r\n     * @function\r\n     * @public\r\n     * @async\r\n     * @param {VoiceProfileType} profileType Profile Type to get activation phrases for\r\n     * @param {string} lang Language string (locale) for Voice Profile\r\n     */\r\n    public async getActivationPhrasesAsync(profileType: VoiceProfileType, lang: string): Promise<VoiceProfilePhraseResult> {\r\n        return this.privVoiceAdapter.getActivationPhrases(profileType, lang);\r\n    }\r\n\r\n    /**\r\n     * Create a speaker recognition voice profile\r\n     * @member VoiceProfileClient.prototype.enrollProfileAsync\r\n     * @function\r\n     * @public\r\n     * @async\r\n     * @param {VoiceProfile} profile Voice Profile to create enrollment for\r\n     * @param {AudioConfig} audioConfig source info from which to create enrollment\r\n     * @return {Promise<VoiceProfileEnrollmentResult>} - Promise of a VoiceProfileEnrollmentResult.\r\n     */\r\n    public async enrollProfileAsync(profile: VoiceProfile, audioConfig: AudioConfig): Promise<VoiceProfileEnrollmentResult> {\r\n        const configImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        Contracts.throwIfNullOrUndefined(configImpl, \"audioConfig\");\r\n        this.audioConfig = audioConfig;\r\n        this.privVoiceAdapter.SpeakerAudioSource = configImpl;\r\n\r\n        return this.privVoiceAdapter.enrollProfile(profile);\r\n    }\r\n\r\n    /**\r\n     * Delete a speaker recognition voice profile\r\n     * @member VoiceProfileClient.prototype.deleteProfileAsync\r\n     * @function\r\n     * @public\r\n     * @async\r\n     * @param {VoiceProfile} profile Voice Profile to be deleted\r\n     * @return {Promise<VoiceProfileResult>} - Promise of a VoiceProfileResult.\r\n     */\r\n    public async deleteProfileAsync(profile: VoiceProfile): Promise<VoiceProfileResult> {\r\n        return this.privVoiceAdapter.deleteProfile(profile);\r\n    }\r\n\r\n    /**\r\n     * Remove all enrollments for a speaker recognition voice profile\r\n     * @member VoiceProfileClient.prototype.resetProfileAsync\r\n     * @function\r\n     * @public\r\n     * @async\r\n     * @param {VoiceProfile} profile Voice Profile to be reset\r\n     * @return {Promise<VoiceProfileResult>} - Promise of a VoiceProfileResult.\r\n     */\r\n    public async resetProfileAsync(profile: VoiceProfile): Promise<VoiceProfileResult> {\r\n        return this.privVoiceAdapter.resetProfile(profile);\r\n    }\r\n\r\n    /**\r\n     * Clean up object and close underlying connection\r\n     * @member VoiceProfileClient.prototype.close\r\n     * @function\r\n     * @async\r\n     * @public\r\n     */\r\n    public async close(): Promise<void> {\r\n        await this.dispose(true);\r\n    }\r\n\r\n    protected createServiceRecognizer(authentication: IAuthentication, connectionFactory: IConnectionFactory, audioConfig: AudioConfig, recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n        const audioImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        return new VoiceServiceRecognizer(authentication, connectionFactory, audioImpl, recognizerConfig, this);\r\n    }\r\n\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedVoiceAdapter) {\r\n            return;\r\n        }\r\n\r\n        this.privDisposedVoiceAdapter = true;\r\n\r\n        if (disposing) {\r\n            await super.dispose(disposing);\r\n        }\r\n    }\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.properties);\r\n    }\r\n\r\n    private getResult(result: IRestResponse, successReason: ResultReason): VoiceProfileResult {\r\n        const response: VoiceProfileResult =\r\n            new VoiceProfileResult(\r\n                result.ok ? successReason : ResultReason.Canceled,\r\n                result.statusText\r\n            );\r\n        return (response);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeakerRecognitionConnectionFactory,\r\n    SpeakerServiceRecognizer,\r\n    SpeechServiceConfig\r\n} from \"../common.speech/Exports.js\";\r\nimport { SpeakerRecognitionModel } from \"./SpeakerRecognitionModel.js\";\r\nimport { AudioConfig, AudioConfigImpl } from \"./Audio/AudioConfig.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    SpeakerIdentificationModel,\r\n    SpeakerRecognitionResult,\r\n    SpeakerVerificationModel,\r\n} from \"./Exports.js\";\r\nimport { SpeechConfig, SpeechConfigImpl } from \"./SpeechConfig.js\";\r\n\r\n/**\r\n * Defines SpeakerRecognizer class for Speaker Recognition\r\n * Handles operations from user for Voice Profile operations (e.g. createProfile, deleteProfile)\r\n * @class SpeakerRecognizer\r\n */\r\nexport class SpeakerRecognizer extends Recognizer {\r\n    protected privProperties: PropertyCollection;\r\n    private privDisposedSpeakerRecognizer: boolean;\r\n    private privAudioConfigImpl: AudioConfigImpl;\r\n    /**\r\n     * Initializes an instance of the SpeakerRecognizer.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - The set of configuration properties.\r\n     * @param {AudioConfig} audioConfig - An optional audio input config associated with the recognizer\r\n     */\r\n    public constructor(speechConfig: SpeechConfig, audioConfig: AudioConfig) {\r\n        Contracts.throwIfNullOrUndefined(speechConfig, \"speechConfig\");\r\n        const configImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        Contracts.throwIfNullOrUndefined(configImpl, \"speechConfig\");\r\n\r\n        super(audioConfig, configImpl.properties, new SpeakerRecognitionConnectionFactory());\r\n        this.privAudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        Contracts.throwIfNull(this.privAudioConfigImpl, \"audioConfig\");\r\n\r\n        this.privDisposedSpeakerRecognizer = false;\r\n        this.privProperties = configImpl.properties;\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member SpeakerRecognizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * @member SpeakerRecognizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} token - Authorization token.\r\n     */\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this SpeakerRecognizer.\r\n     * @member SpeakerRecognizer.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this SpeakerRecognizer.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Get recognition result for model using given audio\r\n     * @member SpeakerRecognizer.prototype.recognizeOnceAsync\r\n     * @function\r\n     * @public\r\n     * @async\r\n     * @param {SpeakerIdentificationModel | SpeakerVerificationModel} model Model containing Voice Profiles to be identified\r\n     * @param cb - Callback invoked once result is returned.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public async recognizeOnceAsync(model: SpeakerIdentificationModel | SpeakerVerificationModel): Promise<SpeakerRecognitionResult> {\r\n        Contracts.throwIfDisposed(this.privDisposedSpeakerRecognizer);\r\n\r\n        return this.recognizeSpeakerOnceAsyncImpl(model);\r\n    }\r\n\r\n    /**\r\n     * Included for compatibility\r\n     * @member SpeakerRecognizer.prototype.close\r\n     * @function\r\n     * @public\r\n     * @async\r\n     */\r\n    public async close(): Promise<void> {\r\n        Contracts.throwIfDisposed(this.privDisposedSpeakerRecognizer);\r\n        await this.dispose(true);\r\n    }\r\n\r\n    protected async recognizeSpeakerOnceAsyncImpl(model: SpeakerRecognitionModel): Promise<SpeakerRecognitionResult> {\r\n        Contracts.throwIfDisposed(this.privDisposedSpeakerRecognizer);\r\n\r\n        await this.implRecognizerStop();\r\n        const result: SpeakerRecognitionResult = await this.privReco.recognizeSpeaker(model);\r\n        await this.implRecognizerStop();\r\n\r\n        return result;\r\n    }\r\n\r\n    protected async implRecognizerStop(): Promise<void> {\r\n        if (this.privReco) {\r\n            await this.privReco.stopRecognizing();\r\n        }\r\n        return;\r\n    }\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.privProperties);\r\n    }\r\n\r\n    protected createServiceRecognizer(authentication: IAuthentication, connectionFactory: IConnectionFactory, audioConfig: AudioConfig, recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n        const audioImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        return new SpeakerServiceRecognizer(authentication, connectionFactory, audioImpl, recognizerConfig, this);\r\n    }\r\n\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedSpeakerRecognizer) {\r\n            return;\r\n        }\r\n\r\n        if (disposing) {\r\n            this.privDisposedSpeakerRecognizer = true;\r\n            await super.dispose(disposing);\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { SpeakerRecognitionModel } from \"./SpeakerRecognitionModel.js\";\r\nimport {\r\n    VoiceProfile,\r\n    VoiceProfileType,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Defines SpeakerIdentificationModel class for Speaker Recognition\r\n * Model contains a set of profiles against which to identify speaker(s)\r\n * @class SpeakerIdentificationModel\r\n */\r\nexport class SpeakerIdentificationModel implements SpeakerRecognitionModel {\r\n    private privVoiceProfiles: VoiceProfile[] = [];\r\n    private privProfileIds: string[] = [];\r\n\r\n    private constructor(profiles: VoiceProfile[]) {\r\n        Contracts.throwIfNullOrUndefined(profiles, \"VoiceProfiles\");\r\n        if (profiles.length === 0) {\r\n            throw new Error(\"Empty Voice Profiles array\");\r\n        }\r\n        for (const profile of profiles) {\r\n            if (profile.profileType !== VoiceProfileType.TextIndependentIdentification) {\r\n                throw new Error(\"Identification model can only be created from Identification profile: \" + profile.profileId);\r\n            }\r\n            this.privVoiceProfiles.push(profile);\r\n            this.privProfileIds.push(profile.profileId);\r\n        }\r\n    }\r\n    public static fromProfiles(profiles: VoiceProfile[]): SpeakerIdentificationModel {\r\n        return new SpeakerIdentificationModel(profiles);\r\n    }\r\n\r\n    public get voiceProfileIds(): string {\r\n        return this.privProfileIds.join(\",\");\r\n    }\r\n\r\n    public get profileIds(): string[] {\r\n        return this.privProfileIds;\r\n    }\r\n\r\n    public get scenario(): string {\r\n        return \"TextIndependentIdentification\";\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { SpeakerRecognitionModel } from \"./SpeakerRecognitionModel.js\";\r\nimport {\r\n    VoiceProfile,\r\n    VoiceProfileType,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Defines SpeakerVerificationModel class for Speaker Recognition\r\n * Model contains a profile against which to verify a speaker\r\n * @class SpeakerVerificationModel\r\n */\r\nexport class SpeakerVerificationModel implements SpeakerRecognitionModel {\r\n    private privVoiceProfile: VoiceProfile;\r\n\r\n    private constructor(profile: VoiceProfile) {\r\n        Contracts.throwIfNullOrUndefined(profile, \"VoiceProfile\");\r\n        if (profile.profileType === VoiceProfileType.TextIndependentIdentification) {\r\n            throw new Error(\"Verification model cannot be created from Identification profile\");\r\n        }\r\n        this.privVoiceProfile = profile;\r\n    }\r\n\r\n    public static fromProfile(profile: VoiceProfile): SpeakerVerificationModel {\r\n        return new SpeakerVerificationModel(profile);\r\n    }\r\n\r\n    public get voiceProfile(): VoiceProfile {\r\n        return this.privVoiceProfile;\r\n    }\r\n\r\n    public get profileIds(): string[] {\r\n        return [ this.voiceProfile.profileId ];\r\n    }\r\n\r\n    public get scenario(): string {\r\n        if (this.voiceProfile.profileType === VoiceProfileType.TextDependentVerification) {\r\n            return \"TextDependentVerification\";\r\n        } else {\r\n            return \"TextIndependentVerification\";\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { AutoDetectSourceLanguagesOpenRangeOptionName } from \"../common.speech/Exports.js\";\r\nimport {Contracts} from \"./Contracts.js\";\r\nimport {\r\n    PropertyCollection,\r\n    PropertyId,\r\n    SourceLanguageConfig,\r\n} from \"./Exports.js\";\r\nimport { LanguageIdMode } from \"./LanguageIdMode.js\";\r\n\r\n/**\r\n * Language auto detect configuration.\r\n * @class AutoDetectSourceLanguageConfig\r\n * Added in version 1.13.0.\r\n */\r\nexport class AutoDetectSourceLanguageConfig {\r\n    private privProperties: PropertyCollection;\r\n    private privLanguageIdMode: LanguageIdMode;\r\n\r\n    private constructor() {\r\n        this.privProperties = new PropertyCollection();\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_LanguageIdMode, \"AtStart\");\r\n        this.privLanguageIdMode = LanguageIdMode.AtStart;\r\n    }\r\n\r\n    /**\r\n     * @member AutoDetectSourceLanguageConfig.fromOpenRange\r\n     * @function\r\n     * @public\r\n     * Only [[SpeechSynthesizer]] supports source language auto detection from open range,\r\n     * for [[Recognizer]], please use AutoDetectSourceLanguageConfig with specific source languages.\r\n     * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\r\n     * @summary Creates an instance of the AutoDetectSourceLanguageConfig with open range.\r\n     */\r\n    public static fromOpenRange(): AutoDetectSourceLanguageConfig {\r\n        const config = new AutoDetectSourceLanguageConfig();\r\n        config.properties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, AutoDetectSourceLanguagesOpenRangeOptionName);\r\n        return config;\r\n    }\r\n\r\n    /**\r\n     * @member AutoDetectSourceLanguageConfig.fromLanguages\r\n     * @function\r\n     * @public\r\n     * @param {string[]} languages Comma-separated string of languages (eg. \"en-US,fr-FR\") to populate properties of config.\r\n     * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\r\n     * @summary Creates an instance of the AutoDetectSourceLanguageConfig with given languages.\r\n     */\r\n    public static fromLanguages(languages: string[]): AutoDetectSourceLanguageConfig {\r\n        Contracts.throwIfArrayEmptyOrWhitespace(languages, \"languages\");\r\n        const config = new AutoDetectSourceLanguageConfig();\r\n        config.properties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, languages.join());\r\n        return config;\r\n    }\r\n\r\n    /**\r\n     * @member AutoDetectSourceLanguageConfig.fromSourceLanguageConfigs\r\n     * @function\r\n     * @public\r\n     * @param {SourceLanguageConfig[]} configs SourceLanguageConfigs to populate properties of config.\r\n     * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\r\n     * @summary Creates an instance of the AutoDetectSourceLanguageConfig with given SourceLanguageConfigs.\r\n     */\r\n    public static fromSourceLanguageConfigs(configs: SourceLanguageConfig[]): AutoDetectSourceLanguageConfig {\r\n        if (configs.length < 1) {\r\n            throw new Error(\"Expected non-empty SourceLanguageConfig array.\");\r\n        }\r\n        const autoConfig = new AutoDetectSourceLanguageConfig();\r\n        const langs: string[] = [];\r\n        configs.forEach((config: SourceLanguageConfig): void => {\r\n            langs.push(config.language);\r\n            if (config.endpointId !== undefined && config.endpointId !== \"\") {\r\n                const customProperty = config.language + PropertyId.SpeechServiceConnection_EndpointId.toString();\r\n                autoConfig.properties.setProperty(customProperty, config.endpointId);\r\n            }\r\n        });\r\n        autoConfig.properties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, langs.join());\r\n\r\n        return autoConfig;\r\n    }\r\n\r\n    /**\r\n     * @member AutoDetectSourceLanguageConfig.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @return {PropertyCollection} Properties of the config.\r\n     * @summary Gets an auto detected language config properties\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * @member AutoDetectSourceLanguageConfig.prototype.mode\r\n     * @function\r\n     * @public\r\n     * @param {LanguageIdMode} mode LID mode desired.\r\n     * @summary Sets LID operation to desired mode\r\n     */\r\n    public set mode(mode: LanguageIdMode) {\r\n        if (mode === LanguageIdMode.Continuous) {\r\n            this.privProperties.setProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"2\");\r\n            this.privProperties.setProperty(PropertyId.SpeechServiceConnection_LanguageIdMode, \"Continuous\");\r\n        } else { // LanguageIdMode.AtStart\r\n            this.privProperties.setProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"1\");\r\n            this.privProperties.setProperty(PropertyId.SpeechServiceConnection_LanguageIdMode, \"AtStart\");\r\n        }\r\n        this.privLanguageIdMode = mode;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Language Identification mode\r\n * @class LanguageIdMode\r\n */\r\nexport enum LanguageIdMode {\r\n\r\n    /**\r\n     * Detect language at audio start\r\n     * @member LanguageIdMode.AtStart\r\n     */\r\n    AtStart,\r\n\r\n    /**\r\n     * Continuously detect language\r\n     * @member LanguageIdMode.Continuous\r\n     */\r\n    Continuous,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    SpeechRecognitionResult,\r\n    ConversationTranscriptionResult\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Output format\r\n * @class AutoDetectSourceLanguageResult\r\n */\r\nexport class AutoDetectSourceLanguageResult {\r\n\r\n    private privLanguage: string;\r\n    private privLanguageDetectionConfidence: string;\r\n\r\n    private constructor(language: string, languageDetectionConfidence: string) {\r\n        Contracts.throwIfNullOrUndefined(language, \"language\");\r\n        Contracts.throwIfNullOrUndefined(languageDetectionConfidence, \"languageDetectionConfidence\");\r\n        this.privLanguage = language;\r\n        this.privLanguageDetectionConfidence = languageDetectionConfidence;\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of AutoDetectSourceLanguageResult object from a SpeechRecognitionResult instance.\r\n     * @member AutoDetectSourceLanguageResult.fromResult\r\n     * @function\r\n     * @public\r\n     * @param {SpeechRecognitionResult} result - The recognition result.\r\n     * @returns {AutoDetectSourceLanguageResult} AutoDetectSourceLanguageResult object being created.\r\n     */\r\n    public static fromResult(result: SpeechRecognitionResult): AutoDetectSourceLanguageResult {\r\n        return new AutoDetectSourceLanguageResult(result.language, result.languageDetectionConfidence);\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of AutoDetectSourceLanguageResult object from a ConversationTranscriptionResult instance.\r\n     * @member AutoDetectSourceLanguageResult.fromConversationTranscriptionResult\r\n     * @function\r\n     * @public\r\n     * @param {ConversationTranscriptionResult} result - The transcription result.\r\n     * @returns {AutoDetectSourceLanguageResult} AutoDetectSourceLanguageResult object being created.\r\n     */\r\n        public static fromConversationTranscriptionResult(result: ConversationTranscriptionResult): AutoDetectSourceLanguageResult {\r\n            return new AutoDetectSourceLanguageResult(result.language, result.languageDetectionConfidence);\r\n        }\r\n\r\n    public get language(): string {\r\n        return this.privLanguage;\r\n    }\r\n\r\n    public get languageDetectionConfidence(): string {\r\n        return this.privLanguageDetectionConfidence;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\n\r\n/**\r\n * Source Language configuration.\r\n * @class SourceLanguageConfig\r\n */\r\nexport class SourceLanguageConfig {\r\n    private privLanguage: string;\r\n    private privEndpointId: string;\r\n\r\n    private constructor(language: string, endpointId?: string) {\r\n        Contracts.throwIfNullOrUndefined(language, \"language\");\r\n        this.privLanguage = language;\r\n        this.privEndpointId = endpointId;\r\n    }\r\n\r\n    /**\r\n     * @member SourceLanguageConfig.fromLanguage\r\n     * @function\r\n     * @public\r\n     * @param {string} language language (eg. \"en-US\") value of config.\r\n     * @param {string?} endpointId endpointId of model bound to given language of config.\r\n     * @return {SourceLanguageConfig} Instance of SourceLanguageConfig\r\n     * @summary Creates an instance of the SourceLanguageConfig with the given language and optional endpointId.\r\n     * Added in version 1.13.0.\r\n     */\r\n    public static fromLanguage(language: string, endpointId?: string): SourceLanguageConfig {\r\n        return new SourceLanguageConfig(language, endpointId);\r\n    }\r\n\r\n    public get language(): string {\r\n        return this.privLanguage;\r\n    }\r\n\r\n    public get endpointId(): string {\r\n        return this.privEndpointId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { CancellationErrorCodePropertyName, SpeakerResponse } from \"../common.speech/Exports.js\";\r\nimport {\r\n    CancellationDetailsBase,\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n} from \"./Exports.js\";\r\n\r\nexport enum SpeakerRecognitionResultType {\r\n    Verify,\r\n    Identify\r\n}\r\n\r\n/**\r\n * Output format\r\n * @class SpeakerRecognitionResult\r\n */\r\nexport class SpeakerRecognitionResult {\r\n    private privReason: ResultReason;\r\n    private privProperties: PropertyCollection;\r\n    private privProfileId: string;\r\n    private privScore: number;\r\n    private privErrorDetails: string;\r\n\r\n    public constructor(response: SpeakerResponse, resultReason: ResultReason = ResultReason.RecognizedSpeaker, cancellationErrorCode: CancellationErrorCode = CancellationErrorCode.NoError, errorDetails: string = \"\") {\r\n        this.privProperties = new PropertyCollection();\r\n        const resultType = response.scenario === \"TextIndependentIdentification\" ? SpeakerRecognitionResultType.Identify : SpeakerRecognitionResultType.Verify;\r\n        this.privReason = resultReason;\r\n        if (this.privReason !== ResultReason.Canceled) {\r\n            if (resultType === SpeakerRecognitionResultType.Identify) {\r\n                this.privProfileId = response.identificationResult.identifiedProfile.profileId;\r\n                this.privScore = response.identificationResult.identifiedProfile.score;\r\n                this.privReason = ResultReason.RecognizedSpeakers;\r\n            } else {\r\n                this.privScore = response.verificationResult.score;\r\n                if (response.verificationResult.recognitionResult.toLowerCase() !== \"accept\") {\r\n                    this.privReason = ResultReason.NoMatch;\r\n                }\r\n                if (response.verificationResult.profileId !== undefined && response.verificationResult.profileId !== \"\") {\r\n                    this.privProfileId = response.verificationResult.profileId;\r\n                }\r\n            }\r\n        } else {\r\n            this.privErrorDetails = errorDetails;\r\n            this.privProperties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[cancellationErrorCode]);\r\n        }\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceResponse_JsonResult, JSON.stringify(response));\r\n    }\r\n\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public get reason(): ResultReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    public get profileId(): string {\r\n        return this.privProfileId;\r\n    }\r\n\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n\r\n    public get score(): number {\r\n        return this.privScore;\r\n    }\r\n}\r\n\r\n/**\r\n * @class SpeakerRecognitionCancellationDetails\r\n */\r\nexport class SpeakerRecognitionCancellationDetails extends CancellationDetailsBase {\r\n\r\n    private constructor(reason: CancellationReason, errorDetails: string, errorCode: CancellationErrorCode) {\r\n        super(reason, errorDetails, errorCode);\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of SpeakerRecognitionCancellationDetails object for the canceled SpeakerRecognitionResult\r\n     * @member SpeakerRecognitionCancellationDetails.fromResult\r\n     * @function\r\n     * @public\r\n     * @param {SpeakerRecognitionResult} result - The result that was canceled.\r\n     * @returns {SpeakerRecognitionCancellationDetails} The cancellation details object being created.\r\n     */\r\n    public static fromResult(result: SpeakerRecognitionResult): SpeakerRecognitionCancellationDetails {\r\n        const reason = CancellationReason.Error;\r\n        let errorCode: CancellationErrorCode = CancellationErrorCode.NoError;\r\n\r\n        if (!!result.properties) {\r\n            errorCode = CancellationErrorCode[result.properties.getProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.NoError]) as keyof typeof CancellationErrorCode];\r\n        }\r\n\r\n        return new SpeakerRecognitionCancellationDetails(reason, result.errorDetails, errorCode);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nexport { Conversation, ConversationImpl } from \"./Conversation.js\";\r\nexport { ConversationInfo } from \"./IConversation.js\";\r\nexport { ConversationCommon } from \"./ConversationCommon.js\";\r\nexport { ConversationExpirationEventArgs } from \"./ConversationExpirationEventArgs.js\";\r\nexport { ConversationParticipantsChangedEventArgs } from \"./ConversationParticipantsChangedEventArgs.js\";\r\nexport { ConversationTranslationCanceledEventArgs } from \"./ConversationTranslationCanceledEventArgs.js\";\r\nexport { ConversationTranslationEventArgs } from \"./ConversationTranslationEventArgs.js\";\r\nexport { ConversationTranslationResult } from \"./ConversationTranslationResult.js\";\r\nexport { ConversationTranslator } from \"./ConversationTranslator.js\";\r\nexport { ConversationTranscriber } from \"./ConversationTranscriber.js\";\r\nexport { IParticipant, Participant, User, VoiceSignature } from \"./IParticipant.js\";\r\nexport { ParticipantChangedReason } from \"./ParticipantChangedReason.js\";\r\nexport { ConversationHandler, ConversationTranscriptionHandler, IConversationTranslator } from \"./ConversationHandler.js\";\r\nexport { Meeting, MeetingImpl } from \"./Meeting.js\";\r\nexport { MeetingInfo } from \"./IMeeting.js\";\r\nexport { MeetingTranscriptionCanceledEventArgs } from \"./MeetingTranscriptionCanceledEventArgs.js\";\r\nexport { MeetingTranscriber } from \"./MeetingTranscriber.js\";\r\nexport { MeetingHandler, MeetingTranscriptionHandler } from \"./MeetingHandler.js\";\r\nexport { ConversationTranscriptionResult } from \"./ConversationTranscriptionResult.js\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    ConversationConnectionConfig,\r\n    ConversationManager,\r\n    ConversationReceivedTranslationEventArgs,\r\n    ConversationRecognizer,\r\n    ConversationRecognizerFactory,\r\n    ConversationTranslatorCommandTypes,\r\n    ConversationTranslatorMessageTypes,\r\n    IAuthentication,\r\n    IInternalConversation,\r\n    IInternalParticipant,\r\n    InternalParticipants,\r\n    MuteAllEventArgs,\r\n    ParticipantAttributeEventArgs,\r\n    ParticipantEventArgs,\r\n    ParticipantsListEventArgs,\r\n    TranscriberRecognizer\r\n} from \"../../common.speech/Exports.js\";\r\nimport {\r\n    IDisposable,\r\n    IErrorMessages,\r\n    marshalPromiseToCallbacks\r\n} from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    ConnectionEventArgs,\r\n    ConversationExpirationEventArgs,\r\n    ConversationParticipantsChangedEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    ConversationTranslationEventArgs,\r\n    ConversationTranslator,\r\n    Participant,\r\n    ParticipantChangedReason,\r\n    ProfanityOption,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    SpeechTranslationConfig,\r\n} from \"../Exports.js\";\r\nimport { SpeechTranslationConfigImpl } from \"../SpeechTranslationConfig.js\";\r\nimport { Callback, ConversationInfo, ConversationProperties, IConversation } from \"./IConversation.js\";\r\nimport { IParticipant, IUser, TranscriptionParticipant } from \"./IParticipant.js\";\r\n\r\nexport abstract class Conversation implements IConversation {\r\n\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    public abstract get authorizationToken(): string;\r\n\r\n    public abstract get config(): SpeechTranslationConfig;\r\n\r\n    public abstract get conversationId(): string;\r\n    public abstract get conversationInfo(): ConversationInfo;\r\n    public abstract get properties(): PropertyCollection;\r\n    public abstract get speechRecognitionLanguage(): string;\r\n    public abstract get participants(): Participant[];\r\n    public abstract set authorizationToken(value: string);\r\n    public abstract get isConnected(): boolean;\r\n\r\n    /**\r\n     * Create a conversation\r\n     * @param speechConfig\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public static createConversationAsync(speechConfig: SpeechTranslationConfig, arg2?: string | Callback, arg3?: Callback, arg4?: Callback): Conversation {\r\n        Contracts.throwIfNullOrUndefined(speechConfig, ConversationConnectionConfig.restErrors.invalidArgs.replace(\"{arg}\", \"config\"));\r\n        Contracts.throwIfNullOrUndefined(speechConfig.region, ConversationConnectionConfig.restErrors.invalidArgs.replace(\"{arg}\", \"SpeechServiceConnection_Region\"));\r\n        if (!speechConfig.subscriptionKey && !speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceAuthorization_Token])) {\r\n            Contracts.throwIfNullOrUndefined(speechConfig.subscriptionKey, ConversationConnectionConfig.restErrors.invalidArgs.replace(\"{arg}\", \"SpeechServiceConnection_Key\"));\r\n        }\r\n        let conversationImpl: ConversationImpl;\r\n        let cb: Callback;\r\n        let err: Callback;\r\n        if (typeof arg2 === \"string\") {\r\n            conversationImpl = new ConversationImpl(speechConfig, arg2);\r\n            // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n            marshalPromiseToCallbacks((async (): Promise<void> => {})(), arg3, arg4);\r\n        } else {\r\n            conversationImpl = new ConversationImpl(speechConfig);\r\n            cb = arg2;\r\n            err = arg3;\r\n            conversationImpl.createConversationAsync(\r\n                ((): void => {\r\n                    if (!!cb) {\r\n                        cb();\r\n                    }\r\n                }),\r\n                (error: any): void => {\r\n                    if (!!err) {\r\n                        err(error);\r\n                    }\r\n                });\r\n        }\r\n        return conversationImpl;\r\n\r\n    }\r\n\r\n    /** Start a conversation. */\r\n    public abstract startConversationAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Delete a conversation. After this no one will be able to join the conversation. */\r\n    public abstract deleteConversationAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** End a conversation. */\r\n    public abstract endConversationAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Lock a conversation. This will prevent new participants from joining. */\r\n    public abstract lockConversationAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Add Participant to Conversation. */\r\n    public abstract addParticipantAsync(participant: IParticipant, cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Mute all other participants in the conversation. After this no other participants will\r\n     * have their speech recognitions broadcast, nor be able to send text messages.\r\n     */\r\n    public abstract muteAllParticipantsAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Mute a participant.\r\n     * @param userId A user identifier\r\n     */\r\n    public abstract muteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Remove a participant from a conversation using the user id, Participant or User object\r\n     * @param userId A user identifier\r\n     */\r\n    public abstract removeParticipantAsync(userId: string | IParticipant | IUser, cb?: Callback, err?: Callback): void;\r\n\r\n    /** Unlocks a conversation. */\r\n    public abstract unlockConversationAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Unmute all other participants in the conversation. */\r\n    public abstract unmuteAllParticipantsAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Unmute a participant.\r\n     * @param userId A user identifier\r\n     */\r\n    public abstract unmuteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void;\r\n}\r\n\r\nexport class ConversationImpl extends Conversation implements IDisposable {\r\n\r\n    private privConfig: SpeechTranslationConfig;\r\n    private privProperties: PropertyCollection;\r\n    private privLanguage: string;\r\n    private privToken: string;\r\n    private privIsDisposed: boolean;\r\n    private privRoom: IInternalConversation;\r\n    private privManager: ConversationManager;\r\n    private privConversationRecognizer: ConversationRecognizer;\r\n    private privIsConnected: boolean;\r\n    private privParticipants: InternalParticipants;\r\n    private privIsReady: boolean;\r\n    private privConversationTranslator: ConversationTranslator;\r\n    private privTranscriberRecognizer: TranscriberRecognizer;\r\n    private privErrors: IErrorMessages = ConversationConnectionConfig.restErrors;\r\n    private privConversationId: string;\r\n    private readonly privTextMessageMaxLength: number;\r\n\r\n    /**\r\n     * Create a conversation impl\r\n     * @param speechConfig\r\n     * @param {string} id - optional conversationId\r\n     */\r\n    public constructor(speechConfig: SpeechTranslationConfig, id?: string) {\r\n        super();\r\n        this.privIsConnected = false;\r\n        this.privIsDisposed = false;\r\n        this.privConversationId = \"\";\r\n        this.privProperties = new PropertyCollection();\r\n        this.privManager = new ConversationManager();\r\n\r\n        // check the speech language\r\n        const language: string = speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n        if (!language) {\r\n            speechConfig.setProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage], ConversationConnectionConfig.defaultLanguageCode);\r\n        }\r\n        this.privLanguage = speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n\r\n        if (!id) {\r\n            // check the target language(s)\r\n            if (speechConfig.targetLanguages.length === 0) {\r\n                speechConfig.addTargetLanguage(this.privLanguage);\r\n            }\r\n\r\n            // check the profanity setting: speech and conversationTranslator should be in sync\r\n            const profanity: string = speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceResponse_ProfanityOption]);\r\n            if (!profanity) {\r\n                speechConfig.setProfanity(ProfanityOption.Masked);\r\n            }\r\n            // check the nickname: it should pass this regex: ^\\w+([\\s-][\\w\\(\\)]+)*$\"\r\n            // TODO: specify the regex required. Nicknames must be unique or get the duplicate nickname error\r\n            // TODO: check what the max length is and if a truncation is required or if the service handles it without an error\r\n            let hostNickname: string = speechConfig.getProperty(PropertyId[PropertyId.ConversationTranslator_Name]);\r\n            if (hostNickname === undefined || hostNickname === null) {\r\n                hostNickname = \"Host\";\r\n            }\r\n            Contracts.throwIfNullOrTooLong(hostNickname, \"nickname\", 50);\r\n            Contracts.throwIfNullOrTooShort(hostNickname, \"nickname\", 2);\r\n            speechConfig.setProperty(PropertyId[PropertyId.ConversationTranslator_Name], hostNickname);\r\n\r\n        } else {\r\n            this.privConversationId = id;\r\n        }\r\n\r\n        // save the speech config for future usage\r\n        this.privConfig = speechConfig;\r\n\r\n        // save the config properties\r\n        const configImpl = speechConfig as SpeechTranslationConfigImpl;\r\n        Contracts.throwIfNull(configImpl, \"speechConfig\");\r\n        this.privProperties = configImpl.properties.clone();\r\n        this.privIsConnected = false;\r\n        this.privParticipants = new InternalParticipants();\r\n        this.privIsReady = false;\r\n        this.privTextMessageMaxLength = 1000;\r\n    }\r\n\r\n    // get the internal data about a conversation\r\n    public get room(): IInternalConversation {\r\n        return this.privRoom;\r\n    }\r\n\r\n    // get the wrapper for connecting to the websockets\r\n    public get connection(): ConversationRecognizer {\r\n        return this.privConversationRecognizer; // this.privConnection;\r\n    }\r\n\r\n    // get the config\r\n    public get config(): SpeechTranslationConfig {\r\n        return this.privConfig;\r\n    }\r\n\r\n    // get the conversation Id\r\n    public get conversationId(): string {\r\n        return this.privRoom ? this.privRoom.roomId : this.privConversationId;\r\n    }\r\n\r\n    // get the properties\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    // get the speech language\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privLanguage;\r\n    }\r\n\r\n    public get isMutedByHost(): boolean {\r\n        return this.privParticipants.me?.isHost ? false : this.privParticipants.me?.isMuted;\r\n    }\r\n\r\n    public get isConnected(): boolean {\r\n        return this.privIsConnected && this.privIsReady;\r\n    }\r\n\r\n    public get participants(): Participant[] {\r\n        return this.toParticipants(true);\r\n    }\r\n\r\n    public get me(): Participant {\r\n        return this.toParticipant(this.privParticipants.me);\r\n    }\r\n\r\n    public get host(): Participant {\r\n        return this.toParticipant(this.privParticipants.host);\r\n    }\r\n\r\n    public get transcriberRecognizer(): TranscriberRecognizer {\r\n        return this.privTranscriberRecognizer;\r\n    }\r\n\r\n    public get conversationInfo(): ConversationInfo {\r\n        const convId: string = this.conversationId;\r\n        const p: TranscriptionParticipant[] = this.participants.map((part: Participant): TranscriptionParticipant => (\r\n            {\r\n                id: part.id,\r\n                preferredLanguage: part.preferredLanguage,\r\n                voice: part.voice\r\n            }\r\n        ));\r\n        const props: ConversationProperties = {};\r\n        for (const key of ConversationConnectionConfig.transcriptionEventKeys) {\r\n            const val: string = this.properties.getProperty(key, \"\");\r\n            if (val !== \"\") {\r\n                props[key] = val;\r\n            }\r\n        }\r\n        const info: ConversationInfo = { id: convId, participants: p, conversationProperties: props };\r\n        return info;\r\n    }\r\n\r\n    private get canSend(): boolean {\r\n        return this.privIsConnected && !this.privParticipants.me?.isMuted;\r\n    }\r\n\r\n    private get canSendAsHost(): boolean {\r\n        return this.privIsConnected && this.privParticipants.me?.isHost;\r\n    }\r\n\r\n    // get / set the speech auth token\r\n    // eslint-disable-next-line @typescript-eslint/member-ordering\r\n    public get authorizationToken(): string {\r\n        return this.privToken;\r\n    }\r\n\r\n    public set authorizationToken(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"authorizationToken\");\r\n        this.privToken = value;\r\n    }\r\n\r\n    public set conversationTranslator(conversationTranslator: ConversationTranslator) {\r\n        this.privConversationTranslator = conversationTranslator;\r\n    }\r\n\r\n    public onToken(token: IAuthentication): void {\r\n        this.privConversationTranslator.onToken(token);\r\n    }\r\n\r\n    /**\r\n     * Create a new conversation as Host\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public createConversationAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            if (!!this.privConversationRecognizer) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedStart), err);\r\n            }\r\n            this.privManager.createOrJoin(this.privProperties, undefined,\r\n                ((room: IInternalConversation): void => {\r\n                    if (!room) {\r\n                        this.handleError(new Error(this.privErrors.permissionDeniedConnect), err);\r\n                    }\r\n                    this.privRoom = room;\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                ((error: any): void => {\r\n                    this.handleError(error, err);\r\n                }));\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Starts a new conversation as host.\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public startConversationAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            // check if there is already a recognizer\r\n            if (!!this.privConversationRecognizer) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedStart), err);\r\n            }\r\n            // check if there is conversation data available\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedConnect);\r\n            // connect to the conversation websocket\r\n            this.privParticipants.meId = this.privRoom.participantId;\r\n            this.privConversationRecognizer = ConversationRecognizerFactory.fromConfig(this, this.privConfig);\r\n\r\n            // Because ConversationTranslator manually sets up and manages the connection, Conversation\r\n            // has to forward serviceRecognizer connection events that usually get passed automatically\r\n            this.privConversationRecognizer.connected = this.onConnected;\r\n            this.privConversationRecognizer.disconnected = this.onDisconnected;\r\n            this.privConversationRecognizer.canceled = this.onCanceled;\r\n\r\n            this.privConversationRecognizer.participantUpdateCommandReceived = this.onParticipantUpdateCommandReceived;\r\n            this.privConversationRecognizer.lockRoomCommandReceived = this.onLockRoomCommandReceived;\r\n            this.privConversationRecognizer.muteAllCommandReceived = this.onMuteAllCommandReceived;\r\n            this.privConversationRecognizer.participantJoinCommandReceived = this.onParticipantJoinCommandReceived;\r\n            this.privConversationRecognizer.participantLeaveCommandReceived = this.onParticipantLeaveCommandReceived;\r\n            this.privConversationRecognizer.translationReceived = this.onTranslationReceived;\r\n            this.privConversationRecognizer.participantsListReceived = this.onParticipantsListReceived;\r\n            this.privConversationRecognizer.conversationExpiration = this.onConversationExpiration;\r\n\r\n            this.privConversationRecognizer.connect(this.privRoom.token,\r\n                ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                ((error: any): void => {\r\n                    this.handleError(error, err);\r\n                }));\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Join a conversation as a participant.\r\n     * @param { IParticipant } participant - participant to add\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public addParticipantAsync(participant: IParticipant, cb?: Callback, err?: Callback): void {\r\n        Contracts.throwIfNullOrUndefined(participant, \"Participant\");\r\n        marshalPromiseToCallbacks(this.addParticipantImplAsync(participant), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Join a conversation as a participant.\r\n     * @param conversation\r\n     * @param nickname\r\n     * @param lang\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public joinConversationAsync(conversationId: string, nickname: string, lang: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            // TODO\r\n            // if (!!this.privConversationRecognizer) {\r\n            //     throw new Error(this.privErrors.permissionDeniedStart);\r\n            // }\r\n            Contracts.throwIfNullOrWhitespace(conversationId, this.privErrors.invalidArgs.replace(\"{arg}\", \"conversationId\"));\r\n            Contracts.throwIfNullOrWhitespace(nickname, this.privErrors.invalidArgs.replace(\"{arg}\", \"nickname\"));\r\n            Contracts.throwIfNullOrWhitespace(lang, this.privErrors.invalidArgs.replace(\"{arg}\", \"language\"));\r\n            // join the conversation\r\n            this.privManager.createOrJoin(this.privProperties, conversationId,\r\n                ((room: IInternalConversation): void => {\r\n                    Contracts.throwIfNullOrUndefined(room, this.privErrors.permissionDeniedConnect);\r\n                    this.privRoom = room;\r\n                    this.privConfig.authorizationToken = room.cognitiveSpeechAuthToken;\r\n                    // join callback\r\n                    if (!!cb) {\r\n                        cb(room.cognitiveSpeechAuthToken);\r\n                    }\r\n                }),\r\n                ((error: any): void => {\r\n                    this.handleError(error, err);\r\n                }));\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Deletes a conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public deleteConversationAsync(cb?: Callback, err?: Callback): void {\r\n        marshalPromiseToCallbacks(this.deleteConversationImplAsync(), cb, err);\r\n    }\r\n\r\n    public async deleteConversationImplAsync(): Promise<void> {\r\n            Contracts.throwIfNullOrUndefined(this.privProperties, this.privErrors.permissionDeniedConnect);\r\n            Contracts.throwIfNullOrWhitespace(this.privRoom.token, this.privErrors.permissionDeniedConnect);\r\n            await this.privManager.leave(this.privProperties, this.privRoom.token);\r\n\r\n            this.dispose();\r\n    }\r\n\r\n    /**\r\n     * Issues a request to close the client websockets\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public endConversationAsync(cb?: Callback, err?: Callback): void {\r\n        marshalPromiseToCallbacks(this.endConversationImplAsync(), cb, err);\r\n    }\r\n\r\n    public endConversationImplAsync(): Promise<void> {\r\n        return this.close(true);\r\n    }\r\n\r\n    /**\r\n     * Issues a request to lock the conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public lockConversationAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"lock\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getLockCommand(true),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to mute the conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public muteAllParticipantsAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privConversationRecognizer, this.privErrors.permissionDeniedSend);\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            // check the user's permissions\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"mute\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteAllCommand(true),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to mute a participant in the conversation\r\n     * @param userId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public muteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(userId, this.privErrors.invalidArgs.replace(\"{arg}\", \"userId\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            // check the connection is open (host + participant can perform the mute command)\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            // if not host, check the participant is not muting another participant\r\n            if (!this.me.isHost && this.me.id !== userId) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace(\"{command}\", \"mute\")), err);\r\n            }\r\n            // check the user exists\r\n            const exists: number = this.privParticipants.getParticipantIndex(userId);\r\n            if (exists === -1) {\r\n                this.handleError(new Error(this.privErrors.invalidParticipantRequest), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteCommand(userId, true), ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to remove a participant from the conversation\r\n     * @param userId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public removeParticipantAsync(userId: string | IParticipant | IUser, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            if (!!this.privTranscriberRecognizer && userId.hasOwnProperty(\"id\")) {\r\n                // Assume this is a transcription participant\r\n                marshalPromiseToCallbacks(this.removeParticipantImplAsync(userId as IParticipant), cb, err);\r\n            } else {\r\n                Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n                Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n                if (!this.canSendAsHost) {\r\n                    this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace(\"{command}\", \"remove\")), err);\r\n                }\r\n                let participantId = \"\";\r\n                if (typeof userId === \"string\") {\r\n                    participantId = userId;\r\n                } else if (userId.hasOwnProperty(\"id\")) {\r\n                    const participant: IParticipant = userId as IParticipant;\r\n                    participantId = participant.id;\r\n                } else if (userId.hasOwnProperty(\"userId\")) {\r\n                    const user: IUser = userId as IUser;\r\n                    participantId = user.userId;\r\n                }\r\n                Contracts.throwIfNullOrWhitespace(participantId, this.privErrors.invalidArgs.replace(\"{arg}\", \"userId\"));\r\n                // check the participant exists\r\n                const index: number = this.participants.findIndex((p: Participant): boolean => p.id === participantId);\r\n                if (index === -1) {\r\n                    this.handleError(new Error(this.privErrors.invalidParticipantRequest), err);\r\n                }\r\n                if (!!this.privConversationRecognizer) {\r\n                    this.privConversationRecognizer.sendRequest(this.getEjectCommand(participantId), ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                        ((error: any): void => {\r\n                            this.handleError(error, err);\r\n                        }));\r\n                }\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to unlock the conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public unlockConversationAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"unlock\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getLockCommand(false), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n                }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to unmute all participants in the conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public unmuteAllParticipantsAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"unmute all\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteAllCommand(false), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to unmute a participant in the conversation\r\n     * @param userId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public unmuteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(userId, this.privErrors.invalidArgs.replace(\"{arg}\", \"userId\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            // check the connection is open (host + participant can perform the mute command)\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            // if not host, check the participant is not muting another participant\r\n            if (!this.me.isHost && this.me.id !== userId) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace(\"{command}\", \"mute\")), err);\r\n            }\r\n            // check the user exists\r\n            const exists: number = this.privParticipants.getParticipantIndex(userId);\r\n            if (exists === -1) {\r\n                this.handleError(new Error(this.privErrors.invalidParticipantRequest), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteCommand(userId, false), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Send a text message\r\n     * @param message\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public sendTextMessageAsync(message: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(message, this.privErrors.invalidArgs.replace(\"{arg}\", \"message\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            // TODO: is a max length check required?\r\n            if (message.length > this.privTextMessageMaxLength) {\r\n                this.handleError(new Error(this.privErrors.invalidArgs.replace(\"{arg}\", \"message length\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMessageCommand(message), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Set translated to languages\r\n     * @param {string[]} languages - languages to translate to\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public setTranslatedLanguagesAsync(languages: string[], cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfArrayEmptyOrWhitespace(languages, this.privErrors.invalidArgs.replace(\"{arg}\", \"languages\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getSetTranslateToLanguagesCommand(languages),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Change nickname\r\n     * @param {string} nickname - new nickname for the room\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public changeNicknameAsync(nickname: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(nickname, this.privErrors.invalidArgs.replace(\"{arg}\", \"nickname\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getChangeNicknameCommand(nickname),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public dispose(): void {\r\n        if (this.isDisposed) {\r\n            return;\r\n        }\r\n        this.privIsDisposed = true;\r\n        if (!!this.config) {\r\n            this.config.close();\r\n        }\r\n        this.privConfig = undefined;\r\n        this.privLanguage = undefined;\r\n        this.privProperties = undefined;\r\n        this.privRoom = undefined;\r\n        this.privToken = undefined;\r\n        this.privManager = undefined;\r\n        this.privIsConnected = false;\r\n        this.privIsReady = false;\r\n        this.privParticipants = undefined;\r\n    }\r\n\r\n    public async connectTranscriberRecognizer(recognizer: TranscriberRecognizer): Promise<void> {\r\n        if (!!this.privTranscriberRecognizer) {\r\n            await this.privTranscriberRecognizer.close();\r\n        }\r\n        await recognizer.enforceAudioGating();\r\n        this.privTranscriberRecognizer = recognizer;\r\n        this.privTranscriberRecognizer.conversation = this;\r\n    }\r\n\r\n    public getKeepAlive(): string {\r\n        const nickname: string = (!!this.me) ? this.me.displayName : \"default_nickname\";\r\n        return JSON.stringify({\r\n            id: \"0\",\r\n            nickname,\r\n            participantId: this.privRoom.participantId,\r\n            roomId: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.keepAlive\r\n        });\r\n    }\r\n\r\n    /** websocket callbacks */\r\n    /* eslint-disable @typescript-eslint/typedef */\r\n    private onConnected = (e: ConnectionEventArgs): void => {\r\n        this.privIsConnected = true;\r\n        try {\r\n            if (!!this.privConversationTranslator?.sessionStarted) {\r\n                this.privConversationTranslator.sessionStarted(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onDisconnected = (e: ConnectionEventArgs): void => {\r\n        try {\r\n            if (!!this.privConversationTranslator?.sessionStopped) {\r\n                this.privConversationTranslator.sessionStopped(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        } finally {\r\n            void this.close(false);\r\n        }\r\n    };\r\n\r\n    private onCanceled = (r: ConversationRecognizer, e: ConversationTranslationCanceledEventArgs): void => {\r\n        try {\r\n            if (!!this.privConversationTranslator?.canceled) {\r\n                this.privConversationTranslator.canceled(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantUpdateCommandReceived = (r: ConversationRecognizer, e: ParticipantAttributeEventArgs): void => {\r\n        try {\r\n            const updatedParticipant: IInternalParticipant = this.privParticipants.getParticipant(e.id);\r\n            if (updatedParticipant !== undefined) {\r\n\r\n                switch (e.key) {\r\n                    case ConversationTranslatorCommandTypes.changeNickname:\r\n                        updatedParticipant.displayName = e.value as string;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setUseTTS:\r\n                        updatedParticipant.isUsingTts = e.value as boolean;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setProfanityFiltering:\r\n                        updatedParticipant.profanity = e.value as boolean;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setMute:\r\n                        updatedParticipant.isMuted = e.value as boolean;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setTranslateToLanguages:\r\n                        updatedParticipant.translateToLanguages = e.value as string[];\r\n                        break;\r\n                }\r\n                this.privParticipants.addOrUpdateParticipant(updatedParticipant);\r\n\r\n                if (!!this.privConversationTranslator) {\r\n                    this.privConversationTranslator.participantsChanged(\r\n                        this.privConversationTranslator,\r\n                        new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.Updated,\r\n                            [this.toParticipant(updatedParticipant)], e.sessionId));\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onLockRoomCommandReceived = (): void => {\r\n        // TODO\r\n    };\r\n\r\n    private onMuteAllCommandReceived = (r: ConversationRecognizer, e: MuteAllEventArgs): void => {\r\n        try {\r\n            this.privParticipants.participants.forEach((p: IInternalParticipant): boolean => p.isMuted = (p.isHost ? false : e.isMuted));\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.participantsChanged(\r\n                    this.privConversationTranslator,\r\n                    new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.Updated,\r\n                        this.toParticipants(false), e.sessionId));\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantJoinCommandReceived = (r: ConversationRecognizer, e: ParticipantEventArgs): void => {\r\n        try {\r\n            const newParticipant: IInternalParticipant = this.privParticipants.addOrUpdateParticipant(e.participant);\r\n            if (newParticipant !== undefined) {\r\n                if (!!this.privConversationTranslator) {\r\n                    this.privConversationTranslator.participantsChanged(\r\n                        this.privConversationTranslator,\r\n                        new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.JoinedConversation,\r\n                            [this.toParticipant(newParticipant)], e.sessionId));\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantLeaveCommandReceived = (r: ConversationRecognizer, e: ParticipantEventArgs): void => {\r\n        try {\r\n            const ejectedParticipant: IInternalParticipant = this.privParticipants.getParticipant(e.participant.id);\r\n            if (ejectedParticipant !== undefined) {\r\n                // remove the participant from the internal participants list\r\n                this.privParticipants.deleteParticipant(e.participant.id);\r\n                if (!!this.privConversationTranslator) {\r\n                    // notify subscribers that the participant has left the conversation\r\n                    this.privConversationTranslator.participantsChanged(\r\n                        this.privConversationTranslator,\r\n                        new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.LeftConversation,\r\n                            [this.toParticipant(ejectedParticipant)], e.sessionId));\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onTranslationReceived = (r: ConversationRecognizer, e: ConversationReceivedTranslationEventArgs): void => {\r\n        try {\r\n            switch (e.command) {\r\n                case ConversationTranslatorMessageTypes.final:\r\n                    if (!!this.privConversationTranslator) {\r\n                        this.privConversationTranslator.transcribed(\r\n                            this.privConversationTranslator,\r\n                            new ConversationTranslationEventArgs(e.payload, undefined, e.sessionId));\r\n                    }\r\n                    break;\r\n                case ConversationTranslatorMessageTypes.partial:\r\n                    if (!!this.privConversationTranslator) {\r\n                        this.privConversationTranslator.transcribing(\r\n                            this.privConversationTranslator,\r\n                            new ConversationTranslationEventArgs(e.payload, undefined, e.sessionId));\r\n                    }\r\n                    break;\r\n                case ConversationTranslatorMessageTypes.instantMessage:\r\n                    if (!!this.privConversationTranslator) {\r\n                        this.privConversationTranslator.textMessageReceived(\r\n                            this.privConversationTranslator,\r\n                            new ConversationTranslationEventArgs(e.payload, undefined, e.sessionId));\r\n                    }\r\n                    break;\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantsListReceived = (r: ConversationRecognizer, e: ParticipantsListEventArgs): void => {\r\n        try {\r\n            // check if the session token needs to be updated\r\n            if (e.sessionToken !== undefined && e.sessionToken !== null) {\r\n                this.privRoom.token = e.sessionToken;\r\n            }\r\n            // save the participants\r\n            this.privParticipants.participants = [...e.participants];\r\n            // enable the conversation\r\n            if (this.privParticipants.me !== undefined) {\r\n                this.privIsReady = true;\r\n            }\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.participantsChanged(\r\n                    this.privConversationTranslator,\r\n                    new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.JoinedConversation, this.toParticipants(true), e.sessionId));\r\n            }\r\n            // if this is the host, update the nickname if needed\r\n            if (this.me.isHost) {\r\n                const nickname: string = this.privConversationTranslator?.properties.getProperty(PropertyId.ConversationTranslator_Name);\r\n                if (nickname !== undefined && nickname.length > 0 && nickname !== this.me.displayName) {\r\n                    // issue a change nickname request\r\n                    this.changeNicknameAsync(nickname);\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onConversationExpiration = (r: ConversationRecognizer, e: ConversationExpirationEventArgs): void => {\r\n        try {\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.conversationExpiration(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n    /* eslint-enable @typescript-eslint/typedef */\r\n\r\n    private addParticipantImplAsync(participant: IParticipant): Promise<void> {\r\n        const newParticipant: IInternalParticipant = this.privParticipants.addOrUpdateParticipant(participant);\r\n        if (newParticipant !== undefined) {\r\n            if (!!this.privTranscriberRecognizer) {\r\n                const conversationInfo = this.conversationInfo;\r\n                conversationInfo.participants = [participant];\r\n                return this.privTranscriberRecognizer.pushConversationEvent(conversationInfo, \"join\");\r\n            }\r\n        }\r\n    }\r\n\r\n    private removeParticipantImplAsync(participant: IParticipant): Promise<void> {\r\n        this.privParticipants.deleteParticipant(participant.id);\r\n        const conversationInfo = this.conversationInfo;\r\n        conversationInfo.participants = [participant];\r\n        return this.privTranscriberRecognizer.pushConversationEvent(conversationInfo, \"leave\");\r\n    }\r\n\r\n    private async close(dispose: boolean): Promise<void> {\r\n        try {\r\n            this.privIsConnected = false;\r\n            await this.privConversationRecognizer?.close();\r\n            this.privConversationRecognizer = undefined;\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.dispose();\r\n            }\r\n        } catch (e) {\r\n            // ignore error\r\n            throw e;\r\n        }\r\n        if (dispose) {\r\n            this.dispose();\r\n        }\r\n    }\r\n\r\n    /** Helpers */\r\n    private handleCallback(cb: () => void, err: (message: string) => void): void {\r\n        if (!!cb) {\r\n            try {\r\n                cb();\r\n            } catch (e) {\r\n                if (!!err) {\r\n                    err(e as string);\r\n                }\r\n            }\r\n            cb = undefined;\r\n        }\r\n    }\r\n\r\n    private handleError(error: any, err: (message: string) => void): void {\r\n        if (!!err) {\r\n            if (error instanceof Error) {\r\n                const typedError: Error = error;\r\n                err(typedError.name + \": \" + typedError.message);\r\n\r\n            } else {\r\n                err(error as string);\r\n            }\r\n        }\r\n    }\r\n\r\n    /** Participant Helpers */\r\n    private toParticipants(includeHost: boolean): Participant[] {\r\n\r\n        const participants: Participant[] = this.privParticipants.participants.map((p: IInternalParticipant): Participant => ( this.toParticipant(p) ) );\r\n        if (!includeHost) {\r\n            return participants.filter((p: Participant): boolean => p.isHost === false);\r\n        } else {\r\n            return participants;\r\n        }\r\n    }\r\n\r\n    private toParticipant(p: IInternalParticipant): Participant {\r\n        return new Participant(p.id, p.avatar, p.displayName, p.isHost, p.isMuted, p.isUsingTts, p.preferredLanguage, p.voice);\r\n    }\r\n\r\n    private getMuteAllCommand(isMuted: boolean): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setMuteAll,\r\n            participantId: this.privRoom.participantId, // the id of the host\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: isMuted\r\n        });\r\n    }\r\n\r\n    private getMuteCommand(participantId: string, isMuted: boolean): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setMute,\r\n            // eslint-disable-next-line object-shorthand\r\n            participantId: participantId,\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: isMuted\r\n        });\r\n    }\r\n\r\n    private getLockCommand(isLocked: boolean): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setLockState,\r\n            participantId: this.privRoom.participantId,\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: isLocked\r\n        });\r\n    }\r\n\r\n    private getEjectCommand(participantId: string): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.ejectParticipant,\r\n            // eslint-disable-next-line object-shorthand\r\n            participantId: participantId,\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n        });\r\n    }\r\n\r\n    private getSetTranslateToLanguagesCommand(languages: string[]): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setTranslateToLanguages,\r\n            participantId: this.privRoom.participantId, // the id of the host\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: languages\r\n        });\r\n    }\r\n\r\n    private getChangeNicknameCommand(nickname: string): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(nickname, \"nickname\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.changeNickname,\r\n            nickname,\r\n            participantId: this.privRoom.participantId, // the id of the host\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: nickname\r\n        });\r\n    }\r\n\r\n    private getMessageCommand(message: string): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n        Contracts.throwIfNullOrWhitespace(message, \"message\");\r\n\r\n        return JSON.stringify({\r\n            participantId: this.privRoom.participantId,\r\n            roomId: this.privRoom.roomId,\r\n            text: message,\r\n            type: ConversationTranslatorMessageTypes.instantMessage\r\n        });\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    AudioConfig,\r\n    SpeechTranslationConfig\r\n} from \"../Exports.js\";\r\nimport { Callback } from \"./IConversation.js\";\r\n\r\nexport class ConversationCommon {\r\n\r\n    protected privAudioConfig: AudioConfig;\r\n    protected privSpeechTranslationConfig: SpeechTranslationConfig;\r\n\r\n    public constructor(audioConfig?: AudioConfig) {\r\n        this.privAudioConfig = audioConfig;\r\n    }\r\n\r\n    protected handleCallback(cb: Callback, err: Callback): void {\r\n        if (!!cb) {\r\n            try {\r\n                cb();\r\n            } catch (e) {\r\n                if (!!err) {\r\n                    err(e);\r\n                }\r\n            }\r\n            cb = undefined;\r\n        }\r\n    }\r\n\r\n    protected handleError(error: any, err: Callback): void {\r\n        if (!!err) {\r\n            if (error instanceof Error) {\r\n                const typedError: Error = error;\r\n                err(typedError.name + \": \" + typedError.message);\r\n\r\n            } else {\r\n                err(error);\r\n            }\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nimport { SessionEventArgs } from \"../Exports.js\";\r\n\r\nexport class ConversationExpirationEventArgs extends SessionEventArgs {\r\n    private privExpirationTime: number;\r\n\r\n    public constructor(expirationTime: number, sessionId?: string) {\r\n        super(sessionId);\r\n        this.privExpirationTime = expirationTime;\r\n    }\r\n\r\n    /** How much longer until the conversation expires (in minutes). */\r\n    public get expirationTime(): number {\r\n        return this.privExpirationTime;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nimport { SessionEventArgs } from \"../Exports.js\";\r\nimport { ParticipantChangedReason } from \"./Exports.js\";\r\nimport { IParticipant } from \"./IParticipant.js\";\r\n\r\nexport class ConversationParticipantsChangedEventArgs extends SessionEventArgs {\r\n    private privReason: ParticipantChangedReason;\r\n    private privParticipant: IParticipant[];\r\n\r\n    public constructor(reason: ParticipantChangedReason, participants: IParticipant[], sessionId?: string) {\r\n        super(sessionId);\r\n        this.privReason = reason;\r\n        this.privParticipant = participants;\r\n    }\r\n\r\n    public get reason(): ParticipantChangedReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    public get participants(): IParticipant[] {\r\n        return this.privParticipant;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nimport { CancellationEventArgsBase } from \"../CancellationEventArgsBase.js\";\r\n\r\nexport class ConversationTranslationCanceledEventArgs extends CancellationEventArgsBase {\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nimport { RecognitionEventArgs } from \"../Exports.js\";\r\nimport { ConversationTranslationResult } from \"./Exports.js\";\r\n\r\nexport class ConversationTranslationEventArgs extends RecognitionEventArgs {\r\n    private privResult: ConversationTranslationResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {ConversationTranslationResult} result - The translation recognition result.\r\n     * @param {number} offset - The offset.\r\n     * @param {string} sessionId - The session id.\r\n     */\r\n    public constructor(result: ConversationTranslationResult, offset?: number, sessionId?: string) {\r\n        super(offset, sessionId);\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Specifies the recognition result.\r\n     * @returns {ConversationTranslationResult} the recognition result.\r\n     */\r\n    public get result(): ConversationTranslationResult {\r\n        return this.privResult;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nimport { PropertyCollection } from \"../PropertyCollection.js\";\r\nimport { ResultReason } from \"../ResultReason.js\";\r\nimport { TranslationRecognitionResult } from \"../TranslationRecognitionResult.js\";\r\nimport { Translations } from \"../Translations.js\";\r\n\r\nexport class ConversationTranslationResult extends TranslationRecognitionResult {\r\n    private privId: string;\r\n    private privOrigLang: string;\r\n\r\n    public constructor(participantId: string,\r\n                       translations: Translations,\r\n                       originalLanguage?: string,\r\n                       resultId?: string,\r\n                       reason?: ResultReason,\r\n                       text?: string,\r\n                       duration?: number,\r\n                       offset?: number,\r\n                       errorDetails?: string,\r\n                       json?: string,\r\n                       properties?: PropertyCollection) {\r\n        super(translations, resultId, reason, text, duration, offset, undefined, undefined, errorDetails, json, properties);\r\n        this.privId = participantId;\r\n        this.privOrigLang = originalLanguage;\r\n    }\r\n\r\n    /**\r\n     * The unique identifier for the participant this result is for.\r\n     */\r\n    public get participantId(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    /**\r\n     * The original language this result was in.\r\n     */\r\n    public get originalLang(): string {\r\n        return this.privOrigLang;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    ConversationConnectionConfig,\r\n    IAuthentication,\r\n    ServicePropertiesPropertyName,\r\n} from \"../../common.speech/Exports.js\";\r\nimport { ConversationTranslatorConnectionFactory } from \"../../common.speech/Transcription/ConversationTranslatorConnectionFactory.js\";\r\nimport {\r\n    IDisposable,\r\n    IErrorMessages,\r\n    IStringDictionary,\r\n    marshalPromiseToCallbacks\r\n} from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    ProfanityOption,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ServicePropertyChannel,\r\n    SessionEventArgs,\r\n    SpeechTranslationConfig,\r\n    TranslationRecognitionEventArgs,\r\n    TranslationRecognizer\r\n} from \"../Exports.js\";\r\nimport { ConversationImpl } from \"./Conversation.js\";\r\nimport {\r\n    ConversationCommon,\r\n    ConversationExpirationEventArgs,\r\n    ConversationHandler,\r\n    ConversationParticipantsChangedEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    ConversationTranslationEventArgs,\r\n    IConversationTranslator,\r\n    Participant\r\n} from \"./Exports.js\";\r\nimport { Callback, IConversation } from \"./IConversation.js\";\r\n\r\nexport enum SpeechState {\r\n    Inactive, Connecting, Connected\r\n}\r\n\r\n// child class of TranslationRecognizer meant only for use with ConversationTranslator\r\nclass ConversationTranslationRecognizer extends TranslationRecognizer {\r\n    private privTranslator: ConversationTranslator;\r\n    private privSpeechState: SpeechState;\r\n\r\n    public constructor(speechConfig: SpeechTranslationConfig, audioConfig: AudioConfig, translator: ConversationTranslator, convGetter: () => ConversationImpl) {\r\n\r\n        super(speechConfig, audioConfig, new ConversationTranslatorConnectionFactory(convGetter));\r\n\r\n        this.privSpeechState = SpeechState.Inactive;\r\n        if (!!translator) {\r\n            this.privTranslator = translator;\r\n            this.sessionStarted = (): void => {\r\n                this.privSpeechState = SpeechState.Connected;\r\n            };\r\n\r\n            this.sessionStopped = (): void => {\r\n                this.privSpeechState = SpeechState.Inactive;\r\n            };\r\n\r\n            this.recognizing = (tr: TranslationRecognizer, e: TranslationRecognitionEventArgs): void => {\r\n                if (!!this.privTranslator.recognizing) {\r\n                    this.privTranslator.recognizing(this.privTranslator, e);\r\n                }\r\n            };\r\n\r\n            // eslint-disable-next-line @typescript-eslint/no-misused-promises\r\n            this.recognized = async (tr: TranslationRecognizer, e: TranslationRecognitionEventArgs): Promise<void> => {\r\n                // if there is an error connecting to the conversation service from the speech service the error will be returned in the ErrorDetails field.\r\n                if (e.result?.errorDetails) {\r\n                    await this.cancelSpeech();\r\n                    // TODO: format the error message contained in 'errorDetails'\r\n                    this.fireCancelEvent(e.result.errorDetails);\r\n                } else {\r\n                    if (!!this.privTranslator.recognized) {\r\n                        this.privTranslator.recognized(this.privTranslator, e);\r\n                    }\r\n                }\r\n                return;\r\n            };\r\n\r\n            // eslint-disable-next-line @typescript-eslint/no-misused-promises\r\n            this.canceled = async (): Promise<void> => {\r\n                if (this.privSpeechState !== SpeechState.Inactive) {\r\n                    try {\r\n                        await this.cancelSpeech();\r\n                    } catch (error) {\r\n                        this.privSpeechState = SpeechState.Inactive;\r\n                    }\r\n                }\r\n            };\r\n        }\r\n    }\r\n\r\n    public get state(): SpeechState {\r\n        return this.privSpeechState;\r\n    }\r\n\r\n    public set state(newState: SpeechState) {\r\n        this.privSpeechState = newState;\r\n    }\r\n\r\n    public set authentication(token: IAuthentication) {\r\n        this.privReco.authentication = token;\r\n    }\r\n\r\n\r\n    public onConnection(): void {\r\n        this.privSpeechState = SpeechState.Connected;\r\n    }\r\n\r\n    public async onCancelSpeech(): Promise<void> {\r\n        this.privSpeechState = SpeechState.Inactive;\r\n        await this.cancelSpeech();\r\n    }\r\n\r\n    /**\r\n     * Fire a cancel event\r\n     * @param error\r\n     */\r\n    private fireCancelEvent(error: string): void {\r\n        try {\r\n            if (!!this.privTranslator.canceled) {\r\n                const cancelEvent: ConversationTranslationCanceledEventArgs = new ConversationTranslationCanceledEventArgs(\r\n                    CancellationReason.Error,\r\n                    error,\r\n                    CancellationErrorCode.RuntimeError\r\n                    );\r\n\r\n                this.privTranslator.canceled(this.privTranslator, cancelEvent);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    }\r\n\r\n    private async cancelSpeech(): Promise<void> {\r\n        try {\r\n            this.stopContinuousRecognitionAsync();\r\n            await this.privReco?.disconnect();\r\n            this.privSpeechState = SpeechState.Inactive;\r\n        } catch (e) {\r\n            // ignore the error\r\n        }\r\n    }\r\n}\r\n\r\n/**\r\n * Join, leave or connect to a conversation.\r\n */\r\nexport class ConversationTranslator extends ConversationCommon implements IConversationTranslator, IDisposable {\r\n\r\n    public canceled: (sender: ConversationHandler, event: ConversationTranslationCanceledEventArgs) => void;\r\n    public conversationExpiration: (sender: IConversationTranslator, event: ConversationExpirationEventArgs) => void;\r\n    public participantsChanged: (sender: IConversationTranslator, event: ConversationParticipantsChangedEventArgs) => void;\r\n    public sessionStarted: (sender: ConversationHandler, event: SessionEventArgs) => void;\r\n    public sessionStopped: (sender: ConversationHandler, event: SessionEventArgs) => void;\r\n    public textMessageReceived: (sender: IConversationTranslator, event: ConversationTranslationEventArgs) => void;\r\n\r\n    // Callbacks for whole conversation results\r\n    public transcribed: (sender: IConversationTranslator, event: ConversationTranslationEventArgs) => void;\r\n    public transcribing: (sender: IConversationTranslator, event: ConversationTranslationEventArgs) => void;\r\n\r\n    // Callbacks for detecting speech/translation results from self\r\n    public recognized: (sender: IConversationTranslator, event: TranslationRecognitionEventArgs) => void;\r\n    public recognizing: (sender: IConversationTranslator, event: TranslationRecognitionEventArgs) => void;\r\n\r\n    private privSpeechRecognitionLanguage: string;\r\n    private privProperties: PropertyCollection;\r\n    private privIsDisposed: boolean;\r\n    private privCTRecognizer: ConversationTranslationRecognizer;\r\n    private privIsSpeaking: boolean;\r\n    private privConversation: ConversationImpl;\r\n    private privErrors: IErrorMessages = ConversationConnectionConfig.restErrors;\r\n    private privPlaceholderKey: string;\r\n    private privPlaceholderRegion: string;\r\n\r\n    public constructor(audioConfig?: AudioConfig) {\r\n        super(audioConfig);\r\n        this.privIsDisposed = false;\r\n        this.privIsSpeaking = false;\r\n        this.privPlaceholderKey = \"abcdefghijklmnopqrstuvwxyz012345\";\r\n        this.privPlaceholderRegion = \"westus\";\r\n        this.privProperties = new PropertyCollection();\r\n    }\r\n\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privSpeechRecognitionLanguage;\r\n    }\r\n\r\n    public get participants(): Participant[] {\r\n        return this.privConversation?.participants;\r\n    }\r\n\r\n    private get canSpeak(): boolean {\r\n\r\n        // is there a Conversation websocket available and has the Recognizer been set up\r\n        if (!this.privConversation.isConnected || !this.privCTRecognizer) {\r\n            return false;\r\n        }\r\n\r\n        // is the user already speaking\r\n        if (this.privIsSpeaking || this.privCTRecognizer.state === SpeechState.Connected || this.privCTRecognizer.state === SpeechState.Connecting) {\r\n            return false;\r\n        }\r\n\r\n        // is the user muted\r\n        if (this.privConversation.isMutedByHost) {\r\n            return false;\r\n        }\r\n\r\n        return true;\r\n    }\r\n\r\n    public onToken(token: IAuthentication): void {\r\n        this.privCTRecognizer.authentication = token;\r\n    }\r\n\r\n    public setServiceProperty(name: string, value: string): void {\r\n        const currentProperties: IStringDictionary<string> = JSON.parse(this.privProperties.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n\r\n        currentProperties[name] = value;\r\n\r\n        this.privProperties.setProperty(ServicePropertiesPropertyName, JSON.stringify(currentProperties));\r\n    }\r\n\r\n    /**\r\n     * Join a conversation. If this is the host, pass in the previously created Conversation object.\r\n     * @param conversation\r\n     * @param nickname\r\n     * @param lang\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public joinConversationAsync(conversation: IConversation, nickname: string, cb?: Callback, err?: Callback): void;\r\n    public joinConversationAsync(conversationId: string, nickname: string, lang: string, cb?: Callback, err?: Callback): void;\r\n    public joinConversationAsync(conversation: string | IConversation, nickname: string, param1?: string | Callback, param2?: Callback, param3?: Callback): void {\r\n\r\n        try {\r\n\r\n            if (typeof conversation === \"string\") {\r\n\r\n                Contracts.throwIfNullOrUndefined(conversation, this.privErrors.invalidArgs.replace(\"{arg}\", \"conversation id\"));\r\n                Contracts.throwIfNullOrWhitespace(nickname, this.privErrors.invalidArgs.replace(\"{arg}\", \"nickname\"));\r\n\r\n                if (!!this.privConversation) {\r\n                    this.handleError(new Error(this.privErrors.permissionDeniedStart), param3);\r\n                }\r\n\r\n                let lang: string = param1 as string;\r\n                if (lang === undefined || lang === null || lang === \"\") {\r\n                    lang = ConversationConnectionConfig.defaultLanguageCode;\r\n                }\r\n\r\n                // create a placeholder config\r\n                this.privSpeechTranslationConfig = SpeechTranslationConfig.fromSubscription(\r\n                    this.privPlaceholderKey,\r\n                    this.privPlaceholderRegion);\r\n                this.privSpeechTranslationConfig.setProfanity(ProfanityOption.Masked);\r\n                this.privSpeechTranslationConfig.addTargetLanguage(lang);\r\n                this.privSpeechTranslationConfig.setProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage], lang);\r\n                this.privSpeechTranslationConfig.setProperty(PropertyId[PropertyId.ConversationTranslator_Name], nickname);\r\n\r\n                const propertyIdsToCopy: (string | PropertyId)[] = [\r\n                    PropertyId.SpeechServiceConnection_Host,\r\n                    PropertyId.ConversationTranslator_Host,\r\n                    PropertyId.SpeechServiceConnection_Endpoint,\r\n                    PropertyId.SpeechServiceConnection_ProxyHostName,\r\n                    PropertyId.SpeechServiceConnection_ProxyPassword,\r\n                    PropertyId.SpeechServiceConnection_ProxyPort,\r\n                    PropertyId.SpeechServiceConnection_ProxyUserName,\r\n                    \"ConversationTranslator_MultiChannelAudio\",\r\n                    \"ConversationTranslator_Region\"\r\n                ];\r\n\r\n                for (const prop of propertyIdsToCopy) {\r\n                    const value = this.privProperties.getProperty(prop);\r\n                    if (value) {\r\n                        const key = typeof prop === \"string\" ? prop : PropertyId[prop];\r\n                        this.privSpeechTranslationConfig.setProperty(key, value);\r\n                    }\r\n                }\r\n\r\n                const currentProperties  = JSON.parse(this.privProperties.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n                for (const prop of Object.keys(currentProperties)) {\r\n                    this.privSpeechTranslationConfig.setServiceProperty(prop, currentProperties[prop], ServicePropertyChannel.UriQueryParameter);\r\n                }\r\n\r\n                // join the conversation\r\n                this.privConversation = new ConversationImpl(this.privSpeechTranslationConfig);\r\n                this.privConversation.conversationTranslator = this;\r\n\r\n                this.privConversation.joinConversationAsync(\r\n                    conversation,\r\n                    nickname,\r\n                    lang,\r\n                    ((result: string): void => {\r\n\r\n                        if (!result) {\r\n                            this.handleError(new Error(this.privErrors.permissionDeniedConnect), param3);\r\n                        }\r\n\r\n                        this.privSpeechTranslationConfig.authorizationToken = result;\r\n                        this.privConversation.room.isHost = false;\r\n\r\n                        // connect to the ws\r\n                        this.privConversation.startConversationAsync(\r\n                            ((): void => {\r\n                                this.handleCallback(param2, param3);\r\n                            }),\r\n                            ((error: any): void => {\r\n                                this.handleError(error, param3);\r\n                            }));\r\n\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, param3);\r\n                    }));\r\n\r\n            } else if (typeof conversation === \"object\") {\r\n\r\n                Contracts.throwIfNullOrUndefined(conversation, this.privErrors.invalidArgs.replace(\"{arg}\", \"conversation id\"));\r\n                Contracts.throwIfNullOrWhitespace(nickname, this.privErrors.invalidArgs.replace(\"{arg}\", \"nickname\"));\r\n\r\n                // save the nickname\r\n                this.privProperties.setProperty(PropertyId.ConversationTranslator_Name, nickname);\r\n                // ref the conversation object\r\n                this.privConversation = conversation as ConversationImpl;\r\n                // ref the conversation translator object\r\n                this.privConversation.conversationTranslator = this;\r\n                this.privConversation.room.isHost = true;\r\n\r\n                Contracts.throwIfNullOrUndefined(this.privConversation, this.privErrors.permissionDeniedConnect);\r\n                Contracts.throwIfNullOrUndefined(this.privConversation.room.token, this.privErrors.permissionDeniedConnect);\r\n\r\n                this.privSpeechTranslationConfig = conversation.config;\r\n\r\n                this.handleCallback(param1 as Callback, param2);\r\n            } else {\r\n                this.handleError(\r\n                    new Error(this.privErrors.invalidArgs.replace(\"{arg}\", \"invalid conversation type\")),\r\n                    param2);\r\n            }\r\n\r\n        } catch (error) {\r\n            this.handleError(error, typeof param1 === \"string\" ? param3 : param2);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Leave the conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public leaveConversationAsync(cb?: Callback, err?: Callback): void {\r\n\r\n        marshalPromiseToCallbacks((async (): Promise<void> => {\r\n\r\n            // stop the speech websocket\r\n            await this.cancelSpeech();\r\n            // stop the websocket\r\n            await this.privConversation.endConversationImplAsync();\r\n            // https delete request\r\n            await this.privConversation.deleteConversationImplAsync();\r\n            this.dispose();\r\n\r\n        })(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Send a text message\r\n     * @param message\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public sendTextMessageAsync(message: string, cb?: Callback, err?: Callback): void {\r\n\r\n        try {\r\n            Contracts.throwIfNullOrUndefined(this.privConversation, this.privErrors.permissionDeniedSend);\r\n            Contracts.throwIfNullOrWhitespace(message, this.privErrors.invalidArgs.replace(\"{arg}\", message));\r\n\r\n            this.privConversation.sendTextMessageAsync(message, cb, err);\r\n        } catch (error) {\r\n\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Start speaking\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public startTranscribingAsync(cb?: Callback, err?: Callback): void {\r\n        marshalPromiseToCallbacks((async (): Promise<void> => {\r\n            try {\r\n                Contracts.throwIfNullOrUndefined(this.privConversation, this.privErrors.permissionDeniedSend);\r\n                Contracts.throwIfNullOrUndefined(this.privConversation.room.token, this.privErrors.permissionDeniedConnect);\r\n\r\n                if (this.privCTRecognizer === undefined) {\r\n                    await this.connectTranslatorRecognizer();\r\n                }\r\n                Contracts.throwIfNullOrUndefined(this.privCTRecognizer, this.privErrors.permissionDeniedSend);\r\n\r\n                if (!this.canSpeak) {\r\n                    this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n                }\r\n\r\n                await this.startContinuousRecognition();\r\n\r\n                this.privIsSpeaking = true;\r\n            } catch (error) {\r\n                this.privIsSpeaking = false;\r\n                await this.cancelSpeech();\r\n                throw error;\r\n            }\r\n        })(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Stop speaking\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public stopTranscribingAsync(cb?: Callback, err?: Callback): void {\r\n        marshalPromiseToCallbacks((async (): Promise<void> => {\r\n            try {\r\n                if (!this.privIsSpeaking) {\r\n                    // stop speech\r\n                    await this.cancelSpeech();\r\n                    return;\r\n                }\r\n\r\n                // stop the recognition but leave the websocket open\r\n                this.privIsSpeaking = false;\r\n                await new Promise((resolve: () => void, reject: (error: string) => void): void => {\r\n                    this.privCTRecognizer.stopContinuousRecognitionAsync(resolve, reject);\r\n                });\r\n\r\n            } catch (error) {\r\n                await this.cancelSpeech();\r\n            }\r\n        })(), cb, err);\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public dispose(reason?: string, success?: () => void, err?: (error: string) => void): void {\r\n        marshalPromiseToCallbacks((async (): Promise<void> => {\r\n            if (this.isDisposed && !this.privIsSpeaking) {\r\n                return;\r\n            }\r\n            await this.cancelSpeech();\r\n            this.privIsDisposed = true;\r\n            this.privSpeechTranslationConfig.close();\r\n            this.privSpeechRecognitionLanguage = undefined;\r\n            this.privProperties = undefined;\r\n            this.privAudioConfig = undefined;\r\n            this.privSpeechTranslationConfig = undefined;\r\n            this.privConversation.dispose();\r\n            this.privConversation = undefined;\r\n        })(), success, err);\r\n    }\r\n\r\n    /**\r\n     * Cancel the speech websocket\r\n     */\r\n    private async cancelSpeech(): Promise<void> {\r\n        try {\r\n            this.privIsSpeaking = false;\r\n            await this.privCTRecognizer?.onCancelSpeech();\r\n            this.privCTRecognizer = undefined;\r\n        } catch (e) {\r\n            // ignore the error\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Connect to the speech translation recognizer.\r\n     * Currently there is no language validation performed before sending the SpeechLanguage code to the service.\r\n     * If it's an invalid language the raw error will be: 'Error during WebSocket handshake: Unexpected response code: 400'\r\n     * e.g. pass in 'fr' instead of 'fr-FR', or a text-only language 'cy'\r\n     */\r\n    private async connectTranslatorRecognizer(): Promise<void> {\r\n        try {\r\n\r\n            if (this.privAudioConfig === undefined) {\r\n                this.privAudioConfig = AudioConfig.fromDefaultMicrophoneInput();\r\n            }\r\n\r\n            // clear the temp subscription key if it's a participant joining\r\n            if (this.privSpeechTranslationConfig.getProperty(PropertyId[PropertyId.SpeechServiceConnection_Key])\r\n                === this.privPlaceholderKey) {\r\n                this.privSpeechTranslationConfig.setProperty(PropertyId[PropertyId.SpeechServiceConnection_Key], \"\");\r\n            }\r\n\r\n            const convGetter = (): ConversationImpl => this.privConversation;\r\n            this.privCTRecognizer = new ConversationTranslationRecognizer(this.privSpeechTranslationConfig, this.privAudioConfig, this, convGetter);\r\n        } catch (error) {\r\n            await this.cancelSpeech();\r\n            throw error;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Handle the start speaking request\r\n     */\r\n    private startContinuousRecognition(): Promise<void> {\r\n        return new Promise((resolve: () => void, reject: (error: string) => void): void => {\r\n            this.privCTRecognizer.startContinuousRecognitionAsync(resolve, reject);\r\n        });\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    RestConfigBase,\r\n    WebsocketConnection,\r\n} from \"../../common.browser/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary,\r\n} from \"../../common/Exports.js\";\r\nimport { StringUtils } from \"../../common/StringUtils.js\";\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport {\r\n    PropertyId\r\n} from \"../../sdk/Exports.js\";\r\nimport {\r\n    ConversationImpl\r\n} from \"../../sdk/Transcription/Conversation.js\";\r\nimport { HeaderNames } from \"../HeaderNames.js\";\r\nimport { QueryParameterNames } from \"../QueryParameterNames.js\";\r\nimport {\r\n    ConnectionFactoryBase\r\n} from \"./../ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    RecognizerConfig,\r\n    TranscriberConnectionFactory,\r\n    TranslationConnectionFactory,\r\n    WebsocketMessageFormatter,\r\n} from \"./../Exports.js\";\r\n\r\n/**\r\n * Connection factory for the conversation translator. Handles connecting to the regular translator endpoint,\r\n * as well as the virtual microphone array transcription endpoint\r\n */\r\nexport class ConversationTranslatorConnectionFactory extends ConnectionFactoryBase {\r\n\r\n    private static readonly CTS_VIRT_MIC_PATH: string = \"/speech/recognition/dynamicaudio\";\r\n\r\n    private privConvGetter: () => ConversationImpl;\r\n\r\n    public constructor(convGetter: () => ConversationImpl) {\r\n        super();\r\n\r\n        Contracts.throwIfNullOrUndefined(convGetter, \"convGetter\");\r\n        this.privConvGetter = convGetter;\r\n    }\r\n\r\n    public create(config: RecognizerConfig, authInfo: AuthInfo, connectionId?: string): IConnection {\r\n        const isVirtMicArrayEndpoint = config.parameters.getProperty(\"ConversationTranslator_MultiChannelAudio\", \"\").toUpperCase() === \"TRUE\";\r\n\r\n        const convInfo = this.privConvGetter().room;\r\n        const region = convInfo.cognitiveSpeechRegion || config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, \"\");\r\n\r\n        const replacementValues: IStringDictionary<string> = {\r\n            hostSuffix: ConnectionFactoryBase.getHostSuffix(region),\r\n            path: ConversationTranslatorConnectionFactory.CTS_VIRT_MIC_PATH,\r\n            region: encodeURIComponent(region)\r\n        };\r\n        replacementValues[QueryParameterNames.Language] = encodeURIComponent(config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, \"\"));\r\n        replacementValues[QueryParameterNames.CtsMeetingId] = encodeURIComponent(convInfo.roomId);\r\n        replacementValues[QueryParameterNames.CtsDeviceId] = encodeURIComponent(convInfo.participantId);\r\n        replacementValues[QueryParameterNames.CtsIsParticipant] = convInfo.isHost ? \"\" : (\"&\" + QueryParameterNames.CtsIsParticipant);\r\n\r\n        let endpointUrl: string = \"\";\r\n        const queryParams: IStringDictionary<string> = {};\r\n        const headers: IStringDictionary<string> = {};\r\n\r\n        if (isVirtMicArrayEndpoint) {\r\n            // connecting to the conversation transcription virtual microphone array endpoint\r\n            endpointUrl = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint);\r\n            if (!endpointUrl) {\r\n                const hostName = config.parameters.getProperty(\r\n                    PropertyId.SpeechServiceConnection_Host,\r\n                    \"transcribe.{region}.cts.speech{hostSuffix}\");\r\n\r\n                endpointUrl = \"wss://\" + hostName + \"{path}\";\r\n            }\r\n\r\n            // because the region can change during a session, we support being passed a format string which we can then\r\n            // replace with the correct information.\r\n            endpointUrl = StringUtils.formatString(endpointUrl, replacementValues);\r\n\r\n            const parsedUrl = new URL(endpointUrl);\r\n            parsedUrl.searchParams.forEach((val: string, key: string): void => {\r\n                queryParams[key] = val;\r\n            });\r\n\r\n            const connFactory = new TranscriberConnectionFactory();\r\n            connFactory.setQueryParams(queryParams, config, endpointUrl);\r\n\r\n            // Some query parameters are required for the CTS endpoint, let's explicity set them here\r\n            queryParams[QueryParameterNames.CtsMeetingId] = replacementValues[QueryParameterNames.CtsMeetingId];\r\n            queryParams[QueryParameterNames.CtsDeviceId] = replacementValues[QueryParameterNames.CtsDeviceId];\r\n            if (!convInfo.isHost) {\r\n                queryParams[QueryParameterNames.CtsIsParticipant] = \"\"; // this doesn't have a value so set to an empty string\r\n            }\r\n\r\n            if (!(QueryParameterNames.Format in queryParams)) {\r\n                queryParams[QueryParameterNames.Format] = \"simple\";\r\n            }\r\n\r\n            parsedUrl.searchParams.forEach((val: string, key: string): void => {\r\n                parsedUrl.searchParams.set(key, queryParams[key]);\r\n                delete queryParams[key];\r\n            });\r\n\r\n            endpointUrl = parsedUrl.toString();\r\n\r\n        } else {\r\n            // connecting to regular translation endpoint\r\n            const connFactory = new TranslationConnectionFactory();\r\n\r\n            endpointUrl = connFactory.getEndpointUrl(config, true);\r\n            endpointUrl = StringUtils.formatString(endpointUrl, replacementValues);\r\n\r\n            connFactory.setQueryParams(queryParams, config, endpointUrl);\r\n        }\r\n\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n        headers[RestConfigBase.configParams.token] = convInfo.token;\r\n        if (!!authInfo.token) {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n\r\n        const enableCompression = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"\").toUpperCase() === \"TRUE\";\r\n        return new WebsocketConnection(endpointUrl, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IStringDictionary } from \"./IDictionary.js\";\r\n\r\n/**\r\n * String helper functions\r\n */\r\nexport class StringUtils {\r\n\r\n    /**\r\n     * Formats a string by replacing the named {keys} in the string with the values contained in the replacement dictionary.\r\n     * @param format The format string that contains the parts to replace surrounded by {}. For example: \"wss://{region}.cts.speech.microsoft.com\".\r\n     * If your string needs to contain a { or } you can use the {{ and }} escape sequences respectively.\r\n     * @param replacements The dictionary of replacements. If a replacement is not found, it is replaced with an empty string\r\n     * @returns The formatted string. If you pass in a null or undefined format string, an empty string will be returned\r\n     */\r\n    public static formatString(format: string, replacements: IStringDictionary<string>): string {\r\n        if (!format) {\r\n            return \"\";\r\n        }\r\n\r\n        if (!replacements) {\r\n            return format;\r\n        }\r\n\r\n        let formatted: string = \"\";\r\n        let key: string = \"\";\r\n\r\n        const appendToFormatted = (str: string): void => {\r\n            formatted += str;\r\n        };\r\n        const appendToKey = (str: string): void => {\r\n            key += str;\r\n        };\r\n        let appendFunc: (str: string) => void = appendToFormatted;\r\n\r\n        for (let i = 0; i < format.length; i++) {\r\n            const c: string = format[i];\r\n            const next: string = i + 1 < format.length ? format[i + 1] : \"\";\r\n\r\n            switch (c) {\r\n                case \"{\":\r\n                    if (next === \"{\") {\r\n                        appendFunc(\"{\");\r\n                        i++;\r\n                    } else {\r\n                        appendFunc = appendToKey;\r\n                    }\r\n                    break;\r\n\r\n                case \"}\":\r\n                    if (next === \"}\") {\r\n                        appendFunc(\"}\");\r\n                        i++;\r\n                    } else {\r\n                        if (replacements.hasOwnProperty(key)) {\r\n                            formatted += replacements[key];\r\n                        }\r\n\r\n                        appendFunc = appendToFormatted;\r\n                        key = \"\";\r\n                    }\r\n                    break;\r\n\r\n                default:\r\n                    appendFunc(c);\r\n                    break;\r\n            }\r\n        }\r\n\r\n        return formatted;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    OutputFormatPropertyName,\r\n    RecognitionMode,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    // SpeechConnectionFactory,\r\n    ConversationTranscriberConnectionFactory,\r\n    SpeechServiceConfig,\r\n    ConversationTranscriptionServiceRecognizer,\r\n} from \"../../common.speech/Exports.js\";\r\nimport { marshalPromiseToCallbacks } from \"../../common/Exports.js\";\r\nimport { AudioConfigImpl } from \"../Audio/AudioConfig.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    AutoDetectSourceLanguageConfig,\r\n    ConversationTranscriptionEventArgs,\r\n    ConversationTranscriptionCanceledEventArgs,\r\n    OutputFormat,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n} from \"../Exports.js\";\r\nimport { SpeechConfig, SpeechConfigImpl } from \"../SpeechConfig.js\";\r\n\r\n/**\r\n * Performs speech recognition with speaker separation from microphone, file, or other audio input streams, and gets transcribed text as result.\r\n * @class ConversationTranscriber\r\n */\r\nexport class ConversationTranscriber extends Recognizer {\r\n    private privDisposedRecognizer: boolean;\r\n\r\n    /**\r\n     * ConversationTranscriber constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - an set of initial properties for this recognizer\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n     */\r\n    public constructor(speechConfig: SpeechConfig, audioConfig?: AudioConfig) {\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        Contracts.throwIfNull(speechConfigImpl, \"speechConfig\");\r\n\r\n        Contracts.throwIfNullOrWhitespace(\r\n            speechConfigImpl.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage),\r\n            PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n\r\n        super(audioConfig, speechConfigImpl.properties, new ConversationTranscriberConnectionFactory());\r\n        this.privProperties.setProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, \"2\");\r\n        this.privDisposedRecognizer = false;\r\n    }\r\n\r\n    /**\r\n     * ConversationTranscriber constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - an set of initial properties for this recognizer\r\n     * @param {AutoDetectSourceLanguageConfig} autoDetectSourceLanguageConfig - An source language detection configuration associated with the recognizer\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n     */\r\n    public static FromConfig(speechConfig: SpeechConfig, autoDetectSourceLanguageConfig: AutoDetectSourceLanguageConfig, audioConfig?: AudioConfig): ConversationTranscriber {\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        autoDetectSourceLanguageConfig.properties.mergeTo(speechConfigImpl.properties);\r\n        const recognizer = new ConversationTranscriber(speechConfig, audioConfig);\r\n        return recognizer;\r\n    }\r\n\r\n    /**\r\n     * The event transcribing signals that an intermediate transcription result is received.\r\n     * @member ConversationTranscriber.prototype.transcribing\r\n     * @function\r\n     * @public\r\n     */\r\n    public transcribing: (sender: Recognizer, event: ConversationTranscriptionEventArgs) => void;\r\n\r\n    /**\r\n     * The event transcriber signals that a final recognition result is received.\r\n     * @member ConversationTranscriber.prototype.transcribed\r\n     * @function\r\n     * @public\r\n     */\r\n    public transcribed: (sender: Recognizer, event: ConversationTranscriptionEventArgs) => void;\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during transcription.\r\n     * @member ConversationTranscriber.prototype.canceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public canceled: (sender: Recognizer, event: ConversationTranscriptionCanceledEventArgs) => void;\r\n\r\n    /**\r\n     * Gets the endpoint id of a customized speech model that is used for transcription.\r\n     * @member ConversationTranscriber.prototype.endpointId\r\n     * @function\r\n     * @public\r\n     * @returns {string} the endpoint id of a customized speech model that is used for speech recognition.\r\n     */\r\n    public get endpointId(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_EndpointId, \"00000000-0000-0000-0000-000000000000\");\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member ConversationTranscriber.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * @member ConversationTranscriber.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} token - Authorization token.\r\n     */\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    /**\r\n     * Gets the spoken language of transcription.\r\n     * @member ConversationTranscriber.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {string} The spoken language of transcription.\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    /**\r\n     * Gets the output format of transcription.\r\n     * @member ConversationTranscriber.prototype.outputFormat\r\n     * @function\r\n     * @public\r\n     * @returns {OutputFormat} The output format of transcription.\r\n     */\r\n    public get outputFormat(): OutputFormat {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        if (this.properties.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]) === OutputFormat[OutputFormat.Simple]) {\r\n            return OutputFormat.Simple;\r\n        } else {\r\n            return OutputFormat.Detailed;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this conversation transcriber.\r\n     * @member ConversationTranscriber.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this SpeechRecognizer.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Starts conversation transcription, until stopTranscribingAsync() is called.\r\n     * User must subscribe to events to receive transcription results.\r\n     * @member ConversationTranscriber.prototype.startTranscribingAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the transcription has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public startTranscribingAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(RecognitionMode.Conversation), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Stops conversation transcription.\r\n     * @member ConversationTranscriber.prototype.stopTranscribingAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the transcription has stopped.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public stopTranscribingAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * closes all external resources held by an instance of this class.\r\n     * @member ConversationTranscriber.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, errorCb?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\r\n    }\r\n\r\n    /**\r\n     * Disposes any resources held by the object.\r\n     * @member SpeechRecognizer.prototype.dispose\r\n     * @function\r\n     * @public\r\n     * @param {boolean} disposing - true if disposing the object.\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedRecognizer) {\r\n            return;\r\n        }\r\n\r\n        if (disposing) {\r\n            this.privDisposedRecognizer = true;\r\n            await this.implRecognizerStop();\r\n        }\r\n\r\n        await super.dispose(disposing);\r\n    }\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.privProperties);\r\n    }\r\n\r\n    protected createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n        const configImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        recognizerConfig.isSpeakerDiarizationEnabled = true;\r\n        return new ConversationTranscriptionServiceRecognizer(authentication, connectionFactory, configImpl, recognizerConfig, this);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { PropertyCollection } from \"../Exports.js\";\r\n\r\n/**\r\n * Represents a user in a conversation.\r\n * Added in version 1.4.0\r\n */\r\nexport interface IUser {\r\n    /** Gets the user's ID */\r\n    readonly userId: string;\r\n}\r\n\r\nexport class User implements IUser {\r\n    private privUserId: string;\r\n\r\n    public constructor(userId: string) {\r\n        this.privUserId = userId;\r\n    }\r\n\r\n    public get userId(): string {\r\n        return this.privUserId;\r\n    }\r\n}\r\n\r\nexport interface VoiceSignature {\r\n    Version: number;\r\n    Tag: string;\r\n    Data: string;\r\n}\r\n\r\nexport interface TranscriptionParticipant {\r\n    /** The unique identifier for the participant. */\r\n    readonly id: string;\r\n    /** The participant's preferred spoken language. */\r\n    readonly preferredLanguage: string;\r\n    /** The participant's voice signature */\r\n    readonly voice: string;\r\n}\r\n\r\n/**\r\n * Represents a participant in a conversation.\r\n * Added in version 1.4.0\r\n */\r\nexport interface IParticipant extends TranscriptionParticipant {\r\n    /** Gets the colour of the user's avatar as an HTML hex string (e.g. FF0000 for red). */\r\n    readonly avatar: string;\r\n    /**\r\n     * The participant's display name. Please note that there may be more than one participant\r\n     * with the same name. You can use <see cref=\"Id\"/> property to tell them apart.\r\n     */\r\n    readonly displayName: string;\r\n    /** Gets whether or not this participant is the host. */\r\n    readonly isHost: boolean;\r\n    /** Gets whether or not this participant is muted. */\r\n    readonly isMuted: boolean;\r\n    /** Gets whether or not the participant is using Text To Speech (TTS). */\r\n    readonly isUsingTts: boolean;\r\n    /** Contains properties of the participant. */\r\n    readonly properties: PropertyCollection;\r\n}\r\n\r\nexport class Participant implements IParticipant {\r\n    private privAvatar: string;\r\n    private privDisplayName: string;\r\n    private privId: string;\r\n    private privIsHost: boolean;\r\n    private privIsMuted: boolean;\r\n    private privIsUsingTts: boolean;\r\n    private privPreferredLanguage: string;\r\n    private privVoice: string;\r\n    private privProperties: PropertyCollection;\r\n\r\n    public constructor(id: string, avatar: string, displayName: string, isHost: boolean, isMuted: boolean, isUsingTts: boolean, preferredLanguage: string, voice?: string) {\r\n        this.privId = id;\r\n        this.privAvatar = avatar;\r\n        this.privDisplayName = displayName;\r\n        this.privIsHost = isHost;\r\n        this.privIsMuted = isMuted;\r\n        this.privIsUsingTts = isUsingTts;\r\n        this.privPreferredLanguage = preferredLanguage;\r\n        this.privVoice = voice;\r\n        this.privProperties = new PropertyCollection();\r\n    }\r\n\r\n    public get avatar(): string {\r\n        return this.privAvatar;\r\n    }\r\n\r\n    public get displayName(): string {\r\n        return this.privDisplayName;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public get preferredLanguage(): string {\r\n        return this.privPreferredLanguage;\r\n    }\r\n\r\n    public get isHost(): boolean {\r\n        return this.privIsHost;\r\n    }\r\n\r\n    public get isMuted(): boolean {\r\n        return this.privIsMuted;\r\n    }\r\n\r\n    public get isUsingTts(): boolean {\r\n        return this.privIsUsingTts;\r\n    }\r\n\r\n    public get voice(): string {\r\n        return this.privVoice;\r\n    }\r\n\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public static From(id: string, language: string, voice: string): IParticipant {\r\n        return new Participant(id, \"\", id, false, false, false, language, voice);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nexport enum ParticipantChangedReason {\r\n    /** Participant has joined the conversation. */\r\n    JoinedConversation,\r\n\r\n    /** Participant has left the conversation. This could be voluntary, or involuntary\r\n     * (e.g. they are experiencing networking issues).\r\n     */\r\n    LeftConversation,\r\n\r\n    /** The participants' state has changed (e.g. they became muted, changed their nickname). */\r\n    Updated\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    ConversationConnectionConfig,\r\n    ConversationManager,\r\n    ConversationReceivedTranslationEventArgs,\r\n    ConversationRecognizer,\r\n    ConversationTranslatorCommandTypes,\r\n    ConversationTranslatorMessageTypes,\r\n    IInternalConversation,\r\n    IInternalParticipant,\r\n    InternalParticipants,\r\n    MuteAllEventArgs,\r\n    ParticipantAttributeEventArgs,\r\n    ParticipantEventArgs,\r\n    ParticipantsListEventArgs,\r\n    TranscriberRecognizer\r\n} from \"../../common.speech/Exports.js\";\r\nimport {\r\n    IDisposable,\r\n    IErrorMessages,\r\n    marshalPromiseToCallbacks\r\n} from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    ConnectionEventArgs,\r\n    ConversationExpirationEventArgs,\r\n    ConversationParticipantsChangedEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    ConversationTranslationEventArgs,\r\n    ConversationTranslator,\r\n    Participant,\r\n    ParticipantChangedReason,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    SpeechTranslationConfig,\r\n} from \"../Exports.js\";\r\nimport { SpeechTranslationConfigImpl } from \"../SpeechTranslationConfig.js\";\r\nimport { Callback, MeetingInfo, MeetingProperties, IMeeting } from \"./IMeeting.js\";\r\nimport { IParticipant, IUser, TranscriptionParticipant } from \"./IParticipant.js\";\r\n\r\nexport abstract class Meeting implements IMeeting {\r\n\r\n    protected constructor() {\r\n        return;\r\n    }\r\n\r\n    public abstract get authorizationToken(): string;\r\n\r\n    public abstract get config(): SpeechTranslationConfig;\r\n\r\n    public abstract get meetingId(): string;\r\n    public abstract get meetingInfo(): MeetingInfo;\r\n    public abstract get properties(): PropertyCollection;\r\n    public abstract get speechRecognitionLanguage(): string;\r\n    public abstract get participants(): Participant[];\r\n    public abstract set authorizationToken(value: string);\r\n    public abstract get isConnected(): boolean;\r\n\r\n    /**\r\n     * Create a meeting\r\n     * @param speechConfig\r\n     * @param meetingId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public static createMeetingAsync(speechConfig: SpeechTranslationConfig, meetingId: string, arg3?: Callback, arg4?: Callback): Meeting {\r\n        Contracts.throwIfNullOrUndefined(speechConfig, ConversationConnectionConfig.restErrors.invalidArgs.replace(\"{arg}\", \"config\"));\r\n        Contracts.throwIfNullOrUndefined(speechConfig.region, ConversationConnectionConfig.restErrors.invalidArgs.replace(\"{arg}\", \"SpeechServiceConnection_Region\"));\r\n        Contracts.throwIfNull(meetingId, \"meetingId\");\r\n        if (meetingId.length === 0) {\r\n            throw new Error(\"meetingId cannot be empty\");\r\n        }\r\n        if (!speechConfig.subscriptionKey && !speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceAuthorization_Token])) {\r\n            Contracts.throwIfNullOrUndefined(speechConfig.subscriptionKey, ConversationConnectionConfig.restErrors.invalidArgs.replace(\"{arg}\", \"SpeechServiceConnection_Key\"));\r\n        }\r\n        const meetingImpl = new MeetingImpl(speechConfig, meetingId);\r\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n        marshalPromiseToCallbacks((async (): Promise<void> => {})(), arg3, arg4);\r\n        return meetingImpl;\r\n    }\r\n\r\n    /** Start a meeting. */\r\n    public abstract startMeetingAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Delete a meeting. After this no one will be able to join the meeting. */\r\n    public abstract deleteMeetingAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** End a meeting. */\r\n    public abstract endMeetingAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Lock a meeting. This will prevent new participants from joining. */\r\n    public abstract lockMeetingAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Add Participant to Meeting. */\r\n    public abstract addParticipantAsync(participant: IParticipant, cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Mute all other participants in the Meeting. After this no other participants will\r\n     * have their speech recognitions broadcast, nor be able to send text messages.\r\n     */\r\n    public abstract muteAllParticipantsAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Mute a participant.\r\n     * @param userId A user identifier\r\n     */\r\n    public abstract muteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Remove a participant from a meeting using the user id, Participant or User object\r\n     * @param userId A user identifier\r\n     */\r\n    public abstract removeParticipantAsync(userId: string | IParticipant | IUser, cb?: Callback, err?: Callback): void;\r\n\r\n    /** Unlocks a meeting. */\r\n    public abstract unlockMeetingAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /** Unmute all other participants in the meeting. */\r\n    public abstract unmuteAllParticipantsAsync(cb?: Callback, err?: Callback): void;\r\n\r\n    /**\r\n     * Unmute a participant.\r\n     * @param userId A user identifier\r\n     */\r\n    public abstract unmuteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void;\r\n}\r\n\r\nexport class MeetingImpl extends Meeting implements IDisposable {\r\n\r\n    private privConfig: SpeechTranslationConfig;\r\n    private privProperties: PropertyCollection;\r\n    private privLanguage: string;\r\n    private privToken: string;\r\n    private privIsDisposed: boolean;\r\n    private privRoom: IInternalConversation;\r\n    private privManager: ConversationManager;\r\n    private privConversationRecognizer: ConversationRecognizer;\r\n    private privIsConnected: boolean;\r\n    private privParticipants: InternalParticipants;\r\n    private privIsReady: boolean;\r\n    private privConversationTranslator: ConversationTranslator;\r\n    private privTranscriberRecognizer: TranscriberRecognizer;\r\n    private privErrors: IErrorMessages = ConversationConnectionConfig.restErrors;\r\n    private privConversationId: string;\r\n    private readonly privTextMessageMaxLength: number;\r\n\r\n    /**\r\n     * Create a Meeting impl\r\n     * @param speechConfig\r\n     * @param {string} id - optional conversationId\r\n     */\r\n    public constructor(speechConfig: SpeechTranslationConfig, id: string) {\r\n        super();\r\n        this.privIsConnected = false;\r\n        this.privIsDisposed = false;\r\n        this.privConversationId = \"\";\r\n        this.privProperties = new PropertyCollection();\r\n        this.privManager = new ConversationManager();\r\n\r\n        // check the speech language\r\n        const language: string = speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n        if (!language) {\r\n            speechConfig.setProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage], ConversationConnectionConfig.defaultLanguageCode);\r\n        }\r\n        this.privLanguage = speechConfig.getProperty(PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n        this.privConversationId = id;\r\n\r\n        // save the speech config for future usage\r\n        this.privConfig = speechConfig;\r\n\r\n        // save the config properties\r\n        const configImpl = speechConfig as SpeechTranslationConfigImpl;\r\n        Contracts.throwIfNull(configImpl, \"speechConfig\");\r\n        this.privProperties = configImpl.properties.clone();\r\n        this.privIsConnected = false;\r\n        this.privParticipants = new InternalParticipants();\r\n        this.privIsReady = false;\r\n        this.privTextMessageMaxLength = 1000;\r\n    }\r\n\r\n    // get the internal data about a conversation\r\n    public get room(): IInternalConversation {\r\n        return this.privRoom;\r\n    }\r\n\r\n    // get the wrapper for connecting to the websockets\r\n    public get connection(): ConversationRecognizer {\r\n        return this.privConversationRecognizer; // this.privConnection;\r\n    }\r\n\r\n    // get the config\r\n    public get config(): SpeechTranslationConfig {\r\n        return this.privConfig;\r\n    }\r\n\r\n    // get the meeting Id\r\n    public get meetingId(): string {\r\n        return this.privRoom ? this.privRoom.roomId : this.privConversationId;\r\n    }\r\n\r\n    // get the properties\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    // get the speech language\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privLanguage;\r\n    }\r\n\r\n    public get isMutedByHost(): boolean {\r\n        return this.privParticipants.me?.isHost ? false : this.privParticipants.me?.isMuted;\r\n    }\r\n\r\n    public get isConnected(): boolean {\r\n        return this.privIsConnected && this.privIsReady;\r\n    }\r\n\r\n    public get participants(): Participant[] {\r\n        return this.toParticipants(true);\r\n    }\r\n\r\n    public get me(): Participant {\r\n        return this.toParticipant(this.privParticipants.me);\r\n    }\r\n\r\n    public get host(): Participant {\r\n        return this.toParticipant(this.privParticipants.host);\r\n    }\r\n\r\n    public get transcriberRecognizer(): TranscriberRecognizer {\r\n        return this.privTranscriberRecognizer;\r\n    }\r\n\r\n    public get meetingInfo(): MeetingInfo {\r\n        const convId: string = this.meetingId;\r\n        const p: TranscriptionParticipant[] = this.participants.map((part: Participant): TranscriptionParticipant => (\r\n            {\r\n                id: part.id,\r\n                preferredLanguage: part.preferredLanguage,\r\n                voice: part.voice\r\n            }\r\n        ));\r\n        const props: MeetingProperties = {};\r\n        for (const key of ConversationConnectionConfig.transcriptionEventKeys) {\r\n            const val: string = this.properties.getProperty(key, \"\");\r\n            if (val !== \"\") {\r\n                props[key] = val;\r\n            }\r\n        }\r\n        const info: MeetingInfo = { id: convId, participants: p, meetingProperties: props };\r\n        return info;\r\n    }\r\n\r\n    private get canSend(): boolean {\r\n        return this.privIsConnected && !this.privParticipants.me?.isMuted;\r\n    }\r\n\r\n    private get canSendAsHost(): boolean {\r\n        return this.privIsConnected && this.privParticipants.me?.isHost;\r\n    }\r\n\r\n    // get / set the speech auth token\r\n    // eslint-disable-next-line @typescript-eslint/member-ordering\r\n    public get authorizationToken(): string {\r\n        return this.privToken;\r\n    }\r\n\r\n    public set authorizationToken(value: string) {\r\n        Contracts.throwIfNullOrWhitespace(value, \"authorizationToken\");\r\n        this.privToken = value;\r\n    }\r\n\r\n    /**\r\n     * Create a new meeting as Host\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public createMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            if (!!this.privConversationRecognizer) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedStart), err);\r\n            }\r\n            this.privManager.createOrJoin(this.privProperties, undefined,\r\n                ((room: IInternalConversation): void => {\r\n                    if (!room) {\r\n                        this.handleError(new Error(this.privErrors.permissionDeniedConnect), err);\r\n                    }\r\n                    this.privRoom = room;\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                ((error: any): void => {\r\n                    this.handleError(error, err);\r\n                }));\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Starts a new meeting as host.\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public startMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            // check if there is already a recognizer\r\n            if (!!this.privConversationRecognizer) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedStart), err);\r\n            }\r\n            // check if there is conversation data available\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedConnect);\r\n            // connect to the conversation websocket\r\n            this.privParticipants.meId = this.privRoom.participantId;\r\n\r\n            // Because ConversationTranslator manually sets up and manages the connection, Conversation\r\n            // has to forward serviceRecognizer connection events that usually get passed automatically\r\n            this.privConversationRecognizer.connected = this.onConnected;\r\n            this.privConversationRecognizer.disconnected = this.onDisconnected;\r\n            this.privConversationRecognizer.canceled = this.onCanceled;\r\n\r\n            this.privConversationRecognizer.participantUpdateCommandReceived = this.onParticipantUpdateCommandReceived;\r\n            this.privConversationRecognizer.lockRoomCommandReceived = this.onLockRoomCommandReceived;\r\n            this.privConversationRecognizer.muteAllCommandReceived = this.onMuteAllCommandReceived;\r\n            this.privConversationRecognizer.participantJoinCommandReceived = this.onParticipantJoinCommandReceived;\r\n            this.privConversationRecognizer.participantLeaveCommandReceived = this.onParticipantLeaveCommandReceived;\r\n            this.privConversationRecognizer.translationReceived = this.onTranslationReceived;\r\n            this.privConversationRecognizer.participantsListReceived = this.onParticipantsListReceived;\r\n            this.privConversationRecognizer.conversationExpiration = this.onConversationExpiration;\r\n\r\n            this.privConversationRecognizer.connect(this.privRoom.token,\r\n                ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                ((error: any): void => {\r\n                    this.handleError(error, err);\r\n                }));\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Join a meeting as a participant.\r\n     * @param { IParticipant } participant - participant to add\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public addParticipantAsync(participant: IParticipant, cb?: Callback, err?: Callback): void {\r\n        Contracts.throwIfNullOrUndefined(participant, \"Participant\");\r\n        marshalPromiseToCallbacks(this.addParticipantImplAsync(participant), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Join a meeting as a participant.\r\n     * @param meeting\r\n     * @param nickname\r\n     * @param lang\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public joinMeetingAsync(meetingId: string, nickname: string, lang: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            // TODO\r\n            // if (!!this.privConversationRecognizer) {\r\n            //     throw new Error(this.privErrors.permissionDeniedStart);\r\n            // }\r\n            Contracts.throwIfNullOrWhitespace(meetingId, this.privErrors.invalidArgs.replace(\"{arg}\", \"conversationId\"));\r\n            Contracts.throwIfNullOrWhitespace(nickname, this.privErrors.invalidArgs.replace(\"{arg}\", \"nickname\"));\r\n            Contracts.throwIfNullOrWhitespace(lang, this.privErrors.invalidArgs.replace(\"{arg}\", \"language\"));\r\n            // join the conversation\r\n            this.privManager.createOrJoin(this.privProperties, meetingId,\r\n                ((room: IInternalConversation): void => {\r\n                    Contracts.throwIfNullOrUndefined(room, this.privErrors.permissionDeniedConnect);\r\n                    this.privRoom = room;\r\n                    this.privConfig.authorizationToken = room.cognitiveSpeechAuthToken;\r\n                    // join callback\r\n                    if (!!cb) {\r\n                        cb(room.cognitiveSpeechAuthToken);\r\n                    }\r\n                }),\r\n                ((error: any): void => {\r\n                    this.handleError(error, err);\r\n                }));\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Deletes a meeting\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public deleteMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        marshalPromiseToCallbacks(this.deleteMeetingImplAsync(), cb, err);\r\n    }\r\n\r\n    public async deleteMeetingImplAsync(): Promise<void> {\r\n            Contracts.throwIfNullOrUndefined(this.privProperties, this.privErrors.permissionDeniedConnect);\r\n            Contracts.throwIfNullOrWhitespace(this.privRoom.token, this.privErrors.permissionDeniedConnect);\r\n            await this.privManager.leave(this.privProperties, this.privRoom.token);\r\n\r\n            this.dispose();\r\n    }\r\n\r\n    /**\r\n     * Issues a request to close the client websockets\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public endMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        marshalPromiseToCallbacks(this.endMeetingImplAsync(), cb, err);\r\n    }\r\n\r\n    public endMeetingImplAsync(): Promise<void> {\r\n        return this.close(true);\r\n    }\r\n\r\n    /**\r\n     * Issues a request to lock the conversation\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public lockMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"lock\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getLockCommand(true),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to mute the meeting\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public muteAllParticipantsAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privConversationRecognizer, this.privErrors.permissionDeniedSend);\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            // check the user's permissions\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"mute\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteAllCommand(true),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to mute a participant in the meeting\r\n     * @param userId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public muteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(userId, this.privErrors.invalidArgs.replace(\"{arg}\", \"userId\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            // check the connection is open (host + participant can perform the mute command)\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            // if not host, check the participant is not muting another participant\r\n            if (!this.me.isHost && this.me.id !== userId) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace(\"{command}\", \"mute\")), err);\r\n            }\r\n            // check the user exists\r\n            const exists: number = this.privParticipants.getParticipantIndex(userId);\r\n            if (exists === -1) {\r\n                this.handleError(new Error(this.privErrors.invalidParticipantRequest), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteCommand(userId, true), ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to remove a participant from the conversation\r\n     * @param userId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public removeParticipantAsync(userId: string | IParticipant | IUser, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            if (!!this.privTranscriberRecognizer && userId.hasOwnProperty(\"id\")) {\r\n                // Assume this is a transcription participant\r\n                marshalPromiseToCallbacks(this.removeParticipantImplAsync(userId as IParticipant), cb, err);\r\n            } else {\r\n                Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n                Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n                if (!this.canSendAsHost) {\r\n                    this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace(\"{command}\", \"remove\")), err);\r\n                }\r\n                let participantId = \"\";\r\n                if (typeof userId === \"string\") {\r\n                    participantId = userId;\r\n                } else if (userId.hasOwnProperty(\"id\")) {\r\n                    const participant: IParticipant = userId as IParticipant;\r\n                    participantId = participant.id;\r\n                } else if (userId.hasOwnProperty(\"userId\")) {\r\n                    const user: IUser = userId as IUser;\r\n                    participantId = user.userId;\r\n                }\r\n                Contracts.throwIfNullOrWhitespace(participantId, this.privErrors.invalidArgs.replace(\"{arg}\", \"userId\"));\r\n                // check the participant exists\r\n                const index: number = this.participants.findIndex((p: Participant): boolean => p.id === participantId);\r\n                if (index === -1) {\r\n                    this.handleError(new Error(this.privErrors.invalidParticipantRequest), err);\r\n                }\r\n                if (!!this.privConversationRecognizer) {\r\n                    this.privConversationRecognizer.sendRequest(this.getEjectCommand(participantId), ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                        ((error: any): void => {\r\n                            this.handleError(error, err);\r\n                        }));\r\n                }\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to unlock the meeting\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public unlockMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"unlock\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getLockCommand(false), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n                }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to unmute all participants in the meeting\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public unmuteAllParticipantsAsync(cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSendAsHost) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedConversation.replace(\"{command}\", \"unmute all\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteAllCommand(false), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Issues a request to unmute a participant in the meeting\r\n     * @param userId\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public unmuteParticipantAsync(userId: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(userId, this.privErrors.invalidArgs.replace(\"{arg}\", \"userId\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            // check the connection is open (host + participant can perform the mute command)\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            // if not host, check the participant is not muting another participant\r\n            if (!this.me.isHost && this.me.id !== userId) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedParticipant.replace(\"{command}\", \"mute\")), err);\r\n            }\r\n            // check the user exists\r\n            const exists: number = this.privParticipants.getParticipantIndex(userId);\r\n            if (exists === -1) {\r\n                this.handleError(new Error(this.privErrors.invalidParticipantRequest), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMuteCommand(userId, false), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Send a text message\r\n     * @param message\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public sendTextMessageAsync(message: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(message, this.privErrors.invalidArgs.replace(\"{arg}\", \"message\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            // TODO: is a max length check required?\r\n            if (message.length > this.privTextMessageMaxLength) {\r\n                this.handleError(new Error(this.privErrors.invalidArgs.replace(\"{arg}\", \"message length\")), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getMessageCommand(message), ((): void => {\r\n                    this.handleCallback(cb, err);\r\n                }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Set translated to languages\r\n     * @param {string[]} languages - languages to translate to\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public setTranslatedLanguagesAsync(languages: string[], cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfArrayEmptyOrWhitespace(languages, this.privErrors.invalidArgs.replace(\"{arg}\", \"languages\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getSetTranslateToLanguagesCommand(languages),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Change nickname\r\n     * @param {string} nickname - new nickname for the room\r\n     * @param cb\r\n     * @param err\r\n     */\r\n    public changeNicknameAsync(nickname: string, cb?: Callback, err?: Callback): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfDisposed(this.privConversationRecognizer.isDisposed());\r\n            Contracts.throwIfNullOrWhitespace(nickname, this.privErrors.invalidArgs.replace(\"{arg}\", \"nickname\"));\r\n            Contracts.throwIfNullOrUndefined(this.privRoom, this.privErrors.permissionDeniedSend);\r\n            if (!this.canSend) {\r\n                this.handleError(new Error(this.privErrors.permissionDeniedSend), err);\r\n            }\r\n            if (!!this.privConversationRecognizer) {\r\n                this.privConversationRecognizer.sendRequest(this.getChangeNicknameCommand(nickname),\r\n                    ((): void => {\r\n                        this.handleCallback(cb, err);\r\n                    }),\r\n                    ((error: any): void => {\r\n                        this.handleError(error, err);\r\n                    }));\r\n            }\r\n        } catch (error) {\r\n            this.handleError(error, err);\r\n        }\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public dispose(): void {\r\n        if (this.isDisposed) {\r\n            return;\r\n        }\r\n        this.privIsDisposed = true;\r\n        if (!!this.config) {\r\n            this.config.close();\r\n        }\r\n        this.privConfig = undefined;\r\n        this.privLanguage = undefined;\r\n        this.privProperties = undefined;\r\n        this.privRoom = undefined;\r\n        this.privToken = undefined;\r\n        this.privManager = undefined;\r\n        this.privIsConnected = false;\r\n        this.privIsReady = false;\r\n        this.privParticipants = undefined;\r\n    }\r\n\r\n    public async connectTranscriberRecognizer(recognizer: TranscriberRecognizer): Promise<void> {\r\n        if (!!this.privTranscriberRecognizer) {\r\n            await this.privTranscriberRecognizer.close();\r\n        }\r\n        await recognizer.enforceAudioGating();\r\n        this.privTranscriberRecognizer = recognizer;\r\n        this.privTranscriberRecognizer.meeting = this;\r\n    }\r\n\r\n    public getKeepAlive(): string {\r\n        const nickname: string = (!!this.me) ? this.me.displayName : \"default_nickname\";\r\n        return JSON.stringify({\r\n            id: \"0\",\r\n            nickname,\r\n            participantId: this.privRoom.participantId,\r\n            roomId: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.keepAlive\r\n        });\r\n    }\r\n\r\n    /** websocket callbacks */\r\n    /* eslint-disable @typescript-eslint/typedef */\r\n    private onConnected = (e: ConnectionEventArgs): void => {\r\n        this.privIsConnected = true;\r\n        try {\r\n            if (!!this.privConversationTranslator?.sessionStarted) {\r\n                this.privConversationTranslator.sessionStarted(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onDisconnected = (e: ConnectionEventArgs): void => {\r\n        try {\r\n            if (!!this.privConversationTranslator?.sessionStopped) {\r\n                this.privConversationTranslator.sessionStopped(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        } finally {\r\n            void this.close(false);\r\n        }\r\n    };\r\n\r\n    private onCanceled = (r: ConversationRecognizer, e: ConversationTranslationCanceledEventArgs): void => {\r\n        try {\r\n            if (!!this.privConversationTranslator?.canceled) {\r\n                this.privConversationTranslator.canceled(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantUpdateCommandReceived = (r: ConversationRecognizer, e: ParticipantAttributeEventArgs): void => {\r\n        try {\r\n            const updatedParticipant: IInternalParticipant = this.privParticipants.getParticipant(e.id);\r\n            if (updatedParticipant !== undefined) {\r\n\r\n                switch (e.key) {\r\n                    case ConversationTranslatorCommandTypes.changeNickname:\r\n                        updatedParticipant.displayName = e.value as string;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setUseTTS:\r\n                        updatedParticipant.isUsingTts = e.value as boolean;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setProfanityFiltering:\r\n                        updatedParticipant.profanity = e.value as boolean;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setMute:\r\n                        updatedParticipant.isMuted = e.value as boolean;\r\n                        break;\r\n                    case ConversationTranslatorCommandTypes.setTranslateToLanguages:\r\n                        updatedParticipant.translateToLanguages = e.value as string[];\r\n                        break;\r\n                }\r\n                this.privParticipants.addOrUpdateParticipant(updatedParticipant);\r\n\r\n                if (!!this.privConversationTranslator) {\r\n                    this.privConversationTranslator.participantsChanged(\r\n                        this.privConversationTranslator,\r\n                        new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.Updated,\r\n                            [this.toParticipant(updatedParticipant)], e.sessionId));\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onLockRoomCommandReceived = (): void => {\r\n        // TODO\r\n    };\r\n\r\n    private onMuteAllCommandReceived = (r: ConversationRecognizer, e: MuteAllEventArgs): void => {\r\n        try {\r\n            this.privParticipants.participants.forEach((p: IInternalParticipant): boolean => p.isMuted = (p.isHost ? false : e.isMuted));\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.participantsChanged(\r\n                    this.privConversationTranslator,\r\n                    new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.Updated,\r\n                        this.toParticipants(false), e.sessionId));\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantJoinCommandReceived = (r: ConversationRecognizer, e: ParticipantEventArgs): void => {\r\n        try {\r\n            const newParticipant: IInternalParticipant = this.privParticipants.addOrUpdateParticipant(e.participant);\r\n            if (newParticipant !== undefined) {\r\n                if (!!this.privConversationTranslator) {\r\n                    this.privConversationTranslator.participantsChanged(\r\n                        this.privConversationTranslator,\r\n                        new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.JoinedConversation,\r\n                            [this.toParticipant(newParticipant)], e.sessionId));\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantLeaveCommandReceived = (r: ConversationRecognizer, e: ParticipantEventArgs): void => {\r\n        try {\r\n            const ejectedParticipant: IInternalParticipant = this.privParticipants.getParticipant(e.participant.id);\r\n            if (ejectedParticipant !== undefined) {\r\n                // remove the participant from the internal participants list\r\n                this.privParticipants.deleteParticipant(e.participant.id);\r\n                if (!!this.privConversationTranslator) {\r\n                    // notify subscribers that the participant has left the conversation\r\n                    this.privConversationTranslator.participantsChanged(\r\n                        this.privConversationTranslator,\r\n                        new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.LeftConversation,\r\n                            [this.toParticipant(ejectedParticipant)], e.sessionId));\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onTranslationReceived = (r: ConversationRecognizer, e: ConversationReceivedTranslationEventArgs): void => {\r\n        try {\r\n            switch (e.command) {\r\n                case ConversationTranslatorMessageTypes.final:\r\n                    if (!!this.privConversationTranslator) {\r\n                        this.privConversationTranslator.transcribed(\r\n                            this.privConversationTranslator,\r\n                            new ConversationTranslationEventArgs(e.payload, undefined, e.sessionId));\r\n                    }\r\n                    break;\r\n                case ConversationTranslatorMessageTypes.partial:\r\n                    if (!!this.privConversationTranslator) {\r\n                        this.privConversationTranslator.transcribing(\r\n                            this.privConversationTranslator,\r\n                            new ConversationTranslationEventArgs(e.payload, undefined, e.sessionId));\r\n                    }\r\n                    break;\r\n                case ConversationTranslatorMessageTypes.instantMessage:\r\n                    if (!!this.privConversationTranslator) {\r\n                        this.privConversationTranslator.textMessageReceived(\r\n                            this.privConversationTranslator,\r\n                            new ConversationTranslationEventArgs(e.payload, undefined, e.sessionId));\r\n                    }\r\n                    break;\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onParticipantsListReceived = (r: ConversationRecognizer, e: ParticipantsListEventArgs): void => {\r\n        try {\r\n            // check if the session token needs to be updated\r\n            if (e.sessionToken !== undefined && e.sessionToken !== null) {\r\n                this.privRoom.token = e.sessionToken;\r\n            }\r\n            // save the participants\r\n            this.privParticipants.participants = [...e.participants];\r\n            // enable the conversation\r\n            if (this.privParticipants.me !== undefined) {\r\n                this.privIsReady = true;\r\n            }\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.participantsChanged(\r\n                    this.privConversationTranslator,\r\n                    new ConversationParticipantsChangedEventArgs(ParticipantChangedReason.JoinedConversation, this.toParticipants(true), e.sessionId));\r\n            }\r\n            // if this is the host, update the nickname if needed\r\n            if (this.me.isHost) {\r\n                const nickname: string = this.privConversationTranslator?.properties.getProperty(PropertyId.ConversationTranslator_Name);\r\n                if (nickname !== undefined && nickname.length > 0 && nickname !== this.me.displayName) {\r\n                    // issue a change nickname request\r\n                    this.changeNicknameAsync(nickname);\r\n                }\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n\r\n    private onConversationExpiration = (r: ConversationRecognizer, e: ConversationExpirationEventArgs): void => {\r\n        try {\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.conversationExpiration(this.privConversationTranslator, e);\r\n            }\r\n        } catch (e) {\r\n            //\r\n        }\r\n    };\r\n    /* eslint-enable @typescript-eslint/typedef */\r\n\r\n    private addParticipantImplAsync(participant: IParticipant): Promise<void> {\r\n        const newParticipant: IInternalParticipant = this.privParticipants.addOrUpdateParticipant(participant);\r\n        if (newParticipant !== undefined) {\r\n            if (!!this.privTranscriberRecognizer) {\r\n                const meetingInfo = this.meetingInfo;\r\n                meetingInfo.participants = [participant];\r\n                return this.privTranscriberRecognizer.pushMeetingEvent(meetingInfo, \"join\");\r\n            }\r\n        }\r\n    }\r\n\r\n    private removeParticipantImplAsync(participant: IParticipant): Promise<void> {\r\n        this.privParticipants.deleteParticipant(participant.id);\r\n        const meetingInfo = this.meetingInfo;\r\n        meetingInfo.participants = [participant];\r\n        return this.privTranscriberRecognizer.pushMeetingEvent(meetingInfo, \"leave\");\r\n    }\r\n\r\n    private async close(dispose: boolean): Promise<void> {\r\n        try {\r\n            this.privIsConnected = false;\r\n            await this.privConversationRecognizer?.close();\r\n            this.privConversationRecognizer = undefined;\r\n            if (!!this.privConversationTranslator) {\r\n                this.privConversationTranslator.dispose();\r\n            }\r\n        } catch (e) {\r\n            // ignore error\r\n            throw e;\r\n        }\r\n        if (dispose) {\r\n            this.dispose();\r\n        }\r\n    }\r\n\r\n    /** Helpers */\r\n    private handleCallback(cb: () => void, err: (message: string) => void): void {\r\n        if (!!cb) {\r\n            try {\r\n                cb();\r\n            } catch (e) {\r\n                if (!!err) {\r\n                    err(e as string);\r\n                }\r\n            }\r\n            cb = undefined;\r\n        }\r\n    }\r\n\r\n    private handleError(error: any, err: (message: string) => void): void {\r\n        if (!!err) {\r\n            if (error instanceof Error) {\r\n                const typedError: Error = error;\r\n                err(typedError.name + \": \" + typedError.message);\r\n\r\n            } else {\r\n                err(error as string);\r\n            }\r\n        }\r\n    }\r\n\r\n    /** Participant Helpers */\r\n    private toParticipants(includeHost: boolean): Participant[] {\r\n\r\n        const participants: Participant[] = this.privParticipants.participants.map((p: IInternalParticipant): Participant => ( this.toParticipant(p) ) );\r\n        if (!includeHost) {\r\n            return participants.filter((p: Participant): boolean => p.isHost === false);\r\n        } else {\r\n            return participants;\r\n        }\r\n    }\r\n\r\n    private toParticipant(p: IInternalParticipant): Participant {\r\n        return new Participant(p.id, p.avatar, p.displayName, p.isHost, p.isMuted, p.isUsingTts, p.preferredLanguage, p.voice);\r\n    }\r\n\r\n    private getMuteAllCommand(isMuted: boolean): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"meetingd\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setMuteAll,\r\n            participantId: this.privRoom.participantId, // the id of the host\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: isMuted\r\n        });\r\n    }\r\n\r\n    private getMuteCommand(participantId: string, isMuted: boolean): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"conversationId\");\r\n        Contracts.throwIfNullOrWhitespace(participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setMute,\r\n            // eslint-disable-next-line object-shorthand\r\n            participantId: participantId,\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: isMuted\r\n        });\r\n    }\r\n\r\n    private getLockCommand(isLocked: boolean): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"meetingId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setLockState,\r\n            participantId: this.privRoom.participantId,\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: isLocked\r\n        });\r\n    }\r\n\r\n    private getEjectCommand(participantId: string): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"meetingId\");\r\n        Contracts.throwIfNullOrWhitespace(participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.ejectParticipant,\r\n            // eslint-disable-next-line object-shorthand\r\n            participantId: participantId,\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n        });\r\n    }\r\n\r\n    private getSetTranslateToLanguagesCommand(languages: string[]): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"meetingId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.setTranslateToLanguages,\r\n            participantId: this.privRoom.participantId, // the id of the host\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: languages\r\n        });\r\n    }\r\n\r\n    private getChangeNicknameCommand(nickname: string): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"meetingId\");\r\n        Contracts.throwIfNullOrWhitespace(nickname, \"nickname\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n\r\n        return JSON.stringify({\r\n            command: ConversationTranslatorCommandTypes.changeNickname,\r\n            nickname,\r\n            participantId: this.privRoom.participantId, // the id of the host\r\n            roomid: this.privRoom.roomId,\r\n            type: ConversationTranslatorMessageTypes.participantCommand,\r\n            value: nickname\r\n        });\r\n    }\r\n\r\n    private getMessageCommand(message: string): string {\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.roomId, \"meetingId\");\r\n        Contracts.throwIfNullOrWhitespace(this.privRoom.participantId, \"participantId\");\r\n        Contracts.throwIfNullOrWhitespace(message, \"message\");\r\n\r\n        return JSON.stringify({\r\n            participantId: this.privRoom.participantId,\r\n            roomId: this.privRoom.roomId,\r\n            text: message,\r\n            type: ConversationTranslatorMessageTypes.instantMessage\r\n        });\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// Multi-device Conversation is a Preview feature.\r\n\r\nimport { CancellationEventArgsBase } from \"../CancellationEventArgsBase.js\";\r\n\r\nexport class MeetingTranscriptionCanceledEventArgs extends CancellationEventArgsBase {\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { TranscriberRecognizer } from \"../../common.speech/Exports.js\";\r\nimport { marshalPromiseToCallbacks } from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    CancellationEventArgs,\r\n    Connection,\r\n    MeetingTranscriptionEventArgs,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    SessionEventArgs\r\n} from \"../Exports.js\";\r\nimport {\r\n    MeetingHandler,\r\n    MeetingImpl,\r\n    MeetingTranscriptionHandler\r\n} from \"./Exports.js\";\r\nimport { Callback, IMeeting } from \"./IMeeting.js\";\r\n\r\nexport class MeetingTranscriber implements MeetingTranscriptionHandler {\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during the meeting.\r\n     * @member MeetingTranscriber.prototype.MeetingCanceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public MeetingCanceled: (sender: MeetingHandler, event: CancellationEventArgs) => void;\r\n\r\n    /**\r\n     * The event canceled signals that an error occurred during transcription.\r\n     * @member MeetingTranscriber.prototype.canceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public canceled: (sender: MeetingHandler, event: CancellationEventArgs) => void;\r\n\r\n     /**\r\n      * The event recognized signals that a final meeting transcription result is received.\r\n      * @member MeetingTranscriber.prototype.transcribed\r\n      * @function\r\n      * @public\r\n      */\r\n    public transcribed: (sender: MeetingTranscriptionHandler, event: MeetingTranscriptionEventArgs) => void;\r\n\r\n     /**\r\n      * The event recognizing signals that an intermediate meeting transcription result is received.\r\n      * @member MeetingTranscriber.prototype.transcribing\r\n      * @function\r\n      * @public\r\n      */\r\n    public transcribing: (sender: MeetingTranscriptionHandler, event: MeetingTranscriptionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for session started events.\r\n     * @member MeetingTranscriber.prototype.sessionStarted\r\n     * @function\r\n     * @public\r\n     */\r\n    public sessionStarted: (sender: MeetingHandler, event: SessionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for session stopped events.\r\n     * @member MeetingTranscriber.prototype.sessionStopped\r\n     * @function\r\n     * @public\r\n     */\r\n    public sessionStopped: (sender: MeetingHandler, event: SessionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for meeting started events.\r\n     * @member MeetingTranscriber.prototype.MeetingStarted\r\n     * @function\r\n     * @public\r\n     */\r\n    public MeetingStarted: (sender: MeetingHandler, event: SessionEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for meeting stopped events.\r\n     * @member MeetingTranscriber.prototype.MeetingStopped\r\n     * @function\r\n     * @public\r\n     */\r\n    public meetingStopped: (sender: MeetingHandler, event: SessionEventArgs) => void;\r\n\r\n    protected privAudioConfig: AudioConfig;\r\n    private privDisposedRecognizer: boolean;\r\n    private privRecognizer: TranscriberRecognizer;\r\n    private privProperties: PropertyCollection;\r\n\r\n    /**\r\n     * MeetingTranscriber constructor.\r\n     * @constructor\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the recognizer\r\n     */\r\n    public constructor(audioConfig?: AudioConfig) {\r\n        this.privAudioConfig = audioConfig;\r\n        this.privProperties = new PropertyCollection();\r\n        this.privRecognizer = undefined;\r\n        this.privDisposedRecognizer = false;\r\n    }\r\n\r\n    /**\r\n     * Gets the spoken language of recognition.\r\n     * @member MeetingTranscriber.prototype.speechRecognitionLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {string} The spoken language of recognition.\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this MeetingTranscriber.\r\n     * @member MeetingTranscriber.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this MeetingTranscriber.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * @Internal\r\n     * Internal data member to support fromRecognizer* pattern methods on other classes.\r\n     * Do not use externally, object returned will change without warning or notice.\r\n     */\r\n    public get internalData(): object {\r\n        return this.privRecognizer.internalData;\r\n    }\r\n\r\n    /**\r\n     * @Deprecated\r\n     * @Obsolete\r\n     * Please use the Connection.fromRecognizer pattern to obtain a connection object\r\n     */\r\n    public get connection(): Connection {\r\n        return Connection.fromRecognizer(this.privRecognizer);\r\n    }\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member MeetingTranscriber.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * @member MeetingTranscriber.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} token - Authorization token.\r\n     */\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    /**\r\n     * @param {Meeting} meeting - meeting to be recognized\r\n     */\r\n    public joinMeetingAsync(meeting: IMeeting, cb?: Callback, err?: Callback): void {\r\n        /* eslint-disable no-console */\r\n        // console.log(\">> MeetingTranscriber::joinMeetingAsync\");\r\n        /* eslint-enable no-console */\r\n        const meetingImpl = meeting as MeetingImpl;\r\n        Contracts.throwIfNullOrUndefined(MeetingImpl, \"Meeting\");\r\n\r\n        // ref the meeting object\r\n        // create recognizer and subscribe to recognizer events\r\n        this.privRecognizer = new TranscriberRecognizer(meeting.config, this.privAudioConfig);\r\n        Contracts.throwIfNullOrUndefined(this.privRecognizer, \"Recognizer\");\r\n        this.privRecognizer.connectMeetingCallbacks(this);\r\n\r\n        marshalPromiseToCallbacks(meetingImpl.connectTranscriberRecognizer(this.privRecognizer), cb, err);\r\n    }\r\n\r\n    /**\r\n     * Starts meeting transcription, until stopTranscribingAsync() is called.\r\n     * User must subscribe to events to receive transcription results.\r\n     * @member MeetingTranscriber.prototype.startTranscribingAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the transcription has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public startTranscribingAsync(cb?: Callback, err?: Callback): void {\r\n        this.privRecognizer.startContinuousRecognitionAsync(cb, err);\r\n    }\r\n\r\n    /**\r\n     * Starts meeting transcription, until stopTranscribingAsync() is called.\r\n     * User must subscribe to events to receive transcription results.\r\n     * @member MeetingTranscriber.prototype.stopTranscribingAsync\r\n     * @function\r\n     * @public\r\n     * @param cb - Callback invoked once the transcription has started.\r\n     * @param err - Callback invoked in case of an error.\r\n     */\r\n    public stopTranscribingAsync(cb?: Callback, err?: Callback): void {\r\n        this.privRecognizer.stopContinuousRecognitionAsync(cb, err);\r\n    }\r\n\r\n    /**\r\n     * Leave the current meeting. After this is called, you will no longer receive any events.\r\n     */\r\n    public leaveMeetingAsync(cb?: Callback, err?: Callback): void {\r\n        this.privRecognizer.disconnectCallbacks();\r\n        // eslint-disable-next-line\r\n        marshalPromiseToCallbacks((async (): Promise<void> => { return; })(), cb, err);\r\n    }\r\n\r\n    /**\r\n     * closes all external resources held by an instance of this class.\r\n     * @member MeetingTranscriber.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, errorCb?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, errorCb);\r\n    }\r\n\r\n    /**\r\n     * Disposes any resources held by the object.\r\n     * @member MeetingTranscriber.prototype.dispose\r\n     * @function\r\n     * @public\r\n     * @param {boolean} disposing - true if disposing the object.\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedRecognizer) {\r\n            return;\r\n        }\r\n        if (!!this.privRecognizer) {\r\n            await this.privRecognizer.close();\r\n            this.privRecognizer = undefined;\r\n        }\r\n        if (disposing) {\r\n            this.privDisposedRecognizer = true;\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, RecognitionResult, ResultReason } from \"../Exports.js\";\r\n\r\n/**\r\n * Defines result of conversation transcription.\r\n * @class ConversationTranscriptionResult\r\n */\r\nexport class ConversationTranscriptionResult extends RecognitionResult {\r\n    private readonly privSpeakerId: string;\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @public\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {string} text - The recognized text.\r\n     * @param {number} duration - The duration.\r\n     * @param {number} offset - The offset into the stream.\r\n     * @param {string} language - Primary Language detected, if provided.\r\n     * @param {string} languageDetectionConfidence - Primary Language confidence (\"Unknown,\" \"Low,\" \"Medium,\" \"High\"...), if provided.\r\n     * @param {string} speakerId - speaker id for conversation transcription.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {string} json - Additional Json, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     */\r\n    public constructor(resultId?: string, reason?: ResultReason, text?: string,\r\n                       duration?: number, offset?: number, language?: string,\r\n                       languageDetectionConfidence?: string, speakerId?: string, errorDetails?: string,\r\n                       json?: string, properties?: PropertyCollection) {\r\n        super(resultId, reason, text, duration, offset, language, languageDetectionConfidence, errorDetails, json, properties);\r\n        this.privSpeakerId = speakerId;\r\n    }\r\n\r\n    /**\r\n     * speaker id\r\n     * @member ConversationTranscriptionResult.prototype.speakerId\r\n     * @function\r\n     * @public\r\n     * @returns {string} id of speaker in given result\r\n     */\r\n    public get speakerId(): string {\r\n        return this.privSpeakerId;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    AutoDetectSourceLanguagesOpenRangeOptionName,\r\n    CognitiveSubscriptionKeyAuthentication,\r\n    CognitiveTokenAuthentication,\r\n    Context,\r\n    IAuthentication,\r\n    ISynthesisConnectionFactory,\r\n    OS,\r\n    SpeechServiceConfig,\r\n    SynthesisAdapterBase,\r\n    SynthesisRestAdapter,\r\n    SynthesizerConfig } from \"../common.speech/Exports.js\";\r\nimport { IAudioDestination, IStringDictionary, Queue } from \"../common/Exports.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { PropertyCollection, PropertyId, SpeechConfig, SpeechConfigImpl, SpeechSynthesisResult } from \"./Exports.js\";\r\n\r\nexport abstract class Synthesizer {\r\n    protected privAdapter: SynthesisAdapterBase;\r\n    protected privRestAdapter: SynthesisRestAdapter;\r\n    protected privProperties: PropertyCollection;\r\n    protected privConnectionFactory: ISynthesisConnectionFactory;\r\n    protected privDisposed: boolean;\r\n    protected privSynthesizing: boolean;\r\n    protected synthesisRequestQueue: Queue<SynthesisRequest>;\r\n\r\n    /**\r\n     * Gets the authorization token used to communicate with the service.\r\n     * @member Synthesizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @returns {string} Authorization token.\r\n     */\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the authorization token used to communicate with the service.\r\n     * @member Synthesizer.prototype.authorizationToken\r\n     * @function\r\n     * @public\r\n     * @param {string} token - Authorization token.\r\n     */\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    /**\r\n     * The collection of properties and their values defined for this Synthesizer.\r\n     * @member Synthesizer.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The collection of properties and their values defined for this SpeechSynthesizer.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    /**\r\n     * Indicates if auto detect source language is enabled\r\n     * @member Synthesizer.prototype.autoDetectSourceLanguage\r\n     * @function\r\n     * @public\r\n     * @returns {boolean} if auto detect source language is enabled\r\n     */\r\n    public get autoDetectSourceLanguage(): boolean {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages) === AutoDetectSourceLanguagesOpenRangeOptionName;\r\n    }\r\n\r\n    /**\r\n     * Creates and initializes an instance of a Recognizer\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - The speech config to initialize the synthesizer.\r\n     */\r\n    protected constructor(speechConfig: SpeechConfig) {\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        Contracts.throwIfNull(speechConfigImpl, \"speechConfig\");\r\n\r\n        this.privProperties = speechConfigImpl.properties.clone();\r\n        this.privDisposed = false;\r\n        this.privSynthesizing = false;\r\n        this.synthesisRequestQueue = new Queue<SynthesisRequest>();\r\n    }\r\n\r\n    public buildSsml(text: string): string {\r\n        const languageToDefaultVoice: IStringDictionary<string>  = {\r\n            [\"af-ZA\"]: \"af-ZA-AdriNeural\",\r\n            [\"am-ET\"]: \"am-ET-AmehaNeural\",\r\n            [\"ar-AE\"]: \"ar-AE-FatimaNeural\",\r\n            [\"ar-BH\"]: \"ar-BH-AliNeural\",\r\n            [\"ar-DZ\"]: \"ar-DZ-AminaNeural\",\r\n            [\"ar-EG\"]: \"ar-EG-SalmaNeural\",\r\n            [\"ar-IQ\"]: \"ar-IQ-BasselNeural\",\r\n            [\"ar-JO\"]: \"ar-JO-SanaNeural\",\r\n            [\"ar-KW\"]: \"ar-KW-FahedNeural\",\r\n            [\"ar-LY\"]: \"ar-LY-ImanNeural\",\r\n            [\"ar-MA\"]: \"ar-MA-JamalNeural\",\r\n            [\"ar-QA\"]: \"ar-QA-AmalNeural\",\r\n            [\"ar-SA\"]: \"ar-SA-HamedNeural\",\r\n            [\"ar-SY\"]: \"ar-SY-AmanyNeural\",\r\n            [\"ar-TN\"]: \"ar-TN-HediNeural\",\r\n            [\"ar-YE\"]: \"ar-YE-MaryamNeural\",\r\n            [\"bg-BG\"]: \"bg-BG-BorislavNeural\",\r\n            [\"bn-BD\"]: \"bn-BD-NabanitaNeural\",\r\n            [\"bn-IN\"]: \"bn-IN-BashkarNeural\",\r\n            [\"ca-ES\"]: \"ca-ES-JoanaNeural\",\r\n            [\"cs-CZ\"]: \"cs-CZ-AntoninNeural\",\r\n            [\"cy-GB\"]: \"cy-GB-AledNeural\",\r\n            [\"da-DK\"]: \"da-DK-ChristelNeural\",\r\n            [\"de-AT\"]: \"de-AT-IngridNeural\",\r\n            [\"de-CH\"]: \"de-CH-JanNeural\",\r\n            [\"de-DE\"]: \"de-DE-KatjaNeural\",\r\n            [\"el-GR\"]: \"el-GR-AthinaNeural\",\r\n            [\"en-AU\"]: \"en-AU-NatashaNeural\",\r\n            [\"en-CA\"]: \"en-CA-ClaraNeural\",\r\n            [\"en-GB\"]: \"en-GB-LibbyNeural\",\r\n            [\"en-HK\"]: \"en-HK-SamNeural\",\r\n            [\"en-IE\"]: \"en-IE-ConnorNeural\",\r\n            [\"en-IN\"]: \"en-IN-NeerjaNeural\",\r\n            [\"en-KE\"]: \"en-KE-AsiliaNeural\",\r\n            [\"en-NG\"]: \"en-NG-AbeoNeural\",\r\n            [\"en-NZ\"]: \"en-NZ-MitchellNeural\",\r\n            [\"en-PH\"]: \"en-PH-JamesNeural\",\r\n            [\"en-SG\"]: \"en-SG-LunaNeural\",\r\n            [\"en-TZ\"]: \"en-TZ-ElimuNeural\",\r\n            [\"en-US\"]: \"en-US-JennyNeural\",\r\n            [\"en-ZA\"]: \"en-ZA-LeahNeural\",\r\n            [\"es-AR\"]: \"es-AR-ElenaNeural\",\r\n            [\"es-BO\"]: \"es-BO-MarceloNeural\",\r\n            [\"es-CL\"]: \"es-CL-CatalinaNeural\",\r\n            [\"es-CO\"]: \"es-CO-GonzaloNeural\",\r\n            [\"es-CR\"]: \"es-CR-JuanNeural\",\r\n            [\"es-CU\"]: \"es-CU-BelkysNeural\",\r\n            [\"es-DO\"]: \"es-DO-EmilioNeural\",\r\n            [\"es-EC\"]: \"es-EC-AndreaNeural\",\r\n            [\"es-ES\"]: \"es-ES-AlvaroNeural\",\r\n            [\"es-GQ\"]: \"es-GQ-JavierNeural\",\r\n            [\"es-GT\"]: \"es-GT-AndresNeural\",\r\n            [\"es-HN\"]: \"es-HN-CarlosNeural\",\r\n            [\"es-MX\"]: \"es-MX-DaliaNeural\",\r\n            [\"es-NI\"]: \"es-NI-FedericoNeural\",\r\n            [\"es-PA\"]: \"es-PA-MargaritaNeural\",\r\n            [\"es-PE\"]: \"es-PE-AlexNeural\",\r\n            [\"es-PR\"]: \"es-PR-KarinaNeural\",\r\n            [\"es-PY\"]: \"es-PY-MarioNeural\",\r\n            [\"es-SV\"]: \"es-SV-LorenaNeural\",\r\n            [\"es-US\"]: \"es-US-AlonsoNeural\",\r\n            [\"es-UY\"]: \"es-UY-MateoNeural\",\r\n            [\"es-VE\"]: \"es-VE-PaolaNeural\",\r\n            [\"et-EE\"]: \"et-EE-AnuNeural\",\r\n            [\"fa-IR\"]: \"fa-IR-DilaraNeural\",\r\n            [\"fi-FI\"]: \"fi-FI-SelmaNeural\",\r\n            [\"fil-PH\"]: \"fil-PH-AngeloNeural\",\r\n            [\"fr-BE\"]: \"fr-BE-CharlineNeural\",\r\n            [\"fr-CA\"]: \"fr-CA-SylvieNeural\",\r\n            [\"fr-CH\"]: \"fr-CH-ArianeNeural\",\r\n            [\"fr-FR\"]: \"fr-FR-DeniseNeural\",\r\n            [\"ga-IE\"]: \"ga-IE-ColmNeural\",\r\n            [\"gl-ES\"]: \"gl-ES-RoiNeural\",\r\n            [\"gu-IN\"]: \"gu-IN-DhwaniNeural\",\r\n            [\"he-IL\"]: \"he-IL-AvriNeural\",\r\n            [\"hi-IN\"]: \"hi-IN-MadhurNeural\",\r\n            [\"hr-HR\"]: \"hr-HR-GabrijelaNeural\",\r\n            [\"hu-HU\"]: \"hu-HU-NoemiNeural\",\r\n            [\"id-ID\"]: \"id-ID-ArdiNeural\",\r\n            [\"is-IS\"]: \"is-IS-GudrunNeural\",\r\n            [\"it-IT\"]: \"it-IT-IsabellaNeural\",\r\n            [\"ja-JP\"]: \"ja-JP-NanamiNeural\",\r\n            [\"jv-ID\"]: \"jv-ID-DimasNeural\",\r\n            [\"kk-KZ\"]: \"kk-KZ-AigulNeural\",\r\n            [\"km-KH\"]: \"km-KH-PisethNeural\",\r\n            [\"kn-IN\"]: \"kn-IN-GaganNeural\",\r\n            [\"ko-KR\"]: \"ko-KR-SunHiNeural\",\r\n            [\"lo-LA\"]: \"lo-LA-ChanthavongNeural\",\r\n            [\"lt-LT\"]: \"lt-LT-LeonasNeural\",\r\n            [\"lv-LV\"]: \"lv-LV-EveritaNeural\",\r\n            [\"mk-MK\"]: \"mk-MK-AleksandarNeural\",\r\n            [\"ml-IN\"]: \"ml-IN-MidhunNeural\",\r\n            [\"mr-IN\"]: \"mr-IN-AarohiNeural\",\r\n            [\"ms-MY\"]: \"ms-MY-OsmanNeural\",\r\n            [\"mt-MT\"]: \"mt-MT-GraceNeural\",\r\n            [\"my-MM\"]: \"my-MM-NilarNeural\",\r\n            [\"nb-NO\"]: \"nb-NO-PernilleNeural\",\r\n            [\"nl-BE\"]: \"nl-BE-ArnaudNeural\",\r\n            [\"nl-NL\"]: \"nl-NL-ColetteNeural\",\r\n            [\"pl-PL\"]: \"pl-PL-AgnieszkaNeural\",\r\n            [\"ps-AF\"]: \"ps-AF-GulNawazNeural\",\r\n            [\"pt-BR\"]: \"pt-BR-FranciscaNeural\",\r\n            [\"pt-PT\"]: \"pt-PT-DuarteNeural\",\r\n            [\"ro-RO\"]: \"ro-RO-AlinaNeural\",\r\n            [\"ru-RU\"]: \"ru-RU-SvetlanaNeural\",\r\n            [\"si-LK\"]: \"si-LK-SameeraNeural\",\r\n            [\"sk-SK\"]: \"sk-SK-LukasNeural\",\r\n            [\"sl-SI\"]: \"sl-SI-PetraNeural\",\r\n            [\"so-SO\"]: \"so-SO-MuuseNeural\",\r\n            [\"sr-RS\"]: \"sr-RS-NicholasNeural\",\r\n            [\"su-ID\"]: \"su-ID-JajangNeural\",\r\n            [\"sv-SE\"]: \"sv-SE-SofieNeural\",\r\n            [\"sw-KE\"]: \"sw-KE-RafikiNeural\",\r\n            [\"sw-TZ\"]: \"sw-TZ-DaudiNeural\",\r\n            [\"ta-IN\"]: \"ta-IN-PallaviNeural\",\r\n            [\"ta-LK\"]: \"ta-LK-KumarNeural\",\r\n            [\"ta-SG\"]: \"ta-SG-AnbuNeural\",\r\n            [\"te-IN\"]: \"te-IN-MohanNeural\",\r\n            [\"th-TH\"]: \"th-TH-PremwadeeNeural\",\r\n            [\"tr-TR\"]: \"tr-TR-AhmetNeural\",\r\n            [\"uk-UA\"]: \"uk-UA-OstapNeural\",\r\n            [\"ur-IN\"]: \"ur-IN-GulNeural\",\r\n            [\"ur-PK\"]: \"ur-PK-AsadNeural\",\r\n            [\"uz-UZ\"]: \"uz-UZ-MadinaNeural\",\r\n            [\"vi-VN\"]: \"vi-VN-HoaiMyNeural\",\r\n            [\"zh-CN\"]: \"zh-CN-XiaoxiaoNeural\",\r\n            [\"zh-HK\"]: \"zh-HK-HiuMaanNeural\",\r\n            [\"zh-TW\"]: \"zh-TW-HsiaoChenNeural\",\r\n            [\"zu-ZA\"]: \"zu-ZA-ThandoNeural\",\r\n        };\r\n\r\n        let language = this.properties.getProperty(PropertyId.SpeechServiceConnection_SynthLanguage, \"en-US\");\r\n        let voice = this.properties.getProperty(PropertyId.SpeechServiceConnection_SynthVoice, \"\");\r\n        let ssml: string = Synthesizer.XMLEncode(text);\r\n        if (this.autoDetectSourceLanguage) {\r\n            language = \"en-US\";\r\n        } else {\r\n            voice = voice || languageToDefaultVoice[language];\r\n        }\r\n        if (voice) {\r\n            ssml = `<voice name='${voice}'>${ssml}</voice>`;\r\n        }\r\n        ssml = `<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xmlns:mstts='http://www.w3.org/2001/mstts' xmlns:emo='http://www.w3.org/2009/10/emotionml' xml:lang='${language}'>${ssml}</speak>`;\r\n        return ssml;\r\n    }\r\n\r\n    /**\r\n     * This method performs cleanup of resources.\r\n     * The Boolean parameter disposing indicates whether the method is called\r\n     * from Dispose (if disposing is true) or from the finalizer (if disposing is false).\r\n     * Derived classes should override this method to dispose resource if needed.\r\n     * @member Synthesizer.prototype.dispose\r\n     * @function\r\n     * @public\r\n     * @param {boolean} disposing - Flag to request disposal.\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposed) {\r\n            return;\r\n        }\r\n\r\n        if (disposing) {\r\n            if (this.privAdapter) {\r\n                await this.privAdapter.dispose();\r\n            }\r\n        }\r\n\r\n        this.privDisposed = true;\r\n    }\r\n\r\n    protected async adapterSpeak(): Promise<void> {\r\n        if (!this.privDisposed && !this.privSynthesizing) {\r\n            this.privSynthesizing = true;\r\n            const request: SynthesisRequest = await this.synthesisRequestQueue.dequeue();\r\n            return this.privAdapter.Speak(request.text, request.isSSML, request.requestId, request.cb, request.err, request.dataStream);\r\n        }\r\n    }\r\n\r\n    //\r\n    // ################################################################################################################\r\n    // IMPLEMENTATION.\r\n    // Move to independent class\r\n    // ################################################################################################################\r\n    //\r\n\r\n    // Creates the synthesis adapter\r\n    protected abstract createSynthesisAdapter(\r\n        authentication: IAuthentication,\r\n        connectionFactory: ISynthesisConnectionFactory,\r\n        synthesizerConfig: SynthesizerConfig): SynthesisAdapterBase;\r\n\r\n    // Creates the REST synthesis adapter\r\n    protected abstract createRestSynthesisAdapter(\r\n        authentication: IAuthentication,\r\n        synthesizerConfig: SynthesizerConfig): SynthesisRestAdapter;\r\n\r\n    protected createSynthesizerConfig(speechConfig: SpeechServiceConfig): SynthesizerConfig {\r\n        return new SynthesizerConfig(\r\n            speechConfig,\r\n            this.privProperties);\r\n    }\r\n\r\n    // Does the generic synthesizer setup that is common across all synthesizer types.\r\n    protected implCommonSynthesizeSetup(): void {\r\n\r\n        let osPlatform = (typeof window !== \"undefined\") ? \"Browser\" : \"Node\";\r\n        let osName = \"unknown\";\r\n        let osVersion = \"unknown\";\r\n\r\n        if (typeof navigator !== \"undefined\") {\r\n            osPlatform = osPlatform + \"/\" + navigator.platform;\r\n            osName = navigator.userAgent;\r\n            osVersion = navigator.appVersion;\r\n        }\r\n\r\n        const synthesizerConfig: SynthesizerConfig = this.createSynthesizerConfig(\r\n            new SpeechServiceConfig(\r\n                new Context(new OS(osPlatform, osName, osVersion))));\r\n\r\n        const subscriptionKey = this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Key, undefined);\r\n        const authentication = (subscriptionKey && subscriptionKey !== \"\") ?\r\n            new CognitiveSubscriptionKeyAuthentication(subscriptionKey) :\r\n            new CognitiveTokenAuthentication(\r\n                (): Promise<string> => {\r\n                    const authorizationToken = this.privProperties.getProperty(PropertyId.SpeechServiceAuthorization_Token, undefined);\r\n                    return Promise.resolve(authorizationToken);\r\n                },\r\n                (): Promise<string> => {\r\n                    const authorizationToken = this.privProperties.getProperty(PropertyId.SpeechServiceAuthorization_Token, undefined);\r\n                    return Promise.resolve(authorizationToken);\r\n                });\r\n\r\n        this.privAdapter = this.createSynthesisAdapter(\r\n            authentication,\r\n            this.privConnectionFactory,\r\n            synthesizerConfig);\r\n\r\n        this.privRestAdapter = this.createRestSynthesisAdapter(\r\n            authentication,\r\n            synthesizerConfig);\r\n    }\r\n\r\n    protected static XMLEncode(text: string): string {\r\n        return text.replace(/&/g, \"&amp;\")\r\n            .replace(/</g, \"&lt;\")\r\n            .replace(/>/g, \"&gt;\")\r\n            .replace(/\"/g, \"&quot;\")\r\n            .replace(/'/g, \"&apos;\");\r\n    }\r\n}\r\n\r\nexport class SynthesisRequest {\r\n    public requestId: string;\r\n    public text: string;\r\n    public isSSML: boolean;\r\n    public cb: (e: SpeechSynthesisResult) => void;\r\n    public err: (e: string) => void;\r\n    public dataStream: IAudioDestination;\r\n\r\n    public constructor(requestId: string, text: string, isSSML: boolean, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, dataStream?: IAudioDestination) {\r\n        this.requestId = requestId;\r\n        this.text = text;\r\n        this.isSSML = isSSML;\r\n        this.cb = cb;\r\n        this.err = err;\r\n        this.dataStream = dataStream;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable @typescript-eslint/no-empty-function */\r\n\r\nimport { PathLike } from \"fs\";\r\nimport { IRestResponse } from \"../common.browser/RestMessageAdapter.js\";\r\nimport {\r\n    IAuthentication,\r\n    ISynthesisConnectionFactory,\r\n    SpeechSynthesisConnectionFactory,\r\n    SynthesisAdapterBase,\r\n    SpeechSynthesisAdapter,\r\n    SynthesisRestAdapter,\r\n    SynthesizerConfig,\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    createNoDashGuid,\r\n    marshalPromiseToCallbacks,\r\n} from \"../common/Exports.js\";\r\nimport { AudioOutputConfigImpl } from \"./Audio/AudioConfig.js\";\r\nimport { AudioFileWriter } from \"./Audio/AudioFileWriter.js\";\r\nimport { AudioOutputFormatImpl } from \"./Audio/AudioOutputFormat.js\";\r\nimport {\r\n    PullAudioOutputStreamImpl,\r\n    PushAudioOutputStreamImpl\r\n} from \"./Audio/AudioOutputStream.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    AudioOutputStream,\r\n    AutoDetectSourceLanguageConfig,\r\n    PropertyId,\r\n    PullAudioOutputStream,\r\n    PushAudioOutputStreamCallback,\r\n    SpeechConfig,\r\n    SpeechSynthesisBookmarkEventArgs,\r\n    SpeechSynthesisEventArgs,\r\n    SpeechSynthesisOutputFormat,\r\n    SpeechSynthesisResult,\r\n    SpeechSynthesisVisemeEventArgs,\r\n    SpeechSynthesisWordBoundaryEventArgs,\r\n    SynthesisVoicesResult,\r\n    Synthesizer\r\n} from \"./Exports.js\";\r\nimport { SpeechConfigImpl } from \"./SpeechConfig.js\";\r\nimport { SynthesisRequest } from \"./Synthesizer.js\";\r\n\r\n/**\r\n * Defines the class SpeechSynthesizer for text to speech.\r\n * Updated in version 1.16.0\r\n * @class SpeechSynthesizer\r\n */\r\nexport class SpeechSynthesizer extends Synthesizer {\r\n    protected audioConfig: AudioConfig;\r\n\r\n    /**\r\n     * Defines event handler for synthesis start events.\r\n     * @member SpeechSynthesizer.prototype.synthesisStarted\r\n     * @function\r\n     * @public\r\n     */\r\n    public synthesisStarted: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for synthesizing events.\r\n     * @member SpeechSynthesizer.prototype.synthesizing\r\n     * @function\r\n     * @public\r\n     */\r\n    public synthesizing: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for synthesis completed events.\r\n     * @member SpeechSynthesizer.prototype.synthesisCompleted\r\n     * @function\r\n     * @public\r\n     */\r\n    public synthesisCompleted: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for synthesis cancelled events.\r\n     * @member SpeechSynthesizer.prototype.SynthesisCanceled\r\n     * @function\r\n     * @public\r\n     */\r\n    public SynthesisCanceled: (sender: SpeechSynthesizer, event: SpeechSynthesisEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for word boundary events\r\n     * @member SpeechSynthesizer.prototype.wordBoundary\r\n     * @function\r\n     * @public\r\n     */\r\n    public wordBoundary: (sender: SpeechSynthesizer, event: SpeechSynthesisWordBoundaryEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for bookmark reached events\r\n     * Added in version 1.16.0\r\n     * @member SpeechSynthesizer.prototype.bookmarkReached\r\n     * @function\r\n     * @public\r\n     */\r\n    public bookmarkReached: (sender: SpeechSynthesizer, event: SpeechSynthesisBookmarkEventArgs) => void;\r\n\r\n    /**\r\n     * Defines event handler for viseme received event\r\n     * Added in version 1.16.0\r\n     * @member SpeechSynthesizer.prototype.visemeReceived\r\n     * @function\r\n     * @public\r\n     */\r\n    public visemeReceived: (sender: SpeechSynthesizer, event: SpeechSynthesisVisemeEventArgs) => void;\r\n\r\n    /**\r\n     * SpeechSynthesizer constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - An set of initial properties for this synthesizer.\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the synthesizer.\r\n     */\r\n    public constructor(speechConfig: SpeechConfig, audioConfig?: AudioConfig) {\r\n        super(speechConfig);\r\n\r\n        if (audioConfig !== null) {\r\n            if (audioConfig === undefined) {\r\n                this.audioConfig = (typeof window === \"undefined\") ? undefined : AudioConfig.fromDefaultSpeakerOutput();\r\n            } else {\r\n                this.audioConfig = audioConfig;\r\n            }\r\n        }\r\n\r\n        this.privConnectionFactory = new SpeechSynthesisConnectionFactory();\r\n        this.implCommonSynthesizeSetup();\r\n    }\r\n\r\n    /**\r\n     * SpeechSynthesizer constructor.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - an set of initial properties for this synthesizer\r\n     * @param {AutoDetectSourceLanguageConfig} autoDetectSourceLanguageConfig - An source language detection configuration associated with the synthesizer\r\n     * @param {AudioConfig} audioConfig - An optional audio configuration associated with the synthesizer\r\n     */\r\n    public static FromConfig(speechConfig: SpeechConfig, autoDetectSourceLanguageConfig: AutoDetectSourceLanguageConfig, audioConfig?: AudioConfig): SpeechSynthesizer {\r\n        const speechConfigImpl: SpeechConfigImpl = speechConfig as SpeechConfigImpl;\r\n        autoDetectSourceLanguageConfig.properties.mergeTo(speechConfigImpl.properties);\r\n        return new SpeechSynthesizer(speechConfig, audioConfig);\r\n    }\r\n\r\n    /**\r\n     * Executes speech synthesis on plain text.\r\n     * The task returns the synthesis result.\r\n     * @member SpeechSynthesizer.prototype.speakTextAsync\r\n     * @function\r\n     * @public\r\n     * @param text - Text to be synthesized.\r\n     * @param cb - Callback that received the SpeechSynthesisResult.\r\n     * @param err - Callback invoked in case of an error.\r\n     * @param stream - AudioOutputStream to receive the synthesized audio.\r\n     */\r\n    public speakTextAsync(text: string, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, stream?: AudioOutputStream | PushAudioOutputStreamCallback | PathLike): void {\r\n        this.speakImpl(text, false, cb, err, stream);\r\n    }\r\n\r\n    /**\r\n     * Executes speech synthesis on SSML.\r\n     * The task returns the synthesis result.\r\n     * @member SpeechSynthesizer.prototype.speakSsmlAsync\r\n     * @function\r\n     * @public\r\n     * @param ssml - SSML to be synthesized.\r\n     * @param cb - Callback that received the SpeechSynthesisResult.\r\n     * @param err - Callback invoked in case of an error.\r\n     * @param stream - AudioOutputStream to receive the synthesized audio.\r\n     */\r\n    public speakSsmlAsync(ssml: string, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, stream?: AudioOutputStream | PushAudioOutputStreamCallback | PathLike): void {\r\n        this.speakImpl(ssml, true, cb, err, stream);\r\n    }\r\n\r\n    /**\r\n     * Get list of synthesis voices available.\r\n     * The task returns the synthesis voice result.\r\n     * @member SpeechSynthesizer.prototype.getVoicesAsync\r\n     * @function\r\n     * @async\r\n     * @public\r\n     * @param locale - Locale of voices in BCP-47 format; if left empty, get all available voices.\r\n     * @return {Promise<SynthesisVoicesResult>} - Promise of a SynthesisVoicesResult.\r\n     */\r\n    public async getVoicesAsync(locale: string = \"\"): Promise<SynthesisVoicesResult> {\r\n        return this.getVoices(locale);\r\n    }\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member SpeechSynthesizer.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public close(cb?: () => void, err?: (error: string) => void): void {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n\r\n        marshalPromiseToCallbacks(this.dispose(true), cb, err);\r\n    }\r\n\r\n    /**\r\n     * @Internal\r\n     * Do not use externally, object returned will change without warning or notice.\r\n     */\r\n    public get internalData(): object {\r\n        return this.privAdapter;\r\n    }\r\n\r\n    //\r\n    // ################################################################################################################\r\n    // IMPLEMENTATION.\r\n    // ################################################################################################################\r\n    //\r\n\r\n    // Creates the synthesis adapter\r\n    protected createSynthesisAdapter(\r\n        authentication: IAuthentication,\r\n        connectionFactory: ISynthesisConnectionFactory,\r\n        synthesizerConfig: SynthesizerConfig): SynthesisAdapterBase {\r\n        return new SpeechSynthesisAdapter(authentication, connectionFactory,\r\n            synthesizerConfig, this, this.audioConfig as AudioOutputConfigImpl);\r\n    }\r\n\r\n    protected createRestSynthesisAdapter(\r\n        authentication: IAuthentication,\r\n        synthesizerConfig: SynthesizerConfig): SynthesisRestAdapter {\r\n        return new SynthesisRestAdapter(synthesizerConfig, authentication);\r\n    }\r\n\r\n    protected implCommonSynthesizeSetup(): void {\r\n        super.implCommonSynthesizeSetup();\r\n\r\n        this.privAdapter.audioOutputFormat = AudioOutputFormatImpl.fromSpeechSynthesisOutputFormat(\r\n            SpeechSynthesisOutputFormat[this.properties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined) as keyof typeof SpeechSynthesisOutputFormat]\r\n        );\r\n    }\r\n\r\n    protected speakImpl(text: string, IsSsml: boolean, cb?: (e: SpeechSynthesisResult) => void, err?: (e: string) => void, dataStream?: AudioOutputStream | PushAudioOutputStreamCallback | PathLike): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privDisposed);\r\n            const requestId = createNoDashGuid();\r\n            let audioDestination;\r\n            if (dataStream instanceof PushAudioOutputStreamCallback) {\r\n                audioDestination = new PushAudioOutputStreamImpl(dataStream);\r\n            } else if (dataStream instanceof PullAudioOutputStream) {\r\n                audioDestination = dataStream as PullAudioOutputStreamImpl;\r\n            } else if (dataStream !== undefined) {\r\n                audioDestination = new AudioFileWriter(dataStream as PathLike);\r\n            } else {\r\n                audioDestination = undefined;\r\n            }\r\n            this.synthesisRequestQueue.enqueue(new SynthesisRequest(requestId, text, IsSsml, (e: SpeechSynthesisResult): void => {\r\n                this.privSynthesizing = false;\r\n                if (!!cb) {\r\n                    try {\r\n                        cb(e);\r\n                    } catch (e) {\r\n                        if (!!err) {\r\n                            err(e as string);\r\n                        }\r\n                    }\r\n                }\r\n                cb = undefined;\r\n                /* eslint-disable no-empty */\r\n                this.adapterSpeak().catch((): void => { });\r\n\r\n            }, (e: string): void => {\r\n                if (!!err) {\r\n                    err(e);\r\n                }\r\n            }, audioDestination));\r\n\r\n            /* eslint-disable no-empty-function */\r\n            this.adapterSpeak().catch((): void => { });\r\n\r\n        } catch (error) {\r\n            if (!!err) {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    err(typedError.name + \": \" + typedError.message);\r\n                } else {\r\n                    err(error as string);\r\n                }\r\n            }\r\n\r\n            // Destroy the synthesizer.\r\n            /* eslint-disable no-empty */\r\n            this.dispose(true).catch((): void => { });\r\n        }\r\n    }\r\n\r\n    protected async getVoices(locale: string): Promise<SynthesisVoicesResult> {\r\n        const requestId = createNoDashGuid();\r\n        const response: IRestResponse = await this.privRestAdapter.getVoicesList(requestId);\r\n        if (response.ok && Array.isArray(response.json)) {\r\n            let json = response.json;\r\n            if (!!locale && locale.length > 0) {\r\n                json = json.filter((item: { Locale: string }): boolean => !!item.Locale && item.Locale.toLowerCase() === locale.toLowerCase() );\r\n            }\r\n            return new SynthesisVoicesResult(requestId, json, undefined);\r\n        } else {\r\n            return new SynthesisVoicesResult(requestId, undefined, `Error: ${response.status}: ${response.statusText}`);\r\n        }\r\n   }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, ResultReason } from \"./Exports.js\";\r\n\r\n/**\r\n * Base class for synthesis results\r\n * @class SynthesisResult\r\n * Added in version 1.20.0\r\n */\r\nexport class SynthesisResult {\r\n    private privResultId: string;\r\n    private privReason: ResultReason;\r\n    private privErrorDetails: string;\r\n    private privProperties: PropertyCollection;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     */\r\n    public constructor(resultId?: string, reason?: ResultReason, errorDetails?: string, properties?: PropertyCollection) {\r\n        this.privResultId = resultId;\r\n        this.privReason = reason;\r\n        this.privErrorDetails = errorDetails;\r\n        this.privProperties = properties;\r\n    }\r\n\r\n    /**\r\n     * Specifies the result identifier.\r\n     * @member SynthesisResult.prototype.resultId\r\n     * @function\r\n     * @public\r\n     * @returns {string} Specifies the result identifier.\r\n     */\r\n    public get resultId(): string {\r\n        return this.privResultId;\r\n    }\r\n\r\n    /**\r\n     * Specifies status of the result.\r\n     * @member SynthesisResult.prototype.reason\r\n     * @function\r\n     * @public\r\n     * @returns {ResultReason} Specifies status of the result.\r\n     */\r\n    public get reason(): ResultReason {\r\n        return this.privReason;\r\n    }\r\n\r\n    /**\r\n     * In case of an unsuccessful synthesis, provides details of the occurred error.\r\n     * @member SynthesisResult.prototype.errorDetails\r\n     * @function\r\n     * @public\r\n     * @returns {string} a brief description of an error.\r\n     */\r\n    public get errorDetails(): string {\r\n        return this.privErrorDetails;\r\n    }\r\n\r\n    /**\r\n     * The set of properties exposed in the result.\r\n     * @member SynthesisResult.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @returns {PropertyCollection} The set of properties exposed in the result.\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    PropertyCollection,\r\n    ResultReason,\r\n    SynthesisResult\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Defines result of speech synthesis.\r\n * @class SpeechSynthesisResult\r\n * Added in version 1.11.0\r\n */\r\nexport class SpeechSynthesisResult extends SynthesisResult {\r\n    private readonly privAudioData: ArrayBuffer;\r\n    private readonly privAudioDuration: number;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {ArrayBuffer} audioData - The synthesized audio binary.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     * @param {number} audioDuration - The audio duration.\r\n     */\r\n    public constructor(resultId?: string, reason?: ResultReason, audioData?: ArrayBuffer,\r\n                errorDetails?: string, properties?: PropertyCollection, audioDuration?: number) {\r\n        super(resultId, reason, errorDetails, properties);\r\n        this.privAudioData = audioData;\r\n        this.privAudioDuration = audioDuration;\r\n    }\r\n\r\n    /**\r\n     * The synthesized audio data\r\n     * @member SpeechSynthesisResult.prototype.audioData\r\n     * @function\r\n     * @public\r\n     * @returns {ArrayBuffer} The synthesized audio data.\r\n     */\r\n    public get audioData(): ArrayBuffer {\r\n        return this.privAudioData;\r\n    }\r\n\r\n    /**\r\n     * The time duration of synthesized audio, in ticks (100 nanoseconds).\r\n     * @member SpeechSynthesisResult.prototype.audioDuration\r\n     * @function\r\n     * @public\r\n     * @returns {number} The time duration of synthesized audio.\r\n     */\r\n    public get audioDuration(): number {\r\n        return this.privAudioDuration;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SpeechSynthesisResult } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines contents of speech synthesis events.\r\n * @class SpeechSynthesisEventArgs\r\n * Added in version 1.11.0\r\n */\r\nexport class SpeechSynthesisEventArgs {\r\n    private readonly privResult: SpeechSynthesisResult;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {SpeechSynthesisResult} result - The speech synthesis result.\r\n     */\r\n    public constructor(result: SpeechSynthesisResult) {\r\n        this.privResult = result;\r\n    }\r\n\r\n    /**\r\n     * Specifies the synthesis result.\r\n     * @member SpeechSynthesisEventArgs.prototype.result\r\n     * @function\r\n     * @public\r\n     * @returns {SpeechSynthesisResult} the synthesis result.\r\n     */\r\n    public get result(): SpeechSynthesisResult {\r\n        return this.privResult;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SpeechSynthesisBoundaryType } from \"./SpeechSynthesisBoundaryType.js\";\r\n\r\n/**\r\n * Defines contents of speech synthesis word boundary event.\r\n * @class SpeechSynthesisWordBoundaryEventArgs\r\n * Added in version 1.11.0\r\n */\r\nexport class SpeechSynthesisWordBoundaryEventArgs {\r\n    private readonly privAudioOffset: number;\r\n    private readonly privDuration: number;\r\n    private readonly privText: string;\r\n    private readonly privWordLength: number;\r\n    private readonly privTextOffset: number;\r\n    private readonly privBoundaryType: SpeechSynthesisBoundaryType;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {number} audioOffset - The audio offset.\r\n     * @param {number} duration - The audio duration.\r\n     * @param {string} text - The text.\r\n     * @param {number} wordLength - The length of the word.\r\n     * @param {number} textOffset - The text offset.\r\n     * @param {SpeechSynthesisBoundaryType} boundaryType - The boundary type\r\n     */\r\n    public constructor(audioOffset: number, duration: number, text: string, wordLength: number,\r\n                       textOffset: number, boundaryType: SpeechSynthesisBoundaryType) {\r\n        this.privAudioOffset = audioOffset;\r\n        this.privDuration = duration;\r\n        this.privText = text;\r\n        this.privWordLength = wordLength;\r\n        this.privTextOffset = textOffset;\r\n        this.privBoundaryType = boundaryType;\r\n    }\r\n\r\n    /**\r\n     * Specifies the audio offset.\r\n     * @member SpeechSynthesisWordBoundaryEventArgs.prototype.audioOffset\r\n     * @function\r\n     * @public\r\n     * @returns {number} the audio offset.\r\n     */\r\n    public get audioOffset(): number {\r\n        return this.privAudioOffset;\r\n    }\r\n\r\n    /**\r\n     * Specifies the duration, in ticks (100 nanoseconds).\r\n     * @member SpeechSynthesisWordBoundaryEventArgs.prototype.duration\r\n     * @function\r\n     * @public\r\n     * @returns {number} Duration in 100 nanosecond increments.\r\n     */\r\n    public get duration(): number {\r\n        return this.privDuration;\r\n    }\r\n\r\n    /**\r\n     * Specifies the text of the word boundary event.\r\n     * @member SpeechSynthesisWordBoundaryEventArgs.prototype.text\r\n     * @function\r\n     * @public\r\n     * @returns {string} the text.\r\n     */\r\n    public get text(): string {\r\n        return this.privText;\r\n    }\r\n\r\n    /**\r\n     * Specifies the word length\r\n     * @member SpeechSynthesisWordBoundaryEventArgs.prototype.wordLength\r\n     * @function\r\n     * @public\r\n     * @returns {number} the word length\r\n     */\r\n    public get wordLength(): number {\r\n        return this.privWordLength;\r\n    }\r\n\r\n    /**\r\n     * Specifies the text offset.\r\n     * @member SpeechSynthesisWordBoundaryEventArgs.prototype.textOffset\r\n     * @function\r\n     * @public\r\n     * @returns {number} the text offset.\r\n     */\r\n    public get textOffset(): number {\r\n        return this.privTextOffset;\r\n    }\r\n\r\n    /**\r\n     * Specifies the boundary type.\r\n     * @member SpeechSynthesisWordBoundaryEventArgs.prototype.boundaryType\r\n     * @function\r\n     * @public\r\n     * @returns {SpeechSynthesisBoundaryType} the boundary type.\r\n     */\r\n    public get boundaryType(): SpeechSynthesisBoundaryType {\r\n        return this.privBoundaryType;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines contents of speech synthesis bookmark event.\r\n * @class SpeechSynthesisBookmarkEventArgs\r\n * Added in version 1.16.0\r\n */\r\nexport class SpeechSynthesisBookmarkEventArgs {\r\n    private privAudioOffset: number;\r\n    private privText: string;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {number} audioOffset - The audio offset.\r\n     * @param {string} text - The bookmark text.\r\n     */\r\n    public constructor(audioOffset: number, text: string) {\r\n        this.privAudioOffset = audioOffset;\r\n        this.privText = text;\r\n    }\r\n\r\n    /**\r\n     * Specifies the audio offset.\r\n     * @member SpeechSynthesisBookmarkEventArgs.prototype.audioOffset\r\n     * @function\r\n     * @public\r\n     * @returns {number} the audio offset.\r\n     */\r\n    public get audioOffset(): number {\r\n        return this.privAudioOffset;\r\n    }\r\n\r\n    /**\r\n     * Specifies the bookmark.\r\n     * @member SpeechSynthesisBookmarkEventArgs.prototype.text\r\n     * @function\r\n     * @public\r\n     * @returns {string} the bookmark text.\r\n     */\r\n    public get text(): string {\r\n        return this.privText;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines contents of speech synthesis viseme event.\r\n * @class SpeechSynthesisVisemeEventArgs\r\n * Added in version 1.16.0\r\n */\r\nexport class SpeechSynthesisVisemeEventArgs {\r\n    private privAudioOffset: number;\r\n    private privVisemeId: number;\r\n    private privAnimation: string;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {number} audioOffset - The audio offset.\r\n     * @param {number} visemeId - The viseme ID.\r\n     * @param {string} animation - The animation, could be in svg or other format.\r\n     */\r\n    public constructor(audioOffset: number, visemeId: number, animation: string) {\r\n        this.privAudioOffset = audioOffset;\r\n        this.privVisemeId = visemeId;\r\n        this.privAnimation = animation;\r\n    }\r\n\r\n    /**\r\n     * Specifies the audio offset.\r\n     * @member SpeechSynthesisVisemeEventArgs.prototype.audioOffset\r\n     * @function\r\n     * @public\r\n     * @returns {number} the audio offset.\r\n     */\r\n    public get audioOffset(): number {\r\n        return this.privAudioOffset;\r\n    }\r\n\r\n    /**\r\n     * Specifies the viseme ID.\r\n     * @member SpeechSynthesisVisemeEventArgs.prototype.visemeId\r\n     * @function\r\n     * @public\r\n     * @returns {number} the viseme ID.\r\n     */\r\n    public get visemeId(): number {\r\n        return this.privVisemeId;\r\n    }\r\n\r\n    /**\r\n     * Specifies the animation.\r\n     * @member SpeechSynthesisVisemeEventArgs.prototype.animation\r\n     * @function\r\n     * @public\r\n     * @returns {string} the animation, could be in svg or other format.\r\n     */\r\n    public get animation(): string {\r\n        return this.privAnimation;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the boundary type of speech synthesis boundary event.\r\n * @class SpeechSynthesisBoundaryType\r\n * Added in version 1.21.0\r\n */\r\nexport enum SpeechSynthesisBoundaryType {\r\n    /**\r\n     * Indicates the boundary text is a word.\r\n     * @member SpeechSynthesisBoundaryType.Word\r\n     */\r\n    Word = \"WordBoundary\",\r\n\r\n    /**\r\n     * Indicates the boundary text is a punctuation.\r\n     * @member SpeechSynthesisBoundaryType.Punctuation\r\n     */\r\n    Punctuation = \"PunctuationBoundary\",\r\n\r\n    /**\r\n     * Indicates the boundary text is a sentence.\r\n     * @member SpeechSynthesisBoundaryType.Sentence\r\n     */\r\n    Sentence = \"SentenceBoundary\"\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection, ResultReason, SynthesisResult, VoiceInfo } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines result of speech synthesis.\r\n * @class SynthesisVoicesResult\r\n * Added in version 1.20.0\r\n */\r\nexport class SynthesisVoicesResult extends SynthesisResult {\r\n    private privVoices: VoiceInfo[];\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param requestId - result id for request.\r\n     * @param json - json payload from endpoint.\r\n     */\r\n    public constructor(requestId: string, json: any, errorDetails: string ) {\r\n        if (Array.isArray(json)) {\r\n            super(requestId, ResultReason.VoicesListRetrieved, undefined, new PropertyCollection());\r\n            this.privVoices = [];\r\n            for (const item of json) {\r\n                this.privVoices.push(new VoiceInfo(item as { Name: string; LocalName: string; DisplayName: string; LocaleName: string; ShortName: string; Gender: string; VoiceType: string; Locale: string; StyleList: string[] }));\r\n            }\r\n        } else {\r\n            super(requestId, ResultReason.Canceled, errorDetails ? errorDetails : \"Error information unavailable\", new PropertyCollection());\r\n        }\r\n    }\r\n\r\n    /**\r\n     * The list of voices\r\n     * @member SynthesisVoicesResult.prototype.voices\r\n     * @function\r\n     * @public\r\n     * @returns {VoiceInfo[]} List of synthesized voices.\r\n     */\r\n    public get voices(): VoiceInfo[] {\r\n        return this.privVoices;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the gender of synthesis voices.\r\n * Added in version 1.20.0.\r\n */\r\nexport enum SynthesisVoiceGender {\r\n\r\n    /** Gender unknown */\r\n    Unknown,\r\n\r\n    /** Female voice */\r\n    Female,\r\n\r\n    /** Male voice */\r\n    Male\r\n}\r\n\r\nexport enum SynthesisVoiceType {\r\n    OnlineNeural = 1,\r\n    OnlineStandard = 2,\r\n    OfflineNeural = 3,\r\n    OfflineStandard = 4,\r\n}\r\n\r\n/**\r\n * Information about Speech Synthesis voice\r\n * Added in version 1.20.0.\r\n * @class VoiceInfo\r\n */\r\nexport class VoiceInfo {\r\n    private privName: string;\r\n    private privLocale: string;\r\n    private privShortName: string;\r\n    private privDisplayName: string;\r\n    private privLocalName: string;\r\n    private privLocaleName: string;\r\n    private privGender: SynthesisVoiceGender;\r\n    private privVoiceType: SynthesisVoiceType;\r\n    private privStyleList: string[] = [];\r\n    private privVoicePath: string;\r\n\r\n    public constructor(json: { Name: string; LocalName: string; DisplayName: string; ShortName: string; Gender: string; VoiceType: string; LocaleName: string ; Locale: string; StyleList: string[] }) {\r\n        this.privVoicePath = \"\";\r\n        if (!!json) {\r\n            this.privName = json.Name;\r\n            this.privLocale = json.Locale;\r\n            this.privShortName = json.ShortName;\r\n            this.privLocaleName = json.LocaleName;\r\n            this.privDisplayName = json.DisplayName;\r\n            this.privLocalName = json.LocalName;\r\n            this.privVoiceType = json.VoiceType.endsWith(\"Standard\") ? SynthesisVoiceType.OnlineStandard : SynthesisVoiceType.OnlineNeural;\r\n            this.privGender = json.Gender === \"Male\" ? SynthesisVoiceGender.Male : json.Gender === \"Female\" ? SynthesisVoiceGender.Female : SynthesisVoiceGender.Unknown;\r\n            if (!!json.StyleList && Array.isArray(json.StyleList)) {\r\n                for (const style of json.StyleList) {\r\n                    this.privStyleList.push(style);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    public get name(): string {\r\n        return this.privName;\r\n    }\r\n\r\n    public get locale(): string {\r\n        return this.privLocale;\r\n    }\r\n\r\n    public get shortName(): string {\r\n        return this.privShortName;\r\n    }\r\n\r\n    public get displayName(): string {\r\n        return this.privDisplayName;\r\n    }\r\n\r\n    public get localName(): string {\r\n        return this.privLocalName;\r\n    }\r\n\r\n    public get localeName(): string {\r\n        return this.privLocaleName;\r\n    }\r\n\r\n    public get gender(): SynthesisVoiceGender {\r\n        return this.privGender;\r\n    }\r\n\r\n    public get voiceType(): SynthesisVoiceType {\r\n        return this.privVoiceType;\r\n    }\r\n\r\n    public get styleList(): string[] {\r\n        return this.privStyleList;\r\n    }\r\n\r\n    public get voicePath(): string {\r\n        return this.privVoicePath;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    BackgroundEvent,\r\n    createNoDashGuid,\r\n    Events,\r\n    IAudioDestination,\r\n    INumberDictionary\r\n} from \"../../common/Exports.js\";\r\nimport { AudioStreamFormat, IPlayer } from \"../Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"./AudioOutputFormat.js\";\r\nimport { PullAudioOutputStreamImpl } from \"./AudioOutputStream.js\";\r\nimport { AudioFormatTag } from \"./AudioStreamFormat.js\";\r\n\r\nconst MediaDurationPlaceholderSeconds = 60 * 30;\r\n\r\nconst AudioFormatToMimeType: INumberDictionary<string> = {\r\n    [AudioFormatTag.PCM]: \"audio/wav\",\r\n    [AudioFormatTag.MuLaw]: \"audio/x-wav\",\r\n    [AudioFormatTag.MP3]: \"audio/mpeg\",\r\n    [AudioFormatTag.OGG_OPUS]: \"audio/ogg\",\r\n    [AudioFormatTag.WEBM_OPUS]: \"audio/webm; codecs=opus\",\r\n    [AudioFormatTag.ALaw]: \"audio/x-wav\",\r\n    [AudioFormatTag.FLAC]: \"audio/flac\",\r\n};\r\n\r\n/**\r\n * Represents the speaker playback audio destination, which only works in browser.\r\n * Note: the SDK will try to use <a href=\"https://www.w3.org/TR/media-source/\">Media Source Extensions</a> to play audio.\r\n * Mp3 format has better supports on Microsoft Edge, Chrome and Safari (desktop), so, it's better to specify mp3 format for playback.\r\n * @class SpeakerAudioDestination\r\n * Updated in version 1.17.0\r\n */\r\nexport class SpeakerAudioDestination implements IAudioDestination, IPlayer {\r\n    private readonly privId: string;\r\n    private privFormat: AudioOutputFormatImpl;\r\n    private privAudio: HTMLAudioElement;\r\n    private privMediaSource: MediaSource;\r\n    private privSourceBuffer: SourceBuffer;\r\n    private privPlaybackStarted: boolean = false;\r\n    private privAudioBuffer: ArrayBuffer[];\r\n    private privAppendingToBuffer: boolean = false;\r\n    private privMediaSourceOpened: boolean = false;\r\n    private privIsClosed: boolean;\r\n    private privIsPaused: boolean;\r\n    private privAudioOutputStream: PullAudioOutputStreamImpl;\r\n    private privBytesReceived: number = 0;\r\n\r\n    public constructor(audioDestinationId?: string) {\r\n        this.privId = audioDestinationId ? audioDestinationId : createNoDashGuid();\r\n        this.privIsPaused = false;\r\n        this.privIsClosed = false;\r\n    }\r\n\r\n    public id(): string {\r\n        return this.privId;\r\n    }\r\n\r\n    public write(buffer: ArrayBuffer, cb?: () => void, err?: (error: string) => void): void {\r\n        if (this.privAudioBuffer !== undefined) {\r\n            this.privAudioBuffer.push(buffer);\r\n            this.updateSourceBuffer().then((): void => {\r\n                if (!!cb) {\r\n                    cb();\r\n                }\r\n            }, (error: string): void => {\r\n                if (!!err) {\r\n                    err(error);\r\n                }\r\n            });\r\n        } else if (this.privAudioOutputStream !== undefined) {\r\n            this.privAudioOutputStream.write(buffer);\r\n            this.privBytesReceived += buffer.byteLength;\r\n        }\r\n    }\r\n\r\n    public close(cb?: () => void, err?: (error: string) => void): void {\r\n        this.privIsClosed = true;\r\n        if (this.privSourceBuffer !== undefined) {\r\n            this.handleSourceBufferUpdateEnd().then((): void => {\r\n                if (!!cb) {\r\n                    cb();\r\n                }\r\n            }, (error: string): void => {\r\n                if (!!err) {\r\n                    err(error);\r\n                }\r\n            });\r\n        } else if (this.privAudioOutputStream !== undefined && typeof window !== \"undefined\") {\r\n            if ((this.privFormat.formatTag === AudioFormatTag.PCM || this.privFormat.formatTag === AudioFormatTag.MuLaw\r\n                || this.privFormat.formatTag === AudioFormatTag.ALaw) && this.privFormat.hasHeader === false) {\r\n                // eslint-disable-next-line no-console\r\n                console.warn(\"Play back is not supported for raw PCM, mulaw or alaw format without header.\");\r\n                if (!!this.onAudioEnd) {\r\n                    this.onAudioEnd(this);\r\n                }\r\n            } else {\r\n                let receivedAudio = new ArrayBuffer(this.privBytesReceived);\r\n                this.privAudioOutputStream.read(receivedAudio).then((): void => {\r\n                    receivedAudio = this.privFormat.addHeader(receivedAudio);\r\n                    const audioBlob = new Blob([receivedAudio], { type: AudioFormatToMimeType[this.privFormat.formatTag] });\r\n                    this.privAudio.src = window.URL.createObjectURL(audioBlob);\r\n                    this.notifyPlayback().then((): void => {\r\n                        if (!!cb) {\r\n                            cb();\r\n                        }\r\n                    }, (error: string): void => {\r\n                        if (!!err) {\r\n                            err(error);\r\n                        }\r\n                    });\r\n                }, (error: string): void => {\r\n                    if (!!err) {\r\n                        err(error);\r\n                    }\r\n                });\r\n            }\r\n        } else {\r\n            // unsupported format, call onAudioEnd directly.\r\n            if (!!this.onAudioEnd) {\r\n                this.onAudioEnd(this);\r\n            }\r\n        }\r\n    }\r\n\r\n    public set format(format: AudioStreamFormat) {\r\n        // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\r\n        if (typeof (AudioContext) !== \"undefined\" || (typeof (window) !== \"undefined\" && typeof ((window as any).webkitAudioContext) !== \"undefined\")) {\r\n            this.privFormat = format as AudioOutputFormatImpl;\r\n            const mimeType: string = AudioFormatToMimeType[this.privFormat.formatTag];\r\n            if (mimeType === undefined) {\r\n                // eslint-disable-next-line no-console\r\n                console.warn(\r\n                    `Unknown mimeType for format ${AudioFormatTag[this.privFormat.formatTag]}; playback is not supported.`);\r\n\r\n            } else if (typeof (MediaSource) !== \"undefined\" && MediaSource.isTypeSupported(mimeType)) {\r\n                this.privAudio = new Audio();\r\n                this.privAudioBuffer = [];\r\n                this.privMediaSource = new MediaSource();\r\n                this.privAudio.src = URL.createObjectURL(this.privMediaSource);\r\n                this.privAudio.load();\r\n                this.privMediaSource.onsourceopen = (): void => {\r\n                    this.privMediaSourceOpened = true;\r\n                    this.privMediaSource.duration = MediaDurationPlaceholderSeconds;\r\n                    this.privSourceBuffer = this.privMediaSource.addSourceBuffer(mimeType);\r\n                    this.privSourceBuffer.onupdate = (): void => {\r\n                        this.updateSourceBuffer().catch((reason: string): void => {\r\n                            Events.instance.onEvent(new BackgroundEvent(reason));\r\n                        });\r\n                    };\r\n                    this.privSourceBuffer.onupdateend = (): void => {\r\n                        this.handleSourceBufferUpdateEnd().catch((reason: string): void => {\r\n                            Events.instance.onEvent(new BackgroundEvent(reason));\r\n                        });\r\n                    };\r\n                    this.privSourceBuffer.onupdatestart = (): void => {\r\n                        this.privAppendingToBuffer = false;\r\n                    };\r\n                };\r\n                this.updateSourceBuffer().catch((reason: string): void => {\r\n                    Events.instance.onEvent(new BackgroundEvent(reason));\r\n                });\r\n\r\n            } else {\r\n                // eslint-disable-next-line no-console\r\n                console.warn(\r\n                    `Format ${AudioFormatTag[this.privFormat.formatTag]} could not be played by MSE, streaming playback is not enabled.`);\r\n                this.privAudioOutputStream = new PullAudioOutputStreamImpl();\r\n                this.privAudioOutputStream.format = this.privFormat;\r\n                this.privAudio = new Audio();\r\n            }\r\n        }\r\n    }\r\n\r\n    public get volume(): number {\r\n        return this.privAudio?.volume ?? -1;\r\n    }\r\n\r\n    public set volume(volume: number) {\r\n        if (!!this.privAudio) {\r\n            this.privAudio.volume = volume;\r\n        }\r\n    }\r\n\r\n    public mute(): void {\r\n        if (!!this.privAudio) {\r\n            this.privAudio.muted = true;\r\n        }\r\n    }\r\n\r\n    public unmute(): void {\r\n        if (!!this.privAudio) {\r\n            this.privAudio.muted = false;\r\n        }\r\n    }\r\n\r\n    public get isClosed(): boolean {\r\n        return this.privIsClosed;\r\n    }\r\n\r\n    public get currentTime(): number {\r\n        if (this.privAudio !== undefined) {\r\n            return this.privAudio.currentTime;\r\n        }\r\n        return -1;\r\n    }\r\n\r\n    public pause(): void {\r\n        if (!this.privIsPaused && this.privAudio !== undefined) {\r\n            this.privAudio.pause();\r\n            this.privIsPaused = true;\r\n        }\r\n    }\r\n\r\n    public resume(cb?: () => void, err?: (error: string) => void): void {\r\n        if (this.privIsPaused && this.privAudio !== undefined) {\r\n            this.privAudio.play().then((): void => {\r\n                if (!!cb) {\r\n                    cb();\r\n                }\r\n            }, (error: string): void => {\r\n                if (!!err) {\r\n                    err(error);\r\n                }\r\n            });\r\n            this.privIsPaused = false;\r\n        }\r\n    }\r\n\r\n    public onAudioStart: (sender: IPlayer) => void;\r\n\r\n    public onAudioEnd: (sender: IPlayer) => void;\r\n\r\n    public get internalAudio(): HTMLAudioElement {\r\n        return this.privAudio;\r\n    }\r\n\r\n    private async updateSourceBuffer(): Promise<void> {\r\n        if (this.privAudioBuffer !== undefined && (this.privAudioBuffer.length > 0) && this.sourceBufferAvailable()) {\r\n            this.privAppendingToBuffer = true;\r\n            const binary = this.privAudioBuffer.shift();\r\n            try {\r\n                this.privSourceBuffer.appendBuffer(binary);\r\n            } catch (error) {\r\n                this.privAudioBuffer.unshift(binary);\r\n                // eslint-disable-next-line no-console\r\n                console.log(\r\n                    \"buffer filled, pausing addition of binaries until space is made\");\r\n                return;\r\n            }\r\n            await this.notifyPlayback();\r\n        } else if (this.canEndStream()) {\r\n            await this.handleSourceBufferUpdateEnd();\r\n        }\r\n    }\r\n\r\n    private async handleSourceBufferUpdateEnd(): Promise<void> {\r\n        if (this.canEndStream() && this.sourceBufferAvailable()) {\r\n            this.privMediaSource.endOfStream();\r\n            await this.notifyPlayback();\r\n        }\r\n    }\r\n\r\n    private async notifyPlayback(): Promise<void> {\r\n        if (!this.privPlaybackStarted && this.privAudio !== undefined) {\r\n            this.privPlaybackStarted = true;\r\n            if (!!this.onAudioStart) {\r\n                this.onAudioStart(this);\r\n            }\r\n            this.privAudio.onended = (): void => {\r\n                if (!!this.onAudioEnd) {\r\n                    this.onAudioEnd(this);\r\n                }\r\n            };\r\n            if (!this.privIsPaused) {\r\n                await this.privAudio.play();\r\n            }\r\n        }\r\n    }\r\n\r\n    private canEndStream(): boolean {\r\n        return (this.isClosed && this.privSourceBuffer !== undefined && (this.privAudioBuffer.length === 0)\r\n            && this.privMediaSourceOpened && !this.privAppendingToBuffer && this.privMediaSource.readyState === \"open\");\r\n    }\r\n\r\n    private sourceBufferAvailable(): boolean {\r\n        return (this.privSourceBuffer !== undefined && !this.privSourceBuffer.updating);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CancellationEventArgsBase,\r\n} from \"./CancellationEventArgsBase.js\";\r\n\r\n/**\r\n * Defines content of a RecognitionErrorEvent.\r\n * @class ConversationTranscriptionCanceledEventArgs\r\n */\r\nexport class ConversationTranscriptionCanceledEventArgs extends CancellationEventArgsBase {\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CancellationEventArgsBase,\r\n} from \"./CancellationEventArgsBase.js\";\r\n\r\n/**\r\n * Defines content of a MeetingTranscriptionCanceledEvent.\r\n * @class MeetingTranscriptionCanceledEventArgs\r\n */\r\nexport class MeetingTranscriptionCanceledEventArgs extends CancellationEventArgsBase {\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the point system for pronunciation score calibration; default value is FivePoint.\r\n * Added in version 1.15.0\r\n * @class PronunciationAssessmentGradingSystem\r\n */\r\nexport enum PronunciationAssessmentGradingSystem {\r\n    /**\r\n     * Five point calibration\r\n     * @member PronunciationAssessmentGradingSystem.FivePoint\r\n     */\r\n    FivePoint = 1,\r\n\r\n    /**\r\n     * Hundred mark\r\n     * @member PronunciationAssessmentGradingSystem.HundredMark\r\n     */\r\n    HundredMark,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the pronunciation evaluation granularity; default value is Phoneme.\r\n * Added in version 1.15.0\r\n * @class PronunciationAssessmentGranularity\r\n */\r\nexport enum PronunciationAssessmentGranularity {\r\n    /**\r\n     * Shows the score on the full text, word and phoneme level\r\n     * @member PronunciationAssessmentGranularity.Phoneme\r\n     */\r\n    Phoneme = 1,\r\n\r\n    /**\r\n     * Shows the score on the full text and word level\r\n     * @member PronunciationAssessmentGranularity.Word\r\n     */\r\n    Word,\r\n\r\n    /**\r\n     * Shows the score on the full text level only\r\n     * @member PronunciationAssessmentGranularity.FullText\r\n     */\r\n    FullText,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ServiceRecognizerBase } from \"../common.speech/ServiceRecognizerBase.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n    PronunciationAssessmentGradingSystem,\r\n    PronunciationAssessmentGranularity,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer\r\n} from \"./Exports.js\";\r\n\r\ninterface PronunciationAssessmentJSON {\r\n    referenceText: string;\r\n    gradingSystem: string;\r\n    granularity: string;\r\n    phonemeAlphabet: string;\r\n    nbestPhonemeCount: number;\r\n    dimension: string;\r\n    enableMiscue: boolean;\r\n    enableProsodyAssessment: boolean;\r\n}\r\n\r\n/**\r\n * Pronunciation assessment configuration.\r\n * @class PronunciationAssessmentConfig\r\n * Added in version 1.15.0.\r\n */\r\nexport class PronunciationAssessmentConfig {\r\n    private privProperties: PropertyCollection;\r\n    private privPhonemeAlphabet: string;\r\n    private privNBestPhonemeCount: number;\r\n    private privEnableProsodyAssessment: boolean;\r\n    private privContentAssessmentTopic: string;\r\n\r\n    /**\r\n     * PronunciationAssessmentConfig constructor.\r\n     * @constructor\r\n     * @param {string} referenceText\r\n     * @param gradingSystem\r\n     * @param granularity\r\n     * @param enableMiscue\r\n     */\r\n    public constructor(referenceText: string,\r\n                       gradingSystem: PronunciationAssessmentGradingSystem = PronunciationAssessmentGradingSystem.FivePoint,\r\n                       granularity: PronunciationAssessmentGranularity = PronunciationAssessmentGranularity.Phoneme,\r\n                       enableMiscue: boolean = false) {\r\n        Contracts.throwIfNullOrUndefined(referenceText, \"referenceText\");\r\n        this.privProperties = new PropertyCollection();\r\n        this.privProperties.setProperty(PropertyId.PronunciationAssessment_ReferenceText, referenceText);\r\n        this.privProperties.setProperty(PropertyId.PronunciationAssessment_GradingSystem, PronunciationAssessmentGradingSystem[gradingSystem]);\r\n        this.privProperties.setProperty(PropertyId.PronunciationAssessment_Granularity, PronunciationAssessmentGranularity[granularity]);\r\n        this.privProperties.setProperty(PropertyId.PronunciationAssessment_EnableMiscue, String(enableMiscue));\r\n    }\r\n\r\n    /**\r\n     * @member PronunciationAssessmentConfig.fromJSON\r\n     * @function\r\n     * @public\r\n     * @param {string} json The json string containing the pronunciation assessment parameters.\r\n     * @return {PronunciationAssessmentConfig} Instance of PronunciationAssessmentConfig\r\n     * @summary Creates an instance of the PronunciationAssessmentConfig from json.\r\n     * This method is designed to support the pronunciation assessment parameters still in preview.\r\n     * Under normal circumstances, use the constructor instead.\r\n     */\r\n    public static fromJSON(json: string): PronunciationAssessmentConfig {\r\n        Contracts.throwIfNullOrUndefined(json, \"json\");\r\n        const config = new PronunciationAssessmentConfig(\"\");\r\n        config.privProperties = new PropertyCollection();\r\n        config.properties.setProperty(PropertyId.PronunciationAssessment_Json, json);\r\n        return config;\r\n    }\r\n\r\n    public toJSON(): string {\r\n        this.updateJson();\r\n        return this.privProperties.getProperty(PropertyId.PronunciationAssessment_Params);\r\n    }\r\n\r\n    public applyTo(recognizer: Recognizer): void {\r\n        this.updateJson();\r\n        const recoBase = recognizer.internalData as ServiceRecognizerBase;\r\n        recoBase.expectContentAssessmentResponse = !!this.privContentAssessmentTopic;\r\n        recoBase.speechContext.setPronunciationAssessmentParams(\r\n            this.properties.getProperty(PropertyId.PronunciationAssessment_Params),\r\n            this.privContentAssessmentTopic,\r\n            recoBase.isSpeakerDiarizationEnabled);\r\n    }\r\n\r\n    /**\r\n     * Gets the reference text.\r\n     * @member PronunciationAssessmentConfig.prototype.referenceText\r\n     * @function\r\n     * @public\r\n     * @returns {string} Reference text.\r\n     */\r\n    public get referenceText(): string {\r\n        return this.properties.getProperty(PropertyId.PronunciationAssessment_ReferenceText);\r\n    }\r\n\r\n    /**\r\n     * Gets/Sets the reference text.\r\n     * @member PronunciationAssessmentConfig.prototype.referenceText\r\n     * @function\r\n     * @public\r\n     * @param {string} referenceText - Reference text.\r\n     */\r\n    public set referenceText(referenceText: string) {\r\n        Contracts.throwIfNullOrWhitespace(referenceText, \"referenceText\");\r\n        this.properties.setProperty(PropertyId.PronunciationAssessment_ReferenceText, referenceText);\r\n    }\r\n\r\n    /**\r\n     * Sets the phoneme alphabet.\r\n     * The valid values are \"SAPI\" (default) and \"IPA\".\r\n     * Added in version 1.20.0\r\n     * @member PronunciationAssessmentConfig.prototype.phonemeAlphabet\r\n     * @function\r\n     * @public\r\n     * @param {string} phonemeAlphabet - Phoneme alphabet.\r\n     */\r\n    public set phonemeAlphabet(phonemeAlphabet: string) {\r\n        Contracts.throwIfNullOrWhitespace(phonemeAlphabet, \"phonemeAlphabet\");\r\n        this.privPhonemeAlphabet = phonemeAlphabet;\r\n    }\r\n\r\n    /**\r\n     * Sets the boolean enableMiscue property.\r\n     * Added in version 1.26.0\r\n     * @member PronunciationAssessmentConfig.prototype.enableMiscue\r\n     * @function\r\n     * @public\r\n     * @param {boolean} enableMiscue - enable miscue.\r\n     */\r\n    public set enableMiscue(enableMiscue: boolean) {\r\n        const enableMiscueString = enableMiscue ? \"true\" : \"false\";\r\n        this.properties.setProperty(PropertyId.PronunciationAssessment_EnableMiscue, enableMiscueString);\r\n    }\r\n\r\n    /**\r\n     * Gets the boolean enableMiscue property.\r\n     * Added in version 1.26.0\r\n     * @member PronunciationAssessmentConfig.prototype.enableMiscue\r\n     * @function\r\n     * @public\r\n     * @return {boolean} enableMiscue - enable miscue.\r\n     */\r\n    public get enableMiscue(): boolean {\r\n        const enableMiscueString = this.properties.getProperty(PropertyId.PronunciationAssessment_EnableMiscue, \"false\");\r\n        return (enableMiscueString.toLowerCase() === \"true\");\r\n    }\r\n\r\n    /**\r\n     * Sets the nbest phoneme count\r\n     * Added in version 1.20.0\r\n     * @member PronunciationAssessmentConfig.prototype.nbestPhonemeCount\r\n     * @function\r\n     * @public\r\n     * @param {number} nbestPhonemeCount - NBest phoneme count.\r\n     */\r\n    public set nbestPhonemeCount(nbestPhonemeCount: number) {\r\n        this.privNBestPhonemeCount = nbestPhonemeCount;\r\n    }\r\n\r\n    /**\r\n     * Enables the prosody assessment.\r\n     * Added in version 1.34.0\r\n     * @member PronunciationAssessmentConfig.prototype.enableProsodyAssessment\r\n     * @function\r\n     * @public\r\n     * @param {boolean} enableProsodyAssessment - enable prosody assessment.\r\n     */\r\n    public set enableProsodyAssessment(enableProsodyAssessment: boolean) {\r\n        this.privEnableProsodyAssessment = enableProsodyAssessment;\r\n    }\r\n\r\n    /**\r\n     * Enables content assessment and sets the topic.\r\n     * Added in version 1.34.0\r\n     * @member PronunciationAssessmentConfig.prototype.enableContentAssessmentWithTopic\r\n     * @function\r\n     * @public\r\n     * @param {string} topic - Topic for content assessment.\r\n     */\r\n    public enableContentAssessmentWithTopic(topic: string): void {\r\n        this.privContentAssessmentTopic = topic;\r\n    }\r\n\r\n    /**\r\n     * @member PronunciationAssessmentConfig.prototype.properties\r\n     * @function\r\n     * @public\r\n     * @return {PropertyCollection} Properties of the config.\r\n     * @summary Gets a pronunciation assessment config properties\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    private updateJson(): void {\r\n        const jsonString = this.privProperties.getProperty(PropertyId.PronunciationAssessment_Json, \"{}\");\r\n        const paramsJson: PronunciationAssessmentJSON = JSON.parse(jsonString) as PronunciationAssessmentJSON;\r\n\r\n        const referenceText = this.privProperties.getProperty(PropertyId.PronunciationAssessment_ReferenceText);\r\n        if (referenceText) {\r\n            paramsJson.referenceText = referenceText;\r\n        }\r\n\r\n        const gradingSystem = this.privProperties.getProperty(PropertyId.PronunciationAssessment_GradingSystem);\r\n        if (gradingSystem) {\r\n            paramsJson.gradingSystem = gradingSystem;\r\n        }\r\n\r\n        const granularity = this.privProperties.getProperty(PropertyId.PronunciationAssessment_Granularity);\r\n        if (granularity) {\r\n            paramsJson.granularity = granularity;\r\n        }\r\n\r\n        if (this.privPhonemeAlphabet) {\r\n            paramsJson.phonemeAlphabet = this.privPhonemeAlphabet;\r\n        }\r\n\r\n        if (this.privNBestPhonemeCount) {\r\n            paramsJson.nbestPhonemeCount = this.privNBestPhonemeCount;\r\n        }\r\n\r\n        paramsJson.enableProsodyAssessment = this.privEnableProsodyAssessment;\r\n\r\n        // always set dimension to Comprehensive\r\n        paramsJson.dimension = \"Comprehensive\";\r\n\r\n        const enableMiscueString = this.privProperties.getProperty(PropertyId.PronunciationAssessment_EnableMiscue);\r\n        if (enableMiscueString) {\r\n            paramsJson.enableMiscue = this.enableMiscue;\r\n        }\r\n\r\n        this.privProperties.setProperty(PropertyId.PronunciationAssessment_Params, JSON.stringify(paramsJson));\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {Contracts} from \"./Contracts.js\";\r\nimport {\r\n    PropertyId,\r\n    RecognitionResult\r\n} from \"./Exports.js\";\r\n\r\ninterface AssessmentResult {\r\n    NBest: DetailResult[];\r\n}\r\n\r\ninterface DetailResult {\r\n    Words: WordResult[];\r\n    PronunciationAssessment: {\r\n        AccuracyScore: number;\r\n        CompletenessScore: number;\r\n        FluencyScore: number;\r\n        PronScore: number;\r\n        ProsodyScore: number;\r\n    };\r\n    ContentAssessment: {\r\n        GrammarScore: number;\r\n        VocabularyScore: number;\r\n        TopicScore: number;\r\n    };\r\n}\r\n\r\ninterface WordResult {\r\n    Word: string;\r\n    Phonemes: {\r\n        Phoneme?: string;\r\n        PronunciationAssessment?: {\r\n            NBestPhonemes: { Phoneme: string }[];\r\n        };\r\n     }[];\r\n    PronunciationAssessment?: {\r\n        AccuracyScore: number;\r\n        ErrorType: string;\r\n    };\r\n    Syllables: { Syllable: string }[];\r\n}\r\n\r\nexport class ContentAssessmentResult {\r\n    private privPronJson: DetailResult;\r\n\r\n    /**\r\n     * @Internal\r\n     * Do not use externally.\r\n     */\r\n    public constructor(detailResult: DetailResult) {\r\n        this.privPronJson = detailResult;\r\n    }\r\n\r\n    /**\r\n     * Correctness in using grammar and variety of sentence patterns.\r\n     * Grammatical errors are jointly evaluated by lexical accuracy,\r\n     * grammatical accuracy and diversity of sentence structures.\r\n     * @member ContentAssessmentResult.prototype.grammarScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Grammar score.\r\n     */\r\n    public get grammarScore(): number {\r\n        return this.privPronJson.ContentAssessment.GrammarScore;\r\n    }\r\n\r\n    /**\r\n     * Proficiency in lexical usage. It evaluates the speaker's effective usage\r\n     * of words and their appropriateness within the given context to express\r\n     * ideas accurately, as well as level of lexical complexity.\r\n     * @member ContentAssessmentResult.prototype.vocabularyScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Vocabulary score.\r\n     */\r\n    public get vocabularyScore(): number {\r\n        return this.privPronJson.ContentAssessment.VocabularyScore;\r\n    }\r\n\r\n    /**\r\n     * Level of understanding and engagement with the topic, which provides\r\n     * insights into the speaker’s ability to express their thoughts and ideas\r\n     * effectively and the ability to engage with the topic.\r\n     * @member ContentAssessmentResult.prototype.topicScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Topic score.\r\n     */\r\n    public get topicScore(): number {\r\n        return this.privPronJson.ContentAssessment.TopicScore;\r\n    }\r\n}\r\n\r\n/**\r\n * Pronunciation assessment results.\r\n * @class PronunciationAssessmentResult\r\n * Added in version 1.15.0.\r\n */\r\nexport class PronunciationAssessmentResult {\r\n    private privPronJson: DetailResult;\r\n\r\n    private constructor(jsonString: string) {\r\n        const j = JSON.parse(jsonString) as AssessmentResult;\r\n        Contracts.throwIfNullOrUndefined(j.NBest[0], \"NBest\");\r\n        this.privPronJson = j.NBest[0];\r\n    }\r\n\r\n    /**\r\n     * @member PronunciationAssessmentResult.fromResult\r\n     * @function\r\n     * @public\r\n     * @param {RecognitionResult} result The recognition result.\r\n     * @return {PronunciationAssessmentConfig} Instance of PronunciationAssessmentConfig\r\n     * @summary Creates an instance of the PronunciationAssessmentResult from recognition result.\r\n     */\r\n    public static fromResult(result: RecognitionResult): PronunciationAssessmentResult {\r\n        Contracts.throwIfNullOrUndefined(result, \"result\");\r\n        const json: string = result.properties.getProperty(PropertyId.SpeechServiceResponse_JsonResult);\r\n        Contracts.throwIfNullOrUndefined(json, \"json\");\r\n        return new PronunciationAssessmentResult(json);\r\n    }\r\n\r\n    /**\r\n     * Gets the detail result of pronunciation assessment.\r\n     * @member PronunciationAssessmentConfig.prototype.detailResult\r\n     * @function\r\n     * @public\r\n     * @returns {DetailResult} detail result.\r\n     */\r\n    public get detailResult(): DetailResult {\r\n        return this.privPronJson;\r\n    }\r\n\r\n    /**\r\n     * The score indicating the pronunciation accuracy of the given speech, which indicates\r\n     * how closely the phonemes match a native speaker's pronunciation.\r\n     * @member PronunciationAssessmentResult.prototype.accuracyScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Accuracy score.\r\n     */\r\n    public get accuracyScore(): number {\r\n        return this.detailResult.PronunciationAssessment?.AccuracyScore;\r\n    }\r\n\r\n    /**\r\n     * The overall score indicating the pronunciation quality of the given speech.\r\n     * This is calculated from AccuracyScore, FluencyScore and CompletenessScore with weight.\r\n     * @member PronunciationAssessmentResult.prototype.pronunciationScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Pronunciation score.\r\n     */\r\n    public get pronunciationScore(): number {\r\n        return this.detailResult.PronunciationAssessment?.PronScore;\r\n    }\r\n\r\n    /**\r\n     * The score indicating the completeness of the given speech by calculating the ratio of pronounced words towards entire input.\r\n     * @member PronunciationAssessmentResult.prototype.completenessScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Completeness score.\r\n     */\r\n    public get completenessScore(): number {\r\n        return this.detailResult.PronunciationAssessment?.CompletenessScore;\r\n    }\r\n\r\n    /**\r\n     * The score indicating the fluency of the given speech.\r\n     * @member PronunciationAssessmentResult.prototype.fluencyScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Fluency score.\r\n     */\r\n    public get fluencyScore(): number {\r\n        return this.detailResult.PronunciationAssessment?.FluencyScore;\r\n    }\r\n\r\n    /**\r\n     * The prosody score, which indicates how nature of the given speech, including stress, intonation, speaking speed and rhythm.\r\n     * @member PronunciationAssessmentResult.prototype.prosodyScore\r\n     * @function\r\n     * @public\r\n     * @returns {number} Prosody score.\r\n     */\r\n    public get prosodyScore(): number {\r\n        return this.detailResult.PronunciationAssessment?.ProsodyScore;\r\n    }\r\n\r\n    /**\r\n     * The concent assessment result.\r\n     * Only available when content assessment is enabled.\r\n     * @member PronunciationAssessmentResult.prototype.contentAssessmentResult\r\n     * @function\r\n     * @public\r\n     * @returns {ContentAssessmentResult} Content assessment result.\r\n     */\r\n    public get contentAssessmentResult(): ContentAssessmentResult {\r\n        if (this.detailResult.ContentAssessment === undefined) {\r\n            return undefined;\r\n        }\r\n        return new ContentAssessmentResult(this.detailResult);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { AvatarVideoFormat } from \"./Exports.js\";\r\n\r\n/**\r\n * Defines the talking avatar configuration.\r\n * @class AvatarConfig\r\n * Added in version 1.33.0\r\n *\r\n * @experimental This feature is experimental and might change or have limited support.\r\n */\r\nexport class AvatarConfig {\r\n    private privCustomized: boolean = false;\r\n    private privBackgroundColor: string;\r\n\r\n    /**\r\n     * Defines the avatar character.\r\n     */\r\n    public character: string;\r\n    /**\r\n     * Defines the avatar style.\r\n     */\r\n    public style: string;\r\n    /**\r\n     * Defines the talking avatar output video format.\r\n     */\r\n    public videoFormat: AvatarVideoFormat;\r\n\r\n    /**\r\n     * Indicates if the talking avatar is customized.\r\n     */\r\n    public get customized(): boolean {\r\n        return this.privCustomized;\r\n    }\r\n\r\n    /**\r\n     * Sets if the talking avatar is customized.\r\n     */\r\n    public set customized(value: boolean) {\r\n        this.privCustomized = value;\r\n    }\r\n\r\n    /**\r\n     * Sets the background color.\r\n     */\r\n    public get backgroundColor(): string {\r\n        return this.privBackgroundColor;\r\n    }\r\n\r\n    /**\r\n     * Gets the background color.\r\n     */\r\n    public set backgroundColor(value: string) {\r\n        this.privBackgroundColor = value;\r\n    }\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} character - The avatar character.\r\n     * @param {string} style - The avatar style.\r\n     * @param {AvatarVideoFormat} videoFormat - The talking avatar output video format.\r\n     */\r\n    public constructor(character: string, style: string, videoFormat: AvatarVideoFormat) {\r\n        Contracts.throwIfNullOrWhitespace(character, \"character\");\r\n        this.character = character;\r\n        this.style = style;\r\n        if (videoFormat === undefined) {\r\n            videoFormat = new AvatarVideoFormat();\r\n        }\r\n        this.videoFormat = videoFormat;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport enum AvatarEventTypes {\r\n    SwitchedToSpeaking = \"SwitchedToSpeaking\",\r\n    SwitchedToIdle = \"SwitchedToIdle\",\r\n    SessionClosed = \"SessionClosed\",\r\n}\r\n\r\n/**\r\n * Defines content for talking avatar events.\r\n * @class AvatarEventArgs\r\n * Added in version 1.33.0\r\n *\r\n * @experimental This feature is experimental and might change or have limited support.\r\n */\r\nexport class AvatarEventArgs {\r\n    private privType: AvatarEventTypes;\r\n    private privOffset: number;\r\n    private privDescription: string;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {number} audioOffset - The audio offset.\r\n     * @param {string} description - The description of the event.\r\n     */\r\n    public constructor(audioOffset: number, description: string) {\r\n        this.privOffset = audioOffset;\r\n        this.privDescription = description;\r\n    }\r\n\r\n    /**\r\n     * The type of the event.\r\n     * @public\r\n     * @returns {AvatarEventTypes} The type of the event.\r\n     */\r\n    public get type(): AvatarEventTypes {\r\n        return this.privType;\r\n    }\r\n\r\n    /**\r\n     * The time offset associated with this event.\r\n     * @public\r\n     * @returns {number} The time offset associated with this event.\r\n     */\r\n    public get offset(): number {\r\n        return this.privOffset;\r\n    }\r\n\r\n    /**\r\n     * The description of the event.\r\n     * @public\r\n     * @returns {string} The description of the event.\r\n     */\r\n    public get description(): string {\r\n        return this.privDescription;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SpeechSynthesisConnectionFactory } from \"../common.speech/SpeechSynthesisConnectionFactory.js\";\r\nimport { SynthesisRestAdapter } from \"../common.speech/SynthesisRestAdapter.js\";\r\nimport { SynthesizerConfig } from \"../common.speech/SynthesizerConfig.js\";\r\nimport {\r\n    AvatarSynthesisAdapter,\r\n    IAuthentication,\r\n    ISynthesisConnectionFactory,\r\n    SpeechServiceConfig,\r\n    SynthesisAdapterBase\r\n} from \"../common.speech/Exports.js\";\r\nimport { createNoDashGuid, Deferred, Events, EventType, PlatformEvent } from \"../common/Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"./Audio/AudioOutputFormat.js\";\r\nimport {\r\n    AvatarConfig,\r\n    AvatarEventArgs,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SpeechConfig,\r\n    SpeechSynthesisOutputFormat,\r\n    SpeechSynthesisResult,\r\n    SynthesisResult,\r\n    Synthesizer\r\n} from \"./Exports.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { SynthesisRequest } from \"./Synthesizer.js\";\r\n\r\n/**\r\n * Defines the avatar synthesizer.\r\n * @class AvatarSynthesizer\r\n * Added in version 1.33.0\r\n *\r\n * @experimental This feature is experimental and might change or have limited support.\r\n */\r\nexport class AvatarSynthesizer extends Synthesizer {\r\n    protected privProperties: PropertyCollection;\r\n    private privAvatarConfig: AvatarConfig;\r\n    private privIceServers: RTCIceServer[];\r\n    /**\r\n     * Defines event handler for avatar events.\r\n     * @member AvatarSynthesizer.prototype.avatarEventReceived\r\n     * @function\r\n     * @public\r\n     */\r\n    public avatarEventReceived: (sender: AvatarSynthesizer, event: AvatarEventArgs) => void;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {SpeechConfig} speechConfig - The speech config.\r\n     * @param {AvatarConfig} avatarConfig - The talking avatar config.\r\n     */\r\n    public constructor(speechConfig: SpeechConfig, avatarConfig: AvatarConfig) {\r\n        super(speechConfig);\r\n\r\n        Contracts.throwIfNullOrUndefined(avatarConfig, \"avatarConfig\");\r\n\r\n        this.privConnectionFactory = new SpeechSynthesisConnectionFactory();\r\n        this.privAvatarConfig = avatarConfig;\r\n        this.implCommonSynthesizeSetup();\r\n    }\r\n\r\n    protected implCommonSynthesizeSetup(): void {\r\n        super.implCommonSynthesizeSetup();\r\n\r\n        // The service checks the audio format setting while it ignores it in avatar synthesis.\r\n        this.privAdapter.audioOutputFormat = AudioOutputFormatImpl.fromSpeechSynthesisOutputFormat(\r\n            SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Starts the talking avatar session and establishes the WebRTC connection.\r\n     * @member AvatarSynthesizer.prototype.startAvatarAsync\r\n     * @function\r\n     * @public\r\n     * @param {AvatarWebRTCConnectionInfo} peerConnection - The peer connection.\r\n     * @returns {Promise<SynthesisResult>} The promise of the connection result.\r\n     */\r\n    public async startAvatarAsync(peerConnection: RTCPeerConnection): Promise<SynthesisResult> {\r\n        Contracts.throwIfNullOrUndefined(peerConnection, \"peerConnection\");\r\n        this.privIceServers = peerConnection.getConfiguration().iceServers;\r\n        Contracts.throwIfNullOrUndefined(this.privIceServers, \"Ice servers must be set.\");\r\n        const iceGatheringDone = new Deferred<void>();\r\n        // https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/icegatheringstatechange_event\r\n        peerConnection.onicegatheringstatechange = (): void => {\r\n            Events.instance.onEvent(new PlatformEvent(\"peer connection: ice gathering state: \" + peerConnection.iceGatheringState, EventType.Debug));\r\n            if (peerConnection.iceGatheringState === \"complete\") {\r\n                Events.instance.onEvent(new PlatformEvent(\"peer connection: ice gathering complete.\", EventType.Info));\r\n                iceGatheringDone.resolve();\r\n            }\r\n        };\r\n        const sdp: RTCSessionDescriptionInit = await peerConnection.createOffer();\r\n        await peerConnection.setLocalDescription(sdp);\r\n        await iceGatheringDone.promise;\r\n        Events.instance.onEvent(new PlatformEvent(\"peer connection: got local SDP.\", EventType.Info));\r\n        this.privProperties.setProperty(PropertyId.TalkingAvatarService_WebRTC_SDP, JSON.stringify(peerConnection.localDescription));\r\n\r\n        const result: SpeechSynthesisResult = await this.speak(\"\", false);\r\n        if (result.reason !== ResultReason.SynthesizingAudioCompleted) {\r\n            return new SynthesisResult(\r\n                result.resultId,\r\n                result.reason,\r\n                result.errorDetails,\r\n                result.properties,\r\n            );\r\n        }\r\n        const sdpAnswerString: string = atob(result.properties.getProperty(PropertyId.TalkingAvatarService_WebRTC_SDP));\r\n        const sdpAnswer: RTCSessionDescription = new RTCSessionDescription(\r\n            JSON.parse(sdpAnswerString) as RTCSessionDescriptionInit,\r\n        );\r\n        await peerConnection.setRemoteDescription(sdpAnswer);\r\n        return new SynthesisResult(\r\n            result.resultId,\r\n            result.reason,\r\n            undefined,\r\n            result.properties,\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Speaks plain text asynchronously. The rendered audio and video will be sent via the WebRTC connection.\r\n     * @member AvatarSynthesizer.prototype.speakTextAsync\r\n     * @function\r\n     * @public\r\n     * @param {string} text - The plain text to speak.\r\n     * @returns {Promise<SynthesisResult>} The promise of the synthesis result.\r\n     */\r\n    public async speakTextAsync(text: string): Promise<SynthesisResult> {\r\n        const r = await this.speak(text, false);\r\n        return new SynthesisResult(\r\n            r.resultId,\r\n            r.reason,\r\n            r.errorDetails,\r\n            r.properties,\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Speaks SSML asynchronously. The rendered audio and video will be sent via the WebRTC connection.\r\n     * @member AvatarSynthesizer.prototype.speakSsmlAsync\r\n     * @function\r\n     * @public\r\n     * @param {string} ssml - The SSML text to speak.\r\n     * @returns {Promise<SynthesisResult>} The promise of the synthesis result.\r\n     */\r\n    public async speakSsmlAsync(ssml: string): Promise<SynthesisResult> {\r\n        const r = await this.speak(ssml, true);\r\n        return new SynthesisResult(\r\n            r.resultId,\r\n            r.reason,\r\n            r.errorDetails,\r\n            r.properties,\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Speaks text asynchronously. The avatar will switch to idle state.\r\n     * @member AvatarSynthesizer.prototype.stopSpeakingAsync\r\n     * @function\r\n     * @public\r\n     * @returns {Promise<void>} The promise of the void result.\r\n     */\r\n    public async stopSpeakingAsync(): Promise<void> {\r\n        while (this.synthesisRequestQueue.length() > 0) {\r\n            const request = await this.synthesisRequestQueue.dequeue();\r\n            request.err(\"Synthesis is canceled by user.\");\r\n        }\r\n        return this.privAdapter.stopSpeaking();\r\n    }\r\n\r\n    /**\r\n     * Stops the talking avatar session and closes the WebRTC connection.\r\n     * For now, this is the same as close().\r\n     * You need to create a new AvatarSynthesizer instance to start a new session.\r\n     * @member AvatarSynthesizer.prototype.stopAvatarAsync\r\n     * @function\r\n     * @public\r\n     * @returns {Promise<void>} The promise of the void result.\r\n     */\r\n    public async stopAvatarAsync(): Promise<void> {\r\n        Contracts.throwIfDisposed(this.privDisposed);\r\n        return this.dispose(true);\r\n    }\r\n\r\n    /**\r\n     * Dispose of associated resources.\r\n     * @member AvatarSynthesizer.prototype.close\r\n     * @function\r\n     * @public\r\n     */\r\n    public async close(): Promise<void> {\r\n        if (this.privDisposed) {\r\n            return;\r\n        }\r\n\r\n        return this.dispose(true);\r\n    }\r\n\r\n    /**\r\n     * Gets the ICE servers. Internal use only.\r\n     */\r\n    public get iceServers(): RTCIceServer[] {\r\n        return this.privIceServers;\r\n    }\r\n\r\n    // Creates the synthesis adapter\r\n    protected createSynthesisAdapter(\r\n        authentication: IAuthentication,\r\n        connectionFactory: ISynthesisConnectionFactory,\r\n        synthesizerConfig: SynthesizerConfig): SynthesisAdapterBase {\r\n        return new AvatarSynthesisAdapter(\r\n            authentication,\r\n            connectionFactory,\r\n            synthesizerConfig,\r\n            this,\r\n            this.privAvatarConfig);\r\n    }\r\n\r\n    protected createRestSynthesisAdapter(\r\n        _authentication: IAuthentication,\r\n        _synthesizerConfig: SynthesizerConfig): SynthesisRestAdapter {\r\n        return undefined;\r\n    }\r\n\r\n    protected createSynthesizerConfig(speechConfig: SpeechServiceConfig): SynthesizerConfig {\r\n        const config = super.createSynthesizerConfig(speechConfig);\r\n        config.avatarEnabled = true;\r\n        return config;\r\n    }\r\n\r\n    protected async speak(text: string, isSSML: boolean): Promise<SpeechSynthesisResult> {\r\n        const requestId = createNoDashGuid();\r\n        const deferredResult = new Deferred<SpeechSynthesisResult>();\r\n        this.synthesisRequestQueue.enqueue(new SynthesisRequest(requestId, text, isSSML,\r\n            (e: SpeechSynthesisResult): void => {\r\n                deferredResult.resolve(e);\r\n                this.privSynthesizing = false;\r\n                void this.adapterSpeak();\r\n            },\r\n            (e: string): void => {\r\n                deferredResult.reject(e);\r\n                this.privSynthesizing = false;\r\n            }));\r\n        void this.adapterSpeak();\r\n        return deferredResult.promise;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary\r\n} from \"../common/Exports.js\";\r\nimport { PropertyId } from \"../sdk/Exports.js\";\r\nimport { ConnectionFactoryBase } from \"./ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    SynthesizerConfig,\r\n    WebsocketMessageFormatter\r\n} from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport { ISynthesisConnectionFactory } from \"./ISynthesisConnectionFactory.js\";\r\nimport {\r\n    QueryParameterNames\r\n} from \"./QueryParameterNames.js\";\r\n\r\nexport class SpeechSynthesisConnectionFactory implements ISynthesisConnectionFactory {\r\n\r\n    private readonly synthesisUri: string = \"/cognitiveservices/websocket/v1\";\r\n\r\n    public create(\r\n        config: SynthesizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): IConnection {\r\n\r\n        let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n        const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, undefined);\r\n        const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n        const endpointId = config.parameters.getProperty(PropertyId.SpeechServiceConnection_EndpointId, undefined);\r\n        const hostPrefix = (endpointId === undefined) ? \"tts\" : \"voice\";\r\n        const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".\" + hostPrefix + \".speech\" + hostSuffix);\r\n\r\n        const queryParams: IStringDictionary<string> = {};\r\n        const headers: IStringDictionary<string> = {};\r\n\r\n        if (authInfo.token !== undefined && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n        if (endpointId !== undefined && endpointId !== \"\") {\r\n            if (!endpoint || endpoint.search(QueryParameterNames.CustomVoiceDeploymentId) === -1) {\r\n                queryParams[QueryParameterNames.CustomVoiceDeploymentId] = endpointId;\r\n            }\r\n        }\r\n\r\n        if (config.avatarEnabled) {\r\n            if (!endpoint || endpoint.search(QueryParameterNames.EnableAvatar) === -1) {\r\n                queryParams[QueryParameterNames.EnableAvatar] = \"true\";\r\n            }\r\n        }\r\n\r\n        if (!endpoint) {\r\n            endpoint = host + this.synthesisUri;\r\n        }\r\n\r\n        config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, endpoint);\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n        return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromParameters(config.parameters), enableCompression, connectionId);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\n/**\r\n * Defines a coordinate in 2D space.\r\n * @class Coordinate\r\n * Added in version 1.33.0\r\n */\r\nexport class Coordinate {\r\n    public x: number;\r\n    public y: number;\r\n\r\n    public constructor(x: number, y: number) {\r\n        this.x = x;\r\n        this.y = y;\r\n    }\r\n}\r\n\r\n/**\r\n * Defines the avatar output video format.\r\n * @class AvatarVideoFormat\r\n * Added in version 1.33.0\r\n *\r\n * @experimental This feature is experimental and might change in the future.\r\n */\r\nexport class AvatarVideoFormat {\r\n    /**\r\n     * Defines the video codec.\r\n     * @default \"H264\"\r\n     */\r\n    public codec: string;\r\n    /**\r\n     * Defines the video bitrate.\r\n     * @default 2000000\r\n     */\r\n    public bitrate: number;\r\n    /**\r\n     * Defines the video width.\r\n     * @default 1920\r\n     */\r\n    public width: number;\r\n    /**\r\n     * Defines the video height.\r\n     * @default 1080\r\n     */\r\n    public height: number;\r\n\r\n    /**\r\n     * Sets the video crop range.\r\n     */\r\n    public setCropRange(topLeft: Coordinate, bottomRight: Coordinate): void {\r\n        this.cropRange = {\r\n            bottomRight,\r\n            topLeft,\r\n        };\r\n    }\r\n\r\n    /**\r\n     * Defines the video crop range.\r\n     * @default undefined\r\n     * @internal\r\n     */\r\n    public cropRange: {\r\n        topLeft: Coordinate;\r\n        bottomRight: Coordinate;\r\n    };\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {string} codec - The video codec.\r\n     * @param {number} bitrate - The video bitrate.\r\n     * @param {number} width - The video width.\r\n     * @param {number} height - The video height.\r\n     */\r\n    public constructor(codec: string = \"H264\",\r\n                       bitrate: number = 2000000,\r\n                       width: number = 1920,\r\n                       height: number = 1080,\r\n    ) {\r\n        this.codec = codec;\r\n        this.bitrate = bitrate;\r\n        this.width = width;\r\n        this.height = height;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ResultReason,\r\n    PropertyCollection,\r\n    SynthesisResult\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Defines the avatar WebRTC connection result.\r\n * @class AvatarWebRTCConnectionResult\r\n * Added in version 1.33.0\r\n *\r\n * @experimental This feature is experimental and might change in the future.\r\n */\r\nexport class AvatarWebRTCConnectionResult extends SynthesisResult {\r\n    private readonly privSDPAnswer: RTCSessionDescriptionInit;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param {RTCSessionDescriptionInit} SDPAnswer - The SDP answer of WebRTC connection.\r\n     * @param {string} resultId - The result id.\r\n     * @param {ResultReason} reason - The reason.\r\n     * @param {string} errorDetails - Error details, if provided.\r\n     * @param {PropertyCollection} properties - Additional properties, if provided.\r\n     */\r\n    public constructor(SDPAnswer?: RTCSessionDescriptionInit, resultId?: string, reason?: ResultReason, errorDetails?: string, properties?: PropertyCollection) {\r\n        super(resultId, reason, errorDetails, properties);\r\n        this.privSDPAnswer = SDPAnswer;\r\n    }\r\n\r\n    /**\r\n     * Specifies SDP (Session Description Protocol) answer of WebRTC connection.\r\n     * @member AvatarWebRTCConnectionResult.prototype.SDPAnswer\r\n     * @function\r\n     * @public\r\n     * @returns {RTCSessionDescriptionInit} Specifies the SDP answer of WebRTC connection.\r\n     */\r\n    public get SDPAnswer(): RTCSessionDescriptionInit {\r\n        return this.privSDPAnswer;\r\n    }\r\n}\r\n","//\r\n// Copyright (c) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\r\n//\r\n\r\nimport { ConsoleLoggingListener } from \"../common.browser/Exports.js\";\r\nimport { Events } from \"../common/Exports.js\";\r\nimport { LogLevel } from \"./LogLevel.js\";\r\n\r\n/**\r\n * Defines diagnostics API for managing console output\r\n * Added in version 1.21.0\r\n */\r\nexport class Diagnostics {\r\n    private static privListener: ConsoleLoggingListener = undefined;\r\n\r\n    public static SetLoggingLevel(logLevel: LogLevel): void {\r\n        this.privListener = new ConsoleLoggingListener(logLevel);\r\n        Events.instance.attachConsoleListener(this.privListener);\r\n    }\r\n\r\n    public static StartConsoleOutput(): void {\r\n        if (!!this.privListener) {\r\n            this.privListener.enableConsoleOutput = true;\r\n        }\r\n    }\r\n\r\n    public static StopConsoleOutput(): void {\r\n        if (!!this.privListener) {\r\n            this.privListener.enableConsoleOutput = false;\r\n        }\r\n    }\r\n\r\n    public static SetLogOutputPath(path: string): void {\r\n        if (typeof window === \"undefined\") {\r\n            if (!!this.privListener) {\r\n                this.privListener.logPath = path;\r\n            }\r\n        } else {\r\n            throw new Error(\"File system logging not available in browser.\");\r\n        }\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport bent, { BentResponse, RequestBody } from \"bent\";\r\nimport {\r\n    ArgumentNullError,\r\n    Deferred\r\n} from \"../common/Exports.js\";\r\nimport { IRequestOptions } from \"./Exports.js\";\r\n\r\nexport enum RestRequestType {\r\n    Get = \"GET\",\r\n    Post = \"POST\",\r\n    Delete = \"DELETE\",\r\n    File = \"file\",\r\n}\r\n\r\nexport interface IRestResponse {\r\n    ok: boolean;\r\n    status: number;\r\n    statusText: string;\r\n    data: string;\r\n    json: any;\r\n    headers: string;\r\n}\r\n\r\ninterface JsonError {\r\n    error?: {\r\n        message: string;\r\n    };\r\n}\r\n\r\n// accept rest operations via request method and return abstracted objects from server response\r\nexport class RestMessageAdapter {\r\n\r\n    private privIgnoreCache: boolean;\r\n    private privHeaders: { [key: string]: string };\r\n\r\n    public constructor(\r\n        configParams: IRequestOptions\r\n        ) {\r\n\r\n        if (!configParams) {\r\n            throw new ArgumentNullError(\"configParams\");\r\n        }\r\n\r\n        this.privHeaders = configParams.headers;\r\n        this.privIgnoreCache = configParams.ignoreCache;\r\n    }\r\n\r\n    public static extractHeaderValue(headerKey: string, headers: string): string {\r\n        let headerValue: string = \"\";\r\n\r\n        try {\r\n            const arr = headers.trim().split(/[\\r\\n]+/);\r\n            const headerMap: { [key: string]: string } = {};\r\n            arr.forEach((line: string): void => {\r\n                const parts = line.split(\": \");\r\n                const header = parts.shift().toLowerCase();\r\n                const value = parts.join(\": \");\r\n                headerMap[header] = value;\r\n            });\r\n\r\n            headerValue = headerMap[headerKey.toLowerCase()];\r\n        } catch (e) {\r\n            // ignore the error\r\n        }\r\n\r\n        return headerValue;\r\n    }\r\n\r\n    public set options(configParams: IRequestOptions) {\r\n        this.privHeaders = configParams.headers;\r\n        this.privIgnoreCache = configParams.ignoreCache;\r\n    }\r\n\r\n    public setHeaders(key: string, value: string): void {\r\n        this.privHeaders[key] = value;\r\n    }\r\n\r\n    public request(\r\n        method: RestRequestType,\r\n        uri: string,\r\n        queryParams: { [key: string]: any } = {},\r\n        body: any = null,\r\n        ): Promise<IRestResponse> {\r\n\r\n        const responseReceivedDeferral = new Deferred<IRestResponse>();\r\n\r\n        const requestCommand = method === RestRequestType.File ? \"POST\" : method;\r\n        const handleRestResponse = (data: BentResponse, j: JsonError = {}): IRestResponse => {\r\n            const d: { statusText?: string; statusMessage?: string } = data;\r\n            return {\r\n                data: JSON.stringify(j),\r\n                headers: JSON.stringify(data.headers),\r\n                json: j,\r\n                ok: data.statusCode >= 200 && data.statusCode < 300,\r\n                status: data.statusCode,\r\n                statusText: j.error ? j.error.message : d.statusText ? d.statusText : d.statusMessage\r\n            };\r\n        };\r\n\r\n        const send = (postData: RequestBody): void => {\r\n            const sendRequest = bent(uri, requestCommand, this.privHeaders, 200, 201, 202, 204, 400, 401, 402, 403, 404);\r\n            const params = this.queryParams(queryParams) === \"\" ? \"\" : `?${this.queryParams(queryParams)}`;\r\n            sendRequest(params, postData).then( async (data: BentResponse): Promise<void> => {\r\n                if (method === RestRequestType.Delete || data.statusCode === 204) {\r\n                    // No JSON from Delete and reset (204) operations\r\n                    responseReceivedDeferral.resolve(handleRestResponse(data));\r\n                } else {\r\n                    try {\r\n                        const j: JsonError = await data.json() as JsonError;\r\n                        responseReceivedDeferral.resolve(handleRestResponse(data, j));\r\n                    } catch {\r\n                        responseReceivedDeferral.resolve(handleRestResponse(data));\r\n                    }\r\n                }\r\n            }).catch((error: string): void => {\r\n                responseReceivedDeferral.reject(error);\r\n            });\r\n        };\r\n\r\n        if (this.privIgnoreCache) {\r\n            this.privHeaders[\"Cache-Control\"] = \"no-cache\";\r\n        }\r\n\r\n        if (method === RestRequestType.Post && body) {\r\n            this.privHeaders[\"content-type\"] = \"application/json\";\r\n            this.privHeaders[\"Content-Type\"] = \"application/json\";\r\n        }\r\n        send(body as RequestBody);\r\n        return responseReceivedDeferral.promise;\r\n    }\r\n\r\n    private queryParams(params: { [key: string]: string } = {}): string {\r\n        return Object.keys(params)\r\n            .map((k: string): string => encodeURIComponent(k) + \"=\" + encodeURIComponent(params[k]))\r\n            .join(\"&\");\r\n    }\r\n}\r\n","'use strict'\n/* global fetch, btoa, Headers */\nconst core = require('./core')\n\nclass StatusError extends Error {\n  constructor (res, ...params) {\n    super(...params)\n\n    if (Error.captureStackTrace) {\n      Error.captureStackTrace(this, StatusError)\n    }\n\n    this.name = 'StatusError'\n    this.message = res.statusMessage\n    this.statusCode = res.status\n    this.res = res\n    this.json = res.json.bind(res)\n    this.text = res.text.bind(res)\n    this.arrayBuffer = res.arrayBuffer.bind(res)\n    let buffer\n    const get = () => {\n      if (!buffer) buffer = this.arrayBuffer()\n      return buffer\n    }\n    Object.defineProperty(this, 'responseBody', { get })\n    // match Node.js headers object\n    this.headers = {}\n    for (const [key, value] of res.headers.entries()) {\n      this.headers[key.toLowerCase()] = value\n    }\n  }\n}\n\nconst mkrequest = (statusCodes, method, encoding, headers, baseurl) => async (_url, body, _headers = {}) => {\n  _url = baseurl + (_url || '')\n  let parsed = new URL(_url)\n\n  if (!headers) headers = {}\n  if (parsed.username) {\n    headers.Authorization = 'Basic ' + btoa(parsed.username + ':' + parsed.password)\n    parsed = new URL(parsed.protocol + '//' + parsed.host + parsed.pathname + parsed.search)\n  }\n  if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {\n    throw new Error(`Unknown protocol, ${parsed.protocol}`)\n  }\n\n  if (body) {\n    if (body instanceof ArrayBuffer ||\n      ArrayBuffer.isView(body) ||\n      typeof body === 'string'\n    ) {\n      // noop\n    } else if (typeof body === 'object') {\n      body = JSON.stringify(body)\n      headers['Content-Type'] = 'application/json'\n    } else {\n      throw new Error('Unknown body type.')\n    }\n  }\n\n  _headers = new Headers({ ...(headers || {}), ..._headers })\n\n  const resp = await fetch(parsed, { method, headers: _headers, body })\n  resp.statusCode = resp.status\n\n  if (!statusCodes.has(resp.status)) {\n    throw new StatusError(resp)\n  }\n\n  if (encoding === 'json') return resp.json()\n  else if (encoding === 'buffer') return resp.arrayBuffer()\n  else if (encoding === 'string') return resp.text()\n  else return resp\n}\n\nmodule.exports = core(mkrequest)\n","'use strict'\nconst encodings = new Set(['json', 'buffer', 'string'])\n\nmodule.exports = mkrequest => (...args) => {\n  const statusCodes = new Set()\n  let method\n  let encoding\n  let headers\n  let baseurl = ''\n\n  args.forEach(arg => {\n    if (typeof arg === 'string') {\n      if (arg.toUpperCase() === arg) {\n        if (method) {\n          const msg = `Can't set method to ${arg}, already set to ${method}.`\n          throw new Error(msg)\n        } else {\n          method = arg\n        }\n      } else if (arg.startsWith('http:') || arg.startsWith('https:')) {\n        baseurl = arg\n      } else {\n        if (encodings.has(arg)) {\n          encoding = arg\n        } else {\n          throw new Error(`Unknown encoding, ${arg}`)\n        }\n      }\n    } else if (typeof arg === 'number') {\n      statusCodes.add(arg)\n    } else if (typeof arg === 'object') {\n      if (Array.isArray(arg) || arg instanceof Set) {\n        arg.forEach(code => statusCodes.add(code))\n      } else {\n        if (headers) {\n          throw new Error('Cannot set headers twice.')\n        }\n        headers = arg\n      }\n    } else {\n      throw new Error(`Unknown type: ${typeof arg}`)\n    }\n  })\n\n  if (!method) method = 'GET'\n  if (statusCodes.size === 0) {\n    statusCodes.add(200)\n  }\n\n  return mkrequest(statusCodes, method, encoding, headers, baseurl)\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IErrorMessages } from \"../common/Exports.js\";\r\n/**\r\n * HTTP request helper\r\n */\r\nexport interface IRequestOptions {\r\n    headers?: {[key: string]: string};\r\n    ignoreCache?: boolean;\r\n    timeout?: number;\r\n}\r\n\r\nexport interface IRestParams {\r\n    apiVersion: string;\r\n    authorization: string;\r\n    clientAppId: string;\r\n    contentTypeKey: string;\r\n    correlationId: string;\r\n    languageCode: string;\r\n    nickname: string;\r\n    profanity: string;\r\n    requestId: string;\r\n    roomId: string;\r\n    sessionToken: string;\r\n    subscriptionKey: string;\r\n    subscriptionRegion: string;\r\n    token: string;\r\n}\r\n\r\nexport class RestConfigBase {\r\n\r\n    public static get requestOptions(): IRequestOptions {\r\n        return RestConfigBase.privDefaultRequestOptions;\r\n    }\r\n\r\n    public static get configParams(): IRestParams {\r\n        return RestConfigBase.privDefaultParams;\r\n    }\r\n\r\n    public static get restErrors(): IErrorMessages {\r\n        return RestConfigBase.privRestErrors;\r\n    }\r\n\r\n    private static readonly privDefaultRequestOptions: IRequestOptions = {\r\n        headers: {\r\n            Accept: \"application/json\",\r\n        },\r\n        ignoreCache: false,\r\n        timeout: 10000,\r\n    };\r\n\r\n    private static readonly privRestErrors: IErrorMessages = {\r\n        authInvalidSubscriptionKey: \"You must specify either an authentication token to use, or a Cognitive Speech subscription key.\",\r\n        authInvalidSubscriptionRegion: \"You must specify the Cognitive Speech region to use.\",\r\n        invalidArgs: \"Required input not found: {arg}.\",\r\n        invalidCreateJoinConversationResponse: \"Creating/Joining conversation failed with HTTP {status}.\",\r\n        invalidParticipantRequest: \"The requested participant was not found.\",\r\n        permissionDeniedConnect: \"Required credentials not found.\",\r\n        permissionDeniedConversation: \"Invalid operation: only the host can {command} the conversation.\",\r\n        permissionDeniedParticipant: \"Invalid operation: only the host can {command} a participant.\",\r\n        permissionDeniedSend: \"Invalid operation: the conversation is not in a connected state.\",\r\n        permissionDeniedStart: \"Invalid operation: there is already an active conversation.\",\r\n    };\r\n\r\n    private static readonly privDefaultParams: IRestParams = {\r\n        apiVersion: \"api-version\",\r\n        authorization: \"Authorization\",\r\n        clientAppId: \"X-ClientAppId\",\r\n        contentTypeKey: \"Content-Type\",\r\n        correlationId: \"X-CorrelationId\",\r\n        languageCode: \"language\",\r\n        nickname: \"nickname\",\r\n        profanity: \"profanity\",\r\n        requestId: \"X-RequestId\",\r\n        roomId: \"roomid\",\r\n        sessionToken: \"token\",\r\n        subscriptionKey: \"Ocp-Apim-Subscription-Key\",\r\n        subscriptionRegion: \"Ocp-Apim-Subscription-Region\",\r\n        token: \"X-CapitoToken\",\r\n    };\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection,\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    PropertyId\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    RecognizerConfig,\r\n    WebsocketMessageFormatter,\r\n} from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\n\r\nclass SpeakerRecognitionConnectionFactoryBase extends ConnectionFactoryBase {\r\n\r\n    public create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        endpointPath: string,\r\n        connectionId?: string): IConnection {\r\n\r\n        let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint);\r\n        if (!endpoint) {\r\n            const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n            const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n            const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, `wss://${region}.spr-frontend.speech${hostSuffix}`);\r\n            const scenario: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_SpeakerIdMode, \"TextIndependentIdentification\");\r\n            endpoint = `${host}/speaker/ws/${this.scenarioToPath(scenario)}/${endpointPath}`;\r\n        }\r\n\r\n        const queryParams: IStringDictionary<string> = {\r\n            format: \"simple\",\r\n            language: config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage),\r\n        };\r\n\r\n        this.setCommonUrlParams(config, queryParams, endpoint);\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n        if (authInfo.token !== undefined && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n        headers[HeaderNames.SpIDAuthKey] = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Key);\r\n\r\n        config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, endpoint);\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n        return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\r\n    }\r\n\r\n    private scenarioToPath(mode: string): string {\r\n        switch (mode) {\r\n            case \"TextIndependentVerification\":\r\n            case \"2\":\r\n                return \"verification/text-independent\";\r\n            case \"TextDependentVerification\":\r\n            case \"1\":\r\n                return \"verification/text-dependent\";\r\n            default:\r\n                return \"identification/text-independent\";\r\n        }\r\n    }\r\n}\r\n\r\nexport class SpeakerRecognitionConnectionFactory extends SpeakerRecognitionConnectionFactoryBase {\r\n    public create( config: RecognizerConfig, authInfo: AuthInfo, connectionId?: string): IConnection {\r\n        return super.create(config, authInfo, \"recognition\", connectionId);\r\n    }\r\n}\r\n\r\nexport class VoiceProfileConnectionFactory extends SpeakerRecognitionConnectionFactoryBase {\r\n    public create( config: RecognizerConfig, authInfo: AuthInfo, connectionId?: string): IConnection {\r\n        return super.create(config, authInfo, \"profile\", connectionId);\r\n    }\r\n}\r\n\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { EventType, PlatformEvent } from \"../common/Exports.js\";\r\n\r\nexport class SpeechRecognitionEvent extends PlatformEvent {\r\n    private privRequestId: string;\r\n    private privSessionId: string;\r\n\r\n    public constructor(eventName: string, requestId: string, sessionId: string, eventType: EventType = EventType.Info) {\r\n        super(eventName, eventType);\r\n\r\n        this.privRequestId = requestId;\r\n        this.privSessionId = sessionId;\r\n    }\r\n\r\n    public get requestId(): string {\r\n        return this.privRequestId;\r\n    }\r\n\r\n    public get sessionId(): string {\r\n        return this.privSessionId;\r\n    }\r\n}\r\n\r\nexport class RecognitionTriggeredEvent extends SpeechRecognitionEvent {\r\n    private privAudioSourceId: string;\r\n    private privAudioNodeId: string;\r\n\r\n    public constructor(requestId: string, sessionId: string, audioSourceId: string, audioNodeId: string) {\r\n        super(\"RecognitionTriggeredEvent\", requestId, sessionId);\r\n\r\n        this.privAudioSourceId = audioSourceId;\r\n        this.privAudioNodeId = audioNodeId;\r\n    }\r\n\r\n    public get audioSourceId(): string {\r\n        return this.privAudioSourceId;\r\n    }\r\n\r\n    public get audioNodeId(): string {\r\n        return this.privAudioNodeId;\r\n    }\r\n}\r\n\r\nexport class ListeningStartedEvent extends SpeechRecognitionEvent {\r\n    private privAudioSourceId: string;\r\n    private privAudioNodeId: string;\r\n\r\n    public constructor(requestId: string, sessionId: string, audioSourceId: string, audioNodeId: string) {\r\n        super(\"ListeningStartedEvent\", requestId, sessionId);\r\n        this.privAudioSourceId = audioSourceId;\r\n        this.privAudioNodeId = audioNodeId;\r\n    }\r\n\r\n    public get audioSourceId(): string {\r\n        return this.privAudioSourceId;\r\n    }\r\n\r\n    public get audioNodeId(): string {\r\n        return this.privAudioNodeId;\r\n    }\r\n}\r\n\r\nexport class ConnectingToServiceEvent extends SpeechRecognitionEvent {\r\n    private privAuthFetchEventid: string;\r\n\r\n    public constructor(requestId: string, authFetchEventid: string, sessionId: string) {\r\n        super(\"ConnectingToServiceEvent\", requestId, sessionId);\r\n        this.privAuthFetchEventid = authFetchEventid;\r\n    }\r\n\r\n    public get authFetchEventid(): string {\r\n        return this.privAuthFetchEventid;\r\n    }\r\n}\r\n\r\nexport class RecognitionStartedEvent extends SpeechRecognitionEvent {\r\n    private privAudioSourceId: string;\r\n    private privAudioNodeId: string;\r\n    private privAuthFetchEventId: string;\r\n\r\n    public constructor(requestId: string, audioSourceId: string, audioNodeId: string, authFetchEventId: string, sessionId: string) {\r\n        super(\"RecognitionStartedEvent\", requestId, sessionId);\r\n\r\n        this.privAudioSourceId = audioSourceId;\r\n        this.privAudioNodeId = audioNodeId;\r\n        this.privAuthFetchEventId = authFetchEventId;\r\n    }\r\n\r\n    public get audioSourceId(): string {\r\n        return this.privAudioSourceId;\r\n    }\r\n\r\n    public get audioNodeId(): string {\r\n        return this.privAudioNodeId;\r\n    }\r\n\r\n    public get authFetchEventId(): string {\r\n        return this.privAuthFetchEventId;\r\n    }\r\n}\r\n\r\nexport enum RecognitionCompletionStatus {\r\n    Success,\r\n    AudioSourceError,\r\n    AudioSourceTimeout,\r\n    AuthTokenFetchError,\r\n    AuthTokenFetchTimeout,\r\n    UnAuthorized,\r\n    ConnectTimeout,\r\n    ConnectError,\r\n    ClientRecognitionActivityTimeout,\r\n    UnknownError,\r\n}\r\n\r\nexport class RecognitionEndedEvent extends SpeechRecognitionEvent {\r\n    private privAudioSourceId: string;\r\n    private privAudioNodeId: string;\r\n    private privAuthFetchEventId: string;\r\n    private privServiceTag: string;\r\n    private privStatus: RecognitionCompletionStatus;\r\n    private privError: string;\r\n\r\n    public constructor(\r\n        requestId: string,\r\n        audioSourceId: string,\r\n        audioNodeId: string,\r\n        authFetchEventId: string,\r\n        sessionId: string,\r\n        serviceTag: string,\r\n        status: RecognitionCompletionStatus,\r\n        error: string) {\r\n\r\n        super(\"RecognitionEndedEvent\", requestId, sessionId, status === RecognitionCompletionStatus.Success ? EventType.Info : EventType.Error);\r\n\r\n        this.privAudioSourceId = audioSourceId;\r\n        this.privAudioNodeId = audioNodeId;\r\n        this.privAuthFetchEventId = authFetchEventId;\r\n        this.privStatus = status;\r\n        this.privError = error;\r\n        this.privServiceTag = serviceTag;\r\n    }\r\n\r\n    public get audioSourceId(): string {\r\n        return this.privAudioSourceId;\r\n    }\r\n\r\n    public get audioNodeId(): string {\r\n        return this.privAudioNodeId;\r\n    }\r\n\r\n    public get authFetchEventId(): string {\r\n        return this.privAuthFetchEventId;\r\n    }\r\n\r\n    public get serviceTag(): string {\r\n        return this.privServiceTag;\r\n    }\r\n\r\n    public get status(): RecognitionCompletionStatus {\r\n        return this.privStatus;\r\n    }\r\n\r\n    public get error(): string {\r\n        return this.privError;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ReplayableAudioNode } from \"../common.browser/Exports.js\";\r\nimport { ConnectionOpenResponse } from \"../common/ConnectionOpenResponse.js\";\r\nimport {\r\n    ArgumentNullError,\r\n    ConnectionClosedEvent,\r\n    ConnectionEvent,\r\n    ConnectionState,\r\n    createNoDashGuid,\r\n    EventSource,\r\n    IAudioSource,\r\n    IAudioStreamNode,\r\n    IConnection,\r\n    IDisposable,\r\n    IStreamChunk,\r\n    MessageType,\r\n    ServiceEvent,\r\n    Timeout\r\n} from \"../common/Exports.js\";\r\nimport { AudioStreamFormatImpl } from \"../sdk/Audio/AudioStreamFormat.js\";\r\nimport { SpeakerRecognitionModel } from \"../sdk/SpeakerRecognitionModel.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    PropertyId,\r\n    RecognitionEventArgs,\r\n    Recognizer,\r\n    SessionEventArgs,\r\n    SpeakerRecognitionResult,\r\n    SpeechRecognitionResult,\r\n    OutputFormat\r\n} from \"../sdk/Exports.js\";\r\nimport { Callback } from \"../sdk/Transcription/IConversation.js\";\r\nimport {\r\n    AgentConfig,\r\n    DynamicGrammarBuilder,\r\n    ISpeechConfigAudioDevice,\r\n    RecognitionMode,\r\n    RequestSession,\r\n    SpeechContext,\r\n    SpeechDetected,\r\n    type,\r\n    OutputFormatPropertyName\r\n} from \"./Exports.js\";\r\nimport {\r\n    AuthInfo,\r\n    IAuthentication,\r\n} from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\ninterface CustomModel {\r\n    language: string;\r\n    endpoint: string;\r\n}\r\n\r\nexport interface PhraseDetection {\r\n    customModels?: CustomModel[];\r\n    onInterim?: { action: string };\r\n    onSuccess?: { action: string };\r\n    mode?: string;\r\n    INTERACTIVE?: Segmentation;\r\n    CONVERSATION?: Segmentation;\r\n    DICTATION?: Segmentation;\r\n    speakerDiarization?: SpeakerDiarization;\r\n}\r\n\r\nexport interface SpeakerDiarization {\r\n    mode?: string;\r\n    audioSessionId?: string;\r\n    audioOffsetMs?: number;\r\n    identityProvider?: string;\r\n}\r\n\r\nexport interface Segmentation {\r\n    segmentation: {\r\n        mode: \"Custom\";\r\n        segmentationSilenceTimeoutMs: number;\r\n    };\r\n}\r\n\r\nexport abstract class ServiceRecognizerBase implements IDisposable {\r\n    private privAuthentication: IAuthentication;\r\n    private privConnectionFactory: IConnectionFactory;\r\n\r\n    // A promise for a configured connection.\r\n    // Do not consume directly, call fetchConnection instead.\r\n    private privConnectionConfigurationPromise: Promise<IConnection> = undefined;\r\n\r\n    // A promise for a connection, but one that has not had the speech context sent yet.\r\n    // Do not consume directly, call fetchConnection instead.\r\n    private privConnectionPromise: Promise<IConnection> = undefined;\r\n    private privAuthFetchEventId: string;\r\n    private privIsDisposed: boolean;\r\n    private privMustReportEndOfStream: boolean;\r\n    private privConnectionEvents: EventSource<ConnectionEvent>;\r\n    private privServiceEvents: EventSource<ServiceEvent>;\r\n    private privDynamicGrammar: DynamicGrammarBuilder;\r\n    private privAgentConfig: AgentConfig;\r\n    private privServiceHasSentMessage: boolean;\r\n    private privActivityTemplate: string;\r\n    private privSetTimeout: (cb: () => void, delay: number) => number = setTimeout;\r\n    private privAudioSource: IAudioSource;\r\n    private privIsLiveAudio: boolean = false;\r\n    private privAverageBytesPerMs: number = 0;\r\n    protected privSpeechContext: SpeechContext;\r\n    protected privRequestSession: RequestSession;\r\n    protected privConnectionId: string;\r\n    protected privDiarizationSessionId: string;\r\n    protected privRecognizerConfig: RecognizerConfig;\r\n    protected privRecognizer: Recognizer;\r\n    protected privSuccessCallback: (e: SpeechRecognitionResult) => void;\r\n    protected privErrorCallback: (e: string) => void;\r\n    protected privEnableSpeakerId: boolean = false;\r\n    protected privExpectContentAssessmentResponse: boolean = false;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        recognizer: Recognizer) {\r\n\r\n        if (!authentication) {\r\n            throw new ArgumentNullError(\"authentication\");\r\n        }\r\n\r\n        if (!connectionFactory) {\r\n            throw new ArgumentNullError(\"connectionFactory\");\r\n        }\r\n\r\n        if (!audioSource) {\r\n            throw new ArgumentNullError(\"audioSource\");\r\n        }\r\n\r\n        if (!recognizerConfig) {\r\n            throw new ArgumentNullError(\"recognizerConfig\");\r\n        }\r\n\r\n        this.privEnableSpeakerId = recognizerConfig.isSpeakerDiarizationEnabled;\r\n        this.privMustReportEndOfStream = false;\r\n        this.privAuthentication = authentication;\r\n        this.privConnectionFactory = connectionFactory;\r\n        this.privAudioSource = audioSource;\r\n        this.privRecognizerConfig = recognizerConfig;\r\n        this.privIsDisposed = false;\r\n        this.privRecognizer = recognizer;\r\n        this.privRequestSession = new RequestSession(this.privAudioSource.id());\r\n        this.privConnectionEvents = new EventSource<ConnectionEvent>();\r\n        this.privServiceEvents = new EventSource<ServiceEvent>();\r\n        this.privDynamicGrammar = new DynamicGrammarBuilder();\r\n        this.privSpeechContext = new SpeechContext(this.privDynamicGrammar);\r\n        this.privAgentConfig = new AgentConfig();\r\n        const webWorkerLoadType: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.WebWorkerLoadType, \"on\").toLowerCase();\r\n        if (webWorkerLoadType === \"on\" && typeof (Blob) !== \"undefined\" && typeof (Worker) !== \"undefined\") {\r\n            this.privSetTimeout = Timeout.setTimeout;\r\n        } else {\r\n            if (typeof window !== \"undefined\") {\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n                this.privSetTimeout = window.setTimeout.bind(window);\r\n            }\r\n        }\r\n\r\n        this.connectionEvents.attach((connectionEvent: ConnectionEvent): void => {\r\n            if (connectionEvent.name === \"ConnectionClosedEvent\") {\r\n                const connectionClosedEvent = connectionEvent as ConnectionClosedEvent;\r\n                if (connectionClosedEvent.statusCode === 1003 ||\r\n                    connectionClosedEvent.statusCode === 1007 ||\r\n                    connectionClosedEvent.statusCode === 1002 ||\r\n                    connectionClosedEvent.statusCode === 4000 ||\r\n                    this.privRequestSession.numConnectionAttempts > this.privRecognizerConfig.maxRetryCount\r\n                ) {\r\n                    void this.cancelRecognitionLocal(CancellationReason.Error,\r\n                        connectionClosedEvent.statusCode === 1007 ? CancellationErrorCode.BadRequestParameters : CancellationErrorCode.ConnectionFailure,\r\n                        `${connectionClosedEvent.reason} websocket error code: ${connectionClosedEvent.statusCode}`);\r\n                }\r\n            }\r\n        });\r\n\r\n        if (this.privEnableSpeakerId) {\r\n            this.privDiarizationSessionId = createNoDashGuid();\r\n        }\r\n\r\n        this.setLanguageIdJson();\r\n        this.setOutputDetailLevelJson();\r\n    }\r\n\r\n    protected setTranslationJson(): void {\r\n        const targetLanguages: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined);\r\n        if (targetLanguages !== undefined) {\r\n            const languages = targetLanguages.split(\",\");\r\n            const translationVoice: string =  this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined);\r\n            const action = ( translationVoice !== undefined ) ? \"Synthesize\" : \"None\";\r\n            this.privSpeechContext.setSection(\"translation\", {\r\n                onSuccess: { action },\r\n                output: { interimResults: { mode: \"Always\" } },\r\n                targetLanguages: languages,\r\n            });\r\n\r\n            if (translationVoice !== undefined) {\r\n                const languageToVoiceMap: { [key: string]: string } = {};\r\n                for (const lang of languages) {\r\n                    languageToVoiceMap[lang] = translationVoice;\r\n                }\r\n                this.privSpeechContext.setSection(\"synthesis\", {\r\n                    defaultVoices: languageToVoiceMap\r\n                });\r\n            }\r\n        }\r\n    }\r\n\r\n    protected setSpeechSegmentationTimeoutJson(): void {\r\n        const speechSegmentationTimeout: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.Speech_SegmentationSilenceTimeoutMs, undefined);\r\n        if (speechSegmentationTimeout !== undefined) {\r\n            const mode = this.recognitionMode === RecognitionMode.Conversation ? \"CONVERSATION\" :\r\n                this.recognitionMode === RecognitionMode.Dictation ? \"DICTATION\" : \"INTERACTIVE\";\r\n            const segmentationSilenceTimeoutMs: number = parseInt(speechSegmentationTimeout, 10);\r\n            const phraseDetection = this.privSpeechContext.getSection(\"phraseDetection\") as PhraseDetection;\r\n            phraseDetection.mode = mode;\r\n            phraseDetection[mode] = {\r\n                segmentation: {\r\n                    mode: \"Custom\",\r\n                    segmentationSilenceTimeoutMs\r\n                }\r\n            };\r\n            this.privSpeechContext.setSection(\"phraseDetection\", phraseDetection);\r\n        }\r\n    }\r\n\r\n    protected setLanguageIdJson(): void {\r\n        const phraseDetection = this.privSpeechContext.getSection(\"phraseDetection\") as PhraseDetection;\r\n        if (this.privRecognizerConfig.autoDetectSourceLanguages !== undefined) {\r\n            const sourceLanguages: string[] = this.privRecognizerConfig.autoDetectSourceLanguages.split(\",\");\r\n\r\n            let speechContextLidMode;\r\n            if (this.privRecognizerConfig.languageIdMode === \"Continuous\") {\r\n                speechContextLidMode = \"DetectContinuous\";\r\n            } else {// recognizerConfig.languageIdMode === \"AtStart\"\r\n                speechContextLidMode = \"DetectAtAudioStart\";\r\n            }\r\n\r\n            this.privSpeechContext.setSection(\"languageId\", {\r\n                Priority: \"PrioritizeLatency\",\r\n                languages: sourceLanguages,\r\n                mode: speechContextLidMode,\r\n                onSuccess: { action: \"Recognize\" },\r\n                onUnknown: { action: \"None\" }\r\n            });\r\n            this.privSpeechContext.setSection(\"phraseOutput\", {\r\n                interimResults: {\r\n                    resultType: \"Auto\"\r\n                },\r\n                phraseResults: {\r\n                    resultType: \"Always\"\r\n                }\r\n            });\r\n            const customModels: CustomModel[] = this.privRecognizerConfig.sourceLanguageModels;\r\n            if (customModels !== undefined) {\r\n                phraseDetection.customModels = customModels;\r\n                phraseDetection.onInterim = { action: \"None\" };\r\n                phraseDetection.onSuccess = { action: \"None\" };\r\n            }\r\n        }\r\n        const targetLanguages: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages, undefined);\r\n        if (targetLanguages !== undefined) {\r\n            phraseDetection.onInterim = { action: \"Translate\" };\r\n            phraseDetection.onSuccess = { action: \"Translate\" };\r\n            this.privSpeechContext.setSection(\"phraseOutput\", {\r\n                interimResults: {\r\n                    resultType: \"None\"\r\n                },\r\n                phraseResults: {\r\n                    resultType: \"None\"\r\n                }\r\n            });\r\n        }\r\n\r\n        this.privSpeechContext.setSection(\"phraseDetection\", phraseDetection);\r\n    }\r\n\r\n    protected setOutputDetailLevelJson(): void {\r\n        if (this.privEnableSpeakerId) {\r\n            const requestWordLevelTimestamps: string = this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"false\").toLowerCase();\r\n            if (requestWordLevelTimestamps === \"true\") {\r\n                this.privSpeechContext.setWordLevelTimings();\r\n            } else {\r\n                const outputFormat: string = this.privRecognizerConfig.parameters.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]).toLowerCase();\r\n                if (outputFormat === OutputFormat[OutputFormat.Detailed].toLocaleLowerCase()) {\r\n                    this.privSpeechContext.setDetailedOutputFormat();\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    public get isSpeakerDiarizationEnabled(): boolean {\r\n        return this.privEnableSpeakerId;\r\n    }\r\n\r\n    public get audioSource(): IAudioSource {\r\n        return this.privAudioSource;\r\n    }\r\n\r\n    public get speechContext(): SpeechContext {\r\n        return this.privSpeechContext;\r\n    }\r\n\r\n    public get dynamicGrammar(): DynamicGrammarBuilder {\r\n        return this.privDynamicGrammar;\r\n    }\r\n\r\n    public get agentConfig(): AgentConfig {\r\n        return this.privAgentConfig;\r\n    }\r\n\r\n    public set conversationTranslatorToken(token: string) {\r\n        this.privRecognizerConfig.parameters.setProperty(PropertyId.ConversationTranslator_Token, token);\r\n    }\r\n\r\n    public set voiceProfileType(type: string) {\r\n        this.privRecognizerConfig.parameters.setProperty(PropertyId.SpeechServiceConnection_SpeakerIdMode, type);\r\n    }\r\n\r\n    public set authentication(auth: IAuthentication) {\r\n        this.privAuthentication = auth;\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public async dispose(reason?: string): Promise<void> {\r\n        this.privIsDisposed = true;\r\n        if (this.privConnectionConfigurationPromise !== undefined) {\r\n            try {\r\n                const connection: IConnection = await this.privConnectionConfigurationPromise;\r\n                await connection.dispose(reason);\r\n            } catch (error) {\r\n                // The connection is in a bad state. But we're trying to kill it, so...\r\n                return;\r\n            }\r\n        }\r\n    }\r\n\r\n    public get connectionEvents(): EventSource<ConnectionEvent> {\r\n        return this.privConnectionEvents;\r\n    }\r\n\r\n    public get serviceEvents(): EventSource<ServiceEvent> {\r\n        return this.privServiceEvents;\r\n    }\r\n\r\n    public get recognitionMode(): RecognitionMode {\r\n        return this.privRecognizerConfig.recognitionMode;\r\n    }\r\n\r\n    protected recognizeOverride: (recoMode: RecognitionMode, sc: (e: SpeechRecognitionResult) => void, ec: (e: string) => void) => Promise<void> = undefined;\r\n\r\n    public recognizeSpeaker: (model: SpeakerRecognitionModel) => Promise<SpeakerRecognitionResult> = undefined;\r\n\r\n    public async recognize(\r\n        recoMode: RecognitionMode,\r\n        successCallback: (e: SpeechRecognitionResult) => void,\r\n        errorCallBack: (e: string) => void,\r\n    ): Promise<void> {\r\n\r\n        if (this.recognizeOverride !== undefined) {\r\n            await this.recognizeOverride(recoMode, successCallback, errorCallBack);\r\n            return;\r\n        }\r\n        // Clear the existing configuration promise to force a re-transmission of config and context.\r\n        this.privConnectionConfigurationPromise = undefined;\r\n        this.privRecognizerConfig.recognitionMode = recoMode;\r\n        this.setSpeechSegmentationTimeoutJson();\r\n        this.setTranslationJson();\r\n\r\n        this.privSuccessCallback = successCallback;\r\n        this.privErrorCallback = errorCallBack;\r\n\r\n        this.privRequestSession.startNewRecognition();\r\n        this.privRequestSession.listenForServiceTelemetry(this.privAudioSource.events);\r\n\r\n        // Start the connection to the service. The promise this will create is stored and will be used by configureConnection().\r\n        const conPromise: Promise<IConnection> = this.connectImpl();\r\n        let audioNode: ReplayableAudioNode;\r\n\r\n        try {\r\n            const audioStreamNode: IAudioStreamNode = await this.audioSource.attach(this.privRequestSession.audioNodeId);\r\n            const format: AudioStreamFormatImpl = await this.audioSource.format;\r\n            const deviceInfo: ISpeechConfigAudioDevice = await this.audioSource.deviceInfo;\r\n            this.privIsLiveAudio = deviceInfo.type && deviceInfo.type === type.Microphones;\r\n\r\n            audioNode = new ReplayableAudioNode(audioStreamNode, format.avgBytesPerSec);\r\n            await this.privRequestSession.onAudioSourceAttachCompleted(audioNode, false);\r\n            this.privRecognizerConfig.SpeechServiceConfig.Context.audio = { source: deviceInfo };\r\n\r\n        } catch (error) {\r\n            await this.privRequestSession.onStopRecognizing();\r\n            throw error;\r\n        }\r\n\r\n        try {\r\n            await conPromise;\r\n        } catch (error) {\r\n            await this.cancelRecognitionLocal(CancellationReason.Error, CancellationErrorCode.ConnectionFailure, error as string);\r\n            return;\r\n        }\r\n\r\n        const sessionStartEventArgs: SessionEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\r\n\r\n        if (!!this.privRecognizer.sessionStarted) {\r\n            this.privRecognizer.sessionStarted(this.privRecognizer, sessionStartEventArgs);\r\n        }\r\n\r\n        void this.receiveMessage();\r\n        const audioSendPromise = this.sendAudio(audioNode);\r\n\r\n        audioSendPromise.catch(async (error: string): Promise<void> => {\r\n            await this.cancelRecognitionLocal(CancellationReason.Error, CancellationErrorCode.RuntimeError, error);\r\n        });\r\n\r\n        return;\r\n    }\r\n\r\n    public async stopRecognizing(): Promise<void> {\r\n        if (this.privRequestSession.isRecognizing) {\r\n            try {\r\n                await this.audioSource.turnOff();\r\n                await this.sendFinalAudio();\r\n                await this.privRequestSession.onStopRecognizing();\r\n                await this.privRequestSession.turnCompletionPromise;\r\n            } finally {\r\n                await this.privRequestSession.dispose();\r\n            }\r\n        }\r\n        return;\r\n    }\r\n\r\n    public async connect(): Promise<void> {\r\n        await this.connectImpl();\r\n        return Promise.resolve();\r\n    }\r\n\r\n    public connectAsync(cb?: Callback, err?: Callback): void {\r\n        this.connectImpl().then((): void => {\r\n            try {\r\n                if (!!cb) {\r\n                    cb();\r\n                }\r\n            } catch (e) {\r\n                if (!!err) {\r\n                    err(e);\r\n                }\r\n            }\r\n        }, (reason: any): void => {\r\n            try {\r\n                if (!!err) {\r\n                    err(reason);\r\n                }\r\n                /* eslint-disable no-empty */\r\n            } catch (error) {\r\n            }\r\n        });\r\n    }\r\n\r\n    protected disconnectOverride: () => Promise<void> = undefined;\r\n\r\n    public async disconnect(): Promise<void> {\r\n        await this.cancelRecognitionLocal(CancellationReason.Error,\r\n            CancellationErrorCode.NoError,\r\n            \"Disconnecting\");\r\n\r\n        if (this.disconnectOverride !== undefined) {\r\n            await this.disconnectOverride();\r\n        }\r\n\r\n        if (this.privConnectionPromise !== undefined) {\r\n            try {\r\n                await (await this.privConnectionPromise).dispose();\r\n            } catch (error) {\r\n\r\n            }\r\n        }\r\n        this.privConnectionPromise = undefined;\r\n    }\r\n\r\n    // Called when telemetry data is sent to the service.\r\n    // Used for testing Telemetry capture.\r\n    public static telemetryData: (json: string) => void;\r\n    public static telemetryDataEnabled: boolean = true;\r\n\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    public sendMessage(message: string): Promise<void> {\r\n        return;\r\n    }\r\n\r\n    public async sendNetworkMessage(path: string, payload: string | ArrayBuffer): Promise<void> {\r\n        const type: MessageType = typeof payload === \"string\" ? MessageType.Text : MessageType.Binary;\r\n        const contentType: string = typeof payload === \"string\" ? \"application/json\" : \"\";\r\n\r\n        const connection: IConnection = await this.fetchConnection();\r\n        return connection.send(new SpeechConnectionMessage(type, path, this.privRequestSession.requestId, contentType, payload));\r\n    }\r\n\r\n    public set activityTemplate(messagePayload: string) {\r\n        this.privActivityTemplate = messagePayload;\r\n    }\r\n\r\n    public get activityTemplate(): string {\r\n        return this.privActivityTemplate;\r\n    }\r\n\r\n    public set expectContentAssessmentResponse(value: boolean) {\r\n        this.privExpectContentAssessmentResponse = value;\r\n    }\r\n\r\n    protected abstract processTypeSpecificMessages(\r\n        connectionMessage: SpeechConnectionMessage,\r\n        successCallback?: (e: SpeechRecognitionResult) => void,\r\n        errorCallBack?: (e: string) => void): Promise<boolean>;\r\n\r\n    protected async sendTelemetryData(): Promise<void> {\r\n        const telemetryData = this.privRequestSession.getTelemetry();\r\n        if (ServiceRecognizerBase.telemetryDataEnabled !== true ||\r\n            this.privIsDisposed ||\r\n            null === telemetryData) {\r\n            return;\r\n        }\r\n\r\n        if (!!ServiceRecognizerBase.telemetryData) {\r\n            try {\r\n                ServiceRecognizerBase.telemetryData(telemetryData);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n\r\n        const connection: IConnection = await this.fetchConnection();\r\n        await connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"telemetry\",\r\n            this.privRequestSession.requestId,\r\n            \"application/json\",\r\n            telemetryData));\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected abstract cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void;\r\n\r\n    // Cancels recognition.\r\n    protected async cancelRecognitionLocal(\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): Promise<void> {\r\n\r\n        if (!!this.privRequestSession.isRecognizing) {\r\n            await this.privRequestSession.onStopRecognizing();\r\n\r\n            this.cancelRecognition(\r\n                this.privRequestSession.sessionId,\r\n                this.privRequestSession.requestId,\r\n                cancellationReason,\r\n                errorCode,\r\n                error);\r\n        }\r\n    }\r\n\r\n    protected receiveMessageOverride: () => Promise<void> = undefined;\r\n\r\n    protected async receiveMessage(): Promise<void> {\r\n        try {\r\n            if (this.privIsDisposed) {\r\n                // We're done.\r\n                return;\r\n            }\r\n\r\n            let connection = await this.fetchConnection();\r\n            const message = await connection.read();\r\n\r\n            if (this.receiveMessageOverride !== undefined) {\r\n                return this.receiveMessageOverride();\r\n            }\r\n\r\n            // indicates we are draining the queue and it came with no message;\r\n            if (!message) {\r\n                return this.receiveMessage();\r\n            }\r\n\r\n            this.privServiceHasSentMessage = true;\r\n            const connectionMessage = SpeechConnectionMessage.fromConnectionMessage(message);\r\n\r\n            if (connectionMessage.requestId.toLowerCase() === this.privRequestSession.requestId.toLowerCase()) {\r\n                switch (connectionMessage.path.toLowerCase()) {\r\n                    case \"turn.start\":\r\n                        this.privMustReportEndOfStream = true;\r\n                        this.privRequestSession.onServiceTurnStartResponse();\r\n                        break;\r\n\r\n                    case \"speech.startdetected\":\r\n                        const speechStartDetected: SpeechDetected = SpeechDetected.fromJSON(connectionMessage.textBody);\r\n                        const speechStartEventArgs = new RecognitionEventArgs(speechStartDetected.Offset, this.privRequestSession.sessionId);\r\n                        if (!!this.privRecognizer.speechStartDetected) {\r\n                            this.privRecognizer.speechStartDetected(this.privRecognizer, speechStartEventArgs);\r\n                        }\r\n                        break;\r\n\r\n                    case \"speech.enddetected\":\r\n                        let json: string;\r\n                        if (connectionMessage.textBody.length > 0) {\r\n                            json = connectionMessage.textBody;\r\n                        } else {\r\n                            // If the request was empty, the JSON returned is empty.\r\n                            json = \"{ Offset: 0 }\";\r\n                        }\r\n                        const speechStopDetected: SpeechDetected = SpeechDetected.fromJSON(json);\r\n                        const speechStopEventArgs = new RecognitionEventArgs(speechStopDetected.Offset + this.privRequestSession.currentTurnAudioOffset, this.privRequestSession.sessionId);\r\n                        if (!!this.privRecognizer.speechEndDetected) {\r\n                            this.privRecognizer.speechEndDetected(this.privRecognizer, speechStopEventArgs);\r\n                        }\r\n                        break;\r\n\r\n                    case \"turn.end\":\r\n                        await this.sendTelemetryData();\r\n                        if (this.privRequestSession.isSpeechEnded && this.privMustReportEndOfStream) {\r\n                            this.privMustReportEndOfStream = false;\r\n                            await this.cancelRecognitionLocal(CancellationReason.EndOfStream, CancellationErrorCode.NoError, undefined);\r\n                        }\r\n                        const sessionStopEventArgs: SessionEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\r\n                        await this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition);\r\n                        if (!this.privRecognizerConfig.isContinuousRecognition || this.privRequestSession.isSpeechEnded || !this.privRequestSession.isRecognizing) {\r\n                            if (!!this.privRecognizer.sessionStopped) {\r\n                                this.privRecognizer.sessionStopped(this.privRecognizer, sessionStopEventArgs);\r\n                            }\r\n                            return;\r\n                        } else {\r\n                            connection = await this.fetchConnection();\r\n                            await this.sendPrePayloadJSON(connection);\r\n                        }\r\n                        break;\r\n\r\n                    default:\r\n                        if (!await this.processTypeSpecificMessages(connectionMessage)) {\r\n                            // here are some messages that the derived class has not processed, dispatch them to connect class\r\n                            if (!!this.privServiceEvents) {\r\n                                this.serviceEvents.onEvent(new ServiceEvent(connectionMessage.path.toLowerCase(), connectionMessage.textBody));\r\n                            }\r\n                        }\r\n                }\r\n            }\r\n            return this.receiveMessage();\r\n        } catch (error) {\r\n            return null;\r\n        }\r\n    }\r\n\r\n    private updateSpeakerDiarizationAudioOffset(): void {\r\n        const bytesSent: number = this.privRequestSession.recognitionBytesSent;\r\n        const audioOffsetMs: number = bytesSent / this.privAverageBytesPerMs;\r\n        this.privSpeechContext.setSpeakerDiarizationAudioOffsetMs(audioOffsetMs);\r\n    }\r\n\r\n    protected sendSpeechContext(connection: IConnection, generateNewRequestId: boolean): Promise<void> {\r\n        if (this.privEnableSpeakerId) {\r\n            this.updateSpeakerDiarizationAudioOffset();\r\n        }\r\n        const speechContextJson = this.speechContext.toJSON();\r\n        if (generateNewRequestId) {\r\n            this.privRequestSession.onSpeechContext();\r\n        }\r\n\r\n        if (speechContextJson) {\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"speech.context\",\r\n                this.privRequestSession.requestId,\r\n                \"application/json\",\r\n                speechContextJson));\r\n        }\r\n        return;\r\n    }\r\n\r\n    protected sendPrePayloadJSONOverride: (connection: IConnection) => Promise<void> = undefined;\r\n\r\n    protected noOp(): Promise<void> {\r\n        // operation not supported\r\n        return;\r\n    }\r\n\r\n    // Encapsulated for derived service recognizers that need to send additional JSON\r\n    protected async sendPrePayloadJSON(connection: IConnection, generateNewRequestId: boolean = true): Promise<void> {\r\n        if (this.sendPrePayloadJSONOverride !== undefined) {\r\n            return this.sendPrePayloadJSONOverride(connection);\r\n        }\r\n\r\n        await this.sendSpeechContext(connection, generateNewRequestId);\r\n        await this.sendWaveHeader(connection);\r\n        return;\r\n    }\r\n\r\n    protected async sendWaveHeader(connection: IConnection): Promise<void> {\r\n        const format: AudioStreamFormatImpl = await this.audioSource.format;\r\n        // this.writeBufferToConsole(format.header);\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Binary,\r\n            \"audio\",\r\n            this.privRequestSession.requestId,\r\n            \"audio/x-wav\",\r\n            format.header\r\n        ));\r\n    }\r\n\r\n    protected postConnectImplOverride: (connection: Promise<IConnection>) => Promise<IConnection> = undefined;\r\n\r\n    // Establishes a websocket connection to the end point.\r\n    protected connectImpl(): Promise<IConnection> {\r\n        if (this.privConnectionPromise !== undefined) {\r\n            return this.privConnectionPromise.then((connection: IConnection): Promise<IConnection> => {\r\n                if (connection.state() === ConnectionState.Disconnected) {\r\n                    this.privConnectionId = null;\r\n                    this.privConnectionPromise = undefined;\r\n                    this.privServiceHasSentMessage = false;\r\n                    return this.connectImpl();\r\n                }\r\n                return this.privConnectionPromise;\r\n            }, (): Promise<IConnection> => {\r\n                this.privConnectionId = null;\r\n                this.privConnectionPromise = undefined;\r\n                this.privServiceHasSentMessage = false;\r\n                return this.connectImpl();\r\n            });\r\n        }\r\n\r\n        this.privConnectionPromise = this.retryableConnect();\r\n\r\n        // Attach an empty handler to allow the promise to run in the background while\r\n        // other startup events happen. It'll eventually be awaited on.\r\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n        this.privConnectionPromise.catch((): void => { });\r\n\r\n        if (this.postConnectImplOverride !== undefined) {\r\n            return this.postConnectImplOverride(this.privConnectionPromise);\r\n        }\r\n\r\n        return this.privConnectionPromise;\r\n    }\r\n\r\n    protected configConnectionOverride: (connection: IConnection) => Promise<IConnection> = undefined;\r\n    protected handleSpeechPhraseMessage: (textBody: string) => Promise<void> = undefined;\r\n    protected handleSpeechHypothesisMessage: (textBody: string) => void = undefined;\r\n\r\n    protected sendSpeechServiceConfig(connection: IConnection, requestSession: RequestSession, SpeechServiceConfigJson: string): Promise<void> {\r\n        requestSession.onSpeechContext();\r\n        // filter out anything that is not required for the service to work.\r\n        if (ServiceRecognizerBase.telemetryDataEnabled !== true) {\r\n            const withTelemetry: { context: { system: string } } = JSON.parse(SpeechServiceConfigJson) as { context: { system: string } };\r\n\r\n            const replacement: any = {\r\n                context: {\r\n                    system: withTelemetry.context.system,\r\n                },\r\n            };\r\n\r\n            SpeechServiceConfigJson = JSON.stringify(replacement);\r\n        }\r\n\r\n        if (this.privRecognizerConfig.parameters.getProperty(\"f0f5debc-f8c9-4892-ac4b-90a7ab359fd2\", \"false\").toLowerCase() === \"true\") {\r\n            const json: { context: { DisableReferenceChannel: string; MicSpec: string } } = JSON.parse(SpeechServiceConfigJson) as { context: { DisableReferenceChannel: string; MicSpec: string } };\r\n            json.context.DisableReferenceChannel = \"True\";\r\n            json.context.MicSpec = \"1_0_0\";\r\n            SpeechServiceConfigJson = JSON.stringify(json);\r\n        }\r\n\r\n        if (SpeechServiceConfigJson) {\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"speech.config\",\r\n                requestSession.requestId,\r\n                \"application/json\",\r\n                SpeechServiceConfigJson));\r\n        }\r\n\r\n        return;\r\n    }\r\n\r\n    protected async fetchConnection(): Promise<IConnection> {\r\n        if (this.privConnectionConfigurationPromise !== undefined) {\r\n            return this.privConnectionConfigurationPromise.then((connection: IConnection): Promise<IConnection> => {\r\n                if (connection.state() === ConnectionState.Disconnected) {\r\n                    this.privConnectionId = null;\r\n                    this.privConnectionConfigurationPromise = undefined;\r\n                    this.privServiceHasSentMessage = false;\r\n                    return this.fetchConnection();\r\n                }\r\n                return this.privConnectionConfigurationPromise;\r\n            }, (): Promise<IConnection> => {\r\n                this.privConnectionId = null;\r\n                this.privConnectionConfigurationPromise = undefined;\r\n                this.privServiceHasSentMessage = false;\r\n                return this.fetchConnection();\r\n            });\r\n        }\r\n\r\n        this.privConnectionConfigurationPromise = this.configureConnection();\r\n        return await this.privConnectionConfigurationPromise;\r\n    }\r\n\r\n    protected async sendAudio(audioStreamNode: IAudioStreamNode): Promise<void> {\r\n        const audioFormat: AudioStreamFormatImpl = await this.audioSource.format;\r\n        this.privAverageBytesPerMs = audioFormat.avgBytesPerSec / 1000;\r\n        // The time we last sent data to the service.\r\n        let nextSendTime: number = Date.now();\r\n\r\n        // Max amount to send before we start to throttle\r\n        const fastLaneSizeMs: string = this.privRecognizerConfig.parameters.getProperty(\"SPEECH-TransmitLengthBeforThrottleMs\", \"5000\");\r\n        const maxSendUnthrottledBytes: number = audioFormat.avgBytesPerSec / 1000 * parseInt(fastLaneSizeMs, 10);\r\n        const startRecogNumber: number = this.privRequestSession.recogNumber;\r\n\r\n        const readAndUploadCycle = async (): Promise<void> => {\r\n            // If speech is done, stop sending audio.\r\n            if (!this.privIsDisposed &&\r\n                !this.privRequestSession.isSpeechEnded &&\r\n                this.privRequestSession.isRecognizing &&\r\n                this.privRequestSession.recogNumber === startRecogNumber) {\r\n\r\n                const connection: IConnection = await this.fetchConnection();\r\n                const audioStreamChunk: IStreamChunk<ArrayBuffer> = await audioStreamNode.read();\r\n                // we have a new audio chunk to upload.\r\n                if (this.privRequestSession.isSpeechEnded) {\r\n                    // If service already recognized audio end then don't send any more audio\r\n                    return;\r\n                }\r\n\r\n                let payload: ArrayBuffer;\r\n                let sendDelay: number;\r\n\r\n                if (!audioStreamChunk || audioStreamChunk.isEnd) {\r\n                    payload = null;\r\n                    sendDelay = 0;\r\n                } else {\r\n                    payload = audioStreamChunk.buffer;\r\n\r\n                    this.privRequestSession.onAudioSent(payload.byteLength);\r\n\r\n                    if (maxSendUnthrottledBytes >= this.privRequestSession.bytesSent) {\r\n                        sendDelay = 0;\r\n                    } else {\r\n                        sendDelay = Math.max(0, nextSendTime - Date.now());\r\n                    }\r\n                }\r\n\r\n                if (0 !== sendDelay) {\r\n                    await this.delay(sendDelay);\r\n                }\r\n\r\n                if (payload !== null) {\r\n                    nextSendTime = Date.now() + (payload.byteLength * 1000 / (audioFormat.avgBytesPerSec * 2));\r\n                }\r\n\r\n                // Are we still alive?\r\n                if (!this.privIsDisposed &&\r\n                    !this.privRequestSession.isSpeechEnded &&\r\n                    this.privRequestSession.isRecognizing &&\r\n                    this.privRequestSession.recogNumber === startRecogNumber) {\r\n                    connection.send(\r\n                        new SpeechConnectionMessage(MessageType.Binary, \"audio\", this.privRequestSession.requestId, null, payload)\r\n                    ).catch((): void => {\r\n                        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n                        this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition).catch((): void => { });\r\n                    });\r\n\r\n                    if (!audioStreamChunk?.isEnd) {\r\n                        // this.writeBufferToConsole(payload);\r\n                        // Regardless of success or failure, schedule the next upload.\r\n                        // If the underlying connection was broken, the next cycle will\r\n                        // get a new connection and re-transmit missing audio automatically.\r\n                        return readAndUploadCycle();\r\n                    } else {\r\n                        // the audio stream has been closed, no need to schedule next\r\n                        // read-upload cycle.\r\n                        if (!this.privIsLiveAudio) {\r\n                            this.privRequestSession.onSpeechEnded();\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        };\r\n\r\n        return readAndUploadCycle();\r\n    }\r\n\r\n    private async retryableConnect(): Promise<IConnection> {\r\n        let isUnAuthorized: boolean = false;\r\n\r\n        this.privAuthFetchEventId = createNoDashGuid();\r\n        const sessionId: string = this.privRequestSession.sessionId;\r\n        this.privConnectionId = (sessionId !== undefined) ? sessionId : createNoDashGuid();\r\n\r\n        this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId, this.privConnectionId);\r\n        let lastStatusCode: number = 0;\r\n        let lastReason: string = \"\";\r\n\r\n        while (this.privRequestSession.numConnectionAttempts <= this.privRecognizerConfig.maxRetryCount) {\r\n\r\n            // Get the auth information for the connection. This is a bit of overkill for the current API surface, but leaving the plumbing in place to be able to raise a developer-customer\r\n            // facing event when a connection fails to let them try and provide new auth information.\r\n            const authPromise = isUnAuthorized ? this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId) : this.privAuthentication.fetch(this.privAuthFetchEventId);\r\n            const auth: AuthInfo = await authPromise;\r\n\r\n            await this.privRequestSession.onAuthCompleted(false);\r\n\r\n            // Create the connection\r\n            const connection: IConnection = this.privConnectionFactory.create(this.privRecognizerConfig, auth, this.privConnectionId);\r\n            // Attach the telemetry handlers.\r\n            this.privRequestSession.listenForServiceTelemetry(connection.events);\r\n\r\n            // Attach to the underlying event. No need to hold onto the detach pointers as in the event the connection goes away,\r\n            // it'll stop sending events.\r\n            connection.events.attach((event: ConnectionEvent): void => {\r\n                this.connectionEvents.onEvent(event);\r\n            });\r\n\r\n            const response: ConnectionOpenResponse = await connection.open();\r\n            // 200 == everything is fine.\r\n            if (response.statusCode === 200) {\r\n                await this.privRequestSession.onConnectionEstablishCompleted(response.statusCode);\r\n                return Promise.resolve(connection);\r\n            } else if (response.statusCode === 1006) {\r\n                isUnAuthorized = true;\r\n            }\r\n\r\n            lastStatusCode = response.statusCode;\r\n            lastReason = response.reason;\r\n\r\n            this.privRequestSession.onRetryConnection();\r\n        }\r\n\r\n        await this.privRequestSession.onConnectionEstablishCompleted(lastStatusCode, lastReason);\r\n        return Promise.reject(`Unable to contact server. StatusCode: ${lastStatusCode}, ${this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint)} Reason: ${lastReason}`);\r\n    }\r\n\r\n    private delay(delayMs: number): Promise<void> {\r\n        return new Promise((resolve: () => void): number => this.privSetTimeout(resolve, delayMs));\r\n    }\r\n\r\n    private writeBufferToConsole(buffer: ArrayBuffer): void {\r\n        let out: string = \"Buffer Size: \";\r\n        if (null === buffer) {\r\n            out += \"null\";\r\n        } else {\r\n            const readView: Uint8Array = new Uint8Array(buffer);\r\n            out += `${buffer.byteLength}\\r\\n`;\r\n            for (let i: number = 0; i < buffer.byteLength; i++) {\r\n                out += readView[i].toString(16).padStart(2, \"0\") + \" \";\r\n                if (((i + 1) % 16) === 0) {\r\n                    // eslint-disable-next-line no-console\r\n                    console.info(out);\r\n                    out = \"\";\r\n                }\r\n            }\r\n        }\r\n        // eslint-disable-next-line no-console\r\n        console.info(out);\r\n    }\r\n\r\n    private async sendFinalAudio(): Promise<void> {\r\n        const connection: IConnection = await this.fetchConnection();\r\n        await connection.send(new SpeechConnectionMessage(MessageType.Binary, \"audio\", this.privRequestSession.requestId, null, null));\r\n        return;\r\n    }\r\n\r\n    // Takes an established websocket connection to the endpoint and sends speech configuration information.\r\n    private async configureConnection(): Promise<IConnection> {\r\n        const connection: IConnection = await this.connectImpl();\r\n        if (this.configConnectionOverride !== undefined) {\r\n            return this.configConnectionOverride(connection);\r\n        }\r\n        await this.sendSpeechServiceConfig(connection, this.privRequestSession, this.privRecognizerConfig.SpeechServiceConfig.serialize());\r\n        await this.sendPrePayloadJSON(connection, false);\r\n        return connection;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ArgumentNullError, ConnectionMessage, IStringDictionary, MessageType } from \"../common/Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\n\r\nexport class SpeechConnectionMessage extends ConnectionMessage {\r\n\r\n    private privPath: string;\r\n    private privRequestId: string;\r\n    private privContentType: string;\r\n    private privStreamId: string;\r\n    private privAdditionalHeaders: IStringDictionary<string>;\r\n\r\n    public constructor(\r\n        messageType: MessageType,\r\n        path: string,\r\n        requestId: string,\r\n        contentType: string,\r\n        body: any,\r\n        streamId?: string,\r\n        additionalHeaders?: IStringDictionary<string>,\r\n        id?: string) {\r\n\r\n        if (!path) {\r\n            throw new ArgumentNullError(\"path\");\r\n        }\r\n\r\n        if (!requestId) {\r\n            throw new ArgumentNullError(\"requestId\");\r\n        }\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n        headers[HeaderNames.Path] = path;\r\n        headers[HeaderNames.RequestId] = requestId;\r\n        headers[HeaderNames.RequestTimestamp] = new Date().toISOString();\r\n        if (contentType) {\r\n            headers[HeaderNames.ContentType] = contentType;\r\n        }\r\n\r\n        if (streamId) {\r\n            headers[HeaderNames.RequestStreamId] = streamId;\r\n        }\r\n\r\n        if (additionalHeaders) {\r\n            for (const headerName in additionalHeaders) {\r\n                if (headerName) {\r\n                    headers[headerName] = additionalHeaders[headerName];\r\n                }\r\n\r\n            }\r\n        }\r\n\r\n        if (id) {\r\n            super(messageType, body, headers, id);\r\n        } else {\r\n            super(messageType, body, headers);\r\n        }\r\n\r\n        this.privPath = path;\r\n        this.privRequestId = requestId;\r\n        this.privContentType = contentType;\r\n        this.privStreamId = streamId;\r\n        this.privAdditionalHeaders = additionalHeaders;\r\n    }\r\n\r\n    public get path(): string {\r\n        return this.privPath;\r\n    }\r\n\r\n    public get requestId(): string {\r\n        return this.privRequestId;\r\n    }\r\n\r\n    public get contentType(): string {\r\n        return this.privContentType;\r\n    }\r\n\r\n    public get streamId(): string {\r\n        return this.privStreamId;\r\n    }\r\n\r\n    public get additionalHeaders(): IStringDictionary<string> {\r\n        return this.privAdditionalHeaders;\r\n    }\r\n\r\n    public static fromConnectionMessage(message: ConnectionMessage): SpeechConnectionMessage {\r\n        let path = null;\r\n        let requestId = null;\r\n        let contentType = null;\r\n        // let requestTimestamp = null;\r\n        let streamId = null;\r\n        const additionalHeaders: IStringDictionary<string> = {};\r\n\r\n        if (message.headers) {\r\n            for (const headerName in message.headers) {\r\n                if (headerName) {\r\n                    if (headerName.toLowerCase() === HeaderNames.Path.toLowerCase()) {\r\n                        path = message.headers[headerName];\r\n                    } else if (headerName.toLowerCase() === HeaderNames.RequestId.toLowerCase()) {\r\n                        requestId = message.headers[headerName];\r\n                    // } else if (headerName.toLowerCase() === HeaderNames.RequestTimestamp.toLowerCase()) {\r\n                       //  requestTimestamp = message.headers[headerName];\r\n                    } else if (headerName.toLowerCase() === HeaderNames.ContentType.toLowerCase()) {\r\n                        contentType = message.headers[headerName];\r\n                    } else if (headerName.toLowerCase() === HeaderNames.RequestStreamId.toLowerCase()) {\r\n                        streamId = message.headers[headerName];\r\n                    } else {\r\n                        additionalHeaders[headerName] = message.headers[headerName];\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        return new SpeechConnectionMessage(\r\n            message.messageType,\r\n            path,\r\n            requestId,\r\n            contentType,\r\n            message.body,\r\n            streamId,\r\n            additionalHeaders,\r\n            message.id);\r\n    }\r\n}\r\n","import { IAudioSource } from \"../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    OutputFormat,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    ResultReason,\r\n    SpeechRecognitionResult\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    DetailedSpeechPhrase,\r\n    EnumTranslation,\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    OutputFormatPropertyName,\r\n    RecognitionStatus,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SimpleSpeechPhrase,\r\n    SpeechHypothesis\r\n} from \"./Exports.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\nexport class ConversationServiceRecognizer extends ServiceRecognizerBase {\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        recognizer: Recognizer) {\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, recognizer);\r\n        this.handleSpeechPhraseMessage = async (textBody: string): Promise<void> => this.handleSpeechPhrase(textBody);\r\n        this.handleSpeechHypothesisMessage = (textBody: string): void => this.handleSpeechHypothesis(textBody);\r\n    }\r\n\r\n    protected processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n        void connectionMessage;\r\n        return;\r\n    }\r\n\r\n    protected handleRecognizedCallback(result: SpeechRecognitionResult, offset: number, sessionId: string): void {\r\n        void result;\r\n        void offset;\r\n        void sessionId;\r\n        return;\r\n    }\r\n\r\n    protected handleRecognizingCallback(result: SpeechRecognitionResult, duration: number, sessionId: string): void {\r\n        void result;\r\n        void duration;\r\n        void sessionId;\r\n        return;\r\n    }\r\n\r\n    protected async processSpeechMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n        let processed: boolean = false;\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            case \"speech.hypothesis\":\r\n            case \"speech.fragment\":\r\n                if (!!this.handleSpeechHypothesisMessage) {\r\n                    this.handleSpeechHypothesisMessage(connectionMessage.textBody);\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"speech.phrase\":\r\n                if (!!this.handleSpeechPhraseMessage) {\r\n                    await this.handleSpeechPhraseMessage(connectionMessage.textBody);\r\n                }\r\n                processed = true;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        return processed;\r\n    }\r\n\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n            // Implementing to allow inheritance\r\n            void sessionId;\r\n            void requestId;\r\n            void cancellationReason;\r\n            void errorCode;\r\n            void error;\r\n        }\r\n\r\n    protected async handleSpeechPhrase(textBody: string): Promise<void> {\r\n\r\n        const simple: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(textBody);\r\n        const resultReason: ResultReason = EnumTranslation.implTranslateRecognitionResult(simple.RecognitionStatus);\r\n        let result: SpeechRecognitionResult;\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, textBody);\r\n        const simpleOffset = simple.Offset + this.privRequestSession.currentTurnAudioOffset;\r\n        let offset = simpleOffset;\r\n\r\n        this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + simple.Offset + simple.Duration);\r\n\r\n        if (ResultReason.Canceled === resultReason) {\r\n            const cancelReason: CancellationReason = EnumTranslation.implTranslateCancelResult(simple.RecognitionStatus);\r\n            const cancellationErrorCode: CancellationErrorCode = EnumTranslation.implTranslateCancelErrorCode(simple.RecognitionStatus);\r\n\r\n            await this.cancelRecognitionLocal(\r\n                cancelReason,\r\n                cancellationErrorCode,\r\n                EnumTranslation.implTranslateErrorDetails(cancellationErrorCode));\r\n\r\n        } else {\r\n            if (!(this.privRequestSession.isSpeechEnded && resultReason === ResultReason.NoMatch && simple.RecognitionStatus !== RecognitionStatus.InitialSilenceTimeout)) {\r\n                if (this.privRecognizerConfig.parameters.getProperty(OutputFormatPropertyName) === OutputFormat[OutputFormat.Simple]) {\r\n                    result = new SpeechRecognitionResult(\r\n                        this.privRequestSession.requestId,\r\n                        resultReason,\r\n                        simple.DisplayText,\r\n                        simple.Duration,\r\n                        simpleOffset,\r\n                        simple.Language,\r\n                        simple.LanguageDetectionConfidence,\r\n                        simple.SpeakerId,\r\n                        undefined,\r\n                        textBody,\r\n                        resultProps);\r\n                } else {\r\n                    const detailed: DetailedSpeechPhrase = DetailedSpeechPhrase.fromJSON(textBody);\r\n                    const totalOffset: number = detailed.Offset + this.privRequestSession.currentTurnAudioOffset;\r\n                    const offsetCorrectedJson: string = detailed.getJsonWithCorrectedOffsets(totalOffset);\r\n\r\n                    result = new SpeechRecognitionResult(\r\n                        this.privRequestSession.requestId,\r\n                        resultReason,\r\n                        detailed.Text,\r\n                        detailed.Duration,\r\n                        totalOffset,\r\n                        detailed.Language,\r\n                        detailed.LanguageDetectionConfidence,\r\n                        detailed.SpeakerId,\r\n                        undefined,\r\n                        offsetCorrectedJson,\r\n                        resultProps);\r\n\r\n                        offset = result.offset;\r\n                }\r\n\r\n                this.handleRecognizedCallback(result, offset, this.privRequestSession.sessionId);\r\n            }\r\n        }\r\n    }\r\n\r\n    protected handleSpeechHypothesis(textBody: string): void {\r\n        const hypothesis: SpeechHypothesis = SpeechHypothesis.fromJSON(textBody);\r\n        const offset: number = hypothesis.Offset + this.privRequestSession.currentTurnAudioOffset;\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, textBody);\r\n\r\n        const result = new SpeechRecognitionResult(\r\n            this.privRequestSession.requestId,\r\n            ResultReason.RecognizingSpeech,\r\n            hypothesis.Text,\r\n            hypothesis.Duration,\r\n            offset,\r\n            hypothesis.Language,\r\n            hypothesis.LanguageDetectionConfidence,\r\n            hypothesis.SpeakerId,\r\n            undefined,\r\n            textBody,\r\n            resultProps);\r\n\r\n        this.privRequestSession.onHypothesis(offset);\r\n\r\n        this.handleRecognizingCallback(result, hypothesis.Duration, this.privRequestSession.sessionId);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { PropertyCollection, PropertyId } from \"../sdk/Exports.js\";\r\nimport { Context, SpeechServiceConfig } from \"./Exports.js\";\r\n\r\nexport enum RecognitionMode {\r\n    Interactive,\r\n    Conversation,\r\n    Dictation,\r\n}\r\n\r\nexport enum SpeechResultFormat {\r\n    Simple,\r\n    Detailed,\r\n}\r\n\r\nexport class RecognizerConfig {\r\n    private privRecognitionMode: RecognitionMode;\r\n    private privLanguageIdMode: string;\r\n    private privSpeechServiceConfig: SpeechServiceConfig;\r\n    private privRecognitionActivityTimeout: number;\r\n    private privParameters: PropertyCollection;\r\n    private privMaxRetryCount: number;\r\n    private privEnableSpeakerId: boolean;\r\n\r\n    public constructor(\r\n        speechServiceConfig: SpeechServiceConfig,\r\n        parameters: PropertyCollection) {\r\n        this.privSpeechServiceConfig = speechServiceConfig ? speechServiceConfig : new SpeechServiceConfig(new Context(null));\r\n        this.privParameters = parameters;\r\n        this.privMaxRetryCount = parseInt(parameters.getProperty(\"SPEECH-Error-MaxRetryCount\", \"4\"), 10);\r\n        this.privLanguageIdMode = parameters.getProperty(PropertyId.SpeechServiceConnection_LanguageIdMode, undefined);\r\n        this.privEnableSpeakerId = false;\r\n    }\r\n\r\n    public get parameters(): PropertyCollection {\r\n        return this.privParameters;\r\n    }\r\n\r\n    public get recognitionMode(): RecognitionMode {\r\n        return this.privRecognitionMode;\r\n    }\r\n\r\n    public set recognitionMode(value: RecognitionMode) {\r\n        this.privRecognitionMode = value;\r\n        this.privRecognitionActivityTimeout = value === RecognitionMode.Interactive ? 8000 : 25000;\r\n        this.privSpeechServiceConfig.Recognition = RecognitionMode[value];\r\n    }\r\n\r\n    public get SpeechServiceConfig(): SpeechServiceConfig {\r\n        return this.privSpeechServiceConfig;\r\n    }\r\n\r\n    public get recognitionActivityTimeout(): number {\r\n        return this.privRecognitionActivityTimeout;\r\n    }\r\n\r\n    public get isContinuousRecognition(): boolean {\r\n        return this.privRecognitionMode !== RecognitionMode.Interactive;\r\n    }\r\n\r\n    public get languageIdMode(): string {\r\n        return this.privLanguageIdMode;\r\n    }\r\n\r\n    public get autoDetectSourceLanguages(): string {\r\n        return this.parameters.getProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, undefined);\r\n    }\r\n\r\n    public get recognitionEndpointVersion(): string {\r\n        return this.parameters.getProperty(PropertyId.SpeechServiceConnection_RecognitionEndpointVersion, undefined);\r\n    }\r\n\r\n    public get sourceLanguageModels(): { language: string; endpoint: string }[] {\r\n        const models: { language: string; endpoint: string }[] = [];\r\n        let modelsExist: boolean = false;\r\n        if (this.autoDetectSourceLanguages !== undefined) {\r\n            for (const language of this.autoDetectSourceLanguages.split(\",\")) {\r\n                const customProperty = language + PropertyId.SpeechServiceConnection_EndpointId.toString();\r\n                const modelId: string = this.parameters.getProperty(customProperty, undefined);\r\n                if (modelId !== undefined) {\r\n                    models.push( { language, endpoint: modelId });\r\n                    modelsExist = true;\r\n                } else {\r\n                    models.push( { language, endpoint: \"\" } );\r\n                }\r\n            }\r\n        }\r\n        return modelsExist ? models : undefined;\r\n    }\r\n\r\n    public get maxRetryCount(): number {\r\n        return this.privMaxRetryCount;\r\n    }\r\n\r\n    public get isSpeakerDiarizationEnabled(): boolean {\r\n        return this.privEnableSpeakerId;\r\n    }\r\n\r\n    public set isSpeakerDiarizationEnabled(value: boolean) {\r\n        this.privEnableSpeakerId = value;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ConnectionMessage,\r\n    Deferred,\r\n    IStringDictionary,\r\n    IWebsocketMessageFormatter,\r\n    MessageType,\r\n    RawWebsocketMessage,\r\n} from \"../common/Exports.js\";\r\n\r\nconst CRLF: string = \"\\r\\n\";\r\n\r\nexport class WebsocketMessageFormatter implements IWebsocketMessageFormatter {\r\n\r\n    public toConnectionMessage(message: RawWebsocketMessage): Promise<ConnectionMessage> {\r\n        const deferral = new Deferred<ConnectionMessage>();\r\n\r\n        try {\r\n            if (message.messageType === MessageType.Text) {\r\n                const textMessage: string = message.textContent;\r\n                let headers: IStringDictionary<string> = {};\r\n                let body: string = null;\r\n\r\n                if (textMessage) {\r\n                    const headerBodySplit = textMessage.split(\"\\r\\n\\r\\n\");\r\n                    if (headerBodySplit && headerBodySplit.length > 0) {\r\n                        headers = this.parseHeaders(headerBodySplit[0]);\r\n                        if (headerBodySplit.length > 1) {\r\n                            body = headerBodySplit[1];\r\n                        }\r\n                    }\r\n                }\r\n\r\n                deferral.resolve(new ConnectionMessage(message.messageType, body, headers, message.id));\r\n            } else if (message.messageType === MessageType.Binary) {\r\n                const binaryMessage: ArrayBuffer = message.binaryContent;\r\n                let headers: IStringDictionary<string> = {};\r\n                let body: ArrayBuffer = null;\r\n\r\n                if (!binaryMessage || binaryMessage.byteLength < 2) {\r\n                    throw new Error(\"Invalid binary message format. Header length missing.\");\r\n                }\r\n\r\n                const dataView = new DataView(binaryMessage);\r\n                const headerLength = dataView.getInt16(0);\r\n\r\n                if (binaryMessage.byteLength < headerLength + 2) {\r\n                    throw new Error(\"Invalid binary message format. Header content missing.\");\r\n                }\r\n\r\n                let headersString = \"\";\r\n                for (let i = 0; i < headerLength; i++) {\r\n                    headersString += String.fromCharCode((dataView).getInt8(i + 2));\r\n                }\r\n\r\n                headers = this.parseHeaders(headersString);\r\n\r\n                if (binaryMessage.byteLength > headerLength + 2) {\r\n                    body = binaryMessage.slice(2 + headerLength);\r\n                }\r\n\r\n                deferral.resolve(new ConnectionMessage(message.messageType, body, headers, message.id));\r\n            }\r\n        } catch (e) {\r\n            deferral.reject(`Error formatting the message. Error: ${e as string}`);\r\n        }\r\n\r\n        return deferral.promise;\r\n    }\r\n\r\n    public fromConnectionMessage(message: ConnectionMessage): Promise<RawWebsocketMessage> {\r\n        const deferral = new Deferred<RawWebsocketMessage>();\r\n\r\n        try {\r\n            if (message.messageType === MessageType.Text) {\r\n                const payload = `${this.makeHeaders(message)}${CRLF}${message.textBody ? message.textBody : \"\"}`;\r\n\r\n                deferral.resolve(new RawWebsocketMessage(MessageType.Text, payload, message.id));\r\n\r\n            } else if (message.messageType === MessageType.Binary) {\r\n                const headersString = this.makeHeaders(message);\r\n                const content = message.binaryBody;\r\n\r\n                const headerBuffer = this.stringToArrayBuffer(headersString);\r\n                const headerInt8Array = new Int8Array(headerBuffer);\r\n                const headerLength = headerInt8Array.byteLength;\r\n\r\n                const payloadInt8Array = new Int8Array(2 + headerLength + (content ? content.byteLength : 0));\r\n                payloadInt8Array[0] = ((headerLength >> 8) & 0xff);\r\n                payloadInt8Array[1] = headerLength & 0xff;\r\n                payloadInt8Array.set(headerInt8Array, 2);\r\n\r\n                if (content) {\r\n                    const bodyInt8Array = new Int8Array(content);\r\n                    payloadInt8Array.set(bodyInt8Array, 2 + headerLength);\r\n                }\r\n\r\n                const payload: ArrayBuffer = payloadInt8Array.buffer;\r\n\r\n                deferral.resolve(new RawWebsocketMessage(MessageType.Binary, payload, message.id));\r\n            }\r\n        } catch (e) {\r\n            deferral.reject(`Error formatting the message. ${e as string}`);\r\n        }\r\n\r\n        return deferral.promise;\r\n    }\r\n\r\n    private makeHeaders(message: ConnectionMessage): string {\r\n        let headersString: string = \"\";\r\n\r\n        if (message.headers) {\r\n            for (const header in message.headers) {\r\n                if (header) {\r\n                    headersString += `${header}: ${message.headers[header]}${CRLF}`;\r\n                }\r\n            }\r\n        }\r\n\r\n        return headersString;\r\n    }\r\n\r\n    private parseHeaders(headersString: string): IStringDictionary<string> {\r\n        const headers: IStringDictionary<string> = {};\r\n\r\n        if (headersString) {\r\n            const headerMatches = headersString.match(/[^\\r\\n]+/g);\r\n            if (headers) {\r\n                for (const header of headerMatches) {\r\n                    if (header) {\r\n                        const separatorIndex = header.indexOf(\":\");\r\n                        const headerName = separatorIndex > 0 ? header.substr(0, separatorIndex).trim().toLowerCase() : header;\r\n                        const headerValue =\r\n                            separatorIndex > 0 && header.length > (separatorIndex + 1) ?\r\n                                header.substr(separatorIndex + 1).trim() :\r\n                                \"\";\r\n\r\n                        headers[headerName] = headerValue;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        return headers;\r\n    }\r\n\r\n    private stringToArrayBuffer(str: string): ArrayBuffer {\r\n        const buffer = new ArrayBuffer(str.length);\r\n        const view = new DataView(buffer);\r\n        for (let i = 0; i < str.length; i++) {\r\n            view.setUint8(i, str.charCodeAt(i));\r\n        }\r\n        return buffer;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection,\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    ForceDictationPropertyName,\r\n    OutputFormatPropertyName,\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    OutputFormat,\r\n    PropertyId\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    RecognitionMode,\r\n    RecognizerConfig,\r\n    WebsocketMessageFormatter\r\n} from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport {\r\n    QueryParameterNames\r\n} from \"./QueryParameterNames.js\";\r\n\r\nexport class SpeechConnectionFactory extends ConnectionFactoryBase {\r\n\r\n    private readonly interactiveRelativeUri: string = \"/speech/recognition/interactive/cognitiveservices/v1\";\r\n    private readonly conversationRelativeUri: string = \"/speech/recognition/conversation/cognitiveservices/v1\";\r\n    private readonly dictationRelativeUri: string = \"/speech/recognition/dictation/cognitiveservices/v1\";\r\n    private readonly universalUri: string = \"/speech/universal/v\";\r\n\r\n    public create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): IConnection {\r\n\r\n        let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n        const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, undefined);\r\n        const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n        const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".stt.speech\" + hostSuffix);\r\n        const queryParams: IStringDictionary<string> = {};\r\n        const endpointId: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_EndpointId, undefined);\r\n        const language: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, undefined);\r\n\r\n        if (endpointId) {\r\n            if (!endpoint || endpoint.search(QueryParameterNames.CustomSpeechDeploymentId) === -1) {\r\n                queryParams[QueryParameterNames.CustomSpeechDeploymentId] = endpointId;\r\n            }\r\n        } else if (language) {\r\n            if (!endpoint || endpoint.search(QueryParameterNames.Language) === -1) {\r\n                queryParams[QueryParameterNames.Language] = language;\r\n            }\r\n        }\r\n\r\n        if (!endpoint || endpoint.search(QueryParameterNames.Format) === -1) {\r\n            queryParams[QueryParameterNames.Format] = config.parameters.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]).toLowerCase();\r\n        }\r\n\r\n        if (config.autoDetectSourceLanguages !== undefined) {\r\n            queryParams[QueryParameterNames.EnableLanguageId] = \"true\";\r\n        }\r\n\r\n        this.setCommonUrlParams(config, queryParams, endpoint);\r\n\r\n        if (!endpoint) {\r\n            switch (config.recognitionMode) {\r\n                case RecognitionMode.Conversation:\r\n                    if (config.parameters.getProperty(ForceDictationPropertyName, \"false\") === \"true\") {\r\n                        endpoint = host + this.dictationRelativeUri;\r\n                    } else {\r\n                        if (config.recognitionEndpointVersion !== undefined && parseInt(config.recognitionEndpointVersion, 10) > 1) {\r\n                            endpoint = `${host}${this.universalUri}${config.recognitionEndpointVersion}`;\r\n                        } else {\r\n                            endpoint = host + this.conversationRelativeUri;\r\n                        }\r\n                    }\r\n                    break;\r\n                case RecognitionMode.Dictation:\r\n                    endpoint = host + this.dictationRelativeUri;\r\n                    break;\r\n                default:\r\n                    if (config.recognitionEndpointVersion !== undefined && parseInt(config.recognitionEndpointVersion, 10) > 1) {\r\n                        endpoint = `${host}${this.universalUri}${config.recognitionEndpointVersion}`;\r\n                    } else {\r\n                        endpoint = host + this.interactiveRelativeUri; // default is interactive\r\n                    }\r\n                    break;\r\n            }\r\n        }\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n        if (authInfo.token !== undefined && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n\r\n        const webSocketConnection = new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\r\n\r\n        // Set the value of SpeechServiceConnection_Url to webSocketConnection.uri (and not to `endpoint`), since this value is the final\r\n        // URI that was used to make the connection (including query parameters).\r\n        const uri: string = webSocketConnection.uri;\r\n        config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, uri);\r\n\r\n        return webSocketConnection;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection,\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    PropertyId\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    ServicePropertiesPropertyName\r\n} from \"../common.speech/Exports.js\";\r\nimport {\r\n    ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    RecognizerConfig,\r\n    WebsocketMessageFormatter\r\n} from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport {\r\n    QueryParameterNames\r\n} from \"./QueryParameterNames.js\";\r\n\r\nexport class ConversationTranscriberConnectionFactory extends ConnectionFactoryBase {\r\n    private readonly universalUri: string = \"/speech/universal/v2\";\r\n\r\n    public create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): IConnection {\r\n\r\n        let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n        const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, undefined);\r\n        const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n        const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".stt.speech\" + hostSuffix);\r\n        const queryParams: IStringDictionary<string> = {};\r\n        const endpointId: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_EndpointId, undefined);\r\n        const language: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, undefined);\r\n\r\n        if (endpointId) {\r\n            if (!endpoint || endpoint.search(QueryParameterNames.CustomSpeechDeploymentId) === -1) {\r\n                queryParams[QueryParameterNames.CustomSpeechDeploymentId] = endpointId;\r\n            }\r\n        } else if (language) {\r\n            if (!endpoint || endpoint.search(QueryParameterNames.Language) === -1) {\r\n                queryParams[QueryParameterNames.Language] = language;\r\n            }\r\n        }\r\n\r\n        if (config.autoDetectSourceLanguages !== undefined) {\r\n            queryParams[QueryParameterNames.EnableLanguageId] = \"true\";\r\n        }\r\n\r\n        this.setV2UrlParams(config, queryParams, endpoint);\r\n\r\n        if (!endpoint) {\r\n            endpoint = `${host}${this.universalUri}`;\r\n        }\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n        if (authInfo.token !== undefined && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n\r\n        const webSocketConnection = new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\r\n\r\n        // Set the value of SpeechServiceConnection_Url to webSocketConnection.uri (and not to `endpoint`), since this value is the final\r\n        // URI that was used to make the connection (including query parameters).\r\n        const uri: string = webSocketConnection.uri;\r\n        config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, uri);\r\n\r\n        return webSocketConnection;\r\n    }\r\n\r\n    protected setV2UrlParams(\r\n        config: RecognizerConfig,\r\n        queryParams: IStringDictionary<string>,\r\n        endpoint: string): void {\r\n\r\n        const propertyIdToParameterMap: Map<number, string> = new Map([\r\n            [PropertyId.Speech_SegmentationSilenceTimeoutMs, QueryParameterNames.SegmentationSilenceTimeoutMs],\r\n            [PropertyId.SpeechServiceConnection_EnableAudioLogging, QueryParameterNames.EnableAudioLogging],\r\n            [PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs, QueryParameterNames.EndSilenceTimeoutMs],\r\n            [PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs, QueryParameterNames.InitialSilenceTimeoutMs],\r\n            [PropertyId.SpeechServiceResponse_PostProcessingOption, QueryParameterNames.Postprocessing],\r\n            [PropertyId.SpeechServiceResponse_ProfanityOption, QueryParameterNames.Profanity],\r\n            [PropertyId.SpeechServiceResponse_StablePartialResultThreshold, QueryParameterNames.StableIntermediateThreshold],\r\n        ]);\r\n\r\n        propertyIdToParameterMap.forEach((parameterName: string, propertyId: PropertyId): void => {\r\n            this.setUrlParameter(propertyId, parameterName, config, queryParams, endpoint);\r\n        });\r\n\r\n\r\n        const serviceProperties: IStringDictionary<string> = JSON.parse(config.parameters.getProperty(ServicePropertiesPropertyName, \"{}\")) as IStringDictionary<string>;\r\n\r\n        Object.keys(serviceProperties).forEach((value: string): void => {\r\n            queryParams[value] = serviceProperties[value];\r\n        });\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection,\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    OutputFormat,\r\n    PropertyId\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    OutputFormatPropertyName,\r\n    RecognizerConfig,\r\n    WebsocketMessageFormatter\r\n} from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport {\r\n    QueryParameterNames\r\n} from \"./QueryParameterNames.js\";\r\n\r\nexport class TranscriberConnectionFactory extends ConnectionFactoryBase {\r\n\r\n    private readonly multiaudioRelativeUri: string = \"/speech/recognition/multiaudio\";\r\n\r\n    public create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): IConnection {\r\n\r\n        let endpoint: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n        const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, \"centralus\");\r\n        const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n        const hostDefault: string = \"wss://transcribe.\" + region + \".cts.speech\" + hostSuffix + this.multiaudioRelativeUri;\r\n        const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, hostDefault);\r\n\r\n        const queryParams: IStringDictionary<string> = {};\r\n        this.setQueryParams(queryParams, config, endpoint);\r\n\r\n        if (!endpoint) {\r\n            endpoint = host;\r\n        }\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n        if (authInfo.token !== undefined && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n\r\n        config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, endpoint);\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n        return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\r\n    }\r\n\r\n    public setQueryParams(queryParams: IStringDictionary<string>, config: RecognizerConfig, endpointUrl: string): void {\r\n\r\n        const endpointId: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_EndpointId, undefined);\r\n        const language: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, undefined);\r\n\r\n        if (endpointId && !(QueryParameterNames.CustomSpeechDeploymentId in queryParams)) {\r\n            queryParams[QueryParameterNames.CustomSpeechDeploymentId] = endpointId;\r\n        }\r\n\r\n        if (language && !(QueryParameterNames.Language in queryParams)) {\r\n            queryParams[QueryParameterNames.Language] = language;\r\n        }\r\n\r\n        const wordLevelTimings: boolean = config.parameters.getProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"false\").toLowerCase() === \"true\";\r\n        const detailed: boolean = config.parameters.getProperty(OutputFormatPropertyName, OutputFormat[OutputFormat.Simple]) !== OutputFormat[OutputFormat.Simple];\r\n        if (wordLevelTimings || detailed) {\r\n            queryParams[QueryParameterNames.Format] = OutputFormat[OutputFormat.Detailed].toLowerCase();\r\n        }\r\n\r\n        this.setCommonUrlParams(config, queryParams, endpointUrl);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ProxyInfo,\r\n    WebsocketConnection,\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    IConnection,\r\n    IStringDictionary,\r\n} from \"../common/Exports.js\";\r\nimport { StringUtils } from \"../common/StringUtils.js\";\r\nimport {\r\n    PropertyId\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    ConnectionFactoryBase\r\n} from \"./ConnectionFactoryBase.js\";\r\nimport {\r\n    AuthInfo,\r\n    RecognitionMode,\r\n    RecognizerConfig,\r\n    WebsocketMessageFormatter,\r\n} from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\nimport { QueryParameterNames } from \"./QueryParameterNames.js\";\r\n\r\nexport class TranslationConnectionFactory extends ConnectionFactoryBase {\r\n\r\n    public create(\r\n        config: RecognizerConfig,\r\n        authInfo: AuthInfo,\r\n        connectionId?: string): IConnection {\r\n\r\n        const endpoint: string = this.getEndpointUrl(config);\r\n\r\n        const queryParams: IStringDictionary<string> = {};\r\n\r\n        if (config.autoDetectSourceLanguages !== undefined) {\r\n            queryParams[QueryParameterNames.EnableLanguageId] = \"true\";\r\n        }\r\n        this.setQueryParams(queryParams, config, endpoint);\r\n\r\n        const headers: IStringDictionary<string> = {};\r\n        if (authInfo.token !== undefined && authInfo.token !== \"\") {\r\n            headers[authInfo.headerName] = authInfo.token;\r\n        }\r\n        headers[HeaderNames.ConnectionId] = connectionId;\r\n\r\n        config.parameters.setProperty(PropertyId.SpeechServiceConnection_Url, endpoint);\r\n\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n        return new WebsocketConnection(endpoint, queryParams, headers, new WebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\r\n    }\r\n\r\n    public getEndpointUrl(config: RecognizerConfig, returnRegionPlaceholder?: boolean): string {\r\n\r\n        const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n        const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n\r\n        let endpointUrl: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n        if (!endpointUrl) {\r\n            if (config.autoDetectSourceLanguages !== undefined) {\r\n                const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://{region}.stt.speech\" + hostSuffix);\r\n                endpointUrl = host + \"/speech/universal/v2\";\r\n            } else {\r\n                const host: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, \"wss://{region}.s2s.speech\" + hostSuffix);\r\n                endpointUrl = host + \"/speech/translation/cognitiveservices/v1\";\r\n            }\r\n        }\r\n\r\n        if (returnRegionPlaceholder === true) {\r\n            return endpointUrl;\r\n        }\r\n\r\n        return StringUtils.formatString(endpointUrl, { region });\r\n    }\r\n\r\n    public setQueryParams(queryParams: IStringDictionary<string>, config: RecognizerConfig, endpointUrl: string): void {\r\n\r\n        queryParams.from = config.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n        queryParams.to = config.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationToLanguages);\r\n        queryParams.scenario = config.recognitionMode === RecognitionMode.Interactive ? \"interactive\" :\r\n            config.recognitionMode === RecognitionMode.Conversation ? \"conversation\" : \"\";\r\n\r\n        this.setCommonUrlParams(config, queryParams, endpointUrl);\r\n        this.setUrlParameter(\r\n            PropertyId.SpeechServiceResponse_TranslationRequestStablePartialResult,\r\n            QueryParameterNames.StableTranslation,\r\n            config,\r\n            queryParams,\r\n            endpointUrl\r\n        );\r\n\r\n        const translationVoice: string =  config.parameters.getProperty(PropertyId.SpeechServiceConnection_TranslationVoice, undefined);\r\n        if (translationVoice !== undefined) {\r\n            queryParams.voice = translationVoice;\r\n            queryParams.features = \"texttospeech\";\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    ResultReason\r\n} from \"../sdk/Exports.js\";\r\nimport { RecognitionStatus } from \"./Exports.js\";\r\n\r\nexport class EnumTranslation {\r\n    public static implTranslateRecognitionResult(recognitionStatus: RecognitionStatus, expectEndOfDictation: boolean = false): ResultReason {\r\n        let reason = ResultReason.Canceled;\r\n        switch (recognitionStatus) {\r\n            case RecognitionStatus.Success:\r\n                reason = ResultReason.RecognizedSpeech;\r\n                break;\r\n            case RecognitionStatus.EndOfDictation:\r\n                // If we need the result in EndOfDictation (typically some session level result),\r\n                // translate into RecognizedSpeech, otherwise NoMatch\r\n                reason = expectEndOfDictation ? ResultReason.RecognizedSpeech : ResultReason.NoMatch;\r\n                break;\r\n            case RecognitionStatus.NoMatch:\r\n            case RecognitionStatus.InitialSilenceTimeout:\r\n            case RecognitionStatus.BabbleTimeout:\r\n                reason = ResultReason.NoMatch;\r\n                break;\r\n            case RecognitionStatus.Error:\r\n            case RecognitionStatus.BadRequest:\r\n            case RecognitionStatus.Forbidden:\r\n            default:\r\n                reason = ResultReason.Canceled;\r\n                break;\r\n        }\r\n        return reason;\r\n    }\r\n\r\n    public static implTranslateCancelResult(recognitionStatus: RecognitionStatus): CancellationReason {\r\n        let reason = CancellationReason.EndOfStream;\r\n        switch (recognitionStatus) {\r\n            case RecognitionStatus.Success:\r\n            case RecognitionStatus.EndOfDictation:\r\n            case RecognitionStatus.NoMatch:\r\n                reason = CancellationReason.EndOfStream;\r\n                break;\r\n            case RecognitionStatus.InitialSilenceTimeout:\r\n            case RecognitionStatus.BabbleTimeout:\r\n            case RecognitionStatus.Error:\r\n            case RecognitionStatus.BadRequest:\r\n            case RecognitionStatus.Forbidden:\r\n            default:\r\n                reason = CancellationReason.Error;\r\n                break;\r\n        }\r\n        return reason;\r\n    }\r\n\r\n    public static implTranslateCancelErrorCode(recognitionStatus: RecognitionStatus): CancellationErrorCode {\r\n        let reason: CancellationErrorCode = CancellationErrorCode.NoError;\r\n        switch (recognitionStatus) {\r\n            case RecognitionStatus.Error:\r\n                reason = CancellationErrorCode.ServiceError;\r\n                break;\r\n            case RecognitionStatus.TooManyRequests:\r\n                reason = CancellationErrorCode.TooManyRequests;\r\n                break;\r\n            case RecognitionStatus.BadRequest:\r\n                reason = CancellationErrorCode.BadRequestParameters;\r\n                break;\r\n            case RecognitionStatus.Forbidden:\r\n                reason = CancellationErrorCode.Forbidden;\r\n                break;\r\n            default:\r\n                reason = CancellationErrorCode.NoError;\r\n                break;\r\n        }\r\n\r\n        return reason;\r\n\r\n    }\r\n\r\n    public static implTranslateErrorDetails(cancellationErrorCode: CancellationErrorCode): string {\r\n        let errorDetails: string = \"The speech service encountered an internal error and could not continue.\";\r\n        switch (cancellationErrorCode) {\r\n            case CancellationErrorCode.Forbidden:\r\n                errorDetails = \"The recognizer is using a free subscription that ran out of quota.\";\r\n                break;\r\n            case CancellationErrorCode.BadRequestParameters:\r\n                errorDetails = \"Invalid parameter or unsupported audio format in the request.\";\r\n                break;\r\n            case CancellationErrorCode.TooManyRequests:\r\n                errorDetails = \"The number of parallel requests exceeded the number of allowed concurrent transcriptions.\";\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        return errorDetails;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * @class SynthesisStatus\r\n * @private\r\n */\r\nexport enum SynthesisStatus {\r\n    /**\r\n     * The response contains valid audio data.\r\n     * @member SynthesisStatus.Success\r\n     */\r\n    Success,\r\n\r\n    /**\r\n     * Indicates the end of audio data. No valid audio data is included in the message.\r\n     * @member SynthesisStatus.SynthesisEnd\r\n     */\r\n    SynthesisEnd,\r\n\r\n    /**\r\n     * Indicates an error occurred during synthesis data processing.\r\n     * @member SynthesisStatus.Error\r\n     */\r\n    Error,\r\n}\r\n\r\nexport enum RecognitionStatus {\r\n    Success,\r\n    NoMatch,\r\n    InitialSilenceTimeout,\r\n    BabbleTimeout,\r\n    Error,\r\n    EndOfDictation,\r\n    TooManyRequests,\r\n    BadRequest,\r\n    Forbidden,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SynthesisStatus } from \"../Exports.js\";\r\n\r\n// translation.synthesis.end\r\nexport interface ITranslationSynthesisEnd {\r\n    SynthesisStatus?: SynthesisStatus;\r\n    FailureReason?: string;\r\n    Status?: SynthesisStatus;\r\n}\r\n\r\nexport class TranslationSynthesisEnd implements ITranslationSynthesisEnd {\r\n    private privSynthesisEnd: ITranslationSynthesisEnd;\r\n\r\n    private constructor(json: string) {\r\n        this.privSynthesisEnd = JSON.parse(json) as ITranslationSynthesisEnd;\r\n        if (!!this.privSynthesisEnd.SynthesisStatus) {\r\n            this.privSynthesisEnd.SynthesisStatus = SynthesisStatus[this.privSynthesisEnd.SynthesisStatus as unknown as keyof typeof SynthesisStatus];\r\n        }\r\n        if (!!this.privSynthesisEnd.Status) {\r\n            this.privSynthesisEnd.SynthesisStatus = SynthesisStatus[this.privSynthesisEnd.Status as unknown as keyof typeof SynthesisStatus];\r\n        }\r\n    }\r\n\r\n    public static fromJSON(json: string): TranslationSynthesisEnd {\r\n        return new TranslationSynthesisEnd(json);\r\n    }\r\n\r\n    public get SynthesisStatus(): SynthesisStatus {\r\n        return this.privSynthesisEnd.SynthesisStatus;\r\n    }\r\n\r\n    public get FailureReason(): string {\r\n        return this.privSynthesisEnd.FailureReason;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport { IPrimaryLanguage, ITranslations } from \"../Exports.js\";\r\nimport { TranslationStatus } from \"../TranslationStatus.js\";\r\n\r\n// translation.hypothesis\r\nexport interface ITranslationHypothesis {\r\n    Duration: number;\r\n    Offset: number;\r\n    PrimaryLanguage?: IPrimaryLanguage;\r\n    Text: string;\r\n    Translation: ITranslations;\r\n}\r\n\r\nexport class TranslationHypothesis implements ITranslationHypothesis {\r\n    private privTranslationHypothesis: ITranslationHypothesis;\r\n\r\n    private constructor(hypothesis: ITranslationHypothesis) {\r\n        this.privTranslationHypothesis = hypothesis;\r\n        this.privTranslationHypothesis.Translation.TranslationStatus = TranslationStatus[this.privTranslationHypothesis.Translation.TranslationStatus as unknown as keyof typeof TranslationStatus];\r\n    }\r\n\r\n    public static fromJSON(json: string): TranslationHypothesis {\r\n        return new TranslationHypothesis(JSON.parse(json) as ITranslationHypothesis);\r\n    }\r\n\r\n    public static fromTranslationResponse(translationHypothesis: { SpeechHypothesis: ITranslationHypothesis }): TranslationHypothesis {\r\n        Contracts.throwIfNullOrUndefined(translationHypothesis, \"translationHypothesis\");\r\n        const hypothesis: ITranslationHypothesis = translationHypothesis.SpeechHypothesis;\r\n        translationHypothesis.SpeechHypothesis = undefined;\r\n        hypothesis.Translation = (translationHypothesis as unknown as ITranslations);\r\n        return new TranslationHypothesis(hypothesis);\r\n    }\r\n\r\n    public get Duration(): number {\r\n        return this.privTranslationHypothesis.Duration;\r\n    }\r\n\r\n    public get Offset(): number {\r\n        return this.privTranslationHypothesis.Offset;\r\n    }\r\n\r\n    public get Text(): string {\r\n        return this.privTranslationHypothesis.Text;\r\n    }\r\n\r\n    public get Translation(): ITranslations {\r\n        return this.privTranslationHypothesis.Translation;\r\n    }\r\n\r\n    public get Language(): string {\r\n        return this.privTranslationHypothesis.PrimaryLanguage?.Language;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport { IPrimaryLanguage, ITranslations, RecognitionStatus } from \"../Exports.js\";\r\nimport { TranslationStatus } from \"../TranslationStatus.js\";\r\n\r\n// translation.phrase\r\nexport interface ITranslationPhrase {\r\n    RecognitionStatus: RecognitionStatus;\r\n    Offset: number;\r\n    Duration: number;\r\n    Translation?: ITranslations;\r\n    Text?: string;\r\n    DisplayText?: string;\r\n    PrimaryLanguage?: IPrimaryLanguage;\r\n}\r\n\r\nexport class TranslationPhrase implements ITranslationPhrase {\r\n    private privTranslationPhrase: ITranslationPhrase;\r\n\r\n    private constructor(phrase: ITranslationPhrase) {\r\n        this.privTranslationPhrase = phrase;\r\n        this.privTranslationPhrase.RecognitionStatus = RecognitionStatus[this.privTranslationPhrase.RecognitionStatus as unknown as keyof typeof RecognitionStatus];\r\n        if (this.privTranslationPhrase.Translation !== undefined) {\r\n            this.privTranslationPhrase.Translation.TranslationStatus = TranslationStatus[this.privTranslationPhrase.Translation.TranslationStatus as unknown as keyof typeof TranslationStatus];\r\n        }\r\n    }\r\n\r\n    public static fromJSON(json: string): TranslationPhrase {\r\n        return new TranslationPhrase(JSON.parse(json) as ITranslationPhrase);\r\n    }\r\n\r\n    public static fromTranslationResponse(translationResponse: { SpeechPhrase: ITranslationPhrase }): TranslationPhrase {\r\n        Contracts.throwIfNullOrUndefined(translationResponse, \"translationResponse\");\r\n        const phrase: ITranslationPhrase = translationResponse.SpeechPhrase;\r\n        translationResponse.SpeechPhrase = undefined;\r\n        phrase.Translation = (translationResponse as unknown as ITranslations);\r\n        phrase.Text = phrase.DisplayText;\r\n        return new TranslationPhrase(phrase);\r\n    }\r\n\r\n    public get RecognitionStatus(): RecognitionStatus {\r\n        return this.privTranslationPhrase.RecognitionStatus;\r\n    }\r\n\r\n    public get Offset(): number {\r\n        return this.privTranslationPhrase.Offset;\r\n    }\r\n\r\n    public get Duration(): number {\r\n        return this.privTranslationPhrase.Duration;\r\n    }\r\n\r\n    public get Text(): string | undefined {\r\n        return this.privTranslationPhrase.Text;\r\n    }\r\n\r\n    public get Language(): string | undefined {\r\n        return this.privTranslationPhrase.PrimaryLanguage?.Language;\r\n    }\r\n\r\n    public get Confidence(): string | undefined {\r\n        return this.privTranslationPhrase.PrimaryLanguage?.Confidence;\r\n    }\r\n\r\n    public get Translation(): ITranslations | undefined {\r\n        return this.privTranslationPhrase.Translation;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ConnectionEvent,\r\n    IAudioSource,\r\n    MessageType,\r\n    TranslationStatus,\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SpeechRecognitionResult,\r\n    TranslationRecognitionCanceledEventArgs,\r\n    TranslationRecognitionEventArgs,\r\n    TranslationRecognitionResult,\r\n    TranslationRecognizer,\r\n    Translations,\r\n    TranslationSynthesisEventArgs,\r\n    TranslationSynthesisResult,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    CancellationErrorCodePropertyName,\r\n    ConversationServiceRecognizer,\r\n    EnumTranslation,\r\n    ITranslationHypothesis,\r\n    RecognitionStatus,\r\n    SynthesisStatus,\r\n    TranslationHypothesis,\r\n    TranslationPhrase,\r\n    TranslationSynthesisEnd,\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { ITranslationPhrase } from \"./ServiceMessages/TranslationPhrase.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class TranslationServiceRecognizer extends ConversationServiceRecognizer {\r\n    private privTranslationRecognizer: TranslationRecognizer;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        translationRecognizer: TranslationRecognizer) {\r\n\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, translationRecognizer);\r\n        this.privTranslationRecognizer = translationRecognizer;\r\n        this.connectionEvents.attach((connectionEvent: ConnectionEvent): void => {\r\n            if (connectionEvent.name === \"ConnectionEstablishedEvent\") {\r\n                this.privTranslationRecognizer.onConnection();\r\n            }\r\n        });\r\n\r\n    }\r\n\r\n    protected async processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        let processed: boolean = await this.processSpeechMessages(connectionMessage);\r\n        if (processed) {\r\n            return true;\r\n        }\r\n\r\n        const handleTranslationPhrase = async (translatedPhrase: TranslationPhrase): Promise<void> => {\r\n            this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + translatedPhrase.Offset + translatedPhrase.Duration);\r\n\r\n            if (translatedPhrase.RecognitionStatus === RecognitionStatus.Success) {\r\n\r\n                // OK, the recognition was successful. How'd the translation do?\r\n                const result: TranslationRecognitionEventArgs = this.fireEventForResult(translatedPhrase, resultProps);\r\n                if (!!this.privTranslationRecognizer.recognized) {\r\n                    try {\r\n                        this.privTranslationRecognizer.recognized(this.privTranslationRecognizer, result);\r\n                        /* eslint-disable no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n\r\n                // report result to promise.\r\n                if (!!this.privSuccessCallback) {\r\n                    try {\r\n                        this.privSuccessCallback(result.result);\r\n                    } catch (e) {\r\n                        if (!!this.privErrorCallback) {\r\n                            this.privErrorCallback(e as string);\r\n                        }\r\n                    }\r\n                    // Only invoke the call back once.\r\n                    // and if it's successful don't invoke the\r\n                    // error after that.\r\n                    this.privSuccessCallback = undefined;\r\n                    this.privErrorCallback = undefined;\r\n                }\r\n            } else {\r\n                const reason: ResultReason = EnumTranslation.implTranslateRecognitionResult(translatedPhrase.RecognitionStatus);\r\n\r\n                const result = new TranslationRecognitionResult(\r\n                    undefined,\r\n                    this.privRequestSession.requestId,\r\n                    reason,\r\n                    translatedPhrase.Text,\r\n                    translatedPhrase.Duration,\r\n                    this.privRequestSession.currentTurnAudioOffset + translatedPhrase.Offset,\r\n                    translatedPhrase.Language,\r\n                    translatedPhrase.Confidence,\r\n                    undefined,\r\n                    connectionMessage.textBody,\r\n                    resultProps);\r\n\r\n                if (reason === ResultReason.Canceled) {\r\n                    const cancelReason: CancellationReason = EnumTranslation.implTranslateCancelResult(translatedPhrase.RecognitionStatus);\r\n                    const cancellationErrorCode: CancellationErrorCode = EnumTranslation.implTranslateCancelErrorCode(translatedPhrase.RecognitionStatus);\r\n\r\n                    await this.cancelRecognitionLocal(\r\n                        cancelReason,\r\n                        cancellationErrorCode,\r\n                        EnumTranslation.implTranslateErrorDetails(cancellationErrorCode));\r\n\r\n                } else {\r\n                    if (!(this.privRequestSession.isSpeechEnded && reason === ResultReason.NoMatch && translatedPhrase.RecognitionStatus !== RecognitionStatus.InitialSilenceTimeout)) {\r\n                        const ev = new TranslationRecognitionEventArgs(result, result.offset, this.privRequestSession.sessionId);\r\n\r\n                        if (!!this.privTranslationRecognizer.recognized) {\r\n                            try {\r\n                                this.privTranslationRecognizer.recognized(this.privTranslationRecognizer, ev);\r\n                                /* eslint-disable no-empty */\r\n                            } catch (error) {\r\n                                // Not going to let errors in the event handler\r\n                                // trip things up.\r\n                            }\r\n                        }\r\n                    }\r\n\r\n                    // report result to promise.\r\n                    if (!!this.privSuccessCallback) {\r\n                        try {\r\n                            this.privSuccessCallback(result);\r\n                        } catch (e) {\r\n                            if (!!this.privErrorCallback) {\r\n                                this.privErrorCallback(e as string);\r\n                            }\r\n                        }\r\n                        // Only invoke the call back once.\r\n                        // and if it's successful don't invoke the\r\n                        // error after that.\r\n                        this.privSuccessCallback = undefined;\r\n                        this.privErrorCallback = undefined;\r\n                    }\r\n                }\r\n                processed = true;\r\n            }\r\n\r\n        };\r\n\r\n        const handleTranslationHypothesis = (hypothesis: TranslationHypothesis, resultProperties: PropertyCollection): void => {\r\n            const result: TranslationRecognitionEventArgs = this.fireEventForResult(hypothesis, resultProperties);\r\n            this.privRequestSession.onHypothesis(this.privRequestSession.currentTurnAudioOffset + result.offset);\r\n\r\n            if (!!this.privTranslationRecognizer.recognizing) {\r\n                try {\r\n                    this.privTranslationRecognizer.recognizing(this.privTranslationRecognizer, result);\r\n                    /* eslint-disable no-empty */\r\n                } catch (error) {\r\n                    // Not going to let errors in the event handler\r\n                    // trip things up.\r\n                }\r\n            }\r\n            processed = true;\r\n        };\r\n\r\n        if (connectionMessage.messageType === MessageType.Text) {\r\n            resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n        }\r\n\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            case \"translation.hypothesis\":\r\n                handleTranslationHypothesis(TranslationHypothesis.fromJSON(connectionMessage.textBody), resultProps);\r\n                break;\r\n\r\n            case \"translation.response\":\r\n                const phrase: { SpeechPhrase: ITranslationPhrase } = JSON.parse(connectionMessage.textBody) as { SpeechPhrase: ITranslationPhrase };\r\n                if (!!phrase.SpeechPhrase) {\r\n                    await handleTranslationPhrase(TranslationPhrase.fromTranslationResponse(phrase));\r\n                } else {\r\n                    const hypothesis: { SpeechHypothesis: ITranslationHypothesis } = JSON.parse(connectionMessage.textBody) as { SpeechHypothesis: ITranslationHypothesis };\r\n                    if (!!hypothesis.SpeechHypothesis) {\r\n                        handleTranslationHypothesis(TranslationHypothesis.fromTranslationResponse(hypothesis), resultProps);\r\n                    }\r\n                }\r\n                break;\r\n            case \"translation.phrase\":\r\n                await handleTranslationPhrase(TranslationPhrase.fromJSON(connectionMessage.textBody));\r\n                break;\r\n\r\n            case \"translation.synthesis\":\r\n                this.sendSynthesisAudio(connectionMessage.binaryBody, this.privRequestSession.sessionId);\r\n                processed = true;\r\n                break;\r\n\r\n            case \"audio.end\":\r\n            case \"translation.synthesis.end\":\r\n                const synthEnd: TranslationSynthesisEnd = TranslationSynthesisEnd.fromJSON(connectionMessage.textBody);\r\n\r\n                switch (synthEnd.SynthesisStatus) {\r\n                    case SynthesisStatus.Error:\r\n                        if (!!this.privTranslationRecognizer.synthesizing) {\r\n                            const result = new TranslationSynthesisResult(ResultReason.Canceled, undefined);\r\n                            const retEvent: TranslationSynthesisEventArgs = new TranslationSynthesisEventArgs(result, this.privRequestSession.sessionId);\r\n\r\n                            try {\r\n                                this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer, retEvent);\r\n                                /* eslint-disable no-empty */\r\n                            } catch (error) {\r\n                                // Not going to let errors in the event handler\r\n                                // trip things up.\r\n                            }\r\n                        }\r\n\r\n                        if (!!this.privTranslationRecognizer.canceled) {\r\n                            // And raise a canceled event to send the rich(er) error message back.\r\n                            const canceledResult: TranslationRecognitionCanceledEventArgs = new TranslationRecognitionCanceledEventArgs(\r\n                                this.privRequestSession.sessionId,\r\n                                CancellationReason.Error,\r\n                                synthEnd.FailureReason,\r\n                                CancellationErrorCode.ServiceError,\r\n                                null);\r\n\r\n                            try {\r\n                                this.privTranslationRecognizer.canceled(this.privTranslationRecognizer, canceledResult);\r\n                                /* eslint-disable no-empty */\r\n                            } catch (error) {\r\n                                // Not going to let errors in the event handler\r\n                                // trip things up.\r\n                            }\r\n                        }\r\n                        break;\r\n                    case SynthesisStatus.Success:\r\n                        this.sendSynthesisAudio(undefined, this.privRequestSession.sessionId);\r\n                        break;\r\n                    default:\r\n                        break;\r\n                }\r\n                processed = true;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        return processed;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n        if (!!this.privTranslationRecognizer.canceled) {\r\n\r\n            const cancelEvent: TranslationRecognitionCanceledEventArgs = new TranslationRecognitionCanceledEventArgs(\r\n                sessionId,\r\n                cancellationReason,\r\n                error,\r\n                errorCode,\r\n                undefined);\r\n\r\n            try {\r\n                this.privTranslationRecognizer.canceled(this.privTranslationRecognizer, cancelEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n\r\n        if (!!this.privSuccessCallback) {\r\n            const result: TranslationRecognitionResult = new TranslationRecognitionResult(\r\n                undefined, // Translations\r\n                requestId,\r\n                ResultReason.Canceled,\r\n                undefined, // Text\r\n                undefined, // Druation\r\n                undefined, // Offset\r\n                undefined, // Language\r\n                undefined, // LanguageDetectionConfidence\r\n                error,\r\n                undefined, // Json\r\n                properties);\r\n            try {\r\n                this.privSuccessCallback(result);\r\n                /* eslint-disable no-empty */\r\n                this.privSuccessCallback = undefined;\r\n            } catch { }\r\n        }\r\n    }\r\n\r\n    protected handleRecognizingCallback(result: SpeechRecognitionResult, duration: number, sessionId: string): void {\r\n        try {\r\n            const ev = new TranslationRecognitionEventArgs(TranslationRecognitionResult.fromSpeechRecognitionResult(result), duration, sessionId);\r\n            this.privTranslationRecognizer.recognizing(this.privTranslationRecognizer, ev);\r\n            /* eslint-disable no-empty */\r\n        } catch (error) {\r\n            // Not going to let errors in the event handler\r\n            // trip things up.\r\n        }\r\n    }\r\n\r\n    protected handleRecognizedCallback(result: SpeechRecognitionResult, offset: number, sessionId: string): void {\r\n        try {\r\n            const ev = new TranslationRecognitionEventArgs(TranslationRecognitionResult.fromSpeechRecognitionResult(result), offset, sessionId);\r\n            this.privTranslationRecognizer.recognized(this.privTranslationRecognizer, ev);\r\n        } catch (error) {\r\n            // Not going to let errors in the event handler\r\n            // trip things up.\r\n        }\r\n    }\r\n\r\n    private fireEventForResult(serviceResult: TranslationHypothesis | TranslationPhrase, properties: PropertyCollection): TranslationRecognitionEventArgs {\r\n        let translations: Translations;\r\n\r\n        if (undefined !== serviceResult.Translation.Translations) {\r\n            translations = new Translations();\r\n            for (const translation of serviceResult.Translation.Translations) {\r\n                translations.set(translation.Language, translation.Text || translation.DisplayText);\r\n            }\r\n        }\r\n\r\n        let resultReason: ResultReason;\r\n        let confidence: string;\r\n        if (serviceResult instanceof TranslationPhrase) {\r\n            if (!!serviceResult.Translation && serviceResult.Translation.TranslationStatus === TranslationStatus.Success) {\r\n                resultReason = ResultReason.TranslatedSpeech;\r\n            } else {\r\n                resultReason = ResultReason.RecognizedSpeech;\r\n            }\r\n            confidence = serviceResult.Confidence;\r\n        } else {\r\n            resultReason = ResultReason.TranslatingSpeech;\r\n        }\r\n        const language = serviceResult.Language;\r\n\r\n        const offset: number = serviceResult.Offset + this.privRequestSession.currentTurnAudioOffset;\r\n\r\n        const result = new TranslationRecognitionResult(\r\n            translations,\r\n            this.privRequestSession.requestId,\r\n            resultReason,\r\n            serviceResult.Text,\r\n            serviceResult.Duration,\r\n            offset,\r\n            language,\r\n            confidence,\r\n            serviceResult.Translation.FailureReason,\r\n            JSON.stringify(serviceResult),\r\n            properties);\r\n\r\n        const ev = new TranslationRecognitionEventArgs(result, offset, this.privRequestSession.sessionId);\r\n        return ev;\r\n    }\r\n\r\n    private sendSynthesisAudio(audio: ArrayBuffer, sessionId: string): void {\r\n        const reason = (undefined === audio) ? ResultReason.SynthesizingAudioCompleted : ResultReason.SynthesizingAudio;\r\n        const result = new TranslationSynthesisResult(reason, audio);\r\n        const retEvent: TranslationSynthesisEventArgs = new TranslationSynthesisEventArgs(result, sessionId);\r\n\r\n        if (!!this.privTranslationRecognizer.synthesizing) {\r\n            try {\r\n                this.privTranslationRecognizer.synthesizing(this.privTranslationRecognizer, retEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch (error) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// speech.endDetected\r\nexport interface ISpeechDetected {\r\n    Offset: number;\r\n}\r\n\r\nexport class SpeechDetected implements ISpeechDetected {\r\n    private privSpeechStartDetected: ISpeechDetected;\r\n\r\n    private constructor(json: string) {\r\n        this.privSpeechStartDetected = JSON.parse(json) as ISpeechDetected;\r\n    }\r\n\r\n    public static fromJSON(json: string): SpeechDetected {\r\n        return new SpeechDetected(json);\r\n    }\r\n\r\n    public get Offset(): number {\r\n        return this.privSpeechStartDetected.Offset;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IPrimaryLanguage } from \"./SimpleSpeechPhrase.js\";\r\n\r\n// speech.hypothesis\r\nexport interface ISpeechHypothesis {\r\n    Text: string;\r\n    Offset: number;\r\n    Duration: number;\r\n    PrimaryLanguage?: IPrimaryLanguage;\r\n    SpeakerId?: string;\r\n}\r\n\r\nexport class SpeechHypothesis implements ISpeechHypothesis {\r\n    private privSpeechHypothesis: ISpeechHypothesis;\r\n\r\n    private constructor(json: string) {\r\n        this.privSpeechHypothesis = JSON.parse(json) as ISpeechHypothesis;\r\n    }\r\n\r\n    public static fromJSON(json: string): SpeechHypothesis {\r\n        return new SpeechHypothesis(json);\r\n    }\r\n\r\n    public get Text(): string {\r\n        return this.privSpeechHypothesis.Text;\r\n    }\r\n\r\n    public get Offset(): number {\r\n        return this.privSpeechHypothesis.Offset;\r\n    }\r\n\r\n    public get Duration(): number {\r\n        return this.privSpeechHypothesis.Duration;\r\n    }\r\n\r\n    public get Language(): string {\r\n        return this.privSpeechHypothesis.PrimaryLanguage === undefined ? undefined : this.privSpeechHypothesis.PrimaryLanguage.Language;\r\n    }\r\n\r\n    public get LanguageDetectionConfidence(): string {\r\n        return this.privSpeechHypothesis.PrimaryLanguage === undefined ? undefined : this.privSpeechHypothesis.PrimaryLanguage.Confidence;\r\n    }\r\n\r\n    public get SpeakerId(): string {\r\n        return this.privSpeechHypothesis.SpeakerId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// speech.keyword\r\nexport interface ISpeechKeyword {\r\n    Status: string;\r\n    Text: string;\r\n    Offset: number;\r\n    Duration: number;\r\n}\r\n\r\nexport class SpeechKeyword implements ISpeechKeyword {\r\n    private privSpeechKeyword: ISpeechKeyword;\r\n\r\n    private constructor(json: string) {\r\n        this.privSpeechKeyword = JSON.parse(json) as ISpeechKeyword;\r\n    }\r\n\r\n    public static fromJSON(json: string): SpeechKeyword {\r\n        return new SpeechKeyword(json);\r\n    }\r\n\r\n    public get Status(): string {\r\n        return this.privSpeechKeyword.Status;\r\n    }\r\n\r\n    public get Text(): string {\r\n        return this.privSpeechKeyword.Text;\r\n    }\r\n\r\n    public get Offset(): number {\r\n        return this.privSpeechKeyword.Offset;\r\n    }\r\n\r\n    public get Duration(): number {\r\n        return this.privSpeechKeyword.Duration;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IAudioSource } from \"../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    OutputFormat,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SpeechRecognitionCanceledEventArgs,\r\n    SpeechRecognitionEventArgs,\r\n    SpeechRecognitionResult,\r\n    SpeechRecognizer,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    CancellationErrorCodePropertyName,\r\n    DetailedSpeechPhrase,\r\n    EnumTranslation,\r\n    OutputFormatPropertyName,\r\n    RecognitionStatus,\r\n    ServiceRecognizerBase,\r\n    SimpleSpeechPhrase,\r\n    SpeechHypothesis,\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class SpeechServiceRecognizer extends ServiceRecognizerBase {\r\n\r\n    private privSpeechRecognizer: SpeechRecognizer;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        speechRecognizer: SpeechRecognizer) {\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, speechRecognizer);\r\n        this.privSpeechRecognizer = speechRecognizer;\r\n\r\n    }\r\n\r\n    protected async processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n\r\n        let result: SpeechRecognitionResult;\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n        let processed: boolean = false;\r\n\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            case \"speech.hypothesis\":\r\n            case \"speech.fragment\":\r\n                const hypothesis: SpeechHypothesis = SpeechHypothesis.fromJSON(connectionMessage.textBody);\r\n                const offset: number = hypothesis.Offset + this.privRequestSession.currentTurnAudioOffset;\r\n\r\n                result = new SpeechRecognitionResult(\r\n                    this.privRequestSession.requestId,\r\n                    ResultReason.RecognizingSpeech,\r\n                    hypothesis.Text,\r\n                    hypothesis.Duration,\r\n                    offset,\r\n                    hypothesis.Language,\r\n                    hypothesis.LanguageDetectionConfidence,\r\n                    undefined, // Speaker Id\r\n                    undefined,\r\n                    connectionMessage.textBody,\r\n                    resultProps);\r\n\r\n                this.privRequestSession.onHypothesis(offset);\r\n\r\n                const ev = new SpeechRecognitionEventArgs(result, hypothesis.Duration, this.privRequestSession.sessionId);\r\n\r\n                if (!!this.privSpeechRecognizer.recognizing) {\r\n                    try {\r\n                        this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer, ev);\r\n                        /* eslint-disable no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"speech.phrase\":\r\n                const simple: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(connectionMessage.textBody);\r\n                const resultReason: ResultReason = EnumTranslation.implTranslateRecognitionResult(simple.RecognitionStatus, this.privExpectContentAssessmentResponse);\r\n\r\n                this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + simple.Offset + simple.Duration);\r\n\r\n                if (ResultReason.Canceled === resultReason) {\r\n                    const cancelReason: CancellationReason = EnumTranslation.implTranslateCancelResult(simple.RecognitionStatus);\r\n                    const cancellationErrorCode: CancellationErrorCode = EnumTranslation.implTranslateCancelErrorCode(simple.RecognitionStatus);\r\n\r\n                    await this.cancelRecognitionLocal(\r\n                        cancelReason,\r\n                        cancellationErrorCode,\r\n                        EnumTranslation.implTranslateErrorDetails(cancellationErrorCode));\r\n\r\n                } else {\r\n                    if (!(this.privRequestSession.isSpeechEnded && resultReason === ResultReason.NoMatch && simple.RecognitionStatus !== RecognitionStatus.InitialSilenceTimeout)) {\r\n                        if (this.privRecognizerConfig.parameters.getProperty(OutputFormatPropertyName) === OutputFormat[OutputFormat.Simple]) {\r\n                            result = new SpeechRecognitionResult(\r\n                                this.privRequestSession.requestId,\r\n                                resultReason,\r\n                                simple.DisplayText,\r\n                                simple.Duration,\r\n                                simple.Offset + this.privRequestSession.currentTurnAudioOffset,\r\n                                simple.Language,\r\n                                simple.LanguageDetectionConfidence,\r\n                                undefined, // Speaker Id\r\n                                undefined,\r\n                                connectionMessage.textBody,\r\n                                resultProps);\r\n                        } else {\r\n                            const detailed: DetailedSpeechPhrase = DetailedSpeechPhrase.fromJSON(connectionMessage.textBody);\r\n                            const totalOffset: number = detailed.Offset + this.privRequestSession.currentTurnAudioOffset;\r\n                            const offsetCorrectedJson: string = detailed.getJsonWithCorrectedOffsets(totalOffset);\r\n\r\n                            result = new SpeechRecognitionResult(\r\n                                this.privRequestSession.requestId,\r\n                                resultReason,\r\n                                detailed.RecognitionStatus === RecognitionStatus.Success ? detailed.NBest[0].Display : undefined,\r\n                                detailed.Duration,\r\n                                totalOffset,\r\n                                detailed.Language,\r\n                                detailed.LanguageDetectionConfidence,\r\n                                undefined, // Speaker Id\r\n                                undefined,\r\n                                offsetCorrectedJson,\r\n                                resultProps);\r\n                        }\r\n\r\n                        const event: SpeechRecognitionEventArgs = new SpeechRecognitionEventArgs(result, result.offset, this.privRequestSession.sessionId);\r\n\r\n                        if (!!this.privSpeechRecognizer.recognized) {\r\n                            try {\r\n                                this.privSpeechRecognizer.recognized(this.privSpeechRecognizer, event);\r\n                                /* eslint-disable no-empty */\r\n                            } catch (error) {\r\n                                // Not going to let errors in the event handler\r\n                                // trip things up.\r\n                            }\r\n                        }\r\n                    }\r\n\r\n                    if (!!this.privSuccessCallback) {\r\n                        try {\r\n                            this.privSuccessCallback(result);\r\n                        } catch (e) {\r\n                            if (!!this.privErrorCallback) {\r\n                                this.privErrorCallback(e as string);\r\n                            }\r\n                        }\r\n                        // Only invoke the call back once.\r\n                        // and if it's successful don't invoke the\r\n                        // error after that.\r\n                        this.privSuccessCallback = undefined;\r\n                        this.privErrorCallback = undefined;\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        return processed;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n        if (!!this.privSpeechRecognizer.canceled) {\r\n            const cancelEvent: SpeechRecognitionCanceledEventArgs = new SpeechRecognitionCanceledEventArgs(\r\n                cancellationReason,\r\n                error,\r\n                errorCode,\r\n                undefined,\r\n                sessionId);\r\n            try {\r\n                this.privSpeechRecognizer.canceled(this.privSpeechRecognizer, cancelEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n\r\n        if (!!this.privSuccessCallback) {\r\n            const result: SpeechRecognitionResult = new SpeechRecognitionResult(\r\n                requestId,\r\n                ResultReason.Canceled,\r\n                undefined, // Text\r\n                undefined, // Duration\r\n                undefined, // Offset\r\n                undefined, // Language\r\n                undefined, // Language Detection Confidence\r\n                undefined, // Speaker Id\r\n                error,\r\n                undefined, // Json\r\n                properties);\r\n            try {\r\n                this.privSuccessCallback(result);\r\n                this.privSuccessCallback = undefined;\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IAudioSource } from \"../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    OutputFormat,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    ConversationTranscriptionCanceledEventArgs,\r\n    ConversationTranscriptionEventArgs,\r\n    ConversationTranscriptionResult,\r\n    ConversationTranscriber,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    CancellationErrorCodePropertyName,\r\n    DetailedSpeechPhrase,\r\n    EnumTranslation,\r\n    OutputFormatPropertyName,\r\n    RecognitionStatus,\r\n    ServiceRecognizerBase,\r\n    SimpleSpeechPhrase,\r\n    SpeechHypothesis,\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\nimport { PhraseDetection, SpeakerDiarization } from \"./ServiceRecognizerBase.js\";\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class ConversationTranscriptionServiceRecognizer extends ServiceRecognizerBase {\r\n\r\n    private privConversationTranscriber: ConversationTranscriber;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        conversationTranscriber: ConversationTranscriber) {\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, conversationTranscriber);\r\n        this.privConversationTranscriber = conversationTranscriber;\r\n        this.setSpeakerDiarizationJson();\r\n    }\r\n\r\n    protected setSpeakerDiarizationJson(): void {\r\n        if (this.privEnableSpeakerId) {\r\n            const phraseDetection = this.privSpeechContext.getSection(\"phraseDetection\") as PhraseDetection;\r\n            phraseDetection.mode = \"Conversation\";\r\n            const speakerDiarization: SpeakerDiarization = {};\r\n            speakerDiarization.mode = \"Anonymous\";\r\n            speakerDiarization.audioSessionId = this.privDiarizationSessionId;\r\n            speakerDiarization.audioOffsetMs = 0;\r\n            phraseDetection.speakerDiarization = speakerDiarization;\r\n            this.privSpeechContext.setSection(\"phraseDetection\", phraseDetection);\r\n        }\r\n    }\r\n\r\n    protected async processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n\r\n        let result: ConversationTranscriptionResult;\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n        let processed: boolean = false;\r\n\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            case \"speech.hypothesis\":\r\n            case \"speech.fragment\":\r\n                const hypothesis: SpeechHypothesis = SpeechHypothesis.fromJSON(connectionMessage.textBody);\r\n                const offset: number = hypothesis.Offset + this.privRequestSession.currentTurnAudioOffset;\r\n\r\n                result = new ConversationTranscriptionResult(\r\n                    this.privRequestSession.requestId,\r\n                    ResultReason.RecognizingSpeech,\r\n                    hypothesis.Text,\r\n                    hypothesis.Duration,\r\n                    offset,\r\n                    hypothesis.Language,\r\n                    hypothesis.LanguageDetectionConfidence,\r\n                    undefined, // Speaker Id\r\n                    undefined,\r\n                    connectionMessage.textBody,\r\n                    resultProps);\r\n\r\n                this.privRequestSession.onHypothesis(offset);\r\n\r\n                const ev = new ConversationTranscriptionEventArgs(result, hypothesis.Duration, this.privRequestSession.sessionId);\r\n\r\n                if (!!this.privConversationTranscriber.transcribing) {\r\n                    try {\r\n                        this.privConversationTranscriber.transcribing(this.privConversationTranscriber, ev);\r\n                        /* eslint-disable no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"speech.phrase\":\r\n                const simple: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(connectionMessage.textBody);\r\n                const resultReason: ResultReason = EnumTranslation.implTranslateRecognitionResult(simple.RecognitionStatus);\r\n\r\n                this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + simple.Offset + simple.Duration);\r\n\r\n                if (ResultReason.Canceled === resultReason) {\r\n                    const cancelReason: CancellationReason = EnumTranslation.implTranslateCancelResult(simple.RecognitionStatus);\r\n                    const cancellationErrorCode: CancellationErrorCode = EnumTranslation.implTranslateCancelErrorCode(simple.RecognitionStatus);\r\n\r\n                    await this.cancelRecognitionLocal(\r\n                        cancelReason,\r\n                        cancellationErrorCode,\r\n                        EnumTranslation.implTranslateErrorDetails(cancellationErrorCode));\r\n\r\n                } else {\r\n                    if (!(this.privRequestSession.isSpeechEnded && resultReason === ResultReason.NoMatch && simple.RecognitionStatus !== RecognitionStatus.InitialSilenceTimeout)) {\r\n                        if (this.privRecognizerConfig.parameters.getProperty(OutputFormatPropertyName) === OutputFormat[OutputFormat.Simple]) {\r\n                            result = new ConversationTranscriptionResult(\r\n                                this.privRequestSession.requestId,\r\n                                resultReason,\r\n                                simple.DisplayText,\r\n                                simple.Duration,\r\n                                simple.Offset + this.privRequestSession.currentTurnAudioOffset,\r\n                                simple.Language,\r\n                                simple.LanguageDetectionConfidence,\r\n                                simple.SpeakerId,\r\n                                undefined,\r\n                                connectionMessage.textBody,\r\n                                resultProps);\r\n                        } else {\r\n                            const detailed: DetailedSpeechPhrase = DetailedSpeechPhrase.fromJSON(connectionMessage.textBody);\r\n                            const totalOffset: number = detailed.Offset + this.privRequestSession.currentTurnAudioOffset;\r\n                            const offsetCorrectedJson: string = detailed.getJsonWithCorrectedOffsets(totalOffset);\r\n\r\n                            result = new ConversationTranscriptionResult(\r\n                                this.privRequestSession.requestId,\r\n                                resultReason,\r\n                                detailed.RecognitionStatus === RecognitionStatus.Success ? detailed.NBest[0].Display : undefined,\r\n                                detailed.Duration,\r\n                                totalOffset,\r\n                                detailed.Language,\r\n                                detailed.LanguageDetectionConfidence,\r\n                                simple.SpeakerId,\r\n                                undefined,\r\n                                offsetCorrectedJson,\r\n                                resultProps);\r\n                        }\r\n\r\n                        const event: ConversationTranscriptionEventArgs = new ConversationTranscriptionEventArgs(result, result.offset, this.privRequestSession.sessionId);\r\n\r\n                        if (!!this.privConversationTranscriber.transcribed) {\r\n                            try {\r\n                                this.privConversationTranscriber.transcribed(this.privConversationTranscriber, event);\r\n                                /* eslint-disable no-empty */\r\n                            } catch (error) {\r\n                                // Not going to let errors in the event handler\r\n                                // trip things up.\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        return processed;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n        if (!!this.privConversationTranscriber.canceled) {\r\n            const cancelEvent: ConversationTranscriptionCanceledEventArgs = new ConversationTranscriptionCanceledEventArgs(\r\n                cancellationReason,\r\n                error,\r\n                errorCode,\r\n                undefined,\r\n                sessionId);\r\n            try {\r\n                this.privConversationTranscriber.canceled(this.privConversationTranscriber, cancelEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    IAudioSource,\r\n    IConnection,\r\n    MessageType\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    ConversationTranscriptionCanceledEventArgs,\r\n    MeetingTranscriptionCanceledEventArgs,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SpeechRecognitionEventArgs,\r\n    SpeechRecognitionResult,\r\n} from \"../sdk/Exports.js\";\r\nimport { ConversationInfo, MeetingInfo } from \"../sdk/Transcription/Exports.js\";\r\nimport { ConversationProperties } from \"../sdk/Transcription/IConversation.js\";\r\nimport { MeetingProperties } from \"../sdk/Transcription/IMeeting.js\";\r\nimport {\r\n    CancellationErrorCodePropertyName,\r\n    ConversationServiceRecognizer,\r\n    TranscriberRecognizer\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class TranscriptionServiceRecognizer extends ConversationServiceRecognizer {\r\n\r\n    private privTranscriberRecognizer: TranscriberRecognizer;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        transcriber: TranscriberRecognizer) {\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, transcriber);\r\n        this.privTranscriberRecognizer = transcriber;\r\n        this.sendPrePayloadJSONOverride = (connection: IConnection): Promise<void> => this.sendTranscriptionStartJSON(connection);\r\n        if (this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps) === \"true\") {\r\n            this.privSpeechContext.setWordLevelTimings();\r\n        }\r\n    }\r\n\r\n    public async sendSpeechEventAsync(info: ConversationInfo, command: string): Promise<void> {\r\n        if (!!this.privRequestSession.isRecognizing) {\r\n            const connection: IConnection = await this.fetchConnection();\r\n            await this.sendSpeechEvent(connection, this.createSpeechEventPayload(info, command));\r\n        }\r\n    }\r\n\r\n    public async sendMeetingSpeechEventAsync(info: MeetingInfo, command: string): Promise<void> {\r\n        if (!!this.privRequestSession.isRecognizing) {\r\n            const connection: IConnection = await this.fetchConnection();\r\n            await this.sendSpeechEvent(connection, this.createMeetingSpeechEventPayload(info, command));\r\n        }\r\n    }\r\n\r\n    protected processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n        return this.processSpeechMessages(connectionMessage);\r\n    }\r\n\r\n    protected handleRecognizedCallback(result: SpeechRecognitionResult, offset: number, sessionId: string): void {\r\n        try {\r\n            const event: SpeechRecognitionEventArgs = new SpeechRecognitionEventArgs(result, offset, sessionId);\r\n            this.privTranscriberRecognizer.recognized(this.privTranscriberRecognizer, event);\r\n            if (!!this.privSuccessCallback) {\r\n                try {\r\n                    this.privSuccessCallback(result);\r\n                } catch (e) {\r\n                    if (!!this.privErrorCallback) {\r\n                        this.privErrorCallback(e as string);\r\n                    }\r\n                }\r\n                // Only invoke the call back once.\r\n                // and if it's successful don't invoke the\r\n                // error after that.\r\n                this.privSuccessCallback = undefined;\r\n                this.privErrorCallback = undefined;\r\n            }\r\n        /* eslint-disable no-empty */\r\n        } catch (error) {\r\n            // Not going to let errors in the event handler\r\n            // trip things up.\r\n        }\r\n    }\r\n\r\n    protected handleRecognizingCallback(result: SpeechRecognitionResult, duration: number, sessionId: string): void {\r\n        try {\r\n            const ev = new SpeechRecognitionEventArgs(result, duration, sessionId);\r\n            this.privTranscriberRecognizer.recognizing(this.privTranscriberRecognizer, ev);\r\n            /* eslint-disable no-empty */\r\n        } catch (error) {\r\n            // Not going to let errors in the event handler\r\n            // trip things up.\r\n        }\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n        if (this.privTranscriberRecognizer.IsMeetingRecognizer()) {\r\n            if (!!this.privTranscriberRecognizer.canceled) {\r\n                const cancelEvent: MeetingTranscriptionCanceledEventArgs = new MeetingTranscriptionCanceledEventArgs(\r\n                    cancellationReason,\r\n                    error,\r\n                    errorCode,\r\n                    undefined,\r\n                    sessionId);\r\n                try {\r\n                    this.privTranscriberRecognizer.canceled(this.privTranscriberRecognizer, cancelEvent);\r\n                    /* eslint-disable no-empty */\r\n                } catch { }\r\n            }\r\n        } else {\r\n            if (!!this.privTranscriberRecognizer.canceled) {\r\n                const cancelEvent: ConversationTranscriptionCanceledEventArgs = new ConversationTranscriptionCanceledEventArgs(\r\n                    cancellationReason,\r\n                    error,\r\n                    errorCode,\r\n                    undefined,\r\n                    sessionId);\r\n                try {\r\n                    this.privTranscriberRecognizer.canceled(this.privTranscriberRecognizer, cancelEvent);\r\n                    /* eslint-disable no-empty */\r\n                } catch { }\r\n            }\r\n        }\r\n\r\n        if (!!this.privSuccessCallback) {\r\n            const result: SpeechRecognitionResult = new SpeechRecognitionResult(\r\n                requestId,\r\n                ResultReason.Canceled,\r\n                undefined, // Text\r\n                undefined, // Duration\r\n                undefined, // Offset\r\n                undefined, // Language\r\n                undefined, // Language Detection Confidence\r\n                undefined, // Speaker Id\r\n                error,\r\n                undefined, // Json\r\n                properties);\r\n            try {\r\n                this.privSuccessCallback(result);\r\n                this.privSuccessCallback = undefined;\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n    }\r\n\r\n    // Encapsulated for derived service recognizers that need to send additional JSON\r\n    protected async sendTranscriptionStartJSON(connection: IConnection): Promise<void> {\r\n        await this.sendSpeechContext(connection, true);\r\n        if (this.privTranscriberRecognizer.IsMeetingRecognizer()) {\r\n            const info: MeetingInfo = this.privTranscriberRecognizer.getMeetingInfo();\r\n            const payload: { [id: string]: any } = this.createMeetingSpeechEventPayload(info, \"start\");\r\n            await this.sendSpeechEvent(connection, payload);\r\n        } else {\r\n            const info: ConversationInfo = this.privTranscriberRecognizer.getConversationInfo();\r\n            const payload: { [id: string]: any } = this.createSpeechEventPayload(info, \"start\");\r\n            await this.sendSpeechEvent(connection, payload);\r\n        }\r\n        await this.sendWaveHeader(connection);\r\n        return;\r\n    }\r\n\r\n    protected sendSpeechEvent(connection: IConnection, payload: { [id: string]: any }): Promise<void> {\r\n        const speechEventJson = JSON.stringify(payload);\r\n\r\n        if (speechEventJson) {\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"speech.event\",\r\n                this.privRequestSession.requestId,\r\n                \"application/json\",\r\n                speechEventJson));\r\n        }\r\n        return;\r\n    }\r\n\r\n    private createSpeechEventPayload(info: ConversationInfo, command: string): { [id: string]: any } {\r\n        const eventDict: { id: string; name: string; meeting: ConversationProperties } = { id: \"meeting\", name: command, meeting: info.conversationProperties };\r\n        eventDict.meeting.id = info.id;\r\n        eventDict.meeting.attendees = info.participants;\r\n        return eventDict;\r\n    }\r\n\r\n    private createMeetingSpeechEventPayload(info: MeetingInfo, command: string): { [id: string]: any } {\r\n        const eventDict: { id: string; name: string; meeting: MeetingProperties } = { id: \"meeting\", name: command, meeting: info.meetingProperties };\r\n        eventDict.meeting.id = info.id;\r\n        eventDict.meeting.attendees = info.participants;\r\n        return eventDict;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IPrimaryLanguage, RecognitionStatus } from \"../Exports.js\";\r\n\r\n// speech.phrase for detailed\r\nexport interface IDetailedSpeechPhrase {\r\n    RecognitionStatus: RecognitionStatus;\r\n    NBest: IPhrase[];\r\n    Duration?: number;\r\n    Offset?: number;\r\n    PrimaryLanguage?: IPrimaryLanguage;\r\n    DisplayText?: string;\r\n    SpeakerId?: string;\r\n}\r\n\r\nexport interface IPhrase {\r\n    Confidence?: number;\r\n    Lexical: string;\r\n    ITN: string;\r\n    MaskedITN: string;\r\n    Display?: string;\r\n    DisplayText?: string;\r\n    Words?: IWord[];\r\n    DisplayWords?: IWord[];\r\n}\r\n\r\nexport interface IWord {\r\n    Word: string;\r\n    Offset: number;\r\n    Duration: number;\r\n}\r\n\r\nexport class DetailedSpeechPhrase implements IDetailedSpeechPhrase {\r\n    private privDetailedSpeechPhrase: IDetailedSpeechPhrase;\r\n\r\n    private constructor(json: string) {\r\n        this.privDetailedSpeechPhrase = JSON.parse(json) as IDetailedSpeechPhrase;\r\n        this.privDetailedSpeechPhrase.RecognitionStatus = RecognitionStatus[this.privDetailedSpeechPhrase.RecognitionStatus as unknown as keyof typeof RecognitionStatus];\r\n    }\r\n\r\n    public static fromJSON(json: string): DetailedSpeechPhrase {\r\n        return new DetailedSpeechPhrase(json);\r\n    }\r\n\r\n    public getJsonWithCorrectedOffsets(baseOffset: number): string {\r\n        if (!!this.privDetailedSpeechPhrase.NBest) {\r\n            let firstWordOffset: number;\r\n            for (const phrase of this.privDetailedSpeechPhrase.NBest) {\r\n                if (!!phrase.Words && !!phrase.Words[0]) {\r\n                    firstWordOffset = phrase.Words[0].Offset;\r\n                    break;\r\n                }\r\n            }\r\n            if (!!firstWordOffset && firstWordOffset < baseOffset) {\r\n                const offset: number = baseOffset - firstWordOffset;\r\n                for (const details of this.privDetailedSpeechPhrase.NBest) {\r\n                    if (!!details.Words) {\r\n                        for (const word of details.Words) {\r\n                            word.Offset += offset;\r\n                        }\r\n                    }\r\n                    if (!!details.DisplayWords) {\r\n                        for (const word of details.DisplayWords) {\r\n                            word.Offset += offset;\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        return JSON.stringify(this.privDetailedSpeechPhrase);\r\n    }\r\n\r\n    public get RecognitionStatus(): RecognitionStatus {\r\n        return this.privDetailedSpeechPhrase.RecognitionStatus;\r\n    }\r\n    public get NBest(): IPhrase[] {\r\n        return this.privDetailedSpeechPhrase.NBest;\r\n    }\r\n    public get Duration(): number {\r\n        return this.privDetailedSpeechPhrase.Duration;\r\n    }\r\n    public get Offset(): number {\r\n        return this.privDetailedSpeechPhrase.Offset;\r\n    }\r\n    public get Language(): string {\r\n        return this.privDetailedSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privDetailedSpeechPhrase.PrimaryLanguage.Language;\r\n    }\r\n    public get LanguageDetectionConfidence(): string {\r\n        return this.privDetailedSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privDetailedSpeechPhrase.PrimaryLanguage.Confidence;\r\n    }\r\n    public get Text(): string {\r\n        if (!!this.privDetailedSpeechPhrase.NBest && this.privDetailedSpeechPhrase.NBest[0]) {\r\n            return this.privDetailedSpeechPhrase.NBest[0].Display || this.privDetailedSpeechPhrase.NBest[0].DisplayText;\r\n        }\r\n        return this.privDetailedSpeechPhrase.DisplayText;\r\n    }\r\n    public get SpeakerId(): string {\r\n        return this.privDetailedSpeechPhrase.SpeakerId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { RecognitionStatus } from \"../Exports.js\";\r\n\r\n// speech.phrase\r\nexport interface ISimpleSpeechPhrase {\r\n    RecognitionStatus: RecognitionStatus;\r\n    DisplayText: string;\r\n    Offset?: number;\r\n    Duration?: number;\r\n    PrimaryLanguage?: IPrimaryLanguage;\r\n    SpeakerId?: string;\r\n}\r\n\r\nexport interface IPrimaryLanguage {\r\n    Language: string;\r\n    Confidence: string;\r\n}\r\n\r\nexport class SimpleSpeechPhrase implements ISimpleSpeechPhrase {\r\n    private privSimpleSpeechPhrase: ISimpleSpeechPhrase;\r\n\r\n    private constructor(json: string) {\r\n        this.privSimpleSpeechPhrase = JSON.parse(json) as ISimpleSpeechPhrase;\r\n        this.privSimpleSpeechPhrase.RecognitionStatus = RecognitionStatus[this.privSimpleSpeechPhrase.RecognitionStatus as unknown as keyof typeof RecognitionStatus];\r\n    }\r\n\r\n    public static fromJSON(json: string): SimpleSpeechPhrase {\r\n        return new SimpleSpeechPhrase(json);\r\n    }\r\n\r\n    public get RecognitionStatus(): RecognitionStatus {\r\n        return this.privSimpleSpeechPhrase.RecognitionStatus;\r\n    }\r\n\r\n    public get DisplayText(): string {\r\n        return this.privSimpleSpeechPhrase.DisplayText;\r\n    }\r\n\r\n    public get Offset(): number {\r\n        return this.privSimpleSpeechPhrase.Offset;\r\n    }\r\n\r\n    public get Duration(): number {\r\n        return this.privSimpleSpeechPhrase.Duration;\r\n    }\r\n\r\n    public get Language(): string {\r\n        return this.privSimpleSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privSimpleSpeechPhrase.PrimaryLanguage.Language;\r\n    }\r\n\r\n    public get LanguageDetectionConfidence(): string {\r\n        return this.privSimpleSpeechPhrase.PrimaryLanguage === undefined ? undefined : this.privSimpleSpeechPhrase.PrimaryLanguage.Confidence;\r\n    }\r\n\r\n    public get SpeakerId(): string {\r\n        return this.privSimpleSpeechPhrase.SpeakerId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { LanguageUnderstandingModelImpl } from \"../sdk/LanguageUnderstandingModel.js\";\r\n\r\n/**\r\n * @class AddedLmIntent\r\n */\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class AddedLmIntent {\r\n    public modelImpl: LanguageUnderstandingModelImpl;\r\n    public intentName: string;\r\n\r\n    /**\r\n     * Creates and initializes an instance of this class.\r\n     * @constructor\r\n     * @param modelImpl - The model.\r\n     * @param intentName - The intent name.\r\n     */\r\n    public constructor(modelImpl: LanguageUnderstandingModelImpl, intentName: string) {\r\n        this.modelImpl = modelImpl;\r\n        this.intentName = intentName;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    Deferred,\r\n    IAudioSource,\r\n    MessageType,\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    IntentRecognitionCanceledEventArgs,\r\n    IntentRecognitionEventArgs,\r\n    IntentRecognitionResult,\r\n    IntentRecognizer,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    AddedLmIntent,\r\n    CancellationErrorCodePropertyName,\r\n    EnumTranslation,\r\n    IntentResponse,\r\n    ServiceRecognizerBase,\r\n    SimpleSpeechPhrase,\r\n    SpeechHypothesis,\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class IntentServiceRecognizer extends ServiceRecognizerBase {\r\n    private privIntentRecognizer: IntentRecognizer;\r\n    private privAddedLmIntents: { [id: string]: AddedLmIntent };\r\n    private privIntentDataSent: boolean;\r\n    private privUmbrellaIntent: AddedLmIntent;\r\n    private privPendingIntentArgs: IntentRecognitionEventArgs;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        recognizer: IntentRecognizer) {\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, recognizer);\r\n        this.privIntentRecognizer = recognizer;\r\n        this.privIntentDataSent = false;\r\n    }\r\n\r\n    public setIntents(addedIntents: { [id: string]: AddedLmIntent }, umbrellaIntent: AddedLmIntent): void {\r\n        this.privAddedLmIntents = addedIntents;\r\n        this.privUmbrellaIntent = umbrellaIntent;\r\n        this.privIntentDataSent = true;\r\n    }\r\n\r\n    protected processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n\r\n        let result: IntentRecognitionResult;\r\n        let ev: IntentRecognitionEventArgs;\r\n        let processed: boolean = false;\r\n\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        if (connectionMessage.messageType === MessageType.Text) {\r\n            resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n        }\r\n\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            case \"speech.hypothesis\":\r\n                const speechHypothesis: SpeechHypothesis = SpeechHypothesis.fromJSON(connectionMessage.textBody);\r\n\r\n                result = new IntentRecognitionResult(\r\n                    undefined,\r\n                    this.privRequestSession.requestId,\r\n                    ResultReason.RecognizingIntent,\r\n                    speechHypothesis.Text,\r\n                    speechHypothesis.Duration,\r\n                    speechHypothesis.Offset + this.privRequestSession.currentTurnAudioOffset,\r\n                    speechHypothesis.Language,\r\n                    speechHypothesis.LanguageDetectionConfidence,\r\n                    undefined,\r\n                    connectionMessage.textBody,\r\n                    resultProps);\r\n\r\n                this.privRequestSession.onHypothesis(result.offset);\r\n\r\n                ev = new IntentRecognitionEventArgs(result, speechHypothesis.Offset + this.privRequestSession.currentTurnAudioOffset, this.privRequestSession.sessionId);\r\n\r\n                if (!!this.privIntentRecognizer.recognizing) {\r\n                    try {\r\n                        this.privIntentRecognizer.recognizing(this.privIntentRecognizer, ev);\r\n                        /* eslint-disable no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"speech.phrase\":\r\n                const simple: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(connectionMessage.textBody);\r\n                result = new IntentRecognitionResult(\r\n                    undefined,\r\n                    this.privRequestSession.requestId,\r\n                    EnumTranslation.implTranslateRecognitionResult(simple.RecognitionStatus),\r\n                    simple.DisplayText,\r\n                    simple.Duration,\r\n                    simple.Offset + this.privRequestSession.currentTurnAudioOffset,\r\n                    simple.Language,\r\n                    simple.LanguageDetectionConfidence,\r\n                    undefined,\r\n                    connectionMessage.textBody,\r\n                    resultProps);\r\n\r\n                ev = new IntentRecognitionEventArgs(result, result.offset, this.privRequestSession.sessionId);\r\n\r\n                const sendEvent: () => void = (): void => {\r\n                    if (!!this.privIntentRecognizer.recognized) {\r\n                        try {\r\n                            this.privIntentRecognizer.recognized(this.privIntentRecognizer, ev);\r\n                            /* eslint-disable no-empty */\r\n                        } catch (error) {\r\n                            // Not going to let errors in the event handler\r\n                            // trip things up.\r\n                        }\r\n                    }\r\n\r\n                    // report result to promise.\r\n                    if (!!this.privSuccessCallback) {\r\n                        try {\r\n                            this.privSuccessCallback(result);\r\n                        } catch (e) {\r\n                            if (!!this.privErrorCallback) {\r\n                                this.privErrorCallback(e as string);\r\n                            }\r\n                        }\r\n                        // Only invoke the call back once.\r\n                        // and if it's successful don't invoke the\r\n                        // error after that.\r\n                        this.privSuccessCallback = undefined;\r\n                        this.privErrorCallback = undefined;\r\n                    }\r\n                };\r\n\r\n                // If intent data was sent, the terminal result for this recognizer is an intent being found.\r\n                // If no intent data was sent, the terminal event is speech recognition being successful.\r\n                if (false === this.privIntentDataSent || ResultReason.NoMatch === ev.result.reason) {\r\n                    // Advance the buffers.\r\n                    this.privRequestSession.onPhraseRecognized(ev.offset + ev.result.duration);\r\n                    sendEvent();\r\n                } else {\r\n                    // Squirrel away the args, when the response event arrives it will build upon them\r\n                    // and then return\r\n                    this.privPendingIntentArgs = ev;\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"response\":\r\n                // Response from LUIS\r\n                ev = this.privPendingIntentArgs;\r\n                this.privPendingIntentArgs = undefined;\r\n\r\n                if (undefined === ev) {\r\n                    if (\"\" === connectionMessage.textBody) {\r\n                        // This condition happens if there is nothing but silence in the\r\n                        // audio sent to the service.\r\n                        return;\r\n                    }\r\n\r\n                    // Odd... Not sure this can happen\r\n                    ev = new IntentRecognitionEventArgs(new IntentRecognitionResult(), 0, this.privRequestSession.sessionId);\r\n                }\r\n\r\n                const intentResponse: IntentResponse = IntentResponse.fromJSON(connectionMessage.textBody);\r\n\r\n                // If LUIS didn't return anything, send the existing event, else\r\n                // modify it to show the match.\r\n                // See if the intent found is in the list of intents asked for.\r\n\r\n                if (null !== intentResponse && !!intentResponse.topScoringIntent && !!intentResponse.topScoringIntent.intent) {\r\n                    let addedIntent: AddedLmIntent = this.privAddedLmIntents[intentResponse.topScoringIntent.intent];\r\n\r\n                    if (this.privUmbrellaIntent !== undefined) {\r\n                        addedIntent = this.privUmbrellaIntent;\r\n                    }\r\n\r\n                    if (!!addedIntent) {\r\n                        const intentId = addedIntent === undefined || addedIntent.intentName === undefined ? intentResponse.topScoringIntent.intent : addedIntent.intentName;\r\n                        let reason = ev.result.reason;\r\n\r\n                        if (undefined !== intentId) {\r\n                            reason = ResultReason.RecognizedIntent;\r\n                        }\r\n\r\n                        // make sure, properties is set.\r\n                        const properties = (undefined !== ev.result.properties) ?\r\n                            ev.result.properties : new PropertyCollection();\r\n\r\n                        properties.setProperty(PropertyId.LanguageUnderstandingServiceResponse_JsonResult, connectionMessage.textBody);\r\n\r\n                        ev = new IntentRecognitionEventArgs(\r\n                            new IntentRecognitionResult(\r\n                                intentId,\r\n                                ev.result.resultId,\r\n                                reason,\r\n                                ev.result.text,\r\n                                ev.result.duration,\r\n                                ev.result.offset,\r\n                                undefined,\r\n                                undefined,\r\n                                ev.result.errorDetails,\r\n                                ev.result.json,\r\n                                properties),\r\n                            ev.offset,\r\n                            ev.sessionId);\r\n\r\n                    }\r\n                }\r\n                this.privRequestSession.onPhraseRecognized(ev.offset + ev.result.duration);\r\n\r\n                if (!!this.privIntentRecognizer.recognized) {\r\n                    try {\r\n                        this.privIntentRecognizer.recognized(this.privIntentRecognizer, ev);\r\n                        /* eslint-disable no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n\r\n                // report result to promise.\r\n                if (!!this.privSuccessCallback) {\r\n                    try {\r\n                        this.privSuccessCallback(ev.result);\r\n                    } catch (e) {\r\n                        if (!!this.privErrorCallback) {\r\n                            this.privErrorCallback(e as string);\r\n                        }\r\n                    }\r\n                    // Only invoke the call back once.\r\n                    // and if it's successful don't invoke the\r\n                    // error after that.\r\n                    this.privSuccessCallback = undefined;\r\n                    this.privErrorCallback = undefined;\r\n                }\r\n                processed = true;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        const defferal = new Deferred<boolean>();\r\n        defferal.resolve(processed);\r\n        return defferal.promise;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n        if (!!this.privIntentRecognizer.canceled) {\r\n\r\n            const cancelEvent: IntentRecognitionCanceledEventArgs = new IntentRecognitionCanceledEventArgs(\r\n                cancellationReason,\r\n                error,\r\n                errorCode,\r\n                undefined,\r\n                undefined,\r\n                sessionId);\r\n            try {\r\n                this.privIntentRecognizer.canceled(this.privIntentRecognizer, cancelEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n\r\n        if (!!this.privSuccessCallback) {\r\n            const result: IntentRecognitionResult = new IntentRecognitionResult(\r\n                undefined, // Intent Id\r\n                requestId,\r\n                ResultReason.Canceled,\r\n                undefined, // Text\r\n                undefined, // Duration\r\n                undefined, // Offset\r\n                undefined, // Language\r\n                undefined, // LanguageDetectionConfidence\r\n                error,\r\n                undefined, // Json\r\n                properties);\r\n            try {\r\n                this.privSuccessCallback(result);\r\n                this.privSuccessCallback = undefined;\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// response\r\n\r\nexport interface IIntentResponse {\r\n    query?: string;\r\n    topScoringIntent?: ISingleIntent;\r\n    entities?: IIntentEntity[];\r\n}\r\n\r\nexport interface IIntentEntity {\r\n    entity: string;\r\n    type: string;\r\n    startIndex: number;\r\n    endIndex: number;\r\n    score: number;\r\n}\r\n\r\nexport interface ISingleIntent {\r\n    intent: string;\r\n    score: number;\r\n}\r\n\r\nexport class IntentResponse implements IIntentResponse {\r\n    private privIntentResponse: IIntentResponse;\r\n\r\n    private constructor(json: string) {\r\n        if (json === \"\") {\r\n            this.privIntentResponse = {};\r\n        } else {\r\n            this.privIntentResponse = JSON.parse(json) as IIntentResponse;\r\n        }\r\n    }\r\n\r\n    public static fromJSON(json: string): IntentResponse {\r\n        return new IntentResponse(json);\r\n    }\r\n\r\n    public get query(): string {\r\n        return this.privIntentResponse.query;\r\n    }\r\n\r\n    public get topScoringIntent(): ISingleIntent {\r\n        return this.privIntentResponse.topScoringIntent;\r\n    }\r\n\r\n    public get entities(): IIntentEntity[] {\r\n        return this.privIntentResponse.entities;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ReplayableAudioNode } from \"../common.browser/Exports.js\";\r\nimport {\r\n    createNoDashGuid,\r\n    Deferred,\r\n    Events,\r\n    IDetachable,\r\n    IEventSource,\r\n    PlatformEvent\r\n} from \"../common/Exports.js\";\r\nimport {\r\n    ConnectingToServiceEvent,\r\n    ListeningStartedEvent,\r\n    RecognitionStartedEvent,\r\n    RecognitionTriggeredEvent,\r\n    SpeechRecognitionEvent,\r\n} from \"./RecognitionEvents.js\";\r\nimport { ServiceTelemetryListener } from \"./ServiceTelemetryListener.Internal.js\";\r\n\r\nexport class RequestSession {\r\n    private privIsDisposed: boolean = false;\r\n    private privServiceTelemetryListener: ServiceTelemetryListener;\r\n    private privDetachables: IDetachable[] = new Array<IDetachable>();\r\n    private privRequestId: string;\r\n    private privAudioSourceId: string;\r\n    private privAudioNodeId: string;\r\n    private privAudioNode: ReplayableAudioNode;\r\n    private privAuthFetchEventId: string;\r\n    private privIsAudioNodeDetached: boolean = false;\r\n    private privIsRecognizing: boolean = false;\r\n    private privIsSpeechEnded: boolean = false;\r\n    private privTurnStartAudioOffset: number = 0;\r\n    private privLastRecoOffset: number = 0;\r\n    private privHypothesisReceived: boolean = false;\r\n    private privBytesSent: number = 0;\r\n    private privRecognitionBytesSent: number = 0;\r\n    private privRecogNumber: number = 0;\r\n    private privSessionId: string;\r\n    private privTurnDeferral: Deferred<void>;\r\n    private privInTurn: boolean = false;\r\n    private privConnectionAttempts: number = 0;\r\n\r\n    public constructor(audioSourceId: string) {\r\n        this.privAudioSourceId = audioSourceId;\r\n        this.privRequestId = createNoDashGuid();\r\n        this.privAudioNodeId = createNoDashGuid();\r\n        this.privTurnDeferral = new Deferred<void>();\r\n\r\n        // We're not in a turn, so resolve.\r\n        this.privTurnDeferral.resolve();\r\n    }\r\n\r\n    public get sessionId(): string {\r\n        return this.privSessionId;\r\n    }\r\n\r\n    public get requestId(): string {\r\n        return this.privRequestId;\r\n    }\r\n\r\n    public get audioNodeId(): string {\r\n        return this.privAudioNodeId;\r\n    }\r\n\r\n    public get turnCompletionPromise(): Promise<void> {\r\n        return this.privTurnDeferral.promise;\r\n    }\r\n\r\n    public get isSpeechEnded(): boolean {\r\n        return this.privIsSpeechEnded;\r\n    }\r\n\r\n    public get isRecognizing(): boolean {\r\n        return this.privIsRecognizing;\r\n    }\r\n\r\n    public get currentTurnAudioOffset(): number {\r\n        return this.privTurnStartAudioOffset;\r\n    }\r\n\r\n    public get recogNumber(): number {\r\n        return this.privRecogNumber;\r\n    }\r\n\r\n    public get numConnectionAttempts(): number {\r\n        return this.privConnectionAttempts;\r\n    }\r\n\r\n    // The number of bytes sent for the current connection.\r\n    // Counter is reset to 0 each time a connection is established.\r\n    public get bytesSent(): number {\r\n        return this.privBytesSent;\r\n    }\r\n\r\n    // The number of bytes sent for the current recognition.\r\n    // Counter is reset to 0 each time recognition is started.\r\n    public get recognitionBytesSent(): number {\r\n        return this.privRecognitionBytesSent;\r\n    }\r\n\r\n    public listenForServiceTelemetry(eventSource: IEventSource<PlatformEvent>): void {\r\n        if (!!this.privServiceTelemetryListener) {\r\n            this.privDetachables.push(eventSource.attachListener(this.privServiceTelemetryListener));\r\n        }\r\n    }\r\n\r\n    public startNewRecognition(): void {\r\n        this.privRecognitionBytesSent = 0;\r\n        this.privIsSpeechEnded = false;\r\n        this.privIsRecognizing = true;\r\n        this.privTurnStartAudioOffset = 0;\r\n        this.privLastRecoOffset = 0;\r\n        this.privRecogNumber++;\r\n        this.privServiceTelemetryListener = new ServiceTelemetryListener(this.privRequestId, this.privAudioSourceId, this.privAudioNodeId);\r\n        this.onEvent(new RecognitionTriggeredEvent(this.requestId, this.privSessionId, this.privAudioSourceId, this.privAudioNodeId));\r\n    }\r\n\r\n    public async onAudioSourceAttachCompleted(audioNode: ReplayableAudioNode, isError: boolean): Promise<void> {\r\n        this.privAudioNode = audioNode;\r\n        this.privIsAudioNodeDetached = false;\r\n\r\n        if (isError) {\r\n            await this.onComplete();\r\n        } else {\r\n            this.onEvent(new ListeningStartedEvent(this.privRequestId, this.privSessionId, this.privAudioSourceId, this.privAudioNodeId));\r\n        }\r\n    }\r\n\r\n    public onPreConnectionStart(authFetchEventId: string, connectionId: string): void {\r\n        this.privAuthFetchEventId = authFetchEventId;\r\n        this.privSessionId = connectionId;\r\n        this.onEvent(new ConnectingToServiceEvent(this.privRequestId, this.privAuthFetchEventId, this.privSessionId));\r\n    }\r\n\r\n    public async onAuthCompleted(isError: boolean): Promise<void> {\r\n        if (isError) {\r\n            await this.onComplete();\r\n        }\r\n    }\r\n\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    public async onConnectionEstablishCompleted(statusCode: number, reason?: string): Promise<void> {\r\n        if (statusCode === 200) {\r\n            this.onEvent(new RecognitionStartedEvent(this.requestId, this.privAudioSourceId, this.privAudioNodeId, this.privAuthFetchEventId, this.privSessionId));\r\n            if (!!this.privAudioNode) {\r\n                this.privAudioNode.replay();\r\n            }\r\n            this.privTurnStartAudioOffset = this.privLastRecoOffset;\r\n            this.privBytesSent = 0;\r\n            return;\r\n        } else if (statusCode === 403) {\r\n            await this.onComplete();\r\n        }\r\n    }\r\n\r\n    public async onServiceTurnEndResponse(continuousRecognition: boolean): Promise<void> {\r\n        this.privTurnDeferral.resolve();\r\n\r\n        if (!continuousRecognition || this.isSpeechEnded) {\r\n            await this.onComplete();\r\n            this.privInTurn = false;\r\n        } else {\r\n            // Start a new request set.\r\n            this.privTurnStartAudioOffset = this.privLastRecoOffset;\r\n            this.privAudioNode.replay();\r\n        }\r\n    }\r\n\r\n    public onSpeechContext(): void {\r\n        this.privRequestId = createNoDashGuid();\r\n    }\r\n\r\n    public onServiceTurnStartResponse(): void {\r\n        if (!!this.privTurnDeferral && !!this.privInTurn) {\r\n            // What? How are we starting a turn with another not done?\r\n            this.privTurnDeferral.reject(\"Another turn started before current completed.\");\r\n            // Avoid UnhandledPromiseRejection if privTurnDeferral is not being awaited\r\n            // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n            this.privTurnDeferral.promise.then().catch((): void => { });\r\n        }\r\n        this.privInTurn = true;\r\n        this.privTurnDeferral = new Deferred<void>();\r\n    }\r\n\r\n    public onHypothesis(offset: number): void {\r\n        if (!this.privHypothesisReceived) {\r\n            this.privHypothesisReceived = true;\r\n            this.privServiceTelemetryListener.hypothesisReceived(this.privAudioNode.findTimeAtOffset(offset));\r\n        }\r\n    }\r\n\r\n    public onPhraseRecognized(offset: number): void {\r\n        this.privServiceTelemetryListener.phraseReceived(this.privAudioNode.findTimeAtOffset(offset));\r\n        this.onServiceRecognized(offset);\r\n    }\r\n\r\n    public onServiceRecognized(offset: number): void {\r\n        this.privLastRecoOffset = offset;\r\n        this.privHypothesisReceived = false;\r\n        this.privAudioNode.shrinkBuffers(offset);\r\n        this.privConnectionAttempts = 0;\r\n    }\r\n\r\n    public onAudioSent(bytesSent: number): void {\r\n        this.privBytesSent += bytesSent;\r\n        this.privRecognitionBytesSent += bytesSent;\r\n    }\r\n\r\n    public onRetryConnection(): void {\r\n        this.privConnectionAttempts++;\r\n    }\r\n\r\n    public async dispose(): Promise<void> {\r\n        if (!this.privIsDisposed) {\r\n            // we should have completed by now. If we did not its an unknown error.\r\n            this.privIsDisposed = true;\r\n            for (const detachable of this.privDetachables) {\r\n                await detachable.detach();\r\n            }\r\n\r\n            if (!!this.privServiceTelemetryListener) {\r\n                this.privServiceTelemetryListener.dispose();\r\n            }\r\n            this.privIsRecognizing = false;\r\n        }\r\n    }\r\n\r\n    public getTelemetry(): string {\r\n        if (this.privServiceTelemetryListener.hasTelemetry) {\r\n            return this.privServiceTelemetryListener.getTelemetry();\r\n        } else {\r\n            return null;\r\n        }\r\n    }\r\n\r\n    public async onStopRecognizing(): Promise<void> {\r\n        await this.onComplete();\r\n    }\r\n\r\n    // Should be called with the audioNode for this session has indicated that it is out of speech.\r\n    public onSpeechEnded(): void {\r\n        this.privIsSpeechEnded = true;\r\n    }\r\n\r\n    protected onEvent(event: SpeechRecognitionEvent): void {\r\n        if (!!this.privServiceTelemetryListener) {\r\n            this.privServiceTelemetryListener.onEvent(event);\r\n        }\r\n        Events.instance.onEvent(event);\r\n    }\r\n\r\n    private async onComplete(): Promise<void> {\r\n        if (!!this.privIsRecognizing) {\r\n            this.privIsRecognizing = false;\r\n            await this.detachAudioNode();\r\n        }\r\n    }\r\n\r\n    private async detachAudioNode(): Promise<void> {\r\n        if (!this.privIsAudioNodeDetached) {\r\n            this.privIsAudioNodeDetached = true;\r\n            if (this.privAudioNode) {\r\n                await this.privAudioNode.detach();\r\n            }\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport {\r\n    AudioSourceErrorEvent,\r\n    AudioStreamNodeAttachedEvent,\r\n    AudioStreamNodeAttachingEvent,\r\n    AudioStreamNodeDetachedEvent,\r\n    AudioStreamNodeErrorEvent,\r\n    ConnectionEstablishedEvent,\r\n    ConnectionEstablishErrorEvent,\r\n    ConnectionMessageReceivedEvent,\r\n    ConnectionStartEvent,\r\n    IEventListener,\r\n    IStringDictionary,\r\n    PlatformEvent,\r\n} from \"../common/Exports.js\";\r\nimport { ConnectingToServiceEvent, RecognitionTriggeredEvent } from \"./RecognitionEvents.js\";\r\n\r\nexport interface ITelemetry {\r\n    Metrics: IMetric[];\r\n    ReceivedMessages: IStringDictionary<string[]>;\r\n}\r\n\r\nexport interface IMetric {\r\n    End?: string;\r\n    Error?: string;\r\n    Id?: string;\r\n    Name?: string;\r\n    Start?: string;\r\n    PhraseLatencyMs?: number[];\r\n    FirstHypothesisLatencyMs?: number[];\r\n}\r\n\r\nexport class ServiceTelemetryListener implements IEventListener<PlatformEvent> {\r\n    private privIsDisposed: boolean = false;\r\n\r\n    private privRequestId: string;\r\n    private privAudioSourceId: string;\r\n    private privAudioNodeId: string;\r\n\r\n    private privListeningTriggerMetric: IMetric = null;\r\n    private privMicMetric: IMetric = null;\r\n    private privConnectionEstablishMetric: IMetric = null;\r\n\r\n    private privMicStartTime: string;\r\n\r\n    private privConnectionId: string;\r\n    private privConnectionStartTime: string;\r\n\r\n    private privReceivedMessages: IStringDictionary<string[]>;\r\n    private privPhraseLatencies: number[];\r\n    private privHypothesisLatencies: number[];\r\n\r\n    public constructor(requestId: string, audioSourceId: string, audioNodeId: string) {\r\n        this.privRequestId = requestId;\r\n        this.privAudioSourceId = audioSourceId;\r\n        this.privAudioNodeId = audioNodeId;\r\n\r\n        this.privReceivedMessages = {};\r\n        this.privPhraseLatencies = [];\r\n        this.privHypothesisLatencies = [];\r\n    }\r\n\r\n    public phraseReceived(audioReceivedTime: number): void {\r\n        if (audioReceivedTime > 0) { // 0 indicates the time is unknown. Drop it.\r\n            this.privPhraseLatencies.push(Date.now() - audioReceivedTime);\r\n        }\r\n    }\r\n\r\n    public hypothesisReceived(audioReceivedTime: number): void {\r\n        if (audioReceivedTime > 0) { // 0 indicates the time is unknown. Drop it.\r\n            this.privHypothesisLatencies.push(Date.now() - audioReceivedTime);\r\n        }\r\n    }\r\n\r\n    public onEvent(e: PlatformEvent): void {\r\n        if (this.privIsDisposed) {\r\n            return;\r\n        }\r\n\r\n        if (e instanceof RecognitionTriggeredEvent && e.requestId === this.privRequestId) {\r\n            this.privListeningTriggerMetric = {\r\n                End: e.eventTime,\r\n                Name: \"ListeningTrigger\",\r\n                Start: e.eventTime,\r\n            };\r\n        }\r\n\r\n        if (e instanceof AudioStreamNodeAttachingEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\r\n            this.privMicStartTime = e.eventTime;\r\n        }\r\n\r\n        if (e instanceof AudioStreamNodeAttachedEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\r\n            this.privMicStartTime = e.eventTime;\r\n        }\r\n\r\n        if (e instanceof AudioSourceErrorEvent && e.audioSourceId === this.privAudioSourceId) {\r\n            if (!this.privMicMetric) {\r\n                this.privMicMetric = {\r\n                    End: e.eventTime,\r\n                    Error: e.error,\r\n                    Name: \"Microphone\",\r\n                    Start: this.privMicStartTime,\r\n                };\r\n            }\r\n        }\r\n\r\n        if (e instanceof AudioStreamNodeErrorEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\r\n            if (!this.privMicMetric) {\r\n                this.privMicMetric = {\r\n                    End: e.eventTime,\r\n                    Error: e.error,\r\n                    Name: \"Microphone\",\r\n                    Start: this.privMicStartTime,\r\n                };\r\n            }\r\n        }\r\n\r\n        if (e instanceof AudioStreamNodeDetachedEvent && e.audioSourceId === this.privAudioSourceId && e.audioNodeId === this.privAudioNodeId) {\r\n            if (!this.privMicMetric) {\r\n                this.privMicMetric = {\r\n                    End: e.eventTime,\r\n                    Name: \"Microphone\",\r\n                    Start: this.privMicStartTime,\r\n                };\r\n            }\r\n        }\r\n\r\n        if (e instanceof ConnectingToServiceEvent && e.requestId === this.privRequestId) {\r\n            this.privConnectionId = e.sessionId;\r\n        }\r\n\r\n        if (e instanceof ConnectionStartEvent && e.connectionId === this.privConnectionId) {\r\n            this.privConnectionStartTime = e.eventTime;\r\n        }\r\n\r\n        if (e instanceof ConnectionEstablishedEvent && e.connectionId === this.privConnectionId) {\r\n            if (!this.privConnectionEstablishMetric) {\r\n                this.privConnectionEstablishMetric = {\r\n                    End: e.eventTime,\r\n                    Id: this.privConnectionId,\r\n                    Name: \"Connection\",\r\n                    Start: this.privConnectionStartTime,\r\n                };\r\n            }\r\n        }\r\n\r\n        if (e instanceof ConnectionEstablishErrorEvent && e.connectionId === this.privConnectionId) {\r\n            if (!this.privConnectionEstablishMetric) {\r\n                this.privConnectionEstablishMetric = {\r\n                    End: e.eventTime,\r\n                    Error: this.getConnectionError(e.statusCode),\r\n                    Id: this.privConnectionId,\r\n                    Name: \"Connection\",\r\n                    Start: this.privConnectionStartTime,\r\n                };\r\n            }\r\n        }\r\n\r\n        if (e instanceof ConnectionMessageReceivedEvent && e.connectionId === this.privConnectionId) {\r\n            if (e.message && e.message.headers && e.message.headers.path) {\r\n                if (!this.privReceivedMessages[e.message.headers.path]) {\r\n                    this.privReceivedMessages[e.message.headers.path] = new Array<string>();\r\n                }\r\n                const maxMessagesToSend = 50;\r\n                if (this.privReceivedMessages[e.message.headers.path].length < maxMessagesToSend) {\r\n                    this.privReceivedMessages[e.message.headers.path].push(e.networkReceivedTime);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    public getTelemetry(): string {\r\n        const metrics = new Array<IMetric>();\r\n\r\n        if (this.privListeningTriggerMetric) {\r\n            metrics.push(this.privListeningTriggerMetric);\r\n        }\r\n\r\n        if (this.privMicMetric) {\r\n            metrics.push(this.privMicMetric);\r\n        }\r\n\r\n        if (this.privConnectionEstablishMetric) {\r\n            metrics.push(this.privConnectionEstablishMetric);\r\n        }\r\n\r\n        if (this.privPhraseLatencies.length > 0) {\r\n            metrics.push({\r\n                PhraseLatencyMs: this.privPhraseLatencies,\r\n            });\r\n        }\r\n\r\n        if (this.privHypothesisLatencies.length > 0) {\r\n            metrics.push({\r\n                FirstHypothesisLatencyMs: this.privHypothesisLatencies,\r\n            });\r\n        }\r\n\r\n        const telemetry: ITelemetry = {\r\n            Metrics: metrics,\r\n            ReceivedMessages: this.privReceivedMessages,\r\n        };\r\n\r\n        const json = JSON.stringify(telemetry);\r\n\r\n        // We dont want to send the same telemetry again. So clean those out.\r\n        this.privReceivedMessages = {};\r\n        this.privListeningTriggerMetric = null;\r\n        this.privMicMetric = null;\r\n        this.privConnectionEstablishMetric = null;\r\n        this.privPhraseLatencies = [];\r\n        this.privHypothesisLatencies = [];\r\n        return json;\r\n    }\r\n\r\n    // Determines if there are any telemetry events to send to the service.\r\n    public get hasTelemetry(): boolean {\r\n        return (Object.keys(this.privReceivedMessages).length !== 0 ||\r\n            this.privListeningTriggerMetric !== null ||\r\n            this.privMicMetric !== null ||\r\n            this.privConnectionEstablishMetric !== null ||\r\n            this.privPhraseLatencies.length !== 0 ||\r\n            this.privHypothesisLatencies.length !== 0);\r\n    }\r\n\r\n    public dispose(): void {\r\n        this.privIsDisposed = true;\r\n    }\r\n\r\n    private getConnectionError(statusCode: number): string {\r\n        /*\r\n        -- Websocket status codes --\r\n        NormalClosure = 1000,\r\n        EndpointUnavailable = 1001,\r\n        ProtocolError = 1002,\r\n        InvalidMessageType = 1003,\r\n        Empty = 1005,\r\n        InvalidPayloadData = 1007,\r\n        PolicyViolation = 1008,\r\n        MessageTooBig = 1009,\r\n        MandatoryExtension = 1010,\r\n        InternalServerError = 1011\r\n        */\r\n\r\n        switch (statusCode) {\r\n            case 400:\r\n            case 1002:\r\n            case 1003:\r\n            case 1005:\r\n            case 1007:\r\n            case 1008:\r\n            case 1009: return \"BadRequest\";\r\n            case 401: return \"Unauthorized\";\r\n            case 403: return \"Forbidden\";\r\n            case 503:\r\n            case 1001: return \"ServerUnavailable\";\r\n            case 500:\r\n            case 1011: return \"ServerError\";\r\n            case 408:\r\n            case 504: return \"Timeout\";\r\n            default: return \"statuscode:\" + statusCode.toString();\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    DynamicGrammarBuilder,\r\n    IDynamicGrammar,\r\n} from \"./Exports.js\";\r\n\r\ninterface Context {\r\n    [section: string]: any;\r\n}\r\n\r\ninterface PhraseContext {\r\n    [section: string]: any;\r\n    phraseDetection?: {\r\n        enrichment?: {\r\n            pronunciationAssessment: any;\r\n            contentAssessment?: {\r\n                topic: string;\r\n            };\r\n        };\r\n        speakerDiarization?: {\r\n            mode?: string;\r\n            audioSessionId?: string;\r\n            audioOffsetMs?: number;\r\n            identityProvider?: string;\r\n        };\r\n        mode?: string;\r\n    };\r\n    phraseOutput?: {\r\n        detailed?: {\r\n            options?: string[];\r\n        };\r\n        format?: any;\r\n    };\r\n}\r\n\r\n/**\r\n * Represents the JSON used in the speech.context message sent to the speech service.\r\n * The dynamic grammar is always refreshed from the encapsulated dynamic grammar object.\r\n */\r\nexport class SpeechContext {\r\n    private privContext: PhraseContext = {};\r\n    private privDynamicGrammar: DynamicGrammarBuilder;\r\n\r\n    public constructor(dynamicGrammar: DynamicGrammarBuilder) {\r\n        this.privDynamicGrammar = dynamicGrammar;\r\n    }\r\n\r\n    /**\r\n     * Gets a section of the speech.context object.\r\n     * @param sectionName Name of the section to get.\r\n     * @return string or Context JSON serializable object that represents the value.\r\n     */\r\n    public getSection(sectionName: string): string | Context {\r\n        return (this.privContext[sectionName] || {}) as string | Context;\r\n    }\r\n\r\n    /**\r\n     * Adds a section to the speech.context object.\r\n     * @param sectionName Name of the section to add.\r\n     * @param value JSON serializable object that represents the value.\r\n     */\r\n    public setSection(sectionName: string, value: string | Context): void {\r\n        this.privContext[sectionName] = value;\r\n    }\r\n\r\n    /**\r\n     * @Internal\r\n     * This is only used by pronunciation assessment config.\r\n     * Do not use externally, object returned will change without warning or notice.\r\n     */\r\n    public setPronunciationAssessmentParams(params: string,\r\n        contentAssessmentTopic: string,\r\n        isSpeakerDiarizationEnabled: boolean = false): void {\r\n        if (this.privContext.phraseDetection === undefined) {\r\n            this.privContext.phraseDetection = {\r\n                enrichment: {\r\n                    pronunciationAssessment: {}\r\n                }\r\n            };\r\n        }\r\n        if (this.privContext.phraseDetection.enrichment === undefined) {\r\n            this.privContext.phraseDetection.enrichment = {\r\n                pronunciationAssessment: {}\r\n            };\r\n        }\r\n        this.privContext.phraseDetection.enrichment.pronunciationAssessment = JSON.parse(params) as Context;\r\n        if (isSpeakerDiarizationEnabled) {\r\n            this.privContext.phraseDetection.mode = \"Conversation\";\r\n        }\r\n        this.setWordLevelTimings();\r\n        this.privContext.phraseOutput.detailed.options.push(\"PronunciationAssessment\");\r\n        if (this.privContext.phraseOutput.detailed.options.indexOf(\"SNR\") === -1) {\r\n            this.privContext.phraseOutput.detailed.options.push(\"SNR\");\r\n        }\r\n        if (!!contentAssessmentTopic) {\r\n            this.privContext.phraseDetection.enrichment.contentAssessment = {\r\n                topic: contentAssessmentTopic\r\n            };\r\n            this.privContext.phraseOutput.detailed.options.push(\"ContentAssessment\");\r\n        }\r\n    }\r\n\r\n    public setDetailedOutputFormat(): void {\r\n        if (this.privContext.phraseOutput === undefined) {\r\n            this.privContext.phraseOutput = {\r\n                detailed: {\r\n                    options: []\r\n                },\r\n                format: {}\r\n            };\r\n        }\r\n        if (this.privContext.phraseOutput.detailed === undefined) {\r\n            this.privContext.phraseOutput.detailed = {\r\n                options: []\r\n            };\r\n        }\r\n        this.privContext.phraseOutput.format = \"Detailed\";\r\n    }\r\n\r\n    public setWordLevelTimings(): void {\r\n        if (this.privContext.phraseOutput === undefined) {\r\n            this.privContext.phraseOutput = {\r\n                detailed: {\r\n                    options: []\r\n                },\r\n                format: {}\r\n            };\r\n        }\r\n        if (this.privContext.phraseOutput.detailed === undefined) {\r\n            this.privContext.phraseOutput.detailed = {\r\n                options: []\r\n            };\r\n        }\r\n        this.privContext.phraseOutput.format = \"Detailed\";\r\n        if (this.privContext.phraseOutput.detailed.options.indexOf(\"WordTimings\") === -1) {\r\n            this.privContext.phraseOutput.detailed.options.push(\"WordTimings\");\r\n        }\r\n    }\r\n\r\n    public setSpeakerDiarizationAudioOffsetMs(audioOffsetMs: number): void {\r\n        this.privContext.phraseDetection.speakerDiarization.audioOffsetMs = audioOffsetMs;\r\n    }\r\n\r\n    public toJSON(): string {\r\n\r\n        const dgi: IDynamicGrammar = this.privDynamicGrammar.generateGrammarObject();\r\n        this.setSection(\"dgi\", dgi);\r\n\r\n        const ret: string = JSON.stringify(this.privContext);\r\n        return ret;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    IDynamicGrammar,\r\n    IDynamicGrammarGeneric,\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Responsible for building the object to be sent to the speech service to support dynamic grammars.\r\n * @class DynamicGrammarBuilder\r\n */\r\nexport class DynamicGrammarBuilder {\r\n\r\n    private privPhrases: string[];\r\n    private privGrammars: string[];\r\n\r\n    // Adds one more reference phrases to the dynamic grammar to send.\r\n    // All added phrases are generic phrases.\r\n    public addPhrase(phrase: string | string[]): void {\r\n        if (!this.privPhrases) {\r\n            this.privPhrases = [];\r\n        }\r\n\r\n        if (phrase instanceof Array) {\r\n            this.privPhrases = this.privPhrases.concat(phrase);\r\n        } else {\r\n            this.privPhrases.push(phrase);\r\n        }\r\n    }\r\n\r\n    // Clears all phrases stored in the current object.\r\n    public clearPhrases(): void {\r\n        this.privPhrases = undefined;\r\n    }\r\n\r\n    // Adds one or more reference grammars to the current grammar.\r\n    public addReferenceGrammar(grammar: string | string[]): void {\r\n        if (!this.privGrammars) {\r\n            this.privGrammars = [];\r\n        }\r\n\r\n        if (grammar instanceof Array) {\r\n            this.privGrammars = this.privGrammars.concat(grammar);\r\n        } else {\r\n            this.privGrammars.push(grammar);\r\n        }\r\n    }\r\n\r\n    // clears all grammars stored on the recognizer.\r\n    public clearGrammars(): void {\r\n        this.privGrammars = undefined;\r\n    }\r\n\r\n    // Generates an object that represents the dynamic grammar used by the Speech Service.\r\n    // This is done by building an object with the correct layout based on the phrases and reference grammars added to this instance\r\n    // of a DynamicGrammarBuilder\r\n    public generateGrammarObject(): IDynamicGrammar {\r\n        if (this.privGrammars === undefined && this.privPhrases === undefined) {\r\n            return undefined;\r\n        }\r\n\r\n        const retObj: IDynamicGrammar = {};\r\n        retObj.ReferenceGrammars = this.privGrammars;\r\n\r\n        if (undefined !== this.privPhrases && 0 !== this.privPhrases.length) {\r\n            const retPhrases: IDynamicGrammarGeneric[] = [];\r\n\r\n            this.privPhrases.forEach((value: string): void => {\r\n                retPhrases.push({\r\n                    Text: value,\r\n                });\r\n            });\r\n\r\n            retObj.Groups = [{ Type: \"Generic\", Items: retPhrases }];\r\n        }\r\n\r\n        return retObj;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ReplayableAudioNode\r\n} from \"../common.browser/Exports.js\";\r\nimport { SendingAgentContextMessageEvent } from \"../common/DialogEvents.js\";\r\nimport {\r\n    BackgroundEvent,\r\n    ConnectionEvent,\r\n    ConnectionMessage,\r\n    createGuid,\r\n    createNoDashGuid,\r\n    Deferred,\r\n    DialogEvent,\r\n    Events,\r\n    EventSource,\r\n    IAudioSource,\r\n    IAudioStreamNode,\r\n    IConnection,\r\n    MessageType,\r\n    ServiceEvent,\r\n} from \"../common/Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"../sdk/Audio/AudioOutputFormat.js\";\r\nimport { PullAudioOutputStreamImpl } from \"../sdk/Audio/AudioOutputStream.js\";\r\nimport { AudioStreamFormatImpl } from \"../sdk/Audio/AudioStreamFormat.js\";\r\nimport {\r\n    ActivityReceivedEventArgs,\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    DialogServiceConfig,\r\n    DialogServiceConnector,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    RecognitionEventArgs,\r\n    ResultReason,\r\n    SessionEventArgs,\r\n    SpeechRecognitionCanceledEventArgs,\r\n    SpeechRecognitionEventArgs,\r\n    SpeechRecognitionResult,\r\n    TurnStatusReceivedEventArgs,\r\n} from \"../sdk/Exports.js\";\r\nimport { DialogServiceTurnStateManager } from \"./DialogServiceTurnStateManager.js\";\r\nimport {\r\n    CancellationErrorCodePropertyName,\r\n    EnumTranslation,\r\n    ISpeechConfigAudioDevice,\r\n    RecognitionStatus,\r\n    ServiceRecognizerBase,\r\n    SimpleSpeechPhrase,\r\n    SpeechDetected,\r\n    SpeechHypothesis,\r\n    SpeechKeyword,\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognitionMode, RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { ActivityPayloadResponse } from \"./ServiceMessages/ActivityResponsePayload.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\nexport class DialogServiceAdapter extends ServiceRecognizerBase {\r\n    private privDialogServiceConnector: DialogServiceConnector;\r\n\r\n    private privDialogAudioSource: IAudioSource;\r\n\r\n    private privConnectionLoop: Promise<void>;\r\n    private terminateMessageLoop: boolean;\r\n    private agentConfigSent: boolean;\r\n    private privLastResult: SpeechRecognitionResult;\r\n    private privEvents: EventSource<DialogEvent>;\r\n\r\n    // Turns are of two kinds:\r\n    // 1: SR turns, end when the SR result is returned and then turn end.\r\n    // 2: Service turns where an activity is sent by the service along with the audio.\r\n    private privTurnStateManager: DialogServiceTurnStateManager;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        dialogServiceConnector: DialogServiceConnector) {\r\n\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, dialogServiceConnector);\r\n\r\n        this.privEvents = new EventSource<DialogEvent>();\r\n        this.privDialogServiceConnector = dialogServiceConnector;\r\n        this.receiveMessageOverride = (): Promise<void> => this.receiveDialogMessageOverride();\r\n        this.privTurnStateManager = new DialogServiceTurnStateManager();\r\n        this.recognizeOverride =\r\n            (recoMode: RecognitionMode, successCallback: (e: SpeechRecognitionResult) => void, errorCallback: (e: string) => void): Promise<void> =>\r\n            this.listenOnce(recoMode, successCallback, errorCallback);\r\n        this.postConnectImplOverride = (connection: Promise<IConnection>): Promise<IConnection> => this.dialogConnectImpl(connection);\r\n        this.configConnectionOverride = (connection: IConnection): Promise<IConnection> => this.configConnection(connection);\r\n        this.disconnectOverride = (): Promise<void> => this.privDisconnect();\r\n        this.privDialogAudioSource = audioSource;\r\n\r\n        this.agentConfigSent = false;\r\n        this.privLastResult = null;\r\n        this.connectionEvents.attach((connectionEvent: ConnectionEvent): void => {\r\n            if (connectionEvent.name === \"ConnectionClosedEvent\") {\r\n                this.terminateMessageLoop = true;\r\n            }\r\n        });\r\n    }\r\n\r\n    public async sendMessage(message: string): Promise<void> {\r\n        const interactionGuid: string = createGuid();\r\n        const requestId: string = createNoDashGuid();\r\n\r\n        const agentMessage: any = {\r\n            context: {\r\n                interactionId: interactionGuid\r\n            },\r\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n            messagePayload: JSON.parse(message),\r\n            version: 0.5\r\n        };\r\n\r\n        const agentMessageJson = JSON.stringify(agentMessage);\r\n        const connection: IConnection = await this.fetchConnection();\r\n        await connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"agent\",\r\n            requestId,\r\n            \"application/json\",\r\n            agentMessageJson));\r\n\r\n    }\r\n\r\n    protected async privDisconnect(): Promise<void> {\r\n        await this.cancelRecognition(this.privRequestSession.sessionId,\r\n            this.privRequestSession.requestId,\r\n            CancellationReason.Error,\r\n            CancellationErrorCode.NoError,\r\n            \"Disconnecting\");\r\n\r\n        this.terminateMessageLoop = true;\r\n        this.agentConfigSent = false;\r\n        return;\r\n    }\r\n\r\n    protected processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        if (connectionMessage.messageType === MessageType.Text) {\r\n            resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n        }\r\n\r\n        let result: SpeechRecognitionResult;\r\n        let processed: boolean;\r\n\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            case \"speech.phrase\":\r\n                const speechPhrase: SimpleSpeechPhrase = SimpleSpeechPhrase.fromJSON(connectionMessage.textBody);\r\n\r\n                this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset + speechPhrase.Offset + speechPhrase.Duration);\r\n\r\n                if (speechPhrase.RecognitionStatus !== RecognitionStatus.TooManyRequests && speechPhrase.RecognitionStatus !== RecognitionStatus.Error) {\r\n                    const args: SpeechRecognitionEventArgs = this.fireEventForResult(speechPhrase, resultProps);\r\n                    this.privLastResult = args.result;\r\n\r\n                    if (!!this.privDialogServiceConnector.recognized) {\r\n                        try {\r\n                            this.privDialogServiceConnector.recognized(this.privDialogServiceConnector, args);\r\n                            /* eslint-disable no-empty */\r\n                        } catch (error) {\r\n                            // Not going to let errors in the event handler\r\n                            // trip things up.\r\n                        }\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"speech.hypothesis\":\r\n                const hypothesis: SpeechHypothesis = SpeechHypothesis.fromJSON(connectionMessage.textBody);\r\n                const offset: number = hypothesis.Offset + this.privRequestSession.currentTurnAudioOffset;\r\n\r\n                result = new SpeechRecognitionResult(\r\n                    this.privRequestSession.requestId,\r\n                    ResultReason.RecognizingSpeech,\r\n                    hypothesis.Text,\r\n                    hypothesis.Duration,\r\n                    offset,\r\n                    hypothesis.Language,\r\n                    hypothesis.LanguageDetectionConfidence,\r\n                    undefined,\r\n                    undefined,\r\n                    connectionMessage.textBody,\r\n                    resultProps);\r\n\r\n                this.privRequestSession.onHypothesis(offset);\r\n\r\n                const ev = new SpeechRecognitionEventArgs(result, hypothesis.Duration, this.privRequestSession.sessionId);\r\n\r\n                if (!!this.privDialogServiceConnector.recognizing) {\r\n                    try {\r\n                        this.privDialogServiceConnector.recognizing(this.privDialogServiceConnector, ev);\r\n                        /* eslint-disable no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"speech.keyword\":\r\n                const keyword: SpeechKeyword = SpeechKeyword.fromJSON(connectionMessage.textBody);\r\n\r\n                result = new SpeechRecognitionResult(\r\n                    this.privRequestSession.requestId,\r\n                    keyword.Status === \"Accepted\" ? ResultReason.RecognizedKeyword : ResultReason.NoMatch,\r\n                    keyword.Text,\r\n                    keyword.Duration,\r\n                    keyword.Offset,\r\n                    undefined,\r\n                    undefined,\r\n                    undefined,\r\n                    undefined,\r\n                    connectionMessage.textBody,\r\n                    resultProps);\r\n\r\n                if (keyword.Status !== \"Accepted\") {\r\n                    this.privLastResult = result;\r\n                }\r\n\r\n                const event = new SpeechRecognitionEventArgs(result, result.duration, result.resultId);\r\n\r\n                if (!!this.privDialogServiceConnector.recognized) {\r\n                    try {\r\n                        this.privDialogServiceConnector.recognized(this.privDialogServiceConnector, event);\r\n                        /* eslint-disable no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n            case \"audio\":\r\n                {\r\n                    const audioRequestId = connectionMessage.requestId.toUpperCase();\r\n                    const turn = this.privTurnStateManager.GetTurn(audioRequestId);\r\n                    try {\r\n                        // Empty binary message signals end of stream.\r\n                        if (!connectionMessage.binaryBody) {\r\n                            turn.endAudioStream();\r\n                        } else {\r\n                            turn.audioStream.write(connectionMessage.binaryBody);\r\n                        }\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                processed = true;\r\n                break;\r\n\r\n            case \"response\":\r\n                {\r\n                    this.handleResponseMessage(connectionMessage);\r\n\r\n                }\r\n                processed = true;\r\n                break;\r\n\r\n            default:\r\n                break;\r\n        }\r\n        const defferal = new Deferred<boolean>();\r\n        defferal.resolve(processed);\r\n        return defferal.promise;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected async cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): Promise<void> {\r\n\r\n        this.terminateMessageLoop = true;\r\n\r\n        if (!!this.privRequestSession.isRecognizing) {\r\n            await this.privRequestSession.onStopRecognizing();\r\n        }\r\n\r\n        if (!!this.privDialogServiceConnector.canceled) {\r\n            const properties: PropertyCollection = new PropertyCollection();\r\n            properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n            const cancelEvent: SpeechRecognitionCanceledEventArgs = new SpeechRecognitionCanceledEventArgs(\r\n                cancellationReason,\r\n                error,\r\n                errorCode,\r\n                undefined,\r\n                sessionId);\r\n\r\n            try {\r\n                this.privDialogServiceConnector.canceled(this.privDialogServiceConnector, cancelEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n\r\n            if (!!this.privSuccessCallback) {\r\n                const result: SpeechRecognitionResult = new SpeechRecognitionResult(\r\n                    undefined, // ResultId\r\n                    ResultReason.Canceled,\r\n                    undefined, // Text\r\n                    undefined, // Duration\r\n                    undefined, // Offset\r\n                    undefined, // Language\r\n                    undefined, // Language Detection Confidence\r\n                    undefined, // Speaker Id\r\n                    error,\r\n                    undefined, // Json\r\n                    properties);\r\n                try {\r\n                    this.privSuccessCallback(result);\r\n                    this.privSuccessCallback = undefined;\r\n                    /* eslint-disable no-empty */\r\n                } catch { }\r\n            }\r\n        }\r\n    }\r\n\r\n    protected async listenOnce(\r\n        recoMode: RecognitionMode,\r\n        successCallback: (e: SpeechRecognitionResult) => void,\r\n        errorCallback: (e: string) => void\r\n    ): Promise<void> {\r\n        this.privRecognizerConfig.recognitionMode = recoMode;\r\n\r\n        this.privSuccessCallback = successCallback;\r\n        this.privErrorCallback = errorCallback;\r\n\r\n        this.privRequestSession.startNewRecognition();\r\n        this.privRequestSession.listenForServiceTelemetry(this.privDialogAudioSource.events);\r\n\r\n        this.privRecognizerConfig.parameters.setProperty(PropertyId.Speech_SessionId, this.privRequestSession.sessionId);\r\n\r\n        // Start the connection to the service. The promise this will create is stored and will be used by configureConnection().\r\n        const conPromise: Promise<IConnection> = this.connectImpl();\r\n\r\n        const preAudioPromise: Promise<void> = this.sendPreAudioMessages();\r\n\r\n        const node: IAudioStreamNode = await this.privDialogAudioSource.attach(this.privRequestSession.audioNodeId);\r\n        const format: AudioStreamFormatImpl = await this.privDialogAudioSource.format;\r\n        const deviceInfo: ISpeechConfigAudioDevice = await this.privDialogAudioSource.deviceInfo;\r\n\r\n        const audioNode = new ReplayableAudioNode(node, format.avgBytesPerSec);\r\n        await this.privRequestSession.onAudioSourceAttachCompleted(audioNode, false);\r\n\r\n        this.privRecognizerConfig.SpeechServiceConfig.Context.audio = { source: deviceInfo };\r\n\r\n        try {\r\n            await conPromise;\r\n            await preAudioPromise;\r\n        } catch (error) {\r\n            await this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, CancellationReason.Error, CancellationErrorCode.ConnectionFailure, error as string);\r\n            return Promise.resolve();\r\n        }\r\n\r\n        const sessionStartEventArgs: SessionEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\r\n\r\n        if (!!this.privRecognizer.sessionStarted) {\r\n            this.privRecognizer.sessionStarted(this.privRecognizer, sessionStartEventArgs);\r\n        }\r\n\r\n        const audioSendPromise = this.sendAudio(audioNode);\r\n\r\n        // /* eslint-disable no-empty */\r\n        audioSendPromise.then((): void => { /* add? return true;*/ }, async (error: string): Promise<void> => {\r\n            await this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, CancellationReason.Error, CancellationErrorCode.RuntimeError, error);\r\n        });\r\n    }\r\n\r\n    // Establishes a websocket connection to the end point.\r\n    private dialogConnectImpl(connection: Promise<IConnection>): Promise<IConnection> {\r\n        this.privConnectionLoop = this.startMessageLoop();\r\n        return connection;\r\n    }\r\n\r\n    private receiveDialogMessageOverride(): Promise<void> {\r\n\r\n        // we won't rely on the cascading promises of the connection since we want to continually be available to receive messages\r\n        const communicationCustodian: Deferred<void> = new Deferred<void>();\r\n\r\n        const loop = async (): Promise<void> => {\r\n            try {\r\n                const isDisposed: boolean = this.isDisposed();\r\n                const terminateMessageLoop = (!this.isDisposed() && this.terminateMessageLoop);\r\n                if (isDisposed || terminateMessageLoop) {\r\n                    // We're done.\r\n                    communicationCustodian.resolve(undefined);\r\n                    return;\r\n                }\r\n\r\n                const connection: IConnection = await this.fetchConnection();\r\n                const message: ConnectionMessage = await connection.read();\r\n\r\n                if (!message) {\r\n                    return loop();\r\n                }\r\n\r\n                const connectionMessage = SpeechConnectionMessage.fromConnectionMessage(message);\r\n\r\n                switch (connectionMessage.path.toLowerCase()) {\r\n                    case \"turn.start\":\r\n                        {\r\n                            const turnRequestId = connectionMessage.requestId.toUpperCase();\r\n                            const audioSessionReqId = this.privRequestSession.requestId.toUpperCase();\r\n\r\n                            // turn started by the service\r\n                            if (turnRequestId !== audioSessionReqId) {\r\n                                this.privTurnStateManager.StartTurn(turnRequestId);\r\n                            } else {\r\n                                this.privRequestSession.onServiceTurnStartResponse();\r\n                            }\r\n                        }\r\n                        break;\r\n\r\n                    case \"speech.startdetected\":\r\n                        const speechStartDetected: SpeechDetected = SpeechDetected.fromJSON(connectionMessage.textBody);\r\n\r\n                        const speechStartEventArgs = new RecognitionEventArgs(speechStartDetected.Offset, this.privRequestSession.sessionId);\r\n\r\n                        if (!!this.privRecognizer.speechStartDetected) {\r\n                            this.privRecognizer.speechStartDetected(this.privRecognizer, speechStartEventArgs);\r\n                        }\r\n\r\n                        break;\r\n\r\n                    case \"speech.enddetected\":\r\n\r\n                        let json: string;\r\n\r\n                        if (connectionMessage.textBody.length > 0) {\r\n                            json = connectionMessage.textBody;\r\n                        } else {\r\n                            // If the request was empty, the JSON returned is empty.\r\n                            json = \"{ Offset: 0 }\";\r\n                        }\r\n\r\n                        const speechStopDetected: SpeechDetected = SpeechDetected.fromJSON(json);\r\n\r\n                        this.privRequestSession.onServiceRecognized(speechStopDetected.Offset + this.privRequestSession.currentTurnAudioOffset);\r\n\r\n                        const speechStopEventArgs = new RecognitionEventArgs(speechStopDetected.Offset + this.privRequestSession.currentTurnAudioOffset, this.privRequestSession.sessionId);\r\n\r\n                        if (!!this.privRecognizer.speechEndDetected) {\r\n                            this.privRecognizer.speechEndDetected(this.privRecognizer, speechStopEventArgs);\r\n                        }\r\n                        break;\r\n\r\n                    case \"turn.end\":\r\n                        {\r\n                            const turnEndRequestId = connectionMessage.requestId.toUpperCase();\r\n\r\n                            const audioSessionReqId = this.privRequestSession.requestId.toUpperCase();\r\n\r\n                            // turn started by the service\r\n                            if (turnEndRequestId !== audioSessionReqId) {\r\n                                this.privTurnStateManager.CompleteTurn(turnEndRequestId);\r\n                            } else {\r\n                                // Audio session turn\r\n\r\n                                const sessionStopEventArgs: SessionEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\r\n                                await this.privRequestSession.onServiceTurnEndResponse(false);\r\n\r\n                                if (!this.privRecognizerConfig.isContinuousRecognition || this.privRequestSession.isSpeechEnded || !this.privRequestSession.isRecognizing) {\r\n                                    if (!!this.privRecognizer.sessionStopped) {\r\n                                        this.privRecognizer.sessionStopped(this.privRecognizer, sessionStopEventArgs);\r\n                                    }\r\n                                }\r\n\r\n                                // report result to promise.\r\n                                if (!!this.privSuccessCallback && this.privLastResult) {\r\n                                    try {\r\n                                        this.privSuccessCallback(this.privLastResult);\r\n                                        this.privLastResult = null;\r\n                                    } catch (e) {\r\n                                        if (!!this.privErrorCallback) {\r\n                                            this.privErrorCallback(e as string);\r\n                                        }\r\n                                    }\r\n                                    // Only invoke the call back once.\r\n                                    // and if it's successful don't invoke the\r\n                                    // error after that.\r\n                                    this.privSuccessCallback = undefined;\r\n                                    this.privErrorCallback = undefined;\r\n                                }\r\n                            }\r\n                        }\r\n                        break;\r\n\r\n                    default:\r\n                        try {\r\n                            const processed = await this.processTypeSpecificMessages(connectionMessage);\r\n                            if (!processed) {\r\n                                if (!!this.serviceEvents) {\r\n                                    this.serviceEvents.onEvent(new ServiceEvent(connectionMessage.path.toLowerCase(), connectionMessage.textBody));\r\n                                }\r\n                            }\r\n                        } catch (e) {\r\n                            //\r\n                        }\r\n                }\r\n                const ret: Promise<void> = loop();\r\n\r\n                return ret;\r\n            } catch (error) {\r\n                this.terminateMessageLoop = true;\r\n                communicationCustodian.resolve();\r\n            }\r\n        };\r\n\r\n        loop().catch((reason: string): void => {\r\n            Events.instance.onEvent(new BackgroundEvent(reason));\r\n        });\r\n\r\n        return communicationCustodian.promise;\r\n    }\r\n\r\n    private async startMessageLoop(): Promise<void> {\r\n\r\n        this.terminateMessageLoop = false;\r\n\r\n        try {\r\n            await this.receiveDialogMessageOverride();\r\n        } catch (error) {\r\n            await this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, CancellationReason.Error, CancellationErrorCode.RuntimeError, error as string);\r\n        }\r\n\r\n        return Promise.resolve();\r\n    }\r\n\r\n    // Takes an established websocket connection to the endpoint and sends speech configuration information.\r\n    private async configConnection(connection: IConnection): Promise<IConnection> {\r\n        if (this.terminateMessageLoop) {\r\n            this.terminateMessageLoop = false;\r\n            return Promise.reject(\"Connection to service terminated.\");\r\n        }\r\n\r\n        await this.sendSpeechServiceConfig(connection, this.privRequestSession, this.privRecognizerConfig.SpeechServiceConfig.serialize());\r\n        await this.sendAgentConfig(connection);\r\n        return connection;\r\n    }\r\n\r\n    private async sendPreAudioMessages(): Promise<void> {\r\n        const connection: IConnection = await this.fetchConnection();\r\n        this.addKeywordContextData();\r\n        await this.sendSpeechContext(connection, true);\r\n        await this.sendAgentContext(connection);\r\n        await this.sendWaveHeader(connection);\r\n    }\r\n\r\n    private sendAgentConfig(connection: IConnection): Promise<void> {\r\n        if (this.agentConfig && !this.agentConfigSent) {\r\n\r\n            if (this.privRecognizerConfig\r\n                .parameters\r\n                .getProperty(PropertyId.Conversation_DialogType) === DialogServiceConfig.DialogTypes.CustomCommands) {\r\n                const config = this.agentConfig.get();\r\n                config.botInfo.commandsCulture = this.privRecognizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, \"en-us\");\r\n                this.agentConfig.set(config);\r\n            }\r\n            this.onEvent(new SendingAgentContextMessageEvent(this.agentConfig));\r\n\r\n            const agentConfigJson = this.agentConfig.toJsonString();\r\n\r\n            // guard against sending this multiple times on one connection\r\n            this.agentConfigSent = true;\r\n\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"agent.config\",\r\n                this.privRequestSession.requestId,\r\n                \"application/json\",\r\n                agentConfigJson));\r\n        }\r\n\r\n        return;\r\n    }\r\n\r\n    private sendAgentContext(connection: IConnection): Promise<void> {\r\n        const guid: string = createGuid();\r\n\r\n        const speechActivityTemplate = this.privDialogServiceConnector.properties.getProperty(PropertyId.Conversation_Speech_Activity_Template);\r\n\r\n        const agentContext: any = {\r\n            channelData: \"\",\r\n            context: {\r\n                interactionId: guid\r\n            },\r\n            messagePayload: typeof speechActivityTemplate === undefined ? undefined : speechActivityTemplate,\r\n            version: 0.5\r\n        };\r\n\r\n        const agentContextJson = JSON.stringify(agentContext);\r\n\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"speech.agent.context\",\r\n            this.privRequestSession.requestId,\r\n            \"application/json\",\r\n            agentContextJson));\r\n    }\r\n\r\n    private fireEventForResult(serviceResult: SimpleSpeechPhrase, properties: PropertyCollection): SpeechRecognitionEventArgs {\r\n        const resultReason: ResultReason = EnumTranslation.implTranslateRecognitionResult(serviceResult.RecognitionStatus);\r\n\r\n        const offset: number = serviceResult.Offset + this.privRequestSession.currentTurnAudioOffset;\r\n\r\n        const result = new SpeechRecognitionResult(\r\n            this.privRequestSession.requestId,\r\n            resultReason,\r\n            serviceResult.DisplayText,\r\n            serviceResult.Duration,\r\n            offset,\r\n            serviceResult.Language,\r\n            serviceResult.LanguageDetectionConfidence,\r\n            undefined,\r\n            undefined,\r\n            JSON.stringify(serviceResult),\r\n            properties);\r\n\r\n        const ev = new SpeechRecognitionEventArgs(result, offset, this.privRequestSession.sessionId);\r\n        return ev;\r\n    }\r\n\r\n    private handleResponseMessage(responseMessage: SpeechConnectionMessage): void {\r\n        // \"response\" messages can contain either \"message\" (activity) or \"MessageStatus\" data. Fire the appropriate\r\n        // event according to the message type that's specified.\r\n        const responsePayload: { messageType: string } = JSON.parse(responseMessage.textBody) as { messageType: string };\r\n        switch (responsePayload.messageType.toLowerCase()) {\r\n            case \"message\":\r\n                const responseRequestId = responseMessage.requestId.toUpperCase();\r\n                const activityPayload: ActivityPayloadResponse = ActivityPayloadResponse.fromJSON(responseMessage.textBody);\r\n                const turn = this.privTurnStateManager.GetTurn(responseRequestId);\r\n\r\n                // update the conversation Id\r\n                if (activityPayload.conversationId) {\r\n                    const updateAgentConfig = this.agentConfig.get();\r\n                    updateAgentConfig.botInfo.conversationId = activityPayload.conversationId;\r\n                    this.agentConfig.set(updateAgentConfig);\r\n                }\r\n\r\n                const pullAudioOutputStream: PullAudioOutputStreamImpl = turn.processActivityPayload(\r\n                    activityPayload,\r\n                    AudioOutputFormatImpl.fromSpeechSynthesisOutputFormatString(this.privDialogServiceConnector.properties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined)));\r\n                const activity = new ActivityReceivedEventArgs(activityPayload.messagePayload, pullAudioOutputStream);\r\n                if (!!this.privDialogServiceConnector.activityReceived) {\r\n                    try {\r\n                        this.privDialogServiceConnector.activityReceived(this.privDialogServiceConnector, activity);\r\n                        /* eslint-disable-next-line no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                break;\r\n\r\n            case \"messagestatus\":\r\n                if (!!this.privDialogServiceConnector.turnStatusReceived) {\r\n                    try {\r\n                        this.privDialogServiceConnector.turnStatusReceived(\r\n                            this.privDialogServiceConnector,\r\n                            new TurnStatusReceivedEventArgs(responseMessage.textBody));\r\n                        /* eslint-disable-next-line no-empty */\r\n                    } catch (error) {\r\n                        // Not going to let errors in the event handler\r\n                        // trip things up.\r\n                    }\r\n                }\r\n                break;\r\n\r\n            default:\r\n                Events.instance.onEvent(\r\n                    new BackgroundEvent(`Unexpected response of type ${responsePayload.messageType}. Ignoring.`));\r\n                break;\r\n        }\r\n    }\r\n\r\n    private onEvent(event: DialogEvent): void {\r\n        this.privEvents.onEvent(event);\r\n        Events.instance.onEvent(event);\r\n    }\r\n\r\n    private addKeywordContextData(): void {\r\n        const keywordPropertyValue: string = this.privRecognizerConfig.parameters.getProperty(\"SPEECH-KeywordsToDetect\");\r\n        if (keywordPropertyValue === undefined) {\r\n            return;\r\n        }\r\n\r\n        const keywordOffsetPropertyValue: string = this.privRecognizerConfig.parameters\r\n            .getProperty(\"SPEECH-KeywordsToDetect-Offsets\");\r\n        const keywordDurationPropertyValue: string = this.privRecognizerConfig.parameters\r\n            .getProperty(\"SPEECH-KeywordsToDetect-Durations\");\r\n\r\n        const keywords = keywordPropertyValue.split(\";\");\r\n        const keywordOffsets = keywordOffsetPropertyValue === undefined ? [] : keywordOffsetPropertyValue.split(\";\");\r\n        const keywordDurations = keywordDurationPropertyValue === undefined ? [] : keywordDurationPropertyValue.split(\";\");\r\n\r\n        const keywordDefinitionArray = [];\r\n        for (let i = 0; i < keywords.length; i++) {\r\n            const definition: { [section: string]: any } = {};\r\n            definition.text = keywords[i];\r\n            if (i < keywordOffsets.length) {\r\n                definition.offset = Number(keywordOffsets[i]);\r\n            }\r\n            if (i < keywordDurations.length) {\r\n                definition.duration = Number(keywordDurations[i]);\r\n            }\r\n            keywordDefinitionArray.push(definition);\r\n        }\r\n\r\n        this.speechContext.setSection(\"invocationSource\", \"VoiceActivationWithKeyword\");\r\n        this.speechContext.setSection(\"keywordDetection\", [{\r\n            clientDetectedKeywords: keywordDefinitionArray,\r\n            onReject: { action: \"EndOfTurn\" },\r\n            type: \"startTrigger\"\r\n        }]);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError } from \"../common/Error.js\";\r\nimport { DialogServiceTurnState } from \"./DialogServiceTurnState.js\";\r\n\r\nexport class DialogServiceTurnStateManager {\r\n    private privTurnMap: Map<string, DialogServiceTurnState>;\r\n\r\n    public constructor() {\r\n        this.privTurnMap = new Map<string, DialogServiceTurnState>();\r\n        return;\r\n    }\r\n\r\n    public StartTurn(id: string): DialogServiceTurnState {\r\n        if (this.privTurnMap.has(id)) {\r\n            throw new InvalidOperationError(\"Service error: There is already a turn with id:\" + id);\r\n        }\r\n        const turnState: DialogServiceTurnState = new DialogServiceTurnState(this, id);\r\n        this.privTurnMap.set(id, turnState);\r\n        return this.privTurnMap.get(id);\r\n    }\r\n\r\n    public GetTurn(id: string): DialogServiceTurnState {\r\n        return this.privTurnMap.get(id);\r\n    }\r\n\r\n    public CompleteTurn(id: string): DialogServiceTurnState {\r\n        if (!this.privTurnMap.has(id)) {\r\n            throw new InvalidOperationError(\"Service error: Received turn end for an unknown turn id:\" + id);\r\n        }\r\n        const turnState = this.privTurnMap.get(id);\r\n        turnState.complete();\r\n        this.privTurnMap.delete(id);\r\n        return turnState;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { AudioOutputFormatImpl } from \"../sdk/Audio/AudioOutputFormat.js\";\r\nimport { AudioOutputStream, PullAudioOutputStreamImpl } from \"../sdk/Audio/AudioOutputStream.js\";\r\nimport { DialogServiceTurnStateManager } from \"./DialogServiceTurnStateManager.js\";\r\nimport { ActivityPayloadResponse, MessageDataStreamType } from \"./ServiceMessages/ActivityResponsePayload.js\";\r\n\r\nexport class DialogServiceTurnState {\r\n    private privRequestId: string;\r\n    private privIsCompleted: boolean;\r\n    private privAudioStream: PullAudioOutputStreamImpl;\r\n    private privTimeoutToken: any;\r\n    private privTurnManager: DialogServiceTurnStateManager;\r\n\r\n    public constructor(manager: DialogServiceTurnStateManager, requestId: string) {\r\n        this.privRequestId = requestId;\r\n        this.privIsCompleted = false;\r\n        this.privAudioStream = null;\r\n        this.privTurnManager = manager;\r\n        this.resetTurnEndTimeout();\r\n    }\r\n\r\n    public get audioStream(): PullAudioOutputStreamImpl {\r\n        // Called when is needed to stream.\r\n        this.resetTurnEndTimeout();\r\n        return this.privAudioStream;\r\n    }\r\n\r\n    public processActivityPayload(payload: ActivityPayloadResponse, audioFormat?: AudioOutputFormatImpl): PullAudioOutputStreamImpl {\r\n        if (payload.messageDataStreamType === MessageDataStreamType.TextToSpeechAudio) {\r\n            this.privAudioStream = AudioOutputStream.createPullStream() as PullAudioOutputStreamImpl;\r\n            this.privAudioStream.format = (audioFormat !== undefined) ? audioFormat : AudioOutputFormatImpl.getDefaultOutputFormat();\r\n        }\r\n        return this.privAudioStream;\r\n    }\r\n\r\n    public endAudioStream(): void {\r\n        if (this.privAudioStream !== null && !this.privAudioStream.isClosed) {\r\n            this.privAudioStream.close();\r\n        }\r\n    }\r\n\r\n    public complete(): void {\r\n        if (this.privTimeoutToken !== undefined) {\r\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n            clearTimeout(this.privTimeoutToken);\r\n        }\r\n        this.endAudioStream();\r\n    }\r\n\r\n    private resetTurnEndTimeout(): void {\r\n        if (this.privTimeoutToken !== undefined) {\r\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n            clearTimeout(this.privTimeoutToken);\r\n        }\r\n        this.privTimeoutToken = setTimeout((): void => {\r\n            this.privTurnManager.CompleteTurn(this.privRequestId);\r\n            return;\r\n        }, 2000);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n// response\r\n\r\nexport interface IActivityPayloadResponse {\r\n    conversationId: string;\r\n    messageDataStreamType: number;\r\n    messagePayload: string | object;\r\n    version: number;\r\n}\r\n\r\nexport class ActivityPayloadResponse implements IActivityPayloadResponse {\r\n    private privActivityResponse: IActivityPayloadResponse;\r\n\r\n    private constructor(json: string) {\r\n        this.privActivityResponse = JSON.parse(json) as IActivityPayloadResponse;\r\n    }\r\n\r\n    public static fromJSON(json: string): ActivityPayloadResponse {\r\n        return new ActivityPayloadResponse(json);\r\n    }\r\n\r\n    public get conversationId(): string {\r\n        return this.privActivityResponse.conversationId;\r\n    }\r\n\r\n    public get messageDataStreamType(): number {\r\n        return this.privActivityResponse.messageDataStreamType;\r\n    }\r\n\r\n    public get messagePayload(): string | object {\r\n        return this.privActivityResponse.messagePayload;\r\n    }\r\n\r\n    public get version(): number {\r\n        return this.privActivityResponse.version;\r\n    }\r\n}\r\n\r\nexport enum MessageDataStreamType {\r\n    None = 0,\r\n    TextToSpeechAudio = 1,\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Represents the JSON used in the agent.config message sent to the speech service.\r\n */\r\nexport class AgentConfig {\r\n    private iPrivConfig: IAgentConfig;\r\n\r\n    public toJsonString(): string {\r\n        return JSON.stringify(this.iPrivConfig);\r\n    }\r\n\r\n    public get(): IAgentConfig {\r\n        return this.iPrivConfig;\r\n    }\r\n\r\n    /**\r\n     * Setter for the agent.config object.\r\n     * @param value a JSON serializable object.\r\n     */\r\n    public set(value: IAgentConfig): void {\r\n        this.iPrivConfig = value;\r\n    }\r\n}\r\n\r\nexport interface IAgentConfig {\r\n    botInfo: {\r\n        commType: string;\r\n        connectionId: string;\r\n        conversationId: string;\r\n        fromId: string;\r\n        commandsCulture: string;\r\n        ttsAudioFormat: string;\r\n    };\r\n    version: number;\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nexport { ConversationManager } from \"./ConversationManager.js\";\r\nexport { ConversationConnectionConfig } from \"./ConversationConnectionConfig.js\";\r\nexport { ConversationRecognizerFactory } from \"./ConversationTranslatorRecognizer.js\";\r\nexport { TranscriberRecognizer } from \"./TranscriberRecognizer.js\";\r\nexport {\r\n    ConversationReceivedTranslationEventArgs,\r\n    LockRoomEventArgs,\r\n    MuteAllEventArgs,\r\n    ParticipantAttributeEventArgs,\r\n    ParticipantEventArgs,\r\n    ParticipantsListEventArgs } from \"./ConversationTranslatorEventArgs.js\";\r\nexport {\r\n    ConversationRecognizer,\r\n    ConversationTranslatorCommandTypes,\r\n    ConversationTranslatorMessageTypes,\r\n    IInternalConversation,\r\n    IInternalParticipant,\r\n    InternalParticipants} from \"./ConversationTranslatorInterfaces.js\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    IRequestOptions,\r\n    IRestParams,\r\n    IRestResponse,\r\n    RestMessageAdapter,\r\n    RestRequestType\r\n} from \"../../common.browser/Exports.js\";\r\nimport { IErrorMessages, IStringDictionary } from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport { PropertyCollection, PropertyId } from \"../../sdk/Exports.js\";\r\nimport { ConversationConnectionConfig } from \"./ConversationConnectionConfig.js\";\r\nimport { IConversationResponseError, IInternalConversation } from \"./ConversationTranslatorInterfaces.js\";\r\n\r\nexport class ConversationManager {\r\n\r\n    private privRequestParams: IRestParams;\r\n    private privErrors: IErrorMessages;\r\n    private privHost: string;\r\n    private privApiVersion: string;\r\n    private privRestPath: string;\r\n    private privRestAdapter: RestMessageAdapter;\r\n\r\n    public constructor() {\r\n        //\r\n        this.privRequestParams = ConversationConnectionConfig.configParams;\r\n        this.privErrors = ConversationConnectionConfig.restErrors;\r\n        this.privHost = ConversationConnectionConfig.host;\r\n        this.privApiVersion = ConversationConnectionConfig.apiVersion;\r\n        this.privRestPath = ConversationConnectionConfig.restPath;\r\n        this.privRestAdapter = new RestMessageAdapter({});\r\n    }\r\n\r\n    /**\r\n     * Make a POST request to the Conversation Manager service endpoint to create or join a conversation.\r\n     * @param args\r\n     * @param conversationCode\r\n     * @param callback\r\n     * @param errorCallback\r\n     */\r\n    public createOrJoin(args: PropertyCollection, conversationCode: string, cb?: (c: any) => void, err?: (e: string) => void): void {\r\n\r\n        try {\r\n\r\n            Contracts.throwIfNullOrUndefined(args, \"args\");\r\n\r\n            const languageCode: string = args.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage, ConversationConnectionConfig.defaultLanguageCode);\r\n            const nickname: string = args.getProperty(PropertyId.ConversationTranslator_Name, \"conversation_host\");\r\n            const endpointHost: string = args.getProperty(PropertyId.ConversationTranslator_Host, this.privHost);\r\n            const correlationId: string = args.getProperty(PropertyId.ConversationTranslator_CorrelationId);\r\n            const subscriptionKey: string = args.getProperty(PropertyId.SpeechServiceConnection_Key);\r\n            const subscriptionRegion: string = args.getProperty(PropertyId.SpeechServiceConnection_Region);\r\n            const authToken: string = args.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n\r\n            Contracts.throwIfNullOrWhitespace(languageCode, \"languageCode\");\r\n            Contracts.throwIfNullOrWhitespace(nickname, \"nickname\");\r\n            Contracts.throwIfNullOrWhitespace(endpointHost, \"endpointHost\");\r\n\r\n            const queryParams: IStringDictionary<string> = {};\r\n            queryParams[this.privRequestParams.apiVersion] = this.privApiVersion;\r\n            queryParams[this.privRequestParams.languageCode] = languageCode;\r\n            queryParams[this.privRequestParams.nickname] = nickname;\r\n\r\n            const headers: IStringDictionary<string> = {};\r\n            if (correlationId) {\r\n                headers[this.privRequestParams.correlationId] = correlationId;\r\n            }\r\n            headers[this.privRequestParams.clientAppId] = ConversationConnectionConfig.clientAppId;\r\n\r\n            if (conversationCode !== undefined) {\r\n                queryParams[this.privRequestParams.roomId] = conversationCode;\r\n            } else {\r\n                Contracts.throwIfNullOrUndefined(subscriptionRegion, this.privErrors.authInvalidSubscriptionRegion);\r\n                headers[this.privRequestParams.subscriptionRegion] = subscriptionRegion;\r\n                if (subscriptionKey) {\r\n                    headers[this.privRequestParams.subscriptionKey] = subscriptionKey;\r\n                } else if (authToken) {\r\n                    headers[this.privRequestParams.authorization] = `Bearer ${authToken}`;\r\n                } else {\r\n                    Contracts.throwIfNullOrUndefined(subscriptionKey, this.privErrors.authInvalidSubscriptionKey);\r\n                }\r\n            }\r\n\r\n            const config: IRequestOptions = {};\r\n            config.headers = headers;\r\n            this.privRestAdapter.options = config;\r\n\r\n            const endpoint: string = `https://${endpointHost}${this.privRestPath}`;\r\n\r\n            // TODO: support a proxy and certificate validation\r\n            this.privRestAdapter.request(RestRequestType.Post, endpoint, queryParams, null).then((response: IRestResponse): void => {\r\n\r\n                const requestId: string = RestMessageAdapter.extractHeaderValue(this.privRequestParams.requestId, response.headers);\r\n\r\n                if (!response.ok) {\r\n                    if (!!err) {\r\n                        // get the error\r\n                        let errorMessage: string = this.privErrors.invalidCreateJoinConversationResponse.replace(\"{status}\", response.status.toString());\r\n                        let errMessageRaw: IConversationResponseError;\r\n                        try {\r\n                            errMessageRaw = JSON.parse(response.data) as IConversationResponseError;\r\n                            errorMessage += ` [${errMessageRaw.error.code}: ${errMessageRaw.error.message}]`;\r\n                        } catch (e) {\r\n                            errorMessage += ` [${response.data}]`;\r\n                        }\r\n                        if (requestId) {\r\n                            errorMessage += ` ${requestId}`;\r\n                        }\r\n\r\n                        err(errorMessage);\r\n                    }\r\n                    return;\r\n                }\r\n                const conversation: IInternalConversation = JSON.parse(response.data) as IInternalConversation;\r\n                if (conversation) {\r\n                    conversation.requestId = requestId;\r\n                }\r\n                if (!!cb) {\r\n                    try {\r\n                        cb(conversation);\r\n                    } catch (e) {\r\n                        if (!!err) {\r\n                            err(e as string);\r\n                        }\r\n                    }\r\n                    cb = undefined;\r\n                }\r\n            // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n            }).catch( (): void => { });\r\n\r\n        } catch (error) {\r\n            if (!!err) {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    err(typedError.name + \": \" + typedError.message);\r\n\r\n                } else {\r\n                    err(error as string);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Make a DELETE request to the Conversation Manager service endpoint to leave the conversation.\r\n     * @param args\r\n     * @param sessionToken\r\n     * @param callback\r\n     */\r\n    public leave(args: PropertyCollection, sessionToken: string): Promise<void> {\r\n        return new Promise<void>((resolve: () => void, reject: (reason: string) => void): void => {\r\n            try {\r\n\r\n                Contracts.throwIfNullOrUndefined(args, this.privErrors.invalidArgs.replace(\"{arg}\", \"config\"));\r\n                Contracts.throwIfNullOrWhitespace(sessionToken, this.privErrors.invalidArgs.replace(\"{arg}\", \"token\"));\r\n\r\n                const endpointHost: string = args.getProperty(PropertyId.ConversationTranslator_Host, this.privHost);\r\n                const correlationId: string = args.getProperty(PropertyId.ConversationTranslator_CorrelationId);\r\n\r\n                const queryParams: IStringDictionary<string> = {};\r\n                queryParams[this.privRequestParams.apiVersion] = this.privApiVersion;\r\n                queryParams[this.privRequestParams.sessionToken] = sessionToken;\r\n\r\n                const headers: IStringDictionary<string> = {};\r\n                if (correlationId) {\r\n                    headers[this.privRequestParams.correlationId] = correlationId;\r\n                }\r\n\r\n                const config: IRequestOptions = {};\r\n                config.headers = headers;\r\n                this.privRestAdapter.options = config;\r\n\r\n                const endpoint: string = `https://${endpointHost}${this.privRestPath}`;\r\n\r\n                // TODO: support a proxy and certificate validation\r\n                this.privRestAdapter.request(RestRequestType.Delete, endpoint, queryParams, null).then((response: IRestResponse): void => {\r\n\r\n                    if (!response.ok) {\r\n                        // ignore errors on delete\r\n                    }\r\n\r\n                    resolve();\r\n                // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n                }).catch( (): void => {});\r\n\r\n            } catch (error) {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    reject(typedError.name + \": \" + typedError.message);\r\n\r\n                } else {\r\n                    reject(error as string);\r\n                }\r\n            }\r\n        });\r\n    }\r\n}\r\n","\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    RestConfigBase\r\n} from \"../../common.browser/RestConfigBase.js\";\r\n\r\nexport class ConversationConnectionConfig extends RestConfigBase {\r\n\r\n    private static readonly privHost: string = \"dev.microsofttranslator.com\";\r\n    private static readonly privRestPath: string = \"/capito/room\";\r\n    private static readonly privApiVersion: string = \"2.0\";\r\n    private static readonly privDefaultLanguageCode: string = \"en-US\";\r\n    private static readonly privClientAppId: string = \"FC539C22-1767-4F1F-84BC-B4D811114F15\";\r\n    private static readonly privWebSocketPath: string = \"/capito/translate\";\r\n    private static readonly privTranscriptionEventKeys: string[] = [\"iCalUid\", \"callId\", \"organizer\", \"FLAC\", \"MTUri\", \"DifferentiateGuestSpeakers\", \"audiorecording\", \"Threadid\", \"OrganizerMri\", \"OrganizerTenantId\", \"UserToken\"];\r\n\r\n    public static get host(): string {\r\n        return ConversationConnectionConfig.privHost;\r\n    }\r\n\r\n    public static get apiVersion(): string {\r\n        return ConversationConnectionConfig.privApiVersion;\r\n    }\r\n\r\n    public static get clientAppId(): string {\r\n        return ConversationConnectionConfig.privClientAppId;\r\n    }\r\n\r\n    public static get defaultLanguageCode(): string {\r\n        return ConversationConnectionConfig.privDefaultLanguageCode;\r\n    }\r\n\r\n    public static get restPath(): string {\r\n        return ConversationConnectionConfig.privRestPath;\r\n    }\r\n\r\n    public static get webSocketPath(): string {\r\n        return ConversationConnectionConfig.privWebSocketPath;\r\n    }\r\n\r\n    public static get transcriptionEventKeys(): string[] {\r\n        return ConversationConnectionConfig.privTranscriptionEventKeys;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nimport {\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechServiceConfig\r\n} from \"../../common.speech/Exports.js\";\r\nimport {\r\n    BackgroundEvent,\r\n    Events,\r\n    Timeout,\r\n} from \"../../common/Exports.js\";\r\nimport { AudioConfigImpl } from \"../../sdk/Audio/AudioConfig.js\";\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    Connection,\r\n    ConnectionEventArgs,\r\n    ConversationExpirationEventArgs,\r\n    ConversationParticipantsChangedEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    SessionEventArgs,\r\n    SpeechTranslationConfig\r\n} from \"../../sdk/Exports.js\";\r\nimport { SpeechTranslationConfigImpl } from \"../../sdk/SpeechTranslationConfig.js\";\r\nimport { ConversationImpl } from \"../../sdk/Transcription/Conversation.js\";\r\nimport { Callback, IConversation } from \"../../sdk/Transcription/IConversation.js\";\r\nimport { ConversationConnectionFactory } from \"./ConversationConnectionFactory.js\";\r\nimport { ConversationServiceAdapter } from \"./ConversationServiceAdapter.js\";\r\nimport {\r\n    ConversationReceivedTranslationEventArgs,\r\n    LockRoomEventArgs,\r\n    MuteAllEventArgs,\r\n    ParticipantAttributeEventArgs,\r\n    ParticipantEventArgs,\r\n    ParticipantsListEventArgs\r\n} from \"./ConversationTranslatorEventArgs.js\";\r\nimport {\r\n    ConversationRecognizer,\r\n} from \"./ConversationTranslatorInterfaces.js\";\r\n\r\nexport class ConversationRecognizerFactory {\r\n    public static fromConfig(conversation: IConversation, speechConfig: SpeechTranslationConfig, audioConfig?: AudioConfig): ConversationRecognizer {\r\n        return new ConversationTranslatorRecognizer(conversation, speechConfig, audioConfig);\r\n    }\r\n}\r\n\r\n/**\r\n * Sends messages to the Conversation Translator websocket and listens for incoming events containing websocket messages.\r\n * Based off the recognizers in the SDK folder.\r\n */\r\nexport class ConversationTranslatorRecognizer extends Recognizer implements ConversationRecognizer {\r\n\r\n    private privIsDisposed: boolean;\r\n    private privSpeechRecognitionLanguage: string;\r\n    private privConnection: Connection;\r\n    private privConversation: ConversationImpl;\r\n    private privTimeoutToken: any;\r\n    private privSetTimeout: (cb: () => void, delay: number) => number;\r\n    private privClearTimeout: (id: number) => void;\r\n\r\n    public constructor(conversation: IConversation, speechConfig: SpeechTranslationConfig, audioConfig?: AudioConfig) {\r\n        const serviceConfigImpl = speechConfig as SpeechTranslationConfigImpl;\r\n        Contracts.throwIfNull(serviceConfigImpl, \"speechConfig\");\r\n        const conversationImpl = conversation as ConversationImpl;\r\n        Contracts.throwIfNull(conversationImpl, \"conversationImpl\");\r\n\r\n        super(audioConfig, serviceConfigImpl.properties, new ConversationConnectionFactory());\r\n\r\n        this.privConversation = conversationImpl;\r\n        this.privIsDisposed = false;\r\n        this.privProperties = serviceConfigImpl.properties.clone();\r\n        this.privConnection = Connection.fromRecognizer(this);\r\n        const webWorkerLoadType: string = this.privProperties.getProperty(PropertyId.WebWorkerLoadType, \"on\").toLowerCase();\r\n        if (webWorkerLoadType === \"on\" && typeof (Blob) !== \"undefined\" && typeof (Worker) !== \"undefined\") {\r\n            this.privSetTimeout = Timeout.setTimeout;\r\n            this.privClearTimeout = Timeout.clearTimeout;\r\n        } else {\r\n            if (typeof window !== \"undefined\") {\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n                this.privSetTimeout = window.setTimeout.bind(window);\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n                this.privClearTimeout = window.clearTimeout.bind(window);\r\n            } else {\r\n                this.privSetTimeout = setTimeout;\r\n                this.privClearTimeout = clearTimeout;\r\n            }\r\n        }\r\n    }\r\n\r\n    public canceled: (sender: ConversationRecognizer, event: ConversationTranslationCanceledEventArgs) => void;\r\n    public conversationExpiration: (sender: ConversationRecognizer, event: ConversationExpirationEventArgs) => void;\r\n    public lockRoomCommandReceived: (sender: ConversationRecognizer, event: LockRoomEventArgs) => void;\r\n    public muteAllCommandReceived: (sender: ConversationRecognizer, event: MuteAllEventArgs) => void;\r\n    public participantJoinCommandReceived: (sender: ConversationRecognizer, event: ParticipantEventArgs) => void;\r\n    public participantLeaveCommandReceived: (sender: ConversationRecognizer, event: ParticipantEventArgs) => void;\r\n    public participantUpdateCommandReceived: (sender: ConversationRecognizer, event: ParticipantAttributeEventArgs) => void;\r\n    public connectionOpened: (sender: ConversationRecognizer, event: SessionEventArgs) => void;\r\n    public connectionClosed: (sender: ConversationRecognizer, event: SessionEventArgs) => void;\r\n    public translationReceived: (sender: ConversationRecognizer, event: ConversationReceivedTranslationEventArgs) => void;\r\n    public participantsListReceived: (sender: ConversationRecognizer, event: ParticipantsListEventArgs) => void;\r\n    public participantsChanged: (sender: ConversationRecognizer, event: ConversationParticipantsChangedEventArgs) => void;\r\n\r\n    public set connected(cb: (e: ConnectionEventArgs) => void) {\r\n        this.privConnection.connected = cb;\r\n    }\r\n\r\n    public set disconnected(cb: (e: ConnectionEventArgs) => void) {\r\n        this.privConnection.disconnected = cb;\r\n    }\r\n\r\n    /**\r\n     * Return the speech language used by the recognizer\r\n     */\r\n    public get speechRecognitionLanguage(): string {\r\n        return this.privSpeechRecognitionLanguage;\r\n    }\r\n\r\n    /**\r\n     * Return the properties for the recognizer\r\n     */\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    /**\r\n     * Connect to the recognizer\r\n     * @param token\r\n     */\r\n    public connect(token: string, cb?: () => void, err?: (e: string) => void): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n            this.privReco.conversationTranslatorToken = token;\r\n            this.resetConversationTimeout();\r\n            this.privReco.connectAsync(cb, err);\r\n        } catch (error) {\r\n            if (!!err) {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    err(typedError.name + \": \" + typedError.message);\r\n                } else {\r\n                    err(error as string);\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Disconnect from the recognizer\r\n     */\r\n    public disconnect(cb?: () => void, err?: (e: string) => void): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            if (this.privTimeoutToken !== undefined) {\r\n               // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n               this.privClearTimeout(this.privTimeoutToken);\r\n            }\r\n            this.privReco.disconnect().then((): void => {\r\n                if (!!cb) {\r\n                    cb();\r\n                }\r\n            }, (error: string): void => {\r\n                if (!!err) {\r\n                    err(error);\r\n                }\r\n            });\r\n        } catch (error) {\r\n            if (!!err) {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    err(typedError.name + \": \" + typedError.message);\r\n                } else {\r\n                    err(error as string);\r\n                }\r\n            }\r\n            // Destroy the recognizer.\r\n            this.dispose(true).catch((reason: string): void => {\r\n                Events.instance.onEvent(new BackgroundEvent(reason));\r\n            });\r\n\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Send the mute all participants command to the websocket\r\n     * @param conversationId\r\n     * @param participantId\r\n     * @param isMuted\r\n     */\r\n    public sendRequest(command: string, cb?: () => void, err?: (e: string) => void): void {\r\n        try {\r\n            Contracts.throwIfDisposed(this.privIsDisposed);\r\n            this.sendMessage(command, cb, err);\r\n        } catch (error) {\r\n            if (!!err) {\r\n                if (error instanceof Error) {\r\n                    const typedError: Error = error;\r\n                    err(typedError.name + \": \" + typedError.message);\r\n                } else {\r\n                    err(error as string);\r\n                }\r\n            }\r\n\r\n            // Destroy the recognizer.\r\n            this.dispose(true).catch((reason: string): void => {\r\n                Events.instance.onEvent(new BackgroundEvent(reason));\r\n            });\r\n\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Handle update of service auth token (#694)\r\n     */\r\n    public onToken(token: IAuthentication): void {\r\n        this.privConversation.onToken(token);\r\n    }\r\n\r\n    /**\r\n     * Close and dispose the recognizer\r\n     */\r\n    public async close(): Promise<void> {\r\n        if (!this.privIsDisposed) {\r\n            if (!!this.privConnection) {\r\n                this.privConnection.closeConnection();\r\n                this.privConnection.close();\r\n            }\r\n            this.privConnection = undefined;\r\n            await this.dispose(true);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Dispose the recognizer\r\n     * @param disposing\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privIsDisposed) {\r\n            return;\r\n        }\r\n        if (disposing) {\r\n            if (this.privTimeoutToken !== undefined) {\r\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n                this.privClearTimeout(this.privTimeoutToken);\r\n            }\r\n            this.privIsDisposed = true;\r\n            if (!!this.privConnection) {\r\n                this.privConnection.closeConnection();\r\n                this.privConnection.close();\r\n                this.privConnection = undefined;\r\n            }\r\n            await super.dispose(disposing);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Create the config for the recognizer\r\n     * @param speechConfig\r\n     */\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(speechConfig, this.privProperties);\r\n    }\r\n\r\n    /**\r\n     * Create the service recognizer.\r\n     * The audio source is redundnant here but is required by the implementation.\r\n     * @param authentication\r\n     * @param connectionFactory\r\n     * @param audioConfig\r\n     * @param recognizerConfig\r\n     */\r\n    protected createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n\r\n        const audioSource: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n\r\n        return new ConversationServiceAdapter(authentication, connectionFactory, audioSource, recognizerConfig, this);\r\n    }\r\n\r\n    private sendMessage(msg: string, cb?: Callback, err?: Callback): void {\r\n        const withAsync = this.privReco as ConversationServiceAdapter;\r\n        const PromiseToEmptyCallback = <T>(promise: Promise<T>, cb?: Callback, err?: Callback): void => {\r\n            if (promise !== undefined) {\r\n                promise.then((): void => {\r\n                    try {\r\n                        if (!!cb) {\r\n                            cb();\r\n                        }\r\n                    } catch (e) {\r\n                        if (!!err) {\r\n                            err(`'Unhandled error on promise callback: ${e as string}'`);\r\n                        }\r\n                    }\r\n                }, (reason: any): void => {\r\n                    try {\r\n                        if (!!err) {\r\n                            err(reason);\r\n                        }\r\n                        // eslint-disable-next-line no-empty\r\n                    } catch (error) { }\r\n                });\r\n            } else {\r\n                if (!!err) {\r\n                    err(\"Null promise\");\r\n                }\r\n            }\r\n        };\r\n\r\n        PromiseToEmptyCallback(withAsync.sendMessageAsync(msg), cb, err);\r\n        this.resetConversationTimeout();\r\n    }\r\n\r\n    private resetConversationTimeout(): void {\r\n        if (this.privTimeoutToken !== undefined) {\r\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\r\n            this.privClearTimeout(this.privTimeoutToken);\r\n        }\r\n\r\n        this.privTimeoutToken = this.privSetTimeout((): void => {\r\n            this.sendRequest(this.privConversation.getKeepAlive());\r\n        }, 60000);\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ProxyInfo, WebsocketConnection } from \"../../common.browser/Exports.js\";\r\nimport { createGuid, IConnection, IStringDictionary } from \"../../common/Exports.js\";\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport { PropertyId } from \"../../sdk/Exports.js\";\r\nimport { ConnectionFactoryBase } from \"../ConnectionFactoryBase.js\";\r\nimport { AuthInfo, RecognizerConfig } from \"../Exports.js\";\r\nimport { ConversationConnectionConfig } from \"./ConversationConnectionConfig.js\";\r\nimport { ConversationWebsocketMessageFormatter } from \"./ConversationWebsocketMessageFormatter.js\";\r\n\r\n/**\r\n * Create a connection to the Conversation Translator websocket for sending instant messages and commands, and for receiving translated messages.\r\n * The conversation must already have been started or joined.\r\n */\r\nexport class ConversationConnectionFactory extends ConnectionFactoryBase  {\r\n\r\n    public create(config: RecognizerConfig, authInfo: AuthInfo, connectionId?: string): IConnection {\r\n\r\n        const endpointHost: string = config.parameters.getProperty(PropertyId.ConversationTranslator_Host, ConversationConnectionConfig.host);\r\n        const correlationId: string = config.parameters.getProperty(PropertyId.ConversationTranslator_CorrelationId, createGuid());\r\n\r\n        const endpoint: string = `wss://${endpointHost}${ConversationConnectionConfig.webSocketPath}`;\r\n        const token: string = config.parameters.getProperty(PropertyId.ConversationTranslator_Token, undefined);\r\n        Contracts.throwIfNullOrUndefined(token, \"token\");\r\n\r\n        const queryParams: IStringDictionary<string> = {};\r\n        queryParams[ConversationConnectionConfig.configParams.apiVersion] = ConversationConnectionConfig.apiVersion;\r\n        queryParams[ConversationConnectionConfig.configParams.token] = token;\r\n        queryParams[ConversationConnectionConfig.configParams.correlationId] = correlationId;\r\n        const enableCompression: boolean = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\r\n        return new WebsocketConnection(endpoint, queryParams, {}, new ConversationWebsocketMessageFormatter(), ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ConnectionMessage,\r\n    Deferred,\r\n    IWebsocketMessageFormatter,\r\n    MessageType,\r\n    RawWebsocketMessage,\r\n} from \"../../common/Exports.js\";\r\nimport { ConversationConnectionMessage } from \"./ConversationConnectionMessage.js\";\r\n\r\n/**\r\n * Based off WebsocketMessageFormatter. The messages for Conversation Translator have some variations from the Speech messages.\r\n */\r\nexport class ConversationWebsocketMessageFormatter implements IWebsocketMessageFormatter {\r\n\r\n    /**\r\n     * Format incoming messages: text (speech partial/final, IM) or binary (tts)\r\n     */\r\n    public toConnectionMessage(message: RawWebsocketMessage): Promise<ConversationConnectionMessage> {\r\n        const deferral = new Deferred<ConversationConnectionMessage>();\r\n\r\n        try {\r\n            if (message.messageType === MessageType.Text) {\r\n                const incomingMessage: ConversationConnectionMessage = new ConversationConnectionMessage(message.messageType, message.textContent, {}, message.id);\r\n                deferral.resolve(incomingMessage);\r\n            } else if (message.messageType === MessageType.Binary) {\r\n                deferral.resolve(new ConversationConnectionMessage(message.messageType, message.binaryContent, undefined, message.id));\r\n            }\r\n        } catch (e) {\r\n            deferral.reject(`Error formatting the message. Error: ${e as string}`);\r\n        }\r\n\r\n        return deferral.promise;\r\n    }\r\n\r\n    /**\r\n     * Format outgoing messages: text (commands or IM)\r\n     */\r\n    public fromConnectionMessage(message: ConnectionMessage): Promise<RawWebsocketMessage> {\r\n\r\n        const deferral = new Deferred<RawWebsocketMessage>();\r\n\r\n        try {\r\n            if (message.messageType === MessageType.Text) {\r\n                const payload = `${message.textBody ? message.textBody : \"\"}`;\r\n                deferral.resolve(new RawWebsocketMessage(MessageType.Text, payload, message.id));\r\n            }\r\n        } catch (e) {\r\n            deferral.reject(`Error formatting the message. ${e as string}`);\r\n        }\r\n\r\n        return deferral.promise;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ConnectionMessage, IStringDictionary, MessageType } from \"../../common/Exports.js\";\r\n\r\nexport class ConversationConnectionMessage extends ConnectionMessage {\r\n    private privConversationMessageType: string;\r\n\r\n    public constructor(\r\n        messageType: MessageType,\r\n        body: any,\r\n        headers?: IStringDictionary<string>,\r\n        id?: string) {\r\n            super(messageType, body, headers, id);\r\n            const json: { type: string } = JSON.parse(this.textBody) as { type: string };\r\n            if (json.type !== undefined) {\r\n                this.privConversationMessageType = json.type;\r\n            }\r\n    }\r\n\r\n    public get conversationMessageType(): string {\r\n        return this.privConversationMessageType;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ConnectionState,\r\n    createNoDashGuid,\r\n    Deferred,\r\n    IAudioSource,\r\n    IConnection,\r\n    MessageType,\r\n} from \"../../common/Exports.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    ConversationExpirationEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    ConversationTranslationResult,\r\n    ResultReason,\r\n    Translations\r\n} from \"../../sdk/Exports.js\";\r\nimport {\r\n    CognitiveTokenAuthentication,\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase\r\n} from \"../Exports.js\";\r\nimport { ConversationConnectionMessage } from \"./ConversationConnectionMessage.js\";\r\nimport { ConversationRequestSession } from \"./ConversationRequestSession.js\";\r\nimport {\r\n    ConversationReceivedTranslationEventArgs,\r\n    LockRoomEventArgs,\r\n    MuteAllEventArgs,\r\n    ParticipantAttributeEventArgs,\r\n    ParticipantEventArgs,\r\n    ParticipantsListEventArgs\r\n} from \"./ConversationTranslatorEventArgs.js\";\r\nimport {\r\n    ConversationTranslatorCommandTypes,\r\n    ConversationTranslatorMessageTypes,\r\n    IInternalParticipant\r\n} from \"./ConversationTranslatorInterfaces.js\";\r\nimport { ConversationTranslatorRecognizer } from \"./ConversationTranslatorRecognizer.js\";\r\nimport {\r\n    CommandResponsePayload,\r\n    IParticipantPayloadResponse,\r\n    IParticipantsListPayloadResponse,\r\n    ITranslationResponsePayload,\r\n    ParticipantPayloadResponse,\r\n    ParticipantsListPayloadResponse,\r\n    SpeechResponsePayload,\r\n    TextResponsePayload\r\n} from \"./ServiceMessages/Exports.js\";\r\n\r\n/**\r\n * The service adapter handles sending and receiving messages to the Conversation Translator websocket.\r\n */\r\nexport class ConversationServiceAdapter extends ServiceRecognizerBase {\r\n    private privConversationServiceConnector: ConversationTranslatorRecognizer;\r\n    private privConversationConnectionFactory: IConnectionFactory;\r\n    private privConversationAuthFetchEventId: string;\r\n    private privConversationAuthentication: IAuthentication;\r\n    private privConversationRequestSession: ConversationRequestSession;\r\n    private privConnectionConfigPromise: Promise<IConnection> = undefined;\r\n    private privConnectionLoop: Promise<void>;\r\n    private terminateMessageLoop: boolean;\r\n    private privLastPartialUtteranceId: string;\r\n    private privConversationIsDisposed: boolean;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        conversationServiceConnector: ConversationTranslatorRecognizer) {\r\n\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, conversationServiceConnector);\r\n\r\n        this.privLastPartialUtteranceId = \"\";\r\n        this.privConversationServiceConnector = conversationServiceConnector;\r\n        this.privConversationAuthentication = authentication;\r\n        this.receiveMessageOverride = (): Promise<void> => this.receiveConversationMessageOverride();\r\n        this.recognizeOverride = (): Promise<void> => this.noOp();\r\n        this.postConnectImplOverride = (connection: Promise<IConnection>): Promise<IConnection> => this.conversationConnectImpl(connection);\r\n        this.configConnectionOverride = (): Promise<IConnection> => this.configConnection();\r\n        this.disconnectOverride = (): Promise<void> => this.privDisconnect();\r\n        this.privConversationRequestSession = new ConversationRequestSession(createNoDashGuid());\r\n        this.privConversationConnectionFactory = connectionFactory;\r\n        this.privConversationIsDisposed = false;\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return super.isDisposed() || this.privConversationIsDisposed;\r\n    }\r\n\r\n    public async dispose(reason?: string): Promise<void> {\r\n        this.privConversationIsDisposed = true;\r\n        if (this.privConnectionConfigPromise !== undefined) {\r\n            const connection: IConnection = await this.privConnectionConfigPromise;\r\n            await connection.dispose(reason);\r\n        }\r\n        await super.dispose(reason);\r\n    }\r\n\r\n    public async sendMessage(message: string): Promise<void> {\r\n        const connection: IConnection = await this.fetchConnection();\r\n        return connection.send(new ConversationConnectionMessage(\r\n            MessageType.Text,\r\n            message));\r\n    }\r\n\r\n    public async sendMessageAsync(message: string): Promise<void> {\r\n        const connection: IConnection = await this.fetchConnection();\r\n\r\n        await connection.send(new ConversationConnectionMessage(MessageType.Text, message));\r\n    }\r\n\r\n    protected privDisconnect(): Promise<void> {\r\n        if (this.terminateMessageLoop) {\r\n            return;\r\n        }\r\n        this.cancelRecognition(this.privConversationRequestSession.sessionId,\r\n            this.privConversationRequestSession.requestId,\r\n            CancellationReason.Error,\r\n            CancellationErrorCode.NoError,\r\n            \"Disconnecting\");\r\n\r\n        this.terminateMessageLoop = true;\r\n        return Promise.resolve();\r\n    }\r\n\r\n    // eslint-disable-next-line @typescript-eslint/require-await\r\n    protected async processTypeSpecificMessages(): Promise<boolean> {\r\n        return true;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        this.terminateMessageLoop = true;\r\n\r\n        const cancelEvent: ConversationTranslationCanceledEventArgs = new ConversationTranslationCanceledEventArgs(\r\n            cancellationReason,\r\n            error,\r\n            errorCode,\r\n            undefined,\r\n            sessionId);\r\n\r\n        try {\r\n            if (!!this.privConversationServiceConnector.canceled) {\r\n                this.privConversationServiceConnector.canceled(this.privConversationServiceConnector, cancelEvent);\r\n            }\r\n        } catch {\r\n            // continue on error\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Establishes a websocket connection to the end point.\r\n     */\r\n    protected async conversationConnectImpl(connection: Promise<IConnection>): Promise<IConnection> {\r\n        this.privConnectionLoop = this.startMessageLoop();\r\n        return connection;\r\n    }\r\n\r\n    /**\r\n     * Process incoming websocket messages\r\n     */\r\n    private async receiveConversationMessageOverride(): Promise<void> {\r\n        if (this.isDisposed() || this.terminateMessageLoop) {\r\n            return Promise.resolve();\r\n        }\r\n        // we won't rely on the cascading promises of the connection since we want to continually be available to receive messages\r\n        const communicationCustodian: Deferred<void> = new Deferred<void>();\r\n\r\n        try {\r\n            const connection: IConnection = await this.fetchConnection();\r\n            const message: ConversationConnectionMessage = await connection.read() as ConversationConnectionMessage;\r\n            if (this.isDisposed() || this.terminateMessageLoop) {\r\n                // We're done.\r\n                communicationCustodian.resolve();\r\n                return Promise.resolve();\r\n            }\r\n\r\n            if (!message) {\r\n                return this.receiveConversationMessageOverride();\r\n            }\r\n\r\n            const sessionId: string = this.privConversationRequestSession.sessionId;\r\n            const conversationMessageType: string = message.conversationMessageType.toLowerCase();\r\n            let sendFinal: boolean = false;\r\n\r\n            try {\r\n                switch (conversationMessageType) {\r\n                    case \"info\":\r\n                    case \"participant_command\":\r\n                    case \"command\":\r\n                        const commandPayload: CommandResponsePayload = CommandResponsePayload.fromJSON(message.textBody);\r\n                        switch (commandPayload.command.toLowerCase()) {\r\n\r\n                            /**\r\n                             * 'ParticpantList' is the first message sent to the user after the websocket connection has opened.\r\n                             * The consuming client must wait for this message to arrive\r\n                             * before starting to send their own data.\r\n                             */\r\n                            case \"participantlist\":\r\n\r\n                                const participantsPayload: IParticipantsListPayloadResponse = ParticipantsListPayloadResponse.fromJSON(message.textBody);\r\n\r\n                                const participantsResult: IInternalParticipant[] = participantsPayload.participants.map((p: IParticipantPayloadResponse): IInternalParticipant => {\r\n                                    const participant: IInternalParticipant = {\r\n                                        avatar: p.avatar,\r\n                                        displayName: p.nickname,\r\n                                        id: p.participantId,\r\n                                        isHost: p.ishost,\r\n                                        isMuted: p.ismuted,\r\n                                        isUsingTts: p.usetts,\r\n                                        preferredLanguage: p.locale\r\n                                    };\r\n                                    return participant;\r\n                                });\r\n\r\n                                if (!!this.privConversationServiceConnector.participantsListReceived) {\r\n                                    this.privConversationServiceConnector.participantsListReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantsListEventArgs(participantsPayload.roomid, participantsPayload.token,\r\n                                            participantsPayload.translateTo, participantsPayload.profanityFilter,\r\n                                            participantsPayload.roomProfanityFilter, participantsPayload.roomLocked,\r\n                                            participantsPayload.muteAll, participantsResult, sessionId));\r\n                                }\r\n                                break;\r\n\r\n                            /**\r\n                             * 'SetTranslateToLanguages' represents the list of languages being used in the Conversation by all users(?).\r\n                             * This is sent at the start of the Conversation\r\n                             */\r\n                            case \"settranslatetolanguages\":\r\n\r\n                                if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantAttributeEventArgs(commandPayload.participantId,\r\n                                            ConversationTranslatorCommandTypes.setTranslateToLanguages,\r\n                                            commandPayload.value, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'SetProfanityFiltering' lets the client set the level of profanity filtering.\r\n                             * If sent by the participant the setting will effect only their own profanity level.\r\n                             * If sent by the host, the setting will effect all participants including the host.\r\n                             * Note: the profanity filters differ from Speech Service (?): 'marked', 'raw', 'removed', 'tagged'\r\n                             */\r\n                            case \"setprofanityfiltering\":\r\n\r\n                                if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantAttributeEventArgs(commandPayload.participantId,\r\n                                            ConversationTranslatorCommandTypes.setProfanityFiltering,\r\n                                            commandPayload.value, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'SetMute' is sent if the participant has been muted by the host.\r\n                             * Check the 'participantId' to determine if the current user has been muted.\r\n                             */\r\n                            case \"setmute\":\r\n\r\n                                if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantAttributeEventArgs(commandPayload.participantId,\r\n                                            ConversationTranslatorCommandTypes.setMute,\r\n                                            commandPayload.value, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'SetMuteAll' is sent if the Conversation has been muted by the host.\r\n                             */\r\n                            case \"setmuteall\":\r\n\r\n                                if (!!this.privConversationServiceConnector.muteAllCommandReceived) {\r\n                                    this.privConversationServiceConnector.muteAllCommandReceived(this.privConversationServiceConnector,\r\n                                        new MuteAllEventArgs(commandPayload.value as boolean, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'RoomExpirationWarning' is sent towards the end of the Conversation session to give a timeout warning.\r\n                             */\r\n                            case \"roomexpirationwarning\":\r\n\r\n                                if (!!this.privConversationServiceConnector.conversationExpiration) {\r\n                                    this.privConversationServiceConnector.conversationExpiration(this.privConversationServiceConnector,\r\n                                        new ConversationExpirationEventArgs(commandPayload.value as number, this.privConversationRequestSession.sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'SetUseTts' is sent as a confirmation if the user requests TTS to be turned on or off.\r\n                             */\r\n                            case \"setusetts\":\r\n\r\n                                if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantAttributeEventArgs(commandPayload.participantId,\r\n                                            ConversationTranslatorCommandTypes.setUseTTS,\r\n                                            commandPayload.value, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'SetLockState' is set if the host has locked or unlocked the Conversation.\r\n                             */\r\n                            case \"setlockstate\":\r\n\r\n                                if (!!this.privConversationServiceConnector.lockRoomCommandReceived) {\r\n                                    this.privConversationServiceConnector.lockRoomCommandReceived(this.privConversationServiceConnector,\r\n                                        new LockRoomEventArgs(commandPayload.value as boolean, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'ChangeNickname' is received if a user changes their display name.\r\n                             * Any cached particpiants list should be updated to reflect the display name.\r\n                             */\r\n                            case \"changenickname\":\r\n\r\n                                if (!!this.privConversationServiceConnector.participantUpdateCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantUpdateCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantAttributeEventArgs(commandPayload.participantId,\r\n                                            ConversationTranslatorCommandTypes.changeNickname,\r\n                                            commandPayload.value, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'JoinSession' is sent when a user joins the Conversation.\r\n                             */\r\n                            case \"joinsession\":\r\n\r\n                                const joinParticipantPayload: ParticipantPayloadResponse = ParticipantPayloadResponse.fromJSON(message.textBody);\r\n\r\n                                const joiningParticipant: IInternalParticipant = {\r\n                                    avatar: joinParticipantPayload.avatar,\r\n                                    displayName: joinParticipantPayload.nickname,\r\n                                    id: joinParticipantPayload.participantId,\r\n                                    isHost: joinParticipantPayload.ishost,\r\n                                    isMuted: joinParticipantPayload.ismuted,\r\n                                    isUsingTts: joinParticipantPayload.usetts,\r\n                                    preferredLanguage: joinParticipantPayload.locale,\r\n                                };\r\n\r\n                                if (!!this.privConversationServiceConnector.participantJoinCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantJoinCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantEventArgs(\r\n                                            joiningParticipant,\r\n                                            sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'LeaveSession' is sent when a user leaves the Conversation'.\r\n                             */\r\n                            case \"leavesession\":\r\n\r\n                                const leavingParticipant: IInternalParticipant = {\r\n                                    id: commandPayload.participantId\r\n                                };\r\n\r\n                                if (!!this.privConversationServiceConnector.participantLeaveCommandReceived) {\r\n                                    this.privConversationServiceConnector.participantLeaveCommandReceived(this.privConversationServiceConnector,\r\n                                        new ParticipantEventArgs(leavingParticipant, sessionId));\r\n                                }\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * 'DisconnectSession' is sent when a user is disconnected from the session (e.g. network problem).\r\n                             * Check the 'ParticipantId' to check whether the message is for the current user.\r\n                             */\r\n                            case \"disconnectsession\":\r\n\r\n                                // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n                                const disconnectParticipant: IInternalParticipant = {\r\n                                    id: commandPayload.participantId\r\n                                };\r\n\r\n                                break;\r\n\r\n                            case \"token\":\r\n                                const token = new CognitiveTokenAuthentication(\r\n                                    (): Promise<string> => {\r\n                                        const authorizationToken = commandPayload.token;\r\n                                        return Promise.resolve(authorizationToken);\r\n                                    },\r\n                                    (): Promise<string> => {\r\n                                        const authorizationToken = commandPayload.token;\r\n                                        return Promise.resolve(authorizationToken);\r\n                                    });\r\n                                this.authentication = token;\r\n                                this.privConversationServiceConnector.onToken(token);\r\n\r\n                                break;\r\n\r\n                            /**\r\n                             * Message not recognized.\r\n                             */\r\n                            default:\r\n                                break;\r\n                        }\r\n                        break;\r\n\r\n                    /**\r\n                     * 'partial' (or 'hypothesis') represents a unfinalized speech message.\r\n                     */\r\n                    case \"partial\":\r\n\r\n                    /**\r\n                     * 'final' (or 'phrase') represents a finalized speech message.\r\n                     */\r\n                    case \"final\":\r\n\r\n                        const speechPayload: SpeechResponsePayload = SpeechResponsePayload.fromJSON(message.textBody);\r\n                        const conversationResultReason: ResultReason = (conversationMessageType === \"final\") ? ResultReason.TranslatedParticipantSpeech : ResultReason.TranslatingParticipantSpeech;\r\n\r\n                        const speechResult: ConversationTranslationResult = new ConversationTranslationResult(speechPayload.participantId,\r\n                            this.getTranslations(speechPayload.translations),\r\n                            speechPayload.language,\r\n                            speechPayload.id,\r\n                            conversationResultReason,\r\n                            speechPayload.recognition,\r\n                            undefined,\r\n                            undefined,\r\n                            message.textBody,\r\n                            undefined);\r\n\r\n                        if (speechPayload.isFinal) {\r\n                            // check the length, sometimes empty finals are returned\r\n                            if (speechResult.text !== undefined && speechResult.text.length > 0) {\r\n                                sendFinal = true;\r\n                            } else if (speechPayload.id === this.privLastPartialUtteranceId) {\r\n                                // send final as normal. We had a non-empty partial for this same utterance\r\n                                // so sending the empty final is important\r\n                                sendFinal = true;\r\n                            } else {\r\n                                // suppress unneeded final\r\n                            }\r\n\r\n                            if (sendFinal) {\r\n                                if (!!this.privConversationServiceConnector.translationReceived) {\r\n                                    this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector,\r\n                                        new ConversationReceivedTranslationEventArgs(ConversationTranslatorMessageTypes.final, speechResult, sessionId));\r\n                                }\r\n                            }\r\n                        } else if (speechResult.text !== undefined) {\r\n                            this.privLastPartialUtteranceId = speechPayload.id;\r\n                            if (!!this.privConversationServiceConnector.translationReceived) {\r\n                                this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector,\r\n                                    new ConversationReceivedTranslationEventArgs(ConversationTranslatorMessageTypes.partial, speechResult, sessionId));\r\n                            }\r\n                        }\r\n\r\n                        break;\r\n\r\n                    /**\r\n                     * \"translated_message\" is a text message or instant message (IM).\r\n                     */\r\n                    case \"translated_message\":\r\n\r\n                        const textPayload: TextResponsePayload = TextResponsePayload.fromJSON(message.textBody);\r\n                        // TODO: (Native parity) a result reason should be set based whether the participantId is ours or not\r\n\r\n                        const textResult: ConversationTranslationResult = new ConversationTranslationResult(textPayload.participantId,\r\n                            this.getTranslations(textPayload.translations),\r\n                            textPayload.language,\r\n                            undefined,\r\n                            undefined,\r\n                            textPayload.originalText,\r\n                            undefined,\r\n                            undefined,\r\n                            undefined,\r\n                            message.textBody,\r\n                            undefined);\r\n\r\n                        if (!!this.privConversationServiceConnector.translationReceived) {\r\n                            this.privConversationServiceConnector.translationReceived(this.privConversationServiceConnector,\r\n                                new ConversationReceivedTranslationEventArgs(ConversationTranslatorMessageTypes.instantMessage, textResult, sessionId));\r\n                        }\r\n                        break;\r\n\r\n                    default:\r\n                        // ignore any unsupported message types\r\n                        break;\r\n                }\r\n            } catch (e) {\r\n                // continue\r\n            }\r\n            return this.receiveConversationMessageOverride();\r\n        } catch (e) {\r\n            this.terminateMessageLoop = true;\r\n        }\r\n\r\n        return communicationCustodian.promise;\r\n    }\r\n\r\n    private async startMessageLoop(): Promise<void> {\r\n        if (this.isDisposed()) {\r\n            return Promise.resolve();\r\n        }\r\n        this.terminateMessageLoop = false;\r\n\r\n        const messageRetrievalPromise = this.receiveConversationMessageOverride();\r\n\r\n        try {\r\n            const r = await messageRetrievalPromise;\r\n            return r;\r\n        } catch (error) {\r\n            this.cancelRecognition(this.privRequestSession ? this.privRequestSession.sessionId : \"\", this.privRequestSession ? this.privRequestSession.requestId : \"\", CancellationReason.Error, CancellationErrorCode.RuntimeError, error as string);\r\n            return null;\r\n        }\r\n    }\r\n\r\n    // Takes an established websocket connection to the endpoint\r\n    private configConnection(): Promise<IConnection> {\r\n        if (this.isDisposed()) {\r\n            return Promise.resolve<IConnection>(undefined);\r\n        }\r\n        if (this.privConnectionConfigPromise !== undefined) {\r\n            return this.privConnectionConfigPromise.then((connection: IConnection): Promise<IConnection> => {\r\n                if (connection.state() === ConnectionState.Disconnected) {\r\n                    this.privConnectionId = null;\r\n                    this.privConnectionConfigPromise = undefined;\r\n                    return this.configConnection();\r\n                }\r\n                return this.privConnectionConfigPromise;\r\n            }, (): Promise<IConnection> => {\r\n                this.privConnectionId = null;\r\n                this.privConnectionConfigPromise = undefined;\r\n                return this.configConnection();\r\n            });\r\n        }\r\n        if (this.terminateMessageLoop) {\r\n            return Promise.resolve<IConnection>(undefined);\r\n        }\r\n\r\n        this.privConnectionConfigPromise = this.connectImpl().then((connection: IConnection): IConnection => connection);\r\n\r\n        return this.privConnectionConfigPromise;\r\n    }\r\n\r\n    private getTranslations(serviceResultTranslations: ITranslationResponsePayload[]): Translations {\r\n        let translations: Translations;\r\n\r\n        if (undefined !== serviceResultTranslations) {\r\n            translations = new Translations();\r\n            for (const translation of serviceResultTranslations) {\r\n                translations.set(translation.lang, translation.translation);\r\n            }\r\n        }\r\n\r\n        return translations;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    createNoDashGuid,\r\n    Deferred,\r\n    IDetachable,\r\n} from \"../../common/Exports.js\";\r\n\r\n/**\r\n * Placeholder class for the Conversation Request Session. Based off RequestSession.\r\n * TODO: define what telemetry is required.\r\n */\r\nexport class ConversationRequestSession {\r\n    private privIsDisposed: boolean = false;\r\n    private privDetachables: IDetachable[] = new Array<IDetachable>();\r\n    private privRequestId: string;\r\n    private privRequestCompletionDeferral: Deferred<void>;\r\n    private privSessionId: string;\r\n\r\n    public constructor(sessionId: string) {\r\n        this.privSessionId = sessionId;\r\n        this.privRequestId = createNoDashGuid();\r\n        this.privRequestCompletionDeferral = new Deferred<void>();\r\n    }\r\n\r\n    public get sessionId(): string {\r\n        return this.privSessionId;\r\n    }\r\n\r\n    public get requestId(): string {\r\n        return this.privRequestId;\r\n    }\r\n\r\n    public get completionPromise(): Promise<void> {\r\n        return this.privRequestCompletionDeferral.promise;\r\n    }\r\n\r\n    public onPreConnectionStart(authFetchEventId: string, connectionId: string): void {\r\n        this.privSessionId = connectionId;\r\n    }\r\n\r\n    public onAuthCompleted(isError: boolean): void {\r\n        if (isError) {\r\n            this.onComplete();\r\n        }\r\n    }\r\n\r\n    public onConnectionEstablishCompleted(statusCode: number): void {\r\n        if (statusCode === 200) {\r\n            return;\r\n        } else if (statusCode === 403) {\r\n            this.onComplete();\r\n        }\r\n    }\r\n\r\n    public onServiceTurnEndResponse(continuousRecognition: boolean): void {\r\n        if (!continuousRecognition) {\r\n            this.onComplete();\r\n        } else {\r\n            this.privRequestId = createNoDashGuid();\r\n        }\r\n    }\r\n\r\n    public async dispose(): Promise<void> {\r\n        if (!this.privIsDisposed) {\r\n            // we should have completed by now. If we did not its an unknown error.\r\n            this.privIsDisposed = true;\r\n            for (const detachable of this.privDetachables) {\r\n                await detachable.detach();\r\n            }\r\n        }\r\n    }\r\n\r\n    private onComplete(): void {\r\n        //\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n/* eslint-disable max-classes-per-file */\r\nimport { ConversationTranslationResult, SessionEventArgs } from \"../../sdk/Exports.js\";\r\nimport { IInternalParticipant } from \"./ConversationTranslatorInterfaces.js\";\r\n\r\nexport class MuteAllEventArgs extends SessionEventArgs {\r\n    private privIsMuted: boolean;\r\n\r\n    public constructor(isMuted: boolean, sessionId?: string) {\r\n        super(sessionId);\r\n\r\n        this.privIsMuted = isMuted;\r\n    }\r\n\r\n    public get isMuted(): boolean {\r\n        return this.privIsMuted;\r\n    }\r\n}\r\n\r\nexport class LockRoomEventArgs extends SessionEventArgs {\r\n    private privIsLocked: boolean;\r\n\r\n    public constructor(isLocked: boolean, sessionId?: string) {\r\n        super(sessionId);\r\n\r\n        this.privIsLocked = isLocked;\r\n    }\r\n\r\n    public get isMuted(): boolean {\r\n        return this.privIsLocked;\r\n    }\r\n}\r\n\r\nexport class ParticipantEventArgs extends SessionEventArgs {\r\n    private privParticipant: IInternalParticipant;\r\n\r\n    public constructor(participant: IInternalParticipant, sessionId?: string) {\r\n        super(sessionId);\r\n        this.privParticipant = participant;\r\n    }\r\n\r\n    public get participant(): IInternalParticipant {\r\n        return this.privParticipant;\r\n    }\r\n}\r\n\r\nexport class ParticipantAttributeEventArgs extends SessionEventArgs {\r\n    private privValue: boolean | number | string | string[];\r\n    private privKey: string;\r\n    private privParticipantId: string;\r\n\r\n    public constructor(participantId: string, key: string, value: boolean | number | string |  string[], sessionId?: string) {\r\n        super(sessionId);\r\n\r\n        this.privKey = key;\r\n        this.privValue = value;\r\n        this.privParticipantId = participantId;\r\n    }\r\n\r\n    public get value(): boolean | number | string |  string[] {\r\n        return this.privValue;\r\n    }\r\n\r\n    public get key(): string {\r\n        return this.privKey;\r\n    }\r\n    public get id(): string {\r\n        return this.privParticipantId;\r\n    }\r\n}\r\n\r\nexport class ParticipantsListEventArgs extends SessionEventArgs {\r\n\r\n    private privRoomId: string;\r\n    private privSessionToken: string;\r\n    private privTranslateTo: string[];\r\n    private privProfanityFilter: string;\r\n    private privRoomProfanityFilter: string;\r\n    private privIsRoomLocked: boolean;\r\n    private privIsMuteAll: boolean;\r\n    private privParticipants: IInternalParticipant[];\r\n\r\n    public constructor(conversationId: string, token: string, translateTo: string[], profanityFilter: string,\r\n                       roomProfanityFilter: string, isRoomLocked: boolean, isMuteAll: boolean, participants: IInternalParticipant[], sessionId?: string) {\r\n        super(sessionId);\r\n        this.privRoomId = conversationId;\r\n        this.privSessionToken = token;\r\n        this.privTranslateTo = translateTo;\r\n        this.privProfanityFilter = profanityFilter;\r\n        this.privRoomProfanityFilter = roomProfanityFilter;\r\n        this.privIsRoomLocked = isRoomLocked;\r\n        this.privIsRoomLocked = isMuteAll;\r\n        this.privParticipants = participants;\r\n    }\r\n    public get sessionToken(): string {\r\n        return this.privSessionToken;\r\n    }\r\n\r\n    public get conversationId(): string {\r\n        return this.privRoomId;\r\n    }\r\n\r\n    public get translateTo(): string[] {\r\n        return this.privTranslateTo;\r\n    }\r\n\r\n    public get profanityFilter(): string {\r\n        return this.privProfanityFilter;\r\n    }\r\n\r\n    public get roomProfanityFilter(): string {\r\n        return this.privRoomProfanityFilter;\r\n    }\r\n\r\n    public get isRoomLocked(): boolean {\r\n        return this.privIsRoomLocked;\r\n    }\r\n\r\n    public get isMuteAll(): boolean {\r\n        return this.privIsMuteAll;\r\n    }\r\n\r\n    public get participants(): IInternalParticipant[] {\r\n        return this.privParticipants;\r\n    }\r\n}\r\n\r\nexport class ConversationReceivedTranslationEventArgs {\r\n    private privPayload: ConversationTranslationResult;\r\n    private privCommand: string;\r\n    private privSessionId: string;\r\n\r\n    public constructor(command: string, payload: ConversationTranslationResult,  sessionId?: string) {\r\n        this.privPayload = payload;\r\n        this.privCommand = command;\r\n        this.privSessionId = sessionId;\r\n    }\r\n\r\n    public get payload(): ConversationTranslationResult {\r\n        return this.privPayload;\r\n    }\r\n\r\n    public get command(): string {\r\n        return this.privCommand;\r\n    }\r\n\r\n    public get sessionId(): string {\r\n        return this.privSessionId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ConnectionEventArgs,\r\n    ConversationExpirationEventArgs,\r\n    ConversationTranslationCanceledEventArgs,\r\n    SessionEventArgs,\r\n    } from \"../../sdk/Exports.js\";\r\n// import { ConversationClient } from \"./ConversationConnection\";\r\nimport {\r\n    ConversationReceivedTranslationEventArgs,\r\n    LockRoomEventArgs,\r\n    MuteAllEventArgs,\r\n    ParticipantAttributeEventArgs,\r\n    ParticipantEventArgs,\r\n    ParticipantsListEventArgs } from \"./ConversationTranslatorEventArgs.js\";\r\n\r\n/**\r\n * Internal conversation data\r\n */\r\nexport interface IInternalConversation {\r\n    // the token to use for connecting to the Speech Service\r\n    cognitiveSpeechAuthToken: string;\r\n    // the region to use for connecting to the Speech Service\r\n    cognitiveSpeechRegion: string;\r\n    // the unique id of the user who started or joined the Conversation\r\n    participantId: string;\r\n    // a descriptive name for the Conversation\r\n    name: string;\r\n    // a descriptive name for the Conversation\r\n    description: string;\r\n    // the speech model ID for custom speech\r\n    speechModel: string;\r\n    // represents the level of speech supported in the Conversation (0: everyone can speak, 2: only host can speak, 3: no-one can speak)\r\n    modalities: number;\r\n    // ?\r\n    isApproved: boolean;\r\n    // the mute flag has been set at conversation level and only the host can speak\r\n    isMuted: boolean;\r\n    // the 5 character conversation Id\r\n    roomId: string;\r\n    // the hex color string to represent a user. If there are many users this hex color may be reused (?).\r\n    avatar: string;\r\n    // the token to use when calling the websocket\r\n    token: string;\r\n    // used for tracking the session and help with troubleshooting problems in the logs\r\n    correlationId: string;\r\n    // extracted from the headers\r\n    requestId: string;\r\n    // set programmatically\r\n    isHost: boolean;\r\n}\r\n\r\n/**\r\n * The user who is participating in the conversation.\r\n */\r\nexport interface IInternalParticipant {\r\n    avatar?: string;\r\n    displayName?: string;\r\n    id?: string;\r\n    isHost?: boolean;\r\n    isMuted?: boolean;\r\n    isUsingTts?: boolean;\r\n    profanity?: boolean;\r\n    preferredLanguage?: string;\r\n    translateToLanguages?: string[];\r\n    voice?: string;\r\n}\r\n\r\n/** Users participating in the conversation */\r\nexport class InternalParticipants {\r\n\r\n    public constructor(public participants: IInternalParticipant[] = [], public meId?: string) {\r\n\r\n    }\r\n\r\n    /**\r\n     * Add or update a participant\r\n     * @param value\r\n     */\r\n    public addOrUpdateParticipant(value: IInternalParticipant): IInternalParticipant {\r\n        if (value === undefined) {\r\n            return;\r\n        }\r\n\r\n        const exists: number = this.getParticipantIndex(value.id);\r\n        if (exists > -1) {\r\n            this.participants.splice(exists, 1, value);\r\n        } else {\r\n            this.participants.push(value);\r\n        }\r\n\r\n        // ensure it was added ok\r\n        return this.getParticipant(value.id);\r\n    }\r\n\r\n    /**\r\n     * Find the participant's position in the participants list.\r\n     * @param id\r\n     */\r\n    public getParticipantIndex(id: string): number {\r\n        return this.participants.findIndex((p: IInternalParticipant): boolean => p.id === id);\r\n    }\r\n\r\n    /**\r\n     * Find the participant by id.\r\n     * @param id\r\n     */\r\n    public getParticipant(id: string): IInternalParticipant {\r\n        return this.participants.find((p: IInternalParticipant): boolean => p.id === id);\r\n    }\r\n\r\n    /**\r\n     * Remove a participant from the participants list.\r\n     */\r\n    public deleteParticipant(id: string): void {\r\n        this.participants = this.participants.filter((p: IInternalParticipant): boolean => p.id !== id);\r\n    }\r\n\r\n    /**\r\n     * Helper to return the conversation host.\r\n     */\r\n    public get host(): IInternalParticipant {\r\n        return this.participants.find((p: IInternalParticipant): boolean => p.isHost === true );\r\n    }\r\n\r\n    /**\r\n     * Helper to return the current user.\r\n     */\r\n    public get me(): IInternalParticipant {\r\n        return this.getParticipant(this.meId);\r\n    }\r\n}\r\n\r\n/**\r\n * Recognizer for handling Conversation Translator websocket messages\r\n */\r\nexport interface ConversationRecognizer {\r\n    isDisposed(): boolean;\r\n    sendRequest: (command: string, cb?: () => void, err?: (e: string) => void) => void;\r\n    cancelSpeech?: () => Promise<void>;\r\n    close?: () => Promise<void>;\r\n    conversationExpiration?: (sender: ConversationRecognizer, event: ConversationExpirationEventArgs) => void;\r\n    connected?: (e: ConnectionEventArgs) => void;\r\n    disconnected?: (e: ConnectionEventArgs) => void;\r\n    canceled?: (sender: ConversationRecognizer, event: ConversationTranslationCanceledEventArgs) => void;\r\n    connectionOpened?: (sender: ConversationRecognizer, event: SessionEventArgs) => void;\r\n    connectionClosed?: (sender: ConversationRecognizer, event: SessionEventArgs) => void;\r\n    participantsListReceived?: (sender: ConversationRecognizer, event: ParticipantsListEventArgs) => void;\r\n    translationReceived?: (sender: ConversationRecognizer, event: ConversationReceivedTranslationEventArgs) => void;\r\n    lockRoomCommandReceived?: (sender: ConversationRecognizer, event: LockRoomEventArgs) => void;\r\n    muteAllCommandReceived?: (sender: ConversationRecognizer, event: MuteAllEventArgs) => void;\r\n    participantJoinCommandReceived?: (sender: ConversationRecognizer, event: ParticipantEventArgs) => void;\r\n    participantLeaveCommandReceived?: (sender: ConversationRecognizer, event: ParticipantEventArgs) => void;\r\n    participantUpdateCommandReceived?: (sender: ConversationRecognizer, event: ParticipantAttributeEventArgs) => void;\r\n    connect?: (token: string, cb?: () => void, err?: (e: string) => void) => void;\r\n}\r\n\r\n/**\r\n * Error message returned from the Conversation Translator websocket\r\n */\r\nexport interface IConversationResponseErrorMessage {\r\n    code: string;\r\n    message: string;\r\n}\r\n\r\n/**\r\n * Error returned from the Conversation Translator websocket\r\n */\r\nexport interface IConversationResponseError {\r\n    error: IConversationResponseErrorMessage;\r\n}\r\n\r\n/**\r\n * Base message command\r\n */\r\nexport interface IClientMessage {\r\n    type: any;\r\n}\r\n\r\n/**\r\n * Command message\r\n */\r\nexport interface ICommandMessage extends IClientMessage {\r\n    command?: string;\r\n}\r\n\r\n/**\r\n * Text message command\r\n */\r\nexport interface IInstantMessageCommand extends ICommandMessage {\r\n    roomId: string;\r\n    nickname?: string;\r\n    participantId: string;\r\n    text: string;\r\n}\r\n\r\n/**\r\n * Lock command\r\n */\r\nexport interface ILockConversationCommand extends ICommandMessage {\r\n    id?: string; // incoming ws\r\n    nickname?: string; // incoming ws\r\n    participantId: string; // host - incoming ws\r\n    roomid: string;\r\n    value: boolean;\r\n}\r\n\r\n/**\r\n * Mute all command\r\n */\r\nexport interface IMuteAllCommand extends ICommandMessage {\r\n    roomid: string;\r\n    nickname?: string;  // incoming ws\r\n    participantId: string; // host\r\n    value: boolean;\r\n    id?: string; // incoming ws\r\n}\r\n\r\n/**\r\n * Mute participant command\r\n */\r\nexport interface IMuteCommand extends ICommandMessage {\r\n    roomid: string;\r\n    nickname?: string;\r\n    participantId: string; // participant\r\n    value: boolean;\r\n    id?: string; // incoming ws\r\n}\r\n\r\n/**\r\n * Remove participant command\r\n */\r\nexport interface IEjectParticipantCommand extends ICommandMessage {\r\n    roomid: string;\r\n    participantId: string; // participant\r\n}\r\n\r\n/**\r\n * Change nickname command\r\n */\r\nexport interface IChangeNicknameCommand extends ICommandMessage {\r\n    roomid: string;\r\n    participantId: string;\r\n    nickname: string;\r\n    value: string;\r\n}\r\n\r\n/**\r\n * List of command message types\r\n */\r\nexport const ConversationTranslatorMessageTypes = {\r\n    command: \"command\",\r\n    final: \"final\",\r\n    info: \"info\",\r\n    instantMessage: \"instant_message\",\r\n    keepAlive: \"keep_alive\",\r\n    partial: \"partial\",\r\n    participantCommand: \"participant_command\",\r\n    translatedMessage: \"translated_message\"\r\n};\r\n\r\n/**\r\n * List of command types\r\n */\r\nexport const ConversationTranslatorCommandTypes = {\r\n    changeNickname: \"ChangeNickname\",\r\n    disconnectSession: \"DisconnectSession\",\r\n    ejectParticipant: \"EjectParticipant\",\r\n    instant_message: \"instant_message\",\r\n    joinSession: \"JoinSession\",\r\n    leaveSession: \"LeaveSession\",\r\n    participantList: \"ParticipantList\",\r\n    roomExpirationWarning: \"RoomExpirationWarning\",\r\n    setLockState: \"SetLockState\",\r\n    setMute: \"SetMute\",\r\n    setMuteAll: \"SetMuteAll\",\r\n    setProfanityFiltering: \"SetProfanityFiltering\",\r\n    setTranslateToLanguages: \"SetTranslateToLanguages\",\r\n    setUseTTS: \"SetUseTTS\"\r\n};\r\n\r\n/**\r\n * HTTP response helper\r\n */\r\nexport interface IResponse {\r\n    ok: boolean;\r\n    status: number;\r\n    statusText: string;\r\n    data: string;\r\n    json: <T>() => T;\r\n    headers: string;\r\n}\r\n","export { CommandResponsePayload } from \"./CommandResponsePayload.js\";\r\nexport { IParticipantsListPayloadResponse, IParticipantPayloadResponse, ParticipantsListPayloadResponse, ParticipantPayloadResponse } from \"./ParticipantResponsePayload.js\";\r\nexport { ITranslationResponsePayload, SpeechResponsePayload, TextResponsePayload } from \"./TranslationResponsePayload.js\";\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/**\r\n * Defines the payload for incoming websocket commands\r\n */\r\nexport interface ICommandResponsePayload {\r\n    type: string;\r\n    command?: string;\r\n    id?: string; // incoming ws\r\n    nickname?: string; // incoming ws\r\n    participantId?: string;\r\n    roomid?: string;\r\n    value: boolean | number | string;\r\n    token?: string;\r\n}\r\n\r\nconst parseCommandResponse = (json: string): ICommandResponsePayload => JSON.parse(json) as ICommandResponsePayload;\r\n\r\nexport class CommandResponsePayload implements ICommandResponsePayload {\r\n    private privCommandResponse: ICommandResponsePayload;\r\n\r\n    public constructor(json: string) {\r\n        this.privCommandResponse = parseCommandResponse(json);\r\n    }\r\n\r\n    public get type(): string {\r\n        return this.privCommandResponse.type;\r\n    }\r\n    public get command(): string {\r\n        return this.privCommandResponse.command;\r\n    }\r\n    public get id(): string {\r\n        return this.privCommandResponse.id;\r\n    }\r\n    public get nickname(): string {\r\n        return this.privCommandResponse.nickname;\r\n    }\r\n    public get participantId(): string {\r\n        return this.privCommandResponse.participantId;\r\n    }\r\n    public get roomid(): string {\r\n        return this.privCommandResponse.roomid;\r\n    }\r\n    public get value(): boolean | number | string {\r\n        return this.privCommandResponse.value;\r\n    }\r\n    public get token(): string {\r\n        return this.privCommandResponse.token;\r\n    }\r\n\r\n    public static fromJSON(json: string): CommandResponsePayload {\r\n        return new CommandResponsePayload(json);\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n/**\r\n * Defines the payload for incoming list of participants\r\n */\r\nexport interface IParticipantsListPayloadResponse {\r\n    roomid: string;\r\n    id: string;\r\n    command: string;\r\n    participants: IParticipantPayloadResponse[];\r\n    token: string;\r\n    translateTo: string[];\r\n    profanityFilter: string;\r\n    roomProfanityFilter: string;\r\n    roomLocked: boolean;\r\n    muteAll: boolean;\r\n    type: string;\r\n}\r\n\r\n/**\r\n * Defines the payload for incoming participant\r\n */\r\nexport interface IParticipantPayloadResponse {\r\n    nickname: string;\r\n    locale: string;\r\n    usetts: boolean;\r\n    ismuted: boolean;\r\n    ishost: boolean;\r\n    participantId: string;\r\n    avatar?: string;\r\n}\r\n\r\nconst parseListResponse = (json: string): IParticipantsListPayloadResponse => JSON.parse(json) as IParticipantsListPayloadResponse;\r\nconst parseParticipantResponse = (json: string): IParticipantPayloadResponse => JSON.parse(json) as IParticipantPayloadResponse;\r\n\r\nexport class ParticipantsListPayloadResponse implements IParticipantsListPayloadResponse {\r\n    private privParticipantsPayloadResponse: IParticipantsListPayloadResponse;\r\n\r\n    private constructor(json: string) {\r\n        this.privParticipantsPayloadResponse = parseListResponse(json);\r\n    }\r\n\r\n    public get roomid(): string {\r\n        return this.privParticipantsPayloadResponse.roomid;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privParticipantsPayloadResponse.id;\r\n    }\r\n\r\n    public get command(): string {\r\n        return this.privParticipantsPayloadResponse.command;\r\n    }\r\n\r\n    public get participants(): IParticipantPayloadResponse[] {\r\n        return this.privParticipantsPayloadResponse.participants;\r\n    }\r\n\r\n    public get token(): string {\r\n        return this.privParticipantsPayloadResponse.token;\r\n    }\r\n\r\n    public get translateTo(): string[] {\r\n        return this.privParticipantsPayloadResponse.translateTo;\r\n    }\r\n\r\n    public get profanityFilter(): string {\r\n        return this.privParticipantsPayloadResponse.profanityFilter;\r\n    }\r\n\r\n    public get roomProfanityFilter(): string {\r\n        return this.privParticipantsPayloadResponse.roomProfanityFilter;\r\n    }\r\n\r\n    public get roomLocked(): boolean {\r\n        return this.privParticipantsPayloadResponse.roomLocked;\r\n    }\r\n\r\n    public get muteAll(): boolean {\r\n        return this.privParticipantsPayloadResponse.muteAll;\r\n    }\r\n\r\n    public get type(): string {\r\n        return this.privParticipantsPayloadResponse.type;\r\n    }\r\n\r\n    public static fromJSON(json: string): ParticipantsListPayloadResponse {\r\n        return new ParticipantsListPayloadResponse(json);\r\n    }\r\n\r\n}\r\n\r\nexport class ParticipantPayloadResponse implements IParticipantPayloadResponse {\r\n\r\n    private privParticipantPayloadResponse: IParticipantPayloadResponse;\r\n\r\n    private constructor(json: string) {\r\n        this.privParticipantPayloadResponse = parseParticipantResponse(json);\r\n    }\r\n\r\n    public get nickname(): string {\r\n        return this.privParticipantPayloadResponse.nickname;\r\n    }\r\n\r\n    public get locale(): string {\r\n        return this.privParticipantPayloadResponse.locale;\r\n    }\r\n\r\n    public get usetts(): boolean {\r\n        return this.privParticipantPayloadResponse.usetts;\r\n    }\r\n\r\n    public get ismuted(): boolean {\r\n        return this.privParticipantPayloadResponse.ismuted;\r\n    }\r\n\r\n    public get ishost(): boolean {\r\n        return this.privParticipantPayloadResponse.ishost;\r\n    }\r\n\r\n    public get participantId(): string {\r\n        return this.privParticipantPayloadResponse.participantId;\r\n    }\r\n\r\n    public get avatar(): string {\r\n        return this.privParticipantPayloadResponse.avatar;\r\n    }\r\n\r\n    public static fromJSON(json: string): ParticipantPayloadResponse {\r\n        return new ParticipantPayloadResponse(json);\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n/**\r\n * Defines the payload for incoming translation messages\r\n */\r\nexport interface ITranslationResponsePayload {\r\n    lang: string;\r\n    translation: string;\r\n}\r\n\r\nexport interface ITranslationCommandMessage {\r\n    translations: ITranslationResponsePayload[];\r\n    id: string;\r\n    language: string;\r\n    nickname: string;\r\n    participantId: string;\r\n    roomid: string;\r\n    timestamp: string;\r\n    type: string;\r\n}\r\n\r\nexport interface ISpeechResponsePayload extends ITranslationCommandMessage {\r\n    recognition: string;\r\n    isFinal: boolean;\r\n}\r\n\r\nexport interface ITextResponsePayload extends ITranslationCommandMessage {\r\n    originalText: string;\r\n}\r\n\r\nconst parseSpeechResponse = (json: string): ISpeechResponsePayload => JSON.parse(json) as ISpeechResponsePayload;\r\nconst parseTextResponse = (json: string): ITextResponsePayload => JSON.parse(json) as ITextResponsePayload;\r\n\r\nexport class SpeechResponsePayload implements ISpeechResponsePayload {\r\n\r\n    private privSpeechResponse: ISpeechResponsePayload;\r\n\r\n    private constructor(json: string) {\r\n        this.privSpeechResponse = parseSpeechResponse(json);\r\n    }\r\n\r\n    public get recognition(): string {\r\n        return this.privSpeechResponse.recognition;\r\n    }\r\n\r\n    public get translations(): ITranslationResponsePayload[] {\r\n        return this.privSpeechResponse.translations;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privSpeechResponse.id;\r\n    }\r\n\r\n    public get language(): string {\r\n        return this.privSpeechResponse.language;\r\n    }\r\n\r\n    public get nickname(): string {\r\n        return this.privSpeechResponse.nickname;\r\n    }\r\n\r\n    public get participantId(): string {\r\n        return this.privSpeechResponse.participantId;\r\n    }\r\n\r\n    public get roomid(): string {\r\n        return this.privSpeechResponse.roomid;\r\n    }\r\n\r\n    public get timestamp(): string {\r\n        return this.privSpeechResponse.timestamp;\r\n    }\r\n\r\n    public get type(): string {\r\n        return this.privSpeechResponse.type;\r\n    }\r\n\r\n    public get isFinal(): boolean {\r\n        return this.privSpeechResponse.type === \"final\";\r\n    }\r\n\r\n    public static fromJSON(json: string): SpeechResponsePayload {\r\n        return new SpeechResponsePayload(json);\r\n    }\r\n\r\n}\r\n\r\nexport class TextResponsePayload implements ITextResponsePayload {\r\n\r\n    private privTextResponse: ITextResponsePayload;\r\n\r\n    private constructor(json: string) {\r\n        this.privTextResponse = parseTextResponse(json);\r\n    }\r\n\r\n    public get originalText(): string {\r\n        return this.privTextResponse.originalText;\r\n    }\r\n\r\n    public get translations(): ITranslationResponsePayload[] {\r\n        return this.privTextResponse.translations;\r\n    }\r\n\r\n    public get id(): string {\r\n        return this.privTextResponse.id;\r\n    }\r\n\r\n    public get language(): string {\r\n        return this.privTextResponse.language;\r\n    }\r\n\r\n    public get nickname(): string {\r\n        return this.privTextResponse.nickname;\r\n    }\r\n\r\n    public get participantId(): string {\r\n        return this.privTextResponse.participantId;\r\n    }\r\n\r\n    public get roomid(): string {\r\n        return this.privTextResponse.roomid;\r\n    }\r\n\r\n    public get timestamp(): string {\r\n        return this.privTextResponse.timestamp;\r\n    }\r\n\r\n    public get type(): string {\r\n        return this.privTextResponse.type;\r\n    }\r\n\r\n    public static fromJSON(json: string): TextResponsePayload {\r\n        return new TextResponsePayload(json);\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\nimport { marshalPromiseToCallbacks } from \"../../common/Exports.js\";\r\nimport { AudioConfigImpl } from \"../../sdk/Audio/AudioConfig.js\";\r\nimport { AudioStreamFormatImpl } from \"../../sdk/Audio/AudioStreamFormat.js\";\r\nimport { Contracts } from \"../../sdk/Contracts.js\";\r\nimport {\r\n    AudioConfig,\r\n    CancellationEventArgs,\r\n    Conversation,\r\n    ConversationInfo,\r\n    Meeting,\r\n    MeetingInfo,\r\n    MeetingTranscriber,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    Recognizer,\r\n    SessionEventArgs,\r\n    SpeechRecognitionEventArgs,\r\n    SpeechTranslationConfig,\r\n    SpeechTranslationConfigImpl,\r\n} from \"../../sdk/Exports.js\";\r\nimport {\r\n    IAuthentication,\r\n    IConnectionFactory,\r\n    RecognitionMode,\r\n    RecognizerConfig,\r\n    ServiceRecognizerBase,\r\n    SpeechServiceConfig,\r\n    TranscriberConnectionFactory,\r\n    TranscriptionServiceRecognizer,\r\n} from \"../Exports.js\";\r\n\r\nexport class TranscriberRecognizer extends Recognizer {\r\n\r\n    public recognizing: (sender: Recognizer, event: SpeechRecognitionEventArgs) => void;\r\n\r\n    public recognized: (sender: Recognizer, event: SpeechRecognitionEventArgs) => void;\r\n\r\n    public canceled: (sender: Recognizer, event: CancellationEventArgs) => void;\r\n\r\n    private privDisposedRecognizer: boolean;\r\n    private privConversation: Conversation;\r\n    private privMeeting: Meeting;\r\n    private isMeetingRecognizer: boolean;\r\n\r\n    /**\r\n     * TranscriberRecognizer constructor.\r\n     * @constructor\r\n     * @param {SpeechTranslationConfig} speechTranslationConfig - Non-audio configuration associated with the recognizer\r\n     * @param {AudioConfig} audioConfig - An audio configuration associated with the recognizer\r\n     */\r\n    public constructor(speechTranslationConfig: SpeechTranslationConfig, audioConfig: AudioConfig) {\r\n        const speechTranslationConfigImpl: SpeechTranslationConfigImpl = speechTranslationConfig as SpeechTranslationConfigImpl;\r\n        Contracts.throwIfNull(speechTranslationConfigImpl, \"speechTranslationConfig\");\r\n\r\n        const audioConfigImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        Contracts.throwIfNull(audioConfigImpl, \"audioConfigImpl\");\r\n\r\n        Contracts.throwIfNullOrWhitespace(\r\n            speechTranslationConfigImpl.speechRecognitionLanguage,\r\n            PropertyId[PropertyId.SpeechServiceConnection_RecoLanguage]);\r\n\r\n        super(audioConfig, speechTranslationConfigImpl.properties, new TranscriberConnectionFactory());\r\n        this.privDisposedRecognizer = false;\r\n        this.isMeetingRecognizer = false;\r\n    }\r\n\r\n    public get speechRecognitionLanguage(): string {\r\n        Contracts.throwIfDisposed(this.privDisposedRecognizer);\r\n\r\n        return this.properties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\r\n    }\r\n\r\n    public get properties(): PropertyCollection {\r\n        return this.privProperties;\r\n    }\r\n\r\n    public get authorizationToken(): string {\r\n        return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\r\n    }\r\n\r\n    public set authorizationToken(token: string) {\r\n        Contracts.throwIfNullOrWhitespace(token, \"token\");\r\n        this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\r\n    }\r\n\r\n    public set conversation(c: Conversation) {\r\n        Contracts.throwIfNullOrUndefined(c, \"Conversation\");\r\n        this.isMeetingRecognizer = false;\r\n        this.privConversation = c;\r\n    }\r\n\r\n    public getConversationInfo(): ConversationInfo {\r\n        Contracts.throwIfNullOrUndefined(this.privConversation, \"Conversation\");\r\n        return this.privConversation.conversationInfo;\r\n    }\r\n\r\n    public set meeting(m: Meeting) {\r\n        Contracts.throwIfNullOrUndefined(m, \"Meeting\");\r\n        this.isMeetingRecognizer = true;\r\n        this.privMeeting = m;\r\n    }\r\n\r\n    public getMeetingInfo(): MeetingInfo {\r\n        Contracts.throwIfNullOrUndefined(this.privMeeting, \"Meeting\");\r\n        return this.privMeeting.meetingInfo;\r\n    }\r\n\r\n    public IsMeetingRecognizer(): boolean {\r\n        return this.isMeetingRecognizer;\r\n    }\r\n\r\n    public startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.startContinuousRecognitionAsyncImpl(RecognitionMode.Conversation), cb, err);\r\n    }\r\n\r\n    public stopContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void): void {\r\n        marshalPromiseToCallbacks(this.stopContinuousRecognitionAsyncImpl(), cb, err);\r\n    }\r\n\r\n    public async close(): Promise<void> {\r\n        if (!this.privDisposedRecognizer) {\r\n            await this.dispose(true);\r\n        }\r\n    }\r\n\r\n    // Push async join/leave conversation message via serviceRecognizer\r\n    public async pushConversationEvent(conversationInfo: ConversationInfo, command: string): Promise<void> {\r\n        const reco = (this.privReco) as TranscriptionServiceRecognizer;\r\n        Contracts.throwIfNullOrUndefined(reco, \"serviceRecognizer\");\r\n        await reco.sendSpeechEventAsync(conversationInfo, command);\r\n    }\r\n\r\n    // Push async join/leave meeting message via serviceRecognizer\r\n    public async pushMeetingEvent(meetingInfo: MeetingInfo, command: string): Promise<void> {\r\n        const reco = (this.privReco) as TranscriptionServiceRecognizer;\r\n        Contracts.throwIfNullOrUndefined(reco, \"serviceRecognizer\");\r\n        await reco.sendMeetingSpeechEventAsync(meetingInfo, command);\r\n    }\r\n\r\n    public async enforceAudioGating(): Promise<void> {\r\n        const audioConfigImpl = this.audioConfig as AudioConfigImpl;\r\n        const format: AudioStreamFormatImpl = await audioConfigImpl.format;\r\n        const channels = format.channels;\r\n        if (channels === 1) {\r\n            if (this.properties.getProperty(\"f0f5debc-f8c9-4892-ac4b-90a7ab359fd2\", \"false\").toLowerCase() !== \"true\") {\r\n                throw new Error(\"Single channel audio configuration for MeetingTranscriber is currently under private preview, please contact diarizationrequest@microsoft.com for more details\");\r\n            }\r\n        } else if (channels !== 8) {\r\n            throw new Error(`Unsupported audio configuration: Detected ${channels}-channel audio`);\r\n        }\r\n        return;\r\n    }\r\n\r\n    public connectMeetingCallbacks(transcriber: MeetingTranscriber): void {\r\n        this.isMeetingRecognizer = true;\r\n        this.canceled = (s: any, e: CancellationEventArgs): void => {\r\n            if (!!transcriber.canceled) {\r\n                transcriber.canceled(transcriber, e);\r\n            }\r\n        };\r\n        this.recognizing = (s: any, e: SpeechRecognitionEventArgs): void => {\r\n            if (!!transcriber.transcribing) {\r\n                transcriber.transcribing(transcriber, e);\r\n            }\r\n        };\r\n        this.recognized = (s: any, e: SpeechRecognitionEventArgs): void => {\r\n            if (!!transcriber.transcribed) {\r\n                transcriber.transcribed(transcriber, e);\r\n            }\r\n        };\r\n        this.sessionStarted = (s: any, e: SessionEventArgs): void => {\r\n            if (!!transcriber.sessionStarted) {\r\n                transcriber.sessionStarted(transcriber, e);\r\n            }\r\n        };\r\n        this.sessionStopped = (s: any, e: SessionEventArgs): void => {\r\n            if (!!transcriber.sessionStopped) {\r\n                transcriber.sessionStopped(transcriber, e);\r\n            }\r\n        };\r\n    }\r\n\r\n    public disconnectCallbacks(): void {\r\n        this.canceled = undefined;\r\n        this.recognizing = undefined;\r\n        this.recognized = undefined;\r\n        this.sessionStarted = undefined;\r\n        this.sessionStopped = undefined;\r\n    }\r\n\r\n    /**\r\n     * Disposes any resources held by the object.\r\n     * @member ConversationTranscriber.prototype.dispose\r\n     * @function\r\n     * @public\r\n     * @param {boolean} disposing - true if disposing the object.\r\n     */\r\n    protected async dispose(disposing: boolean): Promise<void> {\r\n        if (this.privDisposedRecognizer) {\r\n            return;\r\n        }\r\n\r\n        if (disposing) {\r\n            this.privDisposedRecognizer = true;\r\n            await this.implRecognizerStop();\r\n        }\r\n\r\n        await super.dispose(disposing);\r\n    }\r\n\r\n    protected createRecognizerConfig(speechConfig: SpeechServiceConfig): RecognizerConfig {\r\n        return new RecognizerConfig(\r\n            speechConfig,\r\n            this.properties);\r\n    }\r\n\r\n    protected createServiceRecognizer(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioConfig: AudioConfig,\r\n        recognizerConfig: RecognizerConfig): ServiceRecognizerBase {\r\n        const configImpl: AudioConfigImpl = audioConfig as AudioConfigImpl;\r\n        return new TranscriptionServiceRecognizer(authentication, connectionFactory, configImpl, recognizerConfig, this);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { SpeechSynthesisBoundaryType } from \"../../sdk/Exports.js\";\r\n\r\nexport enum MetadataType {\r\n    WordBoundary = \"WordBoundary\",\r\n    Bookmark = \"Bookmark\",\r\n    Viseme = \"Viseme\",\r\n    SentenceBoundary = \"SentenceBoundary\",\r\n    SessionEnd = \"SessionEnd\",\r\n    AvatarSignal = \"TalkingAvatarSignal\",\r\n}\r\n\r\nexport interface ISynthesisMetadata {\r\n    Type: MetadataType;\r\n    Data: {\r\n        Offset: number;\r\n        Duration: number;\r\n        text: {\r\n            Text: string;\r\n            Length: number;\r\n            BoundaryType: SpeechSynthesisBoundaryType;\r\n        };\r\n        Bookmark: string;\r\n        VisemeId: number;\r\n        AnimationChunk: string;\r\n        IsLastAnimation: boolean;\r\n        Name: string;\r\n    };\r\n}\r\n\r\n// audio.metadata\r\nexport interface ISynthesisAudioMetadata {\r\n    Metadata: ISynthesisMetadata[];\r\n}\r\n\r\nexport class SynthesisAudioMetadata implements ISynthesisAudioMetadata {\r\n    private privSynthesisAudioMetadata: ISynthesisAudioMetadata;\r\n\r\n    private constructor(json: string) {\r\n        this.privSynthesisAudioMetadata = JSON.parse(json) as ISynthesisAudioMetadata;\r\n    }\r\n\r\n    public static fromJSON(json: string): SynthesisAudioMetadata {\r\n        return new SynthesisAudioMetadata(json);\r\n    }\r\n\r\n    public get Metadata(): ISynthesisMetadata[] {\r\n        return this.privSynthesisAudioMetadata.Metadata;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    createNoDashGuid,\r\n    Deferred,\r\n    Events,\r\n    IAudioDestination\r\n} from \"../common/Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"../sdk/Audio/AudioOutputFormat.js\";\r\nimport { PullAudioOutputStreamImpl } from \"../sdk/Audio/AudioOutputStream.js\";\r\nimport {\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SpeechSynthesisResult,\r\n} from \"../sdk/Exports.js\";\r\nimport { ISynthesisMetadata, MetadataType } from \"./ServiceMessages/SynthesisAudioMetadata.js\";\r\nimport {\r\n    ConnectingToSynthesisServiceEvent,\r\n    SpeechSynthesisEvent,\r\n    SynthesisStartedEvent,\r\n    SynthesisTriggeredEvent,\r\n} from \"./SynthesisEvents.js\";\r\n\r\nexport interface ISynthesisResponseContext {\r\n    serviceTag: string;\r\n}\r\n\r\nexport interface ISynthesisResponseAudio {\r\n    type: string;\r\n    streamId: string;\r\n}\r\n\r\nexport interface ISynthesisResponse {\r\n    context: ISynthesisResponseContext;\r\n    audio: ISynthesisResponseAudio;\r\n    webrtc: {\r\n        connectionString: string;\r\n    };\r\n}\r\n\r\nexport class SynthesisTurn {\r\n\r\n    public get requestId(): string {\r\n        return this.privRequestId;\r\n    }\r\n\r\n    public get streamId(): string {\r\n        return this.privStreamId;\r\n    }\r\n\r\n    public set streamId(value: string) {\r\n        this.privStreamId = value;\r\n    }\r\n\r\n    public get audioOutputFormat(): AudioOutputFormatImpl {\r\n        return this.privAudioOutputFormat;\r\n    }\r\n\r\n    public set audioOutputFormat(format: AudioOutputFormatImpl) {\r\n        this.privAudioOutputFormat = format;\r\n    }\r\n\r\n    public get turnCompletionPromise(): Promise<void> {\r\n        return this.privTurnDeferral.promise;\r\n    }\r\n\r\n    public get isSynthesisEnded(): boolean {\r\n        return this.privIsSynthesisEnded;\r\n    }\r\n\r\n    public get isSynthesizing(): boolean {\r\n        return this.privIsSynthesizing;\r\n    }\r\n\r\n    public get currentTextOffset(): number {\r\n        return this.privTextOffset;\r\n    }\r\n\r\n    public get currentSentenceOffset(): number {\r\n        return this.privSentenceOffset;\r\n    }\r\n\r\n    // The number of bytes received for current turn\r\n    public get bytesReceived(): number {\r\n        return this.privBytesReceived;\r\n    }\r\n\r\n    public get audioDuration(): number {\r\n        return this.privAudioDuration;\r\n    }\r\n\r\n    public get extraProperties(): PropertyCollection {\r\n        if (!!this.privWebRTCSDP) {\r\n            const properties = new PropertyCollection();\r\n            properties.setProperty(PropertyId.TalkingAvatarService_WebRTC_SDP, this.privWebRTCSDP);\r\n            return properties;\r\n        }\r\n\r\n        return undefined;\r\n    }\r\n\r\n    private privIsDisposed: boolean = false;\r\n    private privAuthFetchEventId: string;\r\n    private privIsSynthesizing: boolean = false;\r\n    private privIsSynthesisEnded: boolean = false;\r\n    private privBytesReceived: number = 0;\r\n    private privRequestId: string;\r\n    private privStreamId: string;\r\n    private privTurnDeferral: Deferred<void>;\r\n    private privInTurn: boolean = false;\r\n    private privAudioOutputFormat: AudioOutputFormatImpl;\r\n    private privAudioOutputStream: PullAudioOutputStreamImpl;\r\n    private privReceivedAudio: ArrayBuffer;\r\n    private privReceivedAudioWithHeader: ArrayBuffer;\r\n    private privTextOffset: number = 0;\r\n    private privNextSearchTextIndex: number = 0;\r\n    private privSentenceOffset: number = 0;\r\n    private privNextSearchSentenceIndex: number = 0;\r\n    private privPartialVisemeAnimation: string;\r\n    private privRawText: string;\r\n    private privIsSSML: boolean;\r\n    private privTurnAudioDestination: IAudioDestination;\r\n    private privAudioDuration: number;\r\n    private privWebRTCSDP: string;\r\n\r\n    public constructor() {\r\n        this.privRequestId = createNoDashGuid();\r\n        this.privTurnDeferral = new Deferred<void>();\r\n\r\n        // We're not in a turn, so resolve.\r\n        this.privTurnDeferral.resolve();\r\n    }\r\n\r\n    public async getAllReceivedAudio(): Promise<ArrayBuffer> {\r\n        if (!!this.privReceivedAudio) {\r\n            return Promise.resolve(this.privReceivedAudio);\r\n        }\r\n        if (!this.privIsSynthesisEnded) {\r\n            return null;\r\n        }\r\n        await this.readAllAudioFromStream();\r\n        return Promise.resolve(this.privReceivedAudio);\r\n    }\r\n\r\n    public async getAllReceivedAudioWithHeader(): Promise<ArrayBuffer> {\r\n        if (!!this.privReceivedAudioWithHeader) {\r\n            return this.privReceivedAudioWithHeader;\r\n        }\r\n        if (!this.privIsSynthesisEnded) {\r\n            return null;\r\n        }\r\n        if (this.audioOutputFormat.hasHeader) {\r\n            const audio: ArrayBuffer = await this.getAllReceivedAudio();\r\n            this.privReceivedAudioWithHeader = this.audioOutputFormat.addHeader(audio);\r\n            return this.privReceivedAudioWithHeader;\r\n        } else {\r\n            return this.getAllReceivedAudio();\r\n        }\r\n    }\r\n\r\n    public startNewSynthesis(requestId: string, rawText: string, isSSML: boolean, audioDestination?: IAudioDestination): void {\r\n        this.privIsSynthesisEnded = false;\r\n        this.privIsSynthesizing = true;\r\n        this.privRequestId = requestId;\r\n        this.privRawText = rawText;\r\n        this.privIsSSML = isSSML;\r\n        this.privAudioOutputStream = new PullAudioOutputStreamImpl();\r\n        this.privAudioOutputStream.format = this.privAudioOutputFormat;\r\n        this.privReceivedAudio = null;\r\n        this.privReceivedAudioWithHeader = null;\r\n        this.privBytesReceived = 0;\r\n        this.privTextOffset = 0;\r\n        this.privNextSearchTextIndex = 0;\r\n        this.privSentenceOffset = 0;\r\n        this.privNextSearchSentenceIndex = 0;\r\n        this.privPartialVisemeAnimation = \"\";\r\n        this.privWebRTCSDP = \"\";\r\n        if (audioDestination !== undefined) {\r\n            this.privTurnAudioDestination = audioDestination;\r\n            this.privTurnAudioDestination.format = this.privAudioOutputFormat;\r\n        }\r\n        this.onEvent(new SynthesisTriggeredEvent(this.requestId, undefined, audioDestination === undefined ? undefined : audioDestination.id()));\r\n    }\r\n\r\n    public onPreConnectionStart(authFetchEventId: string): void {\r\n        this.privAuthFetchEventId = authFetchEventId;\r\n        this.onEvent(new ConnectingToSynthesisServiceEvent(this.privRequestId, this.privAuthFetchEventId));\r\n    }\r\n\r\n    public onAuthCompleted(isError: boolean): void {\r\n        if (isError) {\r\n            this.onComplete();\r\n        }\r\n    }\r\n\r\n    public onConnectionEstablishCompleted(statusCode: number): void {\r\n        if (statusCode === 200) {\r\n            this.onEvent(new SynthesisStartedEvent(this.requestId, this.privAuthFetchEventId));\r\n            this.privBytesReceived = 0;\r\n            return;\r\n        } else if (statusCode === 403) {\r\n            this.onComplete();\r\n        }\r\n    }\r\n\r\n    public onServiceResponseMessage(responseJson: string): void {\r\n        const response: ISynthesisResponse = JSON.parse(responseJson) as ISynthesisResponse;\r\n        this.streamId = response.audio.streamId;\r\n    }\r\n\r\n    public onServiceTurnEndResponse(): void {\r\n        this.privInTurn = false;\r\n        this.privTurnDeferral.resolve();\r\n        this.onComplete();\r\n    }\r\n\r\n    public onServiceTurnStartResponse(responseJson: string): void {\r\n        if (!!this.privTurnDeferral && !!this.privInTurn) {\r\n            // What? How are we starting a turn with another not done?\r\n            this.privTurnDeferral.reject(\"Another turn started before current completed.\");\r\n            // Avoid UnhandledPromiseRejection if privTurnDeferral is not being awaited\r\n            // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n            this.privTurnDeferral.promise.then().catch((): void => { });\r\n        }\r\n        this.privInTurn = true;\r\n        this.privTurnDeferral = new Deferred<void>();\r\n        const response: ISynthesisResponse = JSON.parse(responseJson) as ISynthesisResponse;\r\n        if (!!response.webrtc) {\r\n            this.privWebRTCSDP = response.webrtc.connectionString;\r\n        }\r\n    }\r\n\r\n    public onAudioChunkReceived(data: ArrayBuffer): void {\r\n        if (this.isSynthesizing) {\r\n            this.privAudioOutputStream.write(data);\r\n            this.privBytesReceived += data.byteLength;\r\n            if (this.privTurnAudioDestination !== undefined) {\r\n                this.privTurnAudioDestination.write(data);\r\n            }\r\n        }\r\n    }\r\n\r\n    public onTextBoundaryEvent(metadata: ISynthesisMetadata): void {\r\n        this.updateTextOffset(metadata.Data.text.Text, metadata.Type);\r\n    }\r\n\r\n    public onVisemeMetadataReceived(metadata: ISynthesisMetadata): void {\r\n        if (metadata.Data.AnimationChunk !== undefined) {\r\n            this.privPartialVisemeAnimation += metadata.Data.AnimationChunk;\r\n        }\r\n    }\r\n\r\n    public onSessionEnd(metadata: ISynthesisMetadata): void {\r\n        this.privAudioDuration = metadata.Data.Offset;\r\n    }\r\n\r\n    public async constructSynthesisResult(): Promise<SpeechSynthesisResult> {\r\n        const audioBuffer: ArrayBuffer = await this.getAllReceivedAudioWithHeader();\r\n        return new SpeechSynthesisResult(\r\n            this.requestId,\r\n            ResultReason.SynthesizingAudioCompleted,\r\n            audioBuffer,\r\n            undefined,\r\n            this.extraProperties,\r\n            this.audioDuration\r\n        );\r\n    }\r\n\r\n    public dispose(): void {\r\n        if (!this.privIsDisposed) {\r\n            // we should have completed by now. If we did not its an unknown error.\r\n            this.privIsDisposed = true;\r\n        }\r\n    }\r\n\r\n    public onStopSynthesizing(): void {\r\n        this.onComplete();\r\n    }\r\n\r\n    /**\r\n     * Gets the viseme animation string (merged from animation chunk), and clears the internal\r\n     * partial animation.\r\n     */\r\n    public getAndClearVisemeAnimation(): string {\r\n        const animation: string = this.privPartialVisemeAnimation;\r\n        this.privPartialVisemeAnimation = \"\";\r\n        return animation;\r\n    }\r\n\r\n    protected onEvent(event: SpeechSynthesisEvent): void {\r\n        Events.instance.onEvent(event);\r\n    }\r\n\r\n    /**\r\n     * Check if the text is an XML(SSML) tag\r\n     * @param text\r\n     * @private\r\n     */\r\n    private static isXmlTag(text: string): boolean {\r\n        return text.length >= 2 && text[0] === \"<\" && text[text.length - 1] === \">\";\r\n    }\r\n\r\n    private updateTextOffset(text: string, type: MetadataType): void {\r\n        if (type === MetadataType.WordBoundary) {\r\n            this.privTextOffset = this.privRawText.indexOf(text, this.privNextSearchTextIndex);\r\n            if (this.privTextOffset >= 0) {\r\n                this.privNextSearchTextIndex = this.privTextOffset + text.length;\r\n                if (this.privIsSSML) {\r\n                    if (this.withinXmlTag(this.privTextOffset) && !SynthesisTurn.isXmlTag(text)) {\r\n                        this.updateTextOffset(text, type);\r\n                    }\r\n                }\r\n            }\r\n        } else {\r\n            this.privSentenceOffset = this.privRawText.indexOf(text, this.privNextSearchSentenceIndex);\r\n            if (this.privSentenceOffset >= 0) {\r\n                this.privNextSearchSentenceIndex = this.privSentenceOffset + text.length;\r\n                if (this.privIsSSML) {\r\n                    if (this.withinXmlTag(this.privSentenceOffset) && !SynthesisTurn.isXmlTag(text)) {\r\n                        this.updateTextOffset(text, type);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    private onComplete(): void {\r\n        if (this.privIsSynthesizing) {\r\n            this.privIsSynthesizing = false;\r\n            this.privIsSynthesisEnded = true;\r\n            this.privAudioOutputStream.close();\r\n            this.privInTurn = false;\r\n            if (this.privTurnAudioDestination !== undefined) {\r\n                this.privTurnAudioDestination.close();\r\n                this.privTurnAudioDestination = undefined;\r\n            }\r\n        }\r\n    }\r\n\r\n    private async readAllAudioFromStream(): Promise<void> {\r\n        if (this.privIsSynthesisEnded) {\r\n            this.privReceivedAudio = new ArrayBuffer(this.bytesReceived);\r\n            try {\r\n                await this.privAudioOutputStream.read(this.privReceivedAudio);\r\n            } catch (e) {\r\n                this.privReceivedAudio = new ArrayBuffer(0);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Check if current idx is in XML(SSML) tag\r\n     * @param idx\r\n     * @private\r\n     */\r\n    private withinXmlTag(idx: number): boolean {\r\n        return this.privRawText.indexOf(\"<\", idx + 1) > this.privRawText.indexOf(\">\", idx + 1);\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\nimport { EventType, PlatformEvent } from \"../common/Exports.js\";\r\n\r\nexport class SpeechSynthesisEvent extends PlatformEvent {\r\n    private privRequestId: string;\r\n\r\n    public constructor(eventName: string, requestId: string, eventType: EventType = EventType.Info) {\r\n        super(eventName, eventType);\r\n\r\n        this.privRequestId = requestId;\r\n    }\r\n\r\n    public get requestId(): string {\r\n        return this.privRequestId;\r\n    }\r\n}\r\n\r\nexport class SynthesisTriggeredEvent extends SpeechSynthesisEvent {\r\n    private privSessionAudioDestinationId: string;\r\n    private privTurnAudioDestinationId: string;\r\n\r\n    public constructor(requestId: string, sessionAudioDestinationId: string, turnAudioDestinationId: string) {\r\n        super(\"SynthesisTriggeredEvent\", requestId);\r\n\r\n        this.privSessionAudioDestinationId = sessionAudioDestinationId;\r\n        this.privTurnAudioDestinationId = turnAudioDestinationId;\r\n    }\r\n\r\n    public get audioSessionDestinationId(): string {\r\n        return this.privSessionAudioDestinationId;\r\n    }\r\n\r\n    public get audioTurnDestinationId(): string {\r\n        return this.privTurnAudioDestinationId;\r\n    }\r\n}\r\n\r\nexport class ConnectingToSynthesisServiceEvent extends SpeechSynthesisEvent {\r\n    private privAuthFetchEventId: string;\r\n\r\n    public constructor(requestId: string, authFetchEventId: string) {\r\n        super(\"ConnectingToSynthesisServiceEvent\", requestId);\r\n        this.privAuthFetchEventId = authFetchEventId;\r\n    }\r\n\r\n    public get authFetchEventId(): string {\r\n        return this.privAuthFetchEventId;\r\n    }\r\n}\r\n\r\nexport class SynthesisStartedEvent extends SpeechSynthesisEvent {\r\n    private privAuthFetchEventId: string;\r\n\r\n    public constructor(requestId: string, authFetchEventId: string) {\r\n        super(\"SynthesisStartedEvent\", requestId);\r\n\r\n        this.privAuthFetchEventId = authFetchEventId;\r\n    }\r\n\r\n    public get authFetchEventId(): string {\r\n        return this.privAuthFetchEventId;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    ArgumentNullError,\r\n    ConnectionClosedEvent,\r\n    ConnectionEvent,\r\n    ConnectionMessage,\r\n    ConnectionState,\r\n    createNoDashGuid,\r\n    EventSource,\r\n    IAudioDestination,\r\n    IConnection,\r\n    IDisposable,\r\n    MessageType,\r\n    ServiceEvent,\r\n} from \"../common/Exports.js\";\r\nimport { AudioOutputFormatImpl } from \"../sdk/Audio/AudioOutputFormat.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SpeechSynthesisBookmarkEventArgs,\r\n    SpeechSynthesisResult,\r\n    SpeechSynthesisVisemeEventArgs,\r\n    SpeechSynthesisWordBoundaryEventArgs,\r\n    Synthesizer,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    AgentConfig,\r\n    CancellationErrorCodePropertyName,\r\n    ISynthesisConnectionFactory,\r\n    ISynthesisMetadata,\r\n    MetadataType,\r\n    SynthesisAudioMetadata,\r\n    SynthesisContext,\r\n    SynthesisTurn,\r\n    SynthesizerConfig\r\n} from \"./Exports.js\";\r\nimport { AuthInfo, IAuthentication } from \"./IAuthentication.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\nexport abstract class SynthesisAdapterBase implements IDisposable {\r\n    protected privSynthesisTurn: SynthesisTurn;\r\n    protected privConnectionId: string;\r\n    protected privSynthesizerConfig: SynthesizerConfig;\r\n    protected privSynthesizer: Synthesizer;\r\n    protected privSuccessCallback: (e: SpeechSynthesisResult) => void;\r\n    protected privErrorCallback: (e: string) => void;\r\n\r\n    public get synthesisContext(): SynthesisContext {\r\n        return this.privSynthesisContext;\r\n    }\r\n\r\n    public get agentConfig(): AgentConfig {\r\n        return this.privAgentConfig;\r\n    }\r\n\r\n    public get connectionEvents(): EventSource<ConnectionEvent> {\r\n        return this.privConnectionEvents;\r\n    }\r\n\r\n    public get serviceEvents(): EventSource<ServiceEvent> {\r\n        return this.privServiceEvents;\r\n    }\r\n\r\n    protected speakOverride: (ssml: string, requestId: string, sc: (e: SpeechSynthesisResult) => void, ec: (e: string) => void) => void = undefined;\r\n\r\n    // Called when telemetry data is sent to the service.\r\n    // Used for testing Telemetry capture.\r\n    public static telemetryData: (json: string) => void;\r\n    public static telemetryDataEnabled: boolean = true;\r\n\r\n    public set activityTemplate(messagePayload: string) {\r\n        this.privActivityTemplate = messagePayload;\r\n    }\r\n    public get activityTemplate(): string {\r\n        return this.privActivityTemplate;\r\n    }\r\n\r\n    protected receiveMessageOverride: () => void = undefined;\r\n\r\n    protected connectImplOverride: (isUnAuthorized: boolean) => void = undefined;\r\n\r\n    protected configConnectionOverride: (connection: IConnection) => Promise<IConnection> = undefined;\r\n\r\n    public set audioOutputFormat(format: AudioOutputFormatImpl) {\r\n        this.privAudioOutputFormat = format;\r\n        this.privSynthesisTurn.audioOutputFormat = format;\r\n        if (this.privSessionAudioDestination !== undefined) {\r\n            this.privSessionAudioDestination.format = format;\r\n        }\r\n        if (this.synthesisContext !== undefined) {\r\n            this.synthesisContext.audioOutputFormat = format;\r\n        }\r\n    }\r\n    private privAuthentication: IAuthentication;\r\n    private privConnectionFactory: ISynthesisConnectionFactory;\r\n\r\n    // A promise for a configured connection.\r\n    // Do not consume directly, call fetchConnection instead.\r\n    private privConnectionConfigurationPromise: Promise<IConnection> = undefined;\r\n\r\n    // A promise for a connection, but one that has not had the speech context sent yet.\r\n    // Do not consume directly, call fetchConnection instead.\r\n    private privConnectionPromise: Promise<IConnection>;\r\n    private privAuthFetchEventId: string;\r\n    private privIsDisposed: boolean;\r\n    private privConnectionEvents: EventSource<ConnectionEvent>;\r\n    private privServiceEvents: EventSource<ServiceEvent>;\r\n    protected privSynthesisContext: SynthesisContext;\r\n    private privAgentConfig: AgentConfig;\r\n    private privActivityTemplate: string;\r\n    protected privAudioOutputFormat: AudioOutputFormatImpl;\r\n    private privSessionAudioDestination: IAudioDestination;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: ISynthesisConnectionFactory,\r\n        synthesizerConfig: SynthesizerConfig,\r\n        audioDestination: IAudioDestination) {\r\n\r\n        if (!authentication) {\r\n            throw new ArgumentNullError(\"authentication\");\r\n        }\r\n\r\n        if (!connectionFactory) {\r\n            throw new ArgumentNullError(\"connectionFactory\");\r\n        }\r\n\r\n        if (!synthesizerConfig) {\r\n            throw new ArgumentNullError(\"synthesizerConfig\");\r\n        }\r\n\r\n        this.privAuthentication = authentication;\r\n        this.privConnectionFactory = connectionFactory;\r\n        this.privSynthesizerConfig = synthesizerConfig;\r\n        this.privIsDisposed = false;\r\n        this.privSessionAudioDestination = audioDestination;\r\n        this.privSynthesisTurn = new SynthesisTurn();\r\n        this.privConnectionEvents = new EventSource<ConnectionEvent>();\r\n        this.privServiceEvents = new EventSource<ServiceEvent>();\r\n        this.privSynthesisContext = new SynthesisContext();\r\n        this.privAgentConfig = new AgentConfig();\r\n\r\n        this.connectionEvents.attach((connectionEvent: ConnectionEvent): void => {\r\n            if (connectionEvent.name === \"ConnectionClosedEvent\") {\r\n                const connectionClosedEvent = connectionEvent as ConnectionClosedEvent;\r\n                if (connectionClosedEvent.statusCode !== 1000) {\r\n                    this.cancelSynthesisLocal(CancellationReason.Error,\r\n                        connectionClosedEvent.statusCode === 1007 ? CancellationErrorCode.BadRequestParameters : CancellationErrorCode.ConnectionFailure,\r\n                        `${connectionClosedEvent.reason} websocket error code: ${connectionClosedEvent.statusCode}`);\r\n                }\r\n            }\r\n        });\r\n    }\r\n\r\n    public isDisposed(): boolean {\r\n        return this.privIsDisposed;\r\n    }\r\n\r\n    public async dispose(reason?: string): Promise<void> {\r\n        this.privIsDisposed = true;\r\n        if (this.privSessionAudioDestination !== undefined) {\r\n            this.privSessionAudioDestination.close();\r\n        }\r\n        if (this.privConnectionConfigurationPromise !== undefined) {\r\n            const connection: IConnection = await this.privConnectionConfigurationPromise;\r\n            await connection.dispose(reason);\r\n        }\r\n    }\r\n\r\n    public async connect(): Promise<void> {\r\n        await this.connectImpl();\r\n    }\r\n\r\n    public async sendNetworkMessage(path: string, payload: string | ArrayBuffer): Promise<void> {\r\n        const type: MessageType = typeof payload === \"string\" ? MessageType.Text : MessageType.Binary;\r\n        const contentType: string = typeof payload === \"string\" ? \"application/json\" : \"\";\r\n\r\n        const connection: IConnection = await this.fetchConnection();\r\n        return connection.send(new SpeechConnectionMessage(type, path, this.privSynthesisTurn.requestId, contentType, payload));\r\n    }\r\n\r\n    public async Speak(\r\n        text: string,\r\n        isSSML: boolean,\r\n        requestId: string,\r\n        successCallback: (e: SpeechSynthesisResult) => void,\r\n        errorCallBack: (e: string) => void,\r\n        audioDestination: IAudioDestination,\r\n    ): Promise<void> {\r\n\r\n        let ssml: string;\r\n\r\n        if (isSSML) {\r\n            ssml = text;\r\n        } else {\r\n            ssml = this.privSynthesizer.buildSsml(text);\r\n        }\r\n\r\n        if (this.speakOverride !== undefined) {\r\n            return this.speakOverride(ssml, requestId, successCallback, errorCallBack);\r\n        }\r\n\r\n        this.privSuccessCallback = successCallback;\r\n        this.privErrorCallback = errorCallBack;\r\n\r\n        this.privSynthesisTurn.startNewSynthesis(requestId, text, isSSML, audioDestination);\r\n\r\n        try {\r\n            await this.connectImpl();\r\n            const connection: IConnection = await this.fetchConnection();\r\n            await this.sendSynthesisContext(connection);\r\n            await this.sendSsmlMessage(connection, ssml, requestId);\r\n            this.onSynthesisStarted(requestId);\r\n\r\n            void this.receiveMessage();\r\n        } catch (e) {\r\n            this.cancelSynthesisLocal(CancellationReason.Error, CancellationErrorCode.ConnectionFailure, e as string);\r\n            return Promise.reject(e);\r\n        }\r\n    }\r\n\r\n    public async stopSpeaking(): Promise<void> {\r\n        await this.connectImpl();\r\n        const connection: IConnection = await this.fetchConnection();\r\n\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"synthesis.control\",\r\n            this.privSynthesisTurn.requestId,\r\n            \"application/json\",\r\n            JSON.stringify({\r\n                action: \"stop\"\r\n            })\r\n        ));\r\n    }\r\n\r\n    // Cancels synthesis.\r\n    protected cancelSynthesis(\r\n        requestId: string,\r\n        _cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n        const result: SpeechSynthesisResult = new SpeechSynthesisResult(\r\n            requestId,\r\n            ResultReason.Canceled,\r\n            undefined,\r\n            error,\r\n            properties\r\n        );\r\n\r\n        this.onSynthesisCancelled(result);\r\n\r\n        if (!!this.privSuccessCallback) {\r\n            try {\r\n                this.privSuccessCallback(result);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n    }\r\n\r\n    // Cancels synthesis.\r\n    protected cancelSynthesisLocal(\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        if (!!this.privSynthesisTurn.isSynthesizing) {\r\n            this.privSynthesisTurn.onStopSynthesizing();\r\n\r\n            this.cancelSynthesis(\r\n                this.privSynthesisTurn.requestId,\r\n                cancellationReason,\r\n                errorCode,\r\n                error);\r\n        }\r\n    }\r\n\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    protected processTypeSpecificMessages(_connectionMessage: SpeechConnectionMessage): boolean {\r\n        return true;\r\n    }\r\n\r\n    protected async receiveMessage(): Promise<void> {\r\n        try {\r\n            const connection: IConnection = await this.fetchConnection();\r\n            const message: ConnectionMessage = await connection.read();\r\n\r\n            if (this.receiveMessageOverride !== undefined) {\r\n                return this.receiveMessageOverride();\r\n            }\r\n            if (this.privIsDisposed) {\r\n                // We're done.\r\n                return;\r\n            }\r\n\r\n            // indicates we are draining the queue and it came with no message;\r\n            if (!message) {\r\n                if (!this.privSynthesisTurn.isSynthesizing) {\r\n                    return;\r\n                } else {\r\n                    return this.receiveMessage();\r\n                }\r\n            }\r\n\r\n\r\n            const connectionMessage = SpeechConnectionMessage.fromConnectionMessage(message);\r\n\r\n            if (connectionMessage.requestId.toLowerCase() === this.privSynthesisTurn.requestId.toLowerCase()) {\r\n                switch (connectionMessage.path.toLowerCase()) {\r\n                    case \"turn.start\":\r\n                        this.privSynthesisTurn.onServiceTurnStartResponse(connectionMessage.textBody);\r\n                        break;\r\n                    case \"response\":\r\n                        this.privSynthesisTurn.onServiceResponseMessage(connectionMessage.textBody);\r\n                        break;\r\n                    case \"audio\":\r\n                        if (this.privSynthesisTurn.streamId.toLowerCase() === connectionMessage.streamId.toLowerCase()\r\n                            && !!connectionMessage.binaryBody) {\r\n                            this.privSynthesisTurn.onAudioChunkReceived(connectionMessage.binaryBody);\r\n                            this.onSynthesizing(connectionMessage.binaryBody);\r\n                            if (this.privSessionAudioDestination !== undefined) {\r\n                                this.privSessionAudioDestination.write(connectionMessage.binaryBody);\r\n                            }\r\n                        }\r\n                        break;\r\n                    case \"audio.metadata\":\r\n                        const metadataList = SynthesisAudioMetadata.fromJSON(connectionMessage.textBody).Metadata;\r\n                        for (const metadata of metadataList) {\r\n                            switch (metadata.Type) {\r\n                                case MetadataType.WordBoundary:\r\n                                case MetadataType.SentenceBoundary:\r\n                                    this.privSynthesisTurn.onTextBoundaryEvent(metadata);\r\n                                    const wordBoundaryEventArgs: SpeechSynthesisWordBoundaryEventArgs = new SpeechSynthesisWordBoundaryEventArgs(\r\n                                        metadata.Data.Offset,\r\n                                        metadata.Data.Duration,\r\n                                        metadata.Data.text.Text,\r\n                                        metadata.Data.text.Length,\r\n                                        metadata.Type === MetadataType.WordBoundary\r\n                                            ? this.privSynthesisTurn.currentTextOffset : this.privSynthesisTurn.currentSentenceOffset,\r\n                                        metadata.Data.text.BoundaryType);\r\n                                    this.onWordBoundary(wordBoundaryEventArgs);\r\n                                    break;\r\n                                case MetadataType.Bookmark:\r\n                                    const bookmarkEventArgs: SpeechSynthesisBookmarkEventArgs = new SpeechSynthesisBookmarkEventArgs(\r\n                                        metadata.Data.Offset,\r\n                                        metadata.Data.Bookmark);\r\n                                    this.onBookmarkReached(bookmarkEventArgs);\r\n                                    break;\r\n                                case MetadataType.Viseme:\r\n                                    this.privSynthesisTurn.onVisemeMetadataReceived(metadata);\r\n                                    if (metadata.Data.IsLastAnimation) {\r\n                                        const visemeEventArgs: SpeechSynthesisVisemeEventArgs = new SpeechSynthesisVisemeEventArgs(\r\n                                            metadata.Data.Offset,\r\n                                            metadata.Data.VisemeId,\r\n                                            this.privSynthesisTurn.getAndClearVisemeAnimation());\r\n                                        this.onVisemeReceived(visemeEventArgs);\r\n                                    }\r\n                                    break;\r\n                                case MetadataType.AvatarSignal:\r\n                                    this.onAvatarEvent(metadata);\r\n                                    break;\r\n                                case MetadataType.SessionEnd:\r\n                                    this.privSynthesisTurn.onSessionEnd(metadata);\r\n                                    break;\r\n                            }\r\n                        }\r\n                        break;\r\n                    case \"turn.end\":\r\n                        this.privSynthesisTurn.onServiceTurnEndResponse();\r\n                        let result: SpeechSynthesisResult;\r\n                        try {\r\n                            result = await this.privSynthesisTurn.constructSynthesisResult();\r\n                            if (!!this.privSuccessCallback) {\r\n                                this.privSuccessCallback(result);\r\n                            }\r\n                        } catch (error) {\r\n                            if (!!this.privErrorCallback) {\r\n                                this.privErrorCallback(error as string);\r\n                            }\r\n                        }\r\n                        this.onSynthesisCompleted(result);\r\n                        break;\r\n\r\n                    default:\r\n                        if (!this.processTypeSpecificMessages(connectionMessage)) {\r\n                            // here are some messages that the derived class has not processed, dispatch them to connect class\r\n                            if (!!this.privServiceEvents) {\r\n                                this.serviceEvents.onEvent(new ServiceEvent(connectionMessage.path.toLowerCase(), connectionMessage.textBody));\r\n                            }\r\n                        }\r\n\r\n                }\r\n            }\r\n\r\n            return this.receiveMessage();\r\n\r\n        } catch (e) {\r\n            // TODO: What goes here?\r\n        }\r\n    }\r\n\r\n    protected sendSynthesisContext(connection: IConnection): Promise<void> {\r\n        this.setSynthesisContextSynthesisSection();\r\n        const synthesisContextJson = this.synthesisContext.toJSON();\r\n\r\n        if (synthesisContextJson) {\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"synthesis.context\",\r\n                this.privSynthesisTurn.requestId,\r\n                \"application/json\",\r\n                synthesisContextJson));\r\n        }\r\n        return;\r\n    }\r\n\r\n    protected abstract setSynthesisContextSynthesisSection(): void;\r\n\r\n    protected setSpeechConfigSynthesisSection(): void {\r\n        return;\r\n    }\r\n\r\n    protected connectImpl(isUnAuthorized: boolean = false): Promise<IConnection> {\r\n        if (this.privConnectionPromise != null) {\r\n            return this.privConnectionPromise.then((connection: IConnection): Promise<IConnection> => {\r\n                if (connection.state() === ConnectionState.Disconnected) {\r\n                    this.privConnectionId = null;\r\n                    this.privConnectionPromise = null;\r\n                    return this.connectImpl();\r\n                }\r\n                return this.privConnectionPromise;\r\n            }, (): Promise<IConnection> => {\r\n                this.privConnectionId = null;\r\n                this.privConnectionPromise = null;\r\n                return this.connectImpl();\r\n            });\r\n        }\r\n        this.privAuthFetchEventId = createNoDashGuid();\r\n        this.privConnectionId = createNoDashGuid();\r\n\r\n        this.privSynthesisTurn.onPreConnectionStart(this.privAuthFetchEventId);\r\n\r\n        const authPromise = isUnAuthorized ? this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId) : this.privAuthentication.fetch(this.privAuthFetchEventId);\r\n\r\n        this.privConnectionPromise = authPromise.then(async (result: AuthInfo): Promise<IConnection> => {\r\n            this.privSynthesisTurn.onAuthCompleted(false);\r\n\r\n            const connection: IConnection = this.privConnectionFactory.create(this.privSynthesizerConfig, result, this.privConnectionId);\r\n\r\n            // Attach to the underlying event. No need to hold onto the detach pointers as in the event the connection goes away,\r\n            // it'll stop sending events.\r\n            connection.events.attach((event: ConnectionEvent): void => {\r\n                this.connectionEvents.onEvent(event);\r\n            });\r\n            const response = await connection.open();\r\n            if (response.statusCode === 200) {\r\n                this.privSynthesisTurn.onConnectionEstablishCompleted(response.statusCode);\r\n                return Promise.resolve(connection);\r\n            } else if (response.statusCode === 403 && !isUnAuthorized) {\r\n                return this.connectImpl(true);\r\n            } else {\r\n                this.privSynthesisTurn.onConnectionEstablishCompleted(response.statusCode);\r\n                return Promise.reject(`Unable to contact server. StatusCode: ${response.statusCode}, ${this.privSynthesizerConfig.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint)} Reason: ${response.reason}`);\r\n            }\r\n        }, (error: string): Promise<IConnection> => {\r\n            this.privSynthesisTurn.onAuthCompleted(true);\r\n            throw new Error(error);\r\n        });\r\n\r\n        // Attach an empty handler to allow the promise to run in the background while\r\n        // other startup events happen. It'll eventually be awaited on.\r\n        // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n        this.privConnectionPromise.catch((): void => { });\r\n\r\n        return this.privConnectionPromise;\r\n    }\r\n    protected sendSpeechServiceConfig(connection: IConnection, SpeechServiceConfigJson: string): Promise<void> {\r\n        if (SpeechServiceConfigJson) {\r\n            return connection.send(new SpeechConnectionMessage(\r\n                MessageType.Text,\r\n                \"speech.config\",\r\n                this.privSynthesisTurn.requestId,\r\n                \"application/json\",\r\n                SpeechServiceConfigJson));\r\n        }\r\n    }\r\n\r\n    protected sendSsmlMessage(connection: IConnection, ssml: string, requestId: string): Promise<void> {\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"ssml\",\r\n            requestId,\r\n            \"application/ssml+xml\",\r\n            ssml));\r\n    }\r\n\r\n    private async fetchConnection(): Promise<IConnection> {\r\n        if (this.privConnectionConfigurationPromise !== undefined) {\r\n            return this.privConnectionConfigurationPromise.then((connection: IConnection): Promise<IConnection> => {\r\n                if (connection.state() === ConnectionState.Disconnected) {\r\n                    this.privConnectionId = null;\r\n                    this.privConnectionConfigurationPromise = undefined;\r\n                    return this.fetchConnection();\r\n                }\r\n                return this.privConnectionConfigurationPromise;\r\n            }, (): Promise<IConnection> => {\r\n                this.privConnectionId = null;\r\n                this.privConnectionConfigurationPromise = undefined;\r\n                return this.fetchConnection();\r\n            });\r\n        }\r\n        this.privConnectionConfigurationPromise = this.configureConnection();\r\n        return await this.privConnectionConfigurationPromise;\r\n    }\r\n\r\n    // Takes an established websocket connection to the endpoint and sends speech configuration information.\r\n    private async configureConnection(): Promise<IConnection> {\r\n        const connection: IConnection = await this.connectImpl();\r\n        if (this.configConnectionOverride !== undefined) {\r\n            return this.configConnectionOverride(connection);\r\n        }\r\n        this.setSpeechConfigSynthesisSection();\r\n        await this.sendSpeechServiceConfig(connection, this.privSynthesizerConfig.SpeechServiceConfig.serialize());\r\n        return connection;\r\n    }\r\n\r\n    protected onAvatarEvent(_metadata: ISynthesisMetadata): void {\r\n        return;\r\n    }\r\n\r\n    protected onSynthesisStarted(_requestId: string): void {\r\n        return;\r\n    }\r\n\r\n    protected onSynthesizing(_audio: ArrayBuffer): void {\r\n        return;\r\n    }\r\n\r\n    protected onSynthesisCancelled(_result: SpeechSynthesisResult): void {\r\n        return;\r\n    }\r\n\r\n    protected onSynthesisCompleted(_result: SpeechSynthesisResult): void {\r\n        return;\r\n    }\r\n\r\n    protected onWordBoundary(_wordBoundaryEventArgs: SpeechSynthesisWordBoundaryEventArgs): void {\r\n        return;\r\n    }\r\n\r\n    protected onVisemeReceived(_visemeEventArgs: SpeechSynthesisVisemeEventArgs): void {\r\n        return;\r\n    }\r\n\r\n    protected onBookmarkReached(_bookmarkEventArgs: SpeechSynthesisBookmarkEventArgs): void {\r\n        return;\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport {\r\n    AvatarConfig,\r\n    AvatarEventArgs,\r\n    AvatarSynthesizer,\r\n    PropertyId,\r\n    Synthesizer,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    ISynthesisConnectionFactory,\r\n    ISynthesisMetadata,\r\n    ISynthesisSectionVideo,\r\n    SynthesisAdapterBase,\r\n    SynthesizerConfig\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\n\r\nexport class AvatarSynthesisAdapter extends SynthesisAdapterBase {\r\n    private readonly privAvatarSynthesizer: AvatarSynthesizer;\r\n    private readonly privAvatarConfig: AvatarConfig;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: ISynthesisConnectionFactory,\r\n        synthesizerConfig: SynthesizerConfig,\r\n        avatarSynthesizer: AvatarSynthesizer,\r\n        avatarConfig: AvatarConfig,\r\n        ) {\r\n\r\n        super(authentication, connectionFactory,\r\n            synthesizerConfig, undefined);\r\n        this.privAvatarSynthesizer = avatarSynthesizer;\r\n        this.privSynthesizer = avatarSynthesizer as Synthesizer;\r\n        this.privAvatarConfig = avatarConfig;\r\n    }\r\n\r\n    protected setSynthesisContextSynthesisSection(): void {\r\n        this.privSynthesisContext.setSynthesisSection(undefined);\r\n    }\r\n\r\n    protected setSpeechConfigSynthesisSection(): void {\r\n        this.privSynthesizerConfig.synthesisVideoSection = {\r\n            format: {\r\n                bitrate: this.privAvatarConfig.videoFormat?.bitrate,\r\n                codec: this.privAvatarConfig.videoFormat?.codec,\r\n                crop: {\r\n                    bottomRight: {\r\n                        x: this.privAvatarConfig.videoFormat?.cropRange?.bottomRight?.x,\r\n                        y: this.privAvatarConfig.videoFormat?.cropRange?.bottomRight?.y,\r\n                    },\r\n                    topLeft: {\r\n                        x: this.privAvatarConfig.videoFormat?.cropRange?.topLeft?.x,\r\n                        y: this.privAvatarConfig.videoFormat?.cropRange?.topLeft?.y,\r\n                    },\r\n                },\r\n                resolution: {\r\n                    height: this.privAvatarConfig.videoFormat?.height,\r\n                    width: this.privAvatarConfig.videoFormat?.width,\r\n                },\r\n            },\r\n            protocol: {\r\n                name: \"WebRTC\",\r\n                webrtcConfig: {\r\n                    clientDescription: btoa(this.privSynthesizerConfig.parameters.getProperty(PropertyId.TalkingAvatarService_WebRTC_SDP)),\r\n                    iceServers: this.privAvatarSynthesizer.iceServers,\r\n                },\r\n            },\r\n            talkingAvatar: {\r\n                background: {\r\n                    color: this.privAvatarConfig.backgroundColor,\r\n                },\r\n                character: this.privAvatarConfig.character,\r\n                customized: this.privAvatarConfig.customized,\r\n                style: this.privAvatarConfig.style,\r\n            }\r\n        } as ISynthesisSectionVideo;\r\n    }\r\n\r\n\r\n    protected onAvatarEvent(metadata: ISynthesisMetadata): void {\r\n        if (!!this.privAvatarSynthesizer.avatarEventReceived) {\r\n            const avatarEventArgs: AvatarEventArgs = new AvatarEventArgs(\r\n                metadata.Data.Offset,\r\n                metadata.Data.Name);\r\n            try {\r\n                this.privAvatarSynthesizer.avatarEventReceived(this.privAvatarSynthesizer, avatarEventArgs);\r\n            } catch (error) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { IAudioDestination } from \"../common/Exports.js\";\r\nimport {\r\n    ResultReason,\r\n    SpeechSynthesisBookmarkEventArgs,\r\n    SpeechSynthesisEventArgs,\r\n    SpeechSynthesisResult,\r\n    SpeechSynthesisVisemeEventArgs,\r\n    SpeechSynthesisWordBoundaryEventArgs,\r\n    SpeechSynthesizer,\r\n    Synthesizer,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    IAuthentication,\r\n    ISynthesisConnectionFactory,\r\n    SynthesisAdapterBase,\r\n    SynthesizerConfig\r\n} from \"./Exports.js\";\r\n\r\nexport class SpeechSynthesisAdapter extends SynthesisAdapterBase {\r\n    private privSpeechSynthesizer: SpeechSynthesizer;\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: ISynthesisConnectionFactory,\r\n        synthesizerConfig: SynthesizerConfig,\r\n        speechSynthesizer: SpeechSynthesizer,\r\n        audioDestination: IAudioDestination) {\r\n            super(authentication, connectionFactory, synthesizerConfig, audioDestination);\r\n            this.privSpeechSynthesizer = speechSynthesizer;\r\n            this.privSynthesizer = speechSynthesizer as Synthesizer;\r\n        }\r\n\r\n    protected setSynthesisContextSynthesisSection(): void {\r\n        this.privSynthesisContext.setSynthesisSection(this.privSpeechSynthesizer);\r\n    }\r\n\r\n    protected onSynthesisStarted(requestId: string): void {\r\n        const synthesisStartEventArgs: SpeechSynthesisEventArgs = new SpeechSynthesisEventArgs(\r\n            new SpeechSynthesisResult(\r\n                requestId,\r\n                ResultReason.SynthesizingAudioStarted,\r\n            )\r\n        );\r\n\r\n        if (!!this.privSpeechSynthesizer.synthesisStarted) {\r\n            this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer, synthesisStartEventArgs);\r\n        }\r\n    }\r\n\r\n    protected onSynthesizing(audio: ArrayBuffer): void {\r\n        if (!!this.privSpeechSynthesizer.synthesizing) {\r\n            try {\r\n                const audioWithHeader = this.privSynthesisTurn.audioOutputFormat.addHeader(audio);\r\n                const ev: SpeechSynthesisEventArgs = new SpeechSynthesisEventArgs(\r\n                    new SpeechSynthesisResult(\r\n                        this.privSynthesisTurn.requestId,\r\n                        ResultReason.SynthesizingAudio,\r\n                        audioWithHeader));\r\n                this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer, ev);\r\n            } catch (error) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n    }\r\n\r\n    protected onSynthesisCancelled(result: SpeechSynthesisResult): void {\r\n        if (!!this.privSpeechSynthesizer.SynthesisCanceled) {\r\n            const cancelEvent: SpeechSynthesisEventArgs = new SpeechSynthesisEventArgs(result);\r\n            try {\r\n                this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer, cancelEvent);\r\n                /* eslint-disable no-empty */\r\n            } catch { }\r\n        }\r\n    }\r\n\r\n    protected onSynthesisCompleted(result: SpeechSynthesisResult): void {\r\n        if (this.privSpeechSynthesizer.synthesisCompleted) {\r\n            try {\r\n                this.privSpeechSynthesizer.synthesisCompleted(\r\n                    this.privSpeechSynthesizer,\r\n                    new SpeechSynthesisEventArgs(result)\r\n                );\r\n            } catch (e) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n    }\r\n\r\n    protected onWordBoundary(wordBoundaryEventArgs: SpeechSynthesisWordBoundaryEventArgs): void {\r\n        if (!!this.privSpeechSynthesizer.wordBoundary) {\r\n            try {\r\n                this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer, wordBoundaryEventArgs);\r\n            } catch (error) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n    }\r\n\r\n    protected onVisemeReceived(visemeEventArgs: SpeechSynthesisVisemeEventArgs): void {\r\n        if (!!this.privSpeechSynthesizer.visemeReceived) {\r\n            try {\r\n                this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer, visemeEventArgs);\r\n            } catch (error) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n    }\r\n\r\n    protected onBookmarkReached(bookmarkEventArgs: SpeechSynthesisBookmarkEventArgs): void {\r\n        if (!!this.privSpeechSynthesizer.bookmarkReached) {\r\n            try {\r\n                this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer, bookmarkEventArgs);\r\n            } catch (error) {\r\n                // Not going to let errors in the event handler\r\n                // trip things up.\r\n            }\r\n        }\r\n    }\r\n}\r\n","import {\r\n    IRequestOptions,\r\n    IRestResponse,\r\n    RestConfigBase,\r\n    RestMessageAdapter,\r\n    RestRequestType,\r\n} from \"../common.browser/Exports.js\";\r\nimport {\r\n    PropertyId,\r\n} from \"../sdk/Exports.js\";\r\nimport { ConnectionFactoryBase } from \"./ConnectionFactoryBase.js\";\r\nimport { AuthInfo, IAuthentication, SynthesizerConfig } from \"./Exports.js\";\r\nimport { HeaderNames } from \"./HeaderNames.js\";\r\n\r\n/**\r\n * Implements methods for speaker recognition classes, sending requests to endpoint\r\n * and parsing response into expected format\r\n * @class SynthesisRestAdapter\r\n */\r\nexport class SynthesisRestAdapter {\r\n    private privRestAdapter: RestMessageAdapter;\r\n    private privUri: string;\r\n    private privAuthentication: IAuthentication;\r\n\r\n    public constructor(config: SynthesizerConfig, authentication: IAuthentication) {\r\n\r\n        let endpoint = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Endpoint, undefined);\r\n        if (!endpoint) {\r\n            const region: string = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Region, \"westus\");\r\n            const hostSuffix: string = ConnectionFactoryBase.getHostSuffix(region);\r\n            endpoint = config.parameters.getProperty(PropertyId.SpeechServiceConnection_Host, `https://${region}.tts.speech${hostSuffix}`);\r\n        }\r\n        this.privUri = `${endpoint}/cognitiveservices/voices/list`;\r\n\r\n        const options: IRequestOptions = RestConfigBase.requestOptions;\r\n        this.privRestAdapter = new RestMessageAdapter(options);\r\n        this.privAuthentication = authentication;\r\n    }\r\n\r\n    /**\r\n     * Sends list voices request to endpoint.\r\n     * @function\r\n     * @public\r\n     * @param connectionId - guid for connectionId\r\n     * @returns {Promise<IRestResponse>} rest response to status request\r\n     */\r\n    public getVoicesList(connectionId: string): Promise<IRestResponse> {\r\n        this.privRestAdapter.setHeaders(HeaderNames.ConnectionId, connectionId);\r\n        return this.privAuthentication.fetch(connectionId).then((authInfo: AuthInfo): Promise<IRestResponse> => {\r\n            this.privRestAdapter.setHeaders(authInfo.headerName, authInfo.token);\r\n            return this.privRestAdapter.request(RestRequestType.Get, this.privUri);\r\n        });\r\n    }\r\n\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection } from \"../sdk/Exports.js\";\r\nimport {\r\n    Context,\r\n    ISynthesisSectionVideo,\r\n    SpeechServiceConfig\r\n    } from \"./Exports.js\";\r\n\r\nexport enum SynthesisServiceType {\r\n    Standard,\r\n    Custom,\r\n}\r\n\r\nexport class SynthesizerConfig {\r\n    private privSynthesisServiceType: SynthesisServiceType = SynthesisServiceType.Standard;\r\n    private privSpeechServiceConfig: SpeechServiceConfig;\r\n    private privParameters: PropertyCollection;\r\n    public avatarEnabled: boolean = false;\r\n\r\n    public constructor(\r\n        speechServiceConfig: SpeechServiceConfig,\r\n        parameters: PropertyCollection) {\r\n        this.privSpeechServiceConfig = speechServiceConfig ? speechServiceConfig : new SpeechServiceConfig(new Context(null));\r\n        this.privParameters = parameters;\r\n    }\r\n\r\n    public get parameters(): PropertyCollection {\r\n        return this.privParameters;\r\n    }\r\n\r\n    public get synthesisServiceType(): SynthesisServiceType {\r\n        return this.privSynthesisServiceType;\r\n    }\r\n\r\n    public set synthesisServiceType(value: SynthesisServiceType) {\r\n        this.privSynthesisServiceType = value;\r\n    }\r\n\r\n    public set synthesisVideoSection(value: ISynthesisSectionVideo) {\r\n        this.privSpeechServiceConfig.Context.synthesis = {\r\n            video: value\r\n        };\r\n    }\r\n\r\n    public get SpeechServiceConfig(): SpeechServiceConfig {\r\n        return this.privSpeechServiceConfig;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { AudioOutputFormatImpl } from \"../sdk/Audio/AudioOutputFormat.js\";\r\nimport { PropertyId, SpeechSynthesizer } from \"../sdk/Exports.js\";\r\n\r\n/**\r\n * Represents the JSON used in the synthesis.context message sent to the speech service.\r\n * The dynamic grammar is always refreshed from the encapsulated dynamic grammar object.\r\n */\r\nexport class SynthesisContext {\r\n    private privContext: { [section: string]: any } = {};\r\n    private privAudioOutputFormat: AudioOutputFormatImpl;\r\n\r\n    /**\r\n     * Adds a section to the synthesis.context object.\r\n     * @param sectionName Name of the section to add.\r\n     * @param value JSON serializable object that represents the value.\r\n     */\r\n    public setSection(sectionName: string, value: string | object): void {\r\n        this.privContext[sectionName] = value;\r\n    }\r\n\r\n    /**\r\n     * Sets the audio output format for synthesis context generation.\r\n     * @param format {AudioOutputFormatImpl} the output format\r\n     */\r\n    public set audioOutputFormat(format: AudioOutputFormatImpl) {\r\n        this.privAudioOutputFormat = format;\r\n    }\r\n\r\n    public toJSON(): string {\r\n        return JSON.stringify(this.privContext);\r\n    }\r\n\r\n    public setSynthesisSection(speechSynthesizer: SpeechSynthesizer): void {\r\n        const synthesisSection: ISynthesisSection = this.buildSynthesisContext(speechSynthesizer);\r\n        this.setSection(\"synthesis\", synthesisSection);\r\n    }\r\n\r\n    private buildSynthesisContext(speechSynthesizer: SpeechSynthesizer): ISynthesisSection {\r\n        return {\r\n            audio: {\r\n                metadataOptions: {\r\n                    bookmarkEnabled: (!!speechSynthesizer?.bookmarkReached),\r\n                    punctuationBoundaryEnabled: speechSynthesizer?.properties.getProperty(\r\n                        PropertyId.SpeechServiceResponse_RequestPunctuationBoundary, (!!speechSynthesizer?.wordBoundary)),\r\n                    sentenceBoundaryEnabled: speechSynthesizer?.properties.getProperty(\r\n                        PropertyId.SpeechServiceResponse_RequestSentenceBoundary, false),\r\n                    sessionEndEnabled: true,\r\n                    visemeEnabled: (!!speechSynthesizer?.visemeReceived),\r\n                    wordBoundaryEnabled: speechSynthesizer?.properties.getProperty(\r\n                        PropertyId.SpeechServiceResponse_RequestWordBoundary, (!!speechSynthesizer?.wordBoundary)),\r\n                },\r\n                outputFormat: this.privAudioOutputFormat.requestAudioFormatString,\r\n            },\r\n            language: {\r\n                autoDetection: speechSynthesizer?.autoDetectSourceLanguage\r\n            }\r\n        } as ISynthesisSection;\r\n    }\r\n}\r\n\r\ninterface ISynthesisSection {\r\n    audio: {\r\n        outputFormat: string;\r\n        metadataOptions: {\r\n            bookmarkEnabled: boolean;\r\n            wordBoundaryEnabled: string;\r\n            punctuationBoundaryEnabled: string;\r\n            visemeEnabled: boolean;\r\n            sentenceBoundaryEnabled: string;\r\n            sessionEndEnabled: boolean;\r\n        };\r\n    };\r\n    language: {\r\n        autoDetection: boolean;\r\n    };\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { PropertyCollection } from \"../sdk/Exports.js\";\r\nimport { Context } from \"./Exports.js\";\r\n\r\nexport class SpeakerRecognitionConfig {\r\n    private privParameters: PropertyCollection;\r\n    private privContext: Context;\r\n\r\n    public constructor(\r\n        context: Context,\r\n        parameters: PropertyCollection) {\r\n        this.privContext = context ? context : new Context(null);\r\n        this.privParameters = parameters;\r\n    }\r\n\r\n    public get parameters(): PropertyCollection {\r\n        return this.privParameters;\r\n    }\r\n\r\n    public get Context(): Context {\r\n        return this.privContext;\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ReplayableAudioNode } from \"../common.browser/Exports.js\";\r\nimport {\r\n    Deferred,\r\n    IAudioSource,\r\n    IAudioStreamNode,\r\n    IConnection,\r\n    MessageType,\r\n} from \"../common/Exports.js\";\r\nimport { AudioStreamFormatImpl } from \"../sdk/Audio/AudioStreamFormat.js\";\r\nimport { SpeakerRecognitionModel } from \"../sdk/SpeakerRecognitionModel.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    SpeakerRecognitionResult,\r\n    SpeakerRecognizer,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SessionEventArgs,\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    CancellationErrorCodePropertyName,\r\n    ISpeechConfigAudioDevice,\r\n    SpeakerResponse,\r\n    ServiceRecognizerBase,\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\ninterface SpeakerContext {\r\n    scenario: string;\r\n    profileIds: string[];\r\n    features: {\r\n        interimResult: string;\r\n        progressiveDetection: string;\r\n    };\r\n}\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class SpeakerServiceRecognizer extends ServiceRecognizerBase {\r\n    private privSpeakerRecognizer: SpeakerRecognizer;\r\n    private privSpeakerAudioSource: IAudioSource;\r\n    private privResultDeferral: Deferred<SpeakerRecognitionResult>;\r\n    private privSpeakerModel: SpeakerRecognitionModel;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        recognizer: SpeakerRecognizer) {\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, recognizer);\r\n        this.privSpeakerRecognizer = recognizer;\r\n        this.privSpeakerAudioSource = audioSource;\r\n        this.recognizeSpeaker = (model: SpeakerRecognitionModel): Promise<SpeakerRecognitionResult> => this.recognizeSpeakerOnce(model);\r\n        this.sendPrePayloadJSONOverride = (): Promise<void> => this.noOp();\r\n    }\r\n\r\n    protected processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n\r\n        let processed: boolean = false;\r\n\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        if (connectionMessage.messageType === MessageType.Text) {\r\n            resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n        }\r\n\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            case \"speaker.response\":\r\n                const response: SpeakerResponse = JSON.parse(connectionMessage.textBody) as SpeakerResponse;\r\n                let result: SpeakerRecognitionResult;\r\n                if (response.status.statusCode.toLowerCase() !== \"success\") {\r\n                    result = new SpeakerRecognitionResult(\r\n                        response,\r\n                        ResultReason.Canceled,\r\n                        CancellationErrorCode.ServiceError,\r\n                        response.status.reason\r\n                        );\r\n                } else {\r\n                    result = new SpeakerRecognitionResult(\r\n                        response,\r\n                        ResultReason.RecognizedSpeaker,\r\n                        );\r\n                }\r\n                if (!!this.privResultDeferral) {\r\n                    this.privResultDeferral.resolve(result);\r\n                }\r\n                processed = true;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        const defferal = new Deferred<boolean>();\r\n        defferal.resolve(processed);\r\n        return defferal.promise;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n        if (!!this.privResultDeferral) {\r\n            const result: SpeakerRecognitionResult = new SpeakerRecognitionResult(\r\n                {\r\n                    scenario: this.privSpeakerModel.scenario,\r\n                    status: { statusCode: error, reason: error }\r\n                },\r\n                ResultReason.Canceled,\r\n                errorCode,\r\n                error\r\n                );\r\n            try {\r\n                this.privResultDeferral.resolve(result);\r\n            } catch (error) {\r\n                this.privResultDeferral.reject(error as string);\r\n            }\r\n        }\r\n    }\r\n\r\n    public async recognizeSpeakerOnce(model: SpeakerRecognitionModel): Promise<SpeakerRecognitionResult> {\r\n        this.privSpeakerModel = model;\r\n        this.voiceProfileType = model.scenario;\r\n        if (!this.privResultDeferral) {\r\n            this.privResultDeferral = new Deferred<SpeakerRecognitionResult>();\r\n        }\r\n        this.privRequestSession.startNewRecognition();\r\n        this.privRequestSession.listenForServiceTelemetry(this.privSpeakerAudioSource.events);\r\n\r\n        this.privRecognizerConfig.parameters.setProperty(PropertyId.Speech_SessionId, this.privRequestSession.sessionId);\r\n\r\n        // Start the connection to the service. The promise this will create is stored and will be used by configureConnection().\r\n        const conPromise: Promise<IConnection> = this.connectImpl();\r\n\r\n        const preAudioPromise: Promise<void> = this.sendPreAudioMessages(this.extractSpeakerContext(model));\r\n\r\n        const node: IAudioStreamNode = await this.privSpeakerAudioSource.attach(this.privRequestSession.audioNodeId);\r\n        const format: AudioStreamFormatImpl = await this.privSpeakerAudioSource.format;\r\n        const deviceInfo: ISpeechConfigAudioDevice = await this.privSpeakerAudioSource.deviceInfo;\r\n\r\n        const audioNode = new ReplayableAudioNode(node, format.avgBytesPerSec);\r\n        await this.privRequestSession.onAudioSourceAttachCompleted(audioNode, false);\r\n\r\n        this.privRecognizerConfig.SpeechServiceConfig.Context.audio = { source: deviceInfo };\r\n\r\n        try {\r\n            await conPromise;\r\n            await preAudioPromise;\r\n        } catch (err) {\r\n            this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, CancellationReason.Error, CancellationErrorCode.ConnectionFailure, err as string);\r\n        }\r\n\r\n        const sessionStartEventArgs: SessionEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\r\n\r\n        if (!!this.privRecognizer.sessionStarted) {\r\n            this.privRecognizer.sessionStarted(this.privRecognizer, sessionStartEventArgs);\r\n        }\r\n\r\n        void this.receiveMessage();\r\n        const audioSendPromise = this.sendAudio(audioNode);\r\n\r\n        // /* eslint-disable no-empty */\r\n        audioSendPromise.then((): void => { /* add? return true;*/ }, (error: string): void => {\r\n            this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, CancellationReason.Error, CancellationErrorCode.RuntimeError, error);\r\n        });\r\n\r\n        return this.privResultDeferral.promise;\r\n    }\r\n\r\n    private async sendPreAudioMessages(context: SpeakerContext): Promise<void> {\r\n        const connection: IConnection = await this.fetchConnection();\r\n        await this.sendSpeakerRecognition(connection, context);\r\n        // await this.sendWaveHeader(connection);\r\n    }\r\n\r\n    private async sendSpeakerRecognition(connection: IConnection, context: SpeakerContext): Promise<void> {\r\n        const speakerContextJson = JSON.stringify(context);\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"speaker.context\",\r\n            this.privRequestSession.requestId,\r\n            \"application/json; charset=utf-8\",\r\n            speakerContextJson));\r\n    }\r\n\r\n    private extractSpeakerContext(model: SpeakerRecognitionModel): SpeakerContext {\r\n        return {\r\n            features: {\r\n                interimResult: \"enabled\",\r\n                progressiveDetection: \"disabled\",\r\n            },\r\n            profileIds: model.profileIds,\r\n            scenario: model.scenario,\r\n        };\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { ReplayableAudioNode } from \"../common.browser/Exports.js\";\r\nimport {\r\n    DeferralMap,\r\n    Deferred,\r\n    IAudioSource,\r\n    IAudioStreamNode,\r\n    IConnection,\r\n    MessageType,\r\n} from \"../common/Exports.js\";\r\nimport { AudioStreamFormatImpl } from \"../sdk/Audio/AudioStreamFormat.js\";\r\nimport { SpeakerRecognitionModel } from \"../sdk/SpeakerRecognitionModel.js\";\r\nimport {\r\n    CancellationErrorCode,\r\n    CancellationReason,\r\n    VoiceProfileClient,\r\n    PropertyCollection,\r\n    PropertyId,\r\n    ResultReason,\r\n    SessionEventArgs,\r\n    VoiceProfileEnrollmentResult,\r\n    VoiceProfilePhraseResult,\r\n    VoiceProfileResult,\r\n    VoiceProfileType,\r\n    VoiceProfile\r\n} from \"../sdk/Exports.js\";\r\nimport {\r\n    CancellationErrorCodePropertyName,\r\n    EnrollmentResponse,\r\n    IProfile,\r\n    ISpeechConfigAudioDevice,\r\n    ProfilePhraseResponse,\r\n    ProfileResponse,\r\n    ServiceRecognizerBase,\r\n} from \"./Exports.js\";\r\nimport { IAuthentication } from \"./IAuthentication.js\";\r\nimport { IConnectionFactory } from \"./IConnectionFactory.js\";\r\nimport { RecognizerConfig } from \"./RecognizerConfig.js\";\r\nimport { SpeechConnectionMessage } from \"./SpeechConnectionMessage.Internal.js\";\r\n\r\ninterface CreateProfile {\r\n    scenario: string;\r\n    locale: string;\r\n    number: string;\r\n}\r\n\r\ninterface PhraseRequest {\r\n    scenario: string;\r\n    locale: string;\r\n}\r\n\r\ninterface SpeakerContext {\r\n    scenario: string;\r\n    profileIds: string[];\r\n    features: {\r\n        interimResult: string;\r\n        progressiveDetection: string;\r\n    };\r\n}\r\n\r\n// eslint-disable-next-line max-classes-per-file\r\nexport class VoiceServiceRecognizer extends ServiceRecognizerBase {\r\n    private privSpeakerAudioSource: IAudioSource;\r\n    private privDeferralMap: DeferralMap = new DeferralMap();\r\n    private privExpectedProfileId: string;\r\n\r\n    public constructor(\r\n        authentication: IAuthentication,\r\n        connectionFactory: IConnectionFactory,\r\n        audioSource: IAudioSource,\r\n        recognizerConfig: RecognizerConfig,\r\n        recognizer: VoiceProfileClient) {\r\n        super(authentication, connectionFactory, audioSource, recognizerConfig, recognizer);\r\n        this.privSpeakerAudioSource = audioSource;\r\n        this.sendPrePayloadJSONOverride = (): Promise<void> => this.noOp();\r\n    }\r\n\r\n    public set SpeakerAudioSource(audioSource: IAudioSource) {\r\n        this.privSpeakerAudioSource = audioSource;\r\n    }\r\n\r\n    protected processTypeSpecificMessages(connectionMessage: SpeechConnectionMessage): Promise<boolean> {\r\n\r\n        let processed: boolean = false;\r\n\r\n        const resultProps: PropertyCollection = new PropertyCollection();\r\n        if (connectionMessage.messageType === MessageType.Text) {\r\n            resultProps.setProperty(PropertyId.SpeechServiceResponse_JsonResult, connectionMessage.textBody);\r\n        }\r\n\r\n        switch (connectionMessage.path.toLowerCase()) {\r\n            // Profile management response for create, fetch, delete, reset\r\n            case \"speaker.profiles\":\r\n                const response: ProfileResponse = JSON.parse(connectionMessage.textBody) as ProfileResponse;\r\n                switch (response.operation.toLowerCase()) {\r\n                    case \"create\":\r\n                        this.handleCreateResponse(response, connectionMessage.requestId);\r\n                        break;\r\n\r\n                    case \"delete\":\r\n                    case \"reset\":\r\n                        this.handleResultResponse(response, connectionMessage.requestId);\r\n                        break;\r\n\r\n                    case \"fetch\":\r\n                        const enrollmentResponse: EnrollmentResponse = JSON.parse(connectionMessage.textBody) as EnrollmentResponse;\r\n                        this.handleFetchResponse(enrollmentResponse, connectionMessage.requestId);\r\n                        break;\r\n\r\n                    default:\r\n                        break;\r\n                }\r\n                processed = true;\r\n                break;\r\n            // Activation and authorization phrase response\r\n            case \"speaker.phrases\":\r\n                const phraseResponse: ProfilePhraseResponse = JSON.parse(connectionMessage.textBody) as ProfilePhraseResponse;\r\n                this.handlePhrasesResponse(phraseResponse, connectionMessage.requestId);\r\n                processed = true;\r\n                break;\r\n            // Enrollment response\r\n            case \"speaker.profile.enrollment\":\r\n                const enrollmentResponse: EnrollmentResponse = JSON.parse(connectionMessage.textBody) as EnrollmentResponse;\r\n                const result: VoiceProfileEnrollmentResult = new VoiceProfileEnrollmentResult(\r\n                    this.enrollmentReasonFrom(!!enrollmentResponse.enrollment ? enrollmentResponse.enrollment.enrollmentStatus : enrollmentResponse.status.statusCode),\r\n                    !!enrollmentResponse.enrollment ? JSON.stringify(enrollmentResponse.enrollment) : undefined,\r\n                    enrollmentResponse.status.reason,\r\n                    );\r\n                if (!!this.privDeferralMap.getId(connectionMessage.requestId)) {\r\n                    this.privDeferralMap.complete<VoiceProfileEnrollmentResult>(connectionMessage.requestId, result);\r\n                }\r\n                this.privRequestSession.onSpeechEnded();\r\n                processed = true;\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n        const defferal = new Deferred<boolean>();\r\n        defferal.resolve(processed);\r\n        return defferal.promise;\r\n    }\r\n\r\n    // Cancels recognition.\r\n    protected cancelRecognition(\r\n        sessionId: string,\r\n        requestId: string,\r\n        cancellationReason: CancellationReason,\r\n        errorCode: CancellationErrorCode,\r\n        error: string): void {\r\n\r\n        const properties: PropertyCollection = new PropertyCollection();\r\n        // const enrollmentResponse: EnrollmentResponse = JSON.parse(connectionMessage.textBody) as EnrollmentResponse;\r\n        properties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[errorCode]);\r\n\r\n            const result: VoiceProfileEnrollmentResult = new VoiceProfileEnrollmentResult(\r\n                ResultReason.Canceled,\r\n                error,\r\n                error,\r\n                );\r\n            if (!!this.privDeferralMap.getId(requestId)) {\r\n                this.privDeferralMap.complete<VoiceProfileEnrollmentResult>(requestId, result);\r\n            }\r\n    }\r\n\r\n    public async createProfile(profileType: VoiceProfileType, locale: string): Promise<string[]> {\r\n        // Start the connection to the service. The promise this will create is stored and will be used by configureConnection().\r\n        this.voiceProfileType = profileType.toString();\r\n        const conPromise: Promise<IConnection> = this.connectImpl();\r\n        try {\r\n            const createProfileDeferral = new Deferred<string[]>();\r\n            await conPromise;\r\n            await this.sendCreateProfile(createProfileDeferral, profileType, locale);\r\n            void this.receiveMessage();\r\n            return createProfileDeferral.promise;\r\n        } catch (err) {\r\n            throw err;\r\n        }\r\n    }\r\n\r\n    public async resetProfile(profile: VoiceProfile): Promise<VoiceProfileResult> {\r\n        this.voiceProfileType = profile.profileType.toString();\r\n        return this.sendCommonRequest<VoiceProfileResult>(\"reset\", profile.profileType, profile);\r\n    }\r\n\r\n    public async deleteProfile(profile: VoiceProfile): Promise<VoiceProfileResult> {\r\n        this.voiceProfileType = profile.profileType.toString();\r\n        return this.sendCommonRequest<VoiceProfileResult>(\"delete\", profile.profileType, profile);\r\n    }\r\n\r\n    public async retrieveEnrollmentResult(profile: VoiceProfile): Promise<VoiceProfileEnrollmentResult> {\r\n        this.voiceProfileType = profile.profileType.toString();\r\n        this.privExpectedProfileId = profile.profileId;\r\n        return this.sendCommonRequest<VoiceProfileEnrollmentResult>(\"fetch\", profile.profileType, profile);\r\n    }\r\n\r\n    public async getAllProfiles(profileType: VoiceProfileType): Promise<VoiceProfileEnrollmentResult[]> {\r\n        this.voiceProfileType = profileType.toString();\r\n        return this.sendCommonRequest<VoiceProfileEnrollmentResult[]>(\"fetch\", profileType);\r\n    }\r\n\r\n    public async getActivationPhrases(profileType: VoiceProfileType, lang: string): Promise<VoiceProfilePhraseResult> {\r\n        this.voiceProfileType = profileType.toString();\r\n        // Start the connection to the service. The promise this will create is stored and will be used by configureConnection().\r\n        const conPromise: Promise<IConnection> = this.connectImpl();\r\n        try {\r\n            const getPhrasesDeferral = new Deferred<VoiceProfilePhraseResult>();\r\n            await conPromise;\r\n            await this.sendPhrasesRequest(getPhrasesDeferral, profileType, lang);\r\n            void this.receiveMessage();\r\n            return getPhrasesDeferral.promise;\r\n        } catch (err) {\r\n            throw err;\r\n        }\r\n    }\r\n\r\n    public async enrollProfile(profile: VoiceProfile): Promise<VoiceProfileEnrollmentResult> {\r\n        this.voiceProfileType = profile.profileType.toString();\r\n        const enrollmentDeferral = new Deferred<VoiceProfileEnrollmentResult>();\r\n        this.privRequestSession.startNewRecognition();\r\n        this.privRequestSession.listenForServiceTelemetry(this.privSpeakerAudioSource.events);\r\n\r\n        this.privRecognizerConfig.parameters.setProperty(PropertyId.Speech_SessionId, this.privRequestSession.sessionId);\r\n\r\n        // Start the connection to the service. The promise this will create is stored and will be used by configureConnection().\r\n        const conPromise: Promise<IConnection> = this.connectImpl();\r\n\r\n        const preAudioPromise: Promise<void> = this.sendPreAudioMessages(profile, enrollmentDeferral);\r\n\r\n        const node: IAudioStreamNode = await this.privSpeakerAudioSource.attach(this.privRequestSession.audioNodeId);\r\n        const format: AudioStreamFormatImpl = await this.privSpeakerAudioSource.format;\r\n        const deviceInfo: ISpeechConfigAudioDevice = await this.privSpeakerAudioSource.deviceInfo;\r\n\r\n        const audioNode = new ReplayableAudioNode(node, format.avgBytesPerSec);\r\n        await this.privRequestSession.onAudioSourceAttachCompleted(audioNode, false);\r\n\r\n        this.privRecognizerConfig.SpeechServiceConfig.Context.audio = { source: deviceInfo };\r\n\r\n        try {\r\n            await conPromise;\r\n            await preAudioPromise;\r\n        } catch (err) {\r\n            this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, CancellationReason.Error, CancellationErrorCode.ConnectionFailure, err as string);\r\n        }\r\n\r\n        const sessionStartEventArgs: SessionEventArgs = new SessionEventArgs(this.privRequestSession.sessionId);\r\n\r\n        if (!!this.privRecognizer.sessionStarted) {\r\n            this.privRecognizer.sessionStarted(this.privRecognizer, sessionStartEventArgs);\r\n        }\r\n\r\n        void this.receiveMessage();\r\n        const audioSendPromise = this.sendAudio(audioNode);\r\n\r\n        // /* eslint-disable no-empty */\r\n        audioSendPromise.then((): void => { /* add? return true;*/ }, (error: string): void => {\r\n            this.cancelRecognition(this.privRequestSession.sessionId, this.privRequestSession.requestId, CancellationReason.Error, CancellationErrorCode.RuntimeError, error);\r\n        });\r\n\r\n        return enrollmentDeferral.promise;\r\n    }\r\n\r\n    private async sendPreAudioMessages(profile: VoiceProfile, enrollmentDeferral: Deferred<VoiceProfileEnrollmentResult>): Promise<void> {\r\n        const connection: IConnection = await this.fetchConnection();\r\n        this.privRequestSession.onSpeechContext();\r\n        this.privDeferralMap.add<VoiceProfileEnrollmentResult>(this.privRequestSession.requestId, enrollmentDeferral);\r\n        await this.sendBaseRequest(connection, \"enroll\", this.scenarioFrom(profile.profileType), profile);\r\n    }\r\n\r\n    private async sendPhrasesRequest(getPhrasesDeferral: Deferred<VoiceProfilePhraseResult>, profileType: VoiceProfileType, locale: string): Promise<void> {\r\n        const connection: IConnection = await this.fetchConnection();\r\n        this.privRequestSession.onSpeechContext();\r\n        this.privDeferralMap.add<VoiceProfilePhraseResult>(this.privRequestSession.requestId, getPhrasesDeferral);\r\n        const scenario = this.scenarioFrom(profileType);\r\n\r\n        const profileCreateRequest: PhraseRequest = {\r\n            locale,\r\n            scenario,\r\n        };\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"speaker.profile.phrases\",\r\n            this.privRequestSession.requestId,\r\n            \"application/json; charset=utf-8\",\r\n            JSON.stringify(profileCreateRequest)));\r\n    }\r\n\r\n    private async sendCreateProfile(createProfileDeferral: Deferred<string[]>, profileType: VoiceProfileType, locale: string): Promise<void> {\r\n\r\n        const connection: IConnection = await this.fetchConnection();\r\n        this.privRequestSession.onSpeechContext();\r\n        this.privDeferralMap.add<string[]>(this.privRequestSession.requestId, createProfileDeferral);\r\n        const scenario = profileType === VoiceProfileType.TextIndependentIdentification ? \"TextIndependentIdentification\" :\r\n            profileType === VoiceProfileType.TextIndependentVerification ? \"TextIndependentVerification\" : \"TextDependentVerification\";\r\n\r\n        const profileCreateRequest: CreateProfile = {\r\n            locale,\r\n            number: \"1\",\r\n            scenario,\r\n        };\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            \"speaker.profile.create\",\r\n            this.privRequestSession.requestId,\r\n            \"application/json; charset=utf-8\",\r\n            JSON.stringify(profileCreateRequest)));\r\n    }\r\n\r\n    private async sendCommonRequest<T>(operation: string, profileType: VoiceProfileType, profile: VoiceProfile = undefined): Promise<T> {\r\n        // Start the connection to the service. The promise this will create is stored and will be used by configureConnection().\r\n        const conPromise: Promise<IConnection> = this.connectImpl();\r\n        try {\r\n            const deferral = new Deferred<T>();\r\n            this.privRequestSession.onSpeechContext();\r\n            await conPromise;\r\n            const connection: IConnection = await this.fetchConnection();\r\n            this.privDeferralMap.add<T>(this.privRequestSession.requestId, deferral);\r\n            await this.sendBaseRequest(connection, operation, this.scenarioFrom(profileType), profile);\r\n            void this.receiveMessage();\r\n            return deferral.promise;\r\n        } catch (err) {\r\n            throw err;\r\n        }\r\n    }\r\n\r\n    private async sendBaseRequest(connection: IConnection, operation: string, scenario: string, profile: VoiceProfile): Promise<void> {\r\n        const profileRequest: { maxPageSize?: number; profileIds?: string[]; scenario: string } = {\r\n            scenario\r\n        };\r\n        if (!!profile) {\r\n            profileRequest.profileIds = [ profile.profileId ];\r\n        } else {\r\n            profileRequest.maxPageSize = -1;\r\n        }\r\n        return connection.send(new SpeechConnectionMessage(\r\n            MessageType.Text,\r\n            `speaker.profile.${operation}`,\r\n            this.privRequestSession.requestId,\r\n            \"application/json; charset=utf-8\",\r\n            JSON.stringify(profileRequest)));\r\n    }\r\n\r\n    private extractSpeakerContext(model: SpeakerRecognitionModel): SpeakerContext {\r\n        return {\r\n            features: {\r\n                interimResult: \"enabled\",\r\n                progressiveDetection: \"disabled\",\r\n            },\r\n            profileIds: model.profileIds,\r\n            scenario: model.scenario,\r\n        };\r\n    }\r\n\r\n    private handlePhrasesResponse(response: ProfilePhraseResponse, requestId: string): void {\r\n        if (!!this.privDeferralMap.getId(requestId)) {\r\n            if (response.status.statusCode.toLowerCase() !== \"success\") {\r\n                const reason: ResultReason = ResultReason.Canceled;\r\n                const result = new VoiceProfilePhraseResult(reason, response.status.statusCode, response.passPhraseType, []);\r\n                this.privDeferralMap.complete<VoiceProfilePhraseResult>(requestId, result);\r\n            } else if (!!response.phrases && response.phrases.length > 0) {\r\n                const reason: ResultReason = ResultReason.EnrollingVoiceProfile;\r\n                const result = new VoiceProfilePhraseResult(reason, response.status.statusCode, response.passPhraseType, response.phrases);\r\n                this.privDeferralMap.complete<VoiceProfilePhraseResult>(requestId, result);\r\n            } else {\r\n                throw new Error(\"Voice Profile get activation phrases failed, no phrases received\");\r\n            }\r\n        } else {\r\n            throw new Error(`Voice Profile get activation phrases request for requestID ${requestId} not found`);\r\n        }\r\n    }\r\n\r\n    private handleCreateResponse(response: ProfileResponse, requestId: string): void {\r\n        if (!!response.profiles && response.profiles.length > 0) {\r\n            if (!!this.privDeferralMap.getId(requestId)) {\r\n                const profileIds: string[] = response.profiles.map((profile: IProfile): string => profile.profileId);\r\n                this.privDeferralMap.complete<string[]>(requestId, profileIds);\r\n            } else {\r\n                throw new Error(`Voice Profile create request for requestID ${requestId} not found`);\r\n            }\r\n        } else {\r\n            throw new Error(\"Voice Profile create failed, no profile id received\");\r\n        }\r\n    }\r\n\r\n    private handleResultResponse(response: ProfileResponse, requestId: string): void {\r\n        if (!!this.privDeferralMap.getId(requestId)) {\r\n            const successReason: ResultReason = response.operation.toLowerCase() === \"delete\" ? ResultReason.DeletedVoiceProfile : ResultReason.ResetVoiceProfile;\r\n            const reason: ResultReason = response.status.statusCode.toLowerCase() === \"success\" ? successReason : ResultReason.Canceled;\r\n            const result = new VoiceProfileResult(reason, `statusCode: ${response.status.statusCode}, errorDetails: ${response.status.reason}`);\r\n            this.privDeferralMap.complete<VoiceProfileResult>(requestId, result);\r\n        } else {\r\n            throw new Error(`Voice Profile create request for requestID ${requestId} not found`);\r\n        }\r\n    }\r\n\r\n    private handleFetchResponse(enrollmentResponse: EnrollmentResponse, requestId: string): void {\r\n        if (!!this.privDeferralMap.getId(requestId) && !!enrollmentResponse.profiles[0]) {\r\n            if (!!this.privExpectedProfileId && enrollmentResponse.profiles.length === 1 && enrollmentResponse.profiles[0].profileId === this.privExpectedProfileId) {\r\n                this.privExpectedProfileId = undefined;\r\n                const profileInfo: IProfile = enrollmentResponse.profiles[0];\r\n                const result: VoiceProfileEnrollmentResult = new VoiceProfileEnrollmentResult(\r\n                    this.enrollmentReasonFrom(profileInfo.enrollmentStatus),\r\n                    JSON.stringify(profileInfo),\r\n                    enrollmentResponse.status.reason,\r\n                    );\r\n                this.privDeferralMap.complete<VoiceProfileEnrollmentResult>(requestId, result);\r\n            } else if (enrollmentResponse.profiles.length > 0) {\r\n                const iProfiles: IProfile[] = enrollmentResponse.profiles;\r\n                const profileResults: VoiceProfileEnrollmentResult[] = [];\r\n                for (const profile of iProfiles) {\r\n                    profileResults.push( new VoiceProfileEnrollmentResult(\r\n                        this.enrollmentReasonFrom(profile.enrollmentStatus),\r\n                        JSON.stringify(profile),\r\n                        enrollmentResponse.status.reason,\r\n                    ));\r\n                }\r\n                this.privDeferralMap.complete<VoiceProfileEnrollmentResult[]>(requestId, profileResults);\r\n            }\r\n        } else {\r\n            throw new Error(`Voice Profile fetch request for requestID ${requestId} not found`);\r\n        }\r\n    }\r\n\r\n    private enrollmentReasonFrom(statusCode: string): ResultReason {\r\n        switch (statusCode.toLowerCase()) {\r\n            case \"enrolled\":\r\n                return ResultReason.EnrolledVoiceProfile;\r\n            case \"invalidlocale\":\r\n            case \"invalidphrase\":\r\n            case \"invalidaudioformat\":\r\n            case \"invalidscenario\":\r\n            case \"invalidprofilecount\":\r\n            case \"invalidoperation\":\r\n            case \"audiotooshort\":\r\n            case \"audiotoolong\":\r\n            case \"toomanyenrollments\":\r\n            case \"storageconflict\":\r\n            case \"profilenotfound\":\r\n            case \"incompatibleprofiles\":\r\n            case \"incompleteenrollment\":\r\n                return ResultReason.Canceled;\r\n            default:\r\n                return ResultReason.EnrollingVoiceProfile;\r\n        }\r\n    }\r\n\r\n    private scenarioFrom(profileType: VoiceProfileType): string {\r\n        return profileType === VoiceProfileType.TextIndependentIdentification ? \"TextIndependentIdentification\" :\r\n            profileType === VoiceProfileType.TextIndependentVerification ? \"TextIndependentVerification\" : \"TextDependentVerification\";\r\n    }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\n\r\n// The config is serialized and sent as the Speech.Config\r\nexport class SpeechServiceConfig {\r\n    private context: Context;\r\n    private recognition: string;\r\n\r\n    public constructor(context: Context) {\r\n        this.context = context;\r\n    }\r\n\r\n    public serialize(): string {\r\n        return JSON.stringify(this, (key: any, value: { [k: string]: any }): any => {\r\n            if (value && typeof value === \"object\" && !Array.isArray(value)) {\r\n                const replacement: { [k: string ]: any } = {};\r\n                for (const k in value) {\r\n                    if (Object.hasOwnProperty.call(value, k)) {\r\n                        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\r\n                        replacement[k && k.charAt(0).toLowerCase() + k.substring(1)] = value[k];\r\n                    }\r\n                }\r\n                return replacement;\r\n            }\r\n            return value;\r\n        });\r\n    }\r\n\r\n    public get Context(): Context {\r\n        return this.context;\r\n    }\r\n\r\n    public get Recognition(): string {\r\n        return this.recognition;\r\n    }\r\n\r\n    public set Recognition(value: string) {\r\n        this.recognition = value.toLowerCase();\r\n    }\r\n}\r\n\r\nexport class Context {\r\n    public system: System;\r\n    public os: OS;\r\n    public audio: ISpeechConfigAudio;\r\n    public synthesis: {\r\n        video: ISynthesisSectionVideo;\r\n    };\r\n\r\n    public constructor(os: OS) {\r\n        this.system = new System();\r\n        this.os = os;\r\n    }\r\n}\r\n\r\nexport class System {\r\n    public name: string;\r\n    public version: string;\r\n    public build: string;\r\n    public lang: string;\r\n\r\n    public constructor() {\r\n        // Note: below will be patched for official builds.\r\n        const SPEECHSDK_CLIENTSDK_VERSION = \"1.34.0\";\r\n\r\n        this.name = \"SpeechSDK\";\r\n        this.version = SPEECHSDK_CLIENTSDK_VERSION;\r\n        this.build = \"JavaScript\";\r\n        this.lang = \"JavaScript\";\r\n    }\r\n}\r\n\r\nexport class OS {\r\n    public platform: string;\r\n    public name: string;\r\n    public version: string;\r\n\r\n    public constructor(platform: string, name: string, version: string) {\r\n        this.platform = platform;\r\n        this.name = name;\r\n        this.version = version;\r\n    }\r\n}\r\n\r\nexport class Device {\r\n    public manufacturer: string;\r\n    public model: string;\r\n    public version: string;\r\n\r\n    public constructor(manufacturer: string, model: string, version: string) {\r\n        this.manufacturer = manufacturer;\r\n        this.model = model;\r\n        this.version = version;\r\n    }\r\n}\r\n\r\nexport interface ISpeechConfigAudio {\r\n    source?: ISpeechConfigAudioDevice;\r\n    playback?: ISpeechConfigAudioDevice;\r\n}\r\n\r\nexport interface ISpeechConfigAudioDevice {\r\n    manufacturer: string;\r\n    model: string;\r\n    connectivity: connectivity;\r\n    type: type;\r\n    samplerate: number;\r\n    bitspersample: number;\r\n    channelcount: number;\r\n}\r\n\r\nexport enum connectivity {\r\n    Bluetooth = \"Bluetooth\",\r\n    Wired = \"Wired\",\r\n    WiFi = \"WiFi\",\r\n    Cellular = \"Cellular\",\r\n    InBuilt = \"InBuilt\",\r\n    Unknown = \"Unknown\",\r\n}\r\n\r\nexport enum type {\r\n    Phone = \"Phone\",\r\n    Speaker = \"Speaker\",\r\n    Car = \"Car\",\r\n    Headset = \"Headset\",\r\n    Thermostat = \"Thermostat\",\r\n    Microphones = \"Microphones\",\r\n    Deskphone = \"Deskphone\",\r\n    RemoteControl = \"RemoteControl\",\r\n    Unknown = \"Unknown\",\r\n    File = \"File\",\r\n    Stream = \"Stream\",\r\n}\r\n\r\nexport interface ICoordinate {\r\n    x: number;\r\n    y: number;\r\n}\r\n\r\n// For avatar synthesis\r\nexport interface ISynthesisSectionVideo {\r\n    protocol: {\r\n        name: string;\r\n        webrtcConfig: {\r\n            clientDescription: string;\r\n            iceServers: {\r\n                urls: string[];\r\n                username: string;\r\n                credential: string;\r\n            }[];\r\n        };\r\n    };\r\n    format: {\r\n        bitrate: number;\r\n        codec: string;\r\n        crop: {\r\n            topLeft: ICoordinate;\r\n            bottomRight: ICoordinate;\r\n        };\r\n        resolution: {\r\n            width: number;\r\n            height: number;\r\n        };\r\n    };\r\n    talkingAvatar: {\r\n        character: string;\r\n        customized: boolean;\r\n        style: string;\r\n        background: {\r\n            color: string;\r\n        };\r\n    };\r\n}\r\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n",null,null,null,null,"// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport * as SpeechSDK from './distrib/lib/microsoft.cognitiveservices.speech.sdk.js';\r\nwindow.SpeechSDK = SpeechSDK;\r\n"]}