@ably/ui 8.10.0 → 9.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 (53) hide show
  1. package/core/Code/component.css +3 -3
  2. package/core/Code/component.js +1 -1
  3. package/core/Code.jsx +353 -7273
  4. package/core/CompanyAutocomplete/component.js +1 -1
  5. package/core/ConnectStateWrapper.jsx +13 -4
  6. package/core/ContactFooter.jsx +13 -119
  7. package/core/CookieMessage.jsx +21 -293
  8. package/core/CustomerLogos.jsx +9 -114
  9. package/core/DropdownMenu.jsx +10 -116
  10. package/core/FeaturedLink.jsx +10 -116
  11. package/core/Flash.jsx +29 -1483
  12. package/core/Footer.jsx +17 -123
  13. package/core/Icon.jsx +9 -114
  14. package/core/Loader.jsx +9 -114
  15. package/core/Logo.jsx +13 -118
  16. package/core/Meganav/component.js +1 -2
  17. package/core/Meganav.jsx +2844 -10189
  18. package/core/MeganavBlogPostsList/component.js +1 -1
  19. package/core/MeganavBlogPostsList.jsx +11 -118
  20. package/core/MeganavContentCompany.jsx +31 -124
  21. package/core/MeganavContentDevelopers.jsx +10 -116
  22. package/core/MeganavContentPlatform.jsx +11 -118
  23. package/core/MeganavContentUseCases.jsx +10 -116
  24. package/core/MeganavControl.jsx +10 -116
  25. package/core/MeganavControlMobileDropdown/component.js +1 -1
  26. package/core/MeganavControlMobileDropdown.jsx +10 -116
  27. package/core/MeganavControlMobilePanelClose.jsx +10 -116
  28. package/core/MeganavControlMobilePanelOpen.jsx +10 -116
  29. package/core/MeganavItemsDesktop.jsx +13 -121
  30. package/core/MeganavItemsMobile.jsx +18 -132
  31. package/core/MeganavItemsSignedIn.jsx +16 -129
  32. package/core/MeganavSearch.jsx +13 -123
  33. package/core/MeganavSearchAutocomplete/component.js +1 -2
  34. package/core/MeganavSearchPanel.jsx +12 -121
  35. package/core/MeganavSearchSuggestions.jsx +11 -118
  36. package/core/Notice/component.js +1 -2
  37. package/core/Notice.jsx +62 -2136
  38. package/core/SignOutLink.jsx +9 -114
  39. package/core/Slider/component.js +1 -1
  40. package/core/Slider.jsx +25 -582
  41. package/core/Uptime.jsx +15 -118
  42. package/core/scripts.js +1 -1
  43. package/package.json +4 -4
  44. package/src/core/Code/component.css +1 -67
  45. package/src/core/Code/component.js +11 -46
  46. package/src/core/Code/component.jsx +7 -3
  47. package/src/core/FeatureFooter/component.html.erb +1 -1
  48. package/src/core/utils/syntax-highlighter-registry.js +61 -0
  49. package/src/core/utils/syntax-highlighter.css +69 -0
  50. package/src/core/utils/syntax-highlighter.js +98 -0
  51. package/core/Meganav/component.js.LICENSE.txt +0 -7
  52. package/core/MeganavSearchAutocomplete/component.js.LICENSE.txt +0 -7
  53. package/core/Notice/component.js.LICENSE.txt +0 -9
package/core/Flash.jsx CHANGED
@@ -1,20 +1,20 @@
1
1
  (function webpackUniversalModuleDefinition(root, factory) {
2
2
  if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("react"));
3
+ module.exports = factory(require("react"), require("dompurify"), require("prop-types"), require("redux"));
4
4
  else if(typeof define === 'function' && define.amd)
5
- define([], factory);
5
+ define([, , , ], factory);
6
6
  else {
7
- var a = typeof exports === 'object' ? factory(require("react")) : factory(root[undefined]);
7
+ var a = typeof exports === 'object' ? factory(require("react"), require("dompurify"), require("prop-types"), require("redux")) : factory(root[undefined], root[undefined], root[undefined], root[undefined]);
8
8
  for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
9
  }
10
- })(this, function(__WEBPACK_EXTERNAL_MODULE__9281__) {
10
+ })(this, function(__WEBPACK_EXTERNAL_MODULE__9281__, __WEBPACK_EXTERNAL_MODULE__6357__, __WEBPACK_EXTERNAL_MODULE__3474__, __WEBPACK_EXTERNAL_MODULE__5044__) {
11
11
  return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
12
13
  /******/ var __webpack_modules__ = ({
13
14
 
14
15
  /***/ 9787:
15
16
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
16
17
 
17
- "use strict";
18
18
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
19
19
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
20
20
  /* harmony export */ });
@@ -95,13 +95,12 @@ var ConnectStateWrapper = function ConnectStateWrapper(Component, selectors) {
95
95
  /***/ 9008:
96
96
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
97
97
 
98
- "use strict";
99
98
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
100
99
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
101
100
  /* harmony export */ });
102
101
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9281);
103
102
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
104
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5697);
103
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3474);
105
104
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
106
105
  var _excluded = ["name", "size", "color", "additionalCSS"];
107
106
 
@@ -148,12 +147,13 @@ Icon.propTypes = {
148
147
  /***/ 3511:
149
148
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
150
149
 
151
- "use strict";
152
150
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
153
151
  /* harmony export */ "cO": () => (/* binding */ getRemoteDataStore),
154
152
  /* harmony export */ "kZ": () => (/* binding */ connectState)
155
153
  /* harmony export */ });
156
154
  /* unused harmony exports attachStoreToWindow, createRemoteDataStore */
155
+ /* harmony import */ var redux__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5044);
156
+ /* harmony import */ var redux__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(redux__WEBPACK_IMPORTED_MODULE_0__);
157
157
 
158
158
  var attachStoreToWindow = function attachStoreToWindow(store) {
159
159
  window.AblyUi = window.AblyUi || {};
@@ -186,1484 +186,31 @@ var createRemoteDataStore = function createRemoteDataStore(reducers) {
186
186
 
187
187
  /***/ }),
188
188
 
