{"ast":null,"code":"\"use strict\";\n\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.TranscriberConnectionFactory = void 0;\nconst Exports_js_1 = require(\"../common.browser/Exports.js\");\nconst Exports_js_2 = require(\"../sdk/Exports.js\");\nconst ConnectionFactoryBase_js_1 = require(\"./ConnectionFactoryBase.js\");\nconst Exports_js_3 = require(\"./Exports.js\");\nconst HeaderNames_js_1 = require(\"./HeaderNames.js\");\nconst QueryParameterNames_js_1 = require(\"./QueryParameterNames.js\");\nclass TranscriberConnectionFactory extends ConnectionFactoryBase_js_1.ConnectionFactoryBase {\n constructor() {\n super(...arguments);\n this.multiaudioRelativeUri = \"/speech/recognition/multiaudio\";\n }\n create(config, authInfo, connectionId) {\n let endpoint = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Endpoint, undefined);\n const region = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Region, \"centralus\");\n const hostSuffix = ConnectionFactoryBase_js_1.ConnectionFactoryBase.getHostSuffix(region);\n const hostDefault = \"wss://transcribe.\" + region + \".cts.speech\" + hostSuffix + this.multiaudioRelativeUri;\n const host = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Host, hostDefault);\n const queryParams = {};\n this.setQueryParams(queryParams, config, endpoint);\n if (!endpoint) {\n endpoint = host;\n }\n const headers = {};\n if (authInfo.token !== undefined && authInfo.token !== \"\") {\n headers[authInfo.headerName] = authInfo.token;\n }\n headers[HeaderNames_js_1.HeaderNames.ConnectionId] = connectionId;\n config.parameters.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Url, endpoint);\n const enableCompression = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\n return new Exports_js_1.WebsocketConnection(endpoint, queryParams, headers, new Exports_js_3.WebsocketMessageFormatter(), Exports_js_1.ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\n }\n setQueryParams(queryParams, config, endpointUrl) {\n const endpointId = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_EndpointId, undefined);\n const language = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_RecoLanguage, undefined);\n if (endpointId && !(QueryParameterNames_js_1.QueryParameterNames.CustomSpeechDeploymentId in queryParams)) {\n queryParams[QueryParameterNames_js_1.QueryParameterNames.CustomSpeechDeploymentId] = endpointId;\n }\n if (language && !(QueryParameterNames_js_1.QueryParameterNames.Language in queryParams)) {\n queryParams[QueryParameterNames_js_1.QueryParameterNames.Language] = language;\n }\n const wordLevelTimings = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"false\").toLowerCase() === \"true\";\n const detailed = config.parameters.getProperty(Exports_js_3.OutputFormatPropertyName, Exports_js_2.OutputFormat[Exports_js_2.OutputFormat.Simple]) !== Exports_js_2.OutputFormat[Exports_js_2.OutputFormat.Simple];\n if (wordLevelTimings || detailed) {\n queryParams[QueryParameterNames_js_1.QueryParameterNames.Format] = Exports_js_2.OutputFormat[Exports_js_2.OutputFormat.Detailed].toLowerCase();\n }\n this.setCommonUrlParams(config, queryParams, endpointUrl);\n }\n}\nexports.TranscriberConnectionFactory = TranscriberConnectionFactory;","map":{"version":3,"names":["Object","defineProperty","exports","value","TranscriberConnectionFactory","Exports_js_1","require","Exports_js_2","ConnectionFactoryBase_js_1","Exports_js_3","HeaderNames_js_1","QueryParameterNames_js_1","ConnectionFactoryBase","constructor","arguments","multiaudioRelativeUri","create","config","authInfo","connectionId","endpoint","parameters","getProperty","PropertyId","SpeechServiceConnection_Endpoint","undefined","region","SpeechServiceConnection_Region","hostSuffix","getHostSuffix","hostDefault","host","SpeechServiceConnection_Host","queryParams","setQueryParams","headers","token","headerName","HeaderNames","ConnectionId","setProperty","SpeechServiceConnection_Url","enableCompression","WebsocketConnection","WebsocketMessageFormatter","ProxyInfo","fromRecognizerConfig","endpointUrl","endpointId","SpeechServiceConnection_EndpointId","language","SpeechServiceConnection_RecoLanguage","QueryParameterNames","CustomSpeechDeploymentId","Language","wordLevelTimings","SpeechServiceResponse_RequestWordLevelTimestamps","toLowerCase","detailed","OutputFormatPropertyName","OutputFormat","Simple","Format","Detailed","setCommonUrlParams"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/TranscriberConnectionFactory.js"],"sourcesContent":["\"use strict\";\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.TranscriberConnectionFactory = void 0;\nconst Exports_js_1 = require(\"../common.browser/Exports.js\");\nconst Exports_js_2 = require(\"../sdk/Exports.js\");\nconst ConnectionFactoryBase_js_1 = require(\"./ConnectionFactoryBase.js\");\nconst Exports_js_3 = require(\"./Exports.js\");\nconst HeaderNames_js_1 = require(\"./HeaderNames.js\");\nconst QueryParameterNames_js_1 = require(\"./QueryParameterNames.js\");\nclass TranscriberConnectionFactory extends ConnectionFactoryBase_js_1.ConnectionFactoryBase {\n constructor() {\n super(...arguments);\n this.multiaudioRelativeUri = \"/speech/recognition/multiaudio\";\n }\n create(config, authInfo, connectionId) {\n let endpoint = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Endpoint, undefined);\n const region = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Region, \"centralus\");\n const hostSuffix = ConnectionFactoryBase_js_1.ConnectionFactoryBase.getHostSuffix(region);\n const hostDefault = \"wss://transcribe.\" + region + \".cts.speech\" + hostSuffix + this.multiaudioRelativeUri;\n const host = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Host, hostDefault);\n const queryParams = {};\n this.setQueryParams(queryParams, config, endpoint);\n if (!endpoint) {\n endpoint = host;\n }\n const headers = {};\n if (authInfo.token !== undefined && authInfo.token !== \"\") {\n headers[authInfo.headerName] = authInfo.token;\n }\n headers[HeaderNames_js_1.HeaderNames.ConnectionId] = connectionId;\n config.parameters.setProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Url, endpoint);\n const enableCompression = config.parameters.getProperty(\"SPEECH-EnableWebsocketCompression\", \"false\") === \"true\";\n return new Exports_js_1.WebsocketConnection(endpoint, queryParams, headers, new Exports_js_3.WebsocketMessageFormatter(), Exports_js_1.ProxyInfo.fromRecognizerConfig(config), enableCompression, connectionId);\n }\n setQueryParams(queryParams, config, endpointUrl) {\n const endpointId = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_EndpointId, undefined);\n const language = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_RecoLanguage, undefined);\n if (endpointId && !(QueryParameterNames_js_1.QueryParameterNames.CustomSpeechDeploymentId in queryParams)) {\n queryParams[QueryParameterNames_js_1.QueryParameterNames.CustomSpeechDeploymentId] = endpointId;\n }\n if (language && !(QueryParameterNames_js_1.QueryParameterNames.Language in queryParams)) {\n queryParams[QueryParameterNames_js_1.QueryParameterNames.Language] = language;\n }\n const wordLevelTimings = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"false\").toLowerCase() === \"true\";\n const detailed = config.parameters.getProperty(Exports_js_3.OutputFormatPropertyName, Exports_js_2.OutputFormat[Exports_js_2.OutputFormat.Simple]) !== Exports_js_2.OutputFormat[Exports_js_2.OutputFormat.Simple];\n if (wordLevelTimings || detailed) {\n queryParams[QueryParameterNames_js_1.QueryParameterNames.Format] = Exports_js_2.OutputFormat[Exports_js_2.OutputFormat.Detailed].toLowerCase();\n }\n this.setCommonUrlParams(config, queryParams, endpointUrl);\n }\n}\nexports.TranscriberConnectionFactory = TranscriberConnectionFactory;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACAA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE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