@inboxsdk/core 2.1.29 → 2.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/inboxsdk.js CHANGED
@@ -785,6 +785,36 @@ const get = function get(map, key) {
785
785
 
786
786
  /***/ }),
787
787
 
788
+ /***/ 9865:
789
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
790
+
791
+ "use strict";
792
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
793
+ /* harmony export */ "Z": () => (/* binding */ htmlToText)
794
+ /* harmony export */ });
795
+ /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7856);
796
+ /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dompurify__WEBPACK_IMPORTED_MODULE_0__);
797
+
798
+ const escapeHTMLPolicy = globalThis.trustedTypes?.createPolicy('inboxSdkEscapePolicy', {
799
+ createHTML: string => (0,dompurify__WEBPACK_IMPORTED_MODULE_0__.sanitize)(string)
800
+ }) ?? {
801
+ createHTML(string) {
802
+ return (0,dompurify__WEBPACK_IMPORTED_MODULE_0__.sanitize)(string);
803
+ }
804
+ };
805
+
806
+ /**
807
+ * Quick function for converting HTML with entities into text without
808
+ * introducing an XSS vulnerability.
809
+ */
810
+ function htmlToText(html) {
811
+ const div = document.createElement('div');
812
+ div.innerHTML = escapeHTMLPolicy.createHTML(html);
813
+ return div.textContent;
814
+ }
815
+
816
+ /***/ }),
817
+
788
818
  /***/ 3567:
789
819
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
790
820
 
@@ -814,7 +844,7 @@ function isElementVisible(el) {
814
844
 
815
845
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- SDK_VERSION is injected by webpack
816
846
  ///@ts-ignore
817
- const BUILD_VERSION = "2.1.29-1707947517546-0a2f60e3e3450a0e";
847
+ const BUILD_VERSION = "2.1.31-1708462517400-55033a21933cff6e";
818
848
  if (false) {}
819
849
 
820
850
  /***/ }),
@@ -1776,7 +1806,8 @@ const GmailElementGetter = {
1776
1806
  /* harmony import */ var lodash_last__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_last__WEBPACK_IMPORTED_MODULE_1__);
1777
1807
  /* harmony import */ var transducers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1095);
1778
1808
  /* harmony import */ var transducers_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(transducers_js__WEBPACK_IMPORTED_MODULE_2__);
1779
- /* harmony import */ var _common_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9817);
1809
+ /* harmony import */ var _common_html_to_text__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9865);
1810
+ /* harmony import */ var _common_assert__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9817);
1780
1811
 
1781
1812
 
1782
1813
 
@@ -4694,27 +4725,25 @@ var gmail_dropdown_view = __webpack_require__(2229);
4694
4725
 
4695
4726
 
4696
4727
 