189
- /***/ 7856:
190
- /***/ (function(module) {
191
-
192
- /*! @license DOMPurify | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.2.2/LICENSE */
193
-
194
- (function (global, factory) {
195
- true ? module.exports = factory() :
196
- 0;
197
- }(this, function () { 'use strict';
198
-
199
- function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
200
-
201
- var hasOwnProperty = Object.hasOwnProperty,
202
- setPrototypeOf = Object.setPrototypeOf,
203
- isFrozen = Object.isFrozen,
204
- getPrototypeOf = Object.getPrototypeOf,
205
- getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
206
- var freeze = Object.freeze,
207
- seal = Object.seal,
208
- create = Object.create; // eslint-disable-line import/no-mutable-exports
209
-
210
- var _ref = typeof Reflect !== 'undefined' && Reflect,
211
- apply = _ref.apply,
212
- construct = _ref.construct;
213
-
214
- if (!apply) {
215
- apply = function apply(fun, thisValue, args) {
216
- return fun.apply(thisValue, args);
217
- };
218
- }
219
-
220
- if (!freeze) {
221
- freeze = function freeze(x) {
222
- return x;
223
- };
224
- }
225
-
226
- if (!seal) {
227
- seal = function seal(x) {
228
- return x;
229
- };
230
- }
231
-
232
- if (!construct) {
233
- construct = function construct(Func, args) {
234
- return new (Function.prototype.bind.apply(Func, [null].concat(_toConsumableArray(args))))();
235
- };
236
- }
237
-
238
- var arrayForEach = unapply(Array.prototype.forEach);
239
- var arrayPop = unapply(Array.prototype.pop);
240
- var arrayPush = unapply(Array.prototype.push);
241
-
242
- var stringToLowerCase = unapply(String.prototype.toLowerCase);
243
- var stringMatch = unapply(String.prototype.match);
244
- var stringReplace = unapply(String.prototype.replace);
245
- var stringIndexOf = unapply(String.prototype.indexOf);
246
- var stringTrim = unapply(String.prototype.trim);
247
-
248
- var regExpTest = unapply(RegExp.prototype.test);
249
-
250
- var typeErrorCreate = unconstruct(TypeError);
251
-
252
- function unapply(func) {
253
- return function (thisArg) {
254
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
255
- args[_key - 1] = arguments[_key];
256
- }
257
-
258
- return apply(func, thisArg, args);
259
- };
260
- }
261
-
262
- function unconstruct(func) {
263
- return function () {
264
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
265
- args[_key2] = arguments[_key2];
266
- }
267
-
268
- return construct(func, args);
269
- };
270
- }
271
-
272
- /* Add properties to a lookup table */
273
- function addToSet(set, array) {
274
- if (setPrototypeOf) {
275
- // Make 'in' and truthy checks like Boolean(set.constructor)
276
- // independent of any properties defined on Object.prototype.
277
- // Prevent prototype setters from intercepting set as a this value.
278
- setPrototypeOf(set, null);
279
- }
280
-
281
- var l = array.length;
282
- while (l--) {
283
- var element = array[l];
284
- if (typeof element === 'string') {
285
- var lcElement = stringToLowerCase(element);
286
- if (lcElement !== element) {
287
- // Config presets (e.g. tags.js, attrs.js) are immutable.
288
- if (!isFrozen(array)) {
289
- array[l] = lcElement;
290
- }
291
-
292
- element = lcElement;
293
- }
294
- }
295
-
296
- set[element] = true;
297
- }
298
-
299
- return set;
300
- }
301
-
302
- /* Shallow clone an object */
303
- function clone(object) {
304
- var newObject = create(null);
305
-
306
- var property = void 0;
307
- for (property in object) {
308
- if (apply(hasOwnProperty, object, [property])) {
309
- newObject[property] = object[property];
310
- }
311
- }
312
-
313
- return newObject;
314
- }
315
-
316
- /* IE10 doesn't support __lookupGetter__ so lets'
317
- * simulate it. It also automatically checks
318
- * if the prop is function or getter and behaves
319
- * accordingly. */
320
- function lookupGetter(object, prop) {
321
- while (object !== null) {
322
- var desc = getOwnPropertyDescriptor(object, prop);
323
- if (desc) {
324
- if (desc.get) {
325
- return unapply(desc.get);
326
- }
327
-
328
- if (typeof desc.value === 'function') {
329
- return unapply(desc.value);
330
- }
331
- }
332
-
333
- object = getPrototypeOf(object);
334
- }
335
-
336
- function fallbackValue(element) {
337
- console.warn('fallback value for', element);
338
- return null;
339
- }
340
-
341
- return fallbackValue;
342
- }
343
-
344
- var html = 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']);
345
-
346
- // SVG
347
- var svg = 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']);
348
-
349
- var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
350
-
351
- // List of SVG elements that are disallowed by default.
352
- // We still need to know them so that we can do namespace
353
- // checks properly in case one wants to add them to
354
- // allow-list.
355
- var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'feimage', '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']);
356
-
357
- var mathMl = 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']);
358
-
359
- // Similarly to SVG, we want to know all MathML elements,
360
- // even those that we disallow by default.
361
- var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
362
-
363
- var text = freeze(['#text']);
364
-
365
- var html$1 = 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', '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']);
366
-
367
- var svg$1 = 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', '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']);
368
-
369
- var mathMl$1 = 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']);
370
-
371
- var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
372
-
373
- // eslint-disable-next-line unicorn/better-regex
374
- var MUSTACHE_EXPR = seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
375
- var ERB_EXPR = seal(/<%[\s\S]*|[\s\S]*%>/gm);
376
- var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
377
- var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
378
- var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
379
- );
380
- var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
381
- var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
382
- );
383
-
384
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
385
-
386
- function _toConsumableArray$1(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
387
-
388
- var getGlobal = function getGlobal() {
389
- return typeof window === 'undefined' ? null : window;
390
- };
391
-
392
- /**
393
- * Creates a no-op policy for internal use only.
394
- * Don't export this function outside this module!
395
- * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
396
- * @param {Document} document The document object (to determine policy name suffix)
397
- * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
398
- * are not supported).
399
- */
400
- var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
401
- if ((typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
402
- return null;
403
- }
404
-
405
- // Allow the callers to control the unique policy name
406
- // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
407
- // Policy creation with duplicate names throws in Trusted Types.
408
- var suffix = null;
409
- var ATTR_NAME = 'data-tt-policy-suffix';
410
- if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {
411
- suffix = document.currentScript.getAttribute(ATTR_NAME);
412
- }
413
-
414
- var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
415
-
416
- try {
417
- return trustedTypes.createPolicy(policyName, {
418
- createHTML: function createHTML(html$$1) {
419
- return html$$1;
420
- }
421
- });
422
- } catch (_) {
423
- // Policy creation failed (most likely another DOMPurify script has
424
- // already run). Skip creating the policy, as this will only cause errors
425
- // if TT are enforced.
426
- console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
427
- return null;
428
- }
429
- };
430
-
431
- function createDOMPurify() {
432
- var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
433
-
434
- var DOMPurify = function DOMPurify(root) {
435
- return createDOMPurify(root);
436
- };
437
-
438
- /**
439
- * Version label, exposed for easier checks
440
- * if DOMPurify is up to date or not
441
- */
442
- DOMPurify.version = '2.2.9';
443
-
444
- /**
445
- * Array of elements that DOMPurify removed during sanitation.
446
- * Empty if nothing was removed.
447
- */
448
- DOMPurify.removed = [];
449
-
450
- if (!window || !window.document || window.document.nodeType !== 9) {
451
- // Not running in a browser, provide a factory function
452
- // so that you can pass your own Window
453
- DOMPurify.isSupported = false;
454
-
455
- return DOMPurify;
456
- }
457
-
458
- var originalDocument = window.document;
459
-
460
- var document = window.document;
461
- var DocumentFragment = window.DocumentFragment,
462
- HTMLTemplateElement = window.HTMLTemplateElement,
463
- Node = window.Node,
464
- Element = window.Element,
465
- NodeFilter = window.NodeFilter,
466
- _window$NamedNodeMap = window.NamedNodeMap,
467
- NamedNodeMap = _window$NamedNodeMap === undefined ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,
468
- Text = window.Text,
469
- Comment = window.Comment,
470
- DOMParser = window.DOMParser,
471
- trustedTypes = window.trustedTypes;
472
-
473
-
474
- var ElementPrototype = Element.prototype;
475
-
476
- var cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
477
- var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
478
- var getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
479
- var getParentNode = lookupGetter(ElementPrototype, 'parentNode');
480
-
481
- // As per issue #47, the web-components registry is inherited by a
482
- // new document created via createHTMLDocument. As per the spec
483
- // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
484
- // a new empty registry is used when creating a template contents owner
485
- // document, so we use that as our parent document to ensure nothing
486
- // is inherited.
487
- if (typeof HTMLTemplateElement === 'function') {
488
- var template = document.createElement('template');
489
- if (template.content && template.content.ownerDocument) {
490
- document = template.content.ownerDocument;
491
- }
492
- }
493
-
494
- var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);
495
- var emptyHTML = trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML('') : '';
496
-
497
- var _document = document,
498
- implementation = _document.implementation,
499
- createNodeIterator = _document.createNodeIterator,
500
- createDocumentFragment = _document.createDocumentFragment;
501
- var importNode = originalDocument.importNode;
502
-
503
-
504
- var documentMode = {};
505
- try {
506
- documentMode = clone(document).documentMode ? document.documentMode : {};
507
- } catch (_) {}
508
-
509
- var hooks = {};
510
-
511
- /**
512
- * Expose whether this browser supports running the full DOMPurify.
513
- */
514
- DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9;
515
-
516
- var MUSTACHE_EXPR$$1 = MUSTACHE_EXPR,
517
- ERB_EXPR$$1 = ERB_EXPR,
518
- DATA_ATTR$$1 = DATA_ATTR,
519
- ARIA_ATTR$$1 = ARIA_ATTR,
520
- IS_SCRIPT_OR_DATA$$1 = IS_SCRIPT_OR_DATA,
521
- ATTR_WHITESPACE$$1 = ATTR_WHITESPACE;
522
- var IS_ALLOWED_URI$$1 = IS_ALLOWED_URI;
523
-
524
- /**
525
- * We consider the elements and attributes below to be safe. Ideally
526
- * don't add any new ones but feel free to remove unwanted ones.
527
- */
528
-
529
- /* allowed element names */
530
-
531
- var ALLOWED_TAGS = null;
532
- var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(html), _toConsumableArray$1(svg), _toConsumableArray$1(svgFilters), _toConsumableArray$1(mathMl), _toConsumableArray$1(text)));
533
-
534
- /* Allowed attribute names */
535
- var ALLOWED_ATTR = null;
536
- var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray$1(html$1), _toConsumableArray$1(svg$1), _toConsumableArray$1(mathMl$1), _toConsumableArray$1(xml)));
537
-
538
- /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
539
- var FORBID_TAGS = null;
540
-
541
- /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
542
- var FORBID_ATTR = null;
543
-
544
- /* Decide if ARIA attributes are okay */
545
- var ALLOW_ARIA_ATTR = true;
546
-
547
- /* Decide if custom data attributes are okay */
548
- var ALLOW_DATA_ATTR = true;
549
-
550
- /* Decide if unknown protocols are okay */
551
- var ALLOW_UNKNOWN_PROTOCOLS = false;
552
-
553
- /* Output should be safe for common template engines.
554
- * This means, DOMPurify removes data attributes, mustaches and ERB
555
- */
556
- var SAFE_FOR_TEMPLATES = false;
557
-
558
- /* Decide if document with <html>... should be returned */
559
- var WHOLE_DOCUMENT = false;
560
-
561
- /* Track whether config is already set on this instance of DOMPurify. */
562
- var SET_CONFIG = false;
563
-
564
- /* Decide if all elements (e.g. style, script) must be children of
565
- * document.body. By default, browsers might move them to document.head */
566
- var FORCE_BODY = false;
567
-
568
- /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
569
- * string (or a TrustedHTML object if Trusted Types are supported).
570
- * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
571
- */
572
- var RETURN_DOM = false;
573
-
574
- /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
575
- * string (or a TrustedHTML object if Trusted Types are supported) */
576
- var RETURN_DOM_FRAGMENT = false;
577
-
578
- /* If `RETURN_DOM` or `RETURN_DOM_FRAGMENT` is enabled, decide if the returned DOM
579
- * `Node` is imported into the current `Document`. If this flag is not enabled the
580
- * `Node` will belong (its ownerDocument) to a fresh `HTMLDocument`, created by
581
- * DOMPurify.
582
- *
583
- * This defaults to `true` starting DOMPurify 2.2.0. Note that setting it to `false`
584
- * might cause XSS from attacks hidden in closed shadowroots in case the browser
585
- * supports Declarative Shadow: DOM https://web.dev/declarative-shadow-dom/
586
- */
587
- var RETURN_DOM_IMPORT = true;
588
-
589
- /* Try to return a Trusted Type object instead of a string, return a string in
590
- * case Trusted Types are not supported */
591
- var RETURN_TRUSTED_TYPE = false;
592
-
593
- /* Output should be free from DOM clobbering attacks? */
594
- var SANITIZE_DOM = true;
595
-
596
- /* Keep element content when removing element? */
597
- var KEEP_CONTENT = true;
598
-
599
- /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
600
- * of importing it into a new Document and returning a sanitized copy */
601
- var IN_PLACE = false;
602
-
603
- /* Allow usage of profiles like html, svg and mathMl */
604
- var USE_PROFILES = {};
605
-
606
- /* Tags to ignore content of when KEEP_CONTENT is true */
607
- var 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']);
608
-
609
- /* Tags that are safe for data: URIs */
610
- var DATA_URI_TAGS = null;
611
- var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
612
-
613
- /* Attributes safe for values like "javascript:" */
614
- var URI_SAFE_ATTRIBUTES = null;
615
- var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'summary', 'title', 'value', 'style', 'xmlns']);
616
-
617
- var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
618
- var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
619
- var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
620
- /* Document namespace */
621
- var NAMESPACE = HTML_NAMESPACE;
622
- var IS_EMPTY_INPUT = false;
623
-
624
- /* Keep a reference to config to pass to hooks */
625
- var CONFIG = null;
626
-
627
- /* Ideally, do not touch anything below this line */
628
- /* ______________________________________________ */
629
-
630
- var formElement = document.createElement('form');
631
-
632
- /**
633
- * _parseConfig
634
- *
635
- * @param {Object} cfg optional config literal
636
- */
637
- // eslint-disable-next-line complexity
638
- var _parseConfig = function _parseConfig(cfg) {
639
- if (CONFIG && CONFIG === cfg) {
640
- return;
641
- }
642
-
643
- /* Shield configuration object from tampering */
644
- if (!cfg || (typeof cfg === 'undefined' ? 'undefined' : _typeof(cfg)) !== 'object') {
645
- cfg = {};
646
- }
647
-
648
- /* Shield configuration object from prototype pollution */
649
- cfg = clone(cfg);
650
-
651
- /* Set configuration parameters */
652
- ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS;
653
- ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR;
654
- URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES;
655
- DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS;
656
- FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {};
657
- FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {};
658
- USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
659
- ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
660
- ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
661
- ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
662
- SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
663
- WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
664
- RETURN_DOM = cfg.RETURN_DOM || false; // Default false
665
- RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
666
- RETURN_DOM_IMPORT = cfg.RETURN_DOM_IMPORT !== false; // Default true
667
- RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
668
- FORCE_BODY = cfg.FORCE_BODY || false; // Default false
669
- SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
670
- KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
671
- IN_PLACE = cfg.IN_PLACE || false; // Default false
672
- IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1;
673
- NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
674
- if (SAFE_FOR_TEMPLATES) {
675
- ALLOW_DATA_ATTR = false;
676
- }
677
-
678
- if (RETURN_DOM_FRAGMENT) {
679
- RETURN_DOM = true;
680
- }
681
-
682
- /* Parse profile info */
683
- if (USE_PROFILES) {
684
- ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(text)));
685
- ALLOWED_ATTR = [];
686
- if (USE_PROFILES.html === true) {
687
- addToSet(ALLOWED_TAGS, html);
688
- addToSet(ALLOWED_ATTR, html$1);
689
- }
690
-
691
- if (USE_PROFILES.svg === true) {
692
- addToSet(ALLOWED_TAGS, svg);
693
- addToSet(ALLOWED_ATTR, svg$1);
694
- addToSet(ALLOWED_ATTR, xml);
695
- }
696
-
697
- if (USE_PROFILES.svgFilters === true) {
698
- addToSet(ALLOWED_TAGS, svgFilters);
699
- addToSet(ALLOWED_ATTR, svg$1);
700
- addToSet(ALLOWED_ATTR, xml);
701
- }
702
-
703
- if (USE_PROFILES.mathMl === true) {
704
- addToSet(ALLOWED_TAGS, mathMl);
705
- addToSet(ALLOWED_ATTR, mathMl$1);
706
- addToSet(ALLOWED_ATTR, xml);
707
- }
708
- }
709
-
710
- /* Merge configuration parameters */
711
- if (cfg.ADD_TAGS) {
712
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
713
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
714
- }
715
-
716
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS);
717
- }
718
-
719
- if (cfg.ADD_ATTR) {
720
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
721
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
722
- }
723
-
724
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR);
725
- }
726
-
727
- if (cfg.ADD_URI_SAFE_ATTR) {
728
- addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);
729
- }
730
-
731
- /* Add #text in case KEEP_CONTENT is set to true */
732
- if (KEEP_CONTENT) {
733
- ALLOWED_TAGS['#text'] = true;
734
- }
735
-
736
- /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
737
- if (WHOLE_DOCUMENT) {
738
- addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
739
- }
740
-
741
- /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
742
- if (ALLOWED_TAGS.table) {
743
- addToSet(ALLOWED_TAGS, ['tbody']);
744
- delete FORBID_TAGS.tbody;
745
- }
746
-
747
- // Prevent further manipulation of configuration.
748
- // Not available in IE8, Safari 5, etc.
749
- if (freeze) {
750
- freeze(cfg);
751
- }
752
-
753
- CONFIG = cfg;
754
- };
755
-
756
- var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
757
-
758
- var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']);
759
-
760
- /* Keep track of all possible SVG and MathML tags
761
- * so that we can perform the namespace checks
762
- * correctly. */
763
- var ALL_SVG_TAGS = addToSet({}, svg);
764
- addToSet(ALL_SVG_TAGS, svgFilters);
765
- addToSet(ALL_SVG_TAGS, svgDisallowed);
766
-
767
- var ALL_MATHML_TAGS = addToSet({}, mathMl);
768
- addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
769
-
770
- /**
771
- *
772
- *
773
- * @param {Element} element a DOM element whose namespace is being checked
774
- * @returns {boolean} Return false if the element has a
775
- * namespace that a spec-compliant parser would never
776
- * return. Return true otherwise.
777
- */
778
- var _checkValidNamespace = function _checkValidNamespace(element) {
779
- var parent = getParentNode(element);
780
-
781
- // In JSDOM, if we're inside shadow DOM, then parentNode
782
- // can be null. We just simulate parent in this case.
783
- if (!parent || !parent.tagName) {
784
- parent = {
785
- namespaceURI: HTML_NAMESPACE,
786
- tagName: 'template'
787
- };
788
- }
789
-
790
- var tagName = stringToLowerCase(element.tagName);
791
- var parentTagName = stringToLowerCase(parent.tagName);
792
-
793
- if (element.namespaceURI === SVG_NAMESPACE) {
794
- // The only way to switch from HTML namespace to SVG
795
- // is via <svg>. If it happens via any other tag, then
796
- // it should be killed.
797
- if (parent.namespaceURI === HTML_NAMESPACE) {
798
- return tagName === 'svg';
799
- }
800
-
801
- // The only way to switch from MathML to SVG is via
802
- // svg if parent is either <annotation-xml> or MathML
803
- // text integration points.
804
- if (parent.namespaceURI === MATHML_NAMESPACE) {
805
- return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
806
- }
807
-
808
- // We only allow elements that are defined in SVG
809
- // spec. All others are disallowed in SVG namespace.
810
- return Boolean(ALL_SVG_TAGS[tagName]);
811
- }
812
-
813
- if (element.namespaceURI === MATHML_NAMESPACE) {
814
- // The only way to switch from HTML namespace to MathML
815
- // is via <math>. If it happens via any other tag, then
816
- // it should be killed.
817
- if (parent.namespaceURI === HTML_NAMESPACE) {
818
- return tagName === 'math';
819
- }
820
-
821
- // The only way to switch from SVG to MathML is via
822
- // <math> and HTML integration points
823
- if (parent.namespaceURI === SVG_NAMESPACE) {
824
- return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
825
- }
826
-
827
- // We only allow elements that are defined in MathML
828
- // spec. All others are disallowed in MathML namespace.
829
- return Boolean(ALL_MATHML_TAGS[tagName]);
830
- }
831
-
832
- if (element.namespaceURI === HTML_NAMESPACE) {
833
- // The only way to switch from SVG to HTML is via
834
- // HTML integration points, and from MathML to HTML
835
- // is via MathML text integration points
836
- if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
837
- return false;
838
- }
839
-
840
- if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
841
- return false;
842
- }
843
-
844
- // Certain elements are allowed in both SVG and HTML
845
- // namespace. We need to specify them explicitly
846
- // so that they don't get erronously deleted from
847
- // HTML namespace.
848
- var commonSvgAndHTMLElements = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
849
-
850
- // We disallow tags that are specific for MathML
851
- // or SVG and should never appear in HTML namespace
852
- return !ALL_MATHML_TAGS[tagName] && (commonSvgAndHTMLElements[tagName] || !ALL_SVG_TAGS[tagName]);
853
- }
854
-
855
- // The code should never reach this place (this means
856
- // that the element somehow got namespace that is not
857
- // HTML, SVG or MathML). Return false just in case.
858
- return false;
859
- };
860
-
861
- /**
862
- * _forceRemove
863
- *
864
- * @param {Node} node a DOM node
865
- */
866
- var _forceRemove = function _forceRemove(node) {
867
- arrayPush(DOMPurify.removed, { element: node });
868
- try {
869
- // eslint-disable-next-line unicorn/prefer-dom-node-remove
870
- node.parentNode.removeChild(node);
871
- } catch (_) {
872
- try {
873
- node.outerHTML = emptyHTML;
874
- } catch (_) {
875
- node.remove();
876
- }
877
- }
878
- };
879
-
880
- /**
881
- * _removeAttribute
882
- *
883
- * @param {String} name an Attribute name
884
- * @param {Node} node a DOM node
885
- */
886
- var _removeAttribute = function _removeAttribute(name, node) {
887
- try {
888
- arrayPush(DOMPurify.removed, {
889
- attribute: node.getAttributeNode(name),
890
- from: node
891
- });
892
- } catch (_) {
893
- arrayPush(DOMPurify.removed, {
894
- attribute: null,
895
- from: node
896
- });
897
- }
898
-
899
- node.removeAttribute(name);
900
-
901
- // We void attribute values for unremovable "is"" attributes
902
- if (name === 'is' && !ALLOWED_ATTR[name]) {
903
- if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
904
- try {
905
- _forceRemove(node);
906
- } catch (_) {}
907
- } else {
908
- try {
909
- node.setAttribute(name, '');
910
- } catch (_) {}
911
- }
912
- }
913
- };
914
-
915
- /**
916
- * _initDocument
917
- *
918
- * @param {String} dirty a string of dirty markup
919
- * @return {Document} a DOM, filled with the dirty markup
920
- */
921
- var _initDocument = function _initDocument(dirty) {
922
- /* Create a HTML document */
923
- var doc = void 0;
924
- var leadingWhitespace = void 0;
925
-
926
- if (FORCE_BODY) {
927
- dirty = '<remove></remove>' + dirty;
928
- } else {
929
- /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
930
- var matches = stringMatch(dirty, /^[\r\n\t ]+/);
931
- leadingWhitespace = matches && matches[0];
932
- }
933
-
934
- var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
935
- /*
936
- * Use the DOMParser API by default, fallback later if needs be
937
- * DOMParser not work for svg when has multiple root element.
938
- */
939
- if (NAMESPACE === HTML_NAMESPACE) {
940
- try {
941
- doc = new DOMParser().parseFromString(dirtyPayload, 'text/html');
942
- } catch (_) {}
943
- }
944
-
945
- /* Use createHTMLDocument in case DOMParser is not available */
946
- if (!doc || !doc.documentElement) {
947
- doc = implementation.createDocument(NAMESPACE, 'template', null);
948
- try {
949
- doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload;
950
- } catch (_) {
951
- // Syntax error if dirtyPayload is invalid xml
952
- }
953
- }
954
-
955
- var body = doc.body || doc.documentElement;
956
-
957
- if (dirty && leadingWhitespace) {
958
- body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
959
- }
960
-
961
- /* Work on whole document or just its body */
962
- return WHOLE_DOCUMENT ? doc.documentElement : body;
963
- };
964
-
965
- /**
966
- * _createIterator
967
- *
968
- * @param {Document} root document/fragment to create iterator for
969
- * @return {Iterator} iterator instance
970
- */
971
- var _createIterator = function _createIterator(root) {
972
- return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);
973
- };
974
-
975
- /**
976
- * _isClobbered
977
- *
978
- * @param {Node} elm element to check for clobbering attacks
979
- * @return {Boolean} true if clobbered, false if safe
980
- */
981
- var _isClobbered = function _isClobbered(elm) {
982
- if (elm instanceof Text || elm instanceof Comment) {
983
- return false;
984
- }
985
-
986
- if (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') {
987
- return true;
988
- }
989
-
990
- return false;
991
- };
992
-
993
- /**
994
- * _isNode
995
- *
996
- * @param {Node} obj object to check whether it's a DOM node
997
- * @return {Boolean} true is object is a DOM node
998
- */
999
- var _isNode = function _isNode(object) {
1000
- return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? object instanceof Node : object && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';
1001
- };
1002
-
1003
- /**
1004
- * _executeHook
1005
- * Execute user configurable hooks
1006
- *
1007
- * @param {String} entryPoint Name of the hook's entry point
1008
- * @param {Node} currentNode node to work on with the hook
1009
- * @param {Object} data additional hook parameters
1010
- */
1011
- var _executeHook = function _executeHook(entryPoint, currentNode, data) {
1012
- if (!hooks[entryPoint]) {
1013
- return;
1014
- }
1015
-
1016
- arrayForEach(hooks[entryPoint], function (hook) {
1017
- hook.call(DOMPurify, currentNode, data, CONFIG);
1018
- });
1019
- };
1020
-
1021
- /**
1022
- * _sanitizeElements
1023
- *
1024
- * @protect nodeName
1025
- * @protect textContent
1026
- * @protect removeChild
1027
- *
1028
- * @param {Node} currentNode to check for permission to exist
1029
- * @return {Boolean} true if node was killed, false if left alive
1030
- */
1031
- var _sanitizeElements = function _sanitizeElements(currentNode) {
1032
- var content = void 0;
1033
-
1034
- /* Execute a hook if present */
1035
- _executeHook('beforeSanitizeElements', currentNode, null);
1036
-
1037
- /* Check if element is clobbered or can clobber */
1038
- if (_isClobbered(currentNode)) {
1039
- _forceRemove(currentNode);
1040
- return true;
1041
- }
1042
-
1043
- /* Check if tagname contains Unicode */
1044
- if (stringMatch(currentNode.nodeName, /[\u0080-\uFFFF]/)) {
1045
- _forceRemove(currentNode);
1046
- return true;
1047
- }
1048
-
1049
- /* Now let's check the element's type and name */
1050
- var tagName = stringToLowerCase(currentNode.nodeName);
1051
-
1052
- /* Execute a hook if present */
1053
- _executeHook('uponSanitizeElement', currentNode, {
1054
- tagName: tagName,
1055
- allowedTags: ALLOWED_TAGS
1056
- });
1057
-
1058
- /* Detect mXSS attempts abusing namespace confusion */
1059
- if (!_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
1060
- _forceRemove(currentNode);
1061
- return true;
1062
- }
1063
-
1064
- /* Remove element if anything forbids its presence */
1065
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1066
- /* Keep content except for bad-listed elements */
1067
- if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1068
- var parentNode = getParentNode(currentNode) || currentNode.parentNode;
1069
- var childNodes = getChildNodes(currentNode) || currentNode.childNodes;
1070
-
1071
- if (childNodes && parentNode) {
1072
- var childCount = childNodes.length;
1073
-
1074
- for (var i = childCount - 1; i >= 0; --i) {
1075
- parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
1076
- }
1077
- }
1078
- }
1079
-
1080
- _forceRemove(currentNode);
1081
- return true;
1082
- }
1083
-
1084
- /* Check whether element has a valid namespace */
1085
- if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1086
- _forceRemove(currentNode);
1087
- return true;
1088
- }
1089
-
1090
- if ((tagName === 'noscript' || tagName === 'noembed') && regExpTest(/<\/no(script|embed)/i, currentNode.innerHTML)) {
1091
- _forceRemove(currentNode);
1092
- return true;
1093
- }
1094
-
1095
- /* Sanitize element content to be template-safe */
1096
- if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
1097
- /* Get the element's text content */
1098
- content = currentNode.textContent;
1099
- content = stringReplace(content, MUSTACHE_EXPR$$1, ' ');
1100
- content = stringReplace(content, ERB_EXPR$$1, ' ');
1101
- if (currentNode.textContent !== content) {
1102
- arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
1103
- currentNode.textContent = content;
1104
- }
1105
- }
1106
-
1107
- /* Execute a hook if present */
1108
- _executeHook('afterSanitizeElements', currentNode, null);
1109
-
1110
- return false;
1111
- };
1112
-
1113
- /**
1114
- * _isValidAttribute
1115
- *
1116
- * @param {string} lcTag Lowercase tag name of containing element.
1117
- * @param {string} lcName Lowercase attribute name.
1118
- * @param {string} value Attribute value.
1119
- * @return {Boolean} Returns true if `value` is valid, otherwise false.
1120
- */
1121
- // eslint-disable-next-line complexity
1122
- var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1123
- /* Make sure attribute cannot clobber */
1124
- if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
1125
- return false;
1126
- }
1127
-
1128
- /* Allow valid data-* attributes: At least one character after "-"
1129
- (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1130
- XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1131
- We don't need to check the value; it's always URI safe. */
1132
- if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$$1, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$$1, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1133
- return false;
1134
-
1135
- /* Check value is safe. First, is attr inert? If so, is safe */
1136
- } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$$1, stringReplace(value, ATTR_WHITESPACE$$1, ''))) ; 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$$1, stringReplace(value, ATTR_WHITESPACE$$1, ''))) ; else if (!value) ; else {
1137
- return false;
1138
- }
1139
-
1140
- return true;
1141
- };
1142
-
1143
- /**
1144
- * _sanitizeAttributes
1145
- *
1146
- * @protect attributes
1147
- * @protect nodeName
1148
- * @protect removeAttribute
1149
- * @protect setAttribute
1150
- *
1151
- * @param {Node} currentNode to sanitize
1152
- */
1153
- var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1154
- var attr = void 0;
1155
- var value = void 0;
1156
- var lcName = void 0;
1157
- var l = void 0;
1158
- /* Execute a hook if present */
1159
- _executeHook('beforeSanitizeAttributes', currentNode, null);
1160
-
1161
- var attributes = currentNode.attributes;
1162
-
1163
- /* Check if we have attributes; if not we might have a text node */
1164
-
1165
- if (!attributes) {
1166
- return;
1167
- }
1168
-
1169
- var hookEvent = {
1170
- attrName: '',
1171
- attrValue: '',
1172
- keepAttr: true,
1173
- allowedAttributes: ALLOWED_ATTR
1174
- };
1175
- l = attributes.length;
1176
-
1177
- /* Go backwards over all attributes; safely remove bad ones */
1178
- while (l--) {
1179
- attr = attributes[l];
1180
- var _attr = attr,
1181
- name = _attr.name,
1182
- namespaceURI = _attr.namespaceURI;
1183
-
1184
- value = stringTrim(attr.value);
1185
- lcName = stringToLowerCase(name);
1186
-
1187
- /* Execute a hook if present */
1188
- hookEvent.attrName = lcName;
1189
- hookEvent.attrValue = value;
1190
- hookEvent.keepAttr = true;
1191
- hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
1192
- _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
1193
- value = hookEvent.attrValue;
1194
- /* Did the hooks approve of the attribute? */
1195
- if (hookEvent.forceKeepAttr) {
1196
- continue;
1197
- }
1198
-
1199
- /* Remove attribute */
1200
- _removeAttribute(name, currentNode);
1201
-
1202
- /* Did the hooks approve of the attribute? */
1203
- if (!hookEvent.keepAttr) {
1204
- continue;
1205
- }
1206
-
1207
- /* Work around a security issue in jQuery 3.0 */
1208
- if (regExpTest(/\/>/i, value)) {
1209
- _removeAttribute(name, currentNode);
1210
- continue;
1211
- }
1212
-
1213
- /* Sanitize attribute content to be template-safe */
1214
- if (SAFE_FOR_TEMPLATES) {
1215
- value = stringReplace(value, MUSTACHE_EXPR$$1, ' ');
1216
- value = stringReplace(value, ERB_EXPR$$1, ' ');
1217
- }
1218
-
1219
- /* Is `value` valid for this attribute? */
1220
- var lcTag = currentNode.nodeName.toLowerCase();
1221
- if (!_isValidAttribute(lcTag, lcName, value)) {
1222
- continue;
1223
- }
1224
-
1225
- /* Handle invalid data-* attribute set by try-catching it */
1226
- try {
1227
- if (namespaceURI) {
1228
- currentNode.setAttributeNS(namespaceURI, name, value);
1229
- } else {
1230
- /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1231
- currentNode.setAttribute(name, value);
1232
- }
1233
-
1234
- arrayPop(DOMPurify.removed);
1235
- } catch (_) {}
1236
- }
1237
-
1238
- /* Execute a hook if present */
1239
- _executeHook('afterSanitizeAttributes', currentNode, null);
1240
- };
1241
-
1242
- /**
1243
- * _sanitizeShadowDOM
1244
- *
1245
- * @param {DocumentFragment} fragment to iterate over recursively
1246
- */
1247
- var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
1248
- var shadowNode = void 0;
1249
- var shadowIterator = _createIterator(fragment);
1250
-
1251
- /* Execute a hook if present */
1252
- _executeHook('beforeSanitizeShadowDOM', fragment, null);
1253
-
1254
- while (shadowNode = shadowIterator.nextNode()) {
1255
- /* Execute a hook if present */
1256
- _executeHook('uponSanitizeShadowNode', shadowNode, null);
1257
-
1258
- /* Sanitize tags and elements */
1259
- if (_sanitizeElements(shadowNode)) {
1260
- continue;
1261
- }
1262
-
1263
- /* Deep shadow DOM detected */
1264
- if (shadowNode.content instanceof DocumentFragment) {
1265
- _sanitizeShadowDOM(shadowNode.content);
1266
- }
1267
-
1268
- /* Check attributes, sanitize if necessary */
1269
- _sanitizeAttributes(shadowNode);
1270
- }
1271
-
1272
- /* Execute a hook if present */
1273
- _executeHook('afterSanitizeShadowDOM', fragment, null);
1274
- };
1275
-
1276
- /**
1277
- * Sanitize
1278
- * Public method providing core sanitation functionality
1279
- *
1280
- * @param {String|Node} dirty string or DOM node
1281
- * @param {Object} configuration object
1282
- */
1283
- // eslint-disable-next-line complexity
1284
- DOMPurify.sanitize = function (dirty, cfg) {
1285
- var body = void 0;
1286
- var importedNode = void 0;
1287
- var currentNode = void 0;
1288
- var oldNode = void 0;
1289
- var returnNode = void 0;
1290
- /* Make sure we have a string to sanitize.
1291
- DO NOT return early, as this will return the wrong type if
1292
- the user has requested a DOM object rather than a string */
1293
- IS_EMPTY_INPUT = !dirty;
1294
- if (IS_EMPTY_INPUT) {
1295
- dirty = '<!-->';
1296
- }
1297
-
1298
- /* Stringify, in case dirty is an object */
1299
- if (typeof dirty !== 'string' && !_isNode(dirty)) {
1300
- // eslint-disable-next-line no-negated-condition
1301
- if (typeof dirty.toString !== 'function') {
1302
- throw typeErrorCreate('toString is not a function');
1303
- } else {
1304
- dirty = dirty.toString();
1305
- if (typeof dirty !== 'string') {
1306
- throw typeErrorCreate('dirty is not a string, aborting');
1307
- }
1308
- }
1309
- }
1310
-
1311
- /* Check we can run. Otherwise fall back or ignore */
1312
- if (!DOMPurify.isSupported) {
1313
- if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') {
1314
- if (typeof dirty === 'string') {
1315
- return window.toStaticHTML(dirty);
1316
- }
1317
-
1318
- if (_isNode(dirty)) {
1319
- return window.toStaticHTML(dirty.outerHTML);
1320
- }
1321
- }
1322
-
1323
- return dirty;
1324
- }
1325
-
1326
- /* Assign config vars */
1327
- if (!SET_CONFIG) {
1328
- _parseConfig(cfg);
1329
- }
1330
-
1331
- /* Clean up removed elements */
1332
- DOMPurify.removed = [];
1333
-
1334
- /* Check if dirty is correctly typed for IN_PLACE */
1335
- if (typeof dirty === 'string') {
1336
- IN_PLACE = false;
1337
- }
1338
-
1339
- if (IN_PLACE) ; else if (dirty instanceof Node) {
1340
- /* If dirty is a DOM element, append to an empty document to avoid
1341
- elements being stripped by the parser */
1342
- body = _initDocument('<!---->');
1343
- importedNode = body.ownerDocument.importNode(dirty, true);
1344
- if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
1345
- /* Node is already a body, use as is */
1346
- body = importedNode;
1347
- } else if (importedNode.nodeName === 'HTML') {
1348
- body = importedNode;
1349
- } else {
1350
- // eslint-disable-next-line unicorn/prefer-dom-node-append
1351
- body.appendChild(importedNode);
1352
- }
1353
- } else {
1354
- /* Exit directly if we have nothing to do */
1355
- if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
1356
- // eslint-disable-next-line unicorn/prefer-includes
1357
- dirty.indexOf('<') === -1) {
1358
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1359
- }
1360
-
1361
- /* Initialize the document to work on */
1362
- body = _initDocument(dirty);
1363
-
1364
- /* Check we have a DOM node from the data */
1365
- if (!body) {
1366
- return RETURN_DOM ? null : emptyHTML;
1367
- }
1368
- }
1369
-
1370
- /* Remove first element node (ours) if FORCE_BODY is set */
1371
- if (body && FORCE_BODY) {
1372
- _forceRemove(body.firstChild);
1373
- }
1374
-
1375
- /* Get node iterator */
1376
- var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
1377
-
1378
- /* Now start iterating over the created document */
1379
- while (currentNode = nodeIterator.nextNode()) {
1380
- /* Fix IE's strange behavior with manipulated textNodes #89 */
1381
- if (currentNode.nodeType === 3 && currentNode === oldNode) {
1382
- continue;
1383
- }
1384
-
1385
- /* Sanitize tags and elements */
1386
- if (_sanitizeElements(currentNode)) {
1387
- continue;
1388
- }
1389
-
1390
- /* Shadow DOM detected, sanitize it */
1391
- if (currentNode.content instanceof DocumentFragment) {
1392
- _sanitizeShadowDOM(currentNode.content);
1393
- }
1394
-
1395
- /* Check attributes, sanitize if necessary */
1396
- _sanitizeAttributes(currentNode);
1397
-
1398
- oldNode = currentNode;
1399
- }
1400
-
1401
- oldNode = null;
1402
-
1403
- /* If we sanitized `dirty` in-place, return it. */
1404
- if (IN_PLACE) {
1405
- return dirty;
1406
- }
1407
-
1408
- /* Return sanitized string or DOM */
1409
- if (RETURN_DOM) {
1410
- if (RETURN_DOM_FRAGMENT) {
1411
- returnNode = createDocumentFragment.call(body.ownerDocument);
1412
-
1413
- while (body.firstChild) {
1414
- // eslint-disable-next-line unicorn/prefer-dom-node-append
1415
- returnNode.appendChild(body.firstChild);
1416
- }
1417
- } else {
1418
- returnNode = body;
1419
- }
1420
-
1421
- if (RETURN_DOM_IMPORT) {
1422
- /*
1423
- AdoptNode() is not used because internal state is not reset
1424
- (e.g. the past names map of a HTMLFormElement), this is safe
1425
- in theory but we would rather not risk another attack vector.
1426
- The state that is cloned by importNode() is explicitly defined
1427
- by the specs.
1428
- */
1429
- returnNode = importNode.call(originalDocument, returnNode, true);
1430
- }
1431
-
1432
- return returnNode;
1433
- }
1434
-
1435
- var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1436
-
1437
- /* Sanitize final string template-safe */
1438
- if (SAFE_FOR_TEMPLATES) {
1439
- serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$$1, ' ');
1440
- serializedHTML = stringReplace(serializedHTML, ERB_EXPR$$1, ' ');
1441
- }
1442
-
1443
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1444
- };
1445
-
1446
- /**
1447
- * Public method to set the configuration once
1448
- * setConfig
1449
- *
1450
- * @param {Object} cfg configuration object
1451
- */
1452
- DOMPurify.setConfig = function (cfg) {
1453
- _parseConfig(cfg);
1454
- SET_CONFIG = true;
1455
- };
1456
-
1457
- /**
1458
- * Public method to remove the configuration
1459
- * clearConfig
1460
- *
1461
- */
1462
- DOMPurify.clearConfig = function () {
1463
- CONFIG = null;
1464
- SET_CONFIG = false;
1465
- };
1466
-
1467
- /**
1468
- * Public method to check if an attribute value is valid.
1469
- * Uses last set config, if any. Otherwise, uses config defaults.
1470
- * isValidAttribute
1471
- *
1472
- * @param {string} tag Tag name of containing element.
1473
- * @param {string} attr Attribute name.
1474
- * @param {string} value Attribute value.
1475
- * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
1476
- */
1477
- DOMPurify.isValidAttribute = function (tag, attr, value) {
1478
- /* Initialize shared config vars if necessary. */
1479
- if (!CONFIG) {
1480
- _parseConfig({});
1481
- }
1482
-
1483
- var lcTag = stringToLowerCase(tag);
1484
- var lcName = stringToLowerCase(attr);
1485
- return _isValidAttribute(lcTag, lcName, value);
1486
- };
1487
-
1488
- /**
1489
- * AddHook
1490
- * Public method to add DOMPurify hooks
1491
- *
1492
- * @param {String} entryPoint entry point for the hook to add
1493
- * @param {Function} hookFunction function to execute
1494
- */
1495
- DOMPurify.addHook = function (entryPoint, hookFunction) {
1496
- if (typeof hookFunction !== 'function') {
1497
- return;
1498
- }
1499
-
1500
- hooks[entryPoint] = hooks[entryPoint] || [];
1501
- arrayPush(hooks[entryPoint], hookFunction);
1502
- };
1503
-
1504
- /**
1505
- * RemoveHook
1506
- * Public method to remove a DOMPurify hook at a given entryPoint
1507
- * (pops it from the stack of hooks if more are present)
1508
- *
1509
- * @param {String} entryPoint entry point for the hook to remove
1510
- */
1511
- DOMPurify.removeHook = function (entryPoint) {
1512
- if (hooks[entryPoint]) {
1513
- arrayPop(hooks[entryPoint]);
1514
- }
1515
- };
1516
-
1517
- /**
1518
- * RemoveHooks
1519
- * Public method to remove all DOMPurify hooks at a given entryPoint
1520
- *
1521
- * @param {String} entryPoint entry point for the hooks to remove
1522
- */
1523
- DOMPurify.removeHooks = function (entryPoint) {
1524
- if (hooks[entryPoint]) {
1525
- hooks[entryPoint] = [];
1526
- }
1527
- };
1528
-
1529
- /**
1530
- * RemoveAllHooks
1531
- * Public method to remove all DOMPurify hooks
1532
- *
1533
- */
1534
- DOMPurify.removeAllHooks = function () {
1535
- hooks = {};
1536
- };
1537
-
1538
- return DOMPurify;
1539
- }
1540
-
1541
- var purify = createDOMPurify();
1542
-
1543
- return purify;
1544
-
1545
- }));
1546
- //# sourceMappingURL=purify.js.map
1547
-
1548
-
1549
- /***/ }),
1550
-
1551
- /***/ 2703:
1552
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1553
-
1554
- "use strict";
1555
- /**
1556
- * Copyright (c) 2013-present, Facebook, Inc.
1557
- *
1558
- * This source code is licensed under the MIT license found in the
1559
- * LICENSE file in the root directory of this source tree.
1560
- */
1561
-
1562
-
1563
-
1564
- var ReactPropTypesSecret = __webpack_require__(414);
1565
-
1566
- function emptyFunction() {}
1567
- function emptyFunctionWithReset() {}
1568
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
1569
-
1570
- module.exports = function() {
1571
- function shim(props, propName, componentName, location, propFullName, secret) {
1572
- if (secret === ReactPropTypesSecret) {
1573
- // It is still safe when called from React.
1574
- return;
1575
- }
1576
- var err = new Error(
1577
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1578
- 'Use PropTypes.checkPropTypes() to call them. ' +
1579
- 'Read more at http://fb.me/use-check-prop-types'
1580
- );
1581
- err.name = 'Invariant Violation';
1582
- throw err;
1583
- };
1584
- shim.isRequired = shim;
1585
- function getShim() {
1586
- return shim;
1587
- };
1588
- // Important!
1589
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1590
- var ReactPropTypes = {
1591
- array: shim,
1592
- bool: shim,
1593
- func: shim,
1594
- number: shim,
1595
- object: shim,
1596
- string: shim,
1597
- symbol: shim,
1598
-
1599
- any: shim,
1600
- arrayOf: getShim,
1601
- element: shim,
1602
- elementType: shim,
1603
- instanceOf: getShim,
1604
- node: shim,
1605
- objectOf: getShim,
1606
- oneOf: getShim,
1607
- oneOfType: getShim,
1608
- shape: getShim,
1609
- exact: getShim,
1610
-
1611
- checkPropTypes: emptyFunctionWithReset,
1612
- resetWarningCache: emptyFunction
1613
- };
1614
-
1615
- ReactPropTypes.PropTypes = ReactPropTypes;
1616
-
1617
- return ReactPropTypes;
1618
- };
189
+ /***/ 6357:
190
+ /***/ ((module) => {
1619
191
 
192
+ module.exports = __WEBPACK_EXTERNAL_MODULE__6357__;
1620
193
 
1621
194
  /***/ }),
