web-speech-cognitive-services 8.1.3-main.b33949a → 8.1.4-main.202512240452.5ddefc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -166,7 +166,7 @@ type PatchOptionsInit = {
166
166
  textNormalization?: 'display' | 'itn' | 'lexical' | 'maskeditn' | undefined;
167
167
  };
168
168
 
169
- declare function createSpeechRecognitionPonyfill(options: PatchOptionsInit): {
169
+ declare function createSpeechRecognitionPonyfill$1(options: PatchOptionsInit): {
170
170
  SpeechGrammarList: typeof SpeechGrammarList;
171
171
  SpeechRecognition: {
172
172
  new (): {
@@ -267,7 +267,7 @@ declare function createSpeechRecognitionPonyfillFromRecognizer({ createRecognize
267
267
  SpeechRecognitionEvent: typeof SpeechRecognitionEvent;
268
268
  };
269
269
 
270
- declare class _default$2 {
270
+ declare class AudioContextConsumer {
271
271
  constructor(audioContext: any);
272
272
  audioContext: any;
273
273
  pause(): void;
@@ -277,12 +277,12 @@ declare class _default$2 {
277
277
  stop(): void;
278
278
  }
279
279
 
280
- declare class _default$1 {
280
+ declare class AudioContextQueue {
281
281
  constructor({ audioContext, ponyfill }: {
282
282
  audioContext: any;
283
283
  ponyfill: any;
284
284
  });
285
- consumer: _default$2 | null;
285
+ consumer: AudioContextConsumer | null;
286
286
  paused: boolean;
287
287
  queue: any[];
288
288
  getAudioContext: memoize_one.MemoizedFn<() => any>;
@@ -341,13 +341,13 @@ declare class SpeechSynthesisUtterance {
341
341
  stop(): void;
342
342
  }
343
343
 
344
- declare function _default(options: any): {
345
- speechSynthesis?: never;
346
- SpeechSynthesisEvent?: never;
347
- SpeechSynthesisUtterance?: never;
344
+ declare function createSpeechRecognitionPonyfill(options: any): {
345
+ speechSynthesis?: undefined;
346
+ SpeechSynthesisEvent?: undefined;
347
+ SpeechSynthesisUtterance?: undefined;
348
348
  } | {
349
349
  speechSynthesis: {
350
- queue: _default$1;
350
+ queue: AudioContextQueue;
351
351
  cancel(): void;
352
352
  getVoices(): any[];
353
353
  onvoiceschanged: any;
@@ -369,4 +369,4 @@ declare function fetchAuthorizationToken({ region, subscriptionKey }: FetchAutho
369
369
 
370
370
  declare function createSpeechServicesPonyfill(options?: any): any;
371
371
 
372
- export { createSpeechRecognitionPonyfill, createSpeechRecognitionPonyfillFromRecognizer, createSpeechServicesPonyfill, _default as createSpeechSynthesisPonyfill, fetchAuthorizationToken };
372
+ export { createSpeechRecognitionPonyfill$1 as createSpeechRecognitionPonyfill, createSpeechRecognitionPonyfillFromRecognizer, createSpeechServicesPonyfill, createSpeechRecognitionPonyfill as createSpeechSynthesisPonyfill, fetchAuthorizationToken };
@@ -166,7 +166,7 @@ type PatchOptionsInit = {
166
166
  textNormalization?: 'display' | 'itn' | 'lexical' | 'maskeditn' | undefined;
167
167
  };
168
168
 
169
- declare function createSpeechRecognitionPonyfill(options: PatchOptionsInit): {
169
+ declare function createSpeechRecognitionPonyfill$1(options: PatchOptionsInit): {
170
170
  SpeechGrammarList: typeof SpeechGrammarList;
171
171
  SpeechRecognition: {
172
172
  new (): {
@@ -267,7 +267,7 @@ declare function createSpeechRecognitionPonyfillFromRecognizer({ createRecognize
267
267
  SpeechRecognitionEvent: typeof SpeechRecognitionEvent;
268
268
  };
269
269
 
270
- declare class _default$2 {
270
+ declare class AudioContextConsumer {
271
271
  constructor(audioContext: any);
272
272
  audioContext: any;
273
273
  pause(): void;
@@ -277,12 +277,12 @@ declare class _default$2 {
277
277
  stop(): void;
278
278
  }
279
279
 
280
- declare class _default$1 {
280
+ declare class AudioContextQueue {
281
281
  constructor({ audioContext, ponyfill }: {
282
282
  audioContext: any;
283
283
  ponyfill: any;
284
284
  });
285
- consumer: _default$2 | null;
285
+ consumer: AudioContextConsumer | null;
286
286
  paused: boolean;
287
287
  queue: any[];
288
288
  getAudioContext: memoize_one.MemoizedFn<() => any>;
@@ -341,13 +341,13 @@ declare class SpeechSynthesisUtterance {
341
341
  stop(): void;
342
342
  }
343
343
 
344
- declare function _default(options: any): {
345
- speechSynthesis?: never;
346
- SpeechSynthesisEvent?: never;
347
- SpeechSynthesisUtterance?: never;
344
+ declare function createSpeechRecognitionPonyfill(options: any): {
345
+ speechSynthesis?: undefined;
346
+ SpeechSynthesisEvent?: undefined;
347
+ SpeechSynthesisUtterance?: undefined;
348
348
  } | {
349
349
  speechSynthesis: {
350
- queue: _default$1;
350
+ queue: AudioContextQueue;
351
351
  cancel(): void;
352
352
  getVoices(): any[];
353
353
  onvoiceschanged: any;
@@ -369,4 +369,4 @@ declare function fetchAuthorizationToken({ region, subscriptionKey }: FetchAutho
369
369
 
370
370
  declare function createSpeechServicesPonyfill(options?: any): any;
371
371
 
372
- export { createSpeechRecognitionPonyfill, createSpeechRecognitionPonyfillFromRecognizer, createSpeechServicesPonyfill, _default as createSpeechSynthesisPonyfill, fetchAuthorizationToken };
372
+ export { createSpeechRecognitionPonyfill$1 as createSpeechRecognitionPonyfill, createSpeechRecognitionPonyfillFromRecognizer, createSpeechServicesPonyfill, createSpeechRecognitionPonyfill as createSpeechSynthesisPonyfill, fetchAuthorizationToken };
@@ -24883,13 +24883,14 @@
24883
24883
 
24884
24884
  // src/SpeechServices/SpeechSDK.ts
24885
24885
  var import_microsoft_cognitiveservices_speech_sdk = __toESM(require_microsoft_cognitiveservices_speech_sdk());
24886
- var SpeechSDK_default = {
24886
+ var SpeechSDK = {
24887
24887
  AudioConfig: import_microsoft_cognitiveservices_speech_sdk.AudioConfig,
24888
24888
  OutputFormat: import_microsoft_cognitiveservices_speech_sdk.OutputFormat,
24889
24889
  ResultReason: import_microsoft_cognitiveservices_speech_sdk.ResultReason,
24890
24890
  SpeechConfig: import_microsoft_cognitiveservices_speech_sdk.SpeechConfig,
24891
24891
  SpeechRecognizer: import_microsoft_cognitiveservices_speech_sdk.SpeechRecognizer
24892
24892
  };
24893
+ var SpeechSDK_default = SpeechSDK;
24893
24894
 
24894
24895
  // src/SpeechServices/SpeechToText/validation/credentialsSchema.ts
24895
24896
  var credentialsSchema = pipe(
@@ -25022,7 +25023,7 @@
25022
25023
  }
25023
25024
 
25024
25025
  // src/Util/createPromiseQueue.js
25025
- function createPromiseQueue_default() {
25026
+ function createPromiseQueue() {
25026
25027
  let shiftDeferred;
25027
25028
  const queue = [];
25028
25029
  const push = (value) => {
@@ -25103,7 +25104,7 @@
25103
25104
  var {
25104
25105
  ResultReason: { RecognizingSpeech, RecognizedSpeech }
25105
25106
  } = SpeechSDK_default;
25106
- function cognitiveServiceEventResultToWebSpeechRecognitionResult_default(result, init) {
25107
+ function cognitiveServiceEventResultToWebSpeechRecognitionResult(result, init) {
25107
25108
  const { maxAlternatives = Infinity, textNormalization = "display" } = init || {};
25108
25109
  const json = typeof result.json === "string" ? JSON.parse(result.json) : result.json;
25109
25110
  if (result.reason === RecognizingSpeech || result.reason === RecognizedSpeech && !json.NBest) {
@@ -25468,7 +25469,7 @@
25468
25469
  const recognizer = await createRecognizer(this.lang);
25469
25470
  const { pause, unprepare } = prepareAudioConfig(recognizer["audioConfig"]);
25470
25471
  try {
25471
- const queue = createPromiseQueue_default();
25472
+ const queue = createPromiseQueue();
25472
25473
  let soundStarted;
25473
25474
  let speechStarted;
25474
25475
  let stopping;
@@ -25619,7 +25620,7 @@
25619
25620
  speechStarted = true;
25620
25621
  }
25621
25622
  if (recognized) {
25622
- const result = cognitiveServiceEventResultToWebSpeechRecognitionResult_default(recognized.result, {
25623
+ const result = cognitiveServiceEventResultToWebSpeechRecognitionResult(recognized.result, {
25623
25624
  maxAlternatives: this.maxAlternatives,
25624
25625
  textNormalization
25625
25626
  });
@@ -25651,7 +25652,7 @@
25651
25652
  new SpeechRecognitionEvent("result", {
25652
25653
  results: new SpeechRecognitionResultList([
25653
25654
  ...finalizedResults,
25654
- cognitiveServiceEventResultToWebSpeechRecognitionResult_default(recognizing.result, {
25655
+ cognitiveServiceEventResultToWebSpeechRecognitionResult(recognizing.result, {
25655
25656
  maxAlternatives: this.maxAlternatives,
25656
25657
  textNormalization
25657
25658
  })
@@ -26648,7 +26649,7 @@
26648
26649
  }
26649
26650
 
26650
26651
  // src/SpeechServices/TextToSpeech/AudioContextConsumer.js
26651
- var AudioContextConsumer_default = class {
26652
+ var AudioContextConsumer = class {
26652
26653
  constructor(audioContext) {
26653
26654
  this.audioContext = audioContext;
26654
26655
  }
@@ -26677,7 +26678,7 @@
26677
26678
  };
26678
26679
 
26679
26680
  // src/SpeechServices/TextToSpeech/AudioContextQueue.js
26680
- var AudioContextQueue_default = class {
26681
+ var AudioContextQueue = class {
26681
26682
  constructor({ audioContext, ponyfill: ponyfill2 }) {
26682
26683
  this.consumer = null;
26683
26684
  this.paused = false;
@@ -26705,7 +26706,7 @@
26705
26706
  }
26706
26707
  async startConsumer() {
26707
26708
  while (!this.paused && this.queue.length && !this.consumer) {
26708
- this.consumer = new AudioContextConsumer_default(this.getAudioContext());
26709
+ this.consumer = new AudioContextConsumer(this.getAudioContext());
26709
26710
  await this.consumer.start(this.queue);
26710
26711
  this.consumer = null;
26711
26712
  }
@@ -26830,7 +26831,7 @@
26830
26831
  var DEFAULT_OUTPUT_FORMAT = "riff-16khz-16bit-mono-pcm";
26831
26832
  var DEFAULT_VOICE = "Microsoft Server Speech Text to Speech Voice (en-US, AriaNeural)";
26832
26833
  var EMPTY_MP3_BASE64 = "SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU3LjU2LjEwMQAAAAAAAAAAAAAA//tAwAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAACAAABhgC7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7//////////////////////////////////////////////////////////////////8AAAAATGF2YzU3LjY0AAAAAAAAAAAAAAAAJAUHAAAAAAAAAYYoRBqpAAAAAAD/+xDEAAPAAAGkAAAAIAAANIAAAARMQU1FMy45OS41VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7EMQpg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV";
26833
- async function fetchSpeechData_default({
26834
+ async function fetchSpeechData({
26834
26835
  deploymentId,
26835
26836
  fetchCredentials,
26836
26837
  lang = DEFAULT_LANGUAGE,
@@ -26998,7 +26999,7 @@
26998
26999
  this._volume = value;
26999
27000
  }
27000
27001
  preload({ deploymentId, fetchCredentials, outputFormat }) {
27001
- this.arrayBufferPromise = fetchSpeechData_default({
27002
+ this.arrayBufferPromise = fetchSpeechData({
27002
27003
  fetchCredentials,
27003
27004
  deploymentId,
27004
27005
  lang: this.lang || window.navigator.language,
@@ -27031,7 +27032,7 @@
27031
27032
  var SpeechSynthesisUtterance_default = SpeechSynthesisUtterance;
27032
27033
 
27033
27034
  // src/SpeechServices/TextToSpeech/SpeechSynthesisVoice.js
27034
- var SpeechSynthesisVoice_default = class {
27035
+ var SpeechSynthesisVoice = class {
27035
27036
  constructor({ gender, lang, voiceURI }) {
27036
27037
  this._default = false;
27037
27038
  this._gender = gender;
@@ -27061,7 +27062,7 @@
27061
27062
  };
27062
27063
 
27063
27064
  // src/SpeechServices/TextToSpeech/fetchCustomVoices.js
27064
- async function fetchCustomVoices({ customVoiceHostname, deploymentId, region, subscriptionKey }) {
27065
+ async function fetchCustomVoices_({ customVoiceHostname, deploymentId, region, subscriptionKey }) {
27065
27066
  const hostname = customVoiceHostname || `${region}.customvoice.api.speech.microsoft.com`;
27066
27067
  const res = await fetch(
27067
27068
  `https://${encodeURI(hostname)}/api/texttospeech/v2.0/endpoints/${encodeURIComponent(deploymentId)}`,
@@ -27077,10 +27078,10 @@
27077
27078
  }
27078
27079
  return res.json();
27079
27080
  }
27080
- async function fetchCustomVoices_default({ customVoiceHostname, deploymentId, region, subscriptionKey }) {
27081
- const { models } = await fetchCustomVoices({ customVoiceHostname, deploymentId, region, subscriptionKey });
27081
+ async function fetchCustomVoices({ customVoiceHostname, deploymentId, region, subscriptionKey }) {
27082
+ const { models } = await fetchCustomVoices_({ customVoiceHostname, deploymentId, region, subscriptionKey });
27082
27083
  return models.map(
27083
- ({ properties: { Gender: gender }, locale: lang, name: voiceURI }) => new SpeechSynthesisVoice_default({ gender, lang, voiceURI })
27084
+ ({ properties: { Gender: gender }, locale: lang, name: voiceURI }) => new SpeechSynthesisVoice({ gender, lang, voiceURI })
27084
27085
  ).sort(({ name: x }, { name: y }) => x > y ? 1 : x < y ? -1 : 0);
27085
27086
  }
27086
27087
 
@@ -27101,13 +27102,13 @@
27101
27102
  throw new Error("Failed to fetch voices");
27102
27103
  }
27103
27104
  const voices = await res.json();
27104
- return voices.map(({ Gender: gender, Locale: lang, Name: voiceURI }) => new SpeechSynthesisVoice_default({ gender, lang, voiceURI })).sort(({ name: x }, { name: y }) => x > y ? 1 : x < y ? -1 : 0);
27105
+ return voices.map(({ Gender: gender, Locale: lang, Name: voiceURI }) => new SpeechSynthesisVoice({ gender, lang, voiceURI })).sort(({ name: x }, { name: y }) => x > y ? 1 : x < y ? -1 : 0);
27105
27106
  }
27106
27107
 
27107
27108
  // src/SpeechServices/TextToSpeech/createSpeechSynthesisPonyfill.js
27108
27109
  var DEFAULT_OUTPUT_FORMAT2 = "audio-24khz-160kbitrate-mono-mp3";
27109
27110
  var EMPTY_ARRAY = [];
27110
- var createSpeechSynthesisPonyfill_default = (options) => {
27111
+ function createSpeechRecognitionPonyfill2(options) {
27111
27112
  const {
27112
27113
  audioContext,
27113
27114
  fetchCredentials,
@@ -27126,7 +27127,7 @@
27126
27127
  class SpeechSynthesis extends EventTarget2 {
27127
27128
  constructor() {
27128
27129
  super();
27129
- this.queue = new AudioContextQueue_default({ audioContext, ponyfill: ponyfill2 });
27130
+ this.queue = new AudioContextQueue({ audioContext, ponyfill: ponyfill2 });
27130
27131
  this.updateVoices();
27131
27132
  }
27132
27133
  cancel() {
@@ -27181,7 +27182,7 @@
27181
27182
  "web-speech-cognitive-services: Listing of custom voice models are only available when using subscription key."
27182
27183
  );
27183
27184
  await onErrorResumeNext(async () => {
27184
- const voices = await fetchCustomVoices_default({
27185
+ const voices = await fetchCustomVoices({
27185
27186
  customVoiceHostname,
27186
27187
  deploymentId: speechSynthesisDeploymentId,
27187
27188
  region,
@@ -27205,7 +27206,8 @@
27205
27206
  SpeechSynthesisEvent,
27206
27207
  SpeechSynthesisUtterance: SpeechSynthesisUtterance_default
27207
27208
  };
27208
- };
27209
+ }
27210
+ var createSpeechSynthesisPonyfill_default = createSpeechRecognitionPonyfill2;
27209
27211
 
27210
27212
  // src/SpeechServices/TextToSpeech.js
27211
27213
  var TextToSpeech_default = createSpeechSynthesisPonyfill_default;
@@ -27219,12 +27221,13 @@
27219
27221
  }
27220
27222
  var meta = document.createElement("meta");
27221
27223
  meta.setAttribute("name", "web-speech-cognitive-services");
27222
- meta.setAttribute("content", `version=${"8.1.3-main.b33949a"}`);
27224
+ meta.setAttribute("content", `version=${"8.1.4-main.202512240452.5ddefc2"}`);
27223
27225
  document.head.appendChild(meta);
27226
+ var SpeechServices_default = createSpeechServicesPonyfill;
27224
27227
 
27225
27228
  // src/index.umd.js
27226
27229
  globalThis.WebSpeechCognitiveServices = {
27227
- create: createSpeechServicesPonyfill,
27230
+ create: SpeechServices_default,
27228
27231
  createSpeechRecognitionPonyfillFromRecognizer
27229
27232
  };
27230
27233
  })();