{"version":3,"sources":["webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/PushAudioOutputStreamCallback.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/AudioStreamFormat.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/ConnectionMessage.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/PullAudioInputStreamCallback.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/AudioConfig.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/SpeakerAudioDestination.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/ConversationTranscriptionCanceledEventArgs.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/AudioOutputFormat.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/AudioInputStream.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/ActivityReceivedEventArgs.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Contracts.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Connection.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/ConnectionMessageEventArgs.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/CancellationDetailsBase.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/CancellationDetails.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/BotFrameworkConfig.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/CustomCommandsConfig.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/DialogServiceConnector.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/BaseAudioPlayer.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/AutoDetectSourceLanguageConfig.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/AutoDetectSourceLanguageResult.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/CancellationErrorCodes.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/ConnectionEventArgs.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/AudioOutputStream.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/CancellationReason.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/Audio/AudioFileWriter.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/CancellationEventArgsBase.js","webpack:///./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/sdk/DialogServiceConfig.js"],"names":["PushAudioOutputStreamCallback","AudioStreamFormat","AudioStreamFormatImpl","getDefaultInputFormat","samplesPerSecond","bitsPerSample","channels","samplesPerSec","super","this","setString","view","offset","str","i","length","setUint8","charCodeAt","formatTag","avgBytesPerSec","blockAlign","Math","max","privHeader","ArrayBuffer","DataView","setUint32","setUint16","sampleRate","AudioContext","window","webkitAudioContext","undefined","navigator","mediaDevices","getSupportedConstraints","Error","ConnectionMessage","ConnectionMessageImpl","message","privConnectionMessage","privProperties","headers","ConnectionId","setProperty","Speech_SessionId","Object","keys","forEach","header","index","array","find","key","toLowerCase","messageType","Text","Binary","textBody","binaryBody","PullAudioInputStreamCallback","AudioConfig","pcmRecorder","AudioConfigImpl","deviceId","file","audioStream","MediaStream","AudioOutputConfigImpl","player","fromDefaultSpeakerOutput","filename","source","privSource","format","cb","err","turnOff","then","error","id","blob","turnOn","audioNodeId","attach","detach","events","name","value","throwIfNull","def","getProperty","deviceInfo","destination","privDestination","buffer","write","close","__awaiter","thisArg","_arguments","P","generator","adopt","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","apply","MediaDurationPlaceholderSeconds","AudioFormatToMimeType","PCM","MP3","Opus","SpeakerAudioDestination","audioDestinationId","privPlaybackStarted","privAppendingToBuffer","privMediaSourceOpened","privBytesReceived","privId","privIsPaused","privIsClosed","privAudioBuffer","push","updateSourceBuffer","privAudioOutputStream","byteLength","privSourceBuffer","handleSourceBufferUpdateEnd","receivedAudio","read","_","privFormat","hasHeader","addHeader","audioBlob","Blob","type","privAudio","src","URL","createObjectURL","notifyPlayback","mimeType","console","warn","MediaSource","isTypeSupported","Audio","privMediaSource","load","onsourceopen","event","duration","addSourceBuffer","onupdate","catch","reason","instance","onEvent","onupdateend","onupdatestart","currentTime","pause","play","sourceBufferAvailable","binary","shift","appendBuffer","unshift","log","canEndStream","endOfStream","onended","onAudioEnd","isClosed","readyState","updating","ConversationTranscriptionCanceledEventArgs","AudioFormatTag","AudioOutputFormatImpl","audioFormatString","requestAudioFormatString","priAudioFormatString","priRequestAudioFormatString","priHasHeader","speechSynthesisOutputFormat","getDefaultOutputFormat","fromSpeechSynthesisOutputFormatString","SpeechSynthesisOutputFormatToString","speechSynthesisOutputFormatString","Siren","SILKSkype","MuLaw","audioLength","Raw8Khz8BitMonoMULaw","Riff16Khz16KbpsMonoSiren","Audio16Khz16KbpsMonoSiren","Audio16Khz32KBitRateMonoMp3","Audio16Khz128KBitRateMonoMp3","Audio16Khz64KBitRateMonoMp3","Audio24Khz48KBitRateMonoMp3","Audio24Khz96KBitRateMonoMp3","Audio24Khz160KBitRateMonoMp3","Raw16Khz16BitMonoTrueSilk","Riff16Khz16BitMonoPcm","Riff8Khz16BitMonoPcm","Riff24Khz16BitMonoPcm","Riff8Khz8BitMonoMULaw","Raw16Khz16BitMonoPcm","Raw24Khz16BitMonoPcm","Raw8Khz16BitMonoPcm","Ogg16Khz16BitMonoOpus","Ogg24Khz16BitMonoOpus","Raw48Khz16BitMonoPcm","Riff48Khz16BitMonoPcm","Audio48Khz96KBitRateMonoMp3","Audio48Khz192KBitRateMonoMp3","AudioInputStream","PushAudioInputStream","create","callback","PullAudioInputStream","PushAudioInputStreamImpl","privEvents","privStream","dataBuffer","writeStreamChunk","isEnd","timeReceived","Date","now","audioNode","data","bufferData","Buffer","from","readCycle","audioStreamChunk","concat","toBuffer","stream","readEnded","bitspersample","channelcount","connectivity","Unknown","manufacturer","model","samplerate","Stream","arrayBuffer","buf","alloc","Uint8Array","PullAudioInputStreamImpl","privCallback","privBufferSize","transmitBuff","totalBytes","readBuff","pulledBytes","intView","Int8Array","set","slice","ActivityReceivedEventArgs","activity","privActivity","privAudioStream","Contracts","param","throwIfNullOrUndefined","trim","isDisposed","item","throwIfNullOrWhitespace","Connection","recognizer","recoBase","internalData","ret","privInternalData","setupEvents","synthesizer","synthBase","connect","disconnect","path","propertyName","propertyValue","speechContext","setSection","synthesisContext","payload","success","sendNetworkMessage","privEventListener","connectionEvents","connectionEvent","connected","connectionId","disconnected","messageSent","messageReceived","privServiceEventListener","serviceEvents","receivedServiceMessage","jsonString","ConnectionMessageEventArgs","toString","CancellationDetailsBase","errorDetails","errorCode","privReason","privErrorDetails","privErrorCode","CancellationReason","NoError","RecognitionResult","json","simpleSpeech","SimpleSpeechPhrase","fromJSON","EnumTranslation","implTranslateCancelResult","RecognitionStatus","properties","DialogServiceConfig","subscription","region","botId","botFrameworkConfig","PropertyId","Conversation_DialogType","DialogTypes","BotFramework","SpeechServiceConnection_Key","SpeechServiceConnection_Region","Conversation_ApplicationId","authorizationToken","SpeechServiceAuthorization_Token","host","subscriptionKey","resolvedHost","SpeechServiceConnection_Host","endpoint","SpeechServiceConnection_Endpoint","applicationId","customCommandsConfig","CustomCommands","Recognizer","dialogConfig","audioConfig","dialogServiceConfigImpl","isTurnComplete","privIsDisposed","clone","agentConfig","buildAgentConfig","privReco","token","Conversation_Speech_Activity_Template","speechActivityTemplate","throwIfDisposed","callbackHolder","implRecognizerStop","recognize","Conversation","promise","retPromise","dispose","finally","errCb","sendMessage","disposing","_super","get","call","speechConfig","RecognizerConfig","authentication","connectionFactory","recognizerConfig","audioSource","DialogServiceAdapter","communicationType","botInfo","commType","commandsCulture","Conversation_Agent_Connection_Id","conversationId","Conversation_Conversation_Id","fromId","Conversation_From_Id","ttsAudioFormat","SpeechSynthesisOutputFormat","SpeechServiceConnection_SynthOutputFormat","version","audioFormat","audioContext","gainNode","autoUpdateBufferTimer","init","newAudioData","playAudio","ensureInitializedContext","audioData","formatAudioData","newSamplesData","Float32Array","samples","clearInterval","createAudioContext","timerPeriod","setInterval","updateAudioBuffer","getAudioContext","createGain","gain","startTime","formatArrayBuffer","Int16Array","Int32Array","maxValue","float32Data","channelCount","bufferSource","createBufferSource","frameCount","audioBuffer","createBuffer","channel","channelOffset","getChannelData","start","decodeAudioData","newBuffer","PropertyCollection","config","SpeechServiceConnection_AutoDetectSourceLanguages","languages","throwIfArrayEmptyOrWhitespace","join","configs","autoConfig","langs","language","endpointId","customProperty","SpeechServiceConnection_EndpointId","languageDetectionConfidence","privLanguage","privLanguageDetectionConfidence","CancellationErrorCode","ConnectionEventArgs","AudioOutputStream","PullAudioOutputStream","PullAudioOutputStreamImpl","privLastChunkView","isReadEnded","chunk","tmpBuffer","PushAudioOutputStream","PushAudioOutputStreamImpl","AudioFileWriter","privFd","throwIfNotUndefined","privAudioFormat","headerOffset","privWriteStream","fd","autoClose","on","updateHeader","bytesWritten","end","CancellationEventArgsBase","sessionId","_a","DialogServiceConfigImpl","privSpeechConfig","speechRecognitionLanguage","outputFormat","proxyHostName","proxyPort","proxyUserName","proxyPassword","SpeechServiceConnection_ProxyHostName","SpeechServiceConnection_ProxyPort","SpeechServiceConnection_ProxyUserName","Speech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J,oCASO,MAAMvJ,EAKT,eASA,kBAAkBvP,KAEtBuP,EAAoBO,aAAegJ,EAAK,QAEpCA,EAAG/I,aAAe,gBAClB+I,EAAGjI,eAAiB,kBACpBiI,GAMG,MAAMC,UAAgCxJ,EAIzC,cACIvU,QACAC,KAAK+d,iBAAmB,IAAI,OAShC,iBACI,OAAO/d,KAAK+d,iBAAiB1J,WAQjC,gCACI,OAAOrU,KAAK+d,iBAAiBC,0BASjC,8BAA8BjZ,GAC1B,OAAUmM,wBAAwBnM,EAAO,SACzC/E,KAAK+d,iBAAiBC,0BAA4BjZ,EAEtD,mBACI,OAAO/E,KAAK+d,iBAAiBE,aAEjC,iBAAiBlZ,GACb/E,KAAK+d,iBAAiBE,aAAelZ,EAUzC,YAAYD,EAAMC,GACd/E,KAAK+d,iBAAiB5b,YAAY2C,EAAMC,GAW5C,YAAYD,EAAMG,GACd,OAAOjF,KAAK+d,iBAAiB7Y,YAAYJ,GAW7C,SAASoZ,EAAeC,EAAWC,EAAeC,GAC9Cre,KAAKmC,YAAY,OAAWmc,sCAAuCJ,GACnEle,KAAKmC,YAAY,OAAWoc,kCAAmC,GAAGJ,GAC9DC,GACApe,KAAKmC,YAAY,OAAWqc,sCAAuCJ,GAEnEC,GACAre,KAAKmC,YAAY,OAAWsc,sCAAuCJ,GAG3E,mBAAmBvZ,EAAMC,EAAO+V,GAC5B9a,KAAK+d,iBAAiBW,mBAAmB5Z,EAAMC,EAAO+V,GAQ1D","file":"js/RepeatSentence~62e5b568.ff5b5f06.js","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/**\n * An abstract base class that defines callback methods (write() and close()) for\n * custom audio output streams).\n * @class PushAudioOutputStreamCallback\n */\nexport class PushAudioOutputStreamCallback {\n}\n\n//# sourceMappingURL=PushAudioOutputStreamCallback.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/**\n * Represents audio stream format used for custom audio input configurations.\n * @class AudioStreamFormat\n */\nexport class AudioStreamFormat {\n /**\n * Creates an audio stream format object representing the default audio stream\n * format (16KHz 16bit mono PCM).\n * @member AudioStreamFormat.getDefaultInputFormat\n * @function\n * @public\n * @returns {AudioStreamFormat} The audio stream format being created.\n */\n static getDefaultInputFormat() {\n return AudioStreamFormatImpl.getDefaultInputFormat();\n }\n /**\n * Creates an audio stream format object with the specified pcm waveformat characteristics.\n * @member AudioStreamFormat.getWaveFormatPCM\n * @function\n * @public\n * @param {number} samplesPerSecond - Sample rate, in samples per second (Hertz).\n * @param {number} bitsPerSample - Bits per sample, typically 16.\n * @param {number} channels - Number of channels in the waveform-audio data. Monaural data\n * uses one channel and stereo data uses two channels.\n * @returns {AudioStreamFormat} The audio stream format being created.\n */\n static getWaveFormatPCM(samplesPerSecond, bitsPerSample, channels) {\n return new AudioStreamFormatImpl(samplesPerSecond, bitsPerSample, channels);\n }\n}\n/**\n * @private\n * @class AudioStreamFormatImpl\n */\n// tslint:disable-next-line:max-classes-per-file\nexport class AudioStreamFormatImpl extends AudioStreamFormat {\n /**\n * Creates an instance with the given values.\n * @constructor\n * @param {number} samplesPerSec - Samples per second.\n * @param {number} bitsPerSample - Bits per sample.\n * @param {number} channels - Number of channels.\n */\n constructor(samplesPerSec = 16000, bitsPerSample = 16, channels = 1) {\n super();\n this.setString = (view, offset, str) => {\n for (let i = 0; i < str.length; i++) {\n view.setUint8(offset + i, str.charCodeAt(i));\n }\n };\n this.formatTag = 1;\n this.bitsPerSample = bitsPerSample;\n this.samplesPerSec = samplesPerSec;\n this.channels = channels;\n this.avgBytesPerSec = this.samplesPerSec * this.channels * (this.bitsPerSample / 8);\n this.blockAlign = this.channels * Math.max(this.bitsPerSample, 8);\n this.privHeader = new ArrayBuffer(44);\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView\n const view = new DataView(this.privHeader);\n /* RIFF identifier */\n this.setString(view, 0, \"RIFF\");\n /* file length */\n view.setUint32(4, 0, true);\n /* RIFF type & Format */\n this.setString(view, 8, \"WAVEfmt \");\n /* format chunk length */\n view.setUint32(16, 16, true);\n /* sample format (raw) */\n view.setUint16(20, 1, true);\n /* channel count */\n view.setUint16(22, this.channels, true);\n /* sample rate */\n view.setUint32(24, this.samplesPerSec, true);\n /* byte rate (sample rate * block align) */\n view.setUint32(28, this.avgBytesPerSec, true);\n /* block align (channel count * bytes per sample) */\n view.setUint16(32, this.channels * (this.bitsPerSample / 8), true);\n /* bits per sample */\n view.setUint16(34, this.bitsPerSample, true);\n /* data chunk identifier */\n this.setString(view, 36, \"data\");\n /* data chunk length */\n view.setUint32(40, 0, true);\n }\n /**\n * Retrieves the default input format.\n * @member AudioStreamFormatImpl.getDefaultInputFormat\n * @function\n * @public\n * @returns {AudioStreamFormatImpl} The default input format.\n */\n static getDefaultInputFormat() {\n return new AudioStreamFormatImpl();\n }\n /**\n * Creates an audio context appropriate to current browser\n * @member AudioStreamFormatImpl.getAudioContext\n * @function\n * @public\n * @returns {AudioContext} An audio context instance\n */\n static getAudioContext(sampleRate) {\n // Workaround for Speech SDK bug in Safari.\n const AudioContext = window.AudioContext // our preferred impl\n || window.webkitAudioContext // fallback, mostly when on Safari\n || false; // could not find.\n // https://developer.mozilla.org/en-US/docs/Web/API/AudioContext\n if (!!AudioContext) {\n if (sampleRate !== undefined && navigator.mediaDevices.getSupportedConstraints().sampleRate) {\n return new AudioContext({ sampleRate });\n }\n else {\n return new AudioContext();\n }\n }\n else {\n throw new Error(\"Browser does not support Web Audio API (AudioContext is not available).\");\n }\n }\n /**\n * Closes the configuration object.\n * @member AudioStreamFormatImpl.prototype.close\n * @function\n * @public\n */\n close() { return; }\n get header() {\n return this.privHeader;\n }\n}\n\n//# sourceMappingURL=AudioStreamFormat.js.map\n","//\n// Copyright (c) Microsoft. All rights reserved.\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\n//\nimport { HeaderNames } from \"../common.speech/HeaderNames\";\nimport { MessageType } from \"../common/Exports\";\nimport { PropertyCollection } from \"./PropertyCollection\";\nimport { PropertyId } from \"./PropertyId\";\n/**\n * ConnectionMessage represents implementation specific messages sent to and received from\n * the speech service. These messages are provided for debugging purposes and should not\n * be used for production use cases with the Azure Cognitive Services Speech Service.\n * Messages sent to and received from the Speech Service are subject to change without\n * notice. This includes message contents, headers, payloads, ordering, etc.\n * Added in version 1.11.0.\n */\nexport class ConnectionMessage {\n}\n// tslint:disable-next-line:max-classes-per-file\nexport class ConnectionMessageImpl {\n constructor(message) {\n this.privConnectionMessage = message;\n this.privProperties = new PropertyCollection();\n if (!!this.privConnectionMessage.headers[HeaderNames.ConnectionId]) {\n this.privProperties.setProperty(PropertyId.Speech_SessionId, this.privConnectionMessage.headers[HeaderNames.ConnectionId]);\n }\n Object.keys(this.privConnectionMessage.headers).forEach((header, index, array) => {\n this.privProperties.setProperty(header, this.privConnectionMessage.headers[header]);\n });\n }\n /**\n * The message path.\n */\n get path() {\n return this.privConnectionMessage.headers[Object.keys(this.privConnectionMessage.headers).find((key) => key.toLowerCase() === \"path\".toLowerCase())];\n }\n /**\n * Checks to see if the ConnectionMessage is a text message.\n * See also IsBinaryMessage().\n */\n get isTextMessage() {\n return this.privConnectionMessage.messageType === MessageType.Text;\n }\n /**\n * Checks to see if the ConnectionMessage is a binary message.\n * See also GetBinaryMessage().\n */\n get isBinaryMessage() {\n return this.privConnectionMessage.messageType === MessageType.Binary;\n }\n /**\n * Gets the text message payload. Typically the text message content-type is\n * application/json. To determine other content-types use\n * Properties.GetProperty(\"Content-Type\").\n */\n get TextMessage() {\n return this.privConnectionMessage.textBody;\n }\n /**\n * Gets the binary message payload.\n */\n get binaryMessage() {\n return this.privConnectionMessage.binaryBody;\n }\n /**\n * A collection of properties and their values defined for this .\n * Message headers can be accessed via this collection (e.g. \"Content-Type\").\n */\n get properties() {\n return this.privProperties;\n }\n /**\n * Returns a string that represents the connection message.\n */\n toString() {\n return \"\";\n }\n}\n\n//# sourceMappingURL=ConnectionMessage.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/**\n * An abstract base class that defines callback methods (read() and close()) for\n * custom audio input streams).\n * @class PullAudioInputStreamCallback\n */\nexport class PullAudioInputStreamCallback {\n}\n\n//# sourceMappingURL=PullAudioInputStreamCallback.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { FileAudioSource, MicAudioSource, PcmRecorder, } from \"../../common.browser/Exports\";\nimport { Contracts } from \"../Contracts\";\nimport { AudioInputStream, PullAudioInputStreamCallback, PullAudioOutputStream, PushAudioOutputStream, PushAudioOutputStreamCallback, SpeakerAudioDestination } from \"../Exports\";\nimport { AudioFileWriter } from \"./AudioFileWriter\";\nimport { PullAudioInputStreamImpl } from \"./AudioInputStream\";\nimport { PushAudioOutputStreamImpl } from \"./AudioOutputStream\";\n/**\n * Represents audio input configuration used for specifying what type of input to use (microphone, file, stream).\n * @class AudioConfig\n * Updated in version 1.11.0\n */\nexport class AudioConfig {\n /**\n * Creates an AudioConfig object representing the default microphone on the system.\n * @member AudioConfig.fromDefaultMicrophoneInput\n * @function\n * @public\n * @returns {AudioConfig} The audio input configuration being created.\n */\n static fromDefaultMicrophoneInput() {\n const pcmRecorder = new PcmRecorder();\n return new AudioConfigImpl(new MicAudioSource(pcmRecorder));\n }\n /**\n * Creates an AudioConfig object representing a microphone with the specified device ID.\n * @member AudioConfig.fromMicrophoneInput\n * @function\n * @public\n * @param {string | undefined} deviceId - Specifies the device ID of the microphone to be used.\n * Default microphone is used the value is omitted.\n * @returns {AudioConfig} The audio input configuration being created.\n */\n static fromMicrophoneInput(deviceId) {\n const pcmRecorder = new PcmRecorder();\n return new AudioConfigImpl(new MicAudioSource(pcmRecorder, deviceId));\n }\n /**\n * Creates an AudioConfig object representing the specified file.\n * @member AudioConfig.fromWavFileInput\n * @function\n * @public\n * @param {File} fileName - Specifies the audio input file. Currently, only WAV / PCM is supported.\n * @returns {AudioConfig} The audio input configuration being created.\n */\n static fromWavFileInput(file) {\n return new AudioConfigImpl(new FileAudioSource(file));\n }\n /**\n * Creates an AudioConfig object representing the specified stream.\n * @member AudioConfig.fromStreamInput\n * @function\n * @public\n * @param {AudioInputStream | PullAudioInputStreamCallback | MediaStream} audioStream - Specifies the custom audio input\n * stream. Currently, only WAV / PCM is supported.\n * @returns {AudioConfig} The audio input configuration being created.\n */\n static fromStreamInput(audioStream) {\n if (audioStream instanceof PullAudioInputStreamCallback) {\n return new AudioConfigImpl(new PullAudioInputStreamImpl(audioStream));\n }\n if (audioStream instanceof AudioInputStream) {\n return new AudioConfigImpl(audioStream);\n }\n if (audioStream instanceof MediaStream) {\n const pcmRecorder = new PcmRecorder();\n return new AudioConfigImpl(new MicAudioSource(pcmRecorder, null, null, audioStream));\n }\n throw new Error(\"Not Supported Type\");\n }\n /**\n * Creates an AudioConfig object representing the default speaker.\n * @member AudioConfig.fromDefaultSpeakerOutput\n * @function\n * @public\n * @returns {AudioConfig} The audio output configuration being created.\n * Added in version 1.11.0\n */\n static fromDefaultSpeakerOutput() {\n return new AudioOutputConfigImpl(new SpeakerAudioDestination());\n }\n /**\n * Creates an AudioConfig object representing the custom IPlayer object.\n * You can use the IPlayer object to control pause, resume, etc.\n * @member AudioConfig.fromSpeakerOutput\n * @function\n * @public\n * @param {IPlayer} player - the IPlayer object for playback.\n * @returns {AudioConfig} The audio output configuration being created.\n * Added in version 1.12.0\n */\n static fromSpeakerOutput(player) {\n if (player === undefined) {\n return AudioConfig.fromDefaultSpeakerOutput();\n }\n if (player instanceof SpeakerAudioDestination) {\n return new AudioOutputConfigImpl(player);\n }\n throw new Error(\"Not Supported Type\");\n }\n /**\n * Creates an AudioConfig object representing a specified output audio file\n * @member AudioConfig.fromAudioFileOutput\n * @function\n * @public\n * @param {PathLike} filename - the filename of the output audio file\n * @returns {AudioConfig} The audio output configuration being created.\n * Added in version 1.11.0\n */\n static fromAudioFileOutput(filename) {\n return new AudioOutputConfigImpl(new AudioFileWriter(filename));\n }\n /**\n * Creates an AudioConfig object representing a specified audio output stream\n * @member AudioConfig.fromStreamOutput\n * @function\n * @public\n * @param {AudioOutputStream | PushAudioOutputStreamCallback} audioStream - Specifies the custom audio output\n * stream.\n * @returns {AudioConfig} The audio output configuration being created.\n * Added in version 1.11.0\n */\n static fromStreamOutput(audioStream) {\n if (audioStream instanceof PushAudioOutputStreamCallback) {\n return new AudioOutputConfigImpl(new PushAudioOutputStreamImpl(audioStream));\n }\n if (audioStream instanceof PushAudioOutputStream) {\n return new AudioOutputConfigImpl(audioStream);\n }\n if (audioStream instanceof PullAudioOutputStream) {\n return new AudioOutputConfigImpl(audioStream);\n }\n throw new Error(\"Not Supported Type\");\n }\n}\n/**\n * Represents audio input stream used for custom audio input configurations.\n * @private\n * @class AudioConfigImpl\n */\nexport class AudioConfigImpl extends AudioConfig {\n /**\n * Creates and initializes an instance of this class.\n * @constructor\n * @param {IAudioSource} source - An audio source.\n */\n constructor(source) {\n super();\n this.privSource = source;\n }\n /**\n * Format information for the audio\n */\n get format() {\n return this.privSource.format;\n }\n /**\n * @member AudioConfigImpl.prototype.close\n * @function\n * @public\n */\n close(cb, err) {\n this.privSource.turnOff().then(() => {\n if (!!cb) {\n cb();\n }\n }, (error) => {\n if (!!err) {\n err(error);\n }\n });\n }\n /**\n * @member AudioConfigImpl.prototype.id\n * @function\n * @public\n */\n id() {\n return this.privSource.id();\n }\n /**\n * @member AudioConfigImpl.prototype.blob\n * @function\n * @public\n */\n get blob() {\n return this.privSource.blob;\n }\n /**\n * @member AudioConfigImpl.prototype.turnOn\n * @function\n * @public\n * @returns {Promise} A promise.\n */\n turnOn() {\n return this.privSource.turnOn();\n }\n /**\n * @member AudioConfigImpl.prototype.attach\n * @function\n * @public\n * @param {string} audioNodeId - The audio node id.\n * @returns {Promise} A promise.\n */\n attach(audioNodeId) {\n return this.privSource.attach(audioNodeId);\n }\n /**\n * @member AudioConfigImpl.prototype.detach\n * @function\n * @public\n * @param {string} audioNodeId - The audio node id.\n */\n detach(audioNodeId) {\n return this.privSource.detach(audioNodeId);\n }\n /**\n * @member AudioConfigImpl.prototype.turnOff\n * @function\n * @public\n * @returns {Promise} A promise.\n */\n turnOff() {\n return this.privSource.turnOff();\n }\n /**\n * @member AudioConfigImpl.prototype.events\n * @function\n * @public\n * @returns {EventSource} An event source for audio events.\n */\n get events() {\n return this.privSource.events;\n }\n setProperty(name, value) {\n Contracts.throwIfNull(value, \"value\");\n if (undefined !== this.privSource.setProperty) {\n this.privSource.setProperty(name, value);\n }\n else {\n throw new Error(\"This AudioConfig instance does not support setting properties.\");\n }\n }\n getProperty(name, def) {\n if (undefined !== this.privSource.getProperty) {\n return this.privSource.getProperty(name, def);\n }\n else {\n throw new Error(\"This AudioConfig instance does not support getting properties.\");\n }\n return def;\n }\n get deviceInfo() {\n return this.privSource.deviceInfo;\n }\n}\nexport class AudioOutputConfigImpl extends AudioConfig {\n /**\n * Creates and initializes an instance of this class.\n * @constructor\n * @param {IAudioDestination} destination - An audio destination.\n */\n constructor(destination) {\n super();\n this.privDestination = destination;\n }\n set format(format) {\n this.privDestination.format = format;\n }\n write(buffer) {\n this.privDestination.write(buffer);\n }\n close() {\n this.privDestination.close();\n }\n id() {\n return this.privDestination.id();\n }\n setProperty(name, value) {\n throw new Error(\"This AudioConfig instance does not support setting properties.\");\n }\n getProperty(name, def) {\n throw new Error(\"This AudioConfig instance does not support getting properties.\");\n }\n}\n\n//# sourceMappingURL=AudioConfig.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { SynthesisAdapterBase } from \"../../common.speech/Exports\";\nimport { BackgroundEvent, createNoDashGuid, Events } from \"../../common/Exports\";\nimport { AudioFormatTag } from \"./AudioOutputFormat\";\nimport { PullAudioOutputStreamImpl } from \"./AudioOutputStream\";\nconst MediaDurationPlaceholderSeconds = 60 * 30;\nconst AudioFormatToMimeType = {\n [AudioFormatTag.PCM]: \"audio/wav\",\n [AudioFormatTag.MP3]: \"audio/mpeg\",\n [AudioFormatTag.Opus]: \"audio/ogg\",\n};\n/**\n * Represents the speaker playback audio destination, which only works in browser.\n * Note: the SDK will try to use Media Source Extensions to play audio.\n * Mp3 format has better supports on Microsoft Edge, Chrome and Safari (desktop), so, it's better to specify mp3 format for playback.\n * @class SpeakerAudioDestination\n * Updated in version 1.12.1\n */\nexport class SpeakerAudioDestination {\n constructor(audioDestinationId) {\n this.privPlaybackStarted = false;\n this.privAppendingToBuffer = false;\n this.privMediaSourceOpened = false;\n this.privBytesReceived = 0;\n this.privId = audioDestinationId ? audioDestinationId : createNoDashGuid();\n this.privIsPaused = false;\n this.privIsClosed = false;\n }\n id() {\n return this.privId;\n }\n write(buffer, cb, err) {\n if (this.privAudioBuffer !== undefined) {\n this.privAudioBuffer.push(buffer);\n this.updateSourceBuffer().then(() => {\n if (!!cb) {\n cb();\n }\n }, (error) => {\n if (!!err) {\n err(error);\n }\n });\n }\n else if (this.privAudioOutputStream !== undefined) {\n this.privAudioOutputStream.write(buffer);\n this.privBytesReceived += buffer.byteLength;\n }\n }\n close(cb, err) {\n this.privIsClosed = true;\n if (this.privSourceBuffer !== undefined) {\n this.handleSourceBufferUpdateEnd().then(() => {\n if (!!cb) {\n cb();\n }\n }, (error) => {\n if (!!err) {\n err(error);\n }\n });\n }\n else if (this.privAudioOutputStream !== undefined) {\n let receivedAudio = new ArrayBuffer(this.privBytesReceived);\n this.privAudioOutputStream.read(receivedAudio).then((_) => {\n if (this.privFormat.hasHeader) {\n receivedAudio = SynthesisAdapterBase.addHeader(receivedAudio, this.privFormat);\n }\n const audioBlob = new Blob([receivedAudio], { type: AudioFormatToMimeType[this.privFormat.formatTag] });\n this.privAudio.src = window.URL.createObjectURL(audioBlob);\n this.notifyPlayback().then(() => {\n if (!!cb) {\n cb();\n }\n }, (error) => {\n if (!!err) {\n err(error);\n }\n });\n }, (error) => {\n if (!!err) {\n err(error);\n }\n });\n }\n }\n set format(format) {\n if (typeof (AudioContext) !== \"undefined\" || typeof (window.webkitAudioContext) !== \"undefined\") {\n this.privFormat = format;\n const mimeType = AudioFormatToMimeType[this.privFormat.formatTag];\n if (mimeType === undefined) {\n // tslint:disable-next-line:no-console\n console.warn(`Unknown mimeType for format ${AudioFormatTag[this.privFormat.formatTag]}.`);\n }\n else if (typeof (MediaSource) !== \"undefined\" && MediaSource.isTypeSupported(mimeType)) {\n this.privAudio = new Audio();\n this.privAudioBuffer = [];\n this.privMediaSource = new MediaSource();\n this.privAudio.src = URL.createObjectURL(this.privMediaSource);\n this.privAudio.load();\n this.privMediaSource.onsourceopen = (event) => {\n this.privMediaSourceOpened = true;\n this.privMediaSource.duration = MediaDurationPlaceholderSeconds;\n this.privSourceBuffer = this.privMediaSource.addSourceBuffer(mimeType);\n this.privSourceBuffer.onupdate = (_) => {\n this.updateSourceBuffer().catch((reason) => {\n Events.instance.onEvent(new BackgroundEvent(reason));\n });\n };\n this.privSourceBuffer.onupdateend = (_) => {\n this.handleSourceBufferUpdateEnd().catch((reason) => {\n Events.instance.onEvent(new BackgroundEvent(reason));\n });\n };\n this.privSourceBuffer.onupdatestart = (_) => {\n this.privAppendingToBuffer = false;\n };\n };\n this.updateSourceBuffer().catch((reason) => {\n Events.instance.onEvent(new BackgroundEvent(reason));\n });\n }\n else {\n // tslint:disable-next-line:no-console\n console.warn(`Format ${AudioFormatTag[this.privFormat.formatTag]} could not be played by MSE, streaming playback is not enabled.`);\n this.privAudioOutputStream = new PullAudioOutputStreamImpl();\n this.privAudioOutputStream.format = this.privFormat;\n this.privAudio = new Audio();\n }\n }\n }\n get isClosed() {\n return this.privIsClosed;\n }\n get currentTime() {\n if (this.privAudio !== undefined) {\n return this.privAudio.currentTime;\n }\n return -1;\n }\n pause() {\n if (!this.privIsPaused && this.privAudio !== undefined) {\n this.privAudio.pause();\n this.privIsPaused = true;\n }\n }\n resume(cb, err) {\n if (this.privIsPaused && this.privAudio !== undefined) {\n this.privAudio.play().then(() => {\n if (!!cb) {\n cb();\n }\n }, (error) => {\n if (!!err) {\n err(error);\n }\n });\n this.privIsPaused = false;\n }\n }\n get internalAudio() {\n return this.privAudio;\n }\n updateSourceBuffer() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.privAudioBuffer !== undefined && (this.privAudioBuffer.length > 0) && this.sourceBufferAvailable()) {\n this.privAppendingToBuffer = true;\n const binary = this.privAudioBuffer.shift();\n try {\n this.privSourceBuffer.appendBuffer(binary);\n }\n catch (error) {\n this.privAudioBuffer.unshift(binary);\n // tslint:disable-next-line:no-console\n console.log(\"buffer filled, pausing addition of binaries until space is made\");\n return;\n }\n yield this.notifyPlayback();\n }\n else if (this.canEndStream()) {\n yield this.handleSourceBufferUpdateEnd();\n }\n });\n }\n handleSourceBufferUpdateEnd() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.canEndStream() && this.sourceBufferAvailable()) {\n this.privMediaSource.endOfStream();\n yield this.notifyPlayback();\n }\n });\n }\n notifyPlayback() {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.privPlaybackStarted && this.privAudio !== undefined) {\n this.privAudio.onended = () => {\n if (!!this.onAudioEnd) {\n this.onAudioEnd(this);\n }\n };\n if (!this.privIsPaused) {\n yield this.privAudio.play();\n }\n this.privPlaybackStarted = true;\n }\n });\n }\n canEndStream() {\n return (this.isClosed && this.privSourceBuffer !== undefined && (this.privAudioBuffer.length === 0)\n && this.privMediaSourceOpened && !this.privAppendingToBuffer && this.privMediaSource.readyState === \"open\");\n }\n sourceBufferAvailable() {\n return (this.privSourceBuffer !== undefined && !this.privSourceBuffer.updating);\n }\n}\n\n//# sourceMappingURL=SpeakerAudioDestination.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { CancellationEventArgsBase, } from \"./CancellationEventArgsBase\";\n/**\n * Defines content of a RecognitionErrorEvent.\n * @class ConversationTranscriptionCanceledEventArgs\n */\nexport class ConversationTranscriptionCanceledEventArgs extends CancellationEventArgsBase {\n}\n\n//# sourceMappingURL=ConversationTranscriptionCanceledEventArgs.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { SpeechSynthesisOutputFormat } from \"../SpeechSynthesisOutputFormat\";\nimport { AudioStreamFormatImpl } from \"./AudioStreamFormat\";\nexport var AudioFormatTag;\n(function (AudioFormatTag) {\n AudioFormatTag[AudioFormatTag[\"PCM\"] = 1] = \"PCM\";\n AudioFormatTag[AudioFormatTag[\"MuLaw\"] = 2] = \"MuLaw\";\n AudioFormatTag[AudioFormatTag[\"Siren\"] = 3] = \"Siren\";\n AudioFormatTag[AudioFormatTag[\"MP3\"] = 4] = \"MP3\";\n AudioFormatTag[AudioFormatTag[\"SILKSkype\"] = 5] = \"SILKSkype\";\n AudioFormatTag[AudioFormatTag[\"Opus\"] = 6] = \"Opus\";\n})(AudioFormatTag || (AudioFormatTag = {}));\n/**\n * @private\n * @class AudioOutputFormatImpl\n * Added in version 1.11.0\n */\n// tslint:disable-next-line:max-classes-per-file\nexport class AudioOutputFormatImpl extends AudioStreamFormatImpl {\n /**\n * Creates an instance with the given values.\n * @constructor\n * @param formatTag\n * @param {number} channels - Number of channels.\n * @param {number} samplesPerSec - Samples per second.\n * @param {number} avgBytesPerSec - Average bytes per second.\n * @param {number} blockAlign - Block alignment.\n * @param {number} bitsPerSample - Bits per sample.\n * @param {string} audioFormatString - Audio format string\n * @param {string} requestAudioFormatString - Audio format string sent to service.\n * @param {boolean} hasHeader - If the format has header or not.\n */\n constructor(formatTag, channels, samplesPerSec, avgBytesPerSec, blockAlign, bitsPerSample, audioFormatString, requestAudioFormatString, hasHeader) {\n super(samplesPerSec, bitsPerSample, channels);\n this.formatTag = formatTag;\n this.avgBytesPerSec = avgBytesPerSec;\n this.blockAlign = blockAlign;\n this.priAudioFormatString = audioFormatString;\n this.priRequestAudioFormatString = requestAudioFormatString;\n this.priHasHeader = hasHeader;\n }\n static fromSpeechSynthesisOutputFormat(speechSynthesisOutputFormat) {\n if (speechSynthesisOutputFormat === undefined) {\n return AudioOutputFormatImpl.getDefaultOutputFormat();\n }\n return AudioOutputFormatImpl.fromSpeechSynthesisOutputFormatString(AudioOutputFormatImpl.SpeechSynthesisOutputFormatToString[speechSynthesisOutputFormat]);\n }\n static fromSpeechSynthesisOutputFormatString(speechSynthesisOutputFormatString) {\n switch (speechSynthesisOutputFormatString) {\n case \"raw-8khz-8bit-mono-mulaw\":\n return new AudioOutputFormatImpl(AudioFormatTag.PCM, 1, 8000, 8000, 1, 8, speechSynthesisOutputFormatString, speechSynthesisOutputFormatString, false);\n case \"riff-16khz-16kbps-mono-siren\":\n return new AudioOutputFormatImpl(AudioFormatTag.Siren, 1, 16000, 2000, 40, 0, speechSynthesisOutputFormatString, \"audio-16khz-16kbps-mono-siren\", true);\n case \"audio-16khz-16kbps-mono-siren\":\n return new AudioOutputFormatImpl(AudioFormatTag.Siren, 1, 16000, 2000, 40, 0, speechSynthesisOutputFormatString, speechSynthesisOutputFormatString, false);\n case \"audio-16khz-32kbitrate-mono-mp3\":\n return new AudioOutputFormatImpl(AudioFormatTag.MP3, 1, 16000, 32 << 7, 2, 16, speechSynthesisOutputFormatString, speechSynthesisOutputFormatString, false);\n case \"audio-16khz-128kbitrate-mono-mp3\":\n return new AudioOutputFormatImpl(AudioFormatTag.MP3, 1, 16000, 128 << 7, 2, 16, speechSynthesisOutputFormatString, speechSynthesisOutputFormatString, false);\n case \"audio-16khz-64kbitrate-mono-mp3\":\n return new AudioOutputFormatImpl(AudioFormatTag.MP3, 1, 16000, 64 << 7, 2, 16, speechSynthesisOutputFormatString, speechSynthesisOutputFormatString, false);\n case \"audio-24khz-48kbitrate-mono-mp3\":\n return new AudioOutputFormatImpl(AudioFormatTag.MP3, 1, 24000, 48 << 7, 2, 16, speechSynthesisOutputFormatString, speechSynthesisOutputFormatString, false);\n case \"audio-24khz-96kbitrate-mono-mp3\":\n return new AudioOutputFormatImpl(AudioFormatTag.MP3, 1, 24000, 96 << 7, 2, 16, speechSynthesisOutputFormatString, speechSynthesisOutputFormatString, false);\n case \"audio-24khz-160kbitrate-mono-mp3\":\n return new AudioOutputFormatImpl(AudioFormatTag.MP3, 1, 24000, 160 << 7, 2, 16, speechSynthesisOutputFormatString, speechSynthesisOutputFormatString, false);\n case \"raw-16khz-16bit-mono-truesilk\":\n return new AudioOutputFormatImpl(AudioFormatTag.SILKSkype, 1, 16000, 32000, 2, 16, speechSynthesisOutputFormatString, speechSynthesisOutputFormatString, false);\n case \"riff-8khz-16bit-mono-pcm\":\n return new AudioOutputFormatImpl(AudioFormatTag.PCM, 1, 8000, 16000, 2, 16, speechSynthesisOutputFormatString, \"raw-8khz-16bit-mono-pcm\", true);\n case \"riff-24khz-16bit-mono-pcm\":\n return new AudioOutputFormatImpl(AudioFormatTag.PCM, 1, 24000, 48000, 2, 16, speechSynthesisOutputFormatString, \"raw-24khz-16bit-mono-pcm\", true);\n case \"riff-8khz-8bit-mono-mulaw\":\n return new AudioOutputFormatImpl(AudioFormatTag.MuLaw, 1, 8000, 8000, 1, 8, speechSynthesisOutputFormatString, \"raw-8khz-8bit-mono-mulaw\", true);\n case \"raw-16khz-16bit-mono-pcm\":\n return new AudioOutputFormatImpl(AudioFormatTag.PCM, 1, 16000, 32000, 2, 16, speechSynthesisOutputFormatString, \"raw-16khz-16bit-mono-pcm\", false);\n case \"raw-24khz-16bit-mono-pcm\":\n return new AudioOutputFormatImpl(AudioFormatTag.PCM, 1, 24000, 48000, 2, 16, speechSynthesisOutputFormatString, \"raw-24khz-16bit-mono-pcm\", false);\n case \"raw-8khz-16bit-mono-pcm\":\n return new AudioOutputFormatImpl(AudioFormatTag.PCM, 1, 8000, 16000, 2, 16, speechSynthesisOutputFormatString, \"raw-8khz-16bit-mono-pcm\", false);\n case \"ogg-16khz-16bit-mono-opus\":\n return new AudioOutputFormatImpl(AudioFormatTag.Opus, 1, 16000, 8192, 2, 16, speechSynthesisOutputFormatString, \"ogg-16khz-16bit-mono-opus\", false);\n case \"ogg-24khz-16bit-mono-opus\":\n return new AudioOutputFormatImpl(AudioFormatTag.Opus, 1, 24000, 8192, 2, 16, speechSynthesisOutputFormatString, \"ogg-24khz-16bit-mono-opus\", false);\n case \"raw-48khz-16bit-mono-pcm\":\n return new AudioOutputFormatImpl(AudioFormatTag.PCM, 1, 48000, 96000, 2, 16, speechSynthesisOutputFormatString, \"raw-48khz-16bit-mono-pcm\", false);\n case \"riff-48khz-16bit-mono-pcm\":\n return new AudioOutputFormatImpl(AudioFormatTag.PCM, 1, 48000, 96000, 2, 16, speechSynthesisOutputFormatString, \"raw-48khz-16bit-mono-pcm\", true);\n case \"audio-48khz-96kbitrate-mono-mp3\":\n return new AudioOutputFormatImpl(AudioFormatTag.MP3, 1, 48000, 96 << 7, 2, 16, speechSynthesisOutputFormatString, speechSynthesisOutputFormatString, false);\n case \"audio-48khz-192kbitrate-mono-mp3\":\n return new AudioOutputFormatImpl(AudioFormatTag.MP3, 1, 48000, 192 << 7, 2, 16, speechSynthesisOutputFormatString, speechSynthesisOutputFormatString, false);\n case \"riff-16khz-16bit-mono-pcm\":\n default:\n return new AudioOutputFormatImpl(AudioFormatTag.PCM, 1, 16000, 32000, 2, 16, \"riff-16khz-16bit-mono-pcm\", \"raw-16khz-16bit-mono-pcm\", true);\n }\n }\n static getDefaultOutputFormat() {\n return AudioOutputFormatImpl.fromSpeechSynthesisOutputFormatString((typeof window !== \"undefined\") ? \"audio-24khz-48kbitrate-mono-mp3\" : \"riff-16khz-16bit-mono-pcm\");\n }\n /**\n * Specifies if this audio output format has a header\n * @boolean AudioOutputFormatImpl.prototype.hasHeader\n * @function\n * @public\n */\n get hasHeader() {\n return this.priHasHeader;\n }\n /**\n * Specifies the header of this format\n * @ArrayBuffer AudioOutputFormatImpl.prototype.header\n * @function\n * @public\n */\n get header() {\n if (this.hasHeader) {\n return this.privHeader;\n }\n return undefined;\n }\n /**\n * Updates the header based on the audio length\n * @member AudioOutputFormatImpl.updateHeader\n * @function\n * @public\n * @param {number} audioLength - the audio length\n */\n updateHeader(audioLength) {\n if (this.priHasHeader) {\n const view = new DataView(this.privHeader);\n view.setUint32(40, audioLength, true);\n }\n }\n /**\n * Specifies the audio format string to be sent to the service\n * @string AudioOutputFormatImpl.prototype.requestAudioFormatString\n * @function\n * @public\n */\n get requestAudioFormatString() {\n return this.priRequestAudioFormatString;\n }\n}\nAudioOutputFormatImpl.SpeechSynthesisOutputFormatToString = {\n [SpeechSynthesisOutputFormat.Raw8Khz8BitMonoMULaw]: \"raw-8khz-8bit-mono-mulaw\",\n [SpeechSynthesisOutputFormat.Riff16Khz16KbpsMonoSiren]: \"riff-16khz-16kbps-mono-siren\",\n [SpeechSynthesisOutputFormat.Audio16Khz16KbpsMonoSiren]: \"audio-16khz-16kbps-mono-siren\",\n [SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3]: \"audio-16khz-32kbitrate-mono-mp3\",\n [SpeechSynthesisOutputFormat.Audio16Khz128KBitRateMonoMp3]: \"audio-16khz-128kbitrate-mono-mp3\",\n [SpeechSynthesisOutputFormat.Audio16Khz64KBitRateMonoMp3]: \"audio-16khz-64kbitrate-mono-mp3\",\n [SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3]: \"audio-24khz-48kbitrate-mono-mp3\",\n [SpeechSynthesisOutputFormat.Audio24Khz96KBitRateMonoMp3]: \"audio-24khz-96kbitrate-mono-mp3\",\n [SpeechSynthesisOutputFormat.Audio24Khz160KBitRateMonoMp3]: \"audio-24khz-160kbitrate-mono-mp3\",\n [SpeechSynthesisOutputFormat.Raw16Khz16BitMonoTrueSilk]: \"raw-16khz-16bit-mono-truesilk\",\n [SpeechSynthesisOutputFormat.Riff16Khz16BitMonoPcm]: \"riff-16khz-16bit-mono-pcm\",\n [SpeechSynthesisOutputFormat.Riff8Khz16BitMonoPcm]: \"riff-8khz-16bit-mono-pcm\",\n [SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm]: \"riff-24khz-16bit-mono-pcm\",\n [SpeechSynthesisOutputFormat.Riff8Khz8BitMonoMULaw]: \"riff-8khz-8bit-mono-mulaw\",\n [SpeechSynthesisOutputFormat.Raw16Khz16BitMonoPcm]: \"raw-16khz-16bit-mono-pcm\",\n [SpeechSynthesisOutputFormat.Raw24Khz16BitMonoPcm]: \"raw-24khz-16bit-mono-pcm\",\n [SpeechSynthesisOutputFormat.Raw8Khz16BitMonoPcm]: \"raw-8khz-16bit-mono-pcm\",\n [SpeechSynthesisOutputFormat.Ogg16Khz16BitMonoOpus]: \"ogg-16khz-16bit-mono-opus\",\n [SpeechSynthesisOutputFormat.Ogg24Khz16BitMonoOpus]: \"ogg-24khz-16bit-mono-opus\",\n [SpeechSynthesisOutputFormat.Raw48Khz16BitMonoPcm]: \"raw-48khz-16bit-mono-pcm\",\n [SpeechSynthesisOutputFormat.Riff48Khz16BitMonoPcm]: \"riff-48khz-16bit-mono-pcm\",\n [SpeechSynthesisOutputFormat.Audio48Khz96KBitRateMonoMp3]: \"audio-48khz-96kbitrate-mono-mp3\",\n [SpeechSynthesisOutputFormat.Audio48Khz192KBitRateMonoMp3]: \"audio-48khz-192kbitrate-mono-mp3\",\n};\n\n//# sourceMappingURL=AudioOutputFormat.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n// tslint:disable:max-classes-per-file\nimport { connectivity, type, } from \"../../common.speech/Exports\";\nimport { AudioSourceInitializingEvent, AudioSourceReadyEvent, AudioStreamNodeAttachedEvent, AudioStreamNodeAttachingEvent, AudioStreamNodeDetachedEvent, ChunkedArrayBufferStream, Events, EventSource, } from \"../../common/Exports\";\nimport { createNoDashGuid } from \"../../common/Guid\";\nimport { AudioStreamFormat } from \"../Exports\";\nimport { AudioStreamFormatImpl } from \"./AudioStreamFormat\";\n/**\n * Represents audio input stream used for custom audio input configurations.\n * @class AudioInputStream\n */\nexport class AudioInputStream {\n /**\n * Creates and initializes an instance.\n * @constructor\n */\n constructor() { }\n /**\n * Creates a memory backed PushAudioInputStream with the specified audio format.\n * @member AudioInputStream.createPushStream\n * @function\n * @public\n * @param {AudioStreamFormat} format - The audio data format in which audio will be\n * written to the push audio stream's write() method (Required if format is not 16 kHz 16bit mono PCM).\n * @returns {PushAudioInputStream} The audio input stream being created.\n */\n static createPushStream(format) {\n return PushAudioInputStream.create(format);\n }\n /**\n * Creates a PullAudioInputStream that delegates to the specified callback interface for read()\n * and close() methods.\n * @member AudioInputStream.createPullStream\n * @function\n * @public\n * @param {PullAudioInputStreamCallback} callback - The custom audio input object, derived from\n * PullAudioInputStreamCallback\n * @param {AudioStreamFormat} format - The audio data format in which audio will be returned from\n * the callback's read() method (Required if format is not 16 kHz 16bit mono PCM).\n * @returns {PullAudioInputStream} The audio input stream being created.\n */\n static createPullStream(callback, format) {\n return PullAudioInputStream.create(callback, format);\n // throw new Error(\"Oops\");\n }\n}\n/**\n * Represents memory backed push audio input stream used for custom audio input configurations.\n * @class PushAudioInputStream\n */\nexport class PushAudioInputStream extends AudioInputStream {\n /**\n * Creates a memory backed PushAudioInputStream with the specified audio format.\n * @member PushAudioInputStream.create\n * @function\n * @public\n * @param {AudioStreamFormat} format - The audio data format in which audio will be written to the\n * push audio stream's write() method (Required if format is not 16 kHz 16bit mono PCM).\n * @returns {PushAudioInputStream} The push audio input stream being created.\n */\n static create(format) {\n return new PushAudioInputStreamImpl(format);\n }\n}\n/**\n * Represents memory backed push audio input stream used for custom audio input configurations.\n * @private\n * @class PushAudioInputStreamImpl\n */\nexport class PushAudioInputStreamImpl extends PushAudioInputStream {\n /**\n * Creates and initalizes an instance with the given values.\n * @constructor\n * @param {AudioStreamFormat} format - The audio stream format.\n */\n constructor(format) {\n super();\n this.onEvent = (event) => {\n this.privEvents.onEvent(event);\n Events.instance.onEvent(event);\n };\n if (format === undefined) {\n this.privFormat = AudioStreamFormatImpl.getDefaultInputFormat();\n }\n else {\n this.privFormat = format;\n }\n this.privEvents = new EventSource();\n this.privId = createNoDashGuid();\n this.privStream = new ChunkedArrayBufferStream(this.privFormat.avgBytesPerSec / 10);\n }\n /**\n * Format information for the audio\n */\n get format() {\n return Promise.resolve(this.privFormat);\n }\n /**\n * Writes the audio data specified by making an internal copy of the data.\n * @member PushAudioInputStreamImpl.prototype.write\n * @function\n * @public\n * @param {ArrayBuffer} dataBuffer - The audio buffer of which this function will make a copy.\n */\n write(dataBuffer) {\n this.privStream.writeStreamChunk({\n buffer: dataBuffer,\n isEnd: false,\n timeReceived: Date.now()\n });\n }\n /**\n * Closes the stream.\n * @member PushAudioInputStreamImpl.prototype.close\n * @function\n * @public\n */\n close() {\n this.privStream.close();\n }\n id() {\n return this.privId;\n }\n get blob() {\n return this.attach(\"id\").then((audioNode) => {\n const data = [];\n let bufferData = Buffer.from(\"\");\n const readCycle = () => {\n return audioNode.read().then((audioStreamChunk) => {\n if (!audioStreamChunk || audioStreamChunk.isEnd) {\n if (typeof (XMLHttpRequest) !== \"undefined\" && typeof (Blob) !== \"undefined\") {\n return Promise.resolve(new Blob(data));\n }\n else {\n return Promise.resolve(Buffer.from(bufferData));\n }\n }\n else {\n if (typeof (Blob) !== \"undefined\") {\n data.push(audioStreamChunk.buffer);\n }\n else {\n bufferData = Buffer.concat([bufferData, this.toBuffer(audioStreamChunk.buffer)]);\n }\n return readCycle();\n }\n });\n };\n return readCycle();\n });\n }\n turnOn() {\n this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\n this.onEvent(new AudioSourceReadyEvent(this.privId));\n return;\n }\n attach(audioNodeId) {\n return __awaiter(this, void 0, void 0, function* () {\n this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\n yield this.turnOn();\n const stream = this.privStream;\n this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\n return {\n detach: () => __awaiter(this, void 0, void 0, function* () {\n stream.readEnded();\n this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\n return this.turnOff();\n }),\n id: () => {\n return audioNodeId;\n },\n read: () => {\n return stream.read();\n },\n };\n });\n }\n detach(audioNodeId) {\n this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\n }\n turnOff() {\n return;\n }\n get events() {\n return this.privEvents;\n }\n get deviceInfo() {\n return Promise.resolve({\n bitspersample: this.privFormat.bitsPerSample,\n channelcount: this.privFormat.channels,\n connectivity: connectivity.Unknown,\n manufacturer: \"Speech SDK\",\n model: \"PushStream\",\n samplerate: this.privFormat.samplesPerSec,\n type: type.Stream,\n });\n }\n toBuffer(arrayBuffer) {\n const buf = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n for (let i = 0; i < buf.length; ++i) {\n buf[i] = view[i];\n }\n return buf;\n }\n}\n/*\n * Represents audio input stream used for custom audio input configurations.\n * @class PullAudioInputStream\n */\nexport class PullAudioInputStream extends AudioInputStream {\n /**\n * Creates and initializes and instance.\n * @constructor\n */\n constructor() { super(); }\n /**\n * Creates a PullAudioInputStream that delegates to the specified callback interface for\n * read() and close() methods, using the default format (16 kHz 16bit mono PCM).\n * @member PullAudioInputStream.create\n * @function\n * @public\n * @param {PullAudioInputStreamCallback} callback - The custom audio input object,\n * derived from PullAudioInputStreamCustomCallback\n * @param {AudioStreamFormat} format - The audio data format in which audio will be\n * returned from the callback's read() method (Required if format is not 16 kHz 16bit mono PCM).\n * @returns {PullAudioInputStream} The push audio input stream being created.\n */\n static create(callback, format) {\n return new PullAudioInputStreamImpl(callback, format);\n }\n}\n/**\n * Represents audio input stream used for custom audio input configurations.\n * @private\n * @class PullAudioInputStreamImpl\n */\nexport class PullAudioInputStreamImpl extends PullAudioInputStream {\n /**\n * Creates a PullAudioInputStream that delegates to the specified callback interface for\n * read() and close() methods, using the default format (16 kHz 16bit mono PCM).\n * @constructor\n * @param {PullAudioInputStreamCallback} callback - The custom audio input object,\n * derived from PullAudioInputStreamCustomCallback\n * @param {AudioStreamFormat} format - The audio data format in which audio will be\n * returned from the callback's read() method (Required if format is not 16 kHz 16bit mono PCM).\n */\n constructor(callback, format) {\n super();\n this.onEvent = (event) => {\n this.privEvents.onEvent(event);\n Events.instance.onEvent(event);\n };\n if (undefined === format) {\n this.privFormat = AudioStreamFormat.getDefaultInputFormat();\n }\n else {\n this.privFormat = format;\n }\n this.privEvents = new EventSource();\n this.privId = createNoDashGuid();\n this.privCallback = callback;\n this.privIsClosed = false;\n this.privBufferSize = this.privFormat.avgBytesPerSec / 10;\n }\n /**\n * Format information for the audio\n */\n get format() {\n return Promise.resolve(this.privFormat);\n }\n /**\n * Closes the stream.\n * @member PullAudioInputStreamImpl.prototype.close\n * @function\n * @public\n */\n close() {\n this.privIsClosed = true;\n this.privCallback.close();\n }\n id() {\n return this.privId;\n }\n get blob() {\n return Promise.reject(\"Not implemented\");\n }\n turnOn() {\n this.onEvent(new AudioSourceInitializingEvent(this.privId)); // no stream id\n this.onEvent(new AudioSourceReadyEvent(this.privId));\n return;\n }\n attach(audioNodeId) {\n return __awaiter(this, void 0, void 0, function* () {\n this.onEvent(new AudioStreamNodeAttachingEvent(this.privId, audioNodeId));\n yield this.turnOn();\n this.onEvent(new AudioStreamNodeAttachedEvent(this.privId, audioNodeId));\n return {\n detach: () => {\n this.privCallback.close();\n this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\n return this.turnOff();\n },\n id: () => {\n return audioNodeId;\n },\n read: () => {\n let totalBytes = 0;\n let transmitBuff;\n // Until we have the minimum number of bytes to send in a transmission, keep asking for more.\n while (totalBytes < this.privBufferSize) {\n // Sizing the read buffer to the delta between the perfect size and what's left means we won't ever get too much\n // data back.\n const readBuff = new ArrayBuffer(this.privBufferSize - totalBytes);\n const pulledBytes = this.privCallback.read(readBuff);\n // If there is no return buffer yet defined, set the return buffer to the that was just populated.\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\n // preferred size allocated.\n if (undefined === transmitBuff) {\n transmitBuff = readBuff;\n }\n else {\n // Not the first bite at the apple, so fill the return buffer with the data we got back.\n const intView = new Int8Array(transmitBuff);\n intView.set(new Int8Array(readBuff), totalBytes);\n }\n // If there are no bytes to read, just break out and be done.\n if (0 === pulledBytes) {\n break;\n }\n totalBytes += pulledBytes;\n }\n return Promise.resolve({\n buffer: transmitBuff.slice(0, totalBytes),\n isEnd: this.privIsClosed || totalBytes === 0,\n timeReceived: Date.now(),\n });\n },\n };\n });\n }\n detach(audioNodeId) {\n this.onEvent(new AudioStreamNodeDetachedEvent(this.privId, audioNodeId));\n }\n turnOff() {\n return;\n }\n get events() {\n return this.privEvents;\n }\n get deviceInfo() {\n return Promise.resolve({\n bitspersample: this.privFormat.bitsPerSample,\n channelcount: this.privFormat.channels,\n connectivity: connectivity.Unknown,\n manufacturer: \"Speech SDK\",\n model: \"PullStream\",\n samplerate: this.privFormat.samplesPerSec,\n type: type.Stream,\n });\n }\n}\n\n//# sourceMappingURL=AudioInputStream.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/**\n * Defines contents of received message/events.\n * @class ActivityReceivedEventArgs\n */\nexport class ActivityReceivedEventArgs {\n /**\n * Creates and initializes an instance of this class.\n * @constructor\n * @param {any} activity - The activity..\n */\n constructor(activity, audioStream) {\n this.privActivity = activity;\n this.privAudioStream = audioStream;\n }\n /**\n * Gets the received activity\n * @member ActivityReceivedEventArgs.prototype.activity\n * @function\n * @public\n * @returns {any} the received activity.\n */\n get activity() {\n return this.privActivity;\n }\n get audioStream() {\n return this.privAudioStream;\n }\n}\n\n//# sourceMappingURL=ActivityReceivedEventArgs.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/**\n * @class Contracts\n * @private\n */\nexport class Contracts {\n static throwIfNullOrUndefined(param, name) {\n if (param === undefined || param === null) {\n throw new Error(\"throwIfNullOrUndefined:\" + name);\n }\n }\n static throwIfNull(param, name) {\n if (param === null) {\n throw new Error(\"throwIfNull:\" + name);\n }\n }\n static throwIfNullOrWhitespace(param, name) {\n Contracts.throwIfNullOrUndefined(param, name);\n if ((\"\" + param).trim().length < 1) {\n throw new Error(\"throwIfNullOrWhitespace:\" + name);\n }\n }\n static throwIfDisposed(isDisposed) {\n if (isDisposed) {\n throw new Error(\"the object is already disposed\");\n }\n }\n static throwIfArrayEmptyOrWhitespace(array, name) {\n Contracts.throwIfNullOrUndefined(array, name);\n if (array.length === 0) {\n throw new Error(\"throwIfArrayEmptyOrWhitespace:\" + name);\n }\n for (const item of array) {\n Contracts.throwIfNullOrWhitespace(item, name);\n }\n }\n static throwIfFileDoesNotExist(param, name) {\n Contracts.throwIfNullOrWhitespace(param, name);\n // TODO check for file existence.\n }\n static throwIfNotUndefined(param, name) {\n if (param !== undefined) {\n throw new Error(\"throwIfNotUndefined:\" + name);\n }\n }\n}\n\n//# sourceMappingURL=Contracts.js.map\n","//\n// Copyright (c) Microsoft. All rights reserved.\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\n//\nimport { ServiceRecognizerBase, SynthesisAdapterBase, } from \"../common.speech/Exports\";\nimport { marshalPromiseToCallbacks, } from \"../common/Exports\";\nimport { ConnectionMessageImpl } from \"./ConnectionMessage\";\nimport { Contracts } from \"./Contracts\";\nimport { ConnectionEventArgs, ConnectionMessageEventArgs, ServiceEventArgs, } from \"./Exports\";\n/**\n * Connection is a proxy class for managing connection to the speech service of the specified Recognizer.\n * By default, a Recognizer autonomously manages connection to service when needed.\n * The Connection class provides additional methods for users to explicitly open or close a connection and\n * to subscribe to connection status changes.\n * The use of Connection is optional, and mainly for scenarios where fine tuning of application\n * behavior based on connection status is needed. Users can optionally call Open() to manually set up a connection\n * in advance before starting recognition on the Recognizer associated with this Connection.\n * If the Recognizer needs to connect or disconnect to service, it will\n * setup or shutdown the connection independently. In this case the Connection will be notified by change of connection\n * status via Connected/Disconnected events.\n * Added in version 1.2.1.\n */\nexport class Connection {\n /**\n * Gets the Connection instance from the specified recognizer.\n * @param recognizer The recognizer associated with the connection.\n * @return The Connection instance of the recognizer.\n */\n static fromRecognizer(recognizer) {\n const recoBase = recognizer.internalData;\n const ret = new Connection();\n ret.privInternalData = recoBase;\n ret.setupEvents();\n return ret;\n }\n /**\n * Gets the Connection instance from the specified synthesizer.\n * @param synthesizer The synthesizer associated with the connection.\n * @return The Connection instance of the synthesizer.\n */\n static fromSynthesizer(synthesizer) {\n const synthBase = synthesizer.internalData;\n const ret = new Connection();\n ret.privInternalData = synthBase;\n ret.setupEvents();\n return ret;\n }\n /**\n * Starts to set up connection to the service.\n * Users can optionally call openConnection() to manually set up a connection in advance before starting recognition on the\n * Recognizer associated with this Connection. After starting recognition, calling Open() will have no effect\n *\n * Note: On return, the connection might not be ready yet. Please subscribe to the Connected event to\n * be notified when the connection is established.\n */\n openConnection(cb, err) {\n marshalPromiseToCallbacks(this.privInternalData.connect(), cb, err);\n }\n /**\n * Closes the connection the service.\n * Users can optionally call closeConnection() to manually shutdown the connection of the associated Recognizer.\n *\n * If closeConnection() is called during recognition, recognition will fail and cancel with an error.\n */\n closeConnection(cb, err) {\n if (this.privInternalData instanceof SynthesisAdapterBase) {\n throw new Error(\"Disconnecting a synthesizer's connection is currently not supported\");\n }\n else {\n marshalPromiseToCallbacks(this.privInternalData.disconnect(), cb, err);\n }\n }\n /**\n * Appends a parameter in a message to service.\n * Added in version 1.12.1.\n * @param path The path of the network message.\n * @param propertyName Name of the property\n * @param propertyValue Value of the property. This is a json string.\n */\n setMessageProperty(path, propertyName, propertyValue) {\n Contracts.throwIfNullOrWhitespace(propertyName, \"propertyName\");\n if (this.privInternalData instanceof ServiceRecognizerBase) {\n if (path.toLowerCase() !== \"speech.context\") {\n throw new Error(\"Only speech.context message property sets are currently supported for recognizer\");\n }\n else {\n this.privInternalData.speechContext.setSection(propertyName, propertyValue);\n }\n }\n else if (this.privInternalData instanceof SynthesisAdapterBase) {\n if (path.toLowerCase() !== \"synthesis.context\") {\n throw new Error(\"Only synthesis.context message property sets are currently supported for synthesizer\");\n }\n else {\n this.privInternalData.synthesisContext.setSection(propertyName, propertyValue);\n }\n }\n }\n /**\n * Sends a message to the speech service.\n * Added in version 1.13.0.\n * @param path The WebSocket path of the message\n * @param payload The payload of the message. This is a json string or a ArrayBuffer.\n * @param success A callback to indicate success.\n * @param error A callback to indicate an error.\n */\n sendMessageAsync(path, payload, success, error) {\n marshalPromiseToCallbacks(this.privInternalData.sendNetworkMessage(path, payload), success, error);\n }\n /**\n * Dispose of associated resources.\n */\n close() {\n /* tslint:disable:no-empty */\n }\n setupEvents() {\n this.privEventListener = this.privInternalData.connectionEvents.attach((connectionEvent) => {\n if (connectionEvent.name === \"ConnectionEstablishedEvent\") {\n if (!!this.connected) {\n this.connected(new ConnectionEventArgs(connectionEvent.connectionId));\n }\n }\n else if (connectionEvent.name === \"ConnectionClosedEvent\") {\n if (!!this.disconnected) {\n this.disconnected(new ConnectionEventArgs(connectionEvent.connectionId));\n }\n }\n else if (connectionEvent.name === \"ConnectionMessageSentEvent\") {\n if (!!this.messageSent) {\n this.messageSent(new ConnectionMessageEventArgs(new ConnectionMessageImpl(connectionEvent.message)));\n }\n }\n else if (connectionEvent.name === \"ConnectionMessageReceivedEvent\") {\n if (!!this.messageReceived) {\n this.messageReceived(new ConnectionMessageEventArgs(new ConnectionMessageImpl(connectionEvent.message)));\n }\n }\n });\n this.privServiceEventListener = this.privInternalData.serviceEvents.attach((e) => {\n if (!!this.receivedServiceMessage) {\n this.receivedServiceMessage(new ServiceEventArgs(e.jsonString, e.name));\n }\n });\n }\n}\n\n//# sourceMappingURL=Connection.js.map\n","//\n// Copyright (c) Microsoft. All rights reserved.\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\n//\nexport class ConnectionMessageEventArgs {\n constructor(message) {\n this.privConnectionMessage = message;\n }\n /**\n * Gets the associated with this .\n */\n get message() {\n return this.privConnectionMessage;\n }\n /**\n * Returns a string that represents the connection message event.\n */\n toString() {\n return \"Message: \" + this.privConnectionMessage.toString();\n }\n}\n\n//# sourceMappingURL=ConnectionMessageEventArgs.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/**\n * Contains detailed information about why a result was canceled.\n * @class CancellationDetailsBase\n */\nexport class CancellationDetailsBase {\n /**\n * Creates and initializes an instance of this class.\n * @constructor\n * @param {CancellationReason} reason - The cancellation reason.\n * @param {string} errorDetails - The error details, if provided.\n */\n constructor(reason, errorDetails, errorCode) {\n this.privReason = reason;\n this.privErrorDetails = errorDetails;\n this.privErrorCode = errorCode;\n }\n /**\n * The reason the recognition was canceled.\n * @member CancellationDetailsBase.prototype.reason\n * @function\n * @public\n * @returns {CancellationReason} Specifies the reason canceled.\n */\n get reason() {\n return this.privReason;\n }\n /**\n * In case of an unsuccessful recognition, provides details of the occurred error.\n * @member CancellationDetailsBase.prototype.errorDetails\n * @function\n * @public\n * @returns {string} A String that represents the error details.\n */\n get errorDetails() {\n return this.privErrorDetails;\n }\n /**\n * The error code in case of an unsuccessful recognition.\n * Added in version 1.1.0.\n * @return An error code that represents the error reason.\n */\n get ErrorCode() {\n return this.privErrorCode;\n }\n}\n\n//# sourceMappingURL=CancellationDetailsBase.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { CancellationErrorCodePropertyName, EnumTranslation, SimpleSpeechPhrase } from \"../common.speech/Exports\";\nimport { CancellationDetailsBase } from \"./CancellationDetailsBase\";\nimport { CancellationErrorCode, CancellationReason, RecognitionResult } from \"./Exports\";\n/**\n * Contains detailed information about why a result was canceled.\n * @class CancellationDetails\n */\nexport class CancellationDetails extends CancellationDetailsBase {\n constructor(reason, errorDetails, errorCode) {\n super(reason, errorDetails, errorCode);\n }\n /**\n * Creates an instance of CancellationDetails object for the canceled RecognitionResult.\n * @member CancellationDetails.fromResult\n * @function\n * @public\n * @param {RecognitionResult | SpeechSynthesisResult} result - The result that was canceled.\n * @returns {CancellationDetails} The cancellation details object being created.\n */\n static fromResult(result) {\n let reason = CancellationReason.Error;\n let errorCode = CancellationErrorCode.NoError;\n if (result instanceof RecognitionResult && !!result.json) {\n const simpleSpeech = SimpleSpeechPhrase.fromJSON(result.json);\n reason = EnumTranslation.implTranslateCancelResult(simpleSpeech.RecognitionStatus);\n }\n if (!!result.properties) {\n errorCode = CancellationErrorCode[result.properties.getProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.NoError])];\n }\n return new CancellationDetails(reason, result.errorDetails, errorCode);\n }\n}\n\n//# sourceMappingURL=CancellationDetails.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { Contracts } from \"./Contracts\";\nimport { DialogServiceConfig, DialogServiceConfigImpl } from \"./DialogServiceConfig\";\nimport { PropertyId } from \"./Exports\";\n/**\n * Class that defines configurations for the dialog service connector object for using a Bot Framework backend.\n * @class BotFrameworkConfig\n */\nexport class BotFrameworkConfig extends DialogServiceConfigImpl {\n /**\n * Creates an instance of BotFrameworkConfig.\n */\n constructor() {\n super();\n }\n /**\n * Creates a bot framework configuration instance with the provided subscription information.\n * @member BotFrameworkConfig.fromSubscription\n * @function\n * @public\n * @param subscription Subscription key associated with the bot\n * @param region The region name (see the region page).\n * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\n * resource name.\n * @returns {BotFrameworkConfig} A new bot framework configuration instance.\n */\n static fromSubscription(subscription, region, botId) {\n Contracts.throwIfNullOrWhitespace(subscription, \"subscription\");\n Contracts.throwIfNullOrWhitespace(region, \"region\");\n const botFrameworkConfig = new DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(PropertyId.Conversation_DialogType, DialogServiceConfig.DialogTypes.BotFramework);\n botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscription);\n botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\n if (botId) {\n botFrameworkConfig.setProperty(PropertyId.Conversation_ApplicationId, botId);\n }\n return botFrameworkConfig;\n }\n /**\n * Creates a bot framework configuration instance for the specified authorization token and region.\n * Note: The caller must ensure that an authorization token is valid. Before an authorization token expires, the\n * caller must refresh it by setting the authorizationToken property on the corresponding\n * DialogServiceConnector instance created with this config. The contents of configuration objects are copied\n * when connectors are created, so setting authorizationToken on a DialogServiceConnector will not update the\n * original configuration's authorization token. Create a new configuration instance or set the\n * SpeechServiceAuthorization_Token property to update an existing instance if it will be used to create\n * further DialogServiceConnectors.\n * @member BotFrameworkConfig.fromAuthorizationToken\n * @function\n * @public\n * @param authorizationToken The authorization token associated with the bot\n * @param region The region name (see the region page).\n * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\n * resource name.\n * @returns {BotFrameworkConfig} A new bot framework configuration instance.\n */\n static fromAuthorizationToken(authorizationToken, region, botId) {\n Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\n Contracts.throwIfNullOrWhitespace(region, \"region\");\n const botFrameworkConfig = new DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(PropertyId.Conversation_DialogType, DialogServiceConfig.DialogTypes.BotFramework);\n botFrameworkConfig.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\n botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\n if (botId) {\n botFrameworkConfig.setProperty(PropertyId.Conversation_ApplicationId, botId);\n }\n return botFrameworkConfig;\n }\n /**\n * Creates an instance of a BotFrameworkConfig.\n * This method is intended only for users who use a non-default service host. The standard resource path will be\n * assumed. For services with a non-standard resource path or no path at all, use fromEndpoint instead.\n * Note: Query parameters are not allowed in the host URI and must be set by other APIs.\n * Note: To use an authorization token with fromHost, use fromHost(URL) and then set the AuthorizationToken\n * property on the created BotFrameworkConfig instance.\n * Note: Added in version 1.15.0.\n * @member BotFrameworkConfig.fromHost\n * @function\n * @public\n * @param {URL | string} host - If a URL is provided, the fully-qualified host with protocol (e.g.\n * wss://your.host.com:1234) will be used. If a string is provided, it will be embedded in\n * wss://{host}.convai.speech.azure.us.\n * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization\n * token must be set.\n * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\n * resource name.\n * @returns {BotFrameworkConfig} A new bot framework configuration instance.\n */\n static fromHost(host, subscriptionKey, botId) {\n Contracts.throwIfNullOrUndefined(host, \"host\");\n const resolvedHost = host instanceof URL ? host : new URL(`wss://${host}.convai.speech.azure.us`);\n Contracts.throwIfNullOrUndefined(resolvedHost, \"resolvedHost\");\n const botFrameworkConfig = new DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(PropertyId.Conversation_DialogType, DialogServiceConfig.DialogTypes.BotFramework);\n botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Host, resolvedHost.toString());\n if (undefined !== subscriptionKey) {\n botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\n }\n return botFrameworkConfig;\n }\n /**\n * Creates an instance of a BotFrameworkConfig.\n * This method is intended only for users who use a non-standard service endpoint or parameters.\n * Note: The query parameters specified in the endpoint URL are not changed, even if they are set by any other APIs.\n * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\n * fromEndpoint method, and then set authorizationToken=\"token\" on the created BotFrameworkConfig instance to\n * use the authorization token.\n * Note: Added in version 1.15.0.\n * @member BotFrameworkConfig.fromEndpoint\n * @function\n * @public\n * @param {URL} endpoint - The service endpoint to connect to.\n * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization\n * token must be set.\n * @returns {BotFrameworkConfig} - A new bot framework configuration instance using the provided endpoint.\n */\n static fromEndpoint(endpoint, subscriptionKey) {\n Contracts.throwIfNull(endpoint, \"endpoint\");\n const botFrameworkConfig = new DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(PropertyId.Conversation_DialogType, DialogServiceConfig.DialogTypes.BotFramework);\n botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.toString());\n if (undefined !== subscriptionKey) {\n botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\n }\n return botFrameworkConfig;\n }\n}\n\n//# sourceMappingURL=BotFrameworkConfig.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { Contracts } from \"./Contracts\";\nimport { DialogServiceConfig, DialogServiceConfigImpl } from \"./DialogServiceConfig\";\nimport { PropertyId } from \"./Exports\";\n/**\n * Class that defines configurations for the dialog service connector object for using a CustomCommands backend.\n * @class CustomCommandsConfig\n */\nexport class CustomCommandsConfig extends DialogServiceConfigImpl {\n /**\n * Creates an instance of CustomCommandsConfig.\n */\n constructor() {\n super();\n }\n /**\n * Creates an instance of the bot framework config with the specified subscription and region.\n * @member CustomCommandsConfig.fromSubscription\n * @function\n * @public\n * @param applicationId Speech Commands application id.\n * @param subscription Subscription key associated with the bot\n * @param region The region name (see the region page).\n * @returns {CustomCommandsConfig} A new bot framework config.\n */\n static fromSubscription(applicationId, subscription, region) {\n Contracts.throwIfNullOrWhitespace(applicationId, \"applicationId\");\n Contracts.throwIfNullOrWhitespace(subscription, \"subscription\");\n Contracts.throwIfNullOrWhitespace(region, \"region\");\n const customCommandsConfig = new DialogServiceConfigImpl();\n customCommandsConfig.setProperty(PropertyId.Conversation_DialogType, DialogServiceConfig.DialogTypes.CustomCommands);\n customCommandsConfig.setProperty(PropertyId.Conversation_ApplicationId, applicationId);\n customCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscription);\n customCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\n return customCommandsConfig;\n }\n /**\n * Creates an instance of the bot framework config with the specified Speech Commands application id, authorization token and region.\n * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\n * expires, the caller needs to refresh it by calling this setter with a new valid token.\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.\n * For recognizers that have been created before, you need to set authorization token of the corresponding recognizer\n * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\n * @member CustomCommandsConfig.fromAuthorizationToken\n * @function\n * @public\n * @param applicationId Speech Commands application id.\n * @param authorizationToken The authorization token associated with the application.\n * @param region The region name (see the region page).\n * @returns {CustomCommandsConfig} A new speech commands config.\n */\n static fromAuthorizationToken(applicationId, authorizationToken, region) {\n Contracts.throwIfNullOrWhitespace(applicationId, \"applicationId\");\n Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\n Contracts.throwIfNullOrWhitespace(region, \"region\");\n const customCommandsConfig = new DialogServiceConfigImpl();\n customCommandsConfig.setProperty(PropertyId.Conversation_DialogType, DialogServiceConfig.DialogTypes.CustomCommands);\n customCommandsConfig.setProperty(PropertyId.Conversation_ApplicationId, applicationId);\n customCommandsConfig.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\n customCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\n return customCommandsConfig;\n }\n /**\n * Sets the corresponding backend application identifier.\n * @member CustomCommandsConfig.prototype.Conversation_ApplicationId\n * @function\n * @public\n * @param {string} value - The application identifier to set.\n */\n set applicationId(value) {\n Contracts.throwIfNullOrWhitespace(value, \"value\");\n this.setProperty(PropertyId.Conversation_ApplicationId, value);\n }\n /**\n * Gets the corresponding backend application identifier.\n * @member CustomCommandsConfig.prototype.Conversation_ApplicationId\n * @function\n * @public\n * @param {string} value - The application identifier to get.\n */\n get applicationId() {\n return this.getProperty(PropertyId.Conversation_ApplicationId);\n }\n}\n\n//# sourceMappingURL=CustomCommandsConfig.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { DialogConnectionFactory } from \"../common.speech/DialogConnectorFactory\";\nimport { DialogServiceAdapter, RecognitionMode, RecognizerConfig, } from \"../common.speech/Exports\";\nimport { Deferred, marshalPromiseToCallbacks } from \"../common/Exports\";\nimport { Contracts } from \"./Contracts\";\nimport { Recognizer } from \"./Exports\";\nimport { PropertyId } from \"./PropertyId\";\nimport { SpeechSynthesisOutputFormat } from \"./SpeechSynthesisOutputFormat\";\n/**\n * Dialog Service Connector\n * @class DialogServiceConnector\n */\nexport class DialogServiceConnector extends Recognizer {\n /**\n * Initializes an instance of the DialogServiceConnector.\n * @constructor\n * @param {DialogServiceConfig} dialogConfig - Set of properties to configure this recognizer.\n * @param {AudioConfig} audioConfig - An optional audio config associated with the recognizer\n */\n constructor(dialogConfig, audioConfig) {\n const dialogServiceConfigImpl = dialogConfig;\n Contracts.throwIfNull(dialogConfig, \"dialogConfig\");\n super(audioConfig, dialogServiceConfigImpl.properties, new DialogConnectionFactory());\n this.isTurnComplete = true;\n this.privIsDisposed = false;\n this.privProperties = dialogServiceConfigImpl.properties.clone();\n const agentConfig = this.buildAgentConfig();\n this.privReco.agentConfig.set(agentConfig);\n }\n /**\n * Starts a connection to the service.\n * Users can optionally call connect() to manually set up a connection in advance, before starting interactions.\n *\n * Note: On return, the connection might not be ready yet. Please subscribe to the Connected event to\n * be notified when the connection is established.\n * @member DialogServiceConnector.prototype.connect\n * @function\n * @public\n */\n connect(cb, err) {\n marshalPromiseToCallbacks(this.privReco.connect(), cb, err);\n }\n /**\n * Closes the connection the service.\n * Users can optionally call disconnect() to manually shutdown the connection of the associated DialogServiceConnector.\n *\n * If disconnect() is called during a recognition, recognition will fail and cancel with an error.\n */\n disconnect(cb, err) {\n marshalPromiseToCallbacks(this.privReco.disconnect(), cb, err);\n }\n /**\n * Gets the authorization token used to communicate with the service.\n * @member DialogServiceConnector.prototype.authorizationToken\n * @function\n * @public\n * @returns {string} Authorization token.\n */\n get authorizationToken() {\n return this.properties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\n }\n /**\n * Sets the authorization token used to communicate with the service.\n * @member DialogServiceConnector.prototype.authorizationToken\n * @function\n * @public\n * @param {string} token - Authorization token.\n */\n set authorizationToken(token) {\n Contracts.throwIfNullOrWhitespace(token, \"token\");\n this.properties.setProperty(PropertyId.SpeechServiceAuthorization_Token, token);\n }\n /**\n * The collection of properties and their values defined for this DialogServiceConnector.\n * @member DialogServiceConnector.prototype.properties\n * @function\n * @public\n * @returns {PropertyCollection} The collection of properties and their values defined for this DialogServiceConnector.\n */\n get properties() {\n return this.privProperties;\n }\n /** Gets the template for the activity generated by service from speech.\n * Properties from the template will be stamped on the generated activity.\n * It can be empty\n */\n get speechActivityTemplate() {\n return this.properties.getProperty(PropertyId.Conversation_Speech_Activity_Template);\n }\n /** Sets the template for the activity generated by service from speech.\n * Properties from the template will be stamped on the generated activity.\n * It can be null or empty.\n * Note: it has to be a valid Json object.\n */\n set speechActivityTemplate(speechActivityTemplate) {\n this.properties.setProperty(PropertyId.Conversation_Speech_Activity_Template, speechActivityTemplate);\n }\n /**\n * Starts recognition and stops after the first utterance is recognized.\n * @member DialogServiceConnector.prototype.listenOnceAsync\n * @function\n * @public\n * @param cb - Callback that received the result when the reco has completed.\n * @param err - Callback invoked in case of an error.\n */\n listenOnceAsync(cb, err) {\n if (this.isTurnComplete) {\n Contracts.throwIfDisposed(this.privIsDisposed);\n const callbackHolder = () => __awaiter(this, void 0, void 0, function* () {\n yield this.privReco.connect();\n yield this.implRecognizerStop();\n this.isTurnComplete = false;\n const ret = new Deferred();\n yield this.privReco.recognize(RecognitionMode.Conversation, ret.resolve, ret.reject);\n const e = yield ret.promise;\n yield this.implRecognizerStop();\n return e;\n });\n const retPromise = callbackHolder();\n retPromise.catch(() => {\n // Destroy the recognizer.\n /* tslint:disable:no-empty */ // We've done all we can here.\n this.dispose(true).catch(() => { });\n });\n marshalPromiseToCallbacks(retPromise.finally(() => {\n this.isTurnComplete = true;\n }), cb, err);\n }\n }\n sendActivityAsync(activity, cb, errCb) {\n marshalPromiseToCallbacks(this.privReco.sendMessage(activity), cb, errCb);\n }\n /**\n * closes all external resources held by an instance of this class.\n * @member DialogServiceConnector.prototype.close\n * @function\n * @public\n */\n close(cb, err) {\n Contracts.throwIfDisposed(this.privIsDisposed);\n marshalPromiseToCallbacks(this.dispose(true), cb, err);\n }\n dispose(disposing) {\n const _super = Object.create(null, {\n dispose: { get: () => super.dispose }\n });\n return __awaiter(this, void 0, void 0, function* () {\n if (this.privIsDisposed) {\n return;\n }\n if (disposing) {\n this.privIsDisposed = true;\n yield this.implRecognizerStop();\n yield _super.dispose.call(this, disposing);\n }\n });\n }\n createRecognizerConfig(speechConfig) {\n return new RecognizerConfig(speechConfig, this.privProperties);\n }\n createServiceRecognizer(authentication, connectionFactory, audioConfig, recognizerConfig) {\n const audioSource = audioConfig;\n return new DialogServiceAdapter(authentication, connectionFactory, audioSource, recognizerConfig, this);\n }\n buildAgentConfig() {\n const communicationType = this.properties.getProperty(\"Conversation_Communication_Type\", \"Default\");\n return {\n botInfo: {\n commType: communicationType,\n commandsCulture: undefined,\n connectionId: this.properties.getProperty(PropertyId.Conversation_Agent_Connection_Id),\n conversationId: this.properties.getProperty(PropertyId.Conversation_Conversation_Id, undefined),\n fromId: this.properties.getProperty(PropertyId.Conversation_From_Id, undefined),\n ttsAudioFormat: SpeechSynthesisOutputFormat[this.properties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined)]\n },\n version: 0.2\n };\n }\n}\n\n//# sourceMappingURL=DialogServiceConnector.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { InvalidOperationError } from \"../../common/Error\";\nimport { marshalPromiseToCallbacks } from \"../../common/Promise\";\nimport { AudioStreamFormat } from \"../Exports\";\nimport { AudioStreamFormatImpl } from \"./AudioStreamFormat\";\n/**\n * Base audio player class\n * TODO: Plays only PCM for now.\n * @class\n */\nexport class BaseAudioPlayer {\n /**\n * Creates and initializes an instance of this class.\n * @constructor\n * @param {AudioStreamFormat} audioFormat audio stream format recognized by the player.\n */\n constructor(audioFormat) {\n this.audioContext = null;\n this.gainNode = null;\n this.autoUpdateBufferTimer = 0;\n if (audioFormat === undefined) {\n audioFormat = AudioStreamFormat.getDefaultInputFormat();\n }\n this.init(audioFormat);\n }\n /**\n * play Audio sample\n * @param newAudioData audio data to be played.\n */\n playAudioSample(newAudioData, cb, err) {\n marshalPromiseToCallbacks((() => __awaiter(this, void 0, void 0, function* () {\n if (!!window.webkitAudioContext) {\n yield this.playAudio(newAudioData);\n }\n else {\n this.ensureInitializedContext();\n const audioData = this.formatAudioData(newAudioData);\n const newSamplesData = new Float32Array(this.samples.length + audioData.length);\n newSamplesData.set(this.samples, 0);\n newSamplesData.set(audioData, this.samples.length);\n this.samples = newSamplesData;\n }\n }))(), cb, err);\n }\n /**\n * stops audio and clears the buffers\n */\n stopAudio(cb, err) {\n if (this.audioContext !== null) {\n this.samples = new Float32Array();\n clearInterval(this.autoUpdateBufferTimer);\n this.audioContext.close().then(() => {\n if (!!cb) {\n cb();\n }\n }, (error) => {\n if (!!err) {\n err(error);\n }\n });\n this.audioContext = null;\n }\n }\n init(audioFormat) {\n this.audioFormat = audioFormat;\n this.samples = new Float32Array();\n }\n ensureInitializedContext() {\n if (this.audioContext === null) {\n this.createAudioContext();\n const timerPeriod = 200;\n this.autoUpdateBufferTimer = setInterval(() => {\n this.updateAudioBuffer();\n }, timerPeriod);\n }\n }\n createAudioContext() {\n // new ((window as any).AudioContext || (window as any).webkitAudioContext)();\n this.audioContext = AudioStreamFormatImpl.getAudioContext();\n // TODO: Various examples shows this gain node, it does not seem to be needed unless we plan\n // to control the volume, not likely\n this.gainNode = this.audioContext.createGain();\n this.gainNode.gain.value = 1;\n this.gainNode.connect(this.audioContext.destination);\n this.startTime = this.audioContext.currentTime;\n }\n formatAudioData(audioData) {\n switch (this.audioFormat.bitsPerSample) {\n case 8:\n return this.formatArrayBuffer(new Int8Array(audioData), 128);\n case 16:\n return this.formatArrayBuffer(new Int16Array(audioData), 32768);\n case 32:\n return this.formatArrayBuffer(new Int32Array(audioData), 2147483648);\n default:\n throw new InvalidOperationError(\"Only WAVE_FORMAT_PCM (8/16/32 bps) format supported at this time\");\n }\n }\n formatArrayBuffer(audioData, maxValue) {\n const float32Data = new Float32Array(audioData.length);\n for (let i = 0; i < audioData.length; i++) {\n float32Data[i] = audioData[i] / maxValue;\n }\n return float32Data;\n }\n updateAudioBuffer() {\n if (this.samples.length === 0) {\n return;\n }\n const channelCount = this.audioFormat.channels;\n const bufferSource = this.audioContext.createBufferSource();\n const frameCount = this.samples.length / channelCount;\n const audioBuffer = this.audioContext.createBuffer(channelCount, frameCount, this.audioFormat.samplesPerSec);\n // TODO: Should we do the conversion in the pushAudioSample instead?\n for (let channel = 0; channel < channelCount; channel++) {\n // Fill in individual channel data\n let channelOffset = channel;\n const audioData = audioBuffer.getChannelData(channel);\n for (let i = 0; i < this.samples.length; i++, channelOffset += channelCount) {\n audioData[i] = this.samples[channelOffset];\n }\n }\n if (this.startTime < this.audioContext.currentTime) {\n this.startTime = this.audioContext.currentTime;\n }\n bufferSource.buffer = audioBuffer;\n bufferSource.connect(this.gainNode);\n bufferSource.start(this.startTime);\n // Make sure we play the next sample after the current one.\n this.startTime += audioBuffer.duration;\n // Clear the samples for the next pushed data.\n this.samples = new Float32Array();\n }\n playAudio(audioData) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.audioContext === null) {\n this.createAudioContext();\n }\n const source = this.audioContext.createBufferSource();\n const destination = this.audioContext.destination;\n yield this.audioContext.decodeAudioData(audioData, (newBuffer) => {\n source.buffer = newBuffer;\n source.connect(destination);\n source.start(0);\n });\n });\n }\n}\n\n//# sourceMappingURL=BaseAudioPlayer.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { AutoDetectSourceLanguagesOpenRangeOptionName } from \"../common.speech/Exports\";\nimport { Contracts } from \"./Contracts\";\nimport { PropertyCollection, PropertyId, } from \"./Exports\";\n/**\n * Language auto detect configuration.\n * @class AutoDetectSourceLanguageConfig\n * Added in version 1.13.0.\n */\nexport class AutoDetectSourceLanguageConfig {\n constructor() {\n this.privProperties = new PropertyCollection();\n }\n /**\n * @member AutoDetectSourceLanguageConfig.fromOpenRange\n * @function\n * @public\n * Only [[SpeechSynthesizer]] supports source language auto detection from open range,\n * for [[Recognizer]], please use AutoDetectSourceLanguageConfig with specific source languages.\n * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\n * @summary Creates an instance of the AutoDetectSourceLanguageConfig with open range.\n */\n static fromOpenRange() {\n const config = new AutoDetectSourceLanguageConfig();\n config.properties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, AutoDetectSourceLanguagesOpenRangeOptionName);\n return config;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.fromLanguages\n * @function\n * @public\n * @param {string[]} languages Comma-separated string of languages (eg. \"en-US,fr-FR\") to populate properties of config.\n * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\n * @summary Creates an instance of the AutoDetectSourceLanguageConfig with given languages.\n */\n static fromLanguages(languages) {\n Contracts.throwIfArrayEmptyOrWhitespace(languages, \"languages\");\n const config = new AutoDetectSourceLanguageConfig();\n config.properties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, languages.join());\n return config;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.fromSourceLanguageConfigs\n * @function\n * @public\n * @param {SourceLanguageConfig[]} configs SourceLanguageConfigs to populate properties of config.\n * @return {AutoDetectSourceLanguageConfig} Instance of AutoDetectSourceLanguageConfig\n * @summary Creates an instance of the AutoDetectSourceLanguageConfig with given SourceLanguageConfigs.\n */\n static fromSourceLanguageConfigs(configs) {\n if (configs.length < 1) {\n throw new Error(\"Expected non-empty SourceLanguageConfig array.\");\n }\n const autoConfig = new AutoDetectSourceLanguageConfig();\n const langs = [];\n configs.forEach((config) => {\n langs.push(config.language);\n if (config.endpointId !== undefined && config.endpointId !== \"\") {\n const customProperty = config.language + PropertyId.SpeechServiceConnection_EndpointId.toString();\n autoConfig.properties.setProperty(customProperty, config.endpointId);\n }\n });\n autoConfig.properties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, langs.join());\n return autoConfig;\n }\n /**\n * @member AutoDetectSourceLanguageConfig.prototype.properties\n * @function\n * @public\n * @return {PropertyCollection} Properties of the config.\n * @summary Gets an auto detected language config properties\n */\n get properties() {\n return this.privProperties;\n }\n}\n\n//# sourceMappingURL=AutoDetectSourceLanguageConfig.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { Contracts } from \"./Contracts\";\n/**\n * Output format\n * @class AutoDetectSourceLanguageResult\n */\nexport class AutoDetectSourceLanguageResult {\n constructor(language, languageDetectionConfidence) {\n Contracts.throwIfNullOrUndefined(language, \"language\");\n Contracts.throwIfNullOrUndefined(languageDetectionConfidence, \"languageDetectionConfidence\");\n this.privLanguage = language;\n this.privLanguageDetectionConfidence = languageDetectionConfidence;\n }\n /**\n * Creates an instance of AutoDetectSourceLanguageResult object from a SpeechRecognitionResult instance.\n * @member AutoDetectSourceLanguageResult.fromResult\n * @function\n * @public\n * @param {SpeechRecognitionResult} result - The recognition result.\n * @returns {AutoDetectSourceLanguageResult} AutoDetectSourceLanguageResult object being created.\n */\n static fromResult(result) {\n return new AutoDetectSourceLanguageResult(result.language, result.languageDetectionConfidence);\n }\n get language() {\n return this.privLanguage;\n }\n get languageDetectionConfidence() {\n return this.privLanguageDetectionConfidence;\n }\n}\n\n//# sourceMappingURL=AutoDetectSourceLanguageResult.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/**\n * Defines error code in case that CancellationReason is Error.\n * Added in version 1.1.0.\n */\nexport var CancellationErrorCode;\n(function (CancellationErrorCode) {\n /**\n * Indicates that no error occurred during speech recognition.\n */\n CancellationErrorCode[CancellationErrorCode[\"NoError\"] = 0] = \"NoError\";\n /**\n * Indicates an authentication error.\n */\n CancellationErrorCode[CancellationErrorCode[\"AuthenticationFailure\"] = 1] = \"AuthenticationFailure\";\n /**\n * Indicates that one or more recognition parameters are invalid.\n */\n CancellationErrorCode[CancellationErrorCode[\"BadRequestParameters\"] = 2] = \"BadRequestParameters\";\n /**\n * Indicates that the number of parallel requests exceeded the number of allowed\n * concurrent transcriptions for the subscription.\n */\n CancellationErrorCode[CancellationErrorCode[\"TooManyRequests\"] = 3] = \"TooManyRequests\";\n /**\n * Indicates a connection error.\n */\n CancellationErrorCode[CancellationErrorCode[\"ConnectionFailure\"] = 4] = \"ConnectionFailure\";\n /**\n * Indicates a time-out error when waiting for response from service.\n */\n CancellationErrorCode[CancellationErrorCode[\"ServiceTimeout\"] = 5] = \"ServiceTimeout\";\n /**\n * Indicates that an error is returned by the service.\n */\n CancellationErrorCode[CancellationErrorCode[\"ServiceError\"] = 6] = \"ServiceError\";\n /**\n * Indicates an unexpected runtime error.\n */\n CancellationErrorCode[CancellationErrorCode[\"RuntimeError\"] = 7] = \"RuntimeError\";\n})(CancellationErrorCode || (CancellationErrorCode = {}));\n\n//# sourceMappingURL=CancellationErrorCodes.js.map\n","//\n// Copyright (c) Microsoft. All rights reserved.\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\n//\nimport { SessionEventArgs } from \"./Exports\";\n/**\n * Defines payload for connection events like Connected/Disconnected.\n * Added in version 1.2.0\n */\nexport class ConnectionEventArgs extends SessionEventArgs {\n}\n\n//# sourceMappingURL=ConnectionEventArgs.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n// tslint:disable:max-classes-per-file\nimport { createNoDashGuid, Stream, } from \"../../common/Exports\";\nimport { Contracts } from \"../Contracts\";\nimport { AudioOutputFormatImpl } from \"./AudioOutputFormat\";\n/**\n * Represents audio output stream used for custom audio output configurations.\n * @class AudioOutputStream\n */\nexport class AudioOutputStream {\n /**\n * Creates and initializes an instance.\n * @constructor\n */\n constructor() { }\n /**\n * Creates a memory backed PullAudioOutputStream with the specified audio format.\n * @member AudioOutputStream.createPullStream\n * @function\n * @public\n * @returns {PullAudioOutputStream} The audio output stream being created.\n */\n static createPullStream() {\n return PullAudioOutputStream.create();\n }\n}\n/**\n * Represents memory backed push audio output stream used for custom audio output configurations.\n * @class PullAudioOutputStream\n */\nexport class PullAudioOutputStream extends AudioOutputStream {\n /**\n * Creates a memory backed PullAudioOutputStream with the specified audio format.\n * @member PullAudioOutputStream.create\n * @function\n * @public\n * @returns {PullAudioOutputStream} The push audio output stream being created.\n */\n static create() {\n return new PullAudioOutputStreamImpl();\n }\n}\n/**\n * Represents memory backed push audio output stream used for custom audio output configurations.\n * @private\n * @class PullAudioOutputStreamImpl\n */\nexport class PullAudioOutputStreamImpl extends PullAudioOutputStream {\n /**\n * Creates and initializes an instance with the given values.\n * @constructor\n */\n constructor() {\n super();\n this.privId = createNoDashGuid();\n this.privStream = new Stream();\n }\n /**\n * Sets the format information to the stream. For internal use only.\n * @param {AudioStreamFormat} format - the format to be set.\n */\n set format(format) {\n if (format === undefined || format === null) {\n this.privFormat = AudioOutputFormatImpl.getDefaultOutputFormat();\n }\n this.privFormat = format;\n }\n /**\n * Format information for the audio\n */\n get format() {\n return this.privFormat;\n }\n /**\n * Checks if the stream is closed\n * @member PullAudioOutputStreamImpl.prototype.isClosed\n * @property\n * @public\n */\n get isClosed() {\n return this.privStream.isClosed;\n }\n /**\n * Gets the id of the stream\n * @member PullAudioOutputStreamImpl.prototype.id\n * @property\n * @public\n */\n id() {\n return this.privId;\n }\n /**\n * Reads audio data from the internal buffer.\n * @member PullAudioOutputStreamImpl.prototype.read\n * @function\n * @public\n * @param {ArrayBuffer} dataBuffer - An ArrayBuffer to store the read data.\n * @returns {Promise} - Audio buffer length has been read.\n */\n read(dataBuffer) {\n return __awaiter(this, void 0, void 0, function* () {\n const intView = new Int8Array(dataBuffer);\n let totalBytes = 0;\n if (this.privLastChunkView !== undefined) {\n if (this.privLastChunkView.length > dataBuffer.byteLength) {\n intView.set(this.privLastChunkView.slice(0, dataBuffer.byteLength));\n this.privLastChunkView = this.privLastChunkView.slice(dataBuffer.byteLength);\n return Promise.resolve(dataBuffer.byteLength);\n }\n intView.set(this.privLastChunkView);\n totalBytes = this.privLastChunkView.length;\n this.privLastChunkView = undefined;\n }\n // Until we have the minimum number of bytes to send in a transmission, keep asking for more.\n while (totalBytes < dataBuffer.byteLength && !this.privStream.isReadEnded) {\n const chunk = yield this.privStream.read();\n if (chunk !== undefined && !chunk.isEnd) {\n let tmpBuffer;\n if (chunk.buffer.byteLength > dataBuffer.byteLength - totalBytes) {\n tmpBuffer = chunk.buffer.slice(0, dataBuffer.byteLength - totalBytes);\n this.privLastChunkView = new Int8Array(chunk.buffer.slice(dataBuffer.byteLength - totalBytes));\n }\n else {\n tmpBuffer = chunk.buffer;\n }\n intView.set(new Int8Array(tmpBuffer), totalBytes);\n totalBytes += tmpBuffer.byteLength;\n }\n else {\n yield this.privStream.readEnded();\n }\n }\n return totalBytes;\n });\n }\n /**\n * Writes the audio data specified by making an internal copy of the data.\n * @member PullAudioOutputStreamImpl.prototype.write\n * @function\n * @public\n * @param {ArrayBuffer} dataBuffer - The audio buffer of which this function will make a copy.\n */\n write(dataBuffer) {\n Contracts.throwIfNullOrUndefined(this.privStream, \"must set format before writing\");\n this.privStream.writeStreamChunk({\n buffer: dataBuffer,\n isEnd: false,\n timeReceived: Date.now()\n });\n }\n /**\n * Closes the stream.\n * @member PullAudioOutputStreamImpl.prototype.close\n * @function\n * @public\n */\n close() {\n this.privStream.close();\n }\n}\n/*\n * Represents audio output stream used for custom audio output configurations.\n * @class PushAudioOutputStream\n */\nexport class PushAudioOutputStream extends AudioOutputStream {\n /**\n * Creates and initializes and instance.\n * @constructor\n */\n constructor() { super(); }\n /**\n * Creates a PushAudioOutputStream that delegates to the specified callback interface for\n * write() and close() methods.\n * @member PushAudioOutputStream.create\n * @function\n * @public\n * @param {PushAudioOutputStreamCallback} callback - The custom audio output object,\n * derived from PushAudioOutputStreamCallback\n * @returns {PushAudioOutputStream} The push audio output stream being created.\n */\n static create(callback) {\n return new PushAudioOutputStreamImpl(callback);\n }\n}\n/**\n * Represents audio output stream used for custom audio output configurations.\n * @private\n * @class PushAudioOutputStreamImpl\n */\nexport class PushAudioOutputStreamImpl extends PushAudioOutputStream {\n /**\n * Creates a PushAudioOutputStream that delegates to the specified callback interface for\n * read() and close() methods.\n * @constructor\n * @param {PushAudioOutputStreamCallback} callback - The custom audio output object,\n * derived from PushAudioOutputStreamCallback\n */\n constructor(callback) {\n super();\n this.privId = createNoDashGuid();\n this.privCallback = callback;\n }\n // tslint:disable-next-line:no-empty\n set format(format) { }\n write(buffer) {\n if (!!this.privCallback.write) {\n this.privCallback.write(buffer);\n }\n }\n close() {\n if (!!this.privCallback.close) {\n this.privCallback.close();\n }\n }\n id() {\n return this.privId;\n }\n}\n\n//# sourceMappingURL=AudioOutputStream.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n/**\n * Defines the possible reasons a recognition result might be canceled.\n * @class CancellationReason\n */\nexport var CancellationReason;\n(function (CancellationReason) {\n /**\n * Indicates that an error occurred during speech recognition.\n * @member CancellationReason.Error\n */\n CancellationReason[CancellationReason[\"Error\"] = 0] = \"Error\";\n /**\n * Indicates that the end of the audio stream was reached.\n * @member CancellationReason.EndOfStream\n */\n CancellationReason[CancellationReason[\"EndOfStream\"] = 1] = \"EndOfStream\";\n})(CancellationReason || (CancellationReason = {}));\n\n//# sourceMappingURL=CancellationReason.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport * as fs from \"fs\";\nimport { Contracts } from \"../Contracts\";\nexport class AudioFileWriter {\n constructor(filename) {\n this.id = () => {\n return this.privId;\n };\n this.privFd = fs.openSync(filename, \"w\");\n }\n set format(format) {\n Contracts.throwIfNotUndefined(this.privAudioFormat, \"format is already set\");\n this.privAudioFormat = format;\n let headerOffset = 0;\n if (this.privAudioFormat.hasHeader) {\n headerOffset = this.privAudioFormat.header.byteLength;\n }\n if (this.privFd !== undefined) {\n this.privWriteStream = fs.createWriteStream(\"\", { fd: this.privFd, start: headerOffset, autoClose: false });\n }\n }\n write(buffer) {\n Contracts.throwIfNullOrUndefined(this.privAudioFormat, \"must set format before writing.\");\n if (this.privWriteStream !== undefined) {\n this.privWriteStream.write(new Uint8Array(buffer.slice(0)));\n }\n }\n close() {\n if (this.privFd !== undefined) {\n this.privWriteStream.on(\"finish\", () => {\n if (this.privAudioFormat.hasHeader) {\n this.privAudioFormat.updateHeader(this.privWriteStream.bytesWritten);\n fs.writeSync(this.privFd, new Int8Array(this.privAudioFormat.header), 0, this.privAudioFormat.header.byteLength, 0);\n }\n fs.closeSync(this.privFd);\n this.privFd = undefined;\n });\n this.privWriteStream.end();\n }\n }\n}\n\n//# sourceMappingURL=AudioFileWriter.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nimport { RecognitionEventArgs } from \"./Exports\";\n/**\n * Defines content of a CancellationEvent.\n * @class CancellationEventArgsBase\n */\nexport class CancellationEventArgsBase extends RecognitionEventArgs {\n /**\n * Creates and initializes an instance of this class.\n * @constructor\n * @param {CancellationReason} reason - The cancellation reason.\n * @param {string} errorDetails - Error details, if provided.\n * @param {number} offset - The offset.\n * @param {string} sessionId - The session id.\n */\n constructor(reason, errorDetails, errorCode, offset, sessionId) {\n super(offset, sessionId);\n this.privReason = reason;\n this.privErrorDetails = errorDetails;\n this.privErrorCode = errorCode;\n }\n /**\n * The reason the recognition was canceled.\n * @member CancellationEventArgsBase.prototype.reason\n * @function\n * @public\n * @returns {CancellationReason} Specifies the reason canceled.\n */\n get reason() {\n return this.privReason;\n }\n /**\n * The error code in case of an unsuccessful operation.\n * @return An error code that represents the error reason.\n */\n get errorCode() {\n return this.privErrorCode;\n }\n /**\n * In case of an unsuccessful operation, provides details of the occurred error.\n * @member CancellationEventArgsBase.prototype.errorDetails\n * @function\n * @public\n * @returns {string} A String that represents the error details.\n */\n get errorDetails() {\n return this.privErrorDetails;\n }\n}\n\n//# sourceMappingURL=CancellationEventArgsBase.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nvar _a;\nimport { Contracts } from \"./Contracts\";\nimport { PropertyId, SpeechConfigImpl } from \"./Exports\";\n/**\n * Class that defines base configurations for dialog service connector\n * @class DialogServiceConfig\n */\nexport class DialogServiceConfig {\n /**\n * Creates an instance of DialogService config.\n * @constructor\n */\n constructor() { }\n /**\n * Sets the corresponding backend application identifier.\n * @member DialogServiceConfig.prototype.Conversation_ApplicationId\n * @function\n * @public\n * @param {string} value - The application identifier to set.\n */\n // tslint:disable-next-line: no-empty\n set applicationId(value) { }\n}\nDialogServiceConfig.DialogTypes = (_a = class {\n },\n _a.BotFramework = \"bot_framework\",\n _a.CustomCommands = \"custom_commands\",\n _a);\n/**\n * Dialog Service configuration.\n * @class DialogServiceConfigImpl\n */\n// tslint:disable-next-line:max-classes-per-file\nexport class DialogServiceConfigImpl extends DialogServiceConfig {\n /**\n * Creates an instance of dialogService config.\n */\n constructor() {\n super();\n this.privSpeechConfig = new SpeechConfigImpl();\n }\n /**\n * Provides access to custom properties.\n * @member DialogServiceConfigImpl.prototype.properties\n * @function\n * @public\n * @returns {PropertyCollection} The properties.\n */\n get properties() {\n return this.privSpeechConfig.properties;\n }\n /**\n * Gets the speech recognition language.\n * @member DialogServiceConfigImpl.prototype.speechRecognitionLanguage\n * @function\n * @public\n */\n get speechRecognitionLanguage() {\n return this.privSpeechConfig.speechRecognitionLanguage;\n }\n /**\n * Sets the speech recognition language.\n * @member DialogServiceConfigImpl.prototype.speechRecognitionLanguage\n * @function\n * @public\n * @param {string} value - The language to set.\n */\n set speechRecognitionLanguage(value) {\n Contracts.throwIfNullOrWhitespace(value, \"value\");\n this.privSpeechConfig.speechRecognitionLanguage = value;\n }\n get outputFormat() {\n return this.privSpeechConfig.outputFormat;\n }\n set outputFormat(value) {\n this.privSpeechConfig.outputFormat = value;\n }\n /**\n * Sets a named property as value\n * @member DialogServiceConfigImpl.prototype.setProperty\n * @function\n * @public\n * @param {PropertyId | string} name - The property to set.\n * @param {string} value - The value.\n */\n setProperty(name, value) {\n this.privSpeechConfig.setProperty(name, value);\n }\n /**\n * Sets a named property as value\n * @member DialogServiceConfigImpl.prototype.getProperty\n * @function\n * @public\n * @param {PropertyId | string} name - The property to get.\n * @param {string} def - The default value to return in case the property is not known.\n * @returns {string} The current value, or provided default, of the given property.\n */\n getProperty(name, def) {\n return this.privSpeechConfig.getProperty(name);\n }\n /**\n * Sets the proxy configuration.\n * Only relevant in Node.js environments.\n * Added in version 1.4.0.\n * @param proxyHostName The host name of the proxy server, without the protocol scheme (http://)\n * @param proxyPort The port number of the proxy server.\n * @param proxyUserName The user name of the proxy server.\n * @param proxyPassword The password of the proxy server.\n */\n setProxy(proxyHostName, proxyPort, proxyUserName, proxyPassword) {\n this.setProperty(PropertyId.SpeechServiceConnection_ProxyHostName, proxyHostName);\n this.setProperty(PropertyId.SpeechServiceConnection_ProxyPort, `${proxyPort}`);\n if (proxyUserName) {\n this.setProperty(PropertyId.SpeechServiceConnection_ProxyUserName, proxyUserName);\n }\n if (proxyPassword) {\n this.setProperty(PropertyId.SpeechServiceConnection_ProxyPassword, proxyPassword);\n }\n }\n setServiceProperty(name, value, channel) {\n this.privSpeechConfig.setServiceProperty(name, value, channel);\n }\n /**\n * Dispose of associated resources.\n * @member DialogServiceConfigImpl.prototype.close\n * @function\n * @public\n */\n close() {\n return;\n }\n}\n\n//# sourceMappingURL=DialogServiceConfig.js.map\n"],"sourceRoot":""}