@knime/product-features 1.2.3 → 1.2.4

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/_plugin-vue_export-helper-BOaGB7Aw.js +8 -0
  3. package/dist/ai.js +180 -191
  4. package/dist/ai.js.map +1 -1
  5. package/dist/dataTransfer.js +1158 -1104
  6. package/dist/dataTransfer.js.map +1 -1
  7. package/dist/dist-BrNh9vG-.js +2560 -0
  8. package/dist/dist-BrNh9vG-.js.map +1 -0
  9. package/dist/nodes.css +22 -19
  10. package/dist/nodes.js +656 -613
  11. package/dist/nodes.js.map +1 -1
  12. package/dist/rfcErrors-Dw7NLSDp.js +172 -0
  13. package/dist/rfcErrors-Dw7NLSDp.js.map +1 -0
  14. package/dist/rfcErrors.js +1 -222
  15. package/dist/src/ai/KdsPromptInput/InlineStatusBanner.vue.d.ts +3 -2
  16. package/dist/src/ai/KdsPromptInput/InlineStatusBanner.vue.d.ts.map +1 -1
  17. package/dist/src/ai/KdsPromptInput/KdsPromptInput.vue.d.ts +6 -6
  18. package/dist/src/ai/KdsPromptInput/KdsPromptInput.vue.d.ts.map +1 -1
  19. package/dist/src/dataTransfer/download/ui/DownloadProgressPanel.vue.d.ts +6 -4
  20. package/dist/src/dataTransfer/download/ui/DownloadProgressPanel.vue.d.ts.map +1 -1
  21. package/dist/src/dataTransfer/download/ui/DownloadProgressPanelItem.vue.d.ts +3 -2
  22. package/dist/src/dataTransfer/download/ui/DownloadProgressPanelItem.vue.d.ts.map +1 -1
  23. package/dist/src/dataTransfer/shared/ui/CollapsiblePanel/CollapsiblePanel.vue.d.ts +11 -14
  24. package/dist/src/dataTransfer/shared/ui/CollapsiblePanel/CollapsiblePanel.vue.d.ts.map +1 -1
  25. package/dist/src/dataTransfer/shared/ui/ProgressItem/ProgressItem.vue.d.ts +2 -1
  26. package/dist/src/dataTransfer/shared/ui/ProgressItem/ProgressItem.vue.d.ts.map +1 -1
  27. package/dist/src/dataTransfer/shared/ui/ProgressList/ProgressList.vue.d.ts +7 -11
  28. package/dist/src/dataTransfer/shared/ui/ProgressList/ProgressList.vue.d.ts.map +1 -1
  29. package/dist/src/dataTransfer/upload/ui/UploadProgressPanel.vue.d.ts +6 -4
  30. package/dist/src/dataTransfer/upload/ui/UploadProgressPanel.vue.d.ts.map +1 -1
  31. package/dist/src/dataTransfer/upload/ui/UploadProgressPanelItem.vue.d.ts +3 -2
  32. package/dist/src/dataTransfer/upload/ui/UploadProgressPanelItem.vue.d.ts.map +1 -1
  33. package/dist/src/nodes/NodeDescriptionTabs/NodeDescriptionTabs.vue.d.ts +2 -1
  34. package/dist/src/nodes/NodeDescriptionTabs/NodeDescriptionTabs.vue.d.ts.map +1 -1
  35. package/dist/src/nodes/NodeDescriptionTabs/OptionsTab.vue.d.ts +2 -1
  36. package/dist/src/nodes/NodeDescriptionTabs/OptionsTab.vue.d.ts.map +1 -1
  37. package/dist/src/nodes/NodeDescriptionTabs/PortGroup.vue.d.ts +2 -1
  38. package/dist/src/nodes/NodeDescriptionTabs/PortGroup.vue.d.ts.map +1 -1
  39. package/dist/src/nodes/NodeDescriptionTabs/PortTemplateInfo.vue.d.ts +2 -1
  40. package/dist/src/nodes/NodeDescriptionTabs/PortTemplateInfo.vue.d.ts.map +1 -1
  41. package/dist/src/nodes/NodeDescriptionTabs/PortsTab.vue.d.ts +2 -1
  42. package/dist/src/nodes/NodeDescriptionTabs/PortsTab.vue.d.ts.map +1 -1
  43. package/dist/src/nodes/NodeDescriptionTabs/ViewsTab.vue.d.ts +2 -1
  44. package/dist/src/nodes/NodeDescriptionTabs/ViewsTab.vue.d.ts.map +1 -1
  45. package/dist/src/nodes/NodePreview/NodePreview.vue.d.ts +2 -1
  46. package/dist/src/nodes/NodePreview/NodePreview.vue.d.ts.map +1 -1
  47. package/dist/src/nodes/NodePreview/SVGNodeTorso.vue.d.ts +2 -1
  48. package/dist/src/nodes/NodePreview/SVGNodeTorso.vue.d.ts.map +1 -1
  49. package/dist/src/nodes/NodePreview/enums.d.ts +2 -1
  50. package/dist/src/nodes/NodePreview/enums.d.ts.map +1 -1
  51. package/dist/src/nodes/NodePreview/types.d.ts +1 -1
  52. package/dist/src/nodes/NodePreview/types.d.ts.map +1 -1
  53. package/dist/src/nodes/PortIcon/PortIcon.vue.d.ts +2 -1
  54. package/dist/src/nodes/PortIcon/PortIcon.vue.d.ts.map +1 -1
  55. package/dist/src/nodes/PortIcon/SVGPortIcon.vue.d.ts +2 -1
  56. package/dist/src/nodes/PortIcon/SVGPortIcon.vue.d.ts.map +1 -1
  57. package/dist/src/rfcErrors/RFCErrorToastTemplate.vue.d.ts +3 -2
  58. package/dist/src/rfcErrors/RFCErrorToastTemplate.vue.d.ts.map +1 -1
  59. package/dist/src/toasts/Toast/Toast.vue.d.ts +3 -4
  60. package/dist/src/toasts/Toast/Toast.vue.d.ts.map +1 -1
  61. package/dist/src/toasts/Toast/ToastButton.vue.d.ts +2 -1
  62. package/dist/src/toasts/Toast/ToastButton.vue.d.ts.map +1 -1
  63. package/dist/src/toasts/ToastStack/ToastStack.vue.d.ts +2 -1
  64. package/dist/src/toasts/ToastStack/ToastStack.vue.d.ts.map +1 -1
  65. package/dist/src/versions/CreateVersionForm/CreateVersionForm.vue.d.ts +3 -2
  66. package/dist/src/versions/CreateVersionForm/CreateVersionForm.vue.d.ts.map +1 -1
  67. package/dist/src/versions/VersionHistory/CurrentState.vue.d.ts +3 -2
  68. package/dist/src/versions/VersionHistory/CurrentState.vue.d.ts.map +1 -1
  69. package/dist/src/versions/VersionHistory/HistoryEvent.vue.d.ts +7 -11
  70. package/dist/src/versions/VersionHistory/HistoryEvent.vue.d.ts.map +1 -1
  71. package/dist/src/versions/VersionHistory/HistoryEventAuthor.vue.d.ts +2 -1
  72. package/dist/src/versions/VersionHistory/HistoryEventAuthor.vue.d.ts.map +1 -1
  73. package/dist/src/versions/VersionHistory/HistoryEventFooter.vue.d.ts +2 -1
  74. package/dist/src/versions/VersionHistory/HistoryEventFooter.vue.d.ts.map +1 -1
  75. package/dist/src/versions/VersionHistory/VersionHistory.vue.d.ts +3 -2
  76. package/dist/src/versions/VersionHistory/VersionHistory.vue.d.ts.map +1 -1
  77. package/dist/src/versions/VersionHistory/VersionItem.vue.d.ts +3 -2
  78. package/dist/src/versions/VersionHistory/VersionItem.vue.d.ts.map +1 -1
  79. package/dist/src/versions/VersionHistory/VersionLabel.vue.d.ts +6 -141
  80. package/dist/src/versions/VersionHistory/VersionLabel.vue.d.ts.map +1 -1
  81. package/dist/src/versions/VersionHistory/VersionLimitInfo.vue.d.ts +2 -1
  82. package/dist/src/versions/VersionHistory/VersionLimitInfo.vue.d.ts.map +1 -1
  83. package/dist/toasts.css +13 -13
  84. package/dist/toasts.js +4700 -475
  85. package/dist/toasts.js.map +1 -1
  86. package/dist/versions.js +583 -597
  87. package/dist/versions.js.map +1 -1
  88. package/package.json +5 -5
  89. package/dist/_plugin-vue_export-helper-pcqpp-6-.js +0 -10
  90. package/dist/_plugin-vue_export-helper-pcqpp-6-.js.map +0 -1
  91. package/dist/index-B3ql6hun.js +0 -2695
  92. package/dist/index-B3ql6hun.js.map +0 -1
  93. package/dist/rfcErrors.js.map +0 -1
