dsh-voice-mode 0.7.22 → 0.7.24
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/README.en.md +53 -70
- package/README.md +31 -25
- package/THIRD_PARTY_NOTICES.md +4 -4
- package/assets/architecture.svg +35 -1
- package/lib/client.js +19 -6
- package/lib/index.js +24 -7
- package/lib/msedge-tts.cjs +679 -135
- package/package.json +4 -4
package/lib/msedge-tts.cjs
CHANGED
|
@@ -11936,9 +11936,9 @@ var require_follow_redirects = __commonJS({
|
|
|
11936
11936
|
}
|
|
11937
11937
|
});
|
|
11938
11938
|
|
|
11939
|
-
// node_modules/.pnpm/axios@1.
|
|
11939
|
+
// node_modules/.pnpm/axios@1.20.0_debug@4.4.3/node_modules/axios/dist/node/axios.cjs
|
|
11940
11940
|
var require_axios = __commonJS({
|
|
11941
|
-
"node_modules/.pnpm/axios@1.
|
|
11941
|
+
"node_modules/.pnpm/axios@1.20.0_debug@4.4.3/node_modules/axios/dist/node/axios.cjs"(exports2, module2) {
|
|
11942
11942
|
"use strict";
|
|
11943
11943
|
var FormData$1 = require_form_data();
|
|
11944
11944
|
var crypto2 = require("node:crypto");
|
|
@@ -11971,22 +11971,82 @@ var require_axios = __commonJS({
|
|
|
11971
11971
|
var hasOwnProperty = (({
|
|
11972
11972
|
hasOwnProperty: hasOwnProperty2
|
|
11973
11973
|
}) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
11974
|
+
var isUnsafeObjectKey = (prop) => typeof prop === "string" && (prop === "__proto__" || prop === "constructor" || prop === "prototype");
|
|
11975
|
+
var isPrototypeBoundary = (obj, prototype2, source) => obj === Object.prototype || !source && prototype2 === null;
|
|
11976
|
+
var isSafeAndFullyMutable = (obj) => {
|
|
11977
|
+
if (!Object.isExtensible(obj)) {
|
|
11978
|
+
return false;
|
|
11979
|
+
}
|
|
11980
|
+
const props = Object.getOwnPropertyNames(obj);
|
|
11981
|
+
if (Object.getOwnPropertySymbols) {
|
|
11982
|
+
props.push(...Object.getOwnPropertySymbols(obj));
|
|
11983
|
+
}
|
|
11984
|
+
return props.every((prop) => {
|
|
11985
|
+
if (isUnsafeObjectKey(prop)) {
|
|
11986
|
+
return false;
|
|
11987
|
+
}
|
|
11988
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
11989
|
+
return !!descriptor && descriptor.configurable && descriptor.writable === true;
|
|
11990
|
+
});
|
|
11991
|
+
};
|
|
11974
11992
|
var hasOwnInPrototypeChain = (thing, prop) => {
|
|
11975
11993
|
let obj = thing;
|
|
11976
11994
|
const seen = [];
|
|
11977
|
-
while (obj != null
|
|
11995
|
+
while (obj != null) {
|
|
11978
11996
|
if (seen.indexOf(obj) !== -1) {
|
|
11979
11997
|
return false;
|
|
11980
11998
|
}
|
|
11981
11999
|
seen.push(obj);
|
|
12000
|
+
const prototype2 = getPrototypeOf(obj);
|
|
12001
|
+
if (isPrototypeBoundary(obj, prototype2, obj === thing)) {
|
|
12002
|
+
return false;
|
|
12003
|
+
}
|
|
11982
12004
|
if (hasOwnProperty(obj, prop)) {
|
|
11983
12005
|
return true;
|
|
11984
12006
|
}
|
|
11985
|
-
obj =
|
|
12007
|
+
obj = prototype2;
|
|
11986
12008
|
}
|
|
11987
12009
|
return false;
|
|
11988
12010
|
};
|
|
11989
12011
|
var getSafeProp = (obj, prop) => obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : void 0;
|
|
12012
|
+
var toSafeFlatObject = (thing) => {
|
|
12013
|
+
if (thing == null || typeof thing !== "object" && typeof thing !== "function") {
|
|
12014
|
+
return thing;
|
|
12015
|
+
}
|
|
12016
|
+
const sourcePrototype = getPrototypeOf(thing);
|
|
12017
|
+
if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
|
|
12018
|
+
return thing;
|
|
12019
|
+
}
|
|
12020
|
+
const result = /* @__PURE__ */ Object.create(null);
|
|
12021
|
+
const merged = /* @__PURE__ */ Object.create(null);
|
|
12022
|
+
const seen = [];
|
|
12023
|
+
let current = thing;
|
|
12024
|
+
while (current != null) {
|
|
12025
|
+
if (seen.indexOf(current) !== -1) {
|
|
12026
|
+
break;
|
|
12027
|
+
}
|
|
12028
|
+
seen.push(current);
|
|
12029
|
+
const prototype2 = current === thing ? sourcePrototype : getPrototypeOf(current);
|
|
12030
|
+
if (isPrototypeBoundary(current, prototype2, current === thing)) {
|
|
12031
|
+
break;
|
|
12032
|
+
}
|
|
12033
|
+
const props = Object.getOwnPropertyNames(current);
|
|
12034
|
+
if (Object.getOwnPropertySymbols) {
|
|
12035
|
+
props.push(...Object.getOwnPropertySymbols(current));
|
|
12036
|
+
}
|
|
12037
|
+
for (const prop of props) {
|
|
12038
|
+
if (isUnsafeObjectKey(prop)) {
|
|
12039
|
+
continue;
|
|
12040
|
+
}
|
|
12041
|
+
if (!hasOwnProperty(merged, prop)) {
|
|
12042
|
+
result[prop] = thing[prop];
|
|
12043
|
+
merged[prop] = true;
|
|
12044
|
+
}
|
|
12045
|
+
}
|
|
12046
|
+
current = prototype2;
|
|
12047
|
+
}
|
|
12048
|
+
return result;
|
|
12049
|
+
};
|
|
11990
12050
|
var kindOf = /* @__PURE__ */ ((cache) => (thing) => {
|
|
11991
12051
|
const str = toString.call(thing);
|
|
11992
12052
|
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
@@ -12023,9 +12083,9 @@ var require_axios = __commonJS({
|
|
|
12023
12083
|
return false;
|
|
12024
12084
|
}
|
|
12025
12085
|
const prototype2 = getPrototypeOf(val);
|
|
12026
|
-
return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat
|
|
12027
|
-
//
|
|
12028
|
-
//
|
|
12086
|
+
return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
|
|
12087
|
+
// evidence the value is tagged/iterable, while ignoring members reachable
|
|
12088
|
+
// only through shared or terminal prototype boundaries.
|
|
12029
12089
|
!hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
|
|
12030
12090
|
};
|
|
12031
12091
|
var isEmptyObject = (val) => {
|
|
@@ -12437,6 +12497,7 @@ var require_axios = __commonJS({
|
|
|
12437
12497
|
// an alias to avoid ESLint no-prototype-builtins detection
|
|
12438
12498
|
hasOwnInPrototypeChain,
|
|
12439
12499
|
getSafeProp,
|
|
12500
|
+
toSafeFlatObject,
|
|
12440
12501
|
reduceDescriptors,
|
|
12441
12502
|
freezeMethods,
|
|
12442
12503
|
toObjectSet,
|
|
@@ -12517,7 +12578,7 @@ var require_axios = __commonJS({
|
|
|
12517
12578
|
});
|
|
12518
12579
|
return byteStringHeaders;
|
|
12519
12580
|
}
|
|
12520
|
-
var $internals = Symbol("internals");
|
|
12581
|
+
var $internals$1 = Symbol("internals");
|
|
12521
12582
|
function normalizeHeader(header) {
|
|
12522
12583
|
return header && String(header).trim().toLowerCase();
|
|
12523
12584
|
}
|
|
@@ -12813,7 +12874,7 @@ var require_axios = __commonJS({
|
|
|
12813
12874
|
return computed;
|
|
12814
12875
|
}
|
|
12815
12876
|
static accessor(header) {
|
|
12816
|
-
const internals = this[$internals] = this[$internals] = {
|
|
12877
|
+
const internals = this[$internals$1] = this[$internals$1] = {
|
|
12817
12878
|
accessors: {}
|
|
12818
12879
|
};
|
|
12819
12880
|
const accessors = internals.accessors;
|
|
@@ -13034,19 +13095,16 @@ var require_axios = __commonJS({
|
|
|
13034
13095
|
throw new TypeError("target must be an object");
|
|
13035
13096
|
}
|
|
13036
13097
|
formData = formData || new (FormData$1 || FormData)();
|
|
13037
|
-
|
|
13038
|
-
|
|
13039
|
-
|
|
13040
|
-
|
|
13041
|
-
|
|
13042
|
-
|
|
13043
|
-
|
|
13044
|
-
const
|
|
13045
|
-
const
|
|
13046
|
-
const
|
|
13047
|
-
const indexes = options.indexes;
|
|
13048
|
-
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
13049
|
-
const maxDepth = options.maxDepth === void 0 ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
|
|
13098
|
+
const option = (name, fallback) => {
|
|
13099
|
+
const value = utils$1.getSafeProp(options, name);
|
|
13100
|
+
return utils$1.isUndefined(value) ? fallback : value;
|
|
13101
|
+
};
|
|
13102
|
+
const metaTokens = option("metaTokens", true);
|
|
13103
|
+
const visitor = option("visitor") || defaultVisitor;
|
|
13104
|
+
const dots = option("dots", false);
|
|
13105
|
+
const indexes = option("indexes", false);
|
|
13106
|
+
const _Blob = option("Blob") || typeof Blob !== "undefined" && Blob;
|
|
13107
|
+
const maxDepth = option("maxDepth", DEFAULT_FORM_DATA_MAX_DEPTH);
|
|
13050
13108
|
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
13051
13109
|
const stack = [];
|
|
13052
13110
|
if (!utils$1.isFunction(visitor)) {
|
|
@@ -13205,9 +13263,47 @@ var require_axios = __commonJS({
|
|
|
13205
13263
|
}
|
|
13206
13264
|
return url2;
|
|
13207
13265
|
}
|
|
13266
|
+
var $internals = Symbol("internals");
|
|
13267
|
+
function countHandlers(handlers) {
|
|
13268
|
+
return handlers ? handlers.length : 0;
|
|
13269
|
+
}
|
|
13270
|
+
function trimHandlers(handlers) {
|
|
13271
|
+
if (!handlers) {
|
|
13272
|
+
return;
|
|
13273
|
+
}
|
|
13274
|
+
while (handlers.length && handlers[handlers.length - 1] === null) {
|
|
13275
|
+
handlers.pop();
|
|
13276
|
+
}
|
|
13277
|
+
}
|
|
13278
|
+
function syncHandlerEntries(manager, internals) {
|
|
13279
|
+
const handlers = manager.handlers;
|
|
13280
|
+
const length = countHandlers(handlers);
|
|
13281
|
+
if (handlers !== internals.handlersRef) {
|
|
13282
|
+
internals.handlersRef = handlers;
|
|
13283
|
+
internals.handlerEntries.clear();
|
|
13284
|
+
} else if (length !== internals.handlersLength) {
|
|
13285
|
+
if (!length) {
|
|
13286
|
+
internals.handlerEntries.clear();
|
|
13287
|
+
} else {
|
|
13288
|
+
internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
|
|
13289
|
+
if (handlers[entry.index] !== entry.handler) {
|
|
13290
|
+
internals.handlerEntries.delete(id);
|
|
13291
|
+
}
|
|
13292
|
+
});
|
|
13293
|
+
}
|
|
13294
|
+
}
|
|
13295
|
+
internals.handlersLength = length;
|
|
13296
|
+
}
|
|
13208
13297
|
var InterceptorManager = class {
|
|
13209
13298
|
constructor() {
|
|
13210
13299
|
this.handlers = [];
|
|
13300
|
+
this[$internals] = {
|
|
13301
|
+
handlersRef: this.handlers,
|
|
13302
|
+
handlersLength: this.handlers.length,
|
|
13303
|
+
handlerEntries: /* @__PURE__ */ new Map(),
|
|
13304
|
+
iterationDepth: 0,
|
|
13305
|
+
nextId: 0
|
|
13306
|
+
};
|
|
13211
13307
|
}
|
|
13212
13308
|
/**
|
|
13213
13309
|
* Add a new interceptor to the stack
|
|
@@ -13219,13 +13315,25 @@ var require_axios = __commonJS({
|
|
|
13219
13315
|
* @return {Number} An ID used to remove interceptor later
|
|
13220
13316
|
*/
|
|
13221
13317
|
use(fulfilled, rejected, options) {
|
|
13222
|
-
|
|
13318
|
+
const handler = {
|
|
13223
13319
|
fulfilled,
|
|
13224
13320
|
rejected,
|
|
13225
13321
|
synchronous: options ? options.synchronous : false,
|
|
13226
13322
|
runWhen: options ? options.runWhen : null
|
|
13323
|
+
};
|
|
13324
|
+
const internals = this[$internals];
|
|
13325
|
+
if (this.handlers == null) {
|
|
13326
|
+
this.handlers = [];
|
|
13327
|
+
}
|
|
13328
|
+
syncHandlerEntries(this, internals);
|
|
13329
|
+
const id = internals.nextId++;
|
|
13330
|
+
this.handlers.push(handler);
|
|
13331
|
+
internals.handlerEntries.set(id, {
|
|
13332
|
+
handler,
|
|
13333
|
+
index: this.handlers.length - 1
|
|
13227
13334
|
});
|
|
13228
|
-
|
|
13335
|
+
internals.handlersLength = this.handlers.length;
|
|
13336
|
+
return id;
|
|
13229
13337
|
}
|
|
13230
13338
|
/**
|
|
13231
13339
|
* Remove an interceptor from the stack
|
|
@@ -13235,8 +13343,19 @@ var require_axios = __commonJS({
|
|
|
13235
13343
|
* @returns {void}
|
|
13236
13344
|
*/
|
|
13237
13345
|
eject(id) {
|
|
13238
|
-
|
|
13239
|
-
|
|
13346
|
+
const internals = this[$internals];
|
|
13347
|
+
syncHandlerEntries(this, internals);
|
|
13348
|
+
const entry = internals.handlerEntries.get(id);
|
|
13349
|
+
if (entry) {
|
|
13350
|
+
internals.handlerEntries.delete(id);
|
|
13351
|
+
if (this.handlers[entry.index] !== entry.handler) {
|
|
13352
|
+
return;
|
|
13353
|
+
}
|
|
13354
|
+
this.handlers[entry.index] = null;
|
|
13355
|
+
if (!internals.iterationDepth) {
|
|
13356
|
+
trimHandlers(this.handlers);
|
|
13357
|
+
internals.handlersLength = this.handlers.length;
|
|
13358
|
+
}
|
|
13240
13359
|
}
|
|
13241
13360
|
}
|
|
13242
13361
|
/**
|
|
@@ -13247,6 +13366,7 @@ var require_axios = __commonJS({
|
|
|
13247
13366
|
clear() {
|
|
13248
13367
|
if (this.handlers) {
|
|
13249
13368
|
this.handlers = [];
|
|
13369
|
+
syncHandlerEntries(this, this[$internals]);
|
|
13250
13370
|
}
|
|
13251
13371
|
}
|
|
13252
13372
|
/**
|
|
@@ -13260,11 +13380,22 @@ var require_axios = __commonJS({
|
|
|
13260
13380
|
* @returns {void}
|
|
13261
13381
|
*/
|
|
13262
13382
|
forEach(fn) {
|
|
13263
|
-
|
|
13264
|
-
|
|
13265
|
-
|
|
13383
|
+
const internals = this[$internals];
|
|
13384
|
+
syncHandlerEntries(this, internals);
|
|
13385
|
+
internals.iterationDepth++;
|
|
13386
|
+
try {
|
|
13387
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
13388
|
+
if (h !== null) {
|
|
13389
|
+
fn(h);
|
|
13390
|
+
}
|
|
13391
|
+
});
|
|
13392
|
+
} finally {
|
|
13393
|
+
if (!--internals.iterationDepth) {
|
|
13394
|
+
syncHandlerEntries(this, internals);
|
|
13395
|
+
trimHandlers(this.handlers);
|
|
13396
|
+
internals.handlersLength = countHandlers(this.handlers);
|
|
13266
13397
|
}
|
|
13267
|
-
}
|
|
13398
|
+
}
|
|
13268
13399
|
}
|
|
13269
13400
|
};
|
|
13270
13401
|
var transitionalDefaults = {
|
|
@@ -13400,6 +13531,7 @@ var require_axios = __commonJS({
|
|
|
13400
13531
|
}
|
|
13401
13532
|
return null;
|
|
13402
13533
|
}
|
|
13534
|
+
var methodList = Object.freeze(["get", "delete", "head", "options", "post", "put", "patch", "purge", "link", "unlink", "query"]);
|
|
13403
13535
|
var own = (obj, key) => obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : void 0;
|
|
13404
13536
|
function stringifySafely(rawValue, parser, encoder) {
|
|
13405
13537
|
if (utils$1.isString(rawValue)) {
|
|
@@ -13505,7 +13637,7 @@ var require_axios = __commonJS({
|
|
|
13505
13637
|
}
|
|
13506
13638
|
}
|
|
13507
13639
|
};
|
|
13508
|
-
utils$1.forEach(
|
|
13640
|
+
utils$1.forEach(methodList, (method) => {
|
|
13509
13641
|
defaults.headers[method] = {};
|
|
13510
13642
|
});
|
|
13511
13643
|
function transformData(fns, response) {
|
|
@@ -13562,18 +13694,18 @@ var require_axios = __commonJS({
|
|
|
13562
13694
|
}
|
|
13563
13695
|
return baseURL.slice(0, end) + "/" + relativeURL.replace(/^\/+/, "");
|
|
13564
13696
|
}
|
|
13565
|
-
var
|
|
13566
|
-
var httpProtocolControlCharacters = /[\t\n\r]/g;
|
|
13567
|
-
function stripLeadingC0ControlOrSpace(url2) {
|
|
13568
|
-
let i = 0;
|
|
13569
|
-
while (i < url2.length && url2.charCodeAt(i) <= 32) {
|
|
13570
|
-
i++;
|
|
13571
|
-
}
|
|
13572
|
-
return url2.slice(i);
|
|
13573
|
-
}
|
|
13697
|
+
var urlParserControlCharacters = /[\t\n\r]/g;
|
|
13574
13698
|
function normalizeURLForProtocolCheck(url2) {
|
|
13575
|
-
|
|
13699
|
+
if (typeof url2 !== "string") {
|
|
13700
|
+
return url2;
|
|
13701
|
+
}
|
|
13702
|
+
let start = 0;
|
|
13703
|
+
while (start < url2.length && url2.charCodeAt(start) <= 32) {
|
|
13704
|
+
start++;
|
|
13705
|
+
}
|
|
13706
|
+
return url2.slice(start).replace(urlParserControlCharacters, "");
|
|
13576
13707
|
}
|
|
13708
|
+
var malformedHttpProtocol = /^https?:(?!\/\/)/i;
|
|
13577
13709
|
function redactFragment(fragment) {
|
|
13578
13710
|
if (!fragment) {
|
|
13579
13711
|
return fragment;
|
|
@@ -13674,12 +13806,12 @@ var require_axios = __commonJS({
|
|
|
13674
13806
|
function getEnv(key) {
|
|
13675
13807
|
return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || "";
|
|
13676
13808
|
}
|
|
13677
|
-
var VERSION = "1.
|
|
13809
|
+
var VERSION = "1.20.0";
|
|
13678
13810
|
function parseProtocol(url2) {
|
|
13679
13811
|
const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url2);
|
|
13680
13812
|
return match && match[1] || "";
|
|
13681
13813
|
}
|
|
13682
|
-
var DATA_URL_PATTERN = /^([
|
|
13814
|
+
var DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
|
|
13683
13815
|
function fromDataURI(uri, asBlob, options) {
|
|
13684
13816
|
const _Blob = options && options.Blob || platform.classes.Blob;
|
|
13685
13817
|
const protocol = parseProtocol(uri);
|
|
@@ -13956,7 +14088,7 @@ var require_axios = __commonJS({
|
|
|
13956
14088
|
this.sessions = /* @__PURE__ */ Object.create(null);
|
|
13957
14089
|
}
|
|
13958
14090
|
getSession(authority, options) {
|
|
13959
|
-
options = Object.assign({
|
|
14091
|
+
options = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
13960
14092
|
sessionTimeout: 1e3
|
|
13961
14093
|
}, options);
|
|
13962
14094
|
let authoritySessions = this.sessions[authority];
|
|
@@ -14021,6 +14153,7 @@ var require_axios = __commonJS({
|
|
|
14021
14153
|
};
|
|
14022
14154
|
}
|
|
14023
14155
|
session.once("close", removeSession);
|
|
14156
|
+
session.once("error", removeSession);
|
|
14024
14157
|
let entry = [session, options];
|
|
14025
14158
|
authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
|
|
14026
14159
|
return session;
|
|
@@ -14039,6 +14172,13 @@ var require_axios = __commonJS({
|
|
|
14039
14172
|
} : fn;
|
|
14040
14173
|
};
|
|
14041
14174
|
var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "0.0.0.0"]);
|
|
14175
|
+
var trimTrailingDots = (value) => {
|
|
14176
|
+
let end = value.length;
|
|
14177
|
+
while (end && value.charCodeAt(end - 1) === 46) {
|
|
14178
|
+
end--;
|
|
14179
|
+
}
|
|
14180
|
+
return end === value.length ? value : value.slice(0, end);
|
|
14181
|
+
};
|
|
14042
14182
|
var isIPv4Loopback = (host) => {
|
|
14043
14183
|
const parts = host.split(".");
|
|
14044
14184
|
if (parts.length !== 4) return false;
|
|
@@ -14071,7 +14211,7 @@ var require_axios = __commonJS({
|
|
|
14071
14211
|
if (h.charAt(0) === "[" && h.charAt(h.length - 1) === "]") {
|
|
14072
14212
|
h = h.slice(1, -1);
|
|
14073
14213
|
}
|
|
14074
|
-
h = h
|
|
14214
|
+
h = trimTrailingDots(h);
|
|
14075
14215
|
if (!/^[0-9.xXa-fA-F]+$/.test(h)) return host;
|
|
14076
14216
|
const parts = h.split(".");
|
|
14077
14217
|
if (parts.some((p) => p === "")) return host;
|
|
@@ -14183,6 +14323,40 @@ var require_axios = __commonJS({
|
|
|
14183
14323
|
}
|
|
14184
14324
|
return host;
|
|
14185
14325
|
};
|
|
14326
|
+
var IPV4_OCTET_RE = /^(?:0|[1-9]\d{0,2})$/;
|
|
14327
|
+
var ipv4ToBytes = (host) => {
|
|
14328
|
+
const parts = host.split(".");
|
|
14329
|
+
return parts.length === 4 && parts.every((part) => IPV4_OCTET_RE.test(part) && Number(part) <= 255) ? parts.map(Number) : null;
|
|
14330
|
+
};
|
|
14331
|
+
var IPV6_GROUP_RE = /^[0-9a-f]{1,4}$/i;
|
|
14332
|
+
var ipv6ToBytes = (host) => {
|
|
14333
|
+
const halves = host.split("::");
|
|
14334
|
+
if (halves.length > 2) {
|
|
14335
|
+
return null;
|
|
14336
|
+
}
|
|
14337
|
+
const groups = halves[0] ? halves[0].split(":") : [];
|
|
14338
|
+
if (halves.length === 2) {
|
|
14339
|
+
const rear = halves[1] ? halves[1].split(":") : [];
|
|
14340
|
+
const missing = 8 - groups.length - rear.length;
|
|
14341
|
+
if (missing < 1) {
|
|
14342
|
+
return null;
|
|
14343
|
+
}
|
|
14344
|
+
groups.push(...new Array(missing).fill("0"), ...rear);
|
|
14345
|
+
}
|
|
14346
|
+
if (groups.length !== 8 || groups.some((group) => !IPV6_GROUP_RE.test(group))) {
|
|
14347
|
+
return null;
|
|
14348
|
+
}
|
|
14349
|
+
return groups.flatMap((group) => {
|
|
14350
|
+
const value = Number.parseInt(group, 16);
|
|
14351
|
+
return [value >> 8 & 255, value & 255];
|
|
14352
|
+
});
|
|
14353
|
+
};
|
|
14354
|
+
var ipToBytes = (host) => {
|
|
14355
|
+
if (typeof host !== "string" || !host) {
|
|
14356
|
+
return null;
|
|
14357
|
+
}
|
|
14358
|
+
return host.indexOf(":") !== -1 ? ipv6ToBytes(host) : ipv4ToBytes(host);
|
|
14359
|
+
};
|
|
14186
14360
|
var normalizeNoProxyHost = (hostname) => {
|
|
14187
14361
|
if (!hostname) {
|
|
14188
14362
|
return hostname;
|
|
@@ -14190,13 +14364,99 @@ var require_axios = __commonJS({
|
|
|
14190
14364
|
if (hostname.charAt(0) === "[" && hostname.charAt(hostname.length - 1) === "]") {
|
|
14191
14365
|
hostname = hostname.slice(1, -1);
|
|
14192
14366
|
}
|
|
14193
|
-
const trimmed = hostname
|
|
14367
|
+
const trimmed = trimTrailingDots(hostname);
|
|
14194
14368
|
const ipv4 = normalizeIPAddress(trimmed);
|
|
14195
14369
|
if (ipv4 !== trimmed) {
|
|
14196
14370
|
return ipv4;
|
|
14197
14371
|
}
|
|
14198
14372
|
return unmapIPv4MappedIPv6(trimmed);
|
|
14199
14373
|
};
|
|
14374
|
+
var normalizeCidrBase = (input) => {
|
|
14375
|
+
let base = input;
|
|
14376
|
+
const startsBracket = base.charAt(0) === "[";
|
|
14377
|
+
const endsBracket = base.charAt(base.length - 1) === "]";
|
|
14378
|
+
const hasBracket = base.includes("[") || base.includes("]");
|
|
14379
|
+
if (startsBracket || endsBracket) {
|
|
14380
|
+
if (!startsBracket || !endsBracket) {
|
|
14381
|
+
return null;
|
|
14382
|
+
}
|
|
14383
|
+
base = base.slice(1, -1);
|
|
14384
|
+
if (base.indexOf(":") === -1 || base.includes("[") || base.includes("]")) {
|
|
14385
|
+
return null;
|
|
14386
|
+
}
|
|
14387
|
+
} else if (hasBracket) {
|
|
14388
|
+
return null;
|
|
14389
|
+
}
|
|
14390
|
+
if (!base || base.charAt(base.length - 1) === ".") {
|
|
14391
|
+
return null;
|
|
14392
|
+
}
|
|
14393
|
+
const wasIPv6 = base.indexOf(":") !== -1;
|
|
14394
|
+
if (wasIPv6) {
|
|
14395
|
+
try {
|
|
14396
|
+
base = new URL(`http://[${base}]/`).hostname.slice(1, -1);
|
|
14397
|
+
} catch (_err) {
|
|
14398
|
+
return null;
|
|
14399
|
+
}
|
|
14400
|
+
} else {
|
|
14401
|
+
base = normalizeIPAddress(base);
|
|
14402
|
+
if (!ipv4ToBytes(base)) {
|
|
14403
|
+
return null;
|
|
14404
|
+
}
|
|
14405
|
+
}
|
|
14406
|
+
return {
|
|
14407
|
+
normalized: unmapIPv4MappedIPv6(base),
|
|
14408
|
+
wasIPv6
|
|
14409
|
+
};
|
|
14410
|
+
};
|
|
14411
|
+
var CIDR_ENTRY_RE = /^(.+)\/(0|[1-9]\d{0,2})$/;
|
|
14412
|
+
var parseCidrEntry = (entry) => {
|
|
14413
|
+
if (entry.indexOf("/") === -1) {
|
|
14414
|
+
return void 0;
|
|
14415
|
+
}
|
|
14416
|
+
const match = CIDR_ENTRY_RE.exec(entry);
|
|
14417
|
+
if (!match) {
|
|
14418
|
+
return null;
|
|
14419
|
+
}
|
|
14420
|
+
let prefix = Number(match[2]);
|
|
14421
|
+
const parsedBase = normalizeCidrBase(match[1]);
|
|
14422
|
+
if (!parsedBase) {
|
|
14423
|
+
return null;
|
|
14424
|
+
}
|
|
14425
|
+
const {
|
|
14426
|
+
normalized,
|
|
14427
|
+
wasIPv6
|
|
14428
|
+
} = parsedBase;
|
|
14429
|
+
if (wasIPv6 && normalized.indexOf(":") === -1) {
|
|
14430
|
+
if (prefix < 96) {
|
|
14431
|
+
return null;
|
|
14432
|
+
}
|
|
14433
|
+
prefix -= 96;
|
|
14434
|
+
}
|
|
14435
|
+
const bytes = ipToBytes(normalized);
|
|
14436
|
+
if (!bytes || prefix > bytes.length * 8) {
|
|
14437
|
+
return null;
|
|
14438
|
+
}
|
|
14439
|
+
return {
|
|
14440
|
+
bytes,
|
|
14441
|
+
prefix
|
|
14442
|
+
};
|
|
14443
|
+
};
|
|
14444
|
+
var isInSubnet = (addressBytes, networkBytes, prefix) => {
|
|
14445
|
+
const fullBytes = prefix >> 3;
|
|
14446
|
+
for (let i = 0; i < fullBytes; i++) {
|
|
14447
|
+
if (addressBytes[i] !== networkBytes[i]) {
|
|
14448
|
+
return false;
|
|
14449
|
+
}
|
|
14450
|
+
}
|
|
14451
|
+
const remainingBits = prefix & 7;
|
|
14452
|
+
if (remainingBits) {
|
|
14453
|
+
const mask = 255 << 8 - remainingBits & 255;
|
|
14454
|
+
if ((addressBytes[fullBytes] & mask) !== (networkBytes[fullBytes] & mask)) {
|
|
14455
|
+
return false;
|
|
14456
|
+
}
|
|
14457
|
+
}
|
|
14458
|
+
return true;
|
|
14459
|
+
};
|
|
14200
14460
|
function shouldBypassProxy(location) {
|
|
14201
14461
|
let parsed;
|
|
14202
14462
|
try {
|
|
@@ -14213,6 +14473,7 @@ var require_axios = __commonJS({
|
|
|
14213
14473
|
}
|
|
14214
14474
|
const port = Number.parseInt(parsed.port, 10) || DEFAULT_PORTS[parsed.protocol.split(":", 1)[0]] || 0;
|
|
14215
14475
|
const hostname = normalizeNoProxyHost(parsed.hostname.toLowerCase());
|
|
14476
|
+
const hostnameBytes = ipToBytes(hostname);
|
|
14216
14477
|
return noProxy.split(/[\s,]+/).some((entry) => {
|
|
14217
14478
|
if (!entry) {
|
|
14218
14479
|
return false;
|
|
@@ -14220,6 +14481,10 @@ var require_axios = __commonJS({
|
|
|
14220
14481
|
if (entry === "*") {
|
|
14221
14482
|
return true;
|
|
14222
14483
|
}
|
|
14484
|
+
const cidr = parseCidrEntry(entry);
|
|
14485
|
+
if (cidr !== void 0) {
|
|
14486
|
+
return cidr !== null && !!hostnameBytes && hostnameBytes.length === cidr.bytes.length && isInSubnet(hostnameBytes, cidr.bytes, cidr.prefix);
|
|
14487
|
+
}
|
|
14223
14488
|
let [entryHost, entryPort] = parseNoProxyEntry(entry);
|
|
14224
14489
|
entryHost = normalizeNoProxyHost(entryHost);
|
|
14225
14490
|
if (!entryHost) {
|
|
@@ -14300,13 +14565,14 @@ var require_axios = __commonJS({
|
|
|
14300
14565
|
}
|
|
14301
14566
|
};
|
|
14302
14567
|
const flush = () => lastArgs && invoke(lastArgs);
|
|
14303
|
-
|
|
14568
|
+
const flushWith = (...args) => invoke(args);
|
|
14569
|
+
return [throttled, flush, flushWith];
|
|
14304
14570
|
}
|
|
14305
14571
|
var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
14306
14572
|
let bytesNotified = 0;
|
|
14307
14573
|
const _speedometer = speedometer(50, 250);
|
|
14308
14574
|
return throttle((e) => {
|
|
14309
|
-
if (!e ||
|
|
14575
|
+
if (!e || !utils$1.isNumber(e.loaded)) {
|
|
14310
14576
|
return;
|
|
14311
14577
|
}
|
|
14312
14578
|
const rawLoaded = e.loaded;
|
|
@@ -14460,6 +14726,12 @@ var require_axios = __commonJS({
|
|
|
14460
14726
|
var isHttps = /https:?/;
|
|
14461
14727
|
var kAxiosSocketListener = Symbol("axios.http.socketListener");
|
|
14462
14728
|
var kAxiosCurrentReq = Symbol("axios.http.currentReq");
|
|
14729
|
+
function handleSocketError(err) {
|
|
14730
|
+
const current = this[kAxiosCurrentReq];
|
|
14731
|
+
if (current && !current.destroyed) {
|
|
14732
|
+
current.destroy(err);
|
|
14733
|
+
}
|
|
14734
|
+
}
|
|
14463
14735
|
var kAxiosInstalledTunnel = Symbol("axios.http.installedTunnel");
|
|
14464
14736
|
var tunnelingAgentCache = /* @__PURE__ */ new Map();
|
|
14465
14737
|
var tunnelingAgentCacheUser = /* @__PURE__ */ new WeakMap();
|
|
@@ -14568,10 +14840,10 @@ var require_axios = __commonJS({
|
|
|
14568
14840
|
return false;
|
|
14569
14841
|
}
|
|
14570
14842
|
}
|
|
14571
|
-
function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent) {
|
|
14843
|
+
function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent, allowEnvProxy = true) {
|
|
14572
14844
|
let proxy = configProxy;
|
|
14573
14845
|
const proxyEnvAgent = getProxyEnvAgent(options, configHttpAgent, configHttpsAgent);
|
|
14574
|
-
if (!proxy && proxy !== false && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
|
|
14846
|
+
if (!proxy && proxy !== false && allowEnvProxy && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
|
|
14575
14847
|
const proxyUrl = getProxyForUrl(location);
|
|
14576
14848
|
if (proxyUrl) {
|
|
14577
14849
|
if (!shouldBypassProxy(location)) {
|
|
@@ -14662,8 +14934,9 @@ var require_axios = __commonJS({
|
|
|
14662
14934
|
}
|
|
14663
14935
|
}
|
|
14664
14936
|
options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
|
|
14665
|
-
setProxy(redirectOptions, configProxy, redirectOptions.href, true, configHttpsAgent, configHttpAgent);
|
|
14937
|
+
setProxy(redirectOptions, configProxy, redirectOptions.href, true, configHttpsAgent, configHttpAgent, allowEnvProxy);
|
|
14666
14938
|
};
|
|
14939
|
+
return Boolean(proxy || configProxy !== false && allowEnvProxy && isNodeEnvProxyEnabled(proxyEnvAgent));
|
|
14667
14940
|
}
|
|
14668
14941
|
var isHttpAdapterSupported = typeof process !== "undefined" && utils$1.kindOf(process) === "process";
|
|
14669
14942
|
var wrapAsync = (asyncExecutor) => {
|
|
@@ -14691,7 +14964,7 @@ var require_axios = __commonJS({
|
|
|
14691
14964
|
family
|
|
14692
14965
|
}) => {
|
|
14693
14966
|
if (!utils$1.isString(address)) {
|
|
14694
|
-
throw
|
|
14967
|
+
throw new AxiosError("address must be a string", AxiosError.ERR_BAD_OPTION_VALUE);
|
|
14695
14968
|
}
|
|
14696
14969
|
return {
|
|
14697
14970
|
address,
|
|
@@ -14702,6 +14975,30 @@ var require_axios = __commonJS({
|
|
|
14702
14975
|
address,
|
|
14703
14976
|
family
|
|
14704
14977
|
});
|
|
14978
|
+
var normalizedLookupCache = /* @__PURE__ */ new WeakMap();
|
|
14979
|
+
var normalizeLookup = (lookup) => {
|
|
14980
|
+
let normalized = normalizedLookupCache.get(lookup);
|
|
14981
|
+
if (normalized) {
|
|
14982
|
+
return normalized;
|
|
14983
|
+
}
|
|
14984
|
+
const callbackLookup = callbackify(lookup, (value) => utils$1.isArray(value) ? value : [value]);
|
|
14985
|
+
normalized = (hostname, opt, cb) => {
|
|
14986
|
+
callbackLookup(hostname, opt, (err, arg0, arg1) => {
|
|
14987
|
+
if (err) {
|
|
14988
|
+
return cb(err);
|
|
14989
|
+
}
|
|
14990
|
+
let addresses;
|
|
14991
|
+
try {
|
|
14992
|
+
addresses = utils$1.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
|
14993
|
+
} catch (error) {
|
|
14994
|
+
return cb(error);
|
|
14995
|
+
}
|
|
14996
|
+
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
|
14997
|
+
});
|
|
14998
|
+
};
|
|
14999
|
+
normalizedLookupCache.set(lookup, normalized);
|
|
15000
|
+
return normalized;
|
|
15001
|
+
};
|
|
14705
15002
|
var http2Transport = {
|
|
14706
15003
|
request(options, cb) {
|
|
14707
15004
|
const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
|
|
@@ -14746,6 +15043,7 @@ var require_axios = __commonJS({
|
|
|
14746
15043
|
let family = own2("family");
|
|
14747
15044
|
let httpVersion = own2("httpVersion");
|
|
14748
15045
|
if (httpVersion === void 0) httpVersion = 1;
|
|
15046
|
+
const rawHttpVersion = httpVersion;
|
|
14749
15047
|
let http2Options = own2("http2Options");
|
|
14750
15048
|
const httpAgent = own2("httpAgent");
|
|
14751
15049
|
const httpsAgent = own2("httpsAgent");
|
|
@@ -14762,25 +15060,20 @@ var require_axios = __commonJS({
|
|
|
14762
15060
|
let rejected = false;
|
|
14763
15061
|
let req;
|
|
14764
15062
|
let connectPhaseTimer;
|
|
14765
|
-
|
|
15063
|
+
try {
|
|
15064
|
+
httpVersion = +httpVersion;
|
|
15065
|
+
} catch (err) {
|
|
15066
|
+
throw new AxiosError("Invalid protocol version: value is not a number", AxiosError.ERR_BAD_OPTION_VALUE, config);
|
|
15067
|
+
}
|
|
14766
15068
|
if (Number.isNaN(httpVersion)) {
|
|
14767
|
-
throw
|
|
15069
|
+
throw new AxiosError(`Invalid protocol version: '${rawHttpVersion}' is not a number`, AxiosError.ERR_BAD_OPTION_VALUE, config);
|
|
14768
15070
|
}
|
|
14769
15071
|
if (httpVersion !== 1 && httpVersion !== 2) {
|
|
14770
|
-
throw
|
|
15072
|
+
throw new AxiosError(`Unsupported protocol version '${httpVersion}'`, AxiosError.ERR_BAD_OPTION_VALUE, config);
|
|
14771
15073
|
}
|
|
14772
15074
|
const isHttp2 = httpVersion === 2;
|
|
14773
15075
|
if (lookup) {
|
|
14774
|
-
|
|
14775
|
-
lookup = (hostname, opt, cb) => {
|
|
14776
|
-
_lookup(hostname, opt, (err, arg0, arg1) => {
|
|
14777
|
-
if (err) {
|
|
14778
|
-
return cb(err);
|
|
14779
|
-
}
|
|
14780
|
-
const addresses = utils$1.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
|
14781
|
-
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
|
14782
|
-
});
|
|
14783
|
-
};
|
|
15076
|
+
lookup = normalizeLookup(lookup);
|
|
14784
15077
|
}
|
|
14785
15078
|
const abortEmitter = new events.EventEmitter();
|
|
14786
15079
|
function abort(reason) {
|
|
@@ -14973,6 +15266,11 @@ var require_axios = __commonJS({
|
|
|
14973
15266
|
}));
|
|
14974
15267
|
}
|
|
14975
15268
|
headers.set("Accept-Encoding", utils$1.hasOwnProp(transitional, "advertiseZstdAcceptEncoding") && transitional.advertiseZstdAcceptEncoding === true ? ACCEPT_ENCODING_WITH_ZSTD : ACCEPT_ENCODING, false);
|
|
15269
|
+
if (isHttp2 && lookup) {
|
|
15270
|
+
http2Options = Object.assign(/* @__PURE__ */ Object.create(null), http2Options, {
|
|
15271
|
+
lookup
|
|
15272
|
+
});
|
|
15273
|
+
}
|
|
14976
15274
|
const options = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
14977
15275
|
path: path$1,
|
|
14978
15276
|
method,
|
|
@@ -14986,9 +15284,11 @@ var require_axios = __commonJS({
|
|
|
14986
15284
|
family,
|
|
14987
15285
|
beforeRedirect: dispatchBeforeRedirect,
|
|
14988
15286
|
beforeRedirects: /* @__PURE__ */ Object.create(null),
|
|
14989
|
-
http2Options
|
|
15287
|
+
http2Options,
|
|
15288
|
+
createConnection: void 0
|
|
14990
15289
|
});
|
|
14991
15290
|
!utils$1.isUndefined(lookup) && (options.lookup = lookup);
|
|
15291
|
+
let proxyApplied = false;
|
|
14992
15292
|
if (socketPath) {
|
|
14993
15293
|
if (typeof socketPath !== "string") {
|
|
14994
15294
|
return reject(new AxiosError("socketPath must be a string", AxiosError.ERR_BAD_OPTION_VALUE, config));
|
|
@@ -15006,7 +15306,18 @@ var require_axios = __commonJS({
|
|
|
15006
15306
|
} else {
|
|
15007
15307
|
options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
|
15008
15308
|
options.port = parsed.port;
|
|
15009
|
-
|
|
15309
|
+
proxyApplied = setProxy(
|
|
15310
|
+
options,
|
|
15311
|
+
configProxy,
|
|
15312
|
+
protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path,
|
|
15313
|
+
false,
|
|
15314
|
+
httpsAgent,
|
|
15315
|
+
httpAgent,
|
|
15316
|
+
// The HTTP/2 transport connects independently of HTTP/1 agents, so it
|
|
15317
|
+
// cannot apply either axios-resolved or agent-local environment proxies.
|
|
15318
|
+
// Explicit proxy config is still processed and rejected below.
|
|
15319
|
+
!isHttp2
|
|
15320
|
+
);
|
|
15010
15321
|
}
|
|
15011
15322
|
let transport;
|
|
15012
15323
|
let isNativeTransport = false;
|
|
@@ -15016,6 +15327,9 @@ var require_axios = __commonJS({
|
|
|
15016
15327
|
options.agent = isHttpsRequest ? httpsAgent : httpAgent;
|
|
15017
15328
|
}
|
|
15018
15329
|
if (isHttp2) {
|
|
15330
|
+
if (proxyApplied) {
|
|
15331
|
+
return reject(new AxiosError("HTTP/2 requests with a proxy are not supported", AxiosError.ERR_NOT_SUPPORT, config));
|
|
15332
|
+
}
|
|
15019
15333
|
transport = http2Transport;
|
|
15020
15334
|
} else {
|
|
15021
15335
|
const configTransport = own2("transport");
|
|
@@ -15213,12 +15527,7 @@ var require_axios = __commonJS({
|
|
|
15213
15527
|
socket.setKeepAlive(true, 1e3 * 60);
|
|
15214
15528
|
}
|
|
15215
15529
|
if (!socket[kAxiosSocketListener]) {
|
|
15216
|
-
socket.on("error",
|
|
15217
|
-
const current = socket[kAxiosCurrentReq];
|
|
15218
|
-
if (current && !current.destroyed) {
|
|
15219
|
-
current.destroy(err);
|
|
15220
|
-
}
|
|
15221
|
-
});
|
|
15530
|
+
socket.on("error", handleSocketError);
|
|
15222
15531
|
socket[kAxiosSocketListener] = true;
|
|
15223
15532
|
}
|
|
15224
15533
|
socket[kAxiosCurrentReq] = req;
|
|
@@ -15434,7 +15743,7 @@ var require_axios = __commonJS({
|
|
|
15434
15743
|
transformResponse: defaultToConfig2,
|
|
15435
15744
|
paramsSerializer: defaultToConfig2,
|
|
15436
15745
|
timeout: defaultToConfig2,
|
|
15437
|
-
|
|
15746
|
+
timeoutErrorMessage: defaultToConfig2,
|
|
15438
15747
|
withCredentials: defaultToConfig2,
|
|
15439
15748
|
withXSRFToken: defaultToConfig2,
|
|
15440
15749
|
adapter: defaultToConfig2,
|
|
@@ -15502,10 +15811,11 @@ var require_axios = __commonJS({
|
|
|
15502
15811
|
}
|
|
15503
15812
|
}
|
|
15504
15813
|
if (utils$1.isFormData(data)) {
|
|
15814
|
+
const getHeaders = utils$1.getSafeProp(data, "getHeaders");
|
|
15505
15815
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
|
|
15506
15816
|
headers.setContentType(void 0);
|
|
15507
|
-
} else if (utils$1.isFunction(
|
|
15508
|
-
setFormDataHeaders(headers,
|
|
15817
|
+
} else if (utils$1.isFunction(getHeaders)) {
|
|
15818
|
+
setFormDataHeaders(headers, getHeaders.call(data), own2("formDataHeaderPolicy"));
|
|
15509
15819
|
}
|
|
15510
15820
|
}
|
|
15511
15821
|
if (platform.hasStandardBrowserEnv) {
|
|
@@ -15535,7 +15845,7 @@ var require_axios = __commonJS({
|
|
|
15535
15845
|
} = _config;
|
|
15536
15846
|
let onCanceled;
|
|
15537
15847
|
let uploadThrottled, downloadThrottled;
|
|
15538
|
-
let flushUpload, flushDownload;
|
|
15848
|
+
let flushUpload, flushDownload, flushDownloadWithEvent;
|
|
15539
15849
|
function done() {
|
|
15540
15850
|
flushUpload && flushUpload();
|
|
15541
15851
|
flushDownload && flushDownload();
|
|
@@ -15545,7 +15855,27 @@ var require_axios = __commonJS({
|
|
|
15545
15855
|
let request = new XMLHttpRequest();
|
|
15546
15856
|
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
15547
15857
|
request.timeout = _config.timeout;
|
|
15548
|
-
function onloadend() {
|
|
15858
|
+
function onloadend(event) {
|
|
15859
|
+
if (!request) {
|
|
15860
|
+
return;
|
|
15861
|
+
}
|
|
15862
|
+
if (request.status === 0 && (parseProtocol(normalizeURLForProtocolCheck(_config.url)) || parseProtocol(platform.origin)) !== "file" && !(request.responseURL && request.responseURL.startsWith("file:"))) {
|
|
15863
|
+
reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request));
|
|
15864
|
+
done();
|
|
15865
|
+
request = null;
|
|
15866
|
+
return;
|
|
15867
|
+
}
|
|
15868
|
+
try {
|
|
15869
|
+
if (event) {
|
|
15870
|
+
flushDownloadWithEvent && flushDownloadWithEvent(event);
|
|
15871
|
+
} else {
|
|
15872
|
+
flushDownload && flushDownload();
|
|
15873
|
+
}
|
|
15874
|
+
} catch (err) {
|
|
15875
|
+
setTimeout(() => {
|
|
15876
|
+
throw err;
|
|
15877
|
+
});
|
|
15878
|
+
}
|
|
15549
15879
|
if (!request) {
|
|
15550
15880
|
return;
|
|
15551
15881
|
}
|
|
@@ -15620,7 +15950,7 @@ var require_axios = __commonJS({
|
|
|
15620
15950
|
request.responseType = _config.responseType;
|
|
15621
15951
|
}
|
|
15622
15952
|
if (onDownloadProgress) {
|
|
15623
|
-
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
15953
|
+
[downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(onDownloadProgress, true);
|
|
15624
15954
|
request.addEventListener("progress", downloadThrottled);
|
|
15625
15955
|
}
|
|
15626
15956
|
if (onUploadProgress && request.upload) {
|
|
@@ -15782,6 +16112,17 @@ var require_axios = __commonJS({
|
|
|
15782
16112
|
});
|
|
15783
16113
|
};
|
|
15784
16114
|
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
16115
|
+
var DEFAULT_REQUEST_OPTIONS = {
|
|
16116
|
+
cache: "default",
|
|
16117
|
+
redirect: "follow",
|
|
16118
|
+
referrer: "about:client",
|
|
16119
|
+
referrerPolicy: "",
|
|
16120
|
+
mode: "cors",
|
|
16121
|
+
integrity: "",
|
|
16122
|
+
keepalive: false,
|
|
16123
|
+
priority: "auto",
|
|
16124
|
+
window: null
|
|
16125
|
+
};
|
|
15785
16126
|
var {
|
|
15786
16127
|
isFunction
|
|
15787
16128
|
} = utils$1;
|
|
@@ -15910,7 +16251,8 @@ var require_axios = __commonJS({
|
|
|
15910
16251
|
withCredentials = "same-origin",
|
|
15911
16252
|
fetchOptions,
|
|
15912
16253
|
maxContentLength,
|
|
15913
|
-
maxBodyLength
|
|
16254
|
+
maxBodyLength,
|
|
16255
|
+
maxRedirects
|
|
15914
16256
|
} = resolveConfig(config);
|
|
15915
16257
|
const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
|
|
15916
16258
|
const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
@@ -16011,17 +16353,44 @@ var require_axios = __commonJS({
|
|
|
16011
16353
|
}
|
|
16012
16354
|
}
|
|
16013
16355
|
headers.set("User-Agent", "axios/" + VERSION, false);
|
|
16014
|
-
const
|
|
16015
|
-
|
|
16356
|
+
const safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(/* @__PURE__ */ Object.create(null), fetchOptions);
|
|
16357
|
+
if (safeFetchOptions) {
|
|
16358
|
+
delete safeFetchOptions.body;
|
|
16359
|
+
delete safeFetchOptions.headers;
|
|
16360
|
+
delete safeFetchOptions.method;
|
|
16361
|
+
delete safeFetchOptions.signal;
|
|
16362
|
+
delete safeFetchOptions.duplex;
|
|
16363
|
+
delete safeFetchOptions.credentials;
|
|
16364
|
+
}
|
|
16365
|
+
const resolvedOptions = Object.assign(/* @__PURE__ */ Object.create(null), safeFetchOptions, {
|
|
16016
16366
|
signal: composedSignal,
|
|
16017
16367
|
method: method.toUpperCase(),
|
|
16018
16368
|
headers: toByteStringHeaderObject(headers.normalize()),
|
|
16019
16369
|
body: data,
|
|
16020
16370
|
duplex: "half",
|
|
16021
16371
|
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
16022
|
-
};
|
|
16372
|
+
});
|
|
16373
|
+
if (isRequestSupported) {
|
|
16374
|
+
utils$1.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
|
|
16375
|
+
if (resolvedOptions[key] === void 0) {
|
|
16376
|
+
resolvedOptions[key] = value;
|
|
16377
|
+
}
|
|
16378
|
+
});
|
|
16379
|
+
if (resolvedOptions.signal === void 0) {
|
|
16380
|
+
resolvedOptions.signal = null;
|
|
16381
|
+
}
|
|
16382
|
+
if (resolvedOptions.body === void 0) {
|
|
16383
|
+
resolvedOptions.body = null;
|
|
16384
|
+
}
|
|
16385
|
+
}
|
|
16386
|
+
if (maxRedirects === 0) {
|
|
16387
|
+
resolvedOptions.redirect = "manual";
|
|
16388
|
+
if (safeFetchOptions) {
|
|
16389
|
+
safeFetchOptions.redirect = "manual";
|
|
16390
|
+
}
|
|
16391
|
+
}
|
|
16023
16392
|
request = isRequestSupported && new Request(url2, resolvedOptions);
|
|
16024
|
-
let response = await (isRequestSupported ? _fetch(request,
|
|
16393
|
+
let response = await (isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url2, resolvedOptions));
|
|
16025
16394
|
const responseHeaders = AxiosHeaders.from(response.headers);
|
|
16026
16395
|
if (hasMaxContentLength) {
|
|
16027
16396
|
const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
|
|
@@ -16213,9 +16582,10 @@ var require_axios = __commonJS({
|
|
|
16213
16582
|
throw new CanceledError(null, config);
|
|
16214
16583
|
}
|
|
16215
16584
|
}
|
|
16216
|
-
function dispatchRequest(
|
|
16585
|
+
function dispatchRequest(_config) {
|
|
16586
|
+
const config = utils$1.toSafeFlatObject(_config);
|
|
16217
16587
|
throwIfCancellationRequested(config);
|
|
16218
|
-
config.headers = AxiosHeaders.from(config
|
|
16588
|
+
config.headers = AxiosHeaders.from(utils$1.getSafeProp(config, "headers"));
|
|
16219
16589
|
config.data = transformData.call(config, config.transformRequest);
|
|
16220
16590
|
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
16221
16591
|
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
@@ -16323,16 +16693,15 @@ var require_axios = __commonJS({
|
|
|
16323
16693
|
return await this._request(configOrUrl, config);
|
|
16324
16694
|
} catch (err) {
|
|
16325
16695
|
if (err instanceof Error) {
|
|
16326
|
-
let dummy = {};
|
|
16327
|
-
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
16328
|
-
const stack = (() => {
|
|
16329
|
-
if (!dummy.stack) {
|
|
16330
|
-
return "";
|
|
16331
|
-
}
|
|
16332
|
-
const firstNewlineIndex = dummy.stack.indexOf("\n");
|
|
16333
|
-
return firstNewlineIndex === -1 ? "" : dummy.stack.slice(firstNewlineIndex + 1);
|
|
16334
|
-
})();
|
|
16335
16696
|
try {
|
|
16697
|
+
let dummy = {};
|
|
16698
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
16699
|
+
const dummyStack = dummy.stack;
|
|
16700
|
+
let stack = "";
|
|
16701
|
+
if (typeof dummyStack === "string") {
|
|
16702
|
+
const firstNewlineIndex = dummyStack.indexOf("\n");
|
|
16703
|
+
stack = firstNewlineIndex === -1 ? "" : dummyStack.slice(firstNewlineIndex + 1);
|
|
16704
|
+
}
|
|
16336
16705
|
if (!err.stack) {
|
|
16337
16706
|
err.stack = stack;
|
|
16338
16707
|
} else if (stack) {
|
|
@@ -16394,9 +16763,9 @@ var require_axios = __commonJS({
|
|
|
16394
16763
|
baseUrl: validators.spelling("baseURL"),
|
|
16395
16764
|
withXsrfToken: validators.spelling("withXSRFToken")
|
|
16396
16765
|
}, true);
|
|
16397
|
-
config.method = (config
|
|
16766
|
+
config.method = (utils$1.getSafeProp(config, "method") || utils$1.getSafeProp(this.defaults, "method") || "get").toLowerCase();
|
|
16398
16767
|
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
16399
|
-
headers && utils$1.forEach(
|
|
16768
|
+
headers && utils$1.forEach(methodList.concat("common"), (method) => {
|
|
16400
16769
|
delete headers[method];
|
|
16401
16770
|
});
|
|
16402
16771
|
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
|
@@ -16643,14 +17012,22 @@ var require_axios = __commonJS({
|
|
|
16643
17012
|
Gone: 410,
|
|
16644
17013
|
LengthRequired: 411,
|
|
16645
17014
|
PreconditionFailed: 412,
|
|
17015
|
+
/**
|
|
17016
|
+
* @deprecated Use `ContentTooLarge` instead.
|
|
17017
|
+
*/
|
|
16646
17018
|
PayloadTooLarge: 413,
|
|
17019
|
+
ContentTooLarge: 413,
|
|
16647
17020
|
UriTooLong: 414,
|
|
16648
17021
|
UnsupportedMediaType: 415,
|
|
16649
17022
|
RangeNotSatisfiable: 416,
|
|
16650
17023
|
ExpectationFailed: 417,
|
|
16651
17024
|
ImATeapot: 418,
|
|
16652
17025
|
MisdirectedRequest: 421,
|
|
17026
|
+
/**
|
|
17027
|
+
* @deprecated Use `UnprocessableContent` instead.
|
|
17028
|
+
*/
|
|
16653
17029
|
UnprocessableEntity: 422,
|
|
17030
|
+
UnprocessableContent: 422,
|
|
16654
17031
|
Locked: 423,
|
|
16655
17032
|
FailedDependency: 424,
|
|
16656
17033
|
TooEarly: 425,
|
|
@@ -16679,7 +17056,9 @@ var require_axios = __commonJS({
|
|
|
16679
17056
|
InvalidSslCertificate: 526
|
|
16680
17057
|
};
|
|
16681
17058
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
16682
|
-
HttpStatusCode[value]
|
|
17059
|
+
if (HttpStatusCode[value] === void 0) {
|
|
17060
|
+
HttpStatusCode[value] = key;
|
|
17061
|
+
}
|
|
16683
17062
|
});
|
|
16684
17063
|
function createInstance(defaultConfig) {
|
|
16685
17064
|
const context = new Axios(defaultConfig);
|
|
@@ -22216,9 +22595,9 @@ var require_buffer = __commonJS({
|
|
|
22216
22595
|
}
|
|
22217
22596
|
});
|
|
22218
22597
|
|
|
22219
|
-
// node_modules/.pnpm/msedge-tts@2.
|
|
22598
|
+
// node_modules/.pnpm/msedge-tts@2.1.0_debug@4.4.3/node_modules/msedge-tts/dist/Output.js
|
|
22220
22599
|
var require_Output = __commonJS({
|
|
22221
|
-
"node_modules/.pnpm/msedge-tts@2.
|
|
22600
|
+
"node_modules/.pnpm/msedge-tts@2.1.0_debug@4.4.3/node_modules/msedge-tts/dist/Output.js"(exports2) {
|
|
22222
22601
|
"use strict";
|
|
22223
22602
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
22224
22603
|
exports2.OUTPUT_EXTENSIONS = exports2.OUTPUT_FORMAT = void 0;
|
|
@@ -22236,9 +22615,9 @@ var require_Output = __commonJS({
|
|
|
22236
22615
|
}
|
|
22237
22616
|
});
|
|
22238
22617
|
|
|
22239
|
-
// node_modules/.pnpm/msedge-tts@2.
|
|
22618
|
+
// node_modules/.pnpm/msedge-tts@2.1.0_debug@4.4.3/node_modules/msedge-tts/dist/Prosody.js
|
|
22240
22619
|
var require_Prosody = __commonJS({
|
|
22241
|
-
"node_modules/.pnpm/msedge-tts@2.
|
|
22620
|
+
"node_modules/.pnpm/msedge-tts@2.1.0_debug@4.4.3/node_modules/msedge-tts/dist/Prosody.js"(exports2) {
|
|
22242
22621
|
"use strict";
|
|
22243
22622
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
22244
22623
|
exports2.VOLUME = exports2.PITCH = exports2.RATE = exports2.ProsodyOptions = void 0;
|
|
@@ -22294,9 +22673,9 @@ var require_Prosody = __commonJS({
|
|
|
22294
22673
|
}
|
|
22295
22674
|
});
|
|
22296
22675
|
|
|
22297
|
-
// node_modules/.pnpm/msedge-tts@2.
|
|
22676
|
+
// node_modules/.pnpm/msedge-tts@2.1.0_debug@4.4.3/node_modules/msedge-tts/dist/utils.js
|
|
22298
22677
|
var require_utils = __commonJS({
|
|
22299
|
-
"node_modules/.pnpm/msedge-tts@2.
|
|
22678
|
+
"node_modules/.pnpm/msedge-tts@2.1.0_debug@4.4.3/node_modules/msedge-tts/dist/utils.js"(exports2) {
|
|
22300
22679
|
"use strict";
|
|
22301
22680
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
22302
22681
|
exports2.joinPath = void 0;
|
|
@@ -22307,9 +22686,9 @@ var require_utils = __commonJS({
|
|
|
22307
22686
|
}
|
|
22308
22687
|
});
|
|
22309
22688
|
|
|
22310
|
-
// node_modules/.pnpm/msedge-tts@2.
|
|
22689
|
+
// node_modules/.pnpm/msedge-tts@2.1.0_debug@4.4.3/node_modules/msedge-tts/dist/MsEdgeTTS.js
|
|
22311
22690
|
var require_MsEdgeTTS = __commonJS({
|
|
22312
|
-
"node_modules/.pnpm/msedge-tts@2.
|
|
22691
|
+
"node_modules/.pnpm/msedge-tts@2.1.0_debug@4.4.3/node_modules/msedge-tts/dist/MsEdgeTTS.js"(exports2) {
|
|
22313
22692
|
"use strict";
|
|
22314
22693
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
22315
22694
|
if (k2 === void 0) k2 = k;
|
|
@@ -22380,19 +22759,25 @@ var require_MsEdgeTTS = __commonJS({
|
|
|
22380
22759
|
var MsEdgeTTS2 = class _MsEdgeTTS {
|
|
22381
22760
|
static TRUSTED_CLIENT_TOKEN = "6A5AA1D4EAFF4E9FB37E23D68491D6F4";
|
|
22382
22761
|
static VOICES_URL = `https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list?trustedclienttoken=${_MsEdgeTTS.TRUSTED_CLIENT_TOKEN}`;
|
|
22383
|
-
static WSS_URL = "wss://
|
|
22762
|
+
static WSS_URL = "wss://api.msedgeservices.com/tts/cognitiveservices/websocket/v1";
|
|
22384
22763
|
static JSON_XML_DELIM = "\r\n\r\n";
|
|
22385
22764
|
static AUDIO_DELIM = "Path:audio\r\n";
|
|
22386
|
-
static VOICE_LANG_REGEX = /\
|
|
22765
|
+
static VOICE_LANG_REGEX = /\b[a-z]{2,}-[A-Z]{2}\b/;
|
|
22766
|
+
static _clockOffsetMs = 0;
|
|
22387
22767
|
_enableLogger;
|
|
22388
22768
|
_isBrowser;
|
|
22389
22769
|
_ws;
|
|
22770
|
+
_clientInit;
|
|
22771
|
+
_clientGeneration = 0;
|
|
22390
22772
|
_voice;
|
|
22391
22773
|
_outputFormat;
|
|
22392
22774
|
_metadataOptions = new MetadataOptions();
|
|
22393
22775
|
_streams = {};
|
|
22776
|
+
_retiredSockets = [];
|
|
22394
22777
|
_startTime = 0;
|
|
22395
22778
|
_agent;
|
|
22779
|
+
_connectionTimeoutMs;
|
|
22780
|
+
_synthesisTimeoutMs;
|
|
22396
22781
|
_log(...o) {
|
|
22397
22782
|
if (this._enableLogger) {
|
|
22398
22783
|
console.log(...o);
|
|
@@ -22407,24 +22792,81 @@ var require_MsEdgeTTS = __commonJS({
|
|
|
22407
22792
|
this._agent = options?.agent || void 0;
|
|
22408
22793
|
this._enableLogger = options?.enableLogger || false;
|
|
22409
22794
|
this._isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
22795
|
+
this._connectionTimeoutMs = options?.connectionTimeoutMs === void 0 ? 1e4 : options.connectionTimeoutMs;
|
|
22796
|
+
this._synthesisTimeoutMs = options?.synthesisTimeoutMs === void 0 ? 6e4 : options.synthesisTimeoutMs;
|
|
22797
|
+
for (const [name, value] of Object.entries({ connectionTimeoutMs: this._connectionTimeoutMs, synthesisTimeoutMs: this._synthesisTimeoutMs })) {
|
|
22798
|
+
if (!Number.isInteger(value) || value < 0 || value > 2147483647) {
|
|
22799
|
+
throw new Error(`${name} must be an integer between 0 and 2147483647 milliseconds.`);
|
|
22800
|
+
}
|
|
22801
|
+
}
|
|
22410
22802
|
}
|
|
22411
22803
|
static async getSynthUrl() {
|
|
22412
22804
|
const req_id = _MsEdgeTTS.generateUUID();
|
|
22413
22805
|
const secMsGEC = await _MsEdgeTTS.generateSecMsGec(this.TRUSTED_CLIENT_TOKEN);
|
|
22414
|
-
return `${this.WSS_URL}?
|
|
22415
|
-
}
|
|
22416
|
-
|
|
22806
|
+
return `${this.WSS_URL}?Ocp-Apim-Subscription-Key=${this.TRUSTED_CLIENT_TOKEN}&Sec-MS-GEC=${secMsGEC}&Sec-MS-GEC-Version=1-143.0.3650.96&ConnectionId=${req_id}`;
|
|
22807
|
+
}
|
|
22808
|
+
_initClient() {
|
|
22809
|
+
if (this._clientInit)
|
|
22810
|
+
return this._clientInit;
|
|
22811
|
+
const init = this._createClient();
|
|
22812
|
+
const tracked = init.finally(() => {
|
|
22813
|
+
if (this._clientInit === tracked)
|
|
22814
|
+
this._clientInit = void 0;
|
|
22815
|
+
});
|
|
22816
|
+
this._clientInit = tracked;
|
|
22817
|
+
return tracked;
|
|
22818
|
+
}
|
|
22819
|
+
async _createClient(retryClock = true, deadline = this._connectionTimeoutMs ? Date.now() + this._connectionTimeoutMs : 0, generation = this._clientGeneration) {
|
|
22820
|
+
const previous = this._ws;
|
|
22821
|
+
if (previous) {
|
|
22822
|
+
if (previous.readyState === previous.OPEN && Object.values(this._streams).some((stream) => stream.socket === previous && !stream.turnEnded)) {
|
|
22823
|
+
if (!this._retiredSockets.includes(previous))
|
|
22824
|
+
this._retiredSockets.push(previous);
|
|
22825
|
+
} else {
|
|
22826
|
+
this._closeSocket(previous);
|
|
22827
|
+
}
|
|
22828
|
+
}
|
|
22417
22829
|
const synthUrl = await _MsEdgeTTS.getSynthUrl();
|
|
22830
|
+
if (generation !== this._clientGeneration)
|
|
22831
|
+
throw new Error("Edge TTS connection closed before initialization completed.");
|
|
22832
|
+
const remaining = deadline ? deadline - Date.now() : 0;
|
|
22833
|
+
if (deadline && remaining <= 0)
|
|
22834
|
+
throw new Error(`Edge TTS connection timed out after ${this._connectionTimeoutMs} milliseconds.`);
|
|
22418
22835
|
const options = {
|
|
22419
22836
|
headers: {
|
|
22420
22837
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0",
|
|
22421
22838
|
"Origin": "chrome-extension://jdiccldimpdaibmpdkjnbmckianbfold"
|
|
22422
22839
|
}
|
|
22423
22840
|
};
|
|
22424
|
-
this._ws = this._isBrowser ? new isomorphic_ws_1.default(synthUrl
|
|
22425
|
-
|
|
22841
|
+
const ws = this._ws = this._isBrowser ? new isomorphic_ws_1.default(synthUrl) : new isomorphic_ws_1.default(synthUrl, { ...options, agent: this._agent });
|
|
22842
|
+
ws.binaryType = "arraybuffer";
|
|
22426
22843
|
return new Promise((resolve, reject) => {
|
|
22427
|
-
|
|
22844
|
+
let connecting = true;
|
|
22845
|
+
const connectionTimeout = this._connectionTimeoutMs ? setTimeout(() => {
|
|
22846
|
+
connecting = false;
|
|
22847
|
+
reject(new Error(`Edge TTS connection timed out after ${this._connectionTimeoutMs} milliseconds.`));
|
|
22848
|
+
this._closeSocket(ws);
|
|
22849
|
+
}, remaining) : void 0;
|
|
22850
|
+
if (!this._isBrowser) {
|
|
22851
|
+
ws.once("unexpected-response", (request, response) => {
|
|
22852
|
+
if (!connecting || ws.readyState !== ws.CONNECTING || generation !== this._clientGeneration) {
|
|
22853
|
+
request.destroy();
|
|
22854
|
+
response.destroy();
|
|
22855
|
+
return;
|
|
22856
|
+
}
|
|
22857
|
+
const error = Object.assign(new Error(`Unexpected server response: ${response.statusCode}`), {
|
|
22858
|
+
statusCode: response.statusCode,
|
|
22859
|
+
serverDate: response.headers.date
|
|
22860
|
+
});
|
|
22861
|
+
request.destroy(error);
|
|
22862
|
+
response.destroy();
|
|
22863
|
+
});
|
|
22864
|
+
}
|
|
22865
|
+
ws.onopen = () => {
|
|
22866
|
+
if (!connecting)
|
|
22867
|
+
return;
|
|
22868
|
+
connecting = false;
|
|
22869
|
+
clearTimeout(connectionTimeout);
|
|
22428
22870
|
this._log("Connected in", (Date.now() - this._startTime) / 1e3, "seconds");
|
|
22429
22871
|
this._send(`Content-Type:application/json; charset=utf-8\r
|
|
22430
22872
|
Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
|
|
@@ -22441,39 +22883,58 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
|
|
|
22441
22883
|
}
|
|
22442
22884
|
}
|
|
22443
22885
|
}
|
|
22444
|
-
|
|
22886
|
+
`, void 0, ws).then(resolve, (error) => {
|
|
22887
|
+
this._closeSocket(ws);
|
|
22888
|
+
reject(error);
|
|
22889
|
+
});
|
|
22445
22890
|
};
|
|
22446
|
-
|
|
22891
|
+
ws.onmessage = (m) => {
|
|
22447
22892
|
const buffer = index_1.Buffer.from(m.data);
|
|
22448
22893
|
const message = buffer.toString();
|
|
22449
|
-
const requestId = /X-RequestId:(.*?)\r\n
|
|
22894
|
+
const requestId = /X-RequestId:(.*?)\r\n/.exec(message)?.[1];
|
|
22895
|
+
const stream = requestId && this._streams[requestId];
|
|
22896
|
+
if (!stream || stream.audio.destroyed || stream.turnEnded || stream.socket !== ws)
|
|
22897
|
+
return;
|
|
22450
22898
|
if (message.includes(`Path:${messageTypes.TURN_START}`)) {
|
|
22451
22899
|
this._log("->", message);
|
|
22900
|
+
this._resetSynthesisTimeout(requestId);
|
|
22452
22901
|
} else if (message.includes(`Path:${messageTypes.TURN_END}`)) {
|
|
22453
22902
|
this._log("->", message);
|
|
22454
|
-
|
|
22455
|
-
|
|
22903
|
+
clearTimeout(stream.timeout);
|
|
22904
|
+
stream.timeout = void 0;
|
|
22905
|
+
stream.turnEnded = true;
|
|
22906
|
+
stream.audio.push(null);
|
|
22907
|
+
this._closeRetiredSockets();
|
|
22456
22908
|
} else if (message.includes(`Path:${messageTypes.RESPONSE}`)) {
|
|
22457
22909
|
this._log("->", message);
|
|
22910
|
+
this._resetSynthesisTimeout(requestId);
|
|
22458
22911
|
} else if (message.includes(`Path:${messageTypes.AUDIO_METADATA}`)) {
|
|
22459
22912
|
const dataStartIndex = buffer.indexOf(_MsEdgeTTS.JSON_XML_DELIM) + _MsEdgeTTS.JSON_XML_DELIM.length;
|
|
22460
22913
|
const data = buffer.subarray(dataStartIndex);
|
|
22461
22914
|
this._log("->", message);
|
|
22915
|
+
this._resetSynthesisTimeout(requestId);
|
|
22462
22916
|
this._pushMetadata(data, requestId);
|
|
22463
22917
|
} else if (message.includes(`Path:${messageTypes.AUDIO}`) && m.data instanceof ArrayBuffer) {
|
|
22464
22918
|
const dataStartIndex = buffer.indexOf(_MsEdgeTTS.AUDIO_DELIM) + _MsEdgeTTS.AUDIO_DELIM.length;
|
|
22465
22919
|
const headers = buffer.subarray(0, dataStartIndex).toString();
|
|
22466
22920
|
const data = buffer.subarray(dataStartIndex);
|
|
22467
22921
|
this._log("->", headers);
|
|
22922
|
+
this._resetSynthesisTimeout(requestId);
|
|
22468
22923
|
this._pushAudioData(data, requestId);
|
|
22469
22924
|
} else {
|
|
22470
22925
|
this._log("->", "UNKNOWN MESSAGE", message);
|
|
22471
22926
|
}
|
|
22472
22927
|
};
|
|
22473
|
-
|
|
22928
|
+
ws.onclose = () => {
|
|
22929
|
+
connecting = false;
|
|
22930
|
+
clearTimeout(connectionTimeout);
|
|
22931
|
+
reject(new Error("Edge TTS connection closed before initialization completed."));
|
|
22474
22932
|
this._log("disconnected after:", (Date.now() - this._startTime) / 1e3, "seconds");
|
|
22475
22933
|
for (const requestId in this._streams) {
|
|
22476
22934
|
const stream = this._streams[requestId];
|
|
22935
|
+
if (stream.socket !== ws)
|
|
22936
|
+
continue;
|
|
22937
|
+
clearTimeout(stream.timeout);
|
|
22477
22938
|
if (stream.turnEnded) {
|
|
22478
22939
|
stream.audio.push(null);
|
|
22479
22940
|
} else {
|
|
@@ -22481,14 +22942,47 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
|
|
|
22481
22942
|
}
|
|
22482
22943
|
}
|
|
22483
22944
|
};
|
|
22484
|
-
|
|
22945
|
+
ws.onerror = (event) => {
|
|
22946
|
+
connecting = false;
|
|
22947
|
+
clearTimeout(connectionTimeout);
|
|
22485
22948
|
const underlying = event?.error ?? event;
|
|
22486
22949
|
const message = underlying?.message ?? String(underlying);
|
|
22487
22950
|
const code = underlying?.code ?? event?.code;
|
|
22488
22951
|
const wrapped = new Error(`Edge TTS WebSocket error: ${message}${code ? ` (code=${code})` : ""}`);
|
|
22489
22952
|
wrapped.cause = underlying;
|
|
22490
22953
|
reject(wrapped);
|
|
22954
|
+
for (const stream of Object.values(this._streams)) {
|
|
22955
|
+
if (stream.socket === ws && !stream.turnEnded)
|
|
22956
|
+
stream.audio.destroy(wrapped);
|
|
22957
|
+
}
|
|
22958
|
+
this._closeSocket(ws);
|
|
22491
22959
|
};
|
|
22960
|
+
}).catch((error) => {
|
|
22961
|
+
const underlying = error.cause;
|
|
22962
|
+
const serverTime = typeof underlying?.serverDate === "string" ? Date.parse(underlying.serverDate) : NaN;
|
|
22963
|
+
if (retryClock && underlying?.statusCode === 403 && Number.isFinite(serverTime) && generation === this._clientGeneration && (!deadline || Date.now() < deadline)) {
|
|
22964
|
+
_MsEdgeTTS._clockOffsetMs = serverTime - Date.now();
|
|
22965
|
+
return this._createClient(false, deadline, generation);
|
|
22966
|
+
}
|
|
22967
|
+
throw error;
|
|
22968
|
+
});
|
|
22969
|
+
}
|
|
22970
|
+
_closeSocket(socket) {
|
|
22971
|
+
if (socket.readyState === socket.CLOSED)
|
|
22972
|
+
return;
|
|
22973
|
+
const terminate = socket.terminate;
|
|
22974
|
+
if (socket.readyState !== socket.OPEN && terminate)
|
|
22975
|
+
terminate.call(socket);
|
|
22976
|
+
else
|
|
22977
|
+
socket.close();
|
|
22978
|
+
}
|
|
22979
|
+
_closeRetiredSockets() {
|
|
22980
|
+
this._retiredSockets = this._retiredSockets.filter((socket) => {
|
|
22981
|
+
if (Object.values(this._streams).some((stream) => stream.socket === socket && !stream.turnEnded)) {
|
|
22982
|
+
return true;
|
|
22983
|
+
}
|
|
22984
|
+
socket.close();
|
|
22985
|
+
return false;
|
|
22492
22986
|
});
|
|
22493
22987
|
}
|
|
22494
22988
|
static generateUUID() {
|
|
@@ -22499,7 +22993,7 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
|
|
|
22499
22993
|
});
|
|
22500
22994
|
}
|
|
22501
22995
|
static async generateSecMsGec(trustedClientToken) {
|
|
22502
|
-
const ticks = Math.floor(Date.now() / 1e3) + 11644473600;
|
|
22996
|
+
const ticks = Math.floor((Date.now() + _MsEdgeTTS._clockOffsetMs) / 1e3) + 11644473600;
|
|
22503
22997
|
const rounded = ticks - ticks % 300;
|
|
22504
22998
|
const windowsTicks = rounded * 1e7;
|
|
22505
22999
|
const encoder = new TextEncoder();
|
|
@@ -22507,23 +23001,58 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
|
|
|
22507
23001
|
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
22508
23002
|
return Array.from(new Uint8Array(hashBuffer)).map((b) => b.toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
22509
23003
|
}
|
|
22510
|
-
async _send(message) {
|
|
22511
|
-
|
|
23004
|
+
async _send(message, requestId, initialSocket) {
|
|
23005
|
+
let socket = initialSocket ?? this._ws;
|
|
23006
|
+
for (let i = 1; !initialSocket && i <= 3 && socket.readyState !== socket.OPEN; i++) {
|
|
23007
|
+
if (requestId && !this._streams[requestId])
|
|
23008
|
+
return;
|
|
22512
23009
|
if (i == 1) {
|
|
22513
23010
|
this._startTime = Date.now();
|
|
22514
23011
|
}
|
|
22515
23012
|
this._log("connecting: ", i);
|
|
22516
23013
|
await this._initClient();
|
|
23014
|
+
socket = this._ws;
|
|
22517
23015
|
}
|
|
22518
|
-
|
|
23016
|
+
if (requestId) {
|
|
23017
|
+
const stream = this._streams[requestId];
|
|
23018
|
+
if (!stream || stream.audio.destroyed || stream.turnEnded)
|
|
23019
|
+
return;
|
|
23020
|
+
stream.socket = socket;
|
|
23021
|
+
}
|
|
23022
|
+
if (socket.readyState !== socket.OPEN)
|
|
23023
|
+
throw new Error("Edge TTS WebSocket is not open.");
|
|
23024
|
+
if (requestId)
|
|
23025
|
+
this._resetSynthesisTimeout(requestId);
|
|
23026
|
+
if (this._isBrowser) {
|
|
23027
|
+
socket.send(message);
|
|
22519
23028
|
this._log("<-", message);
|
|
23029
|
+
return;
|
|
23030
|
+
}
|
|
23031
|
+
await new Promise((resolve, reject) => {
|
|
23032
|
+
socket.send(message, (error) => {
|
|
23033
|
+
if (error)
|
|
23034
|
+
return reject(error);
|
|
23035
|
+
this._log("<-", message);
|
|
23036
|
+
resolve();
|
|
23037
|
+
});
|
|
22520
23038
|
});
|
|
22521
23039
|
}
|
|
23040
|
+
_resetSynthesisTimeout(requestId) {
|
|
23041
|
+
const stream = this._streams[requestId];
|
|
23042
|
+
if (!stream || stream.audio.destroyed || stream.turnEnded)
|
|
23043
|
+
return;
|
|
23044
|
+
clearTimeout(stream.timeout);
|
|
23045
|
+
if (this._synthesisTimeoutMs) {
|
|
23046
|
+
stream.timeout = setTimeout(() => {
|
|
23047
|
+
stream.audio.destroy(new Error(`Edge TTS synthesis timed out after ${this._synthesisTimeoutMs} milliseconds without activity.`));
|
|
23048
|
+
}, this._synthesisTimeoutMs);
|
|
23049
|
+
}
|
|
23050
|
+
}
|
|
22522
23051
|
_pushAudioData(data, requestId) {
|
|
22523
|
-
this._streams[requestId]
|
|
23052
|
+
this._streams[requestId]?.audio.push(data);
|
|
22524
23053
|
}
|
|
22525
23054
|
_pushMetadata(data, requestId) {
|
|
22526
|
-
this._streams[requestId]
|
|
23055
|
+
this._streams[requestId]?.metadata?.push(data);
|
|
22527
23056
|
}
|
|
22528
23057
|
_SSMLTemplate(input, options = {}) {
|
|
22529
23058
|
options = { ...new Prosody_1.ProsodyOptions(), ...options };
|
|
@@ -22559,16 +23088,16 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
|
|
|
22559
23088
|
const oldOutputFormat = this._outputFormat;
|
|
22560
23089
|
const oldOptions = JSON.stringify(this._metadataOptions);
|
|
22561
23090
|
this._voice = voiceName;
|
|
22562
|
-
|
|
23091
|
+
Object.assign(this._metadataOptions, metadataOptions);
|
|
23092
|
+
if (!metadataOptions?.voiceLocale && (!this._metadataOptions.voiceLocale || oldVoice !== this._voice)) {
|
|
22563
23093
|
const voiceLangMatch = _MsEdgeTTS.VOICE_LANG_REGEX.exec(this._voice);
|
|
22564
23094
|
if (!voiceLangMatch)
|
|
22565
23095
|
throw new Error("Could not infer voiceLocale from voiceName, and no voiceLocale was specified!");
|
|
22566
23096
|
this._metadataOptions.voiceLocale = voiceLangMatch[0];
|
|
22567
23097
|
}
|
|
22568
23098
|
this._outputFormat = outputFormat;
|
|
22569
|
-
Object.assign(this._metadataOptions, metadataOptions);
|
|
22570
23099
|
const changed = oldVoice !== this._voice || oldOutputFormat !== this._outputFormat || oldOptions !== JSON.stringify(this._metadataOptions);
|
|
22571
|
-
if (!changed && this._ws
|
|
23100
|
+
if (!changed && !this._clientInit && this._ws?.readyState === isomorphic_ws_1.default.OPEN && !this._retiredSockets.includes(this._ws)) {
|
|
22572
23101
|
return;
|
|
22573
23102
|
}
|
|
22574
23103
|
this._startTime = Date.now();
|
|
@@ -22582,7 +23111,18 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
|
|
|
22582
23111
|
* Close the WebSocket connection.
|
|
22583
23112
|
*/
|
|
22584
23113
|
close() {
|
|
22585
|
-
this.
|
|
23114
|
+
this._clientGeneration++;
|
|
23115
|
+
const sockets = new Set(this._retiredSockets);
|
|
23116
|
+
if (this._ws)
|
|
23117
|
+
sockets.add(this._ws);
|
|
23118
|
+
this._retiredSockets = [];
|
|
23119
|
+
for (const stream of Object.values(this._streams)) {
|
|
23120
|
+
clearTimeout(stream.timeout);
|
|
23121
|
+
if (!stream.turnEnded) {
|
|
23122
|
+
stream.audio.destroy(new Error("Stream closed before the synthesis completed (no turn.end received). The audio is likely truncated."));
|
|
23123
|
+
}
|
|
23124
|
+
}
|
|
23125
|
+
sockets.forEach((socket) => this._closeSocket(socket));
|
|
22586
23126
|
}
|
|
22587
23127
|
/**
|
|
22588
23128
|
* Writes raw audio synthesised from text to a file. Uses a basic {@link _SSMLTemplate SML template}.
|
|
@@ -22644,7 +23184,7 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
|
|
|
22644
23184
|
resolve(audioFilePath);
|
|
22645
23185
|
} else {
|
|
22646
23186
|
reject(new Error("No audio data received"));
|
|
22647
|
-
fs.
|
|
23187
|
+
fs.rmSync(audioFilePath, { force: true });
|
|
22648
23188
|
}
|
|
22649
23189
|
});
|
|
22650
23190
|
writableAudioFile.once("error", reject);
|
|
@@ -22664,7 +23204,7 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
|
|
|
22664
23204
|
resolve(metadataFilePath);
|
|
22665
23205
|
} else {
|
|
22666
23206
|
reject(new Error("No metadata received"));
|
|
22667
|
-
fs.
|
|
23207
|
+
fs.rmSync(metadataFilePath, { force: true });
|
|
22668
23208
|
}
|
|
22669
23209
|
});
|
|
22670
23210
|
metadataStream.once("error", reject);
|
|
@@ -22693,7 +23233,9 @@ Path:${messageTypes.SSML}${_MsEdgeTTS.JSON_XML_DELIM}` + requestSSML.trim();
|
|
|
22693
23233
|
read() {
|
|
22694
23234
|
},
|
|
22695
23235
|
destroy(error, callback) {
|
|
23236
|
+
clearTimeout(self2._streams[requestId]?.timeout);
|
|
22696
23237
|
delete self2._streams[requestId];
|
|
23238
|
+
self2._closeRetiredSockets();
|
|
22697
23239
|
callback(error);
|
|
22698
23240
|
}
|
|
22699
23241
|
});
|
|
@@ -22714,7 +23256,9 @@ Path:${messageTypes.SSML}${_MsEdgeTTS.JSON_XML_DELIM}` + requestSSML.trim();
|
|
|
22714
23256
|
metadata: metadataStream,
|
|
22715
23257
|
turnEnded: false
|
|
22716
23258
|
};
|
|
22717
|
-
this._send(request).
|
|
23259
|
+
this._send(request, requestId).catch((error) => {
|
|
23260
|
+
this._streams[requestId]?.audio.destroy(error);
|
|
23261
|
+
});
|
|
22718
23262
|
return { audioStream, metadataStream, requestId };
|
|
22719
23263
|
}
|
|
22720
23264
|
};
|
|
@@ -22755,7 +23299,7 @@ mime-types/index.js:
|
|
|
22755
23299
|
*)
|
|
22756
23300
|
|
|
22757
23301
|
axios/dist/node/axios.cjs:
|
|
22758
|
-
(*! Axios v1.
|
|
23302
|
+
(*! Axios v1.20.0 Copyright (c) 2026 Matt Zabriskie and contributors *)
|
|
22759
23303
|
|
|
22760
23304
|
ieee754/index.js:
|
|
22761
23305
|
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|