4697
- function addButton(gmailComposeView, buttonDescriptorStream, groupOrderHint, extraOnClickOptions) {
4698
- return new Promise(resolve => {
4699
- let buttonViewController;
4700
- buttonDescriptorStream.takeUntilBy(gmailComposeView.getStopper()).onValue(buttonDescriptor => {
4701
- const buttonOptions = _processButtonDescriptor(buttonDescriptor, extraOnClickOptions, gmailComposeView.getGmailDriver());
4702
- if (!buttonViewController) {
4703
- if (buttonOptions) {
4704
- buttonViewController = _addButton(gmailComposeView, buttonOptions, groupOrderHint);
4705
- resolve({
4706
- buttonViewController: buttonViewController,
4707
- buttonDescriptor: buttonDescriptor
4708
- });
4709
- }
4710
- } else {
4711
- // This
4712
- buttonViewController.update(buttonOptions);
4728
+ function addButton(gmailComposeView, buttonDescriptorStream, groupOrderHint, extraOnClickOptions, bus) {
4729
+ let buttonViewController;
4730
+ buttonDescriptorStream.takeUntilBy(gmailComposeView.getStopper()).onValue(buttonDescriptor => {
4731
+ const buttonOptions = _processButtonDescriptor(buttonDescriptor, extraOnClickOptions, gmailComposeView.getGmailDriver());
4732
+ if (buttonViewController instanceof dropdown_button_view_controller/* default */.Z && buttonOptions?.hasDropdown !== true || buttonViewController instanceof basic_button_view_controller/* default */.Z && buttonOptions?.hasDropdown === true) {
4733
+ buttonViewController.destroy();
4734
+ buttonViewController = undefined;
4735
+ }
4736
+ if (!buttonViewController) {
4737
+ if (buttonOptions) {
4738
+ buttonViewController = _addButton(gmailComposeView, buttonOptions, groupOrderHint);
4739
+ bus.emit({
4740
+ buttonViewController: buttonViewController,
4741
+ buttonDescriptor: buttonDescriptor
4742
+ });
4713
4743
  }
4714
- }).onEnd(() => {
4715
- // Just in case things end without ever resolving above.
4716
- resolve(null);
4717
- });
4744
+ } else {
4745
+ buttonViewController.update(buttonOptions);
4746
+ }
4718
4747
  });
4719
4748
  }
4720
4749
  function _addButton(gmailComposeView, buttonOptions, groupOrderHint) {
@@ -6030,8 +6059,8 @@ class GmailComposeView {
6030
6059
  setFromEmail(email) {
6031
6060
  setFromEmail(this.#driver, this, email);
6032
6061
  }
6033
- addButton(buttonDescriptor, groupOrderHint, extraOnClickOptions) {
6034
- return addButton(this, buttonDescriptor, groupOrderHint, extraOnClickOptions);
6062
+ addButton(buttonDescriptor, groupOrderHint, extraOnClickOptions, bus) {
6063
+ addButton(this, buttonDescriptor, groupOrderHint, extraOnClickOptions, bus);
6035
6064
  }
6036
6065
  addTooltipToButton(buttonViewController, buttonDescriptor, tooltipDescriptor) {
6037
6066
  var tooltip = addTooltipToButton(this, buttonViewController, buttonDescriptor, tooltipDescriptor);
@@ -10529,7 +10558,7 @@ options.insert = htmlElement => {
10529
10558
  htmlElement.setAttribute('data-inboxsdk-version',
10530
10559
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
10531
10560
  ///@ts-ignore
10532
- "2.1.29-1707947517546-0a2f60e3e3450a0e");
10561
+ "2.1.31-1708462517400-55033a21933cff6e");
10533
10562
  document.head.append(htmlElement);
10534
10563
  };
10535
10564
  options.domAPI = (styleDomAPI_default());
@@ -11671,7 +11700,7 @@ if (!globalThis.__InboxSDKImpLoader) {
11671
11700
  await onready;
11672
11701
  const {
11673
11702
  makePlatformImplementation
11674
- } = await Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 6801));
11703
+ } = await Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 9046));
11675
11704
  return makePlatformImplementation(appId, opts, {
11676
11705
  piMainStarted,
11677
11706
  piLoadStarted,
@@ -12366,7 +12395,7 @@ function _updateNavMenu(members, newRouteViewDriver) {
12366
12395
 
12367
12396
  /***/ }),
12368
12397
 
12369
- /***/ 6801:
12398
+ /***/ 9046:
12370
12399
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
12371
12400
 
12372
12401
  "use strict";
@@ -19241,7 +19270,7 @@ options.insert = htmlElement => {
19241
19270
  htmlElement.setAttribute('data-inboxsdk-version',
19242
19271
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- this is injected by webpack
19243
19272
  ///@ts-ignore
19244
- "2.1.29-1707947517546-0a2f60e3e3450a0e");
19273
+ "2.1.31-1708462517400-55033a21933cff6e");
19245
19274
  document.head.append(htmlElement);
19246
19275
  };
19247
19276
  options.domAPI = (styleDomAPI_default());
@@ -20112,14 +20141,8 @@ function encodeDraftUrlId(syncThreadId, syncMessageId) {
20112
20141
  }
20113
20142
  // EXTERNAL MODULE: ./src/platform-implementation-js/driver-common/getOriginalMessagePage.ts
20114
20143
  var getOriginalMessagePage = __webpack_require__(8102);
20115
- ;// CONCATENATED MODULE: ./src/common/html-to-text.ts
20116
- // Quick function for converting HTML with entities into text without
20117
- // introducing an XSS vulnerability.
20118
- function htmlToText(html) {
20119
- const div = document.createElement('div');
20120
- div.innerHTML = html.replace(/<[^>]*>?/g, '');
20121
- return div.textContent;
20122
- }
20144
+ // EXTERNAL MODULE: ./src/common/html-to-text.ts
20145
+ var html_to_text = __webpack_require__(9865);
20123
20146
  ;// CONCATENATED MODULE: ./src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-rfc-message-id-for-gmail-message-id.ts
20124
20147
 
20125
20148
 
@@ -20131,7 +20154,7 @@ async function getRfcMessageIdForGmailMessageId(driver, gmailMessageId) {
20131
20154
  if (!match) {
20132
20155
  throw new Error("Failed to find rfc id for gmail thread id. Message may not exist in user's account.");
20133
20156
  }
20134
- return htmlToText(match[1]);
20157
+ return (0,html_to_text/* default */.Z)(match[1]);
20135
20158
  }
20136
20159
  ;// CONCATENATED MODULE: ./src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.ts
20137
20160
 
@@ -24167,15 +24190,16 @@ var get_or_fail = __webpack_require__(7791);
24167
24190
  const memberMap = new WeakMap();
24168
24191
  class ComposeButtonView extends safe_event_emitter/* default */.Z {
24169
24192
  destroyed = false;
24170
- constructor(optionsPromise, composeViewDriver, driver) {
24193
+ #addedEventBus;
24194
+ constructor(addedEventBus, composeViewDriver, driver) {
24171
24195
  super();
24196
+ this.#addedEventBus = addedEventBus;
24172
24197
  const members = {
24173
- optionsPromise,
24174
24198
  composeViewDriver,
24175
24199
  driver
24176
24200
  };
24177
24201
  memberMap.set(this, members);
24178
- members.optionsPromise.then(options => {
24202
+ this.#addedEventBus.toProperty().onValue(options => {
24179
24203
  if (!options) {
24180
24204
  _destroy(this);
24181
24205
  return;
@@ -24190,14 +24214,14 @@ class ComposeButtonView extends safe_event_emitter/* default */.Z {
24190
24214
  members.driver.getLogger().eventSdkPassive('ComposeButtonView.showTooltip', {
24191
24215
  keys: Object.keys(tooltipDescriptor)
24192
24216
  });
24193
- members.optionsPromise.then(options => {
24217
+ this.#addedEventBus.onValue(options => {
24194
24218
  if (!options) return;
24195
24219
  members.composeViewDriver.addTooltipToButton(options.buttonViewController, options.buttonDescriptor, tooltipDescriptor);
24196
24220
  });
24197
24221
  }
24198
24222
  closeTooltip() {
24199
24223
  const members = (0,get_or_fail/* default */.Z)(memberMap, this);
24200
- members.optionsPromise.then(options => {
24224
+ this.#addedEventBus.onValue(options => {
24201
24225
  if (!options) return;
24202
24226
  members.composeViewDriver.closeButtonTooltip(options.buttonViewController);
24203
24227
  });
@@ -24207,6 +24231,9 @@ function _destroy(composeButtonViewInstance) {
24207
24231
  composeButtonViewInstance.destroyed = true;
24208
24232
  composeButtonViewInstance.emit('destroy');
24209
24233
  }
24234
+ // EXTERNAL MODULE: ./node_modules/kefir-bus/index.js
24235
+ var kefir_bus = __webpack_require__(3652);
24236
+ var kefir_bus_default = /*#__PURE__*/__webpack_require__.n(kefir_bus);
24210
24237
  ;// CONCATENATED MODULE: ./src/platform-implementation-js/views/compose-view.ts
24211
24238
  /* module decorator */ module = __webpack_require__.hmd(module);
24212
24239
 
@@ -24215,6 +24242,7 @@ function _destroy(composeButtonViewInstance) {
24215
24242
 
24216
24243
 
24217
24244
 
24245
+
24218
24246
  const compose_view_memberMap = js.defonce(module, () => new WeakMap());
24219
24247
  class ComposeView extends safe_event_emitter/* default */.Z {
24220
24248
  destroyed = false;
@@ -24264,10 +24292,15 @@ class ComposeView extends safe_event_emitter/* default */.Z {
24264
24292
  addButton(buttonDescriptor) {
24265
24293
  const members = (0,get_or_fail/* default */.Z)(compose_view_memberMap, this);
24266
24294
  const buttonDescriptorStream = kefir_cast_default()(kefir_esm["default"], buttonDescriptor);
24267
- const optionsPromise = members.composeViewImplementation.addButton(buttonDescriptorStream, members.driver.getAppId(), {
24295
+ const bus = kefir_bus_default()();
24296
+ members.composeViewImplementation.addButton(buttonDescriptorStream, members.driver.getAppId(), {
24268
24297
  composeView: this
24298
+ }, bus);
24299
+ const view = new ComposeButtonView(bus, members.composeViewImplementation, members.driver);
24300
+ view.on('destroy', () => {
24301
+ bus.end();
24269
24302
  });
24270
- return new ComposeButtonView(optionsPromise, members.composeViewImplementation, members.driver);
24303
+ return view;
24271
24304
  }
24272
24305
  addComposeNotice(composeNoticeDescriptor) {
24273
24306
  return (0,get_or_fail/* default */.Z)(compose_view_memberMap, this).composeViewImplementation.addComposeNotice(composeNoticeDescriptor);
@@ -37757,6 +37790,1522 @@ var __WEBPACK_AMD_DEFINE_RESULT__;;(function (globalScope) {
37757
37790
  })(this);
37758
37791
 
37759
37792
 
37793
+ /***/ }),
37794
+
37795
+ /***/ 7856:
37796
+ /***/ (function(module) {
37797
+
37798
+ /*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */
37799
+
37800
+ (function (global, factory) {
37801
+ true ? module.exports = factory() :
37802
+ 0;
37803
+ })(this, (function () { 'use strict';
37804
+
37805
+ const {
37806
+ entries,
37807
+ setPrototypeOf,
37808
+ isFrozen,
37809
+ getPrototypeOf,
37810
+ getOwnPropertyDescriptor
37811
+ } = Object;
37812
+ let {
37813
+ freeze,
37814
+ seal,
37815
+ create
37816
+ } = Object; // eslint-disable-line import/no-mutable-exports
37817
+ let {
37818
+ apply,
37819
+ construct
37820
+ } = typeof Reflect !== 'undefined' && Reflect;
37821
+ if (!freeze) {
37822
+ freeze = function freeze(x) {
37823
+ return x;
37824
+ };
37825
+ }
37826
+ if (!seal) {
37827
+ seal = function seal(x) {
37828
+ return x;
37829
+ };
37830
+ }
37831
+ if (!apply) {
37832
+ apply = function apply(fun, thisValue, args) {
37833
+ return fun.apply(thisValue, args);
37834
+ };
37835
+ }
37836
+ if (!construct) {
37837
+ construct = function construct(Func, args) {
37838
+ return new Func(...args);
37839
+ };
37840
+ }
37841
+ const arrayForEach = unapply(Array.prototype.forEach);
37842
+ const arrayPop = unapply(Array.prototype.pop);
37843
+ const arrayPush = unapply(Array.prototype.push);
37844
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
37845
+ const stringToString = unapply(String.prototype.toString);
37846
+ const stringMatch = unapply(String.prototype.match);
37847
+ const stringReplace = unapply(String.prototype.replace);
37848
+ const stringIndexOf = unapply(String.prototype.indexOf);
37849
+ const stringTrim = unapply(String.prototype.trim);
37850
+ const regExpTest = unapply(RegExp.prototype.test);
37851
+ const typeErrorCreate = unconstruct(TypeError);
37852
+
37853
+ /**
37854
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
37855
+ *
37856
+ * @param {Function} func - The function to be wrapped and called.
37857
+ * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.
37858
+ */
37859
+ function unapply(func) {
37860
+ return function (thisArg) {
37861
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
37862
+ args[_key - 1] = arguments[_key];
37863
+ }
37864
+ return apply(func, thisArg, args);
37865
+ };
37866
+ }
37867
+
37868
+ /**
37869
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
37870
+ *
37871
+ * @param {Function} func - The constructor function to be wrapped and called.
37872
+ * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.
37873
+ */
37874
+ function unconstruct(func) {
37875
+ return function () {
37876
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
37877
+ args[_key2] = arguments[_key2];
37878
+ }
37879
+ return construct(func, args);
37880
+ };
37881
+ }
37882
+
37883
+ /**
37884
+ * Add properties to a lookup table
37885
+ *
37886
+ * @param {Object} set - The set to which elements will be added.
37887
+ * @param {Array} array - The array containing elements to be added to the set.
37888
+ * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.
37889
+ * @returns {Object} The modified set with added elements.
37890
+ */
37891
+ function addToSet(set, array) {
37892
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
37893
+ if (setPrototypeOf) {
37894
+ // Make 'in' and truthy checks like Boolean(set.constructor)
37895
+ // independent of any properties defined on Object.prototype.
37896
+ // Prevent prototype setters from intercepting set as a this value.
37897
+ setPrototypeOf(set, null);
37898
+ }
37899
+ let l = array.length;
37900
+ while (l--) {
37901
+ let element = array[l];
37902
+ if (typeof element === 'string') {
37903
+ const lcElement = transformCaseFunc(element);
37904
+ if (lcElement !== element) {
37905
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
37906
+ if (!isFrozen(array)) {
37907
+ array[l] = lcElement;
37908
+ }
37909
+ element = lcElement;
37910
+ }
37911
+ }
37912
+ set[element] = true;
37913
+ }
37914
+ return set;
37915
+ }
37916
+
37917
+ /**
37918
+ * Clean up an array to harden against CSPP
37919
+ *
37920
+ * @param {Array} array - The array to be cleaned.
37921
+ * @returns {Array} The cleaned version of the array
37922
+ */
37923
+ function cleanArray(array) {
37924
+ for (let index = 0; index < array.length; index++) {
37925
+ if (getOwnPropertyDescriptor(array, index) === undefined) {
37926
+ array[index] = null;
37927
+ }
37928
+ }
37929
+ return array;
37930
+ }
37931
+
37932
+ /**
37933
+ * Shallow clone an object
37934
+ *
37935
+ * @param {Object} object - The object to be cloned.
37936
+ * @returns {Object} A new object that copies the original.
37937
+ */
37938
+ function clone(object) {
37939
+ const newObject = create(null);
37940
+ for (const [property, value] of entries(object)) {
37941
+ if (getOwnPropertyDescriptor(object, property) !== undefined) {
37942
+ if (Array.isArray(value)) {
37943
+ newObject[property] = cleanArray(value);
37944
+ } else if (value && typeof value === 'object' && value.constructor === Object) {
37945
+ newObject[property] = clone(value);
37946
+ } else {
37947
+ newObject[property] = value;
37948
+ }
37949
+ }
37950
+ }
37951
+ return newObject;
37952
+ }
37953
+
37954
+ /**
37955
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
37956
+ *
37957
+ * @param {Object} object - The object to look up the getter function in its prototype chain.
37958
+ * @param {String} prop - The property name for which to find the getter function.
37959
+ * @returns {Function} The getter function found in the prototype chain or a fallback function.
37960
+ */
37961
+ function lookupGetter(object, prop) {
37962
+ while (object !== null) {
37963
+ const desc = getOwnPropertyDescriptor(object, prop);
37964
+ if (desc) {
37965
+ if (desc.get) {
37966
+ return unapply(desc.get);
37967
+ }
37968
+ if (typeof desc.value === 'function') {
37969
+ return unapply(desc.value);
37970
+ }
37971
+ }
37972
+ object = getPrototypeOf(object);
37973
+ }
37974
+ function fallbackValue(element) {
37975
+ console.warn('fallback value for', element);
37976
+ return null;
37977
+ }
37978
+ return fallbackValue;
37979
+ }
37980
+
37981
+ const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
37982
+
37983
+ // SVG
37984
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
37985
+ const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
37986
+
37987
+ // List of SVG elements that are disallowed by default.
37988
+ // We still need to know them so that we can do namespace
37989
+ // checks properly in case one wants to add them to
37990
+ // allow-list.
37991
+ const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
37992
+ const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);
37993
+
37994
+ // Similarly to SVG, we want to know all MathML elements,
37995
+ // even those that we disallow by default.
37996
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
37997
+ const text = freeze(['#text']);
37998
+
37999
+ const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);
38000
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
38001
+ const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
38002
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
38003
+
38004
+ // eslint-disable-next-line unicorn/better-regex
38005
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
38006
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
38007
+ const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
38008
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
38009
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
38010
+ const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
38011
+ );
38012
+
38013
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
38014
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
38015
+ );
38016
+
38017
+ const DOCTYPE_NAME = seal(/^html$/i);
38018
+
38019
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
38020
+ __proto__: null,
38021
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
38022
+ ERB_EXPR: ERB_EXPR,
38023
+ TMPLIT_EXPR: TMPLIT_EXPR,
38024
+ DATA_ATTR: DATA_ATTR,
38025
+ ARIA_ATTR: ARIA_ATTR,
38026
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
38027
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
38028
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
38029
+ DOCTYPE_NAME: DOCTYPE_NAME
38030
+ });
38031
+
38032
+ const getGlobal = function getGlobal() {
38033
+ return typeof window === 'undefined' ? null : window;
38034
+ };
38035
+
38036
+ /**
38037
+ * Creates a no-op policy for internal use only.
38038
+ * Don't export this function outside this module!
38039
+ * @param {TrustedTypePolicyFactory} trustedTypes The policy factory.
38040
+ * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
38041
+ * @return {TrustedTypePolicy} The policy created (or null, if Trusted Types
38042
+ * are not supported or creating the policy failed).
38043
+ */
38044
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
38045
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
38046
+ return null;
38047
+ }
38048
+
38049
+ // Allow the callers to control the unique policy name
38050
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
38051
+ // Policy creation with duplicate names throws in Trusted Types.
38052
+ let suffix = null;
38053
+ const ATTR_NAME = 'data-tt-policy-suffix';
38054
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
38055
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
38056
+ }
38057
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
38058
+ try {
38059
+ return trustedTypes.createPolicy(policyName, {
38060
+ createHTML(html) {
38061
+ return html;
38062
+ },
38063
+ createScriptURL(scriptUrl) {
38064
+ return scriptUrl;
38065
+ }
38066
+ });
38067
+ } catch (_) {
38068
+ // Policy creation failed (most likely another DOMPurify script has
38069
+ // already run). Skip creating the policy, as this will only cause errors
38070
+ // if TT are enforced.
38071
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
38072
+ return null;
38073
+ }
38074
+ };
38075
+ function createDOMPurify() {
38076
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
38077
+ const DOMPurify = root => createDOMPurify(root);
38078
+
38079
+ /**
38080
+ * Version label, exposed for easier checks
38081
+ * if DOMPurify is up to date or not
38082
+ */
38083
+ DOMPurify.version = '3.0.8';
38084
+
38085
+ /**
38086
+ * Array of elements that DOMPurify removed during sanitation.
38087
+ * Empty if nothing was removed.
38088
+ */
38089
+ DOMPurify.removed = [];
38090
+ if (!window || !window.document || window.document.nodeType !== 9) {
38091
+ // Not running in a browser, provide a factory function
38092
+ // so that you can pass your own Window
38093
+ DOMPurify.isSupported = false;
38094
+ return DOMPurify;
38095
+ }
38096
+ let {
38097
+ document
38098
+ } = window;
38099
+ const originalDocument = document;
38100
+ const currentScript = originalDocument.currentScript;
38101
+ const {
38102
+ DocumentFragment,
38103
+ HTMLTemplateElement,
38104
+ Node,
38105
+ Element,
38106
+ NodeFilter,
38107
+ NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
38108
+ HTMLFormElement,
38109
+ DOMParser,
38110
+ trustedTypes
38111
+ } = window;
38112
+ const ElementPrototype = Element.prototype;
38113
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
38114
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
38115
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
38116
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
38117
+
38118
+ // As per issue #47, the web-components registry is inherited by a
38119
+ // new document created via createHTMLDocument. As per the spec
38120
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
38121
+ // a new empty registry is used when creating a template contents owner
38122
+ // document, so we use that as our parent document to ensure nothing
38123
+ // is inherited.
38124
+ if (typeof HTMLTemplateElement === 'function') {
38125
+ const template = document.createElement('template');
38126
+ if (template.content && template.content.ownerDocument) {
38127
+ document = template.content.ownerDocument;
38128
+ }
38129
+ }
38130
+ let trustedTypesPolicy;
38131
+ let emptyHTML = '';
38132
+ const {
38133
+ implementation,
38134
+ createNodeIterator,
38135
+ createDocumentFragment,
38136
+ getElementsByTagName
38137
+ } = document;
38138
+ const {
38139
+ importNode
38140
+ } = originalDocument;
38141
+ let hooks = {};
38142
+
38143
+ /**
38144
+ * Expose whether this browser supports running the full DOMPurify.
38145
+ */
38146
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
38147
+ const {
38148
+ MUSTACHE_EXPR,
38149
+ ERB_EXPR,
38150
+ TMPLIT_EXPR,
38151
+ DATA_ATTR,
38152
+ ARIA_ATTR,
38153
+ IS_SCRIPT_OR_DATA,
38154
+ ATTR_WHITESPACE
38155
+ } = EXPRESSIONS;
38156
+ let {
38157
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
38158
+ } = EXPRESSIONS;
38159
+
38160
+ /**
38161
+ * We consider the elements and attributes below to be safe. Ideally
38162
+ * don't add any new ones but feel free to remove unwanted ones.
38163
+ */
38164
+
38165
+ /* allowed element names */
38166
+ let ALLOWED_TAGS = null;
38167
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
38168
+
38169
+ /* Allowed attribute names */
38170
+ let ALLOWED_ATTR = null;
38171
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
38172
+
38173
+ /*
38174
+ * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
38175
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
38176
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
38177
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
38178
+ */
38179
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
38180
+ tagNameCheck: {
38181
+ writable: true,
38182
+ configurable: false,
38183
+ enumerable: true,
38184
+ value: null
38185
+ },
38186
+ attributeNameCheck: {
38187
+ writable: true,
38188
+ configurable: false,
38189
+ enumerable: true,
38190
+ value: null
38191
+ },
38192
+ allowCustomizedBuiltInElements: {
38193
+ writable: true,
38194
+ configurable: false,
38195
+ enumerable: true,
38196
+ value: false
38197
+ }
38198
+ }));
38199
+
38200
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
38201
+ let FORBID_TAGS = null;
38202
+
38203
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
38204
+ let FORBID_ATTR = null;
38205
+
38206
+ /* Decide if ARIA attributes are okay */
38207
+ let ALLOW_ARIA_ATTR = true;
38208
+
38209
+ /* Decide if custom data attributes are okay */
38210
+ let ALLOW_DATA_ATTR = true;
38211
+
38212
+ /* Decide if unknown protocols are okay */
38213
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
38214
+
38215
+ /* Decide if self-closing tags in attributes are allowed.
38216
+ * Usually removed due to a mXSS issue in jQuery 3.0 */
38217
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
38218
+
38219
+ /* Output should be safe for common template engines.
38220
+ * This means, DOMPurify removes data attributes, mustaches and ERB
38221
+ */
38222
+ let SAFE_FOR_TEMPLATES = false;
38223
+
38224
+ /* Decide if document with <html>... should be returned */
38225
+ let WHOLE_DOCUMENT = false;
38226
+
38227
+ /* Track whether config is already set on this instance of DOMPurify. */
38228
+ let SET_CONFIG = false;
38229
+
38230
+ /* Decide if all elements (e.g. style, script) must be children of
38231
+ * document.body. By default, browsers might move them to document.head */
38232
+ let FORCE_BODY = false;
38233
+
38234
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
38235
+ * string (or a TrustedHTML object if Trusted Types are supported).
38236
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
38237
+ */
38238
+ let RETURN_DOM = false;
38239
+
38240
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
38241
+ * string (or a TrustedHTML object if Trusted Types are supported) */
38242
+ let RETURN_DOM_FRAGMENT = false;
38243
+
38244
+ /* Try to return a Trusted Type object instead of a string, return a string in
38245
+ * case Trusted Types are not supported */
38246
+ let RETURN_TRUSTED_TYPE = false;
38247
+
38248
+ /* Output should be free from DOM clobbering attacks?
38249
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
38250
+ */
38251
+ let SANITIZE_DOM = true;
38252
+
38253
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
38254
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
38255
+ *
38256
+ * HTML/DOM spec rules that enable DOM Clobbering:
38257
+ * - Named Access on Window (§7.3.3)
38258
+ * - DOM Tree Accessors (§3.1.5)
38259
+ * - Form Element Parent-Child Relations (§4.10.3)
38260
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
38261
+ * - HTMLCollection (§4.2.10.2)
38262
+ *
38263
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
38264
+ * with a constant string, i.e., `user-content-`
38265
+ */
38266
+ let SANITIZE_NAMED_PROPS = false;
38267
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
38268
+
38269
+ /* Keep element content when removing element? */
38270
+ let KEEP_CONTENT = true;
38271
+
38272
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
38273
+ * of importing it into a new Document and returning a sanitized copy */
38274
+ let IN_PLACE = false;
38275
+
38276
+ /* Allow usage of profiles like html, svg and mathMl */
38277
+ let USE_PROFILES = {};
38278
+
38279
+ /* Tags to ignore content of when KEEP_CONTENT is true */
38280
+ let FORBID_CONTENTS = null;
38281
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
38282
+
38283
+ /* Tags that are safe for data: URIs */
38284
+ let DATA_URI_TAGS = null;
38285
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
38286
+
38287
+ /* Attributes safe for values like "javascript:" */
38288
+ let URI_SAFE_ATTRIBUTES = null;
38289
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
38290
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
38291
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
38292
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
38293
+ /* Document namespace */
38294
+ let NAMESPACE = HTML_NAMESPACE;
38295
+ let IS_EMPTY_INPUT = false;
38296
+
38297
+ /* Allowed XHTML+XML namespaces */
38298
+ let ALLOWED_NAMESPACES = null;
38299
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
38300
+
38301
+ /* Parsing of strict XHTML documents */
38302
+ let PARSER_MEDIA_TYPE = null;
38303
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
38304
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
38305
+ let transformCaseFunc = null;
38306
+
38307
+ /* Keep a reference to config to pass to hooks */
38308
+ let CONFIG = null;
38309
+
38310
+ /* Ideally, do not touch anything below this line */
38311
+ /* ______________________________________________ */
38312
+
38313
+ const formElement = document.createElement('form');
38314
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
38315
+ return testValue instanceof RegExp || testValue instanceof Function;
38316
+ };
38317
+
38318
+ /**
38319
+ * _parseConfig
38320
+ *
38321
+ * @param {Object} cfg optional config literal
38322
+ */
38323
+ // eslint-disable-next-line complexity
38324
+ const _parseConfig = function _parseConfig() {
38325
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
38326
+ if (CONFIG && CONFIG === cfg) {
38327
+ return;
38328
+ }
38329
+
38330
+ /* Shield configuration object from tampering */
38331
+ if (!cfg || typeof cfg !== 'object') {
38332
+ cfg = {};
38333
+ }
38334
+
38335
+ /* Shield configuration object from prototype pollution */
38336
+ cfg = clone(cfg);
38337
+ PARSER_MEDIA_TYPE =
38338
+ // eslint-disable-next-line unicorn/prefer-includes
38339
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
38340
+
38341
+ // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
38342
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
38343
+
38344
+ /* Set configuration parameters */
38345
+ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
38346
+ ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
38347
+ ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
38348
+ URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),
38349
+ // eslint-disable-line indent
38350
+ cfg.ADD_URI_SAFE_ATTR,
38351
+ // eslint-disable-line indent
38352
+ transformCaseFunc // eslint-disable-line indent
38353
+ ) // eslint-disable-line indent
38354
+ : DEFAULT_URI_SAFE_ATTRIBUTES;
38355
+ DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS),
38356
+ // eslint-disable-line indent
38357
+ cfg.ADD_DATA_URI_TAGS,
38358
+ // eslint-disable-line indent
38359
+ transformCaseFunc // eslint-disable-line indent
38360
+ ) // eslint-disable-line indent
38361
+ : DEFAULT_DATA_URI_TAGS;
38362
+ FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
38363
+ FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
38364
+ FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
38365
+ USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
38366
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
38367
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
38368
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
38369
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
38370
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
38371
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
38372
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
38373
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
38374
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
38375
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
38376
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
38377
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
38378
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
38379
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
38380
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
38381
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
38382
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
38383
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
38384
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
38385
+ }
38386
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
38387
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
38388
+ }
38389
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
38390
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
38391
+ }
38392
+ if (SAFE_FOR_TEMPLATES) {
38393
+ ALLOW_DATA_ATTR = false;
38394
+ }
38395
+ if (RETURN_DOM_FRAGMENT) {
38396
+ RETURN_DOM = true;
38397
+ }
38398
+
38399
+ /* Parse profile info */
38400
+ if (USE_PROFILES) {
38401
+ ALLOWED_TAGS = addToSet({}, text);
38402
+ ALLOWED_ATTR = [];
38403
+ if (USE_PROFILES.html === true) {
38404
+ addToSet(ALLOWED_TAGS, html$1);
38405
+ addToSet(ALLOWED_ATTR, html);
38406
+ }
38407
+ if (USE_PROFILES.svg === true) {
38408
+ addToSet(ALLOWED_TAGS, svg$1);
38409
+ addToSet(ALLOWED_ATTR, svg);
38410
+ addToSet(ALLOWED_ATTR, xml);
38411
+ }
38412
+ if (USE_PROFILES.svgFilters === true) {
38413
+ addToSet(ALLOWED_TAGS, svgFilters);
38414
+ addToSet(ALLOWED_ATTR, svg);
38415
+ addToSet(ALLOWED_ATTR, xml);
38416
+ }
38417
+ if (USE_PROFILES.mathMl === true) {
38418
+ addToSet(ALLOWED_TAGS, mathMl$1);
38419
+ addToSet(ALLOWED_ATTR, mathMl);
38420
+ addToSet(ALLOWED_ATTR, xml);
38421
+ }
38422
+ }
38423
+
38424
+ /* Merge configuration parameters */
38425
+ if (cfg.ADD_TAGS) {
38426
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
38427
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
38428
+ }
38429
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
38430
+ }
38431
+ if (cfg.ADD_ATTR) {
38432
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
38433
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
38434
+ }
38435
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
38436
+ }
38437
+ if (cfg.ADD_URI_SAFE_ATTR) {
38438
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
38439
+ }
38440
+ if (cfg.FORBID_CONTENTS) {
38441
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
38442
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
38443
+ }
38444
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
38445
+ }
38446
+
38447
+ /* Add #text in case KEEP_CONTENT is set to true */
38448
+ if (KEEP_CONTENT) {
38449
+ ALLOWED_TAGS['#text'] = true;
38450
+ }
38451
+
38452
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
38453
+ if (WHOLE_DOCUMENT) {
38454
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
38455
+ }
38456
+
38457
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
38458
+ if (ALLOWED_TAGS.table) {
38459
+ addToSet(ALLOWED_TAGS, ['tbody']);
38460
+ delete FORBID_TAGS.tbody;
38461
+ }
38462
+ if (cfg.TRUSTED_TYPES_POLICY) {
38463
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
38464
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
38465
+ }
38466
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
38467
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
38468
+ }
38469
+
38470
+ // Overwrite existing TrustedTypes policy.
38471
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
38472
+
38473
+ // Sign local variables required by `sanitize`.
38474
+ emptyHTML = trustedTypesPolicy.createHTML('');
38475
+ } else {
38476
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
38477
+ if (trustedTypesPolicy === undefined) {
38478
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
38479
+ }
38480
+
38481
+ // If creating the internal policy succeeded sign internal variables.
38482
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
38483
+ emptyHTML = trustedTypesPolicy.createHTML('');
38484
+ }
38485
+ }
38486
+
38487
+ // Prevent further manipulation of configuration.
38488
+ // Not available in IE8, Safari 5, etc.
38489
+ if (freeze) {
38490
+ freeze(cfg);
38491
+ }
38492
+ CONFIG = cfg;
38493
+ };
38494
+ const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
38495
+ const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']);
38496
+
38497
+ // Certain elements are allowed in both SVG and HTML
38498
+ // namespace. We need to specify them explicitly
38499
+ // so that they don't get erroneously deleted from
38500
+ // HTML namespace.
38501
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
38502
+
38503
+ /* Keep track of all possible SVG and MathML tags
38504
+ * so that we can perform the namespace checks
38505
+ * correctly. */
38506
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
38507
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
38508
+
38509
+ /**
38510
+ * @param {Element} element a DOM element whose namespace is being checked
38511
+ * @returns {boolean} Return false if the element has a
38512
+ * namespace that a spec-compliant parser would never
38513
+ * return. Return true otherwise.
38514
+ */
38515
+ const _checkValidNamespace = function _checkValidNamespace(element) {
38516
+ let parent = getParentNode(element);
38517
+
38518
+ // In JSDOM, if we're inside shadow DOM, then parentNode
38519
+ // can be null. We just simulate parent in this case.
38520
+ if (!parent || !parent.tagName) {
38521
+ parent = {
38522
+ namespaceURI: NAMESPACE,
38523
+ tagName: 'template'
38524
+ };
38525
+ }
38526
+ const tagName = stringToLowerCase(element.tagName);
38527
+ const parentTagName = stringToLowerCase(parent.tagName);
38528
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
38529
+ return false;
38530
+ }
38531
+ if (element.namespaceURI === SVG_NAMESPACE) {
38532
+ // The only way to switch from HTML namespace to SVG
38533
+ // is via <svg>. If it happens via any other tag, then
38534
+ // it should be killed.
38535
+ if (parent.namespaceURI === HTML_NAMESPACE) {
38536
+ return tagName === 'svg';
38537
+ }
38538
+
38539
+ // The only way to switch from MathML to SVG is via`
38540
+ // svg if parent is either <annotation-xml> or MathML
38541
+ // text integration points.
38542
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
38543
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
38544
+ }
38545
+
38546
+ // We only allow elements that are defined in SVG
38547
+ // spec. All others are disallowed in SVG namespace.
38548
+ return Boolean(ALL_SVG_TAGS[tagName]);
38549
+ }
38550
+ if (element.namespaceURI === MATHML_NAMESPACE) {
38551
+ // The only way to switch from HTML namespace to MathML
38552
+ // is via <math>. If it happens via any other tag, then
38553
+ // it should be killed.
38554
+ if (parent.namespaceURI === HTML_NAMESPACE) {
38555
+ return tagName === 'math';
38556
+ }
38557
+
38558
+ // The only way to switch from SVG to MathML is via
38559
+ // <math> and HTML integration points
38560
+ if (parent.namespaceURI === SVG_NAMESPACE) {
38561
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
38562
+ }
38563
+
38564
+ // We only allow elements that are defined in MathML
38565
+ // spec. All others are disallowed in MathML namespace.
38566
+ return Boolean(ALL_MATHML_TAGS[tagName]);
38567
+ }
38568
+ if (element.namespaceURI === HTML_NAMESPACE) {
38569
+ // The only way to switch from SVG to HTML is via
38570
+ // HTML integration points, and from MathML to HTML
38571
+ // is via MathML text integration points
38572
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
38573
+ return false;
38574
+ }
38575
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
38576
+ return false;
38577
+ }
38578
+
38579
+ // We disallow tags that are specific for MathML
38580
+ // or SVG and should never appear in HTML namespace
38581
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
38582
+ }
38583
+
38584
+ // For XHTML and XML documents that support custom namespaces
38585
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
38586
+ return true;
38587
+ }
38588
+
38589
+ // The code should never reach this place (this means
38590
+ // that the element somehow got namespace that is not
38591
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
38592
+ // Return false just in case.
38593
+ return false;
38594
+ };
38595
+
38596
+ /**
38597
+ * _forceRemove
38598
+ *
38599
+ * @param {Node} node a DOM node
38600
+ */
38601
+ const _forceRemove = function _forceRemove(node) {
38602
+ arrayPush(DOMPurify.removed, {
38603
+ element: node
38604
+ });
38605
+ try {
38606
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
38607
+ node.parentNode.removeChild(node);
38608
+ } catch (_) {
38609
+ node.remove();
38610
+ }
38611
+ };
38612
+
38613
+ /**
38614
+ * _removeAttribute
38615
+ *
38616
+ * @param {String} name an Attribute name
38617
+ * @param {Node} node a DOM node
38618
+ */
38619
+ const _removeAttribute = function _removeAttribute(name, node) {
38620
+ try {
38621
+ arrayPush(DOMPurify.removed, {
38622
+ attribute: node.getAttributeNode(name),
38623
+ from: node
38624
+ });
38625
+ } catch (_) {
38626
+ arrayPush(DOMPurify.removed, {
38627
+ attribute: null,
38628
+ from: node
38629
+ });
38630
+ }
38631
+ node.removeAttribute(name);
38632
+
38633
+ // We void attribute values for unremovable "is"" attributes
38634
+ if (name === 'is' && !ALLOWED_ATTR[name]) {
38635
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
38636
+ try {
38637
+ _forceRemove(node);
38638
+ } catch (_) {}
38639
+ } else {
38640
+ try {
38641
+ node.setAttribute(name, '');
38642
+ } catch (_) {}
38643
+ }
38644
+ }
38645
+ };
38646
+
38647
+ /**
38648
+ * _initDocument
38649
+ *
38650
+ * @param {String} dirty a string of dirty markup
38651
+ * @return {Document} a DOM, filled with the dirty markup
38652
+ */
38653
+ const _initDocument = function _initDocument(dirty) {
38654
+ /* Create a HTML document */
38655
+ let doc = null;
38656
+ let leadingWhitespace = null;
38657
+ if (FORCE_BODY) {
38658
+ dirty = '<remove></remove>' + dirty;
38659
+ } else {
38660
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
38661
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
38662
+ leadingWhitespace = matches && matches[0];
38663
+ }
38664
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
38665
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
38666
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
38667
+ }
38668
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
38669
+ /*
38670
+ * Use the DOMParser API by default, fallback later if needs be
38671
+ * DOMParser not work for svg when has multiple root element.
38672
+ */
38673
+ if (NAMESPACE === HTML_NAMESPACE) {
38674
+ try {
38675
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
38676
+ } catch (_) {}
38677
+ }
38678
+
38679
+ /* Use createHTMLDocument in case DOMParser is not available */
38680
+ if (!doc || !doc.documentElement) {
38681
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
38682
+ try {
38683
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
38684
+ } catch (_) {
38685
+ // Syntax error if dirtyPayload is invalid xml
38686
+ }
38687
+ }
38688
+ const body = doc.body || doc.documentElement;
38689
+ if (dirty && leadingWhitespace) {
38690
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
38691
+ }
38692
+
38693
+ /* Work on whole document or just its body */
38694
+ if (NAMESPACE === HTML_NAMESPACE) {
38695
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
38696
+ }
38697
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
38698
+ };
38699
+
38700
+ /**
38701
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
38702
+ *
38703
+ * @param {Node} root The root element or node to start traversing on.
38704
+ * @return {NodeIterator} The created NodeIterator
38705
+ */
38706
+ const _createNodeIterator = function _createNodeIterator(root) {
38707
+ return createNodeIterator.call(root.ownerDocument || root, root,
38708
+ // eslint-disable-next-line no-bitwise
38709
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null);
38710
+ };
38711
+
38712
+ /**
38713
+ * _isClobbered
38714
+ *
38715
+ * @param {Node} elm element to check for clobbering attacks
38716
+ * @return {Boolean} true if clobbered, false if safe
38717
+ */
38718
+ const _isClobbered = function _isClobbered(elm) {
38719
+ return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
38720
+ };
38721
+
38722
+ /**
38723
+ * Checks whether the given object is a DOM node.
38724
+ *
38725
+ * @param {Node} object object to check whether it's a DOM node
38726
+ * @return {Boolean} true is object is a DOM node
38727
+ */
38728
+ const _isNode = function _isNode(object) {
38729
+ return typeof Node === 'function' && object instanceof Node;
38730
+ };
38731
+
38732
+ /**
38733
+ * _executeHook
38734
+ * Execute user configurable hooks
38735
+ *
38736
+ * @param {String} entryPoint Name of the hook's entry point
38737
+ * @param {Node} currentNode node to work on with the hook
38738
+ * @param {Object} data additional hook parameters
38739
+ */
38740
+ const _executeHook = function _executeHook(entryPoint, currentNode, data) {
38741
+ if (!hooks[entryPoint]) {
38742
+ return;
38743
+ }
38744
+ arrayForEach(hooks[entryPoint], hook => {
38745
+ hook.call(DOMPurify, currentNode, data, CONFIG);
38746
+ });
38747
+ };
38748
+
38749
+ /**
38750
+ * _sanitizeElements
38751
+ *
38752
+ * @protect nodeName
38753
+ * @protect textContent
38754
+ * @protect removeChild
38755
+ *
38756
+ * @param {Node} currentNode to check for permission to exist
38757
+ * @return {Boolean} true if node was killed, false if left alive
38758
+ */
38759
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
38760
+ let content = null;
38761
+
38762
+ /* Execute a hook if present */
38763
+ _executeHook('beforeSanitizeElements', currentNode, null);
38764
+
38765
+ /* Check if element is clobbered or can clobber */
38766
+ if (_isClobbered(currentNode)) {
38767
+ _forceRemove(currentNode);
38768
+ return true;
38769
+ }
38770
+
38771
+ /* Now let's check the element's type and name */
38772
+ const tagName = transformCaseFunc(currentNode.nodeName);
38773
+
38774
+ /* Execute a hook if present */
38775
+ _executeHook('uponSanitizeElement', currentNode, {
38776
+ tagName,
38777
+ allowedTags: ALLOWED_TAGS
38778
+ });
38779
+
38780
+ /* Detect mXSS attempts abusing namespace confusion */
38781
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
38782
+ _forceRemove(currentNode);
38783
+ return true;
38784
+ }
38785
+
38786
+ /* Remove element if anything forbids its presence */
38787
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
38788
+ /* Check if we have a custom element to handle */
38789
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
38790
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
38791
+ return false;
38792
+ }
38793
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
38794
+ return false;
38795
+ }
38796
+ }
38797
+
38798
+ /* Keep content except for bad-listed elements */
38799
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
38800
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
38801
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
38802
+ if (childNodes && parentNode) {
38803
+ const childCount = childNodes.length;
38804
+ for (let i = childCount - 1; i >= 0; --i) {
38805
+ parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
38806
+ }
38807
+ }
38808
+ }
38809
+ _forceRemove(currentNode);
38810
+ return true;
38811
+ }
38812
+
38813
+ /* Check whether element has a valid namespace */
38814
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
38815
+ _forceRemove(currentNode);
38816
+ return true;
38817
+ }
38818
+
38819
+ /* Make sure that older browsers don't get fallback-tag mXSS */
38820
+ if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
38821
+ _forceRemove(currentNode);
38822
+ return true;
38823
+ }
38824
+
38825
+ /* Sanitize element content to be template-safe */
38826
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
38827
+ /* Get the element's text content */
38828
+ content = currentNode.textContent;
38829
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
38830
+ content = stringReplace(content, expr, ' ');
38831
+ });
38832
+ if (currentNode.textContent !== content) {
38833
+ arrayPush(DOMPurify.removed, {
38834
+ element: currentNode.cloneNode()
38835
+ });
38836
+ currentNode.textContent = content;
38837
+ }
38838
+ }
38839
+
38840
+ /* Execute a hook if present */
38841
+ _executeHook('afterSanitizeElements', currentNode, null);
38842
+ return false;
38843
+ };
38844
+
38845
+ /**
38846
+ * _isValidAttribute
38847
+ *
38848
+ * @param {string} lcTag Lowercase tag name of containing element.
38849
+ * @param {string} lcName Lowercase attribute name.
38850
+ * @param {string} value Attribute value.
38851
+ * @return {Boolean} Returns true if `value` is valid, otherwise false.
38852
+ */
38853
+ // eslint-disable-next-line complexity
38854
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
38855
+ /* Make sure attribute cannot clobber */
38856
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
38857
+ return false;
38858
+ }
38859
+
38860
+ /* Allow valid data-* attributes: At least one character after "-"
38861
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
38862
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
38863
+ We don't need to check the value; it's always URI safe. */
38864
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
38865
+ if (
38866
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
38867
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
38868
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
38869
+ _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)) ||
38870
+ // Alternative, second condition checks if it's an `is`-attribute, AND
38871
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
38872
+ 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))) ; else {
38873
+ return false;
38874
+ }
38875
+ /* Check value is safe. First, is attr inert? If so, is safe */
38876
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
38877
+ return false;
38878
+ } else ;
38879
+ return true;
38880
+ };
38881
+
38882
+ /**
38883
+ * _isBasicCustomElement
38884
+ * checks if at least one dash is included in tagName, and it's not the first char
38885
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
38886
+ *
38887
+ * @param {string} tagName name of the tag of the node to sanitize
38888
+ * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
38889
+ */
38890
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
38891
+ return tagName.indexOf('-') > 0;
38892
+ };
38893
+
38894
+ /**
38895
+ * _sanitizeAttributes
38896
+ *
38897
+ * @protect attributes
38898
+ * @protect nodeName
38899
+ * @protect removeAttribute
38900
+ * @protect setAttribute
38901
+ *
38902
+ * @param {Node} currentNode to sanitize
38903
+ */
38904
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
38905
+ /* Execute a hook if present */
38906
+ _executeHook('beforeSanitizeAttributes', currentNode, null);
38907
+ const {
38908
+ attributes
38909
+ } = currentNode;
38910
+
38911
+ /* Check if we have attributes; if not we might have a text node */
38912
+ if (!attributes) {
38913
+ return;
38914
+ }
38915
+ const hookEvent = {
38916
+ attrName: '',
38917
+ attrValue: '',
38918
+ keepAttr: true,
38919
+ allowedAttributes: ALLOWED_ATTR
38920
+ };
38921
+ let l = attributes.length;
38922
+
38923
+ /* Go backwards over all attributes; safely remove bad ones */
38924
+ while (l--) {
38925
+ const attr = attributes[l];
38926
+ const {
38927
+ name,
38928
+ namespaceURI,
38929
+ value: attrValue
38930
+ } = attr;
38931
+ const lcName = transformCaseFunc(name);
38932
+ let value = name === 'value' ? attrValue : stringTrim(attrValue);
38933
+
38934
+ /* Execute a hook if present */
38935
+ hookEvent.attrName = lcName;
38936
+ hookEvent.attrValue = value;
38937
+ hookEvent.keepAttr = true;
38938
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
38939
+ _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
38940
+ value = hookEvent.attrValue;
38941
+ /* Did the hooks approve of the attribute? */
38942
+ if (hookEvent.forceKeepAttr) {
38943
+ continue;
38944
+ }
38945
+
38946
+ /* Remove attribute */
38947
+ _removeAttribute(name, currentNode);
38948
+
38949
+ /* Did the hooks approve of the attribute? */
38950
+ if (!hookEvent.keepAttr) {
38951
+ continue;
38952
+ }
38953
+
38954
+ /* Work around a security issue in jQuery 3.0 */
38955
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
38956
+ _removeAttribute(name, currentNode);
38957
+ continue;
38958
+ }
38959
+
38960
+ /* Sanitize attribute content to be template-safe */
38961
+ if (SAFE_FOR_TEMPLATES) {
38962
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
38963
+ value = stringReplace(value, expr, ' ');
38964
+ });
38965
+ }
38966
+
38967
+ /* Is `value` valid for this attribute? */
38968
+ const lcTag = transformCaseFunc(currentNode.nodeName);
38969
+ if (!_isValidAttribute(lcTag, lcName, value)) {
38970
+ continue;
38971
+ }
38972
+
38973
+ /* Full DOM Clobbering protection via namespace isolation,
38974
+ * Prefix id and name attributes with `user-content-`
38975
+ */
38976
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
38977
+ // Remove the attribute with this value
38978
+ _removeAttribute(name, currentNode);
38979
+
38980
+ // Prefix the value and later re-create the attribute with the sanitized value
38981
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
38982
+ }
38983
+
38984
+ /* Handle attributes that require Trusted Types */
38985
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
38986
+ if (namespaceURI) ; else {
38987
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
38988
+ case 'TrustedHTML':
38989
+ {
38990
+ value = trustedTypesPolicy.createHTML(value);
38991
+ break;
38992
+ }
38993
+ case 'TrustedScriptURL':
38994
+ {
38995
+ value = trustedTypesPolicy.createScriptURL(value);
38996
+ break;
38997
+ }
38998
+ }
38999
+ }
39000
+ }
39001
+
39002
+ /* Handle invalid data-* attribute set by try-catching it */
39003
+ try {
39004
+ if (namespaceURI) {
39005
+ currentNode.setAttributeNS(namespaceURI, name, value);
39006
+ } else {
39007
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
39008
+ currentNode.setAttribute(name, value);
39009
+ }
39010
+ arrayPop(DOMPurify.removed);
39011
+ } catch (_) {}
39012
+ }
39013
+
39014
+ /* Execute a hook if present */
39015
+ _executeHook('afterSanitizeAttributes', currentNode, null);
39016
+ };
39017
+
39018
+ /**
39019
+ * _sanitizeShadowDOM
39020
+ *
39021
+ * @param {DocumentFragment} fragment to iterate over recursively
39022
+ */
39023
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
39024
+ let shadowNode = null;
39025
+ const shadowIterator = _createNodeIterator(fragment);
39026
+
39027
+ /* Execute a hook if present */
39028
+ _executeHook('beforeSanitizeShadowDOM', fragment, null);
39029
+ while (shadowNode = shadowIterator.nextNode()) {
39030
+ /* Execute a hook if present */
39031
+ _executeHook('uponSanitizeShadowNode', shadowNode, null);
39032
+
39033
+ /* Sanitize tags and elements */
39034
+ if (_sanitizeElements(shadowNode)) {
39035
+ continue;
39036
+ }
39037
+
39038
+ /* Deep shadow DOM detected */
39039
+ if (shadowNode.content instanceof DocumentFragment) {
39040
+ _sanitizeShadowDOM(shadowNode.content);
39041
+ }
39042
+
39043
+ /* Check attributes, sanitize if necessary */
39044
+ _sanitizeAttributes(shadowNode);
39045
+ }
39046
+
39047
+ /* Execute a hook if present */
39048
+ _executeHook('afterSanitizeShadowDOM', fragment, null);
39049
+ };
39050
+
39051
+ /**
39052
+ * Sanitize
39053
+ * Public method providing core sanitation functionality
39054
+ *
39055
+ * @param {String|Node} dirty string or DOM node
39056
+ * @param {Object} cfg object
39057
+ */
39058
+ // eslint-disable-next-line complexity
39059
+ DOMPurify.sanitize = function (dirty) {
39060
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
39061
+ let body = null;
39062
+ let importedNode = null;
39063
+ let currentNode = null;
39064
+ let returnNode = null;
39065
+ /* Make sure we have a string to sanitize.
39066
+ DO NOT return early, as this will return the wrong type if
39067
+ the user has requested a DOM object rather than a string */
39068
+ IS_EMPTY_INPUT = !dirty;
39069
+ if (IS_EMPTY_INPUT) {
39070
+ dirty = '<!-->';
39071
+ }
39072
+
39073
+ /* Stringify, in case dirty is an object */
39074
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
39075
+ if (typeof dirty.toString === 'function') {
39076
+ dirty = dirty.toString();
39077
+ if (typeof dirty !== 'string') {
39078
+ throw typeErrorCreate('dirty is not a string, aborting');
39079
+ }
39080
+ } else {
39081
+ throw typeErrorCreate('toString is not a function');
39082
+ }
39083
+ }
39084
+
39085
+ /* Return dirty HTML if DOMPurify cannot run */
39086
+ if (!DOMPurify.isSupported) {
39087
+ return dirty;
39088
+ }
39089
+
39090
+ /* Assign config vars */
39091
+ if (!SET_CONFIG) {
39092
+ _parseConfig(cfg);
39093
+ }
39094
+
39095
+ /* Clean up removed elements */
39096
+ DOMPurify.removed = [];
39097
+
39098
+ /* Check if dirty is correctly typed for IN_PLACE */
39099
+ if (typeof dirty === 'string') {
39100
+ IN_PLACE = false;
39101
+ }
39102
+ if (IN_PLACE) {
39103
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
39104
+ if (dirty.nodeName) {
39105
+ const tagName = transformCaseFunc(dirty.nodeName);
39106
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
39107
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
39108
+ }
39109
+ }
39110
+ } else if (dirty instanceof Node) {
39111
+ /* If dirty is a DOM element, append to an empty document to avoid
39112
+ elements being stripped by the parser */
39113
+ body = _initDocument('<!---->');
39114
+ importedNode = body.ownerDocument.importNode(dirty, true);
39115
+ if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
39116
+ /* Node is already a body, use as is */
39117
+ body = importedNode;
39118
+ } else if (importedNode.nodeName === 'HTML') {
39119
+ body = importedNode;
39120
+ } else {
39121
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
39122
+ body.appendChild(importedNode);
39123
+ }
39124
+ } else {
39125
+ /* Exit directly if we have nothing to do */
39126
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
39127
+ // eslint-disable-next-line unicorn/prefer-includes
39128
+ dirty.indexOf('<') === -1) {
39129
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
39130
+ }
39131
+
39132
+ /* Initialize the document to work on */
39133
+ body = _initDocument(dirty);
39134
+
39135
+ /* Check we have a DOM node from the data */
39136
+ if (!body) {
39137
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
39138
+ }
39139
+ }
39140
+
39141
+ /* Remove first element node (ours) if FORCE_BODY is set */
39142
+ if (body && FORCE_BODY) {
39143
+ _forceRemove(body.firstChild);
39144
+ }
39145
+
39146
+ /* Get node iterator */
39147
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
39148
+
39149
+ /* Now start iterating over the created document */
39150
+ while (currentNode = nodeIterator.nextNode()) {
39151
+ /* Sanitize tags and elements */
39152
+ if (_sanitizeElements(currentNode)) {
39153
+ continue;
39154
+ }
39155
+
39156
+ /* Shadow DOM detected, sanitize it */
39157
+ if (currentNode.content instanceof DocumentFragment) {
39158
+ _sanitizeShadowDOM(currentNode.content);
39159
+ }
39160
+
39161
+ /* Check attributes, sanitize if necessary */
39162
+ _sanitizeAttributes(currentNode);
39163
+ }
39164
+
39165
+ /* If we sanitized `dirty` in-place, return it. */
39166
+ if (IN_PLACE) {
39167
+ return dirty;
39168
+ }
39169
+
39170
+ /* Return sanitized string or DOM */
39171
+ if (RETURN_DOM) {
39172
+ if (RETURN_DOM_FRAGMENT) {
39173
+ returnNode = createDocumentFragment.call(body.ownerDocument);
39174
+ while (body.firstChild) {
39175
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
39176
+ returnNode.appendChild(body.firstChild);
39177
+ }
39178
+ } else {
39179
+ returnNode = body;
39180
+ }
39181
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
39182
+ /*
39183
+ AdoptNode() is not used because internal state is not reset
39184
+ (e.g. the past names map of a HTMLFormElement), this is safe
39185
+ in theory but we would rather not risk another attack vector.
39186
+ The state that is cloned by importNode() is explicitly defined
39187
+ by the specs.
39188
+ */
39189
+ returnNode = importNode.call(originalDocument, returnNode, true);
39190
+ }
39191
+ return returnNode;
39192
+ }
39193
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
39194
+
39195
+ /* Serialize doctype if allowed */
39196
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
39197
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
39198
+ }
39199
+
39200
+ /* Sanitize final string template-safe */
39201
+ if (SAFE_FOR_TEMPLATES) {
39202
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
39203
+ serializedHTML = stringReplace(serializedHTML, expr, ' ');
39204
+ });
39205
+ }
39206
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
39207
+ };
39208
+
39209
+ /**
39210
+ * Public method to set the configuration once
39211
+ * setConfig
39212
+ *
39213
+ * @param {Object} cfg configuration object
39214
+ */
39215
+ DOMPurify.setConfig = function () {
39216
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
39217
+ _parseConfig(cfg);
39218
+ SET_CONFIG = true;
39219
+ };
39220
+
39221
+ /**
39222
+ * Public method to remove the configuration
39223
+ * clearConfig
39224
+ *
39225
+ */
39226
+ DOMPurify.clearConfig = function () {
39227
+ CONFIG = null;
39228
+ SET_CONFIG = false;
39229
+ };
39230
+
39231
+ /**
39232
+ * Public method to check if an attribute value is valid.
39233
+ * Uses last set config, if any. Otherwise, uses config defaults.
39234
+ * isValidAttribute
39235
+ *
39236
+ * @param {String} tag Tag name of containing element.
39237
+ * @param {String} attr Attribute name.
39238
+ * @param {String} value Attribute value.
39239
+ * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
39240
+ */
39241
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
39242
+ /* Initialize shared config vars if necessary. */
39243
+ if (!CONFIG) {
39244
+ _parseConfig({});
39245
+ }
39246
+ const lcTag = transformCaseFunc(tag);
39247
+ const lcName = transformCaseFunc(attr);
39248
+ return _isValidAttribute(lcTag, lcName, value);
39249
+ };
39250
+
39251
+ /**
39252
+ * AddHook
39253
+ * Public method to add DOMPurify hooks
39254
+ *
39255
+ * @param {String} entryPoint entry point for the hook to add
39256
+ * @param {Function} hookFunction function to execute
39257
+ */
39258
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
39259
+ if (typeof hookFunction !== 'function') {
39260
+ return;
39261
+ }
39262
+ hooks[entryPoint] = hooks[entryPoint] || [];
39263
+ arrayPush(hooks[entryPoint], hookFunction);
39264
+ };
39265
+
39266
+ /**
39267
+ * RemoveHook
39268
+ * Public method to remove a DOMPurify hook at a given entryPoint
39269
+ * (pops it from the stack of hooks if more are present)
39270
+ *
39271
+ * @param {String} entryPoint entry point for the hook to remove
39272
+ * @return {Function} removed(popped) hook
39273
+ */
39274
+ DOMPurify.removeHook = function (entryPoint) {
39275
+ if (hooks[entryPoint]) {
39276
+ return arrayPop(hooks[entryPoint]);
39277
+ }
39278
+ };
39279
+
39280
+ /**
39281
+ * RemoveHooks
39282
+ * Public method to remove all DOMPurify hooks at a given entryPoint
39283
+ *
39284
+ * @param {String} entryPoint entry point for the hooks to remove
39285
+ */
39286
+ DOMPurify.removeHooks = function (entryPoint) {
39287
+ if (hooks[entryPoint]) {
39288
+ hooks[entryPoint] = [];
39289
+ }
39290
+ };
39291
+
39292
+ /**
39293
+ * RemoveAllHooks
39294
+ * Public method to remove all DOMPurify hooks
39295
+ */
39296
+ DOMPurify.removeAllHooks = function () {
39297
+ hooks = {};
39298
+ };
39299
+ return DOMPurify;
39300
+ }
39301
+ var purify = createDOMPurify();
39302
+
39303
+ return purify;
39304
+
39305
+ }));
39306
+ //# sourceMappingURL=purify.js.map
39307
+
39308
+
37760
39309
  /***/ }),
37761
39310
 
37762
39311
  /***/ 3462: