1 |
- {"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.SpeechSynthesisConnectionFactory = 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 SpeechSynthesisConnectionFactory {\n constructor() {\n this.synthesisUri = \"/cognitiveservices/websocket/v1\";\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, undefined);\n const hostSuffix = ConnectionFactoryBase_js_1.ConnectionFactoryBase.getHostSuffix(region);\n const endpointId = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_EndpointId, undefined);\n const hostPrefix = endpointId === undefined ? \"tts\" : \"voice\";\n const host = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".\" + hostPrefix + \".speech\" + hostSuffix);\n const queryParams = {};\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 if (endpointId !== undefined && endpointId !== \"\") {\n if (!endpoint || endpoint.search(QueryParameterNames_js_1.QueryParameterNames.CustomVoiceDeploymentId) === -1) {\n queryParams[QueryParameterNames_js_1.QueryParameterNames.CustomVoiceDeploymentId] = endpointId;\n }\n }\n if (config.avatarEnabled) {\n if (!endpoint || endpoint.search(QueryParameterNames_js_1.QueryParameterNames.EnableAvatar) === -1) {\n queryParams[QueryParameterNames_js_1.QueryParameterNames.EnableAvatar] = \"true\";\n }\n }\n if (!endpoint) {\n endpoint = host + this.synthesisUri;\n }\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.fromParameters(config.parameters), enableCompression, connectionId);\n }\n}\nexports.SpeechSynthesisConnectionFactory = SpeechSynthesisConnectionFactory;","map":{"version":3,"names":["Object","defineProperty","exports","value","SpeechSynthesisConnectionFactory","Exports_js_1","require","Exports_js_2","ConnectionFactoryBase_js_1","Exports_js_3","HeaderNames_js_1","QueryParameterNames_js_1","constructor","synthesisUri","create","config","authInfo","connectionId","endpoint","parameters","getProperty","PropertyId","SpeechServiceConnection_Endpoint","undefined","region","SpeechServiceConnection_Region","hostSuffix","ConnectionFactoryBase","getHostSuffix","endpointId","SpeechServiceConnection_EndpointId","hostPrefix","host","SpeechServiceConnection_Host","queryParams","headers","token","headerName","HeaderNames","ConnectionId","search","QueryParameterNames","CustomVoiceDeploymentId","avatarEnabled","EnableAvatar","setProperty","SpeechServiceConnection_Url","enableCompression","WebsocketConnection","WebsocketMessageFormatter","ProxyInfo","fromParameters"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/SpeechSynthesisConnectionFactory.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.SpeechSynthesisConnectionFactory = 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 SpeechSynthesisConnectionFactory {\n constructor() {\n this.synthesisUri = \"/cognitiveservices/websocket/v1\";\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, undefined);\n const hostSuffix = ConnectionFactoryBase_js_1.ConnectionFactoryBase.getHostSuffix(region);\n const endpointId = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_EndpointId, undefined);\n const hostPrefix = (endpointId === undefined) ? \"tts\" : \"voice\";\n const host = config.parameters.getProperty(Exports_js_2.PropertyId.SpeechServiceConnection_Host, \"wss://\" + region + \".\" + hostPrefix + \".speech\" + hostSuffix);\n const queryParams = {};\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 if (endpointId !== undefined && endpointId !== \"\") {\n if (!endpoint || endpoint.search(QueryParameterNames_js_1.QueryParameterNames.CustomVoiceDeploymentId) === -1) {\n queryParams[QueryParameterNames_js_1.QueryParameterNames.CustomVoiceDeploymentId] = endpointId;\n }\n }\n if (config.avatarEnabled) {\n if (!endpoint || endpoint.search(QueryParameterNames_js_1.QueryParameterNames.EnableAvatar) === -1) {\n queryParams[QueryParameterNames_js_1.QueryParameterNames.EnableAvatar] = \"true\";\n }\n }\n if (!endpoint) {\n endpoint = host + this.synthesisUri;\n }\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.fromParameters(config.parameters), enableCompression, connectionId);\n }\n}\nexports.SpeechSynthesisConnectionFactory = SpeechSynthesisConnectionFactory;\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,gCAAgC,GAAG,KAAK,CAAC;AACjD,MAAMC,YAAY,GAAGC,OAAO,CAAC,8BAA8B,CAAC;AAC5D,MAAMC,YAAY,GAAGD,OAAO,CAAC,mBAAmB,CAAC;AACjD,MAAME,0BAA0B,GAAGF,OAAO,CAAC,4BAA4B,CAAC;AACxE,MAAMG,YAAY,GAAGH,OAAO,CAAC,cAAc,CAAC;AAC5C,MAAMI,gBAAgB,GAAGJ,OAAO,CAAC,kBAAkB,CAAC;AACpD,MAAMK,wBAAwB,GAAGL,OAAO,CAAC,0BAA0B,CAAC;AACpE,MAAMF,gCAAgC,CAAC;EACnCQ,WAAWA,CAAA,EAAG;IACV,IAAI,CAACC,YAAY,GAAG,iCAAiC;EACzD;EACAC,MAAMA,CAACC,MAAM,EAAEC,QAAQ,EAAEC,YAAY,EAAE;IACnC,IAAIC,QAAQ,GAAGH,MAAM,CAACI,UAAU,CAACC,WAAW,CAACb,YAAY,CAACc,UAAU,CAACC,gCAAgC,EAAEC,SAAS,CAAC;IACjH,MAAMC,MAAM,GAAGT,MAAM,CAACI,UAAU,CAACC,WAAW,CAACb,YAAY,CAACc,UAAU,CAACI,8BAA8B,EAAEF,SAAS,CAAC;IAC/G,MAAMG,UAAU,GAAGlB,0BAA0B,CAACmB,qBAAqB,CAACC,aAAa,CAACJ,MAAM,CAAC;IACzF,MAAMK,UAAU,GAAGd,MAAM,CAACI,UAAU,CAACC,WAAW,CAACb,YAAY,CAACc,UAAU,CAACS,kCAAkC,EAAEP,SAAS,CAAC;IACvH,MAAMQ,UAAU,GAAIF,UAAU,KAAKN,SAAS,G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