@kky42/pievo-server 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/.output/nitro.json +17 -0
  2. package/.output/public/assets/CodeField-dOzyFQNH.js +34 -0
  3. package/.output/public/assets/LoopView-B4H9QibC.js +55 -0
  4. package/.output/public/assets/Modal-D33gNSgx.js +1 -0
  5. package/.output/public/assets/SignIn-SHuRRyOv.js +1 -0
  6. package/.output/public/assets/actionUi-ChGGALzg.js +1 -0
  7. package/.output/public/assets/app-DElSo_jy.css +2 -0
  8. package/.output/public/assets/artifactView-DFuubXLJ.js +66 -0
  9. package/.output/public/assets/index-DfpTWRSz.js +12 -0
  10. package/.output/public/assets/invite._token-DJtd-XE2.js +1 -0
  11. package/.output/public/assets/invite._token-T8oo4Qtw.js +1 -0
  12. package/.output/public/assets/jsx-runtime-BseJUIpC.js +1 -0
  13. package/.output/public/assets/lifecycleUi-DKkChdnU.js +1 -0
  14. package/.output/public/assets/loopApi-BM2nj71x.js +3 -0
  15. package/.output/public/assets/loops._loopId-B19Jw7jC.js +5 -0
  16. package/.output/public/assets/loops._loopId_.runs._runId-_CflHV38.js +3 -0
  17. package/.output/public/assets/notifyFns-DCubjpRy.js +1 -0
  18. package/.output/public/assets/preload-helper-CKUiEq3b.js +3 -0
  19. package/.output/public/assets/routes-B9tgli5f.js +1 -0
  20. package/.output/public/assets/routes-CTtlM_qt.js +1 -0
  21. package/.output/public/assets/t._teamId-Bm21mngW.js +1 -0
  22. package/.output/public/assets/t._teamId-gR7BVKkR.js +1 -0
  23. package/.output/public/assets/ui-Dp88qUWh.js +1 -0
  24. package/.output/public/assets/useRouter-DsjH8G0p.js +1 -0
  25. package/.output/public/favicon.svg +12 -0
  26. package/.output/public/fonts/GeistPixel-Square.woff2 +0 -0
  27. package/.output/server/_chunks/ssr-renderer.mjs +26 -0
  28. package/.output/server/_libs/@aws-crypto/crc32+[...].mjs +419 -0
  29. package/.output/server/_libs/@aws-sdk/checksums+[...].mjs +10732 -0
  30. package/.output/server/_libs/@aws-sdk/client-s3+[...].mjs +9475 -0
  31. package/.output/server/_libs/@aws-sdk/credential-provider-http+[...].mjs +137 -0
  32. package/.output/server/_libs/@aws-sdk/credential-provider-ini+[...].mjs +440 -0
  33. package/.output/server/_libs/@aws-sdk/credential-provider-process+[...].mjs +62 -0
  34. package/.output/server/_libs/@aws-sdk/credential-provider-sso+[...].mjs +818 -0
  35. package/.output/server/_libs/@aws-sdk/credential-provider-web-identity+[...].mjs +59 -0
  36. package/.output/server/_libs/@base-ui/react+[...].mjs +11125 -0
  37. package/.output/server/_libs/@codemirror/autocomplete+[...].mjs +19713 -0
  38. package/.output/server/_libs/@codemirror/lang-css+[...].mjs +2636 -0
  39. package/.output/server/_libs/@codemirror/lang-html+[...].mjs +2247 -0
  40. package/.output/server/_libs/@codemirror/lang-json+[...].mjs +79 -0
  41. package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +1736 -0
  42. package/.output/server/_libs/@smithy/credential-provider-imds+[...].mjs +342 -0
  43. package/.output/server/_libs/@tanstack/react-router+[...].mjs +14300 -0
  44. package/.output/server/_libs/@uiw/codemirror-extensions-basic-setup+[...].mjs +76 -0
  45. package/.output/server/_libs/atomic-sleep.mjs +27 -0
  46. package/.output/server/_libs/aws-crypto__crc32c.mjs +314 -0
  47. package/.output/server/_libs/aws-sdk__nested-clients.mjs +2671 -0
  48. package/.output/server/_libs/babel__runtime.mjs +30 -0
  49. package/.output/server/_libs/clsx.mjs +16 -0
  50. package/.output/server/_libs/codemirror__commands.mjs +1725 -0
  51. package/.output/server/_libs/codemirror__lint.mjs +565 -0
  52. package/.output/server/_libs/codemirror__search.mjs +1138 -0
  53. package/.output/server/_libs/codemirror__theme-one-dark.mjs +161 -0
  54. package/.output/server/_libs/colorette.mjs +129 -0
  55. package/.output/server/_libs/croner.mjs +735 -0
  56. package/.output/server/_libs/d3-array.mjs +231 -0
  57. package/.output/server/_libs/d3-color.mjs +330 -0
  58. package/.output/server/_libs/d3-format.mjs +252 -0
  59. package/.output/server/_libs/d3-interpolate.mjs +163 -0
  60. package/.output/server/_libs/d3-path.mjs +77 -0
  61. package/.output/server/_libs/d3-scale+[...].mjs +1907 -0
  62. package/.output/server/_libs/d3-shape.mjs +689 -0
  63. package/.output/server/_libs/dateformat.mjs +341 -0
  64. package/.output/server/_libs/decimal.js-light.mjs +884 -0
  65. package/.output/server/_libs/diff.mjs +732 -0
  66. package/.output/server/_libs/dom-serializer+[...].mjs +708 -0
  67. package/.output/server/_libs/domhandler.mjs +461 -0
  68. package/.output/server/_libs/dompurify.mjs +2111 -0
  69. package/.output/server/_libs/domutils.mjs +868 -0
  70. package/.output/server/_libs/drizzle-orm+postgres.mjs +7689 -0
  71. package/.output/server/_libs/electric-sql__pglite.mjs +14674 -0
  72. package/.output/server/_libs/end-of-stream+once+wrappy.mjs +145 -0
  73. package/.output/server/_libs/es-toolkit.mjs +1737 -0
  74. package/.output/server/_libs/eventemitter3.mjs +236 -0
  75. package/.output/server/_libs/fast-copy.mjs +285 -0
  76. package/.output/server/_libs/fast-safe-stringify.mjs +172 -0
  77. package/.output/server/_libs/h3+rou3+srvx.mjs +1201 -0
  78. package/.output/server/_libs/html-dom-parser+htmlparser2.mjs +1560 -0
  79. package/.output/server/_libs/html-react-parser+[...].mjs +1360 -0
  80. package/.output/server/_libs/initdb.wasm +0 -0
  81. package/.output/server/_libs/marked.mjs +1548 -0
  82. package/.output/server/_libs/on-exit-leak-free.mjs +80 -0
  83. package/.output/server/_libs/pglite.data +37667 -8
  84. package/.output/server/_libs/pglite.wasm +0 -0
  85. package/.output/server/_libs/pino+[...].mjs +3196 -0
  86. package/.output/server/_libs/pino-abstract-transport+split2.mjs +194 -0
  87. package/.output/server/_libs/pino-pretty+[...].mjs +1623 -0
  88. package/.output/server/_libs/pinojs__redact.mjs +280 -0
  89. package/.output/server/_libs/react-redux+[...].mjs +205 -0
  90. package/.output/server/_libs/recharts+victory-vendor.mjs +15875 -0
  91. package/.output/server/_libs/tanstack__history.mjs +342 -0
  92. package/.output/server/_libs/ufo.mjs +64 -0
  93. package/.output/server/_libs/uiw__codemirror-themes.mjs +32 -0
  94. package/.output/server/_libs/uiw__react-codemirror.mjs +354 -0
  95. package/.output/server/_runtime.mjs +37 -0
  96. package/.output/server/_ssr/CodeField-tm4rr6G3.mjs +143 -0
  97. package/.output/server/_ssr/DashboardView-CC7htv28.mjs +2795 -0
  98. package/.output/server/_ssr/LoopPlaybook-BXH8mhiX.mjs +2105 -0
  99. package/.output/server/_ssr/LoopView-DCugEbHx.mjs +1106 -0
  100. package/.output/server/_ssr/Modal-DpKZHLZK.mjs +49 -0
  101. package/.output/server/_ssr/SignIn-dTndU6Hw.mjs +67 -0
  102. package/.output/server/_ssr/actionUi-CZbEixbf.mjs +119 -0
  103. package/.output/server/_ssr/adapters-BS8XosjF.mjs +130 -0
  104. package/.output/server/_ssr/artifactFiles-Cagtj7J0.mjs +61 -0
  105. package/.output/server/_ssr/artifactKind-BW0isV8L.mjs +37 -0
  106. package/.output/server/_ssr/artifactView-DS4O22wl.mjs +304 -0
  107. package/.output/server/_ssr/artifacts-DngKyW2u.mjs +2 -0
  108. package/.output/server/_ssr/auth-DY1DuYZd.mjs +38429 -0
  109. package/.output/server/_ssr/boot-BbtG0ImW.mjs +9010 -0
  110. package/.output/server/_ssr/boot-CMHTxQpJ.mjs +2 -0
  111. package/.output/server/_ssr/bun-sqlite-dialect-BW9W1_Ps-CU1Spd6z.mjs +162 -0
  112. package/.output/server/_ssr/core-RrmWoKne.mjs +5 -0
  113. package/.output/server/_ssr/createServerRpc-BD8Xn_0_.mjs +12 -0
  114. package/.output/server/_ssr/d1-sqlite-dialect-BLC8LXE6-DfG7tB8s.mjs +112 -0
  115. package/.output/server/_ssr/db-DWAuZq1o.mjs +2 -0
  116. package/.output/server/_ssr/dist-BIxFFVZg.mjs +342 -0
  117. package/.output/server/_ssr/empty-plugin-adapters-DKUlnwwl.mjs +5 -0
  118. package/.output/server/_ssr/factory-Blq0DYfT.mjs +6903 -0
  119. package/.output/server/_ssr/invite._token-BRCo9LGB.mjs +36 -0
  120. package/.output/server/_ssr/invite._token-DJxGLILJ.mjs +28 -0
  121. package/.output/server/_ssr/invite._token-NewFt27g.mjs +92 -0
  122. package/.output/server/_ssr/kysely-adapter-D3XTe64J.mjs +2 -0
  123. package/.output/server/_ssr/kysely-migration-tables-JkVUjPF_-bPAX9LR_.mjs +19 -0
  124. package/.output/server/_ssr/lifecycleUi-C9lg1r3r.mjs +38 -0
  125. package/.output/server/_ssr/logger-Dw82jNjH.mjs +2 -0
  126. package/.output/server/_ssr/loopApi-BtfkZQYK.mjs +532 -0
  127. package/.output/server/_ssr/loopApi-Cxe8WyOB.mjs +105 -0
  128. package/.output/server/_ssr/loops._loopId-7NQJPB9W.mjs +30 -0
  129. package/.output/server/_ssr/loops._loopId-DhnArGdL.mjs +1635 -0
  130. package/.output/server/_ssr/loops._loopId_.runs._runId-Bvuo2nki.mjs +29 -0
  131. package/.output/server/_ssr/loops._loopId_.runs._runId-Dip5Xk-q.mjs +674 -0
  132. package/.output/server/_ssr/machineFns-Dvr5ICUy.mjs +266 -0
  133. package/.output/server/_ssr/node-sqlite-dialect-DhyOpJTX.mjs +162 -0
  134. package/.output/server/_ssr/notifyFns-BcMRY5kP.mjs +118 -0
  135. package/.output/server/_ssr/notifyFns-Q458pZmE.mjs +580 -0
  136. package/.output/server/_ssr/router-J8KZ30xw.mjs +678 -0
  137. package/.output/server/_ssr/routes-Bcs4T1ox.mjs +28 -0
  138. package/.output/server/_ssr/routes-BoGrcf-b.mjs +43 -0
  139. package/.output/server/_ssr/routes-D4am3Zff.mjs +28 -0
  140. package/.output/server/_ssr/runDiff-CpEFqo7G.mjs +113 -0
  141. package/.output/server/_ssr/ssr.mjs +5837 -0
  142. package/.output/server/_ssr/start-4ifArtKx.mjs +4 -0
  143. package/.output/server/_ssr/store-b3JcQ08F.mjs +2 -0
  144. package/.output/server/_ssr/t._teamId-CeUhzgzT.mjs +32 -0
  145. package/.output/server/_ssr/t._teamId-DR-hQK7o.mjs +47 -0
  146. package/.output/server/_ssr/t._teamId-Dy_McbRt.mjs +31 -0
  147. package/.output/server/_ssr/teamCookie-B7hLOIie.mjs +10 -0
  148. package/.output/server/_ssr/teamFns-BIDnsg2A.mjs +473 -0
  149. package/.output/server/_ssr/teamFns-DA4ovI5g.mjs +33 -0
  150. package/.output/server/_ssr/tokens-ytd60FUt.mjs +2 -0
  151. package/.output/server/_ssr/ui-Dej2qjuS.mjs +267 -0
  152. package/.output/server/_tanstack-start-manifest_v-CVS6c7re.mjs +95 -0
  153. package/.output/server/drizzle/0000_round_marauders.sql +193 -0
  154. package/.output/server/drizzle/0001_naive_silver_fox.sql +25 -0
  155. package/.output/server/drizzle/0002_funny_sage.sql +12 -0
  156. package/.output/server/drizzle/0003_optimal_slapstick.sql +102 -0
  157. package/.output/server/drizzle/0004_remove_grok_agent.sql +5 -0
  158. package/.output/server/drizzle/0005_heavy_gauntlet.sql +8 -0
  159. package/.output/server/drizzle/0006_tranquil_sharon_carter.sql +1 -0
  160. package/.output/server/drizzle/0007_faulty_starbolt.sql +30 -0
  161. package/.output/server/drizzle/0008_durable_lifecycle_evidence.sql +15 -0
  162. package/.output/server/drizzle/meta/0000_snapshot.json +1333 -0
  163. package/.output/server/drizzle/meta/0001_snapshot.json +1498 -0
  164. package/.output/server/drizzle/meta/0002_snapshot.json +1576 -0
  165. package/.output/server/drizzle/meta/0003_snapshot.json +1666 -0
  166. package/.output/server/drizzle/meta/0005_snapshot.json +1666 -0
  167. package/.output/server/drizzle/meta/0006_snapshot.json +1672 -0
  168. package/.output/server/drizzle/meta/0007_snapshot.json +1787 -0
  169. package/.output/server/drizzle/meta/_journal.json +69 -0
  170. package/.output/server/index.mjs +464 -0
  171. package/.output/server/node_modules/tslib/modules/index.js +70 -0
  172. package/.output/server/node_modules/tslib/modules/package.json +3 -0
  173. package/.output/server/node_modules/tslib/package.json +47 -0
  174. package/.output/server/node_modules/tslib/tslib.js +484 -0
  175. package/.output/server/package.json +9 -0
  176. package/LICENSE +21 -0
  177. package/drizzle/0000_round_marauders.sql +193 -0
  178. package/drizzle/0001_naive_silver_fox.sql +25 -0
  179. package/drizzle/0002_funny_sage.sql +12 -0
  180. package/drizzle/0003_optimal_slapstick.sql +102 -0
  181. package/drizzle/0004_remove_grok_agent.sql +5 -0
  182. package/drizzle/0005_heavy_gauntlet.sql +8 -0
  183. package/drizzle/0006_tranquil_sharon_carter.sql +1 -0
  184. package/drizzle/0007_faulty_starbolt.sql +30 -0
  185. package/drizzle/0008_durable_lifecycle_evidence.sql +15 -0
  186. package/drizzle/meta/0000_snapshot.json +1333 -0
  187. package/drizzle/meta/0001_snapshot.json +1498 -0
  188. package/drizzle/meta/0002_snapshot.json +1576 -0
  189. package/drizzle/meta/0003_snapshot.json +1666 -0
  190. package/drizzle/meta/0005_snapshot.json +1666 -0
  191. package/drizzle/meta/0006_snapshot.json +1672 -0
  192. package/drizzle/meta/0007_snapshot.json +1787 -0
  193. package/drizzle/meta/_journal.json +69 -0
  194. package/package.json +84 -0
  195. package/scripts/pievo-server.mjs +390 -0
  196. package/scripts/prestart.mjs +66 -0
  197. package/scripts/server-cli-lib.mjs +451 -0