1622
195
 
1623
- /***/ 5697:
1624
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1625
-
1626
- /**
1627
- * Copyright (c) 2013-present, Facebook, Inc.
1628
- *
1629
- * This source code is licensed under the MIT license found in the
1630
- * LICENSE file in the root directory of this source tree.
1631
- */
1632
-
1633
- if (false) { var throwOnDirectAccess, ReactIs; } else {
1634
- // By explicitly using `prop-types` you are opting into new production behavior.
1635
- // http://fb.me/prop-types-in-prod
1636
- module.exports = __webpack_require__(2703)();
1637
- }
196
+ /***/ 3474:
197
+ /***/ ((module) => {
1638
198
 
199
+ module.exports = __WEBPACK_EXTERNAL_MODULE__3474__;
1639
200
 
1640
201
  /***/ }),
1641
202
 
1642
- /***/ 414:
203
+ /***/ 9281:
1643
204
  /***/ ((module) => {
1644
205
 
1645
- "use strict";
1646
- /**
1647
- * Copyright (c) 2013-present, Facebook, Inc.
1648
- *
1649
- * This source code is licensed under the MIT license found in the
1650
- * LICENSE file in the root directory of this source tree.
1651
- */
1652
-
1653
-
1654
-
1655
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
1656
-
1657
- module.exports = ReactPropTypesSecret;
1658
-
206
+ module.exports = __WEBPACK_EXTERNAL_MODULE__9281__;
1659
207
 
1660
208
  /***/ }),
