@coveo/atomic-react 3.11.18 → 3.11.19
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/cjs/atomic-react.cjs +589 -318
- package/dist/cjs/atomic-react.cjs.map +1 -1
- package/dist/cjs/commerce/atomic-react.cjs +211 -70
- package/dist/cjs/commerce/atomic-react.cjs.map +1 -1
- package/dist/cjs/recommendation/atomic-react.cjs +589 -318
- package/dist/cjs/recommendation/atomic-react.cjs.map +1 -1
- package/package.json +3 -3
|
@@ -465,7 +465,7 @@ const renderBreadcrumbContainer = ({ props })=>(children)=>{
|
|
|
465
465
|
</div>`;
|
|
466
466
|
};
|
|
467
467
|
|
|
468
|
-
/*! @license DOMPurify 3.4.
|
|
468
|
+
/*! @license DOMPurify 3.4.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.1/LICENSE */
|
|
469
469
|
|
|
470
470
|
const {
|
|
471
471
|
entries,
|
|
@@ -514,13 +514,19 @@ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
|
514
514
|
const arrayPop = unapply(Array.prototype.pop);
|
|
515
515
|
const arrayPush = unapply(Array.prototype.push);
|
|
516
516
|
const arraySplice = unapply(Array.prototype.splice);
|
|
517
|
+
const arrayIsArray = Array.isArray;
|
|
517
518
|
const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
518
519
|
const stringToString = unapply(String.prototype.toString);
|
|
519
520
|
const stringMatch = unapply(String.prototype.match);
|
|
520
521
|
const stringReplace = unapply(String.prototype.replace);
|
|
521
522
|
const stringIndexOf = unapply(String.prototype.indexOf);
|
|
522
523
|
const stringTrim = unapply(String.prototype.trim);
|
|
524
|
+
const numberToString = unapply(Number.prototype.toString);
|
|
525
|
+
const booleanToString = unapply(Boolean.prototype.toString);
|
|
526
|
+
const bigintToString = typeof BigInt === 'undefined' ? null : unapply(BigInt.prototype.toString);
|
|
527
|
+
const symbolToString = typeof Symbol === 'undefined' ? null : unapply(Symbol.prototype.toString);
|
|
523
528
|
const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
|
529
|
+
const objectToString$1 = unapply(Object.prototype.toString);
|
|
524
530
|
const regExpTest = unapply(RegExp.prototype.test);
|
|
525
531
|
const typeErrorCreate = unconstruct(TypeError);
|
|
526
532
|
/**
|
|
@@ -570,6 +576,9 @@ function addToSet(set, array) {
|
|
|
570
576
|
// Prevent prototype setters from intercepting set as a this value.
|
|
571
577
|
setPrototypeOf(set, null);
|
|
572
578
|
}
|
|
579
|
+
if (!arrayIsArray(array)) {
|
|
580
|
+
return set;
|
|
581
|
+
}
|
|
573
582
|
let l = array.length;
|
|
574
583
|
while (l--) {
|
|
575
584
|
let element = array[l];
|
|
@@ -613,7 +622,7 @@ function clone$1(object) {
|
|
|
613
622
|
for (const [property, value] of entries(object)) {
|
|
614
623
|
const isPropertyExist = objectHasOwnProperty(object, property);
|
|
615
624
|
if (isPropertyExist) {
|
|
616
|
-
if (
|
|
625
|
+
if (arrayIsArray(value)) {
|
|
617
626
|
newObject[property] = cleanArray(value);
|
|
618
627
|
} else if (value && typeof value === 'object' && value.constructor === Object) {
|
|
619
628
|
newObject[property] = clone$1(value);
|
|
@@ -624,6 +633,58 @@ function clone$1(object) {
|
|
|
624
633
|
}
|
|
625
634
|
return newObject;
|
|
626
635
|
}
|
|
636
|
+
/**
|
|
637
|
+
* Convert non-node values into strings without depending on direct property access.
|
|
638
|
+
*
|
|
639
|
+
* @param value - The value to stringify.
|
|
640
|
+
* @returns A string representation of the provided value.
|
|
641
|
+
*/
|
|
642
|
+
function stringifyValue(value) {
|
|
643
|
+
switch (typeof value) {
|
|
644
|
+
case 'string':
|
|
645
|
+
{
|
|
646
|
+
return value;
|
|
647
|
+
}
|
|
648
|
+
case 'number':
|
|
649
|
+
{
|
|
650
|
+
return numberToString(value);
|
|
651
|
+
}
|
|
652
|
+
case 'boolean':
|
|
653
|
+
{
|
|
654
|
+
return booleanToString(value);
|
|
655
|
+
}
|
|
656
|
+
case 'bigint':
|
|
657
|
+
{
|
|
658
|
+
return bigintToString ? bigintToString(value) : '0';
|
|
659
|
+
}
|
|
660
|
+
case 'symbol':
|
|
661
|
+
{
|
|
662
|
+
return symbolToString ? symbolToString(value) : 'Symbol()';
|
|
663
|
+
}
|
|
664
|
+
case 'undefined':
|
|
665
|
+
{
|
|
666
|
+
return objectToString$1(value);
|
|
667
|
+
}
|
|
668
|
+
case 'function':
|
|
669
|
+
case 'object':
|
|
670
|
+
{
|
|
671
|
+
if (value === null) {
|
|
672
|
+
return objectToString$1(value);
|
|
673
|
+
}
|
|
674
|
+
const valueAsRecord = value;
|
|
675
|
+
const valueToString = lookupGetter(valueAsRecord, 'toString');
|
|
676
|
+
if (typeof valueToString === 'function') {
|
|
677
|
+
const stringified = valueToString(valueAsRecord);
|
|
678
|
+
return typeof stringified === 'string' ? stringified : objectToString$1(stringified);
|
|
679
|
+
}
|
|
680
|
+
return objectToString$1(value);
|
|
681
|
+
}
|
|
682
|
+
default:
|
|
683
|
+
{
|
|
684
|
+
return objectToString$1(value);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
627
688
|
/**
|
|
628
689
|
* This method automatically checks if the prop is function or getter and behaves accordingly.
|
|
629
690
|
*
|
|
@@ -649,6 +710,14 @@ function lookupGetter(object, prop) {
|
|
|
649
710
|
}
|
|
650
711
|
return fallbackValue;
|
|
651
712
|
}
|
|
713
|
+
function isRegex(value) {
|
|
714
|
+
try {
|
|
715
|
+
regExpTest(value, '');
|
|
716
|
+
return true;
|
|
717
|
+
} catch (_unused) {
|
|
718
|
+
return false;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
652
721
|
|
|
653
722
|
const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
|
|
654
723
|
const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
@@ -664,7 +733,7 @@ const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mgly
|
|
|
664
733
|
const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
|
|
665
734
|
const text = freeze(['#text']);
|
|
666
735
|
|
|
667
|
-
const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns'
|
|
736
|
+
const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns']);
|
|
668
737
|
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
669
738
|
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnalign', 'columnlines', 'columnspacing', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lquote', 'lspace', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
|
670
739
|
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
@@ -684,17 +753,17 @@ const DOCTYPE_NAME = seal(/^html$/i);
|
|
|
684
753
|
const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
685
754
|
|
|
686
755
|
var EXPRESSIONS = /*#__PURE__*/Object.freeze({
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
756
|
+
__proto__: null,
|
|
757
|
+
ARIA_ATTR: ARIA_ATTR,
|
|
758
|
+
ATTR_WHITESPACE: ATTR_WHITESPACE,
|
|
759
|
+
CUSTOM_ELEMENT: CUSTOM_ELEMENT,
|
|
760
|
+
DATA_ATTR: DATA_ATTR,
|
|
761
|
+
DOCTYPE_NAME: DOCTYPE_NAME,
|
|
762
|
+
ERB_EXPR: ERB_EXPR,
|
|
763
|
+
IS_ALLOWED_URI: IS_ALLOWED_URI,
|
|
764
|
+
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
|
|
765
|
+
MUSTACHE_EXPR: MUSTACHE_EXPR,
|
|
766
|
+
TMPLIT_EXPR: TMPLIT_EXPR
|
|
698
767
|
});
|
|
699
768
|
|
|
700
769
|
/* eslint-disable @typescript-eslint/indent */
|
|
@@ -763,7 +832,7 @@ const _createHooksMap = function _createHooksMap() {
|
|
|
763
832
|
function createDOMPurify() {
|
|
764
833
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
765
834
|
const DOMPurify = root => createDOMPurify(root);
|
|
766
|
-
DOMPurify.version = '3.4.
|
|
835
|
+
DOMPurify.version = '3.4.1';
|
|
767
836
|
DOMPurify.removed = [];
|
|
768
837
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
769
838
|
// Not running in a browser, provide a factory function
|
|
@@ -1011,15 +1080,15 @@ function createDOMPurify() {
|
|
|
1011
1080
|
// HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
1012
1081
|
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
|
|
1013
1082
|
/* Set configuration parameters */
|
|
1014
|
-
ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
1015
|
-
ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
1016
|
-
ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
|
1017
|
-
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone$1(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
1018
|
-
DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone$1(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
|
1019
|
-
FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
1020
|
-
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone$1({});
|
|
1021
|
-
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone$1({});
|
|
1022
|
-
USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
|
|
1083
|
+
ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
1084
|
+
ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
1085
|
+
ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
|
1086
|
+
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone$1(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
1087
|
+
DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone$1(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
|
1088
|
+
FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
1089
|
+
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone$1({});
|
|
1090
|
+
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone$1({});
|
|
1091
|
+
USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === 'object' ? clone$1(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
|
|
1023
1092
|
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
1024
1093
|
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
|
1025
1094
|
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
|
|
@@ -1035,19 +1104,20 @@ function createDOMPurify() {
|
|
|
1035
1104
|
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
|
|
1036
1105
|
KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
|
|
1037
1106
|
IN_PLACE = cfg.IN_PLACE || false; // Default false
|
|
1038
|
-
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP
|
|
1039
|
-
NAMESPACE = cfg.NAMESPACE
|
|
1040
|
-
MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS
|
|
1041
|
-
HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1107
|
+
IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI; // Default regexp
|
|
1108
|
+
NAMESPACE = typeof cfg.NAMESPACE === 'string' ? cfg.NAMESPACE : HTML_NAMESPACE; // Default HTML namespace
|
|
1109
|
+
MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, 'MATHML_TEXT_INTEGRATION_POINTS') && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === 'object' ? clone$1(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']); // Default built-in map
|
|
1110
|
+
HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, 'HTML_INTEGRATION_POINTS') && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === 'object' ? clone$1(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ['annotation-xml']); // Default built-in map
|
|
1111
|
+
const customElementHandling = objectHasOwnProperty(cfg, 'CUSTOM_ELEMENT_HANDLING') && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === 'object' ? clone$1(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
|
|
1112
|
+
CUSTOM_ELEMENT_HANDLING = create(null);
|
|
1113
|
+
if (objectHasOwnProperty(customElementHandling, 'tagNameCheck') && isRegexOrFunction(customElementHandling.tagNameCheck)) {
|
|
1114
|
+
CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck; // Default undefined
|
|
1045
1115
|
}
|
|
1046
|
-
if (
|
|
1047
|
-
CUSTOM_ELEMENT_HANDLING.attributeNameCheck =
|
|
1116
|
+
if (objectHasOwnProperty(customElementHandling, 'attributeNameCheck') && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
|
|
1117
|
+
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck; // Default undefined
|
|
1048
1118
|
}
|
|
1049
|
-
if (
|
|
1050
|
-
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements =
|
|
1119
|
+
if (objectHasOwnProperty(customElementHandling, 'allowCustomizedBuiltInElements') && typeof customElementHandling.allowCustomizedBuiltInElements === 'boolean') {
|
|
1120
|
+
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements; // Default undefined
|
|
1051
1121
|
}
|
|
1052
1122
|
if (SAFE_FOR_TEMPLATES) {
|
|
1053
1123
|
ALLOW_DATA_ATTR = false;
|
|
@@ -1084,36 +1154,36 @@ function createDOMPurify() {
|
|
|
1084
1154
|
EXTRA_ELEMENT_HANDLING.tagCheck = null;
|
|
1085
1155
|
EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
1086
1156
|
/* Merge configuration parameters */
|
|
1087
|
-
if (cfg
|
|
1157
|
+
if (objectHasOwnProperty(cfg, 'ADD_TAGS')) {
|
|
1088
1158
|
if (typeof cfg.ADD_TAGS === 'function') {
|
|
1089
1159
|
EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
|
|
1090
|
-
} else {
|
|
1160
|
+
} else if (arrayIsArray(cfg.ADD_TAGS)) {
|
|
1091
1161
|
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
1092
1162
|
ALLOWED_TAGS = clone$1(ALLOWED_TAGS);
|
|
1093
1163
|
}
|
|
1094
1164
|
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
1095
1165
|
}
|
|
1096
1166
|
}
|
|
1097
|
-
if (cfg
|
|
1167
|
+
if (objectHasOwnProperty(cfg, 'ADD_ATTR')) {
|
|
1098
1168
|
if (typeof cfg.ADD_ATTR === 'function') {
|
|
1099
1169
|
EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
|
|
1100
|
-
} else {
|
|
1170
|
+
} else if (arrayIsArray(cfg.ADD_ATTR)) {
|
|
1101
1171
|
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
1102
1172
|
ALLOWED_ATTR = clone$1(ALLOWED_ATTR);
|
|
1103
1173
|
}
|
|
1104
1174
|
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
1105
1175
|
}
|
|
1106
1176
|
}
|
|
1107
|
-
if (cfg.ADD_URI_SAFE_ATTR) {
|
|
1177
|
+
if (objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
|
|
1108
1178
|
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
1109
1179
|
}
|
|
1110
|
-
if (cfg.FORBID_CONTENTS) {
|
|
1180
|
+
if (objectHasOwnProperty(cfg, 'FORBID_CONTENTS') && arrayIsArray(cfg.FORBID_CONTENTS)) {
|
|
1111
1181
|
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
1112
1182
|
FORBID_CONTENTS = clone$1(FORBID_CONTENTS);
|
|
1113
1183
|
}
|
|
1114
1184
|
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
1115
1185
|
}
|
|
1116
|
-
if (cfg.ADD_FORBID_CONTENTS) {
|
|
1186
|
+
if (objectHasOwnProperty(cfg, 'ADD_FORBID_CONTENTS') && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
|
|
1117
1187
|
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
1118
1188
|
FORBID_CONTENTS = clone$1(FORBID_CONTENTS);
|
|
1119
1189
|
}
|
|
@@ -1439,7 +1509,6 @@ function createDOMPurify() {
|
|
|
1439
1509
|
const childCount = childNodes.length;
|
|
1440
1510
|
for (let i = childCount - 1; i >= 0; --i) {
|
|
1441
1511
|
const childClone = cloneNode(childNodes[i], true);
|
|
1442
|
-
childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
|
|
1443
1512
|
parentNode.insertBefore(childClone, getNextSibling(currentNode));
|
|
1444
1513
|
}
|
|
1445
1514
|
}
|
|
@@ -1514,6 +1583,10 @@ function createDOMPurify() {
|
|
|
1514
1583
|
} else ;
|
|
1515
1584
|
return true;
|
|
1516
1585
|
};
|
|
1586
|
+
/* Names the HTML spec reserves from valid-custom-element-name; these must
|
|
1587
|
+
* never be treated as basic custom elements even when a permissive
|
|
1588
|
+
* CUSTOM_ELEMENT_HANDLING.tagNameCheck is configured. */
|
|
1589
|
+
const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, ['annotation-xml', 'color-profile', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'missing-glyph']);
|
|
1517
1590
|
/**
|
|
1518
1591
|
* _isBasicCustomElement
|
|
1519
1592
|
* checks if at least one dash is included in tagName, and it's not the first char
|
|
@@ -1523,7 +1596,7 @@ function createDOMPurify() {
|
|
|
1523
1596
|
* @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
|
|
1524
1597
|
*/
|
|
1525
1598
|
const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
|
|
1526
|
-
return tagName
|
|
1599
|
+
return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT, tagName);
|
|
1527
1600
|
};
|
|
1528
1601
|
/**
|
|
1529
1602
|
* _sanitizeAttributes
|
|
@@ -1574,12 +1647,14 @@ function createDOMPurify() {
|
|
|
1574
1647
|
/* Full DOM Clobbering protection via namespace isolation,
|
|
1575
1648
|
* Prefix id and name attributes with `user-content-`
|
|
1576
1649
|
*/
|
|
1577
|
-
if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
|
|
1650
|
+
if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name') && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
|
|
1578
1651
|
// Remove the attribute with this value
|
|
1579
1652
|
_removeAttribute(name, currentNode);
|
|
1580
1653
|
// Prefix the value and later re-create the attribute with the sanitized value
|
|
1581
1654
|
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
1582
1655
|
}
|
|
1656
|
+
// Else: already prefixed, leave the attribute alone — the prefix is
|
|
1657
|
+
// itself the clobbering protection, and re-applying it is incorrect.
|
|
1583
1658
|
/* Work around a security issue with comments inside attributes */
|
|
1584
1659
|
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
|
|
1585
1660
|
_removeAttribute(name, currentNode);
|
|
@@ -1696,13 +1771,9 @@ function createDOMPurify() {
|
|
|
1696
1771
|
}
|
|
1697
1772
|
/* Stringify, in case dirty is an object */
|
|
1698
1773
|
if (typeof dirty !== 'string' && !_isNode(dirty)) {
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
throw typeErrorCreate('dirty is not a string, aborting');
|
|
1703
|
-
}
|
|
1704
|
-
} else {
|
|
1705
|
-
throw typeErrorCreate('toString is not a function');
|
|
1774
|
+
dirty = stringifyValue(dirty);
|
|
1775
|
+
if (typeof dirty !== 'string') {
|
|
1776
|
+
throw typeErrorCreate('dirty is not a string, aborting');
|
|
1706
1777
|
}
|
|
1707
1778
|
}
|
|
1708
1779
|
/* Return dirty HTML if DOMPurify cannot run */
|
|
@@ -1721,8 +1792,9 @@ function createDOMPurify() {
|
|
|
1721
1792
|
}
|
|
1722
1793
|
if (IN_PLACE) {
|
|
1723
1794
|
/* Do some early pre-sanitization to avoid unsafe root nodes */
|
|
1724
|
-
|
|
1725
|
-
|
|
1795
|
+
const nn = dirty.nodeName;
|
|
1796
|
+
if (typeof nn === 'string') {
|
|
1797
|
+
const tagName = transformCaseFunc(nn);
|
|
1726
1798
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
1727
1799
|
throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
|
|
1728
1800
|
}
|
|
@@ -2044,6 +2116,7 @@ const ATOMIC_CUSTOM_ELEMENT_TAGS = new Set([
|
|
|
2044
2116
|
'atomic-generated-answer',
|
|
2045
2117
|
'atomic-generated-answer-content',
|
|
2046
2118
|
'atomic-generated-answer-feedback-modal',
|
|
2119
|
+
'atomic-generated-answer-inline-link',
|
|
2047
2120
|
'atomic-generated-answer-thread',
|
|
2048
2121
|
'atomic-generated-answer-thread-item',
|
|
2049
2122
|
'atomic-html',
|
|
@@ -8478,7 +8551,7 @@ function getWindow() {
|
|
|
8478
8551
|
}
|
|
8479
8552
|
function getAtomicEnvironment(headlessVersion) {
|
|
8480
8553
|
return {
|
|
8481
|
-
version: "3.57.
|
|
8554
|
+
version: "3.57.2",
|
|
8482
8555
|
headlessVersion
|
|
8483
8556
|
};
|
|
8484
8557
|
}
|
|
@@ -8499,7 +8572,39 @@ function augmentAnalyticsConfigWithAtomicVersion() {
|
|
|
8499
8572
|
};
|
|
8500
8573
|
}
|
|
8501
8574
|
|
|
8575
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
8576
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
8577
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8502
8578
|
function _typeof$2(o) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$2(o); }
|
|
8579
|
+
var UNSAFE_KEYS$1 = ['__proto__', 'constructor', 'prototype'];
|
|
8580
|
+
function isSafeUrlSegment(v) {
|
|
8581
|
+
if (typeof v !== 'string') return false;
|
|
8582
|
+
if (v.length === 0 || v.length > 128) return false;
|
|
8583
|
+
if (UNSAFE_KEYS$1.indexOf(v) > -1) return false;
|
|
8584
|
+
if (v.indexOf('..') > -1) return false;
|
|
8585
|
+
if (v.indexOf('/') > -1 || v.indexOf('\\') > -1) return false;
|
|
8586
|
+
if (/[?#%\s@]/.test(v)) return false;
|
|
8587
|
+
if (/[\x00-\x1F\x7F]/.test(v)) return false;
|
|
8588
|
+
return true;
|
|
8589
|
+
}
|
|
8590
|
+
function sanitizeLogValue(v) {
|
|
8591
|
+
if (typeof v !== 'string') return v;
|
|
8592
|
+
return v.replace(/[\r\n\x00-\x1F\x7F]/g, ' ');
|
|
8593
|
+
}
|
|
8594
|
+
function redactUrlCredentials(u) {
|
|
8595
|
+
if (typeof u !== 'string' || u.length === 0) return u;
|
|
8596
|
+
try {
|
|
8597
|
+
var parsed = new URL(u);
|
|
8598
|
+
if (parsed.username || parsed.password) {
|
|
8599
|
+
parsed.username = '';
|
|
8600
|
+
parsed.password = '';
|
|
8601
|
+
return parsed.toString();
|
|
8602
|
+
}
|
|
8603
|
+
return u;
|
|
8604
|
+
} catch (e) {
|
|
8605
|
+
return u.replace(/(\/\/)[^/@\s]+@/g, '$1');
|
|
8606
|
+
}
|
|
8607
|
+
}
|
|
8503
8608
|
function hasXMLHttpRequest() {
|
|
8504
8609
|
return typeof XMLHttpRequest === 'function' || (typeof XMLHttpRequest === "undefined" ? "undefined" : _typeof$2(XMLHttpRequest)) === 'object';
|
|
8505
8610
|
}
|
|
@@ -8513,11 +8618,32 @@ function makePromise(maybePromise) {
|
|
|
8513
8618
|
return Promise.resolve(maybePromise);
|
|
8514
8619
|
}
|
|
8515
8620
|
var interpolationRegexp = /\{\{(.+?)\}\}/g;
|
|
8516
|
-
function
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8621
|
+
function interpolateUrl(str, data) {
|
|
8622
|
+
var unsafe = false;
|
|
8623
|
+
var result = str.replace(interpolationRegexp, function (match, key) {
|
|
8624
|
+
var k = key.trim();
|
|
8625
|
+
if (UNSAFE_KEYS$1.indexOf(k) > -1) return match;
|
|
8626
|
+
var value = data[k];
|
|
8627
|
+
if (value == null) return match;
|
|
8628
|
+
var segments = String(value).split('+');
|
|
8629
|
+
var _iterator = _createForOfIteratorHelper(segments),
|
|
8630
|
+
_step;
|
|
8631
|
+
try {
|
|
8632
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
8633
|
+
var seg = _step.value;
|
|
8634
|
+
if (!isSafeUrlSegment(seg)) {
|
|
8635
|
+
unsafe = true;
|
|
8636
|
+
return match;
|
|
8637
|
+
}
|
|
8638
|
+
}
|
|
8639
|
+
} catch (err) {
|
|
8640
|
+
_iterator.e(err);
|
|
8641
|
+
} finally {
|
|
8642
|
+
_iterator.f();
|
|
8643
|
+
}
|
|
8644
|
+
return segments.join('+');
|
|
8520
8645
|
});
|
|
8646
|
+
return unsafe ? null : result;
|
|
8521
8647
|
}
|
|
8522
8648
|
|
|
8523
8649
|
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -8556,10 +8682,13 @@ if (!fetchApi && !XmlHttpRequestApi && !ActiveXObjectApi) {
|
|
|
8556
8682
|
}).catch(function () {});
|
|
8557
8683
|
} catch (e) {}
|
|
8558
8684
|
}
|
|
8685
|
+
var UNSAFE_KEYS = ['__proto__', 'constructor', 'prototype'];
|
|
8559
8686
|
var addQueryString = function addQueryString(url, params) {
|
|
8560
8687
|
if (params && _typeof$1(params) === 'object') {
|
|
8561
8688
|
var queryString = '';
|
|
8562
|
-
for (var
|
|
8689
|
+
for (var _i = 0, _Object$keys = Object.keys(params); _i < _Object$keys.length; _i++) {
|
|
8690
|
+
var paramName = _Object$keys[_i];
|
|
8691
|
+
if (UNSAFE_KEYS.indexOf(paramName) > -1) continue;
|
|
8563
8692
|
queryString += '&' + encodeURIComponent(paramName) + '=' + encodeURIComponent(params[paramName]);
|
|
8564
8693
|
}
|
|
8565
8694
|
if (!queryString) return url;
|
|
@@ -8592,7 +8721,6 @@ var fetchIt = function fetchIt(url, fetchOptions, callback, altFetch) {
|
|
|
8592
8721
|
fetchApi(url, fetchOptions).then(resolver).catch(callback);
|
|
8593
8722
|
}
|
|
8594
8723
|
};
|
|
8595
|
-
var omitFetchOptions = false;
|
|
8596
8724
|
var requestWithFetch = function requestWithFetch(options, url, payload, callback) {
|
|
8597
8725
|
if (options.queryStringParams) {
|
|
8598
8726
|
url = addQueryString(url, options.queryStringParams);
|
|
@@ -8607,7 +8735,7 @@ var requestWithFetch = function requestWithFetch(options, url, payload, callback
|
|
|
8607
8735
|
method: payload ? 'POST' : 'GET',
|
|
8608
8736
|
body: payload ? options.stringify(payload) : undefined,
|
|
8609
8737
|
headers: headers
|
|
8610
|
-
},
|
|
8738
|
+
}, options._omitFetchOptions ? {} : reqOptions);
|
|
8611
8739
|
var altFetch = typeof options.alternateFetch === 'function' && options.alternateFetch.length >= 1 ? options.alternateFetch : undefined;
|
|
8612
8740
|
try {
|
|
8613
8741
|
fetchIt(url, fetchOptions, callback, altFetch);
|
|
@@ -8620,7 +8748,7 @@ var requestWithFetch = function requestWithFetch(options, url, payload, callback
|
|
|
8620
8748
|
delete fetchOptions[opt];
|
|
8621
8749
|
});
|
|
8622
8750
|
fetchIt(url, fetchOptions, callback, altFetch);
|
|
8623
|
-
|
|
8751
|
+
options._omitFetchOptions = true;
|
|
8624
8752
|
} catch (err) {
|
|
8625
8753
|
callback(err);
|
|
8626
8754
|
}
|
|
@@ -8649,7 +8777,9 @@ var requestWithXmlHttpRequest = function requestWithXmlHttpRequest(options, url,
|
|
|
8649
8777
|
var h = options.customHeaders;
|
|
8650
8778
|
h = typeof h === 'function' ? h() : h;
|
|
8651
8779
|
if (h) {
|
|
8652
|
-
for (var
|
|
8780
|
+
for (var _i2 = 0, _Object$keys2 = Object.keys(h); _i2 < _Object$keys2.length; _i2++) {
|
|
8781
|
+
var i = _Object$keys2[_i2];
|
|
8782
|
+
if (UNSAFE_KEYS.indexOf(i) > -1) continue;
|
|
8653
8783
|
x.setRequestHeader(i, h[i]);
|
|
8654
8784
|
}
|
|
8655
8785
|
}
|
|
@@ -8764,10 +8894,15 @@ var Backend = function () {
|
|
|
8764
8894
|
loadPath = makePromise(loadPath);
|
|
8765
8895
|
loadPath.then(function (resolvedLoadPath) {
|
|
8766
8896
|
if (!resolvedLoadPath) return callback(null, {});
|
|
8767
|
-
var url =
|
|
8897
|
+
var url = interpolateUrl(resolvedLoadPath, {
|
|
8768
8898
|
lng: languages.join('+'),
|
|
8769
8899
|
ns: namespaces.join('+')
|
|
8770
8900
|
});
|
|
8901
|
+
if (url == null) {
|
|
8902
|
+
var safeLngs = languages.map(sanitizeLogValue).join(', ');
|
|
8903
|
+
var safeNss = namespaces.map(sanitizeLogValue).join(', ');
|
|
8904
|
+
return callback(new Error('i18next-http-backend: unsafe lng/ns value — refusing to build request URL for languages=[' + safeLngs + '] namespaces=[' + safeNss + ']'), false);
|
|
8905
|
+
}
|
|
8771
8906
|
_this2.loadUrl(url, callback, loadUrlLanguages, loadUrlNamespaces);
|
|
8772
8907
|
});
|
|
8773
8908
|
}
|
|
@@ -8778,16 +8913,17 @@ var Backend = function () {
|
|
|
8778
8913
|
var lng = typeof languages === 'string' ? [languages] : languages;
|
|
8779
8914
|
var ns = typeof namespaces === 'string' ? [namespaces] : namespaces;
|
|
8780
8915
|
var payload = this.options.parseLoadPayload(lng, ns);
|
|
8916
|
+
var safeUrl = sanitizeLogValue(redactUrlCredentials(url));
|
|
8781
8917
|
this.options.request(this.options, url, payload, function (err, res) {
|
|
8782
|
-
if (res && (res.status >= 500 && res.status < 600 || !res.status)) return callback('failed loading ' +
|
|
8783
|
-
if (res && res.status >= 400 && res.status < 500) return callback('failed loading ' +
|
|
8918
|
+
if (res && (res.status >= 500 && res.status < 600 || !res.status)) return callback('failed loading ' + safeUrl + '; status code: ' + res.status, true);
|
|
8919
|
+
if (res && res.status >= 400 && res.status < 500) return callback('failed loading ' + safeUrl + '; status code: ' + res.status, false);
|
|
8784
8920
|
if (!res && err && err.message) {
|
|
8785
8921
|
var errorMessage = err.message.toLowerCase();
|
|
8786
8922
|
var isNetworkError = ['failed', 'fetch', 'network', 'load'].find(function (term) {
|
|
8787
8923
|
return errorMessage.indexOf(term) > -1;
|
|
8788
8924
|
});
|
|
8789
8925
|
if (isNetworkError) {
|
|
8790
|
-
return callback('failed loading ' +
|
|
8926
|
+
return callback('failed loading ' + safeUrl + ': ' + sanitizeLogValue(err.message), true);
|
|
8791
8927
|
}
|
|
8792
8928
|
}
|
|
8793
8929
|
if (err) return callback(err, false);
|
|
@@ -8799,7 +8935,7 @@ var Backend = function () {
|
|
|
8799
8935
|
ret = res.data;
|
|
8800
8936
|
}
|
|
8801
8937
|
} catch (e) {
|
|
8802
|
-
parseErr = 'failed parsing ' +
|
|
8938
|
+
parseErr = 'failed parsing ' + safeUrl + ' to json';
|
|
8803
8939
|
}
|
|
8804
8940
|
if (parseErr) return callback(parseErr, false);
|
|
8805
8941
|
callback(null, ret);
|
|
@@ -8820,10 +8956,15 @@ var Backend = function () {
|
|
|
8820
8956
|
if (typeof _this4.options.addPath === 'function') {
|
|
8821
8957
|
addPath = _this4.options.addPath(lng, namespace);
|
|
8822
8958
|
}
|
|
8823
|
-
var url =
|
|
8959
|
+
var url = interpolateUrl(addPath, {
|
|
8824
8960
|
lng: lng,
|
|
8825
8961
|
ns: namespace
|
|
8826
8962
|
});
|
|
8963
|
+
if (url == null) {
|
|
8964
|
+
finished += 1;
|
|
8965
|
+
if (callback && finished === languages.length) callback(dataArray, resArray);
|
|
8966
|
+
return;
|
|
8967
|
+
}
|
|
8827
8968
|
_this4.options.request(_this4.options, url, payload, function (data, res) {
|
|
8828
8969
|
finished += 1;
|
|
8829
8970
|
dataArray.push(data);
|