@@ -0,0 +1,2111 @@
1
+ //#region ../../node_modules/.pnpm/dompurify@3.4.11/node_modules/dompurify/dist/purify.es.mjs
2
+ /*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */
3
+ function _arrayLikeToArray(r, a) {
4
+ (null == a || a > r.length) && (a = r.length);
5
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
6
+ return n;
7
+ }
8
+ function _arrayWithHoles(r) {
9
+ if (Array.isArray(r)) return r;
10
+ }
11
+ function _iterableToArrayLimit(r, l) {
12
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
13
+ if (null != t) {
14
+ var e, n, i, u, a = [], f = true, o = false;
15
+ try {
16
+ if (i = (t = t.call(r)).next, 0 === l);
17
+ else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
18
+ } catch (r) {
19
+ o = true, n = r;
20
+ } finally {
21
+ try {
22
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
23
+ } finally {
24
+ if (o) throw n;
25
+ }
26
+ }
27
+ return a;
28
+ }
29
+ }
30
+ function _nonIterableRest() {
31
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
32
+ }
33
+ function _slicedToArray(r, e) {
34
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
35
+ }
36
+ function _unsupportedIterableToArray(r, a) {
37
+ if (r) {
38
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
39
+ var t = {}.toString.call(r).slice(8, -1);
40
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
41
+ }
42
+ }
43
+ var entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
44
+ var freeze = Object.freeze, seal = Object.seal, create = Object.create;
45
+ var _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
46
+ if (!freeze) freeze = function freeze(x) {
47
+ return x;
48
+ };
49
+ if (!seal) seal = function seal(x) {
50
+ return x;
51
+ };
52
+ if (!apply) apply = function apply(func, thisArg) {
53
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
54
+ return func.apply(thisArg, args);
55
+ };
56
+ if (!construct) construct = function construct(Func) {
57
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
58
+ return new Func(...args);
59
+ };
60
+ var arrayForEach = unapply(Array.prototype.forEach);
61
+ var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
62
+ var arrayPop = unapply(Array.prototype.pop);
63
+ var arrayPush = unapply(Array.prototype.push);
64
+ var arraySplice = unapply(Array.prototype.splice);
65
+ var arrayIsArray = Array.isArray;
66
+ var stringToLowerCase = unapply(String.prototype.toLowerCase);
67
+ var stringToString = unapply(String.prototype.toString);
68
+ var stringMatch = unapply(String.prototype.match);
69
+ var stringReplace = unapply(String.prototype.replace);
70
+ var stringIndexOf = unapply(String.prototype.indexOf);
71
+ var stringTrim = unapply(String.prototype.trim);
72
+ var numberToString = unapply(Number.prototype.toString);
73
+ var booleanToString = unapply(Boolean.prototype.toString);
74
+ var bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
75
+ var symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
76
+ var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
77
+ var objectToString = unapply(Object.prototype.toString);
78
+ var regExpTest = unapply(RegExp.prototype.test);
79
+ var typeErrorCreate = unconstruct(TypeError);
80
+ /**
81
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
82
+ *
83
+ * @param func - The function to be wrapped and called.
84
+ * @returns A new function that calls the given function with a specified thisArg and arguments.
85
+ */
86
+ function unapply(func) {
87
+ return function(thisArg) {
88
+ if (thisArg instanceof RegExp) thisArg.lastIndex = 0;
89
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) args[_key3 - 1] = arguments[_key3];
90
+ return apply(func, thisArg, args);
91
+ };
92
+ }
93
+ /**
94
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
95
+ *
96
+ * @param func - The constructor function to be wrapped and called.
97
+ * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
98
+ */
99
+ function unconstruct(Func) {
100
+ return function() {
101
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) args[_key4] = arguments[_key4];
102
+ return construct(Func, args);
103
+ };
104
+ }
105
+ /**
106
+ * Add properties to a lookup table
107
+ *
108
+ * @param set - The set to which elements will be added.
109
+ * @param array - The array containing elements to be added to the set.
110
+ * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
111
+ * @returns The modified set with added elements.
112
+ */
113
+ function addToSet(set, array) {
114
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
115
+ if (setPrototypeOf) setPrototypeOf(set, null);
116
+ if (!arrayIsArray(array)) return set;
117
+ let l = array.length;
118
+ while (l--) {
119
+ let element = array[l];
120
+ if (typeof element === "string") {
121
+ const lcElement = transformCaseFunc(element);
122
+ if (lcElement !== element) {
123
+ if (!isFrozen(array)) array[l] = lcElement;
124
+ element = lcElement;
125
+ }
126
+ }
127
+ set[element] = true;
128
+ }
129
+ return set;
130
+ }
131
+ /**
132
+ * Clean up an array to harden against CSPP
133
+ *
134
+ * @param array - The array to be cleaned.
135
+ * @returns The cleaned version of the array
136
+ */
137
+ function cleanArray(array) {
138
+ for (let index = 0; index < array.length; index++) if (!objectHasOwnProperty(array, index)) array[index] = null;
139
+ return array;
140
+ }
141
+ /**
142
+ * Shallow clone an object
143
+ *
144
+ * @param object - The object to be cloned.
145
+ * @returns A new object that copies the original.
146
+ */
147
+ function clone(object) {
148
+ const newObject = create(null);
149
+ for (const _ref2 of entries(object)) {
150
+ var _ref3 = _slicedToArray(_ref2, 2);
151
+ const property = _ref3[0];
152
+ const value = _ref3[1];
153
+ if (objectHasOwnProperty(object, property)) if (arrayIsArray(value)) newObject[property] = cleanArray(value);
154
+ else if (value && typeof value === "object" && value.constructor === Object) newObject[property] = clone(value);
155
+ else newObject[property] = value;
156
+ }
157
+ return newObject;
158
+ }
159
+ /**
160
+ * Convert non-node values into strings without depending on direct property access.
161
+ *
162
+ * @param value - The value to stringify.
163
+ * @returns A string representation of the provided value.
164
+ */
165
+ function stringifyValue(value) {
166
+ switch (typeof value) {
167
+ case "string": return value;
168
+ case "number": return numberToString(value);
169
+ case "boolean": return booleanToString(value);
170
+ case "bigint": return bigintToString ? bigintToString(value) : "0";
171
+ case "symbol": return symbolToString ? symbolToString(value) : "Symbol()";
172
+ case "undefined": return objectToString(value);
173
+ case "function":
174
+ case "object": {
175
+ if (value === null) return objectToString(value);
176
+ const valueAsRecord = value;
177
+ const valueToString = lookupGetter(valueAsRecord, "toString");
178
+ if (typeof valueToString === "function") {
179
+ const stringified = valueToString(valueAsRecord);
180
+ return typeof stringified === "string" ? stringified : objectToString(stringified);
181
+ }
182
+ return objectToString(value);
183
+ }
184
+ default: return objectToString(value);
185
+ }
186
+ }
187
+ /**
188
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
189
+ *
190
+ * @param object - The object to look up the getter function in its prototype chain.
191
+ * @param prop - The property name for which to find the getter function.
192
+ * @returns The getter function found in the prototype chain or a fallback function.
193
+ */
194
+ function lookupGetter(object, prop) {
195
+ while (object !== null) {
196
+ const desc = getOwnPropertyDescriptor(object, prop);
197
+ if (desc) {
198
+ if (desc.get) return unapply(desc.get);
199
+ if (typeof desc.value === "function") return unapply(desc.value);
200
+ }
201
+ object = getPrototypeOf(object);
202
+ }
203
+ function fallbackValue() {
204
+ return null;
205
+ }
206
+ return fallbackValue;
207
+ }
208
+ function isRegex(value) {
209
+ try {
210
+ regExpTest(value, "");
211
+ return true;
212
+ } catch (_unused) {
213
+ return false;
214
+ }
215
+ }
216
+ var html$1 = freeze([
217
+ "a",
218
+ "abbr",
219
+ "acronym",
220
+ "address",
221
+ "area",
222
+ "article",
223
+ "aside",
224
+ "audio",
225
+ "b",
226
+ "bdi",
227
+ "bdo",
228
+ "big",
229
+ "blink",
230
+ "blockquote",
231
+ "body",
232
+ "br",
233
+ "button",
234
+ "canvas",
235
+ "caption",
236
+ "center",
237
+ "cite",
238
+ "code",
239
+ "col",
240
+ "colgroup",
241
+ "content",
242
+ "data",
243
+ "datalist",
244
+ "dd",
245
+ "decorator",
246
+ "del",
247
+ "details",
248
+ "dfn",
249
+ "dialog",
250
+ "dir",
251
+ "div",
252
+ "dl",
253
+ "dt",
254
+ "element",
255
+ "em",
256
+ "fieldset",
257
+ "figcaption",
258
+ "figure",
259
+ "font",
260
+ "footer",
261
+ "form",
262
+ "h1",
263
+ "h2",
264
+ "h3",
265
+ "h4",
266
+ "h5",
267
+ "h6",
268
+ "head",
269
+ "header",
270
+ "hgroup",
271
+ "hr",
272
+ "html",
273
+ "i",
274
+ "img",
275
+ "input",
276
+ "ins",
277
+ "kbd",
278
+ "label",
279
+ "legend",
280
+ "li",
281
+ "main",
282
+ "map",
283
+ "mark",
284
+ "marquee",
285
+ "menu",
286
+ "menuitem",
287
+ "meter",
288
+ "nav",
289
+ "nobr",
290
+ "ol",
291
+ "optgroup",
292
+ "option",
293
+ "output",
294
+ "p",
295
+ "picture",
296
+ "pre",
297
+ "progress",
298
+ "q",
299
+ "rp",
300
+ "rt",
301
+ "ruby",
302
+ "s",
303
+ "samp",
304
+ "search",
305
+ "section",
306
+ "select",
307
+ "shadow",
308
+ "slot",
309
+ "small",
310
+ "source",
311
+ "spacer",
312
+ "span",
313
+ "strike",
314
+ "strong",
315
+ "style",
316
+ "sub",
317
+ "summary",
318
+ "sup",
319
+ "table",
320
+ "tbody",
321
+ "td",
322
+ "template",
323
+ "textarea",
324
+ "tfoot",
325
+ "th",
326
+ "thead",
327
+ "time",
328
+ "tr",
329
+ "track",
330
+ "tt",
331
+ "u",
332
+ "ul",
333
+ "var",
334
+ "video",
335
+ "wbr"
336
+ ]);
337
+ var svg$1 = freeze([
338
+ "svg",
339
+ "a",
340
+ "altglyph",
341
+ "altglyphdef",
342
+ "altglyphitem",
343
+ "animatecolor",
344
+ "animatemotion",
345
+ "animatetransform",
346
+ "circle",
347
+ "clippath",
348
+ "defs",
349
+ "desc",
350
+ "ellipse",
351
+ "enterkeyhint",
352
+ "exportparts",
353
+ "filter",
354
+ "font",
355
+ "g",
356
+ "glyph",
357
+ "glyphref",
358
+ "hkern",
359
+ "image",
360
+ "inputmode",
361
+ "line",
362
+ "lineargradient",
363
+ "marker",
364
+ "mask",
365
+ "metadata",
366
+ "mpath",
367
+ "part",
368
+ "path",
369
+ "pattern",
370
+ "polygon",
371
+ "polyline",
372
+ "radialgradient",
373
+ "rect",
374
+ "stop",
375
+ "style",
376
+ "switch",
377
+ "symbol",
378
+ "text",
379
+ "textpath",
380
+ "title",
381
+ "tref",
382
+ "tspan",
383
+ "view",
384
+ "vkern"
385
+ ]);
386
+ var svgFilters = freeze([
387
+ "feBlend",
388
+ "feColorMatrix",
389
+ "feComponentTransfer",
390
+ "feComposite",
391
+ "feConvolveMatrix",
392
+ "feDiffuseLighting",
393
+ "feDisplacementMap",
394
+ "feDistantLight",
395
+ "feDropShadow",
396
+ "feFlood",
397
+ "feFuncA",
398
+ "feFuncB",
399
+ "feFuncG",
400
+ "feFuncR",
401
+ "feGaussianBlur",
402
+ "feImage",
403
+ "feMerge",
404
+ "feMergeNode",
405
+ "feMorphology",
406
+ "feOffset",
407
+ "fePointLight",
408
+ "feSpecularLighting",
409
+ "feSpotLight",
410
+ "feTile",
411
+ "feTurbulence"
412
+ ]);
413
+ var svgDisallowed = freeze([
414
+ "animate",
415
+ "color-profile",
416
+ "cursor",
417
+ "discard",
418
+ "font-face",
419
+ "font-face-format",
420
+ "font-face-name",
421
+ "font-face-src",
422
+ "font-face-uri",
423
+ "foreignobject",
424
+ "hatch",
425
+ "hatchpath",
426
+ "mesh",
427
+ "meshgradient",
428
+ "meshpatch",
429
+ "meshrow",
430
+ "missing-glyph",
431
+ "script",
432
+ "set",
433
+ "solidcolor",
434
+ "unknown",
435
+ "use"
436
+ ]);
437
+ var mathMl$1 = freeze([
438
+ "math",
439
+ "menclose",
440
+ "merror",
441
+ "mfenced",
442
+ "mfrac",
443
+ "mglyph",
444
+ "mi",
445
+ "mlabeledtr",
446
+ "mmultiscripts",
447
+ "mn",
448
+ "mo",
449
+ "mover",
450
+ "mpadded",
451
+ "mphantom",
452
+ "mroot",
453
+ "mrow",
454
+ "ms",
455
+ "mspace",
456
+ "msqrt",
457
+ "mstyle",
458
+ "msub",
459
+ "msup",
460
+ "msubsup",
461
+ "mtable",
462
+ "mtd",
463
+ "mtext",
464
+ "mtr",
465
+ "munder",
466
+ "munderover",
467
+ "mprescripts"
468
+ ]);
469
+ var mathMlDisallowed = freeze([
470
+ "maction",
471
+ "maligngroup",
472
+ "malignmark",
473
+ "mlongdiv",
474
+ "mscarries",
475
+ "mscarry",
476
+ "msgroup",
477
+ "mstack",
478
+ "msline",
479
+ "msrow",
480
+ "semantics",
481
+ "annotation",
482
+ "annotation-xml",
483
+ "mprescripts",
484
+ "none"
485
+ ]);
486
+ var text = freeze(["#text"]);
487
+ var html = freeze([
488
+ "accept",
489
+ "action",
490
+ "align",
491
+ "alt",
492
+ "autocapitalize",
493
+ "autocomplete",
494
+ "autopictureinpicture",
495
+ "autoplay",
496
+ "background",
497
+ "bgcolor",
498
+ "border",
499
+ "capture",
500
+ "cellpadding",
501
+ "cellspacing",
502
+ "checked",
503
+ "cite",
504
+ "class",
505
+ "clear",
506
+ "color",
507
+ "cols",
508
+ "colspan",
509
+ "command",
510
+ "commandfor",
511
+ "controls",
512
+ "controlslist",
513
+ "coords",
514
+ "crossorigin",
515
+ "datetime",
516
+ "decoding",
517
+ "default",
518
+ "dir",
519
+ "disabled",
520
+ "disablepictureinpicture",
521
+ "disableremoteplayback",
522
+ "download",
523
+ "draggable",
524
+ "enctype",
525
+ "enterkeyhint",
526
+ "exportparts",
527
+ "face",
528
+ "for",
529
+ "headers",
530
+ "height",
531
+ "hidden",
532
+ "high",
533
+ "href",
534
+ "hreflang",
535
+ "id",
536
+ "inert",
537
+ "inputmode",
538
+ "integrity",
539
+ "ismap",
540
+ "kind",
541
+ "label",
542
+ "lang",
543
+ "list",
544
+ "loading",
545
+ "loop",
546
+ "low",
547
+ "max",
548
+ "maxlength",
549
+ "media",
550
+ "method",
551
+ "min",
552
+ "minlength",
553
+ "multiple",
554
+ "muted",
555
+ "name",
556
+ "nonce",
557
+ "noshade",
558
+ "novalidate",
559
+ "nowrap",
560
+ "open",
561
+ "optimum",
562
+ "part",
563
+ "pattern",
564
+ "placeholder",
565
+ "playsinline",
566
+ "popover",
567
+ "popovertarget",
568
+ "popovertargetaction",
569
+ "poster",
570
+ "preload",
571
+ "pubdate",
572
+ "radiogroup",
573
+ "readonly",
574
+ "rel",
575
+ "required",
576
+ "rev",
577
+ "reversed",
578
+ "role",
579
+ "rows",
580
+ "rowspan",
581
+ "spellcheck",
582
+ "scope",
583
+ "selected",
584
+ "shape",
585
+ "size",
586
+ "sizes",
587
+ "slot",
588
+ "span",
589
+ "srclang",
590
+ "start",
591
+ "src",
592
+ "srcset",
593
+ "step",
594
+ "style",
595
+ "summary",
596
+ "tabindex",
597
+ "title",
598
+ "translate",
599
+ "type",
600
+ "usemap",
601
+ "valign",
602
+ "value",
603
+ "width",
604
+ "wrap",
605
+ "xmlns"
606
+ ]);
607
+ var svg = freeze([
608
+ "accent-height",
609
+ "accumulate",
610
+ "additive",
611
+ "alignment-baseline",
612
+ "amplitude",
613
+ "ascent",
614
+ "attributename",
615
+ "attributetype",
616
+ "azimuth",
617
+ "basefrequency",
618
+ "baseline-shift",
619
+ "begin",
620
+ "bias",
621
+ "by",
622
+ "class",
623
+ "clip",
624
+ "clippathunits",
625
+ "clip-path",
626
+ "clip-rule",
627
+ "color",
628
+ "color-interpolation",
629
+ "color-interpolation-filters",
630
+ "color-profile",
631
+ "color-rendering",
632
+ "cx",
633
+ "cy",
634
+ "d",
635
+ "dx",
636
+ "dy",
637
+ "diffuseconstant",
638
+ "direction",
639
+ "display",
640
+ "divisor",
641
+ "dur",
642
+ "edgemode",
643
+ "elevation",
644
+ "end",
645
+ "exponent",
646
+ "fill",
647
+ "fill-opacity",
648
+ "fill-rule",
649
+ "filter",
650
+ "filterunits",
651
+ "flood-color",
652
+ "flood-opacity",
653
+ "font-family",
654
+ "font-size",
655
+ "font-size-adjust",
656
+ "font-stretch",
657
+ "font-style",
658
+ "font-variant",
659
+ "font-weight",
660
+ "fx",
661
+ "fy",
662
+ "g1",
663
+ "g2",
664
+ "glyph-name",
665
+ "glyphref",
666
+ "gradientunits",
667
+ "gradienttransform",
668
+ "height",
669
+ "href",
670
+ "id",
671
+ "image-rendering",
672
+ "in",
673
+ "in2",
674
+ "intercept",
675
+ "k",
676
+ "k1",
677
+ "k2",
678
+ "k3",
679
+ "k4",
680
+ "kerning",
681
+ "keypoints",
682
+ "keysplines",
683
+ "keytimes",
684
+ "lang",
685
+ "lengthadjust",
686
+ "letter-spacing",
687
+ "kernelmatrix",
688
+ "kernelunitlength",
689
+ "lighting-color",
690
+ "local",
691
+ "marker-end",
692
+ "marker-mid",
693
+ "marker-start",
694
+ "markerheight",
695
+ "markerunits",
696
+ "markerwidth",
697
+ "maskcontentunits",
698
+ "maskunits",
699
+ "max",
700
+ "mask",
701
+ "mask-type",
702
+ "media",
703
+ "method",
704
+ "mode",
705
+ "min",
706
+ "name",
707
+ "numoctaves",
708
+ "offset",
709
+ "operator",
710
+ "opacity",
711
+ "order",
712
+ "orient",
713
+ "orientation",
714
+ "origin",
715
+ "overflow",
716
+ "paint-order",
717
+ "path",
718
+ "pathlength",
719
+ "patterncontentunits",
720
+ "patterntransform",
721
+ "patternunits",
722
+ "points",
723
+ "preservealpha",
724
+ "preserveaspectratio",
725
+ "primitiveunits",
726
+ "r",
727
+ "rx",
728
+ "ry",
729
+ "radius",
730
+ "refx",
731
+ "refy",
732
+ "repeatcount",
733
+ "repeatdur",
734
+ "restart",
735
+ "result",
736
+ "rotate",
737
+ "scale",
738
+ "seed",
739
+ "shape-rendering",
740
+ "slope",
741
+ "specularconstant",
742
+ "specularexponent",
743
+ "spreadmethod",
744
+ "startoffset",
745
+ "stddeviation",
746
+ "stitchtiles",
747
+ "stop-color",
748
+ "stop-opacity",
749
+ "stroke-dasharray",
750
+ "stroke-dashoffset",
751
+ "stroke-linecap",
752
+ "stroke-linejoin",
753
+ "stroke-miterlimit",
754
+ "stroke-opacity",
755
+ "stroke",
756
+ "stroke-width",
757
+ "style",
758
+ "surfacescale",
759
+ "systemlanguage",
760
+ "tabindex",
761
+ "tablevalues",
762
+ "targetx",
763
+ "targety",
764
+ "transform",
765
+ "transform-origin",
766
+ "text-anchor",
767
+ "text-decoration",
768
+ "text-rendering",
769
+ "textlength",
770
+ "type",
771
+ "u1",
772
+ "u2",
773
+ "unicode",
774
+ "values",
775
+ "viewbox",
776
+ "visibility",
777
+ "version",
778
+ "vert-adv-y",
779
+ "vert-origin-x",
780
+ "vert-origin-y",
781
+ "width",
782
+ "word-spacing",
783
+ "wrap",
784
+ "writing-mode",
785
+ "xchannelselector",
786
+ "ychannelselector",
787
+ "x",
788
+ "x1",
789
+ "x2",
790
+ "xmlns",
791
+ "y",
792
+ "y1",
793
+ "y2",
794
+ "z",
795
+ "zoomandpan"
796
+ ]);
797
+ var mathMl = freeze([
798
+ "accent",
799
+ "accentunder",
800
+ "align",
801
+ "bevelled",
802
+ "close",
803
+ "columnalign",
804
+ "columnlines",
805
+ "columnspacing",
806
+ "columnspan",
807
+ "denomalign",
808
+ "depth",
809
+ "dir",
810
+ "display",
811
+ "displaystyle",
812
+ "encoding",
813
+ "fence",
814
+ "frame",
815
+ "height",
816
+ "href",
817
+ "id",
818
+ "largeop",
819
+ "length",
820
+ "linethickness",
821
+ "lquote",
822
+ "lspace",
823
+ "mathbackground",
824
+ "mathcolor",
825
+ "mathsize",
826
+ "mathvariant",
827
+ "maxsize",
828
+ "minsize",
829
+ "movablelimits",
830
+ "notation",
831
+ "numalign",
832
+ "open",
833
+ "rowalign",
834
+ "rowlines",
835
+ "rowspacing",
836
+ "rowspan",
837
+ "rspace",
838
+ "rquote",
839
+ "scriptlevel",
840
+ "scriptminsize",
841
+ "scriptsizemultiplier",
842
+ "selection",
843
+ "separator",
844
+ "separators",
845
+ "stretchy",
846
+ "subscriptshift",
847
+ "supscriptshift",
848
+ "symmetric",
849
+ "voffset",
850
+ "width",
851
+ "xmlns"
852
+ ]);
853
+ var xml = freeze([
854
+ "xlink:href",
855
+ "xml:id",
856
+ "xlink:title",
857
+ "xml:space",
858
+ "xmlns:xlink"
859
+ ]);
860
+ var MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
861
+ var ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
862
+ var TMPLIT_EXPR = seal(/\${[\w\W]*/g);
863
+ var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
864
+ var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
865
+ var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
866
+ var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
867
+ var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);
868
+ var DOCTYPE_NAME = seal(/^html$/i);
869
+ var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
870
+ var ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
871
+ var COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
872
+ var FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
873
+ var SELF_CLOSING_TAG = seal(/\/>/i);
874
+ var NODE_TYPE = {
875
+ element: 1,
876
+ attribute: 2,
877
+ text: 3,
878
+ cdataSection: 4,
879
+ entityReference: 5,
880
+ entityNode: 6,
881
+ processingInstruction: 7,
882
+ comment: 8,
883
+ document: 9,
884
+ documentType: 10,
885
+ documentFragment: 11,
886
+ notation: 12
887
+ };
888
+ var getGlobal = function getGlobal() {
889
+ return typeof window === "undefined" ? null : window;
890
+ };
891
+ /**
892
+ * Creates a no-op policy for internal use only.
893
+ * Don't export this function outside this module!
894
+ * @param trustedTypes The policy factory.
895
+ * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
896
+ * @return The policy created (or null, if Trusted Types
897
+ * are not supported or creating the policy failed).
898
+ */
899
+ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
900
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") return null;
901
+ let suffix = null;
902
+ const ATTR_NAME = "data-tt-policy-suffix";
903
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) suffix = purifyHostElement.getAttribute(ATTR_NAME);
904
+ const policyName = "dompurify" + (suffix ? "#" + suffix : "");
905
+ try {
906
+ return trustedTypes.createPolicy(policyName, {
907
+ createHTML(html) {
908
+ return html;
909
+ },
910
+ createScriptURL(scriptUrl) {
911
+ return scriptUrl;
912
+ }
913
+ });
914
+ } catch (_) {
915
+ console.warn("TrustedTypes policy " + policyName + " could not be created.");
916
+ return null;
917
+ }
918
+ };
919
+ var _createHooksMap = function _createHooksMap() {
920
+ return {
921
+ afterSanitizeAttributes: [],
922
+ afterSanitizeElements: [],
923
+ afterSanitizeShadowDOM: [],
924
+ beforeSanitizeAttributes: [],
925
+ beforeSanitizeElements: [],
926
+ beforeSanitizeShadowDOM: [],
927
+ uponSanitizeAttribute: [],
928
+ uponSanitizeElement: [],
929
+ uponSanitizeShadowNode: []
930
+ };
931
+ };
932
+ /**
933
+ * Resolve a set-valued configuration option: a fresh set built from
934
+ * cfg[key] when it is an own array property (seeded with a clone of
935
+ * options.base when given, case-normalized via options.transform),
936
+ * the fallback set otherwise.
937
+ *
938
+ * @param cfg the cloned, prototype-free configuration object
939
+ * @param key the configuration property to read
940
+ * @param fallback the set to use when the option is absent or not an array
941
+ * @param options transform and optional base set to merge into
942
+ * @returns the resolved set
943
+ */
944
+ var _resolveSetOption = function _resolveSetOption(cfg, key, fallback, options) {
945
+ return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
946
+ };
947
+ function createDOMPurify() {
948
+ let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
949
+ const DOMPurify = (root) => createDOMPurify(root);
950
+ DOMPurify.version = "3.4.11";
951
+ DOMPurify.removed = [];
952
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
953
+ DOMPurify.isSupported = false;
954
+ return DOMPurify;
955
+ }
956
+ let document = window.document;
957
+ const originalDocument = document;
958
+ const currentScript = originalDocument.currentScript;
959
+ window.DocumentFragment;
960
+ const HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, Element = window.Element, NodeFilter = window.NodeFilter;
961
+ window.NamedNodeMap === void 0 && (window.NamedNodeMap || window.MozNamedAttrMap);
962
+ window.HTMLFormElement;
963
+ const DOMParser = window.DOMParser, trustedTypes = window.trustedTypes;
964
+ const ElementPrototype = Element.prototype;
965
+ const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
966
+ const remove = lookupGetter(ElementPrototype, "remove");
967
+ const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
968
+ const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
969
+ const getParentNode = lookupGetter(ElementPrototype, "parentNode");
970
+ const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot");
971
+ const getAttributes = lookupGetter(ElementPrototype, "attributes");
972
+ const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
973
+ const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
974
+ if (typeof HTMLTemplateElement === "function") {
975
+ const template = document.createElement("template");
976
+ if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
977
+ }
978
+ let trustedTypesPolicy;
979
+ let emptyHTML = "";
980
+ let defaultTrustedTypesPolicy;
981
+ let defaultTrustedTypesPolicyResolved = false;
982
+ let IN_TRUSTED_TYPES_POLICY = 0;
983
+ const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy() {
984
+ if (IN_TRUSTED_TYPES_POLICY > 0) throw typeErrorCreate("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
985
+ };
986
+ const _createTrustedHTML = function _createTrustedHTML(html) {
987
+ _assertNotInTrustedTypesPolicy();
988
+ IN_TRUSTED_TYPES_POLICY++;
989
+ try {
990
+ return trustedTypesPolicy.createHTML(html);
991
+ } finally {
992
+ IN_TRUSTED_TYPES_POLICY--;
993
+ }
994
+ };
995
+ const _createTrustedScriptURL = function _createTrustedScriptURL(scriptUrl) {
996
+ _assertNotInTrustedTypesPolicy();
997
+ IN_TRUSTED_TYPES_POLICY++;
998
+ try {
999
+ return trustedTypesPolicy.createScriptURL(scriptUrl);
1000
+ } finally {
1001
+ IN_TRUSTED_TYPES_POLICY--;
1002
+ }
1003
+ };
1004
+ const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy() {
1005
+ if (!defaultTrustedTypesPolicyResolved) {
1006
+ defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
1007
+ defaultTrustedTypesPolicyResolved = true;
1008
+ }
1009
+ return defaultTrustedTypesPolicy;
1010
+ };
1011
+ const _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
1012
+ const importNode = originalDocument.importNode;
1013
+ let hooks = _createHooksMap();
1014
+ /**
1015
+ * Expose whether this browser supports running the full DOMPurify.
1016
+ */
1017
+ DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
1018
+ const MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, TMPLIT_EXPR$1 = TMPLIT_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE, CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
1019
+ let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
1020
+ /**
1021
+ * We consider the elements and attributes below to be safe. Ideally
1022
+ * don't add any new ones but feel free to remove unwanted ones.
1023
+ */
1024
+ let ALLOWED_TAGS = null;
1025
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [
1026
+ ...html$1,
1027
+ ...svg$1,
1028
+ ...svgFilters,
1029
+ ...mathMl$1,
1030
+ ...text
1031
+ ]);
1032
+ let ALLOWED_ATTR = null;
1033
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [
1034
+ ...html,
1035
+ ...svg,
1036
+ ...mathMl,
1037
+ ...xml
1038
+ ]);
1039
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
1040
+ tagNameCheck: {
1041
+ writable: true,
1042
+ configurable: false,
1043
+ enumerable: true,
1044
+ value: null
1045
+ },
1046
+ attributeNameCheck: {
1047
+ writable: true,
1048
+ configurable: false,
1049
+ enumerable: true,
1050
+ value: null
1051
+ },
1052
+ allowCustomizedBuiltInElements: {
1053
+ writable: true,
1054
+ configurable: false,
1055
+ enumerable: true,
1056
+ value: false
1057
+ }
1058
+ }));
1059
+ let FORBID_TAGS = null;
1060
+ let FORBID_ATTR = null;
1061
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
1062
+ tagCheck: {
1063
+ writable: true,
1064
+ configurable: false,
1065
+ enumerable: true,
1066
+ value: null
1067
+ },
1068
+ attributeCheck: {
1069
+ writable: true,
1070
+ configurable: false,
1071
+ enumerable: true,
1072
+ value: null
1073
+ }
1074
+ }));
1075
+ let ALLOW_ARIA_ATTR = true;
1076
+ let ALLOW_DATA_ATTR = true;
1077
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
1078
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
1079
+ let SAFE_FOR_TEMPLATES = false;
1080
+ let SAFE_FOR_XML = true;
1081
+ let WHOLE_DOCUMENT = false;
1082
+ let SET_CONFIG = false;
1083
+ let SET_CONFIG_ALLOWED_TAGS = null;
1084
+ let SET_CONFIG_ALLOWED_ATTR = null;
1085
+ let FORCE_BODY = false;
1086
+ let RETURN_DOM = false;
1087
+ let RETURN_DOM_FRAGMENT = false;
1088
+ let RETURN_TRUSTED_TYPE = false;
1089
+ let SANITIZE_DOM = true;
1090
+ let SANITIZE_NAMED_PROPS = false;
1091
+ const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
1092
+ let KEEP_CONTENT = true;
1093
+ let IN_PLACE = false;
1094
+ let USE_PROFILES = {};
1095
+ let FORBID_CONTENTS = null;
1096
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, [
1097
+ "annotation-xml",
1098
+ "audio",
1099
+ "colgroup",
1100
+ "desc",
1101
+ "foreignobject",
1102
+ "head",
1103
+ "iframe",
1104
+ "math",
1105
+ "mi",
1106
+ "mn",
1107
+ "mo",
1108
+ "ms",
1109
+ "mtext",
1110
+ "noembed",
1111
+ "noframes",
1112
+ "noscript",
1113
+ "plaintext",
1114
+ "script",
1115
+ "selectedcontent",
1116
+ "style",
1117
+ "svg",
1118
+ "template",
1119
+ "thead",
1120
+ "title",
1121
+ "video",
1122
+ "xmp"
1123
+ ]);
1124
+ let DATA_URI_TAGS = null;
1125
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, [
1126
+ "audio",
1127
+ "video",
1128
+ "img",
1129
+ "source",
1130
+ "image",
1131
+ "track"
1132
+ ]);
1133
+ let URI_SAFE_ATTRIBUTES = null;
1134
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
1135
+ "alt",
1136
+ "class",
1137
+ "for",
1138
+ "id",
1139
+ "label",
1140
+ "name",
1141
+ "pattern",
1142
+ "placeholder",
1143
+ "role",
1144
+ "summary",
1145
+ "title",
1146
+ "value",
1147
+ "style",
1148
+ "xmlns"
1149
+ ]);
1150
+ const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
1151
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
1152
+ const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
1153
+ let NAMESPACE = HTML_NAMESPACE;
1154
+ let IS_EMPTY_INPUT = false;
1155
+ let ALLOWED_NAMESPACES = null;
1156
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [
1157
+ MATHML_NAMESPACE,
1158
+ SVG_NAMESPACE,
1159
+ HTML_NAMESPACE
1160
+ ], stringToString);
1161
+ const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze([
1162
+ "mi",
1163
+ "mo",
1164
+ "mn",
1165
+ "ms",
1166
+ "mtext"
1167
+ ]);
1168
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
1169
+ const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
1170
+ let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
1171
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
1172
+ "title",
1173
+ "style",
1174
+ "font",
1175
+ "a",
1176
+ "script"
1177
+ ]);
1178
+ let PARSER_MEDIA_TYPE = null;
1179
+ const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
1180
+ const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
1181
+ let transformCaseFunc = null;
1182
+ let CONFIG = null;
1183
+ const formElement = document.createElement("form");
1184
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
1185
+ return testValue instanceof RegExp || testValue instanceof Function;
1186
+ };
1187
+ /**
1188
+ * _parseConfig
1189
+ *
1190
+ * @param cfg optional config literal
1191
+ */
1192
+ const _parseConfig = function _parseConfig() {
1193
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1194
+ if (CONFIG && CONFIG === cfg) return;
1195
+ if (!cfg || typeof cfg !== "object") cfg = {};
1196
+ cfg = clone(cfg);
1197
+ PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
1198
+ transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
1199
+ ALLOWED_TAGS = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, { transform: transformCaseFunc });
1200
+ ALLOWED_ATTR = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, { transform: transformCaseFunc });
1201
+ ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, { transform: stringToString });
1202
+ URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, "ADD_URI_SAFE_ATTR", DEFAULT_URI_SAFE_ATTRIBUTES, {
1203
+ transform: transformCaseFunc,
1204
+ base: DEFAULT_URI_SAFE_ATTRIBUTES
1205
+ });
1206
+ DATA_URI_TAGS = _resolveSetOption(cfg, "ADD_DATA_URI_TAGS", DEFAULT_DATA_URI_TAGS, {
1207
+ transform: transformCaseFunc,
1208
+ base: DEFAULT_DATA_URI_TAGS
1209
+ });
1210
+ FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, { transform: transformCaseFunc });
1211
+ FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), { transform: transformCaseFunc });
1212
+ FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), { transform: transformCaseFunc });
1213
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
1214
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
1215
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
1216
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
1217
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
1218
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
1219
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
1220
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
1221
+ RETURN_DOM = cfg.RETURN_DOM || false;
1222
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
1223
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
1224
+ FORCE_BODY = cfg.FORCE_BODY || false;
1225
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
1226
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
1227
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
1228
+ IN_PLACE = cfg.IN_PLACE || false;
1229
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
1230
+ NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
1231
+ MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
1232
+ HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
1233
+ const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
1234
+ CUSTOM_ELEMENT_HANDLING = create(null);
1235
+ if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
1236
+ if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
1237
+ if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
1238
+ seal(CUSTOM_ELEMENT_HANDLING);
1239
+ if (SAFE_FOR_TEMPLATES) ALLOW_DATA_ATTR = false;
1240
+ if (RETURN_DOM_FRAGMENT) RETURN_DOM = true;
1241
+ if (USE_PROFILES) {
1242
+ ALLOWED_TAGS = addToSet({}, text);
1243
+ ALLOWED_ATTR = create(null);
1244
+ if (USE_PROFILES.html === true) {
1245
+ addToSet(ALLOWED_TAGS, html$1);
1246
+ addToSet(ALLOWED_ATTR, html);
1247
+ }
1248
+ if (USE_PROFILES.svg === true) {
1249
+ addToSet(ALLOWED_TAGS, svg$1);
1250
+ addToSet(ALLOWED_ATTR, svg);
1251
+ addToSet(ALLOWED_ATTR, xml);
1252
+ }
1253
+ if (USE_PROFILES.svgFilters === true) {
1254
+ addToSet(ALLOWED_TAGS, svgFilters);
1255
+ addToSet(ALLOWED_ATTR, svg);
1256
+ addToSet(ALLOWED_ATTR, xml);
1257
+ }
1258
+ if (USE_PROFILES.mathMl === true) {
1259
+ addToSet(ALLOWED_TAGS, mathMl$1);
1260
+ addToSet(ALLOWED_ATTR, mathMl);
1261
+ addToSet(ALLOWED_ATTR, xml);
1262
+ }
1263
+ }
1264
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
1265
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
1266
+ if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
1267
+ if (typeof cfg.ADD_TAGS === "function") EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
1268
+ else if (arrayIsArray(cfg.ADD_TAGS)) {
1269
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS = clone(ALLOWED_TAGS);
1270
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
1271
+ }
1272
+ }
1273
+ if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
1274
+ if (typeof cfg.ADD_ATTR === "function") EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
1275
+ else if (arrayIsArray(cfg.ADD_ATTR)) {
1276
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR = clone(ALLOWED_ATTR);
1277
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
1278
+ }
1279
+ }
1280
+ if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
1281
+ if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
1282
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
1283
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
1284
+ }
1285
+ if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
1286
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
1287
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
1288
+ }
1289
+ if (KEEP_CONTENT) ALLOWED_TAGS["#text"] = true;
1290
+ if (WHOLE_DOCUMENT) addToSet(ALLOWED_TAGS, [
1291
+ "html",
1292
+ "head",
1293
+ "body"
1294
+ ]);
1295
+ if (ALLOWED_TAGS.table) {
1296
+ addToSet(ALLOWED_TAGS, ["tbody"]);
1297
+ delete FORBID_TAGS.tbody;
1298
+ }
1299
+ if (cfg.TRUSTED_TYPES_POLICY) {
1300
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
1301
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
1302
+ const previousTrustedTypesPolicy = trustedTypesPolicy;
1303
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
1304
+ try {
1305
+ emptyHTML = _createTrustedHTML("");
1306
+ } catch (error) {
1307
+ trustedTypesPolicy = previousTrustedTypesPolicy;
1308
+ throw error;
1309
+ }
1310
+ } else if (cfg.TRUSTED_TYPES_POLICY === null) {
1311
+ trustedTypesPolicy = void 0;
1312
+ emptyHTML = "";
1313
+ } else {
1314
+ if (trustedTypesPolicy === void 0) trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
1315
+ if (trustedTypesPolicy && typeof emptyHTML === "string") emptyHTML = _createTrustedHTML("");
1316
+ }
1317
+ if (freeze) freeze(cfg);
1318
+ CONFIG = cfg;
1319
+ };
1320
+ const ALL_SVG_TAGS = addToSet({}, [
1321
+ ...svg$1,
1322
+ ...svgFilters,
1323
+ ...svgDisallowed
1324
+ ]);
1325
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
1326
+ /**
1327
+ * Namespace rules for an element in the SVG namespace.
1328
+ *
1329
+ * @param tagName the element's lowercase tag name
1330
+ * @param parent the (possibly simulated) parent node
1331
+ * @param parentTagName the parent's lowercase tag name
1332
+ * @returns true if a spec-compliant parser could produce this element
1333
+ */
1334
+ const _checkSvgNamespace = function _checkSvgNamespace(tagName, parent, parentTagName) {
1335
+ if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg";
1336
+ if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
1337
+ return Boolean(ALL_SVG_TAGS[tagName]);
1338
+ };
1339
+ /**
1340
+ * Namespace rules for an element in the MathML namespace.
1341
+ *
1342
+ * @param tagName the element's lowercase tag name
1343
+ * @param parent the (possibly simulated) parent node
1344
+ * @param parentTagName the parent's lowercase tag name
1345
+ * @returns true if a spec-compliant parser could produce this element
1346
+ */
1347
+ const _checkMathMlNamespace = function _checkMathMlNamespace(tagName, parent, parentTagName) {
1348
+ if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math";
1349
+ if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
1350
+ return Boolean(ALL_MATHML_TAGS[tagName]);
1351
+ };
1352
+ /**
1353
+ * Namespace rules for an element in the HTML namespace.
1354
+ *
1355
+ * @param tagName the element's lowercase tag name
1356
+ * @param parent the (possibly simulated) parent node
1357
+ * @param parentTagName the parent's lowercase tag name
1358
+ * @returns true if a spec-compliant parser could produce this element
1359
+ */
1360
+ const _checkHtmlNamespace = function _checkHtmlNamespace(tagName, parent, parentTagName) {
1361
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false;
1362
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false;
1363
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
1364
+ };
1365
+ /**
1366
+ * @param element a DOM element whose namespace is being checked
1367
+ * @returns Return false if the element has a
1368
+ * namespace that a spec-compliant parser would never
1369
+ * return. Return true otherwise.
1370
+ */
1371
+ const _checkValidNamespace = function _checkValidNamespace(element) {
1372
+ let parent = getParentNode(element);
1373
+ if (!parent || !parent.tagName) parent = {
1374
+ namespaceURI: NAMESPACE,
1375
+ tagName: "template"
1376
+ };
1377
+ const tagName = stringToLowerCase(element.tagName);
1378
+ const parentTagName = stringToLowerCase(parent.tagName);
1379
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) return false;
1380
+ if (element.namespaceURI === SVG_NAMESPACE) return _checkSvgNamespace(tagName, parent, parentTagName);
1381
+ if (element.namespaceURI === MATHML_NAMESPACE) return _checkMathMlNamespace(tagName, parent, parentTagName);
1382
+ if (element.namespaceURI === HTML_NAMESPACE) return _checkHtmlNamespace(tagName, parent, parentTagName);
1383
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) return true;
1384
+ return false;
1385
+ };
1386
+ /**
1387
+ * _forceRemove
1388
+ *
1389
+ * @param node a DOM node
1390
+ */
1391
+ const _forceRemove = function _forceRemove(node) {
1392
+ arrayPush(DOMPurify.removed, { element: node });
1393
+ try {
1394
+ getParentNode(node).removeChild(node);
1395
+ } catch (_) {
1396
+ remove(node);
1397
+ if (!getParentNode(node)) throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
1398
+ }
1399
+ };
1400
+ /**
1401
+ * _neutralizeRoot
1402
+ *
1403
+ * Fail-closed teardown of an in-place root after the sanitize walk aborts
1404
+ * (campaign-3 F2). An internal throw mid-walk — e.g. a page-registered
1405
+ * custom element's reaction detaches a node so `_forceRemove`'s deliberate
1406
+ * parentless guard throws, or any other re-entrant engine mutation — would
1407
+ * otherwise leave the caller's *live* tree half-sanitized, with everything
1408
+ * after the abort point still carrying its handlers. There is no safe way
1409
+ * to resume the walk (the tree mutated under us), so we strip the root bare:
1410
+ * remove every child and every attribute, then let the caller's catch see
1411
+ * the original error. Clobber-safe (cached `remove`/`childNodes`/`attributes`
1412
+ * getters; the root was already clobber-pre-flighted at the IN_PLACE entry).
1413
+ *
1414
+ * @param root the in-place root to empty
1415
+ */
1416
+ const _neutralizeRoot = function _neutralizeRoot(root) {
1417
+ const childNodes = getChildNodes(root);
1418
+ if (childNodes) {
1419
+ const snapshot = [];
1420
+ arrayForEach(childNodes, (child) => {
1421
+ arrayPush(snapshot, child);
1422
+ });
1423
+ arrayForEach(snapshot, (child) => {
1424
+ try {
1425
+ remove(child);
1426
+ } catch (_) {}
1427
+ });
1428
+ }
1429
+ const attributes = getAttributes(root);
1430
+ if (attributes) for (let i = attributes.length - 1; i >= 0; --i) {
1431
+ const attribute = attributes[i];
1432
+ const name = attribute && attribute.name;
1433
+ if (typeof name === "string") try {
1434
+ root.removeAttribute(name);
1435
+ } catch (_) {}
1436
+ }
1437
+ };
1438
+ /**
1439
+ * _removeAttribute
1440
+ *
1441
+ * @param name an Attribute name
1442
+ * @param element a DOM node
1443
+ */
1444
+ const _removeAttribute = function _removeAttribute(name, element) {
1445
+ try {
1446
+ arrayPush(DOMPurify.removed, {
1447
+ attribute: element.getAttributeNode(name),
1448
+ from: element
1449
+ });
1450
+ } catch (_) {
1451
+ arrayPush(DOMPurify.removed, {
1452
+ attribute: null,
1453
+ from: element
1454
+ });
1455
+ }
1456
+ element.removeAttribute(name);
1457
+ if (name === "is") if (RETURN_DOM || RETURN_DOM_FRAGMENT) try {
1458
+ _forceRemove(element);
1459
+ } catch (_) {}
1460
+ else try {
1461
+ element.setAttribute(name, "");
1462
+ } catch (_) {}
1463
+ };
1464
+ /**
1465
+ * _stripDisallowedAttributes
1466
+ *
1467
+ * Removes every attribute the active configuration does not allow from a
1468
+ * single element, using the same allowlist as the main attribute pass (so
1469
+ * `on*` handlers go, but no `/^on/` blocklist is introduced). Used only to
1470
+ * neutralise nodes that are being discarded from an in-place tree.
1471
+ *
1472
+ * @param element the element to strip
1473
+ */
1474
+ const _stripDisallowedAttributes = function _stripDisallowedAttributes(element) {
1475
+ const attributes = getAttributes(element);
1476
+ if (!attributes) return;
1477
+ for (let i = attributes.length - 1; i >= 0; --i) {
1478
+ const attribute = attributes[i];
1479
+ const name = attribute && attribute.name;
1480
+ if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)]) continue;
1481
+ try {
1482
+ element.removeAttribute(name);
1483
+ } catch (_) {}
1484
+ }
1485
+ };
1486
+ /**
1487
+ * _neutralizeSubtree
1488
+ *
1489
+ * Completes the audit-5 F1 fix across every removal path. The KEEP_CONTENT
1490
+ * move-hoist neutralises only disallowed-tag removals; clobber, mXSS-canary,
1491
+ * namespace, comment, processing-instruction and KEEP_CONTENT:false removals
1492
+ * all drop their subtree wholesale via `_forceRemove`. On the IN_PLACE path
1493
+ * those dropped nodes are detached from the caller's LIVE tree but a
1494
+ * handler-bearing original among them (an `<img onerror>`/`<video>` that was
1495
+ * loading) keeps its queued resource event, which fires in page scope after
1496
+ * sanitize returns. This walks a removed subtree and strips every attribute
1497
+ * the active configuration does not allow — so `on*` handlers are cancelled
1498
+ * through the SAME allowlist that governs kept nodes, not a separate `/^on/`
1499
+ * blocklist. Run synchronously before sanitize returns, i.e. before any
1500
+ * queued event can fire. Hook-free by design: these nodes leave the output,
1501
+ * so firing attribute hooks for them would be surprising. Clobber-safe reads;
1502
+ * a doomed clobbered node may shadow `removeAttribute` (its own attributes are
1503
+ * irrelevant — it is discarded — while its non-clobbered descendants, e.g.
1504
+ * the `<img>`, are reached and scrubbed).
1505
+ *
1506
+ * @param root the root of a removed subtree to neutralise
1507
+ */
1508
+ const _neutralizeSubtree = function _neutralizeSubtree(root) {
1509
+ const stack = [root];
1510
+ while (stack.length > 0) {
1511
+ const node = stack.pop();
1512
+ if ((getNodeType ? getNodeType(node) : node.nodeType) === NODE_TYPE.element) _stripDisallowedAttributes(node);
1513
+ const childNodes = getChildNodes(node);
1514
+ if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
1515
+ }
1516
+ };
1517
+ /**
1518
+ * _initDocument
1519
+ *
1520
+ * @param dirty - a string of dirty markup
1521
+ * @return a DOM, filled with the dirty markup
1522
+ */
1523
+ const _initDocument = function _initDocument(dirty) {
1524
+ let doc = null;
1525
+ let leadingWhitespace = null;
1526
+ if (FORCE_BODY) dirty = "<remove></remove>" + dirty;
1527
+ else {
1528
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
1529
+ leadingWhitespace = matches && matches[0];
1530
+ }
1531
+ 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>";
1532
+ const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
1533
+ if (NAMESPACE === HTML_NAMESPACE) try {
1534
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
1535
+ } catch (_) {}
1536
+ if (!doc || !doc.documentElement) {
1537
+ doc = implementation.createDocument(NAMESPACE, "template", null);
1538
+ try {
1539
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
1540
+ } catch (_) {}
1541
+ }
1542
+ const body = doc.body || doc.documentElement;
1543
+ if (dirty && leadingWhitespace) body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
1544
+ if (NAMESPACE === HTML_NAMESPACE) return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
1545
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
1546
+ };
1547
+ /**
1548
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
1549
+ *
1550
+ * @param root The root element or node to start traversing on.
1551
+ * @return The created NodeIterator
1552
+ */
1553
+ const _createNodeIterator = function _createNodeIterator(root) {
1554
+ 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);
1555
+ };
1556
+ /**
1557
+ * Replace template expression syntax (mustache, ERB, template
1558
+ * literal) with a space; shared by all SAFE_FOR_TEMPLATES scrub
1559
+ * sites. Order matters: mustache, then ERB, then template literal.
1560
+ *
1561
+ * @param value the string to scrub
1562
+ * @returns the scrubbed string
1563
+ */
1564
+ const _stripTemplateExpressions = function _stripTemplateExpressions(value) {
1565
+ value = stringReplace(value, MUSTACHE_EXPR$1, " ");
1566
+ value = stringReplace(value, ERB_EXPR$1, " ");
1567
+ value = stringReplace(value, TMPLIT_EXPR$1, " ");
1568
+ return value;
1569
+ };
1570
+ /**
1571
+ * Strip template-engine expressions ({{...}}, ${...}, <%...%>) from the
1572
+ * character data of an element subtree. Used as the final safety net for
1573
+ * SAFE_FOR_TEMPLATES on every DOM-returning code path so that expressions
1574
+ * which only form after text-node normalization (e.g. fragments split across
1575
+ * stripped elements) cannot survive into a template-evaluating framework.
1576
+ *
1577
+ * Walks text/comment/CDATA/processing-instruction nodes and mutates `.data`
1578
+ * in place rather than round-tripping through innerHTML. This preserves
1579
+ * descendant node references (important for IN_PLACE callers), avoids a
1580
+ * serialize/reparse cycle, and reads literal character data — which means
1581
+ * `<%...%>` in text content matches the ERB regex against its real bytes
1582
+ * instead of the HTML-entity-escaped form innerHTML would produce.
1583
+ *
1584
+ * Attribute values are not visited here; SAFE_FOR_TEMPLATES handling for
1585
+ * attributes is performed during the per-node `_sanitizeAttributes` pass.
1586
+ *
1587
+ * @param node The root element whose character data should be scrubbed.
1588
+ */
1589
+ const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
1590
+ var _node$querySelectorAl;
1591
+ node.normalize();
1592
+ const walker = createNodeIterator.call(node.ownerDocument || node, node, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
1593
+ let currentNode = walker.nextNode();
1594
+ while (currentNode) {
1595
+ currentNode.data = _stripTemplateExpressions(currentNode.data);
1596
+ currentNode = walker.nextNode();
1597
+ }
1598
+ const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
1599
+ if (templates) arrayForEach(templates, (tmpl) => {
1600
+ if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
1601
+ });
1602
+ };
1603
+ /**
1604
+ * _isClobbered
1605
+ *
1606
+ * Detect DOM-clobbering on HTMLFormElement nodes. Form is the only HTML
1607
+ * interface with [LegacyOverrideBuiltIns]; a descendant element with a
1608
+ * `name` attribute matching a prototype property shadows that property
1609
+ * on direct reads. We use this check at the IN_PLACE entry-point and
1610
+ * during attribute sanitization to refuse clobbered forms.
1611
+ *
1612
+ * @param element element to check for clobbering attacks
1613
+ * @return true if clobbered, false if safe
1614
+ */
1615
+ const _isClobbered = function _isClobbered(element) {
1616
+ const realTagName = getNodeName ? getNodeName(element) : null;
1617
+ if (typeof realTagName !== "string") return false;
1618
+ if (transformCaseFunc(realTagName) !== "form") return false;
1619
+ return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || element.nodeType !== getNodeType(element) || element.childNodes !== getChildNodes(element);
1620
+ };
1621
+ /**
1622
+ * Checks whether the given value is a DocumentFragment from any realm.
1623
+ *
1624
+ * The realm-independent replacement reads `nodeType` through the cached
1625
+ * Node.prototype getter and compares to the DOCUMENT_FRAGMENT_NODE
1626
+ * constant (11). nodeType is a numeric value resolved from the node's
1627
+ * internal slot, identical across realms for the same kind of node.
1628
+ *
1629
+ * @param value object to check
1630
+ * @return true if value is a DocumentFragment-shaped node from any realm
1631
+ */
1632
+ const _isDocumentFragment = function _isDocumentFragment(value) {
1633
+ if (!getNodeType || typeof value !== "object" || value === null) return false;
1634
+ try {
1635
+ return getNodeType(value) === NODE_TYPE.documentFragment;
1636
+ } catch (_) {
1637
+ return false;
1638
+ }
1639
+ };
1640
+ /**
1641
+ * Checks whether the given object is a DOM node, including nodes that
1642
+ * originate from a different window/realm (e.g. an iframe's
1643
+ * contentDocument). The previous `value instanceof Node` check was
1644
+ * realm-bound: nodes from a different window failed it, causing
1645
+ * sanitize() to silently stringify them and reset IN_PLACE to false,
1646
+ * returning the original node unsanitized. See GHSA-4w3q-35jp-p934.
1647
+ *
1648
+ * @param value object to check whether it's a DOM node
1649
+ * @return true if value is a DOM node from any realm
1650
+ */
1651
+ const _isNode = function _isNode(value) {
1652
+ if (!getNodeType || typeof value !== "object" || value === null) return false;
1653
+ try {
1654
+ return typeof getNodeType(value) === "number";
1655
+ } catch (_) {
1656
+ return false;
1657
+ }
1658
+ };
1659
+ function _executeHooks(hooks, currentNode, data) {
1660
+ if (hooks.length === 0) return;
1661
+ arrayForEach(hooks, (hook) => {
1662
+ hook.call(DOMPurify, currentNode, data, CONFIG);
1663
+ });
1664
+ }
1665
+ /**
1666
+ * Structural-threat checks that condemn a node regardless of the
1667
+ * allowlists: mXSS via namespace confusion, risky CSS construction,
1668
+ * processing instructions, markup-bearing comments. Pure predicate;
1669
+ * the caller removes. Check order is load-bearing.
1670
+ *
1671
+ * @param currentNode the node to inspect
1672
+ * @param tagName the node's transformCaseFunc'd tag name
1673
+ * @return true if the node must be removed
1674
+ */
1675
+ const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName) {
1676
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
1677
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) return true;
1678
+ if (currentNode.nodeType === NODE_TYPE.processingInstruction) return true;
1679
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) return true;
1680
+ return false;
1681
+ };
1682
+ /**
1683
+ * Handle a node whose tag is forbidden or not allowlisted: keep
1684
+ * allowed custom elements (false return exits _sanitizeElements
1685
+ * early - namespace/fallback checks and the afterSanitizeElements
1686
+ * hook are intentionally skipped for kept custom elements), else
1687
+ * hoist content per KEEP_CONTENT and remove.
1688
+ *
1689
+ * @param currentNode the disallowed node
1690
+ * @param tagName the node's transformCaseFunc'd tag name
1691
+ * @return true if the node was removed, false if kept
1692
+ */
1693
+ const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName) {
1694
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
1695
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
1696
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
1697
+ }
1698
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1699
+ const parentNode = getParentNode(currentNode);
1700
+ const childNodes = getChildNodes(currentNode);
1701
+ if (childNodes && parentNode) {
1702
+ const childCount = childNodes.length;
1703
+ for (let i = childCount - 1; i >= 0; --i) {
1704
+ const hoisted = IN_PLACE ? childNodes[i] : cloneNode(childNodes[i], true);
1705
+ parentNode.insertBefore(hoisted, getNextSibling(currentNode));
1706
+ }
1707
+ }
1708
+ }
1709
+ _forceRemove(currentNode);
1710
+ return true;
1711
+ };
1712
+ /**
1713
+ * _sanitizeElements
1714
+ *
1715
+ * @protect nodeName
1716
+ * @protect textContent
1717
+ * @protect removeChild
1718
+ * @param currentNode to check for permission to exist
1719
+ * @return true if node was killed, false if left alive
1720
+ */
1721
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
1722
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
1723
+ if (_isClobbered(currentNode)) {
1724
+ _forceRemove(currentNode);
1725
+ return true;
1726
+ }
1727
+ const tagName = transformCaseFunc(getNodeName ? getNodeName(currentNode) : currentNode.nodeName);
1728
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
1729
+ tagName,
1730
+ allowedTags: ALLOWED_TAGS
1731
+ });
1732
+ if (_isUnsafeNode(currentNode, tagName)) {
1733
+ _forceRemove(currentNode);
1734
+ return true;
1735
+ }
1736
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) return _sanitizeDisallowedNode(currentNode, tagName);
1737
+ if ((getNodeType ? getNodeType(currentNode) : currentNode.nodeType) === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
1738
+ _forceRemove(currentNode);
1739
+ return true;
1740
+ }
1741
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
1742
+ _forceRemove(currentNode);
1743
+ return true;
1744
+ }
1745
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
1746
+ const content = _stripTemplateExpressions(currentNode.textContent);
1747
+ if (currentNode.textContent !== content) {
1748
+ arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
1749
+ currentNode.textContent = content;
1750
+ }
1751
+ }
1752
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1753
+ return false;
1754
+ };
1755
+ /**
1756
+ * _isValidAttribute
1757
+ *
1758
+ * @param lcTag Lowercase tag name of containing element.
1759
+ * @param lcName Lowercase attribute name.
1760
+ * @param value Attribute value.
1761
+ * @return Returns true if `value` is valid, otherwise false.
1762
+ */
1763
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1764
+ if (FORBID_ATTR[lcName]) return false;
1765
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) return false;
1766
+ const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
1767
+ if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName));
1768
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName));
1769
+ else if (!nameIsPermitted) if (_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value)));
1770
+ else return false;
1771
+ else if (URI_SAFE_ATTRIBUTES[lcName]);
1772
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, "")));
1773
+ else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]);
1774
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, "")));
1775
+ else if (value) return false;
1776
+ return true;
1777
+ };
1778
+ const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, [
1779
+ "annotation-xml",
1780
+ "color-profile",
1781
+ "font-face",
1782
+ "font-face-format",
1783
+ "font-face-name",
1784
+ "font-face-src",
1785
+ "font-face-uri",
1786
+ "missing-glyph"
1787
+ ]);
1788
+ /**
1789
+ * _isBasicCustomElement
1790
+ * checks if at least one dash is included in tagName, and it's not the first char
1791
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1792
+ *
1793
+ * @param tagName name of the tag of the node to sanitize
1794
+ * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
1795
+ */
1796
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
1797
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
1798
+ };
1799
+ /**
1800
+ * Wrap an attribute value in the matching Trusted Types object when
1801
+ * the active policy requires it. Namespaced attributes pass through
1802
+ * unchanged (no TT support yet, see
1803
+ * https://bugs.chromium.org/p/chromium/issues/detail?id=1305293).
1804
+ *
1805
+ * @param lcTag lowercase tag name of the containing element
1806
+ * @param lcName lowercase attribute name
1807
+ * @param namespaceURI the attribute's namespace, if any
1808
+ * @param value the attribute value to wrap
1809
+ * @return the value, wrapped when Trusted Types demand it
1810
+ */
1811
+ const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value) {
1812
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI) switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1813
+ case "TrustedHTML": return _createTrustedHTML(value);
1814
+ case "TrustedScriptURL": return _createTrustedScriptURL(value);
1815
+ }
1816
+ return value;
1817
+ };
1818
+ /**
1819
+ * Write a modified attribute value back onto the element. On
1820
+ * success, re-probe for clobbering introduced by the new value and
1821
+ * remove the element when found; otherwise pop the removal entry
1822
+ * recorded by the earlier _removeAttribute (long-standing pairing
1823
+ * with the SANITIZE_NAMED_PROPS path - do not "fix" casually). On
1824
+ * failure, remove the attribute instead.
1825
+ *
1826
+ * @param currentNode the element carrying the attribute
1827
+ * @param name the attribute name as present on the element
1828
+ * @param namespaceURI the attribute's namespace, if any
1829
+ * @param value the new attribute value
1830
+ */
1831
+ const _setAttributeValue = function _setAttributeValue(currentNode, name, namespaceURI, value) {
1832
+ try {
1833
+ if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
1834
+ else currentNode.setAttribute(name, value);
1835
+ if (_isClobbered(currentNode)) _forceRemove(currentNode);
1836
+ else arrayPop(DOMPurify.removed);
1837
+ } catch (_) {
1838
+ _removeAttribute(name, currentNode);
1839
+ }
1840
+ };
1841
+ /**
1842
+ * _sanitizeAttributes
1843
+ *
1844
+ * @protect attributes
1845
+ * @protect nodeName
1846
+ * @protect removeAttribute
1847
+ * @protect setAttribute
1848
+ *
1849
+ * @param currentNode to sanitize
1850
+ */
1851
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1852
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
1853
+ const attributes = currentNode.attributes;
1854
+ if (!attributes || _isClobbered(currentNode)) return;
1855
+ const hookEvent = {
1856
+ attrName: "",
1857
+ attrValue: "",
1858
+ keepAttr: true,
1859
+ allowedAttributes: ALLOWED_ATTR,
1860
+ forceKeepAttr: void 0
1861
+ };
1862
+ let l = attributes.length;
1863
+ const lcTag = transformCaseFunc(currentNode.nodeName);
1864
+ while (l--) {
1865
+ const attr = attributes[l];
1866
+ const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
1867
+ const lcName = transformCaseFunc(name);
1868
+ const initValue = attrValue;
1869
+ let value = name === "value" ? initValue : stringTrim(initValue);
1870
+ hookEvent.attrName = lcName;
1871
+ hookEvent.attrValue = value;
1872
+ hookEvent.keepAttr = true;
1873
+ hookEvent.forceKeepAttr = void 0;
1874
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
1875
+ value = hookEvent.attrValue;
1876
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
1877
+ _removeAttribute(name, currentNode);
1878
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1879
+ }
1880
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
1881
+ _removeAttribute(name, currentNode);
1882
+ continue;
1883
+ }
1884
+ if (lcName === "attributename" && stringMatch(value, "href")) {
1885
+ _removeAttribute(name, currentNode);
1886
+ continue;
1887
+ }
1888
+ if (hookEvent.forceKeepAttr) continue;
1889
+ if (!hookEvent.keepAttr) {
1890
+ _removeAttribute(name, currentNode);
1891
+ continue;
1892
+ }
1893
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
1894
+ _removeAttribute(name, currentNode);
1895
+ continue;
1896
+ }
1897
+ if (SAFE_FOR_TEMPLATES) value = _stripTemplateExpressions(value);
1898
+ if (!_isValidAttribute(lcTag, lcName, value)) {
1899
+ _removeAttribute(name, currentNode);
1900
+ continue;
1901
+ }
1902
+ value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
1903
+ if (value !== initValue) _setAttributeValue(currentNode, name, namespaceURI, value);
1904
+ }
1905
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
1906
+ };
1907
+ /**
1908
+ * _sanitizeShadowDOM
1909
+ *
1910
+ * @param fragment to iterate over recursively
1911
+ */
1912
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
1913
+ let shadowNode = null;
1914
+ const shadowIterator = _createNodeIterator(fragment);
1915
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
1916
+ while (shadowNode = shadowIterator.nextNode()) {
1917
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
1918
+ _sanitizeElements(shadowNode);
1919
+ _sanitizeAttributes(shadowNode);
1920
+ if (_isDocumentFragment(shadowNode.content)) _sanitizeShadowDOM2(shadowNode.content);
1921
+ if ((getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType) === NODE_TYPE.element) {
1922
+ const innerSr = getShadowRoot(shadowNode);
1923
+ if (_isDocumentFragment(innerSr)) {
1924
+ _sanitizeAttachedShadowRoots(innerSr);
1925
+ _sanitizeShadowDOM2(innerSr);
1926
+ }
1927
+ }
1928
+ }
1929
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
1930
+ };
1931
+ /**
1932
+ * _sanitizeAttachedShadowRoots
1933
+ *
1934
+ * Walks `root` and feeds every attached shadow root we encounter into
1935
+ * the existing _sanitizeShadowDOM pipeline. The default node iterator
1936
+ * does not descend into shadow trees, so nodes inside an attached
1937
+ * shadow root would otherwise be skipped entirely.
1938
+ *
1939
+ * Two real input paths put attached shadow roots in front of us:
1940
+ * 1. IN_PLACE on a DOM node that already has shadow roots attached.
1941
+ * 2. DOM-node input where importNode(dirty, true) deep-clones the
1942
+ * shadow root because it was created with `clonable: true`.
1943
+ *
1944
+ * This pass runs once, up front, so the main iteration loop (and the
1945
+ * existing _sanitizeShadowDOM template-content recursion) stay
1946
+ * untouched — string-input paths are not affected.
1947
+ *
1948
+ * @param root the subtree root to walk for attached shadow roots
1949
+ */
1950
+ const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots(root) {
1951
+ const stack = [{
1952
+ node: root,
1953
+ shadow: null
1954
+ }];
1955
+ while (stack.length > 0) {
1956
+ const item = stack.pop();
1957
+ if (item.shadow) {
1958
+ _sanitizeShadowDOM2(item.shadow);
1959
+ continue;
1960
+ }
1961
+ const node = item.node;
1962
+ const isElement = (getNodeType ? getNodeType(node) : node.nodeType) === NODE_TYPE.element;
1963
+ const childNodes = getChildNodes(node);
1964
+ if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push({
1965
+ node: childNodes[i],
1966
+ shadow: null
1967
+ });
1968
+ if (isElement) {
1969
+ const rootName = getNodeName ? getNodeName(node) : null;
1970
+ if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
1971
+ const content = node.content;
1972
+ if (_isDocumentFragment(content)) stack.push({
1973
+ node: content,
1974
+ shadow: null
1975
+ });
1976
+ }
1977
+ }
1978
+ if (isElement) {
1979
+ const sr = getShadowRoot(node);
1980
+ if (_isDocumentFragment(sr)) stack.push({
1981
+ node: null,
1982
+ shadow: sr
1983
+ }, {
1984
+ node: sr,
1985
+ shadow: null
1986
+ });
1987
+ }
1988
+ }
1989
+ };
1990
+ DOMPurify.sanitize = function(dirty) {
1991
+ let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1992
+ let body = null;
1993
+ let importedNode = null;
1994
+ let currentNode = null;
1995
+ let returnNode = null;
1996
+ IS_EMPTY_INPUT = !dirty;
1997
+ if (IS_EMPTY_INPUT) dirty = "<!-->";
1998
+ if (typeof dirty !== "string" && !_isNode(dirty)) {
1999
+ dirty = stringifyValue(dirty);
2000
+ if (typeof dirty !== "string") throw typeErrorCreate("dirty is not a string, aborting");
2001
+ }
2002
+ if (!DOMPurify.isSupported) return dirty;
2003
+ if (SET_CONFIG) {
2004
+ ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
2005
+ ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
2006
+ } else _parseConfig(cfg);
2007
+ if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) ALLOWED_TAGS = clone(ALLOWED_TAGS);
2008
+ if (hooks.uponSanitizeAttribute.length > 0) ALLOWED_ATTR = clone(ALLOWED_ATTR);
2009
+ DOMPurify.removed = [];
2010
+ const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
2011
+ if (inPlace) {
2012
+ const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName;
2013
+ if (typeof nn === "string") {
2014
+ const tagName = transformCaseFunc(nn);
2015
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
2016
+ }
2017
+ if (_isClobbered(dirty)) throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
2018
+ try {
2019
+ _sanitizeAttachedShadowRoots(dirty);
2020
+ } catch (error) {
2021
+ _neutralizeRoot(dirty);
2022
+ throw error;
2023
+ }
2024
+ } else if (_isNode(dirty)) {
2025
+ body = _initDocument("<!---->");
2026
+ importedNode = body.ownerDocument.importNode(dirty, true);
2027
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode;
2028
+ else if (importedNode.nodeName === "HTML") body = importedNode;
2029
+ else body.appendChild(importedNode);
2030
+ _sanitizeAttachedShadowRoots(importedNode);
2031
+ } else {
2032
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
2033
+ body = _initDocument(dirty);
2034
+ if (!body) return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
2035
+ }
2036
+ if (body && FORCE_BODY) _forceRemove(body.firstChild);
2037
+ const nodeIterator = _createNodeIterator(inPlace ? dirty : body);
2038
+ try {
2039
+ while (currentNode = nodeIterator.nextNode()) {
2040
+ _sanitizeElements(currentNode);
2041
+ _sanitizeAttributes(currentNode);
2042
+ if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content);
2043
+ }
2044
+ } catch (error) {
2045
+ if (inPlace) _neutralizeRoot(dirty);
2046
+ throw error;
2047
+ }
2048
+ if (inPlace) {
2049
+ arrayForEach(DOMPurify.removed, (entry) => {
2050
+ if (entry.element) _neutralizeSubtree(entry.element);
2051
+ });
2052
+ if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(dirty);
2053
+ return dirty;
2054
+ }
2055
+ if (RETURN_DOM) {
2056
+ if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(body);
2057
+ if (RETURN_DOM_FRAGMENT) {
2058
+ returnNode = createDocumentFragment.call(body.ownerDocument);
2059
+ while (body.firstChild) returnNode.appendChild(body.firstChild);
2060
+ } else returnNode = body;
2061
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) returnNode = importNode.call(originalDocument, returnNode, true);
2062
+ return returnNode;
2063
+ }
2064
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
2065
+ 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;
2066
+ if (SAFE_FOR_TEMPLATES) serializedHTML = _stripTemplateExpressions(serializedHTML);
2067
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
2068
+ };
2069
+ DOMPurify.setConfig = function() {
2070
+ _parseConfig(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {});
2071
+ SET_CONFIG = true;
2072
+ SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
2073
+ SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
2074
+ };
2075
+ DOMPurify.clearConfig = function() {
2076
+ CONFIG = null;
2077
+ SET_CONFIG = false;
2078
+ SET_CONFIG_ALLOWED_TAGS = null;
2079
+ SET_CONFIG_ALLOWED_ATTR = null;
2080
+ trustedTypesPolicy = defaultTrustedTypesPolicy;
2081
+ emptyHTML = "";
2082
+ };
2083
+ DOMPurify.isValidAttribute = function(tag, attr, value) {
2084
+ if (!CONFIG) _parseConfig({});
2085
+ return _isValidAttribute(transformCaseFunc(tag), transformCaseFunc(attr), value);
2086
+ };
2087
+ DOMPurify.addHook = function(entryPoint, hookFunction) {
2088
+ if (typeof hookFunction !== "function") return;
2089
+ if (!objectHasOwnProperty(hooks, entryPoint)) return;
2090
+ arrayPush(hooks[entryPoint], hookFunction);
2091
+ };
2092
+ DOMPurify.removeHook = function(entryPoint, hookFunction) {
2093
+ if (!objectHasOwnProperty(hooks, entryPoint)) return;
2094
+ if (hookFunction !== void 0) {
2095
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
2096
+ return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
2097
+ }
2098
+ return arrayPop(hooks[entryPoint]);
2099
+ };
2100
+ DOMPurify.removeHooks = function(entryPoint) {
2101
+ if (!objectHasOwnProperty(hooks, entryPoint)) return;
2102
+ hooks[entryPoint] = [];
2103
+ };
2104
+ DOMPurify.removeAllHooks = function() {
2105
+ hooks = _createHooksMap();
2106
+ };
2107
+ return DOMPurify;
2108
+ }
2109
+ var purify = createDOMPurify();
2110
+ //#endregion
2111
+ export { purify as t };