1661
209
 
1662
- /***/ 9281:
210
+ /***/ 5044:
1663
211
  /***/ ((module) => {
1664
212
 
1665
- "use strict";
1666
- module.exports = __WEBPACK_EXTERNAL_MODULE__9281__;
213
+ module.exports = __WEBPACK_EXTERNAL_MODULE__5044__;
1667
214
 
1668
215
  /***/ })
1669
216
 
@@ -1687,7 +234,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__9281__;
1687
234
  /******/ };
1688
235
  /******/
1689
236
  /******/ // Execute the module function
1690
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
237
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
1691
238
  /******/
1692
239
  /******/ // Return the exports of the module
1693
240
  /******/ return module.exports;
@@ -1736,9 +283,8 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__9281__;
1736
283
  /******/
1737
284
  /************************************************************************/
1738
285
  var __webpack_exports__ = {};
1739
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
286
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
1740
287
  (() => {
1741
- "use strict";
1742
288
  __webpack_require__.r(__webpack_exports__);
1743
289
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1744
290
  /* harmony export */ "reducerFlashes": () => (/* binding */ reducerFlashes),
@@ -1748,13 +294,13 @@ __webpack_require__.r(__webpack_exports__);
1748
294
  /* harmony export */ });
1749
295
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9281);
1750
296
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
1751
- /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7856);
297
+ /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6357);
1752
298
  /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dompurify__WEBPACK_IMPORTED_MODULE_1__);
