UNPKG

@watergis/mapbox-gl-export

Version:

This module adds control which can export PDF and images.

769 lines (768 loc) 32.9 kB
//#region ../maplibre-gl-export/dist/purify.es-DNpVkA56.js function e(e, t) { (t == null || t > e.length) && (t = e.length); for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n]; return r; } function t(e) { if (Array.isArray(e)) return e; } function n(e, t) { var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"]; if (n != null) { var r, i, a, o, s = [], c = !0, l = !1; try { if (a = (n = n.call(e)).next, t !== 0) for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0); } catch (e) { l = !0, i = e; } finally { try { if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return; } finally { if (l) throw i; } } return s; } } function r() { throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function i(e, i) { return t(e) || n(e, i) || a(e, i) || r(); } function a(t, n) { if (t) { if (typeof t == "string") return e(t, n); var r = {}.toString.call(t).slice(8, -1); return r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set" ? Array.from(t) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? e(t, n) : void 0; } } var o = Object.entries, s = Object.setPrototypeOf, c = Object.isFrozen, l = Object.getPrototypeOf, u = Object.getOwnPropertyDescriptor, d = Object.freeze, f = Object.seal, ee = Object.create, p = typeof Reflect < "u" && Reflect, m = p.apply, te = p.construct; d ||= function(e) { return e; }, f ||= function(e) { return e; }, m ||= function(e, t) { var n = [...arguments].slice(2); return e.apply(t, n); }, te ||= function(e) { return new e(...[...arguments].slice(1)); }; var h = w(Array.prototype.forEach), ne = w(Array.prototype.lastIndexOf), re = w(Array.prototype.pop), g = w(Array.prototype.push), ie = w(Array.prototype.splice), _ = Array.isArray, ae = w(String.prototype.toLowerCase), oe = w(String.prototype.toString), se = w(String.prototype.match), ce = w(String.prototype.replace), le = w(String.prototype.indexOf), ue = w(String.prototype.trim), de = w(Number.prototype.toString), fe = w(Boolean.prototype.toString), v = typeof BigInt > "u" ? null : w(BigInt.prototype.toString), y = typeof Symbol > "u" ? null : w(Symbol.prototype.toString), b = w(Object.prototype.hasOwnProperty), x = w(Object.prototype.toString), S = w(RegExp.prototype.test), C = T(TypeError); function w(e) { return function(t) { t instanceof RegExp && (t.lastIndex = 0); var n = [...arguments].slice(1); return m(e, t, n); }; } function T(e) { return function() { return te(e, [...arguments]); }; } function E(e, t) { let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ae; if (s && s(e, null), !_(t)) return e; let r = t.length; for (; r--;) { let i = t[r]; if (typeof i == "string") { let e = n(i); e !== i && (c(t) || (t[r] = e), i = e); } e[i] = !0; } return e; } function D(e) { for (let t = 0; t < e.length; t++) b(e, t) || (e[t] = null); return e; } function O(e) { let t = ee(null); for (let r of o(e)) { var n = i(r, 2); let a = n[0], o = n[1]; b(e, a) && (_(o) ? t[a] = D(o) : o && typeof o == "object" && o.constructor === Object ? t[a] = O(o) : t[a] = o); } return t; } function pe(e) { switch (typeof e) { case "string": return e; case "number": return de(e); case "boolean": return fe(e); case "bigint": return v ? v(e) : "0"; case "symbol": return y ? y(e) : "Symbol()"; case "undefined": return x(e); case "function": case "object": { if (e === null) return x(e); let t = e, n = k(t, "toString"); if (typeof n == "function") { let e = n(t); return typeof e == "string" ? e : x(e); } return x(e); } default: return x(e); } } function k(e, t) { for (; e !== null;) { let n = u(e, t); if (n) { if (n.get) return w(n.get); if (typeof n.value == "function") return w(n.value); } e = l(e); } function n() { return null; } return n; } function me(e) { try { return S(e, ""), !0; } catch { return !1; } } var he = d(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr".split(".")), ge = d(/* @__PURE__ */ "svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern".split(".")), _e = d([ "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" ]), ve = d([ "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" ]), ye = d(/* @__PURE__ */ "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".split(".")), be = d([ "maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none" ]), xe = d(["#text"]), Se = d(/* @__PURE__ */ "accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns".split(".")), Ce = d(/* @__PURE__ */ "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.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.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".split(".")), we = d(/* @__PURE__ */ "accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns".split(".")), Te = d([ "xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink" ]), Ee = f(/{{[\w\W]*|^[\w\W]*}}/g), De = f(/<%[\w\W]*|^[\w\W]*%>/g), Oe = f(/\${[\w\W]*/g), ke = f(/^data-[\-\w.\u00B7-\uFFFF]+$/), Ae = f(/^aria-[\-\w]+$/), je = f(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), Me = f(/^(?:\w+script|data):/i), Ne = f(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), Pe = f(/^html$/i), Fe = f(/^[a-z][.\w]*(-[.\w]+)+$/i), Ie = f(/<[/\w!]/g), Le = f(/<[/\w]/g), Re = f(/<\/no(script|embed|frames)/i), ze = f(/\/>/i), A = { element: 1, attribute: 2, text: 3, cdataSection: 4, entityReference: 5, entityNode: 6, processingInstruction: 7, comment: 8, document: 9, documentType: 10, documentFragment: 11, notation: 12 }, Be = function() { return typeof window > "u" ? null : window; }, Ve = function(e, t) { if (typeof e != "object" || typeof e.createPolicy != "function") return null; let n = null, r = "data-tt-policy-suffix"; t && t.hasAttribute(r) && (n = t.getAttribute(r)); let i = "dompurify" + (n ? "#" + n : ""); try { return e.createPolicy(i, { createHTML(e) { return e; }, createScriptURL(e) { return e; } }); } catch { return console.warn("TrustedTypes policy " + i + " could not be created."), null; } }, He = function() { return { afterSanitizeAttributes: [], afterSanitizeElements: [], afterSanitizeShadowDOM: [], beforeSanitizeAttributes: [], beforeSanitizeElements: [], beforeSanitizeShadowDOM: [], uponSanitizeAttribute: [], uponSanitizeElement: [], uponSanitizeShadowNode: [] }; }, j = function(e, t, n, r) { return b(e, t) && _(e[t]) ? E(r.base ? O(r.base) : {}, e[t], r.transform) : n; }; function Ue() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Be(), t = (e) => Ue(e); if (t.version = "3.4.12", t.removed = [], !e || !e.document || e.document.nodeType !== A.document || !e.Element) return t.isSupported = !1, t; let n = e.document, r = n, i = r.currentScript; e.DocumentFragment; let a = e.HTMLTemplateElement, s = e.Node, c = e.Element, l = e.NodeFilter; e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement; let u = e.DOMParser, p = e.trustedTypes, m = c.prototype, te = k(m, "cloneNode"), de = k(m, "remove"), fe = k(m, "nextSibling"), v = k(m, "childNodes"), y = k(m, "parentNode"), x = k(m, "shadowRoot"), w = k(m, "attributes"), T = s && s.prototype ? k(s.prototype, "nodeType") : null, D = s && s.prototype ? k(s.prototype, "nodeName") : null; if (typeof a == "function") { let e = n.createElement("template"); e.content && e.content.ownerDocument && (n = e.content.ownerDocument); } let M, N = "", We, Ge = !1, Ke = 0, qe = function() { if (Ke > 0) throw C("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."); }, P = function(e) { qe(), Ke++; try { return M.createHTML(e); } finally { Ke--; } }, Je = function(e) { qe(), Ke++; try { return M.createScriptURL(e); } finally { Ke--; } }, Ye = function() { return Ge ||= (We = Ve(p, i), !0), We; }, Xe = n, Ze = Xe.implementation, Qe = Xe.createNodeIterator, $e = Xe.createDocumentFragment, et = Xe.getElementsByTagName, tt = r.importNode, F = He(); t.isSupported = typeof o == "function" && typeof y == "function" && Ze && Ze.createHTMLDocument !== void 0; let nt = Ee, rt = De, it = Oe, at = ke, ot = Ae, st = Me, ct = Ne, lt = Fe, ut = je, I = null, dt = E({}, [ ...he, ...ge, ..._e, ...ye, ...xe ]), L = null, ft = E({}, [ ...Se, ...Ce, ...we, ...Te ]), R = Object.seal(ee(null, { tagNameCheck: { writable: !0, configurable: !1, enumerable: !0, value: null }, attributeNameCheck: { writable: !0, configurable: !1, enumerable: !0, value: null }, allowCustomizedBuiltInElements: { writable: !0, configurable: !1, enumerable: !0, value: !1 } })), pt = null, mt = null, z = Object.seal(ee(null, { tagCheck: { writable: !0, configurable: !1, enumerable: !0, value: null }, attributeCheck: { writable: !0, configurable: !1, enumerable: !0, value: null } })), ht = !0, gt = !0, _t = !1, vt = !0, B = !1, V = !0, H = !1, yt = !1, bt = null, xt = null, St = !1, U = !1, Ct = !1, wt = !1, Tt = !0, Et = !1, Dt = "user-content-", Ot = !0, kt = !1, W = {}, G = null, At = E({}, /* @__PURE__ */ "annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp".split(".")), jt = null, Mt = E({}, [ "audio", "video", "img", "source", "image", "track" ]), Nt = null, Pt = E({}, [ "alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns" ]), Ft = "http://www.w3.org/1998/Math/MathML", It = "http://www.w3.org/2000/svg", K = "http://www.w3.org/1999/xhtml", q = K, Lt = !1, Rt = null, zt = E({}, [ Ft, It, K ], oe), Bt = d([ "mi", "mo", "mn", "ms", "mtext" ]), Vt = E({}, Bt), Ht = d(["annotation-xml"]), Ut = E({}, Ht), Wt = E({}, [ "title", "style", "font", "a", "script" ]), Gt = null, Kt = ["application/xhtml+xml", "text/html"], J = null, Y = null, qt = n.createElement("form"), Jt = function(e) { return e instanceof RegExp || e instanceof Function; }, Yt = function() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; if (Y && Y === e) return; (!e || typeof e != "object") && (e = {}), e = O(e), Gt = Kt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, J = Gt === "application/xhtml+xml" ? oe : ae, I = j(e, "ALLOWED_TAGS", dt, { transform: J }), L = j(e, "ALLOWED_ATTR", ft, { transform: J }), Rt = j(e, "ALLOWED_NAMESPACES", zt, { transform: oe }), Nt = j(e, "ADD_URI_SAFE_ATTR", Pt, { transform: J, base: Pt }), jt = j(e, "ADD_DATA_URI_TAGS", Mt, { transform: J, base: Mt }), G = j(e, "FORBID_CONTENTS", At, { transform: J }), pt = j(e, "FORBID_TAGS", O({}), { transform: J }), mt = j(e, "FORBID_ATTR", O({}), { transform: J }), W = b(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? O(e.USE_PROFILES) : e.USE_PROFILES : !1, ht = e.ALLOW_ARIA_ATTR !== !1, gt = e.ALLOW_DATA_ATTR !== !1, _t = e.ALLOW_UNKNOWN_PROTOCOLS || !1, vt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, B = e.SAFE_FOR_TEMPLATES || !1, V = e.SAFE_FOR_XML !== !1, H = e.WHOLE_DOCUMENT || !1, U = e.RETURN_DOM || !1, Ct = e.RETURN_DOM_FRAGMENT || !1, wt = e.RETURN_TRUSTED_TYPE || !1, St = e.FORCE_BODY || !1, Tt = e.SANITIZE_DOM !== !1, Et = e.SANITIZE_NAMED_PROPS || !1, Ot = e.KEEP_CONTENT !== !1, kt = e.IN_PLACE || !1, ut = me(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : je, q = typeof e.NAMESPACE == "string" ? e.NAMESPACE : K, Vt = b(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? O(e.MATHML_TEXT_INTEGRATION_POINTS) : E({}, Bt), Ut = b(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? O(e.HTML_INTEGRATION_POINTS) : E({}, Ht); let t = b(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? O(e.CUSTOM_ELEMENT_HANDLING) : ee(null); if (R = ee(null), b(t, "tagNameCheck") && Jt(t.tagNameCheck) && (R.tagNameCheck = t.tagNameCheck), b(t, "attributeNameCheck") && Jt(t.attributeNameCheck) && (R.attributeNameCheck = t.attributeNameCheck), b(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (R.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), f(R), B && (gt = !1), Ct && (U = !0), W && (I = E({}, xe), L = ee(null), W.html === !0 && (E(I, he), E(L, Se)), W.svg === !0 && (E(I, ge), E(L, Ce), E(L, Te)), W.svgFilters === !0 && (E(I, _e), E(L, Ce), E(L, Te)), W.mathMl === !0 && (E(I, ye), E(L, we), E(L, Te))), z.tagCheck = null, z.attributeCheck = null, b(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? z.tagCheck = e.ADD_TAGS : _(e.ADD_TAGS) && (I === dt && (I = O(I)), E(I, e.ADD_TAGS, J))), b(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? z.attributeCheck = e.ADD_ATTR : _(e.ADD_ATTR) && (L === ft && (L = O(L)), E(L, e.ADD_ATTR, J))), b(e, "ADD_URI_SAFE_ATTR") && _(e.ADD_URI_SAFE_ATTR) && E(Nt, e.ADD_URI_SAFE_ATTR, J), b(e, "FORBID_CONTENTS") && _(e.FORBID_CONTENTS) && (G === At && (G = O(G)), E(G, e.FORBID_CONTENTS, J)), b(e, "ADD_FORBID_CONTENTS") && _(e.ADD_FORBID_CONTENTS) && (G === At && (G = O(G)), E(G, e.ADD_FORBID_CONTENTS, J)), Ot && (I["#text"] = !0), H && E(I, [ "html", "head", "body" ]), I.table && (E(I, ["tbody"]), delete pt.tbody), e.TRUSTED_TYPES_POLICY) { if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw C("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook."); if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw C("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook."); let t = M; M = e.TRUSTED_TYPES_POLICY; try { N = P(""); } catch (e) { throw M = t, e; } } else e.TRUSTED_TYPES_POLICY === null ? (M = void 0, N = "") : (M === void 0 && (M = Ye()), M && typeof N == "string" && (N = P(""))); d && d(e), Y = e; }, Xt = E({}, [ ...ge, ..._e, ...ve ]), Zt = E({}, [...ye, ...be]), Qt = function(e, t, n) { return t.namespaceURI === K ? e === "svg" : t.namespaceURI === Ft ? e === "svg" && (n === "annotation-xml" || Vt[n]) : !!Xt[e]; }, $t = function(e, t, n) { return t.namespaceURI === K ? e === "math" : t.namespaceURI === It ? e === "math" && Ut[n] : !!Zt[e]; }, en = function(e, t, n) { return t.namespaceURI === It && !Ut[n] || t.namespaceURI === Ft && !Vt[n] ? !1 : !Zt[e] && (Wt[e] || !Xt[e]); }, tn = function(e) { let t = y(e); (!t || !t.tagName) && (t = { namespaceURI: q, tagName: "template" }); let n = ae(e.tagName), r = ae(t.tagName); return Rt[e.namespaceURI] ? e.namespaceURI === It ? Qt(n, t, r) : e.namespaceURI === Ft ? $t(n, t, r) : e.namespaceURI === K ? en(n, t, r) : !!(Gt === "application/xhtml+xml" && Rt[e.namespaceURI]) : !1; }, X = function(e) { g(t.removed, { element: e }); try { y(e).removeChild(e); } catch { if (de(e), !y(e)) throw C("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place"); } }, nn = function(e) { an(e); let t = v(e); if (t) { let e = []; h(t, (t) => { g(e, t); }), h(e, (e) => { try { de(e); } catch {} }); } let n = w(e); if (n) for (let t = n.length - 1; t >= 0; --t) { let r = n[t], i = r && r.name; if (typeof i == "string") try { e.removeAttribute(i); } catch {} } }, Z = function(e, n) { try { g(t.removed, { attribute: n.getAttributeNode(e), from: n }); } catch { g(t.removed, { attribute: null, from: n }); } if (n.removeAttribute(e), e === "is") if (U || Ct) try { X(n); } catch {} else try { n.setAttribute(e, ""); } catch {} }, rn = function(e) { let t = w(e); if (t) for (let n = t.length - 1; n >= 0; --n) { let r = t[n], i = r && r.name; if (!(typeof i != "string" || L[J(i)])) try { e.removeAttribute(i); } catch {} } }, an = function(e) { let t = [e]; for (; t.length > 0;) { let e = t.pop(); (T ? T(e) : e.nodeType) === A.element && rn(e); let n = v(e); if (n) for (let e = n.length - 1; e >= 0; --e) t.push(n[e]); } }, on = function(e) { if (!V) return; let t = [e]; for (; t.length > 0;) { let e = t.pop(), n = T ? T(e) : e.nodeType; if (n === A.processingInstruction || n === A.comment && S(Le, e.data)) { try { de(e); } catch {} continue; } if (n === A.element) { let t = e, n = J(D ? D(e) : e.nodeName); try { t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && n !== "label" && n !== "output" && t.removeAttribute("for"); } catch {} } let r = v(e); if (r) for (let e = r.length - 1; e >= 0; --e) t.push(r[e]); } }, sn = function(e) { let t = null, r = null; if (St) e = "<remove></remove>" + e; else { let t = se(e, /^[\r\n\t ]+/); r = t && t[0]; } Gt === "application/xhtml+xml" && q === K && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>"); let i = M ? P(e) : e; if (q === K) try { t = new u().parseFromString(i, Gt); } catch {} if (!t || !t.documentElement) { t = Ze.createDocument(q, "template", null); try { t.documentElement.innerHTML = Lt ? N : i; } catch {} } let a = t.body || t.documentElement; return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), q === K ? et.call(t, H ? "html" : "body")[0] : H ? t.documentElement : a; }, cn = function(e) { return Qe.call(e.ownerDocument || e, e, l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION, null); }, ln = function(e) { return e = ce(e, nt, " "), e = ce(e, rt, " "), e = ce(e, it, " "), e; }, un = function(e) { e.normalize(); let t = Qe.call(e.ownerDocument || e, e, l.SHOW_TEXT | l.SHOW_COMMENT | l.SHOW_CDATA_SECTION | l.SHOW_PROCESSING_INSTRUCTION, null), n = t.nextNode(); for (; n;) n.data = ln(n.data), n = t.nextNode(); let r = e.querySelectorAll?.call(e, "template"); r && h(r, (e) => { Q(e.content) && un(e.content); }); }, dn = function(e) { let t = D ? D(e) : null; return typeof t != "string" || J(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== w(e) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== T(e) || e.childNodes !== v(e); }, Q = function(e) { if (!T || typeof e != "object" || !e) return !1; try { return T(e) === A.documentFragment; } catch { return !1; } }, fn = function(e) { if (!T || typeof e != "object" || !e) return !1; try { return typeof T(e) == "number"; } catch { return !1; } }; function $(e, n, r) { e.length !== 0 && h(e, (e) => { e.call(t, n, r, Y); }); } let pn = function(e, t) { return !!(V && e.hasChildNodes() && !fn(e.firstElementChild) && S(Ie, e.textContent) && S(Ie, e.innerHTML) || V && e.namespaceURI === K && t === "style" && fn(e.firstElementChild) || e.nodeType === A.processingInstruction || V && e.nodeType === A.comment && S(Le, e.data)); }, mn = function(e, t) { if (!pt[t] && vn(t) && (R.tagNameCheck instanceof RegExp && S(R.tagNameCheck, t) || R.tagNameCheck instanceof Function && R.tagNameCheck(t))) return !1; if (Ot && !G[t]) { let t = y(e), n = v(e); if (n && t) { let r = n.length; for (let i = r - 1; i >= 0; --i) { let r = kt ? n[i] : te(n[i], !0); t.insertBefore(r, fe(e)); } } } return X(e), !0; }, hn = function(e, n) { if ($(F.beforeSanitizeElements, e, null), e !== n && y(e) === null) return !0; if (dn(e)) return X(e), !0; let r = J(D ? D(e) : e.nodeName); if ($(F.uponSanitizeElement, e, { tagName: r, allowedTags: I }), e !== n && y(e) === null) return !0; if (pn(e, r)) return X(e), !0; if (pt[r] || !(z.tagCheck instanceof Function && z.tagCheck(r)) && !I[r]) { let t = mn(e, r); return t === !1 && $(F.afterSanitizeElements, e, null), t; } if ((T ? T(e) : e.nodeType) === A.element && !tn(e) || (r === "noscript" || r === "noembed" || r === "noframes") && S(Re, e.innerHTML)) return X(e), !0; if (B && e.nodeType === A.text) { let n = ln(e.textContent); e.textContent !== n && (g(t.removed, { element: e.cloneNode() }), e.textContent = n); } return $(F.afterSanitizeElements, e, null), !1; }, gn = function(e, t, r) { if (mt[t] || V && t === "patchsrc" || V && t === "for" && e !== "label" && e !== "output" || Tt && (t === "id" || t === "name") && (r in n || r in qt)) return !1; let i = L[t] || z.attributeCheck instanceof Function && z.attributeCheck(t, e); if (!(gt && S(at, t)) && !(ht && S(ot, t))) { if (!i) { if (!(vn(e) && (R.tagNameCheck instanceof RegExp && S(R.tagNameCheck, e) || R.tagNameCheck instanceof Function && R.tagNameCheck(e)) && (R.attributeNameCheck instanceof RegExp && S(R.attributeNameCheck, t) || R.attributeNameCheck instanceof Function && R.attributeNameCheck(t, e)) || t === "is" && R.allowCustomizedBuiltInElements && (R.tagNameCheck instanceof RegExp && S(R.tagNameCheck, r) || R.tagNameCheck instanceof Function && R.tagNameCheck(r)))) return !1; } else if (!Nt[t] && !S(ut, ce(r, ct, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && le(r, "data:") === 0 && jt[e]) && !(_t && !S(st, ce(r, ct, ""))) && r) return !1; } return !0; }, _n = E({}, [ "annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph" ]), vn = function(e) { return !_n[ae(e)] && S(lt, e); }, yn = function(e, t, n, r) { if (M && typeof p == "object" && typeof p.getAttributeType == "function" && !n) switch (p.getAttributeType(e, t)) { case "TrustedHTML": return P(r); case "TrustedScriptURL": return Je(r); } return r; }, bn = function(e, n, r, i) { try { r ? e.setAttributeNS(r, n, i) : e.setAttribute(n, i), dn(e) ? X(e) : re(t.removed); } catch { Z(n, e); } }, xn = function(e) { $(F.beforeSanitizeAttributes, e, null); let t = e.attributes; if (!t || dn(e)) return; let n = { attrName: "", attrValue: "", keepAttr: !0, allowedAttributes: L, forceKeepAttr: void 0 }, r = t.length, i = J(e.nodeName); for (; r--;) { let a = t[r], o = a.name, s = a.namespaceURI, c = a.value, l = J(o), u = c, d = o === "value" ? u : ue(u); if (n.attrName = l, n.attrValue = d, n.keepAttr = !0, n.forceKeepAttr = void 0, $(F.uponSanitizeAttribute, e, n), d = n.attrValue, Et && (l === "id" || l === "name") && le(d, Dt) !== 0 && (Z(o, e), d = Dt + d), V && S(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, d)) { Z(o, e); continue; } if (l === "attributename" && se(d, "href")) { Z(o, e); continue; } if (!n.forceKeepAttr) { if (!n.keepAttr) { Z(o, e); continue; } if (!vt && S(ze, d)) { Z(o, e); continue; } if (B && (d = ln(d)), !gn(i, l, d)) { Z(o, e); continue; } d = yn(i, l, s, d), d !== u && bn(e, o, s, d); } } $(F.afterSanitizeAttributes, e, null); }, Sn = function(e) { let t = null, n = cn(e); for ($(F.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if ($(F.uponSanitizeShadowNode, t, null), hn(t, e), xn(t), Q(t.content) && Sn(t.content), (T ? T(t) : t.nodeType) === A.element) { let e = x(t); Q(e) && (Cn(e), Sn(e)); } $(F.afterSanitizeShadowDOM, e, null); }, Cn = function(e) { let t = [{ node: e, shadow: null }]; for (; t.length > 0;) { let e = t.pop(); if (e.shadow) { Sn(e.shadow); continue; } let n = e.node, r = (T ? T(n) : n.nodeType) === A.element, i = v(n); if (i) for (let e = i.length - 1; e >= 0; --e) t.push({ node: i[e], shadow: null }); if (r) { let e = D ? D(n) : null; if (typeof e == "string" && J(e) === "template") { let e = n.content; Q(e) && t.push({ node: e, shadow: null }); } } if (r) { let e = x(n); Q(e) && t.push({ node: null, shadow: e }, { node: e, shadow: null }); } } }; return t.sanitize = function(e) { let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, a = null, o = null, s = null; if (Lt = !e, Lt && (e = "<!-->"), typeof e != "string" && !fn(e) && (e = pe(e), typeof e != "string")) throw C("dirty is not a string, aborting"); if (!t.isSupported) return e; yt ? (I = bt, L = xt) : Yt(n), (F.uponSanitizeElement.length > 0 || F.uponSanitizeAttribute.length > 0) && (I = O(I)), F.uponSanitizeAttribute.length > 0 && (L = O(L)), t.removed = []; let c = kt && typeof e != "string" && fn(e); if (c) { on(e); let t = D ? D(e) : e.nodeName; if (typeof t == "string") { let n = J(t); if (!I[n] || pt[n]) throw nn(e), C("root node is forbidden and cannot be sanitized in-place"); } if (dn(e)) throw nn(e), C("root node is clobbered and cannot be sanitized in-place"); try { Cn(e); } catch (t) { throw nn(e), t; } } else if (fn(e)) i = sn("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === A.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), Cn(a); else { if (!U && !B && !H && e.indexOf("<") === -1) return M && wt ? P(e) : e; if (i = sn(e), !i) return U ? null : wt ? N : ""; } i && St && X(i.firstChild); let l = c ? e : i, u = cn(l); try { for (; o = u.nextNode();) hn(o, l), xn(o), Q(o.content) && Sn(o.content); } catch (n) { throw c && (nn(e), h(t.removed, (e) => { e.element && an(e.element); })), n; } if (c) return h(t.removed, (e) => { e.element && an(e.element); }), B && un(e), e; if (U) { if (B && un(i), Ct) for (s = $e.call(i.ownerDocument); i.firstChild;) s.appendChild(i.firstChild); else s = i; return (L.shadowroot || L.shadowrootmode) && (s = tt.call(r, s, !0)), s; } let d = H ? i.outerHTML : i.innerHTML; return H && I["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && S(Pe, i.ownerDocument.doctype.name) && (d = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + d), B && (d = ln(d)), M && wt ? P(d) : d; }, t.setConfig = function() { let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; Yt(e), yt = !0, bt = I, xt = L; }, t.clearConfig = function() { Y = null, yt = !1, bt = null, xt = null, M = We, N = ""; }, t.isValidAttribute = function(e, t, n) { Y || Yt({}); let r = J(e), i = J(t); return gn(r, i, n); }, t.addHook = function(e, t) { typeof t == "function" && b(F, e) && g(F[e], t); }, t.removeHook = function(e, t) { if (b(F, e)) { if (t !== void 0) { let n = ne(F[e], t); return n === -1 ? void 0 : ie(F[e], n, 1)[0]; } return re(F[e]); } }, t.removeHooks = function(e) { b(F, e) && (F[e] = []); }, t.removeAllHooks = function() { F = He(); }, t; } var M = Ue(); //#endregion export { M as default }; //# sourceMappingURL=purify.es-DNpVkA56-Cn89V7cb.js.map