@d1g1tal/transportr 3.3.0 → 3.3.1
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/CHANGELOG.md +7 -0
- package/dist/iife/transportr.js +37 -37
- package/dist/iife/transportr.js.map +2 -2
- package/dist/transportr.js +3 -3
- package/dist/transportr.js.map +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.3.1](https://github.com/D1g1talEntr0py/transportr/compare/v3.3.0...v3.3.1) (2026-04-09)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* bypasses DOMPurify entirely for trusted content (bc6b70db9199f985ce908688fc4e0ac16e05ec6e)
|
|
6
|
+
Fixes an issue where the handler partially sanitized HTML even when scripts were allowed. Bypassing DOMPurify completely ensures that inline event handlers and other required attributes are preserved, allowing JavaScript to execute reliably when the caller explicitly trusts the content.
|
|
7
|
+
|
|
1
8
|
## [3.3.0](https://github.com/D1g1talEntr0py/transportr/compare/v3.2.2...v3.3.0) (2026-04-09)
|
|
2
9
|
|
|
3
10
|
### Features
|
package/dist/iife/transportr.js
CHANGED
|
@@ -74,12 +74,12 @@ function ht() {
|
|
|
74
74
|
}
|
|
75
75
|
let g, X2 = "", { implementation: de2, createNodeIterator: Nt, createDocumentFragment: Ct, getElementsByTagName: It } = l, { importNode: Mt } = a, A2 = Et();
|
|
76
76
|
o.isSupported = typeof _t == "function" && typeof te2 == "function" && de2 && de2.createHTMLDocument !== void 0;
|
|
77
|
-
let { MUSTACHE_EXPR: Ee2, ERB_EXPR: _e2, TMPLIT_EXPR: ge2, DATA_ATTR: wt, ARIA_ATTR: xt, IS_SCRIPT_OR_DATA: Pt, ATTR_WHITESPACE: He2, CUSTOM_ELEMENT: kt } = dt, { IS_ALLOWED_URI: ze } = dt, T2 = null, Ge = r({}, [...ut, ...we, ...xe, ...Pe, ...mt]), d = null, We = r({}, [...pt, ...ke, ...Tt, ...ue]), u = Object.seal(me(null, { tagNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, attributeNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, allowCustomizedBuiltInElements: { writable: true, configurable: false, enumerable: true, value: false } })), j2 = null, ne2 = null, x2 = Object.seal(me(null, { tagCheck: { writable: true, configurable: false, enumerable: true, value: null }, attributeCheck: { writable: true, configurable: false, enumerable: true, value: null } })), Be2 = true, Ae2 = true, Ye = false, Xe = true,
|
|
77
|
+
let { MUSTACHE_EXPR: Ee2, ERB_EXPR: _e2, TMPLIT_EXPR: ge2, DATA_ATTR: wt, ARIA_ATTR: xt, IS_SCRIPT_OR_DATA: Pt, ATTR_WHITESPACE: He2, CUSTOM_ELEMENT: kt } = dt, { IS_ALLOWED_URI: ze } = dt, T2 = null, Ge = r({}, [...ut, ...we, ...xe, ...Pe, ...mt]), d = null, We = r({}, [...pt, ...ke, ...Tt, ...ue]), u = Object.seal(me(null, { tagNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, attributeNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, allowCustomizedBuiltInElements: { writable: true, configurable: false, enumerable: true, value: false } })), j2 = null, ne2 = null, x2 = Object.seal(me(null, { tagCheck: { writable: true, configurable: false, enumerable: true, value: null }, attributeCheck: { writable: true, configurable: false, enumerable: true, value: null } })), Be2 = true, Ae2 = true, Ye = false, Xe = true, U = false, oe = true, P = false, he2 = false, Se2 = false, F2 = false, ie = false, ae2 = false, je2 = true, Ve = false, vt = "user-content-", Re2 = true, V2 = false, H2 = {}, L2 = null, De2 = r({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]), $e = null, qe2 = r({}, ["audio", "video", "img", "source", "image", "track"]), Oe2 = null, Ke = r({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), re = "http://www.w3.org/1998/Math/MathML", se2 = "http://www.w3.org/2000/svg", I2 = "http://www.w3.org/1999/xhtml", z2 = I2, ye2 = false, be2 = null, Ut = r({}, [re, se2, I2], Ie), le2 = r({}, ["mi", "mo", "mn", "ms", "mtext"]), ce2 = r({}, ["annotation-xml"]), Ft = r({}, ["title", "style", "font", "a", "script"]), $2 = null, Ht = ["application/xhtml+xml", "text/html"], zt = "text/html", p = null, G = null, Gt = l.createElement("form"), Ze = function(e) {
|
|
78
78
|
return e instanceof RegExp || e instanceof Function;
|
|
79
79
|
}, Le2 = function() {
|
|
80
80
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
81
81
|
if (!(G && G === e)) {
|
|
82
|
-
if ((!e || typeof e != "object") && (e = {}), e = C(e), $2 = Ht.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? zt : e.PARSER_MEDIA_TYPE, p = $2 === "application/xhtml+xml" ? Ie : pe, T2 = y(e, "ALLOWED_TAGS") ? r({}, e.ALLOWED_TAGS, p) : Ge, d = y(e, "ALLOWED_ATTR") ? r({}, e.ALLOWED_ATTR, p) : We, be2 = y(e, "ALLOWED_NAMESPACES") ? r({}, e.ALLOWED_NAMESPACES, Ie) : Ut, Oe2 = y(e, "ADD_URI_SAFE_ATTR") ? r(C(Ke), e.ADD_URI_SAFE_ATTR, p) : Ke, $e = y(e, "ADD_DATA_URI_TAGS") ? r(C(qe2), e.ADD_DATA_URI_TAGS, p) : qe2,
|
|
82
|
+
if ((!e || typeof e != "object") && (e = {}), e = C(e), $2 = Ht.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? zt : e.PARSER_MEDIA_TYPE, p = $2 === "application/xhtml+xml" ? Ie : pe, T2 = y(e, "ALLOWED_TAGS") ? r({}, e.ALLOWED_TAGS, p) : Ge, d = y(e, "ALLOWED_ATTR") ? r({}, e.ALLOWED_ATTR, p) : We, be2 = y(e, "ALLOWED_NAMESPACES") ? r({}, e.ALLOWED_NAMESPACES, Ie) : Ut, Oe2 = y(e, "ADD_URI_SAFE_ATTR") ? r(C(Ke), e.ADD_URI_SAFE_ATTR, p) : Ke, $e = y(e, "ADD_DATA_URI_TAGS") ? r(C(qe2), e.ADD_DATA_URI_TAGS, p) : qe2, L2 = y(e, "FORBID_CONTENTS") ? r({}, e.FORBID_CONTENTS, p) : De2, j2 = y(e, "FORBID_TAGS") ? r({}, e.FORBID_TAGS, p) : C({}), ne2 = y(e, "FORBID_ATTR") ? r({}, e.FORBID_ATTR, p) : C({}), H2 = y(e, "USE_PROFILES") ? e.USE_PROFILES : false, Be2 = e.ALLOW_ARIA_ATTR !== false, Ae2 = e.ALLOW_DATA_ATTR !== false, Ye = e.ALLOW_UNKNOWN_PROTOCOLS || false, Xe = e.ALLOW_SELF_CLOSE_IN_ATTR !== false, U = e.SAFE_FOR_TEMPLATES || false, oe = e.SAFE_FOR_XML !== false, P = e.WHOLE_DOCUMENT || false, F2 = e.RETURN_DOM || false, ie = e.RETURN_DOM_FRAGMENT || false, ae2 = e.RETURN_TRUSTED_TYPE || false, Se2 = e.FORCE_BODY || false, je2 = e.SANITIZE_DOM !== false, Ve = e.SANITIZE_NAMED_PROPS || false, Re2 = e.KEEP_CONTENT !== false, V2 = e.IN_PLACE || false, ze = e.ALLOWED_URI_REGEXP || gt, z2 = e.NAMESPACE || I2, le2 = e.MATHML_TEXT_INTEGRATION_POINTS || le2, ce2 = e.HTML_INTEGRATION_POINTS || ce2, u = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && Ze(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (u.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && Ze(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (u.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (u.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), U && (Ae2 = false), ie && (F2 = true), H2 && (T2 = r({}, mt), d = me(null), H2.html === true && (r(T2, ut), r(d, pt)), H2.svg === true && (r(T2, we), r(d, ke), r(d, ue)), H2.svgFilters === true && (r(T2, xe), r(d, ke), r(d, ue)), H2.mathMl === true && (r(T2, Pe), r(d, Tt), r(d, ue))), y(e, "ADD_TAGS") || (x2.tagCheck = null), y(e, "ADD_ATTR") || (x2.attributeCheck = null), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? x2.tagCheck = e.ADD_TAGS : (T2 === Ge && (T2 = C(T2)), r(T2, e.ADD_TAGS, p))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? x2.attributeCheck = e.ADD_ATTR : (d === We && (d = C(d)), r(d, e.ADD_ATTR, p))), e.ADD_URI_SAFE_ATTR && r(Oe2, e.ADD_URI_SAFE_ATTR, p), e.FORBID_CONTENTS && (L2 === De2 && (L2 = C(L2)), r(L2, e.FORBID_CONTENTS, p)), e.ADD_FORBID_CONTENTS && (L2 === De2 && (L2 = C(L2)), r(L2, e.ADD_FORBID_CONTENTS, p)), Re2 && (T2["#text"] = true), P && r(T2, ["html", "head", "body"]), T2.table && (r(T2, ["tbody"]), delete j2.tbody), e.TRUSTED_TYPES_POLICY) {
|
|
83
83
|
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw Z('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
84
84
|
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw Z('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
85
85
|
g = e.TRUSTED_TYPES_POLICY, X2 = g.createHTML("");
|
|
@@ -153,7 +153,7 @@ function ht() {
|
|
|
153
153
|
if (M2(A2.uponSanitizeElement, e, { tagName: n, allowedTags: T2 }), oe && e.hasChildNodes() && !nt(e.firstElementChild) && h(/<[/\w!]/g, e.innerHTML) && h(/<[/\w!]/g, e.textContent) || e.nodeType === Q.progressingInstruction || oe && e.nodeType === Q.comment && h(/<[/\w]/g, e.data)) return N2(e), true;
|
|
154
154
|
if (!(x2.tagCheck instanceof Function && x2.tagCheck(n)) && (!T2[n] || j2[n])) {
|
|
155
155
|
if (!j2[n] && at(n) && (u.tagNameCheck instanceof RegExp && h(u.tagNameCheck, n) || u.tagNameCheck instanceof Function && u.tagNameCheck(n))) return false;
|
|
156
|
-
if (Re2 && !
|
|
156
|
+
if (Re2 && !L2[n]) {
|
|
157
157
|
let f = te2(e) || e.parentNode, _2 = Lt(e) || e.childNodes;
|
|
158
158
|
if (_2 && f) {
|
|
159
159
|
let m2 = _2.length;
|
|
@@ -165,7 +165,7 @@ function ht() {
|
|
|
165
165
|
}
|
|
166
166
|
return N2(e), true;
|
|
167
167
|
}
|
|
168
|
-
return e instanceof Fe && !Wt(e) || (n === "noscript" || n === "noembed" || n === "noframes") && h(/<\/no(script|embed|frames)/i, e.innerHTML) ? (N2(e), true) : (
|
|
168
|
+
return e instanceof Fe && !Wt(e) || (n === "noscript" || n === "noembed" || n === "noframes") && h(/<\/no(script|embed|frames)/i, e.innerHTML) ? (N2(e), true) : (U && e.nodeType === Q.text && (t = e.textContent, fe([Ee2, _e2, ge2], (f) => {
|
|
169
169
|
t = K(t, f, " ");
|
|
170
170
|
}), e.textContent !== t && (q(o.removed, { element: e.cloneNode() }), e.textContent = t)), M2(A2.afterSanitizeElements, e, null), false);
|
|
171
171
|
}, it = function(e, t, n) {
|
|
@@ -214,7 +214,7 @@ function ht() {
|
|
|
214
214
|
k2(m2, e);
|
|
215
215
|
continue;
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
U && fe([Ee2, _e2, ge2], (lt) => {
|
|
218
218
|
E = K(E, lt, " ");
|
|
219
219
|
});
|
|
220
220
|
let st = p(e.nodeName);
|
|
@@ -257,7 +257,7 @@ function ht() {
|
|
|
257
257
|
}
|
|
258
258
|
} else if (i instanceof Te2) t = et("<!---->"), n = t.ownerDocument.importNode(i, true), n.nodeType === Q.element && n.nodeName === "BODY" || n.nodeName === "HTML" ? t = n : t.appendChild(n);
|
|
259
259
|
else {
|
|
260
|
-
if (!F2 && !
|
|
260
|
+
if (!F2 && !U && !P && i.indexOf("<") === -1) return g && ae2 ? g.createHTML(i) : i;
|
|
261
261
|
if (t = et(i), !t) return F2 ? null : ae2 ? X2 : "";
|
|
262
262
|
}
|
|
263
263
|
t && Se2 && N2(t.firstChild);
|
|
@@ -271,7 +271,7 @@ function ht() {
|
|
|
271
271
|
}
|
|
272
272
|
let O = P ? t.outerHTML : t.innerHTML;
|
|
273
273
|
return P && T2["!doctype"] && t.ownerDocument && t.ownerDocument.doctype && t.ownerDocument.doctype.name && h(At, t.ownerDocument.doctype.name) && (O = "<!DOCTYPE " + t.ownerDocument.doctype.name + `>
|
|
274
|
-
` + O),
|
|
274
|
+
` + O), U && fe([Ee2, _e2, ge2], (w2) => {
|
|
275
275
|
O = K(O, w2, " ");
|
|
276
276
|
}), g && ae2 ? g.createHTML(O) : O;
|
|
277
277
|
}, o.setConfig = function() {
|
|
@@ -380,7 +380,7 @@ var init_OP3JQ447 = __esm({
|
|
|
380
380
|
});
|
|
381
381
|
|
|
382
382
|
// iife:/home/runner/work/transportr/transportr/dist/transportr.js
|
|
383
|
-
var
|
|
383
|
+
var L = /^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/u;
|
|
384
384
|
var xe2 = /(["\\])/ug;
|
|
385
385
|
var Ue2 = /^[\t\u0020-\u007E\u0080-\u00FF]*$/u;
|
|
386
386
|
var ae = class ue2 extends Map {
|
|
@@ -388,7 +388,7 @@ var ae = class ue2 extends Map {
|
|
|
388
388
|
super(e);
|
|
389
389
|
}
|
|
390
390
|
static isValid(e, t) {
|
|
391
|
-
return
|
|
391
|
+
return L.test(e) && Ue2.test(t);
|
|
392
392
|
}
|
|
393
393
|
get(e) {
|
|
394
394
|
return super.get(e.toLowerCase());
|
|
@@ -404,7 +404,7 @@ var ae = class ue2 extends Map {
|
|
|
404
404
|
return super.delete(e.toLowerCase());
|
|
405
405
|
}
|
|
406
406
|
toString() {
|
|
407
|
-
return Array.from(this).map(([e, t]) => `;${e}=${!t || !
|
|
407
|
+
return Array.from(this).map(([e, t]) => `;${e}=${!t || !L.test(t) ? `"${t.replace(xe2, "\\$1")}"` : t}`).join("");
|
|
408
408
|
}
|
|
409
409
|
get [Symbol.toStringTag]() {
|
|
410
410
|
return "MediaTypeParameters";
|
|
@@ -418,10 +418,10 @@ var Ne = class w {
|
|
|
418
418
|
static parse(e) {
|
|
419
419
|
e = e.replace(Me2, "");
|
|
420
420
|
let t = 0, [n, r2] = w.collect(e, t, ["/"]);
|
|
421
|
-
if (t = r2, !n.length || t >= e.length || !
|
|
421
|
+
if (t = r2, !n.length || t >= e.length || !L.test(n)) throw new TypeError(w.generateErrorMessage("type", n));
|
|
422
422
|
++t;
|
|
423
423
|
let [o, i] = w.collect(e, t, [";"], true, true);
|
|
424
|
-
if (t = i, !o.length || !
|
|
424
|
+
if (t = i, !o.length || !L.test(o)) throw new TypeError(w.generateErrorMessage("subtype", o));
|
|
425
425
|
let a = new ae();
|
|
426
426
|
for (; t < e.length; ) {
|
|
427
427
|
for (++t; Le.has(e[t]); ) ++t;
|
|
@@ -552,7 +552,7 @@ var je = class {
|
|
|
552
552
|
return "Subscription";
|
|
553
553
|
}
|
|
554
554
|
};
|
|
555
|
-
var
|
|
555
|
+
var I = class {
|
|
556
556
|
subscribers = new De();
|
|
557
557
|
errorHandler;
|
|
558
558
|
setErrorHandler(s2) {
|
|
@@ -662,17 +662,17 @@ var b2 = { CONFIGURED: "configured", SUCCESS: "success", ERROR: "error", ABORTED
|
|
|
662
662
|
var H = { ABORT: "abort", TIMEOUT: "timeout" };
|
|
663
663
|
var A = { ABORT: "AbortError", TIMEOUT: "TimeoutError" };
|
|
664
664
|
var x = { once: true, passive: true };
|
|
665
|
-
var
|
|
665
|
+
var M = () => new CustomEvent(H.ABORT, { detail: { cause: A.ABORT } });
|
|
666
666
|
var Re = () => new CustomEvent(H.TIMEOUT, { detail: { cause: A.TIMEOUT } });
|
|
667
667
|
var he = ["POST", "PUT", "PATCH", "DELETE"];
|
|
668
668
|
var ge = new v(500, "Internal Server Error");
|
|
669
669
|
var me2 = new v(499, "Aborted");
|
|
670
670
|
var ye = new v(504, "Request Timeout");
|
|
671
|
-
var
|
|
672
|
-
var
|
|
673
|
-
var
|
|
674
|
-
var
|
|
675
|
-
var
|
|
671
|
+
var W = [408, 413, 429, 500, 502, 503, 504];
|
|
672
|
+
var z = ["GET", "PUT", "HEAD", "DELETE", "OPTIONS"];
|
|
673
|
+
var N = 300;
|
|
674
|
+
var D = 2;
|
|
675
|
+
var _ = class {
|
|
676
676
|
abortSignal;
|
|
677
677
|
abortController = new AbortController();
|
|
678
678
|
events = /* @__PURE__ */ new Map();
|
|
@@ -693,7 +693,7 @@ var j = class {
|
|
|
693
693
|
onTimeout(e) {
|
|
694
694
|
return this.addEventListener(H.TIMEOUT, e);
|
|
695
695
|
}
|
|
696
|
-
abort(e =
|
|
696
|
+
abort(e = M()) {
|
|
697
697
|
this.abortController.abort(e.detail?.cause);
|
|
698
698
|
}
|
|
699
699
|
destroy() {
|
|
@@ -708,15 +708,15 @@ var j = class {
|
|
|
708
708
|
return "SignalController";
|
|
709
709
|
}
|
|
710
710
|
};
|
|
711
|
+
var j;
|
|
711
712
|
var F;
|
|
712
|
-
var
|
|
713
|
-
var k = () => F || (F = (typeof document > "u" || typeof DOMParser > "u" || typeof DocumentFragment > "u" ? import("jsdom").then(({ JSDOM: e }) => {
|
|
713
|
+
var k = () => j || (j = (typeof document > "u" || typeof DOMParser > "u" || typeof DocumentFragment > "u" ? import("jsdom").then(({ JSDOM: e }) => {
|
|
714
714
|
let { window: t } = new e("<!DOCTYPE html><html><head></head><body></body></html>", { url: "http://localhost" });
|
|
715
715
|
globalThis.window = t, Object.assign(globalThis, { document: t.document, DOMParser: t.DOMParser, DocumentFragment: t.DocumentFragment });
|
|
716
716
|
}).catch(() => {
|
|
717
|
-
throw
|
|
717
|
+
throw j = void 0, new Error("jsdom is required for HTML/XML/DOM features in Node.js environments. Install it with: npm install jsdom");
|
|
718
718
|
}) : Promise.resolve()).then(() => Promise.resolve().then(() => (init_OP3JQ447(), OP3JQ447_exports))).then(({ default: e }) => {
|
|
719
|
-
|
|
719
|
+
F = e;
|
|
720
720
|
}));
|
|
721
721
|
var be = async (s2) => await s2.text();
|
|
722
722
|
var K2 = async (s2) => {
|
|
@@ -757,10 +757,10 @@ var Z2 = async (s2) => {
|
|
|
757
757
|
};
|
|
758
758
|
var Ee = async (s2) => await s2.arrayBuffer();
|
|
759
759
|
var ee = async (s2) => Promise.resolve(s2.body);
|
|
760
|
-
var te = async (s2) => (await k(), new DOMParser().parseFromString(
|
|
761
|
-
var se = async (s2) => (await k(), new DOMParser().parseFromString(
|
|
762
|
-
var Se = async (s2) => (await k(), document.createRange().createContextualFragment(
|
|
763
|
-
var Oe = async (s2) => (await k(), document.createRange().createContextualFragment(
|
|
760
|
+
var te = async (s2) => (await k(), new DOMParser().parseFromString(F.sanitize(await s2.text()), "application/xml"));
|
|
761
|
+
var se = async (s2) => (await k(), new DOMParser().parseFromString(F.sanitize(await s2.text()), "text/html"));
|
|
762
|
+
var Se = async (s2) => (await k(), document.createRange().createContextualFragment(F.sanitize(await s2.text())));
|
|
763
|
+
var Oe = async (s2) => (await k(), document.createRange().createContextualFragment(await s2.text()));
|
|
764
764
|
var we2 = (s2) => ({ [Symbol.asyncIterator]() {
|
|
765
765
|
let e = s2.body.getReader(), t = new TextDecoder(), n = "", r2 = false;
|
|
766
766
|
return { async next() {
|
|
@@ -879,14 +879,14 @@ var Be = class s {
|
|
|
879
879
|
_options;
|
|
880
880
|
subscribr;
|
|
881
881
|
hooks = { beforeRequest: [], afterResponse: [], beforeError: [] };
|
|
882
|
-
static globalSubscribr = new
|
|
882
|
+
static globalSubscribr = new I();
|
|
883
883
|
static globalHooks = { beforeRequest: [], afterResponse: [], beforeError: [] };
|
|
884
884
|
static signalControllers = /* @__PURE__ */ new Set();
|
|
885
885
|
static inflightRequests = /* @__PURE__ */ new Map();
|
|
886
886
|
static mediaTypeCache = new Map(Object.values(m).map((e) => [e.toString(), e]));
|
|
887
887
|
static contentTypeHandlers = [[m.TEXT.type, be], [m.JSON.subtype, Q2], [m.BIN.subtype, ee], [m.HTML.subtype, se], [m.XML.subtype, te], [m.PNG.type, Z2], [m.JAVA_SCRIPT.subtype, K2], [m.CSS.subtype, Y]];
|
|
888
888
|
constructor(e = V, t = {}) {
|
|
889
|
-
y2(e) && ([e, t] = [V, e]), this._baseUrl = s.getBaseUrl(e), this._options = s.createOptions(t, s.defaultRequestOptions), this.subscribr = new
|
|
889
|
+
y2(e) && ([e, t] = [V, e]), this._baseUrl = s.getBaseUrl(e), this._options = s.createOptions(t, s.defaultRequestOptions), this.subscribr = new I();
|
|
890
890
|
}
|
|
891
891
|
static CredentialsPolicy = { INCLUDE: "include", OMIT: "omit", SAME_ORIGIN: "same-origin" };
|
|
892
892
|
static RequestMode = { CORS: "cors", NAVIGATE: "navigate", NO_CORS: "no-cors", SAME_ORIGIN: "same-origin" };
|
|
@@ -902,7 +902,7 @@ var Be = class s {
|
|
|
902
902
|
return s.globalSubscribr.unsubscribe(e);
|
|
903
903
|
}
|
|
904
904
|
static abortAll() {
|
|
905
|
-
for (let e of this.signalControllers) e.abort(
|
|
905
|
+
for (let e of this.signalControllers) e.abort(M());
|
|
906
906
|
this.signalControllers.clear();
|
|
907
907
|
}
|
|
908
908
|
static all(e) {
|
|
@@ -934,7 +934,7 @@ var Be = class s {
|
|
|
934
934
|
s.globalHooks = { beforeRequest: [], afterResponse: [], beforeError: [] };
|
|
935
935
|
}
|
|
936
936
|
static unregisterAll() {
|
|
937
|
-
s.abortAll(), s.globalSubscribr = new
|
|
937
|
+
s.abortAll(), s.globalSubscribr = new I(), s.clearHooks(), s.inflightRequests.clear();
|
|
938
938
|
}
|
|
939
939
|
get baseUrl() {
|
|
940
940
|
return this._baseUrl;
|
|
@@ -1106,12 +1106,12 @@ var Be = class s {
|
|
|
1106
1106
|
else if (ke2(u)) f = new Uint8Array(u);
|
|
1107
1107
|
else if (ArrayBuffer.isView(u)) f = new Uint8Array(u.buffer, u.byteOffset, u.byteLength);
|
|
1108
1108
|
else if (!(u instanceof ReadableStream)) return;
|
|
1109
|
-
let E = f ? f.byteLength : null,
|
|
1109
|
+
let E = f ? f.byteLength : null, U = f ? new ReadableStream({ start(P) {
|
|
1110
1110
|
P.enqueue(f), P.close();
|
|
1111
1111
|
} }) : u, O = 0, C2 = new TransformStream({ transform(P, G) {
|
|
1112
1112
|
O += P.byteLength, c({ loaded: O, total: E, percentage: E !== null && E > 0 ? Math.round(O / E * 100) : null }), G.enqueue(P);
|
|
1113
1113
|
} });
|
|
1114
|
-
n.body =
|
|
1114
|
+
n.body = U.pipeThrough(C2), Object.assign(n, { duplex: "half" });
|
|
1115
1115
|
}, re = async () => {
|
|
1116
1116
|
for (; ; ) try {
|
|
1117
1117
|
await S2();
|
|
@@ -1140,7 +1140,7 @@ var Be = class s {
|
|
|
1140
1140
|
}, oe = (f) => {
|
|
1141
1141
|
let E = n.onDownloadProgress;
|
|
1142
1142
|
if (!E || !f.body) return f;
|
|
1143
|
-
let
|
|
1143
|
+
let U = f.headers.get("content-length"), O = U ? parseInt(U, 10) : null, C2 = 0, P = new TransformStream({ transform(ie, Ce) {
|
|
1144
1144
|
C2 += ie.byteLength, E({ loaded: C2, total: O, percentage: O !== null && O > 0 ? Math.round(C2 / O * 100) : null }), Ce.enqueue(ie);
|
|
1145
1145
|
} }), G = f.body.pipeThrough(P);
|
|
1146
1146
|
return new Response(G, { status: f.status, statusText: f.statusText, headers: f.headers });
|
|
@@ -1164,7 +1164,7 @@ var Be = class s {
|
|
|
1164
1164
|
}
|
|
1165
1165
|
}
|
|
1166
1166
|
static normalizeRetryOptions(e) {
|
|
1167
|
-
return e === void 0 ? { limit: 0, statusCodes: [], methods: [], delay:
|
|
1167
|
+
return e === void 0 ? { limit: 0, statusCodes: [], methods: [], delay: N, backoffFactor: D } : typeof e == "number" ? { limit: e, statusCodes: [...W], methods: [...z], delay: N, backoffFactor: D } : { limit: e.limit ?? 0, statusCodes: e.statusCodes ?? [...W], methods: e.methods ?? [...z], delay: e.delay ?? N, backoffFactor: e.backoffFactor ?? D };
|
|
1168
1168
|
}
|
|
1169
1169
|
static retryDelay(e, t) {
|
|
1170
1170
|
let n = typeof e.delay == "function" ? e.delay(t) : e.delay * e.backoffFactor ** (t - 1);
|
|
@@ -1236,7 +1236,7 @@ var Be = class s {
|
|
|
1236
1236
|
let { cookieName: u, headerName: c } = typeof p == "object" ? p : {}, S2 = He(u ?? ce);
|
|
1237
1237
|
S2 && d.headers.set(c ?? pe2, S2);
|
|
1238
1238
|
}
|
|
1239
|
-
let l = new
|
|
1239
|
+
let l = new _({ signal: R2, timeout: g }).onAbort((u) => this.publish({ name: b2.ABORTED, event: u, global: h2 })).onTimeout((u) => this.publish({ name: b2.TIMEOUT, event: u, global: h2 }));
|
|
1240
1240
|
return d.signal = l.signal, this.publish({ name: b2.CONFIGURED, data: d, global: h2 }), { signalController: l, requestOptions: d, global: h2 };
|
|
1241
1241
|
}
|
|
1242
1242
|
static getBaseUrl(e) {
|