@ably/ui 5.0.1-dev.baf5b97.0 → 5.3.0-dev.3c981a4

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 (176) hide show
  1. package/core/.gitignore +1 -0
  2. package/core/Code/component.css +70 -0
  3. package/core/Code/component.js +1 -0
  4. package/core/Code.jsx +7578 -0
  5. package/core/ConnectStateWrapper/component.js +1 -0
  6. package/core/ConnectStateWrapper.jsx +213 -0
  7. package/core/ContactFooter/component.css +12 -0
  8. package/core/ContactFooter/component.js +1 -0
  9. package/core/ContactFooter.jsx +448 -0
  10. package/core/CookieMessage/component.css +14 -0
  11. package/core/CookieMessage/component.js +1 -0
  12. package/core/CookieMessage.jsx +476 -0
  13. package/core/CustomerLogos/component.js +1 -0
  14. package/core/CustomerLogos.jsx +246 -0
  15. package/core/FeatureFooter/component.css +13 -0
  16. package/core/FeatureFooter/component.js +1 -0
  17. package/core/FeatureFooter.jsx +17 -0
  18. package/core/FeaturedLink/component.css +16 -0
  19. package/core/FeaturedLink/component.js +1 -0
  20. package/core/FeaturedLink.jsx +307 -0
  21. package/core/Flash/component.css +30 -0
  22. package/core/Flash/component.js +1 -0
  23. package/core/Flash.jsx +2002 -0
  24. package/core/Footer/component.css +14 -0
  25. package/core/Footer/component.js +1 -0
  26. package/core/Footer.jsx +593 -0
  27. package/core/Icon/component.css +1 -0
  28. package/core/Icon/component.js +1 -0
  29. package/core/Icon.jsx +257 -0
  30. package/core/Logo/component.js +1 -0
  31. package/core/Logo.jsx +302 -0
  32. package/core/Meganav/component.css +103 -0
  33. package/core/Meganav/component.js +1 -0
  34. package/core/Meganav/component.json +37 -0
  35. package/core/Meganav.jsx +6514 -0
  36. package/core/MeganavBlogPostsList/component.js +1 -0
  37. package/core/MeganavBlogPostsList.jsx +360 -0
  38. package/core/MeganavContentDevelopers/component.js +1 -0
  39. package/core/MeganavContentDevelopers.jsx +418 -0
  40. package/core/MeganavContentPlatform/component.js +1 -0
  41. package/core/MeganavContentPlatform.jsx +440 -0
  42. package/core/MeganavContentUseCases/component.js +1 -0
  43. package/core/MeganavContentUseCases.jsx +309 -0
  44. package/core/MeganavContentWhyAbly/component.js +1 -0
  45. package/core/MeganavContentWhyAbly.jsx +1471 -0
  46. package/core/MeganavControl/component.js +1 -0
  47. package/core/MeganavControl.jsx +301 -0
  48. package/core/MeganavControlMobileDropdown/component.js +1 -0
  49. package/core/MeganavControlMobileDropdown.jsx +303 -0
  50. package/core/MeganavControlMobilePanelClose/component.js +1 -0
  51. package/core/MeganavControlMobilePanelClose.jsx +301 -0
  52. package/core/MeganavControlMobilePanelOpen/component.js +1 -0
  53. package/core/MeganavControlMobilePanelOpen.jsx +299 -0
  54. package/core/MeganavItemsDesktop/component.js +1 -0
  55. package/core/MeganavItemsDesktop.jsx +377 -0
  56. package/core/MeganavItemsMobile/component.js +1 -0
  57. package/core/MeganavItemsMobile.jsx +581 -0
  58. package/core/MeganavItemsSignedIn/component.js +1 -0
  59. package/core/MeganavItemsSignedIn.jsx +461 -0
  60. package/core/Notice/component.css +8 -0
  61. package/core/Notice/component.js +2 -0
  62. package/core/Notice/component.js.LICENSE.txt +9 -0
  63. package/core/Notice.jsx +2915 -0
  64. package/core/Showcase/component.css +31 -0
  65. package/core/Showcase/component.js +1 -0
  66. package/core/Showcase.jsx +17 -0
  67. package/core/SignOutLink/component.js +1 -0
  68. package/core/SignOutLink.jsx +262 -0
  69. package/core/Slider/component.css +9 -0
  70. package/core/Slider/component.js +1 -0
  71. package/core/Slider.jsx +957 -0
  72. package/core/Test/component.js +59 -0
  73. package/core/Test.jsx +4 -0
  74. package/core/Uptime/component.css +129 -0
  75. package/core/Uptime/component.js +1 -0
  76. package/core/Uptime.jsx +1373 -0
  77. package/core/core.base.css +1 -0
  78. package/core/core.components.css +49 -0
  79. package/core/fonts/.DS_Store +0 -0
  80. package/core/fonts/NEXT-Book-Light-Italic.eot +0 -0
  81. package/core/fonts/NEXT-Book-Light-Italic.otf +0 -0
  82. package/core/fonts/NEXT-Book-Light-Italic.woff +0 -0
  83. package/core/fonts/NEXT-Book-Light-Italic.woff2 +0 -0
  84. package/core/fonts/NEXT-Book-Light.eot +0 -0
  85. package/core/fonts/NEXT-Book-Light.otf +0 -0
  86. package/core/fonts/NEXT-Book-Light.woff +0 -0
  87. package/core/fonts/NEXT-Book-Light.woff2 +0 -0
  88. package/core/fonts/NEXT-Book-Medium-Italic.eot +0 -0
  89. package/core/fonts/NEXT-Book-Medium-Italic.otf +0 -0
  90. package/core/fonts/NEXT-Book-Medium-Italic.woff +0 -0
  91. package/core/fonts/NEXT-Book-Medium-Italic.woff2 +0 -0
  92. package/core/fonts/NEXT-Book-Medium.eot +0 -0
  93. package/core/fonts/NEXT-Book-Medium.otf +0 -0
  94. package/core/fonts/NEXT-Book-Medium.woff +0 -0
  95. package/core/fonts/NEXT-Book-Medium.woff2 +0 -0
  96. package/core/fonts/next.css +59 -0
  97. package/core/images/.DS_Store +0 -0
  98. package/core/images/ably-logo.svg +15 -0
  99. package/core/images/ably-stack.svg +14 -0
  100. package/core/images/blog-thumb1.jpg +0 -0
  101. package/core/images/blog-thumb2.jpg +0 -0
  102. package/core/images/blog-thumb3.jpg +0 -0
  103. package/core/images/cust-logo-ao-col-pos.png +0 -0
  104. package/core/images/cust-logo-ao-col-pos@2x.png +0 -0
  105. package/core/images/cust-logo-ausopen-col-pos.png +0 -0
  106. package/core/images/cust-logo-ausopen-col-pos@2x.png +0 -0
  107. package/core/images/cust-logo-ausopen-mono-pos.svg +5 -0
  108. package/core/images/cust-logo-bloomberg-mono-pos.svg +11 -0
  109. package/core/images/cust-logo-hopin-mono-pos.svg +4 -0
  110. package/core/images/cust-logo-hubspot-col-pos.png +0 -0
  111. package/core/images/cust-logo-hubspot-col-pos@2x.png +0 -0
  112. package/core/images/cust-logo-hubspot-mono-pos.svg +4 -0
  113. package/core/images/cust-logo-lightspeed-col-pos.png +0 -0
  114. package/core/images/cust-logo-lightspeed-col-pos@2x.png +0 -0
  115. package/core/images/cust-logo-lightspeed-syst-col-pos.png +0 -0
  116. package/core/images/cust-logo-lightspeed-syst-col-pos@2x.png +0 -0
  117. package/core/images/cust-logo-split-col-pos.png +0 -0
  118. package/core/images/cust-logo-split-col-pos@2x.png +0 -0
  119. package/core/images/cust-logo-split-mono-pos.svg +9 -0
  120. package/core/images/cust-logo-toyota-mono-pos.svg +18 -0
  121. package/core/images/cust-logo-vitac-col-pos.png +0 -0
  122. package/core/images/cust-logo-vitac-col-pos@2x.png +0 -0
  123. package/core/images/cust-photo-hubspot-max-freiert.jpg +0 -0
  124. package/core/images/cust-photo-split-pato-echague.jpg +0 -0
  125. package/core/images/cust-photo-vitac-joe-antonio.jpg +0 -0
  126. package/core/images/flexible-companies.png +0 -0
  127. package/core/images/rocket-list-2021.png +0 -0
  128. package/core/images/scale-motif-open-empathetic.svg +1 -0
  129. package/core/images/technical-support-01-800x533.jpg +0 -0
  130. package/core/scripts.js +1 -0
  131. package/core/sprites.svg +130 -0
  132. package/core/styles.base.css +1 -0
  133. package/core/styles.components.css +49 -0
  134. package/core/styles.css +560 -0
  135. package/package.json +1 -1
  136. package/preview/log/.keep +0 -0
  137. package/preview/tmp/.keep +0 -0
  138. package/preview/tmp/pids/.keep +0 -0
  139. package/reset/.gitignore +1 -0
  140. package/reset/scripts.js +1 -0
  141. package/reset/styles.css +487 -0
  142. package/src/.DS_Store +0 -0
  143. package/src/core/.DS_Store +0 -0
  144. package/src/core/Code/component.html.erb +3 -3
  145. package/src/core/Code/component.jsx +3 -2
  146. package/src/core/Code/component.rb +2 -1
  147. package/src/core/CustomerLogos/component.html.erb +9 -0
  148. package/src/core/CustomerLogos/component.js +0 -0
  149. package/src/core/CustomerLogos/component.jsx +27 -0
  150. package/src/core/CustomerLogos/component.rb +13 -0
  151. package/src/core/FeaturedLink/component.css +1 -2
  152. package/src/core/FeaturedLink/component.html.erb +1 -1
  153. package/src/core/FeaturedLink/component.rb +3 -1
  154. package/src/core/MeganavItemsSignedIn/component.html.erb +1 -1
  155. package/src/core/MeganavItemsSignedIn/component.jsx +1 -1
  156. package/src/core/Slider/component.html.erb +2 -2
  157. package/src/core/Slider/component.js +2 -2
  158. package/src/core/Slider/component.jsx +2 -2
  159. package/src/core/icons/icon-display-api-keys.svg +3 -0
  160. package/src/core/icons/icon-display-cloud-servers.svg +3 -0
  161. package/src/core/icons/icon-display-map-pin.svg +1 -1
  162. package/src/core/icons/icon-display-servers.svg +3 -0
  163. package/src/core/icons/icon-gui-history.svg +3 -0
  164. package/src/core/icons/icon-gui-refresh.svg +10 -0
  165. package/src/core/images/cust-logo-ausopen-mono-pos.svg +5 -0
  166. package/src/core/images/cust-logo-bloomberg-mono-pos.svg +11 -0
  167. package/src/core/images/cust-logo-hopin-mono-pos.svg +4 -0
  168. package/src/core/images/cust-logo-hubspot-mono-pos.svg +4 -0
  169. package/src/core/images/cust-logo-split-mono-pos.svg +9 -0
  170. package/src/core/images/cust-logo-toyota-mono-pos.svg +18 -0
  171. package/src/core/styles/buttons.css +91 -4
  172. package/src/core/styles/forms.css +50 -0
  173. package/src/core/styles/properties.css +34 -6
  174. package/src/core/styles/text.css +62 -1
  175. package/src/core/styles.components.css +1 -0
  176. package/tailwind.config.js +22 -1
