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AM,CAAC;QAClB,UAAU,EAAE,OAAO,CAAC;QACpB,eAAe,EAAE,OAAO,CAAC;QACzB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE;YACR,KAAK,EAAE,MAAM,CAAC;SACjB,CAAC;KACL,CAAC;CACL","file":"SpeechServiceConfig.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\n/* eslint-disable max-classes-per-file */\n\n// The config is serialized and sent as the Speech.Config\nexport class SpeechServiceConfig {\n private context: Context;\n private recognition: string;\n\n public constructor(context: Context) {\n this.context = context;\n }\n\n public serialize(): string {\n return JSON.stringify(this, (key: any, value: { [k: string]: any }): any => {\n if (value && typeof value === \"object\" && !Array.isArray(value)) {\n const replacement: { [k: string ]: any } = {};\n for (const k in value) {\n if (Object.hasOwnProperty.call(value, k)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n replacement[k && k.charAt(0).toLowerCase() + k.substring(1)] = value[k];\n }\n }\n return replacement;\n }\n return value;\n });\n }\n\n public get Context(): Context {\n return this.context;\n }\n\n public get Recognition(): string {\n return this.recognition;\n }\n\n public set Recognition(value: string) {\n this.recognition = value.toLowerCase();\n }\n}\n\nexport class Context {\n public system: System;\n public os: OS;\n public audio: ISpeechConfigAudio;\n public synthesis: {\n video: ISynthesisSectionVideo;\n };\n\n public constructor(os: OS) {\n this.system = new System();\n this.os = os;\n }\n}\n\nexport class System {\n public name: string;\n public version: string;\n public build: string;\n public lang: string;\n\n public constructor() {\n // Note: below will be patched for official builds.\n const SPEECHSDK_CLIENTSDK_VERSION = \"1.44.0-alpha.0.20250706023335\";\n\n this.name = \"SpeechSDK\";\n this.version = SPEECHSDK_CLIENTSDK_VERSION;\n this.build = \"JavaScript\";\n this.lang = \"JavaScript\";\n }\n}\n\nexport class OS {\n public platform: string;\n public name: string;\n public version: string;\n\n public constructor(platform: string, name: string, version: string) {\n this.platform = platform;\n this.name = name;\n this.version = version;\n }\n}\n\nexport class Device {\n public manufacturer: string;\n public model: string;\n public version: string;\n\n public constructor(manufacturer: string, model: string, version: string) {\n this.manufacturer = manufacturer;\n this.model = model;\n this.version = version;\n }\n}\n\nexport interface ISpeechConfigAudio {\n source?: ISpeechConfigAudioDevice;\n playback?: ISpeechConfigAudioDevice;\n}\n\nexport interface ISpeechConfigAudioDevice {\n manufacturer: string;\n model: string;\n connectivity: connectivity;\n type: type;\n samplerate: number;\n bitspersample: number;\n channelcount: number;\n}\n\nexport enum connectivity {\n Bluetooth = \"Bluetooth\",\n Wired = \"Wired\",\n WiFi = \"WiFi\",\n Cellular = \"Cellular\",\n InBuilt = \"InBuilt\",\n Unknown = \"Unknown\",\n}\n\nexport enum type {\n Phone = \"Phone\",\n Speaker = \"Speaker\",\n Car = \"Car\",\n Headset = \"Headset\",\n Thermostat = \"Thermostat\",\n Microphones = \"Microphones\",\n Deskphone = \"Deskphone\",\n RemoteControl = \"RemoteControl\",\n Unknown = \"Unknown\",\n File = \"File\",\n Stream = \"Stream\",\n}\n\nexport interface ICoordinate {\n x: number;\n y: number;\n}\n\n// For avatar synthesis\nexport interface ISynthesisSectionVideo {\n protocol: {\n name: string;\n webrtcConfig: {\n clientDescription: string;\n iceServers: {\n urls: string[];\n username: string;\n credential: string;\n }[];\n };\n };\n format: {\n bitrate: number;\n codec: string;\n crop: {\n topLeft: ICoordinate;\n bottomRight: ICoordinate;\n };\n resolution: {\n width: number;\n height: number;\n };\n };\n talkingAvatar: {\n character: string;\n customized: boolean;\n useBuiltInVoice: boolean;\n style: string;\n background: {\n color: string;\n };\n };\n}\n"]}