PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / assets / js / chunks / text-path.js

text-path.js in Elementor Website Builder – more than just a page builder 4.3.0-beta3, at assets/js/chunks/text-path.js

1,873 lines 57.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function() {
2
3 //#region \0rolldown/runtime.js
4 var __create = Object.create;
5 var __defProp = Object.defineProperty;
6 var __name = (target, value) => __defProp(target, "name", {
7 value,
8 configurable: true
9 });
10 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11 var __getOwnPropNames = Object.getOwnPropertyNames;
12 var __getProtoOf = Object.getPrototypeOf;
13 var __hasOwnProp = Object.prototype.hasOwnProperty;
14 var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
15 var __copyProps = (to, from, except, desc) => {
16 if (from && typeof from === "object" || typeof from === "function") {
17 for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
18 key = keys[i];
19 if (!__hasOwnProp.call(to, key) && key !== except) {
20 __defProp(to, key, {
21 get: ((k) => from[k]).bind(null, key),
22 enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23 });
24 }
25 }
26 }
27 return to;
28 };
29 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30 value: mod,
31 enumerable: true
32 }) : target, mod));
33
34 //#endregion
35
36 //#region node_modules/@babel/runtime/helpers/interopRequireDefault.js
37 var require_interopRequireDefault = /* @__PURE__ */ __commonJSMin(((exports, module) => {
38 function _interopRequireDefault(e) {
39 return e && e.__esModule ? e : { "default": e };
40 }
41 module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
42 }));
43
44 //#endregion
45 //#region assets/dev/js/frontend/utils/utils.js
46 var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
47 Object.defineProperty(exports, "__esModule", { value: true });
48 exports.isScrollSnapActive = exports.escapeHTML = void 0;
49 var escapeHTML = (str) => {
50 const specialChars = {
51 "&": "&amp;",
52 "<": "&lt;",
53 ">": "&gt;",
54 "'": "&#39;",
55 "\"": "&quot;"
56 };
57 return str.replace(/[&<>'"]/g, (tag) => specialChars[tag] || tag);
58 };
59 exports.escapeHTML = escapeHTML;
60 var isScrollSnapActive = () => {
61 var _elementor$settings$p;
62 var _elementorFrontend$co;
63 return "yes" === (elementorFrontend.isEditMode() ? (_elementor$settings$p = elementor.settings.page.model.attributes) === null || _elementor$settings$p === void 0 ? void 0 : _elementor$settings$p.scroll_snap : (_elementorFrontend$co = elementorFrontend.config.settings.page) === null || _elementorFrontend$co === void 0 ? void 0 : _elementorFrontend$co.scroll_snap) ? true : false;
64 };
65 exports.isScrollSnapActive = isScrollSnapActive;
66 }));
67
68 //#endregion
69 //#region node_modules/dompurify/dist/purify.cjs.js
70 /*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
71 var require_purify_cjs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
72 var { entries, setPrototypeOf, isFrozen, getPrototypeOf, getOwnPropertyDescriptor } = Object;
73 var { freeze, seal, create } = Object;
74 var { apply, construct } = typeof Reflect !== "undefined" && Reflect;
75 if (!freeze) freeze = function freeze(x) {
76 return x;
77 };
78 if (!seal) seal = function seal(x) {
79 return x;
80 };
81 if (!apply) apply = function apply(func, thisArg) {
82 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
83 return func.apply(thisArg, args);
84 };
85 if (!construct) construct = function construct(Func) {
86 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
87 return new Func(...args);
88 };
89 var arrayForEach = unapply(Array.prototype.forEach);
90 var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
91 var arrayPop = unapply(Array.prototype.pop);
92 var arrayPush = unapply(Array.prototype.push);
93 var arraySplice = unapply(Array.prototype.splice);
94 var stringToLowerCase = unapply(String.prototype.toLowerCase);
95 var stringToString = unapply(String.prototype.toString);
96 var stringMatch = unapply(String.prototype.match);
97 var stringReplace = unapply(String.prototype.replace);
98 var stringIndexOf = unapply(String.prototype.indexOf);
99 var stringTrim = unapply(String.prototype.trim);
100 var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
101 var regExpTest = unapply(RegExp.prototype.test);
102 var typeErrorCreate = unconstruct(TypeError);
103 /**
104 * Creates a new function that calls the given function with a specified thisArg and arguments.
105 *
106 * @param func - The function to be wrapped and called.
107 * @returns A new function that calls the given function with a specified thisArg and arguments.
108 */
109 function unapply(func) {
110 return function(thisArg) {
111 if (thisArg instanceof RegExp) thisArg.lastIndex = 0;
112 for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) args[_key3 - 1] = arguments[_key3];
113 return apply(func, thisArg, args);
114 };
115 }
116 /**
117 * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
118 *
119 * @param func - The constructor function to be wrapped and called.
120 * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
121 */
122 function unconstruct(Func) {
123 return function() {
124 for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) args[_key4] = arguments[_key4];
125 return construct(Func, args);
126 };
127 }
128 /**
129 * Add properties to a lookup table
130 *
131 * @param set - The set to which elements will be added.
132 * @param array - The array containing elements to be added to the set.
133 * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
134 * @returns The modified set with added elements.
135 */
136 function addToSet(set, array) {
137 let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
138 if (setPrototypeOf) setPrototypeOf(set, null);
139 let l = array.length;
140 while (l--) {
141 let element = array[l];
142 if (typeof element === "string") {
143 const lcElement = transformCaseFunc(element);
144 if (lcElement !== element) {
145 if (!isFrozen(array)) array[l] = lcElement;
146 element = lcElement;
147 }
148 }
149 set[element] = true;
150 }
151 return set;
152 }
153 /**
154 * Clean up an array to harden against CSPP
155 *
156 * @param array - The array to be cleaned.
157 * @returns The cleaned version of the array
158 */
159 function cleanArray(array) {
160 for (let index = 0; index < array.length; index++) if (!objectHasOwnProperty(array, index)) array[index] = null;
161 return array;
162 }
163 /**
164 * Shallow clone an object
165 *
166 * @param object - The object to be cloned.
167 * @returns A new object that copies the original.
168 */
169 function clone(object) {
170 const newObject = create(null);
171 for (const [property, value] of entries(object)) if (objectHasOwnProperty(object, property)) if (Array.isArray(value)) newObject[property] = cleanArray(value);
172 else if (value && typeof value === "object" && value.constructor === Object) newObject[property] = clone(value);
173 else newObject[property] = value;
174 return newObject;
175 }
176 /**
177 * This method automatically checks if the prop is function or getter and behaves accordingly.
178 *
179 * @param object - The object to look up the getter function in its prototype chain.
180 * @param prop - The property name for which to find the getter function.
181 * @returns The getter function found in the prototype chain or a fallback function.
182 */
183 function lookupGetter(object, prop) {
184 while (object !== null) {
185 const desc = getOwnPropertyDescriptor(object, prop);
186 if (desc) {
187 if (desc.get) return unapply(desc.get);
188 if (typeof desc.value === "function") return unapply(desc.value);
189 }
190 object = getPrototypeOf(object);
191 }
192 function fallbackValue() {
193 return null;
194 }
195 return fallbackValue;
196 }
197 var html$1 = freeze([
198 "a",
199 "abbr",
200 "acronym",
201 "address",
202 "area",
203 "article",
204 "aside",
205 "audio",
206 "b",
207 "bdi",
208 "bdo",
209 "big",
210 "blink",
211 "blockquote",
212 "body",
213 "br",
214 "button",
215 "canvas",
216 "caption",
217 "center",
218 "cite",
219 "code",
220 "col",
221 "colgroup",
222 "content",
223 "data",
224 "datalist",
225 "dd",
226 "decorator",
227 "del",
228 "details",
229 "dfn",
230 "dialog",
231 "dir",
232 "div",
233 "dl",
234 "dt",
235 "element",
236 "em",
237 "fieldset",
238 "figcaption",
239 "figure",
240 "font",
241 "footer",
242 "form",
243 "h1",
244 "h2",
245 "h3",
246 "h4",
247 "h5",
248 "h6",
249 "head",
250 "header",
251 "hgroup",
252 "hr",
253 "html",
254 "i",
255 "img",
256 "input",
257 "ins",
258 "kbd",
259 "label",
260 "legend",
261 "li",
262 "main",
263 "map",
264 "mark",
265 "marquee",
266 "menu",
267 "menuitem",
268 "meter",
269 "nav",
270 "nobr",
271 "ol",
272 "optgroup",
273 "option",
274 "output",
275 "p",
276 "picture",
277 "pre",
278 "progress",
279 "q",
280 "rp",
281 "rt",
282 "ruby",
283 "s",
284 "samp",
285 "search",
286 "section",
287 "select",
288 "shadow",
289 "slot",
290 "small",
291 "source",
292 "spacer",
293 "span",
294 "strike",
295 "strong",
296 "style",
297 "sub",
298 "summary",
299 "sup",
300 "table",
301 "tbody",
302 "td",
303 "template",
304 "textarea",
305 "tfoot",
306 "th",
307 "thead",
308 "time",
309 "tr",
310 "track",
311 "tt",
312 "u",
313 "ul",
314 "var",
315 "video",
316 "wbr"
317 ]);
318 var svg$1 = freeze([
319 "svg",
320 "a",
321 "altglyph",
322 "altglyphdef",
323 "altglyphitem",
324 "animatecolor",
325 "animatemotion",
326 "animatetransform",
327 "circle",
328 "clippath",
329 "defs",
330 "desc",
331 "ellipse",
332 "enterkeyhint",
333 "exportparts",
334 "filter",
335 "font",
336 "g",
337 "glyph",
338 "glyphref",
339 "hkern",
340 "image",
341 "inputmode",
342 "line",
343 "lineargradient",
344 "marker",
345 "mask",
346 "metadata",
347 "mpath",
348 "part",
349 "path",
350 "pattern",
351 "polygon",
352 "polyline",
353 "radialgradient",
354 "rect",
355 "stop",
356 "style",
357 "switch",
358 "symbol",
359 "text",
360 "textpath",
361 "title",
362 "tref",
363 "tspan",
364 "view",
365 "vkern"
366 ]);
367 var svgFilters = freeze([
368 "feBlend",
369 "feColorMatrix",
370 "feComponentTransfer",
371 "feComposite",
372 "feConvolveMatrix",
373 "feDiffuseLighting",
374 "feDisplacementMap",
375 "feDistantLight",
376 "feDropShadow",
377 "feFlood",
378 "feFuncA",
379 "feFuncB",
380 "feFuncG",
381 "feFuncR",
382 "feGaussianBlur",
383 "feImage",
384 "feMerge",
385 "feMergeNode",
386 "feMorphology",
387 "feOffset",
388 "fePointLight",
389 "feSpecularLighting",
390 "feSpotLight",
391 "feTile",
392 "feTurbulence"
393 ]);
394 var svgDisallowed = freeze([
395 "animate",
396 "color-profile",
397 "cursor",
398 "discard",
399 "font-face",
400 "font-face-format",
401 "font-face-name",
402 "font-face-src",
403 "font-face-uri",
404 "foreignobject",
405 "hatch",
406 "hatchpath",
407 "mesh",
408 "meshgradient",
409 "meshpatch",
410 "meshrow",
411 "missing-glyph",
412 "script",
413 "set",
414 "solidcolor",
415 "unknown",
416 "use"
417 ]);
418 var mathMl$1 = freeze([
419 "math",
420 "menclose",
421 "merror",
422 "mfenced",
423 "mfrac",
424 "mglyph",
425 "mi",
426 "mlabeledtr",
427 "mmultiscripts",
428 "mn",
429 "mo",
430 "mover",
431 "mpadded",
432 "mphantom",
433 "mroot",
434 "mrow",
435 "ms",
436 "mspace",
437 "msqrt",
438 "mstyle",
439 "msub",
440 "msup",
441 "msubsup",
442 "mtable",
443 "mtd",
444 "mtext",
445 "mtr",
446 "munder",
447 "munderover",
448 "mprescripts"
449 ]);
450 var mathMlDisallowed = freeze([
451 "maction",
452 "maligngroup",
453 "malignmark",
454 "mlongdiv",
455 "mscarries",
456 "mscarry",
457 "msgroup",
458 "mstack",
459 "msline",
460 "msrow",
461 "semantics",
462 "annotation",
463 "annotation-xml",
464 "mprescripts",
465 "none"
466 ]);
467 var text = freeze(["#text"]);
468 var html = freeze([
469 "accept",
470 "action",
471 "align",
472 "alt",
473 "autocapitalize",
474 "autocomplete",
475 "autopictureinpicture",
476 "autoplay",
477 "background",
478 "bgcolor",
479 "border",
480 "capture",
481 "cellpadding",
482 "cellspacing",
483 "checked",
484 "cite",
485 "class",
486 "clear",
487 "color",
488 "cols",
489 "colspan",
490 "controls",
491 "controlslist",
492 "coords",
493 "crossorigin",
494 "datetime",
495 "decoding",
496 "default",
497 "dir",
498 "disabled",
499 "disablepictureinpicture",
500 "disableremoteplayback",
501 "download",
502 "draggable",
503 "enctype",
504 "enterkeyhint",
505 "exportparts",
506 "face",
507 "for",
508 "headers",
509 "height",
510 "hidden",
511 "high",
512 "href",
513 "hreflang",
514 "id",
515 "inert",
516 "inputmode",
517 "integrity",
518 "ismap",
519 "kind",
520 "label",
521 "lang",
522 "list",
523 "loading",
524 "loop",
525 "low",
526 "max",
527 "maxlength",
528 "media",
529 "method",
530 "min",
531 "minlength",
532 "multiple",
533 "muted",
534 "name",
535 "nonce",
536 "noshade",
537 "novalidate",
538 "nowrap",
539 "open",
540 "optimum",
541 "part",
542 "pattern",
543 "placeholder",
544 "playsinline",
545 "popover",
546 "popovertarget",
547 "popovertargetaction",
548 "poster",
549 "preload",
550 "pubdate",
551 "radiogroup",
552 "readonly",
553 "rel",
554 "required",
555 "rev",
556 "reversed",
557 "role",
558 "rows",
559 "rowspan",
560 "spellcheck",
561 "scope",
562 "selected",
563 "shape",
564 "size",
565 "sizes",
566 "slot",
567 "span",
568 "srclang",
569 "start",
570 "src",
571 "srcset",
572 "step",
573 "style",
574 "summary",
575 "tabindex",
576 "title",
577 "translate",
578 "type",
579 "usemap",
580 "valign",
581 "value",
582 "width",
583 "wrap",
584 "xmlns",
585 "slot"
586 ]);
587 var svg = freeze([
588 "accent-height",
589 "accumulate",
590 "additive",
591 "alignment-baseline",
592 "amplitude",
593 "ascent",
594 "attributename",
595 "attributetype",
596 "azimuth",
597 "basefrequency",
598 "baseline-shift",
599 "begin",
600 "bias",
601 "by",
602 "class",
603 "clip",
604 "clippathunits",
605 "clip-path",
606 "clip-rule",
607 "color",
608 "color-interpolation",
609 "color-interpolation-filters",
610 "color-profile",
611 "color-rendering",
612 "cx",
613 "cy",
614 "d",
615 "dx",
616 "dy",
617 "diffuseconstant",
618 "direction",
619 "display",
620 "divisor",
621 "dur",
622 "edgemode",
623 "elevation",
624 "end",
625 "exponent",
626 "fill",
627 "fill-opacity",
628 "fill-rule",
629 "filter",
630 "filterunits",
631 "flood-color",
632 "flood-opacity",
633 "font-family",
634 "font-size",
635 "font-size-adjust",
636 "font-stretch",
637 "font-style",
638 "font-variant",
639 "font-weight",
640 "fx",
641 "fy",
642 "g1",
643 "g2",
644 "glyph-name",
645 "glyphref",
646 "gradientunits",
647 "gradienttransform",
648 "height",
649 "href",
650 "id",
651 "image-rendering",
652 "in",
653 "in2",
654 "intercept",
655 "k",
656 "k1",
657 "k2",
658 "k3",
659 "k4",
660 "kerning",
661 "keypoints",
662 "keysplines",
663 "keytimes",
664 "lang",
665 "lengthadjust",
666 "letter-spacing",
667 "kernelmatrix",
668 "kernelunitlength",
669 "lighting-color",
670 "local",
671 "marker-end",
672 "marker-mid",
673 "marker-start",
674 "markerheight",
675 "markerunits",
676 "markerwidth",
677 "maskcontentunits",
678 "maskunits",
679 "max",
680 "mask",
681 "mask-type",
682 "media",
683 "method",
684 "mode",
685 "min",
686 "name",
687 "numoctaves",
688 "offset",
689 "operator",
690 "opacity",
691 "order",
692 "orient",
693 "orientation",
694 "origin",
695 "overflow",
696 "paint-order",
697 "path",
698 "pathlength",
699 "patterncontentunits",
700 "patterntransform",
701 "patternunits",
702 "points",
703 "preservealpha",
704 "preserveaspectratio",
705 "primitiveunits",
706 "r",
707 "rx",
708 "ry",
709 "radius",
710 "refx",
711 "refy",
712 "repeatcount",
713 "repeatdur",
714 "restart",
715 "result",
716 "rotate",
717 "scale",
718 "seed",
719 "shape-rendering",
720 "slope",
721 "specularconstant",
722 "specularexponent",
723 "spreadmethod",
724 "startoffset",
725 "stddeviation",
726 "stitchtiles",
727 "stop-color",
728 "stop-opacity",
729 "stroke-dasharray",
730 "stroke-dashoffset",
731 "stroke-linecap",
732 "stroke-linejoin",
733 "stroke-miterlimit",
734 "stroke-opacity",
735 "stroke",
736 "stroke-width",
737 "style",
738 "surfacescale",
739 "systemlanguage",
740 "tabindex",
741 "tablevalues",
742 "targetx",
743 "targety",
744 "transform",
745 "transform-origin",
746 "text-anchor",
747 "text-decoration",
748 "text-rendering",
749 "textlength",
750 "type",
751 "u1",
752 "u2",
753 "unicode",
754 "values",
755 "viewbox",
756 "visibility",
757 "version",
758 "vert-adv-y",
759 "vert-origin-x",
760 "vert-origin-y",
761 "width",
762 "word-spacing",
763 "wrap",
764 "writing-mode",
765 "xchannelselector",
766 "ychannelselector",
767 "x",
768 "x1",
769 "x2",
770 "xmlns",
771 "y",
772 "y1",
773 "y2",
774 "z",
775 "zoomandpan"
776 ]);
777 var mathMl = freeze([
778 "accent",
779 "accentunder",
780 "align",
781 "bevelled",
782 "close",
783 "columnsalign",
784 "columnlines",
785 "columnspan",
786 "denomalign",
787 "depth",
788 "dir",
789 "display",
790 "displaystyle",
791 "encoding",
792 "fence",
793 "frame",
794 "height",
795 "href",
796 "id",
797 "largeop",
798 "length",
799 "linethickness",
800 "lspace",
801 "lquote",
802 "mathbackground",
803 "mathcolor",
804 "mathsize",
805 "mathvariant",
806 "maxsize",
807 "minsize",
808 "movablelimits",
809 "notation",
810 "numalign",
811 "open",
812 "rowalign",
813 "rowlines",
814 "rowspacing",
815 "rowspan",
816 "rspace",
817 "rquote",
818 "scriptlevel",
819 "scriptminsize",
820 "scriptsizemultiplier",
821 "selection",
822 "separator",
823 "separators",
824 "stretchy",
825 "subscriptshift",
826 "supscriptshift",
827 "symmetric",
828 "voffset",
829 "width",
830 "xmlns"
831 ]);
832 var xml = freeze([
833 "xlink:href",
834 "xml:id",
835 "xlink:title",
836 "xml:space",
837 "xmlns:xlink"
838 ]);
839 var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
840 var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
841 var TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm);
842 var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
843 var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
844 var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
845 var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
846 var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);
847 var DOCTYPE_NAME = seal(/^html$/i);
848 var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
849 var EXPRESSIONS = /*#__PURE__*/ Object.freeze({
850 __proto__: null,
851 ARIA_ATTR,
852 ATTR_WHITESPACE,
853 CUSTOM_ELEMENT,
854 DATA_ATTR,
855 DOCTYPE_NAME,
856 ERB_EXPR,
857 IS_ALLOWED_URI,
858 IS_SCRIPT_OR_DATA,
859 MUSTACHE_EXPR,
860 TMPLIT_EXPR
861 });
862 var NODE_TYPE = {
863 element: 1,
864 attribute: 2,
865 text: 3,
866 cdataSection: 4,
867 entityReference: 5,
868 entityNode: 6,
869 progressingInstruction: 7,
870 comment: 8,
871 document: 9,
872 documentType: 10,
873 documentFragment: 11,
874 notation: 12
875 };
876 var getGlobal = function getGlobal() {
877 return typeof window === "undefined" ? null : window;
878 };
879 /**
880 * Creates a no-op policy for internal use only.
881 * Don't export this function outside this module!
882 * @param trustedTypes The policy factory.
883 * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
884 * @return The policy created (or null, if Trusted Types
885 * are not supported or creating the policy failed).
886 */
887 var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
888 if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") return null;
889 let suffix = null;
890 const ATTR_NAME = "data-tt-policy-suffix";
891 if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) suffix = purifyHostElement.getAttribute(ATTR_NAME);
892 const policyName = "dompurify" + (suffix ? "#" + suffix : "");
893 try {
894 return trustedTypes.createPolicy(policyName, {
895 createHTML(html) {
896 return html;
897 },
898 createScriptURL(scriptUrl) {
899 return scriptUrl;
900 }
901 });
902 } catch (_) {
903 console.warn("TrustedTypes policy " + policyName + " could not be created.");
904 return null;
905 }
906 };
907 var _createHooksMap = function _createHooksMap() {
908 return {
909 afterSanitizeAttributes: [],
910 afterSanitizeElements: [],
911 afterSanitizeShadowDOM: [],
912 beforeSanitizeAttributes: [],
913 beforeSanitizeElements: [],
914 beforeSanitizeShadowDOM: [],
915 uponSanitizeAttribute: [],
916 uponSanitizeElement: [],
917 uponSanitizeShadowNode: []
918 };
919 };
920 function createDOMPurify() {
921 let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
922 const DOMPurify = (root) => createDOMPurify(root);
923 DOMPurify.version = "3.3.0";
924 DOMPurify.removed = [];
925 if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
926 DOMPurify.isSupported = false;
927 return DOMPurify;
928 }
929 let { document } = window;
930 const originalDocument = document;
931 const currentScript = originalDocument.currentScript;
932 const { DocumentFragment, HTMLTemplateElement, Node, Element, NodeFilter, NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap, HTMLFormElement, DOMParser, trustedTypes } = window;
933 const ElementPrototype = Element.prototype;
934 const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
935 const remove = lookupGetter(ElementPrototype, "remove");
936 const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
937 const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
938 const getParentNode = lookupGetter(ElementPrototype, "parentNode");
939 if (typeof HTMLTemplateElement === "function") {
940 const template = document.createElement("template");
941 if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
942 }
943 let trustedTypesPolicy;
944 let emptyHTML = "";
945 const { implementation, createNodeIterator, createDocumentFragment, getElementsByTagName } = document;
946 const { importNode } = originalDocument;
947 let hooks = _createHooksMap();
948 /**
949 * Expose whether this browser supports running the full DOMPurify.
950 */
951 DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
952 const { MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR, DATA_ATTR, ARIA_ATTR, IS_SCRIPT_OR_DATA, ATTR_WHITESPACE, CUSTOM_ELEMENT } = EXPRESSIONS;
953 let { IS_ALLOWED_URI: IS_ALLOWED_URI$1 } = EXPRESSIONS;
954 /**
955 * We consider the elements and attributes below to be safe. Ideally
956 * don't add any new ones but feel free to remove unwanted ones.
957 */
958 let ALLOWED_TAGS = null;
959 const DEFAULT_ALLOWED_TAGS = addToSet({}, [
960 ...html$1,
961 ...svg$1,
962 ...svgFilters,
963 ...mathMl$1,
964 ...text
965 ]);
966 let ALLOWED_ATTR = null;
967 const DEFAULT_ALLOWED_ATTR = addToSet({}, [
968 ...html,
969 ...svg,
970 ...mathMl,
971 ...xml
972 ]);
973 let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
974 tagNameCheck: {
975 writable: true,
976 configurable: false,
977 enumerable: true,
978 value: null
979 },
980 attributeNameCheck: {
981 writable: true,
982 configurable: false,
983 enumerable: true,
984 value: null
985 },
986 allowCustomizedBuiltInElements: {
987 writable: true,
988 configurable: false,
989 enumerable: true,
990 value: false
991 }
992 }));
993 let FORBID_TAGS = null;
994 let FORBID_ATTR = null;
995 const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
996 tagCheck: {
997 writable: true,
998 configurable: false,
999 enumerable: true,
1000 value: null
1001 },
1002 attributeCheck: {
1003 writable: true,
1004 configurable: false,
1005 enumerable: true,
1006 value: null
1007 }
1008 }));
1009 let ALLOW_ARIA_ATTR = true;
1010 let ALLOW_DATA_ATTR = true;
1011 let ALLOW_UNKNOWN_PROTOCOLS = false;
1012 let ALLOW_SELF_CLOSE_IN_ATTR = true;
1013 let SAFE_FOR_TEMPLATES = false;
1014 let SAFE_FOR_XML = true;
1015 let WHOLE_DOCUMENT = false;
1016 let SET_CONFIG = false;
1017 let FORCE_BODY = false;
1018 let RETURN_DOM = false;
1019 let RETURN_DOM_FRAGMENT = false;
1020 let RETURN_TRUSTED_TYPE = false;
1021 let SANITIZE_DOM = true;
1022 let SANITIZE_NAMED_PROPS = false;
1023 const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
1024 let KEEP_CONTENT = true;
1025 let IN_PLACE = false;
1026 let USE_PROFILES = {};
1027 let FORBID_CONTENTS = null;
1028 const DEFAULT_FORBID_CONTENTS = addToSet({}, [
1029 "annotation-xml",
1030 "audio",
1031 "colgroup",
1032 "desc",
1033 "foreignobject",
1034 "head",
1035 "iframe",
1036 "math",
1037 "mi",
1038 "mn",
1039 "mo",
1040 "ms",
1041 "mtext",
1042 "noembed",
1043 "noframes",
1044 "noscript",
1045 "plaintext",
1046 "script",
1047 "style",
1048 "svg",
1049 "template",
1050 "thead",
1051 "title",
1052 "video",
1053 "xmp"
1054 ]);
1055 let DATA_URI_TAGS = null;
1056 const DEFAULT_DATA_URI_TAGS = addToSet({}, [
1057 "audio",
1058 "video",
1059 "img",
1060 "source",
1061 "image",
1062 "track"
1063 ]);
1064 let URI_SAFE_ATTRIBUTES = null;
1065 const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
1066 "alt",
1067 "class",
1068 "for",
1069 "id",
1070 "label",
1071 "name",
1072 "pattern",
1073 "placeholder",
1074 "role",
1075 "summary",
1076 "title",
1077 "value",
1078 "style",
1079 "xmlns"
1080 ]);
1081 const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
1082 const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
1083 const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
1084 let NAMESPACE = HTML_NAMESPACE;
1085 let IS_EMPTY_INPUT = false;
1086 let ALLOWED_NAMESPACES = null;
1087 const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [
1088 MATHML_NAMESPACE,
1089 SVG_NAMESPACE,
1090 HTML_NAMESPACE
1091 ], stringToString);
1092 let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, [
1093 "mi",
1094 "mo",
1095 "mn",
1096 "ms",
1097 "mtext"
1098 ]);
1099 let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
1100 const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
1101 "title",
1102 "style",
1103 "font",
1104 "a",
1105 "script"
1106 ]);
1107 let PARSER_MEDIA_TYPE = null;
1108 const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
1109 const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
1110 let transformCaseFunc = null;
1111 let CONFIG = null;
1112 const formElement = document.createElement("form");
1113 const isRegexOrFunction = function isRegexOrFunction(testValue) {
1114 return testValue instanceof RegExp || testValue instanceof Function;
1115 };
1116 /**
1117 * _parseConfig
1118 *
1119 * @param cfg optional config literal
1120 */
1121 const _parseConfig = function _parseConfig() {
1122 let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1123 if (CONFIG && CONFIG === cfg) return;
1124 if (!cfg || typeof cfg !== "object") cfg = {};
1125 cfg = clone(cfg);
1126 PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
1127 transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
1128 ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
1129 ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
1130 ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
1131 URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
1132 DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
1133 FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
1134 FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
1135 FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
1136 USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false;
1137 ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
1138 ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
1139 ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
1140 ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
1141 SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
1142 SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
1143 WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
1144 RETURN_DOM = cfg.RETURN_DOM || false;
1145 RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
1146 RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
1147 FORCE_BODY = cfg.FORCE_BODY || false;
1148 SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
1149 SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
1150 KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
1151 IN_PLACE = cfg.IN_PLACE || false;
1152 IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
1153 NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
1154 MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
1155 HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
1156 CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
1157 if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
1158 if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
1159 if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
1160 if (SAFE_FOR_TEMPLATES) ALLOW_DATA_ATTR = false;
1161 if (RETURN_DOM_FRAGMENT) RETURN_DOM = true;
1162 if (USE_PROFILES) {
1163 ALLOWED_TAGS = addToSet({}, text);
1164 ALLOWED_ATTR = [];
1165 if (USE_PROFILES.html === true) {
1166 addToSet(ALLOWED_TAGS, html$1);
1167 addToSet(ALLOWED_ATTR, html);
1168 }
1169 if (USE_PROFILES.svg === true) {
1170 addToSet(ALLOWED_TAGS, svg$1);
1171 addToSet(ALLOWED_ATTR, svg);
1172 addToSet(ALLOWED_ATTR, xml);
1173 }
1174 if (USE_PROFILES.svgFilters === true) {
1175 addToSet(ALLOWED_TAGS, svgFilters);
1176 addToSet(ALLOWED_ATTR, svg);
1177 addToSet(ALLOWED_ATTR, xml);
1178 }
1179 if (USE_PROFILES.mathMl === true) {
1180 addToSet(ALLOWED_TAGS, mathMl$1);
1181 addToSet(ALLOWED_ATTR, mathMl);
1182 addToSet(ALLOWED_ATTR, xml);
1183 }
1184 }
1185 if (cfg.ADD_TAGS) if (typeof cfg.ADD_TAGS === "function") EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
1186 else {
1187 if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS = clone(ALLOWED_TAGS);
1188 addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
1189 }
1190 if (cfg.ADD_ATTR) if (typeof cfg.ADD_ATTR === "function") EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
1191 else {
1192 if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR = clone(ALLOWED_ATTR);
1193 addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
1194 }
1195 if (cfg.ADD_URI_SAFE_ATTR) addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
1196 if (cfg.FORBID_CONTENTS) {
1197 if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
1198 addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
1199 }
1200 if (KEEP_CONTENT) ALLOWED_TAGS["#text"] = true;
1201 if (WHOLE_DOCUMENT) addToSet(ALLOWED_TAGS, [
1202 "html",
1203 "head",
1204 "body"
1205 ]);
1206 if (ALLOWED_TAGS.table) {
1207 addToSet(ALLOWED_TAGS, ["tbody"]);
1208 delete FORBID_TAGS.tbody;
1209 }
1210 if (cfg.TRUSTED_TYPES_POLICY) {
1211 if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
1212 if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
1213 trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
1214 emptyHTML = trustedTypesPolicy.createHTML("");
1215 } else {
1216 if (trustedTypesPolicy === void 0) trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
1217 if (trustedTypesPolicy !== null && typeof emptyHTML === "string") emptyHTML = trustedTypesPolicy.createHTML("");
1218 }
1219 if (freeze) freeze(cfg);
1220 CONFIG = cfg;
1221 };
1222 const ALL_SVG_TAGS = addToSet({}, [
1223 ...svg$1,
1224 ...svgFilters,
1225 ...svgDisallowed
1226 ]);
1227 const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
1228 /**
1229 * @param element a DOM element whose namespace is being checked
1230 * @returns Return false if the element has a
1231 * namespace that a spec-compliant parser would never
1232 * return. Return true otherwise.
1233 */
1234 const _checkValidNamespace = function _checkValidNamespace(element) {
1235 let parent = getParentNode(element);
1236 if (!parent || !parent.tagName) parent = {
1237 namespaceURI: NAMESPACE,
1238 tagName: "template"
1239 };
1240 const tagName = stringToLowerCase(element.tagName);
1241 const parentTagName = stringToLowerCase(parent.tagName);
1242 if (!ALLOWED_NAMESPACES[element.namespaceURI]) return false;
1243 if (element.namespaceURI === SVG_NAMESPACE) {
1244 if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg";
1245 if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
1246 return Boolean(ALL_SVG_TAGS[tagName]);
1247 }
1248 if (element.namespaceURI === MATHML_NAMESPACE) {
1249 if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math";
1250 if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
1251 return Boolean(ALL_MATHML_TAGS[tagName]);
1252 }
1253 if (element.namespaceURI === HTML_NAMESPACE) {
1254 if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false;
1255 if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false;
1256 return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
1257 }
1258 if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) return true;
1259 return false;
1260 };
1261 /**
1262 * _forceRemove
1263 *
1264 * @param node a DOM node
1265 */
1266 const _forceRemove = function _forceRemove(node) {
1267 arrayPush(DOMPurify.removed, { element: node });
1268 try {
1269 getParentNode(node).removeChild(node);
1270 } catch (_) {
1271 remove(node);
1272 }
1273 };
1274 /**
1275 * _removeAttribute
1276 *
1277 * @param name an Attribute name
1278 * @param element a DOM node
1279 */
1280 const _removeAttribute = function _removeAttribute(name, element) {
1281 try {
1282 arrayPush(DOMPurify.removed, {
1283 attribute: element.getAttributeNode(name),
1284 from: element
1285 });
1286 } catch (_) {
1287 arrayPush(DOMPurify.removed, {
1288 attribute: null,
1289 from: element
1290 });
1291 }
1292 element.removeAttribute(name);
1293 if (name === "is") if (RETURN_DOM || RETURN_DOM_FRAGMENT) try {
1294 _forceRemove(element);
1295 } catch (_) {}
1296 else try {
1297 element.setAttribute(name, "");
1298 } catch (_) {}
1299 };
1300 /**
1301 * _initDocument
1302 *
1303 * @param dirty - a string of dirty markup
1304 * @return a DOM, filled with the dirty markup
1305 */
1306 const _initDocument = function _initDocument(dirty) {
1307 let doc = null;
1308 let leadingWhitespace = null;
1309 if (FORCE_BODY) dirty = "<remove></remove>" + dirty;
1310 else {
1311 const matches = stringMatch(dirty, /^[\r\n\t ]+/);
1312 leadingWhitespace = matches && matches[0];
1313 }
1314 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>";
1315 const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
1316 if (NAMESPACE === HTML_NAMESPACE) try {
1317 doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
1318 } catch (_) {}
1319 if (!doc || !doc.documentElement) {
1320 doc = implementation.createDocument(NAMESPACE, "template", null);
1321 try {
1322 doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
1323 } catch (_) {}
1324 }
1325 const body = doc.body || doc.documentElement;
1326 if (dirty && leadingWhitespace) body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
1327 if (NAMESPACE === HTML_NAMESPACE) return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
1328 return WHOLE_DOCUMENT ? doc.documentElement : body;
1329 };
1330 /**
1331 * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
1332 *
1333 * @param root The root element or node to start traversing on.
1334 * @return The created NodeIterator
1335 */
1336 const _createNodeIterator = function _createNodeIterator(root) {
1337 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);
1338 };
1339 /**
1340 * _isClobbered
1341 *
1342 * @param element element to check for clobbering attacks
1343 * @return true if clobbered, false if safe
1344 */
1345 const _isClobbered = function _isClobbered(element) {
1346 return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
1347 };
1348 /**
1349 * Checks whether the given object is a DOM node.
1350 *
1351 * @param value object to check whether it's a DOM node
1352 * @return true is object is a DOM node
1353 */
1354 const _isNode = function _isNode(value) {
1355 return typeof Node === "function" && value instanceof Node;
1356 };
1357 function _executeHooks(hooks, currentNode, data) {
1358 arrayForEach(hooks, (hook) => {
1359 hook.call(DOMPurify, currentNode, data, CONFIG);
1360 });
1361 }
1362 /**
1363 * _sanitizeElements
1364 *
1365 * @protect nodeName
1366 * @protect textContent
1367 * @protect removeChild
1368 * @param currentNode to check for permission to exist
1369 * @return true if node was killed, false if left alive
1370 */
1371 const _sanitizeElements = function _sanitizeElements(currentNode) {
1372 let content = null;
1373 _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
1374 if (_isClobbered(currentNode)) {
1375 _forceRemove(currentNode);
1376 return true;
1377 }
1378 const tagName = transformCaseFunc(currentNode.nodeName);
1379 _executeHooks(hooks.uponSanitizeElement, currentNode, {
1380 tagName,
1381 allowedTags: ALLOWED_TAGS
1382 });
1383 if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
1384 _forceRemove(currentNode);
1385 return true;
1386 }
1387 if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
1388 _forceRemove(currentNode);
1389 return true;
1390 }
1391 if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
1392 _forceRemove(currentNode);
1393 return true;
1394 }
1395 if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
1396 if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
1397 if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
1398 if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
1399 }
1400 if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1401 const parentNode = getParentNode(currentNode) || currentNode.parentNode;
1402 const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
1403 if (childNodes && parentNode) {
1404 const childCount = childNodes.length;
1405 for (let i = childCount - 1; i >= 0; --i) {
1406 const childClone = cloneNode(childNodes[i], true);
1407 childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
1408 parentNode.insertBefore(childClone, getNextSibling(currentNode));
1409 }
1410 }
1411 }
1412 _forceRemove(currentNode);
1413 return true;
1414 }
1415 if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1416 _forceRemove(currentNode);
1417 return true;
1418 }
1419 if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
1420 _forceRemove(currentNode);
1421 return true;
1422 }
1423 if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
1424 content = currentNode.textContent;
1425 arrayForEach([
1426 MUSTACHE_EXPR,
1427 ERB_EXPR,
1428 TMPLIT_EXPR
1429 ], (expr) => {
1430 content = stringReplace(content, expr, " ");
1431 });
1432 if (currentNode.textContent !== content) {
1433 arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
1434 currentNode.textContent = content;
1435 }
1436 }
1437 _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1438 return false;
1439 };
1440 /**
1441 * _isValidAttribute
1442 *
1443 * @param lcTag Lowercase tag name of containing element.
1444 * @param lcName Lowercase attribute name.
1445 * @param value Attribute value.
1446 * @return Returns true if `value` is valid, otherwise false.
1447 */
1448 const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1449 if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) return false;
1450 if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName));
1451 else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName));
1452 else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag));
1453 else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) 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)));
1454 else return false;
1455 else if (URI_SAFE_ATTRIBUTES[lcName]);
1456 else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, "")));
1457 else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]);
1458 else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, "")));
1459 else if (value) return false;
1460 return true;
1461 };
1462 /**
1463 * _isBasicCustomElement
1464 * checks if at least one dash is included in tagName, and it's not the first char
1465 * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1466 *
1467 * @param tagName name of the tag of the node to sanitize
1468 * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
1469 */
1470 const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
1471 return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT);
1472 };
1473 /**
1474 * _sanitizeAttributes
1475 *
1476 * @protect attributes
1477 * @protect nodeName
1478 * @protect removeAttribute
1479 * @protect setAttribute
1480 *
1481 * @param currentNode to sanitize
1482 */
1483 const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1484 _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
1485 const { attributes } = currentNode;
1486 if (!attributes || _isClobbered(currentNode)) return;
1487 const hookEvent = {
1488 attrName: "",
1489 attrValue: "",
1490 keepAttr: true,
1491 allowedAttributes: ALLOWED_ATTR,
1492 forceKeepAttr: void 0
1493 };
1494 let l = attributes.length;
1495 while (l--) {
1496 const { name, namespaceURI, value: attrValue } = attributes[l];
1497 const lcName = transformCaseFunc(name);
1498 const initValue = attrValue;
1499 let value = name === "value" ? initValue : stringTrim(initValue);
1500 hookEvent.attrName = lcName;
1501 hookEvent.attrValue = value;
1502 hookEvent.keepAttr = true;
1503 hookEvent.forceKeepAttr = void 0;
1504 _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
1505 value = hookEvent.attrValue;
1506 if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
1507 _removeAttribute(name, currentNode);
1508 value = SANITIZE_NAMED_PROPS_PREFIX + value;
1509 }
1510 if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) {
1511 _removeAttribute(name, currentNode);
1512 continue;
1513 }
1514 if (lcName === "attributename" && stringMatch(value, "href")) {
1515 _removeAttribute(name, currentNode);
1516 continue;
1517 }
1518 if (hookEvent.forceKeepAttr) continue;
1519 if (!hookEvent.keepAttr) {
1520 _removeAttribute(name, currentNode);
1521 continue;
1522 }
1523 if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
1524 _removeAttribute(name, currentNode);
1525 continue;
1526 }
1527 if (SAFE_FOR_TEMPLATES) arrayForEach([
1528 MUSTACHE_EXPR,
1529 ERB_EXPR,
1530 TMPLIT_EXPR
1531 ], (expr) => {
1532 value = stringReplace(value, expr, " ");
1533 });
1534 const lcTag = transformCaseFunc(currentNode.nodeName);
1535 if (!_isValidAttribute(lcTag, lcName, value)) {
1536 _removeAttribute(name, currentNode);
1537 continue;
1538 }
1539 if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") if (namespaceURI);
1540 else switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1541 case "TrustedHTML":
1542 value = trustedTypesPolicy.createHTML(value);
1543 break;
1544 case "TrustedScriptURL":
1545 value = trustedTypesPolicy.createScriptURL(value);
1546 break;
1547 }
1548 if (value !== initValue) try {
1549 if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
1550 else currentNode.setAttribute(name, value);
1551 if (_isClobbered(currentNode)) _forceRemove(currentNode);
1552 else arrayPop(DOMPurify.removed);
1553 } catch (_) {
1554 _removeAttribute(name, currentNode);
1555 }
1556 }
1557 _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
1558 };
1559 /**
1560 * _sanitizeShadowDOM
1561 *
1562 * @param fragment to iterate over recursively
1563 */
1564 const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
1565 let shadowNode = null;
1566 const shadowIterator = _createNodeIterator(fragment);
1567 _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
1568 while (shadowNode = shadowIterator.nextNode()) {
1569 _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
1570 _sanitizeElements(shadowNode);
1571 _sanitizeAttributes(shadowNode);
1572 if (shadowNode.content instanceof DocumentFragment) _sanitizeShadowDOM(shadowNode.content);
1573 }
1574 _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
1575 };
1576 DOMPurify.sanitize = function(dirty) {
1577 let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1578 let body = null;
1579 let importedNode = null;
1580 let currentNode = null;
1581 let returnNode = null;
1582 IS_EMPTY_INPUT = !dirty;
1583 if (IS_EMPTY_INPUT) dirty = "<!-->";
1584 if (typeof dirty !== "string" && !_isNode(dirty)) if (typeof dirty.toString === "function") {
1585 dirty = dirty.toString();
1586 if (typeof dirty !== "string") throw typeErrorCreate("dirty is not a string, aborting");
1587 } else throw typeErrorCreate("toString is not a function");
1588 if (!DOMPurify.isSupported) return dirty;
1589 if (!SET_CONFIG) _parseConfig(cfg);
1590 DOMPurify.removed = [];
1591 if (typeof dirty === "string") IN_PLACE = false;
1592 if (IN_PLACE) {
1593 if (dirty.nodeName) {
1594 const tagName = transformCaseFunc(dirty.nodeName);
1595 if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
1596 }
1597 } else if (dirty instanceof Node) {
1598 body = _initDocument("<!---->");
1599 importedNode = body.ownerDocument.importNode(dirty, true);
1600 if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode;
1601 else if (importedNode.nodeName === "HTML") body = importedNode;
1602 else body.appendChild(importedNode);
1603 } else {
1604 if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1605 body = _initDocument(dirty);
1606 if (!body) return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
1607 }
1608 if (body && FORCE_BODY) _forceRemove(body.firstChild);
1609 const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
1610 while (currentNode = nodeIterator.nextNode()) {
1611 _sanitizeElements(currentNode);
1612 _sanitizeAttributes(currentNode);
1613 if (currentNode.content instanceof DocumentFragment) _sanitizeShadowDOM(currentNode.content);
1614 }
1615 if (IN_PLACE) return dirty;
1616 if (RETURN_DOM) {
1617 if (RETURN_DOM_FRAGMENT) {
1618 returnNode = createDocumentFragment.call(body.ownerDocument);
1619 while (body.firstChild) returnNode.appendChild(body.firstChild);
1620 } else returnNode = body;
1621 if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) returnNode = importNode.call(originalDocument, returnNode, true);
1622 return returnNode;
1623 }
1624 let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1625 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;
1626 if (SAFE_FOR_TEMPLATES) arrayForEach([
1627 MUSTACHE_EXPR,
1628 ERB_EXPR,
1629 TMPLIT_EXPR
1630 ], (expr) => {
1631 serializedHTML = stringReplace(serializedHTML, expr, " ");
1632 });
1633 return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1634 };
1635 DOMPurify.setConfig = function() {
1636 let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1637 _parseConfig(cfg);
1638 SET_CONFIG = true;
1639 };
1640 DOMPurify.clearConfig = function() {
1641 CONFIG = null;
1642 SET_CONFIG = false;
1643 };
1644 DOMPurify.isValidAttribute = function(tag, attr, value) {
1645 if (!CONFIG) _parseConfig({});
1646 const lcTag = transformCaseFunc(tag);
1647 const lcName = transformCaseFunc(attr);
1648 return _isValidAttribute(lcTag, lcName, value);
1649 };
1650 DOMPurify.addHook = function(entryPoint, hookFunction) {
1651 if (typeof hookFunction !== "function") return;
1652 arrayPush(hooks[entryPoint], hookFunction);
1653 };
1654 DOMPurify.removeHook = function(entryPoint, hookFunction) {
1655 if (hookFunction !== void 0) {
1656 const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
1657 return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
1658 }
1659 return arrayPop(hooks[entryPoint]);
1660 };
1661 DOMPurify.removeHooks = function(entryPoint) {
1662 hooks[entryPoint] = [];
1663 };
1664 DOMPurify.removeAllHooks = function() {
1665 hooks = _createHooksMap();
1666 };
1667 return DOMPurify;
1668 }
1669 var purify = createDOMPurify();
1670 module.exports = purify;
1671 }));
1672
1673 //#endregion
1674 //#region modules/shapes/assets/js/frontend/handlers/text-path.js
1675 var require_text_path = /* @__PURE__ */ __commonJSMin(((exports) => {
1676 var _interopRequireDefault = require_interopRequireDefault();
1677 Object.defineProperty(exports, "__esModule", { value: true });
1678 exports.default = void 0;
1679 var _utils = require_utils();
1680 var _dompurify = _interopRequireDefault(require_purify_cjs());
1681 var TextPathHandler = class extends elementorModules.frontend.handlers.Base {
1682 getDefaultSettings() {
1683 return { selectors: {
1684 pathContainer: ".e-text-path",
1685 svg: ".e-text-path > svg"
1686 } };
1687 }
1688 getDefaultElements() {
1689 const { selectors } = this.getSettings();
1690 const element = this.$element[0];
1691 return {
1692 widgetWrapper: element,
1693 pathContainer: element.querySelector(selectors.pathContainer),
1694 svg: element.querySelector(selectors.svg),
1695 textPath: element.querySelector(selectors.textPath)
1696 };
1697 }
1698 /**
1699 * Initialize the object.
1700 *
1701 * @return {void}
1702 */
1703 onInit() {
1704 this.elements = this.getDefaultElements();
1705 this.fetchSVG().then(() => {
1706 const sanitizedId = _dompurify.default.sanitize(this.elements.widgetWrapper.dataset.id);
1707 this.pathId = `e-path-${sanitizedId}`;
1708 this.textPathId = `e-text-path-${sanitizedId}`;
1709 if (!this.elements.svg) return;
1710 this.initTextPath();
1711 });
1712 }
1713 /**
1714 * Fetch & Inject the SVG markup.
1715 *
1716 * @return {Promise} success
1717 */
1718 fetchSVG() {
1719 const { url } = this.elements.pathContainer.dataset;
1720 if (!url || !url.endsWith(".svg")) return Promise.reject(url);
1721 return fetch(url).then((res) => res.text()).then((svg) => {
1722 this.elements.pathContainer.innerHTML = _dompurify.default.sanitize(svg);
1723 this.elements = this.getDefaultElements();
1724 });
1725 }
1726 /**
1727 * Gets a text offset (relative to the starting point) as a string or int, and set it as percents to the
1728 * `startOffset` attribute of the `<textPath>` element.
1729 *
1730 * @param {string|number} offset The text start offset.
1731 *
1732 * @return {void}
1733 */
1734 setOffset(offset) {
1735 if (!this.elements.textPath) return;
1736 if (this.isRTL()) offset = 100 - parseInt(offset);
1737 this.elements.textPath.setAttribute("startOffset", offset + "%");
1738 }
1739 /**
1740 * Handle element settings changes.
1741 *
1742 * @param {Object} setting The settings object from the editor.
1743 *
1744 * @return {void}
1745 */
1746 onElementChange(setting) {
1747 const { start_point: startPoint, text } = this.getElementSettings();
1748 switch (setting) {
1749 case "start_point":
1750 this.setOffset(startPoint.size);
1751 break;
1752 case "text":
1753 this.setText(text);
1754 break;
1755 case "text_path_direction":
1756 this.setOffset(startPoint.size);
1757 this.setText(text);
1758 break;
1759 default: break;
1760 }
1761 }
1762 /**
1763 * Attach a unique ID to the `path` element in the SVG, based on the container's ID.
1764 * This function selects the first `path` with a `data-path-anchor` attribute, or defaults to the first `path` element.
1765 *
1766 * @return {void}
1767 */
1768 attachIdToPath() {
1769 const path = this.elements.svg.querySelector("[data-path-anchor]") || this.elements.svg.querySelector("path");
1770 path.id = this.pathId;
1771 }
1772 /**
1773 * Initialize & build the SVG markup of the widget using the settings from the panel.
1774 *
1775 * @return {void}
1776 */
1777 initTextPath() {
1778 const { start_point: startPoint } = this.getElementSettings();
1779 const text = (0, _utils.escapeHTML)(this.elements.pathContainer.dataset.text);
1780 this.attachIdToPath();
1781 this.elements.svg.innerHTML += `
1782 <text>
1783 <textPath id="${this.textPathId}" href="#${this.pathId}"></textPath>
1784 </text>
1785 `;
1786 this.elements.textPath = this.elements.svg.querySelector(`#${this.textPathId}`);
1787 this.setOffset(startPoint.size);
1788 this.setText(text);
1789 }
1790 /**
1791 * Sets the text on the SVG path, including the link (if set) and its properties.
1792 *
1793 * @param {string} newText The new text to put in the text path.
1794 *
1795 * @return {void}
1796 */
1797 setText(newText) {
1798 const { is_external: isExternal, nofollow } = this.getElementSettings().link;
1799 const { linkUrl: url } = this.elements.pathContainer.dataset;
1800 const target = isExternal ? "_blank" : "";
1801 const rel = nofollow ? "nofollow" : "";
1802 if (url) {
1803 newText = `<a href="${(0, _utils.escapeHTML)(url)}" rel="${rel}" target="${target}">${(0, _utils.escapeHTML)(newText)}</a>`;
1804 newText = _dompurify.default.sanitize(newText, { ADD_ATTR: ["target"] });
1805 }
1806 this.elements.textPath.innerHTML = newText;
1807 const existingClone = this.elements.svg.querySelector(`#${this.textPathId}-clone`);
1808 if (existingClone) existingClone.remove();
1809 if (this.shouldReverseText()) {
1810 const clone = this.elements.textPath.cloneNode();
1811 clone.id += "-clone";
1812 clone.classList.add("elementor-hidden");
1813 clone.textContent = newText;
1814 this.elements.textPath.parentNode.appendChild(clone);
1815 this.reverseToRTL();
1816 }
1817 }
1818 /**
1819 * Determine if the text direction of the widget should be RTL or not, based on the site direction and the widget's settings.
1820 *
1821 * @return {boolean} is RTL
1822 */
1823 isRTL() {
1824 const { text_path_direction: direction } = this.getElementSettings();
1825 let isRTL = elementorFrontend.config.is_rtl;
1826 if (direction) isRTL = "rtl" === direction;
1827 return isRTL;
1828 }
1829 /**
1830 * Determine if it should RTL the text (reversing it, etc.).
1831 *
1832 * @return {boolean} should RTL
1833 */
1834 shouldReverseText() {
1835 if (!this.isRTL()) return false;
1836 if (elementorFrontend.utils.environment.firefox) return false;
1837 if (elementorFrontend.utils.environment.blink) return !this.isFixedChromiumVersion();
1838 return true;
1839 }
1840 /**
1841 * Chromium >= 96 fixed the issue with RTL text in SVG.
1842 *
1843 * @see https://chromium-review.googlesource.com/c/chromium/src/+/3159942
1844 * @see https://chromium.googlesource.com/chromium/src/+/4f1bc7d6ff8bfbf6348613bdb970fcdc2a706b5a/chrome/VERSION
1845 */
1846 isFixedChromiumVersion() {
1847 return parseInt(navigator.userAgent.match(/(?:Chrom(?:e|ium)|Edg)\/([0-9]+)\./)[1]) >= 96;
1848 }
1849 /**
1850 * Reverse the text path to support RTL.
1851 *
1852 * @return {void}
1853 */
1854 reverseToRTL() {
1855 let parentElement = this.elements.textPath;
1856 parentElement = parentElement.querySelector("a") || parentElement;
1857 parentElement.textContent = parentElement.textContent.replace(/([\u0591-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC\s$&+,:;=?@#|'<>.^*()%!-]+)/gi, (word) => {
1858 return word.split("").reverse().join("");
1859 });
1860 parentElement.setAttribute("aria-hidden", true);
1861 }
1862 };
1863 exports.default = TextPathHandler;
1864 }));
1865
1866 //#endregion
1867 //#region \0elementor-chunk-entry
1868 var import_text_path = /* @__PURE__ */ __toESM(require_text_path());
1869 (window.__elementorChunks = window.__elementorChunks || {})["text-path"] = import_text_path;
1870
1871 //#endregion
1872 })();
1873 //# sourceMappingURL=text-path.js.map