@@ -0,0 +1,2560 @@
1
+ //#region ../../node_modules/.pnpm/pretty-bytes@7.1.0/node_modules/pretty-bytes/index.js
2
+ var BYTE_UNITS = [
3
+ "B",
4
+ "kB",
5
+ "MB",
6
+ "GB",
7
+ "TB",
8
+ "PB",
9
+ "EB",
10
+ "ZB",
11
+ "YB"
12
+ ];
13
+ var BIBYTE_UNITS = [
14
+ "B",
15
+ "KiB",
16
+ "MiB",
17
+ "GiB",
18
+ "TiB",
19
+ "PiB",
20
+ "EiB",
21
+ "ZiB",
22
+ "YiB"
23
+ ];
24
+ var BIT_UNITS = [
25
+ "b",
26
+ "kbit",
27
+ "Mbit",
28
+ "Gbit",
29
+ "Tbit",
30
+ "Pbit",
31
+ "Ebit",
32
+ "Zbit",
33
+ "Ybit"
34
+ ];
35
+ var BIBIT_UNITS = [
36
+ "b",
37
+ "kibit",
38
+ "Mibit",
39
+ "Gibit",
40
+ "Tibit",
41
+ "Pibit",
42
+ "Eibit",
43
+ "Zibit",
44
+ "Yibit"
45
+ ];
46
+ var toLocaleString = (number, locale, options) => {
47
+ let result = number;
48
+ if (typeof locale === "string" || Array.isArray(locale)) result = number.toLocaleString(locale, options);
49
+ else if (locale === true || options !== void 0) result = number.toLocaleString(void 0, options);
50
+ return result;
51
+ };
52
+ var log10 = (numberOrBigInt) => {
53
+ if (typeof numberOrBigInt === "number") return Math.log10(numberOrBigInt);
54
+ const string = numberOrBigInt.toString(10);
55
+ return string.length + Math.log10(`0.${string.slice(0, 15)}`);
56
+ };
57
+ var log = (numberOrBigInt) => {
58
+ if (typeof numberOrBigInt === "number") return Math.log(numberOrBigInt);
59
+ return log10(numberOrBigInt) * Math.log(10);
60
+ };
61
+ var divide = (numberOrBigInt, divisor) => {
62
+ if (typeof numberOrBigInt === "number") return numberOrBigInt / divisor;
63
+ const integerPart = numberOrBigInt / BigInt(divisor);
64
+ const remainder = numberOrBigInt % BigInt(divisor);
65
+ return Number(integerPart) + Number(remainder) / divisor;
66
+ };
67
+ var applyFixedWidth = (result, fixedWidth) => {
68
+ if (fixedWidth === void 0) return result;
69
+ if (typeof fixedWidth !== "number" || !Number.isSafeInteger(fixedWidth) || fixedWidth < 0) throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof fixedWidth}: ${fixedWidth}`);
70
+ if (fixedWidth === 0) return result;
71
+ return result.length < fixedWidth ? result.padStart(fixedWidth, " ") : result;
72
+ };
73
+ var buildLocaleOptions = (options) => {
74
+ const { minimumFractionDigits, maximumFractionDigits } = options;
75
+ if (minimumFractionDigits === void 0 && maximumFractionDigits === void 0) return;
76
+ return {
77
+ ...minimumFractionDigits !== void 0 && { minimumFractionDigits },
78
+ ...maximumFractionDigits !== void 0 && { maximumFractionDigits },
79
+ roundingMode: "trunc"
80
+ };
81
+ };
82
+ function prettyBytes(number, options) {
83
+ if (typeof number !== "bigint" && !Number.isFinite(number)) throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
84
+ options = {
85
+ bits: false,
86
+ binary: false,
87
+ space: true,
88
+ nonBreakingSpace: false,
89
+ ...options
90
+ };
91
+ const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
92
+ const separator = options.space ? options.nonBreakingSpace ? "\xA0" : " " : "";
93
+ const isZero = typeof number === "number" ? number === 0 : number === 0n;
94
+ if (options.signed && isZero) return applyFixedWidth(` 0${separator}${UNITS[0]}`, options.fixedWidth);
95
+ const isNegative = number < 0;
96
+ const prefix = isNegative ? "-" : options.signed ? "+" : "";
97
+ if (isNegative) number = -number;
98
+ const localeOptions = buildLocaleOptions(options);
99
+ let result;
100
+ if (number < 1) result = prefix + toLocaleString(number, options.locale, localeOptions) + separator + UNITS[0];
101
+ else {
102
+ const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
103
+ number = divide(number, (options.binary ? 1024 : 1e3) ** exponent);
104
+ if (!localeOptions) {
105
+ const minPrecision = Math.max(3, Math.floor(number).toString().length);
106
+ number = number.toPrecision(minPrecision);
107
+ }
108
+ const numberString = toLocaleString(Number(number), options.locale, localeOptions);
109
+ const unit = UNITS[exponent];
110
+ result = prefix + numberString + separator + unit;
111
+ }
112
+ return applyFixedWidth(result, options.fixedWidth);
113
+ }
114
+ //#endregion
115
+ //#region ../../node_modules/.pnpm/dompurify@3.4.11/node_modules/dompurify/dist/purify.es.mjs
116
+ /*! @license DOMPurify 3.4.11 | (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.11/LICENSE */
117
+ function _arrayLikeToArray(r, a) {
118
+ (null == a || a > r.length) && (a = r.length);
119
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
120
+ return n;
121
+ }
122
+ function _arrayWithHoles(r) {
123
+ if (Array.isArray(r)) return r;
124
+ }
125
+ function _iterableToArrayLimit(r, l) {
126
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
127
+ if (null != t) {
128
+ var e, n, i, u, a = [], f = true, o = false;
129
+ try {
130
+ if (i = (t = t.call(r)).next, 0 === l);
131
+ else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
132
+ } catch (r) {
133
+ o = true, n = r;
134
+ } finally {
135
+ try {
136
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
137
+ } finally {
138
+ if (o) throw n;
139
+ }
140
+ }
141
+ return a;
142
+ }
143
+ }
144
+ function _nonIterableRest() {
145
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
146
+ }
147
+ function _slicedToArray(r, e) {
148
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
149
+ }
150
+ function _unsupportedIterableToArray(r, a) {
151
+ if (r) {
152
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
153
+ var t = {}.toString.call(r).slice(8, -1);
154
+ 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;
155
+ }
156
+ }
157
+ var entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
158
+ var freeze = Object.freeze, seal = Object.seal, create = Object.create;
159
+ var _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
160
+ if (!freeze) freeze = function freeze(x) {
161
+ return x;
162
+ };
163
+ if (!seal) seal = function seal(x) {
164
+ return x;
165
+ };
166
+ if (!apply) apply = function apply(func, thisArg) {
167
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
168
+ return func.apply(thisArg, args);
169
+ };
170
+ if (!construct) construct = function construct(Func) {
171
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
172
+ return new Func(...args);
173
+ };
174
+ var arrayForEach = unapply(Array.prototype.forEach);
175
+ var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
176
+ var arrayPop = unapply(Array.prototype.pop);
177
+ var arrayPush = unapply(Array.prototype.push);
178
+ var arraySplice = unapply(Array.prototype.splice);
179
+ var arrayIsArray = Array.isArray;
180
+ var stringToLowerCase = unapply(String.prototype.toLowerCase);
181
+ var stringToString = unapply(String.prototype.toString);
182
+ var stringMatch = unapply(String.prototype.match);
183
+ var stringReplace = unapply(String.prototype.replace);
184
+ var stringIndexOf = unapply(String.prototype.indexOf);
185
+ var stringTrim = unapply(String.prototype.trim);
186
+ var numberToString = unapply(Number.prototype.toString);
187
+ var booleanToString = unapply(Boolean.prototype.toString);
188
+ var bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
189
+ var symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
190
+ var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
191
+ var objectToString = unapply(Object.prototype.toString);
192
+ var regExpTest = unapply(RegExp.prototype.test);
193
+ var typeErrorCreate = unconstruct(TypeError);
194
+ /**
195
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
196
+ *
197
+ * @param func - The function to be wrapped and called.
198
+ * @returns A new function that calls the given function with a specified thisArg and arguments.
199
+ */
200
+ function unapply(func) {
201
+ return function(thisArg) {
202
+ if (thisArg instanceof RegExp) thisArg.lastIndex = 0;
203
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) args[_key3 - 1] = arguments[_key3];
204
+ return apply(func, thisArg, args);
205
+ };
206
+ }
207
+ /**
208
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
209
+ *
210
+ * @param func - The constructor function to be wrapped and called.
211
+ * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
212
+ */
213
+ function unconstruct(Func) {
214
+ return function() {
215
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) args[_key4] = arguments[_key4];
216
+ return construct(Func, args);
217
+ };
218
+ }
219
+ /**
220
+ * Add properties to a lookup table
221
+ *
222
+ * @param set - The set to which elements will be added.
223
+ * @param array - The array containing elements to be added to the set.
224
+ * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
225
+ * @returns The modified set with added elements.
226
+ */
227
+ function addToSet(set, array) {
228
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
229
+ if (setPrototypeOf) setPrototypeOf(set, null);
230
+ if (!arrayIsArray(array)) return set;
231
+ let l = array.length;
232
+ while (l--) {
233
+ let element = array[l];
234
+ if (typeof element === "string") {
235
+ const lcElement = transformCaseFunc(element);
236
+ if (lcElement !== element) {
237
+ if (!isFrozen(array)) array[l] = lcElement;
238
+ element = lcElement;
239
+ }
240
+ }
241
+ set[element] = true;
242
+ }
243
+ return set;
244
+ }
245
+ /**
246
+ * Clean up an array to harden against CSPP
247
+ *
248
+ * @param array - The array to be cleaned.
249
+ * @returns The cleaned version of the array
250
+ */
251
+ function cleanArray(array) {
252
+ for (let index = 0; index < array.length; index++) if (!objectHasOwnProperty(array, index)) array[index] = null;
253
+ return array;
254
+ }
255
+ /**
256
+ * Shallow clone an object
257
+ *
258
+ * @param object - The object to be cloned.
259
+ * @returns A new object that copies the original.
260
+ */
261
+ function clone(object) {
262
+ const newObject = create(null);
263
+ for (const _ref2 of entries(object)) {
264
+ var _ref3 = _slicedToArray(_ref2, 2);
265
+ const property = _ref3[0];
266
+ const value = _ref3[1];
267
+ if (objectHasOwnProperty(object, property)) if (arrayIsArray(value)) newObject[property] = cleanArray(value);
268
+ else if (value && typeof value === "object" && value.constructor === Object) newObject[property] = clone(value);
269
+ else newObject[property] = value;
270
+ }
271
+ return newObject;
272
+ }
273
+ /**
274
+ * Convert non-node values into strings without depending on direct property access.
275
+ *
276
+ * @param value - The value to stringify.
277
+ * @returns A string representation of the provided value.
278
+ */
279
+ function stringifyValue(value) {
280
+ switch (typeof value) {
281
+ case "string": return value;
282
+ case "number": return numberToString(value);
283
+ case "boolean": return booleanToString(value);
284
+ case "bigint": return bigintToString ? bigintToString(value) : "0";
285
+ case "symbol": return symbolToString ? symbolToString(value) : "Symbol()";
286
+ case "undefined": return objectToString(value);
287
+ case "function":
288
+ case "object": {
289
+ if (value === null) return objectToString(value);
290
+ const valueAsRecord = value;
291
+ const valueToString = lookupGetter(valueAsRecord, "toString");
292
+ if (typeof valueToString === "function") {
293
+ const stringified = valueToString(valueAsRecord);
294
+ return typeof stringified === "string" ? stringified : objectToString(stringified);
295
+ }
296
+ return objectToString(value);
297
+ }
298
+ default: return objectToString(value);
299
+ }
300
+ }
301
+ /**
302
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
303
+ *
304
+ * @param object - The object to look up the getter function in its prototype chain.
305
+ * @param prop - The property name for which to find the getter function.
306
+ * @returns The getter function found in the prototype chain or a fallback function.
307
+ */
308
+ function lookupGetter(object, prop) {
309
+ while (object !== null) {
310
+ const desc = getOwnPropertyDescriptor(object, prop);
311
+ if (desc) {
312
+ if (desc.get) return unapply(desc.get);
313
+ if (typeof desc.value === "function") return unapply(desc.value);
314
+ }
315
+ object = getPrototypeOf(object);
316
+ }
317
+ function fallbackValue() {
318
+ return null;
319
+ }
320
+ return fallbackValue;
321
+ }
322
+ function isRegex(value) {
323
+ try {
324
+ regExpTest(value, "");
325
+ return true;
326
+ } catch (_unused) {
327
+ return false;
328
+ }
329
+ }
330
+ var html$1 = freeze([
331
+ "a",
332
+ "abbr",
333
+ "acronym",
334
+ "address",
335
+ "area",
336
+ "article",
337
+ "aside",
338
+ "audio",
339
+ "b",
340
+ "bdi",
341
+ "bdo",
342
+ "big",
343
+ "blink",
344
+ "blockquote",
345
+ "body",
346
+ "br",
347
+ "button",
348
+ "canvas",
349
+ "caption",
350
+ "center",
351
+ "cite",
352
+ "code",
353
+ "col",
354
+ "colgroup",
355
+ "content",
356
+ "data",
357
+ "datalist",
358
+ "dd",
359
+ "decorator",
360
+ "del",
361
+ "details",
362
+ "dfn",
363
+ "dialog",
364
+ "dir",
365
+ "div",
366
+ "dl",
367
+ "dt",
368
+ "element",
369
+ "em",
370
+ "fieldset",
371
+ "figcaption",
372
+ "figure",
373
+ "font",
374
+ "footer",
375
+ "form",
376
+ "h1",
377
+ "h2",
378
+ "h3",
379
+ "h4",
380
+ "h5",
381
+ "h6",
382
+ "head",
383
+ "header",
384
+ "hgroup",
385
+ "hr",
386
+ "html",
387
+ "i",
388
+ "img",
389
+ "input",
390
+ "ins",
391
+ "kbd",
392
+ "label",
393
+ "legend",
394
+ "li",
395
+ "main",
396
+ "map",
397
+ "mark",
398
+ "marquee",
399
+ "menu",
400
+ "menuitem",
401
+ "meter",
402
+ "nav",
403
+ "nobr",
404
+ "ol",
405
+ "optgroup",
406
+ "option",
407
+ "output",
408
+ "p",
409
+ "picture",
410
+ "pre",
411
+ "progress",
412
+ "q",
413
+ "rp",
414
+ "rt",
415
+ "ruby",
416
+ "s",
417
+ "samp",
418
+ "search",
419
+ "section",
420
+ "select",
421
+ "shadow",
422
+ "slot",
423
+ "small",
424
+ "source",
425
+ "spacer",
426
+ "span",
427
+ "strike",
428
+ "strong",
429
+ "style",
430
+ "sub",
431
+ "summary",
432
+ "sup",
433
+ "table",
434
+ "tbody",
435
+ "td",
436
+ "template",
437
+ "textarea",
438
+ "tfoot",
439
+ "th",
440
+ "thead",
441
+ "time",
442
+ "tr",
443
+ "track",
444
+ "tt",
445
+ "u",
446
+ "ul",
447
+ "var",
448
+ "video",
449
+ "wbr"
450
+ ]);
451
+ var svg$1 = freeze([
452
+ "svg",
453
+ "a",
454
+ "altglyph",
455
+ "altglyphdef",
456
+ "altglyphitem",
457
+ "animatecolor",
458
+ "animatemotion",
459
+ "animatetransform",
460
+ "circle",
461
+ "clippath",
462
+ "defs",
463
+ "desc",
464
+ "ellipse",
465
+ "enterkeyhint",
466
+ "exportparts",
467
+ "filter",
468
+ "font",
469
+ "g",
470
+ "glyph",
471
+ "glyphref",
472
+ "hkern",
473
+ "image",
474
+ "inputmode",
475
+ "line",
476
+ "lineargradient",
477
+ "marker",
478
+ "mask",
479
+ "metadata",
480
+ "mpath",
481
+ "part",
482
+ "path",
483
+ "pattern",
484
+ "polygon",
485
+ "polyline",
486
+ "radialgradient",
487
+ "rect",
488
+ "stop",
489
+ "style",
490
+ "switch",
491
+ "symbol",
492
+ "text",
493
+ "textpath",
494
+ "title",
495
+ "tref",
496
+ "tspan",
497
+ "view",
498
+ "vkern"
499
+ ]);
500
+ var svgFilters = freeze([
501
+ "feBlend",
502
+ "feColorMatrix",
503
+ "feComponentTransfer",
504
+ "feComposite",
505
+ "feConvolveMatrix",
506
+ "feDiffuseLighting",
507
+ "feDisplacementMap",
508
+ "feDistantLight",
509
+ "feDropShadow",
510
+ "feFlood",
511
+ "feFuncA",
512
+ "feFuncB",
513
+ "feFuncG",
514
+ "feFuncR",
515
+ "feGaussianBlur",
516
+ "feImage",
517
+ "feMerge",
518
+ "feMergeNode",
519
+ "feMorphology",
520
+ "feOffset",
521
+ "fePointLight",
522
+ "feSpecularLighting",
523
+ "feSpotLight",
524
+ "feTile",
525
+ "feTurbulence"
526
+ ]);
527
+ var svgDisallowed = freeze([
528
+ "animate",
529
+ "color-profile",
530
+ "cursor",
531
+ "discard",
532
+ "font-face",
533
+ "font-face-format",
534
+ "font-face-name",
535
+ "font-face-src",
536
+ "font-face-uri",
537
+ "foreignobject",
538
+ "hatch",
539
+ "hatchpath",
540
+ "mesh",
541
+ "meshgradient",
542
+ "meshpatch",
543
+ "meshrow",
544
+ "missing-glyph",
545
+ "script",
546
+ "set",
547
+ "solidcolor",
548
+ "unknown",
549
+ "use"
550
+ ]);
551
+ var mathMl$1 = freeze([
552
+ "math",
553
+ "menclose",
554
+ "merror",
555
+ "mfenced",
556
+ "mfrac",
557
+ "mglyph",
558
+ "mi",
559
+ "mlabeledtr",
560
+ "mmultiscripts",
561
+ "mn",
562
+ "mo",
563
+ "mover",
564
+ "mpadded",
565
+ "mphantom",
566
+ "mroot",
567
+ "mrow",
568
+ "ms",
569
+ "mspace",
570
+ "msqrt",
571
+ "mstyle",
572
+ "msub",
573
+ "msup",
574
+ "msubsup",
575
+ "mtable",
576
+ "mtd",
577
+ "mtext",
578
+ "mtr",
579
+ "munder",
580
+ "munderover",
581
+ "mprescripts"
582
+ ]);
583
+ var mathMlDisallowed = freeze([
584
+ "maction",
585
+ "maligngroup",
586
+ "malignmark",
587
+ "mlongdiv",
588
+ "mscarries",
589
+ "mscarry",
590
+ "msgroup",
591
+ "mstack",
592
+ "msline",
593
+ "msrow",
594
+ "semantics",
595
+ "annotation",
596
+ "annotation-xml",
597
+ "mprescripts",
598
+ "none"
599
+ ]);
600
+ var text = freeze(["#text"]);
601
+ var html = freeze([
602
+ "accept",
603
+ "action",
604
+ "align",
605
+ "alt",
606
+ "autocapitalize",
607
+ "autocomplete",
608
+ "autopictureinpicture",
609
+ "autoplay",
610
+ "background",
611
+ "bgcolor",
612
+ "border",
613
+ "capture",
614
+ "cellpadding",
615
+ "cellspacing",
616
+ "checked",
617
+ "cite",
618
+ "class",
619
+ "clear",
620
+ "color",
621
+ "cols",
622
+ "colspan",
623
+ "command",
624
+ "commandfor",
625
+ "controls",
626
+ "controlslist",
627
+ "coords",
628
+ "crossorigin",
629
+ "datetime",
630
+ "decoding",
631
+ "default",
632
+ "dir",
633
+ "disabled",
634
+ "disablepictureinpicture",
635
+ "disableremoteplayback",
636
+ "download",
637
+ "draggable",
638
+ "enctype",
639
+ "enterkeyhint",
640
+ "exportparts",
641
+ "face",
642
+ "for",
643
+ "headers",
644
+ "height",
645
+ "hidden",
646
+ "high",
647
+ "href",
648
+ "hreflang",
649
+ "id",
650
+ "inert",
651
+ "inputmode",
652
+ "integrity",
653
+ "ismap",
654
+ "kind",
655
+ "label",
656
+ "lang",
657
+ "list",
658
+ "loading",
659
+ "loop",
660
+ "low",
661
+ "max",
662
+ "maxlength",
663
+ "media",
664
+ "method",
665
+ "min",
666
+ "minlength",
667
+ "multiple",
668
+ "muted",
669
+ "name",
670
+ "nonce",
671
+ "noshade",
672
+ "novalidate",
673
+ "nowrap",
674
+ "open",
675
+ "optimum",
676
+ "part",
677
+ "pattern",
678
+ "placeholder",
679
+ "playsinline",
680
+ "popover",
681
+ "popovertarget",
682
+ "popovertargetaction",
683
+ "poster",
684
+ "preload",
685
+ "pubdate",
686
+ "radiogroup",
687
+ "readonly",
688
+ "rel",
689
+ "required",
690
+ "rev",
691
+ "reversed",
692
+ "role",
693
+ "rows",
694
+ "rowspan",
695
+ "spellcheck",
696
+ "scope",
697
+ "selected",
698
+ "shape",
699
+ "size",
700
+ "sizes",
701
+ "slot",
702
+ "span",
703
+ "srclang",
704
+ "start",
705
+ "src",
706
+ "srcset",
707
+ "step",
708
+ "style",
709
+ "summary",
710
+ "tabindex",
711
+ "title",
712
+ "translate",
713
+ "type",
714
+ "usemap",
715
+ "valign",
716
+ "value",
717
+ "width",
718
+ "wrap",
719
+ "xmlns"
720
+ ]);
721
+ var svg = freeze([
722
+ "accent-height",
723
+ "accumulate",
724
+ "additive",
725
+ "alignment-baseline",
726
+ "amplitude",
727
+ "ascent",
728
+ "attributename",
729
+ "attributetype",
730
+ "azimuth",
731
+ "basefrequency",
732
+ "baseline-shift",
733
+ "begin",
734
+ "bias",
735
+ "by",
736
+ "class",
737
+ "clip",
738
+ "clippathunits",
739
+ "clip-path",
740
+ "clip-rule",
741
+ "color",
742
+ "color-interpolation",
743
+ "color-interpolation-filters",
744
+ "color-profile",
745
+ "color-rendering",
746
+ "cx",
747
+ "cy",
748
+ "d",
749
+ "dx",
750
+ "dy",
751
+ "diffuseconstant",
752
+ "direction",
753
+ "display",
754
+ "divisor",
755
+ "dur",
756
+ "edgemode",
757
+ "elevation",
758
+ "end",
759
+ "exponent",
760
+ "fill",
761
+ "fill-opacity",
762
+ "fill-rule",
763
+ "filter",
764
+ "filterunits",
765
+ "flood-color",
766
+ "flood-opacity",
767
+ "font-family",
768
+ "font-size",
769
+ "font-size-adjust",
770
+ "font-stretch",
771
+ "font-style",
772
+ "font-variant",
773
+ "font-weight",
774
+ "fx",
775
+ "fy",
776
+ "g1",
777
+ "g2",
778
+ "glyph-name",
779
+ "glyphref",
780
+ "gradientunits",
781
+ "gradienttransform",
782
+ "height",
783
+ "href",
784
+ "id",
785
+ "image-rendering",
786
+ "in",
787
+ "in2",
788
+ "intercept",
789
+ "k",
790
+ "k1",
791
+ "k2",
792
+ "k3",
793
+ "k4",
794
+ "kerning",
795
+ "keypoints",
796
+ "keysplines",
797
+ "keytimes",
798
+ "lang",
799
+ "lengthadjust",
800
+ "letter-spacing",
801
+ "kernelmatrix",
802
+ "kernelunitlength",
803
+ "lighting-color",
804
+ "local",
805
+ "marker-end",
806
+ "marker-mid",
807
+ "marker-start",
808
+ "markerheight",
809
+ "markerunits",
810
+ "markerwidth",
811
+ "maskcontentunits",
812
+ "maskunits",
813
+ "max",
814
+ "mask",
815
+ "mask-type",
816
+ "media",
817
+ "method",
818
+ "mode",
819
+ "min",
820
+ "name",
821
+ "numoctaves",
822
+ "offset",
823
+ "operator",
824
+ "opacity",
825
+ "order",
826
+ "orient",
827
+ "orientation",
828
+ "origin",
829
+ "overflow",
830
+ "paint-order",
831
+ "path",
832
+ "pathlength",
833
+ "patterncontentunits",
834
+ "patterntransform",
835
+ "patternunits",
836
+ "points",
837
+ "preservealpha",
838
+ "preserveaspectratio",
839
+ "primitiveunits",
840
+ "r",
841
+ "rx",
842
+ "ry",
843
+ "radius",
844
+ "refx",
845
+ "refy",
846
+ "repeatcount",
847
+ "repeatdur",
848
+ "restart",
849
+ "result",
850
+ "rotate",
851
+ "scale",
852
+ "seed",
853
+ "shape-rendering",
854
+ "slope",
855
+ "specularconstant",
856
+ "specularexponent",
857
+ "spreadmethod",
858
+ "startoffset",
859
+ "stddeviation",
860
+ "stitchtiles",
861
+ "stop-color",
862
+ "stop-opacity",
863
+ "stroke-dasharray",
864
+ "stroke-dashoffset",
865
+ "stroke-linecap",
866
+ "stroke-linejoin",
867
+ "stroke-miterlimit",
868
+ "stroke-opacity",
869
+ "stroke",
870
+ "stroke-width",
871
+ "style",
872
+ "surfacescale",
873
+ "systemlanguage",
874
+ "tabindex",
875
+ "tablevalues",
876
+ "targetx",
877
+ "targety",
878
+ "transform",
879
+ "transform-origin",
880
+ "text-anchor",
881
+ "text-decoration",
882
+ "text-rendering",
883
+ "textlength",
884
+ "type",
885
+ "u1",
886
+ "u2",
887
+ "unicode",
888
+ "values",
889
+ "viewbox",
890
+ "visibility",
891
+ "version",
892
+ "vert-adv-y",
893
+ "vert-origin-x",
894
+ "vert-origin-y",
895
+ "width",
896
+ "word-spacing",
897
+ "wrap",
898
+ "writing-mode",
899
+ "xchannelselector",
900
+ "ychannelselector",
901
+ "x",
902
+ "x1",
903
+ "x2",
904
+ "xmlns",
905
+ "y",
906
+ "y1",
907
+ "y2",
908
+ "z",
909
+ "zoomandpan"
910
+ ]);
911
+ var mathMl = freeze([
912
+ "accent",
913
+ "accentunder",
914
+ "align",
915
+ "bevelled",
916
+ "close",
917
+ "columnalign",
918
+ "columnlines",
919
+ "columnspacing",
920
+ "columnspan",
921
+ "denomalign",
922
+ "depth",
923
+ "dir",
924
+ "display",
925
+ "displaystyle",
926
+ "encoding",
927
+ "fence",
928
+ "frame",
929
+ "height",
930
+ "href",
931
+ "id",
932
+ "largeop",
933
+ "length",
934
+ "linethickness",
935
+ "lquote",
936
+ "lspace",
937
+ "mathbackground",
938
+ "mathcolor",
939
+ "mathsize",
940
+ "mathvariant",
941
+ "maxsize",
942
+ "minsize",
943
+ "movablelimits",
944
+ "notation",
945
+ "numalign",
946
+ "open",
947
+ "rowalign",
948
+ "rowlines",
949
+ "rowspacing",
950
+ "rowspan",
951
+ "rspace",
952
+ "rquote",
953
+ "scriptlevel",
954
+ "scriptminsize",
955
+ "scriptsizemultiplier",
956
+ "selection",
957
+ "separator",
958
+ "separators",
959
+ "stretchy",
960
+ "subscriptshift",
961
+ "supscriptshift",
962
+ "symmetric",
963
+ "voffset",
964
+ "width",
965
+ "xmlns"
966
+ ]);
967
+ var xml = freeze([
968
+ "xlink:href",
969
+ "xml:id",
970
+ "xlink:title",
971
+ "xml:space",
972
+ "xmlns:xlink"
973
+ ]);
974
+ var MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
975
+ var ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
976
+ var TMPLIT_EXPR = seal(/\${[\w\W]*/g);
977
+ var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
978
+ var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
979
+ var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
980
+ var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
981
+ var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);
982
+ var DOCTYPE_NAME = seal(/^html$/i);
983
+ var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
984
+ var ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
985
+ var COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
986
+ var FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
987
+ var SELF_CLOSING_TAG = seal(/\/>/i);
988
+ var NODE_TYPE = {
989
+ element: 1,
990
+ attribute: 2,
991
+ text: 3,
992
+ cdataSection: 4,
993
+ entityReference: 5,
994
+ entityNode: 6,
995
+ processingInstruction: 7,
996
+ comment: 8,
997
+ document: 9,
998
+ documentType: 10,
999
+ documentFragment: 11,
1000
+ notation: 12
1001
+ };
1002
+ var getGlobal = function getGlobal() {
1003
+ return typeof window === "undefined" ? null : window;
1004
+ };
1005
+ /**
1006
+ * Creates a no-op policy for internal use only.
1007
+ * Don't export this function outside this module!
1008
+ * @param trustedTypes The policy factory.
1009
+ * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
1010
+ * @return The policy created (or null, if Trusted Types
1011
+ * are not supported or creating the policy failed).
1012
+ */
1013
+ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
1014
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") return null;
1015
+ let suffix = null;
1016
+ const ATTR_NAME = "data-tt-policy-suffix";
1017
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) suffix = purifyHostElement.getAttribute(ATTR_NAME);
1018
+ const policyName = "dompurify" + (suffix ? "#" + suffix : "");
1019
+ try {
1020
+ return trustedTypes.createPolicy(policyName, {
1021
+ createHTML(html) {
1022
+ return html;
1023
+ },
1024
+ createScriptURL(scriptUrl) {
1025
+ return scriptUrl;
1026
+ }
1027
+ });
1028
+ } catch (_) {
1029
+ console.warn("TrustedTypes policy " + policyName + " could not be created.");
1030
+ return null;
1031
+ }
1032
+ };
1033
+ var _createHooksMap = function _createHooksMap() {
1034
+ return {
1035
+ afterSanitizeAttributes: [],
1036
+ afterSanitizeElements: [],
1037
+ afterSanitizeShadowDOM: [],
1038
+ beforeSanitizeAttributes: [],
1039
+ beforeSanitizeElements: [],
1040
+ beforeSanitizeShadowDOM: [],
1041
+ uponSanitizeAttribute: [],
1042
+ uponSanitizeElement: [],
1043
+ uponSanitizeShadowNode: []
1044
+ };
1045
+ };
1046
+ /**
1047
+ * Resolve a set-valued configuration option: a fresh set built from
1048
+ * cfg[key] when it is an own array property (seeded with a clone of
1049
+ * options.base when given, case-normalized via options.transform),
1050
+ * the fallback set otherwise.
1051
+ *
1052
+ * @param cfg the cloned, prototype-free configuration object
1053
+ * @param key the configuration property to read
1054
+ * @param fallback the set to use when the option is absent or not an array
1055
+ * @param options transform and optional base set to merge into
1056
+ * @returns the resolved set
1057
+ */
1058
+ var _resolveSetOption = function _resolveSetOption(cfg, key, fallback, options) {
1059
+ return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
1060
+ };
1061
+ function createDOMPurify() {
1062
+ let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
1063
+ const DOMPurify = (root) => createDOMPurify(root);
1064
+ DOMPurify.version = "3.4.11";
1065
+ DOMPurify.removed = [];
1066
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
1067
+ DOMPurify.isSupported = false;
1068
+ return DOMPurify;
1069
+ }
1070
+ let document = window.document;
1071
+ const originalDocument = document;
1072
+ const currentScript = originalDocument.currentScript;
1073
+ window.DocumentFragment;
1074
+ const HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, Element = window.Element, NodeFilter = window.NodeFilter;
1075
+ window.NamedNodeMap === void 0 && (window.NamedNodeMap || window.MozNamedAttrMap);
1076
+ window.HTMLFormElement;
1077
+ const DOMParser = window.DOMParser, trustedTypes = window.trustedTypes;
1078
+ const ElementPrototype = Element.prototype;
1079
+ const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
1080
+ const remove = lookupGetter(ElementPrototype, "remove");
1081
+ const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
1082
+ const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
1083
+ const getParentNode = lookupGetter(ElementPrototype, "parentNode");
1084
+ const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot");
1085
+ const getAttributes = lookupGetter(ElementPrototype, "attributes");
1086
+ const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
1087
+ const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
1088
+ if (typeof HTMLTemplateElement === "function") {
1089
+ const template = document.createElement("template");
1090
+ if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
1091
+ }
1092
+ let trustedTypesPolicy;
1093
+ let emptyHTML = "";
1094
+ let defaultTrustedTypesPolicy;
1095
+ let defaultTrustedTypesPolicyResolved = false;
1096
+ let IN_TRUSTED_TYPES_POLICY = 0;
1097
+ const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy() {
1098
+ if (IN_TRUSTED_TYPES_POLICY > 0) throw typeErrorCreate("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
1099
+ };
1100
+ const _createTrustedHTML = function _createTrustedHTML(html) {
1101
+ _assertNotInTrustedTypesPolicy();
1102
+ IN_TRUSTED_TYPES_POLICY++;
1103
+ try {
1104
+ return trustedTypesPolicy.createHTML(html);
1105
+ } finally {
1106
+ IN_TRUSTED_TYPES_POLICY--;
1107
+ }
1108
+ };
1109
+ const _createTrustedScriptURL = function _createTrustedScriptURL(scriptUrl) {
1110
+ _assertNotInTrustedTypesPolicy();
1111
+ IN_TRUSTED_TYPES_POLICY++;
1112
+ try {
1113
+ return trustedTypesPolicy.createScriptURL(scriptUrl);
1114
+ } finally {
1115
+ IN_TRUSTED_TYPES_POLICY--;
1116
+ }
1117
+ };
1118
+ const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy() {
1119
+ if (!defaultTrustedTypesPolicyResolved) {
1120
+ defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
1121
+ defaultTrustedTypesPolicyResolved = true;
1122
+ }
1123
+ return defaultTrustedTypesPolicy;
1124
+ };
1125
+ const _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
1126
+ const importNode = originalDocument.importNode;
1127
+ let hooks = _createHooksMap();
1128
+ /**
1129
+ * Expose whether this browser supports running the full DOMPurify.
1130
+ */
1131
+ DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
1132
+ const MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, TMPLIT_EXPR$1 = TMPLIT_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE, CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
1133
+ let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
1134
+ /**
1135
+ * We consider the elements and attributes below to be safe. Ideally
1136
+ * don't add any new ones but feel free to remove unwanted ones.
1137
+ */
1138
+ let ALLOWED_TAGS = null;
1139
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [
1140
+ ...html$1,
1141
+ ...svg$1,
1142
+ ...svgFilters,
1143
+ ...mathMl$1,
1144
+ ...text
1145
+ ]);
1146
+ let ALLOWED_ATTR = null;
1147
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [
1148
+ ...html,
1149
+ ...svg,
1150
+ ...mathMl,
1151
+ ...xml
1152
+ ]);
1153
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
1154
+ tagNameCheck: {
1155
+ writable: true,
1156
+ configurable: false,
1157
+ enumerable: true,
1158
+ value: null
1159
+ },
1160
+ attributeNameCheck: {
1161
+ writable: true,
1162
+ configurable: false,
1163
+ enumerable: true,
1164
+ value: null
1165
+ },
1166
+ allowCustomizedBuiltInElements: {
1167
+ writable: true,
1168
+ configurable: false,
1169
+ enumerable: true,
1170
+ value: false
1171
+ }
1172
+ }));
1173
+ let FORBID_TAGS = null;
1174
+ let FORBID_ATTR = null;
1175
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
1176
+ tagCheck: {
1177
+ writable: true,
1178
+ configurable: false,
1179
+ enumerable: true,
1180
+ value: null
1181
+ },
1182
+ attributeCheck: {
1183
+ writable: true,
1184
+ configurable: false,
1185
+ enumerable: true,
1186
+ value: null
1187
+ }
1188
+ }));
1189
+ let ALLOW_ARIA_ATTR = true;
1190
+ let ALLOW_DATA_ATTR = true;
1191
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
1192
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
1193
+ let SAFE_FOR_TEMPLATES = false;
1194
+ let SAFE_FOR_XML = true;
1195
+ let WHOLE_DOCUMENT = false;
1196
+ let SET_CONFIG = false;
1197
+ let SET_CONFIG_ALLOWED_TAGS = null;
1198
+ let SET_CONFIG_ALLOWED_ATTR = null;
1199
+ let FORCE_BODY = false;
1200
+ let RETURN_DOM = false;
1201
+ let RETURN_DOM_FRAGMENT = false;
1202
+ let RETURN_TRUSTED_TYPE = false;
1203
+ let SANITIZE_DOM = true;
1204
+ let SANITIZE_NAMED_PROPS = false;
1205
+ const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
1206
+ let KEEP_CONTENT = true;
1207
+ let IN_PLACE = false;
1208
+ let USE_PROFILES = {};
1209
+ let FORBID_CONTENTS = null;
1210
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, [
1211
+ "annotation-xml",
1212
+ "audio",
1213
+ "colgroup",
1214
+ "desc",
1215
+ "foreignobject",
1216
+ "head",
1217
+ "iframe",
1218
+ "math",
1219
+ "mi",
1220
+ "mn",
1221
+ "mo",
1222
+ "ms",
1223
+ "mtext",
1224
+ "noembed",
1225
+ "noframes",
1226
+ "noscript",
1227
+ "plaintext",
1228
+ "script",
1229
+ "selectedcontent",
1230
+ "style",
1231
+ "svg",
1232
+ "template",
1233
+ "thead",
1234
+ "title",
1235
+ "video",
1236
+ "xmp"
1237
+ ]);
1238
+ let DATA_URI_TAGS = null;
1239
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, [
1240
+ "audio",
1241
+ "video",
1242
+ "img",
1243
+ "source",
1244
+ "image",
1245
+ "track"
1246
+ ]);
1247
+ let URI_SAFE_ATTRIBUTES = null;
1248
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
1249
+ "alt",
1250
+ "class",
1251
+ "for",
1252
+ "id",
1253
+ "label",
1254
+ "name",
1255
+ "pattern",
1256
+ "placeholder",
1257
+ "role",
1258
+ "summary",
1259
+ "title",
1260
+ "value",
1261
+ "style",
1262
+ "xmlns"
1263
+ ]);
1264
+ const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
1265
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
1266
+ const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
1267
+ let NAMESPACE = HTML_NAMESPACE;
1268
+ let IS_EMPTY_INPUT = false;
1269
+ let ALLOWED_NAMESPACES = null;
1270
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [
1271
+ MATHML_NAMESPACE,
1272
+ SVG_NAMESPACE,
1273
+ HTML_NAMESPACE
1274
+ ], stringToString);
1275
+ const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze([
1276
+ "mi",
1277
+ "mo",
1278
+ "mn",
1279
+ "ms",
1280
+ "mtext"
1281
+ ]);
1282
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
1283
+ const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
1284
+ let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
1285
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
1286
+ "title",
1287
+ "style",
1288
+ "font",
1289
+ "a",
1290
+ "script"
1291
+ ]);
1292
+ let PARSER_MEDIA_TYPE = null;
1293
+ const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
1294
+ const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
1295
+ let transformCaseFunc = null;
1296
+ let CONFIG = null;
1297
+ const formElement = document.createElement("form");
1298
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
1299
+ return testValue instanceof RegExp || testValue instanceof Function;
1300
+ };
1301
+ /**
1302
+ * _parseConfig
1303
+ *
1304
+ * @param cfg optional config literal
1305
+ */
1306
+ const _parseConfig = function _parseConfig() {
1307
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1308
+ if (CONFIG && CONFIG === cfg) return;
1309
+ if (!cfg || typeof cfg !== "object") cfg = {};
1310
+ cfg = clone(cfg);
1311
+ PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
1312
+ transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
1313
+ ALLOWED_TAGS = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, { transform: transformCaseFunc });
1314
+ ALLOWED_ATTR = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, { transform: transformCaseFunc });
1315
+ ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, { transform: stringToString });
1316
+ URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, "ADD_URI_SAFE_ATTR", DEFAULT_URI_SAFE_ATTRIBUTES, {
1317
+ transform: transformCaseFunc,
1318
+ base: DEFAULT_URI_SAFE_ATTRIBUTES
1319
+ });
1320
+ DATA_URI_TAGS = _resolveSetOption(cfg, "ADD_DATA_URI_TAGS", DEFAULT_DATA_URI_TAGS, {
1321
+ transform: transformCaseFunc,
1322
+ base: DEFAULT_DATA_URI_TAGS
1323
+ });
1324
+ FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, { transform: transformCaseFunc });
1325
+ FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), { transform: transformCaseFunc });
1326
+ FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), { transform: transformCaseFunc });
1327
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
1328
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
1329
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
1330
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
1331
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
1332
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
1333
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
1334
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
1335
+ RETURN_DOM = cfg.RETURN_DOM || false;
1336
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
1337
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
1338
+ FORCE_BODY = cfg.FORCE_BODY || false;
1339
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
1340
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
1341
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
1342
+ IN_PLACE = cfg.IN_PLACE || false;
1343
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
1344
+ NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
1345
+ MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
1346
+ HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
1347
+ const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
1348
+ CUSTOM_ELEMENT_HANDLING = create(null);
1349
+ if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
1350
+ if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
1351
+ if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
1352
+ seal(CUSTOM_ELEMENT_HANDLING);
1353
+ if (SAFE_FOR_TEMPLATES) ALLOW_DATA_ATTR = false;
1354
+ if (RETURN_DOM_FRAGMENT) RETURN_DOM = true;
1355
+ if (USE_PROFILES) {
1356
+ ALLOWED_TAGS = addToSet({}, text);
1357
+ ALLOWED_ATTR = create(null);
1358
+ if (USE_PROFILES.html === true) {
1359
+ addToSet(ALLOWED_TAGS, html$1);
1360
+ addToSet(ALLOWED_ATTR, html);
1361
+ }
1362
+ if (USE_PROFILES.svg === true) {
1363
+ addToSet(ALLOWED_TAGS, svg$1);
1364
+ addToSet(ALLOWED_ATTR, svg);
1365
+ addToSet(ALLOWED_ATTR, xml);
1366
+ }
1367
+ if (USE_PROFILES.svgFilters === true) {
1368
+ addToSet(ALLOWED_TAGS, svgFilters);
1369
+ addToSet(ALLOWED_ATTR, svg);
1370
+ addToSet(ALLOWED_ATTR, xml);
1371
+ }
1372
+ if (USE_PROFILES.mathMl === true) {
1373
+ addToSet(ALLOWED_TAGS, mathMl$1);
1374
+ addToSet(ALLOWED_ATTR, mathMl);
1375
+ addToSet(ALLOWED_ATTR, xml);
1376
+ }
1377
+ }
1378
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
1379
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
1380
+ if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
1381
+ if (typeof cfg.ADD_TAGS === "function") EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
1382
+ else if (arrayIsArray(cfg.ADD_TAGS)) {
1383
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS = clone(ALLOWED_TAGS);
1384
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
1385
+ }
1386
+ }
1387
+ if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
1388
+ if (typeof cfg.ADD_ATTR === "function") EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
1389
+ else if (arrayIsArray(cfg.ADD_ATTR)) {
1390
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR = clone(ALLOWED_ATTR);
1391
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
1392
+ }
1393
+ }
1394
+ if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
1395
+ if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
1396
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
1397
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
1398
+ }
1399
+ if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
1400
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
1401
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
1402
+ }
1403
+ if (KEEP_CONTENT) ALLOWED_TAGS["#text"] = true;
1404
+ if (WHOLE_DOCUMENT) addToSet(ALLOWED_TAGS, [
1405
+ "html",
1406
+ "head",
1407
+ "body"
1408
+ ]);
1409
+ if (ALLOWED_TAGS.table) {
1410
+ addToSet(ALLOWED_TAGS, ["tbody"]);
1411
+ delete FORBID_TAGS.tbody;
1412
+ }
1413
+ if (cfg.TRUSTED_TYPES_POLICY) {
1414
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
1415
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
1416
+ const previousTrustedTypesPolicy = trustedTypesPolicy;
1417
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
1418
+ try {
1419
+ emptyHTML = _createTrustedHTML("");
1420
+ } catch (error) {
1421
+ trustedTypesPolicy = previousTrustedTypesPolicy;
1422
+ throw error;
1423
+ }
1424
+ } else if (cfg.TRUSTED_TYPES_POLICY === null) {
1425
+ trustedTypesPolicy = void 0;
1426
+ emptyHTML = "";
1427
+ } else {
1428
+ if (trustedTypesPolicy === void 0) trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
1429
+ if (trustedTypesPolicy && typeof emptyHTML === "string") emptyHTML = _createTrustedHTML("");
1430
+ }
1431
+ if (freeze) freeze(cfg);
1432
+ CONFIG = cfg;
1433
+ };
1434
+ const ALL_SVG_TAGS = addToSet({}, [
1435
+ ...svg$1,
1436
+ ...svgFilters,
1437
+ ...svgDisallowed
1438
+ ]);
1439
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
1440
+ /**
1441
+ * Namespace rules for an element in the SVG namespace.
1442
+ *
1443
+ * @param tagName the element's lowercase tag name
1444
+ * @param parent the (possibly simulated) parent node
1445
+ * @param parentTagName the parent's lowercase tag name
1446
+ * @returns true if a spec-compliant parser could produce this element
1447
+ */
1448
+ const _checkSvgNamespace = function _checkSvgNamespace(tagName, parent, parentTagName) {
1449
+ if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg";
1450
+ if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
1451
+ return Boolean(ALL_SVG_TAGS[tagName]);
1452
+ };
1453
+ /**
1454
+ * Namespace rules for an element in the MathML namespace.
1455
+ *
1456
+ * @param tagName the element's lowercase tag name
1457
+ * @param parent the (possibly simulated) parent node
1458
+ * @param parentTagName the parent's lowercase tag name
1459
+ * @returns true if a spec-compliant parser could produce this element
1460
+ */
1461
+ const _checkMathMlNamespace = function _checkMathMlNamespace(tagName, parent, parentTagName) {
1462
+ if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math";
1463
+ if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
1464
+ return Boolean(ALL_MATHML_TAGS[tagName]);
1465
+ };
1466
+ /**
1467
+ * Namespace rules for an element in the HTML namespace.
1468
+ *
1469
+ * @param tagName the element's lowercase tag name
1470
+ * @param parent the (possibly simulated) parent node
1471
+ * @param parentTagName the parent's lowercase tag name
1472
+ * @returns true if a spec-compliant parser could produce this element
1473
+ */
1474
+ const _checkHtmlNamespace = function _checkHtmlNamespace(tagName, parent, parentTagName) {
1475
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false;
1476
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false;
1477
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
1478
+ };
1479
+ /**
1480
+ * @param element a DOM element whose namespace is being checked
1481
+ * @returns Return false if the element has a
1482
+ * namespace that a spec-compliant parser would never
1483
+ * return. Return true otherwise.
1484
+ */
1485
+ const _checkValidNamespace = function _checkValidNamespace(element) {
1486
+ let parent = getParentNode(element);
1487
+ if (!parent || !parent.tagName) parent = {
1488
+ namespaceURI: NAMESPACE,
1489
+ tagName: "template"
1490
+ };
1491
+ const tagName = stringToLowerCase(element.tagName);
1492
+ const parentTagName = stringToLowerCase(parent.tagName);
1493
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) return false;
1494
+ if (element.namespaceURI === SVG_NAMESPACE) return _checkSvgNamespace(tagName, parent, parentTagName);
1495
+ if (element.namespaceURI === MATHML_NAMESPACE) return _checkMathMlNamespace(tagName, parent, parentTagName);
1496
+ if (element.namespaceURI === HTML_NAMESPACE) return _checkHtmlNamespace(tagName, parent, parentTagName);
1497
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) return true;
1498
+ return false;
1499
+ };
1500
+ /**
1501
+ * _forceRemove
1502
+ *
1503
+ * @param node a DOM node
1504
+ */
1505
+ const _forceRemove = function _forceRemove(node) {
1506
+ arrayPush(DOMPurify.removed, { element: node });
1507
+ try {
1508
+ getParentNode(node).removeChild(node);
1509
+ } catch (_) {
1510
+ remove(node);
1511
+ if (!getParentNode(node)) throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
1512
+ }
1513
+ };
1514
+ /**
1515
+ * _neutralizeRoot
1516
+ *
1517
+ * Fail-closed teardown of an in-place root after the sanitize walk aborts
1518
+ * (campaign-3 F2). An internal throw mid-walk — e.g. a page-registered
1519
+ * custom element's reaction detaches a node so `_forceRemove`'s deliberate
1520
+ * parentless guard throws, or any other re-entrant engine mutation — would
1521
+ * otherwise leave the caller's *live* tree half-sanitized, with everything
1522
+ * after the abort point still carrying its handlers. There is no safe way
1523
+ * to resume the walk (the tree mutated under us), so we strip the root bare:
1524
+ * remove every child and every attribute, then let the caller's catch see
1525
+ * the original error. Clobber-safe (cached `remove`/`childNodes`/`attributes`
1526
+ * getters; the root was already clobber-pre-flighted at the IN_PLACE entry).
1527
+ *
1528
+ * @param root the in-place root to empty
1529
+ */
1530
+ const _neutralizeRoot = function _neutralizeRoot(root) {
1531
+ const childNodes = getChildNodes(root);
1532
+ if (childNodes) {
1533
+ const snapshot = [];
1534
+ arrayForEach(childNodes, (child) => {
1535
+ arrayPush(snapshot, child);
1536
+ });
1537
+ arrayForEach(snapshot, (child) => {
1538
+ try {
1539
+ remove(child);
1540
+ } catch (_) {}
1541
+ });
1542
+ }
1543
+ const attributes = getAttributes(root);
1544
+ if (attributes) for (let i = attributes.length - 1; i >= 0; --i) {
1545
+ const attribute = attributes[i];
1546
+ const name = attribute && attribute.name;
1547
+ if (typeof name === "string") try {
1548
+ root.removeAttribute(name);
1549
+ } catch (_) {}
1550
+ }
1551
+ };
1552
+ /**
1553
+ * _removeAttribute
1554
+ *
1555
+ * @param name an Attribute name
1556
+ * @param element a DOM node
1557
+ */
1558
+ const _removeAttribute = function _removeAttribute(name, element) {
1559
+ try {
1560
+ arrayPush(DOMPurify.removed, {
1561
+ attribute: element.getAttributeNode(name),
1562
+ from: element
1563
+ });
1564
+ } catch (_) {
1565
+ arrayPush(DOMPurify.removed, {
1566
+ attribute: null,
1567
+ from: element
1568
+ });
1569
+ }
1570
+ element.removeAttribute(name);
1571
+ if (name === "is") if (RETURN_DOM || RETURN_DOM_FRAGMENT) try {
1572
+ _forceRemove(element);
1573
+ } catch (_) {}
1574
+ else try {
1575
+ element.setAttribute(name, "");
1576
+ } catch (_) {}
1577
+ };
1578
+ /**
1579
+ * _stripDisallowedAttributes
1580
+ *
1581
+ * Removes every attribute the active configuration does not allow from a
1582
+ * single element, using the same allowlist as the main attribute pass (so
1583
+ * `on*` handlers go, but no `/^on/` blocklist is introduced). Used only to
1584
+ * neutralise nodes that are being discarded from an in-place tree.
1585
+ *
1586
+ * @param element the element to strip
1587
+ */
1588
+ const _stripDisallowedAttributes = function _stripDisallowedAttributes(element) {
1589
+ const attributes = getAttributes(element);
1590
+ if (!attributes) return;
1591
+ for (let i = attributes.length - 1; i >= 0; --i) {
1592
+ const attribute = attributes[i];
1593
+ const name = attribute && attribute.name;
1594
+ if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)]) continue;
1595
+ try {
1596
+ element.removeAttribute(name);
1597
+ } catch (_) {}
1598
+ }
1599
+ };
1600
+ /**
1601
+ * _neutralizeSubtree
1602
+ *
1603
+ * Completes the audit-5 F1 fix across every removal path. The KEEP_CONTENT
1604
+ * move-hoist neutralises only disallowed-tag removals; clobber, mXSS-canary,
1605
+ * namespace, comment, processing-instruction and KEEP_CONTENT:false removals
1606
+ * all drop their subtree wholesale via `_forceRemove`. On the IN_PLACE path
1607
+ * those dropped nodes are detached from the caller's LIVE tree but a
1608
+ * handler-bearing original among them (an `<img onerror>`/`<video>` that was
1609
+ * loading) keeps its queued resource event, which fires in page scope after
1610
+ * sanitize returns. This walks a removed subtree and strips every attribute
1611
+ * the active configuration does not allow — so `on*` handlers are cancelled
1612
+ * through the SAME allowlist that governs kept nodes, not a separate `/^on/`
1613
+ * blocklist. Run synchronously before sanitize returns, i.e. before any
1614
+ * queued event can fire. Hook-free by design: these nodes leave the output,
1615
+ * so firing attribute hooks for them would be surprising. Clobber-safe reads;
1616
+ * a doomed clobbered node may shadow `removeAttribute` (its own attributes are
1617
+ * irrelevant — it is discarded — while its non-clobbered descendants, e.g.
1618
+ * the `<img>`, are reached and scrubbed).
1619
+ *
1620
+ * @param root the root of a removed subtree to neutralise
1621
+ */
1622
+ const _neutralizeSubtree = function _neutralizeSubtree(root) {
1623
+ const stack = [root];
1624
+ while (stack.length > 0) {
1625
+ const node = stack.pop();
1626
+ if ((getNodeType ? getNodeType(node) : node.nodeType) === NODE_TYPE.element) _stripDisallowedAttributes(node);
1627
+ const childNodes = getChildNodes(node);
1628
+ if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
1629
+ }
1630
+ };
1631
+ /**
1632
+ * _initDocument
1633
+ *
1634
+ * @param dirty - a string of dirty markup
1635
+ * @return a DOM, filled with the dirty markup
1636
+ */
1637
+ const _initDocument = function _initDocument(dirty) {
1638
+ let doc = null;
1639
+ let leadingWhitespace = null;
1640
+ if (FORCE_BODY) dirty = "<remove></remove>" + dirty;
1641
+ else {
1642
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
1643
+ leadingWhitespace = matches && matches[0];
1644
+ }
1645
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) dirty = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + dirty + "</body></html>";
1646
+ const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
1647
+ if (NAMESPACE === HTML_NAMESPACE) try {
1648
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
1649
+ } catch (_) {}
1650
+ if (!doc || !doc.documentElement) {
1651
+ doc = implementation.createDocument(NAMESPACE, "template", null);
1652
+ try {
1653
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
1654
+ } catch (_) {}
1655
+ }
1656
+ const body = doc.body || doc.documentElement;
1657
+ if (dirty && leadingWhitespace) body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
1658
+ if (NAMESPACE === HTML_NAMESPACE) return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
1659
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
1660
+ };
1661
+ /**
1662
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
1663
+ *
1664
+ * @param root The root element or node to start traversing on.
1665
+ * @return The created NodeIterator
1666
+ */
1667
+ const _createNodeIterator = function _createNodeIterator(root) {
1668
+ return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
1669
+ };
1670
+ /**
1671
+ * Replace template expression syntax (mustache, ERB, template
1672
+ * literal) with a space; shared by all SAFE_FOR_TEMPLATES scrub
1673
+ * sites. Order matters: mustache, then ERB, then template literal.
1674
+ *
1675
+ * @param value the string to scrub
1676
+ * @returns the scrubbed string
1677
+ */
1678
+ const _stripTemplateExpressions = function _stripTemplateExpressions(value) {
1679
+ value = stringReplace(value, MUSTACHE_EXPR$1, " ");
1680
+ value = stringReplace(value, ERB_EXPR$1, " ");
1681
+ value = stringReplace(value, TMPLIT_EXPR$1, " ");
1682
+ return value;
1683
+ };
1684
+ /**
1685
+ * Strip template-engine expressions ({{...}}, ${...}, <%...%>) from the
1686
+ * character data of an element subtree. Used as the final safety net for
1687
+ * SAFE_FOR_TEMPLATES on every DOM-returning code path so that expressions
1688
+ * which only form after text-node normalization (e.g. fragments split across
1689
+ * stripped elements) cannot survive into a template-evaluating framework.
1690
+ *
1691
+ * Walks text/comment/CDATA/processing-instruction nodes and mutates `.data`
1692
+ * in place rather than round-tripping through innerHTML. This preserves
1693
+ * descendant node references (important for IN_PLACE callers), avoids a
1694
+ * serialize/reparse cycle, and reads literal character data — which means
1695
+ * `<%...%>` in text content matches the ERB regex against its real bytes
1696
+ * instead of the HTML-entity-escaped form innerHTML would produce.
1697
+ *
1698
+ * Attribute values are not visited here; SAFE_FOR_TEMPLATES handling for
1699
+ * attributes is performed during the per-node `_sanitizeAttributes` pass.
1700
+ *
1701
+ * @param node The root element whose character data should be scrubbed.
1702
+ */
1703
+ const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
1704
+ var _node$querySelectorAl;
1705
+ node.normalize();
1706
+ const walker = createNodeIterator.call(node.ownerDocument || node, node, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
1707
+ let currentNode = walker.nextNode();
1708
+ while (currentNode) {
1709
+ currentNode.data = _stripTemplateExpressions(currentNode.data);
1710
+ currentNode = walker.nextNode();
1711
+ }
1712
+ const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
1713
+ if (templates) arrayForEach(templates, (tmpl) => {
1714
+ if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
1715
+ });
1716
+ };
1717
+ /**
1718
+ * _isClobbered
1719
+ *
1720
+ * Detect DOM-clobbering on HTMLFormElement nodes. Form is the only HTML
1721
+ * interface with [LegacyOverrideBuiltIns]; a descendant element with a
1722
+ * `name` attribute matching a prototype property shadows that property
1723
+ * on direct reads. We use this check at the IN_PLACE entry-point and
1724
+ * during attribute sanitization to refuse clobbered forms.
1725
+ *
1726
+ * @param element element to check for clobbering attacks
1727
+ * @return true if clobbered, false if safe
1728
+ */
1729
+ const _isClobbered = function _isClobbered(element) {
1730
+ const realTagName = getNodeName ? getNodeName(element) : null;
1731
+ if (typeof realTagName !== "string") return false;
1732
+ if (transformCaseFunc(realTagName) !== "form") return false;
1733
+ return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || element.nodeType !== getNodeType(element) || element.childNodes !== getChildNodes(element);
1734
+ };
1735
+ /**
1736
+ * Checks whether the given value is a DocumentFragment from any realm.
1737
+ *
1738
+ * The realm-independent replacement reads `nodeType` through the cached
1739
+ * Node.prototype getter and compares to the DOCUMENT_FRAGMENT_NODE
1740
+ * constant (11). nodeType is a numeric value resolved from the node's
1741
+ * internal slot, identical across realms for the same kind of node.
1742
+ *
1743
+ * @param value object to check
1744
+ * @return true if value is a DocumentFragment-shaped node from any realm
1745
+ */
1746
+ const _isDocumentFragment = function _isDocumentFragment(value) {
1747
+ if (!getNodeType || typeof value !== "object" || value === null) return false;
1748
+ try {
1749
+ return getNodeType(value) === NODE_TYPE.documentFragment;
1750
+ } catch (_) {
1751
+ return false;
1752
+ }
1753
+ };
1754
+ /**
1755
+ * Checks whether the given object is a DOM node, including nodes that
1756
+ * originate from a different window/realm (e.g. an iframe's
1757
+ * contentDocument). The previous `value instanceof Node` check was
1758
+ * realm-bound: nodes from a different window failed it, causing
1759
+ * sanitize() to silently stringify them and reset IN_PLACE to false,
1760
+ * returning the original node unsanitized. See GHSA-4w3q-35jp-p934.
1761
+ *
1762
+ * @param value object to check whether it's a DOM node
1763
+ * @return true if value is a DOM node from any realm
1764
+ */
1765
+ const _isNode = function _isNode(value) {
1766
+ if (!getNodeType || typeof value !== "object" || value === null) return false;
1767
+ try {
1768
+ return typeof getNodeType(value) === "number";
1769
+ } catch (_) {
1770
+ return false;
1771
+ }
1772
+ };
1773
+ function _executeHooks(hooks, currentNode, data) {
1774
+ if (hooks.length === 0) return;
1775
+ arrayForEach(hooks, (hook) => {
1776
+ hook.call(DOMPurify, currentNode, data, CONFIG);
1777
+ });
1778
+ }
1779
+ /**
1780
+ * Structural-threat checks that condemn a node regardless of the
1781
+ * allowlists: mXSS via namespace confusion, risky CSS construction,
1782
+ * processing instructions, markup-bearing comments. Pure predicate;
1783
+ * the caller removes. Check order is load-bearing.
1784
+ *
1785
+ * @param currentNode the node to inspect
1786
+ * @param tagName the node's transformCaseFunc'd tag name
1787
+ * @return true if the node must be removed
1788
+ */
1789
+ const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName) {
1790
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
1791
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) return true;
1792
+ if (currentNode.nodeType === NODE_TYPE.processingInstruction) return true;
1793
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) return true;
1794
+ return false;
1795
+ };
1796
+ /**
1797
+ * Handle a node whose tag is forbidden or not allowlisted: keep
1798
+ * allowed custom elements (false return exits _sanitizeElements
1799
+ * early - namespace/fallback checks and the afterSanitizeElements
1800
+ * hook are intentionally skipped for kept custom elements), else
1801
+ * hoist content per KEEP_CONTENT and remove.
1802
+ *
1803
+ * @param currentNode the disallowed node
1804
+ * @param tagName the node's transformCaseFunc'd tag name
1805
+ * @return true if the node was removed, false if kept
1806
+ */
1807
+ const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName) {
1808
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
1809
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
1810
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
1811
+ }
1812
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1813
+ const parentNode = getParentNode(currentNode);
1814
+ const childNodes = getChildNodes(currentNode);
1815
+ if (childNodes && parentNode) {
1816
+ const childCount = childNodes.length;
1817
+ for (let i = childCount - 1; i >= 0; --i) {
1818
+ const hoisted = IN_PLACE ? childNodes[i] : cloneNode(childNodes[i], true);
1819
+ parentNode.insertBefore(hoisted, getNextSibling(currentNode));
1820
+ }
1821
+ }
1822
+ }
1823
+ _forceRemove(currentNode);
1824
+ return true;
1825
+ };
1826
+ /**
1827
+ * _sanitizeElements
1828
+ *
1829
+ * @protect nodeName
1830
+ * @protect textContent
1831
+ * @protect removeChild
1832
+ * @param currentNode to check for permission to exist
1833
+ * @return true if node was killed, false if left alive
1834
+ */
1835
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
1836
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
1837
+ if (_isClobbered(currentNode)) {
1838
+ _forceRemove(currentNode);
1839
+ return true;
1840
+ }
1841
+ const tagName = transformCaseFunc(getNodeName ? getNodeName(currentNode) : currentNode.nodeName);
1842
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
1843
+ tagName,
1844
+ allowedTags: ALLOWED_TAGS
1845
+ });
1846
+ if (_isUnsafeNode(currentNode, tagName)) {
1847
+ _forceRemove(currentNode);
1848
+ return true;
1849
+ }
1850
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) return _sanitizeDisallowedNode(currentNode, tagName);
1851
+ if ((getNodeType ? getNodeType(currentNode) : currentNode.nodeType) === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
1852
+ _forceRemove(currentNode);
1853
+ return true;
1854
+ }
1855
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
1856
+ _forceRemove(currentNode);
1857
+ return true;
1858
+ }
1859
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
1860
+ const content = _stripTemplateExpressions(currentNode.textContent);
1861
+ if (currentNode.textContent !== content) {
1862
+ arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
1863
+ currentNode.textContent = content;
1864
+ }
1865
+ }
1866
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1867
+ return false;
1868
+ };
1869
+ /**
1870
+ * _isValidAttribute
1871
+ *
1872
+ * @param lcTag Lowercase tag name of containing element.
1873
+ * @param lcName Lowercase attribute name.
1874
+ * @param value Attribute value.
1875
+ * @return Returns true if `value` is valid, otherwise false.
1876
+ */
1877
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1878
+ if (FORBID_ATTR[lcName]) return false;
1879
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) return false;
1880
+ const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
1881
+ if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName));
1882
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName));
1883
+ else if (!nameIsPermitted) if (_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value)));
1884
+ else return false;
1885
+ else if (URI_SAFE_ATTRIBUTES[lcName]);
1886
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, "")));
1887
+ else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]);
1888
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, "")));
1889
+ else if (value) return false;
1890
+ return true;
1891
+ };
1892
+ const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, [
1893
+ "annotation-xml",
1894
+ "color-profile",
1895
+ "font-face",
1896
+ "font-face-format",
1897
+ "font-face-name",
1898
+ "font-face-src",
1899
+ "font-face-uri",
1900
+ "missing-glyph"
1901
+ ]);
1902
+ /**
1903
+ * _isBasicCustomElement
1904
+ * checks if at least one dash is included in tagName, and it's not the first char
1905
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1906
+ *
1907
+ * @param tagName name of the tag of the node to sanitize
1908
+ * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
1909
+ */
1910
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
1911
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
1912
+ };
1913
+ /**
1914
+ * Wrap an attribute value in the matching Trusted Types object when
1915
+ * the active policy requires it. Namespaced attributes pass through
1916
+ * unchanged (no TT support yet, see
1917
+ * https://bugs.chromium.org/p/chromium/issues/detail?id=1305293).
1918
+ *
1919
+ * @param lcTag lowercase tag name of the containing element
1920
+ * @param lcName lowercase attribute name
1921
+ * @param namespaceURI the attribute's namespace, if any
1922
+ * @param value the attribute value to wrap
1923
+ * @return the value, wrapped when Trusted Types demand it
1924
+ */
1925
+ const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value) {
1926
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI) switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1927
+ case "TrustedHTML": return _createTrustedHTML(value);
1928
+ case "TrustedScriptURL": return _createTrustedScriptURL(value);
1929
+ }
1930
+ return value;
1931
+ };
1932
+ /**
1933
+ * Write a modified attribute value back onto the element. On
1934
+ * success, re-probe for clobbering introduced by the new value and
1935
+ * remove the element when found; otherwise pop the removal entry
1936
+ * recorded by the earlier _removeAttribute (long-standing pairing
1937
+ * with the SANITIZE_NAMED_PROPS path - do not "fix" casually). On
1938
+ * failure, remove the attribute instead.
1939
+ *
1940
+ * @param currentNode the element carrying the attribute
1941
+ * @param name the attribute name as present on the element
1942
+ * @param namespaceURI the attribute's namespace, if any
1943
+ * @param value the new attribute value
1944
+ */
1945
+ const _setAttributeValue = function _setAttributeValue(currentNode, name, namespaceURI, value) {
1946
+ try {
1947
+ if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
1948
+ else currentNode.setAttribute(name, value);
1949
+ if (_isClobbered(currentNode)) _forceRemove(currentNode);
1950
+ else arrayPop(DOMPurify.removed);
1951
+ } catch (_) {
1952
+ _removeAttribute(name, currentNode);
1953
+ }
1954
+ };
1955
+ /**
1956
+ * _sanitizeAttributes
1957
+ *
1958
+ * @protect attributes
1959
+ * @protect nodeName
1960
+ * @protect removeAttribute
1961
+ * @protect setAttribute
1962
+ *
1963
+ * @param currentNode to sanitize
1964
+ */
1965
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1966
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
1967
+ const attributes = currentNode.attributes;
1968
+ if (!attributes || _isClobbered(currentNode)) return;
1969
+ const hookEvent = {
1970
+ attrName: "",
1971
+ attrValue: "",
1972
+ keepAttr: true,
1973
+ allowedAttributes: ALLOWED_ATTR,
1974
+ forceKeepAttr: void 0
1975
+ };
1976
+ let l = attributes.length;
1977
+ const lcTag = transformCaseFunc(currentNode.nodeName);
1978
+ while (l--) {
1979
+ const attr = attributes[l];
1980
+ const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
1981
+ const lcName = transformCaseFunc(name);
1982
+ const initValue = attrValue;
1983
+ let value = name === "value" ? initValue : stringTrim(initValue);
1984
+ hookEvent.attrName = lcName;
1985
+ hookEvent.attrValue = value;
1986
+ hookEvent.keepAttr = true;
1987
+ hookEvent.forceKeepAttr = void 0;
1988
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
1989
+ value = hookEvent.attrValue;
1990
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
1991
+ _removeAttribute(name, currentNode);
1992
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1993
+ }
1994
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
1995
+ _removeAttribute(name, currentNode);
1996
+ continue;
1997
+ }
1998
+ if (lcName === "attributename" && stringMatch(value, "href")) {
1999
+ _removeAttribute(name, currentNode);
2000
+ continue;
2001
+ }
2002
+ if (hookEvent.forceKeepAttr) continue;
2003
+ if (!hookEvent.keepAttr) {
2004
+ _removeAttribute(name, currentNode);
2005
+ continue;
2006
+ }
2007
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
2008
+ _removeAttribute(name, currentNode);
2009
+ continue;
2010
+ }
2011
+ if (SAFE_FOR_TEMPLATES) value = _stripTemplateExpressions(value);
2012
+ if (!_isValidAttribute(lcTag, lcName, value)) {
2013
+ _removeAttribute(name, currentNode);
2014
+ continue;
2015
+ }
2016
+ value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
2017
+ if (value !== initValue) _setAttributeValue(currentNode, name, namespaceURI, value);
2018
+ }
2019
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
2020
+ };
2021
+ /**
2022
+ * _sanitizeShadowDOM
2023
+ *
2024
+ * @param fragment to iterate over recursively
2025
+ */
2026
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
2027
+ let shadowNode = null;
2028
+ const shadowIterator = _createNodeIterator(fragment);
2029
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
2030
+ while (shadowNode = shadowIterator.nextNode()) {
2031
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
2032
+ _sanitizeElements(shadowNode);
2033
+ _sanitizeAttributes(shadowNode);
2034
+ if (_isDocumentFragment(shadowNode.content)) _sanitizeShadowDOM2(shadowNode.content);
2035
+ if ((getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType) === NODE_TYPE.element) {
2036
+ const innerSr = getShadowRoot(shadowNode);
2037
+ if (_isDocumentFragment(innerSr)) {
2038
+ _sanitizeAttachedShadowRoots(innerSr);
2039
+ _sanitizeShadowDOM2(innerSr);
2040
+ }
2041
+ }
2042
+ }
2043
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
2044
+ };
2045
+ /**
2046
+ * _sanitizeAttachedShadowRoots
2047
+ *
2048
+ * Walks `root` and feeds every attached shadow root we encounter into
2049
+ * the existing _sanitizeShadowDOM pipeline. The default node iterator
2050
+ * does not descend into shadow trees, so nodes inside an attached
2051
+ * shadow root would otherwise be skipped entirely.
2052
+ *
2053
+ * Two real input paths put attached shadow roots in front of us:
2054
+ * 1. IN_PLACE on a DOM node that already has shadow roots attached.
2055
+ * 2. DOM-node input where importNode(dirty, true) deep-clones the
2056
+ * shadow root because it was created with `clonable: true`.
2057
+ *
2058
+ * This pass runs once, up front, so the main iteration loop (and the
2059
+ * existing _sanitizeShadowDOM template-content recursion) stay
2060
+ * untouched — string-input paths are not affected.
2061
+ *
2062
+ * @param root the subtree root to walk for attached shadow roots
2063
+ */
2064
+ const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots(root) {
2065
+ const stack = [{
2066
+ node: root,
2067
+ shadow: null
2068
+ }];
2069
+ while (stack.length > 0) {
2070
+ const item = stack.pop();
2071
+ if (item.shadow) {
2072
+ _sanitizeShadowDOM2(item.shadow);
2073
+ continue;
2074
+ }
2075
+ const node = item.node;
2076
+ const isElement = (getNodeType ? getNodeType(node) : node.nodeType) === NODE_TYPE.element;
2077
+ const childNodes = getChildNodes(node);
2078
+ if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push({
2079
+ node: childNodes[i],
2080
+ shadow: null
2081
+ });
2082
+ if (isElement) {
2083
+ const rootName = getNodeName ? getNodeName(node) : null;
2084
+ if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
2085
+ const content = node.content;
2086
+ if (_isDocumentFragment(content)) stack.push({
2087
+ node: content,
2088
+ shadow: null
2089
+ });
2090
+ }
2091
+ }
2092
+ if (isElement) {
2093
+ const sr = getShadowRoot(node);
2094
+ if (_isDocumentFragment(sr)) stack.push({
2095
+ node: null,
2096
+ shadow: sr
2097
+ }, {
2098
+ node: sr,
2099
+ shadow: null
2100
+ });
2101
+ }
2102
+ }
2103
+ };
2104
+ DOMPurify.sanitize = function(dirty) {
2105
+ let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2106
+ let body = null;
2107
+ let importedNode = null;
2108
+ let currentNode = null;
2109
+ let returnNode = null;
2110
+ IS_EMPTY_INPUT = !dirty;
2111
+ if (IS_EMPTY_INPUT) dirty = "<!-->";
2112
+ if (typeof dirty !== "string" && !_isNode(dirty)) {
2113
+ dirty = stringifyValue(dirty);
2114
+ if (typeof dirty !== "string") throw typeErrorCreate("dirty is not a string, aborting");
2115
+ }
2116
+ if (!DOMPurify.isSupported) return dirty;
2117
+ if (SET_CONFIG) {
2118
+ ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
2119
+ ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
2120
+ } else _parseConfig(cfg);
2121
+ if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) ALLOWED_TAGS = clone(ALLOWED_TAGS);
2122
+ if (hooks.uponSanitizeAttribute.length > 0) ALLOWED_ATTR = clone(ALLOWED_ATTR);
2123
+ DOMPurify.removed = [];
2124
+ const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
2125
+ if (inPlace) {
2126
+ const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName;
2127
+ if (typeof nn === "string") {
2128
+ const tagName = transformCaseFunc(nn);
2129
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
2130
+ }
2131
+ if (_isClobbered(dirty)) throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
2132
+ try {
2133
+ _sanitizeAttachedShadowRoots(dirty);
2134
+ } catch (error) {
2135
+ _neutralizeRoot(dirty);
2136
+ throw error;
2137
+ }
2138
+ } else if (_isNode(dirty)) {
2139
+ body = _initDocument("<!---->");
2140
+ importedNode = body.ownerDocument.importNode(dirty, true);
2141
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode;
2142
+ else if (importedNode.nodeName === "HTML") body = importedNode;
2143
+ else body.appendChild(importedNode);
2144
+ _sanitizeAttachedShadowRoots(importedNode);
2145
+ } else {
2146
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
2147
+ body = _initDocument(dirty);
2148
+ if (!body) return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
2149
+ }
2150
+ if (body && FORCE_BODY) _forceRemove(body.firstChild);
2151
+ const nodeIterator = _createNodeIterator(inPlace ? dirty : body);
2152
+ try {
2153
+ while (currentNode = nodeIterator.nextNode()) {
2154
+ _sanitizeElements(currentNode);
2155
+ _sanitizeAttributes(currentNode);
2156
+ if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content);
2157
+ }
2158
+ } catch (error) {
2159
+ if (inPlace) _neutralizeRoot(dirty);
2160
+ throw error;
2161
+ }
2162
+ if (inPlace) {
2163
+ arrayForEach(DOMPurify.removed, (entry) => {
2164
+ if (entry.element) _neutralizeSubtree(entry.element);
2165
+ });
2166
+ if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(dirty);
2167
+ return dirty;
2168
+ }
2169
+ if (RETURN_DOM) {
2170
+ if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(body);
2171
+ if (RETURN_DOM_FRAGMENT) {
2172
+ returnNode = createDocumentFragment.call(body.ownerDocument);
2173
+ while (body.firstChild) returnNode.appendChild(body.firstChild);
2174
+ } else returnNode = body;
2175
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) returnNode = importNode.call(originalDocument, returnNode, true);
2176
+ return returnNode;
2177
+ }
2178
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
2179
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
2180
+ if (SAFE_FOR_TEMPLATES) serializedHTML = _stripTemplateExpressions(serializedHTML);
2181
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
2182
+ };
2183
+ DOMPurify.setConfig = function() {
2184
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2185
+ _parseConfig(cfg);
2186
+ SET_CONFIG = true;
2187
+ SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
2188
+ SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
2189
+ };
2190
+ DOMPurify.clearConfig = function() {
2191
+ CONFIG = null;
2192
+ SET_CONFIG = false;
2193
+ SET_CONFIG_ALLOWED_TAGS = null;
2194
+ SET_CONFIG_ALLOWED_ATTR = null;
2195
+ trustedTypesPolicy = defaultTrustedTypesPolicy;
2196
+ emptyHTML = "";
2197
+ };
2198
+ DOMPurify.isValidAttribute = function(tag, attr, value) {
2199
+ if (!CONFIG) _parseConfig({});
2200
+ const lcTag = transformCaseFunc(tag);
2201
+ const lcName = transformCaseFunc(attr);
2202
+ return _isValidAttribute(lcTag, lcName, value);
2203
+ };
2204
+ DOMPurify.addHook = function(entryPoint, hookFunction) {
2205
+ if (typeof hookFunction !== "function") return;
2206
+ if (!objectHasOwnProperty(hooks, entryPoint)) return;
2207
+ arrayPush(hooks[entryPoint], hookFunction);
2208
+ };
2209
+ DOMPurify.removeHook = function(entryPoint, hookFunction) {
2210
+ if (!objectHasOwnProperty(hooks, entryPoint)) return;
2211
+ if (hookFunction !== void 0) {
2212
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
2213
+ return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
2214
+ }
2215
+ return arrayPop(hooks[entryPoint]);
2216
+ };
2217
+ DOMPurify.removeHooks = function(entryPoint) {
2218
+ if (!objectHasOwnProperty(hooks, entryPoint)) return;
2219
+ hooks[entryPoint] = [];
2220
+ };
2221
+ DOMPurify.removeAllHooks = function() {
2222
+ hooks = _createHooksMap();
2223
+ };
2224
+ return DOMPurify;
2225
+ }
2226
+ createDOMPurify();
2227
+ //#endregion
2228
+ //#region ../utils/dist/index.js
2229
+ var __defProp = Object.defineProperty;
2230
+ var __exportAll = (all, no_symbols) => {
2231
+ let target = {};
2232
+ for (var name in all) __defProp(target, name, {
2233
+ get: all[name],
2234
+ enumerable: true
2235
+ });
2236
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
2237
+ return target;
2238
+ };
2239
+ /**
2240
+ * Uppercases first letter of string
2241
+ * @param string to be capitalized first string, e.g. "workflow"
2242
+ * @return Capitalized String, e.g. "Workflow"
2243
+ */
2244
+ var capitalize = (input) => input.charAt(0).toUpperCase() + input.substring(1);
2245
+ Object.assign({}, ...[
2246
+ {
2247
+ id: "search",
2248
+ normalize(searchTerm, caseSensitiveSearch) {
2249
+ return caseSensitiveSearch ? searchTerm : searchTerm.toLowerCase();
2250
+ },
2251
+ test(text, normalizedSearchTerm, caseSensitiveSearch, inverseSearch) {
2252
+ const matches = (caseSensitiveSearch ? text : text.toLowerCase()).includes(normalizedSearchTerm);
2253
+ return inverseSearch ? !matches : matches;
2254
+ }
2255
+ },
2256
+ {
2257
+ id: "wildcard",
2258
+ normalize(searchTerm, caseSensitiveSearch) {
2259
+ if (searchTerm.length > 0) searchTerm = `^${searchTerm.replace(/[-[\]{}()+.,\\^$|#\s]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".?")}$`;
2260
+ else return { test: () => false };
2261
+ try {
2262
+ return new RegExp(searchTerm, caseSensitiveSearch ? "" : "i");
2263
+ } catch (_error) {
2264
+ return /$^/;
2265
+ }
2266
+ },
2267
+ test(text, normalizedSearchTerm, caseSensitiveSearch, inverseSearch) {
2268
+ const matches = normalizedSearchTerm.test(text);
2269
+ return inverseSearch ? !matches : matches;
2270
+ }
2271
+ },
2272
+ {
2273
+ id: "regex",
2274
+ normalize(searchTerm, caseSensitiveSearch) {
2275
+ try {
2276
+ const flags = caseSensitiveSearch ? "" : "i";
2277
+ return new RegExp(`^(${searchTerm})$`, flags);
2278
+ } catch (_error) {
2279
+ return /$^/;
2280
+ }
2281
+ },
2282
+ test(text, normalizedSearchTerm, caseSensitiveSearch, inverseSearch) {
2283
+ const matches = normalizedSearchTerm.test(text);
2284
+ return inverseSearch ? !matches : matches;
2285
+ }
2286
+ },
2287
+ {
2288
+ id: "type",
2289
+ normalize(selectedTypes) {
2290
+ return { test: (type) => selectedTypes.includes(type) };
2291
+ },
2292
+ test(type, normalizedSearchTerm) {
2293
+ if (typeof type === "undefined") return false;
2294
+ return normalizedSearchTerm.test(type);
2295
+ }
2296
+ }
2297
+ ].map((obj) => ({ [obj.id]: obj })));
2298
+ /**
2299
+ * Get the users local timezone.
2300
+ *
2301
+ * @returns current users timezone (browser based) tz db string (e. g. Europe/Berlin).
2302
+ */
2303
+ var localTimezone_default = () => Intl.DateTimeFormat().resolvedOptions().timeZone;
2304
+ /**
2305
+ * Converts the specified date String to human readable text containing the day, month, and year.
2306
+ * Example: '2018-07-31T09:44:31+00:00' => 'Jul 31, 2018'
2307
+ *
2308
+ * @param dateString String representation of the Date to format
2309
+ * @param useTimeZone to set the timeZone where the user is located, and display local date and time
2310
+ * @returns human readable date String
2311
+ */
2312
+ var formatDateString = (dateString, useTimeZone = false) => {
2313
+ const date = new Date(dateString);
2314
+ if (isNaN(date)) throw Error("Invalid Date format");
2315
+ const baseDateOptions = {
2316
+ day: "numeric",
2317
+ month: "short",
2318
+ year: "numeric"
2319
+ };
2320
+ const dateOptions = useTimeZone ? {
2321
+ ...baseDateOptions,
2322
+ timeZone: localTimezone_default()
2323
+ } : baseDateOptions;
2324
+ return date.toLocaleDateString("en-US", dateOptions);
2325
+ };
2326
+ /**
2327
+ * Converts the specified time String to human readable text containing the hour (12-hour) and minute.
2328
+ * Example: '2018-07-31T09:44:31+00:00' => '9:44 AM'
2329
+ *
2330
+ * @param timeString String representation of the Date (including time) to format
2331
+ * @param useTimeZone to set the timeZone where the user is located, and display local date and time
2332
+ * @returns human readable time String
2333
+ */
2334
+ var formatTimeString = (timeString, useTimeZone = false) => {
2335
+ const time = new Date(timeString);
2336
+ if (isNaN(time)) throw Error("Invalid Date format");
2337
+ const baseTimeOptions = {
2338
+ hour: "numeric",
2339
+ minute: "2-digit"
2340
+ };
2341
+ const timeOptions = useTimeZone ? {
2342
+ ...baseTimeOptions,
2343
+ timeZone: localTimezone_default()
2344
+ } : baseTimeOptions;
2345
+ return time.toLocaleTimeString("en-US", timeOptions);
2346
+ };
2347
+ /**
2348
+ * Converts the specified time String to human readable text containing the date (day, month, year) and time (hour,
2349
+ * minute; 12-hour).
2350
+ * Example: '2018-07-31T09:44:31+00:00' => 'Jul 31, 2018 9:44 AM'
2351
+ *
2352
+ * @param dateTimeString String representation of the Date (including time and date) to format
2353
+ * @param useTimeZone to set the timeZone where the user is located, and display local date and time
2354
+ * @returns human readable date/time String
2355
+ */
2356
+ var formatDateTimeString = (dateTimeString, useTimeZone = false) => {
2357
+ return `${formatDateString(dateTimeString, useTimeZone)} ${formatTimeString(dateTimeString, useTimeZone)}`;
2358
+ };
2359
+ /**
2360
+ * Converts the specified date and time to the user time zone with option to display (day, month, year) only or with time (hour,
2361
+ * minute; 12-hour).
2362
+ *
2363
+ * @param showTime String representation of the Date to convert and format
2364
+ * @param String | number} date String representation of the Date to convert and format
2365
+ * @returns human readable date/time String converted to user time zone
2366
+ */
2367
+ var formatLocalDateTimeString = (date, showTime) => showTime ? formatDateTimeString(date, true) : formatDateString(date, true);
2368
+ var formatFileSize = (bytes) => {
2369
+ return prettyBytes(Number.isFinite(bytes) && bytes >= 0 ? bytes : 0);
2370
+ };
2371
+ var yearsPart = "(\\d+)\\s*y(?:ears?)?";
2372
+ var monthsPart = "(\\d+)\\s*m(?:o(?:nths?)?)?";
2373
+ var weeksPart = "(\\d+)\\s*w(?:eeks?)?";
2374
+ var daysPart = "(\\d+)\\s*d(?:ays?)?";
2375
+ var hoursPart = "(\\d+)\\s*h(?:ours?)?";
2376
+ var minutesPart = "(\\d+)\\s*m(?:in(?:s|utes?)?)?";
2377
+ var secondsPart = "(\\d+)(?:[,.](\\d{1,3}))?\\s*s(?:ec(?:s|onds?)?)?";
2378
+ /**
2379
+ * Matches a human readable period string, e.g. "1y 2mo 3weeks 4day" (each part is optional)
2380
+ */
2381
+ var humanReadablePeriodRegex = new RegExp(`^(?:${yearsPart})?\\s*(?:${monthsPart})?\\s*(?:${weeksPart})?\\s*(?:${daysPart})?\\s*$`, "i");
2382
+ /**
2383
+ * Matches a human readable duration string, e.g. "1h 2m 3.456s" (each part is optional)
2384
+ */
2385
+ var humanReadableDurationRegex = new RegExp(`^(?:${hoursPart})?\\s*(?:${minutesPart})?\\s*(?:${secondsPart})?$`, "i");
2386
+ new RegExp(`^\\s*-\\s*\\(\\s*${humanReadablePeriodRegex.source.replace(/[$^]/g, "")}\\s*\\)\\s*$`, "i");
2387
+ new RegExp(`^\\s*-\\s*(?:\\s*${yearsPart}|${monthsPart}|${weeksPart}|${daysPart})\\s*$`, "i");
2388
+ new RegExp(`^\\s*-\\s*\\(\\s*${humanReadableDurationRegex.source.replace(/[$^]/g, "")}\\s*\\)\\s*$`, "i");
2389
+ new RegExp(`^\\s*-\\s*(?:\\s*${hoursPart}|${minutesPart}|${secondsPart})\\s*$`, "i");
2390
+ var AbortError = class extends Error {};
2391
+ /**
2392
+ * Helper to create an abortable promise. Returns an AbortController and a Function
2393
+ * that you can pass your async handler to. Whenever the AbortController signal is
2394
+ * aborted then the async handler's promise will reject with an AbortError
2395
+ *
2396
+ * Example:
2397
+ * ```
2398
+ * import { abortUtils } from "@knime/utils"
2399
+ * const myFetchCall = async (params...) => {...};
2400
+ *
2401
+ * try {
2402
+ * const { runAbortablePromise, abortController } = createAbortablePromise(() =>
2403
+ * myFetchCall(params...),
2404
+ * );
2405
+ * } catch (e) {
2406
+ * if (e instanceof abortUtils.AbortError) {
2407
+ * console.info('ignore due to abort');
2408
+ * return;
2409
+ * }
2410
+ * }
2411
+ *
2412
+ * // somewhere else (while request is in-flight)
2413
+ * abortController.abort(new abortUtils.AbortError('reason here'))
2414
+ * ```
2415
+ */
2416
+ var createAbortablePromise = () => {
2417
+ const abortController = new AbortController();
2418
+ const runAbortablePromise = (request) => {
2419
+ return new Promise((resolve, reject) => {
2420
+ const abortListener = ({ target }) => {
2421
+ abortController.signal.removeEventListener("abort", abortListener);
2422
+ const reason = target.reason;
2423
+ reject(reason instanceof AbortError ? reason : new AbortError(reason));
2424
+ };
2425
+ request().then(resolve).catch((error) => {
2426
+ if (error instanceof AbortError) return;
2427
+ reject(error);
2428
+ });
2429
+ abortController.signal.addEventListener("abort", abortListener);
2430
+ });
2431
+ };
2432
+ return {
2433
+ abortController,
2434
+ runAbortablePromise
2435
+ };
2436
+ };
2437
+ var createUnwrappedPromise = () => {
2438
+ let resolve = () => {};
2439
+ let reject = () => {};
2440
+ const promise = new Promise((res, rej) => {
2441
+ resolve = res;
2442
+ reject = rej;
2443
+ });
2444
+ return {
2445
+ resolve,
2446
+ reject,
2447
+ promise
2448
+ };
2449
+ };
2450
+ /**
2451
+ * Returns promise that resolves after ms.
2452
+ */
2453
+ function sleep(ms) {
2454
+ return new Promise((resolve) => setTimeout(resolve, ms));
2455
+ }
2456
+ /**
2457
+ * Helper to add retry capability to an async function
2458
+ * @param fn async function
2459
+ * @param retryCount max number of retries. defaults to 5
2460
+ * @param retryDelayMS delay in-between retries in millisecs. defaults to 0
2461
+ * @param excludeError predicate fn to exclude specific errors from causing a retry
2462
+ */
2463
+ async function retryPromise({ fn, retryCount = 5, retryDelayMS = 0, excludeError }) {
2464
+ try {
2465
+ return await fn();
2466
+ } catch (error) {
2467
+ if (excludeError?.(error)) throw error;
2468
+ if (retryCount > 0) {
2469
+ await sleep(retryDelayMS);
2470
+ return await retryPromise({
2471
+ fn,
2472
+ retryCount: retryCount - 1,
2473
+ retryDelayMS,
2474
+ excludeError
2475
+ });
2476
+ }
2477
+ throw error;
2478
+ }
2479
+ }
2480
+ var promise_exports = /* @__PURE__ */ __exportAll({
2481
+ AbortError: () => AbortError,
2482
+ DEFAULT_RETRY_COUNT: () => 5,
2483
+ DEFAULT_RETRY_DELAY_MS: () => 0,
2484
+ createAbortablePromise: () => createAbortablePromise,
2485
+ createUnwrappedPromise: () => createUnwrappedPromise,
2486
+ retryPromise: () => retryPromise
2487
+ });
2488
+ var defaultMaxLength = 160;
2489
+ var truncateString_default = (string = "", maxLength = defaultMaxLength) => {
2490
+ const dots = string.length > maxLength ? "…" : "";
2491
+ return `${string.substring(0, maxLength - 1)}${dots}`;
2492
+ };
2493
+ /**
2494
+ * Gets the file extension
2495
+ * @param nameOrPath can take a full file name (e.g "file.txt") or a path to a file
2496
+ * (e.g "file://path/to/file.txt" OR "/path/to/file.txt")
2497
+ * @returns just the file extension (e.g "txt")
2498
+ */
2499
+ var getFileExtension = (nameOrPath) => {
2500
+ const basename = nameOrPath.split(/[\\/]/).pop() ?? "";
2501
+ const parts = basename.split(".");
2502
+ if (basename === "" || parts.length === 1) return "";
2503
+ return parts.at(-1) ?? "";
2504
+ };
2505
+ /**
2506
+ * Metadata for .knar files, which corresponds to exported KNIME Workflow Groups
2507
+ * or Components
2508
+ */
2509
+ var KNAR = Object.freeze({
2510
+ extension: "knar",
2511
+ mimeType: "application/vnd.knime.workflow-group+zip",
2512
+ matches(file) {
2513
+ return getFileExtension(file.name) === this.extension;
2514
+ }
2515
+ });
2516
+ /**
2517
+ * Metadata for .knwf files, which corresponds to exported KNIME Workflows
2518
+ */
2519
+ var KNWF = Object.freeze({
2520
+ extension: "knwf",
2521
+ mimeType: "application/vnd.knime.workflow+zip",
2522
+ matches(file) {
2523
+ return getFileExtension(file.name) === this.extension;
2524
+ },
2525
+ /**
2526
+ * Gets the name of a .knwf file without the extension. If the file is not
2527
+ * matched as a .knwf file then this function will return the default value,
2528
+ * which is empty string ("") if param is not provided
2529
+ */
2530
+ getNameOrDefault(file, defaultValue = "") {
2531
+ if (!this.matches(file)) return defaultValue;
2532
+ return file.name.replace(`.${this.extension}`, "");
2533
+ }
2534
+ });
2535
+ var knimeFileFormats = {
2536
+ KNAR,
2537
+ KNWF
2538
+ };
2539
+ /**
2540
+ * Gets the mime type from a given file. Defaults to `application/octet-stream`
2541
+ * if mimeType cannot be detected
2542
+ * @param file File
2543
+ * @returns mimeType
2544
+ */
2545
+ var getFileMimeType = (file) => {
2546
+ const DEFAULT_MIMETYPE = "application/octet-stream";
2547
+ if (!getFileExtension(file.name)) return DEFAULT_MIMETYPE;
2548
+ if (KNWF.matches(file)) return KNWF.mimeType;
2549
+ if (KNAR.matches(file)) return KNAR.mimeType;
2550
+ if (!file.type) return DEFAULT_MIMETYPE;
2551
+ return file.type;
2552
+ };
2553
+ Object.values({
2554
+ MAC_OS: "macOS",
2555
+ OTHER: "other"
2556
+ });
2557
+ //#endregion
2558
+ export { getFileExtension as a, promise_exports as c, formatLocalDateTimeString as i, sleep as l, formatDateTimeString as n, getFileMimeType as o, formatFileSize as r, knimeFileFormats as s, capitalize as t, truncateString_default as u };
2559
+
2560
+ //# sourceMappingURL=dist-BrNh9vG-.js.map