yummies 5.10.0 → 5.11.0

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/html.js CHANGED
@@ -1,558 +1,34 @@
1
- import { blobToUrl as Bt } from "yummies/media";
2
- /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
3
- const {
4
- entries: Tt,
5
- setPrototypeOf: at,
6
- isFrozen: Yt,
7
- getPrototypeOf: Vt,
8
- getOwnPropertyDescriptor: Xt
9
- } = Object;
10
- let {
11
- freeze: S,
12
- seal: y,
13
- create: ht
14
- } = Object, {
15
- apply: Me,
16
- construct: xe
17
- } = typeof Reflect < "u" && Reflect;
18
- S || (S = function(n) {
19
- return n;
20
- });
21
- y || (y = function(n) {
22
- return n;
23
- });
24
- Me || (Me = function(n, r, s) {
25
- return n.apply(r, s);
26
- });
27
- xe || (xe = function(n, r) {
28
- return new n(...r);
29
- });
30
- const le = b(Array.prototype.forEach), $t = b(Array.prototype.lastIndexOf), st = b(Array.prototype.pop), j = b(Array.prototype.push), jt = b(Array.prototype.splice), fe = b(String.prototype.toLowerCase), De = b(String.prototype.toString), lt = b(String.prototype.match), q = b(String.prototype.replace), qt = b(String.prototype.indexOf), Kt = b(String.prototype.trim), O = b(Object.prototype.hasOwnProperty), A = b(RegExp.prototype.test), K = Zt(TypeError);
31
- function b(o) {
32
- return function(n) {
33
- n instanceof RegExp && (n.lastIndex = 0);
34
- for (var r = arguments.length, s = new Array(r > 1 ? r - 1 : 0), m = 1; m < r; m++)
35
- s[m - 1] = arguments[m];
36
- return Me(o, n, s);
37
- };
38
- }
39
- function Zt(o) {
40
- return function() {
41
- for (var n = arguments.length, r = new Array(n), s = 0; s < n; s++)
42
- r[s] = arguments[s];
43
- return xe(o, r);
44
- };
45
- }
46
- function l(o, n) {
47
- let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : fe;
48
- at && at(o, null);
49
- let s = n.length;
50
- for (; s--; ) {
51
- let m = n[s];
52
- if (typeof m == "string") {
53
- const L = r(m);
54
- L !== m && (Yt(n) || (n[s] = L), m = L);
55
- }
56
- o[m] = !0;
57
- }
58
- return o;
59
- }
60
- function Jt(o) {
61
- for (let n = 0; n < o.length; n++)
62
- O(o, n) || (o[n] = null);
63
- return o;
64
- }
65
- function C(o) {
66
- const n = ht(null);
67
- for (const [r, s] of Tt(o))
68
- O(o, r) && (Array.isArray(s) ? n[r] = Jt(s) : s && typeof s == "object" && s.constructor === Object ? n[r] = C(s) : n[r] = s);
69
- return n;
70
- }
71
- function Z(o, n) {
72
- for (; o !== null; ) {
73
- const s = Xt(o, n);
74
- if (s) {
75
- if (s.get)
76
- return b(s.get);
77
- if (typeof s.value == "function")
78
- return b(s.value);
79
- }
80
- o = Vt(o);
81
- }
82
- function r() {
83
- return null;
84
- }
85
- return r;
86
- }
87
- const ct = S(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Ne = S(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Ie = S(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Qt = S(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), we = S(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), en = S(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), ft = S(["#text"]), ut = S(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Ce = S(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), mt = S(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), ce = S(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), tn = y(/\{\{[\w\W]*|[\w\W]*\}\}/gm), nn = y(/<%[\w\W]*|[\w\W]*%>/gm), on = y(/\$\{[\w\W]*/gm), rn = y(/^data-[\-\w.\u00B7-\uFFFF]+$/), an = y(/^aria-[\-\w]+$/), gt = y(
88
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
89
- // eslint-disable-line no-useless-escape
90
- ), sn = y(/^(?:\w+script|data):/i), ln = y(
91
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
92
- // eslint-disable-line no-control-regex
93
- ), Et = y(/^html$/i), cn = y(/^[a-z][.\w]*(-[.\w]+)+$/i);
94
- var pt = /* @__PURE__ */ Object.freeze({
95
- __proto__: null,
96
- ARIA_ATTR: an,
97
- ATTR_WHITESPACE: ln,
98
- CUSTOM_ELEMENT: cn,
99
- DATA_ATTR: rn,
100
- DOCTYPE_NAME: Et,
101
- ERB_EXPR: nn,
102
- IS_ALLOWED_URI: gt,
103
- IS_SCRIPT_OR_DATA: sn,
104
- MUSTACHE_EXPR: tn,
105
- TMPLIT_EXPR: on
106
- });
107
- const J = {
108
- element: 1,
109
- text: 3,
110
- // Deprecated
111
- progressingInstruction: 7,
112
- comment: 8,
113
- document: 9
114
- }, fn = function() {
115
- return typeof window > "u" ? null : window;
116
- }, un = function(n, r) {
117
- if (typeof n != "object" || typeof n.createPolicy != "function")
118
- return null;
119
- let s = null;
120
- const m = "data-tt-policy-suffix";
121
- r && r.hasAttribute(m) && (s = r.getAttribute(m));
122
- const L = "dompurify" + (s ? "#" + s : "");
123
- try {
124
- return n.createPolicy(L, {
125
- createHTML(x) {
126
- return x;
127
- },
128
- createScriptURL(x) {
129
- return x;
130
- }
131
- });
132
- } catch {
133
- return console.warn("TrustedTypes policy " + L + " could not be created."), null;
134
- }
135
- }, dt = function() {
136
- return {
137
- afterSanitizeAttributes: [],
138
- afterSanitizeElements: [],
139
- afterSanitizeShadowDOM: [],
140
- beforeSanitizeAttributes: [],
141
- beforeSanitizeElements: [],
142
- beforeSanitizeShadowDOM: [],
143
- uponSanitizeAttribute: [],
144
- uponSanitizeElement: [],
145
- uponSanitizeShadowNode: []
146
- };
147
- };
148
- function _t() {
149
- let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : fn();
150
- const n = (a) => _t(a);
151
- if (n.version = "3.2.6", n.removed = [], !o || !o.document || o.document.nodeType !== J.document || !o.Element)
152
- return n.isSupported = !1, n;
153
- let {
154
- document: r
155
- } = o;
156
- const s = r, m = s.currentScript, {
157
- DocumentFragment: L,
158
- HTMLTemplateElement: x,
159
- Node: ue,
160
- Element: Pe,
161
- NodeFilter: W,
162
- NamedNodeMap: At = o.NamedNodeMap || o.MozNamedAttrMap,
163
- HTMLFormElement: St,
164
- DOMParser: bt,
165
- trustedTypes: Q
166
- } = o, G = Pe.prototype, Rt = Z(G, "cloneNode"), yt = Z(G, "remove"), Lt = Z(G, "nextSibling"), Ot = Z(G, "childNodes"), ee = Z(G, "parentNode");
167
- if (typeof x == "function") {
168
- const a = r.createElement("template");
169
- a.content && a.content.ownerDocument && (r = a.content.ownerDocument);
170
- }
171
- let E, B = "";
172
- const {
173
- implementation: me,
174
- createNodeIterator: Dt,
175
- createDocumentFragment: Nt,
176
- getElementsByTagName: It
177
- } = r, {
178
- importNode: wt
179
- } = s;
180
- let _ = dt();
181
- n.isSupported = typeof Tt == "function" && typeof ee == "function" && me && me.createHTMLDocument !== void 0;
182
- const {
183
- MUSTACHE_EXPR: pe,
184
- ERB_EXPR: de,
185
- TMPLIT_EXPR: Te,
186
- DATA_ATTR: Ct,
187
- ARIA_ATTR: Mt,
188
- IS_SCRIPT_OR_DATA: xt,
189
- ATTR_WHITESPACE: ve,
190
- CUSTOM_ELEMENT: Pt
191
- } = pt;
192
- let {
193
- IS_ALLOWED_URI: ke
194
- } = pt, p = null;
195
- const Ue = l({}, [...ct, ...Ne, ...Ie, ...we, ...ft]);
196
- let T = null;
197
- const Fe = l({}, [...ut, ...Ce, ...mt, ...ce]);
198
- let f = Object.seal(ht(null, {
199
- tagNameCheck: {
200
- writable: !0,
201
- configurable: !1,
202
- enumerable: !0,
203
- value: null
204
- },
205
- attributeNameCheck: {
206
- writable: !0,
207
- configurable: !1,
208
- enumerable: !0,
209
- value: null
210
- },
211
- allowCustomizedBuiltInElements: {
212
- writable: !0,
213
- configurable: !1,
214
- enumerable: !0,
215
- value: !1
216
- }
217
- })), Y = null, he = null, He = !0, ge = !0, ze = !1, We = !0, P = !1, te = !0, M = !1, Ee = !1, _e = !1, v = !1, ne = !1, oe = !1, Ge = !0, Be = !1;
218
- const vt = "user-content-";
219
- let Ae = !0, V = !1, k = {}, U = null;
220
- const Ye = l({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
221
- let Ve = null;
222
- const Xe = l({}, ["audio", "video", "img", "source", "image", "track"]);
223
- let Se = null;
224
- const $e = l({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ie = "http://www.w3.org/1998/Math/MathML", re = "http://www.w3.org/2000/svg", N = "http://www.w3.org/1999/xhtml";
225
- let F = N, be = !1, Re = null;
226
- const kt = l({}, [ie, re, N], De);
227
- let ae = l({}, ["mi", "mo", "mn", "ms", "mtext"]), se = l({}, ["annotation-xml"]);
228
- const Ut = l({}, ["title", "style", "font", "a", "script"]);
229
- let X = null;
230
- const Ft = ["application/xhtml+xml", "text/html"], Ht = "text/html";
231
- let d = null, H = null;
232
- const zt = r.createElement("form"), je = function(e) {
233
- return e instanceof RegExp || e instanceof Function;
234
- }, ye = function() {
235
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
236
- if (!(H && H === e)) {
237
- if ((!e || typeof e != "object") && (e = {}), e = C(e), X = // eslint-disable-next-line unicorn/prefer-includes
238
- Ft.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? Ht : e.PARSER_MEDIA_TYPE, d = X === "application/xhtml+xml" ? De : fe, p = O(e, "ALLOWED_TAGS") ? l({}, e.ALLOWED_TAGS, d) : Ue, T = O(e, "ALLOWED_ATTR") ? l({}, e.ALLOWED_ATTR, d) : Fe, Re = O(e, "ALLOWED_NAMESPACES") ? l({}, e.ALLOWED_NAMESPACES, De) : kt, Se = O(e, "ADD_URI_SAFE_ATTR") ? l(C($e), e.ADD_URI_SAFE_ATTR, d) : $e, Ve = O(e, "ADD_DATA_URI_TAGS") ? l(C(Xe), e.ADD_DATA_URI_TAGS, d) : Xe, U = O(e, "FORBID_CONTENTS") ? l({}, e.FORBID_CONTENTS, d) : Ye, Y = O(e, "FORBID_TAGS") ? l({}, e.FORBID_TAGS, d) : C({}), he = O(e, "FORBID_ATTR") ? l({}, e.FORBID_ATTR, d) : C({}), k = O(e, "USE_PROFILES") ? e.USE_PROFILES : !1, He = e.ALLOW_ARIA_ATTR !== !1, ge = e.ALLOW_DATA_ATTR !== !1, ze = e.ALLOW_UNKNOWN_PROTOCOLS || !1, We = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, P = e.SAFE_FOR_TEMPLATES || !1, te = e.SAFE_FOR_XML !== !1, M = e.WHOLE_DOCUMENT || !1, v = e.RETURN_DOM || !1, ne = e.RETURN_DOM_FRAGMENT || !1, oe = e.RETURN_TRUSTED_TYPE || !1, _e = e.FORCE_BODY || !1, Ge = e.SANITIZE_DOM !== !1, Be = e.SANITIZE_NAMED_PROPS || !1, Ae = e.KEEP_CONTENT !== !1, V = e.IN_PLACE || !1, ke = e.ALLOWED_URI_REGEXP || gt, F = e.NAMESPACE || N, ae = e.MATHML_TEXT_INTEGRATION_POINTS || ae, se = e.HTML_INTEGRATION_POINTS || se, f = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && je(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (f.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && je(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (f.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (f.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), P && (ge = !1), ne && (v = !0), k && (p = l({}, ft), T = [], k.html === !0 && (l(p, ct), l(T, ut)), k.svg === !0 && (l(p, Ne), l(T, Ce), l(T, ce)), k.svgFilters === !0 && (l(p, Ie), l(T, Ce), l(T, ce)), k.mathMl === !0 && (l(p, we), l(T, mt), l(T, ce))), e.ADD_TAGS && (p === Ue && (p = C(p)), l(p, e.ADD_TAGS, d)), e.ADD_ATTR && (T === Fe && (T = C(T)), l(T, e.ADD_ATTR, d)), e.ADD_URI_SAFE_ATTR && l(Se, e.ADD_URI_SAFE_ATTR, d), e.FORBID_CONTENTS && (U === Ye && (U = C(U)), l(U, e.FORBID_CONTENTS, d)), Ae && (p["#text"] = !0), M && l(p, ["html", "head", "body"]), p.table && (l(p, ["tbody"]), delete Y.tbody), e.TRUSTED_TYPES_POLICY) {
239
- if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
240
- throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
241
- if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
242
- throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
243
- E = e.TRUSTED_TYPES_POLICY, B = E.createHTML("");
244
- } else
245
- E === void 0 && (E = un(Q, m)), E !== null && typeof B == "string" && (B = E.createHTML(""));
246
- S && S(e), H = e;
247
- }
248
- }, qe = l({}, [...Ne, ...Ie, ...Qt]), Ke = l({}, [...we, ...en]), Wt = function(e) {
249
- let t = ee(e);
250
- (!t || !t.tagName) && (t = {
251
- namespaceURI: F,
252
- tagName: "template"
253
- });
254
- const i = fe(e.tagName), c = fe(t.tagName);
255
- return Re[e.namespaceURI] ? e.namespaceURI === re ? t.namespaceURI === N ? i === "svg" : t.namespaceURI === ie ? i === "svg" && (c === "annotation-xml" || ae[c]) : !!qe[i] : e.namespaceURI === ie ? t.namespaceURI === N ? i === "math" : t.namespaceURI === re ? i === "math" && se[c] : !!Ke[i] : e.namespaceURI === N ? t.namespaceURI === re && !se[c] || t.namespaceURI === ie && !ae[c] ? !1 : !Ke[i] && (Ut[i] || !qe[i]) : !!(X === "application/xhtml+xml" && Re[e.namespaceURI]) : !1;
256
- }, D = function(e) {
257
- j(n.removed, {
258
- element: e
259
- });
260
- try {
261
- ee(e).removeChild(e);
262
- } catch {
263
- yt(e);
264
- }
265
- }, z = function(e, t) {
266
- try {
267
- j(n.removed, {
268
- attribute: t.getAttributeNode(e),
269
- from: t
270
- });
271
- } catch {
272
- j(n.removed, {
273
- attribute: null,
274
- from: t
275
- });
276
- }
277
- if (t.removeAttribute(e), e === "is")
278
- if (v || ne)
279
- try {
280
- D(t);
281
- } catch {
282
- }
283
- else
284
- try {
285
- t.setAttribute(e, "");
286
- } catch {
287
- }
288
- }, Ze = function(e) {
289
- let t = null, i = null;
290
- if (_e)
291
- e = "<remove></remove>" + e;
292
- else {
293
- const u = lt(e, /^[\r\n\t ]+/);
294
- i = u && u[0];
295
- }
296
- X === "application/xhtml+xml" && F === N && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
297
- const c = E ? E.createHTML(e) : e;
298
- if (F === N)
299
- try {
300
- t = new bt().parseFromString(c, X);
301
- } catch {
302
- }
303
- if (!t || !t.documentElement) {
304
- t = me.createDocument(F, "template", null);
305
- try {
306
- t.documentElement.innerHTML = be ? B : c;
307
- } catch {
308
- }
309
- }
310
- const h = t.body || t.documentElement;
311
- return e && i && h.insertBefore(r.createTextNode(i), h.childNodes[0] || null), F === N ? It.call(t, M ? "html" : "body")[0] : M ? t.documentElement : h;
312
- }, Je = function(e) {
313
- return Dt.call(
314
- e.ownerDocument || e,
315
- e,
316
- // eslint-disable-next-line no-bitwise
317
- W.SHOW_ELEMENT | W.SHOW_COMMENT | W.SHOW_TEXT | W.SHOW_PROCESSING_INSTRUCTION | W.SHOW_CDATA_SECTION,
318
- null
319
- );
320
- }, Le = function(e) {
321
- return e instanceof St && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof At) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
322
- }, Qe = function(e) {
323
- return typeof ue == "function" && e instanceof ue;
324
- };
325
- function I(a, e, t) {
326
- le(a, (i) => {
327
- i.call(n, e, t, H);
328
- });
329
- }
330
- const et = function(e) {
331
- let t = null;
332
- if (I(_.beforeSanitizeElements, e, null), Le(e))
333
- return D(e), !0;
334
- const i = d(e.nodeName);
335
- if (I(_.uponSanitizeElement, e, {
336
- tagName: i,
337
- allowedTags: p
338
- }), te && e.hasChildNodes() && !Qe(e.firstElementChild) && A(/<[/\w!]/g, e.innerHTML) && A(/<[/\w!]/g, e.textContent) || e.nodeType === J.progressingInstruction || te && e.nodeType === J.comment && A(/<[/\w]/g, e.data))
339
- return D(e), !0;
340
- if (!p[i] || Y[i]) {
341
- if (!Y[i] && nt(i) && (f.tagNameCheck instanceof RegExp && A(f.tagNameCheck, i) || f.tagNameCheck instanceof Function && f.tagNameCheck(i)))
342
- return !1;
343
- if (Ae && !U[i]) {
344
- const c = ee(e) || e.parentNode, h = Ot(e) || e.childNodes;
345
- if (h && c) {
346
- const u = h.length;
347
- for (let R = u - 1; R >= 0; --R) {
348
- const w = Rt(h[R], !0);
349
- w.__removalCount = (e.__removalCount || 0) + 1, c.insertBefore(w, Lt(e));
350
- }
351
- }
352
- }
353
- return D(e), !0;
354
- }
355
- return e instanceof Pe && !Wt(e) || (i === "noscript" || i === "noembed" || i === "noframes") && A(/<\/no(script|embed|frames)/i, e.innerHTML) ? (D(e), !0) : (P && e.nodeType === J.text && (t = e.textContent, le([pe, de, Te], (c) => {
356
- t = q(t, c, " ");
357
- }), e.textContent !== t && (j(n.removed, {
358
- element: e.cloneNode()
359
- }), e.textContent = t)), I(_.afterSanitizeElements, e, null), !1);
360
- }, tt = function(e, t, i) {
361
- if (Ge && (t === "id" || t === "name") && (i in r || i in zt))
362
- return !1;
363
- if (!(ge && !he[t] && A(Ct, t))) {
364
- if (!(He && A(Mt, t))) {
365
- if (!T[t] || he[t]) {
366
- if (
367
- // First condition does a very basic check if a) it's basically a valid custom element tagname AND
368
- // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
369
- // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
370
- !(nt(e) && (f.tagNameCheck instanceof RegExp && A(f.tagNameCheck, e) || f.tagNameCheck instanceof Function && f.tagNameCheck(e)) && (f.attributeNameCheck instanceof RegExp && A(f.attributeNameCheck, t) || f.attributeNameCheck instanceof Function && f.attributeNameCheck(t)) || // Alternative, second condition checks if it's an `is`-attribute, AND
371
- // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
372
- t === "is" && f.allowCustomizedBuiltInElements && (f.tagNameCheck instanceof RegExp && A(f.tagNameCheck, i) || f.tagNameCheck instanceof Function && f.tagNameCheck(i)))
373
- ) return !1;
374
- } else if (!Se[t]) {
375
- if (!A(ke, q(i, ve, ""))) {
376
- if (!((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && qt(i, "data:") === 0 && Ve[e])) {
377
- if (!(ze && !A(xt, q(i, ve, "")))) {
378
- if (i)
379
- return !1;
380
- }
381
- }
382
- }
383
- }
384
- }
385
- }
386
- return !0;
387
- }, nt = function(e) {
388
- return e !== "annotation-xml" && lt(e, Pt);
389
- }, ot = function(e) {
390
- I(_.beforeSanitizeAttributes, e, null);
391
- const {
392
- attributes: t
393
- } = e;
394
- if (!t || Le(e))
395
- return;
396
- const i = {
397
- attrName: "",
398
- attrValue: "",
399
- keepAttr: !0,
400
- allowedAttributes: T,
401
- forceKeepAttr: void 0
402
- };
403
- let c = t.length;
404
- for (; c--; ) {
405
- const h = t[c], {
406
- name: u,
407
- namespaceURI: R,
408
- value: w
409
- } = h, $ = d(u), Oe = w;
410
- let g = u === "value" ? Oe : Kt(Oe);
411
- if (i.attrName = $, i.attrValue = g, i.keepAttr = !0, i.forceKeepAttr = void 0, I(_.uponSanitizeAttribute, e, i), g = i.attrValue, Be && ($ === "id" || $ === "name") && (z(u, e), g = vt + g), te && A(/((--!?|])>)|<\/(style|title)/i, g)) {
412
- z(u, e);
413
- continue;
414
- }
415
- if (i.forceKeepAttr)
416
- continue;
417
- if (!i.keepAttr) {
418
- z(u, e);
419
- continue;
420
- }
421
- if (!We && A(/\/>/i, g)) {
422
- z(u, e);
423
- continue;
424
- }
425
- P && le([pe, de, Te], (rt) => {
426
- g = q(g, rt, " ");
427
- });
428
- const it = d(e.nodeName);
429
- if (!tt(it, $, g)) {
430
- z(u, e);
431
- continue;
432
- }
433
- if (E && typeof Q == "object" && typeof Q.getAttributeType == "function" && !R)
434
- switch (Q.getAttributeType(it, $)) {
435
- case "TrustedHTML": {
436
- g = E.createHTML(g);
437
- break;
438
- }
439
- case "TrustedScriptURL": {
440
- g = E.createScriptURL(g);
441
- break;
442
- }
443
- }
444
- if (g !== Oe)
445
- try {
446
- R ? e.setAttributeNS(R, u, g) : e.setAttribute(u, g), Le(e) ? D(e) : st(n.removed);
447
- } catch {
448
- z(u, e);
449
- }
450
- }
451
- I(_.afterSanitizeAttributes, e, null);
452
- }, Gt = function a(e) {
453
- let t = null;
454
- const i = Je(e);
455
- for (I(_.beforeSanitizeShadowDOM, e, null); t = i.nextNode(); )
456
- I(_.uponSanitizeShadowNode, t, null), et(t), ot(t), t.content instanceof L && a(t.content);
457
- I(_.afterSanitizeShadowDOM, e, null);
458
- };
459
- return n.sanitize = function(a) {
460
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = null, i = null, c = null, h = null;
461
- if (be = !a, be && (a = "<!-->"), typeof a != "string" && !Qe(a))
462
- if (typeof a.toString == "function") {
463
- if (a = a.toString(), typeof a != "string")
464
- throw K("dirty is not a string, aborting");
465
- } else
466
- throw K("toString is not a function");
467
- if (!n.isSupported)
468
- return a;
469
- if (Ee || ye(e), n.removed = [], typeof a == "string" && (V = !1), V) {
470
- if (a.nodeName) {
471
- const w = d(a.nodeName);
472
- if (!p[w] || Y[w])
473
- throw K("root node is forbidden and cannot be sanitized in-place");
474
- }
475
- } else if (a instanceof ue)
476
- t = Ze("<!---->"), i = t.ownerDocument.importNode(a, !0), i.nodeType === J.element && i.nodeName === "BODY" || i.nodeName === "HTML" ? t = i : t.appendChild(i);
477
- else {
478
- if (!v && !P && !M && // eslint-disable-next-line unicorn/prefer-includes
479
- a.indexOf("<") === -1)
480
- return E && oe ? E.createHTML(a) : a;
481
- if (t = Ze(a), !t)
482
- return v ? null : oe ? B : "";
483
- }
484
- t && _e && D(t.firstChild);
485
- const u = Je(V ? a : t);
486
- for (; c = u.nextNode(); )
487
- et(c), ot(c), c.content instanceof L && Gt(c.content);
488
- if (V)
489
- return a;
490
- if (v) {
491
- if (ne)
492
- for (h = Nt.call(t.ownerDocument); t.firstChild; )
493
- h.appendChild(t.firstChild);
494
- else
495
- h = t;
496
- return (T.shadowroot || T.shadowrootmode) && (h = wt.call(s, h, !0)), h;
497
- }
498
- let R = M ? t.outerHTML : t.innerHTML;
499
- return M && p["!doctype"] && t.ownerDocument && t.ownerDocument.doctype && t.ownerDocument.doctype.name && A(Et, t.ownerDocument.doctype.name) && (R = "<!DOCTYPE " + t.ownerDocument.doctype.name + `>
500
- ` + R), P && le([pe, de, Te], (w) => {
501
- R = q(R, w, " ");
502
- }), E && oe ? E.createHTML(R) : R;
503
- }, n.setConfig = function() {
504
- let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
505
- ye(a), Ee = !0;
506
- }, n.clearConfig = function() {
507
- H = null, Ee = !1;
508
- }, n.isValidAttribute = function(a, e, t) {
509
- H || ye({});
510
- const i = d(a), c = d(e);
511
- return tt(i, c, t);
512
- }, n.addHook = function(a, e) {
513
- typeof e == "function" && j(_[a], e);
514
- }, n.removeHook = function(a, e) {
515
- if (e !== void 0) {
516
- const t = $t(_[a], e);
517
- return t === -1 ? void 0 : jt(_[a], t, 1)[0];
518
- }
519
- return st(_[a]);
520
- }, n.removeHooks = function(a) {
521
- _[a] = [];
522
- }, n.removeAllHooks = function() {
523
- _ = dt();
524
- }, n;
525
- }
526
- var mn = _t();
527
- const Tn = (o) => {
528
- if (!o) return null;
529
- const n = document.createElement("div");
530
- n.style.color = o, document.body.append(n);
531
- const r = globalThis.getComputedStyle(n).color, s = /rgba?\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*\d+[.d+]*)*\)/g.exec(r);
532
- return n.remove(), s ? `${s[1]}, ${s[2]}, ${s[3]}` : null;
533
- }, hn = (o, n) => {
534
- const r = Bt(o), s = document.createElement("a");
535
- s.href = r, s.download = n ?? "file", s.target = "_blank", document.body.append(s), s.click(), s.remove();
1
+ import l from "dompurify";
2
+ import { blobToUrl as a } from "yummies/media";
3
+ const u = (t) => {
4
+ if (!t) return null;
5
+ const e = document.createElement("div");
6
+ e.style.color = t, document.body.append(e);
7
+ const o = globalThis.getComputedStyle(e).color, n = /rgba?\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*\d+[.d+]*)*\)/g.exec(o);
8
+ return e.remove(), n ? `${n[1]}, ${n[2]}, ${n[3]}` : null;
9
+ }, m = (t, e) => {
10
+ const o = a(t), n = document.createElement("a");
11
+ n.href = o, n.download = e ?? "file", n.target = "_blank", document.body.append(n), n.click(), n.remove();
536
12
  };
537
- function gn(o) {
538
- const n = String(o).replace(/^(https?:\/{0,2})?(w{3}\.)?/, "www.");
539
- return /^https?:\/{2}/.test(o) || (o = `http://${o}`), `<a href=${o} target="_blank">${n}</a>`;
13
+ function h(t) {
14
+ const e = String(t).replace(/^(https?:\/{0,2})?(w{3}\.)?/, "www.");
15
+ return /^https?:\/{2}/.test(t) || (t = `http://${t}`), `<a href=${t} target="_blank">${e}</a>`;
540
16
  }
541
- const En = (o) => {
542
- let n = 0, r = o;
543
- for (; r != null; )
544
- n += r.offsetTop, r = r.parentElement;
545
- return n;
546
- }, _n = (o) => (o.preventDefault(), o.stopPropagation(), !1), An = (o) => {
547
- const n = document.body, r = window.innerHeight, s = o.getBoundingClientRect(), m = n.scrollHeight / r, L = Math.min(
548
- Math.max(s.top / r, 1),
549
- m
17
+ const p = (t) => {
18
+ let e = 0, o = t;
19
+ for (; o != null; )
20
+ e += o.offsetTop, o = o.parentElement;
21
+ return e;
22
+ }, g = (t) => (t.preventDefault(), t.stopPropagation(), !1), f = (t) => {
23
+ const e = document.body, o = window.innerHeight, n = t.getBoundingClientRect(), r = e.scrollHeight / o, s = Math.min(
24
+ Math.max(n.top / o, 1),
25
+ r
550
26
  );
551
27
  window.scroll({
552
- top: L * r,
28
+ top: s * o,
553
29
  behavior: "smooth"
554
30
  });
555
- }, pn = {
31
+ }, i = {
556
32
  ALLOWED_TAGS: [
557
33
  "a",
558
34
  "article",
@@ -597,53 +73,53 @@ const En = (o) => {
597
73
  "ul"
598
74
  ],
599
75
  ALLOWED_ATTR: ["href", "target", "name", "src", "class"]
600
- }, Sn = (o, n) => mn.sanitize(o || "", {
601
- ...pn,
602
- ...n
603
- }), bn = (o, n) => {
604
- let r = o;
605
- if (!n) return !1;
606
- for (; r != null; ) {
607
- if (r === n)
76
+ }, b = (t, e) => l.sanitize(t || "", {
77
+ ...i,
78
+ ...e
79
+ }), w = (t, e) => {
80
+ let o = t;
81
+ if (!e) return !1;
82
+ for (; o != null; ) {
83
+ if (o === e)
608
84
  return !0;
609
- r = r.parentElement;
85
+ o = o.parentElement;
610
86
  }
611
87
  return !1;
612
- }, Rn = (o, n) => {
613
- if (document.startViewTransition && !n?.disabled)
614
- return document.startViewTransition(o);
615
- o();
616
- }, yn = () => {
617
- const o = document.createElement("div");
618
- o.style.visibility = "hidden", o.style.width = "100px", o.style.overflow = "scroll", document.body.append(o);
619
- const n = document.createElement("div");
620
- n.style.width = "100%", o.append(n);
621
- const r = o.offsetWidth - n.offsetWidth;
622
- return o.parentNode?.removeChild(o), r;
88
+ }, T = (t, e) => {
89
+ if (document.startViewTransition && !e?.disabled)
90
+ return document.startViewTransition(t);
91
+ t();
92
+ }, y = () => {
93
+ const t = document.createElement("div");
94
+ t.style.visibility = "hidden", t.style.width = "100px", t.style.overflow = "scroll", document.body.append(t);
95
+ const e = document.createElement("div");
96
+ e.style.width = "100%", t.append(e);
97
+ const o = t.offsetWidth - e.offsetWidth;
98
+ return t.parentNode?.removeChild(t), o;
623
99
  };
624
- function Ln(o) {
625
- const { clientHeight: n } = o, { paddingTop: r, paddingBottom: s } = getComputedStyle(o);
626
- return n - Number.parseFloat(r) - Number.parseFloat(s);
100
+ function v(t) {
101
+ const { clientHeight: e } = t, { paddingTop: o, paddingBottom: n } = getComputedStyle(t);
102
+ return e - Number.parseFloat(o) - Number.parseFloat(n);
627
103
  }
628
- function On(o) {
629
- const { clientWidth: n } = o, { paddingLeft: r, paddingRight: s } = getComputedStyle(o);
630
- return n - Number.parseFloat(r) - Number.parseFloat(s);
104
+ function E(t) {
105
+ const { clientWidth: e } = t, { paddingLeft: o, paddingRight: n } = getComputedStyle(t);
106
+ return e - Number.parseFloat(o) - Number.parseFloat(n);
631
107
  }
632
- const Dn = () => !!globalThis.matchMedia?.("(prefers-color-scheme: dark)")?.matches, Nn = () => !!globalThis.matchMedia?.("(prefers-color-scheme: light)")?.matches;
108
+ const C = () => !!globalThis.matchMedia?.("(prefers-color-scheme: dark)")?.matches, S = () => !!globalThis.matchMedia?.("(prefers-color-scheme: light)")?.matches;
633
109
  export {
634
- yn as calcScrollbarWidth,
635
- bn as checkElementHasParent,
636
- En as collectOffsetTop,
637
- hn as downloadUsingAnchor,
638
- Tn as getComputedColor,
639
- Ln as getElementInnerHeight,
640
- On as getElementInnerWidth,
641
- An as globalScrollIntoViewForY,
642
- Dn as isPrefersDarkTheme,
643
- Nn as isPrefersLightTheme,
644
- Sn as sanitizeHtml,
645
- _n as skipEvent,
646
- Rn as startViewTransitionSafety,
647
- gn as wrapTextToTagLink
110
+ y as calcScrollbarWidth,
111
+ w as checkElementHasParent,
112
+ p as collectOffsetTop,
113
+ m as downloadUsingAnchor,
114
+ u as getComputedColor,
115
+ v as getElementInnerHeight,
116
+ E as getElementInnerWidth,
117
+ f as globalScrollIntoViewForY,
118
+ C as isPrefersDarkTheme,
119
+ S as isPrefersLightTheme,
120
+ b as sanitizeHtml,
121
+ g as skipEvent,
122
+ T as startViewTransitionSafety,
123
+ h as wrapTextToTagLink
648
124
  };
649
125
  //# sourceMappingURL=html.js.map