1753
- /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5697);
299
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3474);
1754
300
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
1755
- /* harmony import */ var _remote_data_store__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3511);
1756
- /* harmony import */ var _ConnectStateWrapper_component_jsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9787);
1757
- /* harmony import */ var _Icon_component_jsx__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9008);
301
+ /* harmony import */ var _remote_data_store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3511);
302
+ /* harmony import */ var _ConnectStateWrapper_component_jsx__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9787);
303
+ /* harmony import */ var _Icon_component_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9008);
1758
304
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1759
305
 
1760
306
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
@@ -1920,7 +466,7 @@ var Flash = function Flash(_ref) {
1920
466
  "data-id": "ui-flash"
1921
467
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1922
468
  className: "".concat(FLASH_BG_COLOR[type], " p-32 flex align-center rounded shadow-container-subtle")
1923
- }, withIcons[type] && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_Icon_component_jsx__WEBPACK_IMPORTED_MODULE_4__.default, {
469
+ }, withIcons[type] && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_Icon_component_jsx__WEBPACK_IMPORTED_MODULE_5__.default, {
1924
470
  name: withIcons[type],
1925
471
  color: iconColor[type],
1926
472
  size: "1.5rem",
@@ -1934,7 +480,7 @@ var Flash = function Flash(_ref) {
1934
480
  type: "button",
1935
481
  className: "p-0 ml-auto self-start focus:outline-none",
1936
482
  onClick: closeFlash
1937
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_Icon_component_jsx__WEBPACK_IMPORTED_MODULE_4__.default, {
483
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_Icon_component_jsx__WEBPACK_IMPORTED_MODULE_5__.default, {
1938
484
  name: "icon-gui-close",
1939
485
  color: iconColor[type],
1940
486
  size: "1.5rem",
@@ -1978,14 +524,14 @@ var BackendFlashes = function BackendFlashes(_ref3) {
1978
524
  }) || [];
1979
525
 
1980
526
  if (transformedFlashes.length > 0) {
1981
- var store = (0,_remote_data_store__WEBPACK_IMPORTED_MODULE_5__/* .getRemoteDataStore */ .cO)();
527
+ var store = (0,_remote_data_store__WEBPACK_IMPORTED_MODULE_3__/* .getRemoteDataStore */ .cO)();
1982
528
  store.dispatch({
1983
529
  type: "flash/push",
1984
530
  payload: transformedFlashes
1985
531
  });
1986
532
  }
1987
533
  }, []);
1988
- var WrappedFlashes = (0,_ConnectStateWrapper_component_jsx__WEBPACK_IMPORTED_MODULE_3__.default)(Flashes, {
534
+ var WrappedFlashes = (0,_ConnectStateWrapper_component_jsx__WEBPACK_IMPORTED_MODULE_4__.default)(Flashes, {
1989
535
  flashes: selectFlashes
1990
536
  });
1991
537
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(WrappedFlashes, null);