web-speech-cognitive-services 8.0.0-main.428d2a8 → 8.0.0-main.5903868
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.
- package/dist/web-speech-cognitive-services.d.mts +123 -26
- package/dist/web-speech-cognitive-services.d.ts +123 -26
- package/dist/web-speech-cognitive-services.development.js +1339 -1251
- package/dist/web-speech-cognitive-services.development.js.map +1 -1
- package/dist/web-speech-cognitive-services.js +225 -140
- package/dist/web-speech-cognitive-services.js.map +1 -1
- package/dist/web-speech-cognitive-services.mjs +220 -135
- package/dist/web-speech-cognitive-services.mjs.map +1 -1
- package/dist/web-speech-cognitive-services.production.min.js +12 -12
- package/dist/web-speech-cognitive-services.production.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -5519,7 +5519,7 @@
|
|
|
5519
5519
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5520
5520
|
exports.SpeechRecognitionResult = void 0;
|
|
5521
5521
|
var Exports_js_1 = require_Exports3();
|
|
5522
|
-
var
|
|
5522
|
+
var SpeechRecognitionResult2 = class extends Exports_js_1.RecognitionResult {
|
|
5523
5523
|
/**
|
|
5524
5524
|
* Creates and initializes an instance of this class.
|
|
5525
5525
|
* @constructor
|
|
@@ -5551,7 +5551,7 @@
|
|
|
5551
5551
|
return this.privSpeakerId;
|
|
5552
5552
|
}
|
|
5553
5553
|
};
|
|
5554
|
-
exports.SpeechRecognitionResult =
|
|
5554
|
+
exports.SpeechRecognitionResult = SpeechRecognitionResult2;
|
|
5555
5555
|
}
|
|
5556
5556
|
});
|
|
5557
5557
|
|
|
@@ -23432,1226 +23432,507 @@
|
|
|
23432
23432
|
}
|
|
23433
23433
|
});
|
|
23434
23434
|
|
|
23435
|
-
// ../../node_modules/
|
|
23436
|
-
function
|
|
23437
|
-
|
|
23438
|
-
|
|
23439
|
-
|
|
23435
|
+
// ../../node_modules/p-defer/index.js
|
|
23436
|
+
function pDefer() {
|
|
23437
|
+
const deferred = {};
|
|
23438
|
+
deferred.promise = new Promise((resolve, reject) => {
|
|
23439
|
+
deferred.resolve = resolve;
|
|
23440
|
+
deferred.reject = reject;
|
|
23441
|
+
});
|
|
23442
|
+
return deferred;
|
|
23440
23443
|
}
|
|
23441
|
-
|
|
23442
|
-
|
|
23443
|
-
|
|
23444
|
+
|
|
23445
|
+
// src/Util/createPromiseQueue.js
|
|
23446
|
+
function createPromiseQueue_default() {
|
|
23447
|
+
let shiftDeferred;
|
|
23448
|
+
const queue = [];
|
|
23449
|
+
const push = (value) => {
|
|
23450
|
+
if (shiftDeferred) {
|
|
23451
|
+
const { resolve } = shiftDeferred;
|
|
23452
|
+
shiftDeferred = null;
|
|
23453
|
+
resolve(value);
|
|
23454
|
+
} else {
|
|
23455
|
+
queue.push(value);
|
|
23456
|
+
}
|
|
23457
|
+
};
|
|
23458
|
+
const shift = () => {
|
|
23459
|
+
if (queue.length) {
|
|
23460
|
+
return Promise.resolve(queue.shift());
|
|
23461
|
+
}
|
|
23462
|
+
return (shiftDeferred || (shiftDeferred = pDefer())).promise;
|
|
23463
|
+
};
|
|
23464
|
+
return {
|
|
23465
|
+
push,
|
|
23466
|
+
shift
|
|
23467
|
+
};
|
|
23444
23468
|
}
|
|
23445
|
-
|
|
23446
|
-
|
|
23447
|
-
|
|
23448
|
-
|
|
23449
|
-
return Object.prototype.toString.call(x);
|
|
23469
|
+
|
|
23470
|
+
// src/SpeechServices/resolveFunctionOrReturnValue.ts
|
|
23471
|
+
function isFunction(value) {
|
|
23472
|
+
return typeof value === "function";
|
|
23450
23473
|
}
|
|
23451
|
-
|
|
23452
|
-
|
|
23453
|
-
|
|
23454
|
-
|
|
23455
|
-
|
|
23456
|
-
|
|
23457
|
-
|
|
23458
|
-
|
|
23459
|
-
|
|
23460
|
-
|
|
23461
|
-
|
|
23462
|
-
|
|
23463
|
-
|
|
23474
|
+
function resolveFunctionOrReturnValue(fnOrValue) {
|
|
23475
|
+
return isFunction(fnOrValue) ? fnOrValue() : fnOrValue;
|
|
23476
|
+
}
|
|
23477
|
+
|
|
23478
|
+
// src/SpeechServices/patchOptions.js
|
|
23479
|
+
var shouldWarnOnSubscriptionKey = true;
|
|
23480
|
+
function patchOptions({
|
|
23481
|
+
authorizationToken,
|
|
23482
|
+
credentials,
|
|
23483
|
+
looseEvent,
|
|
23484
|
+
looseEvents,
|
|
23485
|
+
region = "westus",
|
|
23486
|
+
subscriptionKey,
|
|
23487
|
+
...otherOptions
|
|
23488
|
+
} = {}) {
|
|
23489
|
+
if (typeof looseEvent !== "undefined") {
|
|
23490
|
+
console.warn('web-speech-cognitive-services: The option "looseEvent" should be named as "looseEvents".');
|
|
23491
|
+
looseEvents = looseEvent;
|
|
23492
|
+
}
|
|
23493
|
+
if (!credentials) {
|
|
23494
|
+
if (!authorizationToken && !subscriptionKey) {
|
|
23495
|
+
throw new Error("web-speech-cognitive-services: Credentials must be specified.");
|
|
23496
|
+
} else {
|
|
23497
|
+
console.warn(
|
|
23498
|
+
"web-speech-cognitive-services: We are deprecating authorizationToken, region, and subscriptionKey. Please use credentials instead. The deprecated option will be removed on or after 2020-11-14."
|
|
23499
|
+
);
|
|
23500
|
+
credentials = async () => authorizationToken ? { authorizationToken: await resolveFunctionOrReturnValue(authorizationToken), region } : { region, subscriptionKey: await resolveFunctionOrReturnValue(subscriptionKey) };
|
|
23464
23501
|
}
|
|
23465
|
-
console.error(error);
|
|
23466
|
-
} catch (_a) {
|
|
23467
23502
|
}
|
|
23503
|
+
return {
|
|
23504
|
+
...otherOptions,
|
|
23505
|
+
fetchCredentials: async () => {
|
|
23506
|
+
const {
|
|
23507
|
+
authorizationToken: authorizationToken2,
|
|
23508
|
+
customVoiceHostname,
|
|
23509
|
+
region: region2,
|
|
23510
|
+
speechRecognitionHostname,
|
|
23511
|
+
speechSynthesisHostname,
|
|
23512
|
+
subscriptionKey: subscriptionKey2
|
|
23513
|
+
} = await resolveFunctionOrReturnValue(credentials);
|
|
23514
|
+
if (!authorizationToken2 && !subscriptionKey2 || authorizationToken2 && subscriptionKey2) {
|
|
23515
|
+
throw new Error(
|
|
23516
|
+
'web-speech-cognitive-services: Either "authorizationToken" or "subscriptionKey" must be provided.'
|
|
23517
|
+
);
|
|
23518
|
+
} else if (!region2 && !(speechRecognitionHostname && speechSynthesisHostname)) {
|
|
23519
|
+
throw new Error(
|
|
23520
|
+
'web-speech-cognitive-services: Either "region" or "speechRecognitionHostname" and "speechSynthesisHostname" must be set.'
|
|
23521
|
+
);
|
|
23522
|
+
} else if (region2 && (customVoiceHostname || speechRecognitionHostname || speechSynthesisHostname)) {
|
|
23523
|
+
throw new Error(
|
|
23524
|
+
'web-speech-cognitive-services: Only either "region" or "customVoiceHostname", "speechRecognitionHostname" and "speechSynthesisHostname" can be set.'
|
|
23525
|
+
);
|
|
23526
|
+
} else if (authorizationToken2) {
|
|
23527
|
+
if (typeof authorizationToken2 !== "string") {
|
|
23528
|
+
throw new Error('web-speech-cognitive-services: "authorizationToken" must be a string.');
|
|
23529
|
+
}
|
|
23530
|
+
} else if (typeof subscriptionKey2 !== "string") {
|
|
23531
|
+
throw new Error('web-speech-cognitive-services: "subscriptionKey" must be a string.');
|
|
23532
|
+
}
|
|
23533
|
+
if (shouldWarnOnSubscriptionKey && subscriptionKey2) {
|
|
23534
|
+
console.warn(
|
|
23535
|
+
"web-speech-cognitive-services: In production environment, subscription key should not be used, authorization token should be used instead."
|
|
23536
|
+
);
|
|
23537
|
+
shouldWarnOnSubscriptionKey = false;
|
|
23538
|
+
}
|
|
23539
|
+
const resolvedCredentials = authorizationToken2 ? { authorizationToken: authorizationToken2 } : { subscriptionKey: subscriptionKey2 };
|
|
23540
|
+
if (region2) {
|
|
23541
|
+
resolvedCredentials.region = region2;
|
|
23542
|
+
} else {
|
|
23543
|
+
resolvedCredentials.customVoiceHostname = customVoiceHostname;
|
|
23544
|
+
resolvedCredentials.speechRecognitionHostname = speechRecognitionHostname;
|
|
23545
|
+
resolvedCredentials.speechSynthesisHostname = speechSynthesisHostname;
|
|
23546
|
+
}
|
|
23547
|
+
return resolvedCredentials;
|
|
23548
|
+
},
|
|
23549
|
+
looseEvents
|
|
23550
|
+
};
|
|
23468
23551
|
}
|
|
23469
|
-
|
|
23470
|
-
|
|
23471
|
-
var
|
|
23472
|
-
|
|
23473
|
-
|
|
23474
|
-
|
|
23552
|
+
|
|
23553
|
+
// src/SpeechServices/SpeechSDK.js
|
|
23554
|
+
var import_microsoft_cognitiveservices_speech = __toESM(require_microsoft_cognitiveservices_speech_sdk());
|
|
23555
|
+
var SpeechSDK_default = {
|
|
23556
|
+
AudioConfig: import_microsoft_cognitiveservices_speech.AudioConfig,
|
|
23557
|
+
OutputFormat: import_microsoft_cognitiveservices_speech.OutputFormat,
|
|
23558
|
+
ResultReason: import_microsoft_cognitiveservices_speech.ResultReason,
|
|
23559
|
+
SpeechConfig: import_microsoft_cognitiveservices_speech.SpeechConfig,
|
|
23560
|
+
SpeechRecognizer: import_microsoft_cognitiveservices_speech.SpeechRecognizer
|
|
23561
|
+
};
|
|
23562
|
+
|
|
23563
|
+
// src/SpeechServices/SpeechToText/SpeechRecognitionAlternative.ts
|
|
23564
|
+
var SpeechRecognitionAlternative = class {
|
|
23565
|
+
constructor({ confidence, transcript }) {
|
|
23566
|
+
this.#confidence = confidence;
|
|
23567
|
+
this.#transcript = transcript;
|
|
23475
23568
|
}
|
|
23476
|
-
|
|
23477
|
-
|
|
23478
|
-
|
|
23479
|
-
|
|
23480
|
-
|
|
23481
|
-
|
|
23482
|
-
|
|
23483
|
-
if (currentWarnHandler) {
|
|
23484
|
-
currentWarnHandler({ ...this, args });
|
|
23485
|
-
return;
|
|
23486
|
-
}
|
|
23487
|
-
const stack = ((_a = new Error().stack) !== null && _a !== void 0 ? _a : "").replace(/^(?:.+?\n){2}/gu, "\n");
|
|
23488
|
-
console.warn(this.message, ...args, stack);
|
|
23489
|
-
} catch (_b) {
|
|
23490
|
-
}
|
|
23569
|
+
#confidence;
|
|
23570
|
+
#transcript;
|
|
23571
|
+
get confidence() {
|
|
23572
|
+
return this.#confidence;
|
|
23573
|
+
}
|
|
23574
|
+
get transcript() {
|
|
23575
|
+
return this.#transcript;
|
|
23491
23576
|
}
|
|
23492
23577
|
};
|
|
23493
|
-
|
|
23494
|
-
|
|
23495
|
-
var
|
|
23496
|
-
|
|
23497
|
-
|
|
23498
|
-
|
|
23499
|
-
|
|
23500
|
-
|
|
23501
|
-
|
|
23502
|
-
|
|
23503
|
-
|
|
23504
|
-
|
|
23505
|
-
|
|
23506
|
-
|
|
23507
|
-
|
|
23578
|
+
|
|
23579
|
+
// src/SpeechServices/SpeechToText/FakeArray.ts
|
|
23580
|
+
var FakeArray = class {
|
|
23581
|
+
constructor(array) {
|
|
23582
|
+
if (!array) {
|
|
23583
|
+
throw new Error("array must be set.");
|
|
23584
|
+
}
|
|
23585
|
+
this.#array = array;
|
|
23586
|
+
for (const key in array) {
|
|
23587
|
+
Object.defineProperty(this, key, {
|
|
23588
|
+
enumerable: true,
|
|
23589
|
+
get() {
|
|
23590
|
+
return array[key];
|
|
23591
|
+
}
|
|
23592
|
+
});
|
|
23593
|
+
}
|
|
23508
23594
|
}
|
|
23509
|
-
|
|
23510
|
-
|
|
23511
|
-
|
|
23512
|
-
static get CAPTURING_PHASE() {
|
|
23513
|
-
return CAPTURING_PHASE;
|
|
23595
|
+
#array;
|
|
23596
|
+
[Symbol.iterator]() {
|
|
23597
|
+
return this.#array[Symbol.iterator]();
|
|
23514
23598
|
}
|
|
23515
|
-
|
|
23516
|
-
|
|
23517
|
-
*/
|
|
23518
|
-
static get AT_TARGET() {
|
|
23519
|
-
return AT_TARGET;
|
|
23599
|
+
get length() {
|
|
23600
|
+
return this.#array.length;
|
|
23520
23601
|
}
|
|
23521
|
-
|
|
23522
|
-
|
|
23523
|
-
|
|
23524
|
-
|
|
23525
|
-
|
|
23602
|
+
};
|
|
23603
|
+
|
|
23604
|
+
// src/SpeechServices/SpeechToText/SpeechRecognitionResult.ts
|
|
23605
|
+
var SpeechRecognitionResult = class extends FakeArray {
|
|
23606
|
+
constructor(init) {
|
|
23607
|
+
super(init.results);
|
|
23608
|
+
this.#isFinal = init.isFinal;
|
|
23526
23609
|
}
|
|
23527
|
-
|
|
23528
|
-
|
|
23529
|
-
|
|
23530
|
-
|
|
23531
|
-
|
|
23532
|
-
|
|
23533
|
-
|
|
23534
|
-
|
|
23535
|
-
|
|
23536
|
-
|
|
23610
|
+
#isFinal;
|
|
23611
|
+
get isFinal() {
|
|
23612
|
+
return this.#isFinal;
|
|
23613
|
+
}
|
|
23614
|
+
};
|
|
23615
|
+
|
|
23616
|
+
// src/SpeechServices/SpeechToText/cognitiveServiceEventResultToWebSpeechRecognitionResult.ts
|
|
23617
|
+
var {
|
|
23618
|
+
ResultReason: { RecognizingSpeech, RecognizedSpeech }
|
|
23619
|
+
} = SpeechSDK_default;
|
|
23620
|
+
function cognitiveServiceEventResultToWebSpeechRecognitionResult_default(result, init) {
|
|
23621
|
+
const { maxAlternatives = Infinity, textNormalization = "display" } = init || {};
|
|
23622
|
+
const json = typeof result.json === "string" ? JSON.parse(result.json) : result.json;
|
|
23623
|
+
if (result.reason === RecognizingSpeech || result.reason === RecognizedSpeech && !json.NBest) {
|
|
23624
|
+
return new SpeechRecognitionResult({
|
|
23625
|
+
isFinal: result.reason === RecognizedSpeech,
|
|
23626
|
+
results: [
|
|
23627
|
+
new SpeechRecognitionAlternative({
|
|
23628
|
+
confidence: 0.5,
|
|
23629
|
+
transcript: result.text
|
|
23630
|
+
})
|
|
23631
|
+
]
|
|
23537
23632
|
});
|
|
23538
|
-
|
|
23539
|
-
|
|
23540
|
-
|
|
23541
|
-
|
|
23542
|
-
|
|
23543
|
-
|
|
23544
|
-
|
|
23545
|
-
|
|
23546
|
-
|
|
23547
|
-
stopImmediatePropagationFlag: false,
|
|
23548
|
-
canceledFlag: false,
|
|
23549
|
-
inPassiveListenerFlag: false,
|
|
23550
|
-
dispatchFlag: false,
|
|
23551
|
-
timeStamp: Date.now()
|
|
23633
|
+
} else if (result.reason === RecognizedSpeech) {
|
|
23634
|
+
return new SpeechRecognitionResult({
|
|
23635
|
+
isFinal: true,
|
|
23636
|
+
results: (json.NBest || []).slice(0, maxAlternatives).map(
|
|
23637
|
+
({ Confidence: confidence, Display: display, ITN: itn, Lexical: lexical, MaskedITN: maskedITN }) => new SpeechRecognitionAlternative({
|
|
23638
|
+
confidence,
|
|
23639
|
+
transcript: textNormalization === "itn" ? itn : textNormalization === "lexical" ? lexical : textNormalization === "maskeditn" ? maskedITN : display
|
|
23640
|
+
})
|
|
23641
|
+
)
|
|
23552
23642
|
});
|
|
23553
23643
|
}
|
|
23554
|
-
|
|
23555
|
-
|
|
23556
|
-
|
|
23557
|
-
|
|
23558
|
-
|
|
23559
|
-
|
|
23644
|
+
return new SpeechRecognitionResult({ isFinal: false, results: [] });
|
|
23645
|
+
}
|
|
23646
|
+
|
|
23647
|
+
// src/SpeechServices/SpeechToText/EventListenerMap.ts
|
|
23648
|
+
var EventListenerMap = class {
|
|
23649
|
+
constructor(eventTarget) {
|
|
23650
|
+
this.#eventTarget = eventTarget;
|
|
23651
|
+
this.#propertyMap = {};
|
|
23560
23652
|
}
|
|
23561
|
-
|
|
23562
|
-
|
|
23563
|
-
|
|
23564
|
-
|
|
23565
|
-
get target() {
|
|
23566
|
-
return $(this).target;
|
|
23653
|
+
#eventTarget;
|
|
23654
|
+
#propertyMap;
|
|
23655
|
+
getProperty(name) {
|
|
23656
|
+
return this.#propertyMap[name];
|
|
23567
23657
|
}
|
|
23568
|
-
|
|
23569
|
-
|
|
23570
|
-
|
|
23571
|
-
* @see https://dom.spec.whatwg.org/#dom-event-srcelement
|
|
23572
|
-
*/
|
|
23573
|
-
get srcElement() {
|
|
23574
|
-
return $(this).target;
|
|
23575
|
-
}
|
|
23576
|
-
/**
|
|
23577
|
-
* The event target of the current dispatching.
|
|
23578
|
-
* @see https://dom.spec.whatwg.org/#dom-event-currenttarget
|
|
23579
|
-
*/
|
|
23580
|
-
get currentTarget() {
|
|
23581
|
-
return $(this).currentTarget;
|
|
23582
|
-
}
|
|
23583
|
-
/**
|
|
23584
|
-
* The event target of the current dispatching.
|
|
23585
|
-
* This doesn't support node tree.
|
|
23586
|
-
* @see https://dom.spec.whatwg.org/#dom-event-composedpath
|
|
23587
|
-
*/
|
|
23588
|
-
composedPath() {
|
|
23589
|
-
const currentTarget = $(this).currentTarget;
|
|
23590
|
-
if (currentTarget) {
|
|
23591
|
-
return [currentTarget];
|
|
23592
|
-
}
|
|
23593
|
-
return [];
|
|
23594
|
-
}
|
|
23595
|
-
/**
|
|
23596
|
-
* @see https://dom.spec.whatwg.org/#dom-event-none
|
|
23597
|
-
*/
|
|
23598
|
-
get NONE() {
|
|
23599
|
-
return NONE;
|
|
23600
|
-
}
|
|
23601
|
-
/**
|
|
23602
|
-
* @see https://dom.spec.whatwg.org/#dom-event-capturing_phase
|
|
23603
|
-
*/
|
|
23604
|
-
get CAPTURING_PHASE() {
|
|
23605
|
-
return CAPTURING_PHASE;
|
|
23606
|
-
}
|
|
23607
|
-
/**
|
|
23608
|
-
* @see https://dom.spec.whatwg.org/#dom-event-at_target
|
|
23609
|
-
*/
|
|
23610
|
-
get AT_TARGET() {
|
|
23611
|
-
return AT_TARGET;
|
|
23612
|
-
}
|
|
23613
|
-
/**
|
|
23614
|
-
* @see https://dom.spec.whatwg.org/#dom-event-bubbling_phase
|
|
23615
|
-
*/
|
|
23616
|
-
get BUBBLING_PHASE() {
|
|
23617
|
-
return BUBBLING_PHASE;
|
|
23618
|
-
}
|
|
23619
|
-
/**
|
|
23620
|
-
* The current event phase.
|
|
23621
|
-
* @see https://dom.spec.whatwg.org/#dom-event-eventphase
|
|
23622
|
-
*/
|
|
23623
|
-
get eventPhase() {
|
|
23624
|
-
return $(this).dispatchFlag ? 2 : 0;
|
|
23625
|
-
}
|
|
23626
|
-
/**
|
|
23627
|
-
* Stop event bubbling.
|
|
23628
|
-
* Because this shim doesn't support node tree, this merely changes the `cancelBubble` property value.
|
|
23629
|
-
* @see https://dom.spec.whatwg.org/#dom-event-stoppropagation
|
|
23630
|
-
*/
|
|
23631
|
-
stopPropagation() {
|
|
23632
|
-
$(this).stopPropagationFlag = true;
|
|
23633
|
-
}
|
|
23634
|
-
/**
|
|
23635
|
-
* `true` if event bubbling was stopped.
|
|
23636
|
-
* @deprecated
|
|
23637
|
-
* @see https://dom.spec.whatwg.org/#dom-event-cancelbubble
|
|
23638
|
-
*/
|
|
23639
|
-
get cancelBubble() {
|
|
23640
|
-
return $(this).stopPropagationFlag;
|
|
23641
|
-
}
|
|
23642
|
-
/**
|
|
23643
|
-
* Stop event bubbling if `true` is set.
|
|
23644
|
-
* @deprecated Use the `stopPropagation()` method instead.
|
|
23645
|
-
* @see https://dom.spec.whatwg.org/#dom-event-cancelbubble
|
|
23646
|
-
*/
|
|
23647
|
-
set cancelBubble(value) {
|
|
23658
|
+
setProperty(name, value) {
|
|
23659
|
+
const existing = this.#propertyMap[name];
|
|
23660
|
+
existing && this.#eventTarget.removeEventListener(name, existing);
|
|
23648
23661
|
if (value) {
|
|
23649
|
-
|
|
23650
|
-
} else {
|
|
23651
|
-
FalsyWasAssignedToCancelBubble.warn();
|
|
23662
|
+
this.#eventTarget.addEventListener(name, value);
|
|
23652
23663
|
}
|
|
23664
|
+
this.#propertyMap[name] = value;
|
|
23653
23665
|
}
|
|
23654
|
-
|
|
23655
|
-
|
|
23656
|
-
|
|
23657
|
-
|
|
23658
|
-
|
|
23659
|
-
|
|
23660
|
-
data.stopPropagationFlag = data.stopImmediatePropagationFlag = true;
|
|
23661
|
-
}
|
|
23662
|
-
/**
|
|
23663
|
-
* `true` if this event will bubble.
|
|
23664
|
-
* @see https://dom.spec.whatwg.org/#dom-event-bubbles
|
|
23665
|
-
*/
|
|
23666
|
-
get bubbles() {
|
|
23667
|
-
return $(this).bubbles;
|
|
23666
|
+
};
|
|
23667
|
+
|
|
23668
|
+
// src/SpeechServices/SpeechToText/SpeechGrammarList.js
|
|
23669
|
+
var SpeechGrammarList_default = class {
|
|
23670
|
+
constructor() {
|
|
23671
|
+
this._phrases = [];
|
|
23668
23672
|
}
|
|
23669
|
-
|
|
23670
|
-
|
|
23671
|
-
* @see https://dom.spec.whatwg.org/#dom-event-cancelable
|
|
23672
|
-
*/
|
|
23673
|
-
get cancelable() {
|
|
23674
|
-
return $(this).cancelable;
|
|
23673
|
+
addFromString() {
|
|
23674
|
+
throw new Error("JSGF is not supported");
|
|
23675
23675
|
}
|
|
23676
|
-
|
|
23677
|
-
|
|
23678
|
-
* @deprecated Use the `defaultPrevented` proeprty instead.
|
|
23679
|
-
* @see https://dom.spec.whatwg.org/#dom-event-returnvalue
|
|
23680
|
-
*/
|
|
23681
|
-
get returnValue() {
|
|
23682
|
-
return !$(this).canceledFlag;
|
|
23676
|
+
get phrases() {
|
|
23677
|
+
return this._phrases;
|
|
23683
23678
|
}
|
|
23684
|
-
|
|
23685
|
-
|
|
23686
|
-
|
|
23687
|
-
|
|
23688
|
-
|
|
23689
|
-
set returnValue(value) {
|
|
23690
|
-
if (!value) {
|
|
23691
|
-
setCancelFlag($(this));
|
|
23679
|
+
set phrases(value) {
|
|
23680
|
+
if (Array.isArray(value)) {
|
|
23681
|
+
this._phrases = value;
|
|
23682
|
+
} else if (typeof value === "string") {
|
|
23683
|
+
this._phrases = [value];
|
|
23692
23684
|
} else {
|
|
23693
|
-
|
|
23685
|
+
throw new Error(`The provided value is not an array or of type 'string'`);
|
|
23694
23686
|
}
|
|
23695
23687
|
}
|
|
23696
|
-
|
|
23697
|
-
|
|
23698
|
-
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
|
|
23688
|
+
};
|
|
23689
|
+
|
|
23690
|
+
// src/SpeechServices/SpeechToText/SpeechRecognitionErrorEvent.ts
|
|
23691
|
+
var SpeechRecognitionErrorEvent = class extends Event {
|
|
23692
|
+
constructor(type, { error, message }) {
|
|
23693
|
+
super(type);
|
|
23694
|
+
this.#error = error;
|
|
23695
|
+
this.#message = message;
|
|
23702
23696
|
}
|
|
23703
|
-
|
|
23704
|
-
|
|
23705
|
-
|
|
23706
|
-
|
|
23707
|
-
get defaultPrevented() {
|
|
23708
|
-
return $(this).canceledFlag;
|
|
23697
|
+
#error;
|
|
23698
|
+
#message;
|
|
23699
|
+
get error() {
|
|
23700
|
+
return this.#error;
|
|
23709
23701
|
}
|
|
23710
|
-
|
|
23711
|
-
|
|
23712
|
-
*/
|
|
23713
|
-
get composed() {
|
|
23714
|
-
return $(this).composed;
|
|
23702
|
+
get message() {
|
|
23703
|
+
return this.#message;
|
|
23715
23704
|
}
|
|
23716
|
-
|
|
23717
|
-
|
|
23718
|
-
|
|
23719
|
-
|
|
23720
|
-
|
|
23721
|
-
|
|
23705
|
+
};
|
|
23706
|
+
|
|
23707
|
+
// src/SpeechServices/SpeechToText/SpeechRecognitionResultList.ts
|
|
23708
|
+
var SpeechRecognitionResultList = class extends FakeArray {
|
|
23709
|
+
constructor(result) {
|
|
23710
|
+
super(result);
|
|
23722
23711
|
}
|
|
23723
|
-
|
|
23724
|
-
|
|
23725
|
-
|
|
23726
|
-
|
|
23727
|
-
|
|
23712
|
+
};
|
|
23713
|
+
|
|
23714
|
+
// src/SpeechServices/SpeechToText/SpeechRecognitionEvent.ts
|
|
23715
|
+
var SpeechRecognitionEvent = class extends Event {
|
|
23716
|
+
constructor(type, { data, resultIndex, results } = {}) {
|
|
23717
|
+
super(type);
|
|
23718
|
+
this.#data = data;
|
|
23719
|
+
this.#resultIndex = resultIndex;
|
|
23720
|
+
this.#results = results || new SpeechRecognitionResultList([]);
|
|
23728
23721
|
}
|
|
23729
|
-
|
|
23730
|
-
|
|
23731
|
-
|
|
23732
|
-
|
|
23733
|
-
|
|
23734
|
-
|
|
23735
|
-
InitEventWasCalledWhileDispatching.warn();
|
|
23736
|
-
return;
|
|
23737
|
-
}
|
|
23738
|
-
internalDataMap.set(this, {
|
|
23739
|
-
...data,
|
|
23740
|
-
type: String(type),
|
|
23741
|
-
bubbles: Boolean(bubbles),
|
|
23742
|
-
cancelable: Boolean(cancelable),
|
|
23743
|
-
target: null,
|
|
23744
|
-
currentTarget: null,
|
|
23745
|
-
stopPropagationFlag: false,
|
|
23746
|
-
stopImmediatePropagationFlag: false,
|
|
23747
|
-
canceledFlag: false
|
|
23748
|
-
});
|
|
23722
|
+
#data;
|
|
23723
|
+
// TODO: "resultIndex" should be set.
|
|
23724
|
+
#resultIndex;
|
|
23725
|
+
#results;
|
|
23726
|
+
get data() {
|
|
23727
|
+
return this.#data;
|
|
23749
23728
|
}
|
|
23750
|
-
|
|
23751
|
-
|
|
23752
|
-
var CAPTURING_PHASE = 1;
|
|
23753
|
-
var AT_TARGET = 2;
|
|
23754
|
-
var BUBBLING_PHASE = 3;
|
|
23755
|
-
var internalDataMap = /* @__PURE__ */ new WeakMap();
|
|
23756
|
-
function $(event, name = "this") {
|
|
23757
|
-
const retv = internalDataMap.get(event);
|
|
23758
|
-
assertType(retv != null, "'%s' must be an object that Event constructor created, but got another one: %o", name, event);
|
|
23759
|
-
return retv;
|
|
23760
|
-
}
|
|
23761
|
-
function setCancelFlag(data) {
|
|
23762
|
-
if (data.inPassiveListenerFlag) {
|
|
23763
|
-
CanceledInPassiveListener.warn();
|
|
23764
|
-
return;
|
|
23729
|
+
get resultIndex() {
|
|
23730
|
+
return this.#resultIndex;
|
|
23765
23731
|
}
|
|
23766
|
-
|
|
23767
|
-
|
|
23768
|
-
return;
|
|
23732
|
+
get results() {
|
|
23733
|
+
return this.#results;
|
|
23769
23734
|
}
|
|
23770
|
-
|
|
23735
|
+
};
|
|
23736
|
+
|
|
23737
|
+
// src/SpeechServices/SpeechToText/createSpeechRecognitionPonyfill.js
|
|
23738
|
+
var { AudioConfig: AudioConfig2, OutputFormat: OutputFormat2, ResultReason: ResultReason2, SpeechConfig: SpeechConfig2, SpeechRecognizer: SpeechRecognizer2 } = SpeechSDK_default;
|
|
23739
|
+
function serializeRecognitionResult({ duration, errorDetails, json, offset, properties, reason, resultId, text }) {
|
|
23740
|
+
return {
|
|
23741
|
+
duration,
|
|
23742
|
+
errorDetails,
|
|
23743
|
+
json: JSON.parse(json),
|
|
23744
|
+
offset,
|
|
23745
|
+
properties,
|
|
23746
|
+
reason,
|
|
23747
|
+
resultId,
|
|
23748
|
+
text
|
|
23749
|
+
};
|
|
23771
23750
|
}
|
|
23772
|
-
|
|
23773
|
-
|
|
23774
|
-
|
|
23775
|
-
Object.defineProperty(Event, "BUBBLING_PHASE", { enumerable: true });
|
|
23776
|
-
var keys = Object.getOwnPropertyNames(Event.prototype);
|
|
23777
|
-
for (let i = 0; i < keys.length; ++i) {
|
|
23778
|
-
if (keys[i] === "constructor") {
|
|
23779
|
-
continue;
|
|
23780
|
-
}
|
|
23781
|
-
Object.defineProperty(Event.prototype, keys[i], { enumerable: true });
|
|
23751
|
+
function averageAmplitude(arrayBuffer) {
|
|
23752
|
+
const array = new Int16Array(arrayBuffer);
|
|
23753
|
+
return [].reduce.call(array, (averageAmplitude2, amplitude) => averageAmplitude2 + Math.abs(amplitude), 0) / array.length;
|
|
23782
23754
|
}
|
|
23783
|
-
|
|
23784
|
-
|
|
23755
|
+
function cognitiveServicesAsyncToPromise(fn) {
|
|
23756
|
+
return (...args) => new Promise((resolve, reject) => fn(...args, resolve, reject));
|
|
23785
23757
|
}
|
|
23786
|
-
function
|
|
23787
|
-
|
|
23788
|
-
|
|
23789
|
-
|
|
23790
|
-
|
|
23791
|
-
|
|
23792
|
-
|
|
23793
|
-
|
|
23794
|
-
|
|
23795
|
-
|
|
23796
|
-
|
|
23797
|
-
|
|
23798
|
-
|
|
23799
|
-
|
|
23800
|
-
|
|
23801
|
-
|
|
23802
|
-
|
|
23803
|
-
|
|
23804
|
-
return
|
|
23805
|
-
}
|
|
23758
|
+
function prepareAudioConfig(audioConfig) {
|
|
23759
|
+
const originalAttach = audioConfig.attach;
|
|
23760
|
+
const boundOriginalAttach = audioConfig.attach.bind(audioConfig);
|
|
23761
|
+
let firstChunk;
|
|
23762
|
+
let muted;
|
|
23763
|
+
audioConfig.attach = async () => {
|
|
23764
|
+
const reader = await boundOriginalAttach();
|
|
23765
|
+
return {
|
|
23766
|
+
...reader,
|
|
23767
|
+
read: async () => {
|
|
23768
|
+
const chunk = await reader.read();
|
|
23769
|
+
if (!firstChunk && averageAmplitude(chunk.buffer) > 150) {
|
|
23770
|
+
audioConfig.events.onEvent({ name: "FirstAudibleChunk" });
|
|
23771
|
+
firstChunk = true;
|
|
23772
|
+
}
|
|
23773
|
+
if (muted) {
|
|
23774
|
+
return { buffer: new ArrayBuffer(0), isEnd: true, timeReceived: Date.now() };
|
|
23775
|
+
}
|
|
23776
|
+
return chunk;
|
|
23777
|
+
}
|
|
23806
23778
|
};
|
|
23807
|
-
|
|
23808
|
-
|
|
23809
|
-
|
|
23810
|
-
|
|
23811
|
-
|
|
23812
|
-
|
|
23813
|
-
|
|
23814
|
-
|
|
23815
|
-
|
|
23816
|
-
|
|
23817
|
-
var ErrorCodeMap = {
|
|
23818
|
-
INDEX_SIZE_ERR: 1,
|
|
23819
|
-
DOMSTRING_SIZE_ERR: 2,
|
|
23820
|
-
HIERARCHY_REQUEST_ERR: 3,
|
|
23821
|
-
WRONG_DOCUMENT_ERR: 4,
|
|
23822
|
-
INVALID_CHARACTER_ERR: 5,
|
|
23823
|
-
NO_DATA_ALLOWED_ERR: 6,
|
|
23824
|
-
NO_MODIFICATION_ALLOWED_ERR: 7,
|
|
23825
|
-
NOT_FOUND_ERR: 8,
|
|
23826
|
-
NOT_SUPPORTED_ERR: 9,
|
|
23827
|
-
INUSE_ATTRIBUTE_ERR: 10,
|
|
23828
|
-
INVALID_STATE_ERR: 11,
|
|
23829
|
-
SYNTAX_ERR: 12,
|
|
23830
|
-
INVALID_MODIFICATION_ERR: 13,
|
|
23831
|
-
NAMESPACE_ERR: 14,
|
|
23832
|
-
INVALID_ACCESS_ERR: 15,
|
|
23833
|
-
VALIDATION_ERR: 16,
|
|
23834
|
-
TYPE_MISMATCH_ERR: 17,
|
|
23835
|
-
SECURITY_ERR: 18,
|
|
23836
|
-
NETWORK_ERR: 19,
|
|
23837
|
-
ABORT_ERR: 20,
|
|
23838
|
-
URL_MISMATCH_ERR: 21,
|
|
23839
|
-
QUOTA_EXCEEDED_ERR: 22,
|
|
23840
|
-
TIMEOUT_ERR: 23,
|
|
23841
|
-
INVALID_NODE_TYPE_ERR: 24,
|
|
23842
|
-
DATA_CLONE_ERR: 25
|
|
23843
|
-
};
|
|
23844
|
-
function defineErrorCodeProperties(obj) {
|
|
23845
|
-
const keys2 = Object.keys(ErrorCodeMap);
|
|
23846
|
-
for (let i = 0; i < keys2.length; ++i) {
|
|
23847
|
-
const key = keys2[i];
|
|
23848
|
-
const value = ErrorCodeMap[key];
|
|
23849
|
-
Object.defineProperty(obj, key, {
|
|
23850
|
-
get() {
|
|
23851
|
-
return value;
|
|
23852
|
-
},
|
|
23853
|
-
configurable: true,
|
|
23854
|
-
enumerable: true
|
|
23855
|
-
});
|
|
23856
|
-
}
|
|
23779
|
+
};
|
|
23780
|
+
return {
|
|
23781
|
+
audioConfig,
|
|
23782
|
+
pause: () => {
|
|
23783
|
+
muted = true;
|
|
23784
|
+
},
|
|
23785
|
+
unprepare: () => {
|
|
23786
|
+
audioConfig.attach = originalAttach;
|
|
23787
|
+
}
|
|
23788
|
+
};
|
|
23857
23789
|
}
|
|
23858
|
-
|
|
23859
|
-
|
|
23860
|
-
|
|
23861
|
-
|
|
23862
|
-
|
|
23863
|
-
|
|
23864
|
-
|
|
23865
|
-
|
|
23866
|
-
|
|
23867
|
-
|
|
23868
|
-
|
|
23869
|
-
|
|
23870
|
-
|
|
23871
|
-
|
|
23872
|
-
|
|
23873
|
-
|
|
23790
|
+
function createSpeechRecognitionPonyfillFromRecognizer({
|
|
23791
|
+
createRecognizer,
|
|
23792
|
+
enableTelemetry,
|
|
23793
|
+
looseEvents,
|
|
23794
|
+
referenceGrammars,
|
|
23795
|
+
textNormalization
|
|
23796
|
+
}) {
|
|
23797
|
+
SpeechRecognizer2.enableTelemetry(enableTelemetry !== false);
|
|
23798
|
+
class SpeechRecognition extends EventTarget {
|
|
23799
|
+
constructor() {
|
|
23800
|
+
super();
|
|
23801
|
+
this._continuous = false;
|
|
23802
|
+
this._interimResults = false;
|
|
23803
|
+
this._lang = typeof window !== "undefined" ? window.document.documentElement.getAttribute("lang") || window.navigator.language : "en-US";
|
|
23804
|
+
this._grammars = new SpeechGrammarList_default();
|
|
23805
|
+
this._maxAlternatives = 1;
|
|
23806
|
+
this.#eventListenerMap = new EventListenerMap(this);
|
|
23874
23807
|
}
|
|
23875
|
-
|
|
23876
|
-
|
|
23808
|
+
/** @type { import('./SpeechRecognitionEventListenerMap').SpeechRecognitionEventListenerMap } */
|
|
23809
|
+
#eventListenerMap;
|
|
23810
|
+
emitCognitiveServices(type, event) {
|
|
23811
|
+
this.dispatchEvent(
|
|
23812
|
+
new SpeechRecognitionEvent("cognitiveservices", {
|
|
23813
|
+
data: {
|
|
23814
|
+
...event,
|
|
23815
|
+
type
|
|
23816
|
+
}
|
|
23817
|
+
})
|
|
23818
|
+
);
|
|
23877
23819
|
}
|
|
23878
|
-
|
|
23879
|
-
|
|
23880
|
-
|
|
23881
|
-
|
|
23882
|
-
|
|
23883
|
-
|
|
23820
|
+
get continuous() {
|
|
23821
|
+
return this._continuous;
|
|
23822
|
+
}
|
|
23823
|
+
set continuous(value) {
|
|
23824
|
+
this._continuous = value;
|
|
23825
|
+
}
|
|
23826
|
+
get grammars() {
|
|
23827
|
+
return this._grammars;
|
|
23828
|
+
}
|
|
23829
|
+
set grammars(value) {
|
|
23830
|
+
if (value instanceof SpeechGrammarList_default) {
|
|
23831
|
+
this._grammars = value;
|
|
23832
|
+
} else {
|
|
23833
|
+
throw new Error(`The provided value is not of type 'SpeechGrammarList'`);
|
|
23884
23834
|
}
|
|
23885
23835
|
}
|
|
23886
|
-
|
|
23887
|
-
|
|
23888
|
-
super.stopPropagation();
|
|
23889
|
-
const { original } = $$1(this);
|
|
23890
|
-
if ("stopPropagation" in original) {
|
|
23891
|
-
original.stopPropagation();
|
|
23836
|
+
get interimResults() {
|
|
23837
|
+
return this._interimResults;
|
|
23892
23838
|
}
|
|
23893
|
-
|
|
23894
|
-
|
|
23895
|
-
return super.cancelBubble;
|
|
23896
|
-
}
|
|
23897
|
-
set cancelBubble(value) {
|
|
23898
|
-
super.cancelBubble = value;
|
|
23899
|
-
const { original } = $$1(this);
|
|
23900
|
-
if ("cancelBubble" in original) {
|
|
23901
|
-
original.cancelBubble = value;
|
|
23839
|
+
set interimResults(value) {
|
|
23840
|
+
this._interimResults = value;
|
|
23902
23841
|
}
|
|
23903
|
-
|
|
23904
|
-
|
|
23905
|
-
super.stopImmediatePropagation();
|
|
23906
|
-
const { original } = $$1(this);
|
|
23907
|
-
if ("stopImmediatePropagation" in original) {
|
|
23908
|
-
original.stopImmediatePropagation();
|
|
23842
|
+
get maxAlternatives() {
|
|
23843
|
+
return this._maxAlternatives;
|
|
23909
23844
|
}
|
|
23910
|
-
|
|
23911
|
-
|
|
23912
|
-
return super.returnValue;
|
|
23913
|
-
}
|
|
23914
|
-
set returnValue(value) {
|
|
23915
|
-
super.returnValue = value;
|
|
23916
|
-
const { original } = $$1(this);
|
|
23917
|
-
if ("returnValue" in original) {
|
|
23918
|
-
original.returnValue = value;
|
|
23845
|
+
set maxAlternatives(value) {
|
|
23846
|
+
this._maxAlternatives = value;
|
|
23919
23847
|
}
|
|
23920
|
-
|
|
23921
|
-
|
|
23922
|
-
super.preventDefault();
|
|
23923
|
-
const { original } = $$1(this);
|
|
23924
|
-
if ("preventDefault" in original) {
|
|
23925
|
-
original.preventDefault();
|
|
23848
|
+
get lang() {
|
|
23849
|
+
return this._lang;
|
|
23926
23850
|
}
|
|
23927
|
-
|
|
23928
|
-
|
|
23929
|
-
const { original } = $$1(this);
|
|
23930
|
-
if ("timeStamp" in original) {
|
|
23931
|
-
return original.timeStamp;
|
|
23851
|
+
set lang(value) {
|
|
23852
|
+
this._lang = value;
|
|
23932
23853
|
}
|
|
23933
|
-
|
|
23934
|
-
|
|
23935
|
-
|
|
23936
|
-
var internalDataMap$1 = /* @__PURE__ */ new WeakMap();
|
|
23937
|
-
function $$1(event) {
|
|
23938
|
-
const retv = internalDataMap$1.get(event);
|
|
23939
|
-
assertType(retv != null, "'this' is expected an Event object, but got", event);
|
|
23940
|
-
return retv;
|
|
23941
|
-
}
|
|
23942
|
-
var wrapperClassCache = /* @__PURE__ */ new WeakMap();
|
|
23943
|
-
wrapperClassCache.set(Object.prototype, EventWrapper);
|
|
23944
|
-
if (typeof Global !== "undefined" && typeof Global.Event !== "undefined") {
|
|
23945
|
-
wrapperClassCache.set(Global.Event.prototype, EventWrapper);
|
|
23946
|
-
}
|
|
23947
|
-
function getWrapperClassOf(originalEvent) {
|
|
23948
|
-
const prototype = Object.getPrototypeOf(originalEvent);
|
|
23949
|
-
if (prototype == null) {
|
|
23950
|
-
return EventWrapper;
|
|
23951
|
-
}
|
|
23952
|
-
let wrapper = wrapperClassCache.get(prototype);
|
|
23953
|
-
if (wrapper == null) {
|
|
23954
|
-
wrapper = defineWrapper(getWrapperClassOf(prototype), prototype);
|
|
23955
|
-
wrapperClassCache.set(prototype, wrapper);
|
|
23956
|
-
}
|
|
23957
|
-
return wrapper;
|
|
23958
|
-
}
|
|
23959
|
-
function defineWrapper(BaseEventWrapper, originalPrototype) {
|
|
23960
|
-
class CustomEventWrapper extends BaseEventWrapper {
|
|
23961
|
-
}
|
|
23962
|
-
const keys2 = Object.keys(originalPrototype);
|
|
23963
|
-
for (let i = 0; i < keys2.length; ++i) {
|
|
23964
|
-
Object.defineProperty(CustomEventWrapper.prototype, keys2[i], defineRedirectDescriptor(originalPrototype, keys2[i]));
|
|
23965
|
-
}
|
|
23966
|
-
return CustomEventWrapper;
|
|
23967
|
-
}
|
|
23968
|
-
function defineRedirectDescriptor(obj, key) {
|
|
23969
|
-
const d = Object.getOwnPropertyDescriptor(obj, key);
|
|
23970
|
-
return {
|
|
23971
|
-
get() {
|
|
23972
|
-
const original = $$1(this).original;
|
|
23973
|
-
const value = original[key];
|
|
23974
|
-
if (typeof value === "function") {
|
|
23975
|
-
return value.bind(original);
|
|
23976
|
-
}
|
|
23977
|
-
return value;
|
|
23978
|
-
},
|
|
23979
|
-
set(value) {
|
|
23980
|
-
const original = $$1(this).original;
|
|
23981
|
-
original[key] = value;
|
|
23982
|
-
},
|
|
23983
|
-
configurable: d.configurable,
|
|
23984
|
-
enumerable: d.enumerable
|
|
23985
|
-
};
|
|
23986
|
-
}
|
|
23987
|
-
function createListener(callback, capture, passive, once, signal, signalListener) {
|
|
23988
|
-
return {
|
|
23989
|
-
callback,
|
|
23990
|
-
flags: (capture ? 1 : 0) | (passive ? 2 : 0) | (once ? 4 : 0),
|
|
23991
|
-
signal,
|
|
23992
|
-
signalListener
|
|
23993
|
-
};
|
|
23994
|
-
}
|
|
23995
|
-
function setRemoved(listener) {
|
|
23996
|
-
listener.flags |= 8;
|
|
23997
|
-
}
|
|
23998
|
-
function isCapture(listener) {
|
|
23999
|
-
return (listener.flags & 1) === 1;
|
|
24000
|
-
}
|
|
24001
|
-
function isPassive(listener) {
|
|
24002
|
-
return (listener.flags & 2) === 2;
|
|
24003
|
-
}
|
|
24004
|
-
function isOnce(listener) {
|
|
24005
|
-
return (listener.flags & 4) === 4;
|
|
24006
|
-
}
|
|
24007
|
-
function isRemoved(listener) {
|
|
24008
|
-
return (listener.flags & 8) === 8;
|
|
24009
|
-
}
|
|
24010
|
-
function invokeCallback({ callback }, target, event) {
|
|
24011
|
-
try {
|
|
24012
|
-
if (typeof callback === "function") {
|
|
24013
|
-
callback.call(target, event);
|
|
24014
|
-
} else if (typeof callback.handleEvent === "function") {
|
|
24015
|
-
callback.handleEvent(event);
|
|
23854
|
+
/** @type { ((event: SpeechRecognitionEvent<'audioend'>) => void) | undefined } */
|
|
23855
|
+
get onaudioend() {
|
|
23856
|
+
return this.#eventListenerMap.getProperty("audioend");
|
|
24016
23857
|
}
|
|
24017
|
-
|
|
24018
|
-
|
|
24019
|
-
}
|
|
24020
|
-
}
|
|
24021
|
-
function findIndexOfListener({ listeners }, callback, capture) {
|
|
24022
|
-
for (let i = 0; i < listeners.length; ++i) {
|
|
24023
|
-
if (listeners[i].callback === callback && isCapture(listeners[i]) === capture) {
|
|
24024
|
-
return i;
|
|
23858
|
+
set onaudioend(value) {
|
|
23859
|
+
this.#eventListenerMap.setProperty("audioend", value);
|
|
24025
23860
|
}
|
|
24026
|
-
|
|
24027
|
-
|
|
24028
|
-
|
|
24029
|
-
function addListener(list, callback, capture, passive, once, signal) {
|
|
24030
|
-
let signalListener;
|
|
24031
|
-
if (signal) {
|
|
24032
|
-
signalListener = removeListener.bind(null, list, callback, capture);
|
|
24033
|
-
signal.addEventListener("abort", signalListener);
|
|
24034
|
-
}
|
|
24035
|
-
const listener = createListener(callback, capture, passive, once, signal, signalListener);
|
|
24036
|
-
if (list.cow) {
|
|
24037
|
-
list.cow = false;
|
|
24038
|
-
list.listeners = [...list.listeners, listener];
|
|
24039
|
-
} else {
|
|
24040
|
-
list.listeners.push(listener);
|
|
24041
|
-
}
|
|
24042
|
-
return listener;
|
|
24043
|
-
}
|
|
24044
|
-
function removeListener(list, callback, capture) {
|
|
24045
|
-
const index = findIndexOfListener(list, callback, capture);
|
|
24046
|
-
if (index !== -1) {
|
|
24047
|
-
return removeListenerAt(list, index);
|
|
24048
|
-
}
|
|
24049
|
-
return false;
|
|
24050
|
-
}
|
|
24051
|
-
function removeListenerAt(list, index, disableCow = false) {
|
|
24052
|
-
const listener = list.listeners[index];
|
|
24053
|
-
setRemoved(listener);
|
|
24054
|
-
if (listener.signal) {
|
|
24055
|
-
listener.signal.removeEventListener("abort", listener.signalListener);
|
|
24056
|
-
}
|
|
24057
|
-
if (list.cow && !disableCow) {
|
|
24058
|
-
list.cow = false;
|
|
24059
|
-
list.listeners = list.listeners.filter((_, i) => i !== index);
|
|
24060
|
-
return false;
|
|
24061
|
-
}
|
|
24062
|
-
list.listeners.splice(index, 1);
|
|
24063
|
-
return true;
|
|
24064
|
-
}
|
|
24065
|
-
function createListenerListMap() {
|
|
24066
|
-
return /* @__PURE__ */ Object.create(null);
|
|
24067
|
-
}
|
|
24068
|
-
function ensureListenerList(listenerMap, type) {
|
|
24069
|
-
var _a;
|
|
24070
|
-
return (_a = listenerMap[type]) !== null && _a !== void 0 ? _a : listenerMap[type] = {
|
|
24071
|
-
attrCallback: void 0,
|
|
24072
|
-
attrListener: void 0,
|
|
24073
|
-
cow: false,
|
|
24074
|
-
listeners: []
|
|
24075
|
-
};
|
|
24076
|
-
}
|
|
24077
|
-
var EventTarget = class {
|
|
24078
|
-
/**
|
|
24079
|
-
* Initialize this instance.
|
|
24080
|
-
*/
|
|
24081
|
-
constructor() {
|
|
24082
|
-
internalDataMap$2.set(this, createListenerListMap());
|
|
24083
|
-
}
|
|
24084
|
-
// Implementation
|
|
24085
|
-
addEventListener(type0, callback0, options0) {
|
|
24086
|
-
const listenerMap = $$2(this);
|
|
24087
|
-
const { callback, capture, once, passive, signal, type } = normalizeAddOptions(type0, callback0, options0);
|
|
24088
|
-
if (callback == null || (signal === null || signal === void 0 ? void 0 : signal.aborted)) {
|
|
24089
|
-
return;
|
|
23861
|
+
/** @type { ((event: SpeechRecognitionEvent<'audiostart'>) => void) | undefined } */
|
|
23862
|
+
get onaudiostart() {
|
|
23863
|
+
return this.#eventListenerMap.getProperty("audiostart");
|
|
24090
23864
|
}
|
|
24091
|
-
|
|
24092
|
-
|
|
24093
|
-
if (i !== -1) {
|
|
24094
|
-
warnDuplicate(list.listeners[i], passive, once, signal);
|
|
24095
|
-
return;
|
|
23865
|
+
set onaudiostart(value) {
|
|
23866
|
+
this.#eventListenerMap.setProperty("audiostart", value);
|
|
24096
23867
|
}
|
|
24097
|
-
|
|
24098
|
-
|
|
24099
|
-
|
|
24100
|
-
removeEventListener(type0, callback0, options0) {
|
|
24101
|
-
const listenerMap = $$2(this);
|
|
24102
|
-
const { callback, capture, type } = normalizeOptions(type0, callback0, options0);
|
|
24103
|
-
const list = listenerMap[type];
|
|
24104
|
-
if (callback != null && list) {
|
|
24105
|
-
removeListener(list, callback, capture);
|
|
23868
|
+
/** @type { ((event: SpeechRecognitionEvent<'cognitiveservices'>) => void) | undefined } */
|
|
23869
|
+
get oncognitiveservices() {
|
|
23870
|
+
return this.#eventListenerMap.getProperty("cognitiveservices");
|
|
24106
23871
|
}
|
|
24107
|
-
|
|
24108
|
-
|
|
24109
|
-
dispatchEvent(e) {
|
|
24110
|
-
const list = $$2(this)[String(e.type)];
|
|
24111
|
-
if (list == null) {
|
|
24112
|
-
return true;
|
|
23872
|
+
set oncognitiveservices(value) {
|
|
23873
|
+
this.#eventListenerMap.setProperty("cognitiveservices", value);
|
|
24113
23874
|
}
|
|
24114
|
-
|
|
24115
|
-
|
|
24116
|
-
|
|
24117
|
-
throw createInvalidStateError("This event has been in dispatching.");
|
|
23875
|
+
/** @type { ((event: SpeechRecognitionEvent<'end'>) => void) | undefined } */
|
|
23876
|
+
get onend() {
|
|
23877
|
+
return this.#eventListenerMap.getProperty("end");
|
|
24118
23878
|
}
|
|
24119
|
-
|
|
24120
|
-
|
|
24121
|
-
if (!eventData.stopPropagationFlag) {
|
|
24122
|
-
const { cow, listeners } = list;
|
|
24123
|
-
list.cow = true;
|
|
24124
|
-
for (let i = 0; i < listeners.length; ++i) {
|
|
24125
|
-
const listener = listeners[i];
|
|
24126
|
-
if (isRemoved(listener)) {
|
|
24127
|
-
continue;
|
|
24128
|
-
}
|
|
24129
|
-
if (isOnce(listener) && removeListenerAt(list, i, !cow)) {
|
|
24130
|
-
i -= 1;
|
|
24131
|
-
}
|
|
24132
|
-
eventData.inPassiveListenerFlag = isPassive(listener);
|
|
24133
|
-
invokeCallback(listener, this, event);
|
|
24134
|
-
eventData.inPassiveListenerFlag = false;
|
|
24135
|
-
if (eventData.stopImmediatePropagationFlag) {
|
|
24136
|
-
break;
|
|
24137
|
-
}
|
|
24138
|
-
}
|
|
24139
|
-
if (!cow) {
|
|
24140
|
-
list.cow = false;
|
|
24141
|
-
}
|
|
23879
|
+
set onend(value) {
|
|
23880
|
+
this.#eventListenerMap.setProperty("end", value);
|
|
24142
23881
|
}
|
|
24143
|
-
|
|
24144
|
-
|
|
24145
|
-
|
|
24146
|
-
eventData.stopPropagationFlag = false;
|
|
24147
|
-
eventData.dispatchFlag = false;
|
|
24148
|
-
return !eventData.canceledFlag;
|
|
24149
|
-
}
|
|
24150
|
-
};
|
|
24151
|
-
var internalDataMap$2 = /* @__PURE__ */ new WeakMap();
|
|
24152
|
-
function $$2(target, name = "this") {
|
|
24153
|
-
const retv = internalDataMap$2.get(target);
|
|
24154
|
-
assertType(retv != null, "'%s' must be an object that EventTarget constructor created, but got another one: %o", name, target);
|
|
24155
|
-
return retv;
|
|
24156
|
-
}
|
|
24157
|
-
function normalizeAddOptions(type, callback, options) {
|
|
24158
|
-
var _a;
|
|
24159
|
-
assertCallback(callback);
|
|
24160
|
-
if (typeof options === "object" && options !== null) {
|
|
24161
|
-
return {
|
|
24162
|
-
type: String(type),
|
|
24163
|
-
callback: callback !== null && callback !== void 0 ? callback : void 0,
|
|
24164
|
-
capture: Boolean(options.capture),
|
|
24165
|
-
passive: Boolean(options.passive),
|
|
24166
|
-
once: Boolean(options.once),
|
|
24167
|
-
signal: (_a = options.signal) !== null && _a !== void 0 ? _a : void 0
|
|
24168
|
-
};
|
|
24169
|
-
}
|
|
24170
|
-
return {
|
|
24171
|
-
type: String(type),
|
|
24172
|
-
callback: callback !== null && callback !== void 0 ? callback : void 0,
|
|
24173
|
-
capture: Boolean(options),
|
|
24174
|
-
passive: false,
|
|
24175
|
-
once: false,
|
|
24176
|
-
signal: void 0
|
|
24177
|
-
};
|
|
24178
|
-
}
|
|
24179
|
-
function normalizeOptions(type, callback, options) {
|
|
24180
|
-
assertCallback(callback);
|
|
24181
|
-
if (typeof options === "object" && options !== null) {
|
|
24182
|
-
return {
|
|
24183
|
-
type: String(type),
|
|
24184
|
-
callback: callback !== null && callback !== void 0 ? callback : void 0,
|
|
24185
|
-
capture: Boolean(options.capture)
|
|
24186
|
-
};
|
|
24187
|
-
}
|
|
24188
|
-
return {
|
|
24189
|
-
type: String(type),
|
|
24190
|
-
callback: callback !== null && callback !== void 0 ? callback : void 0,
|
|
24191
|
-
capture: Boolean(options)
|
|
24192
|
-
};
|
|
24193
|
-
}
|
|
24194
|
-
function assertCallback(callback) {
|
|
24195
|
-
if (typeof callback === "function" || typeof callback === "object" && callback !== null && typeof callback.handleEvent === "function") {
|
|
24196
|
-
return;
|
|
24197
|
-
}
|
|
24198
|
-
if (callback == null || typeof callback === "object") {
|
|
24199
|
-
InvalidEventListener.warn(callback);
|
|
24200
|
-
return;
|
|
24201
|
-
}
|
|
24202
|
-
throw new TypeError(format(InvalidEventListener.message, [callback]));
|
|
24203
|
-
}
|
|
24204
|
-
function warnDuplicate(listener, passive, once, signal) {
|
|
24205
|
-
EventListenerWasDuplicated.warn(isCapture(listener) ? "capture" : "bubble", listener.callback);
|
|
24206
|
-
if (isPassive(listener) !== passive) {
|
|
24207
|
-
OptionWasIgnored.warn("passive");
|
|
24208
|
-
}
|
|
24209
|
-
if (isOnce(listener) !== once) {
|
|
24210
|
-
OptionWasIgnored.warn("once");
|
|
24211
|
-
}
|
|
24212
|
-
if (listener.signal !== signal) {
|
|
24213
|
-
OptionWasIgnored.warn("signal");
|
|
24214
|
-
}
|
|
24215
|
-
}
|
|
24216
|
-
var keys$1 = Object.getOwnPropertyNames(EventTarget.prototype);
|
|
24217
|
-
for (let i = 0; i < keys$1.length; ++i) {
|
|
24218
|
-
if (keys$1[i] === "constructor") {
|
|
24219
|
-
continue;
|
|
24220
|
-
}
|
|
24221
|
-
Object.defineProperty(EventTarget.prototype, keys$1[i], { enumerable: true });
|
|
24222
|
-
}
|
|
24223
|
-
if (typeof Global !== "undefined" && typeof Global.EventTarget !== "undefined") {
|
|
24224
|
-
Object.setPrototypeOf(EventTarget.prototype, Global.EventTarget.prototype);
|
|
24225
|
-
}
|
|
24226
|
-
function getEventAttributeValue(target, type) {
|
|
24227
|
-
var _a, _b;
|
|
24228
|
-
const listMap = $$2(target, "target");
|
|
24229
|
-
return (_b = (_a = listMap[type]) === null || _a === void 0 ? void 0 : _a.attrCallback) !== null && _b !== void 0 ? _b : null;
|
|
24230
|
-
}
|
|
24231
|
-
function setEventAttributeValue(target, type, callback) {
|
|
24232
|
-
if (callback != null && typeof callback !== "function") {
|
|
24233
|
-
InvalidAttributeHandler.warn(callback);
|
|
24234
|
-
}
|
|
24235
|
-
if (typeof callback === "function" || typeof callback === "object" && callback !== null) {
|
|
24236
|
-
upsertEventAttributeListener(target, type, callback);
|
|
24237
|
-
} else {
|
|
24238
|
-
removeEventAttributeListener(target, type);
|
|
24239
|
-
}
|
|
24240
|
-
}
|
|
24241
|
-
function upsertEventAttributeListener(target, type, callback) {
|
|
24242
|
-
const list = ensureListenerList($$2(target, "target"), String(type));
|
|
24243
|
-
list.attrCallback = callback;
|
|
24244
|
-
if (list.attrListener == null) {
|
|
24245
|
-
list.attrListener = addListener(list, defineEventAttributeCallback(list), false, false, false, void 0);
|
|
24246
|
-
}
|
|
24247
|
-
}
|
|
24248
|
-
function removeEventAttributeListener(target, type) {
|
|
24249
|
-
const listMap = $$2(target, "target");
|
|
24250
|
-
const list = listMap[String(type)];
|
|
24251
|
-
if (list && list.attrListener) {
|
|
24252
|
-
removeListener(list, list.attrListener.callback, false);
|
|
24253
|
-
list.attrCallback = list.attrListener = void 0;
|
|
24254
|
-
}
|
|
24255
|
-
}
|
|
24256
|
-
function defineEventAttributeCallback(list) {
|
|
24257
|
-
return function(event) {
|
|
24258
|
-
const callback = list.attrCallback;
|
|
24259
|
-
if (typeof callback === "function") {
|
|
24260
|
-
callback.call(this, event);
|
|
23882
|
+
/** @type { ((event: SpeechRecognitionEvent<'error'>) => void) | undefined } */
|
|
23883
|
+
get onerror() {
|
|
23884
|
+
return this.#eventListenerMap.getProperty("error");
|
|
24261
23885
|
}
|
|
24262
|
-
|
|
24263
|
-
|
|
24264
|
-
|
|
24265
|
-
// ../../node_modules/p-defer/index.js
|
|
24266
|
-
function pDefer() {
|
|
24267
|
-
const deferred = {};
|
|
24268
|
-
deferred.promise = new Promise((resolve, reject) => {
|
|
24269
|
-
deferred.resolve = resolve;
|
|
24270
|
-
deferred.reject = reject;
|
|
24271
|
-
});
|
|
24272
|
-
return deferred;
|
|
24273
|
-
}
|
|
24274
|
-
|
|
24275
|
-
// src/Util/createPromiseQueue.js
|
|
24276
|
-
function createPromiseQueue_default() {
|
|
24277
|
-
let shiftDeferred;
|
|
24278
|
-
const queue = [];
|
|
24279
|
-
const push = (value) => {
|
|
24280
|
-
if (shiftDeferred) {
|
|
24281
|
-
const { resolve } = shiftDeferred;
|
|
24282
|
-
shiftDeferred = null;
|
|
24283
|
-
resolve(value);
|
|
24284
|
-
} else {
|
|
24285
|
-
queue.push(value);
|
|
23886
|
+
set onerror(value) {
|
|
23887
|
+
this.#eventListenerMap.setProperty("error", value);
|
|
24286
23888
|
}
|
|
24287
|
-
|
|
24288
|
-
|
|
24289
|
-
|
|
24290
|
-
return Promise.resolve(queue.shift());
|
|
23889
|
+
/** @type { ((event: SpeechRecognitionEvent<'result'>) => void) | undefined } */
|
|
23890
|
+
get onresult() {
|
|
23891
|
+
return this.#eventListenerMap.getProperty("result");
|
|
24291
23892
|
}
|
|
24292
|
-
|
|
24293
|
-
|
|
24294
|
-
return {
|
|
24295
|
-
push,
|
|
24296
|
-
shift
|
|
24297
|
-
};
|
|
24298
|
-
}
|
|
24299
|
-
|
|
24300
|
-
// src/SpeechServices/resolveFunctionOrReturnValue.ts
|
|
24301
|
-
function isFunction(value) {
|
|
24302
|
-
return typeof value === "function";
|
|
24303
|
-
}
|
|
24304
|
-
function resolveFunctionOrReturnValue(fnOrValue) {
|
|
24305
|
-
return isFunction(fnOrValue) ? fnOrValue() : fnOrValue;
|
|
24306
|
-
}
|
|
24307
|
-
|
|
24308
|
-
// src/SpeechServices/patchOptions.js
|
|
24309
|
-
var shouldWarnOnSubscriptionKey = true;
|
|
24310
|
-
function patchOptions({
|
|
24311
|
-
authorizationToken,
|
|
24312
|
-
credentials,
|
|
24313
|
-
looseEvent,
|
|
24314
|
-
looseEvents,
|
|
24315
|
-
region = "westus",
|
|
24316
|
-
subscriptionKey,
|
|
24317
|
-
...otherOptions
|
|
24318
|
-
} = {}) {
|
|
24319
|
-
if (typeof looseEvent !== "undefined") {
|
|
24320
|
-
console.warn('web-speech-cognitive-services: The option "looseEvent" should be named as "looseEvents".');
|
|
24321
|
-
looseEvents = looseEvent;
|
|
24322
|
-
}
|
|
24323
|
-
if (!credentials) {
|
|
24324
|
-
if (!authorizationToken && !subscriptionKey) {
|
|
24325
|
-
throw new Error("web-speech-cognitive-services: Credentials must be specified.");
|
|
24326
|
-
} else {
|
|
24327
|
-
console.warn(
|
|
24328
|
-
"web-speech-cognitive-services: We are deprecating authorizationToken, region, and subscriptionKey. Please use credentials instead. The deprecated option will be removed on or after 2020-11-14."
|
|
24329
|
-
);
|
|
24330
|
-
credentials = async () => authorizationToken ? { authorizationToken: await resolveFunctionOrReturnValue(authorizationToken), region } : { region, subscriptionKey: await resolveFunctionOrReturnValue(subscriptionKey) };
|
|
23893
|
+
set onresult(value) {
|
|
23894
|
+
this.#eventListenerMap.setProperty("result", value);
|
|
24331
23895
|
}
|
|
24332
|
-
|
|
24333
|
-
|
|
24334
|
-
|
|
24335
|
-
fetchCredentials: async () => {
|
|
24336
|
-
const {
|
|
24337
|
-
authorizationToken: authorizationToken2,
|
|
24338
|
-
customVoiceHostname,
|
|
24339
|
-
region: region2,
|
|
24340
|
-
speechRecognitionHostname,
|
|
24341
|
-
speechSynthesisHostname,
|
|
24342
|
-
subscriptionKey: subscriptionKey2
|
|
24343
|
-
} = await resolveFunctionOrReturnValue(credentials);
|
|
24344
|
-
if (!authorizationToken2 && !subscriptionKey2 || authorizationToken2 && subscriptionKey2) {
|
|
24345
|
-
throw new Error(
|
|
24346
|
-
'web-speech-cognitive-services: Either "authorizationToken" or "subscriptionKey" must be provided.'
|
|
24347
|
-
);
|
|
24348
|
-
} else if (!region2 && !(speechRecognitionHostname && speechSynthesisHostname)) {
|
|
24349
|
-
throw new Error(
|
|
24350
|
-
'web-speech-cognitive-services: Either "region" or "speechRecognitionHostname" and "speechSynthesisHostname" must be set.'
|
|
24351
|
-
);
|
|
24352
|
-
} else if (region2 && (customVoiceHostname || speechRecognitionHostname || speechSynthesisHostname)) {
|
|
24353
|
-
throw new Error(
|
|
24354
|
-
'web-speech-cognitive-services: Only either "region" or "customVoiceHostname", "speechRecognitionHostname" and "speechSynthesisHostname" can be set.'
|
|
24355
|
-
);
|
|
24356
|
-
} else if (authorizationToken2) {
|
|
24357
|
-
if (typeof authorizationToken2 !== "string") {
|
|
24358
|
-
throw new Error('web-speech-cognitive-services: "authorizationToken" must be a string.');
|
|
24359
|
-
}
|
|
24360
|
-
} else if (typeof subscriptionKey2 !== "string") {
|
|
24361
|
-
throw new Error('web-speech-cognitive-services: "subscriptionKey" must be a string.');
|
|
24362
|
-
}
|
|
24363
|
-
if (shouldWarnOnSubscriptionKey && subscriptionKey2) {
|
|
24364
|
-
console.warn(
|
|
24365
|
-
"web-speech-cognitive-services: In production environment, subscription key should not be used, authorization token should be used instead."
|
|
24366
|
-
);
|
|
24367
|
-
shouldWarnOnSubscriptionKey = false;
|
|
24368
|
-
}
|
|
24369
|
-
const resolvedCredentials = authorizationToken2 ? { authorizationToken: authorizationToken2 } : { subscriptionKey: subscriptionKey2 };
|
|
24370
|
-
if (region2) {
|
|
24371
|
-
resolvedCredentials.region = region2;
|
|
24372
|
-
} else {
|
|
24373
|
-
resolvedCredentials.customVoiceHostname = customVoiceHostname;
|
|
24374
|
-
resolvedCredentials.speechRecognitionHostname = speechRecognitionHostname;
|
|
24375
|
-
resolvedCredentials.speechSynthesisHostname = speechSynthesisHostname;
|
|
24376
|
-
}
|
|
24377
|
-
return resolvedCredentials;
|
|
24378
|
-
},
|
|
24379
|
-
looseEvents
|
|
24380
|
-
};
|
|
24381
|
-
}
|
|
24382
|
-
|
|
24383
|
-
// src/SpeechServices/SpeechSDK.js
|
|
24384
|
-
var import_microsoft_cognitiveservices_speech = __toESM(require_microsoft_cognitiveservices_speech_sdk());
|
|
24385
|
-
var SpeechSDK_default = {
|
|
24386
|
-
AudioConfig: import_microsoft_cognitiveservices_speech.AudioConfig,
|
|
24387
|
-
OutputFormat: import_microsoft_cognitiveservices_speech.OutputFormat,
|
|
24388
|
-
ResultReason: import_microsoft_cognitiveservices_speech.ResultReason,
|
|
24389
|
-
SpeechConfig: import_microsoft_cognitiveservices_speech.SpeechConfig,
|
|
24390
|
-
SpeechRecognizer: import_microsoft_cognitiveservices_speech.SpeechRecognizer
|
|
24391
|
-
};
|
|
24392
|
-
|
|
24393
|
-
// src/Util/arrayToMap.js
|
|
24394
|
-
function arrayToMap_default(array, extras) {
|
|
24395
|
-
const map = {
|
|
24396
|
-
...[].reduce.call(
|
|
24397
|
-
array,
|
|
24398
|
-
(map2, value, index) => {
|
|
24399
|
-
map2[index] = value;
|
|
24400
|
-
return map2;
|
|
24401
|
-
},
|
|
24402
|
-
{}
|
|
24403
|
-
),
|
|
24404
|
-
...extras,
|
|
24405
|
-
length: array.length,
|
|
24406
|
-
[Symbol.iterator]: () => [].slice.call(map)[Symbol.iterator]()
|
|
24407
|
-
};
|
|
24408
|
-
return map;
|
|
24409
|
-
}
|
|
24410
|
-
|
|
24411
|
-
// src/SpeechServices/SpeechToText/cognitiveServiceEventResultToWebSpeechRecognitionResultList.js
|
|
24412
|
-
var {
|
|
24413
|
-
ResultReason: { RecognizingSpeech, RecognizedSpeech }
|
|
24414
|
-
} = SpeechSDK_default;
|
|
24415
|
-
function cognitiveServiceEventResultToWebSpeechRecognitionResultList_default(result, { maxAlternatives = Infinity, textNormalization = "display" } = {}) {
|
|
24416
|
-
if (result.reason === RecognizingSpeech || result.reason === RecognizedSpeech && !result.json.NBest) {
|
|
24417
|
-
const resultList = [
|
|
24418
|
-
{
|
|
24419
|
-
confidence: 0.5,
|
|
24420
|
-
transcript: result.text
|
|
24421
|
-
}
|
|
24422
|
-
];
|
|
24423
|
-
if (result.reason === RecognizedSpeech) {
|
|
24424
|
-
resultList.isFinal = true;
|
|
23896
|
+
/** @type { ((event: SpeechRecognitionEvent<'soundend'>) => void) | undefined } */
|
|
23897
|
+
get onsoundend() {
|
|
23898
|
+
return this.#eventListenerMap.getProperty("soundend");
|
|
24425
23899
|
}
|
|
24426
|
-
|
|
24427
|
-
|
|
24428
|
-
const resultList = arrayToMap_default(
|
|
24429
|
-
(result.json.NBest || []).slice(0, maxAlternatives).map(({ Confidence: confidence, Display: display, ITN: itn, Lexical: lexical, MaskedITN: maskedITN }) => ({
|
|
24430
|
-
confidence,
|
|
24431
|
-
transcript: textNormalization === "itn" ? itn : textNormalization === "lexical" ? lexical : textNormalization === "maskeditn" ? maskedITN : display
|
|
24432
|
-
})),
|
|
24433
|
-
{ isFinal: true }
|
|
24434
|
-
);
|
|
24435
|
-
return resultList;
|
|
24436
|
-
}
|
|
24437
|
-
return [];
|
|
24438
|
-
}
|
|
24439
|
-
|
|
24440
|
-
// src/SpeechServices/SpeechToText/SpeechGrammarList.js
|
|
24441
|
-
var SpeechGrammarList_default = class {
|
|
24442
|
-
constructor() {
|
|
24443
|
-
this._phrases = [];
|
|
24444
|
-
}
|
|
24445
|
-
addFromString() {
|
|
24446
|
-
throw new Error("JSGF is not supported");
|
|
24447
|
-
}
|
|
24448
|
-
get phrases() {
|
|
24449
|
-
return this._phrases;
|
|
24450
|
-
}
|
|
24451
|
-
set phrases(value) {
|
|
24452
|
-
if (Array.isArray(value)) {
|
|
24453
|
-
this._phrases = value;
|
|
24454
|
-
} else if (typeof value === "string") {
|
|
24455
|
-
this._phrases = [value];
|
|
24456
|
-
} else {
|
|
24457
|
-
throw new Error(`The provided value is not an array or of type 'string'`);
|
|
23900
|
+
set onsoundend(value) {
|
|
23901
|
+
this.#eventListenerMap.setProperty("soundend", value);
|
|
24458
23902
|
}
|
|
24459
|
-
|
|
24460
|
-
|
|
24461
|
-
|
|
24462
|
-
// src/SpeechServices/SpeechToText/createSpeechRecognitionPonyfill.js
|
|
24463
|
-
var { AudioConfig: AudioConfig2, OutputFormat: OutputFormat2, ResultReason: ResultReason2, SpeechConfig: SpeechConfig2, SpeechRecognizer: SpeechRecognizer2 } = SpeechSDK_default;
|
|
24464
|
-
function serializeRecognitionResult({ duration, errorDetails, json, offset, properties, reason, resultId, text }) {
|
|
24465
|
-
return {
|
|
24466
|
-
duration,
|
|
24467
|
-
errorDetails,
|
|
24468
|
-
json: JSON.parse(json),
|
|
24469
|
-
offset,
|
|
24470
|
-
properties,
|
|
24471
|
-
reason,
|
|
24472
|
-
resultId,
|
|
24473
|
-
text
|
|
24474
|
-
};
|
|
24475
|
-
}
|
|
24476
|
-
function averageAmplitude(arrayBuffer) {
|
|
24477
|
-
const array = new Int16Array(arrayBuffer);
|
|
24478
|
-
return [].reduce.call(array, (averageAmplitude2, amplitude) => averageAmplitude2 + Math.abs(amplitude), 0) / array.length;
|
|
24479
|
-
}
|
|
24480
|
-
function cognitiveServicesAsyncToPromise(fn) {
|
|
24481
|
-
return (...args) => new Promise((resolve, reject) => fn(...args, resolve, reject));
|
|
24482
|
-
}
|
|
24483
|
-
var SpeechRecognitionEvent = class extends Event {
|
|
24484
|
-
constructor(type, { data, emma, interpretation, resultIndex, results } = {}) {
|
|
24485
|
-
super(type);
|
|
24486
|
-
this.data = data;
|
|
24487
|
-
this.emma = emma;
|
|
24488
|
-
this.interpretation = interpretation;
|
|
24489
|
-
this.resultIndex = resultIndex;
|
|
24490
|
-
this.results = results;
|
|
24491
|
-
}
|
|
24492
|
-
};
|
|
24493
|
-
function prepareAudioConfig(audioConfig) {
|
|
24494
|
-
const originalAttach = audioConfig.attach;
|
|
24495
|
-
const boundOriginalAttach = audioConfig.attach.bind(audioConfig);
|
|
24496
|
-
let firstChunk;
|
|
24497
|
-
let muted;
|
|
24498
|
-
audioConfig.attach = async () => {
|
|
24499
|
-
const reader = await boundOriginalAttach();
|
|
24500
|
-
return {
|
|
24501
|
-
...reader,
|
|
24502
|
-
read: async () => {
|
|
24503
|
-
const chunk = await reader.read();
|
|
24504
|
-
if (!firstChunk && averageAmplitude(chunk.buffer) > 150) {
|
|
24505
|
-
audioConfig.events.onEvent({ name: "FirstAudibleChunk" });
|
|
24506
|
-
firstChunk = true;
|
|
24507
|
-
}
|
|
24508
|
-
if (muted) {
|
|
24509
|
-
return { buffer: new ArrayBuffer(0), isEnd: true, timeReceived: Date.now() };
|
|
24510
|
-
}
|
|
24511
|
-
return chunk;
|
|
24512
|
-
}
|
|
24513
|
-
};
|
|
24514
|
-
};
|
|
24515
|
-
return {
|
|
24516
|
-
audioConfig,
|
|
24517
|
-
pause: () => {
|
|
24518
|
-
muted = true;
|
|
24519
|
-
},
|
|
24520
|
-
unprepare: () => {
|
|
24521
|
-
audioConfig.attach = originalAttach;
|
|
23903
|
+
/** @type { ((event: SpeechRecognitionEvent<'soundstart'>) => void) | undefined } */
|
|
23904
|
+
get onsoundstart() {
|
|
23905
|
+
return this.#eventListenerMap.getProperty("soundstart");
|
|
24522
23906
|
}
|
|
24523
|
-
|
|
24524
|
-
|
|
24525
|
-
function createSpeechRecognitionPonyfillFromRecognizer({
|
|
24526
|
-
createRecognizer,
|
|
24527
|
-
enableTelemetry,
|
|
24528
|
-
looseEvents,
|
|
24529
|
-
referenceGrammars,
|
|
24530
|
-
textNormalization
|
|
24531
|
-
}) {
|
|
24532
|
-
SpeechRecognizer2.enableTelemetry(enableTelemetry !== false);
|
|
24533
|
-
class SpeechRecognition extends EventTarget {
|
|
24534
|
-
constructor() {
|
|
24535
|
-
super();
|
|
24536
|
-
this._continuous = false;
|
|
24537
|
-
this._interimResults = false;
|
|
24538
|
-
this._lang = typeof window !== "undefined" ? window.document.documentElement.getAttribute("lang") || window.navigator.language : "en-US";
|
|
24539
|
-
this._grammars = new SpeechGrammarList_default();
|
|
24540
|
-
this._maxAlternatives = 1;
|
|
24541
|
-
}
|
|
24542
|
-
emitCognitiveServices(type, event) {
|
|
24543
|
-
this.dispatchEvent(
|
|
24544
|
-
new SpeechRecognitionEvent("cognitiveservices", {
|
|
24545
|
-
data: {
|
|
24546
|
-
...event,
|
|
24547
|
-
type
|
|
24548
|
-
}
|
|
24549
|
-
})
|
|
24550
|
-
);
|
|
24551
|
-
}
|
|
24552
|
-
get continuous() {
|
|
24553
|
-
return this._continuous;
|
|
24554
|
-
}
|
|
24555
|
-
set continuous(value) {
|
|
24556
|
-
this._continuous = value;
|
|
24557
|
-
}
|
|
24558
|
-
get grammars() {
|
|
24559
|
-
return this._grammars;
|
|
24560
|
-
}
|
|
24561
|
-
set grammars(value) {
|
|
24562
|
-
if (value instanceof SpeechGrammarList_default) {
|
|
24563
|
-
this._grammars = value;
|
|
24564
|
-
} else {
|
|
24565
|
-
throw new Error(`The provided value is not of type 'SpeechGrammarList'`);
|
|
24566
|
-
}
|
|
24567
|
-
}
|
|
24568
|
-
get interimResults() {
|
|
24569
|
-
return this._interimResults;
|
|
24570
|
-
}
|
|
24571
|
-
set interimResults(value) {
|
|
24572
|
-
this._interimResults = value;
|
|
24573
|
-
}
|
|
24574
|
-
get maxAlternatives() {
|
|
24575
|
-
return this._maxAlternatives;
|
|
24576
|
-
}
|
|
24577
|
-
set maxAlternatives(value) {
|
|
24578
|
-
this._maxAlternatives = value;
|
|
24579
|
-
}
|
|
24580
|
-
get lang() {
|
|
24581
|
-
return this._lang;
|
|
24582
|
-
}
|
|
24583
|
-
set lang(value) {
|
|
24584
|
-
this._lang = value;
|
|
24585
|
-
}
|
|
24586
|
-
get onaudioend() {
|
|
24587
|
-
return getEventAttributeValue(this, "audioend");
|
|
24588
|
-
}
|
|
24589
|
-
set onaudioend(value) {
|
|
24590
|
-
setEventAttributeValue(this, "audioend", value);
|
|
24591
|
-
}
|
|
24592
|
-
get onaudiostart() {
|
|
24593
|
-
return getEventAttributeValue(this, "audiostart");
|
|
24594
|
-
}
|
|
24595
|
-
set onaudiostart(value) {
|
|
24596
|
-
setEventAttributeValue(this, "audiostart", value);
|
|
24597
|
-
}
|
|
24598
|
-
get oncognitiveservices() {
|
|
24599
|
-
return getEventAttributeValue(this, "cognitiveservices");
|
|
24600
|
-
}
|
|
24601
|
-
set oncognitiveservices(value) {
|
|
24602
|
-
setEventAttributeValue(this, "cognitiveservices", value);
|
|
24603
|
-
}
|
|
24604
|
-
get onend() {
|
|
24605
|
-
return getEventAttributeValue(this, "end");
|
|
24606
|
-
}
|
|
24607
|
-
set onend(value) {
|
|
24608
|
-
setEventAttributeValue(this, "end", value);
|
|
24609
|
-
}
|
|
24610
|
-
get onerror() {
|
|
24611
|
-
return getEventAttributeValue(this, "error");
|
|
24612
|
-
}
|
|
24613
|
-
set onerror(value) {
|
|
24614
|
-
setEventAttributeValue(this, "error", value);
|
|
24615
|
-
}
|
|
24616
|
-
get onresult() {
|
|
24617
|
-
return getEventAttributeValue(this, "result");
|
|
24618
|
-
}
|
|
24619
|
-
set onresult(value) {
|
|
24620
|
-
setEventAttributeValue(this, "result", value);
|
|
24621
|
-
}
|
|
24622
|
-
get onsoundend() {
|
|
24623
|
-
return getEventAttributeValue(this, "soundend");
|
|
24624
|
-
}
|
|
24625
|
-
set onsoundend(value) {
|
|
24626
|
-
setEventAttributeValue(this, "soundend", value);
|
|
24627
|
-
}
|
|
24628
|
-
get onsoundstart() {
|
|
24629
|
-
return getEventAttributeValue(this, "soundstart");
|
|
24630
|
-
}
|
|
24631
|
-
set onsoundstart(value) {
|
|
24632
|
-
setEventAttributeValue(this, "soundstart", value);
|
|
23907
|
+
set onsoundstart(value) {
|
|
23908
|
+
this.#eventListenerMap.setProperty("soundstart", value);
|
|
24633
23909
|
}
|
|
23910
|
+
/** @type { ((event: SpeechRecognitionEvent<'speechend'>) => void) | undefined } */
|
|
24634
23911
|
get onspeechend() {
|
|
24635
|
-
return
|
|
23912
|
+
return this.#eventListenerMap.getProperty("speechend");
|
|
24636
23913
|
}
|
|
24637
23914
|
set onspeechend(value) {
|
|
24638
|
-
|
|
23915
|
+
this.#eventListenerMap.setProperty("speechend", value);
|
|
24639
23916
|
}
|
|
23917
|
+
/** @type { ((event: SpeechRecognitionEvent<'speechstart'>) => void) | undefined } */
|
|
24640
23918
|
get onspeechstart() {
|
|
24641
|
-
return
|
|
23919
|
+
return this.#eventListenerMap.getProperty("speechstart");
|
|
24642
23920
|
}
|
|
24643
23921
|
set onspeechstart(value) {
|
|
24644
|
-
|
|
23922
|
+
this.#eventListenerMap.setProperty("speechstart", value);
|
|
24645
23923
|
}
|
|
23924
|
+
/** @type { ((event: SpeechRecognitionEvent<'start'>) => void) | undefined } */
|
|
24646
23925
|
get onstart() {
|
|
24647
|
-
return
|
|
23926
|
+
return this.#eventListenerMap.getProperty("start");
|
|
24648
23927
|
}
|
|
24649
23928
|
set onstart(value) {
|
|
24650
|
-
|
|
23929
|
+
this.#eventListenerMap.setProperty("start", value);
|
|
24651
23930
|
}
|
|
24652
23931
|
start() {
|
|
24653
23932
|
this._startOnce().catch((err) => {
|
|
24654
|
-
this.dispatchEvent(
|
|
23933
|
+
this.dispatchEvent(
|
|
23934
|
+
new SpeechRecognitionErrorEvent("error", { error: err, message: err && (err.stack || err.message) })
|
|
23935
|
+
);
|
|
24655
23936
|
});
|
|
24656
23937
|
}
|
|
24657
23938
|
async _startOnce() {
|
|
@@ -24741,10 +24022,7 @@
|
|
|
24741
24022
|
Object.keys(event).forEach((name) => this.emitCognitiveServices(name, event[name]));
|
|
24742
24023
|
const errorMessage = canceled && canceled.errorDetails;
|
|
24743
24024
|
if (/Permission\sdenied/u.test(errorMessage || "")) {
|
|
24744
|
-
finalEvent = {
|
|
24745
|
-
error: "not-allowed",
|
|
24746
|
-
type: "error"
|
|
24747
|
-
};
|
|
24025
|
+
finalEvent = new SpeechRecognitionErrorEvent("error", { error: "not-allowed" });
|
|
24748
24026
|
break;
|
|
24749
24027
|
}
|
|
24750
24028
|
if (!loop) {
|
|
@@ -24756,23 +24034,14 @@
|
|
|
24756
24034
|
this.dispatchEvent(new SpeechRecognitionEvent("audiostart"));
|
|
24757
24035
|
this.dispatchEvent(new SpeechRecognitionEvent("audioend"));
|
|
24758
24036
|
}
|
|
24759
|
-
finalEvent = {
|
|
24760
|
-
error: "network",
|
|
24761
|
-
type: "error"
|
|
24762
|
-
};
|
|
24037
|
+
finalEvent = new SpeechRecognitionErrorEvent("error", { error: "network" });
|
|
24763
24038
|
} else {
|
|
24764
|
-
finalEvent = {
|
|
24765
|
-
error: "unknown",
|
|
24766
|
-
type: "error"
|
|
24767
|
-
};
|
|
24039
|
+
finalEvent = new SpeechRecognitionErrorEvent("error", { error: "unknown" });
|
|
24768
24040
|
}
|
|
24769
24041
|
break;
|
|
24770
24042
|
} else if (abort || stop) {
|
|
24771
24043
|
if (abort) {
|
|
24772
|
-
finalEvent = {
|
|
24773
|
-
error: "aborted",
|
|
24774
|
-
type: "error"
|
|
24775
|
-
};
|
|
24044
|
+
finalEvent = new SpeechRecognitionErrorEvent("error", { error: "aborted" });
|
|
24776
24045
|
stopping = "abort";
|
|
24777
24046
|
} else {
|
|
24778
24047
|
pause();
|
|
@@ -24796,10 +24065,7 @@
|
|
|
24796
24065
|
} else if (stopping !== "abort") {
|
|
24797
24066
|
if (recognized && recognized.result && recognized.result.reason === ResultReason2.NoMatch) {
|
|
24798
24067
|
if (!this.continuous || stopping === "stop") {
|
|
24799
|
-
finalEvent = {
|
|
24800
|
-
results: [],
|
|
24801
|
-
type: "result"
|
|
24802
|
-
};
|
|
24068
|
+
finalEvent = new SpeechRecognitionEvent("result", { results: finalizedResults });
|
|
24803
24069
|
recognizer.stopContinuousRecognitionAsync && await cognitiveServicesAsyncToPromise(recognizer.stopContinuousRecognitionAsync.bind(recognizer))();
|
|
24804
24070
|
break;
|
|
24805
24071
|
}
|
|
@@ -24817,7 +24083,7 @@
|
|
|
24817
24083
|
speechStarted = true;
|
|
24818
24084
|
}
|
|
24819
24085
|
if (recognized) {
|
|
24820
|
-
const result =
|
|
24086
|
+
const result = cognitiveServiceEventResultToWebSpeechRecognitionResult_default(recognized.result, {
|
|
24821
24087
|
maxAlternatives: this.maxAlternatives,
|
|
24822
24088
|
textNormalization
|
|
24823
24089
|
});
|
|
@@ -24826,35 +24092,34 @@
|
|
|
24826
24092
|
finalizedResults = [...finalizedResults, result];
|
|
24827
24093
|
this.continuous && this.dispatchEvent(
|
|
24828
24094
|
new SpeechRecognitionEvent("result", {
|
|
24829
|
-
results: finalizedResults
|
|
24095
|
+
results: new SpeechRecognitionResultList(finalizedResults)
|
|
24830
24096
|
})
|
|
24831
24097
|
);
|
|
24832
24098
|
}
|
|
24833
24099
|
if (this.continuous && recognizable) {
|
|
24834
|
-
finalEvent =
|
|
24100
|
+
finalEvent = void 0;
|
|
24835
24101
|
} else {
|
|
24836
|
-
finalEvent = {
|
|
24837
|
-
results: finalizedResults
|
|
24838
|
-
|
|
24839
|
-
};
|
|
24102
|
+
finalEvent = new SpeechRecognitionEvent("result", {
|
|
24103
|
+
results: new SpeechRecognitionResultList(finalizedResults)
|
|
24104
|
+
});
|
|
24840
24105
|
}
|
|
24841
24106
|
if ((!this.continuous || stopping === "stop") && recognizer.stopContinuousRecognitionAsync) {
|
|
24842
24107
|
await cognitiveServicesAsyncToPromise(recognizer.stopContinuousRecognitionAsync.bind(recognizer))();
|
|
24843
24108
|
}
|
|
24844
24109
|
if (looseEvents && finalEvent && recognizable) {
|
|
24845
|
-
this.dispatchEvent(
|
|
24846
|
-
finalEvent =
|
|
24110
|
+
this.dispatchEvent(finalEvent);
|
|
24111
|
+
finalEvent = void 0;
|
|
24847
24112
|
}
|
|
24848
24113
|
} else if (recognizing) {
|
|
24849
24114
|
this.interimResults && this.dispatchEvent(
|
|
24850
24115
|
new SpeechRecognitionEvent("result", {
|
|
24851
|
-
results: [
|
|
24116
|
+
results: new SpeechRecognitionResultList([
|
|
24852
24117
|
...finalizedResults,
|
|
24853
|
-
|
|
24118
|
+
cognitiveServiceEventResultToWebSpeechRecognitionResult_default(recognizing.result, {
|
|
24854
24119
|
maxAlternatives: this.maxAlternatives,
|
|
24855
24120
|
textNormalization
|
|
24856
24121
|
})
|
|
24857
|
-
]
|
|
24122
|
+
])
|
|
24858
24123
|
})
|
|
24859
24124
|
);
|
|
24860
24125
|
}
|
|
@@ -24867,90 +24132,913 @@
|
|
|
24867
24132
|
if (soundStarted) {
|
|
24868
24133
|
this.dispatchEvent(new SpeechRecognitionEvent("soundend"));
|
|
24869
24134
|
}
|
|
24870
|
-
if (audioStarted) {
|
|
24871
|
-
this.dispatchEvent(new SpeechRecognitionEvent("audioend"));
|
|
24135
|
+
if (audioStarted) {
|
|
24136
|
+
this.dispatchEvent(new SpeechRecognitionEvent("audioend"));
|
|
24137
|
+
}
|
|
24138
|
+
if (finalEvent) {
|
|
24139
|
+
if (finalEvent.type === "result" && !finalEvent.results.length) {
|
|
24140
|
+
finalEvent = new SpeechRecognitionErrorEvent("error", { error: "no-speech" });
|
|
24141
|
+
}
|
|
24142
|
+
this.dispatchEvent(finalEvent);
|
|
24143
|
+
}
|
|
24144
|
+
this.dispatchEvent(new SpeechRecognitionEvent("end"));
|
|
24145
|
+
detachAudioConfigEvent();
|
|
24146
|
+
} catch (err) {
|
|
24147
|
+
console.error(err);
|
|
24148
|
+
throw err;
|
|
24149
|
+
} finally {
|
|
24150
|
+
unprepare();
|
|
24151
|
+
recognizer.dispose();
|
|
24152
|
+
}
|
|
24153
|
+
}
|
|
24154
|
+
}
|
|
24155
|
+
return {
|
|
24156
|
+
SpeechGrammarList: SpeechGrammarList_default,
|
|
24157
|
+
SpeechRecognition,
|
|
24158
|
+
SpeechRecognitionEvent
|
|
24159
|
+
};
|
|
24160
|
+
}
|
|
24161
|
+
var createSpeechRecognitionPonyfill_default = (options) => {
|
|
24162
|
+
const {
|
|
24163
|
+
audioConfig = AudioConfig2.fromDefaultMicrophoneInput(),
|
|
24164
|
+
// We set telemetry to true to honor the default telemetry settings of Speech SDK
|
|
24165
|
+
// https://github.com/Microsoft/cognitive-services-speech-sdk-js#data--telemetry
|
|
24166
|
+
enableTelemetry = true,
|
|
24167
|
+
fetchCredentials,
|
|
24168
|
+
looseEvents,
|
|
24169
|
+
referenceGrammars,
|
|
24170
|
+
speechRecognitionEndpointId,
|
|
24171
|
+
textNormalization = "display"
|
|
24172
|
+
} = patchOptions(options);
|
|
24173
|
+
if (!audioConfig && (!window.navigator.mediaDevices || !window.navigator.mediaDevices.getUserMedia)) {
|
|
24174
|
+
console.warn(
|
|
24175
|
+
"web-speech-cognitive-services: This browser does not support WebRTC and it will not work with Cognitive Services Speech Services."
|
|
24176
|
+
);
|
|
24177
|
+
return {};
|
|
24178
|
+
}
|
|
24179
|
+
const createRecognizer = async (lang) => {
|
|
24180
|
+
const { authorizationToken, region, speechRecognitionHostname, subscriptionKey } = await fetchCredentials();
|
|
24181
|
+
let speechConfig;
|
|
24182
|
+
if (speechRecognitionHostname) {
|
|
24183
|
+
const host = { hostname: speechRecognitionHostname, port: 443, protocol: "wss:" };
|
|
24184
|
+
if (authorizationToken) {
|
|
24185
|
+
speechConfig = SpeechConfig2.fromHost(host);
|
|
24186
|
+
speechConfig.authorizationToken = authorizationToken;
|
|
24187
|
+
} else {
|
|
24188
|
+
speechConfig = SpeechConfig2.fromHost(host, subscriptionKey);
|
|
24189
|
+
}
|
|
24190
|
+
} else {
|
|
24191
|
+
speechConfig = authorizationToken ? SpeechConfig2.fromAuthorizationToken(authorizationToken, region) : SpeechConfig2.fromSubscription(subscriptionKey, region);
|
|
24192
|
+
}
|
|
24193
|
+
if (speechRecognitionEndpointId) {
|
|
24194
|
+
speechConfig.endpointId = speechRecognitionEndpointId;
|
|
24195
|
+
}
|
|
24196
|
+
speechConfig.outputFormat = OutputFormat2.Detailed;
|
|
24197
|
+
speechConfig.speechRecognitionLanguage = lang || "en-US";
|
|
24198
|
+
return new SpeechRecognizer2(speechConfig, audioConfig);
|
|
24199
|
+
};
|
|
24200
|
+
return createSpeechRecognitionPonyfillFromRecognizer({
|
|
24201
|
+
audioConfig,
|
|
24202
|
+
createRecognizer,
|
|
24203
|
+
enableTelemetry,
|
|
24204
|
+
looseEvents,
|
|
24205
|
+
referenceGrammars,
|
|
24206
|
+
textNormalization
|
|
24207
|
+
});
|
|
24208
|
+
};
|
|
24209
|
+
|
|
24210
|
+
// src/SpeechServices/SpeechToText.js
|
|
24211
|
+
var SpeechToText_default = createSpeechRecognitionPonyfill_default;
|
|
24212
|
+
|
|
24213
|
+
// ../../node_modules/event-target-shim/index.mjs
|
|
24214
|
+
function assertType(condition, message, ...args) {
|
|
24215
|
+
if (!condition) {
|
|
24216
|
+
throw new TypeError(format(message, args));
|
|
24217
|
+
}
|
|
24218
|
+
}
|
|
24219
|
+
function format(message, args) {
|
|
24220
|
+
let i = 0;
|
|
24221
|
+
return message.replace(/%[os]/gu, () => anyToString(args[i++]));
|
|
24222
|
+
}
|
|
24223
|
+
function anyToString(x) {
|
|
24224
|
+
if (typeof x !== "object" || x === null) {
|
|
24225
|
+
return String(x);
|
|
24226
|
+
}
|
|
24227
|
+
return Object.prototype.toString.call(x);
|
|
24228
|
+
}
|
|
24229
|
+
var currentErrorHandler;
|
|
24230
|
+
function reportError(maybeError) {
|
|
24231
|
+
try {
|
|
24232
|
+
const error = maybeError instanceof Error ? maybeError : new Error(anyToString(maybeError));
|
|
24233
|
+
if (currentErrorHandler) {
|
|
24234
|
+
currentErrorHandler(error);
|
|
24235
|
+
return;
|
|
24236
|
+
}
|
|
24237
|
+
if (typeof dispatchEvent === "function" && typeof ErrorEvent === "function") {
|
|
24238
|
+
dispatchEvent(new ErrorEvent("error", { error, message: error.message }));
|
|
24239
|
+
} else if (typeof process !== "undefined" && typeof process.emit === "function") {
|
|
24240
|
+
process.emit("uncaughtException", error);
|
|
24241
|
+
return;
|
|
24242
|
+
}
|
|
24243
|
+
console.error(error);
|
|
24244
|
+
} catch (_a) {
|
|
24245
|
+
}
|
|
24246
|
+
}
|
|
24247
|
+
var Global = typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : typeof globalThis !== "undefined" ? globalThis : void 0;
|
|
24248
|
+
var currentWarnHandler;
|
|
24249
|
+
var Warning = class {
|
|
24250
|
+
constructor(code, message) {
|
|
24251
|
+
this.code = code;
|
|
24252
|
+
this.message = message;
|
|
24253
|
+
}
|
|
24254
|
+
/**
|
|
24255
|
+
* Report this warning.
|
|
24256
|
+
* @param args The arguments of the warning.
|
|
24257
|
+
*/
|
|
24258
|
+
warn(...args) {
|
|
24259
|
+
var _a;
|
|
24260
|
+
try {
|
|
24261
|
+
if (currentWarnHandler) {
|
|
24262
|
+
currentWarnHandler({ ...this, args });
|
|
24263
|
+
return;
|
|
24264
|
+
}
|
|
24265
|
+
const stack = ((_a = new Error().stack) !== null && _a !== void 0 ? _a : "").replace(/^(?:.+?\n){2}/gu, "\n");
|
|
24266
|
+
console.warn(this.message, ...args, stack);
|
|
24267
|
+
} catch (_b) {
|
|
24268
|
+
}
|
|
24269
|
+
}
|
|
24270
|
+
};
|
|
24271
|
+
var InitEventWasCalledWhileDispatching = new Warning("W01", "Unable to initialize event under dispatching.");
|
|
24272
|
+
var FalsyWasAssignedToCancelBubble = new Warning("W02", "Assigning any falsy value to 'cancelBubble' property has no effect.");
|
|
24273
|
+
var TruthyWasAssignedToReturnValue = new Warning("W03", "Assigning any truthy value to 'returnValue' property has no effect.");
|
|
24274
|
+
var NonCancelableEventWasCanceled = new Warning("W04", "Unable to preventDefault on non-cancelable events.");
|
|
24275
|
+
var CanceledInPassiveListener = new Warning("W05", "Unable to preventDefault inside passive event listener invocation.");
|
|
24276
|
+
var EventListenerWasDuplicated = new Warning("W06", "An event listener wasn't added because it has been added already: %o, %o");
|
|
24277
|
+
var OptionWasIgnored = new Warning("W07", "The %o option value was abandoned because the event listener wasn't added as duplicated.");
|
|
24278
|
+
var InvalidEventListener = new Warning("W08", "The 'callback' argument must be a function or an object that has 'handleEvent' method: %o");
|
|
24279
|
+
var InvalidAttributeHandler = new Warning("W09", "Event attribute handler must be a function: %o");
|
|
24280
|
+
var Event2 = class {
|
|
24281
|
+
/**
|
|
24282
|
+
* @see https://dom.spec.whatwg.org/#dom-event-none
|
|
24283
|
+
*/
|
|
24284
|
+
static get NONE() {
|
|
24285
|
+
return NONE;
|
|
24286
|
+
}
|
|
24287
|
+
/**
|
|
24288
|
+
* @see https://dom.spec.whatwg.org/#dom-event-capturing_phase
|
|
24289
|
+
*/
|
|
24290
|
+
static get CAPTURING_PHASE() {
|
|
24291
|
+
return CAPTURING_PHASE;
|
|
24292
|
+
}
|
|
24293
|
+
/**
|
|
24294
|
+
* @see https://dom.spec.whatwg.org/#dom-event-at_target
|
|
24295
|
+
*/
|
|
24296
|
+
static get AT_TARGET() {
|
|
24297
|
+
return AT_TARGET;
|
|
24298
|
+
}
|
|
24299
|
+
/**
|
|
24300
|
+
* @see https://dom.spec.whatwg.org/#dom-event-bubbling_phase
|
|
24301
|
+
*/
|
|
24302
|
+
static get BUBBLING_PHASE() {
|
|
24303
|
+
return BUBBLING_PHASE;
|
|
24304
|
+
}
|
|
24305
|
+
/**
|
|
24306
|
+
* Initialize this event instance.
|
|
24307
|
+
* @param type The type of this event.
|
|
24308
|
+
* @param eventInitDict Options to initialize.
|
|
24309
|
+
* @see https://dom.spec.whatwg.org/#dom-event-event
|
|
24310
|
+
*/
|
|
24311
|
+
constructor(type, eventInitDict) {
|
|
24312
|
+
Object.defineProperty(this, "isTrusted", {
|
|
24313
|
+
value: false,
|
|
24314
|
+
enumerable: true
|
|
24315
|
+
});
|
|
24316
|
+
const opts = eventInitDict !== null && eventInitDict !== void 0 ? eventInitDict : {};
|
|
24317
|
+
internalDataMap.set(this, {
|
|
24318
|
+
type: String(type),
|
|
24319
|
+
bubbles: Boolean(opts.bubbles),
|
|
24320
|
+
cancelable: Boolean(opts.cancelable),
|
|
24321
|
+
composed: Boolean(opts.composed),
|
|
24322
|
+
target: null,
|
|
24323
|
+
currentTarget: null,
|
|
24324
|
+
stopPropagationFlag: false,
|
|
24325
|
+
stopImmediatePropagationFlag: false,
|
|
24326
|
+
canceledFlag: false,
|
|
24327
|
+
inPassiveListenerFlag: false,
|
|
24328
|
+
dispatchFlag: false,
|
|
24329
|
+
timeStamp: Date.now()
|
|
24330
|
+
});
|
|
24331
|
+
}
|
|
24332
|
+
/**
|
|
24333
|
+
* The type of this event.
|
|
24334
|
+
* @see https://dom.spec.whatwg.org/#dom-event-type
|
|
24335
|
+
*/
|
|
24336
|
+
get type() {
|
|
24337
|
+
return $(this).type;
|
|
24338
|
+
}
|
|
24339
|
+
/**
|
|
24340
|
+
* The event target of the current dispatching.
|
|
24341
|
+
* @see https://dom.spec.whatwg.org/#dom-event-target
|
|
24342
|
+
*/
|
|
24343
|
+
get target() {
|
|
24344
|
+
return $(this).target;
|
|
24345
|
+
}
|
|
24346
|
+
/**
|
|
24347
|
+
* The event target of the current dispatching.
|
|
24348
|
+
* @deprecated Use the `target` property instead.
|
|
24349
|
+
* @see https://dom.spec.whatwg.org/#dom-event-srcelement
|
|
24350
|
+
*/
|
|
24351
|
+
get srcElement() {
|
|
24352
|
+
return $(this).target;
|
|
24353
|
+
}
|
|
24354
|
+
/**
|
|
24355
|
+
* The event target of the current dispatching.
|
|
24356
|
+
* @see https://dom.spec.whatwg.org/#dom-event-currenttarget
|
|
24357
|
+
*/
|
|
24358
|
+
get currentTarget() {
|
|
24359
|
+
return $(this).currentTarget;
|
|
24360
|
+
}
|
|
24361
|
+
/**
|
|
24362
|
+
* The event target of the current dispatching.
|
|
24363
|
+
* This doesn't support node tree.
|
|
24364
|
+
* @see https://dom.spec.whatwg.org/#dom-event-composedpath
|
|
24365
|
+
*/
|
|
24366
|
+
composedPath() {
|
|
24367
|
+
const currentTarget = $(this).currentTarget;
|
|
24368
|
+
if (currentTarget) {
|
|
24369
|
+
return [currentTarget];
|
|
24370
|
+
}
|
|
24371
|
+
return [];
|
|
24372
|
+
}
|
|
24373
|
+
/**
|
|
24374
|
+
* @see https://dom.spec.whatwg.org/#dom-event-none
|
|
24375
|
+
*/
|
|
24376
|
+
get NONE() {
|
|
24377
|
+
return NONE;
|
|
24378
|
+
}
|
|
24379
|
+
/**
|
|
24380
|
+
* @see https://dom.spec.whatwg.org/#dom-event-capturing_phase
|
|
24381
|
+
*/
|
|
24382
|
+
get CAPTURING_PHASE() {
|
|
24383
|
+
return CAPTURING_PHASE;
|
|
24384
|
+
}
|
|
24385
|
+
/**
|
|
24386
|
+
* @see https://dom.spec.whatwg.org/#dom-event-at_target
|
|
24387
|
+
*/
|
|
24388
|
+
get AT_TARGET() {
|
|
24389
|
+
return AT_TARGET;
|
|
24390
|
+
}
|
|
24391
|
+
/**
|
|
24392
|
+
* @see https://dom.spec.whatwg.org/#dom-event-bubbling_phase
|
|
24393
|
+
*/
|
|
24394
|
+
get BUBBLING_PHASE() {
|
|
24395
|
+
return BUBBLING_PHASE;
|
|
24396
|
+
}
|
|
24397
|
+
/**
|
|
24398
|
+
* The current event phase.
|
|
24399
|
+
* @see https://dom.spec.whatwg.org/#dom-event-eventphase
|
|
24400
|
+
*/
|
|
24401
|
+
get eventPhase() {
|
|
24402
|
+
return $(this).dispatchFlag ? 2 : 0;
|
|
24403
|
+
}
|
|
24404
|
+
/**
|
|
24405
|
+
* Stop event bubbling.
|
|
24406
|
+
* Because this shim doesn't support node tree, this merely changes the `cancelBubble` property value.
|
|
24407
|
+
* @see https://dom.spec.whatwg.org/#dom-event-stoppropagation
|
|
24408
|
+
*/
|
|
24409
|
+
stopPropagation() {
|
|
24410
|
+
$(this).stopPropagationFlag = true;
|
|
24411
|
+
}
|
|
24412
|
+
/**
|
|
24413
|
+
* `true` if event bubbling was stopped.
|
|
24414
|
+
* @deprecated
|
|
24415
|
+
* @see https://dom.spec.whatwg.org/#dom-event-cancelbubble
|
|
24416
|
+
*/
|
|
24417
|
+
get cancelBubble() {
|
|
24418
|
+
return $(this).stopPropagationFlag;
|
|
24419
|
+
}
|
|
24420
|
+
/**
|
|
24421
|
+
* Stop event bubbling if `true` is set.
|
|
24422
|
+
* @deprecated Use the `stopPropagation()` method instead.
|
|
24423
|
+
* @see https://dom.spec.whatwg.org/#dom-event-cancelbubble
|
|
24424
|
+
*/
|
|
24425
|
+
set cancelBubble(value) {
|
|
24426
|
+
if (value) {
|
|
24427
|
+
$(this).stopPropagationFlag = true;
|
|
24428
|
+
} else {
|
|
24429
|
+
FalsyWasAssignedToCancelBubble.warn();
|
|
24430
|
+
}
|
|
24431
|
+
}
|
|
24432
|
+
/**
|
|
24433
|
+
* Stop event bubbling and subsequent event listener callings.
|
|
24434
|
+
* @see https://dom.spec.whatwg.org/#dom-event-stopimmediatepropagation
|
|
24435
|
+
*/
|
|
24436
|
+
stopImmediatePropagation() {
|
|
24437
|
+
const data = $(this);
|
|
24438
|
+
data.stopPropagationFlag = data.stopImmediatePropagationFlag = true;
|
|
24439
|
+
}
|
|
24440
|
+
/**
|
|
24441
|
+
* `true` if this event will bubble.
|
|
24442
|
+
* @see https://dom.spec.whatwg.org/#dom-event-bubbles
|
|
24443
|
+
*/
|
|
24444
|
+
get bubbles() {
|
|
24445
|
+
return $(this).bubbles;
|
|
24446
|
+
}
|
|
24447
|
+
/**
|
|
24448
|
+
* `true` if this event can be canceled by the `preventDefault()` method.
|
|
24449
|
+
* @see https://dom.spec.whatwg.org/#dom-event-cancelable
|
|
24450
|
+
*/
|
|
24451
|
+
get cancelable() {
|
|
24452
|
+
return $(this).cancelable;
|
|
24453
|
+
}
|
|
24454
|
+
/**
|
|
24455
|
+
* `true` if the default behavior will act.
|
|
24456
|
+
* @deprecated Use the `defaultPrevented` proeprty instead.
|
|
24457
|
+
* @see https://dom.spec.whatwg.org/#dom-event-returnvalue
|
|
24458
|
+
*/
|
|
24459
|
+
get returnValue() {
|
|
24460
|
+
return !$(this).canceledFlag;
|
|
24461
|
+
}
|
|
24462
|
+
/**
|
|
24463
|
+
* Cancel the default behavior if `false` is set.
|
|
24464
|
+
* @deprecated Use the `preventDefault()` method instead.
|
|
24465
|
+
* @see https://dom.spec.whatwg.org/#dom-event-returnvalue
|
|
24466
|
+
*/
|
|
24467
|
+
set returnValue(value) {
|
|
24468
|
+
if (!value) {
|
|
24469
|
+
setCancelFlag($(this));
|
|
24470
|
+
} else {
|
|
24471
|
+
TruthyWasAssignedToReturnValue.warn();
|
|
24472
|
+
}
|
|
24473
|
+
}
|
|
24474
|
+
/**
|
|
24475
|
+
* Cancel the default behavior.
|
|
24476
|
+
* @see https://dom.spec.whatwg.org/#dom-event-preventdefault
|
|
24477
|
+
*/
|
|
24478
|
+
preventDefault() {
|
|
24479
|
+
setCancelFlag($(this));
|
|
24480
|
+
}
|
|
24481
|
+
/**
|
|
24482
|
+
* `true` if the default behavior was canceled.
|
|
24483
|
+
* @see https://dom.spec.whatwg.org/#dom-event-defaultprevented
|
|
24484
|
+
*/
|
|
24485
|
+
get defaultPrevented() {
|
|
24486
|
+
return $(this).canceledFlag;
|
|
24487
|
+
}
|
|
24488
|
+
/**
|
|
24489
|
+
* @see https://dom.spec.whatwg.org/#dom-event-composed
|
|
24490
|
+
*/
|
|
24491
|
+
get composed() {
|
|
24492
|
+
return $(this).composed;
|
|
24493
|
+
}
|
|
24494
|
+
/**
|
|
24495
|
+
* @see https://dom.spec.whatwg.org/#dom-event-istrusted
|
|
24496
|
+
*/
|
|
24497
|
+
//istanbul ignore next
|
|
24498
|
+
get isTrusted() {
|
|
24499
|
+
return false;
|
|
24500
|
+
}
|
|
24501
|
+
/**
|
|
24502
|
+
* @see https://dom.spec.whatwg.org/#dom-event-timestamp
|
|
24503
|
+
*/
|
|
24504
|
+
get timeStamp() {
|
|
24505
|
+
return $(this).timeStamp;
|
|
24506
|
+
}
|
|
24507
|
+
/**
|
|
24508
|
+
* @deprecated Don't use this method. The constructor did initialization.
|
|
24509
|
+
*/
|
|
24510
|
+
initEvent(type, bubbles = false, cancelable = false) {
|
|
24511
|
+
const data = $(this);
|
|
24512
|
+
if (data.dispatchFlag) {
|
|
24513
|
+
InitEventWasCalledWhileDispatching.warn();
|
|
24514
|
+
return;
|
|
24515
|
+
}
|
|
24516
|
+
internalDataMap.set(this, {
|
|
24517
|
+
...data,
|
|
24518
|
+
type: String(type),
|
|
24519
|
+
bubbles: Boolean(bubbles),
|
|
24520
|
+
cancelable: Boolean(cancelable),
|
|
24521
|
+
target: null,
|
|
24522
|
+
currentTarget: null,
|
|
24523
|
+
stopPropagationFlag: false,
|
|
24524
|
+
stopImmediatePropagationFlag: false,
|
|
24525
|
+
canceledFlag: false
|
|
24526
|
+
});
|
|
24527
|
+
}
|
|
24528
|
+
};
|
|
24529
|
+
var NONE = 0;
|
|
24530
|
+
var CAPTURING_PHASE = 1;
|
|
24531
|
+
var AT_TARGET = 2;
|
|
24532
|
+
var BUBBLING_PHASE = 3;
|
|
24533
|
+
var internalDataMap = /* @__PURE__ */ new WeakMap();
|
|
24534
|
+
function $(event, name = "this") {
|
|
24535
|
+
const retv = internalDataMap.get(event);
|
|
24536
|
+
assertType(retv != null, "'%s' must be an object that Event constructor created, but got another one: %o", name, event);
|
|
24537
|
+
return retv;
|
|
24538
|
+
}
|
|
24539
|
+
function setCancelFlag(data) {
|
|
24540
|
+
if (data.inPassiveListenerFlag) {
|
|
24541
|
+
CanceledInPassiveListener.warn();
|
|
24542
|
+
return;
|
|
24543
|
+
}
|
|
24544
|
+
if (!data.cancelable) {
|
|
24545
|
+
NonCancelableEventWasCanceled.warn();
|
|
24546
|
+
return;
|
|
24547
|
+
}
|
|
24548
|
+
data.canceledFlag = true;
|
|
24549
|
+
}
|
|
24550
|
+
Object.defineProperty(Event2, "NONE", { enumerable: true });
|
|
24551
|
+
Object.defineProperty(Event2, "CAPTURING_PHASE", { enumerable: true });
|
|
24552
|
+
Object.defineProperty(Event2, "AT_TARGET", { enumerable: true });
|
|
24553
|
+
Object.defineProperty(Event2, "BUBBLING_PHASE", { enumerable: true });
|
|
24554
|
+
var keys = Object.getOwnPropertyNames(Event2.prototype);
|
|
24555
|
+
for (let i = 0; i < keys.length; ++i) {
|
|
24556
|
+
if (keys[i] === "constructor") {
|
|
24557
|
+
continue;
|
|
24558
|
+
}
|
|
24559
|
+
Object.defineProperty(Event2.prototype, keys[i], { enumerable: true });
|
|
24560
|
+
}
|
|
24561
|
+
if (typeof Global !== "undefined" && typeof Global.Event !== "undefined") {
|
|
24562
|
+
Object.setPrototypeOf(Event2.prototype, Global.Event.prototype);
|
|
24563
|
+
}
|
|
24564
|
+
function createInvalidStateError(message) {
|
|
24565
|
+
if (Global.DOMException) {
|
|
24566
|
+
return new Global.DOMException(message, "InvalidStateError");
|
|
24567
|
+
}
|
|
24568
|
+
if (DOMException == null) {
|
|
24569
|
+
DOMException = class DOMException2 extends Error {
|
|
24570
|
+
constructor(msg) {
|
|
24571
|
+
super(msg);
|
|
24572
|
+
if (Error.captureStackTrace) {
|
|
24573
|
+
Error.captureStackTrace(this, DOMException2);
|
|
24574
|
+
}
|
|
24575
|
+
}
|
|
24576
|
+
// eslint-disable-next-line class-methods-use-this
|
|
24577
|
+
get code() {
|
|
24578
|
+
return 11;
|
|
24579
|
+
}
|
|
24580
|
+
// eslint-disable-next-line class-methods-use-this
|
|
24581
|
+
get name() {
|
|
24582
|
+
return "InvalidStateError";
|
|
24583
|
+
}
|
|
24584
|
+
};
|
|
24585
|
+
Object.defineProperties(DOMException.prototype, {
|
|
24586
|
+
code: { enumerable: true },
|
|
24587
|
+
name: { enumerable: true }
|
|
24588
|
+
});
|
|
24589
|
+
defineErrorCodeProperties(DOMException);
|
|
24590
|
+
defineErrorCodeProperties(DOMException.prototype);
|
|
24591
|
+
}
|
|
24592
|
+
return new DOMException(message);
|
|
24593
|
+
}
|
|
24594
|
+
var DOMException;
|
|
24595
|
+
var ErrorCodeMap = {
|
|
24596
|
+
INDEX_SIZE_ERR: 1,
|
|
24597
|
+
DOMSTRING_SIZE_ERR: 2,
|
|
24598
|
+
HIERARCHY_REQUEST_ERR: 3,
|
|
24599
|
+
WRONG_DOCUMENT_ERR: 4,
|
|
24600
|
+
INVALID_CHARACTER_ERR: 5,
|
|
24601
|
+
NO_DATA_ALLOWED_ERR: 6,
|
|
24602
|
+
NO_MODIFICATION_ALLOWED_ERR: 7,
|
|
24603
|
+
NOT_FOUND_ERR: 8,
|
|
24604
|
+
NOT_SUPPORTED_ERR: 9,
|
|
24605
|
+
INUSE_ATTRIBUTE_ERR: 10,
|
|
24606
|
+
INVALID_STATE_ERR: 11,
|
|
24607
|
+
SYNTAX_ERR: 12,
|
|
24608
|
+
INVALID_MODIFICATION_ERR: 13,
|
|
24609
|
+
NAMESPACE_ERR: 14,
|
|
24610
|
+
INVALID_ACCESS_ERR: 15,
|
|
24611
|
+
VALIDATION_ERR: 16,
|
|
24612
|
+
TYPE_MISMATCH_ERR: 17,
|
|
24613
|
+
SECURITY_ERR: 18,
|
|
24614
|
+
NETWORK_ERR: 19,
|
|
24615
|
+
ABORT_ERR: 20,
|
|
24616
|
+
URL_MISMATCH_ERR: 21,
|
|
24617
|
+
QUOTA_EXCEEDED_ERR: 22,
|
|
24618
|
+
TIMEOUT_ERR: 23,
|
|
24619
|
+
INVALID_NODE_TYPE_ERR: 24,
|
|
24620
|
+
DATA_CLONE_ERR: 25
|
|
24621
|
+
};
|
|
24622
|
+
function defineErrorCodeProperties(obj) {
|
|
24623
|
+
const keys2 = Object.keys(ErrorCodeMap);
|
|
24624
|
+
for (let i = 0; i < keys2.length; ++i) {
|
|
24625
|
+
const key = keys2[i];
|
|
24626
|
+
const value = ErrorCodeMap[key];
|
|
24627
|
+
Object.defineProperty(obj, key, {
|
|
24628
|
+
get() {
|
|
24629
|
+
return value;
|
|
24630
|
+
},
|
|
24631
|
+
configurable: true,
|
|
24632
|
+
enumerable: true
|
|
24633
|
+
});
|
|
24634
|
+
}
|
|
24635
|
+
}
|
|
24636
|
+
var EventWrapper = class extends Event2 {
|
|
24637
|
+
/**
|
|
24638
|
+
* Wrap a given event object to control states.
|
|
24639
|
+
* @param event The event-like object to wrap.
|
|
24640
|
+
*/
|
|
24641
|
+
static wrap(event) {
|
|
24642
|
+
return new (getWrapperClassOf(event))(event);
|
|
24643
|
+
}
|
|
24644
|
+
constructor(event) {
|
|
24645
|
+
super(event.type, {
|
|
24646
|
+
bubbles: event.bubbles,
|
|
24647
|
+
cancelable: event.cancelable,
|
|
24648
|
+
composed: event.composed
|
|
24649
|
+
});
|
|
24650
|
+
if (event.cancelBubble) {
|
|
24651
|
+
super.stopPropagation();
|
|
24652
|
+
}
|
|
24653
|
+
if (event.defaultPrevented) {
|
|
24654
|
+
super.preventDefault();
|
|
24655
|
+
}
|
|
24656
|
+
internalDataMap$1.set(this, { original: event });
|
|
24657
|
+
const keys2 = Object.keys(event);
|
|
24658
|
+
for (let i = 0; i < keys2.length; ++i) {
|
|
24659
|
+
const key = keys2[i];
|
|
24660
|
+
if (!(key in this)) {
|
|
24661
|
+
Object.defineProperty(this, key, defineRedirectDescriptor(event, key));
|
|
24662
|
+
}
|
|
24663
|
+
}
|
|
24664
|
+
}
|
|
24665
|
+
stopPropagation() {
|
|
24666
|
+
super.stopPropagation();
|
|
24667
|
+
const { original } = $$1(this);
|
|
24668
|
+
if ("stopPropagation" in original) {
|
|
24669
|
+
original.stopPropagation();
|
|
24670
|
+
}
|
|
24671
|
+
}
|
|
24672
|
+
get cancelBubble() {
|
|
24673
|
+
return super.cancelBubble;
|
|
24674
|
+
}
|
|
24675
|
+
set cancelBubble(value) {
|
|
24676
|
+
super.cancelBubble = value;
|
|
24677
|
+
const { original } = $$1(this);
|
|
24678
|
+
if ("cancelBubble" in original) {
|
|
24679
|
+
original.cancelBubble = value;
|
|
24680
|
+
}
|
|
24681
|
+
}
|
|
24682
|
+
stopImmediatePropagation() {
|
|
24683
|
+
super.stopImmediatePropagation();
|
|
24684
|
+
const { original } = $$1(this);
|
|
24685
|
+
if ("stopImmediatePropagation" in original) {
|
|
24686
|
+
original.stopImmediatePropagation();
|
|
24687
|
+
}
|
|
24688
|
+
}
|
|
24689
|
+
get returnValue() {
|
|
24690
|
+
return super.returnValue;
|
|
24691
|
+
}
|
|
24692
|
+
set returnValue(value) {
|
|
24693
|
+
super.returnValue = value;
|
|
24694
|
+
const { original } = $$1(this);
|
|
24695
|
+
if ("returnValue" in original) {
|
|
24696
|
+
original.returnValue = value;
|
|
24697
|
+
}
|
|
24698
|
+
}
|
|
24699
|
+
preventDefault() {
|
|
24700
|
+
super.preventDefault();
|
|
24701
|
+
const { original } = $$1(this);
|
|
24702
|
+
if ("preventDefault" in original) {
|
|
24703
|
+
original.preventDefault();
|
|
24704
|
+
}
|
|
24705
|
+
}
|
|
24706
|
+
get timeStamp() {
|
|
24707
|
+
const { original } = $$1(this);
|
|
24708
|
+
if ("timeStamp" in original) {
|
|
24709
|
+
return original.timeStamp;
|
|
24710
|
+
}
|
|
24711
|
+
return super.timeStamp;
|
|
24712
|
+
}
|
|
24713
|
+
};
|
|
24714
|
+
var internalDataMap$1 = /* @__PURE__ */ new WeakMap();
|
|
24715
|
+
function $$1(event) {
|
|
24716
|
+
const retv = internalDataMap$1.get(event);
|
|
24717
|
+
assertType(retv != null, "'this' is expected an Event object, but got", event);
|
|
24718
|
+
return retv;
|
|
24719
|
+
}
|
|
24720
|
+
var wrapperClassCache = /* @__PURE__ */ new WeakMap();
|
|
24721
|
+
wrapperClassCache.set(Object.prototype, EventWrapper);
|
|
24722
|
+
if (typeof Global !== "undefined" && typeof Global.Event !== "undefined") {
|
|
24723
|
+
wrapperClassCache.set(Global.Event.prototype, EventWrapper);
|
|
24724
|
+
}
|
|
24725
|
+
function getWrapperClassOf(originalEvent) {
|
|
24726
|
+
const prototype = Object.getPrototypeOf(originalEvent);
|
|
24727
|
+
if (prototype == null) {
|
|
24728
|
+
return EventWrapper;
|
|
24729
|
+
}
|
|
24730
|
+
let wrapper = wrapperClassCache.get(prototype);
|
|
24731
|
+
if (wrapper == null) {
|
|
24732
|
+
wrapper = defineWrapper(getWrapperClassOf(prototype), prototype);
|
|
24733
|
+
wrapperClassCache.set(prototype, wrapper);
|
|
24734
|
+
}
|
|
24735
|
+
return wrapper;
|
|
24736
|
+
}
|
|
24737
|
+
function defineWrapper(BaseEventWrapper, originalPrototype) {
|
|
24738
|
+
class CustomEventWrapper extends BaseEventWrapper {
|
|
24739
|
+
}
|
|
24740
|
+
const keys2 = Object.keys(originalPrototype);
|
|
24741
|
+
for (let i = 0; i < keys2.length; ++i) {
|
|
24742
|
+
Object.defineProperty(CustomEventWrapper.prototype, keys2[i], defineRedirectDescriptor(originalPrototype, keys2[i]));
|
|
24743
|
+
}
|
|
24744
|
+
return CustomEventWrapper;
|
|
24745
|
+
}
|
|
24746
|
+
function defineRedirectDescriptor(obj, key) {
|
|
24747
|
+
const d = Object.getOwnPropertyDescriptor(obj, key);
|
|
24748
|
+
return {
|
|
24749
|
+
get() {
|
|
24750
|
+
const original = $$1(this).original;
|
|
24751
|
+
const value = original[key];
|
|
24752
|
+
if (typeof value === "function") {
|
|
24753
|
+
return value.bind(original);
|
|
24754
|
+
}
|
|
24755
|
+
return value;
|
|
24756
|
+
},
|
|
24757
|
+
set(value) {
|
|
24758
|
+
const original = $$1(this).original;
|
|
24759
|
+
original[key] = value;
|
|
24760
|
+
},
|
|
24761
|
+
configurable: d.configurable,
|
|
24762
|
+
enumerable: d.enumerable
|
|
24763
|
+
};
|
|
24764
|
+
}
|
|
24765
|
+
function createListener(callback, capture, passive, once, signal, signalListener) {
|
|
24766
|
+
return {
|
|
24767
|
+
callback,
|
|
24768
|
+
flags: (capture ? 1 : 0) | (passive ? 2 : 0) | (once ? 4 : 0),
|
|
24769
|
+
signal,
|
|
24770
|
+
signalListener
|
|
24771
|
+
};
|
|
24772
|
+
}
|
|
24773
|
+
function setRemoved(listener) {
|
|
24774
|
+
listener.flags |= 8;
|
|
24775
|
+
}
|
|
24776
|
+
function isCapture(listener) {
|
|
24777
|
+
return (listener.flags & 1) === 1;
|
|
24778
|
+
}
|
|
24779
|
+
function isPassive(listener) {
|
|
24780
|
+
return (listener.flags & 2) === 2;
|
|
24781
|
+
}
|
|
24782
|
+
function isOnce(listener) {
|
|
24783
|
+
return (listener.flags & 4) === 4;
|
|
24784
|
+
}
|
|
24785
|
+
function isRemoved(listener) {
|
|
24786
|
+
return (listener.flags & 8) === 8;
|
|
24787
|
+
}
|
|
24788
|
+
function invokeCallback({ callback }, target, event) {
|
|
24789
|
+
try {
|
|
24790
|
+
if (typeof callback === "function") {
|
|
24791
|
+
callback.call(target, event);
|
|
24792
|
+
} else if (typeof callback.handleEvent === "function") {
|
|
24793
|
+
callback.handleEvent(event);
|
|
24794
|
+
}
|
|
24795
|
+
} catch (thrownError) {
|
|
24796
|
+
reportError(thrownError);
|
|
24797
|
+
}
|
|
24798
|
+
}
|
|
24799
|
+
function findIndexOfListener({ listeners }, callback, capture) {
|
|
24800
|
+
for (let i = 0; i < listeners.length; ++i) {
|
|
24801
|
+
if (listeners[i].callback === callback && isCapture(listeners[i]) === capture) {
|
|
24802
|
+
return i;
|
|
24803
|
+
}
|
|
24804
|
+
}
|
|
24805
|
+
return -1;
|
|
24806
|
+
}
|
|
24807
|
+
function addListener(list, callback, capture, passive, once, signal) {
|
|
24808
|
+
let signalListener;
|
|
24809
|
+
if (signal) {
|
|
24810
|
+
signalListener = removeListener.bind(null, list, callback, capture);
|
|
24811
|
+
signal.addEventListener("abort", signalListener);
|
|
24812
|
+
}
|
|
24813
|
+
const listener = createListener(callback, capture, passive, once, signal, signalListener);
|
|
24814
|
+
if (list.cow) {
|
|
24815
|
+
list.cow = false;
|
|
24816
|
+
list.listeners = [...list.listeners, listener];
|
|
24817
|
+
} else {
|
|
24818
|
+
list.listeners.push(listener);
|
|
24819
|
+
}
|
|
24820
|
+
return listener;
|
|
24821
|
+
}
|
|
24822
|
+
function removeListener(list, callback, capture) {
|
|
24823
|
+
const index = findIndexOfListener(list, callback, capture);
|
|
24824
|
+
if (index !== -1) {
|
|
24825
|
+
return removeListenerAt(list, index);
|
|
24826
|
+
}
|
|
24827
|
+
return false;
|
|
24828
|
+
}
|
|
24829
|
+
function removeListenerAt(list, index, disableCow = false) {
|
|
24830
|
+
const listener = list.listeners[index];
|
|
24831
|
+
setRemoved(listener);
|
|
24832
|
+
if (listener.signal) {
|
|
24833
|
+
listener.signal.removeEventListener("abort", listener.signalListener);
|
|
24834
|
+
}
|
|
24835
|
+
if (list.cow && !disableCow) {
|
|
24836
|
+
list.cow = false;
|
|
24837
|
+
list.listeners = list.listeners.filter((_, i) => i !== index);
|
|
24838
|
+
return false;
|
|
24839
|
+
}
|
|
24840
|
+
list.listeners.splice(index, 1);
|
|
24841
|
+
return true;
|
|
24842
|
+
}
|
|
24843
|
+
function createListenerListMap() {
|
|
24844
|
+
return /* @__PURE__ */ Object.create(null);
|
|
24845
|
+
}
|
|
24846
|
+
function ensureListenerList(listenerMap, type) {
|
|
24847
|
+
var _a;
|
|
24848
|
+
return (_a = listenerMap[type]) !== null && _a !== void 0 ? _a : listenerMap[type] = {
|
|
24849
|
+
attrCallback: void 0,
|
|
24850
|
+
attrListener: void 0,
|
|
24851
|
+
cow: false,
|
|
24852
|
+
listeners: []
|
|
24853
|
+
};
|
|
24854
|
+
}
|
|
24855
|
+
var EventTarget2 = class {
|
|
24856
|
+
/**
|
|
24857
|
+
* Initialize this instance.
|
|
24858
|
+
*/
|
|
24859
|
+
constructor() {
|
|
24860
|
+
internalDataMap$2.set(this, createListenerListMap());
|
|
24861
|
+
}
|
|
24862
|
+
// Implementation
|
|
24863
|
+
addEventListener(type0, callback0, options0) {
|
|
24864
|
+
const listenerMap = $$2(this);
|
|
24865
|
+
const { callback, capture, once, passive, signal, type } = normalizeAddOptions(type0, callback0, options0);
|
|
24866
|
+
if (callback == null || (signal === null || signal === void 0 ? void 0 : signal.aborted)) {
|
|
24867
|
+
return;
|
|
24868
|
+
}
|
|
24869
|
+
const list = ensureListenerList(listenerMap, type);
|
|
24870
|
+
const i = findIndexOfListener(list, callback, capture);
|
|
24871
|
+
if (i !== -1) {
|
|
24872
|
+
warnDuplicate(list.listeners[i], passive, once, signal);
|
|
24873
|
+
return;
|
|
24874
|
+
}
|
|
24875
|
+
addListener(list, callback, capture, passive, once, signal);
|
|
24876
|
+
}
|
|
24877
|
+
// Implementation
|
|
24878
|
+
removeEventListener(type0, callback0, options0) {
|
|
24879
|
+
const listenerMap = $$2(this);
|
|
24880
|
+
const { callback, capture, type } = normalizeOptions(type0, callback0, options0);
|
|
24881
|
+
const list = listenerMap[type];
|
|
24882
|
+
if (callback != null && list) {
|
|
24883
|
+
removeListener(list, callback, capture);
|
|
24884
|
+
}
|
|
24885
|
+
}
|
|
24886
|
+
// Implementation
|
|
24887
|
+
dispatchEvent(e) {
|
|
24888
|
+
const list = $$2(this)[String(e.type)];
|
|
24889
|
+
if (list == null) {
|
|
24890
|
+
return true;
|
|
24891
|
+
}
|
|
24892
|
+
const event = e instanceof Event2 ? e : EventWrapper.wrap(e);
|
|
24893
|
+
const eventData = $(event, "event");
|
|
24894
|
+
if (eventData.dispatchFlag) {
|
|
24895
|
+
throw createInvalidStateError("This event has been in dispatching.");
|
|
24896
|
+
}
|
|
24897
|
+
eventData.dispatchFlag = true;
|
|
24898
|
+
eventData.target = eventData.currentTarget = this;
|
|
24899
|
+
if (!eventData.stopPropagationFlag) {
|
|
24900
|
+
const { cow, listeners } = list;
|
|
24901
|
+
list.cow = true;
|
|
24902
|
+
for (let i = 0; i < listeners.length; ++i) {
|
|
24903
|
+
const listener = listeners[i];
|
|
24904
|
+
if (isRemoved(listener)) {
|
|
24905
|
+
continue;
|
|
24906
|
+
}
|
|
24907
|
+
if (isOnce(listener) && removeListenerAt(list, i, !cow)) {
|
|
24908
|
+
i -= 1;
|
|
24872
24909
|
}
|
|
24873
|
-
|
|
24874
|
-
|
|
24875
|
-
|
|
24876
|
-
|
|
24877
|
-
|
|
24878
|
-
};
|
|
24879
|
-
}
|
|
24880
|
-
if (finalEvent.type === "error") {
|
|
24881
|
-
this.dispatchEvent(new ErrorEvent("error", finalEvent));
|
|
24882
|
-
} else {
|
|
24883
|
-
this.dispatchEvent(new SpeechRecognitionEvent(finalEvent.type, finalEvent));
|
|
24884
|
-
}
|
|
24910
|
+
eventData.inPassiveListenerFlag = isPassive(listener);
|
|
24911
|
+
invokeCallback(listener, this, event);
|
|
24912
|
+
eventData.inPassiveListenerFlag = false;
|
|
24913
|
+
if (eventData.stopImmediatePropagationFlag) {
|
|
24914
|
+
break;
|
|
24885
24915
|
}
|
|
24886
|
-
|
|
24887
|
-
|
|
24888
|
-
|
|
24889
|
-
console.error(err);
|
|
24890
|
-
throw err;
|
|
24891
|
-
} finally {
|
|
24892
|
-
unprepare();
|
|
24893
|
-
recognizer.dispose();
|
|
24916
|
+
}
|
|
24917
|
+
if (!cow) {
|
|
24918
|
+
list.cow = false;
|
|
24894
24919
|
}
|
|
24895
24920
|
}
|
|
24921
|
+
eventData.target = null;
|
|
24922
|
+
eventData.currentTarget = null;
|
|
24923
|
+
eventData.stopImmediatePropagationFlag = false;
|
|
24924
|
+
eventData.stopPropagationFlag = false;
|
|
24925
|
+
eventData.dispatchFlag = false;
|
|
24926
|
+
return !eventData.canceledFlag;
|
|
24927
|
+
}
|
|
24928
|
+
};
|
|
24929
|
+
var internalDataMap$2 = /* @__PURE__ */ new WeakMap();
|
|
24930
|
+
function $$2(target, name = "this") {
|
|
24931
|
+
const retv = internalDataMap$2.get(target);
|
|
24932
|
+
assertType(retv != null, "'%s' must be an object that EventTarget constructor created, but got another one: %o", name, target);
|
|
24933
|
+
return retv;
|
|
24934
|
+
}
|
|
24935
|
+
function normalizeAddOptions(type, callback, options) {
|
|
24936
|
+
var _a;
|
|
24937
|
+
assertCallback(callback);
|
|
24938
|
+
if (typeof options === "object" && options !== null) {
|
|
24939
|
+
return {
|
|
24940
|
+
type: String(type),
|
|
24941
|
+
callback: callback !== null && callback !== void 0 ? callback : void 0,
|
|
24942
|
+
capture: Boolean(options.capture),
|
|
24943
|
+
passive: Boolean(options.passive),
|
|
24944
|
+
once: Boolean(options.once),
|
|
24945
|
+
signal: (_a = options.signal) !== null && _a !== void 0 ? _a : void 0
|
|
24946
|
+
};
|
|
24896
24947
|
}
|
|
24897
24948
|
return {
|
|
24898
|
-
|
|
24899
|
-
|
|
24900
|
-
|
|
24949
|
+
type: String(type),
|
|
24950
|
+
callback: callback !== null && callback !== void 0 ? callback : void 0,
|
|
24951
|
+
capture: Boolean(options),
|
|
24952
|
+
passive: false,
|
|
24953
|
+
once: false,
|
|
24954
|
+
signal: void 0
|
|
24901
24955
|
};
|
|
24902
24956
|
}
|
|
24903
|
-
|
|
24904
|
-
|
|
24905
|
-
|
|
24906
|
-
|
|
24907
|
-
|
|
24908
|
-
|
|
24909
|
-
|
|
24910
|
-
|
|
24911
|
-
referenceGrammars,
|
|
24912
|
-
speechRecognitionEndpointId,
|
|
24913
|
-
textNormalization = "display"
|
|
24914
|
-
} = patchOptions(options);
|
|
24915
|
-
if (!audioConfig && (!window.navigator.mediaDevices || !window.navigator.mediaDevices.getUserMedia)) {
|
|
24916
|
-
console.warn(
|
|
24917
|
-
"web-speech-cognitive-services: This browser does not support WebRTC and it will not work with Cognitive Services Speech Services."
|
|
24918
|
-
);
|
|
24919
|
-
return {};
|
|
24957
|
+
function normalizeOptions(type, callback, options) {
|
|
24958
|
+
assertCallback(callback);
|
|
24959
|
+
if (typeof options === "object" && options !== null) {
|
|
24960
|
+
return {
|
|
24961
|
+
type: String(type),
|
|
24962
|
+
callback: callback !== null && callback !== void 0 ? callback : void 0,
|
|
24963
|
+
capture: Boolean(options.capture)
|
|
24964
|
+
};
|
|
24920
24965
|
}
|
|
24921
|
-
|
|
24922
|
-
|
|
24923
|
-
|
|
24924
|
-
|
|
24925
|
-
|
|
24926
|
-
|
|
24927
|
-
|
|
24928
|
-
|
|
24929
|
-
|
|
24930
|
-
|
|
24931
|
-
|
|
24932
|
-
|
|
24933
|
-
|
|
24934
|
-
|
|
24935
|
-
|
|
24936
|
-
|
|
24966
|
+
return {
|
|
24967
|
+
type: String(type),
|
|
24968
|
+
callback: callback !== null && callback !== void 0 ? callback : void 0,
|
|
24969
|
+
capture: Boolean(options)
|
|
24970
|
+
};
|
|
24971
|
+
}
|
|
24972
|
+
function assertCallback(callback) {
|
|
24973
|
+
if (typeof callback === "function" || typeof callback === "object" && callback !== null && typeof callback.handleEvent === "function") {
|
|
24974
|
+
return;
|
|
24975
|
+
}
|
|
24976
|
+
if (callback == null || typeof callback === "object") {
|
|
24977
|
+
InvalidEventListener.warn(callback);
|
|
24978
|
+
return;
|
|
24979
|
+
}
|
|
24980
|
+
throw new TypeError(format(InvalidEventListener.message, [callback]));
|
|
24981
|
+
}
|
|
24982
|
+
function warnDuplicate(listener, passive, once, signal) {
|
|
24983
|
+
EventListenerWasDuplicated.warn(isCapture(listener) ? "capture" : "bubble", listener.callback);
|
|
24984
|
+
if (isPassive(listener) !== passive) {
|
|
24985
|
+
OptionWasIgnored.warn("passive");
|
|
24986
|
+
}
|
|
24987
|
+
if (isOnce(listener) !== once) {
|
|
24988
|
+
OptionWasIgnored.warn("once");
|
|
24989
|
+
}
|
|
24990
|
+
if (listener.signal !== signal) {
|
|
24991
|
+
OptionWasIgnored.warn("signal");
|
|
24992
|
+
}
|
|
24993
|
+
}
|
|
24994
|
+
var keys$1 = Object.getOwnPropertyNames(EventTarget2.prototype);
|
|
24995
|
+
for (let i = 0; i < keys$1.length; ++i) {
|
|
24996
|
+
if (keys$1[i] === "constructor") {
|
|
24997
|
+
continue;
|
|
24998
|
+
}
|
|
24999
|
+
Object.defineProperty(EventTarget2.prototype, keys$1[i], { enumerable: true });
|
|
25000
|
+
}
|
|
25001
|
+
if (typeof Global !== "undefined" && typeof Global.EventTarget !== "undefined") {
|
|
25002
|
+
Object.setPrototypeOf(EventTarget2.prototype, Global.EventTarget.prototype);
|
|
25003
|
+
}
|
|
25004
|
+
function getEventAttributeValue(target, type) {
|
|
25005
|
+
var _a, _b;
|
|
25006
|
+
const listMap = $$2(target, "target");
|
|
25007
|
+
return (_b = (_a = listMap[type]) === null || _a === void 0 ? void 0 : _a.attrCallback) !== null && _b !== void 0 ? _b : null;
|
|
25008
|
+
}
|
|
25009
|
+
function setEventAttributeValue(target, type, callback) {
|
|
25010
|
+
if (callback != null && typeof callback !== "function") {
|
|
25011
|
+
InvalidAttributeHandler.warn(callback);
|
|
25012
|
+
}
|
|
25013
|
+
if (typeof callback === "function" || typeof callback === "object" && callback !== null) {
|
|
25014
|
+
upsertEventAttributeListener(target, type, callback);
|
|
25015
|
+
} else {
|
|
25016
|
+
removeEventAttributeListener(target, type);
|
|
25017
|
+
}
|
|
25018
|
+
}
|
|
25019
|
+
function upsertEventAttributeListener(target, type, callback) {
|
|
25020
|
+
const list = ensureListenerList($$2(target, "target"), String(type));
|
|
25021
|
+
list.attrCallback = callback;
|
|
25022
|
+
if (list.attrListener == null) {
|
|
25023
|
+
list.attrListener = addListener(list, defineEventAttributeCallback(list), false, false, false, void 0);
|
|
25024
|
+
}
|
|
25025
|
+
}
|
|
25026
|
+
function removeEventAttributeListener(target, type) {
|
|
25027
|
+
const listMap = $$2(target, "target");
|
|
25028
|
+
const list = listMap[String(type)];
|
|
25029
|
+
if (list && list.attrListener) {
|
|
25030
|
+
removeListener(list, list.attrListener.callback, false);
|
|
25031
|
+
list.attrCallback = list.attrListener = void 0;
|
|
25032
|
+
}
|
|
25033
|
+
}
|
|
25034
|
+
function defineEventAttributeCallback(list) {
|
|
25035
|
+
return function(event) {
|
|
25036
|
+
const callback = list.attrCallback;
|
|
25037
|
+
if (typeof callback === "function") {
|
|
25038
|
+
callback.call(this, event);
|
|
24937
25039
|
}
|
|
24938
|
-
speechConfig.outputFormat = OutputFormat2.Detailed;
|
|
24939
|
-
speechConfig.speechRecognitionLanguage = lang || "en-US";
|
|
24940
|
-
return new SpeechRecognizer2(speechConfig, audioConfig);
|
|
24941
25040
|
};
|
|
24942
|
-
|
|
24943
|
-
audioConfig,
|
|
24944
|
-
createRecognizer,
|
|
24945
|
-
enableTelemetry,
|
|
24946
|
-
looseEvents,
|
|
24947
|
-
referenceGrammars,
|
|
24948
|
-
textNormalization
|
|
24949
|
-
});
|
|
24950
|
-
};
|
|
24951
|
-
|
|
24952
|
-
// src/SpeechServices/SpeechToText.js
|
|
24953
|
-
var SpeechToText_default = createSpeechRecognitionPonyfill_default;
|
|
25041
|
+
}
|
|
24954
25042
|
|
|
24955
25043
|
// ../../node_modules/on-error-resume-next/dist/chunk-MBTBSBLB.mjs
|
|
24956
25044
|
function isPromise(value) {
|
|
@@ -25094,7 +25182,7 @@
|
|
|
25094
25182
|
};
|
|
25095
25183
|
|
|
25096
25184
|
// src/SpeechServices/TextToSpeech/SpeechSynthesisEvent.js
|
|
25097
|
-
var SpeechSynthesisEvent = class extends
|
|
25185
|
+
var SpeechSynthesisEvent = class extends Event2 {
|
|
25098
25186
|
constructor(type) {
|
|
25099
25187
|
super(type);
|
|
25100
25188
|
}
|
|
@@ -25285,7 +25373,7 @@
|
|
|
25285
25373
|
}
|
|
25286
25374
|
});
|
|
25287
25375
|
}
|
|
25288
|
-
var SpeechSynthesisUtterance = class extends
|
|
25376
|
+
var SpeechSynthesisUtterance = class extends EventTarget2 {
|
|
25289
25377
|
constructor(text) {
|
|
25290
25378
|
super();
|
|
25291
25379
|
this._lang = null;
|
|
@@ -25500,7 +25588,7 @@
|
|
|
25500
25588
|
);
|
|
25501
25589
|
return {};
|
|
25502
25590
|
}
|
|
25503
|
-
class SpeechSynthesis extends
|
|
25591
|
+
class SpeechSynthesis extends EventTarget2 {
|
|
25504
25592
|
constructor() {
|
|
25505
25593
|
super();
|
|
25506
25594
|
this.queue = new AudioContextQueue_default({ audioContext, ponyfill: ponyfill2 });
|
|
@@ -25596,7 +25684,7 @@
|
|
|
25596
25684
|
}
|
|
25597
25685
|
var meta = document.createElement("meta");
|
|
25598
25686
|
meta.setAttribute("name", "web-speech-cognitive-services");
|
|
25599
|
-
meta.setAttribute("content", `version=${"8.0.0-main.
|
|
25687
|
+
meta.setAttribute("content", `version=${"8.0.0-main.5903868"}`);
|
|
25600
25688
|
document.head.appendChild(meta);
|
|
25601
25689
|
|
|
25602
25690
|
// src/index.umd.js
|