@openui5/sap.m 1.105.0 → 1.106.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (417) hide show
  1. package/.reuse/dep5 +20 -17
  2. package/THIRDPARTY.txt +31 -21
  3. package/package.json +4 -4
  4. package/src/sap/m/.library +17 -1
  5. package/src/sap/m/AccButton.js +1 -1
  6. package/src/sap/m/ActionListItem.js +1 -1
  7. package/src/sap/m/ActionSelect.js +1 -1
  8. package/src/sap/m/ActionSheet.js +1 -1
  9. package/src/sap/m/App.js +1 -1
  10. package/src/sap/m/AssociativeOverflowToolbar.js +1 -1
  11. package/src/sap/m/Avatar.js +1 -1
  12. package/src/sap/m/Bar.js +1 -1
  13. package/src/sap/m/Breadcrumbs.js +1 -1
  14. package/src/sap/m/BusyDialog.js +1 -1
  15. package/src/sap/m/BusyIndicator.js +1 -1
  16. package/src/sap/m/Button.js +1 -1
  17. package/src/sap/m/Carousel.js +1 -1
  18. package/src/sap/m/CarouselLayout.js +1 -1
  19. package/src/sap/m/CarouselRenderer.js +3 -3
  20. package/src/sap/m/CheckBox.js +1 -1
  21. package/src/sap/m/ColorPalette.js +1 -1
  22. package/src/sap/m/ColorPalettePopover.js +1 -1
  23. package/src/sap/m/Column.js +5 -5
  24. package/src/sap/m/ColumnHeaderPopover.js +1 -1
  25. package/src/sap/m/ColumnListItem.js +1 -1
  26. package/src/sap/m/ColumnPopoverActionItem.js +1 -1
  27. package/src/sap/m/ColumnPopoverCustomItem.js +1 -1
  28. package/src/sap/m/ColumnPopoverItem.js +1 -1
  29. package/src/sap/m/ColumnPopoverSelectListItem.js +1 -1
  30. package/src/sap/m/ColumnPopoverSortItem.js +1 -1
  31. package/src/sap/m/ComboBox.js +1 -1
  32. package/src/sap/m/ComboBoxBase.js +3 -3
  33. package/src/sap/m/ComboBoxTextField.js +1 -1
  34. package/src/sap/m/CustomDynamicDateOption.js +1 -1
  35. package/src/sap/m/CustomListItem.js +1 -1
  36. package/src/sap/m/CustomTile.js +1 -1
  37. package/src/sap/m/CustomTreeItem.js +1 -1
  38. package/src/sap/m/DatePicker.js +3 -3
  39. package/src/sap/m/DateRangeSelection.js +2 -2
  40. package/src/sap/m/DateTimeField.js +1 -1
  41. package/src/sap/m/DateTimeInput.js +1 -1
  42. package/src/sap/m/DateTimePicker.js +7 -5
  43. package/src/sap/m/DateTimePickerRenderer.js +1 -1
  44. package/src/sap/m/Dialog.js +7 -2
  45. package/src/sap/m/DisplayListItem.js +1 -1
  46. package/src/sap/m/DraftIndicator.js +1 -1
  47. package/src/sap/m/DynamicDate.js +1 -1
  48. package/src/sap/m/DynamicDateOption.js +1 -1
  49. package/src/sap/m/DynamicDateRange.js +1 -1
  50. package/src/sap/m/DynamicDateValueHelpUIType.js +1 -1
  51. package/src/sap/m/ExpandableText.js +1 -1
  52. package/src/sap/m/FacetFilter.js +1 -1
  53. package/src/sap/m/FacetFilterItem.js +1 -1
  54. package/src/sap/m/FacetFilterList.js +3 -3
  55. package/src/sap/m/FeedContent.js +1 -1
  56. package/src/sap/m/FeedInput.js +1 -1
  57. package/src/sap/m/FeedListItem.js +1 -1
  58. package/src/sap/m/FeedListItemAction.js +1 -1
  59. package/src/sap/m/Fiori20Adapter.js +2 -2
  60. package/src/sap/m/FlexBox.js +1 -1
  61. package/src/sap/m/FlexItemData.js +1 -1
  62. package/src/sap/m/FormattedText.js +1 -1
  63. package/src/sap/m/GenericTag.js +1 -1
  64. package/src/sap/m/GenericTile.js +61 -19
  65. package/src/sap/m/GenericTileRenderer.js +7 -6
  66. package/src/sap/m/GroupHeaderListItem.js +1 -1
  67. package/src/sap/m/GrowingEnablement.js +23 -25
  68. package/src/sap/m/GrowingList.js +1 -1
  69. package/src/sap/m/HBox.js +1 -1
  70. package/src/sap/m/HeaderContainer.js +32 -30
  71. package/src/sap/m/HeaderContainerItemNavigator.js +1 -1
  72. package/src/sap/m/IconTabBar.js +1 -1
  73. package/src/sap/m/IconTabBarSelectList.js +1 -1
  74. package/src/sap/m/IconTabFilter.js +1 -1
  75. package/src/sap/m/IconTabFilterExpandButtonBadge.js +1 -1
  76. package/src/sap/m/IconTabHeader.js +2 -19
  77. package/src/sap/m/IconTabSeparator.js +1 -1
  78. package/src/sap/m/IllustratedMessage.js +35 -1
  79. package/src/sap/m/Illustration.js +8 -1
  80. package/src/sap/m/IllustrationPool.js +1 -1
  81. package/src/sap/m/IllustrationRenderer.js +1 -0
  82. package/src/sap/m/Image.js +72 -2
  83. package/src/sap/m/ImageContent.js +1 -1
  84. package/src/sap/m/ImageRenderer.js +66 -2
  85. package/src/sap/m/Input.js +12 -1
  86. package/src/sap/m/InputBase.js +1 -1
  87. package/src/sap/m/InputListItem.js +1 -1
  88. package/src/sap/m/InstanceManager.js +6 -6
  89. package/src/sap/m/Label.js +1 -1
  90. package/src/sap/m/LightBox.js +2 -2
  91. package/src/sap/m/LightBoxItem.js +1 -1
  92. package/src/sap/m/Link.js +1 -22
  93. package/src/sap/m/List.js +1 -1
  94. package/src/sap/m/ListBase.js +6 -5
  95. package/src/sap/m/ListItemBase.js +2 -2
  96. package/src/sap/m/MaskEnabler.js +1 -1
  97. package/src/sap/m/MaskInput.js +1 -1
  98. package/src/sap/m/MaskInputRule.js +1 -1
  99. package/src/sap/m/Menu.js +1 -1
  100. package/src/sap/m/MenuButton.js +1 -1
  101. package/src/sap/m/MenuItem.js +1 -1
  102. package/src/sap/m/MenuListItem.js +1 -1
  103. package/src/sap/m/MessageItem.js +1 -1
  104. package/src/sap/m/MessageListItem.js +4 -4
  105. package/src/sap/m/MessagePage.js +1 -1
  106. package/src/sap/m/MessagePopover.js +1 -1
  107. package/src/sap/m/MessagePopoverItem.js +1 -1
  108. package/src/sap/m/MessageStrip.js +1 -1
  109. package/src/sap/m/MessageToast.js +1 -1
  110. package/src/sap/m/MessageView.js +1 -1
  111. package/src/sap/m/MultiComboBox.js +1 -1
  112. package/src/sap/m/MultiEditField.js +1 -1
  113. package/src/sap/m/MultiInput.js +1 -1
  114. package/src/sap/m/NavContainer.js +1 -1
  115. package/src/sap/m/NewsContent.js +1 -1
  116. package/src/sap/m/NotificationList.js +1 -1
  117. package/src/sap/m/NotificationListBase.js +1 -1
  118. package/src/sap/m/NotificationListGroup.js +1 -1
  119. package/src/sap/m/NotificationListItem.js +1 -1
  120. package/src/sap/m/NumericContent.js +1 -1
  121. package/src/sap/m/NumericInput.js +1 -1
  122. package/src/sap/m/ObjectAttribute.js +1 -1
  123. package/src/sap/m/ObjectHeader.js +1 -1
  124. package/src/sap/m/ObjectIdentifier.js +6 -3
  125. package/src/sap/m/ObjectListItem.js +1 -1
  126. package/src/sap/m/ObjectMarker.js +1 -1
  127. package/src/sap/m/ObjectNumber.js +1 -1
  128. package/src/sap/m/ObjectStatus.js +1 -1
  129. package/src/sap/m/OverflowToolbar.js +1 -1
  130. package/src/sap/m/OverflowToolbarAssociativePopover.js +1 -1
  131. package/src/sap/m/OverflowToolbarAssociativePopoverControls.js +0 -5
  132. package/src/sap/m/OverflowToolbarButton.js +2 -2
  133. package/src/sap/m/OverflowToolbarLayoutData.js +1 -1
  134. package/src/sap/m/OverflowToolbarToggleButton.js +1 -1
  135. package/src/sap/m/P13nAnyFilterItem.js +1 -1
  136. package/src/sap/m/P13nColumnsItem.js +1 -1
  137. package/src/sap/m/P13nColumnsPanel.js +1 -1
  138. package/src/sap/m/P13nConditionPanel.js +1 -1
  139. package/src/sap/m/P13nDialog.js +1 -1
  140. package/src/sap/m/P13nDimMeasureItem.js +1 -1
  141. package/src/sap/m/P13nDimMeasurePanel.js +1 -1
  142. package/src/sap/m/P13nFilterItem.js +1 -1
  143. package/src/sap/m/P13nFilterPanel.js +1 -1
  144. package/src/sap/m/P13nGroupItem.js +1 -1
  145. package/src/sap/m/P13nGroupPanel.js +1 -1
  146. package/src/sap/m/P13nItem.js +1 -1
  147. package/src/sap/m/P13nPanel.js +1 -1
  148. package/src/sap/m/P13nSelectionItem.js +1 -1
  149. package/src/sap/m/P13nSelectionPanel.js +1 -1
  150. package/src/sap/m/P13nSortItem.js +1 -1
  151. package/src/sap/m/P13nSortPanel.js +1 -1
  152. package/src/sap/m/PDFViewer.js +1 -1
  153. package/src/sap/m/Page.js +1 -1
  154. package/src/sap/m/PageAccessibleLandmarkInfo.js +1 -1
  155. package/src/sap/m/PagingButton.js +1 -1
  156. package/src/sap/m/Panel.js +1 -1
  157. package/src/sap/m/PlanningCalendar.js +1 -1
  158. package/src/sap/m/PlanningCalendarHeader.js +1 -1
  159. package/src/sap/m/PlanningCalendarLegend.js +1 -1
  160. package/src/sap/m/PlanningCalendarRow.js +1 -1
  161. package/src/sap/m/PlanningCalendarView.js +1 -1
  162. package/src/sap/m/Popover.js +1 -1
  163. package/src/sap/m/ProgressIndicator.js +1 -1
  164. package/src/sap/m/PullToRefresh.js +1 -1
  165. package/src/sap/m/QuickView.js +1 -1
  166. package/src/sap/m/QuickViewBase.js +1 -1
  167. package/src/sap/m/QuickViewCard.js +1 -1
  168. package/src/sap/m/QuickViewGroup.js +1 -1
  169. package/src/sap/m/QuickViewGroupElement.js +1 -1
  170. package/src/sap/m/QuickViewPage.js +1 -1
  171. package/src/sap/m/RadioButton.js +1 -1
  172. package/src/sap/m/RadioButtonGroup.js +1 -8
  173. package/src/sap/m/RangeSlider.js +1 -1
  174. package/src/sap/m/RatingIndicator.js +1 -1
  175. package/src/sap/m/ResponsivePopover.js +1 -1
  176. package/src/sap/m/ResponsiveScale.js +1 -1
  177. package/src/sap/m/ScrollBar.js +1 -1
  178. package/src/sap/m/ScrollContainer.js +1 -1
  179. package/src/sap/m/SearchField.js +1 -1
  180. package/src/sap/m/SearchFieldRenderer.js +1 -0
  181. package/src/sap/m/SegmentedButton.js +1 -1
  182. package/src/sap/m/SegmentedButtonItem.js +1 -1
  183. package/src/sap/m/Select.js +2 -2
  184. package/src/sap/m/SelectDialog.js +1 -1
  185. package/src/sap/m/SelectDialogBase.js +1 -1
  186. package/src/sap/m/SelectList.js +1 -1
  187. package/src/sap/m/SelectionDetails.js +1 -1
  188. package/src/sap/m/SelectionDetailsFacade.js +2 -2
  189. package/src/sap/m/SelectionDetailsItem.js +1 -1
  190. package/src/sap/m/SelectionDetailsItemLine.js +1 -1
  191. package/src/sap/m/Shell.js +1 -1
  192. package/src/sap/m/SimpleFixFlex.js +1 -1
  193. package/src/sap/m/SinglePlanningCalendar.js +3 -3
  194. package/src/sap/m/SinglePlanningCalendarDayView.js +1 -1
  195. package/src/sap/m/SinglePlanningCalendarGrid.js +1 -1
  196. package/src/sap/m/SinglePlanningCalendarMonthGrid.js +1 -1
  197. package/src/sap/m/SinglePlanningCalendarMonthView.js +1 -1
  198. package/src/sap/m/SinglePlanningCalendarView.js +1 -1
  199. package/src/sap/m/SinglePlanningCalendarWeekView.js +12 -13
  200. package/src/sap/m/SinglePlanningCalendarWorkWeekView.js +1 -1
  201. package/src/sap/m/SlideTile.js +1 -1
  202. package/src/sap/m/Slider.js +1 -1
  203. package/src/sap/m/SliderTooltip.js +1 -1
  204. package/src/sap/m/SliderTooltipBase.js +1 -1
  205. package/src/sap/m/SliderTooltipContainer.js +1 -1
  206. package/src/sap/m/SplitApp.js +1 -1
  207. package/src/sap/m/SplitButton.js +1 -1
  208. package/src/sap/m/SplitContainer.js +3 -3
  209. package/src/sap/m/StandardDynamicDateOption.js +1 -1
  210. package/src/sap/m/StandardListItem.js +1 -1
  211. package/src/sap/m/StandardTile.js +1 -1
  212. package/src/sap/m/StandardTreeItem.js +1 -1
  213. package/src/sap/m/StepInput.js +1 -1
  214. package/src/sap/m/SuggestionItem.js +1 -1
  215. package/src/sap/m/SuggestionsPopover.js +1 -1
  216. package/src/sap/m/Switch.js +1 -1
  217. package/src/sap/m/TabContainer.js +1 -1
  218. package/src/sap/m/TabContainerItem.js +1 -1
  219. package/src/sap/m/TabStrip.js +1 -1
  220. package/src/sap/m/TabStripItem.js +1 -1
  221. package/src/sap/m/Table.js +1 -1
  222. package/src/sap/m/TablePersoController.js +1 -1
  223. package/src/sap/m/TablePersoDialog.js +1 -1
  224. package/src/sap/m/TablePersoProvider.js +1 -1
  225. package/src/sap/m/TableSelectDialog.js +1 -1
  226. package/src/sap/m/Text.js +1 -1
  227. package/src/sap/m/TextArea.js +1 -1
  228. package/src/sap/m/Tile.js +1 -1
  229. package/src/sap/m/TileContainer.js +1 -1
  230. package/src/sap/m/TileContent.js +1 -1
  231. package/src/sap/m/TimePicker.js +3 -3
  232. package/src/sap/m/TimePickerClock.js +1 -1
  233. package/src/sap/m/TimePickerClocks.js +1 -1
  234. package/src/sap/m/TimePickerClocksRenderer.js +3 -1
  235. package/src/sap/m/TimePickerInputs.js +1 -1
  236. package/src/sap/m/TimePickerInternals.js +1 -1
  237. package/src/sap/m/TimePickerSlider.js +1 -1
  238. package/src/sap/m/TimePickerSliders.js +1 -1
  239. package/src/sap/m/Title.js +1 -1
  240. package/src/sap/m/TitlePropagationSupport.js +1 -1
  241. package/src/sap/m/ToggleButton.js +1 -1
  242. package/src/sap/m/Token.js +1 -1
  243. package/src/sap/m/Tokenizer.js +1 -1
  244. package/src/sap/m/Toolbar.js +1 -1
  245. package/src/sap/m/ToolbarLayoutData.js +1 -1
  246. package/src/sap/m/ToolbarSeparator.js +1 -1
  247. package/src/sap/m/ToolbarSpacer.js +1 -1
  248. package/src/sap/m/Tree.js +1 -1
  249. package/src/sap/m/TreeItemBase.js +1 -1
  250. package/src/sap/m/UploadCollection.js +1 -1
  251. package/src/sap/m/UploadCollectionItem.js +1 -1
  252. package/src/sap/m/UploadCollectionParameter.js +1 -1
  253. package/src/sap/m/UploadCollectionToolbarPlaceholder.js +1 -1
  254. package/src/sap/m/VBox.js +1 -1
  255. package/src/sap/m/ValueStateHeader.js +1 -1
  256. package/src/sap/m/VariantManagement.js +52 -1
  257. package/src/sap/m/ViewSettingsCustomItem.js +1 -1
  258. package/src/sap/m/ViewSettingsCustomTab.js +1 -1
  259. package/src/sap/m/ViewSettingsDialog.js +1 -1
  260. package/src/sap/m/ViewSettingsFilterItem.js +1 -1
  261. package/src/sap/m/ViewSettingsItem.js +1 -1
  262. package/src/sap/m/VisibleItem.js +1 -1
  263. package/src/sap/m/WheelSlider.js +1 -1
  264. package/src/sap/m/WheelSliderContainer.js +1 -1
  265. package/src/sap/m/Wizard.js +10 -1
  266. package/src/sap/m/WizardProgressNavigator.js +1 -1
  267. package/src/sap/m/WizardStep.js +3 -1
  268. package/src/sap/m/_thirdparty/purify.js +1622 -0
  269. package/src/sap/m/changeHandler/AddTableColumn.js +1 -1
  270. package/src/sap/m/changeHandler/ChangeLinkTarget.js +1 -1
  271. package/src/sap/m/changeHandler/CombineButtons.js +1 -1
  272. package/src/sap/m/changeHandler/MoveTableColumns.js +1 -1
  273. package/src/sap/m/changeHandler/SelectIconTabBarFilter.js +1 -1
  274. package/src/sap/m/changeHandler/SplitMenuButton.js +1 -1
  275. package/src/sap/m/library.js +32 -3
  276. package/src/sap/m/messagebundle.properties +28 -4
  277. package/src/sap/m/messagebundle_ar.properties +15 -3
  278. package/src/sap/m/messagebundle_bg.properties +15 -3
  279. package/src/sap/m/messagebundle_ca.properties +15 -3
  280. package/src/sap/m/messagebundle_cs.properties +15 -3
  281. package/src/sap/m/messagebundle_cy.properties +15 -3
  282. package/src/sap/m/messagebundle_da.properties +15 -3
  283. package/src/sap/m/messagebundle_de.properties +14 -2
  284. package/src/sap/m/messagebundle_el.properties +15 -3
  285. package/src/sap/m/messagebundle_en.properties +14 -2
  286. package/src/sap/m/messagebundle_en_GB.properties +14 -2
  287. package/src/sap/m/messagebundle_en_US_sappsd.properties +14 -2
  288. package/src/sap/m/messagebundle_en_US_saprigi.properties +14 -2
  289. package/src/sap/m/messagebundle_en_US_saptrc.properties +14 -2
  290. package/src/sap/m/messagebundle_es.properties +15 -3
  291. package/src/sap/m/messagebundle_es_MX.properties +15 -3
  292. package/src/sap/m/messagebundle_et.properties +15 -3
  293. package/src/sap/m/messagebundle_fi.properties +15 -3
  294. package/src/sap/m/messagebundle_fr.properties +15 -3
  295. package/src/sap/m/messagebundle_fr_CA.properties +15 -3
  296. package/src/sap/m/messagebundle_hi.properties +15 -3
  297. package/src/sap/m/messagebundle_hr.properties +16 -4
  298. package/src/sap/m/messagebundle_hu.properties +15 -3
  299. package/src/sap/m/messagebundle_id.properties +15 -3
  300. package/src/sap/m/messagebundle_it.properties +16 -4
  301. package/src/sap/m/messagebundle_iw.properties +15 -3
  302. package/src/sap/m/messagebundle_ja.properties +15 -3
  303. package/src/sap/m/messagebundle_kk.properties +15 -3
  304. package/src/sap/m/messagebundle_ko.properties +16 -4
  305. package/src/sap/m/messagebundle_lt.properties +15 -3
  306. package/src/sap/m/messagebundle_lv.properties +15 -3
  307. package/src/sap/m/messagebundle_ms.properties +15 -3
  308. package/src/sap/m/messagebundle_nl.properties +15 -3
  309. package/src/sap/m/messagebundle_no.properties +15 -3
  310. package/src/sap/m/messagebundle_pl.properties +15 -3
  311. package/src/sap/m/messagebundle_pt.properties +15 -3
  312. package/src/sap/m/messagebundle_pt_PT.properties +15 -3
  313. package/src/sap/m/messagebundle_ro.properties +15 -3
  314. package/src/sap/m/messagebundle_ru.properties +15 -3
  315. package/src/sap/m/messagebundle_sh.properties +16 -4
  316. package/src/sap/m/messagebundle_sk.properties +15 -3
  317. package/src/sap/m/messagebundle_sl.properties +16 -4
  318. package/src/sap/m/messagebundle_sv.properties +15 -3
  319. package/src/sap/m/messagebundle_th.properties +15 -3
  320. package/src/sap/m/messagebundle_tr.properties +15 -3
  321. package/src/sap/m/messagebundle_uk.properties +15 -3
  322. package/src/sap/m/messagebundle_vi.properties +15 -3
  323. package/src/sap/m/messagebundle_zh_CN.properties +15 -3
  324. package/src/sap/m/messagebundle_zh_TW.properties +15 -3
  325. package/src/sap/m/p13n/AbstractContainer.js +2 -2
  326. package/src/sap/m/p13n/AbstractContainerItem.js +2 -2
  327. package/src/sap/m/p13n/BasePanel.js +17 -7
  328. package/src/sap/m/p13n/Container.js +1 -1
  329. package/src/sap/m/p13n/Engine.js +1 -1
  330. package/src/sap/m/p13n/GroupController.js +1 -1
  331. package/src/sap/m/p13n/GroupPanel.js +1 -1
  332. package/src/sap/m/p13n/Popup.js +1 -1
  333. package/src/sap/m/p13n/QueryPanel.js +1 -1
  334. package/src/sap/m/p13n/SelectionController.js +1 -1
  335. package/src/sap/m/p13n/SelectionPanel.js +9 -3
  336. package/src/sap/m/p13n/SortController.js +1 -1
  337. package/src/sap/m/p13n/SortPanel.js +3 -3
  338. package/src/sap/m/p13n/modules/DefaultProviderRegistry.js +1 -1
  339. package/src/sap/m/p13n/modules/StateHandlerRegistry.js +1 -1
  340. package/src/sap/m/p13n/modules/UIManager.js +1 -1
  341. package/src/sap/m/plugins/CellSelector.js +1 -1
  342. package/src/sap/m/plugins/ColumnResizer.js +1 -1
  343. package/src/sap/m/plugins/DataStateIndicator.js +1 -1
  344. package/src/sap/m/plugins/PasteProvider.js +1 -1
  345. package/src/sap/m/plugins/PluginBase.js +1 -1
  346. package/src/sap/m/rules/CheckBox.support.js +1 -1
  347. package/src/sap/m/rules/Image.support.js +1 -1
  348. package/src/sap/m/rules/Link.support.js +1 -1
  349. package/src/sap/m/rules/MessagePage.support.js +1 -1
  350. package/src/sap/m/rules/ObjectHeader.support.js +6 -6
  351. package/src/sap/m/rules/ObjectListItem.support.js +1 -1
  352. package/src/sap/m/rules/ObjectMarker.support.js +1 -1
  353. package/src/sap/m/rules/ObjectStatus.support.js +1 -1
  354. package/src/sap/m/rules/Panel.support.js +1 -1
  355. package/src/sap/m/rules/Select.support.js +1 -1
  356. package/src/sap/m/rules/Table.support.js +3 -3
  357. package/src/sap/m/semantic/AddAction.js +1 -1
  358. package/src/sap/m/semantic/CancelAction.js +1 -1
  359. package/src/sap/m/semantic/DeleteAction.js +1 -1
  360. package/src/sap/m/semantic/DetailPage.js +1 -1
  361. package/src/sap/m/semantic/DiscussInJamAction.js +1 -1
  362. package/src/sap/m/semantic/EditAction.js +1 -1
  363. package/src/sap/m/semantic/FavoriteAction.js +1 -1
  364. package/src/sap/m/semantic/FilterAction.js +1 -1
  365. package/src/sap/m/semantic/FilterSelect.js +1 -1
  366. package/src/sap/m/semantic/FlagAction.js +1 -1
  367. package/src/sap/m/semantic/ForwardAction.js +1 -1
  368. package/src/sap/m/semantic/FullscreenPage.js +1 -1
  369. package/src/sap/m/semantic/GroupAction.js +1 -1
  370. package/src/sap/m/semantic/GroupSelect.js +1 -1
  371. package/src/sap/m/semantic/MainAction.js +1 -1
  372. package/src/sap/m/semantic/MasterPage.js +1 -1
  373. package/src/sap/m/semantic/MessagesIndicator.js +1 -1
  374. package/src/sap/m/semantic/MultiSelectAction.js +1 -1
  375. package/src/sap/m/semantic/NegativeAction.js +1 -1
  376. package/src/sap/m/semantic/OpenInAction.js +1 -1
  377. package/src/sap/m/semantic/PositiveAction.js +1 -1
  378. package/src/sap/m/semantic/PrintAction.js +1 -1
  379. package/src/sap/m/semantic/SaveAction.js +1 -1
  380. package/src/sap/m/semantic/Segment.js +1 -1
  381. package/src/sap/m/semantic/SegmentedContainer.js +1 -1
  382. package/src/sap/m/semantic/SemanticButton.js +1 -1
  383. package/src/sap/m/semantic/SemanticConfiguration.js +1 -1
  384. package/src/sap/m/semantic/SemanticControl.js +1 -1
  385. package/src/sap/m/semantic/SemanticOverflowToolbarButton.js +1 -1
  386. package/src/sap/m/semantic/SemanticOverflowToolbarToggleButton.js +1 -1
  387. package/src/sap/m/semantic/SemanticPage.js +1 -1
  388. package/src/sap/m/semantic/SemanticSelect.js +1 -1
  389. package/src/sap/m/semantic/SemanticToggleButton.js +1 -1
  390. package/src/sap/m/semantic/SendEmailAction.js +1 -1
  391. package/src/sap/m/semantic/SendMessageAction.js +1 -1
  392. package/src/sap/m/semantic/ShareInJamAction.js +1 -1
  393. package/src/sap/m/semantic/ShareMenu.js +1 -1
  394. package/src/sap/m/semantic/ShareMenuPage.js +1 -1
  395. package/src/sap/m/semantic/SortAction.js +1 -1
  396. package/src/sap/m/semantic/SortSelect.js +1 -1
  397. package/src/sap/m/table/Util.js +17 -5
  398. package/src/sap/m/table/columnmenu/ActionItem.js +1 -1
  399. package/src/sap/m/table/columnmenu/Entry.js +1 -1
  400. package/src/sap/m/table/columnmenu/Item.js +1 -1
  401. package/src/sap/m/table/columnmenu/ItemBase.js +1 -1
  402. package/src/sap/m/table/columnmenu/Menu.js +45 -14
  403. package/src/sap/m/table/columnmenu/QuickAction.js +16 -8
  404. package/src/sap/m/table/columnmenu/QuickActionBase.js +18 -3
  405. package/src/sap/m/table/columnmenu/QuickActionItem.js +5 -6
  406. package/src/sap/m/table/columnmenu/QuickGroup.js +9 -3
  407. package/src/sap/m/table/columnmenu/QuickGroupItem.js +1 -1
  408. package/src/sap/m/table/columnmenu/QuickSort.js +1 -1
  409. package/src/sap/m/table/columnmenu/QuickSortItem.js +8 -5
  410. package/src/sap/m/table/columnmenu/QuickTotal.js +9 -3
  411. package/src/sap/m/table/columnmenu/QuickTotalItem.js +1 -1
  412. package/src/sap/m/themes/base/Carousel.less +8 -8
  413. package/src/sap/m/themes/base/DisplayListItem.less +3 -3
  414. package/src/sap/m/themes/base/GenericTile.less +7 -0
  415. package/src/sap/m/upload/UploadSet.js +193 -5
  416. package/src/sap/m/upload/UploadSetItem.js +1 -1
  417. package/src/sap/m/upload/UploadSetToolbarPlaceholder.js +1 -1
