@knime/kds-components 2.7.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/KdsIcon-VyfE1YXh.js +596 -0
- package/dist/KdsIcon-VyfE1YXh.js.map +1 -0
- package/dist/KdsIcon.css +64 -0
- package/dist/{KdsPopover-DBU9xVEK.js → KdsPopover-FOQyEkHj.js} +3 -9
- package/dist/{KdsPopover-DBU9xVEK.js.map → KdsPopover-FOQyEkHj.js.map} +1 -1
- package/dist/_plugin-vue_export-helper-BOaGB7Aw.js +8 -0
- package/dist/{collection-set-datatype-CjK0E8Js.js → collection-set-datatype-DUmEUGg4.js} +2 -2
- package/dist/{collection-set-datatype-CjK0E8Js.js.map → collection-set-datatype-DUmEUGg4.js.map} +1 -1
- package/dist/index.css +632 -15
- package/dist/index.js +4009 -579
- package/dist/index.js.map +1 -1
- package/dist/src/components/forms/inputs/SearchInput/KdsSearchInput.vue.d.ts.map +1 -1
- package/dist/src/components/lists/ListContainer/KdsListContainer.vue.d.ts.map +1 -1
- package/dist/src/components/lists/ListContainer/types.d.ts +0 -5
- package/dist/src/components/lists/ListContainer/types.d.ts.map +1 -1
- package/dist/src/components/lists/MenuContainer/KdsMenuContainer.vue.d.ts.map +1 -1
- package/dist/src/components/lists/MenuContainer/types.d.ts +0 -5
- package/dist/src/components/lists/MenuContainer/types.d.ts.map +1 -1
- package/package.json +6 -3
- package/dist/overlays-Bai-I-gc.js +0 -3953
- package/dist/overlays-Bai-I-gc.js.map +0 -1
- package/dist/overlays.css +0 -681
- package/dist/src/util/types.d.ts +0 -20
- package/dist/src/util/types.d.ts.map +0 -1
- package/dist/src/util/useListItemKeyboardNav.d.ts +0 -32
- package/dist/src/util/useListItemKeyboardNav.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { a as kdsPopoverRole, c as kdsPopoverTypes, i as kdsPopoverPlacements, l as
|
|
2
|
-
import {
|
|
1
|
+
import { a as kdsPopoverRole, c as kdsPopoverTypes, i as kdsPopoverPlacements, l as __exportAll$1, o as kdsPopoverRoles, r as kdsPopoverPlacement, s as kdsPopoverType, t as KdsPopover_default } from "./KdsPopover-FOQyEkHj.js";
|
|
2
|
+
import { a as useKdsIsTruncated, i as elementOverflowsHorizontally, n as useIcon, r as vKdsTooltip, t as KdsIcon_default } from "./KdsIcon-VyfE1YXh.js";
|
|
3
|
+
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BOaGB7Aw.js";
|
|
3
4
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createPropsRestProxy, createSlots, createTextVNode, createVNode, defineAsyncComponent, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, isRef, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, onUnmounted, openBlock, provide, readonly, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, toRefs, unref, useAttrs, useCssVars, useId, useModel, useSlots, useTemplateRef, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
4
5
|
import { onClickOutside, useDark, useElementSize, useLocalStorage, useMousePressed, usePreferredDark, useResizeObserver, useTemplateRefsList, useVirtualList } from "@vueuse/core";
|
|
5
6
|
import './index.css';//#region src/components/accessories/Avatar/enums.ts
|
|
@@ -12,14 +13,14 @@ var kdsAvatarSize = {
|
|
|
12
13
|
var kdsAvatarSizes = Object.values(kdsAvatarSize);
|
|
13
14
|
//#endregion
|
|
14
15
|
//#region src/components/accessories/Avatar/KdsAvatar.vue?vue&type=script&setup=true&lang.ts
|
|
15
|
-
var _hoisted_1$
|
|
16
|
+
var _hoisted_1$79 = [
|
|
16
17
|
"role",
|
|
17
18
|
"aria-hidden",
|
|
18
19
|
"aria-label",
|
|
19
20
|
"data-color"
|
|
20
21
|
];
|
|
21
|
-
var _hoisted_2$
|
|
22
|
-
var _hoisted_3$
|
|
22
|
+
var _hoisted_2$48 = ["src"];
|
|
23
|
+
var _hoisted_3$34 = {
|
|
23
24
|
key: 1,
|
|
24
25
|
class: "kds-avatar-initials",
|
|
25
26
|
"aria-hidden": "true"
|
|
@@ -79,15 +80,15 @@ var KdsAvatar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
|
|
|
79
80
|
alt: "",
|
|
80
81
|
"aria-hidden": "true",
|
|
81
82
|
onError: onImageError
|
|
82
|
-
}, null, 40, _hoisted_2$
|
|
83
|
+
}, null, 40, _hoisted_2$48)) : (openBlock(), createElementBlock("div", _hoisted_3$34, [createElementVNode("span", null, toDisplayString(displayedInitials.value), 1)]))], 10, _hoisted_1$79)), [[unref(vKdsTooltip), hasTitle.value ? accessibleTitle.value : void 0]]);
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
86
|
}), [["__scopeId", "data-v-1cc8bb54"]]);
|
|
86
87
|
//#endregion
|
|
87
88
|
//#region src/components/accessories/Avatar/KdsAvatarCounter.vue?vue&type=script&setup=true&lang.ts
|
|
88
|
-
var _hoisted_1$
|
|
89
|
-
var _hoisted_2$
|
|
90
|
-
var _hoisted_3$
|
|
89
|
+
var _hoisted_1$78 = ["aria-label"];
|
|
90
|
+
var _hoisted_2$47 = { class: "avatars" };
|
|
91
|
+
var _hoisted_3$33 = {
|
|
91
92
|
key: 0,
|
|
92
93
|
class: "more-count",
|
|
93
94
|
"aria-hidden": "true"
|
|
@@ -117,7 +118,7 @@ var KdsAvatarCounter_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
|
|
|
117
118
|
class: "kds-avatar-counter",
|
|
118
119
|
role: "group",
|
|
119
120
|
"aria-label": ariaLabel.value
|
|
120
|
-
}, [createElementVNode("div", _hoisted_2$
|
|
121
|
+
}, [createElementVNode("div", _hoisted_2$47, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.avatars, (avatar, index) => {
|
|
121
122
|
return openBlock(), createBlock(KdsAvatar_default, {
|
|
122
123
|
key: index,
|
|
123
124
|
"aria-hidden": "true",
|
|
@@ -134,7 +135,7 @@ var KdsAvatarCounter_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
|
|
|
134
135
|
"tooltip",
|
|
135
136
|
"src"
|
|
136
137
|
]);
|
|
137
|
-
}), 128))]), __props.moreCount > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
138
|
+
}), 128))]), __props.moreCount > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$33, " +" + toDisplayString(__props.moreCount), 1)) : createCommentVNode("", true)], 8, _hoisted_1$78);
|
|
138
139
|
};
|
|
139
140
|
}
|
|
140
141
|
}), [["__scopeId", "data-v-ac6925b6"]]);
|
|
@@ -482,7 +483,7 @@ var kdsDataTypeSize = {
|
|
|
482
483
|
var kdsDataTypeSizes = Object.values(kdsDataTypeSize);
|
|
483
484
|
//#endregion
|
|
484
485
|
//#region src/components/accessories/Icon/KdsDataType.vue?vue&type=script&setup=true&lang.ts
|
|
485
|
-
var _hoisted_1$
|
|
486
|
+
var _hoisted_1$77 = ["data-kds-icon-name"];
|
|
486
487
|
//#endregion
|
|
487
488
|
//#region src/components/accessories/Icon/KdsDataType.vue
|
|
488
489
|
var KdsDataType_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
@@ -539,7 +540,7 @@ var KdsDataType_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
|
|
|
539
540
|
]),
|
|
540
541
|
"aria-hidden": "true",
|
|
541
542
|
focusable: "false"
|
|
542
|
-
}, null, 8, ["class"]))], 10, _hoisted_1$
|
|
543
|
+
}, null, 8, ["class"]))], 10, _hoisted_1$77)), [[unref(vKdsTooltip), __props.iconTitle]]);
|
|
543
544
|
};
|
|
544
545
|
}
|
|
545
546
|
}), [["__scopeId", "data-v-c908ab99"]]);
|
|
@@ -561,7 +562,7 @@ var kdsBadgeSize = {
|
|
|
561
562
|
var kdsBadgeSizes = Object.values(kdsBadgeSize);
|
|
562
563
|
//#endregion
|
|
563
564
|
//#region src/components/accessories/Badge/KdsBadge.vue?vue&type=script&setup=true&lang.ts
|
|
564
|
-
var _hoisted_1$
|
|
565
|
+
var _hoisted_1$76 = { class: "label-wrapper" };
|
|
565
566
|
//#endregion
|
|
566
567
|
//#region src/components/accessories/Badge/KdsBadge.vue
|
|
567
568
|
var KdsBadge_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
@@ -586,7 +587,7 @@ var KdsBadge_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
|
|
|
586
587
|
key: 0,
|
|
587
588
|
name: __props.leadingIcon,
|
|
588
589
|
size: sizeToIconSize[__props.size]
|
|
589
|
-
}, null, 8, ["name", "size"])) : createCommentVNode("", true), createElementVNode("span", _hoisted_1$
|
|
590
|
+
}, null, 8, ["name", "size"])) : createCommentVNode("", true), createElementVNode("span", _hoisted_1$76, toDisplayString(__props.label), 1)], 2);
|
|
590
591
|
};
|
|
591
592
|
}
|
|
592
593
|
}), [["__scopeId", "data-v-ed7689bb"]]);
|
|
@@ -6583,7 +6584,7 @@ var kdsColorSwatchSize = {
|
|
|
6583
6584
|
var kdsColorSwatchSizes = Object.values(kdsColorSwatchSize);
|
|
6584
6585
|
//#endregion
|
|
6585
6586
|
//#region src/components/accessories/ColorSwatch/KdsColorSwatch.vue?vue&type=script&setup=true&lang.ts
|
|
6586
|
-
var _hoisted_1$
|
|
6587
|
+
var _hoisted_1$75 = [
|
|
6587
6588
|
"role",
|
|
6588
6589
|
"aria-hidden",
|
|
6589
6590
|
"aria-label"
|
|
@@ -6658,7 +6659,7 @@ var KdsColorSwatch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
6658
6659
|
style: normalizeStyle(swatchStyle.value),
|
|
6659
6660
|
"aria-hidden": hasTitle.value ? void 0 : "true",
|
|
6660
6661
|
"aria-label": hasTitle.value ? accessibleTitle.value : void 0
|
|
6661
|
-
}, null, 14, _hoisted_1$
|
|
6662
|
+
}, null, 14, _hoisted_1$75)), [[unref(vKdsTooltip), hasTitle.value ? accessibleTitle.value : void 0]]);
|
|
6662
6663
|
};
|
|
6663
6664
|
}
|
|
6664
6665
|
}), [["__scopeId", "data-v-2f562103"]]);
|
|
@@ -6668,17 +6669,17 @@ var PORT_SIZE = 8;
|
|
|
6668
6669
|
var PORT_STROKE_WIDTH = 1.4;
|
|
6669
6670
|
//#endregion
|
|
6670
6671
|
//#region src/components/accessories/PortIcon/KdsPortIcon.vue?vue&type=script&setup=true&lang.ts
|
|
6671
|
-
var _hoisted_1$
|
|
6672
|
+
var _hoisted_1$74 = [
|
|
6672
6673
|
"points",
|
|
6673
6674
|
"data-type",
|
|
6674
6675
|
"stroke-width"
|
|
6675
6676
|
];
|
|
6676
|
-
var _hoisted_2$
|
|
6677
|
+
var _hoisted_2$46 = [
|
|
6677
6678
|
"r",
|
|
6678
6679
|
"data-type",
|
|
6679
6680
|
"stroke-width"
|
|
6680
6681
|
];
|
|
6681
|
-
var _hoisted_3$
|
|
6682
|
+
var _hoisted_3$32 = [
|
|
6682
6683
|
"width",
|
|
6683
6684
|
"height",
|
|
6684
6685
|
"x",
|
|
@@ -6738,13 +6739,13 @@ var KdsPortIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
|
|
|
6738
6739
|
class: normalizeClass({ optional: __props.optional }),
|
|
6739
6740
|
"data-type": __props.type,
|
|
6740
6741
|
"stroke-width": unref(PORT_STROKE_WIDTH)
|
|
6741
|
-
}, null, 10, _hoisted_1$
|
|
6742
|
+
}, null, 10, _hoisted_1$74)) : __props.type === "flowVariable" ? (openBlock(), createElementBlock("circle", {
|
|
6742
6743
|
key: 1,
|
|
6743
6744
|
r: unref(8) / 2 - unref(PORT_STROKE_WIDTH) / 2,
|
|
6744
6745
|
class: normalizeClass({ optional: __props.optional }),
|
|
6745
6746
|
"data-type": __props.type,
|
|
6746
6747
|
"stroke-width": unref(PORT_STROKE_WIDTH)
|
|
6747
|
-
}, null, 10, _hoisted_2$
|
|
6748
|
+
}, null, 10, _hoisted_2$46)) : (openBlock(), createElementBlock("rect", {
|
|
6748
6749
|
key: 2,
|
|
6749
6750
|
width: unref(8) - unref(PORT_STROKE_WIDTH),
|
|
6750
6751
|
height: unref(8) - unref(PORT_STROKE_WIDTH),
|
|
@@ -6753,7 +6754,7 @@ var KdsPortIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
|
|
|
6753
6754
|
class: normalizeClass({ optional: __props.optional }),
|
|
6754
6755
|
"data-type": __props.type,
|
|
6755
6756
|
"stroke-width": unref(PORT_STROKE_WIDTH)
|
|
6756
|
-
}, null, 10, _hoisted_3$
|
|
6757
|
+
}, null, 10, _hoisted_3$32))]),
|
|
6757
6758
|
_: 1
|
|
6758
6759
|
}, 16);
|
|
6759
6760
|
};
|
|
@@ -6769,415 +6770,3861 @@ var kdsPortType = {
|
|
|
6769
6770
|
};
|
|
6770
6771
|
var kdsPortTypes = Object.values(kdsPortType);
|
|
6771
6772
|
//#endregion
|
|
6773
|
+
//#region ../../node_modules/.pnpm/pretty-bytes@7.1.0/node_modules/pretty-bytes/index.js
|
|
6774
|
+
var BYTE_UNITS = [
|
|
6775
|
+
"B",
|
|
6776
|
+
"kB",
|
|
6777
|
+
"MB",
|
|
6778
|
+
"GB",
|
|
6779
|
+
"TB",
|
|
6780
|
+
"PB",
|
|
6781
|
+
"EB",
|
|
6782
|
+
"ZB",
|
|
6783
|
+
"YB"
|
|
6784
|
+
];
|
|
6785
|
+
var BIBYTE_UNITS = [
|
|
6786
|
+
"B",
|
|
6787
|
+
"KiB",
|
|
6788
|
+
"MiB",
|
|
6789
|
+
"GiB",
|
|
6790
|
+
"TiB",
|
|
6791
|
+
"PiB",
|
|
6792
|
+
"EiB",
|
|
6793
|
+
"ZiB",
|
|
6794
|
+
"YiB"
|
|
6795
|
+
];
|
|
6796
|
+
var BIT_UNITS = [
|
|
6797
|
+
"b",
|
|
6798
|
+
"kbit",
|
|
6799
|
+
"Mbit",
|
|
6800
|
+
"Gbit",
|
|
6801
|
+
"Tbit",
|
|
6802
|
+
"Pbit",
|
|
6803
|
+
"Ebit",
|
|
6804
|
+
"Zbit",
|
|
6805
|
+
"Ybit"
|
|
6806
|
+
];
|
|
6807
|
+
var BIBIT_UNITS = [
|
|
6808
|
+
"b",
|
|
6809
|
+
"kibit",
|
|
6810
|
+
"Mibit",
|
|
6811
|
+
"Gibit",
|
|
6812
|
+
"Tibit",
|
|
6813
|
+
"Pibit",
|
|
6814
|
+
"Eibit",
|
|
6815
|
+
"Zibit",
|
|
6816
|
+
"Yibit"
|
|
6817
|
+
];
|
|
6818
|
+
var toLocaleString = (number, locale, options) => {
|
|
6819
|
+
let result = number;
|
|
6820
|
+
if (typeof locale === "string" || Array.isArray(locale)) result = number.toLocaleString(locale, options);
|
|
6821
|
+
else if (locale === true || options !== void 0) result = number.toLocaleString(void 0, options);
|
|
6822
|
+
return result;
|
|
6823
|
+
};
|
|
6824
|
+
var log10 = (numberOrBigInt) => {
|
|
6825
|
+
if (typeof numberOrBigInt === "number") return Math.log10(numberOrBigInt);
|
|
6826
|
+
const string = numberOrBigInt.toString(10);
|
|
6827
|
+
return string.length + Math.log10(`0.${string.slice(0, 15)}`);
|
|
6828
|
+
};
|
|
6829
|
+
var log = (numberOrBigInt) => {
|
|
6830
|
+
if (typeof numberOrBigInt === "number") return Math.log(numberOrBigInt);
|
|
6831
|
+
return log10(numberOrBigInt) * Math.log(10);
|
|
6832
|
+
};
|
|
6833
|
+
var divide = (numberOrBigInt, divisor) => {
|
|
6834
|
+
if (typeof numberOrBigInt === "number") return numberOrBigInt / divisor;
|
|
6835
|
+
const integerPart = numberOrBigInt / BigInt(divisor);
|
|
6836
|
+
const remainder = numberOrBigInt % BigInt(divisor);
|
|
6837
|
+
return Number(integerPart) + Number(remainder) / divisor;
|
|
6838
|
+
};
|
|
6839
|
+
var applyFixedWidth = (result, fixedWidth) => {
|
|
6840
|
+
if (fixedWidth === void 0) return result;
|
|
6841
|
+
if (typeof fixedWidth !== "number" || !Number.isSafeInteger(fixedWidth) || fixedWidth < 0) throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof fixedWidth}: ${fixedWidth}`);
|
|
6842
|
+
if (fixedWidth === 0) return result;
|
|
6843
|
+
return result.length < fixedWidth ? result.padStart(fixedWidth, " ") : result;
|
|
6844
|
+
};
|
|
6845
|
+
var buildLocaleOptions = (options) => {
|
|
6846
|
+
const { minimumFractionDigits, maximumFractionDigits } = options;
|
|
6847
|
+
if (minimumFractionDigits === void 0 && maximumFractionDigits === void 0) return;
|
|
6848
|
+
return {
|
|
6849
|
+
...minimumFractionDigits !== void 0 && { minimumFractionDigits },
|
|
6850
|
+
...maximumFractionDigits !== void 0 && { maximumFractionDigits },
|
|
6851
|
+
roundingMode: "trunc"
|
|
6852
|
+
};
|
|
6853
|
+
};
|
|
6854
|
+
function prettyBytes(number, options) {
|
|
6855
|
+
if (typeof number !== "bigint" && !Number.isFinite(number)) throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
6856
|
+
options = {
|
|
6857
|
+
bits: false,
|
|
6858
|
+
binary: false,
|
|
6859
|
+
space: true,
|
|
6860
|
+
nonBreakingSpace: false,
|
|
6861
|
+
...options
|
|
6862
|
+
};
|
|
6863
|
+
const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
|
|
6864
|
+
const separator = options.space ? options.nonBreakingSpace ? "\xA0" : " " : "";
|
|
6865
|
+
const isZero = typeof number === "number" ? number === 0 : number === 0n;
|
|
6866
|
+
if (options.signed && isZero) return applyFixedWidth(` 0${separator}${UNITS[0]}`, options.fixedWidth);
|
|
6867
|
+
const isNegative = number < 0;
|
|
6868
|
+
const prefix = isNegative ? "-" : options.signed ? "+" : "";
|
|
6869
|
+
if (isNegative) number = -number;
|
|
6870
|
+
const localeOptions = buildLocaleOptions(options);
|
|
6871
|
+
let result;
|
|
6872
|
+
if (number < 1) result = prefix + toLocaleString(number, options.locale, localeOptions) + separator + UNITS[0];
|
|
6873
|
+
else {
|
|
6874
|
+
const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
|
|
6875
|
+
number = divide(number, (options.binary ? 1024 : 1e3) ** exponent);
|
|
6876
|
+
if (!localeOptions) {
|
|
6877
|
+
const minPrecision = Math.max(3, Math.floor(number).toString().length);
|
|
6878
|
+
number = number.toPrecision(minPrecision);
|
|
6879
|
+
}
|
|
6880
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
6881
|
+
const unit = UNITS[exponent];
|
|
6882
|
+
result = prefix + numberString + separator + unit;
|
|
6883
|
+
}
|
|
6884
|
+
return applyFixedWidth(result, options.fixedWidth);
|
|
6885
|
+
}
|
|
6886
|
+
//#endregion
|
|
6887
|
+
//#region ../../node_modules/.pnpm/dompurify@3.4.12/node_modules/dompurify/dist/purify.es.mjs
|
|
6888
|
+
/*! @license DOMPurify 3.4.12 | (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.12/LICENSE */
|
|
6889
|
+
function _arrayLikeToArray(r, a) {
|
|
6890
|
+
(null == a || a > r.length) && (a = r.length);
|
|
6891
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
6892
|
+
return n;
|
|
6893
|
+
}
|
|
6894
|
+
function _arrayWithHoles(r) {
|
|
6895
|
+
if (Array.isArray(r)) return r;
|
|
6896
|
+
}
|
|
6897
|
+
function _iterableToArrayLimit(r, l) {
|
|
6898
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
6899
|
+
if (null != t) {
|
|
6900
|
+
var e, n, i, u, a = [], f = true, o = false;
|
|
6901
|
+
try {
|
|
6902
|
+
if (i = (t = t.call(r)).next, 0 === l);
|
|
6903
|
+
else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
6904
|
+
} catch (r) {
|
|
6905
|
+
o = true, n = r;
|
|
6906
|
+
} finally {
|
|
6907
|
+
try {
|
|
6908
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
6909
|
+
} finally {
|
|
6910
|
+
if (o) throw n;
|
|
6911
|
+
}
|
|
6912
|
+
}
|
|
6913
|
+
return a;
|
|
6914
|
+
}
|
|
6915
|
+
}
|
|
6916
|
+
function _nonIterableRest() {
|
|
6917
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6918
|
+
}
|
|
6919
|
+
function _slicedToArray(r, e) {
|
|
6920
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
6921
|
+
}
|
|
6922
|
+
function _unsupportedIterableToArray(r, a) {
|
|
6923
|
+
if (r) {
|
|
6924
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
6925
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
6926
|
+
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;
|
|
6927
|
+
}
|
|
6928
|
+
}
|
|
6929
|
+
var entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
6930
|
+
var freeze = Object.freeze, seal = Object.seal, create$1 = Object.create;
|
|
6931
|
+
var _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
|
|
6932
|
+
if (!freeze) freeze = function freeze(x) {
|
|
6933
|
+
return x;
|
|
6934
|
+
};
|
|
6935
|
+
if (!seal) seal = function seal(x) {
|
|
6936
|
+
return x;
|
|
6937
|
+
};
|
|
6938
|
+
if (!apply) apply = function apply(func, thisArg) {
|
|
6939
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
|
|
6940
|
+
return func.apply(thisArg, args);
|
|
6941
|
+
};
|
|
6942
|
+
if (!construct) construct = function construct(Func) {
|
|
6943
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
|
|
6944
|
+
return new Func(...args);
|
|
6945
|
+
};
|
|
6946
|
+
var arrayForEach = unapply(Array.prototype.forEach);
|
|
6947
|
+
var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
6948
|
+
var arrayPop = unapply(Array.prototype.pop);
|
|
6949
|
+
var arrayPush = unapply(Array.prototype.push);
|
|
6950
|
+
var arraySplice = unapply(Array.prototype.splice);
|
|
6951
|
+
var arrayIsArray = Array.isArray;
|
|
6952
|
+
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
6953
|
+
var stringToString = unapply(String.prototype.toString);
|
|
6954
|
+
var stringMatch = unapply(String.prototype.match);
|
|
6955
|
+
var stringReplace = unapply(String.prototype.replace);
|
|
6956
|
+
var stringIndexOf = unapply(String.prototype.indexOf);
|
|
6957
|
+
var stringTrim = unapply(String.prototype.trim);
|
|
6958
|
+
var numberToString = unapply(Number.prototype.toString);
|
|
6959
|
+
var booleanToString = unapply(Boolean.prototype.toString);
|
|
6960
|
+
var bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
|
|
6961
|
+
var symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
|
|
6962
|
+
var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
|
6963
|
+
var objectToString = unapply(Object.prototype.toString);
|
|
6964
|
+
var regExpTest = unapply(RegExp.prototype.test);
|
|
6965
|
+
var typeErrorCreate = unconstruct(TypeError);
|
|
6966
|
+
/**
|
|
6967
|
+
* Creates a new function that calls the given function with a specified thisArg and arguments.
|
|
6968
|
+
*
|
|
6969
|
+
* @param func - The function to be wrapped and called.
|
|
6970
|
+
* @returns A new function that calls the given function with a specified thisArg and arguments.
|
|
6971
|
+
*/
|
|
6972
|
+
function unapply(func) {
|
|
6973
|
+
return function(thisArg) {
|
|
6974
|
+
if (thisArg instanceof RegExp) thisArg.lastIndex = 0;
|
|
6975
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) args[_key3 - 1] = arguments[_key3];
|
|
6976
|
+
return apply(func, thisArg, args);
|
|
6977
|
+
};
|
|
6978
|
+
}
|
|
6979
|
+
/**
|
|
6980
|
+
* Creates a new function that constructs an instance of the given constructor function with the provided arguments.
|
|
6981
|
+
*
|
|
6982
|
+
* @param func - The constructor function to be wrapped and called.
|
|
6983
|
+
* @returns A new function that constructs an instance of the given constructor function with the provided arguments.
|
|
6984
|
+
*/
|
|
6985
|
+
function unconstruct(Func) {
|
|
6986
|
+
return function() {
|
|
6987
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) args[_key4] = arguments[_key4];
|
|
6988
|
+
return construct(Func, args);
|
|
6989
|
+
};
|
|
6990
|
+
}
|
|
6991
|
+
/**
|
|
6992
|
+
* Add properties to a lookup table
|
|
6993
|
+
*
|
|
6994
|
+
* @param set - The set to which elements will be added.
|
|
6995
|
+
* @param array - The array containing elements to be added to the set.
|
|
6996
|
+
* @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
|
|
6997
|
+
* @returns The modified set with added elements.
|
|
6998
|
+
*/
|
|
6999
|
+
function addToSet(set, array) {
|
|
7000
|
+
let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
|
|
7001
|
+
if (setPrototypeOf) setPrototypeOf(set, null);
|
|
7002
|
+
if (!arrayIsArray(array)) return set;
|
|
7003
|
+
let l = array.length;
|
|
7004
|
+
while (l--) {
|
|
7005
|
+
let element = array[l];
|
|
7006
|
+
if (typeof element === "string") {
|
|
7007
|
+
const lcElement = transformCaseFunc(element);
|
|
7008
|
+
if (lcElement !== element) {
|
|
7009
|
+
if (!isFrozen(array)) array[l] = lcElement;
|
|
7010
|
+
element = lcElement;
|
|
7011
|
+
}
|
|
7012
|
+
}
|
|
7013
|
+
set[element] = true;
|
|
7014
|
+
}
|
|
7015
|
+
return set;
|
|
7016
|
+
}
|
|
7017
|
+
/**
|
|
7018
|
+
* Clean up an array to harden against CSPP
|
|
7019
|
+
*
|
|
7020
|
+
* @param array - The array to be cleaned.
|
|
7021
|
+
* @returns The cleaned version of the array
|
|
7022
|
+
*/
|
|
7023
|
+
function cleanArray(array) {
|
|
7024
|
+
for (let index = 0; index < array.length; index++) if (!objectHasOwnProperty(array, index)) array[index] = null;
|
|
7025
|
+
return array;
|
|
7026
|
+
}
|
|
7027
|
+
/**
|
|
7028
|
+
* Shallow clone an object
|
|
7029
|
+
*
|
|
7030
|
+
* @param object - The object to be cloned.
|
|
7031
|
+
* @returns A new object that copies the original.
|
|
7032
|
+
*/
|
|
7033
|
+
function clone(object) {
|
|
7034
|
+
const newObject = create$1(null);
|
|
7035
|
+
for (const _ref2 of entries(object)) {
|
|
7036
|
+
var _ref3 = _slicedToArray(_ref2, 2);
|
|
7037
|
+
const property = _ref3[0];
|
|
7038
|
+
const value = _ref3[1];
|
|
7039
|
+
if (objectHasOwnProperty(object, property)) if (arrayIsArray(value)) newObject[property] = cleanArray(value);
|
|
7040
|
+
else if (value && typeof value === "object" && value.constructor === Object) newObject[property] = clone(value);
|
|
7041
|
+
else newObject[property] = value;
|
|
7042
|
+
}
|
|
7043
|
+
return newObject;
|
|
7044
|
+
}
|
|
7045
|
+
/**
|
|
7046
|
+
* Convert non-node values into strings without depending on direct property access.
|
|
7047
|
+
*
|
|
7048
|
+
* @param value - The value to stringify.
|
|
7049
|
+
* @returns A string representation of the provided value.
|
|
7050
|
+
*/
|
|
7051
|
+
function stringifyValue(value) {
|
|
7052
|
+
switch (typeof value) {
|
|
7053
|
+
case "string": return value;
|
|
7054
|
+
case "number": return numberToString(value);
|
|
7055
|
+
case "boolean": return booleanToString(value);
|
|
7056
|
+
case "bigint": return bigintToString ? bigintToString(value) : "0";
|
|
7057
|
+
case "symbol": return symbolToString ? symbolToString(value) : "Symbol()";
|
|
7058
|
+
case "undefined": return objectToString(value);
|
|
7059
|
+
case "function":
|
|
7060
|
+
case "object": {
|
|
7061
|
+
if (value === null) return objectToString(value);
|
|
7062
|
+
const valueAsRecord = value;
|
|
7063
|
+
const valueToString = lookupGetter(valueAsRecord, "toString");
|
|
7064
|
+
if (typeof valueToString === "function") {
|
|
7065
|
+
const stringified = valueToString(valueAsRecord);
|
|
7066
|
+
return typeof stringified === "string" ? stringified : objectToString(stringified);
|
|
7067
|
+
}
|
|
7068
|
+
return objectToString(value);
|
|
7069
|
+
}
|
|
7070
|
+
default: return objectToString(value);
|
|
7071
|
+
}
|
|
7072
|
+
}
|
|
7073
|
+
/**
|
|
7074
|
+
* This method automatically checks if the prop is function or getter and behaves accordingly.
|
|
7075
|
+
*
|
|
7076
|
+
* @param object - The object to look up the getter function in its prototype chain.
|
|
7077
|
+
* @param prop - The property name for which to find the getter function.
|
|
7078
|
+
* @returns The getter function found in the prototype chain or a fallback function.
|
|
7079
|
+
*/
|
|
7080
|
+
function lookupGetter(object, prop) {
|
|
7081
|
+
while (object !== null) {
|
|
7082
|
+
const desc = getOwnPropertyDescriptor(object, prop);
|
|
7083
|
+
if (desc) {
|
|
7084
|
+
if (desc.get) return unapply(desc.get);
|
|
7085
|
+
if (typeof desc.value === "function") return unapply(desc.value);
|
|
7086
|
+
}
|
|
7087
|
+
object = getPrototypeOf(object);
|
|
7088
|
+
}
|
|
7089
|
+
function fallbackValue() {
|
|
7090
|
+
return null;
|
|
7091
|
+
}
|
|
7092
|
+
return fallbackValue;
|
|
7093
|
+
}
|
|
7094
|
+
function isRegex(value) {
|
|
7095
|
+
try {
|
|
7096
|
+
regExpTest(value, "");
|
|
7097
|
+
return true;
|
|
7098
|
+
} catch (_unused) {
|
|
7099
|
+
return false;
|
|
7100
|
+
}
|
|
7101
|
+
}
|
|
7102
|
+
var html$1 = freeze([
|
|
7103
|
+
"a",
|
|
7104
|
+
"abbr",
|
|
7105
|
+
"acronym",
|
|
7106
|
+
"address",
|
|
7107
|
+
"area",
|
|
7108
|
+
"article",
|
|
7109
|
+
"aside",
|
|
7110
|
+
"audio",
|
|
7111
|
+
"b",
|
|
7112
|
+
"bdi",
|
|
7113
|
+
"bdo",
|
|
7114
|
+
"big",
|
|
7115
|
+
"blink",
|
|
7116
|
+
"blockquote",
|
|
7117
|
+
"body",
|
|
7118
|
+
"br",
|
|
7119
|
+
"button",
|
|
7120
|
+
"canvas",
|
|
7121
|
+
"caption",
|
|
7122
|
+
"center",
|
|
7123
|
+
"cite",
|
|
7124
|
+
"code",
|
|
7125
|
+
"col",
|
|
7126
|
+
"colgroup",
|
|
7127
|
+
"content",
|
|
7128
|
+
"data",
|
|
7129
|
+
"datalist",
|
|
7130
|
+
"dd",
|
|
7131
|
+
"decorator",
|
|
7132
|
+
"del",
|
|
7133
|
+
"details",
|
|
7134
|
+
"dfn",
|
|
7135
|
+
"dialog",
|
|
7136
|
+
"dir",
|
|
7137
|
+
"div",
|
|
7138
|
+
"dl",
|
|
7139
|
+
"dt",
|
|
7140
|
+
"element",
|
|
7141
|
+
"em",
|
|
7142
|
+
"fieldset",
|
|
7143
|
+
"figcaption",
|
|
7144
|
+
"figure",
|
|
7145
|
+
"font",
|
|
7146
|
+
"footer",
|
|
7147
|
+
"form",
|
|
7148
|
+
"h1",
|
|
7149
|
+
"h2",
|
|
7150
|
+
"h3",
|
|
7151
|
+
"h4",
|
|
7152
|
+
"h5",
|
|
7153
|
+
"h6",
|
|
7154
|
+
"head",
|
|
7155
|
+
"header",
|
|
7156
|
+
"hgroup",
|
|
7157
|
+
"hr",
|
|
7158
|
+
"html",
|
|
7159
|
+
"i",
|
|
7160
|
+
"img",
|
|
7161
|
+
"input",
|
|
7162
|
+
"ins",
|
|
7163
|
+
"kbd",
|
|
7164
|
+
"label",
|
|
7165
|
+
"legend",
|
|
7166
|
+
"li",
|
|
7167
|
+
"main",
|
|
7168
|
+
"map",
|
|
7169
|
+
"mark",
|
|
7170
|
+
"marquee",
|
|
7171
|
+
"menu",
|
|
7172
|
+
"menuitem",
|
|
7173
|
+
"meter",
|
|
7174
|
+
"nav",
|
|
7175
|
+
"nobr",
|
|
7176
|
+
"ol",
|
|
7177
|
+
"optgroup",
|
|
7178
|
+
"option",
|
|
7179
|
+
"output",
|
|
7180
|
+
"p",
|
|
7181
|
+
"picture",
|
|
7182
|
+
"pre",
|
|
7183
|
+
"progress",
|
|
7184
|
+
"q",
|
|
7185
|
+
"rp",
|
|
7186
|
+
"rt",
|
|
7187
|
+
"ruby",
|
|
7188
|
+
"s",
|
|
7189
|
+
"samp",
|
|
7190
|
+
"search",
|
|
7191
|
+
"section",
|
|
7192
|
+
"select",
|
|
7193
|
+
"shadow",
|
|
7194
|
+
"slot",
|
|
7195
|
+
"small",
|
|
7196
|
+
"source",
|
|
7197
|
+
"spacer",
|
|
7198
|
+
"span",
|
|
7199
|
+
"strike",
|
|
7200
|
+
"strong",
|
|
7201
|
+
"style",
|
|
7202
|
+
"sub",
|
|
7203
|
+
"summary",
|
|
7204
|
+
"sup",
|
|
7205
|
+
"table",
|
|
7206
|
+
"tbody",
|
|
7207
|
+
"td",
|
|
7208
|
+
"template",
|
|
7209
|
+
"textarea",
|
|
7210
|
+
"tfoot",
|
|
7211
|
+
"th",
|
|
7212
|
+
"thead",
|
|
7213
|
+
"time",
|
|
7214
|
+
"tr",
|
|
7215
|
+
"track",
|
|
7216
|
+
"tt",
|
|
7217
|
+
"u",
|
|
7218
|
+
"ul",
|
|
7219
|
+
"var",
|
|
7220
|
+
"video",
|
|
7221
|
+
"wbr"
|
|
7222
|
+
]);
|
|
7223
|
+
var svg$1 = freeze([
|
|
7224
|
+
"svg",
|
|
7225
|
+
"a",
|
|
7226
|
+
"altglyph",
|
|
7227
|
+
"altglyphdef",
|
|
7228
|
+
"altglyphitem",
|
|
7229
|
+
"animatecolor",
|
|
7230
|
+
"animatemotion",
|
|
7231
|
+
"animatetransform",
|
|
7232
|
+
"circle",
|
|
7233
|
+
"clippath",
|
|
7234
|
+
"defs",
|
|
7235
|
+
"desc",
|
|
7236
|
+
"ellipse",
|
|
7237
|
+
"enterkeyhint",
|
|
7238
|
+
"exportparts",
|
|
7239
|
+
"filter",
|
|
7240
|
+
"font",
|
|
7241
|
+
"g",
|
|
7242
|
+
"glyph",
|
|
7243
|
+
"glyphref",
|
|
7244
|
+
"hkern",
|
|
7245
|
+
"image",
|
|
7246
|
+
"inputmode",
|
|
7247
|
+
"line",
|
|
7248
|
+
"lineargradient",
|
|
7249
|
+
"marker",
|
|
7250
|
+
"mask",
|
|
7251
|
+
"metadata",
|
|
7252
|
+
"mpath",
|
|
7253
|
+
"part",
|
|
7254
|
+
"path",
|
|
7255
|
+
"pattern",
|
|
7256
|
+
"polygon",
|
|
7257
|
+
"polyline",
|
|
7258
|
+
"radialgradient",
|
|
7259
|
+
"rect",
|
|
7260
|
+
"stop",
|
|
7261
|
+
"style",
|
|
7262
|
+
"switch",
|
|
7263
|
+
"symbol",
|
|
7264
|
+
"text",
|
|
7265
|
+
"textpath",
|
|
7266
|
+
"title",
|
|
7267
|
+
"tref",
|
|
7268
|
+
"tspan",
|
|
7269
|
+
"view",
|
|
7270
|
+
"vkern"
|
|
7271
|
+
]);
|
|
7272
|
+
var svgFilters = freeze([
|
|
7273
|
+
"feBlend",
|
|
7274
|
+
"feColorMatrix",
|
|
7275
|
+
"feComponentTransfer",
|
|
7276
|
+
"feComposite",
|
|
7277
|
+
"feConvolveMatrix",
|
|
7278
|
+
"feDiffuseLighting",
|
|
7279
|
+
"feDisplacementMap",
|
|
7280
|
+
"feDistantLight",
|
|
7281
|
+
"feDropShadow",
|
|
7282
|
+
"feFlood",
|
|
7283
|
+
"feFuncA",
|
|
7284
|
+
"feFuncB",
|
|
7285
|
+
"feFuncG",
|
|
7286
|
+
"feFuncR",
|
|
7287
|
+
"feGaussianBlur",
|
|
7288
|
+
"feImage",
|
|
7289
|
+
"feMerge",
|
|
7290
|
+
"feMergeNode",
|
|
7291
|
+
"feMorphology",
|
|
7292
|
+
"feOffset",
|
|
7293
|
+
"fePointLight",
|
|
7294
|
+
"feSpecularLighting",
|
|
7295
|
+
"feSpotLight",
|
|
7296
|
+
"feTile",
|
|
7297
|
+
"feTurbulence"
|
|
7298
|
+
]);
|
|
7299
|
+
var svgDisallowed = freeze([
|
|
7300
|
+
"animate",
|
|
7301
|
+
"color-profile",
|
|
7302
|
+
"cursor",
|
|
7303
|
+
"discard",
|
|
7304
|
+
"font-face",
|
|
7305
|
+
"font-face-format",
|
|
7306
|
+
"font-face-name",
|
|
7307
|
+
"font-face-src",
|
|
7308
|
+
"font-face-uri",
|
|
7309
|
+
"foreignobject",
|
|
7310
|
+
"hatch",
|
|
7311
|
+
"hatchpath",
|
|
7312
|
+
"mesh",
|
|
7313
|
+
"meshgradient",
|
|
7314
|
+
"meshpatch",
|
|
7315
|
+
"meshrow",
|
|
7316
|
+
"missing-glyph",
|
|
7317
|
+
"script",
|
|
7318
|
+
"set",
|
|
7319
|
+
"solidcolor",
|
|
7320
|
+
"unknown",
|
|
7321
|
+
"use"
|
|
7322
|
+
]);
|
|
7323
|
+
var mathMl$1 = freeze([
|
|
7324
|
+
"math",
|
|
7325
|
+
"menclose",
|
|
7326
|
+
"merror",
|
|
7327
|
+
"mfenced",
|
|
7328
|
+
"mfrac",
|
|
7329
|
+
"mglyph",
|
|
7330
|
+
"mi",
|
|
7331
|
+
"mlabeledtr",
|
|
7332
|
+
"mmultiscripts",
|
|
7333
|
+
"mn",
|
|
7334
|
+
"mo",
|
|
7335
|
+
"mover",
|
|
7336
|
+
"mpadded",
|
|
7337
|
+
"mphantom",
|
|
7338
|
+
"mroot",
|
|
7339
|
+
"mrow",
|
|
7340
|
+
"ms",
|
|
7341
|
+
"mspace",
|
|
7342
|
+
"msqrt",
|
|
7343
|
+
"mstyle",
|
|
7344
|
+
"msub",
|
|
7345
|
+
"msup",
|
|
7346
|
+
"msubsup",
|
|
7347
|
+
"mtable",
|
|
7348
|
+
"mtd",
|
|
7349
|
+
"mtext",
|
|
7350
|
+
"mtr",
|
|
7351
|
+
"munder",
|
|
7352
|
+
"munderover",
|
|
7353
|
+
"mprescripts"
|
|
7354
|
+
]);
|
|
7355
|
+
var mathMlDisallowed = freeze([
|
|
7356
|
+
"maction",
|
|
7357
|
+
"maligngroup",
|
|
7358
|
+
"malignmark",
|
|
7359
|
+
"mlongdiv",
|
|
7360
|
+
"mscarries",
|
|
7361
|
+
"mscarry",
|
|
7362
|
+
"msgroup",
|
|
7363
|
+
"mstack",
|
|
7364
|
+
"msline",
|
|
7365
|
+
"msrow",
|
|
7366
|
+
"semantics",
|
|
7367
|
+
"annotation",
|
|
7368
|
+
"annotation-xml",
|
|
7369
|
+
"mprescripts",
|
|
7370
|
+
"none"
|
|
7371
|
+
]);
|
|
7372
|
+
var text = freeze(["#text"]);
|
|
7373
|
+
var html = freeze([
|
|
7374
|
+
"accept",
|
|
7375
|
+
"action",
|
|
7376
|
+
"align",
|
|
7377
|
+
"alt",
|
|
7378
|
+
"autocapitalize",
|
|
7379
|
+
"autocomplete",
|
|
7380
|
+
"autopictureinpicture",
|
|
7381
|
+
"autoplay",
|
|
7382
|
+
"background",
|
|
7383
|
+
"bgcolor",
|
|
7384
|
+
"border",
|
|
7385
|
+
"capture",
|
|
7386
|
+
"cellpadding",
|
|
7387
|
+
"cellspacing",
|
|
7388
|
+
"checked",
|
|
7389
|
+
"cite",
|
|
7390
|
+
"class",
|
|
7391
|
+
"clear",
|
|
7392
|
+
"color",
|
|
7393
|
+
"cols",
|
|
7394
|
+
"colspan",
|
|
7395
|
+
"command",
|
|
7396
|
+
"commandfor",
|
|
7397
|
+
"controls",
|
|
7398
|
+
"controlslist",
|
|
7399
|
+
"coords",
|
|
7400
|
+
"crossorigin",
|
|
7401
|
+
"datetime",
|
|
7402
|
+
"decoding",
|
|
7403
|
+
"default",
|
|
7404
|
+
"dir",
|
|
7405
|
+
"disabled",
|
|
7406
|
+
"disablepictureinpicture",
|
|
7407
|
+
"disableremoteplayback",
|
|
7408
|
+
"download",
|
|
7409
|
+
"draggable",
|
|
7410
|
+
"enctype",
|
|
7411
|
+
"enterkeyhint",
|
|
7412
|
+
"exportparts",
|
|
7413
|
+
"face",
|
|
7414
|
+
"for",
|
|
7415
|
+
"headers",
|
|
7416
|
+
"height",
|
|
7417
|
+
"hidden",
|
|
7418
|
+
"high",
|
|
7419
|
+
"href",
|
|
7420
|
+
"hreflang",
|
|
7421
|
+
"id",
|
|
7422
|
+
"inert",
|
|
7423
|
+
"inputmode",
|
|
7424
|
+
"integrity",
|
|
7425
|
+
"ismap",
|
|
7426
|
+
"kind",
|
|
7427
|
+
"label",
|
|
7428
|
+
"lang",
|
|
7429
|
+
"list",
|
|
7430
|
+
"loading",
|
|
7431
|
+
"loop",
|
|
7432
|
+
"low",
|
|
7433
|
+
"max",
|
|
7434
|
+
"maxlength",
|
|
7435
|
+
"media",
|
|
7436
|
+
"method",
|
|
7437
|
+
"min",
|
|
7438
|
+
"minlength",
|
|
7439
|
+
"multiple",
|
|
7440
|
+
"muted",
|
|
7441
|
+
"name",
|
|
7442
|
+
"nonce",
|
|
7443
|
+
"noshade",
|
|
7444
|
+
"novalidate",
|
|
7445
|
+
"nowrap",
|
|
7446
|
+
"open",
|
|
7447
|
+
"optimum",
|
|
7448
|
+
"part",
|
|
7449
|
+
"pattern",
|
|
7450
|
+
"placeholder",
|
|
7451
|
+
"playsinline",
|
|
7452
|
+
"popover",
|
|
7453
|
+
"popovertarget",
|
|
7454
|
+
"popovertargetaction",
|
|
7455
|
+
"poster",
|
|
7456
|
+
"preload",
|
|
7457
|
+
"pubdate",
|
|
7458
|
+
"radiogroup",
|
|
7459
|
+
"readonly",
|
|
7460
|
+
"rel",
|
|
7461
|
+
"required",
|
|
7462
|
+
"rev",
|
|
7463
|
+
"reversed",
|
|
7464
|
+
"role",
|
|
7465
|
+
"rows",
|
|
7466
|
+
"rowspan",
|
|
7467
|
+
"spellcheck",
|
|
7468
|
+
"scope",
|
|
7469
|
+
"selected",
|
|
7470
|
+
"shape",
|
|
7471
|
+
"size",
|
|
7472
|
+
"sizes",
|
|
7473
|
+
"slot",
|
|
7474
|
+
"span",
|
|
7475
|
+
"srclang",
|
|
7476
|
+
"start",
|
|
7477
|
+
"src",
|
|
7478
|
+
"srcset",
|
|
7479
|
+
"step",
|
|
7480
|
+
"style",
|
|
7481
|
+
"summary",
|
|
7482
|
+
"tabindex",
|
|
7483
|
+
"title",
|
|
7484
|
+
"translate",
|
|
7485
|
+
"type",
|
|
7486
|
+
"usemap",
|
|
7487
|
+
"valign",
|
|
7488
|
+
"value",
|
|
7489
|
+
"width",
|
|
7490
|
+
"wrap",
|
|
7491
|
+
"xmlns"
|
|
7492
|
+
]);
|
|
7493
|
+
var svg = freeze([
|
|
7494
|
+
"accent-height",
|
|
7495
|
+
"accumulate",
|
|
7496
|
+
"additive",
|
|
7497
|
+
"alignment-baseline",
|
|
7498
|
+
"amplitude",
|
|
7499
|
+
"ascent",
|
|
7500
|
+
"attributename",
|
|
7501
|
+
"attributetype",
|
|
7502
|
+
"azimuth",
|
|
7503
|
+
"basefrequency",
|
|
7504
|
+
"baseline-shift",
|
|
7505
|
+
"begin",
|
|
7506
|
+
"bias",
|
|
7507
|
+
"by",
|
|
7508
|
+
"class",
|
|
7509
|
+
"clip",
|
|
7510
|
+
"clippathunits",
|
|
7511
|
+
"clip-path",
|
|
7512
|
+
"clip-rule",
|
|
7513
|
+
"color",
|
|
7514
|
+
"color-interpolation",
|
|
7515
|
+
"color-interpolation-filters",
|
|
7516
|
+
"color-profile",
|
|
7517
|
+
"color-rendering",
|
|
7518
|
+
"cx",
|
|
7519
|
+
"cy",
|
|
7520
|
+
"d",
|
|
7521
|
+
"dx",
|
|
7522
|
+
"dy",
|
|
7523
|
+
"diffuseconstant",
|
|
7524
|
+
"direction",
|
|
7525
|
+
"display",
|
|
7526
|
+
"divisor",
|
|
7527
|
+
"dominant-baseline",
|
|
7528
|
+
"dur",
|
|
7529
|
+
"edgemode",
|
|
7530
|
+
"elevation",
|
|
7531
|
+
"end",
|
|
7532
|
+
"exponent",
|
|
7533
|
+
"fill",
|
|
7534
|
+
"fill-opacity",
|
|
7535
|
+
"fill-rule",
|
|
7536
|
+
"filter",
|
|
7537
|
+
"filterunits",
|
|
7538
|
+
"flood-color",
|
|
7539
|
+
"flood-opacity",
|
|
7540
|
+
"font-family",
|
|
7541
|
+
"font-size",
|
|
7542
|
+
"font-size-adjust",
|
|
7543
|
+
"font-stretch",
|
|
7544
|
+
"font-style",
|
|
7545
|
+
"font-variant",
|
|
7546
|
+
"font-weight",
|
|
7547
|
+
"fx",
|
|
7548
|
+
"fy",
|
|
7549
|
+
"g1",
|
|
7550
|
+
"g2",
|
|
7551
|
+
"glyph-name",
|
|
7552
|
+
"glyphref",
|
|
7553
|
+
"gradientunits",
|
|
7554
|
+
"gradienttransform",
|
|
7555
|
+
"height",
|
|
7556
|
+
"href",
|
|
7557
|
+
"id",
|
|
7558
|
+
"image-rendering",
|
|
7559
|
+
"in",
|
|
7560
|
+
"in2",
|
|
7561
|
+
"intercept",
|
|
7562
|
+
"k",
|
|
7563
|
+
"k1",
|
|
7564
|
+
"k2",
|
|
7565
|
+
"k3",
|
|
7566
|
+
"k4",
|
|
7567
|
+
"kerning",
|
|
7568
|
+
"keypoints",
|
|
7569
|
+
"keysplines",
|
|
7570
|
+
"keytimes",
|
|
7571
|
+
"lang",
|
|
7572
|
+
"lengthadjust",
|
|
7573
|
+
"letter-spacing",
|
|
7574
|
+
"kernelmatrix",
|
|
7575
|
+
"kernelunitlength",
|
|
7576
|
+
"lighting-color",
|
|
7577
|
+
"local",
|
|
7578
|
+
"marker-end",
|
|
7579
|
+
"marker-mid",
|
|
7580
|
+
"marker-start",
|
|
7581
|
+
"markerheight",
|
|
7582
|
+
"markerunits",
|
|
7583
|
+
"markerwidth",
|
|
7584
|
+
"maskcontentunits",
|
|
7585
|
+
"maskunits",
|
|
7586
|
+
"max",
|
|
7587
|
+
"mask",
|
|
7588
|
+
"mask-type",
|
|
7589
|
+
"media",
|
|
7590
|
+
"method",
|
|
7591
|
+
"mode",
|
|
7592
|
+
"min",
|
|
7593
|
+
"name",
|
|
7594
|
+
"numoctaves",
|
|
7595
|
+
"offset",
|
|
7596
|
+
"operator",
|
|
7597
|
+
"opacity",
|
|
7598
|
+
"order",
|
|
7599
|
+
"orient",
|
|
7600
|
+
"orientation",
|
|
7601
|
+
"origin",
|
|
7602
|
+
"overflow",
|
|
7603
|
+
"paint-order",
|
|
7604
|
+
"path",
|
|
7605
|
+
"pathlength",
|
|
7606
|
+
"patterncontentunits",
|
|
7607
|
+
"patterntransform",
|
|
7608
|
+
"patternunits",
|
|
7609
|
+
"points",
|
|
7610
|
+
"preservealpha",
|
|
7611
|
+
"preserveaspectratio",
|
|
7612
|
+
"primitiveunits",
|
|
7613
|
+
"r",
|
|
7614
|
+
"rx",
|
|
7615
|
+
"ry",
|
|
7616
|
+
"radius",
|
|
7617
|
+
"refx",
|
|
7618
|
+
"refy",
|
|
7619
|
+
"repeatcount",
|
|
7620
|
+
"repeatdur",
|
|
7621
|
+
"restart",
|
|
7622
|
+
"result",
|
|
7623
|
+
"rotate",
|
|
7624
|
+
"scale",
|
|
7625
|
+
"seed",
|
|
7626
|
+
"shape-rendering",
|
|
7627
|
+
"slope",
|
|
7628
|
+
"specularconstant",
|
|
7629
|
+
"specularexponent",
|
|
7630
|
+
"spreadmethod",
|
|
7631
|
+
"startoffset",
|
|
7632
|
+
"stddeviation",
|
|
7633
|
+
"stitchtiles",
|
|
7634
|
+
"stop-color",
|
|
7635
|
+
"stop-opacity",
|
|
7636
|
+
"stroke-dasharray",
|
|
7637
|
+
"stroke-dashoffset",
|
|
7638
|
+
"stroke-linecap",
|
|
7639
|
+
"stroke-linejoin",
|
|
7640
|
+
"stroke-miterlimit",
|
|
7641
|
+
"stroke-opacity",
|
|
7642
|
+
"stroke",
|
|
7643
|
+
"stroke-width",
|
|
7644
|
+
"style",
|
|
7645
|
+
"surfacescale",
|
|
7646
|
+
"systemlanguage",
|
|
7647
|
+
"tabindex",
|
|
7648
|
+
"tablevalues",
|
|
7649
|
+
"targetx",
|
|
7650
|
+
"targety",
|
|
7651
|
+
"transform",
|
|
7652
|
+
"transform-origin",
|
|
7653
|
+
"text-anchor",
|
|
7654
|
+
"text-decoration",
|
|
7655
|
+
"text-orientation",
|
|
7656
|
+
"text-rendering",
|
|
7657
|
+
"textlength",
|
|
7658
|
+
"type",
|
|
7659
|
+
"u1",
|
|
7660
|
+
"u2",
|
|
7661
|
+
"unicode",
|
|
7662
|
+
"values",
|
|
7663
|
+
"viewbox",
|
|
7664
|
+
"visibility",
|
|
7665
|
+
"version",
|
|
7666
|
+
"vert-adv-y",
|
|
7667
|
+
"vert-origin-x",
|
|
7668
|
+
"vert-origin-y",
|
|
7669
|
+
"width",
|
|
7670
|
+
"word-spacing",
|
|
7671
|
+
"wrap",
|
|
7672
|
+
"writing-mode",
|
|
7673
|
+
"xchannelselector",
|
|
7674
|
+
"ychannelselector",
|
|
7675
|
+
"x",
|
|
7676
|
+
"x1",
|
|
7677
|
+
"x2",
|
|
7678
|
+
"xmlns",
|
|
7679
|
+
"y",
|
|
7680
|
+
"y1",
|
|
7681
|
+
"y2",
|
|
7682
|
+
"z",
|
|
7683
|
+
"zoomandpan"
|
|
7684
|
+
]);
|
|
7685
|
+
var mathMl = freeze([
|
|
7686
|
+
"accent",
|
|
7687
|
+
"accentunder",
|
|
7688
|
+
"align",
|
|
7689
|
+
"bevelled",
|
|
7690
|
+
"close",
|
|
7691
|
+
"columnalign",
|
|
7692
|
+
"columnlines",
|
|
7693
|
+
"columnspacing",
|
|
7694
|
+
"columnspan",
|
|
7695
|
+
"denomalign",
|
|
7696
|
+
"depth",
|
|
7697
|
+
"dir",
|
|
7698
|
+
"display",
|
|
7699
|
+
"displaystyle",
|
|
7700
|
+
"encoding",
|
|
7701
|
+
"fence",
|
|
7702
|
+
"frame",
|
|
7703
|
+
"height",
|
|
7704
|
+
"href",
|
|
7705
|
+
"id",
|
|
7706
|
+
"largeop",
|
|
7707
|
+
"length",
|
|
7708
|
+
"linethickness",
|
|
7709
|
+
"lquote",
|
|
7710
|
+
"lspace",
|
|
7711
|
+
"mathbackground",
|
|
7712
|
+
"mathcolor",
|
|
7713
|
+
"mathsize",
|
|
7714
|
+
"mathvariant",
|
|
7715
|
+
"maxsize",
|
|
7716
|
+
"minsize",
|
|
7717
|
+
"movablelimits",
|
|
7718
|
+
"notation",
|
|
7719
|
+
"numalign",
|
|
7720
|
+
"open",
|
|
7721
|
+
"rowalign",
|
|
7722
|
+
"rowlines",
|
|
7723
|
+
"rowspacing",
|
|
7724
|
+
"rowspan",
|
|
7725
|
+
"rspace",
|
|
7726
|
+
"rquote",
|
|
7727
|
+
"scriptlevel",
|
|
7728
|
+
"scriptminsize",
|
|
7729
|
+
"scriptsizemultiplier",
|
|
7730
|
+
"selection",
|
|
7731
|
+
"separator",
|
|
7732
|
+
"separators",
|
|
7733
|
+
"stretchy",
|
|
7734
|
+
"subscriptshift",
|
|
7735
|
+
"supscriptshift",
|
|
7736
|
+
"symmetric",
|
|
7737
|
+
"voffset",
|
|
7738
|
+
"width",
|
|
7739
|
+
"xmlns"
|
|
7740
|
+
]);
|
|
7741
|
+
var xml = freeze([
|
|
7742
|
+
"xlink:href",
|
|
7743
|
+
"xml:id",
|
|
7744
|
+
"xlink:title",
|
|
7745
|
+
"xml:space",
|
|
7746
|
+
"xmlns:xlink"
|
|
7747
|
+
]);
|
|
7748
|
+
var MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
|
|
7749
|
+
var ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
|
|
7750
|
+
var TMPLIT_EXPR = seal(/\${[\w\W]*/g);
|
|
7751
|
+
var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
|
|
7752
|
+
var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
|
|
7753
|
+
var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
|
|
7754
|
+
var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
7755
|
+
var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);
|
|
7756
|
+
var DOCTYPE_NAME = seal(/^html$/i);
|
|
7757
|
+
var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
7758
|
+
var ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
|
|
7759
|
+
var COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
|
|
7760
|
+
var FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
|
|
7761
|
+
var SELF_CLOSING_TAG = seal(/\/>/i);
|
|
7762
|
+
var NODE_TYPE = {
|
|
7763
|
+
element: 1,
|
|
7764
|
+
attribute: 2,
|
|
7765
|
+
text: 3,
|
|
7766
|
+
cdataSection: 4,
|
|
7767
|
+
entityReference: 5,
|
|
7768
|
+
entityNode: 6,
|
|
7769
|
+
processingInstruction: 7,
|
|
7770
|
+
comment: 8,
|
|
7771
|
+
document: 9,
|
|
7772
|
+
documentType: 10,
|
|
7773
|
+
documentFragment: 11,
|
|
7774
|
+
notation: 12
|
|
7775
|
+
};
|
|
7776
|
+
var getGlobal = function getGlobal() {
|
|
7777
|
+
return typeof window === "undefined" ? null : window;
|
|
7778
|
+
};
|
|
7779
|
+
/**
|
|
7780
|
+
* Creates a no-op policy for internal use only.
|
|
7781
|
+
* Don't export this function outside this module!
|
|
7782
|
+
* @param trustedTypes The policy factory.
|
|
7783
|
+
* @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
|
|
7784
|
+
* @return The policy created (or null, if Trusted Types
|
|
7785
|
+
* are not supported or creating the policy failed).
|
|
7786
|
+
*/
|
|
7787
|
+
var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
|
|
7788
|
+
if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") return null;
|
|
7789
|
+
let suffix = null;
|
|
7790
|
+
const ATTR_NAME = "data-tt-policy-suffix";
|
|
7791
|
+
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
|
7792
|
+
const policyName = "dompurify" + (suffix ? "#" + suffix : "");
|
|
7793
|
+
try {
|
|
7794
|
+
return trustedTypes.createPolicy(policyName, {
|
|
7795
|
+
createHTML(html) {
|
|
7796
|
+
return html;
|
|
7797
|
+
},
|
|
7798
|
+
createScriptURL(scriptUrl) {
|
|
7799
|
+
return scriptUrl;
|
|
7800
|
+
}
|
|
7801
|
+
});
|
|
7802
|
+
} catch (_) {
|
|
7803
|
+
console.warn("TrustedTypes policy " + policyName + " could not be created.");
|
|
7804
|
+
return null;
|
|
7805
|
+
}
|
|
7806
|
+
};
|
|
7807
|
+
var _createHooksMap = function _createHooksMap() {
|
|
7808
|
+
return {
|
|
7809
|
+
afterSanitizeAttributes: [],
|
|
7810
|
+
afterSanitizeElements: [],
|
|
7811
|
+
afterSanitizeShadowDOM: [],
|
|
7812
|
+
beforeSanitizeAttributes: [],
|
|
7813
|
+
beforeSanitizeElements: [],
|
|
7814
|
+
beforeSanitizeShadowDOM: [],
|
|
7815
|
+
uponSanitizeAttribute: [],
|
|
7816
|
+
uponSanitizeElement: [],
|
|
7817
|
+
uponSanitizeShadowNode: []
|
|
7818
|
+
};
|
|
7819
|
+
};
|
|
7820
|
+
/**
|
|
7821
|
+
* Resolve a set-valued configuration option: a fresh set built from
|
|
7822
|
+
* cfg[key] when it is an own array property (seeded with a clone of
|
|
7823
|
+
* options.base when given, case-normalized via options.transform),
|
|
7824
|
+
* the fallback set otherwise.
|
|
7825
|
+
*
|
|
7826
|
+
* @param cfg the cloned, prototype-free configuration object
|
|
7827
|
+
* @param key the configuration property to read
|
|
7828
|
+
* @param fallback the set to use when the option is absent or not an array
|
|
7829
|
+
* @param options transform and optional base set to merge into
|
|
7830
|
+
* @returns the resolved set
|
|
7831
|
+
*/
|
|
7832
|
+
var _resolveSetOption = function _resolveSetOption(cfg, key, fallback, options) {
|
|
7833
|
+
return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
|
|
7834
|
+
};
|
|
7835
|
+
function createDOMPurify() {
|
|
7836
|
+
let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
7837
|
+
const DOMPurify = (root) => createDOMPurify(root);
|
|
7838
|
+
DOMPurify.version = "3.4.12";
|
|
7839
|
+
DOMPurify.removed = [];
|
|
7840
|
+
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
7841
|
+
DOMPurify.isSupported = false;
|
|
7842
|
+
return DOMPurify;
|
|
7843
|
+
}
|
|
7844
|
+
let document = window.document;
|
|
7845
|
+
const originalDocument = document;
|
|
7846
|
+
const currentScript = originalDocument.currentScript;
|
|
7847
|
+
window.DocumentFragment;
|
|
7848
|
+
const HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, Element = window.Element, NodeFilter = window.NodeFilter;
|
|
7849
|
+
window.NamedNodeMap === void 0 && (window.NamedNodeMap || window.MozNamedAttrMap);
|
|
7850
|
+
window.HTMLFormElement;
|
|
7851
|
+
const DOMParser = window.DOMParser, trustedTypes = window.trustedTypes;
|
|
7852
|
+
const ElementPrototype = Element.prototype;
|
|
7853
|
+
const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
|
|
7854
|
+
const remove = lookupGetter(ElementPrototype, "remove");
|
|
7855
|
+
const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
|
|
7856
|
+
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
|
7857
|
+
const getParentNode = lookupGetter(ElementPrototype, "parentNode");
|
|
7858
|
+
const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot");
|
|
7859
|
+
const getAttributes = lookupGetter(ElementPrototype, "attributes");
|
|
7860
|
+
const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
|
|
7861
|
+
const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
|
|
7862
|
+
if (typeof HTMLTemplateElement === "function") {
|
|
7863
|
+
const template = document.createElement("template");
|
|
7864
|
+
if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
|
|
7865
|
+
}
|
|
7866
|
+
let trustedTypesPolicy;
|
|
7867
|
+
let emptyHTML = "";
|
|
7868
|
+
let defaultTrustedTypesPolicy;
|
|
7869
|
+
let defaultTrustedTypesPolicyResolved = false;
|
|
7870
|
+
let IN_TRUSTED_TYPES_POLICY = 0;
|
|
7871
|
+
const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy() {
|
|
7872
|
+
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.");
|
|
7873
|
+
};
|
|
7874
|
+
const _createTrustedHTML = function _createTrustedHTML(html) {
|
|
7875
|
+
_assertNotInTrustedTypesPolicy();
|
|
7876
|
+
IN_TRUSTED_TYPES_POLICY++;
|
|
7877
|
+
try {
|
|
7878
|
+
return trustedTypesPolicy.createHTML(html);
|
|
7879
|
+
} finally {
|
|
7880
|
+
IN_TRUSTED_TYPES_POLICY--;
|
|
7881
|
+
}
|
|
7882
|
+
};
|
|
7883
|
+
const _createTrustedScriptURL = function _createTrustedScriptURL(scriptUrl) {
|
|
7884
|
+
_assertNotInTrustedTypesPolicy();
|
|
7885
|
+
IN_TRUSTED_TYPES_POLICY++;
|
|
7886
|
+
try {
|
|
7887
|
+
return trustedTypesPolicy.createScriptURL(scriptUrl);
|
|
7888
|
+
} finally {
|
|
7889
|
+
IN_TRUSTED_TYPES_POLICY--;
|
|
7890
|
+
}
|
|
7891
|
+
};
|
|
7892
|
+
const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy() {
|
|
7893
|
+
if (!defaultTrustedTypesPolicyResolved) {
|
|
7894
|
+
defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
|
7895
|
+
defaultTrustedTypesPolicyResolved = true;
|
|
7896
|
+
}
|
|
7897
|
+
return defaultTrustedTypesPolicy;
|
|
7898
|
+
};
|
|
7899
|
+
const _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
|
|
7900
|
+
const importNode = originalDocument.importNode;
|
|
7901
|
+
let hooks = _createHooksMap();
|
|
7902
|
+
/**
|
|
7903
|
+
* Expose whether this browser supports running the full DOMPurify.
|
|
7904
|
+
*/
|
|
7905
|
+
DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
|
|
7906
|
+
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;
|
|
7907
|
+
let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
|
|
7908
|
+
/**
|
|
7909
|
+
* We consider the elements and attributes below to be safe. Ideally
|
|
7910
|
+
* don't add any new ones but feel free to remove unwanted ones.
|
|
7911
|
+
*/
|
|
7912
|
+
let ALLOWED_TAGS = null;
|
|
7913
|
+
const DEFAULT_ALLOWED_TAGS = addToSet({}, [
|
|
7914
|
+
...html$1,
|
|
7915
|
+
...svg$1,
|
|
7916
|
+
...svgFilters,
|
|
7917
|
+
...mathMl$1,
|
|
7918
|
+
...text
|
|
7919
|
+
]);
|
|
7920
|
+
let ALLOWED_ATTR = null;
|
|
7921
|
+
const DEFAULT_ALLOWED_ATTR = addToSet({}, [
|
|
7922
|
+
...html,
|
|
7923
|
+
...svg,
|
|
7924
|
+
...mathMl,
|
|
7925
|
+
...xml
|
|
7926
|
+
]);
|
|
7927
|
+
let CUSTOM_ELEMENT_HANDLING = Object.seal(create$1(null, {
|
|
7928
|
+
tagNameCheck: {
|
|
7929
|
+
writable: true,
|
|
7930
|
+
configurable: false,
|
|
7931
|
+
enumerable: true,
|
|
7932
|
+
value: null
|
|
7933
|
+
},
|
|
7934
|
+
attributeNameCheck: {
|
|
7935
|
+
writable: true,
|
|
7936
|
+
configurable: false,
|
|
7937
|
+
enumerable: true,
|
|
7938
|
+
value: null
|
|
7939
|
+
},
|
|
7940
|
+
allowCustomizedBuiltInElements: {
|
|
7941
|
+
writable: true,
|
|
7942
|
+
configurable: false,
|
|
7943
|
+
enumerable: true,
|
|
7944
|
+
value: false
|
|
7945
|
+
}
|
|
7946
|
+
}));
|
|
7947
|
+
let FORBID_TAGS = null;
|
|
7948
|
+
let FORBID_ATTR = null;
|
|
7949
|
+
const EXTRA_ELEMENT_HANDLING = Object.seal(create$1(null, {
|
|
7950
|
+
tagCheck: {
|
|
7951
|
+
writable: true,
|
|
7952
|
+
configurable: false,
|
|
7953
|
+
enumerable: true,
|
|
7954
|
+
value: null
|
|
7955
|
+
},
|
|
7956
|
+
attributeCheck: {
|
|
7957
|
+
writable: true,
|
|
7958
|
+
configurable: false,
|
|
7959
|
+
enumerable: true,
|
|
7960
|
+
value: null
|
|
7961
|
+
}
|
|
7962
|
+
}));
|
|
7963
|
+
let ALLOW_ARIA_ATTR = true;
|
|
7964
|
+
let ALLOW_DATA_ATTR = true;
|
|
7965
|
+
let ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
7966
|
+
let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
|
7967
|
+
let SAFE_FOR_TEMPLATES = false;
|
|
7968
|
+
let SAFE_FOR_XML = true;
|
|
7969
|
+
let WHOLE_DOCUMENT = false;
|
|
7970
|
+
let SET_CONFIG = false;
|
|
7971
|
+
let SET_CONFIG_ALLOWED_TAGS = null;
|
|
7972
|
+
let SET_CONFIG_ALLOWED_ATTR = null;
|
|
7973
|
+
let FORCE_BODY = false;
|
|
7974
|
+
let RETURN_DOM = false;
|
|
7975
|
+
let RETURN_DOM_FRAGMENT = false;
|
|
7976
|
+
let RETURN_TRUSTED_TYPE = false;
|
|
7977
|
+
let SANITIZE_DOM = true;
|
|
7978
|
+
let SANITIZE_NAMED_PROPS = false;
|
|
7979
|
+
const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
|
|
7980
|
+
let KEEP_CONTENT = true;
|
|
7981
|
+
let IN_PLACE = false;
|
|
7982
|
+
let USE_PROFILES = {};
|
|
7983
|
+
let FORBID_CONTENTS = null;
|
|
7984
|
+
const DEFAULT_FORBID_CONTENTS = addToSet({}, [
|
|
7985
|
+
"annotation-xml",
|
|
7986
|
+
"audio",
|
|
7987
|
+
"colgroup",
|
|
7988
|
+
"desc",
|
|
7989
|
+
"foreignobject",
|
|
7990
|
+
"head",
|
|
7991
|
+
"iframe",
|
|
7992
|
+
"math",
|
|
7993
|
+
"mi",
|
|
7994
|
+
"mn",
|
|
7995
|
+
"mo",
|
|
7996
|
+
"ms",
|
|
7997
|
+
"mtext",
|
|
7998
|
+
"noembed",
|
|
7999
|
+
"noframes",
|
|
8000
|
+
"noscript",
|
|
8001
|
+
"plaintext",
|
|
8002
|
+
"script",
|
|
8003
|
+
"selectedcontent",
|
|
8004
|
+
"style",
|
|
8005
|
+
"svg",
|
|
8006
|
+
"template",
|
|
8007
|
+
"thead",
|
|
8008
|
+
"title",
|
|
8009
|
+
"video",
|
|
8010
|
+
"xmp"
|
|
8011
|
+
]);
|
|
8012
|
+
let DATA_URI_TAGS = null;
|
|
8013
|
+
const DEFAULT_DATA_URI_TAGS = addToSet({}, [
|
|
8014
|
+
"audio",
|
|
8015
|
+
"video",
|
|
8016
|
+
"img",
|
|
8017
|
+
"source",
|
|
8018
|
+
"image",
|
|
8019
|
+
"track"
|
|
8020
|
+
]);
|
|
8021
|
+
let URI_SAFE_ATTRIBUTES = null;
|
|
8022
|
+
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
|
|
8023
|
+
"alt",
|
|
8024
|
+
"class",
|
|
8025
|
+
"for",
|
|
8026
|
+
"id",
|
|
8027
|
+
"label",
|
|
8028
|
+
"name",
|
|
8029
|
+
"pattern",
|
|
8030
|
+
"placeholder",
|
|
8031
|
+
"role",
|
|
8032
|
+
"summary",
|
|
8033
|
+
"title",
|
|
8034
|
+
"value",
|
|
8035
|
+
"style",
|
|
8036
|
+
"xmlns"
|
|
8037
|
+
]);
|
|
8038
|
+
const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
|
8039
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
8040
|
+
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
8041
|
+
let NAMESPACE = HTML_NAMESPACE;
|
|
8042
|
+
let IS_EMPTY_INPUT = false;
|
|
8043
|
+
let ALLOWED_NAMESPACES = null;
|
|
8044
|
+
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [
|
|
8045
|
+
MATHML_NAMESPACE,
|
|
8046
|
+
SVG_NAMESPACE,
|
|
8047
|
+
HTML_NAMESPACE
|
|
8048
|
+
], stringToString);
|
|
8049
|
+
const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze([
|
|
8050
|
+
"mi",
|
|
8051
|
+
"mo",
|
|
8052
|
+
"mn",
|
|
8053
|
+
"ms",
|
|
8054
|
+
"mtext"
|
|
8055
|
+
]);
|
|
8056
|
+
let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
|
|
8057
|
+
const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
|
|
8058
|
+
let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
|
|
8059
|
+
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
|
|
8060
|
+
"title",
|
|
8061
|
+
"style",
|
|
8062
|
+
"font",
|
|
8063
|
+
"a",
|
|
8064
|
+
"script"
|
|
8065
|
+
]);
|
|
8066
|
+
let PARSER_MEDIA_TYPE = null;
|
|
8067
|
+
const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
|
|
8068
|
+
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
|
8069
|
+
let transformCaseFunc = null;
|
|
8070
|
+
let CONFIG = null;
|
|
8071
|
+
const formElement = document.createElement("form");
|
|
8072
|
+
const isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
8073
|
+
return testValue instanceof RegExp || testValue instanceof Function;
|
|
8074
|
+
};
|
|
8075
|
+
/**
|
|
8076
|
+
* _parseConfig
|
|
8077
|
+
*
|
|
8078
|
+
* @param cfg optional config literal
|
|
8079
|
+
*/
|
|
8080
|
+
const _parseConfig = function _parseConfig() {
|
|
8081
|
+
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
8082
|
+
if (CONFIG && CONFIG === cfg) return;
|
|
8083
|
+
if (!cfg || typeof cfg !== "object") cfg = {};
|
|
8084
|
+
cfg = clone(cfg);
|
|
8085
|
+
PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
|
8086
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
|
|
8087
|
+
ALLOWED_TAGS = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, { transform: transformCaseFunc });
|
|
8088
|
+
ALLOWED_ATTR = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, { transform: transformCaseFunc });
|
|
8089
|
+
ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, { transform: stringToString });
|
|
8090
|
+
URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, "ADD_URI_SAFE_ATTR", DEFAULT_URI_SAFE_ATTRIBUTES, {
|
|
8091
|
+
transform: transformCaseFunc,
|
|
8092
|
+
base: DEFAULT_URI_SAFE_ATTRIBUTES
|
|
8093
|
+
});
|
|
8094
|
+
DATA_URI_TAGS = _resolveSetOption(cfg, "ADD_DATA_URI_TAGS", DEFAULT_DATA_URI_TAGS, {
|
|
8095
|
+
transform: transformCaseFunc,
|
|
8096
|
+
base: DEFAULT_DATA_URI_TAGS
|
|
8097
|
+
});
|
|
8098
|
+
FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, { transform: transformCaseFunc });
|
|
8099
|
+
FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), { transform: transformCaseFunc });
|
|
8100
|
+
FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), { transform: transformCaseFunc });
|
|
8101
|
+
USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
|
|
8102
|
+
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
|
|
8103
|
+
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
|
|
8104
|
+
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
|
|
8105
|
+
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
|
|
8106
|
+
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
|
|
8107
|
+
SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
|
|
8108
|
+
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
|
|
8109
|
+
RETURN_DOM = cfg.RETURN_DOM || false;
|
|
8110
|
+
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
|
|
8111
|
+
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
|
|
8112
|
+
FORCE_BODY = cfg.FORCE_BODY || false;
|
|
8113
|
+
SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
|
|
8114
|
+
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
|
|
8115
|
+
KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
|
|
8116
|
+
IN_PLACE = cfg.IN_PLACE || false;
|
|
8117
|
+
IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
|
|
8118
|
+
NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
|
|
8119
|
+
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);
|
|
8120
|
+
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);
|
|
8121
|
+
const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create$1(null);
|
|
8122
|
+
CUSTOM_ELEMENT_HANDLING = create$1(null);
|
|
8123
|
+
if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
|
|
8124
|
+
if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
|
|
8125
|
+
if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
|
|
8126
|
+
seal(CUSTOM_ELEMENT_HANDLING);
|
|
8127
|
+
if (SAFE_FOR_TEMPLATES) ALLOW_DATA_ATTR = false;
|
|
8128
|
+
if (RETURN_DOM_FRAGMENT) RETURN_DOM = true;
|
|
8129
|
+
if (USE_PROFILES) {
|
|
8130
|
+
ALLOWED_TAGS = addToSet({}, text);
|
|
8131
|
+
ALLOWED_ATTR = create$1(null);
|
|
8132
|
+
if (USE_PROFILES.html === true) {
|
|
8133
|
+
addToSet(ALLOWED_TAGS, html$1);
|
|
8134
|
+
addToSet(ALLOWED_ATTR, html);
|
|
8135
|
+
}
|
|
8136
|
+
if (USE_PROFILES.svg === true) {
|
|
8137
|
+
addToSet(ALLOWED_TAGS, svg$1);
|
|
8138
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
8139
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
8140
|
+
}
|
|
8141
|
+
if (USE_PROFILES.svgFilters === true) {
|
|
8142
|
+
addToSet(ALLOWED_TAGS, svgFilters);
|
|
8143
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
8144
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
8145
|
+
}
|
|
8146
|
+
if (USE_PROFILES.mathMl === true) {
|
|
8147
|
+
addToSet(ALLOWED_TAGS, mathMl$1);
|
|
8148
|
+
addToSet(ALLOWED_ATTR, mathMl);
|
|
8149
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
8150
|
+
}
|
|
8151
|
+
}
|
|
8152
|
+
EXTRA_ELEMENT_HANDLING.tagCheck = null;
|
|
8153
|
+
EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
8154
|
+
if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
|
|
8155
|
+
if (typeof cfg.ADD_TAGS === "function") EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
|
|
8156
|
+
else if (arrayIsArray(cfg.ADD_TAGS)) {
|
|
8157
|
+
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
8158
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
8159
|
+
}
|
|
8160
|
+
}
|
|
8161
|
+
if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
|
|
8162
|
+
if (typeof cfg.ADD_ATTR === "function") EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
|
|
8163
|
+
else if (arrayIsArray(cfg.ADD_ATTR)) {
|
|
8164
|
+
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
8165
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
8166
|
+
}
|
|
8167
|
+
}
|
|
8168
|
+
if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
8169
|
+
if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
|
|
8170
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
8171
|
+
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
8172
|
+
}
|
|
8173
|
+
if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
|
|
8174
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
8175
|
+
addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
|
|
8176
|
+
}
|
|
8177
|
+
if (KEEP_CONTENT) ALLOWED_TAGS["#text"] = true;
|
|
8178
|
+
if (WHOLE_DOCUMENT) addToSet(ALLOWED_TAGS, [
|
|
8179
|
+
"html",
|
|
8180
|
+
"head",
|
|
8181
|
+
"body"
|
|
8182
|
+
]);
|
|
8183
|
+
if (ALLOWED_TAGS.table) {
|
|
8184
|
+
addToSet(ALLOWED_TAGS, ["tbody"]);
|
|
8185
|
+
delete FORBID_TAGS.tbody;
|
|
8186
|
+
}
|
|
8187
|
+
if (cfg.TRUSTED_TYPES_POLICY) {
|
|
8188
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
|
|
8189
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
|
|
8190
|
+
const previousTrustedTypesPolicy = trustedTypesPolicy;
|
|
8191
|
+
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
|
8192
|
+
try {
|
|
8193
|
+
emptyHTML = _createTrustedHTML("");
|
|
8194
|
+
} catch (error) {
|
|
8195
|
+
trustedTypesPolicy = previousTrustedTypesPolicy;
|
|
8196
|
+
throw error;
|
|
8197
|
+
}
|
|
8198
|
+
} else if (cfg.TRUSTED_TYPES_POLICY === null) {
|
|
8199
|
+
trustedTypesPolicy = void 0;
|
|
8200
|
+
emptyHTML = "";
|
|
8201
|
+
} else {
|
|
8202
|
+
if (trustedTypesPolicy === void 0) trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
|
|
8203
|
+
if (trustedTypesPolicy && typeof emptyHTML === "string") emptyHTML = _createTrustedHTML("");
|
|
8204
|
+
}
|
|
8205
|
+
if (freeze) freeze(cfg);
|
|
8206
|
+
CONFIG = cfg;
|
|
8207
|
+
};
|
|
8208
|
+
const ALL_SVG_TAGS = addToSet({}, [
|
|
8209
|
+
...svg$1,
|
|
8210
|
+
...svgFilters,
|
|
8211
|
+
...svgDisallowed
|
|
8212
|
+
]);
|
|
8213
|
+
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
8214
|
+
/**
|
|
8215
|
+
* Namespace rules for an element in the SVG namespace.
|
|
8216
|
+
*
|
|
8217
|
+
* @param tagName the element's lowercase tag name
|
|
8218
|
+
* @param parent the (possibly simulated) parent node
|
|
8219
|
+
* @param parentTagName the parent's lowercase tag name
|
|
8220
|
+
* @returns true if a spec-compliant parser could produce this element
|
|
8221
|
+
*/
|
|
8222
|
+
const _checkSvgNamespace = function _checkSvgNamespace(tagName, parent, parentTagName) {
|
|
8223
|
+
if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg";
|
|
8224
|
+
if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
8225
|
+
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
8226
|
+
};
|
|
8227
|
+
/**
|
|
8228
|
+
* Namespace rules for an element in the MathML namespace.
|
|
8229
|
+
*
|
|
8230
|
+
* @param tagName the element's lowercase tag name
|
|
8231
|
+
* @param parent the (possibly simulated) parent node
|
|
8232
|
+
* @param parentTagName the parent's lowercase tag name
|
|
8233
|
+
* @returns true if a spec-compliant parser could produce this element
|
|
8234
|
+
*/
|
|
8235
|
+
const _checkMathMlNamespace = function _checkMathMlNamespace(tagName, parent, parentTagName) {
|
|
8236
|
+
if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math";
|
|
8237
|
+
if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
|
|
8238
|
+
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
8239
|
+
};
|
|
8240
|
+
/**
|
|
8241
|
+
* Namespace rules for an element in the HTML namespace.
|
|
8242
|
+
*
|
|
8243
|
+
* @param tagName the element's lowercase tag name
|
|
8244
|
+
* @param parent the (possibly simulated) parent node
|
|
8245
|
+
* @param parentTagName the parent's lowercase tag name
|
|
8246
|
+
* @returns true if a spec-compliant parser could produce this element
|
|
8247
|
+
*/
|
|
8248
|
+
const _checkHtmlNamespace = function _checkHtmlNamespace(tagName, parent, parentTagName) {
|
|
8249
|
+
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false;
|
|
8250
|
+
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false;
|
|
8251
|
+
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
8252
|
+
};
|
|
8253
|
+
/**
|
|
8254
|
+
* @param element a DOM element whose namespace is being checked
|
|
8255
|
+
* @returns Return false if the element has a
|
|
8256
|
+
* namespace that a spec-compliant parser would never
|
|
8257
|
+
* return. Return true otherwise.
|
|
8258
|
+
*/
|
|
8259
|
+
const _checkValidNamespace = function _checkValidNamespace(element) {
|
|
8260
|
+
let parent = getParentNode(element);
|
|
8261
|
+
if (!parent || !parent.tagName) parent = {
|
|
8262
|
+
namespaceURI: NAMESPACE,
|
|
8263
|
+
tagName: "template"
|
|
8264
|
+
};
|
|
8265
|
+
const tagName = stringToLowerCase(element.tagName);
|
|
8266
|
+
const parentTagName = stringToLowerCase(parent.tagName);
|
|
8267
|
+
if (!ALLOWED_NAMESPACES[element.namespaceURI]) return false;
|
|
8268
|
+
if (element.namespaceURI === SVG_NAMESPACE) return _checkSvgNamespace(tagName, parent, parentTagName);
|
|
8269
|
+
if (element.namespaceURI === MATHML_NAMESPACE) return _checkMathMlNamespace(tagName, parent, parentTagName);
|
|
8270
|
+
if (element.namespaceURI === HTML_NAMESPACE) return _checkHtmlNamespace(tagName, parent, parentTagName);
|
|
8271
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) return true;
|
|
8272
|
+
return false;
|
|
8273
|
+
};
|
|
8274
|
+
/**
|
|
8275
|
+
* _forceRemove
|
|
8276
|
+
*
|
|
8277
|
+
* @param node a DOM node
|
|
8278
|
+
*/
|
|
8279
|
+
const _forceRemove = function _forceRemove(node) {
|
|
8280
|
+
arrayPush(DOMPurify.removed, { element: node });
|
|
8281
|
+
try {
|
|
8282
|
+
getParentNode(node).removeChild(node);
|
|
8283
|
+
} catch (_) {
|
|
8284
|
+
remove(node);
|
|
8285
|
+
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");
|
|
8286
|
+
}
|
|
8287
|
+
};
|
|
8288
|
+
/**
|
|
8289
|
+
* _neutralizeRoot
|
|
8290
|
+
*
|
|
8291
|
+
* Fail-closed teardown of an in-place root after the sanitize walk aborts
|
|
8292
|
+
* (campaign-3 F2). An internal throw mid-walk — e.g. a page-registered
|
|
8293
|
+
* custom element's reaction detaches a node so `_forceRemove`'s deliberate
|
|
8294
|
+
* parentless guard throws, or any other re-entrant engine mutation — would
|
|
8295
|
+
* otherwise leave the caller's *live* tree half-sanitized, with everything
|
|
8296
|
+
* after the abort point still carrying its handlers. There is no safe way
|
|
8297
|
+
* to resume the walk (the tree mutated under us), so we strip the root bare:
|
|
8298
|
+
* remove every child and every attribute, then let the caller's catch see
|
|
8299
|
+
* the original error. Clobber-safe (cached `remove`/`childNodes`/`attributes`
|
|
8300
|
+
* getters; the root was already clobber-pre-flighted at the IN_PLACE entry).
|
|
8301
|
+
*
|
|
8302
|
+
* @param root the in-place root to empty
|
|
8303
|
+
*/
|
|
8304
|
+
const _neutralizeRoot = function _neutralizeRoot(root) {
|
|
8305
|
+
_neutralizeSubtree(root);
|
|
8306
|
+
const childNodes = getChildNodes(root);
|
|
8307
|
+
if (childNodes) {
|
|
8308
|
+
const snapshot = [];
|
|
8309
|
+
arrayForEach(childNodes, (child) => {
|
|
8310
|
+
arrayPush(snapshot, child);
|
|
8311
|
+
});
|
|
8312
|
+
arrayForEach(snapshot, (child) => {
|
|
8313
|
+
try {
|
|
8314
|
+
remove(child);
|
|
8315
|
+
} catch (_) {}
|
|
8316
|
+
});
|
|
8317
|
+
}
|
|
8318
|
+
const attributes = getAttributes(root);
|
|
8319
|
+
if (attributes) for (let i = attributes.length - 1; i >= 0; --i) {
|
|
8320
|
+
const attribute = attributes[i];
|
|
8321
|
+
const name = attribute && attribute.name;
|
|
8322
|
+
if (typeof name === "string") try {
|
|
8323
|
+
root.removeAttribute(name);
|
|
8324
|
+
} catch (_) {}
|
|
8325
|
+
}
|
|
8326
|
+
};
|
|
8327
|
+
/**
|
|
8328
|
+
* _removeAttribute
|
|
8329
|
+
*
|
|
8330
|
+
* @param name an Attribute name
|
|
8331
|
+
* @param element a DOM node
|
|
8332
|
+
*/
|
|
8333
|
+
const _removeAttribute = function _removeAttribute(name, element) {
|
|
8334
|
+
try {
|
|
8335
|
+
arrayPush(DOMPurify.removed, {
|
|
8336
|
+
attribute: element.getAttributeNode(name),
|
|
8337
|
+
from: element
|
|
8338
|
+
});
|
|
8339
|
+
} catch (_) {
|
|
8340
|
+
arrayPush(DOMPurify.removed, {
|
|
8341
|
+
attribute: null,
|
|
8342
|
+
from: element
|
|
8343
|
+
});
|
|
8344
|
+
}
|
|
8345
|
+
element.removeAttribute(name);
|
|
8346
|
+
if (name === "is") if (RETURN_DOM || RETURN_DOM_FRAGMENT) try {
|
|
8347
|
+
_forceRemove(element);
|
|
8348
|
+
} catch (_) {}
|
|
8349
|
+
else try {
|
|
8350
|
+
element.setAttribute(name, "");
|
|
8351
|
+
} catch (_) {}
|
|
8352
|
+
};
|
|
8353
|
+
/**
|
|
8354
|
+
* _stripDisallowedAttributes
|
|
8355
|
+
*
|
|
8356
|
+
* Removes every attribute the active configuration does not allow from a
|
|
8357
|
+
* single element, using the same allowlist as the main attribute pass (so
|
|
8358
|
+
* `on*` handlers go, but no `/^on/` blocklist is introduced). Used only to
|
|
8359
|
+
* neutralise nodes that are being discarded from an in-place tree.
|
|
8360
|
+
*
|
|
8361
|
+
* @param element the element to strip
|
|
8362
|
+
*/
|
|
8363
|
+
const _stripDisallowedAttributes = function _stripDisallowedAttributes(element) {
|
|
8364
|
+
const attributes = getAttributes(element);
|
|
8365
|
+
if (!attributes) return;
|
|
8366
|
+
for (let i = attributes.length - 1; i >= 0; --i) {
|
|
8367
|
+
const attribute = attributes[i];
|
|
8368
|
+
const name = attribute && attribute.name;
|
|
8369
|
+
if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)]) continue;
|
|
8370
|
+
try {
|
|
8371
|
+
element.removeAttribute(name);
|
|
8372
|
+
} catch (_) {}
|
|
8373
|
+
}
|
|
8374
|
+
};
|
|
8375
|
+
/**
|
|
8376
|
+
* _neutralizeSubtree
|
|
8377
|
+
*
|
|
8378
|
+
* Completes the audit-5 F1 fix across every removal path. The KEEP_CONTENT
|
|
8379
|
+
* move-hoist neutralises only disallowed-tag removals; clobber, mXSS-canary,
|
|
8380
|
+
* namespace, comment, processing-instruction and KEEP_CONTENT:false removals
|
|
8381
|
+
* all drop their subtree wholesale via `_forceRemove`. On the IN_PLACE path
|
|
8382
|
+
* those dropped nodes are detached from the caller's LIVE tree but a
|
|
8383
|
+
* handler-bearing original among them (an `<img onerror>`/`<video>` that was
|
|
8384
|
+
* loading) keeps its queued resource event, which fires in page scope after
|
|
8385
|
+
* sanitize returns. This walks a removed subtree and strips every attribute
|
|
8386
|
+
* the active configuration does not allow — so `on*` handlers are cancelled
|
|
8387
|
+
* through the SAME allowlist that governs kept nodes, not a separate `/^on/`
|
|
8388
|
+
* blocklist. Run synchronously before sanitize returns, i.e. before any
|
|
8389
|
+
* queued event can fire. Hook-free by design: these nodes leave the output,
|
|
8390
|
+
* so firing attribute hooks for them would be surprising. Clobber-safe reads;
|
|
8391
|
+
* a doomed clobbered node may shadow `removeAttribute` (its own attributes are
|
|
8392
|
+
* irrelevant — it is discarded — while its non-clobbered descendants, e.g.
|
|
8393
|
+
* the `<img>`, are reached and scrubbed).
|
|
8394
|
+
*
|
|
8395
|
+
* @param root the root of a removed subtree to neutralise
|
|
8396
|
+
*/
|
|
8397
|
+
const _neutralizeSubtree = function _neutralizeSubtree(root) {
|
|
8398
|
+
const stack = [root];
|
|
8399
|
+
while (stack.length > 0) {
|
|
8400
|
+
const node = stack.pop();
|
|
8401
|
+
if ((getNodeType ? getNodeType(node) : node.nodeType) === NODE_TYPE.element) _stripDisallowedAttributes(node);
|
|
8402
|
+
const childNodes = getChildNodes(node);
|
|
8403
|
+
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
|
|
8404
|
+
}
|
|
8405
|
+
};
|
|
8406
|
+
/**
|
|
8407
|
+
* _neutralizePatchLinkage
|
|
8408
|
+
*
|
|
8409
|
+
* IN_PLACE entry pre-pass (declarative-partial-updates / streaming
|
|
8410
|
+
* hardening, https://github.com/WICG/declarative-partial-updates).
|
|
8411
|
+
*
|
|
8412
|
+
* The main walk strips patch linkage (`for`/`patchsrc`) and removes range
|
|
8413
|
+
* markers (PIs / markup comments) node-by-node, in document order, AS it
|
|
8414
|
+
* reaches each node. On a live in-place root that leaves a window: from the
|
|
8415
|
+
* moment the root is connected until the walk arrives at a given node, that
|
|
8416
|
+
* node's linkage is live. A patch applied on connection/stream can fire as
|
|
8417
|
+
* a microtask during the walk and inject or teleport an unsanitized DOM
|
|
8418
|
+
* range into a region the iterator has already passed and will not revisit,
|
|
8419
|
+
* so the post-return "tree is sanitized" contract is violated. Sweep the
|
|
8420
|
+
* whole tree once up front and sever every linkage before the walk begins,
|
|
8421
|
+
* closing that window.
|
|
8422
|
+
*
|
|
8423
|
+
* This CANNOT undo a patch that already fired before sanitize ran — that is
|
|
8424
|
+
* the irreducible "do not IN_PLACE a live-connected attacker tree" caveat —
|
|
8425
|
+
* but it closes everything from sanitize-start onward. Gated on SAFE_FOR_XML
|
|
8426
|
+
* to group with the rest of the declarative-partial-updates handling and
|
|
8427
|
+
* stay overridable, consistent with the codebase.
|
|
8428
|
+
*
|
|
8429
|
+
* Clobber-safe traversal (cached childNodes getter); per-node try/catch so a
|
|
8430
|
+
* clobbered root cannot defeat the sweep of its non-clobbered descendants.
|
|
8431
|
+
*
|
|
8432
|
+
* NOTE (pending real-Chrome confirmation, see test/declarative-patch-probe
|
|
8433
|
+
* .html Q1): this mirrors the existing policy of keeping `for` on
|
|
8434
|
+
* <label>/<output>. If the shipping feature can drive a patch through a
|
|
8435
|
+
* surviving `for`-on-label/output + `id` pair, this pre-pass and the
|
|
8436
|
+
* attribute check at _isBasicCustomElement's caller must additionally drop
|
|
8437
|
+
* that pair on the IN_PLACE path. Left as-is until the taxonomy is verified.
|
|
8438
|
+
*
|
|
8439
|
+
* @param root the in-place root to sweep
|
|
8440
|
+
*/
|
|
8441
|
+
const _neutralizePatchLinkage = function _neutralizePatchLinkage(root) {
|
|
8442
|
+
if (!SAFE_FOR_XML) return;
|
|
8443
|
+
const stack = [root];
|
|
8444
|
+
while (stack.length > 0) {
|
|
8445
|
+
const node = stack.pop();
|
|
8446
|
+
const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
|
|
8447
|
+
if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
|
|
8448
|
+
try {
|
|
8449
|
+
remove(node);
|
|
8450
|
+
} catch (_) {}
|
|
8451
|
+
continue;
|
|
8452
|
+
}
|
|
8453
|
+
if (nodeType === NODE_TYPE.element) {
|
|
8454
|
+
const element = node;
|
|
8455
|
+
const lcTag = transformCaseFunc(getNodeName ? getNodeName(node) : node.nodeName);
|
|
8456
|
+
try {
|
|
8457
|
+
if (element.hasAttribute && element.hasAttribute("patchsrc")) element.removeAttribute("patchsrc");
|
|
8458
|
+
if (element.hasAttribute && element.hasAttribute("for") && lcTag !== "label" && lcTag !== "output") element.removeAttribute("for");
|
|
8459
|
+
} catch (_) {}
|
|
8460
|
+
}
|
|
8461
|
+
const childNodes = getChildNodes(node);
|
|
8462
|
+
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
|
|
8463
|
+
}
|
|
8464
|
+
};
|
|
8465
|
+
/**
|
|
8466
|
+
* _initDocument
|
|
8467
|
+
*
|
|
8468
|
+
* @param dirty - a string of dirty markup
|
|
8469
|
+
* @return a DOM, filled with the dirty markup
|
|
8470
|
+
*/
|
|
8471
|
+
const _initDocument = function _initDocument(dirty) {
|
|
8472
|
+
let doc = null;
|
|
8473
|
+
let leadingWhitespace = null;
|
|
8474
|
+
if (FORCE_BODY) dirty = "<remove></remove>" + dirty;
|
|
8475
|
+
else {
|
|
8476
|
+
const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
8477
|
+
leadingWhitespace = matches && matches[0];
|
|
8478
|
+
}
|
|
8479
|
+
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>";
|
|
8480
|
+
const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
|
|
8481
|
+
if (NAMESPACE === HTML_NAMESPACE) try {
|
|
8482
|
+
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
8483
|
+
} catch (_) {}
|
|
8484
|
+
if (!doc || !doc.documentElement) {
|
|
8485
|
+
doc = implementation.createDocument(NAMESPACE, "template", null);
|
|
8486
|
+
try {
|
|
8487
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
|
8488
|
+
} catch (_) {}
|
|
8489
|
+
}
|
|
8490
|
+
const body = doc.body || doc.documentElement;
|
|
8491
|
+
if (dirty && leadingWhitespace) body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
8492
|
+
if (NAMESPACE === HTML_NAMESPACE) return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
|
|
8493
|
+
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
8494
|
+
};
|
|
8495
|
+
/**
|
|
8496
|
+
* Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
|
|
8497
|
+
*
|
|
8498
|
+
* @param root The root element or node to start traversing on.
|
|
8499
|
+
* @return The created NodeIterator
|
|
8500
|
+
*/
|
|
8501
|
+
const _createNodeIterator = function _createNodeIterator(root) {
|
|
8502
|
+
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);
|
|
8503
|
+
};
|
|
8504
|
+
/**
|
|
8505
|
+
* Replace template expression syntax (mustache, ERB, template
|
|
8506
|
+
* literal) with a space; shared by all SAFE_FOR_TEMPLATES scrub
|
|
8507
|
+
* sites. Order matters: mustache, then ERB, then template literal.
|
|
8508
|
+
*
|
|
8509
|
+
* @param value the string to scrub
|
|
8510
|
+
* @returns the scrubbed string
|
|
8511
|
+
*/
|
|
8512
|
+
const _stripTemplateExpressions = function _stripTemplateExpressions(value) {
|
|
8513
|
+
value = stringReplace(value, MUSTACHE_EXPR$1, " ");
|
|
8514
|
+
value = stringReplace(value, ERB_EXPR$1, " ");
|
|
8515
|
+
value = stringReplace(value, TMPLIT_EXPR$1, " ");
|
|
8516
|
+
return value;
|
|
8517
|
+
};
|
|
8518
|
+
/**
|
|
8519
|
+
* Strip template-engine expressions ({{...}}, ${...}, <%...%>) from the
|
|
8520
|
+
* character data of an element subtree. Used as the final safety net for
|
|
8521
|
+
* SAFE_FOR_TEMPLATES on every DOM-returning code path so that expressions
|
|
8522
|
+
* which only form after text-node normalization (e.g. fragments split across
|
|
8523
|
+
* stripped elements) cannot survive into a template-evaluating framework.
|
|
8524
|
+
*
|
|
8525
|
+
* Walks text/comment/CDATA/processing-instruction nodes and mutates `.data`
|
|
8526
|
+
* in place rather than round-tripping through innerHTML. This preserves
|
|
8527
|
+
* descendant node references (important for IN_PLACE callers), avoids a
|
|
8528
|
+
* serialize/reparse cycle, and reads literal character data — which means
|
|
8529
|
+
* `<%...%>` in text content matches the ERB regex against its real bytes
|
|
8530
|
+
* instead of the HTML-entity-escaped form innerHTML would produce.
|
|
8531
|
+
*
|
|
8532
|
+
* Attribute values are not visited here; SAFE_FOR_TEMPLATES handling for
|
|
8533
|
+
* attributes is performed during the per-node `_sanitizeAttributes` pass.
|
|
8534
|
+
*
|
|
8535
|
+
* @param node The root element whose character data should be scrubbed.
|
|
8536
|
+
*/
|
|
8537
|
+
const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
|
|
8538
|
+
var _node$querySelectorAl;
|
|
8539
|
+
node.normalize();
|
|
8540
|
+
const walker = createNodeIterator.call(node.ownerDocument || node, node, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
|
|
8541
|
+
let currentNode = walker.nextNode();
|
|
8542
|
+
while (currentNode) {
|
|
8543
|
+
currentNode.data = _stripTemplateExpressions(currentNode.data);
|
|
8544
|
+
currentNode = walker.nextNode();
|
|
8545
|
+
}
|
|
8546
|
+
const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
|
|
8547
|
+
if (templates) arrayForEach(templates, (tmpl) => {
|
|
8548
|
+
if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
|
|
8549
|
+
});
|
|
8550
|
+
};
|
|
8551
|
+
/**
|
|
8552
|
+
* _isClobbered
|
|
8553
|
+
*
|
|
8554
|
+
* Detect DOM-clobbering on HTMLFormElement nodes. Form is the only HTML
|
|
8555
|
+
* interface with [LegacyOverrideBuiltIns]; a descendant element with a
|
|
8556
|
+
* `name` attribute matching a prototype property shadows that property
|
|
8557
|
+
* on direct reads. We use this check at the IN_PLACE entry-point and
|
|
8558
|
+
* during attribute sanitization to refuse clobbered forms.
|
|
8559
|
+
*
|
|
8560
|
+
* @param element element to check for clobbering attacks
|
|
8561
|
+
* @return true if clobbered, false if safe
|
|
8562
|
+
*/
|
|
8563
|
+
const _isClobbered = function _isClobbered(element) {
|
|
8564
|
+
const realTagName = getNodeName ? getNodeName(element) : null;
|
|
8565
|
+
if (typeof realTagName !== "string") return false;
|
|
8566
|
+
if (transformCaseFunc(realTagName) !== "form") return false;
|
|
8567
|
+
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);
|
|
8568
|
+
};
|
|
8569
|
+
/**
|
|
8570
|
+
* Checks whether the given value is a DocumentFragment from any realm.
|
|
8571
|
+
*
|
|
8572
|
+
* The realm-independent replacement reads `nodeType` through the cached
|
|
8573
|
+
* Node.prototype getter and compares to the DOCUMENT_FRAGMENT_NODE
|
|
8574
|
+
* constant (11). nodeType is a numeric value resolved from the node's
|
|
8575
|
+
* internal slot, identical across realms for the same kind of node.
|
|
8576
|
+
*
|
|
8577
|
+
* @param value object to check
|
|
8578
|
+
* @return true if value is a DocumentFragment-shaped node from any realm
|
|
8579
|
+
*/
|
|
8580
|
+
const _isDocumentFragment = function _isDocumentFragment(value) {
|
|
8581
|
+
if (!getNodeType || typeof value !== "object" || value === null) return false;
|
|
8582
|
+
try {
|
|
8583
|
+
return getNodeType(value) === NODE_TYPE.documentFragment;
|
|
8584
|
+
} catch (_) {
|
|
8585
|
+
return false;
|
|
8586
|
+
}
|
|
8587
|
+
};
|
|
8588
|
+
/**
|
|
8589
|
+
* Checks whether the given object is a DOM node, including nodes that
|
|
8590
|
+
* originate from a different window/realm (e.g. an iframe's
|
|
8591
|
+
* contentDocument). The previous `value instanceof Node` check was
|
|
8592
|
+
* realm-bound: nodes from a different window failed it, causing
|
|
8593
|
+
* sanitize() to silently stringify them and reset IN_PLACE to false,
|
|
8594
|
+
* returning the original node unsanitized. See GHSA-4w3q-35jp-p934.
|
|
8595
|
+
*
|
|
8596
|
+
* @param value object to check whether it's a DOM node
|
|
8597
|
+
* @return true if value is a DOM node from any realm
|
|
8598
|
+
*/
|
|
8599
|
+
const _isNode = function _isNode(value) {
|
|
8600
|
+
if (!getNodeType || typeof value !== "object" || value === null) return false;
|
|
8601
|
+
try {
|
|
8602
|
+
return typeof getNodeType(value) === "number";
|
|
8603
|
+
} catch (_) {
|
|
8604
|
+
return false;
|
|
8605
|
+
}
|
|
8606
|
+
};
|
|
8607
|
+
function _executeHooks(hooks, currentNode, data) {
|
|
8608
|
+
if (hooks.length === 0) return;
|
|
8609
|
+
arrayForEach(hooks, (hook) => {
|
|
8610
|
+
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
8611
|
+
});
|
|
8612
|
+
}
|
|
8613
|
+
/**
|
|
8614
|
+
* Structural-threat checks that condemn a node regardless of the
|
|
8615
|
+
* allowlists: mXSS via namespace confusion, risky CSS construction,
|
|
8616
|
+
* processing instructions, markup-bearing comments. Pure predicate;
|
|
8617
|
+
* the caller removes. Check order is load-bearing.
|
|
8618
|
+
*
|
|
8619
|
+
* @param currentNode the node to inspect
|
|
8620
|
+
* @param tagName the node's transformCaseFunc'd tag name
|
|
8621
|
+
* @return true if the node must be removed
|
|
8622
|
+
*/
|
|
8623
|
+
const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName) {
|
|
8624
|
+
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
|
|
8625
|
+
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) return true;
|
|
8626
|
+
if (currentNode.nodeType === NODE_TYPE.processingInstruction) return true;
|
|
8627
|
+
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) return true;
|
|
8628
|
+
return false;
|
|
8629
|
+
};
|
|
8630
|
+
/**
|
|
8631
|
+
* Handle a node whose tag is forbidden or not allowlisted: keep
|
|
8632
|
+
* allowed custom elements (false return exits _sanitizeElements
|
|
8633
|
+
* early - the namespace and fallback-tag removal checks are
|
|
8634
|
+
* intentionally skipped for kept custom elements), else hoist
|
|
8635
|
+
* content per KEEP_CONTENT and remove.
|
|
8636
|
+
*
|
|
8637
|
+
* A kept custom element is the ONLY case in which this function
|
|
8638
|
+
* returns false, so the caller uses that return value to run the
|
|
8639
|
+
* afterSanitizeElements hook on the kept element and keep the
|
|
8640
|
+
* element-hook lifecycle consistent with normal allowlisted
|
|
8641
|
+
* elements (GHSA-c2j3-45gr-mqc4).
|
|
8642
|
+
*
|
|
8643
|
+
* @param currentNode the disallowed node
|
|
8644
|
+
* @param tagName the node's transformCaseFunc'd tag name
|
|
8645
|
+
* @return true if the node was removed, false if kept
|
|
8646
|
+
*/
|
|
8647
|
+
const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName) {
|
|
8648
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
8649
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
8650
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
|
|
8651
|
+
}
|
|
8652
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
8653
|
+
const parentNode = getParentNode(currentNode);
|
|
8654
|
+
const childNodes = getChildNodes(currentNode);
|
|
8655
|
+
if (childNodes && parentNode) {
|
|
8656
|
+
const childCount = childNodes.length;
|
|
8657
|
+
for (let i = childCount - 1; i >= 0; --i) {
|
|
8658
|
+
const hoisted = IN_PLACE ? childNodes[i] : cloneNode(childNodes[i], true);
|
|
8659
|
+
parentNode.insertBefore(hoisted, getNextSibling(currentNode));
|
|
8660
|
+
}
|
|
8661
|
+
}
|
|
8662
|
+
}
|
|
8663
|
+
_forceRemove(currentNode);
|
|
8664
|
+
return true;
|
|
8665
|
+
};
|
|
8666
|
+
/**
|
|
8667
|
+
* _sanitizeElements
|
|
8668
|
+
*
|
|
8669
|
+
* @protect nodeName
|
|
8670
|
+
* @protect textContent
|
|
8671
|
+
* @protect removeChild
|
|
8672
|
+
* @param currentNode to check for permission to exist
|
|
8673
|
+
* @return true if node was killed, false if left alive
|
|
8674
|
+
*/
|
|
8675
|
+
const _sanitizeElements = function _sanitizeElements(currentNode, root) {
|
|
8676
|
+
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
8677
|
+
if (currentNode !== root && getParentNode(currentNode) === null) return true;
|
|
8678
|
+
if (_isClobbered(currentNode)) {
|
|
8679
|
+
_forceRemove(currentNode);
|
|
8680
|
+
return true;
|
|
8681
|
+
}
|
|
8682
|
+
const tagName = transformCaseFunc(getNodeName ? getNodeName(currentNode) : currentNode.nodeName);
|
|
8683
|
+
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
|
8684
|
+
tagName,
|
|
8685
|
+
allowedTags: ALLOWED_TAGS
|
|
8686
|
+
});
|
|
8687
|
+
if (currentNode !== root && getParentNode(currentNode) === null) return true;
|
|
8688
|
+
if (_isUnsafeNode(currentNode, tagName)) {
|
|
8689
|
+
_forceRemove(currentNode);
|
|
8690
|
+
return true;
|
|
8691
|
+
}
|
|
8692
|
+
if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
|
|
8693
|
+
const removed = _sanitizeDisallowedNode(currentNode, tagName);
|
|
8694
|
+
if (removed === false) _executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
8695
|
+
return removed;
|
|
8696
|
+
}
|
|
8697
|
+
if ((getNodeType ? getNodeType(currentNode) : currentNode.nodeType) === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
|
|
8698
|
+
_forceRemove(currentNode);
|
|
8699
|
+
return true;
|
|
8700
|
+
}
|
|
8701
|
+
if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
|
|
8702
|
+
_forceRemove(currentNode);
|
|
8703
|
+
return true;
|
|
8704
|
+
}
|
|
8705
|
+
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
8706
|
+
const content = _stripTemplateExpressions(currentNode.textContent);
|
|
8707
|
+
if (currentNode.textContent !== content) {
|
|
8708
|
+
arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
|
|
8709
|
+
currentNode.textContent = content;
|
|
8710
|
+
}
|
|
8711
|
+
}
|
|
8712
|
+
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
8713
|
+
return false;
|
|
8714
|
+
};
|
|
8715
|
+
/**
|
|
8716
|
+
* _isValidAttribute
|
|
8717
|
+
*
|
|
8718
|
+
* @param lcTag Lowercase tag name of containing element.
|
|
8719
|
+
* @param lcName Lowercase attribute name.
|
|
8720
|
+
* @param value Attribute value.
|
|
8721
|
+
* @return Returns true if `value` is valid, otherwise false.
|
|
8722
|
+
*/
|
|
8723
|
+
const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
8724
|
+
if (FORBID_ATTR[lcName]) return false;
|
|
8725
|
+
if (SAFE_FOR_XML && lcName === "patchsrc") return false;
|
|
8726
|
+
if (SAFE_FOR_XML && lcName === "for" && lcTag !== "label" && lcTag !== "output") return false;
|
|
8727
|
+
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) return false;
|
|
8728
|
+
const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
|
|
8729
|
+
if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName));
|
|
8730
|
+
else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName));
|
|
8731
|
+
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)));
|
|
8732
|
+
else return false;
|
|
8733
|
+
else if (URI_SAFE_ATTRIBUTES[lcName]);
|
|
8734
|
+
else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, "")));
|
|
8735
|
+
else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]);
|
|
8736
|
+
else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, "")));
|
|
8737
|
+
else if (value) return false;
|
|
8738
|
+
return true;
|
|
8739
|
+
};
|
|
8740
|
+
const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, [
|
|
8741
|
+
"annotation-xml",
|
|
8742
|
+
"color-profile",
|
|
8743
|
+
"font-face",
|
|
8744
|
+
"font-face-format",
|
|
8745
|
+
"font-face-name",
|
|
8746
|
+
"font-face-src",
|
|
8747
|
+
"font-face-uri",
|
|
8748
|
+
"missing-glyph"
|
|
8749
|
+
]);
|
|
8750
|
+
/**
|
|
8751
|
+
* _isBasicCustomElement
|
|
8752
|
+
* checks if at least one dash is included in tagName, and it's not the first char
|
|
8753
|
+
* for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
|
|
8754
|
+
*
|
|
8755
|
+
* @param tagName name of the tag of the node to sanitize
|
|
8756
|
+
* @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
|
|
8757
|
+
*/
|
|
8758
|
+
const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
|
|
8759
|
+
return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
|
|
8760
|
+
};
|
|
8761
|
+
/**
|
|
8762
|
+
* Wrap an attribute value in the matching Trusted Types object when
|
|
8763
|
+
* the active policy requires it. Namespaced attributes pass through
|
|
8764
|
+
* unchanged (no TT support yet, see
|
|
8765
|
+
* https://bugs.chromium.org/p/chromium/issues/detail?id=1305293).
|
|
8766
|
+
*
|
|
8767
|
+
* @param lcTag lowercase tag name of the containing element
|
|
8768
|
+
* @param lcName lowercase attribute name
|
|
8769
|
+
* @param namespaceURI the attribute's namespace, if any
|
|
8770
|
+
* @param value the attribute value to wrap
|
|
8771
|
+
* @return the value, wrapped when Trusted Types demand it
|
|
8772
|
+
*/
|
|
8773
|
+
const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value) {
|
|
8774
|
+
if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI) switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
8775
|
+
case "TrustedHTML": return _createTrustedHTML(value);
|
|
8776
|
+
case "TrustedScriptURL": return _createTrustedScriptURL(value);
|
|
8777
|
+
}
|
|
8778
|
+
return value;
|
|
8779
|
+
};
|
|
8780
|
+
/**
|
|
8781
|
+
* Write a modified attribute value back onto the element. On
|
|
8782
|
+
* success, re-probe for clobbering introduced by the new value and
|
|
8783
|
+
* remove the element when found; otherwise pop the removal entry
|
|
8784
|
+
* recorded by the earlier _removeAttribute (long-standing pairing
|
|
8785
|
+
* with the SANITIZE_NAMED_PROPS path - do not "fix" casually). On
|
|
8786
|
+
* failure, remove the attribute instead.
|
|
8787
|
+
*
|
|
8788
|
+
* @param currentNode the element carrying the attribute
|
|
8789
|
+
* @param name the attribute name as present on the element
|
|
8790
|
+
* @param namespaceURI the attribute's namespace, if any
|
|
8791
|
+
* @param value the new attribute value
|
|
8792
|
+
*/
|
|
8793
|
+
const _setAttributeValue = function _setAttributeValue(currentNode, name, namespaceURI, value) {
|
|
8794
|
+
try {
|
|
8795
|
+
if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
|
|
8796
|
+
else currentNode.setAttribute(name, value);
|
|
8797
|
+
if (_isClobbered(currentNode)) _forceRemove(currentNode);
|
|
8798
|
+
else arrayPop(DOMPurify.removed);
|
|
8799
|
+
} catch (_) {
|
|
8800
|
+
_removeAttribute(name, currentNode);
|
|
8801
|
+
}
|
|
8802
|
+
};
|
|
8803
|
+
/**
|
|
8804
|
+
* _sanitizeAttributes
|
|
8805
|
+
*
|
|
8806
|
+
* @protect attributes
|
|
8807
|
+
* @protect nodeName
|
|
8808
|
+
* @protect removeAttribute
|
|
8809
|
+
* @protect setAttribute
|
|
8810
|
+
*
|
|
8811
|
+
* @param currentNode to sanitize
|
|
8812
|
+
*/
|
|
8813
|
+
const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
8814
|
+
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
8815
|
+
const attributes = currentNode.attributes;
|
|
8816
|
+
if (!attributes || _isClobbered(currentNode)) return;
|
|
8817
|
+
const hookEvent = {
|
|
8818
|
+
attrName: "",
|
|
8819
|
+
attrValue: "",
|
|
8820
|
+
keepAttr: true,
|
|
8821
|
+
allowedAttributes: ALLOWED_ATTR,
|
|
8822
|
+
forceKeepAttr: void 0
|
|
8823
|
+
};
|
|
8824
|
+
let l = attributes.length;
|
|
8825
|
+
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
8826
|
+
while (l--) {
|
|
8827
|
+
const attr = attributes[l];
|
|
8828
|
+
const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
|
|
8829
|
+
const lcName = transformCaseFunc(name);
|
|
8830
|
+
const initValue = attrValue;
|
|
8831
|
+
let value = name === "value" ? initValue : stringTrim(initValue);
|
|
8832
|
+
hookEvent.attrName = lcName;
|
|
8833
|
+
hookEvent.attrValue = value;
|
|
8834
|
+
hookEvent.keepAttr = true;
|
|
8835
|
+
hookEvent.forceKeepAttr = void 0;
|
|
8836
|
+
_executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
|
|
8837
|
+
value = hookEvent.attrValue;
|
|
8838
|
+
if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
|
|
8839
|
+
_removeAttribute(name, currentNode);
|
|
8840
|
+
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
8841
|
+
}
|
|
8842
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
|
|
8843
|
+
_removeAttribute(name, currentNode);
|
|
8844
|
+
continue;
|
|
8845
|
+
}
|
|
8846
|
+
if (lcName === "attributename" && stringMatch(value, "href")) {
|
|
8847
|
+
_removeAttribute(name, currentNode);
|
|
8848
|
+
continue;
|
|
8849
|
+
}
|
|
8850
|
+
if (hookEvent.forceKeepAttr) continue;
|
|
8851
|
+
if (!hookEvent.keepAttr) {
|
|
8852
|
+
_removeAttribute(name, currentNode);
|
|
8853
|
+
continue;
|
|
8854
|
+
}
|
|
8855
|
+
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
|
|
8856
|
+
_removeAttribute(name, currentNode);
|
|
8857
|
+
continue;
|
|
8858
|
+
}
|
|
8859
|
+
if (SAFE_FOR_TEMPLATES) value = _stripTemplateExpressions(value);
|
|
8860
|
+
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
8861
|
+
_removeAttribute(name, currentNode);
|
|
8862
|
+
continue;
|
|
8863
|
+
}
|
|
8864
|
+
value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
|
|
8865
|
+
if (value !== initValue) _setAttributeValue(currentNode, name, namespaceURI, value);
|
|
8866
|
+
}
|
|
8867
|
+
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
8868
|
+
};
|
|
8869
|
+
/**
|
|
8870
|
+
* _sanitizeShadowDOM
|
|
8871
|
+
*
|
|
8872
|
+
* @param fragment to iterate over recursively
|
|
8873
|
+
*/
|
|
8874
|
+
const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
|
|
8875
|
+
let shadowNode = null;
|
|
8876
|
+
const shadowIterator = _createNodeIterator(fragment);
|
|
8877
|
+
_executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
|
|
8878
|
+
while (shadowNode = shadowIterator.nextNode()) {
|
|
8879
|
+
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
|
8880
|
+
_sanitizeElements(shadowNode, fragment);
|
|
8881
|
+
_sanitizeAttributes(shadowNode);
|
|
8882
|
+
if (_isDocumentFragment(shadowNode.content)) _sanitizeShadowDOM2(shadowNode.content);
|
|
8883
|
+
if ((getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType) === NODE_TYPE.element) {
|
|
8884
|
+
const innerSr = getShadowRoot(shadowNode);
|
|
8885
|
+
if (_isDocumentFragment(innerSr)) {
|
|
8886
|
+
_sanitizeAttachedShadowRoots(innerSr);
|
|
8887
|
+
_sanitizeShadowDOM2(innerSr);
|
|
8888
|
+
}
|
|
8889
|
+
}
|
|
8890
|
+
}
|
|
8891
|
+
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
8892
|
+
};
|
|
8893
|
+
/**
|
|
8894
|
+
* _sanitizeAttachedShadowRoots
|
|
8895
|
+
*
|
|
8896
|
+
* Walks `root` and feeds every attached shadow root we encounter into
|
|
8897
|
+
* the existing _sanitizeShadowDOM pipeline. The default node iterator
|
|
8898
|
+
* does not descend into shadow trees, so nodes inside an attached
|
|
8899
|
+
* shadow root would otherwise be skipped entirely.
|
|
8900
|
+
*
|
|
8901
|
+
* Two real input paths put attached shadow roots in front of us:
|
|
8902
|
+
* 1. IN_PLACE on a DOM node that already has shadow roots attached.
|
|
8903
|
+
* 2. DOM-node input where importNode(dirty, true) deep-clones the
|
|
8904
|
+
* shadow root because it was created with `clonable: true`.
|
|
8905
|
+
*
|
|
8906
|
+
* This pass runs once, up front, so the main iteration loop (and the
|
|
8907
|
+
* existing _sanitizeShadowDOM template-content recursion) stay
|
|
8908
|
+
* untouched — string-input paths are not affected.
|
|
8909
|
+
*
|
|
8910
|
+
* @param root the subtree root to walk for attached shadow roots
|
|
8911
|
+
*/
|
|
8912
|
+
const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots(root) {
|
|
8913
|
+
const stack = [{
|
|
8914
|
+
node: root,
|
|
8915
|
+
shadow: null
|
|
8916
|
+
}];
|
|
8917
|
+
while (stack.length > 0) {
|
|
8918
|
+
const item = stack.pop();
|
|
8919
|
+
if (item.shadow) {
|
|
8920
|
+
_sanitizeShadowDOM2(item.shadow);
|
|
8921
|
+
continue;
|
|
8922
|
+
}
|
|
8923
|
+
const node = item.node;
|
|
8924
|
+
const isElement = (getNodeType ? getNodeType(node) : node.nodeType) === NODE_TYPE.element;
|
|
8925
|
+
const childNodes = getChildNodes(node);
|
|
8926
|
+
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push({
|
|
8927
|
+
node: childNodes[i],
|
|
8928
|
+
shadow: null
|
|
8929
|
+
});
|
|
8930
|
+
if (isElement) {
|
|
8931
|
+
const rootName = getNodeName ? getNodeName(node) : null;
|
|
8932
|
+
if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
|
|
8933
|
+
const content = node.content;
|
|
8934
|
+
if (_isDocumentFragment(content)) stack.push({
|
|
8935
|
+
node: content,
|
|
8936
|
+
shadow: null
|
|
8937
|
+
});
|
|
8938
|
+
}
|
|
8939
|
+
}
|
|
8940
|
+
if (isElement) {
|
|
8941
|
+
const sr = getShadowRoot(node);
|
|
8942
|
+
if (_isDocumentFragment(sr)) stack.push({
|
|
8943
|
+
node: null,
|
|
8944
|
+
shadow: sr
|
|
8945
|
+
}, {
|
|
8946
|
+
node: sr,
|
|
8947
|
+
shadow: null
|
|
8948
|
+
});
|
|
8949
|
+
}
|
|
8950
|
+
}
|
|
8951
|
+
};
|
|
8952
|
+
DOMPurify.sanitize = function(dirty) {
|
|
8953
|
+
let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
8954
|
+
let body = null;
|
|
8955
|
+
let importedNode = null;
|
|
8956
|
+
let currentNode = null;
|
|
8957
|
+
let returnNode = null;
|
|
8958
|
+
IS_EMPTY_INPUT = !dirty;
|
|
8959
|
+
if (IS_EMPTY_INPUT) dirty = "<!-->";
|
|
8960
|
+
if (typeof dirty !== "string" && !_isNode(dirty)) {
|
|
8961
|
+
dirty = stringifyValue(dirty);
|
|
8962
|
+
if (typeof dirty !== "string") throw typeErrorCreate("dirty is not a string, aborting");
|
|
8963
|
+
}
|
|
8964
|
+
if (!DOMPurify.isSupported) return dirty;
|
|
8965
|
+
if (SET_CONFIG) {
|
|
8966
|
+
ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
|
|
8967
|
+
ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
|
|
8968
|
+
} else _parseConfig(cfg);
|
|
8969
|
+
if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
8970
|
+
if (hooks.uponSanitizeAttribute.length > 0) ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
8971
|
+
DOMPurify.removed = [];
|
|
8972
|
+
const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
|
|
8973
|
+
if (inPlace) {
|
|
8974
|
+
_neutralizePatchLinkage(dirty);
|
|
8975
|
+
const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName;
|
|
8976
|
+
if (typeof nn === "string") {
|
|
8977
|
+
const tagName = transformCaseFunc(nn);
|
|
8978
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
8979
|
+
_neutralizeRoot(dirty);
|
|
8980
|
+
throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
|
8981
|
+
}
|
|
8982
|
+
}
|
|
8983
|
+
if (_isClobbered(dirty)) {
|
|
8984
|
+
_neutralizeRoot(dirty);
|
|
8985
|
+
throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
|
|
8986
|
+
}
|
|
8987
|
+
try {
|
|
8988
|
+
_sanitizeAttachedShadowRoots(dirty);
|
|
8989
|
+
} catch (error) {
|
|
8990
|
+
_neutralizeRoot(dirty);
|
|
8991
|
+
throw error;
|
|
8992
|
+
}
|
|
8993
|
+
} else if (_isNode(dirty)) {
|
|
8994
|
+
body = _initDocument("<!---->");
|
|
8995
|
+
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
8996
|
+
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode;
|
|
8997
|
+
else if (importedNode.nodeName === "HTML") body = importedNode;
|
|
8998
|
+
else body.appendChild(importedNode);
|
|
8999
|
+
_sanitizeAttachedShadowRoots(importedNode);
|
|
9000
|
+
} else {
|
|
9001
|
+
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
|
|
9002
|
+
body = _initDocument(dirty);
|
|
9003
|
+
if (!body) return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
|
|
9004
|
+
}
|
|
9005
|
+
if (body && FORCE_BODY) _forceRemove(body.firstChild);
|
|
9006
|
+
const walkRoot = inPlace ? dirty : body;
|
|
9007
|
+
const nodeIterator = _createNodeIterator(walkRoot);
|
|
9008
|
+
try {
|
|
9009
|
+
while (currentNode = nodeIterator.nextNode()) {
|
|
9010
|
+
_sanitizeElements(currentNode, walkRoot);
|
|
9011
|
+
_sanitizeAttributes(currentNode);
|
|
9012
|
+
if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content);
|
|
9013
|
+
}
|
|
9014
|
+
} catch (error) {
|
|
9015
|
+
if (inPlace) {
|
|
9016
|
+
_neutralizeRoot(dirty);
|
|
9017
|
+
arrayForEach(DOMPurify.removed, (entry) => {
|
|
9018
|
+
if (entry.element) _neutralizeSubtree(entry.element);
|
|
9019
|
+
});
|
|
9020
|
+
}
|
|
9021
|
+
throw error;
|
|
9022
|
+
}
|
|
9023
|
+
if (inPlace) {
|
|
9024
|
+
arrayForEach(DOMPurify.removed, (entry) => {
|
|
9025
|
+
if (entry.element) _neutralizeSubtree(entry.element);
|
|
9026
|
+
});
|
|
9027
|
+
if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(dirty);
|
|
9028
|
+
return dirty;
|
|
9029
|
+
}
|
|
9030
|
+
if (RETURN_DOM) {
|
|
9031
|
+
if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(body);
|
|
9032
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
9033
|
+
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
9034
|
+
while (body.firstChild) returnNode.appendChild(body.firstChild);
|
|
9035
|
+
} else returnNode = body;
|
|
9036
|
+
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) returnNode = importNode.call(originalDocument, returnNode, true);
|
|
9037
|
+
return returnNode;
|
|
9038
|
+
}
|
|
9039
|
+
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
9040
|
+
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;
|
|
9041
|
+
if (SAFE_FOR_TEMPLATES) serializedHTML = _stripTemplateExpressions(serializedHTML);
|
|
9042
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
|
|
9043
|
+
};
|
|
9044
|
+
DOMPurify.setConfig = function() {
|
|
9045
|
+
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
9046
|
+
_parseConfig(cfg);
|
|
9047
|
+
SET_CONFIG = true;
|
|
9048
|
+
SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
|
|
9049
|
+
SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
|
|
9050
|
+
};
|
|
9051
|
+
DOMPurify.clearConfig = function() {
|
|
9052
|
+
CONFIG = null;
|
|
9053
|
+
SET_CONFIG = false;
|
|
9054
|
+
SET_CONFIG_ALLOWED_TAGS = null;
|
|
9055
|
+
SET_CONFIG_ALLOWED_ATTR = null;
|
|
9056
|
+
trustedTypesPolicy = defaultTrustedTypesPolicy;
|
|
9057
|
+
emptyHTML = "";
|
|
9058
|
+
};
|
|
9059
|
+
DOMPurify.isValidAttribute = function(tag, attr, value) {
|
|
9060
|
+
if (!CONFIG) _parseConfig({});
|
|
9061
|
+
const lcTag = transformCaseFunc(tag);
|
|
9062
|
+
const lcName = transformCaseFunc(attr);
|
|
9063
|
+
return _isValidAttribute(lcTag, lcName, value);
|
|
9064
|
+
};
|
|
9065
|
+
DOMPurify.addHook = function(entryPoint, hookFunction) {
|
|
9066
|
+
if (typeof hookFunction !== "function") return;
|
|
9067
|
+
if (!objectHasOwnProperty(hooks, entryPoint)) return;
|
|
9068
|
+
arrayPush(hooks[entryPoint], hookFunction);
|
|
9069
|
+
};
|
|
9070
|
+
DOMPurify.removeHook = function(entryPoint, hookFunction) {
|
|
9071
|
+
if (!objectHasOwnProperty(hooks, entryPoint)) return;
|
|
9072
|
+
if (hookFunction !== void 0) {
|
|
9073
|
+
const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
9074
|
+
return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
|
|
9075
|
+
}
|
|
9076
|
+
return arrayPop(hooks[entryPoint]);
|
|
9077
|
+
};
|
|
9078
|
+
DOMPurify.removeHooks = function(entryPoint) {
|
|
9079
|
+
if (!objectHasOwnProperty(hooks, entryPoint)) return;
|
|
9080
|
+
hooks[entryPoint] = [];
|
|
9081
|
+
};
|
|
9082
|
+
DOMPurify.removeAllHooks = function() {
|
|
9083
|
+
hooks = _createHooksMap();
|
|
9084
|
+
};
|
|
9085
|
+
return DOMPurify;
|
|
9086
|
+
}
|
|
9087
|
+
createDOMPurify();
|
|
9088
|
+
//#endregion
|
|
9089
|
+
//#region ../utils/dist/index.js
|
|
9090
|
+
var __defProp = Object.defineProperty;
|
|
9091
|
+
var __exportAll = (all, no_symbols) => {
|
|
9092
|
+
let target = {};
|
|
9093
|
+
for (var name in all) __defProp(target, name, {
|
|
9094
|
+
get: all[name],
|
|
9095
|
+
enumerable: true
|
|
9096
|
+
});
|
|
9097
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
9098
|
+
return target;
|
|
9099
|
+
};
|
|
9100
|
+
Object.assign({}, ...[
|
|
9101
|
+
{
|
|
9102
|
+
id: "search",
|
|
9103
|
+
normalize(searchTerm, caseSensitiveSearch) {
|
|
9104
|
+
return caseSensitiveSearch ? searchTerm : searchTerm.toLowerCase();
|
|
9105
|
+
},
|
|
9106
|
+
test(text, normalizedSearchTerm, caseSensitiveSearch, inverseSearch) {
|
|
9107
|
+
const matches = (caseSensitiveSearch ? text : text.toLowerCase()).includes(normalizedSearchTerm);
|
|
9108
|
+
return inverseSearch ? !matches : matches;
|
|
9109
|
+
}
|
|
9110
|
+
},
|
|
9111
|
+
{
|
|
9112
|
+
id: "wildcard",
|
|
9113
|
+
normalize(searchTerm, caseSensitiveSearch) {
|
|
9114
|
+
if (searchTerm.length > 0) searchTerm = `^${searchTerm.replace(/[-[\]{}()+.,\\^$|#\s]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".?")}$`;
|
|
9115
|
+
else return { test: () => false };
|
|
9116
|
+
try {
|
|
9117
|
+
return new RegExp(searchTerm, caseSensitiveSearch ? "" : "i");
|
|
9118
|
+
} catch (_error) {
|
|
9119
|
+
return /$^/;
|
|
9120
|
+
}
|
|
9121
|
+
},
|
|
9122
|
+
test(text, normalizedSearchTerm, caseSensitiveSearch, inverseSearch) {
|
|
9123
|
+
const matches = normalizedSearchTerm.test(text);
|
|
9124
|
+
return inverseSearch ? !matches : matches;
|
|
9125
|
+
}
|
|
9126
|
+
},
|
|
9127
|
+
{
|
|
9128
|
+
id: "regex",
|
|
9129
|
+
normalize(searchTerm, caseSensitiveSearch) {
|
|
9130
|
+
try {
|
|
9131
|
+
const flags = caseSensitiveSearch ? "" : "i";
|
|
9132
|
+
return new RegExp(`^(${searchTerm})$`, flags);
|
|
9133
|
+
} catch (_error) {
|
|
9134
|
+
return /$^/;
|
|
9135
|
+
}
|
|
9136
|
+
},
|
|
9137
|
+
test(text, normalizedSearchTerm, caseSensitiveSearch, inverseSearch) {
|
|
9138
|
+
const matches = normalizedSearchTerm.test(text);
|
|
9139
|
+
return inverseSearch ? !matches : matches;
|
|
9140
|
+
}
|
|
9141
|
+
},
|
|
9142
|
+
{
|
|
9143
|
+
id: "type",
|
|
9144
|
+
normalize(selectedTypes) {
|
|
9145
|
+
return { test: (type) => selectedTypes.includes(type) };
|
|
9146
|
+
},
|
|
9147
|
+
test(type, normalizedSearchTerm) {
|
|
9148
|
+
if (typeof type === "undefined") return false;
|
|
9149
|
+
return normalizedSearchTerm.test(type);
|
|
9150
|
+
}
|
|
9151
|
+
}
|
|
9152
|
+
].map((obj) => ({ [obj.id]: obj })));
|
|
9153
|
+
var formatFileSize = (bytes) => {
|
|
9154
|
+
return prettyBytes(Number.isFinite(bytes) && bytes >= 0 ? bytes : 0);
|
|
9155
|
+
};
|
|
9156
|
+
var yearsPart$1 = "(\\d+)\\s*y(?:ears?)?";
|
|
9157
|
+
var monthsPart$1 = "(\\d+)\\s*m(?:o(?:nths?)?)?";
|
|
9158
|
+
var weeksPart$1 = "(\\d+)\\s*w(?:eeks?)?";
|
|
9159
|
+
var daysPart$1 = "(\\d+)\\s*d(?:ays?)?";
|
|
9160
|
+
var hoursPart$1 = "(\\d+)\\s*h(?:ours?)?";
|
|
9161
|
+
var minutesPart$1 = "(\\d+)\\s*m(?:in(?:s|utes?)?)?";
|
|
9162
|
+
var secondsPart$1 = "(\\d+)(?:[,.](\\d{1,3}))?\\s*s(?:ec(?:s|onds?)?)?";
|
|
9163
|
+
/**
|
|
9164
|
+
* Matches a human readable period string, e.g. "1y 2mo 3weeks 4day" (each part is optional)
|
|
9165
|
+
*/
|
|
9166
|
+
var humanReadablePeriodRegex$1 = new RegExp(`^(?:${yearsPart$1})?\\s*(?:${monthsPart$1})?\\s*(?:${weeksPart$1})?\\s*(?:${daysPart$1})?\\s*$`, "i");
|
|
9167
|
+
/**
|
|
9168
|
+
* Matches a human readable duration string, e.g. "1h 2m 3.456s" (each part is optional)
|
|
9169
|
+
*/
|
|
9170
|
+
var humanReadableDurationRegex$1 = new RegExp(`^(?:${hoursPart$1})?\\s*(?:${minutesPart$1})?\\s*(?:${secondsPart$1})?$`, "i");
|
|
9171
|
+
new RegExp(`^\\s*-\\s*\\(\\s*${humanReadablePeriodRegex$1.source.replace(/[$^]/g, "")}\\s*\\)\\s*$`, "i");
|
|
9172
|
+
new RegExp(`^\\s*-\\s*(?:\\s*${yearsPart$1}|${monthsPart$1}|${weeksPart$1}|${daysPart$1})\\s*$`, "i");
|
|
9173
|
+
new RegExp(`^\\s*-\\s*\\(\\s*${humanReadableDurationRegex$1.source.replace(/[$^]/g, "")}\\s*\\)\\s*$`, "i");
|
|
9174
|
+
new RegExp(`^\\s*-\\s*(?:\\s*${hoursPart$1}|${minutesPart$1}|${secondsPart$1})\\s*$`, "i");
|
|
9175
|
+
var AbortError = class extends Error {};
|
|
9176
|
+
/**
|
|
9177
|
+
* Helper to create an abortable promise. Returns an AbortController and a Function
|
|
9178
|
+
* that you can pass your async handler to. Whenever the AbortController signal is
|
|
9179
|
+
* aborted then the async handler's promise will reject with an AbortError
|
|
9180
|
+
*
|
|
9181
|
+
* Example:
|
|
9182
|
+
* ```
|
|
9183
|
+
* import { abortUtils } from "@knime/utils"
|
|
9184
|
+
* const myFetchCall = async (params...) => {...};
|
|
9185
|
+
*
|
|
9186
|
+
* try {
|
|
9187
|
+
* const { runAbortablePromise, abortController } = createAbortablePromise(() =>
|
|
9188
|
+
* myFetchCall(params...),
|
|
9189
|
+
* );
|
|
9190
|
+
* } catch (e) {
|
|
9191
|
+
* if (e instanceof abortUtils.AbortError) {
|
|
9192
|
+
* console.info('ignore due to abort');
|
|
9193
|
+
* return;
|
|
9194
|
+
* }
|
|
9195
|
+
* }
|
|
9196
|
+
*
|
|
9197
|
+
* // somewhere else (while request is in-flight)
|
|
9198
|
+
* abortController.abort(new abortUtils.AbortError('reason here'))
|
|
9199
|
+
* ```
|
|
9200
|
+
*/
|
|
9201
|
+
var createAbortablePromise = () => {
|
|
9202
|
+
const abortController = new AbortController();
|
|
9203
|
+
const runAbortablePromise = (request) => {
|
|
9204
|
+
return new Promise((resolve, reject) => {
|
|
9205
|
+
const abortListener = ({ target }) => {
|
|
9206
|
+
abortController.signal.removeEventListener("abort", abortListener);
|
|
9207
|
+
const reason = target.reason;
|
|
9208
|
+
reject(reason instanceof AbortError ? reason : new AbortError(reason));
|
|
9209
|
+
};
|
|
9210
|
+
request().then(resolve).catch((error) => {
|
|
9211
|
+
if (error instanceof AbortError) return;
|
|
9212
|
+
reject(error);
|
|
9213
|
+
});
|
|
9214
|
+
abortController.signal.addEventListener("abort", abortListener);
|
|
9215
|
+
});
|
|
9216
|
+
};
|
|
9217
|
+
return {
|
|
9218
|
+
abortController,
|
|
9219
|
+
runAbortablePromise
|
|
9220
|
+
};
|
|
9221
|
+
};
|
|
9222
|
+
var createUnwrappedPromise = () => {
|
|
9223
|
+
let resolve = () => {};
|
|
9224
|
+
let reject = () => {};
|
|
9225
|
+
const promise = new Promise((res, rej) => {
|
|
9226
|
+
resolve = res;
|
|
9227
|
+
reject = rej;
|
|
9228
|
+
});
|
|
9229
|
+
return {
|
|
9230
|
+
resolve,
|
|
9231
|
+
reject,
|
|
9232
|
+
promise
|
|
9233
|
+
};
|
|
9234
|
+
};
|
|
9235
|
+
/**
|
|
9236
|
+
* Returns promise that resolves after ms.
|
|
9237
|
+
*/
|
|
9238
|
+
function sleep(ms) {
|
|
9239
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
9240
|
+
}
|
|
9241
|
+
/**
|
|
9242
|
+
* Helper to add retry capability to an async function
|
|
9243
|
+
* @param fn async function
|
|
9244
|
+
* @param retryCount max number of retries. defaults to 5
|
|
9245
|
+
* @param retryDelayMS delay in-between retries in millisecs. defaults to 0
|
|
9246
|
+
* @param excludeError predicate fn to exclude specific errors from causing a retry
|
|
9247
|
+
*/
|
|
9248
|
+
async function retryPromise({ fn, retryCount = 5, retryDelayMS = 0, excludeError }) {
|
|
9249
|
+
try {
|
|
9250
|
+
return await fn();
|
|
9251
|
+
} catch (error) {
|
|
9252
|
+
if (excludeError?.(error)) throw error;
|
|
9253
|
+
if (retryCount > 0) {
|
|
9254
|
+
await sleep(retryDelayMS);
|
|
9255
|
+
return await retryPromise({
|
|
9256
|
+
fn,
|
|
9257
|
+
retryCount: retryCount - 1,
|
|
9258
|
+
retryDelayMS,
|
|
9259
|
+
excludeError
|
|
9260
|
+
});
|
|
9261
|
+
}
|
|
9262
|
+
throw error;
|
|
9263
|
+
}
|
|
9264
|
+
}
|
|
9265
|
+
var promise_exports = /* @__PURE__ */ __exportAll({
|
|
9266
|
+
AbortError: () => AbortError,
|
|
9267
|
+
DEFAULT_RETRY_COUNT: () => 5,
|
|
9268
|
+
DEFAULT_RETRY_DELAY_MS: () => 0,
|
|
9269
|
+
createAbortablePromise: () => createAbortablePromise,
|
|
9270
|
+
createUnwrappedPromise: () => createUnwrappedPromise,
|
|
9271
|
+
retryPromise: () => retryPromise
|
|
9272
|
+
});
|
|
9273
|
+
/**
|
|
9274
|
+
* Gets the file extension
|
|
9275
|
+
* @param nameOrPath can take a full file name (e.g "file.txt") or a path to a file
|
|
9276
|
+
* (e.g "file://path/to/file.txt" OR "/path/to/file.txt")
|
|
9277
|
+
* @returns just the file extension (e.g "txt")
|
|
9278
|
+
*/
|
|
9279
|
+
var getFileExtension = (nameOrPath) => {
|
|
9280
|
+
const basename = nameOrPath.split(/[\\/]/).pop() ?? "";
|
|
9281
|
+
const parts = basename.split(".");
|
|
9282
|
+
if (basename === "" || parts.length === 1) return "";
|
|
9283
|
+
return parts.at(-1) ?? "";
|
|
9284
|
+
};
|
|
9285
|
+
Object.freeze({
|
|
9286
|
+
extension: "knar",
|
|
9287
|
+
mimeType: "application/vnd.knime.workflow-group+zip",
|
|
9288
|
+
matches(file) {
|
|
9289
|
+
return getFileExtension(file.name) === this.extension;
|
|
9290
|
+
}
|
|
9291
|
+
});
|
|
9292
|
+
Object.freeze({
|
|
9293
|
+
extension: "knwf",
|
|
9294
|
+
mimeType: "application/vnd.knime.workflow+zip",
|
|
9295
|
+
matches(file) {
|
|
9296
|
+
return getFileExtension(file.name) === this.extension;
|
|
9297
|
+
},
|
|
9298
|
+
/**
|
|
9299
|
+
* Gets the name of a .knwf file without the extension. If the file is not
|
|
9300
|
+
* matched as a .knwf file then this function will return the default value,
|
|
9301
|
+
* which is empty string ("") if param is not provided
|
|
9302
|
+
*/
|
|
9303
|
+
getNameOrDefault(file, defaultValue = "") {
|
|
9304
|
+
if (!this.matches(file)) return defaultValue;
|
|
9305
|
+
return file.name.replace(`.${this.extension}`, "");
|
|
9306
|
+
}
|
|
9307
|
+
});
|
|
9308
|
+
/**
|
|
9309
|
+
* Platforms that influence how modifier keys are rendered. macOS substitutes
|
|
9310
|
+
* dedicated glyphs (`⌘`, `⌥`, `⇧`, …), every other platform uses the textual
|
|
9311
|
+
* rendering (`Ctrl`, `Alt`, `Shift`, …).
|
|
9312
|
+
*/
|
|
9313
|
+
var hotkeyPlatform = {
|
|
9314
|
+
MAC_OS: "macOS",
|
|
9315
|
+
OTHER: "other"
|
|
9316
|
+
};
|
|
9317
|
+
Object.values(hotkeyPlatform);
|
|
9318
|
+
/**
|
|
9319
|
+
*
|
|
9320
|
+
* @returns true if the platform of the user is Mac
|
|
9321
|
+
*/
|
|
9322
|
+
var isMac = () => navigator?.userAgent?.toLowerCase()?.includes("mac");
|
|
9323
|
+
var globalKeyMap = {
|
|
9324
|
+
ArrowUp: "↑",
|
|
9325
|
+
ArrowDown: "↓",
|
|
9326
|
+
ArrowLeft: "←",
|
|
9327
|
+
ArrowRight: "→",
|
|
9328
|
+
Enter: "↵",
|
|
9329
|
+
" ": "Space",
|
|
9330
|
+
CtrlOrCmd: "Ctrl"
|
|
9331
|
+
};
|
|
9332
|
+
var MacOSkeyMap = {
|
|
9333
|
+
Shift: "⇧",
|
|
9334
|
+
Delete: "⌫",
|
|
9335
|
+
CtrlOrCmd: "⌘",
|
|
9336
|
+
Ctrl: "⌃",
|
|
9337
|
+
Alt: "⌥",
|
|
9338
|
+
Enter: "↩"
|
|
9339
|
+
};
|
|
9340
|
+
/**
|
|
9341
|
+
* Returns a string representation of a single hotkey. Replaces some special key names with symbols.
|
|
9342
|
+
*
|
|
9343
|
+
* By default the platform is auto-detected from the user agent via `isMac()`.
|
|
9344
|
+
* Pass `platform` to force a specific platform's glyphs — useful for SSR,
|
|
9345
|
+
* tests, or rendering multiple platforms on the same page.
|
|
9346
|
+
*/
|
|
9347
|
+
var formatHotkey = (hotkey, platform) => {
|
|
9348
|
+
/**
|
|
9349
|
+
* Returns the symbol corresponding to the `key` based on the given
|
|
9350
|
+
* `formatMap`. Otherwise, if not found, returns the same `key` value given
|
|
9351
|
+
*/
|
|
9352
|
+
const mapSymbols = (formatMap) => (key) => formatMap[key] ?? key;
|
|
9353
|
+
/**
|
|
9354
|
+
* Pipe function implementation. Receives a list of functions to execute in order
|
|
9355
|
+
* and will pipe the parameter passed at the end to each function returning the final output
|
|
9356
|
+
*/
|
|
9357
|
+
const pipe = (...fns) => fns.reduce((f, g) => (arg) => g(f(arg)), (arg) => arg);
|
|
9358
|
+
const macKeyFormatter = pipe(mapSymbols(MacOSkeyMap), mapSymbols(globalKeyMap));
|
|
9359
|
+
const generalKeyFormatter = mapSymbols(globalKeyMap);
|
|
9360
|
+
return (platform === void 0 ? isMac() : platform === hotkeyPlatform.MAC_OS) ? macKeyFormatter(hotkey) : generalKeyFormatter(hotkey);
|
|
9361
|
+
};
|
|
9362
|
+
var getDefaultSeparator = () => isMac() ? " " : "+";
|
|
9363
|
+
/**
|
|
9364
|
+
* Returns a string representation of a list of hotkeys. Replaces some special key names with symbols
|
|
9365
|
+
*/
|
|
9366
|
+
var formatHotkeys = (hotkeys, getSeparator = getDefaultSeparator) => hotkeys.map((hotkey) => formatHotkey(hotkey)).join(getSeparator());
|
|
9367
|
+
/**
|
|
9368
|
+
* Appends a formatted hotkey shortcut to the given string. Useful for tooltips
|
|
9369
|
+
*/
|
|
9370
|
+
var textWithHotkeys = (text, hotkeys) => {
|
|
9371
|
+
return `${text} – ${formatHotkeys(hotkeys)}`;
|
|
9372
|
+
};
|
|
9373
|
+
/**
|
|
9374
|
+
* Checks whether a pressed `Digit` key falls within a numeric hotkey range such
|
|
9375
|
+
* as `1-9`.
|
|
9376
|
+
* @param keyCode - The `KeyboardEvent.code` to check (e.g. `Digit5`).
|
|
9377
|
+
* @param hotkey - The hotkey token, expected to be a single-digit range like `1-9`.
|
|
9378
|
+
* @returns True if the pressed digit lies within the inclusive range.
|
|
9379
|
+
*/
|
|
9380
|
+
var isDigitKeyInRange = (keyCode, hotkey) => {
|
|
9381
|
+
if (hotkey.length !== 3 || !keyCode?.startsWith("Digit")) return false;
|
|
9382
|
+
const keyNumber = Number(keyCode.slice(5));
|
|
9383
|
+
const [lower, upper] = hotkey.split("-");
|
|
9384
|
+
return Boolean(lower) && Boolean(upper) && Number.parseInt(lower, 10) <= keyNumber && keyNumber <= Number.parseInt(upper, 10);
|
|
9385
|
+
};
|
|
9386
|
+
/**
|
|
9387
|
+
* Checks whether a keyboard event matches a hotkey definition. The last token is
|
|
9388
|
+
* treated as the character; any preceding tokens are modifiers. The special
|
|
9389
|
+
* `CtrlOrCmd` modifier resolves to the platform's primary modifier (Meta/`⌘` on
|
|
9390
|
+
* macOS, Ctrl elsewhere).
|
|
9391
|
+
* @param event - The keyboard event to check.
|
|
9392
|
+
* @param hotkeys - The ordered hotkey tokens (modifiers followed by the character).
|
|
9393
|
+
* @returns True if the event matches the given hotkey, otherwise false.
|
|
9394
|
+
*/
|
|
9395
|
+
var match = (event, hotkeys) => {
|
|
9396
|
+
const { key, code, metaKey, ctrlKey, shiftKey, altKey } = event;
|
|
9397
|
+
const modifiers = hotkeys.slice();
|
|
9398
|
+
const character = modifiers.pop() ?? "";
|
|
9399
|
+
const ctrlOrMeta = isMac() ? "Meta" : "Ctrl";
|
|
9400
|
+
const platformModifiers = new Set(modifiers.map((modifier) => modifier === "CtrlOrCmd" ? ctrlOrMeta : modifier));
|
|
9401
|
+
const metaMatches = Boolean(metaKey) === platformModifiers.has("Meta");
|
|
9402
|
+
const ctrlMatches = Boolean(ctrlKey) === platformModifiers.has("Ctrl");
|
|
9403
|
+
const shiftMatches = Boolean(shiftKey) === platformModifiers.has("Shift");
|
|
9404
|
+
const altMatches = Boolean(altKey) === platformModifiers.has("Alt");
|
|
9405
|
+
const keysMatch = key.toUpperCase() === character.toUpperCase() || character.includes("-") && isDigitKeyInRange(code, character) || isMac() && character === "Delete" && key === "Backspace";
|
|
9406
|
+
return metaMatches && ctrlMatches && shiftMatches && altMatches && keysMatch;
|
|
9407
|
+
};
|
|
9408
|
+
/**
|
|
9409
|
+
* Returns the name of the primary modifier key for the current platform.
|
|
9410
|
+
*/
|
|
9411
|
+
var getMetaOrCtrlKey = () => {
|
|
9412
|
+
return isMac() ? "metaKey" : "ctrlKey";
|
|
9413
|
+
};
|
|
9414
|
+
/**
|
|
9415
|
+
* Grouped keyboard-shortcut helpers, exposed as a single namespace for
|
|
9416
|
+
* ergonomic access (e.g. `hotkeys.formatHotkey`).
|
|
9417
|
+
*/
|
|
9418
|
+
var hotkeys = {
|
|
9419
|
+
formatHotkeys,
|
|
9420
|
+
formatHotkey,
|
|
9421
|
+
getDefaultSeparator,
|
|
9422
|
+
hotkeyPlatform,
|
|
9423
|
+
textWithHotkeys,
|
|
9424
|
+
match
|
|
9425
|
+
};
|
|
9426
|
+
//#endregion
|
|
6772
9427
|
//#region src/components/accessories/KeyboardShortcut/enums.ts
|
|
6773
9428
|
var kdsKeyboardShortcutSize = {
|
|
6774
9429
|
SMALL: "small",
|
|
6775
|
-
MEDIUM: "medium"
|
|
9430
|
+
MEDIUM: "medium"
|
|
9431
|
+
};
|
|
9432
|
+
var kdsKeyboardShortcutSizes = Object.values(kdsKeyboardShortcutSize);
|
|
9433
|
+
//#endregion
|
|
9434
|
+
//#region src/components/accessories/KeyboardShortcut/KdsKeyboardShortcut.vue
|
|
9435
|
+
var KdsKeyboardShortcut_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
9436
|
+
__name: "KdsKeyboardShortcut",
|
|
9437
|
+
props: {
|
|
9438
|
+
size: { default: () => kdsKeyboardShortcutSize.SMALL },
|
|
9439
|
+
shortcut: {},
|
|
9440
|
+
platform: {}
|
|
9441
|
+
},
|
|
9442
|
+
setup(__props) {
|
|
9443
|
+
const formattedHotkeys = computed(() => __props.shortcut.map((hotkey) => hotkeys.formatHotkey(hotkey, __props.platform)));
|
|
9444
|
+
return (_ctx, _cache) => {
|
|
9445
|
+
return openBlock(), createElementBlock("kbd", { class: normalizeClass(["kds-keyboard-shortcut", __props.size]) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(formattedHotkeys.value, (hotkey) => {
|
|
9446
|
+
return openBlock(), createElementBlock("kbd", {
|
|
9447
|
+
key: hotkey,
|
|
9448
|
+
class: "shortcut-item"
|
|
9449
|
+
}, toDisplayString(hotkey), 1);
|
|
9450
|
+
}), 128))], 2);
|
|
9451
|
+
};
|
|
9452
|
+
}
|
|
9453
|
+
}), [["__scopeId", "data-v-5a9d1e42"]]);
|
|
9454
|
+
//#endregion
|
|
9455
|
+
//#region src/components/accessories/LiveStatus/KdsLiveStatus.vue?vue&type=script&setup=true&lang.ts
|
|
9456
|
+
var _hoisted_1$73 = ["aria-label"];
|
|
9457
|
+
var _hoisted_2$45 = {
|
|
9458
|
+
key: 0,
|
|
9459
|
+
class: "label"
|
|
9460
|
+
};
|
|
9461
|
+
//#endregion
|
|
9462
|
+
//#region src/components/accessories/LiveStatus/KdsLiveStatus.vue
|
|
9463
|
+
var KdsLiveStatus_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
9464
|
+
__name: "KdsLiveStatus",
|
|
9465
|
+
props: {
|
|
9466
|
+
status: { default: "red" },
|
|
9467
|
+
size: { default: "medium" },
|
|
9468
|
+
label: { default: "" },
|
|
9469
|
+
tooltip: {}
|
|
9470
|
+
},
|
|
9471
|
+
setup(__props) {
|
|
9472
|
+
const props = createPropsRestProxy(__props, [
|
|
9473
|
+
"status",
|
|
9474
|
+
"size",
|
|
9475
|
+
"label"
|
|
9476
|
+
]);
|
|
9477
|
+
const accessibleTitle = computed(() => props.tooltip?.trim() || `Status is ${__props.status}`);
|
|
9478
|
+
return (_ctx, _cache) => {
|
|
9479
|
+
return withDirectives((openBlock(), createElementBlock("span", {
|
|
9480
|
+
class: normalizeClass([
|
|
9481
|
+
"kds-live-status",
|
|
9482
|
+
__props.status,
|
|
9483
|
+
`size-${__props.size}`
|
|
9484
|
+
]),
|
|
9485
|
+
role: "img",
|
|
9486
|
+
"aria-label": accessibleTitle.value
|
|
9487
|
+
}, [_cache[0] || (_cache[0] = createElementVNode("span", { class: "dot" }, null, -1)), __props.label ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$45, [createTextVNode(toDisplayString(__props.label), 1)])), [[
|
|
9488
|
+
unref(vKdsTooltip),
|
|
9489
|
+
__props.label,
|
|
9490
|
+
"truncated"
|
|
9491
|
+
]]) : createCommentVNode("", true)], 10, _hoisted_1$73)), [[unref(vKdsTooltip), !__props.label ? accessibleTitle.value : void 0]]);
|
|
9492
|
+
};
|
|
9493
|
+
}
|
|
9494
|
+
}), [["__scopeId", "data-v-d5a7f94a"]]);
|
|
9495
|
+
//#endregion
|
|
9496
|
+
//#region src/components/accessories/LiveStatus/enums.ts
|
|
9497
|
+
var kdsLiveStatusStatus = {
|
|
9498
|
+
RED: "red",
|
|
9499
|
+
ORANGE: "orange",
|
|
9500
|
+
GREEN: "green",
|
|
9501
|
+
DISABLED: "disabled"
|
|
9502
|
+
};
|
|
9503
|
+
var kdsLiveStatusStatuses = Object.values(kdsLiveStatusStatus);
|
|
9504
|
+
var kdsLiveStatusSize = {
|
|
9505
|
+
LARGE: "large",
|
|
9506
|
+
MEDIUM: "medium",
|
|
9507
|
+
SMALL: "small"
|
|
9508
|
+
};
|
|
9509
|
+
var kdsLiveStatusSizes = Object.values(kdsLiveStatusSize);
|
|
9510
|
+
//#endregion
|
|
9511
|
+
//#region src/components/accessories/LoadingSpinner/KdsLoadingSpinner.vue?vue&type=script&setup=true&lang.ts
|
|
9512
|
+
var _hoisted_1$72 = ["data-style"];
|
|
9513
|
+
//#endregion
|
|
9514
|
+
//#region src/components/accessories/LoadingSpinner/KdsLoadingSpinner.vue
|
|
9515
|
+
var KdsLoadingSpinner_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
9516
|
+
__name: "KdsLoadingSpinner",
|
|
9517
|
+
props: {
|
|
9518
|
+
size: { default: "medium" },
|
|
9519
|
+
variant: { default: "onSurface" }
|
|
9520
|
+
},
|
|
9521
|
+
setup(__props) {
|
|
9522
|
+
return (_ctx, _cache) => {
|
|
9523
|
+
return openBlock(), createElementBlock("svg", {
|
|
9524
|
+
class: normalizeClass(["kds-loading-spinner", __props.size]),
|
|
9525
|
+
"data-style": __props.variant,
|
|
9526
|
+
viewBox: "0 0 120 120"
|
|
9527
|
+
}, [..._cache[0] || (_cache[0] = [createElementVNode("circle", {
|
|
9528
|
+
class: "track",
|
|
9529
|
+
cx: "60",
|
|
9530
|
+
cy: "60",
|
|
9531
|
+
r: "50"
|
|
9532
|
+
}, null, -1), createElementVNode("circle", {
|
|
9533
|
+
class: "loader",
|
|
9534
|
+
cx: "60",
|
|
9535
|
+
cy: "60",
|
|
9536
|
+
r: "50"
|
|
9537
|
+
}, null, -1)])], 10, _hoisted_1$72);
|
|
9538
|
+
};
|
|
9539
|
+
}
|
|
9540
|
+
}), [["__scopeId", "data-v-ea91036d"]]);
|
|
9541
|
+
//#endregion
|
|
9542
|
+
//#region src/components/accessories/LoadingSpinner/enums.ts
|
|
9543
|
+
var kdsLoadingSpinnerVariant = {
|
|
9544
|
+
ON_PRIMARY: "onPrimary",
|
|
9545
|
+
ON_SURFACE: "onSurface"
|
|
9546
|
+
};
|
|
9547
|
+
var kdsLoadingSpinnerVariants = Object.values(kdsLoadingSpinnerVariant);
|
|
9548
|
+
//#endregion
|
|
9549
|
+
//#region src/components/accessories/MissingValueIcon/KdsMissingValueIcon.vue
|
|
9550
|
+
var KdsMissingValueIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
9551
|
+
__name: "KdsMissingValueIcon",
|
|
9552
|
+
props: { size: {} },
|
|
9553
|
+
setup(__props) {
|
|
9554
|
+
return (_ctx, _cache) => {
|
|
9555
|
+
return openBlock(), createBlock(KdsIcon_default, {
|
|
9556
|
+
name: "circle-question",
|
|
9557
|
+
size: __props.size,
|
|
9558
|
+
class: "kds-missing-value-icon"
|
|
9559
|
+
}, null, 8, ["size"]);
|
|
9560
|
+
};
|
|
9561
|
+
}
|
|
9562
|
+
}), [["__scopeId", "data-v-e6901949"]]);
|
|
9563
|
+
//#endregion
|
|
9564
|
+
//#region src/components/accessories/DonutChart/KdsDonutChart.vue?vue&type=script&setup=true&lang.ts
|
|
9565
|
+
var _hoisted_1$71 = { class: "donut-container" };
|
|
9566
|
+
var _hoisted_2$44 = [
|
|
9567
|
+
"height",
|
|
9568
|
+
"width",
|
|
9569
|
+
"viewBox"
|
|
9570
|
+
];
|
|
9571
|
+
var _hoisted_3$31 = ["r", "stroke-width"];
|
|
9572
|
+
var _hoisted_4$27 = [
|
|
9573
|
+
"r",
|
|
9574
|
+
"stroke-width",
|
|
9575
|
+
"stroke-dasharray",
|
|
9576
|
+
"stroke-dashoffset",
|
|
9577
|
+
"transform"
|
|
9578
|
+
];
|
|
9579
|
+
var _hoisted_5$15 = [
|
|
9580
|
+
"r",
|
|
9581
|
+
"stroke-width",
|
|
9582
|
+
"stroke-dasharray",
|
|
9583
|
+
"stroke-dashoffset",
|
|
9584
|
+
"transform"
|
|
9585
|
+
];
|
|
9586
|
+
var _hoisted_6$11 = {
|
|
9587
|
+
key: 0,
|
|
9588
|
+
class: "donut-text"
|
|
9589
|
+
};
|
|
9590
|
+
var _hoisted_7$3 = { class: "title" };
|
|
9591
|
+
var _hoisted_8$3 = {
|
|
9592
|
+
key: 0,
|
|
9593
|
+
class: "sub-text"
|
|
9594
|
+
};
|
|
9595
|
+
var radius = 22;
|
|
9596
|
+
var innerRadius = 10;
|
|
9597
|
+
//#endregion
|
|
9598
|
+
//#region src/components/accessories/DonutChart/KdsDonutChart.vue
|
|
9599
|
+
var KdsDonutChart_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
9600
|
+
__name: "KdsDonutChart",
|
|
9601
|
+
props: {
|
|
9602
|
+
value: {},
|
|
9603
|
+
secondaryValue: { default: 0 },
|
|
9604
|
+
maxValue: {},
|
|
9605
|
+
acceptValuesLargerThanMax: {
|
|
9606
|
+
type: Boolean,
|
|
9607
|
+
default: false
|
|
9608
|
+
},
|
|
9609
|
+
animate: {
|
|
9610
|
+
type: Boolean,
|
|
9611
|
+
default: true
|
|
9612
|
+
},
|
|
9613
|
+
label: {},
|
|
9614
|
+
subText: {}
|
|
9615
|
+
},
|
|
9616
|
+
setup(__props) {
|
|
9617
|
+
const clippedValue = computed(() => {
|
|
9618
|
+
const clipValue = Math.max(0, __props.value);
|
|
9619
|
+
return __props.acceptValuesLargerThanMax ? clipValue : Math.min(clipValue, __props.maxValue);
|
|
9620
|
+
});
|
|
9621
|
+
const secondaryClippedValue = computed(() => {
|
|
9622
|
+
const clipValue = Math.max(0, __props.secondaryValue + clippedValue.value);
|
|
9623
|
+
return __props.acceptValuesLargerThanMax ? clipValue : Math.min(clipValue, __props.maxValue);
|
|
9624
|
+
});
|
|
9625
|
+
const strokeWidth = computed(() => radius - innerRadius);
|
|
9626
|
+
const r = computed(() => radius - strokeWidth.value / 2);
|
|
9627
|
+
const diameter = computed(() => 2 * radius);
|
|
9628
|
+
const viewBox = computed(() => `0 0 ${diameter.value} ${diameter.value}`);
|
|
9629
|
+
const circumference = computed(() => 2 * Math.PI * r.value);
|
|
9630
|
+
const calcStrokeDashOffset = (value) => {
|
|
9631
|
+
if (__props.maxValue <= 0 || !Number.isFinite(__props.maxValue)) return circumference.value;
|
|
9632
|
+
const strokeDiff = Math.min(value / __props.maxValue * circumference.value, circumference.value);
|
|
9633
|
+
return Math.max(circumference.value - strokeDiff, 0);
|
|
9634
|
+
};
|
|
9635
|
+
const strokeDashOffset = computed(() => calcStrokeDashOffset(clippedValue.value));
|
|
9636
|
+
const secondaryStrokeDashOffset = computed(() => calcStrokeDashOffset(secondaryClippedValue.value));
|
|
9637
|
+
const transformWedge = computed(() => `rotate(-90, ${radius}, ${radius})`);
|
|
9638
|
+
const disabled = computed(() => !Number.isFinite(__props.maxValue));
|
|
9639
|
+
return (_ctx, _cache) => {
|
|
9640
|
+
return openBlock(), createElementBlock("div", _hoisted_1$71, [(openBlock(), createElementBlock("svg", {
|
|
9641
|
+
height: diameter.value,
|
|
9642
|
+
width: diameter.value,
|
|
9643
|
+
viewBox: viewBox.value,
|
|
9644
|
+
class: "donut-chart"
|
|
9645
|
+
}, [
|
|
9646
|
+
createElementVNode("circle", {
|
|
9647
|
+
class: "background-circle",
|
|
9648
|
+
cx: radius,
|
|
9649
|
+
cy: radius,
|
|
9650
|
+
r: r.value,
|
|
9651
|
+
"stroke-width": strokeWidth.value,
|
|
9652
|
+
fill: "transparent"
|
|
9653
|
+
}, null, 8, _hoisted_3$31),
|
|
9654
|
+
__props.secondaryValue && !disabled.value ? (openBlock(), createElementBlock("circle", {
|
|
9655
|
+
key: 0,
|
|
9656
|
+
class: normalizeClass([
|
|
9657
|
+
"value-wedge",
|
|
9658
|
+
"secondary-circle",
|
|
9659
|
+
{ animate: __props.animate }
|
|
9660
|
+
]),
|
|
9661
|
+
cx: radius,
|
|
9662
|
+
cy: radius,
|
|
9663
|
+
r: r.value,
|
|
9664
|
+
"stroke-width": strokeWidth.value,
|
|
9665
|
+
"stroke-dasharray": circumference.value,
|
|
9666
|
+
"stroke-dashoffset": secondaryStrokeDashOffset.value,
|
|
9667
|
+
fill: "transparent",
|
|
9668
|
+
transform: transformWedge.value
|
|
9669
|
+
}, null, 10, _hoisted_4$27)) : createCommentVNode("", true),
|
|
9670
|
+
!disabled.value ? (openBlock(), createElementBlock("circle", {
|
|
9671
|
+
key: 1,
|
|
9672
|
+
class: normalizeClass([
|
|
9673
|
+
"value-wedge",
|
|
9674
|
+
"primary-circle",
|
|
9675
|
+
{ animate: __props.animate }
|
|
9676
|
+
]),
|
|
9677
|
+
cx: radius,
|
|
9678
|
+
cy: radius,
|
|
9679
|
+
r: r.value,
|
|
9680
|
+
"stroke-width": strokeWidth.value,
|
|
9681
|
+
"stroke-dasharray": circumference.value,
|
|
9682
|
+
"stroke-dashoffset": strokeDashOffset.value,
|
|
9683
|
+
fill: "transparent",
|
|
9684
|
+
transform: transformWedge.value
|
|
9685
|
+
}, null, 10, _hoisted_5$15)) : createCommentVNode("", true)
|
|
9686
|
+
], 8, _hoisted_2$44)), __props.label ? (openBlock(), createElementBlock("div", _hoisted_6$11, [createElementVNode("div", _hoisted_7$3, toDisplayString(__props.label), 1), __props.subText ? (openBlock(), createElementBlock("div", _hoisted_8$3, toDisplayString(__props.subText), 1)) : createCommentVNode("", true)])) : createCommentVNode("", true)]);
|
|
9687
|
+
};
|
|
9688
|
+
}
|
|
9689
|
+
}), [["__scopeId", "data-v-93590a62"]]);
|
|
9690
|
+
//#endregion
|
|
9691
|
+
//#region src/components/accessories/Text/KdsTextHighlight/KdsTextHighlight.vue?vue&type=script&setup=true&lang.ts
|
|
9692
|
+
var _hoisted_1$70 = { class: "kds-highlighted-text" };
|
|
9693
|
+
var _hoisted_2$43 = {
|
|
9694
|
+
key: 0,
|
|
9695
|
+
class: "kds-highlighted-text-match"
|
|
9696
|
+
};
|
|
9697
|
+
//#endregion
|
|
9698
|
+
//#region src/components/accessories/Text/KdsTextHighlight/KdsTextHighlight.vue
|
|
9699
|
+
var KdsTextHighlight_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
9700
|
+
__name: "KdsTextHighlight",
|
|
9701
|
+
props: {
|
|
9702
|
+
text: {},
|
|
9703
|
+
term: { default: "" }
|
|
9704
|
+
},
|
|
9705
|
+
setup(__props) {
|
|
9706
|
+
const segments = computed(() => {
|
|
9707
|
+
if (!__props.term) return [{
|
|
9708
|
+
text: __props.text,
|
|
9709
|
+
match: false
|
|
9710
|
+
}];
|
|
9711
|
+
const lowerText = __props.text.toLowerCase();
|
|
9712
|
+
const lowerTerm = __props.term.toLowerCase();
|
|
9713
|
+
const result = [];
|
|
9714
|
+
let cursor = 0;
|
|
9715
|
+
while (cursor < __props.text.length) {
|
|
9716
|
+
const index = lowerText.indexOf(lowerTerm, cursor);
|
|
9717
|
+
if (index === -1) {
|
|
9718
|
+
result.push({
|
|
9719
|
+
text: __props.text.slice(cursor),
|
|
9720
|
+
match: false
|
|
9721
|
+
});
|
|
9722
|
+
break;
|
|
9723
|
+
}
|
|
9724
|
+
if (index > cursor) result.push({
|
|
9725
|
+
text: __props.text.slice(cursor, index),
|
|
9726
|
+
match: false
|
|
9727
|
+
});
|
|
9728
|
+
result.push({
|
|
9729
|
+
text: __props.text.slice(index, index + __props.term.length),
|
|
9730
|
+
match: true
|
|
9731
|
+
});
|
|
9732
|
+
cursor = index + __props.term.length;
|
|
9733
|
+
}
|
|
9734
|
+
return result;
|
|
9735
|
+
});
|
|
9736
|
+
return (_ctx, _cache) => {
|
|
9737
|
+
return openBlock(), createElementBlock("span", _hoisted_1$70, [(openBlock(true), createElementBlock(Fragment, null, renderList(segments.value, (segment, index) => {
|
|
9738
|
+
return openBlock(), createElementBlock(Fragment, { key: index }, [segment.match ? (openBlock(), createElementBlock("mark", _hoisted_2$43, toDisplayString(segment.text), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(segment.text), 1)], 64))], 64);
|
|
9739
|
+
}), 128))]);
|
|
9740
|
+
};
|
|
9741
|
+
}
|
|
9742
|
+
}), [["__scopeId", "data-v-a2202598"]]);
|
|
9743
|
+
//#endregion
|
|
9744
|
+
//#region src/components/accessories/Divider/KdsDivider.vue
|
|
9745
|
+
var _sfc_main = {};
|
|
9746
|
+
var _hoisted_1$69 = { class: "kds-divider" };
|
|
9747
|
+
function _sfc_render$1(_ctx, _cache) {
|
|
9748
|
+
return openBlock(), createElementBlock("hr", _hoisted_1$69);
|
|
9749
|
+
}
|
|
9750
|
+
var KdsDivider_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render$1], ["__scopeId", "data-v-dead6417"]]);
|
|
9751
|
+
//#endregion
|
|
9752
|
+
//#region src/components/accessories/_Accessory/enums.ts
|
|
9753
|
+
var kdsAccessoryType = {
|
|
9754
|
+
ICON: "icon",
|
|
9755
|
+
DATA_TYPE: "dataType",
|
|
9756
|
+
COLOR_SWATCH: "colorSwatch",
|
|
9757
|
+
LIVE_STATUS: "liveStatus",
|
|
9758
|
+
AVATAR: "avatar",
|
|
9759
|
+
PORT: "port"
|
|
9760
|
+
};
|
|
9761
|
+
var kdsAccessoryTypes = Object.values(kdsAccessoryType);
|
|
9762
|
+
var kdsAccessorySize = {
|
|
9763
|
+
SMALL: "small",
|
|
9764
|
+
MEDIUM: "medium",
|
|
9765
|
+
LARGE: "large"
|
|
9766
|
+
};
|
|
9767
|
+
var kdsAccessorySizes = Object.values(kdsAccessorySize);
|
|
9768
|
+
//#endregion
|
|
9769
|
+
//#region src/components/buttons/BaseButton.vue?vue&type=script&setup=true&lang.ts
|
|
9770
|
+
var _hoisted_1$68 = {
|
|
9771
|
+
key: 0,
|
|
9772
|
+
class: "label"
|
|
9773
|
+
};
|
|
9774
|
+
//#endregion
|
|
9775
|
+
//#region src/components/buttons/BaseButton.vue
|
|
9776
|
+
var BaseButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
9777
|
+
__name: "BaseButton",
|
|
9778
|
+
props: {
|
|
9779
|
+
dataTestId: {},
|
|
9780
|
+
size: { default: "medium" },
|
|
9781
|
+
disabled: {
|
|
9782
|
+
type: Boolean,
|
|
9783
|
+
default: false
|
|
9784
|
+
},
|
|
9785
|
+
tooltip: {},
|
|
9786
|
+
variant: {},
|
|
9787
|
+
label: {},
|
|
9788
|
+
leadingIcon: {},
|
|
9789
|
+
trailingIcon: {},
|
|
9790
|
+
ariaLabel: {},
|
|
9791
|
+
destructive: {
|
|
9792
|
+
type: Boolean,
|
|
9793
|
+
default: false
|
|
9794
|
+
},
|
|
9795
|
+
success: {
|
|
9796
|
+
type: Boolean,
|
|
9797
|
+
default: false
|
|
9798
|
+
},
|
|
9799
|
+
error: {
|
|
9800
|
+
type: Boolean,
|
|
9801
|
+
default: false
|
|
9802
|
+
},
|
|
9803
|
+
toggled: {
|
|
9804
|
+
type: Boolean,
|
|
9805
|
+
default: false
|
|
9806
|
+
},
|
|
9807
|
+
removeBorderRadius: { default: () => void 0 },
|
|
9808
|
+
component: { default: "button" }
|
|
9809
|
+
},
|
|
9810
|
+
emits: ["click"],
|
|
9811
|
+
setup(__props, { emit: __emit }) {
|
|
9812
|
+
const props = createPropsRestProxy(__props, [
|
|
9813
|
+
"component",
|
|
9814
|
+
"size",
|
|
9815
|
+
"destructive",
|
|
9816
|
+
"success",
|
|
9817
|
+
"error",
|
|
9818
|
+
"disabled",
|
|
9819
|
+
"toggled",
|
|
9820
|
+
"removeBorderRadius"
|
|
9821
|
+
]);
|
|
9822
|
+
const emit = __emit;
|
|
9823
|
+
const classes = computed(() => [
|
|
9824
|
+
"button",
|
|
9825
|
+
__props.size,
|
|
9826
|
+
props.variant,
|
|
9827
|
+
{ destructive: __props.destructive },
|
|
9828
|
+
{ disabled: __props.disabled },
|
|
9829
|
+
{ toggled: __props.toggled },
|
|
9830
|
+
{ success: __props.success },
|
|
9831
|
+
{ error: __props.error },
|
|
9832
|
+
__props.removeBorderRadius ? `remove-border-radius-${__props.removeBorderRadius}` : void 0
|
|
9833
|
+
]);
|
|
9834
|
+
const iconSize = computed(() => {
|
|
9835
|
+
if (__props.size === "xsmall") return "small";
|
|
9836
|
+
else return __props.size;
|
|
9837
|
+
});
|
|
9838
|
+
function onClick(e) {
|
|
9839
|
+
if (!__props.disabled) emit("click", e);
|
|
9840
|
+
}
|
|
9841
|
+
return (_ctx, _cache) => {
|
|
9842
|
+
return withDirectives((openBlock(), createBlock(resolveDynamicComponent(__props.component), {
|
|
9843
|
+
type: __props.component === "button" ? "button" : void 0,
|
|
9844
|
+
class: normalizeClass(classes.value),
|
|
9845
|
+
disabled: __props.disabled,
|
|
9846
|
+
"aria-label": props.ariaLabel,
|
|
9847
|
+
"data-test-id": props.dataTestId,
|
|
9848
|
+
onClick: _cache[0] || (_cache[0] = ($event) => onClick($event))
|
|
9849
|
+
}, {
|
|
9850
|
+
default: withCtx(() => [
|
|
9851
|
+
renderSlot(_ctx.$slots, "leading", {}, () => [props.leadingIcon ? (openBlock(), createBlock(KdsIcon_default, {
|
|
9852
|
+
key: 0,
|
|
9853
|
+
name: props.leadingIcon,
|
|
9854
|
+
size: iconSize.value
|
|
9855
|
+
}, null, 8, ["name", "size"])) : createCommentVNode("", true)], true),
|
|
9856
|
+
props.label ? (openBlock(), createElementBlock("span", _hoisted_1$68, toDisplayString(props.label), 1)) : createCommentVNode("", true),
|
|
9857
|
+
props.trailingIcon && props.label ? (openBlock(), createBlock(KdsIcon_default, {
|
|
9858
|
+
key: 1,
|
|
9859
|
+
name: props.trailingIcon,
|
|
9860
|
+
size: iconSize.value
|
|
9861
|
+
}, null, 8, ["name", "size"])) : createCommentVNode("", true)
|
|
9862
|
+
]),
|
|
9863
|
+
_: 3
|
|
9864
|
+
}, 8, [
|
|
9865
|
+
"type",
|
|
9866
|
+
"class",
|
|
9867
|
+
"disabled",
|
|
9868
|
+
"aria-label",
|
|
9869
|
+
"data-test-id"
|
|
9870
|
+
])), [[unref(vKdsTooltip), props.tooltip]]);
|
|
9871
|
+
};
|
|
9872
|
+
}
|
|
9873
|
+
}), [["__scopeId", "data-v-afad70c2"]]);
|
|
9874
|
+
//#endregion
|
|
9875
|
+
//#region src/components/buttons/KdsButton/KdsButton.vue
|
|
9876
|
+
var KdsButton_default = /* @__PURE__ */ defineComponent({
|
|
9877
|
+
__name: "KdsButton",
|
|
9878
|
+
props: {
|
|
9879
|
+
dataTestId: {},
|
|
9880
|
+
size: {},
|
|
9881
|
+
disabled: { type: Boolean },
|
|
9882
|
+
tooltip: {},
|
|
9883
|
+
variant: { default: "filled" },
|
|
9884
|
+
label: {},
|
|
9885
|
+
leadingIcon: {},
|
|
9886
|
+
trailingIcon: {},
|
|
9887
|
+
ariaLabel: {},
|
|
9888
|
+
destructive: { type: Boolean }
|
|
9889
|
+
},
|
|
9890
|
+
emits: ["click"],
|
|
9891
|
+
setup(__props, { emit: __emit }) {
|
|
9892
|
+
const props = createPropsRestProxy(__props, ["variant"]);
|
|
9893
|
+
const emit = __emit;
|
|
9894
|
+
return (_ctx, _cache) => {
|
|
9895
|
+
return openBlock(), createBlock(BaseButton_default, mergeProps(props, {
|
|
9896
|
+
variant: __props.variant,
|
|
9897
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event))
|
|
9898
|
+
}), null, 16, ["variant"]);
|
|
9899
|
+
};
|
|
9900
|
+
}
|
|
9901
|
+
});
|
|
9902
|
+
//#endregion
|
|
9903
|
+
//#region src/util/nuxtComponentResolver.ts
|
|
9904
|
+
var getAppInstance = () => {
|
|
9905
|
+
return getCurrentInstance()?.appContext.app;
|
|
9906
|
+
};
|
|
9907
|
+
var resolveNuxtLinkComponent = () => {
|
|
9908
|
+
const app = getAppInstance();
|
|
9909
|
+
const nuxtLinkComponent = app?.component("NuxtLink");
|
|
9910
|
+
if (nuxtLinkComponent) return nuxtLinkComponent;
|
|
9911
|
+
const routerLinkComponent = app?.component("RouterLink");
|
|
9912
|
+
if (routerLinkComponent) return routerLinkComponent;
|
|
9913
|
+
return defineComponent({
|
|
9914
|
+
props: { to: {
|
|
9915
|
+
type: String,
|
|
9916
|
+
default: ""
|
|
9917
|
+
} },
|
|
9918
|
+
render() {
|
|
9919
|
+
return h("a", { href: this.to }, [useSlots().default?.()]);
|
|
9920
|
+
}
|
|
9921
|
+
});
|
|
6776
9922
|
};
|
|
6777
|
-
var kdsKeyboardShortcutSizes = Object.values(kdsKeyboardShortcutSize);
|
|
6778
9923
|
//#endregion
|
|
6779
|
-
//#region src/components/
|
|
6780
|
-
|
|
6781
|
-
|
|
9924
|
+
//#region src/components/buttons/links/linkUtils.ts
|
|
9925
|
+
function isExternalUrl(url) {
|
|
9926
|
+
const normalized = url.trim();
|
|
9927
|
+
if (!normalized) return false;
|
|
9928
|
+
if (normalized.startsWith("#") || normalized.startsWith("/") && !normalized.startsWith("//") || normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("?")) return false;
|
|
9929
|
+
return true;
|
|
9930
|
+
}
|
|
9931
|
+
//#endregion
|
|
9932
|
+
//#region src/components/buttons/links/KdsLinkButton/KdsLinkButton.vue
|
|
9933
|
+
var KdsLinkButton_default = /* @__PURE__ */ defineComponent({
|
|
9934
|
+
__name: "KdsLinkButton",
|
|
6782
9935
|
props: {
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
9936
|
+
dataTestId: {},
|
|
9937
|
+
size: {},
|
|
9938
|
+
disabled: {
|
|
9939
|
+
type: Boolean,
|
|
9940
|
+
default: false
|
|
9941
|
+
},
|
|
9942
|
+
tooltip: {},
|
|
9943
|
+
variant: { default: "filled" },
|
|
9944
|
+
label: {},
|
|
9945
|
+
leadingIcon: {},
|
|
9946
|
+
trailingIcon: {},
|
|
9947
|
+
ariaLabel: {},
|
|
9948
|
+
destructive: { type: Boolean },
|
|
9949
|
+
to: {},
|
|
9950
|
+
download: {
|
|
9951
|
+
type: Boolean,
|
|
9952
|
+
default: () => void 0
|
|
9953
|
+
},
|
|
9954
|
+
target: { default: null },
|
|
9955
|
+
rel: { default: null }
|
|
6786
9956
|
},
|
|
6787
|
-
|
|
6788
|
-
|
|
9957
|
+
emits: ["click"],
|
|
9958
|
+
setup(__props, { emit: __emit }) {
|
|
9959
|
+
const rawProps = createPropsRestProxy(__props, [
|
|
9960
|
+
"variant",
|
|
9961
|
+
"disabled",
|
|
9962
|
+
"download",
|
|
9963
|
+
"rel",
|
|
9964
|
+
"target"
|
|
9965
|
+
]);
|
|
9966
|
+
const props = computed(() => {
|
|
9967
|
+
if (isExternalUrl(rawProps.to)) return {
|
|
9968
|
+
...rawProps,
|
|
9969
|
+
trailingIcon: "external-link"
|
|
9970
|
+
};
|
|
9971
|
+
return rawProps;
|
|
9972
|
+
});
|
|
9973
|
+
const component = computed(() => {
|
|
9974
|
+
if (__props.disabled) return "button";
|
|
9975
|
+
return resolveNuxtLinkComponent();
|
|
9976
|
+
});
|
|
9977
|
+
const emit = __emit;
|
|
6789
9978
|
return (_ctx, _cache) => {
|
|
6790
|
-
return openBlock(),
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
9979
|
+
return openBlock(), createBlock(BaseButton_default, mergeProps(props.value, {
|
|
9980
|
+
variant: __props.variant,
|
|
9981
|
+
disabled: __props.disabled,
|
|
9982
|
+
download: __props.download,
|
|
9983
|
+
rel: __props.rel,
|
|
9984
|
+
target: __props.target,
|
|
9985
|
+
component: component.value,
|
|
9986
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event))
|
|
9987
|
+
}), null, 16, [
|
|
9988
|
+
"variant",
|
|
9989
|
+
"disabled",
|
|
9990
|
+
"download",
|
|
9991
|
+
"rel",
|
|
9992
|
+
"target",
|
|
9993
|
+
"component"
|
|
9994
|
+
]);
|
|
6796
9995
|
};
|
|
6797
9996
|
}
|
|
6798
|
-
})
|
|
9997
|
+
});
|
|
6799
9998
|
//#endregion
|
|
6800
|
-
//#region
|
|
6801
|
-
var
|
|
6802
|
-
|
|
9999
|
+
//#region ../styles/dist/img/icons/external-link.svg?url
|
|
10000
|
+
var external_link_default = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20stroke='currentColor'%20stroke-linecap='round'%20stroke-linejoin='round'%20viewBox='0%200%2012%2012'%3e%3cpath%20d='M5.5%201.5h-3a1%201%200%200%200-1%201v7a1%201%200%200%200%201%201h7a1%201%200%200%200%201-1v-3m0-5L6%205.892M10.5%201.5v2.75m0-2.75H7.75'%20vector-effect='non-scaling-stroke'/%3e%3c/svg%3e";
|
|
10001
|
+
//#endregion
|
|
10002
|
+
//#region src/layouts/overlays/Modal/enums.ts
|
|
10003
|
+
var kdsModalClosedBy = {
|
|
10004
|
+
ANY: "any",
|
|
10005
|
+
CLOSEREQUEST: "closerequest",
|
|
10006
|
+
NONE: "none"
|
|
10007
|
+
};
|
|
10008
|
+
var kdsModalClosedByOptions = Object.values(kdsModalClosedBy);
|
|
10009
|
+
var kdsModalWidth = {
|
|
10010
|
+
SMALL: "small",
|
|
10011
|
+
MEDIUM: "medium",
|
|
10012
|
+
LARGE: "large",
|
|
10013
|
+
XLARGE: "xlarge",
|
|
10014
|
+
FULL: "full"
|
|
10015
|
+
};
|
|
10016
|
+
var kdsModalWidthSizes = Object.values(kdsModalWidth);
|
|
10017
|
+
var kdsModalHeight = {
|
|
10018
|
+
AUTO: "auto",
|
|
10019
|
+
FULL: "full"
|
|
10020
|
+
};
|
|
10021
|
+
var kdsModalHeightSizes = Object.values(kdsModalHeight);
|
|
10022
|
+
var kdsModalVariant = {
|
|
10023
|
+
PADDED: "padded",
|
|
10024
|
+
PLAIN: "plain"
|
|
10025
|
+
};
|
|
10026
|
+
var kdsModalVariants = Object.values(kdsModalVariant);
|
|
10027
|
+
var kdsModalLayoutPropsDefault = {
|
|
10028
|
+
headline: "",
|
|
10029
|
+
variant: kdsModalVariant.PADDED,
|
|
10030
|
+
overflow: "auto",
|
|
10031
|
+
leadingIcon: void 0
|
|
10032
|
+
};
|
|
10033
|
+
kdsModalHeight.AUTO, kdsModalWidth.MEDIUM, kdsModalClosedBy.CLOSEREQUEST, { ...kdsModalLayoutPropsDefault };
|
|
10034
|
+
//#endregion
|
|
10035
|
+
//#region src/layouts/overlays/Modal/KdsModalLayout.vue?vue&type=script&setup=true&lang.ts
|
|
10036
|
+
var _hoisted_1$67 = { class: "modal-header" };
|
|
10037
|
+
var _hoisted_2$42 = { class: "modal-header-headline" };
|
|
10038
|
+
var _hoisted_3$30 = ["data-variant"];
|
|
10039
|
+
var _hoisted_4$26 = {
|
|
6803
10040
|
key: 0,
|
|
6804
|
-
class: "
|
|
10041
|
+
class: "modal-footer"
|
|
6805
10042
|
};
|
|
6806
10043
|
//#endregion
|
|
6807
|
-
//#region src/
|
|
6808
|
-
var
|
|
6809
|
-
|
|
10044
|
+
//#region src/layouts/overlays/Modal/KdsModalLayout.vue
|
|
10045
|
+
var KdsModalLayout_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
10046
|
+
inheritAttrs: false,
|
|
10047
|
+
__name: "KdsModalLayout",
|
|
6810
10048
|
props: {
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
10049
|
+
headline: { default: "" },
|
|
10050
|
+
variant: { default: () => kdsModalVariant.PADDED },
|
|
10051
|
+
leadingIcon: {},
|
|
10052
|
+
overflow: { default: "auto" },
|
|
10053
|
+
onClose: { type: Function }
|
|
6815
10054
|
},
|
|
6816
10055
|
setup(__props) {
|
|
10056
|
+
useCssVars((_ctx) => ({ "v4b5bb7fa": _ctx.overflow }));
|
|
6817
10057
|
const props = createPropsRestProxy(__props, [
|
|
6818
|
-
"
|
|
6819
|
-
"
|
|
6820
|
-
"
|
|
10058
|
+
"headline",
|
|
10059
|
+
"variant",
|
|
10060
|
+
"overflow"
|
|
6821
10061
|
]);
|
|
6822
|
-
const accessibleTitle = computed(() => props.tooltip?.trim() || `Status is ${__props.status}`);
|
|
6823
10062
|
return (_ctx, _cache) => {
|
|
6824
|
-
return
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
10063
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
10064
|
+
createElementVNode("header", _hoisted_1$67, [
|
|
10065
|
+
props.leadingIcon ? (openBlock(), createBlock(KdsIcon_default, {
|
|
10066
|
+
key: 0,
|
|
10067
|
+
name: props.leadingIcon,
|
|
10068
|
+
size: "medium"
|
|
10069
|
+
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
10070
|
+
createElementVNode("div", _hoisted_2$42, toDisplayString(__props.headline), 1),
|
|
10071
|
+
createVNode(KdsButton_default, {
|
|
10072
|
+
"leading-icon": "x-close",
|
|
10073
|
+
variant: "transparent",
|
|
10074
|
+
size: "medium",
|
|
10075
|
+
tooltip: "Close",
|
|
10076
|
+
ariaLabel: "Close",
|
|
10077
|
+
onClick: props.onClose
|
|
10078
|
+
}, null, 8, ["onClick"])
|
|
6829
10079
|
]),
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
]]) : createCommentVNode("", true)], 10, _hoisted_1$65)), [[unref(vKdsTooltip), !__props.label ? accessibleTitle.value : void 0]]);
|
|
10080
|
+
createElementVNode("div", {
|
|
10081
|
+
class: "modal-body",
|
|
10082
|
+
"data-variant": __props.variant
|
|
10083
|
+
}, [renderSlot(_ctx.$slots, "body", {}, void 0, true)], 8, _hoisted_3$30),
|
|
10084
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_4$26, [renderSlot(_ctx.$slots, "footer", {}, void 0, true)])) : createCommentVNode("", true)
|
|
10085
|
+
], 64);
|
|
6837
10086
|
};
|
|
6838
10087
|
}
|
|
6839
|
-
}), [["__scopeId", "data-v-
|
|
10088
|
+
}), [["__scopeId", "data-v-3e1612e8"]]);
|
|
6840
10089
|
//#endregion
|
|
6841
|
-
//#region src/
|
|
6842
|
-
var
|
|
6843
|
-
RED: "red",
|
|
6844
|
-
ORANGE: "orange",
|
|
6845
|
-
GREEN: "green",
|
|
6846
|
-
DISABLED: "disabled"
|
|
6847
|
-
};
|
|
6848
|
-
var kdsLiveStatusStatuses = Object.values(kdsLiveStatusStatus);
|
|
6849
|
-
var kdsLiveStatusSize = {
|
|
6850
|
-
LARGE: "large",
|
|
6851
|
-
MEDIUM: "medium",
|
|
6852
|
-
SMALL: "small"
|
|
6853
|
-
};
|
|
6854
|
-
var kdsLiveStatusSizes = Object.values(kdsLiveStatusSize);
|
|
10090
|
+
//#region src/layouts/overlays/Modal/KdsModal.vue?vue&type=script&setup=true&lang.ts
|
|
10091
|
+
var _hoisted_1$66 = ["closedby"];
|
|
6855
10092
|
//#endregion
|
|
6856
|
-
//#region src/
|
|
6857
|
-
var
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
}
|
|
6861
|
-
|
|
10093
|
+
//#region src/layouts/overlays/Modal/KdsModal.vue
|
|
10094
|
+
var KdsModal_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
10095
|
+
__name: "KdsModal",
|
|
10096
|
+
props: {
|
|
10097
|
+
leadingIcon: {},
|
|
10098
|
+
headline: { default: "" },
|
|
10099
|
+
variant: { default: () => kdsModalVariant.PADDED },
|
|
10100
|
+
width: { default: () => kdsModalWidth.MEDIUM },
|
|
10101
|
+
height: { default: () => kdsModalHeight.AUTO },
|
|
10102
|
+
active: {
|
|
10103
|
+
type: Boolean,
|
|
10104
|
+
default: false
|
|
10105
|
+
},
|
|
10106
|
+
closedby: { default: () => kdsModalClosedBy.CLOSEREQUEST },
|
|
10107
|
+
overflow: { default: "auto" }
|
|
10108
|
+
},
|
|
10109
|
+
emits: ["close", "closed"],
|
|
10110
|
+
setup(__props, { emit: __emit }) {
|
|
10111
|
+
useCssVars((_ctx) => ({ "v366b75ef": _ctx.overflow }));
|
|
10112
|
+
const emit = __emit;
|
|
10113
|
+
const dialog = useTemplateRef("dialogElement");
|
|
10114
|
+
const onClose = (event) => {
|
|
10115
|
+
emit("close", event);
|
|
10116
|
+
};
|
|
10117
|
+
watch(() => __props.active, async (isActive) => {
|
|
10118
|
+
if (isActive) {
|
|
10119
|
+
await nextTick();
|
|
10120
|
+
dialog.value?.showModal();
|
|
10121
|
+
} else dialog.value?.close();
|
|
10122
|
+
}, { immediate: true });
|
|
10123
|
+
const renderDialog = ref(__props.active);
|
|
10124
|
+
const removeDialog = () => {
|
|
10125
|
+
if (!renderDialog.value) return;
|
|
10126
|
+
renderDialog.value = false;
|
|
10127
|
+
emit("closed");
|
|
10128
|
+
};
|
|
10129
|
+
watch(() => __props.active, async (value, lastValue) => {
|
|
10130
|
+
if (value === false && lastValue === true) if (dialog.value) {
|
|
10131
|
+
Promise.all(dialog.value.getAnimations({ subtree: true }).map((animation) => animation.finished)).then(removeDialog).catch((error) => {
|
|
10132
|
+
if (error.name === "AbortError") {
|
|
10133
|
+
removeDialog();
|
|
10134
|
+
return;
|
|
10135
|
+
}
|
|
10136
|
+
throw error;
|
|
10137
|
+
});
|
|
10138
|
+
await sleep(350);
|
|
10139
|
+
removeDialog();
|
|
10140
|
+
} else removeDialog();
|
|
10141
|
+
else renderDialog.value = value;
|
|
10142
|
+
});
|
|
10143
|
+
return (_ctx, _cache) => {
|
|
10144
|
+
return renderDialog.value ? (openBlock(), createElementBlock("dialog", {
|
|
10145
|
+
key: 0,
|
|
10146
|
+
ref: "dialogElement",
|
|
10147
|
+
class: normalizeClass([
|
|
10148
|
+
"kds-modal",
|
|
10149
|
+
`width-${__props.width}`,
|
|
10150
|
+
`height-${__props.height}`,
|
|
10151
|
+
`overflow-${__props.overflow}`
|
|
10152
|
+
]),
|
|
10153
|
+
closedby: __props.closedby,
|
|
10154
|
+
onCancel: withModifiers(onClose, ["prevent"])
|
|
10155
|
+
}, [renderSlot(_ctx.$slots, "default", {
|
|
10156
|
+
headline: __props.headline,
|
|
10157
|
+
leadingIcon: __props.leadingIcon,
|
|
10158
|
+
variant: __props.variant,
|
|
10159
|
+
overflow: __props.overflow,
|
|
10160
|
+
onClose
|
|
10161
|
+
}, () => [createVNode(KdsModalLayout_default, {
|
|
10162
|
+
headline: __props.headline,
|
|
10163
|
+
"leading-icon": __props.leadingIcon,
|
|
10164
|
+
variant: __props.variant,
|
|
10165
|
+
overflow: __props.overflow,
|
|
10166
|
+
onClose
|
|
10167
|
+
}, {
|
|
10168
|
+
body: withCtx(() => [renderSlot(_ctx.$slots, "body", {}, void 0, true)]),
|
|
10169
|
+
footer: withCtx(() => [renderSlot(_ctx.$slots, "footer", {}, void 0, true)]),
|
|
10170
|
+
_: 3
|
|
10171
|
+
}, 8, [
|
|
10172
|
+
"headline",
|
|
10173
|
+
"leading-icon",
|
|
10174
|
+
"variant",
|
|
10175
|
+
"overflow"
|
|
10176
|
+
])], true)], 42, _hoisted_1$66)) : createCommentVNode("", true);
|
|
10177
|
+
};
|
|
10178
|
+
}
|
|
10179
|
+
}), [["__scopeId", "data-v-a56c7085"]]);
|
|
6862
10180
|
//#endregion
|
|
6863
|
-
//#region src/components/
|
|
6864
|
-
var
|
|
6865
|
-
|
|
6866
|
-
|
|
10181
|
+
//#region src/components/forms/_helper/KdsSubText.vue?vue&type=script&setup=true&lang.ts
|
|
10182
|
+
var _hoisted_1$65 = ["id"];
|
|
10183
|
+
var _hoisted_2$41 = { class: "subtext-text" };
|
|
10184
|
+
//#endregion
|
|
10185
|
+
//#region src/components/forms/_helper/KdsSubText.vue
|
|
10186
|
+
var KdsSubText_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
10187
|
+
__name: "KdsSubText",
|
|
10188
|
+
props: {
|
|
10189
|
+
id: {},
|
|
10190
|
+
subText: {},
|
|
10191
|
+
error: {
|
|
10192
|
+
type: Boolean,
|
|
10193
|
+
default: false
|
|
10194
|
+
},
|
|
10195
|
+
warning: {
|
|
10196
|
+
type: Boolean,
|
|
10197
|
+
default: false
|
|
10198
|
+
},
|
|
10199
|
+
validating: {
|
|
10200
|
+
type: Boolean,
|
|
10201
|
+
default: false
|
|
10202
|
+
},
|
|
10203
|
+
preserveSubTextSpace: {
|
|
10204
|
+
type: Boolean,
|
|
10205
|
+
default: false
|
|
10206
|
+
}
|
|
10207
|
+
},
|
|
6867
10208
|
setup(__props) {
|
|
10209
|
+
const props = createPropsRestProxy(__props, [
|
|
10210
|
+
"error",
|
|
10211
|
+
"warning",
|
|
10212
|
+
"validating",
|
|
10213
|
+
"preserveSubTextSpace"
|
|
10214
|
+
]);
|
|
6868
10215
|
return (_ctx, _cache) => {
|
|
6869
|
-
return openBlock(),
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
class:
|
|
6873
|
-
|
|
10216
|
+
return props.subText || __props.preserveSubTextSpace ? (openBlock(), createElementBlock("div", {
|
|
10217
|
+
key: 0,
|
|
10218
|
+
id: props.id,
|
|
10219
|
+
class: normalizeClass({
|
|
10220
|
+
subtext: true,
|
|
10221
|
+
error: __props.error,
|
|
10222
|
+
warning: __props.warning && !__props.error
|
|
10223
|
+
})
|
|
10224
|
+
}, [__props.error && props.subText ? (openBlock(), createBlock(KdsIcon_default, {
|
|
10225
|
+
key: 0,
|
|
10226
|
+
name: "circle-error",
|
|
10227
|
+
size: "small",
|
|
10228
|
+
"aria-label": "Error"
|
|
10229
|
+
})) : __props.warning && props.subText ? (openBlock(), createBlock(KdsIcon_default, {
|
|
10230
|
+
key: 1,
|
|
10231
|
+
name: "warning",
|
|
10232
|
+
size: "small",
|
|
10233
|
+
"aria-label": "Warning"
|
|
10234
|
+
})) : __props.validating && props.subText ? (openBlock(), createBlock(KdsLoadingSpinner_default, {
|
|
10235
|
+
key: 2,
|
|
10236
|
+
size: "small",
|
|
10237
|
+
variant: "onSurface",
|
|
10238
|
+
"aria-hidden": "true"
|
|
10239
|
+
})) : createCommentVNode("", true), createElementVNode("span", _hoisted_2$41, toDisplayString(props.subText), 1)], 10, _hoisted_1$65)) : createCommentVNode("", true);
|
|
6874
10240
|
};
|
|
6875
10241
|
}
|
|
6876
|
-
}), [["__scopeId", "data-v-
|
|
10242
|
+
}), [["__scopeId", "data-v-295b2828"]]);
|
|
6877
10243
|
//#endregion
|
|
6878
|
-
//#region src/components/
|
|
6879
|
-
var _hoisted_1$64 =
|
|
6880
|
-
|
|
6881
|
-
"
|
|
6882
|
-
"
|
|
6883
|
-
"
|
|
6884
|
-
|
|
6885
|
-
var _hoisted_3$28 = ["r", "stroke-width"];
|
|
6886
|
-
var _hoisted_4$25 = [
|
|
6887
|
-
"r",
|
|
6888
|
-
"stroke-width",
|
|
6889
|
-
"stroke-dasharray",
|
|
6890
|
-
"stroke-dashoffset",
|
|
6891
|
-
"transform"
|
|
6892
|
-
];
|
|
6893
|
-
var _hoisted_5$14 = [
|
|
6894
|
-
"r",
|
|
6895
|
-
"stroke-width",
|
|
6896
|
-
"stroke-dasharray",
|
|
6897
|
-
"stroke-dashoffset",
|
|
6898
|
-
"transform"
|
|
10244
|
+
//#region src/components/forms/Checkbox/BaseCheckbox.vue?vue&type=script&setup=true&lang.ts
|
|
10245
|
+
var _hoisted_1$64 = [
|
|
10246
|
+
"disabled",
|
|
10247
|
+
"aria-label",
|
|
10248
|
+
"aria-checked",
|
|
10249
|
+
"aria-describedby",
|
|
10250
|
+
"aria-invalid"
|
|
6899
10251
|
];
|
|
6900
|
-
var
|
|
10252
|
+
var _hoisted_2$40 = { class: "control" };
|
|
10253
|
+
var _hoisted_3$29 = {
|
|
6901
10254
|
key: 0,
|
|
6902
|
-
class: "
|
|
10255
|
+
class: "content"
|
|
6903
10256
|
};
|
|
6904
|
-
var
|
|
6905
|
-
var
|
|
10257
|
+
var _hoisted_4$25 = { class: "label" };
|
|
10258
|
+
var _hoisted_5$14 = ["id"];
|
|
10259
|
+
var _hoisted_6$10 = {
|
|
6906
10260
|
key: 0,
|
|
6907
|
-
class: "
|
|
10261
|
+
class: "subtext-wrapper"
|
|
6908
10262
|
};
|
|
6909
|
-
var radius = 22;
|
|
6910
|
-
var innerRadius = 10;
|
|
6911
10263
|
//#endregion
|
|
6912
|
-
//#region src/components/
|
|
6913
|
-
var
|
|
6914
|
-
__name: "
|
|
6915
|
-
props: {
|
|
6916
|
-
|
|
6917
|
-
secondaryValue: { default: 0 },
|
|
6918
|
-
maxValue: {},
|
|
6919
|
-
acceptValuesLargerThanMax: {
|
|
10264
|
+
//#region src/components/forms/Checkbox/BaseCheckbox.vue
|
|
10265
|
+
var BaseCheckbox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
10266
|
+
__name: "BaseCheckbox",
|
|
10267
|
+
props: /*@__PURE__*/ mergeModels({
|
|
10268
|
+
disabled: {
|
|
6920
10269
|
type: Boolean,
|
|
6921
10270
|
default: false
|
|
6922
10271
|
},
|
|
6923
|
-
|
|
10272
|
+
error: {
|
|
6924
10273
|
type: Boolean,
|
|
6925
|
-
default:
|
|
10274
|
+
default: false
|
|
6926
10275
|
},
|
|
10276
|
+
subText: {},
|
|
10277
|
+
preserveSubTextSpace: { type: Boolean },
|
|
6927
10278
|
label: {},
|
|
6928
|
-
|
|
6929
|
-
|
|
10279
|
+
tooltip: {},
|
|
10280
|
+
helperText: {}
|
|
10281
|
+
}, {
|
|
10282
|
+
"modelValue": { default: false },
|
|
10283
|
+
"modelModifiers": {}
|
|
10284
|
+
}),
|
|
10285
|
+
emits: ["update:modelValue"],
|
|
6930
10286
|
setup(__props) {
|
|
6931
|
-
const
|
|
6932
|
-
|
|
6933
|
-
|
|
10287
|
+
const props = createPropsRestProxy(__props, ["disabled", "error"]);
|
|
10288
|
+
const modelValue = useModel(__props, "modelValue");
|
|
10289
|
+
const helperId = useId();
|
|
10290
|
+
const descriptionId = useId();
|
|
10291
|
+
const isChecked = computed(() => modelValue.value === true);
|
|
10292
|
+
const isIndeterminate = computed(() => modelValue.value === "indeterminate");
|
|
10293
|
+
const icon = computed(() => {
|
|
10294
|
+
if (isChecked.value) return "checkmark";
|
|
10295
|
+
if (isIndeterminate.value) return "minus";
|
|
10296
|
+
return null;
|
|
6934
10297
|
});
|
|
6935
|
-
const
|
|
6936
|
-
|
|
6937
|
-
return
|
|
10298
|
+
const ariaChecked = computed(() => {
|
|
10299
|
+
if (isIndeterminate.value) return "mixed";
|
|
10300
|
+
return isChecked.value;
|
|
6938
10301
|
});
|
|
6939
|
-
const
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
10302
|
+
const ariaDescribedBy = computed(() => {
|
|
10303
|
+
const ids = [];
|
|
10304
|
+
if (props.helperText) ids.push(helperId);
|
|
10305
|
+
if (props.subText) ids.push(descriptionId);
|
|
10306
|
+
return ids.length > 0 ? ids.join(" ") : void 0;
|
|
10307
|
+
});
|
|
10308
|
+
const handleClick = () => {
|
|
10309
|
+
if (__props.disabled) return;
|
|
10310
|
+
modelValue.value = isIndeterminate.value ? true : !isChecked.value;
|
|
6948
10311
|
};
|
|
6949
|
-
const strokeDashOffset = computed(() => calcStrokeDashOffset(clippedValue.value));
|
|
6950
|
-
const secondaryStrokeDashOffset = computed(() => calcStrokeDashOffset(secondaryClippedValue.value));
|
|
6951
|
-
const transformWedge = computed(() => `rotate(-90, ${radius}, ${radius})`);
|
|
6952
|
-
const disabled = computed(() => !Number.isFinite(__props.maxValue));
|
|
6953
10312
|
return (_ctx, _cache) => {
|
|
6954
|
-
return openBlock(), createElementBlock("div",
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
]),
|
|
6991
|
-
cx: radius,
|
|
6992
|
-
cy: radius,
|
|
6993
|
-
r: r.value,
|
|
6994
|
-
"stroke-width": strokeWidth.value,
|
|
6995
|
-
"stroke-dasharray": circumference.value,
|
|
6996
|
-
"stroke-dashoffset": strokeDashOffset.value,
|
|
6997
|
-
fill: "transparent",
|
|
6998
|
-
transform: transformWedge.value
|
|
6999
|
-
}, null, 10, _hoisted_5$14)) : createCommentVNode("", true)
|
|
7000
|
-
], 8, _hoisted_2$40)), __props.label ? (openBlock(), createElementBlock("div", _hoisted_6$10, [createElementVNode("div", _hoisted_7$3, toDisplayString(__props.label), 1), __props.subText ? (openBlock(), createElementBlock("div", _hoisted_8$3, toDisplayString(__props.subText), 1)) : createCommentVNode("", true)])) : createCommentVNode("", true)]);
|
|
10313
|
+
return openBlock(), createElementBlock("div", null, [withDirectives((openBlock(), createElementBlock("button", {
|
|
10314
|
+
class: normalizeClass({
|
|
10315
|
+
checkbox: true,
|
|
10316
|
+
checked: isChecked.value,
|
|
10317
|
+
indeterminate: isIndeterminate.value,
|
|
10318
|
+
disabled: __props.disabled,
|
|
10319
|
+
error: __props.error
|
|
10320
|
+
}),
|
|
10321
|
+
disabled: __props.disabled,
|
|
10322
|
+
"aria-label": props.tooltip,
|
|
10323
|
+
"aria-checked": ariaChecked.value,
|
|
10324
|
+
"aria-describedby": ariaDescribedBy.value,
|
|
10325
|
+
"aria-invalid": __props.error,
|
|
10326
|
+
type: "button",
|
|
10327
|
+
role: "checkbox",
|
|
10328
|
+
onClick: handleClick
|
|
10329
|
+
}, [createElementVNode("div", _hoisted_2$40, [icon.value ? (openBlock(), createBlock(KdsIcon_default, {
|
|
10330
|
+
key: 0,
|
|
10331
|
+
name: icon.value,
|
|
10332
|
+
class: "icon",
|
|
10333
|
+
size: "xsmall"
|
|
10334
|
+
}, null, 8, ["name"])) : createCommentVNode("", true)]), props.label || props.helperText ? (openBlock(), createElementBlock("div", _hoisted_3$29, [createElementVNode("div", _hoisted_4$25, toDisplayString(props.label), 1), props.helperText ? (openBlock(), createElementBlock("div", {
|
|
10335
|
+
key: 0,
|
|
10336
|
+
id: unref(helperId),
|
|
10337
|
+
class: "helper-text"
|
|
10338
|
+
}, toDisplayString(props.helperText), 9, _hoisted_5$14)) : createCommentVNode("", true)])) : createCommentVNode("", true)], 10, _hoisted_1$64)), [[unref(vKdsTooltip), props.tooltip]]), props.subText || props.preserveSubTextSpace ? (openBlock(), createElementBlock("div", _hoisted_6$10, [createVNode(KdsSubText_default, {
|
|
10339
|
+
id: unref(descriptionId),
|
|
10340
|
+
"sub-text": props.subText,
|
|
10341
|
+
"preserve-sub-text-space": props.preserveSubTextSpace,
|
|
10342
|
+
error: __props.error
|
|
10343
|
+
}, null, 8, [
|
|
10344
|
+
"id",
|
|
10345
|
+
"sub-text",
|
|
10346
|
+
"preserve-sub-text-space",
|
|
10347
|
+
"error"
|
|
10348
|
+
])])) : createCommentVNode("", true)]);
|
|
7001
10349
|
};
|
|
7002
10350
|
}
|
|
7003
|
-
}), [["__scopeId", "data-v-
|
|
7004
|
-
//#endregion
|
|
7005
|
-
//#region src/components/accessories/Text/KdsTextHighlight/KdsTextHighlight.vue?vue&type=script&setup=true&lang.ts
|
|
7006
|
-
var _hoisted_1$63 = { class: "kds-highlighted-text" };
|
|
7007
|
-
var _hoisted_2$39 = {
|
|
7008
|
-
key: 0,
|
|
7009
|
-
class: "kds-highlighted-text-match"
|
|
7010
|
-
};
|
|
10351
|
+
}), [["__scopeId", "data-v-74caccc8"]]);
|
|
7011
10352
|
//#endregion
|
|
7012
|
-
//#region src/components/
|
|
7013
|
-
var
|
|
7014
|
-
__name: "
|
|
7015
|
-
props: {
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
10353
|
+
//#region src/components/forms/Checkbox/KdsCheckbox.vue
|
|
10354
|
+
var KdsCheckbox_default = /* @__PURE__ */ defineComponent({
|
|
10355
|
+
__name: "KdsCheckbox",
|
|
10356
|
+
props: /*@__PURE__*/ mergeModels({
|
|
10357
|
+
disabled: {
|
|
10358
|
+
type: Boolean,
|
|
10359
|
+
default: false
|
|
10360
|
+
},
|
|
10361
|
+
error: {
|
|
10362
|
+
type: Boolean,
|
|
10363
|
+
default: false
|
|
10364
|
+
},
|
|
10365
|
+
subText: {},
|
|
10366
|
+
preserveSubTextSpace: {
|
|
10367
|
+
type: Boolean,
|
|
10368
|
+
default: false
|
|
10369
|
+
},
|
|
10370
|
+
label: {},
|
|
10371
|
+
tooltip: {}
|
|
10372
|
+
}, {
|
|
10373
|
+
"modelValue": { default: false },
|
|
10374
|
+
"modelModifiers": {}
|
|
10375
|
+
}),
|
|
10376
|
+
emits: ["update:modelValue"],
|
|
7019
10377
|
setup(__props) {
|
|
7020
|
-
const
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
const result = [];
|
|
7028
|
-
let cursor = 0;
|
|
7029
|
-
while (cursor < __props.text.length) {
|
|
7030
|
-
const index = lowerText.indexOf(lowerTerm, cursor);
|
|
7031
|
-
if (index === -1) {
|
|
7032
|
-
result.push({
|
|
7033
|
-
text: __props.text.slice(cursor),
|
|
7034
|
-
match: false
|
|
7035
|
-
});
|
|
7036
|
-
break;
|
|
7037
|
-
}
|
|
7038
|
-
if (index > cursor) result.push({
|
|
7039
|
-
text: __props.text.slice(cursor, index),
|
|
7040
|
-
match: false
|
|
7041
|
-
});
|
|
7042
|
-
result.push({
|
|
7043
|
-
text: __props.text.slice(index, index + __props.term.length),
|
|
7044
|
-
match: true
|
|
7045
|
-
});
|
|
7046
|
-
cursor = index + __props.term.length;
|
|
7047
|
-
}
|
|
7048
|
-
return result;
|
|
7049
|
-
});
|
|
10378
|
+
const props = createPropsRestProxy(__props, [
|
|
10379
|
+
"disabled",
|
|
10380
|
+
"error",
|
|
10381
|
+
"preserveSubTextSpace"
|
|
10382
|
+
]);
|
|
10383
|
+
/** The checked state of the checkbox. */
|
|
10384
|
+
const modelValue = useModel(__props, "modelValue");
|
|
7050
10385
|
return (_ctx, _cache) => {
|
|
7051
|
-
return openBlock(),
|
|
7052
|
-
|
|
7053
|
-
|
|
10386
|
+
return openBlock(), createBlock(BaseCheckbox_default, mergeProps(props, {
|
|
10387
|
+
modelValue: modelValue.value,
|
|
10388
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
10389
|
+
disabled: __props.disabled,
|
|
10390
|
+
error: __props.error,
|
|
10391
|
+
"preserve-sub-text-space": __props.preserveSubTextSpace
|
|
10392
|
+
}), null, 16, [
|
|
10393
|
+
"modelValue",
|
|
10394
|
+
"disabled",
|
|
10395
|
+
"error",
|
|
10396
|
+
"preserve-sub-text-space"
|
|
10397
|
+
]);
|
|
7054
10398
|
};
|
|
7055
10399
|
}
|
|
7056
|
-
})
|
|
7057
|
-
//#endregion
|
|
7058
|
-
//#region src/components/accessories/Divider/KdsDivider.vue
|
|
7059
|
-
var _sfc_main = {};
|
|
7060
|
-
var _hoisted_1$62 = { class: "kds-divider" };
|
|
7061
|
-
function _sfc_render$1(_ctx, _cache) {
|
|
7062
|
-
return openBlock(), createElementBlock("hr", _hoisted_1$62);
|
|
7063
|
-
}
|
|
7064
|
-
var KdsDivider_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render$1], ["__scopeId", "data-v-dead6417"]]);
|
|
10400
|
+
});
|
|
7065
10401
|
//#endregion
|
|
7066
|
-
//#region src/
|
|
7067
|
-
var
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
COLOR_SWATCH: "colorSwatch",
|
|
7071
|
-
LIVE_STATUS: "liveStatus",
|
|
7072
|
-
AVATAR: "avatar",
|
|
7073
|
-
PORT: "port"
|
|
10402
|
+
//#region src/layouts/overlays/Modal/useKdsDynamicModal.ts
|
|
10403
|
+
var defaultCancelButton = {
|
|
10404
|
+
type: "cancel",
|
|
10405
|
+
label: "Cancel"
|
|
7074
10406
|
};
|
|
7075
|
-
var
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
MEDIUM: "medium",
|
|
7079
|
-
LARGE: "large"
|
|
10407
|
+
var defaultConfirmButton = {
|
|
10408
|
+
type: "confirm",
|
|
10409
|
+
label: "Confirm"
|
|
7080
10410
|
};
|
|
7081
|
-
var
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
var
|
|
7085
|
-
|
|
10411
|
+
var isActive = ref(false);
|
|
10412
|
+
var activeModalConfig = ref(null);
|
|
10413
|
+
var unwrappedPromise = ref(promise_exports.createUnwrappedPromise());
|
|
10414
|
+
var resetInternalState = () => {
|
|
10415
|
+
isActive.value = false;
|
|
10416
|
+
unwrappedPromise.value = promise_exports.createUnwrappedPromise();
|
|
10417
|
+
};
|
|
10418
|
+
var onClosed = () => {
|
|
10419
|
+
activeModalConfig.value = null;
|
|
10420
|
+
};
|
|
10421
|
+
/**
|
|
10422
|
+
* Used to confirm the modal result. Should only used when called via
|
|
10423
|
+
* `askConfirmation`
|
|
10424
|
+
* @param doNotAskAgain
|
|
10425
|
+
*/
|
|
10426
|
+
var confirm = (doNotAskAgain = false) => {
|
|
10427
|
+
unwrappedPromise.value.resolve({
|
|
10428
|
+
confirmed: true,
|
|
10429
|
+
doNotAskAgain
|
|
10430
|
+
});
|
|
10431
|
+
resetInternalState();
|
|
10432
|
+
};
|
|
10433
|
+
/**
|
|
10434
|
+
* Close or cancel the dialog
|
|
10435
|
+
*/
|
|
10436
|
+
var close = () => {
|
|
10437
|
+
const isConfirm = activeModalConfig.value?.type === "confirm";
|
|
10438
|
+
unwrappedPromise.value.resolve(isConfirm ? { confirmed: false } : void 0);
|
|
10439
|
+
resetInternalState();
|
|
10440
|
+
};
|
|
10441
|
+
var isTemplateBasedConfirm = (config) => {
|
|
10442
|
+
return "component" in config;
|
|
7086
10443
|
};
|
|
7087
|
-
var
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
10444
|
+
var updateConfig = (config) => {
|
|
10445
|
+
if (!isActive.value || !activeModalConfig.value || activeModalConfig.value.type === "confirm") {
|
|
10446
|
+
consola.warn("useKdsDynamicModal: invalid invocation of updateConfig");
|
|
10447
|
+
return;
|
|
10448
|
+
}
|
|
10449
|
+
activeModalConfig.value.value = {
|
|
10450
|
+
...activeModalConfig.value.value,
|
|
10451
|
+
...config
|
|
10452
|
+
};
|
|
10453
|
+
};
|
|
10454
|
+
var internal = {
|
|
10455
|
+
confirm,
|
|
10456
|
+
close,
|
|
10457
|
+
isTemplateBasedConfirm,
|
|
10458
|
+
onClosed,
|
|
10459
|
+
updateConfig
|
|
10460
|
+
};
|
|
10461
|
+
function askConfirmation(config) {
|
|
10462
|
+
activeModalConfig.value = {
|
|
10463
|
+
type: "confirm",
|
|
10464
|
+
value: {
|
|
10465
|
+
buttons: [defaultCancelButton, defaultConfirmButton],
|
|
10466
|
+
...config
|
|
7100
10467
|
}
|
|
7101
|
-
}
|
|
10468
|
+
};
|
|
10469
|
+
isActive.value = true;
|
|
10470
|
+
return unwrappedPromise.value.promise;
|
|
10471
|
+
}
|
|
10472
|
+
var showByTemplate = (config) => {
|
|
10473
|
+
activeModalConfig.value = {
|
|
10474
|
+
type: "dynamic",
|
|
10475
|
+
value: config
|
|
10476
|
+
};
|
|
10477
|
+
isActive.value = true;
|
|
10478
|
+
return unwrappedPromise.value.promise;
|
|
10479
|
+
};
|
|
10480
|
+
var useKdsDynamicModal = () => {
|
|
10481
|
+
return {
|
|
10482
|
+
askConfirmation,
|
|
10483
|
+
showByTemplate,
|
|
10484
|
+
config: computed(() => activeModalConfig.value),
|
|
10485
|
+
isActive: computed(() => isActive.value),
|
|
10486
|
+
close: () => internal.close()
|
|
10487
|
+
};
|
|
7102
10488
|
};
|
|
7103
10489
|
//#endregion
|
|
7104
|
-
//#region src/
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
10490
|
+
//#region src/layouts/overlays/Modal/KdsDynamicModalProvider.vue?vue&type=script&setup=true&lang.ts
|
|
10491
|
+
var _hoisted_1$63 = {
|
|
10492
|
+
key: 1,
|
|
10493
|
+
class: "confirmation"
|
|
10494
|
+
};
|
|
10495
|
+
var _hoisted_2$39 = { class: "message" };
|
|
10496
|
+
var _hoisted_3$28 = {
|
|
10497
|
+
key: 0,
|
|
10498
|
+
class: "ask-again"
|
|
10499
|
+
};
|
|
7111
10500
|
//#endregion
|
|
7112
|
-
//#region src/
|
|
7113
|
-
var
|
|
7114
|
-
__name: "
|
|
10501
|
+
//#region src/layouts/overlays/Modal/KdsDynamicModalProvider.vue
|
|
10502
|
+
var KdsDynamicModalProvider_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
10503
|
+
__name: "KdsDynamicModalProvider",
|
|
10504
|
+
setup(__props) {
|
|
10505
|
+
const askAgain = ref(false);
|
|
10506
|
+
const { config, isActive } = useKdsDynamicModal();
|
|
10507
|
+
const reset = () => {
|
|
10508
|
+
askAgain.value = false;
|
|
10509
|
+
};
|
|
10510
|
+
const onConfirm = () => {
|
|
10511
|
+
internal.confirm(askAgain.value);
|
|
10512
|
+
reset();
|
|
10513
|
+
};
|
|
10514
|
+
const onClose = () => {
|
|
10515
|
+
internal.close();
|
|
10516
|
+
reset();
|
|
10517
|
+
};
|
|
10518
|
+
const handleConfirmButton = (button) => {
|
|
10519
|
+
if (!button.customHandler) {
|
|
10520
|
+
(button.type === "cancel" ? onClose : onConfirm)();
|
|
10521
|
+
return;
|
|
10522
|
+
}
|
|
10523
|
+
if (button.type === "cancel") button.customHandler({ cancel: onClose });
|
|
10524
|
+
if (button.type === "confirm") button.customHandler({ confirm: onConfirm });
|
|
10525
|
+
};
|
|
10526
|
+
const defaultVariant = (type) => type === "cancel" ? "transparent" : "filled";
|
|
10527
|
+
const kdsModalProps = computed(() => {
|
|
10528
|
+
if (!config.value) return {};
|
|
10529
|
+
const { leadingIcon, headline, height, width, variant, overflow, closedby } = config.value.value;
|
|
10530
|
+
return {
|
|
10531
|
+
leadingIcon,
|
|
10532
|
+
headline,
|
|
10533
|
+
height,
|
|
10534
|
+
width,
|
|
10535
|
+
variant,
|
|
10536
|
+
overflow,
|
|
10537
|
+
closedby,
|
|
10538
|
+
onClose,
|
|
10539
|
+
onClosed: internal.onClosed,
|
|
10540
|
+
active: isActive.value
|
|
10541
|
+
};
|
|
10542
|
+
});
|
|
10543
|
+
return (_ctx, _cache) => {
|
|
10544
|
+
return openBlock(), createBlock(KdsModal_default, mergeProps({ class: "confirm-modal" }, kdsModalProps.value), createSlots({ _: 2 }, [
|
|
10545
|
+
unref(config)?.type === "confirm" ? {
|
|
10546
|
+
name: "body",
|
|
10547
|
+
fn: withCtx(() => [unref(internal).isTemplateBasedConfirm(unref(config).value) ? (openBlock(), createBlock(resolveDynamicComponent(unref(config).value.component), { key: 0 })) : (openBlock(), createElementBlock("div", _hoisted_1$63, [createElementVNode("div", _hoisted_2$39, toDisplayString(unref(config).value.message), 1), unref(config).value.doNotAskAgain ? (openBlock(), createElementBlock("div", _hoisted_3$28, [createVNode(KdsCheckbox_default, {
|
|
10548
|
+
modelValue: askAgain.value,
|
|
10549
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => askAgain.value = $event),
|
|
10550
|
+
label: unref(config).value.doNotAskAgain.label,
|
|
10551
|
+
"sub-text": unref(config).value.doNotAskAgain.subText
|
|
10552
|
+
}, null, 8, [
|
|
10553
|
+
"modelValue",
|
|
10554
|
+
"label",
|
|
10555
|
+
"sub-text"
|
|
10556
|
+
])])) : createCommentVNode("", true)]))]),
|
|
10557
|
+
key: "0"
|
|
10558
|
+
} : void 0,
|
|
10559
|
+
unref(config)?.type === "confirm" ? {
|
|
10560
|
+
name: "footer",
|
|
10561
|
+
fn: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(config).value.buttons, (button, index) => {
|
|
10562
|
+
return openBlock(), createBlock(KdsButton_default, {
|
|
10563
|
+
key: index,
|
|
10564
|
+
destructive: button.destructive,
|
|
10565
|
+
autofocus: button.autofocus,
|
|
10566
|
+
label: button.label,
|
|
10567
|
+
variant: button.variant ?? defaultVariant(button.type),
|
|
10568
|
+
class: normalizeClass({ "flush-left": button.flushLeft }),
|
|
10569
|
+
"data-test-id": `${button.type}-button`,
|
|
10570
|
+
onClick: ($event) => handleConfirmButton(button)
|
|
10571
|
+
}, null, 8, [
|
|
10572
|
+
"destructive",
|
|
10573
|
+
"autofocus",
|
|
10574
|
+
"label",
|
|
10575
|
+
"variant",
|
|
10576
|
+
"class",
|
|
10577
|
+
"data-test-id",
|
|
10578
|
+
"onClick"
|
|
10579
|
+
]);
|
|
10580
|
+
}), 128))]),
|
|
10581
|
+
key: "1"
|
|
10582
|
+
} : void 0,
|
|
10583
|
+
unref(config)?.type === "dynamic" ? {
|
|
10584
|
+
name: "default",
|
|
10585
|
+
fn: withCtx((slotProps) => [(openBlock(), createBlock(resolveDynamicComponent(unref(config).value.component), normalizeProps(guardReactiveProps({
|
|
10586
|
+
...slotProps,
|
|
10587
|
+
context: unref(config).value.context,
|
|
10588
|
+
updateConfig: unref(internal).updateConfig
|
|
10589
|
+
})), null, 16))]),
|
|
10590
|
+
key: "2"
|
|
10591
|
+
} : void 0
|
|
10592
|
+
]), 1040);
|
|
10593
|
+
};
|
|
10594
|
+
}
|
|
10595
|
+
}), [["__scopeId", "data-v-9937b6b2"]]);
|
|
10596
|
+
//#endregion
|
|
10597
|
+
//#region src/layouts/overlays/SideDrawer/KdsSideDrawer.vue?vue&type=script&setup=true&lang.ts
|
|
10598
|
+
var _hoisted_1$62 = ["data-width"];
|
|
10599
|
+
//#endregion
|
|
10600
|
+
//#region src/layouts/overlays/SideDrawer/KdsSideDrawer.vue
|
|
10601
|
+
var KdsSideDrawer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
10602
|
+
__name: "KdsSideDrawer",
|
|
7115
10603
|
props: {
|
|
7116
|
-
|
|
7117
|
-
size: {},
|
|
7118
|
-
disabled: {
|
|
10604
|
+
isExpanded: {
|
|
7119
10605
|
type: Boolean,
|
|
7120
10606
|
default: false
|
|
7121
10607
|
},
|
|
7122
|
-
|
|
7123
|
-
variant: { default: "filled" },
|
|
7124
|
-
label: {},
|
|
7125
|
-
leadingIcon: {},
|
|
7126
|
-
trailingIcon: {},
|
|
7127
|
-
ariaLabel: {},
|
|
7128
|
-
destructive: { type: Boolean },
|
|
7129
|
-
to: {},
|
|
7130
|
-
download: {
|
|
7131
|
-
type: Boolean,
|
|
7132
|
-
default: () => void 0
|
|
7133
|
-
},
|
|
7134
|
-
target: { default: null },
|
|
7135
|
-
rel: { default: null }
|
|
10608
|
+
width: { default: "default" }
|
|
7136
10609
|
},
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
"target"
|
|
7145
|
-
]);
|
|
7146
|
-
const props = computed(() => {
|
|
7147
|
-
if (isExternalUrl(rawProps.to)) return {
|
|
7148
|
-
...rawProps,
|
|
7149
|
-
trailingIcon: "external-link"
|
|
7150
|
-
};
|
|
7151
|
-
return rawProps;
|
|
7152
|
-
});
|
|
7153
|
-
const component = computed(() => {
|
|
7154
|
-
if (__props.disabled) return "button";
|
|
7155
|
-
return resolveNuxtLinkComponent();
|
|
10610
|
+
setup(__props) {
|
|
10611
|
+
const drawerRef = useTemplateRef("drawer");
|
|
10612
|
+
onMounted(() => {
|
|
10613
|
+
watch(() => __props.isExpanded, (expanded) => {
|
|
10614
|
+
if (expanded) drawerRef.value?.showPopover();
|
|
10615
|
+
else drawerRef.value?.hidePopover();
|
|
10616
|
+
}, { immediate: true });
|
|
7156
10617
|
});
|
|
7157
|
-
const emit = __emit;
|
|
7158
10618
|
return (_ctx, _cache) => {
|
|
7159
|
-
return openBlock(),
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
component: component.value,
|
|
7166
|
-
onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event))
|
|
7167
|
-
}), null, 16, [
|
|
7168
|
-
"variant",
|
|
7169
|
-
"disabled",
|
|
7170
|
-
"download",
|
|
7171
|
-
"rel",
|
|
7172
|
-
"target",
|
|
7173
|
-
"component"
|
|
7174
|
-
]);
|
|
10619
|
+
return openBlock(), createElementBlock("div", {
|
|
10620
|
+
ref: "drawer",
|
|
10621
|
+
popover: "manual",
|
|
10622
|
+
class: "kds-side-drawer",
|
|
10623
|
+
"data-width": __props.width
|
|
10624
|
+
}, [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 8, _hoisted_1$62);
|
|
7175
10625
|
};
|
|
7176
10626
|
}
|
|
7177
|
-
});
|
|
7178
|
-
//#endregion
|
|
7179
|
-
//#region ../styles/dist/img/icons/external-link.svg?url
|
|
7180
|
-
var external_link_default = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20stroke='currentColor'%20stroke-linecap='round'%20stroke-linejoin='round'%20viewBox='0%200%2012%2012'%3e%3cpath%20d='M5.5%201.5h-3a1%201%200%200%200-1%201v7a1%201%200%200%200%201%201h7a1%201%200%200%200%201-1v-3m0-5L6%205.892M10.5%201.5v2.75m0-2.75H7.75'%20vector-effect='non-scaling-stroke'/%3e%3c/svg%3e";
|
|
10627
|
+
}), [["__scopeId", "data-v-2bceb215"]]);
|
|
7181
10628
|
//#endregion
|
|
7182
10629
|
//#region src/components/buttons/links/KdsLink/KdsLink.vue?vue&type=script&setup=true&lang.ts
|
|
7183
10630
|
var _hoisted_1$61 = { class: "label" };
|
|
@@ -7417,150 +10864,6 @@ var kdsProgressButtonState = {
|
|
|
7417
10864
|
};
|
|
7418
10865
|
var kdsProgressButtonStates = Object.values(kdsProgressButtonState);
|
|
7419
10866
|
//#endregion
|
|
7420
|
-
//#region src/util/useListItemKeyboardNav.ts
|
|
7421
|
-
var isTextInput = (target) => target instanceof HTMLElement && [
|
|
7422
|
-
"INPUT",
|
|
7423
|
-
"TEXTAREA",
|
|
7424
|
-
"SELECT"
|
|
7425
|
-
].includes(target.tagName);
|
|
7426
|
-
var diffIds = (a, b) => a.length !== b.length || a.some((id, i) => id !== b[i]);
|
|
7427
|
-
var useListItemKeyboardNav = (options) => {
|
|
7428
|
-
const { containerEl, selectableItems, enabledItems, itemFocusStrategy = "persistent", shouldNavigate = () => true } = options;
|
|
7429
|
-
const activeId = ref(void 0);
|
|
7430
|
-
function scrollToView() {
|
|
7431
|
-
if (!activeId.value || !containerEl.value) return;
|
|
7432
|
-
containerEl.value?.querySelector(`#${CSS.escape(activeId.value)}`)?.scrollIntoView({ block: "nearest" });
|
|
7433
|
-
}
|
|
7434
|
-
const findEnabledIndex = (id) => id === void 0 ? -1 : enabledItems.value.findIndex((o) => o.id === id);
|
|
7435
|
-
const moveDown = (currentIndex) => {
|
|
7436
|
-
if (currentIndex < 0) return enabledItems.value[0].id;
|
|
7437
|
-
if (currentIndex >= enabledItems.value.length - 1) return options.allowNoSelection ? void 0 : enabledItems.value[0].id;
|
|
7438
|
-
return enabledItems.value[currentIndex + 1].id;
|
|
7439
|
-
};
|
|
7440
|
-
const moveUp = (currentIndex) => {
|
|
7441
|
-
if (options.allowNoSelection && currentIndex === 0) return;
|
|
7442
|
-
if (currentIndex <= 0) return enabledItems.value[enabledItems.value.length - 1].id;
|
|
7443
|
-
return enabledItems.value[currentIndex - 1].id;
|
|
7444
|
-
};
|
|
7445
|
-
const handleKeydown = (event) => {
|
|
7446
|
-
if (!shouldNavigate(event)) return;
|
|
7447
|
-
if (enabledItems.value.length === 0) {
|
|
7448
|
-
activeId.value = selectableItems.value.length === 0 ? options.emptyOptionId : void 0;
|
|
7449
|
-
return;
|
|
7450
|
-
}
|
|
7451
|
-
const currentIndex = findEnabledIndex(activeId.value);
|
|
7452
|
-
const targetItem = enabledItems.value.find((item) => item.id === activeId.value);
|
|
7453
|
-
switch (event.key) {
|
|
7454
|
-
case "ArrowDown":
|
|
7455
|
-
activeId.value = moveDown(currentIndex);
|
|
7456
|
-
scrollToView();
|
|
7457
|
-
event.preventDefault();
|
|
7458
|
-
break;
|
|
7459
|
-
case "ArrowUp":
|
|
7460
|
-
activeId.value = moveUp(currentIndex);
|
|
7461
|
-
scrollToView();
|
|
7462
|
-
event.preventDefault();
|
|
7463
|
-
break;
|
|
7464
|
-
case "ArrowLeft":
|
|
7465
|
-
options.triggers?.onArrowLeft?.(activeId.value, targetItem);
|
|
7466
|
-
event.preventDefault();
|
|
7467
|
-
break;
|
|
7468
|
-
case "ArrowRight":
|
|
7469
|
-
options.triggers?.onArrowRight?.(activeId.value, targetItem);
|
|
7470
|
-
event.preventDefault();
|
|
7471
|
-
break;
|
|
7472
|
-
case "Enter":
|
|
7473
|
-
options.triggers?.onEnter?.(activeId.value, targetItem, event);
|
|
7474
|
-
event.preventDefault();
|
|
7475
|
-
break;
|
|
7476
|
-
case " ":
|
|
7477
|
-
if (isTextInput(event.target)) break;
|
|
7478
|
-
options.triggers?.onSpace?.(activeId.value, targetItem, event);
|
|
7479
|
-
event.preventDefault();
|
|
7480
|
-
break;
|
|
7481
|
-
case "Home":
|
|
7482
|
-
activeId.value = enabledItems.value[0].id;
|
|
7483
|
-
scrollToView();
|
|
7484
|
-
event.preventDefault();
|
|
7485
|
-
break;
|
|
7486
|
-
case "End":
|
|
7487
|
-
activeId.value = enabledItems.value[enabledItems.value.length - 1].id;
|
|
7488
|
-
scrollToView();
|
|
7489
|
-
event.preventDefault();
|
|
7490
|
-
break;
|
|
7491
|
-
default: break;
|
|
7492
|
-
}
|
|
7493
|
-
};
|
|
7494
|
-
const isFocused = ref(false);
|
|
7495
|
-
const lastActiveId = ref(void 0);
|
|
7496
|
-
const updateActiveItemId = (didIdsChange = false) => {
|
|
7497
|
-
function assertUnreachable(_) {
|
|
7498
|
-
throw new Error("Exhaustive check not met");
|
|
7499
|
-
}
|
|
7500
|
-
isFocused.value = true;
|
|
7501
|
-
switch (itemFocusStrategy) {
|
|
7502
|
-
case "always-first":
|
|
7503
|
-
activeId.value = enabledItems.value.at(0)?.id;
|
|
7504
|
-
return;
|
|
7505
|
-
case "persistent": {
|
|
7506
|
-
const hasActiveId = activeId.value !== void 0;
|
|
7507
|
-
if (!didIdsChange && hasActiveId) return;
|
|
7508
|
-
const isStillAvailable = enabledItems.value.find(({ id }) => lastActiveId.value === id);
|
|
7509
|
-
activeId.value = isStillAvailable ? lastActiveId.value : enabledItems.value.at(0)?.id;
|
|
7510
|
-
lastActiveId.value = activeId.value;
|
|
7511
|
-
return;
|
|
7512
|
-
}
|
|
7513
|
-
case "noop":
|
|
7514
|
-
activeId.value = void 0;
|
|
7515
|
-
lastActiveId.value = void 0;
|
|
7516
|
-
return;
|
|
7517
|
-
default: assertUnreachable(itemFocusStrategy);
|
|
7518
|
-
}
|
|
7519
|
-
};
|
|
7520
|
-
/** Reset activeId when possibleValues change */
|
|
7521
|
-
watch([enabledItems, () => options.loading], ([currentValues, isLoading], [prevValues]) => {
|
|
7522
|
-
if (!isFocused.value) return;
|
|
7523
|
-
if (isLoading && options.emptyOptionId) {
|
|
7524
|
-
activeId.value = options.emptyOptionId;
|
|
7525
|
-
return;
|
|
7526
|
-
}
|
|
7527
|
-
const didIdsChange = diffIds(currentValues.map(({ id }) => id), prevValues.map(({ id }) => id));
|
|
7528
|
-
updateActiveItemId(didIdsChange);
|
|
7529
|
-
});
|
|
7530
|
-
const blur = () => {
|
|
7531
|
-
lastActiveId.value = activeId.value;
|
|
7532
|
-
activeId.value = void 0;
|
|
7533
|
-
isFocused.value = false;
|
|
7534
|
-
};
|
|
7535
|
-
const setActiveId = (id) => {
|
|
7536
|
-
activeId.value = id;
|
|
7537
|
-
};
|
|
7538
|
-
const focus = () => updateActiveItemId();
|
|
7539
|
-
onMounted(() => {
|
|
7540
|
-
containerEl.value?.addEventListener("keydown", handleKeydown);
|
|
7541
|
-
containerEl.value?.addEventListener("focus", focus);
|
|
7542
|
-
containerEl.value?.addEventListener("blur", blur);
|
|
7543
|
-
});
|
|
7544
|
-
onUnmounted(() => {
|
|
7545
|
-
containerEl.value?.removeEventListener("keydown", handleKeydown);
|
|
7546
|
-
containerEl.value?.removeEventListener("focus", focus);
|
|
7547
|
-
containerEl.value?.removeEventListener("blur", blur);
|
|
7548
|
-
});
|
|
7549
|
-
function scrollSelectedIntoView() {
|
|
7550
|
-
nextTick(() => {
|
|
7551
|
-
(containerEl.value?.querySelector("[aria-selected=\"true\"]"))?.scrollIntoView({ block: "center" });
|
|
7552
|
-
});
|
|
7553
|
-
}
|
|
7554
|
-
return {
|
|
7555
|
-
handleKeydown,
|
|
7556
|
-
activeId: readonly(activeId),
|
|
7557
|
-
focus: updateActiveItemId,
|
|
7558
|
-
blur,
|
|
7559
|
-
setActiveId,
|
|
7560
|
-
scrollSelectedIntoView
|
|
7561
|
-
};
|
|
7562
|
-
};
|
|
7563
|
-
//#endregion
|
|
7564
10867
|
//#region src/util/useStableItemIds.ts
|
|
7565
10868
|
/**
|
|
7566
10869
|
* This composable adds prefixes to the ids of the given list of items.
|
|
@@ -8064,16 +11367,14 @@ var KdsMenuContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
|
|
|
8064
11367
|
ariaLabel: { default: "Menu" },
|
|
8065
11368
|
items: {},
|
|
8066
11369
|
menuMaxHeight: {},
|
|
8067
|
-
variant: { default: () => kdsListItemVariant.SMALL }
|
|
8068
|
-
itemFocusStrategy: { default: "noop" }
|
|
11370
|
+
variant: { default: () => kdsListItemVariant.SMALL }
|
|
8069
11371
|
},
|
|
8070
11372
|
emits: ["itemClick"],
|
|
8071
11373
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
8072
11374
|
const props = createPropsRestProxy(__props, [
|
|
8073
11375
|
"ariaLabel",
|
|
8074
11376
|
"menuMaxHeight",
|
|
8075
|
-
"variant"
|
|
8076
|
-
"itemFocusStrategy"
|
|
11377
|
+
"variant"
|
|
8077
11378
|
]);
|
|
8078
11379
|
const emit = __emit;
|
|
8079
11380
|
const { itemsWithPrefix, toUnprefixedId } = useStableItemIds({ items: computed(() => props.items) });
|
|
@@ -8140,38 +11441,86 @@ var KdsMenuContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
|
|
|
8140
11441
|
const hasChildren = (item) => {
|
|
8141
11442
|
return item.children && item.children.length > 0;
|
|
8142
11443
|
};
|
|
8143
|
-
const showPopoverByKeyboard = (
|
|
8144
|
-
if (
|
|
8145
|
-
};
|
|
8146
|
-
const
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
11444
|
+
const showPopoverByKeyboard = (id) => {
|
|
11445
|
+
if (id) (showPopover(id)?.querySelector("[data-submenu-container]"))?.focus();
|
|
11446
|
+
};
|
|
11447
|
+
const activeId = ref(void 0);
|
|
11448
|
+
function scrollToView() {
|
|
11449
|
+
if (!activeId.value || !containerEl.value) return;
|
|
11450
|
+
containerEl.value?.querySelector(`#${CSS.escape(activeId.value)}`)?.scrollIntoView({ block: "nearest" });
|
|
11451
|
+
}
|
|
11452
|
+
const findEnabledIndex = (id) => id === void 0 ? -1 : enabledItems.value.findIndex((o) => o.id === id);
|
|
11453
|
+
const moveDown = (currentIndex) => {
|
|
11454
|
+
if (currentIndex < 0) return enabledItems.value[0]?.id;
|
|
11455
|
+
if (currentIndex >= enabledItems.value.length - 1) return enabledItems.value[0].id;
|
|
11456
|
+
return enabledItems.value[currentIndex + 1].id;
|
|
11457
|
+
};
|
|
11458
|
+
const moveUp = (currentIndex) => {
|
|
11459
|
+
if (currentIndex <= 0) return enabledItems.value[enabledItems.value.length - 1].id;
|
|
11460
|
+
return enabledItems.value[currentIndex - 1].id;
|
|
11461
|
+
};
|
|
11462
|
+
const setActiveId = (id) => {
|
|
11463
|
+
activeId.value = id;
|
|
11464
|
+
};
|
|
11465
|
+
const shouldNavigate = (event) => {
|
|
11466
|
+
const rootNode = containerEl.value?.getRootNode();
|
|
11467
|
+
if (!rootNode) return false;
|
|
11468
|
+
const activeElement = rootNode.activeElement;
|
|
11469
|
+
return activeElement === event.target && activeElement === containerEl.value;
|
|
11470
|
+
};
|
|
11471
|
+
const handleKeydown = (event) => {
|
|
11472
|
+
if (!shouldNavigate(event)) return;
|
|
11473
|
+
if (enabledItems.value.length === 0) return;
|
|
11474
|
+
const currentIndex = findEnabledIndex(activeId.value);
|
|
11475
|
+
const targetItem = enabledItems.value.find((item) => item.id === activeId.value);
|
|
11476
|
+
switch (event.key) {
|
|
11477
|
+
case "ArrowDown":
|
|
11478
|
+
activeId.value = moveDown(currentIndex);
|
|
11479
|
+
scrollToView();
|
|
11480
|
+
event.preventDefault();
|
|
11481
|
+
break;
|
|
11482
|
+
case "ArrowUp":
|
|
11483
|
+
activeId.value = moveUp(currentIndex);
|
|
11484
|
+
scrollToView();
|
|
11485
|
+
event.preventDefault();
|
|
11486
|
+
break;
|
|
11487
|
+
case "ArrowLeft":
|
|
8167
11488
|
parentList?.closeActiveSubmenu({ requester: props.id });
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
11489
|
+
event.preventDefault();
|
|
11490
|
+
break;
|
|
11491
|
+
case "ArrowRight":
|
|
11492
|
+
if (targetItem && !hasChildren(validateItemChildren(targetItem))) break;
|
|
11493
|
+
showPopoverByKeyboard(activeId.value);
|
|
11494
|
+
event.preventDefault();
|
|
11495
|
+
break;
|
|
11496
|
+
case "Enter":
|
|
11497
|
+
if (targetItem && hasChildren(validateItemChildren(targetItem))) showPopoverByKeyboard(activeId.value);
|
|
11498
|
+
else onKeyboardActivate(targetItem, event);
|
|
11499
|
+
event.preventDefault();
|
|
11500
|
+
break;
|
|
11501
|
+
case " ":
|
|
11502
|
+
onKeyboardActivate(targetItem, event);
|
|
11503
|
+
event.preventDefault();
|
|
11504
|
+
break;
|
|
11505
|
+
case "Home":
|
|
11506
|
+
activeId.value = enabledItems.value[0].id;
|
|
11507
|
+
scrollToView();
|
|
11508
|
+
event.preventDefault();
|
|
11509
|
+
break;
|
|
11510
|
+
case "End":
|
|
11511
|
+
activeId.value = enabledItems.value[enabledItems.value.length - 1].id;
|
|
11512
|
+
scrollToView();
|
|
11513
|
+
event.preventDefault();
|
|
11514
|
+
break;
|
|
11515
|
+
default: break;
|
|
8173
11516
|
}
|
|
8174
|
-
}
|
|
11517
|
+
};
|
|
11518
|
+
const focus = () => {
|
|
11519
|
+
activeId.value = void 0;
|
|
11520
|
+
};
|
|
11521
|
+
const blur = () => {
|
|
11522
|
+
activeId.value = void 0;
|
|
11523
|
+
};
|
|
8175
11524
|
provide(ChildItemKey, { closeActiveSubmenu: () => {
|
|
8176
11525
|
const lastActiveId = activePopoverId.value;
|
|
8177
11526
|
closePopover();
|
|
@@ -8181,7 +11530,7 @@ var KdsMenuContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/
|
|
|
8181
11530
|
__expose({
|
|
8182
11531
|
/**
|
|
8183
11532
|
* Function to focus the outer container of the menu.
|
|
8184
|
-
*
|
|
11533
|
+
* No item is activated on focus.
|
|
8185
11534
|
*/
|
|
8186
11535
|
focus: () => {
|
|
8187
11536
|
containerEl.value?.focus();
|
|
@@ -8207,13 +11556,18 @@ focus: () => {
|
|
|
8207
11556
|
"aria-label": __props.ariaLabel,
|
|
8208
11557
|
tabindex: 0,
|
|
8209
11558
|
style: normalizeStyle({ maxHeight: __props.menuMaxHeight }),
|
|
8210
|
-
"aria-activedescendant":
|
|
8211
|
-
|
|
8212
|
-
onFocusin: _cache[3] || (_cache[3] = withModifiers(($event) => activePopoverId.value = void 0, ["stop"])),
|
|
8213
|
-
onFocusout: handleFocusOut,
|
|
8214
|
-
onKeydown: _cache[4] || (_cache[4] = withKeys(() => {
|
|
11559
|
+
"aria-activedescendant": activeId.value ?? activePopoverId.value,
|
|
11560
|
+
onKeydown: [handleKeydown, _cache[5] || (_cache[5] = withKeys(() => {
|
|
8215
11561
|
unref(parentList)?.closeActiveSubmenu({ requester: props.id });
|
|
8216
|
-
}, ["esc"]))
|
|
11562
|
+
}, ["esc"]))],
|
|
11563
|
+
onFocus: focus,
|
|
11564
|
+
onBlur: blur,
|
|
11565
|
+
onMouseleave: _cache[3] || (_cache[3] = () => {
|
|
11566
|
+
closePopover();
|
|
11567
|
+
activeId.value = void 0;
|
|
11568
|
+
}),
|
|
11569
|
+
onFocusin: _cache[4] || (_cache[4] = withModifiers(($event) => activePopoverId.value = void 0, ["stop"])),
|
|
11570
|
+
onFocusout: handleFocusOut
|
|
8217
11571
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(itemsWithPrefix), (item, index) => {
|
|
8218
11572
|
return openBlock(), createBlock(KdsMenuItem_default, {
|
|
8219
11573
|
key: item.id,
|
|
@@ -8221,11 +11575,12 @@ focus: () => {
|
|
|
8221
11575
|
ref: (el) => setItemRef(el, index),
|
|
8222
11576
|
item: validateItemChildren(item),
|
|
8223
11577
|
"is-last": index === unref(itemsWithPrefix).length - 1,
|
|
8224
|
-
"active-id":
|
|
11578
|
+
"active-id": activeId.value ?? activePopoverId.value,
|
|
8225
11579
|
variant: __props.variant,
|
|
8226
11580
|
onClick: ($event) => handleItemInteraction(item, $event),
|
|
8227
11581
|
onMouseenter: () => {
|
|
8228
11582
|
if (activePopoverId.value) closePopover();
|
|
11583
|
+
if (!item.disabled) activeId.value = item.id;
|
|
8229
11584
|
if (!item.disabled && hasChildren(item)) showPopover(item.id);
|
|
8230
11585
|
}
|
|
8231
11586
|
}, {
|
|
@@ -8263,7 +11618,7 @@ focus: () => {
|
|
|
8263
11618
|
}), 128))], 44, _hoisted_1$57);
|
|
8264
11619
|
};
|
|
8265
11620
|
}
|
|
8266
|
-
}), [["__scopeId", "data-v-
|
|
11621
|
+
}), [["__scopeId", "data-v-7e0346b7"]]);
|
|
8267
11622
|
//#endregion
|
|
8268
11623
|
//#region src/components/buttons/KdsMenuButton/KdsMenuButton.vue
|
|
8269
11624
|
var KdsMenuButton_default = /* @__PURE__ */ defineComponent({
|
|
@@ -9082,11 +12437,11 @@ var KdsEmptyState_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @
|
|
|
9082
12437
|
})) : createCommentVNode("", true),
|
|
9083
12438
|
createElementVNode("p", _hoisted_2$32, toDisplayString(props.headline), 1),
|
|
9084
12439
|
props.description ? (openBlock(), createElementBlock("p", _hoisted_3$24, toDisplayString(props.description), 1)) : createCommentVNode("", true),
|
|
9085
|
-
resolvedPrimaryAction.value ? (openBlock(), createElementBlock("div", _hoisted_4$22, [createVNode(ActionButton_default, mergeProps(resolvedPrimaryAction.value, { size: "
|
|
12440
|
+
resolvedPrimaryAction.value ? (openBlock(), createElementBlock("div", _hoisted_4$22, [createVNode(ActionButton_default, mergeProps(resolvedPrimaryAction.value, { size: "small" }), null, 16), resolvedSecondaryAction.value ? (openBlock(), createBlock(ActionButton_default, mergeProps({ key: 0 }, resolvedSecondaryAction.value, { size: "small" }), null, 16)) : createCommentVNode("", true)])) : createCommentVNode("", true)
|
|
9086
12441
|
], 10, _hoisted_1$53);
|
|
9087
12442
|
};
|
|
9088
12443
|
}
|
|
9089
|
-
}), [["__scopeId", "data-v-
|
|
12444
|
+
}), [["__scopeId", "data-v-cf1ab519"]]);
|
|
9090
12445
|
//#endregion
|
|
9091
12446
|
//#region src/components/feedback/InlineMessage/KdsInlineMessage.vue?vue&type=script&setup=true&lang.ts
|
|
9092
12447
|
var _hoisted_1$52 = ["role"];
|
|
@@ -11388,8 +14743,7 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
11388
14743
|
allowNoSelection: {
|
|
11389
14744
|
type: Boolean,
|
|
11390
14745
|
default: false
|
|
11391
|
-
}
|
|
11392
|
-
itemFocusStrategy: { default: "persistent" }
|
|
14746
|
+
}
|
|
11393
14747
|
},
|
|
11394
14748
|
emits: ["itemClick"],
|
|
11395
14749
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -11397,8 +14751,7 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
11397
14751
|
"emptyText",
|
|
11398
14752
|
"variant",
|
|
11399
14753
|
"loading",
|
|
11400
|
-
"allowNoSelection"
|
|
11401
|
-
"itemFocusStrategy"
|
|
14754
|
+
"allowNoSelection"
|
|
11402
14755
|
]);
|
|
11403
14756
|
const emit = __emit;
|
|
11404
14757
|
const { itemsWithPrefix, idPrefix, toUnprefixedId } = useStableItemIds({ items: computed(() => __props.loading ? [] : props.possibleValues) });
|
|
@@ -11410,24 +14763,96 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
11410
14763
|
/** Only selectable (non-section-headline) items */
|
|
11411
14764
|
const selectableValues = computed(() => itemsWithPrefix.value.filter((item) => !item.sectionHeadline));
|
|
11412
14765
|
const containerEl = useTemplateRef("containerEl");
|
|
11413
|
-
const
|
|
11414
|
-
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
14766
|
+
const enabledValues = computed(() => selectableValues.value.filter((o) => !o.disabled));
|
|
14767
|
+
const activeId = ref(void 0);
|
|
14768
|
+
const isFocused = ref(false);
|
|
14769
|
+
function scrollToView() {
|
|
14770
|
+
if (!activeId.value || !containerEl.value) return;
|
|
14771
|
+
containerEl.value?.querySelector(`#${CSS.escape(activeId.value)}`)?.scrollIntoView({ block: "nearest" });
|
|
14772
|
+
}
|
|
14773
|
+
const findEnabledIndex = (id) => id === void 0 ? -1 : enabledValues.value.findIndex((o) => o.id === id);
|
|
14774
|
+
const moveDown = (currentIndex) => {
|
|
14775
|
+
if (currentIndex < 0) return enabledValues.value[0].id;
|
|
14776
|
+
if (currentIndex >= enabledValues.value.length - 1) return __props.allowNoSelection ? void 0 : enabledValues.value[0].id;
|
|
14777
|
+
return enabledValues.value[currentIndex + 1].id;
|
|
14778
|
+
};
|
|
14779
|
+
const moveUp = (currentIndex) => {
|
|
14780
|
+
if (__props.allowNoSelection && currentIndex === 0) return;
|
|
14781
|
+
if (currentIndex <= 0) return enabledValues.value[enabledValues.value.length - 1].id;
|
|
14782
|
+
return enabledValues.value[currentIndex - 1].id;
|
|
14783
|
+
};
|
|
14784
|
+
const isTextInput = (target) => target instanceof HTMLElement && [
|
|
14785
|
+
"INPUT",
|
|
14786
|
+
"TEXTAREA",
|
|
14787
|
+
"SELECT"
|
|
14788
|
+
].includes(target.tagName);
|
|
14789
|
+
const handleKeydown = (event) => {
|
|
14790
|
+
if (enabledValues.value.length === 0) {
|
|
14791
|
+
activeId.value = selectableValues.value.length === 0 ? emptyOptionId : void 0;
|
|
14792
|
+
return;
|
|
14793
|
+
}
|
|
14794
|
+
const currentIndex = findEnabledIndex(activeId.value);
|
|
14795
|
+
switch (event.key) {
|
|
14796
|
+
case "ArrowDown":
|
|
14797
|
+
activeId.value = moveDown(currentIndex);
|
|
14798
|
+
scrollToView();
|
|
14799
|
+
event.preventDefault();
|
|
14800
|
+
break;
|
|
14801
|
+
case "ArrowUp":
|
|
14802
|
+
activeId.value = moveUp(currentIndex);
|
|
14803
|
+
scrollToView();
|
|
14804
|
+
event.preventDefault();
|
|
14805
|
+
break;
|
|
14806
|
+
case "Enter":
|
|
11424
14807
|
emit("itemClick", toOptionId(activeId.value));
|
|
11425
|
-
|
|
11426
|
-
|
|
14808
|
+
event.preventDefault();
|
|
14809
|
+
break;
|
|
14810
|
+
case " ":
|
|
14811
|
+
if (isTextInput(event.target)) break;
|
|
11427
14812
|
emit("itemClick", toOptionId(activeId.value));
|
|
11428
|
-
|
|
14813
|
+
event.preventDefault();
|
|
14814
|
+
break;
|
|
14815
|
+
case "Home":
|
|
14816
|
+
activeId.value = enabledValues.value[0].id;
|
|
14817
|
+
scrollToView();
|
|
14818
|
+
event.preventDefault();
|
|
14819
|
+
break;
|
|
14820
|
+
case "End":
|
|
14821
|
+
activeId.value = enabledValues.value[enabledValues.value.length - 1].id;
|
|
14822
|
+
scrollToView();
|
|
14823
|
+
event.preventDefault();
|
|
14824
|
+
break;
|
|
14825
|
+
default: break;
|
|
14826
|
+
}
|
|
14827
|
+
};
|
|
14828
|
+
const activateSelectedItem = () => {
|
|
14829
|
+
const selectedItem = enabledValues.value.find((item) => item.selected);
|
|
14830
|
+
activeId.value = selectedItem?.id;
|
|
14831
|
+
};
|
|
14832
|
+
const focus = () => {
|
|
14833
|
+
isFocused.value = true;
|
|
14834
|
+
activateSelectedItem();
|
|
14835
|
+
};
|
|
14836
|
+
const blur = () => {
|
|
14837
|
+
activeId.value = void 0;
|
|
14838
|
+
isFocused.value = false;
|
|
14839
|
+
};
|
|
14840
|
+
/** Reset activeId when possibleValues change */
|
|
14841
|
+
const diffIds = (a, b) => a.length !== b.length || a.some((id, i) => id !== b[i]);
|
|
14842
|
+
watch([enabledValues, () => __props.loading], ([currentValues, isLoading], [prevValues]) => {
|
|
14843
|
+
if (activeId.value && !selectableValues.value.some((item) => item.id === activeId.value)) activeId.value = void 0;
|
|
14844
|
+
if (!isFocused.value) return;
|
|
14845
|
+
if (isLoading && emptyOptionId) {
|
|
14846
|
+
activeId.value = emptyOptionId;
|
|
14847
|
+
return;
|
|
11429
14848
|
}
|
|
14849
|
+
if (diffIds(currentValues.map(({ id }) => id), prevValues.map(({ id }) => id))) activateSelectedItem();
|
|
11430
14850
|
});
|
|
14851
|
+
function scrollSelectedIntoView() {
|
|
14852
|
+
nextTick(() => {
|
|
14853
|
+
(containerEl.value?.querySelector("[aria-selected=\"true\"]"))?.scrollIntoView({ block: "center" });
|
|
14854
|
+
});
|
|
14855
|
+
}
|
|
11431
14856
|
__expose({
|
|
11432
14857
|
/** Forward a keydown event to the list for keyboard navigation */
|
|
11433
14858
|
handleKeydown,
|
|
@@ -11435,7 +14860,7 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
11435
14860
|
handleFocus: focus,
|
|
11436
14861
|
/** Notify the list that its controlling element lost focus */
|
|
11437
14862
|
handleBlur: blur,
|
|
11438
|
-
activeDescendant: activeId,
|
|
14863
|
+
activeDescendant: readonly(activeId),
|
|
11439
14864
|
/** Moves focus to the list container element */
|
|
11440
14865
|
focus: () => {
|
|
11441
14866
|
containerEl.value?.focus();
|
|
@@ -11449,9 +14874,13 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
11449
14874
|
role: "listbox",
|
|
11450
14875
|
"aria-busy": __props.loading,
|
|
11451
14876
|
"aria-label": props.ariaLabel,
|
|
11452
|
-
"aria-activedescendant": !props.controlledExternally &&
|
|
14877
|
+
"aria-activedescendant": !props.controlledExternally && activeId.value ? activeId.value : void 0,
|
|
11453
14878
|
class: ["kds-list-container", { standalone: !props.controlledExternally }],
|
|
11454
|
-
tabindex: props.controlledExternally ? void 0 : 0
|
|
14879
|
+
tabindex: props.controlledExternally ? void 0 : 0,
|
|
14880
|
+
onKeydown: handleKeydown,
|
|
14881
|
+
onFocus: focus,
|
|
14882
|
+
onBlur: blur,
|
|
14883
|
+
onMouseleave: _cache[1] || (_cache[1] = ($event) => activeId.value = void 0)
|
|
11455
14884
|
}), [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(itemsWithPrefix), (item, index) => {
|
|
11456
14885
|
return openBlock(), createElementBlock(Fragment, { key: item.id }, [item.sectionHeadline ? (openBlock(), createBlock(ListItemSectionTitle_default, {
|
|
11457
14886
|
key: 0,
|
|
@@ -11467,14 +14896,15 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
11467
14896
|
"sub-text": item.subText,
|
|
11468
14897
|
selected: item.selected,
|
|
11469
14898
|
disabled: item.disabled,
|
|
11470
|
-
active:
|
|
14899
|
+
active: activeId.value === item.id,
|
|
11471
14900
|
special: item.special,
|
|
11472
14901
|
missing: item.missing,
|
|
11473
14902
|
variant: __props.variant,
|
|
11474
14903
|
"trailing-icon": item.missing && !item.disabled ? "trash" : item.selected ? "checkmark" : void 0,
|
|
11475
14904
|
role: "option",
|
|
11476
14905
|
onMousedown: _cache[0] || (_cache[0] = ($event) => props.controlledExternally && $event.preventDefault()),
|
|
11477
|
-
onClick: ($event) => !item.disabled && emit("itemClick", toOptionId(item.id))
|
|
14906
|
+
onClick: ($event) => !item.disabled && emit("itemClick", toOptionId(item.id)),
|
|
14907
|
+
onMouseenter: ($event) => !item.disabled && (activeId.value = item.id)
|
|
11478
14908
|
}, null, 8, [
|
|
11479
14909
|
"id",
|
|
11480
14910
|
"accessory",
|
|
@@ -11487,7 +14917,8 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
11487
14917
|
"missing",
|
|
11488
14918
|
"variant",
|
|
11489
14919
|
"trailing-icon",
|
|
11490
|
-
"onClick"
|
|
14920
|
+
"onClick",
|
|
14921
|
+
"onMouseenter"
|
|
11491
14922
|
])), item.separator && index < unref(itemsWithPrefix).length - 1 ? (openBlock(), createBlock(unref(KdsDivider_default), {
|
|
11492
14923
|
key: 2,
|
|
11493
14924
|
class: "kds-list-item-divider",
|
|
@@ -11510,8 +14941,8 @@ var KdsListContainer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
11510
14941
|
});
|
|
11511
14942
|
//#endregion
|
|
11512
14943
|
//#region src/components/lists/ListContainer/KdsListContainer.vue
|
|
11513
|
-
var KdsListContainer_exports = /* @__PURE__ */ __exportAll({ default: () => KdsListContainer_default });
|
|
11514
|
-
var KdsListContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(KdsListContainer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
14944
|
+
var KdsListContainer_exports = /* @__PURE__ */ __exportAll$1({ default: () => KdsListContainer_default });
|
|
14945
|
+
var KdsListContainer_default = /*#__PURE__*/ _plugin_vue_export_helper_default(KdsListContainer_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-d28d3d15"]]);
|
|
11515
14946
|
//#endregion
|
|
11516
14947
|
//#region src/components/forms/inputs/TextInput/KdsTextInput.vue
|
|
11517
14948
|
var KdsTextInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
@@ -17770,7 +21201,7 @@ var KdsSearchInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
17770
21201
|
"resultClick"
|
|
17771
21202
|
], ["update:modelValue"]),
|
|
17772
21203
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
17773
|
-
const KdsPopover = defineAsyncComponent(() => import("./KdsPopover-
|
|
21204
|
+
const KdsPopover = defineAsyncComponent(() => import("./KdsPopover-FOQyEkHj.js").then((n) => n.n));
|
|
17774
21205
|
const KdsListContainer = defineAsyncComponent(() => Promise.resolve().then(() => KdsListContainer_exports));
|
|
17775
21206
|
const props = createPropsRestProxy(__props, [
|
|
17776
21207
|
"placeholder",
|
|
@@ -17894,7 +21325,6 @@ var KdsSearchInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
17894
21325
|
"possible-values": __props.results,
|
|
17895
21326
|
"controlled-externally": "",
|
|
17896
21327
|
"allow-no-selection": "",
|
|
17897
|
-
"item-focus-strategy": "noop",
|
|
17898
21328
|
"empty-text": "No search results",
|
|
17899
21329
|
"aria-label": "Search results list",
|
|
17900
21330
|
onItemClick: onResultClick
|
|
@@ -17914,7 +21344,7 @@ var KdsSearchInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
17914
21344
|
]);
|
|
17915
21345
|
};
|
|
17916
21346
|
}
|
|
17917
|
-
}), [["__scopeId", "data-v-
|
|
21347
|
+
}), [["__scopeId", "data-v-fe584de9"]]);
|
|
17918
21348
|
//#endregion
|
|
17919
21349
|
//#region src/components/forms/inputs/Textarea/KdsTextarea.vue?vue&type=script&setup=true&lang.ts
|
|
17920
21350
|
var _hoisted_1$35 = [
|
|
@@ -21968,7 +25398,7 @@ var KdsInfoToggleButton_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
|
|
|
21968
25398
|
});
|
|
21969
25399
|
//#endregion
|
|
21970
25400
|
//#region src/components/forms/_helper/InfoPopover/KdsInfoToggleButton.vue
|
|
21971
|
-
var KdsInfoToggleButton_exports = /* @__PURE__ */ __exportAll({ default: () => KdsInfoToggleButton_default });
|
|
25401
|
+
var KdsInfoToggleButton_exports = /* @__PURE__ */ __exportAll$1({ default: () => KdsInfoToggleButton_default });
|
|
21972
25402
|
var KdsInfoToggleButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(KdsInfoToggleButton_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-e9c62ffb"]]);
|
|
21973
25403
|
//#endregion
|
|
21974
25404
|
//#region src/components/forms/_helper/VariablePopover/VariablePopover.vue?vue&type=script&setup=true&lang.ts
|