package/core/Flash.jsx ADDED
@@ -0,0 +1,2002 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("react"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else {
7
+ var a = typeof exports === 'object' ? factory(require("react")) : factory(root[undefined]);
8
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
+ }
10
+ })(this, function(__WEBPACK_EXTERNAL_MODULE__9281__) {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ var __webpack_modules__ = ({
13
+
14
+ /***/ 9787:
15
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
16
+
17
+ "use strict";
18
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
19
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
20
+ /* harmony export */ });
21
+ /* unused harmony export ConnectStateWrapper */
22
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9281);
23
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
24
+ /* harmony import */ var _remote_data_store__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3511);
25
+ 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); }
26
+
27
+ 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; }
28
+
29
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
30
+
31
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
32
+
33
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
34
+
35
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
36
+
37
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
38
+
39
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
40
+
41
+ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
42
+
43
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
44
+
45
+
46
+
47
+ /*
48
+ Connect a react component to a global store.
49
+ This is similar to what react-redux does but uses our global store so
50
+ can share state with other React mount points or anything that uses the
51
+ store.
52
+ - selectors is an object where keys are your prop names and values are your select
53
+ functions that work on the store to retrieve the state you are interested in
54
+ - initial state is set in useEffect so the wrapped component needs to handle it's props set to undefined initially
55
+ */
56
+
57
+ var ConnectStateWrapper = function ConnectStateWrapper(Component, selectors) {
58
+ var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({}),
59
+ _useState2 = _slicedToArray(_useState, 2),
60
+ state = _useState2[0],
61
+ setState = _useState2[1];
62
+
63
+ var setStateForKey = function setStateForKey(key) {
64
+ return function (storeState) {
65
+ return setState(function () {
66
+ return _defineProperty({}, key, storeState);
67
+ });
68
+ };
69
+ };
70
+
71
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
72
+ var store = (0,_remote_data_store__WEBPACK_IMPORTED_MODULE_1__/* .getRemoteDataStore */ .cO)();
73
+ var resolvedState = Object.keys(selectors).reduce(function (acc, key) {
74
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, selectors[key](store)));
75
+ }, {}); // Set initial state
76
+
77
+ setState(resolvedState); // Create a store subscription for each selector. Depending on your use case, this can be inefficient.
78
+ // When optimising for renders, look for wins with selectors better for your use and using connectState directly.
79
+
80
+ Object.keys(selectors).forEach(function (key) {
81
+ (0,_remote_data_store__WEBPACK_IMPORTED_MODULE_1__/* .connectState */ .kZ)(selectors[key], setStateForKey(key));
82
+ });
83
+ }, []);
84
+
85
+ var WrappedComponent = function WrappedComponent(props) {
86
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Component, _extends({}, props, state));
87
+ };
88
+
89
+ return WrappedComponent;
90
+ };
91
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ConnectStateWrapper);
92
+
93
+ /***/ }),
94
+
95
+ /***/ 9008:
96
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
97
+
98
+ "use strict";
99
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
100
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
101
+ /* harmony export */ });
102
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9281);
103
+ /* 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);
105
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
106
+ var _excluded = ["name", "size", "color", "additionalCSS"];
107
+
108
+ 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); }
109
+
110
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
111
+
112
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
113
+
114
+
115
+
116
+
117
+ var Icon = function Icon(_ref) {
118
+ var name = _ref.name,
119
+ _ref$size = _ref.size,
120
+ size = _ref$size === void 0 ? "0.75rem" : _ref$size,
121
+ _ref$color = _ref.color,
122
+ color = _ref$color === void 0 ? "" : _ref$color,
123
+ _ref$additionalCSS = _ref.additionalCSS,
124
+ additionalCSS = _ref$additionalCSS === void 0 ? "" : _ref$additionalCSS,
125
+ additionalAttributes = _objectWithoutProperties(_ref, _excluded);
126
+
127
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", _extends({
128
+ className: "".concat(color, " ").concat(additionalCSS),
129
+ style: {
130
+ width: size,
131
+ height: size
132
+ }
133
+ }, additionalAttributes), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("use", {
134
+ xlinkHref: "#sprite-".concat(name)
135
+ }));
136
+ };
137
+
138
+ Icon.propTypes = {
139
+ name: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string.isRequired),
140
+ size: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
141
+ color: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string),
142
+ additionalCSS: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string)
143
+ };
144
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Icon);
145
+
146
+ /***/ }),
147
+
148
+ /***/ 3511:
149
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
150
+
151
+ "use strict";
152
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
153
+ /* harmony export */ "cO": () => (/* binding */ getRemoteDataStore),
154
+ /* harmony export */ "kZ": () => (/* binding */ connectState)
155
+ /* harmony export */ });
156
+ /* unused harmony exports attachStoreToWindow, createRemoteDataStore */
157
+
158
+ var attachStoreToWindow = function attachStoreToWindow(store) {
159
+ window.AblyUi = window.AblyUi || {};
160
+ window.AblyUi.RemoteDataStore = store;
161
+ };
162
+ var getRemoteDataStore = function getRemoteDataStore() {
163
+ if (!window.AblyUi.RemoteDataStore) {
164
+ throw new Error("Remote store was called before one was created");
165
+ }
166
+
167
+ return window.AblyUi.RemoteDataStore;
168
+ };
169
+ var connectState = function connectState(selector, setState) {
170
+ var store = getRemoteDataStore();
171
+ var cachedOldState = selector(store);
172
+ store.subscribe(function () {
173
+ var newState = selector(store); // Do nothing, state is the same
174
+
175
+ if (newState === cachedOldState) {
176
+ return;
177
+ }
178
+
179
+ cachedOldState = newState;
180
+ setState(newState);
181
+ });
182
+ };
183
+ var createRemoteDataStore = function createRemoteDataStore(reducers) {
184
+ return createStore(combineReducers(reducers));
185
+ };
186
+
187
+ /***/ }),
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
+ };
1619
+
1620
+
1621
+ /***/ }),
1622
+
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
+ }
1638
+
1639
+
1640
+ /***/ }),
1641
+
1642
+ /***/ 414:
1643
+ /***/ ((module) => {
1644
+
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
+
1659
+
1660
+ /***/ }),
1661
+
1662
+ /***/ 9281:
1663
+ /***/ ((module) => {
1664
+
1665
+ "use strict";
1666
+ module.exports = __WEBPACK_EXTERNAL_MODULE__9281__;
1667
+
1668
+ /***/ })
1669
+
1670
+ /******/ });
1671
+ /************************************************************************/
1672
+ /******/ // The module cache
1673
+ /******/ var __webpack_module_cache__ = {};
1674
+ /******/
1675
+ /******/ // The require function
1676
+ /******/ function __webpack_require__(moduleId) {
1677
+ /******/ // Check if module is in cache
1678
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
1679
+ /******/ if (cachedModule !== undefined) {
1680
+ /******/ return cachedModule.exports;
1681
+ /******/ }
1682
+ /******/ // Create a new module (and put it into the cache)
1683
+ /******/ var module = __webpack_module_cache__[moduleId] = {
1684
+ /******/ // no module.id needed
1685
+ /******/ // no module.loaded needed
1686
+ /******/ exports: {}
1687
+ /******/ };
1688
+ /******/
1689
+ /******/ // Execute the module function
1690
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
1691
+ /******/
1692
+ /******/ // Return the exports of the module
1693
+ /******/ return module.exports;
1694
+ /******/ }
1695
+ /******/
1696
+ /************************************************************************/
1697
+ /******/ /* webpack/runtime/compat get default export */
1698
+ /******/ (() => {
1699
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
1700
+ /******/ __webpack_require__.n = (module) => {
1701
+ /******/ var getter = module && module.__esModule ?
1702
+ /******/ () => (module['default']) :
1703
+ /******/ () => (module);
1704
+ /******/ __webpack_require__.d(getter, { a: getter });
1705
+ /******/ return getter;
1706
+ /******/ };
1707
+ /******/ })();
1708
+ /******/
1709
+ /******/ /* webpack/runtime/define property getters */
1710
+ /******/ (() => {
1711
+ /******/ // define getter functions for harmony exports
1712
+ /******/ __webpack_require__.d = (exports, definition) => {
1713
+ /******/ for(var key in definition) {
1714
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
1715
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
1716
+ /******/ }
1717
+ /******/ }
1718
+ /******/ };
1719
+ /******/ })();
1720
+ /******/
1721
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
1722
+ /******/ (() => {
1723
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
1724
+ /******/ })();
1725
+ /******/
1726
+ /******/ /* webpack/runtime/make namespace object */
1727
+ /******/ (() => {
1728
+ /******/ // define __esModule on exports
1729
+ /******/ __webpack_require__.r = (exports) => {
1730
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1731
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1732
+ /******/ }
1733
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
1734
+ /******/ };
1735
+ /******/ })();
1736
+ /******/
1737
+ /************************************************************************/
1738
+ var __webpack_exports__ = {};
1739
+ // This entry need to be wrapped in an IIFE because it need to be in strict mode.
1740
+ (() => {
1741
+ "use strict";
1742
+ __webpack_require__.r(__webpack_exports__);
1743
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1744
+ /* harmony export */ "reducerFlashes": () => (/* binding */ reducerFlashes),
1745
+ /* harmony export */ "FLASH_DATA_ID": () => (/* binding */ FLASH_DATA_ID),
1746
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1747
+ /* harmony export */ });
1748
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9281);
1749
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
1750
+ /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7856);
1751
+ /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dompurify__WEBPACK_IMPORTED_MODULE_1__);
1752
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5697);
1753
+ /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
1754
+ /* harmony import */ var _remote_data_store__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3511);
1755
+ /* harmony import */ var _ConnectStateWrapper_component_jsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9787);
1756
+ /* harmony import */ var _Icon_component_jsx__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9008);
1757
+ 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); }
1758
+
1759
+ 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; }
1760
+
1761
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1762
+
1763
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1764
+
1765
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1766
+
1767
+ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
1768
+
1769
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1770
+
1771
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1772
+
1773
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1774
+
1775
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1776
+
1777
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1778
+
1779
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1780
+
1781
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1782
+
1783
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1784
+
1785
+
1786
+
1787
+
1788
+
1789
+
1790
+
1791
+ var REDUCER_KEY = "flashes";
1792
+ var FLASH_DATA_ID = "ui-flashes";
1793
+ var initialState = {
1794
+ items: []
1795
+ };
1796
+
1797
+ var reducerFlashes = _defineProperty({}, REDUCER_KEY, function () {
1798
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
1799
+ var action = arguments.length > 1 ? arguments[1] : undefined;
1800
+
1801
+ switch (action.type) {
1802
+ case "flash/push":
1803
+ {
1804
+ var flashes = Array.isArray(action.payload) ? action.payload : [action.payload];
1805
+ return {
1806
+ items: [].concat(_toConsumableArray(state.items), _toConsumableArray(flashes))
1807
+ };
1808
+ }
1809
+
1810
+ default:
1811
+ return state;
1812
+ }
1813
+ });
1814
+
1815
+ var selectFlashes = function selectFlashes(store) {
1816
+ return store.getState()[REDUCER_KEY];
1817
+ };
1818
+
1819
+ var FlashT = {
1820
+ type: prop_types__WEBPACK_IMPORTED_MODULE_2___default().oneOf(["error", "success", "notice", "info", "alert"]),
1821
+ content: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string)
1822
+ };
1823
+ var FLASH_BG_COLOR = {
1824
+ error: "bg-gui-error",
1825
+ success: "bg-zingy-green",
1826
+ notice: "bg-electric-cyan",
1827
+ info: "bg-electric-cyan",
1828
+ alert: "bg-active-orange"
1829
+ };
1830
+ var FLASH_TEXT_COLOR = {
1831
+ error: "text-white",
1832
+ success: "text-cool-black",
1833
+ notice: "text-cool-black",
1834
+ info: "text-cool-black",
1835
+ alert: "text-white"
1836
+ };
1837
+ var AUTO_HIDE = ["success", "info", "notice"];
1838
+ var AUTO_HIDE_TIME = 8000;
1839
+
1840
+ var Flash = function Flash(_ref) {
1841
+ var type = _ref.type,
1842
+ content = _ref.content;
1843
+ var ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
1844
+
1845
+ var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
1846
+ _useState2 = _slicedToArray(_useState, 2),
1847
+ closed = _useState2[0],
1848
+ setClosed = _useState2[1];
1849
+
1850
+ var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),
1851
+ _useState4 = _slicedToArray(_useState3, 2),
1852
+ flashHeight = _useState4[0],
1853
+ setFlashHeight = _useState4[1];
1854
+
1855
+ var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
1856
+ _useState6 = _slicedToArray(_useState5, 2),
1857
+ triggerEntryAnimation = _useState6[0],
1858
+ setTriggerEntryAnimation = _useState6[1];
1859
+
1860
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
1861
+ return setTriggerEntryAnimation(true);
1862
+ }, []);
1863
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
1864
+ if (AUTO_HIDE.includes(type)) {
1865
+ setTimeout(function () {
1866
+ // closeFlash is idempotent, we can call it even if the flash has been already closed
1867
+ closeFlash();
1868
+ }, AUTO_HIDE_TIME);
1869
+ }
1870
+ }, [closed]);
1871
+
1872
+ var closeFlash = function closeFlash() {
1873
+ if (ref.current) {
1874
+ setFlashHeight(ref.current.getBoundingClientRect().height);
1875
+ }
1876
+
1877
+ setTimeout(function () {
1878
+ return setClosed(true);
1879
+ }, 0);
1880
+ };
1881
+
1882
+ var animateEntry = triggerEntryAnimation && !closed;
1883
+ var style;
1884
+
1885
+ if (flashHeight && !closed) {
1886
+ style = {
1887
+ height: "".concat(flashHeight, "px")
1888
+ };
1889
+ } else if (closed) {
1890
+ style = {
1891
+ height: 0,
1892
+ marginTop: 0,
1893
+ zIndex: -1
1894
+ };
1895
+ } else {
1896
+ style = {};
1897
+ }
1898
+
1899
+ var safeContent = dompurify__WEBPACK_IMPORTED_MODULE_1___default().sanitize(content, {
1900
+ ALLOWED_TAGS: ["a"],
1901
+ ALLOWED_ATTR: ["href", "data-method", "rel"]
1902
+ });
1903
+ var withIcons = {
1904
+ notice: "icon-gui-ably-badge",
1905
+ success: "icon-gui-tick",
1906
+ error: "icon-gui-warning",
1907
+ alert: "icon-gui-warning"
1908
+ };
1909
+ var iconColor = {
1910
+ notice: "text-cool-black",
1911
+ success: "text-cool-black",
1912
+ error: "text-white",
1913
+ alert: "text-white"
1914
+ };
1915
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1916
+ className: "ui-flash-message ui-grid-px ".concat(animateEntry ? "ui-flash-message-enter" : ""),
1917
+ style: style,
1918
+ ref: ref,
1919
+ "data-id": "ui-flash"
1920
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1921
+ className: "".concat(FLASH_BG_COLOR[type], " p-32 flex align-center rounded shadow-container-subtle")
1922
+ }, withIcons[type] && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_Icon_component_jsx__WEBPACK_IMPORTED_MODULE_4__.default, {
1923
+ name: withIcons[type],
1924
+ color: iconColor[type],
1925
+ size: "1.5rem",
1926
+ additionalCSS: "mr-16 self-baseline"
1927
+ }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", {
1928
+ className: "ui-flash-text ".concat(FLASH_TEXT_COLOR[type]),
1929
+ dangerouslySetInnerHTML: {
1930
+ __html: safeContent
1931
+ }
1932
+ }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", {
1933
+ type: "button",
1934
+ className: "p-0 ml-auto self-start",
1935
+ onClick: closeFlash
1936
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", {
1937
+ className: "h-24 w-24 transition-colors ui-icon-cool-black"
1938
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("use", {
1939
+ xlinkHref: "#sprite-close"
1940
+ })))));
1941
+ };
1942
+
1943
+ Flash.propTypes = _objectSpread({}, FlashT);
1944
+
1945
+ var Flashes = function Flashes(_ref2) {
1946
+ var flashes = _ref2.flashes;
1947
+ var items = (flashes === null || flashes === void 0 ? void 0 : flashes.items) || [];
1948
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1949
+ className: "ui-flash",
1950
+ "data-id": FLASH_DATA_ID
1951
+ }, items.map(function (flash) {
1952
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Flash, _extends({
1953
+ key: flash.type
1954
+ }, flash));
1955
+ }));
1956
+ };
1957
+
1958
+ Flashes.propTypes = {
1959
+ flashes: prop_types__WEBPACK_IMPORTED_MODULE_2___default().shape({
1960
+ items: prop_types__WEBPACK_IMPORTED_MODULE_2___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_2___default().shape(FlashT))
1961
+ })
1962
+ };
1963
+
1964
+ var BackendFlashes = function BackendFlashes(_ref3) {
1965
+ var flashes = _ref3.flashes;
1966
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
1967
+ var transformedFlashes = flashes.map(function (flash) {
1968
+ var _flash = _slicedToArray(flash, 2),
1969
+ type = _flash[0],
1970
+ content = _flash[1];
1971
+
1972
+ return {
1973
+ type: type,
1974
+ content: content
1975
+ };
1976
+ }) || [];
1977
+
1978
+ if (transformedFlashes.length > 0) {
1979
+ var store = (0,_remote_data_store__WEBPACK_IMPORTED_MODULE_5__/* .getRemoteDataStore */ .cO)();
1980
+ store.dispatch({
1981
+ type: "flash/push",
1982
+ payload: transformedFlashes
1983
+ });
1984
+ }
1985
+ }, []);
1986
+ var WrappedFlashes = (0,_ConnectStateWrapper_component_jsx__WEBPACK_IMPORTED_MODULE_3__.default)(Flashes, {
1987
+ flashes: selectFlashes
1988
+ });
1989
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(WrappedFlashes, null);
1990
+ };
1991
+
1992
+ BackendFlashes.propTypes = {
1993
+ flashes: prop_types__WEBPACK_IMPORTED_MODULE_2___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_2___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_2___default().string)))
1994
+ };
1995
+
1996
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BackendFlashes);
1997
+ })();
1998
+
1999
+ /******/ return __webpack_exports__;
2000
+ /******/ })()
2001
+ ;
2002
+ });