@@ -0,0 +1,1622 @@
1
+ /*! @license DOMPurify 2.3.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.8/LICENSE */
2
+
3
+ sap.ui.define([], function () { 'use strict';
4
+
5
+ function _typeof(obj) {
6
+ "@babel/helpers - typeof";
7
+
8
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
9
+ return typeof obj;
10
+ } : function (obj) {
11
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
12
+ }, _typeof(obj);
13
+ }
14
+
15
+ function _setPrototypeOf(o, p) {
16
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
17
+ o.__proto__ = p;
18
+ return o;
19
+ };
20
+
21
+ return _setPrototypeOf(o, p);
22
+ }
23
+
24
+ function _isNativeReflectConstruct() {
25
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
26
+ if (Reflect.construct.sham) return false;
27
+ if (typeof Proxy === "function") return true;
28
+
29
+ try {
30
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
31
+ return true;
32
+ } catch (e) {
33
+ return false;
34
+ }
35
+ }
36
+
37
+ function _construct(Parent, args, Class) {
38
+ if (_isNativeReflectConstruct()) {
39
+ _construct = Reflect.construct;
40
+ } else {
41
+ _construct = function _construct(Parent, args, Class) {
42
+ var a = [null];
43
+ a.push.apply(a, args);
44
+ var Constructor = Function.bind.apply(Parent, a);
45
+ var instance = new Constructor();
46
+ if (Class) _setPrototypeOf(instance, Class.prototype);
47
+ return instance;
48
+ };
49
+ }
50
+
51
+ return _construct.apply(null, arguments);
52
+ }
53
+
54
+ function _toConsumableArray(arr) {
55
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
56
+ }
57
+
58
+ function _arrayWithoutHoles(arr) {
59
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
60
+ }
61
+
62
+ function _iterableToArray(iter) {
63
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
64
+ }
65
+
66
+ function _unsupportedIterableToArray(o, minLen) {
67
+ if (!o) return;
68
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
69
+ var n = Object.prototype.toString.call(o).slice(8, -1);
70
+ if (n === "Object" && o.constructor) n = o.constructor.name;
71
+ if (n === "Map" || n === "Set") return Array.from(o);
72
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
73
+ }
74
+
75
+ function _arrayLikeToArray(arr, len) {
76
+ if (len == null || len > arr.length) len = arr.length;
77
+
78
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
79
+
80
+ return arr2;
81
+ }
82
+
83
+ function _nonIterableSpread() {
84
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
85
+ }
86
+
87
+ var hasOwnProperty = Object.hasOwnProperty,
88
+ setPrototypeOf = Object.setPrototypeOf,
89
+ isFrozen = Object.isFrozen,
90
+ getPrototypeOf = Object.getPrototypeOf,
91
+ getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
92
+ var freeze = Object.freeze,
93
+ seal = Object.seal,
94
+ create = Object.create; // eslint-disable-line import/no-mutable-exports
95
+
96
+ var _ref = typeof Reflect !== 'undefined' && Reflect,
97
+ apply = _ref.apply,
98
+ construct = _ref.construct;
99
+
100
+ if (!apply) {
101
+ apply = function apply(fun, thisValue, args) {
102
+ return fun.apply(thisValue, args);
103
+ };
104
+ }
105
+
106
+ if (!freeze) {
107
+ freeze = function freeze(x) {
108
+ return x;
109
+ };
110
+ }
111
+
112
+ if (!seal) {
113
+ seal = function seal(x) {
114
+ return x;
115
+ };
116
+ }
117
+
118
+ if (!construct) {
119
+ construct = function construct(Func, args) {
120
+ return _construct(Func, _toConsumableArray(args));
121
+ };
122
+ }
123
+
124
+ var arrayForEach = unapply(Array.prototype.forEach);
125
+ var arrayPop = unapply(Array.prototype.pop);
126
+ var arrayPush = unapply(Array.prototype.push);
127
+ var stringToLowerCase = unapply(String.prototype.toLowerCase);
128
+ var stringMatch = unapply(String.prototype.match);
129
+ var stringReplace = unapply(String.prototype.replace);
130
+ var stringIndexOf = unapply(String.prototype.indexOf);
131
+ var stringTrim = unapply(String.prototype.trim);
132
+ var regExpTest = unapply(RegExp.prototype.test);
133
+ var typeErrorCreate = unconstruct(TypeError);
134
+ function unapply(func) {
135
+ return function (thisArg) {
136
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
137
+ args[_key - 1] = arguments[_key];
138
+ }
139
+
140
+ return apply(func, thisArg, args);
141
+ };
142
+ }
143
+ function unconstruct(func) {
144
+ return function () {
145
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
146
+ args[_key2] = arguments[_key2];
147
+ }
148
+
149
+ return construct(func, args);
150
+ };
151
+ }
152
+ /* Add properties to a lookup table */
153
+
154
+ function addToSet(set, array, transformCaseFunc) {
155
+ transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase;
156
+
157
+ if (setPrototypeOf) {
158
+ // Make 'in' and truthy checks like Boolean(set.constructor)
159
+ // independent of any properties defined on Object.prototype.
160
+ // Prevent prototype setters from intercepting set as a this value.
161
+ setPrototypeOf(set, null);
162
+ }
163
+
164
+ var l = array.length;
165
+
166
+ while (l--) {
167
+ var element = array[l];
168
+
169
+ if (typeof element === 'string') {
170
+ var lcElement = transformCaseFunc(element);
171
+
172
+ if (lcElement !== element) {
173
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
174
+ if (!isFrozen(array)) {
175
+ array[l] = lcElement;
176
+ }
177
+
178
+ element = lcElement;
179
+ }
180
+ }
181
+
182
+ set[element] = true;
183
+ }
184
+
185
+ return set;
186
+ }
187
+ /* Shallow clone an object */
188
+
189
+ function clone(object) {
190
+ var newObject = create(null);
191
+ var property;
192
+
193
+ for (property in object) {
194
+ if (apply(hasOwnProperty, object, [property])) {
195
+ newObject[property] = object[property];
196
+ }
197
+ }
198
+
199
+ return newObject;
200
+ }
201
+ /* IE10 doesn't support __lookupGetter__ so lets'
202
+ * simulate it. It also automatically checks
203
+ * if the prop is function or getter and behaves
204
+ * accordingly. */
205
+
206
+ function lookupGetter(object, prop) {
207
+ while (object !== null) {
208
+ var desc = getOwnPropertyDescriptor(object, prop);
209
+
210
+ if (desc) {
211
+ if (desc.get) {
212
+ return unapply(desc.get);
213
+ }
214
+
215
+ if (typeof desc.value === 'function') {
216
+ return unapply(desc.value);
217
+ }
218
+ }
219
+
220
+ object = getPrototypeOf(object);
221
+ }
222
+
223
+ function fallbackValue(element) {
224
+ console.warn('fallback value for', element);
225
+ return null;
226
+ }
227
+
228
+ return fallbackValue;
229
+ }
230
+
231
+ var html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG
232
+
233
+ var svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
234
+ var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default.
235
+ // We still need to know them so that we can do namespace
236
+ // checks properly in case one wants to add them to
237
+ // allow-list.
238
+
239
+ var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', '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']);
240
+ var mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); // Similarly to SVG, we want to know all MathML elements,
241
+ // even those that we disallow by default.
242
+
243
+ var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
244
+ var text = freeze(['#text']);
245
+
246
+ var html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);
247
+ var svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
248
+ var mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
249
+ var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
250
+
251
+ var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
252
+
253
+ var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
254
+ var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
255
+
256
+ var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
257
+
258
+ 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
259
+ );
260
+ var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
261
+ var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
262
+ );
263
+ var DOCTYPE_NAME = seal(/^html$/i);
264
+
265
+ var getGlobal = function getGlobal() {
266
+ return typeof window === 'undefined' ? null : window;
267
+ };
268
+ /**
269
+ * Creates a no-op policy for internal use only.
270
+ * Don't export this function outside this module!
271
+ * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
272
+ * @param {Document} document The document object (to determine policy name suffix)
273
+ * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
274
+ * are not supported).
275
+ */
276
+
277
+
278
+ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
279
+ if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
280
+ return null;
281
+ } // Allow the callers to control the unique policy name
282
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
283
+ // Policy creation with duplicate names throws in Trusted Types.
284
+
285
+
286
+ var suffix = null;
287
+ var ATTR_NAME = 'data-tt-policy-suffix';
288
+
289
+ if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {
290
+ suffix = document.currentScript.getAttribute(ATTR_NAME);
291
+ }
292
+
293
+ var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
294
+
295
+ try {
296
+ return trustedTypes.createPolicy(policyName, {
297
+ createHTML: function createHTML(html) {
298
+ return html;
299
+ }
300
+ });
301
+ } catch (_) {
302
+ // Policy creation failed (most likely another DOMPurify script has
303
+ // already run). Skip creating the policy, as this will only cause errors
304
+ // if TT are enforced.
305
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
306
+ return null;
307
+ }
308
+ };
309
+
310
+ function createDOMPurify() {
311
+ var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
312
+
313
+ var DOMPurify = function DOMPurify(root) {
314
+ return createDOMPurify(root);
315
+ };
316
+ /**
317
+ * Version label, exposed for easier checks
318
+ * if DOMPurify is up to date or not
319
+ */
320
+
321
+
322
+ DOMPurify.version = '2.3.8';
323
+ /**
324
+ * Array of elements that DOMPurify removed during sanitation.
325
+ * Empty if nothing was removed.
326
+ */
327
+
328
+ DOMPurify.removed = [];
329
+
330
+ if (!window || !window.document || window.document.nodeType !== 9) {
331
+ // Not running in a browser, provide a factory function
332
+ // so that you can pass your own Window
333
+ DOMPurify.isSupported = false;
334
+ return DOMPurify;
335
+ }
336
+
337
+ var originalDocument = window.document;
338
+ var document = window.document;
339
+ var DocumentFragment = window.DocumentFragment,
340
+ HTMLTemplateElement = window.HTMLTemplateElement,
341
+ Node = window.Node,
342
+ Element = window.Element,
343
+ NodeFilter = window.NodeFilter,
344
+ _window$NamedNodeMap = window.NamedNodeMap,
345
+ NamedNodeMap = _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,
346
+ HTMLFormElement = window.HTMLFormElement,
347
+ DOMParser = window.DOMParser,
348
+ trustedTypes = window.trustedTypes;
349
+ var ElementPrototype = Element.prototype;
350
+ var cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
351
+ var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
352
+ var getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
353
+ var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a
354
+ // new document created via createHTMLDocument. As per the spec
355
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
356
+ // a new empty registry is used when creating a template contents owner
357
+ // document, so we use that as our parent document to ensure nothing
358
+ // is inherited.
359
+
360
+ if (typeof HTMLTemplateElement === 'function') {
361
+ var template = document.createElement('template');
362
+
363
+ if (template.content && template.content.ownerDocument) {
364
+ document = template.content.ownerDocument;
365
+ }
366
+ }
367
+
368
+ var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);
369
+
370
+ var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';
371
+ var _document = document,
372
+ implementation = _document.implementation,
373
+ createNodeIterator = _document.createNodeIterator,
374
+ createDocumentFragment = _document.createDocumentFragment,
375
+ getElementsByTagName = _document.getElementsByTagName;
376
+ var importNode = originalDocument.importNode;
377
+ var documentMode = {};
378
+
379
+ try {
380
+ documentMode = clone(document).documentMode ? document.documentMode : {};
381
+ } catch (_) {}
382
+
383
+ var hooks = {};
384
+ /**
385
+ * Expose whether this browser supports running the full DOMPurify.
386
+ */
387
+
388
+ DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9;
389
+ var MUSTACHE_EXPR$1 = MUSTACHE_EXPR,
390
+ ERB_EXPR$1 = ERB_EXPR,
391
+ DATA_ATTR$1 = DATA_ATTR,
392
+ ARIA_ATTR$1 = ARIA_ATTR,
393
+ IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA,
394
+ ATTR_WHITESPACE$1 = ATTR_WHITESPACE;
395
+ var IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
396
+ /**
397
+ * We consider the elements and attributes below to be safe. Ideally
398
+ * don't add any new ones but feel free to remove unwanted ones.
399
+ */
400
+
401
+ /* allowed element names */
402
+
403
+ var ALLOWED_TAGS = null;
404
+ var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text)));
405
+ /* Allowed attribute names */
406
+
407
+ var ALLOWED_ATTR = null;
408
+ var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml)));
409
+ /*
410
+ * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
411
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
412
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
413
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
414
+ */
415
+
416
+ var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
417
+ tagNameCheck: {
418
+ writable: true,
419
+ configurable: false,
420
+ enumerable: true,
421
+ value: null
422
+ },
423
+ attributeNameCheck: {
424
+ writable: true,
425
+ configurable: false,
426
+ enumerable: true,
427
+ value: null
428
+ },
429
+ allowCustomizedBuiltInElements: {
430
+ writable: true,
431
+ configurable: false,
432
+ enumerable: true,
433
+ value: false
434
+ }
435
+ }));
436
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
437
+
438
+ var FORBID_TAGS = null;
439
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
440
+
441
+ var FORBID_ATTR = null;
442
+ /* Decide if ARIA attributes are okay */
443
+
444
+ var ALLOW_ARIA_ATTR = true;
445
+ /* Decide if custom data attributes are okay */
446
+
447
+ var ALLOW_DATA_ATTR = true;
448
+ /* Decide if unknown protocols are okay */
449
+
450
+ var ALLOW_UNKNOWN_PROTOCOLS = false;
451
+ /* Output should be safe for common template engines.
452
+ * This means, DOMPurify removes data attributes, mustaches and ERB
453
+ */
454
+
455
+ var SAFE_FOR_TEMPLATES = false;
456
+ /* Decide if document with <html>... should be returned */
457
+
458
+ var WHOLE_DOCUMENT = false;
459
+ /* Track whether config is already set on this instance of DOMPurify. */
460
+
461
+ var SET_CONFIG = false;
462
+ /* Decide if all elements (e.g. style, script) must be children of
463
+ * document.body. By default, browsers might move them to document.head */
464
+
465
+ var FORCE_BODY = false;
466
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
467
+ * string (or a TrustedHTML object if Trusted Types are supported).
468
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
469
+ */
470
+
471
+ var RETURN_DOM = false;
472
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
473
+ * string (or a TrustedHTML object if Trusted Types are supported) */
474
+
475
+ var RETURN_DOM_FRAGMENT = false;
476
+ /* Try to return a Trusted Type object instead of a string, return a string in
477
+ * case Trusted Types are not supported */
478
+
479
+ var RETURN_TRUSTED_TYPE = false;
480
+ /* Output should be free from DOM clobbering attacks? */
481
+
482
+ var SANITIZE_DOM = true;
483
+ /* Keep element content when removing element? */
484
+
485
+ var KEEP_CONTENT = true;
486
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
487
+ * of importing it into a new Document and returning a sanitized copy */
488
+
489
+ var IN_PLACE = false;
490
+ /* Allow usage of profiles like html, svg and mathMl */
491
+
492
+ var USE_PROFILES = {};
493
+ /* Tags to ignore content of when KEEP_CONTENT is true */
494
+
495
+ var FORBID_CONTENTS = null;
496
+ var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
497
+ /* Tags that are safe for data: URIs */
498
+
499
+ var DATA_URI_TAGS = null;
500
+ var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
501
+ /* Attributes safe for values like "javascript:" */
502
+
503
+ var URI_SAFE_ATTRIBUTES = null;
504
+ var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
505
+ var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
506
+ var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
507
+ var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
508
+ /* Document namespace */
509
+
510
+ var NAMESPACE = HTML_NAMESPACE;
511
+ var IS_EMPTY_INPUT = false;
512
+ /* Parsing of strict XHTML documents */
513
+
514
+ var PARSER_MEDIA_TYPE;
515
+ var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
516
+ var DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
517
+ var transformCaseFunc;
518
+ /* Keep a reference to config to pass to hooks */
519
+
520
+ var CONFIG = null;
521
+ /* Ideally, do not touch anything below this line */
522
+
523
+ /* ______________________________________________ */
524
+
525
+ var formElement = document.createElement('form');
526
+
527
+ var isRegexOrFunction = function isRegexOrFunction(testValue) {
528
+ return testValue instanceof RegExp || testValue instanceof Function;
529
+ };
530
+ /**
531
+ * _parseConfig
532
+ *
533
+ * @param {Object} cfg optional config literal
534
+ */
535
+ // eslint-disable-next-line complexity
536
+
537
+
538
+ var _parseConfig = function _parseConfig(cfg) {
539
+ if (CONFIG && CONFIG === cfg) {
540
+ return;
541
+ }
542
+ /* Shield configuration object from tampering */
543
+
544
+
545
+ if (!cfg || _typeof(cfg) !== 'object') {
546
+ cfg = {};
547
+ }
548
+ /* Shield configuration object from prototype pollution */
549
+
550
+
551
+ cfg = clone(cfg);
552
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
553
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
554
+
555
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {
556
+ return x;
557
+ } : stringToLowerCase;
558
+ /* Set configuration parameters */
559
+
560
+ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
561
+ ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
562
+ URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent
563
+ cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent
564
+ transformCaseFunc // eslint-disable-line indent
565
+ ) // eslint-disable-line indent
566
+ : DEFAULT_URI_SAFE_ATTRIBUTES;
567
+ DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent
568
+ cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent
569
+ transformCaseFunc // eslint-disable-line indent
570
+ ) // eslint-disable-line indent
571
+ : DEFAULT_DATA_URI_TAGS;
572
+ FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
573
+ FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
574
+ FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
575
+ USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
576
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
577
+
578
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
579
+
580
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
581
+
582
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
583
+
584
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
585
+
586
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
587
+
588
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
589
+
590
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
591
+
592
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
593
+
594
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
595
+
596
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
597
+
598
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
599
+
600
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1;
601
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
602
+
603
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
604
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
605
+ }
606
+
607
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
608
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
609
+ }
610
+
611
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
612
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
613
+ }
614
+
615
+ if (SAFE_FOR_TEMPLATES) {
616
+ ALLOW_DATA_ATTR = false;
617
+ }
618
+
619
+ if (RETURN_DOM_FRAGMENT) {
620
+ RETURN_DOM = true;
621
+ }
622
+ /* Parse profile info */
623
+
624
+
625
+ if (USE_PROFILES) {
626
+ ALLOWED_TAGS = addToSet({}, _toConsumableArray(text));
627
+ ALLOWED_ATTR = [];
628
+
629
+ if (USE_PROFILES.html === true) {
630
+ addToSet(ALLOWED_TAGS, html$1);
631
+ addToSet(ALLOWED_ATTR, html);
632
+ }
633
+
634
+ if (USE_PROFILES.svg === true) {
635
+ addToSet(ALLOWED_TAGS, svg$1);
636
+ addToSet(ALLOWED_ATTR, svg);
637
+ addToSet(ALLOWED_ATTR, xml);
638
+ }
639
+
640
+ if (USE_PROFILES.svgFilters === true) {
641
+ addToSet(ALLOWED_TAGS, svgFilters);
642
+ addToSet(ALLOWED_ATTR, svg);
643
+ addToSet(ALLOWED_ATTR, xml);
644
+ }
645
+
646
+ if (USE_PROFILES.mathMl === true) {
647
+ addToSet(ALLOWED_TAGS, mathMl$1);
648
+ addToSet(ALLOWED_ATTR, mathMl);
649
+ addToSet(ALLOWED_ATTR, xml);
650
+ }
651
+ }
652
+ /* Merge configuration parameters */
653
+
654
+
655
+ if (cfg.ADD_TAGS) {
656
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
657
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
658
+ }
659
+
660
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
661
+ }
662
+
663
+ if (cfg.ADD_ATTR) {
664
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
665
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
666
+ }
667
+
668
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
669
+ }
670
+
671
+ if (cfg.ADD_URI_SAFE_ATTR) {
672
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
673
+ }
674
+
675
+ if (cfg.FORBID_CONTENTS) {
676
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
677
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
678
+ }
679
+
680
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
681
+ }
682
+ /* Add #text in case KEEP_CONTENT is set to true */
683
+
684
+
685
+ if (KEEP_CONTENT) {
686
+ ALLOWED_TAGS['#text'] = true;
687
+ }
688
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
689
+
690
+
691
+ if (WHOLE_DOCUMENT) {
692
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
693
+ }
694
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
695
+
696
+
697
+ if (ALLOWED_TAGS.table) {
698
+ addToSet(ALLOWED_TAGS, ['tbody']);
699
+ delete FORBID_TAGS.tbody;
700
+ } // Prevent further manipulation of configuration.
701
+ // Not available in IE8, Safari 5, etc.
702
+
703
+
704
+ if (freeze) {
705
+ freeze(cfg);
706
+ }
707
+
708
+ CONFIG = cfg;
709
+ };
710
+
711
+ var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
712
+ var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML
713
+ // namespace. We need to specify them explicitly
714
+ // so that they don't get erroneously deleted from
715
+ // HTML namespace.
716
+
717
+ var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
718
+ /* Keep track of all possible SVG and MathML tags
719
+ * so that we can perform the namespace checks
720
+ * correctly. */
721
+
722
+ var ALL_SVG_TAGS = addToSet({}, svg$1);
723
+ addToSet(ALL_SVG_TAGS, svgFilters);
724
+ addToSet(ALL_SVG_TAGS, svgDisallowed);
725
+ var ALL_MATHML_TAGS = addToSet({}, mathMl$1);
726
+ addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
727
+ /**
728
+ *
729
+ *
730
+ * @param {Element} element a DOM element whose namespace is being checked
731
+ * @returns {boolean} Return false if the element has a
732
+ * namespace that a spec-compliant parser would never
733
+ * return. Return true otherwise.
734
+ */
735
+
736
+ var _checkValidNamespace = function _checkValidNamespace(element) {
737
+ var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode
738
+ // can be null. We just simulate parent in this case.
739
+
740
+ if (!parent || !parent.tagName) {
741
+ parent = {
742
+ namespaceURI: HTML_NAMESPACE,
743
+ tagName: 'template'
744
+ };
745
+ }
746
+
747
+ var tagName = stringToLowerCase(element.tagName);
748
+ var parentTagName = stringToLowerCase(parent.tagName);
749
+
750
+ if (element.namespaceURI === SVG_NAMESPACE) {
751
+ // The only way to switch from HTML namespace to SVG
752
+ // is via <svg>. If it happens via any other tag, then
753
+ // it should be killed.
754
+ if (parent.namespaceURI === HTML_NAMESPACE) {
755
+ return tagName === 'svg';
756
+ } // The only way to switch from MathML to SVG is via
757
+ // svg if parent is either <annotation-xml> or MathML
758
+ // text integration points.
759
+
760
+
761
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
762
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
763
+ } // We only allow elements that are defined in SVG
764
+ // spec. All others are disallowed in SVG namespace.
765
+
766
+
767
+ return Boolean(ALL_SVG_TAGS[tagName]);
768
+ }
769
+
770
+ if (element.namespaceURI === MATHML_NAMESPACE) {
771
+ // The only way to switch from HTML namespace to MathML
772
+ // is via <math>. If it happens via any other tag, then
773
+ // it should be killed.
774
+ if (parent.namespaceURI === HTML_NAMESPACE) {
775
+ return tagName === 'math';
776
+ } // The only way to switch from SVG to MathML is via
777
+ // <math> and HTML integration points
778
+
779
+
780
+ if (parent.namespaceURI === SVG_NAMESPACE) {
781
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
782
+ } // We only allow elements that are defined in MathML
783
+ // spec. All others are disallowed in MathML namespace.
784
+
785
+
786
+ return Boolean(ALL_MATHML_TAGS[tagName]);
787
+ }
788
+
789
+ if (element.namespaceURI === HTML_NAMESPACE) {
790
+ // The only way to switch from SVG to HTML is via
791
+ // HTML integration points, and from MathML to HTML
792
+ // is via MathML text integration points
793
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
794
+ return false;
795
+ }
796
+
797
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
798
+ return false;
799
+ } // We disallow tags that are specific for MathML
800
+ // or SVG and should never appear in HTML namespace
801
+
802
+
803
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
804
+ } // The code should never reach this place (this means
805
+ // that the element somehow got namespace that is not
806
+ // HTML, SVG or MathML). Return false just in case.
807
+
808
+
809
+ return false;
810
+ };
811
+ /**
812
+ * _forceRemove
813
+ *
814
+ * @param {Node} node a DOM node
815
+ */
816
+
817
+
818
+ var _forceRemove = function _forceRemove(node) {
819
+ arrayPush(DOMPurify.removed, {
820
+ element: node
821
+ });
822
+
823
+ try {
824
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
825
+ node.parentNode.removeChild(node);
826
+ } catch (_) {
827
+ try {
828
+ node.outerHTML = emptyHTML;
829
+ } catch (_) {
830
+ node.remove();
831
+ }
832
+ }
833
+ };
834
+ /**
835
+ * _removeAttribute
836
+ *
837
+ * @param {String} name an Attribute name
838
+ * @param {Node} node a DOM node
839
+ */
840
+
841
+
842
+ var _removeAttribute = function _removeAttribute(name, node) {
843
+ try {
844
+ arrayPush(DOMPurify.removed, {
845
+ attribute: node.getAttributeNode(name),
846
+ from: node
847
+ });
848
+ } catch (_) {
849
+ arrayPush(DOMPurify.removed, {
850
+ attribute: null,
851
+ from: node
852
+ });
853
+ }
854
+
855
+ node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes
856
+
857
+ if (name === 'is' && !ALLOWED_ATTR[name]) {
858
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
859
+ try {
860
+ _forceRemove(node);
861
+ } catch (_) {}
862
+ } else {
863
+ try {
864
+ node.setAttribute(name, '');
865
+ } catch (_) {}
866
+ }
867
+ }
868
+ };
869
+ /**
870
+ * _initDocument
871
+ *
872
+ * @param {String} dirty a string of dirty markup
873
+ * @return {Document} a DOM, filled with the dirty markup
874
+ */
875
+
876
+
877
+ var _initDocument = function _initDocument(dirty) {
878
+ /* Create a HTML document */
879
+ var doc;
880
+ var leadingWhitespace;
881
+
882
+ if (FORCE_BODY) {
883
+ dirty = '<remove></remove>' + dirty;
884
+ } else {
885
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
886
+ var matches = stringMatch(dirty, /^[\r\n\t ]+/);
887
+ leadingWhitespace = matches && matches[0];
888
+ }
889
+
890
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') {
891
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
892
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
893
+ }
894
+
895
+ var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
896
+ /*
897
+ * Use the DOMParser API by default, fallback later if needs be
898
+ * DOMParser not work for svg when has multiple root element.
899
+ */
900
+
901
+ if (NAMESPACE === HTML_NAMESPACE) {
902
+ try {
903
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
904
+ } catch (_) {}
905
+ }
906
+ /* Use createHTMLDocument in case DOMParser is not available */
907
+
908
+
909
+ if (!doc || !doc.documentElement) {
910
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
911
+
912
+ try {
913
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload;
914
+ } catch (_) {// Syntax error if dirtyPayload is invalid xml
915
+ }
916
+ }
917
+
918
+ var body = doc.body || doc.documentElement;
919
+
920
+ if (dirty && leadingWhitespace) {
921
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
922
+ }
923
+ /* Work on whole document or just its body */
924
+
925
+
926
+ if (NAMESPACE === HTML_NAMESPACE) {
927
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
928
+ }
929
+
930
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
931
+ };
932
+ /**
933
+ * _createIterator
934
+ *
935
+ * @param {Document} root document/fragment to create iterator for
936
+ * @return {Iterator} iterator instance
937
+ */
938
+
939
+
940
+ var _createIterator = function _createIterator(root) {
941
+ return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise
942
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);
943
+ };
944
+ /**
945
+ * _isClobbered
946
+ *
947
+ * @param {Node} elm element to check for clobbering attacks
948
+ * @return {Boolean} true if clobbered, false if safe
949
+ */
950
+
951
+
952
+ var _isClobbered = function _isClobbered(elm) {
953
+ return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function');
954
+ };
955
+ /**
956
+ * _isNode
957
+ *
958
+ * @param {Node} obj object to check whether it's a DOM node
959
+ * @return {Boolean} true is object is a DOM node
960
+ */
961
+
962
+
963
+ var _isNode = function _isNode(object) {
964
+ return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';
965
+ };
966
+ /**
967
+ * _executeHook
968
+ * Execute user configurable hooks
969
+ *
970
+ * @param {String} entryPoint Name of the hook's entry point
971
+ * @param {Node} currentNode node to work on with the hook
972
+ * @param {Object} data additional hook parameters
973
+ */
974
+
975
+
976
+ var _executeHook = function _executeHook(entryPoint, currentNode, data) {
977
+ if (!hooks[entryPoint]) {
978
+ return;
979
+ }
980
+
981
+ arrayForEach(hooks[entryPoint], function (hook) {
982
+ hook.call(DOMPurify, currentNode, data, CONFIG);
983
+ });
984
+ };
985
+ /**
986
+ * _sanitizeElements
987
+ *
988
+ * @protect nodeName
989
+ * @protect textContent
990
+ * @protect removeChild
991
+ *
992
+ * @param {Node} currentNode to check for permission to exist
993
+ * @return {Boolean} true if node was killed, false if left alive
994
+ */
995
+
996
+
997
+ var _sanitizeElements = function _sanitizeElements(currentNode) {
998
+ var content;
999
+ /* Execute a hook if present */
1000
+
1001
+ _executeHook('beforeSanitizeElements', currentNode, null);
1002
+ /* Check if element is clobbered or can clobber */
1003
+
1004
+
1005
+ if (_isClobbered(currentNode)) {
1006
+ _forceRemove(currentNode);
1007
+
1008
+ return true;
1009
+ }
1010
+ /* Check if tagname contains Unicode */
1011
+
1012
+
1013
+ if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) {
1014
+ _forceRemove(currentNode);
1015
+
1016
+ return true;
1017
+ }
1018
+ /* Now let's check the element's type and name */
1019
+
1020
+
1021
+ var tagName = transformCaseFunc(currentNode.nodeName);
1022
+ /* Execute a hook if present */
1023
+
1024
+ _executeHook('uponSanitizeElement', currentNode, {
1025
+ tagName: tagName,
1026
+ allowedTags: ALLOWED_TAGS
1027
+ });
1028
+ /* Detect mXSS attempts abusing namespace confusion */
1029
+
1030
+
1031
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
1032
+ _forceRemove(currentNode);
1033
+
1034
+ return true;
1035
+ }
1036
+ /* Mitigate a problem with templates inside select */
1037
+
1038
+
1039
+ if (tagName === 'select' && regExpTest(/<template/i, currentNode.innerHTML)) {
1040
+ _forceRemove(currentNode);
1041
+
1042
+ return true;
1043
+ }
1044
+ /* Remove element if anything forbids its presence */
1045
+
1046
+
1047
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1048
+ /* Check if we have a custom element to handle */
1049
+ if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
1050
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
1051
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
1052
+ }
1053
+ /* Keep content except for bad-listed elements */
1054
+
1055
+
1056
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1057
+ var parentNode = getParentNode(currentNode) || currentNode.parentNode;
1058
+ var childNodes = getChildNodes(currentNode) || currentNode.childNodes;
1059
+
1060
+ if (childNodes && parentNode) {
1061
+ var childCount = childNodes.length;
1062
+
1063
+ for (var i = childCount - 1; i >= 0; --i) {
1064
+ parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
1065
+ }
1066
+ }
1067
+ }
1068
+
1069
+ _forceRemove(currentNode);
1070
+
1071
+ return true;
1072
+ }
1073
+ /* Check whether element has a valid namespace */
1074
+
1075
+
1076
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1077
+ _forceRemove(currentNode);
1078
+
1079
+ return true;
1080
+ }
1081
+
1082
+ if ((tagName === 'noscript' || tagName === 'noembed') && regExpTest(/<\/no(script|embed)/i, currentNode.innerHTML)) {
1083
+ _forceRemove(currentNode);
1084
+
1085
+ return true;
1086
+ }
1087
+ /* Sanitize element content to be template-safe */
1088
+
1089
+
1090
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
1091
+ /* Get the element's text content */
1092
+ content = currentNode.textContent;
1093
+ content = stringReplace(content, MUSTACHE_EXPR$1, ' ');
1094
+ content = stringReplace(content, ERB_EXPR$1, ' ');
1095
+
1096
+ if (currentNode.textContent !== content) {
1097
+ arrayPush(DOMPurify.removed, {
1098
+ element: currentNode.cloneNode()
1099
+ });
1100
+ currentNode.textContent = content;
1101
+ }
1102
+ }
1103
+ /* Execute a hook if present */
1104
+
1105
+
1106
+ _executeHook('afterSanitizeElements', currentNode, null);
1107
+
1108
+ return false;
1109
+ };
1110
+ /**
1111
+ * _isValidAttribute
1112
+ *
1113
+ * @param {string} lcTag Lowercase tag name of containing element.
1114
+ * @param {string} lcName Lowercase attribute name.
1115
+ * @param {string} value Attribute value.
1116
+ * @return {Boolean} Returns true if `value` is valid, otherwise false.
1117
+ */
1118
+ // eslint-disable-next-line complexity
1119
+
1120
+
1121
+ var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1122
+ /* Make sure attribute cannot clobber */
1123
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
1124
+ return false;
1125
+ }
1126
+ /* Allow valid data-* attributes: At least one character after "-"
1127
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1128
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1129
+ We don't need to check the value; it's always URI safe. */
1130
+
1131
+
1132
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1133
+ if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1134
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1135
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1136
+ _basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
1137
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1138
+ lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
1139
+ return false;
1140
+ }
1141
+ /* Check value is safe. First, is attr inert? If so, is safe */
1142
+
1143
+ } 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 {
1144
+ return false;
1145
+ }
1146
+
1147
+ return true;
1148
+ };
1149
+ /**
1150
+ * _basicCustomElementCheck
1151
+ * checks if at least one dash is included in tagName, and it's not the first char
1152
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1153
+ * @param {string} tagName name of the tag of the node to sanitize
1154
+ */
1155
+
1156
+
1157
+ var _basicCustomElementTest = function _basicCustomElementTest(tagName) {
1158
+ return tagName.indexOf('-') > 0;
1159
+ };
1160
+ /**
1161
+ * _sanitizeAttributes
1162
+ *
1163
+ * @protect attributes
1164
+ * @protect nodeName
1165
+ * @protect removeAttribute
1166
+ * @protect setAttribute
1167
+ *
1168
+ * @param {Node} currentNode to sanitize
1169
+ */
1170
+
1171
+
1172
+ var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1173
+ var attr;
1174
+ var value;
1175
+ var lcName;
1176
+ var l;
1177
+ /* Execute a hook if present */
1178
+
1179
+ _executeHook('beforeSanitizeAttributes', currentNode, null);
1180
+
1181
+ var attributes = currentNode.attributes;
1182
+ /* Check if we have attributes; if not we might have a text node */
1183
+
1184
+ if (!attributes) {
1185
+ return;
1186
+ }
1187
+
1188
+ var hookEvent = {
1189
+ attrName: '',
1190
+ attrValue: '',
1191
+ keepAttr: true,
1192
+ allowedAttributes: ALLOWED_ATTR
1193
+ };
1194
+ l = attributes.length;
1195
+ /* Go backwards over all attributes; safely remove bad ones */
1196
+
1197
+ while (l--) {
1198
+ attr = attributes[l];
1199
+ var _attr = attr,
1200
+ name = _attr.name,
1201
+ namespaceURI = _attr.namespaceURI;
1202
+ value = name === 'value' ? attr.value : stringTrim(attr.value);
1203
+ lcName = transformCaseFunc(name);
1204
+ /* Execute a hook if present */
1205
+
1206
+ hookEvent.attrName = lcName;
1207
+ hookEvent.attrValue = value;
1208
+ hookEvent.keepAttr = true;
1209
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
1210
+
1211
+ _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
1212
+
1213
+ value = hookEvent.attrValue;
1214
+ /* Did the hooks approve of the attribute? */
1215
+
1216
+ if (hookEvent.forceKeepAttr) {
1217
+ continue;
1218
+ }
1219
+ /* Remove attribute */
1220
+
1221
+
1222
+ _removeAttribute(name, currentNode);
1223
+ /* Did the hooks approve of the attribute? */
1224
+
1225
+
1226
+ if (!hookEvent.keepAttr) {
1227
+ continue;
1228
+ }
1229
+ /* Work around a security issue in jQuery 3.0 */
1230
+
1231
+
1232
+ if (regExpTest(/\/>/i, value)) {
1233
+ _removeAttribute(name, currentNode);
1234
+
1235
+ continue;
1236
+ }
1237
+ /* Sanitize attribute content to be template-safe */
1238
+
1239
+
1240
+ if (SAFE_FOR_TEMPLATES) {
1241
+ value = stringReplace(value, MUSTACHE_EXPR$1, ' ');
1242
+ value = stringReplace(value, ERB_EXPR$1, ' ');
1243
+ }
1244
+ /* Is `value` valid for this attribute? */
1245
+
1246
+
1247
+ var lcTag = transformCaseFunc(currentNode.nodeName);
1248
+
1249
+ if (!_isValidAttribute(lcTag, lcName, value)) {
1250
+ continue;
1251
+ }
1252
+ /* Handle invalid data-* attribute set by try-catching it */
1253
+
1254
+
1255
+ try {
1256
+ if (namespaceURI) {
1257
+ currentNode.setAttributeNS(namespaceURI, name, value);
1258
+ } else {
1259
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1260
+ currentNode.setAttribute(name, value);
1261
+ }
1262
+
1263
+ arrayPop(DOMPurify.removed);
1264
+ } catch (_) {}
1265
+ }
1266
+ /* Execute a hook if present */
1267
+
1268
+
1269
+ _executeHook('afterSanitizeAttributes', currentNode, null);
1270
+ };
1271
+ /**
1272
+ * _sanitizeShadowDOM
1273
+ *
1274
+ * @param {DocumentFragment} fragment to iterate over recursively
1275
+ */
1276
+
1277
+
1278
+ var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
1279
+ var shadowNode;
1280
+
1281
+ var shadowIterator = _createIterator(fragment);
1282
+ /* Execute a hook if present */
1283
+
1284
+
1285
+ _executeHook('beforeSanitizeShadowDOM', fragment, null);
1286
+
1287
+ while (shadowNode = shadowIterator.nextNode()) {
1288
+ /* Execute a hook if present */
1289
+ _executeHook('uponSanitizeShadowNode', shadowNode, null);
1290
+ /* Sanitize tags and elements */
1291
+
1292
+
1293
+ if (_sanitizeElements(shadowNode)) {
1294
+ continue;
1295
+ }
1296
+ /* Deep shadow DOM detected */
1297
+
1298
+
1299
+ if (shadowNode.content instanceof DocumentFragment) {
1300
+ _sanitizeShadowDOM(shadowNode.content);
1301
+ }
1302
+ /* Check attributes, sanitize if necessary */
1303
+
1304
+
1305
+ _sanitizeAttributes(shadowNode);
1306
+ }
1307
+ /* Execute a hook if present */
1308
+
1309
+
1310
+ _executeHook('afterSanitizeShadowDOM', fragment, null);
1311
+ };
1312
+ /**
1313
+ * Sanitize
1314
+ * Public method providing core sanitation functionality
1315
+ *
1316
+ * @param {String|Node} dirty string or DOM node
1317
+ * @param {Object} configuration object
1318
+ */
1319
+ // eslint-disable-next-line complexity
1320
+
1321
+
1322
+ DOMPurify.sanitize = function (dirty, cfg) {
1323
+ var body;
1324
+ var importedNode;
1325
+ var currentNode;
1326
+ var oldNode;
1327
+ var returnNode;
1328
+ /* Make sure we have a string to sanitize.
1329
+ DO NOT return early, as this will return the wrong type if
1330
+ the user has requested a DOM object rather than a string */
1331
+
1332
+ IS_EMPTY_INPUT = !dirty;
1333
+
1334
+ if (IS_EMPTY_INPUT) {
1335
+ dirty = '<!-->';
1336
+ }
1337
+ /* Stringify, in case dirty is an object */
1338
+
1339
+
1340
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
1341
+ // eslint-disable-next-line no-negated-condition
1342
+ if (typeof dirty.toString !== 'function') {
1343
+ throw typeErrorCreate('toString is not a function');
1344
+ } else {
1345
+ dirty = dirty.toString();
1346
+
1347
+ if (typeof dirty !== 'string') {
1348
+ throw typeErrorCreate('dirty is not a string, aborting');
1349
+ }
1350
+ }
1351
+ }
1352
+ /* Check we can run. Otherwise fall back or ignore */
1353
+
1354
+
1355
+ if (!DOMPurify.isSupported) {
1356
+ if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') {
1357
+ if (typeof dirty === 'string') {
1358
+ return window.toStaticHTML(dirty);
1359
+ }
1360
+
1361
+ if (_isNode(dirty)) {
1362
+ return window.toStaticHTML(dirty.outerHTML);
1363
+ }
1364
+ }
1365
+
1366
+ return dirty;
1367
+ }
1368
+ /* Assign config vars */
1369
+
1370
+
1371
+ if (!SET_CONFIG) {
1372
+ _parseConfig(cfg);
1373
+ }
1374
+ /* Clean up removed elements */
1375
+
1376
+
1377
+ DOMPurify.removed = [];
1378
+ /* Check if dirty is correctly typed for IN_PLACE */
1379
+
1380
+ if (typeof dirty === 'string') {
1381
+ IN_PLACE = false;
1382
+ }
1383
+
1384
+ if (IN_PLACE) {
1385
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
1386
+ if (dirty.nodeName) {
1387
+ var tagName = transformCaseFunc(dirty.nodeName);
1388
+
1389
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1390
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
1391
+ }
1392
+ }
1393
+ } else if (dirty instanceof Node) {
1394
+ /* If dirty is a DOM element, append to an empty document to avoid
1395
+ elements being stripped by the parser */
1396
+ body = _initDocument('<!---->');
1397
+ importedNode = body.ownerDocument.importNode(dirty, true);
1398
+
1399
+ if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
1400
+ /* Node is already a body, use as is */
1401
+ body = importedNode;
1402
+ } else if (importedNode.nodeName === 'HTML') {
1403
+ body = importedNode;
1404
+ } else {
1405
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1406
+ body.appendChild(importedNode);
1407
+ }
1408
+ } else {
1409
+ /* Exit directly if we have nothing to do */
1410
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
1411
+ dirty.indexOf('<') === -1) {
1412
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1413
+ }
1414
+ /* Initialize the document to work on */
1415
+
1416
+
1417
+ body = _initDocument(dirty);
1418
+ /* Check we have a DOM node from the data */
1419
+
1420
+ if (!body) {
1421
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
1422
+ }
1423
+ }
1424
+ /* Remove first element node (ours) if FORCE_BODY is set */
1425
+
1426
+
1427
+ if (body && FORCE_BODY) {
1428
+ _forceRemove(body.firstChild);
1429
+ }
1430
+ /* Get node iterator */
1431
+
1432
+
1433
+ var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
1434
+ /* Now start iterating over the created document */
1435
+
1436
+
1437
+ while (currentNode = nodeIterator.nextNode()) {
1438
+ /* Fix IE's strange behavior with manipulated textNodes #89 */
1439
+ if (currentNode.nodeType === 3 && currentNode === oldNode) {
1440
+ continue;
1441
+ }
1442
+ /* Sanitize tags and elements */
1443
+
1444
+
1445
+ if (_sanitizeElements(currentNode)) {
1446
+ continue;
1447
+ }
1448
+ /* Shadow DOM detected, sanitize it */
1449
+
1450
+
1451
+ if (currentNode.content instanceof DocumentFragment) {
1452
+ _sanitizeShadowDOM(currentNode.content);
1453
+ }
1454
+ /* Check attributes, sanitize if necessary */
1455
+
1456
+
1457
+ _sanitizeAttributes(currentNode);
1458
+
1459
+ oldNode = currentNode;
1460
+ }
1461
+
1462
+ oldNode = null;
1463
+ /* If we sanitized `dirty` in-place, return it. */
1464
+
1465
+ if (IN_PLACE) {
1466
+ return dirty;
1467
+ }
1468
+ /* Return sanitized string or DOM */
1469
+
1470
+
1471
+ if (RETURN_DOM) {
1472
+ if (RETURN_DOM_FRAGMENT) {
1473
+ returnNode = createDocumentFragment.call(body.ownerDocument);
1474
+
1475
+ while (body.firstChild) {
1476
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1477
+ returnNode.appendChild(body.firstChild);
1478
+ }
1479
+ } else {
1480
+ returnNode = body;
1481
+ }
1482
+
1483
+ if (ALLOWED_ATTR.shadowroot) {
1484
+ /*
1485
+ AdoptNode() is not used because internal state is not reset
1486
+ (e.g. the past names map of a HTMLFormElement), this is safe
1487
+ in theory but we would rather not risk another attack vector.
1488
+ The state that is cloned by importNode() is explicitly defined
1489
+ by the specs.
1490
+ */
1491
+ returnNode = importNode.call(originalDocument, returnNode, true);
1492
+ }
1493
+
1494
+ return returnNode;
1495
+ }
1496
+
1497
+ var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1498
+ /* Serialize doctype if allowed */
1499
+
1500
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1501
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
1502
+ }
1503
+ /* Sanitize final string template-safe */
1504
+
1505
+
1506
+ if (SAFE_FOR_TEMPLATES) {
1507
+ serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$1, ' ');
1508
+ serializedHTML = stringReplace(serializedHTML, ERB_EXPR$1, ' ');
1509
+ }
1510
+
1511
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1512
+ };
1513
+ /**
1514
+ * Public method to set the configuration once
1515
+ * setConfig
1516
+ *
1517
+ * @param {Object} cfg configuration object
1518
+ */
1519
+
1520
+
1521
+ DOMPurify.setConfig = function (cfg) {
1522
+ _parseConfig(cfg);
1523
+
1524
+ SET_CONFIG = true;
1525
+ };
1526
+ /**
1527
+ * Public method to remove the configuration
1528
+ * clearConfig
1529
+ *
1530
+ */
1531
+
1532
+
1533
+ DOMPurify.clearConfig = function () {
1534
+ CONFIG = null;
1535
+ SET_CONFIG = false;
1536
+ };
1537
+ /**
1538
+ * Public method to check if an attribute value is valid.
1539
+ * Uses last set config, if any. Otherwise, uses config defaults.
1540
+ * isValidAttribute
1541
+ *
1542
+ * @param {string} tag Tag name of containing element.
1543
+ * @param {string} attr Attribute name.
1544
+ * @param {string} value Attribute value.
1545
+ * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
1546
+ */
1547
+
1548
+
1549
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
1550
+ /* Initialize shared config vars if necessary. */
1551
+ if (!CONFIG) {
1552
+ _parseConfig({});
1553
+ }
1554
+
1555
+ var lcTag = transformCaseFunc(tag);
1556
+ var lcName = transformCaseFunc(attr);
1557
+ return _isValidAttribute(lcTag, lcName, value);
1558
+ };
1559
+ /**
1560
+ * AddHook
1561
+ * Public method to add DOMPurify hooks
1562
+ *
1563
+ * @param {String} entryPoint entry point for the hook to add
1564
+ * @param {Function} hookFunction function to execute
1565
+ */
1566
+
1567
+
1568
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
1569
+ if (typeof hookFunction !== 'function') {
1570
+ return;
1571
+ }
1572
+
1573
+ hooks[entryPoint] = hooks[entryPoint] || [];
1574
+ arrayPush(hooks[entryPoint], hookFunction);
1575
+ };
1576
+ /**
1577
+ * RemoveHook
1578
+ * Public method to remove a DOMPurify hook at a given entryPoint
1579
+ * (pops it from the stack of hooks if more are present)
1580
+ *
1581
+ * @param {String} entryPoint entry point for the hook to remove
1582
+ * @return {Function} removed(popped) hook
1583
+ */
1584
+
1585
+
1586
+ DOMPurify.removeHook = function (entryPoint) {
1587
+ if (hooks[entryPoint]) {
1588
+ return arrayPop(hooks[entryPoint]);
1589
+ }
1590
+ };
1591
+ /**
1592
+ * RemoveHooks
1593
+ * Public method to remove all DOMPurify hooks at a given entryPoint
1594
+ *
1595
+ * @param {String} entryPoint entry point for the hooks to remove
1596
+ */
1597
+
1598
+
1599
+ DOMPurify.removeHooks = function (entryPoint) {
1600
+ if (hooks[entryPoint]) {
1601
+ hooks[entryPoint] = [];
1602
+ }
1603
+ };
1604
+ /**
1605
+ * RemoveAllHooks
1606
+ * Public method to remove all DOMPurify hooks
1607
+ *
1608
+ */
1609
+
1610
+
1611
+ DOMPurify.removeAllHooks = function () {
1612
+ hooks = {};
1613
+ };
1614
+
1615
+ return DOMPurify;
1616
+ }
1617
+
1618
+ var purify = createDOMPurify();
1619
+
1620
+ return purify;
1621
+
1622
+ });