@cdc/chart 4.23.1 → 4.23.3

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 (74) hide show
  1. package/dist/cdcchart.js +56289 -702
  2. package/examples/Barchart_with_negative.json +34 -0
  3. package/examples/area-chart.json +187 -0
  4. package/examples/big-small-test-bar.json +328 -0
  5. package/examples/big-small-test-line.json +328 -0
  6. package/examples/big-small-test-negative.json +328 -0
  7. package/examples/box-plot.json +1 -2
  8. package/examples/dynamic-legends.json +1 -1
  9. package/examples/example-bar-chart-nonnumeric.json +36 -0
  10. package/examples/example-bar-chart.json +36 -0
  11. package/examples/example-combo-bar-nonnumeric.json +105 -0
  12. package/examples/example-sparkline.json +76 -0
  13. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart.json +31 -172
  14. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json +1 -1
  15. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-confidence.json +1 -0
  16. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-with-confidence.json +96 -14
  17. package/examples/gallery/bar-chart-vertical/vertical-bar-chart.json +2 -2
  18. package/examples/gallery/line/line.json +1 -0
  19. package/examples/gallery/paired-bar/paired-bar-chart.json +65 -13
  20. package/examples/horizontal-chart-max-increase.json +38 -0
  21. package/examples/line-chart-max-increase.json +32 -0
  22. package/examples/line-chart-nonnumeric.json +32 -0
  23. package/examples/line-chart.json +21 -63
  24. package/examples/newdata.json +1 -1
  25. package/examples/planet-combo-example-config.json +143 -20
  26. package/examples/planet-deviation-config.json +168 -0
  27. package/examples/planet-deviation-data.json +38 -0
  28. package/examples/planet-example-config.json +139 -20
  29. package/examples/planet-example-data-max-increase.json +56 -0
  30. package/examples/planet-example-data-nonnumeric.json +56 -0
  31. package/examples/planet-example-data.json +9 -9
  32. package/examples/planet-pie-example-config-nonnumeric.json +30 -0
  33. package/examples/scatterplot-continuous.csv +17 -0
  34. package/examples/scatterplot.json +136 -0
  35. package/examples/sparkline-chart-nonnumeric.json +76 -0
  36. package/examples/stacked-vertical-bar-example-negative.json +154 -0
  37. package/examples/stacked-vertical-bar-example-nonnumerics.json +154 -0
  38. package/index.html +91 -0
  39. package/package.json +33 -24
  40. package/src/{CdcChart.tsx → CdcChart.jsx} +196 -124
  41. package/src/components/AreaChart.jsx +198 -0
  42. package/src/components/{BarChart.tsx → BarChart.jsx} +154 -122
  43. package/src/components/BoxPlot.jsx +101 -0
  44. package/src/components/{DataTable.tsx → DataTable.jsx} +109 -28
  45. package/src/components/DeviationBar.jsx +191 -0
  46. package/src/components/{EditorPanel.js → EditorPanel.jsx} +676 -157
  47. package/src/components/{Filters.js → Filters.jsx} +6 -11
  48. package/src/components/Legend.jsx +316 -0
  49. package/src/components/{LineChart.tsx → LineChart.jsx} +22 -26
  50. package/src/components/{LinearChart.tsx → LinearChart.jsx} +214 -91
  51. package/src/components/{PairedBarChart.tsx → PairedBarChart.jsx} +44 -78
  52. package/src/components/{PieChart.tsx → PieChart.jsx} +26 -44
  53. package/src/components/ScatterPlot.jsx +51 -0
  54. package/src/components/SparkLine.jsx +218 -0
  55. package/src/components/{useIntersectionObserver.tsx → useIntersectionObserver.jsx} +2 -2
  56. package/src/data/initial-state.js +51 -5
  57. package/src/hooks/useColorPalette.js +68 -0
  58. package/src/hooks/{useReduceData.ts → useReduceData.js} +26 -16
  59. package/src/hooks/useRightAxis.js +3 -1
  60. package/src/index.jsx +16 -0
  61. package/src/scss/DataTable.scss +22 -0
  62. package/src/scss/editor-panel.scss +5 -0
  63. package/src/scss/main.scss +30 -10
  64. package/src/test/CdcChart.test.jsx +6 -0
  65. package/vite.config.js +4 -0
  66. package/dist/495.js +0 -3
  67. package/dist/703.js +0 -1
  68. package/src/components/BoxPlot.js +0 -92
  69. package/src/components/Legend.js +0 -291
  70. package/src/components/SparkLine.js +0 -185
  71. package/src/hooks/useColorPalette.ts +0 -76
  72. package/src/index.html +0 -67
  73. package/src/index.tsx +0 -18
  74. /package/src/{context.tsx → ConfigContext.jsx} +0 -0
@@ -1,6 +1,7 @@
1
1
  export default {
2
2
  type: 'chart',
3
3
  title: '',
4
+ showTitle: true,
4
5
  theme: 'theme-blue',
5
6
  animate: false,
6
7
  fontSize: 'medium',
@@ -24,6 +25,7 @@ export default {
24
25
  hideTicks: false,
25
26
  size: 50,
26
27
  gridLines: false,
28
+ enablePadding: false,
27
29
  min: '',
28
30
  max: '',
29
31
  labelColor: '#333',
@@ -36,9 +38,38 @@ export default {
36
38
  rightAxisLabelColor: '#333',
37
39
  rightAxisTickLabelColor: '#333',
38
40
  rightAxisTickColor: '#333',
39
- numTicks: ''
41
+ numTicks: '',
42
+ axisPadding: 0,
43
+ tickRotation: 0
44
+ },
45
+ boxplot: {
46
+ plots: [],
47
+ borders: 'true',
48
+ firstQuartilePercentage: 25,
49
+ thirdQuartilePercentage: 75,
50
+ boxWidthPercentage: 40,
51
+ plotOutlierValues: false,
52
+ plotNonOutlierValues: true,
53
+ legend: {
54
+ showHowToReadText: false,
55
+ howToReadText: ''
56
+ },
57
+ labels: {
58
+ q1: 'Lower Quartile',
59
+ q2: 'q2',
60
+ q3: 'Upper Quartile',
61
+ q4: 'q4',
62
+ minimum: 'Minimum',
63
+ maximum: 'Maximum',
64
+ mean: 'Mean',
65
+ median: 'Median',
66
+ sd: 'Standard Deviation',
67
+ iqr: 'Interquartile Range',
68
+ total: 'Total',
69
+ outliers: 'Outliers',
70
+ values: 'Values'
71
+ }
40
72
  },
41
- boxplot: [],
42
73
  topAxis: {
43
74
  hasLine: false
44
75
  },
@@ -52,6 +83,8 @@ export default {
52
83
  },
53
84
  xAxis: {
54
85
  type: 'categorical',
86
+ showTargetLabel: true,
87
+ targetLabel: 'Target',
55
88
  hideAxis: false,
56
89
  hideLabel: false,
57
90
  hideTicks: false,
@@ -63,7 +96,9 @@ export default {
63
96
  tickLabelColor: '#333',
64
97
  tickColor: '#333',
65
98
  numTicks: '',
66
- labelOffset: 65
99
+ labelOffset: 65,
100
+ axisPadding: 0,
101
+ target: 0
67
102
  },
68
103
  table: {
69
104
  label: 'Data Table',
@@ -76,7 +111,6 @@ export default {
76
111
  orientation: 'vertical',
77
112
  legend: {
78
113
  behavior: 'isolate',
79
- position: 'right',
80
114
  singleRow: false,
81
115
  colorCode: '',
82
116
  reverseLabelOrder: false,
@@ -93,8 +127,20 @@ export default {
93
127
  },
94
128
  palette: 'qualitative-bold',
95
129
  isPaletteReversed: false,
130
+ twoColor: {
131
+ palette: 'monochrome-1',
132
+ isPaletteReversed: false
133
+ },
96
134
  labels: false,
97
- dataFormat: { commas: false, prefix: '', suffix: '', abbreviated: false },
135
+ dataFormat: {
136
+ commas: false,
137
+ prefix: '',
138
+ suffix: '',
139
+ abbreviated: false,
140
+ bottomSuffix: '',
141
+ bottomPrefix: '',
142
+ bottomAbbreviated: false
143
+ },
98
144
  confidenceKeys: {},
99
145
  visual: {
100
146
  border: true,
@@ -0,0 +1,68 @@
1
+ import { colorPalettesChart, twoColorPalette } from '@cdc/core/data/colorPalettes'
2
+ import { useEffect } from 'react'
3
+
4
+ export const useColorPalette = (config, updateConfig) => {
5
+ let twoColorPalettes = []
6
+ let sequential = []
7
+ let nonSequential = []
8
+
9
+ // Get two color palettes if visualization type is Paired Bar
10
+ if (config.visualizationType === 'Paired Bar' || config.visualizationType === 'Deviation Bar') {
11
+ const isReversed = config.twoColor.isPaletteReversed
12
+ twoColorPalettes = Object.keys(twoColorPalette).filter(name => (isReversed ? name.endsWith('reverse') : !name.endsWith('reverse')))
13
+ } else {
14
+ // Get sequential and non-sequential palettes for other visualization types
15
+ const seqPalettes = []
16
+ const nonSeqPalettes = []
17
+
18
+ for (const paletteName in colorPalettesChart) {
19
+ const isSequential = paletteName.startsWith('sequential')
20
+ const isQualitative = paletteName.startsWith('qualitative')
21
+ const isReversed = paletteName.endsWith('reverse')
22
+
23
+ if (isSequential && ((!config.isPaletteReversed && !isReversed) || (config.isPaletteReversed && isReversed))) {
24
+ seqPalettes.push(paletteName)
25
+ }
26
+
27
+ if (isQualitative && ((!config.isPaletteReversed && !isReversed) || (config.isPaletteReversed && isReversed))) {
28
+ nonSeqPalettes.push(paletteName)
29
+ }
30
+ }
31
+
32
+ sequential = seqPalettes
33
+ nonSequential = nonSeqPalettes
34
+ }
35
+
36
+ // Update pairedBar.palette based on isPaletteReversed
37
+ useEffect(() => {
38
+ let palette = ''
39
+
40
+ if (config.twoColor.isPaletteReversed && !config.twoColor.palette.endsWith('reverse')) {
41
+ palette = config.twoColor.palette + 'reverse'
42
+ }
43
+
44
+ if (!config.twoColor.isPaletteReversed && config.twoColor.palette.endsWith('reverse')) {
45
+ palette = config.twoColor.palette.slice(0, -7)
46
+ }
47
+
48
+ updateConfig({ ...config, twoColor: { ...config.twoColor, palette: palette } })
49
+ }, [config.twoColor.isPaletteReversed])
50
+
51
+ // Update palette based on isPaletteReversed
52
+ useEffect(() => {
53
+ let palette = ''
54
+
55
+ if (config.isPaletteReversed && !config.palette.endsWith('reverse')) {
56
+ palette = config.palette + 'reverse'
57
+ }
58
+
59
+ if (!config.isPaletteReversed && config.palette.endsWith('reverse')) {
60
+ palette = config.palette.slice(0, -7)
61
+ }
62
+
63
+ updateConfig({ ...config, palette: palette })
64
+ }, [config.isPaletteReversed])
65
+
66
+ // Return all palettes
67
+ return { twoColorPalettes, sequential, nonSequential }
68
+ }
@@ -1,9 +1,20 @@
1
+ import isNumber from '@cdc/core/helpers/isNumber'
2
+
1
3
  function useReduceData(config, data) {
2
4
  // for combo charts check if all Data Series selected to Bar;
3
5
  const isBar = config?.series?.every(element => element?.type === 'Bar')
4
6
  // for combo charts check if all Data series selected Line or dashed-md/sm/lg.
5
- const isAllLine = config?.series?.every(el => el.type === 'Line' || el.type=== 'dashed-sm'|| el.type=== 'dashed-md' || el.type=== 'dashed-lg');
6
-
7
+ const isAllLine = config?.series?.every(el => el.type === 'Line' || el.type === 'dashed-sm' || el.type === 'dashed-md' || el.type === 'dashed-lg')
8
+ const cleanChars = value => {
9
+ // remove comma and $ signs
10
+ let tmp
11
+ if (typeof value === 'string') {
12
+ tmp = value !== null && value !== '' ? value.replace(/[,$]/g, '') : ''
13
+ } else {
14
+ tmp = value !== null && value !== '' ? value : ''
15
+ }
16
+ return tmp
17
+ }
7
18
  const getMaxValueFromData = () => {
8
19
  let max // will hold max number from data.
9
20
  if ((config.visualizationType === 'Bar' || (config.visualizationType === 'Combo' && isBar)) && config.visualizationSubType === 'stacked') {
@@ -18,11 +29,12 @@ function useReduceData(config, data) {
18
29
  max = totalYValues
19
30
  }
20
31
  return allTotals
21
- }, [] as number[])
32
+ }, [])
22
33
 
23
34
  max = Math.max(...yTotals)
24
- } else if (config.visualizationType === 'Bar' && config.series && config.series.dataKey) {
25
- max = Math.max(...data.map(d => Number(d[config.series.dataKey])))
35
+ } else if ((config.visualizationType === 'Bar' || config.visualizationType === 'Deviation Bar') && config.series && config.series.dataKey) {
36
+ max = Math.max(...data.map(d => (isNumber(d[config.series.dataKey]) ? Number(cleanChars(d[config.series.dataKey])) : 0)))
37
+ //max = Math.max(...data.map(d => Number(d[config.series.dataKey])))
26
38
  } else if (config.visualizationType === 'Combo' && config.visualizationSubType === 'stacked' && !isBar) {
27
39
  let total = []
28
40
 
@@ -33,31 +45,29 @@ function useReduceData(config, data) {
33
45
  yTotal += Number(d[k])
34
46
  return yTotal
35
47
  }, 0)
36
- total.push(totalYValues)
48
+ return total.push(totalYValues)
37
49
  })
38
50
  // get lineSeries largest values
39
- const lineMax = Math.max(...data.map(d => Math.max(...config.runtime.lineSeriesKeys.map(key => Number(d[key])))))
51
+ const lineMax = Math.max(...data.map(d => Math.max(...config.runtime.lineSeriesKeys.map(key => Number(cleanChars(d[key]))))))
40
52
 
41
53
  const barMax = Math.max(...total)
42
54
 
43
55
  max = Number(barMax) > Number(lineMax) ? barMax : lineMax
44
56
  }
45
57
  } else {
46
- max = Math.max(...data.map(d => Math.max(...config.runtime.seriesKeys.map(key => Number(d[key])))))
58
+ max = Math.max(...data.map(d => Math.max(...config.runtime.seriesKeys.map(key => (isNumber(d[key]) ? Number(cleanChars(d[key])) : 0)))))
47
59
  }
48
-
49
60
  return max
50
61
  }
51
62
 
52
63
  const getMinValueFromData = () => {
53
64
  let min
54
- const minNumberFromData = Math.min(...data.map(d => Math.min(...config.runtime.seriesKeys.map(key => Number(d[key])))))
65
+ const minNumberFromData = Math.min(...data.map(d => Math.min(...config.runtime.seriesKeys.map(key => (isNumber(d[key]) ? Number(cleanChars(d[key])) : 1000000000)))))
55
66
  min = String(minNumberFromData)
56
-
57
67
  return min
58
68
  }
59
69
 
60
- const findPositiveNum = (): boolean => {
70
+ const findPositiveNum = () => {
61
71
  // loop throught provided data to find positve number in arr based on series keys.
62
72
  let existPositiveValue = false
63
73
  if (config.runtime.seriesKeys) {
@@ -68,11 +78,11 @@ function useReduceData(config, data) {
68
78
  return existPositiveValue
69
79
  }
70
80
 
71
- const maxValue = Number(getMaxValueFromData());
72
- const minValue = Number(getMinValueFromData());
73
- const existPositiveValue = findPositiveNum();
81
+ const maxValue = Number(getMaxValueFromData())
82
+ const minValue = Number(getMinValueFromData())
83
+ const existPositiveValue = findPositiveNum()
74
84
 
75
- return {minValue, maxValue, existPositiveValue ,isAllLine}
85
+ return { minValue, maxValue, existPositiveValue, isAllLine }
76
86
  }
77
87
 
78
88
  export default useReduceData
@@ -1,8 +1,10 @@
1
1
  import { scaleLinear } from '@visx/scale'
2
+ import useReduceData from '../hooks/useReduceData'
2
3
 
3
4
  export default function useRightAxis({ config, yMax = 0, data = [], updateConfig }) {
4
5
  const hasRightAxis = config.visualizationType === 'Combo' && config.orientation === 'vertical'
5
6
  const rightSeriesKeys = config.series && config.series.filter(series => series.axis === 'Right').map(key => key.dataKey)
7
+ const { minValue } = useReduceData(config, data)
6
8
 
7
9
  const allRightAxisData = rightSeriesKeys => {
8
10
  if (!rightSeriesKeys) return [0]
@@ -17,7 +19,7 @@ export default function useRightAxis({ config, yMax = 0, data = [], updateConfig
17
19
  const max = Math.max.apply(null, allRightAxisData(rightSeriesKeys))
18
20
 
19
21
  const yScaleRight = scaleLinear({
20
- domain: [0, max],
22
+ domain: [minValue, max],
21
23
  range: [yMax, 0]
22
24
  })
23
25
 
package/src/index.jsx ADDED
@@ -0,0 +1,16 @@
1
+ import React from 'react'
2
+ import ReactDOM from 'react-dom/client'
3
+
4
+ import CdcChart from './CdcChart'
5
+
6
+ import 'react-tooltip/dist/react-tooltip.css'
7
+
8
+ let isEditor = window.location.href.includes('editor=true')
9
+
10
+ let domContainer = document.getElementsByClassName('react-container')[0]
11
+
12
+ ReactDOM.createRoot(domContainer).render(
13
+ <React.StrictMode>
14
+ <CdcChart configUrl={domContainer.attributes['data-config'].value} isEditor={isEditor} />
15
+ </React.StrictMode>
16
+ )
@@ -5,6 +5,28 @@
5
5
  }
6
6
 
7
7
  .data-table-container {
8
+ // Hides Category Column
9
+ .row-Box-Plot--0 {
10
+ display: none !important;
11
+ }
12
+
13
+ // Highlight Boxplot 5 Number Summary
14
+ .row-Box-Plot--1 > td:first-child,
15
+ .row-Box-Plot--2 > td:first-child,
16
+ .row-Box-Plot--3 > td:first-child,
17
+ .row-Box-Plot--4 > td:first-child,
18
+ .row-Box-Plot--5 > td:first-child {
19
+ background-color: #ffe699;
20
+ }
21
+ // Highlight Boxplot Measures
22
+ .row-Box-Plot--6 > td:first-child,
23
+ .row-Box-Plot--7 > td:first-child,
24
+ .row-Box-Plot--8 > td:first-child,
25
+ .row-Box-Plot--9 > td:first-child,
26
+ .row-Box-Plot--10 > td:first-child,
27
+ .row-Box-Plot--11 > td:first-child {
28
+ background-color: #d9d9d9;
29
+ }
8
30
  .region-table {
9
31
  display: table;
10
32
 
@@ -419,6 +419,11 @@
419
419
  width: 33.3%;
420
420
  height: 100%;
421
421
  }
422
+
423
+ span.two-color {
424
+ width: 50%;
425
+ height: 100%;
426
+ }
422
427
  }
423
428
  }
424
429
 
@@ -1,8 +1,8 @@
1
- @import '~@cdc/core/styles/base';
2
- @import '~@cdc/core/styles/heading-colors';
1
+ @import '@cdc/core/styles/base';
2
+ @import '@cdc/core/styles/heading-colors';
3
3
  @import 'mixins';
4
4
  @import 'variables';
5
- @import '~@cdc/core/styles/v2/themes/color-definitions';
5
+ @import '@cdc/core/styles/v2/themes/color-definitions';
6
6
 
7
7
  .form-container {
8
8
  overflow-y: auto;
@@ -232,14 +232,20 @@
232
232
  }
233
233
 
234
234
  .tooltip {
235
- background-color: #fff;
236
- border: rgba(0, 0, 0, 0.3) 1px solid !important;
237
- box-shadow: rgba(0, 0, 0, 0.1) 3px 3px 7px;
238
- line-height: 1.4em;
239
- font-size: 1em !important;
240
- border-radius: 4px !important;
241
- padding: 8px 12px !important;
235
+ border: rgba(0,0,0,.3) 1px solid;
236
+ box-shadow: rgba(0,0,0,.1) 3px 3px 7px;
242
237
  opacity: 1;
238
+ line-height: 1.4em;
239
+ font-size: 1em;
240
+ border-radius: 4px;
241
+ padding: 8px 12px;
242
+ z-index: 1;
243
+
244
+ .react-tooltip-arrow {
245
+ border-bottom: rgba(0,0,0,.3) 1px solid;
246
+ border-right: rgba(0,0,0,.3) 1px solid;
247
+ backface-visibility: hidden;
248
+ }
243
249
  }
244
250
 
245
251
  .region-table {
@@ -557,6 +563,7 @@
557
563
 
558
564
  .horizontal rect,
559
565
  .horizontal foreignObject {
566
+ opacity: 0;
560
567
  animation: growBarH 0.5s linear forwards;
561
568
  animation-play-state: paused;
562
569
  }
@@ -593,13 +600,26 @@
593
600
 
594
601
  @keyframes growBarH {
595
602
  from {
603
+ opacity: 1;
596
604
  transform: scale(0, 1);
597
605
  }
598
606
 
599
607
  to {
608
+ opacity: 1;
600
609
  transform: scale(1);
601
610
  }
602
611
  }
612
+
613
+ .fieldset--boxplot {
614
+ padding: 10px;
615
+ border-radius: 5px;
616
+ border: 2px solid rgba(0, 0, 0, 0.2);
617
+ padding: 10px;
618
+
619
+ label {
620
+ margin: 5px 0;
621
+ }
622
+ }
603
623
  }
604
624
 
605
625
  .cdc-visualization__paired-bar-chart {
@@ -0,0 +1,6 @@
1
+ // Placeholder test until we add them in.
2
+ describe('Chart', () => {
3
+ it('has a test.', async () => {
4
+ return true
5
+ })
6
+ })
package/vite.config.js ADDED
@@ -0,0 +1,4 @@
1
+ import GenerateViteConfig from '../../generateViteConfig.js'
2
+ import { moduleName } from './package.json'
3
+
4
+ export default GenerateViteConfig(moduleName)
package/dist/495.js DELETED
@@ -1,3 +0,0 @@
1
- (self.webpackChunkCdcChart=self.webpackChunkCdcChart||[]).push([[495],{16478:function(e){
2
- /*! @license DOMPurify 2.4.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.1/LICENSE */
3
- e.exports=function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,n){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function r(e,o,a){return r=n()?Reflect.construct:function(e,n,r){var o=[null];o.push.apply(o,n);var a=new(Function.bind.apply(e,o));return r&&t(a,r.prototype),a},r.apply(null,arguments)}function o(e){return a(e)||i(e)||l(e)||u()}function a(e){if(Array.isArray(e))return c(e)}function i(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s=Object.hasOwnProperty,m=Object.setPrototypeOf,f=Object.isFrozen,p=Object.getPrototypeOf,d=Object.getOwnPropertyDescriptor,h=Object.freeze,g=Object.seal,y=Object.create,b="undefined"!=typeof Reflect&&Reflect,v=b.apply,T=b.construct;v||(v=function(e,t,n){return e.apply(t,n)}),h||(h=function(e){return e}),g||(g=function(e){return e}),T||(T=function(e,t){return r(e,o(t))});var N=L(Array.prototype.forEach),A=L(Array.prototype.pop),E=L(Array.prototype.push),w=L(String.prototype.toLowerCase),S=L(String.prototype.toString),k=L(String.prototype.match),x=L(String.prototype.replace),_=L(String.prototype.indexOf),C=L(String.prototype.trim),O=L(RegExp.prototype.test),D=R(TypeError);function L(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return v(e,t,r)}}function R(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return T(e,n)}}function M(e,t,n){n=n||w,m&&m(e,null);for(var r=t.length;r--;){var o=t[r];if("string"==typeof o){var a=n(o);a!==o&&(f(t)||(t[r]=a),o=a)}e[o]=!0}return e}function I(e){var t,n=y(null);for(t in e)v(s,e,[t])&&(n[t]=e[t]);return n}function F(e,t){for(;null!==e;){var n=d(e,t);if(n){if(n.get)return L(n.get);if("function"==typeof n.value)return L(n.value)}e=p(e)}function r(e){return console.warn("fallback value for",e),null}return r}var U=h(["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"]),H=h(["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"]),z=h(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),P=h(["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"]),B=h(["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"]),j=h(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),G=h(["#text"]),W=h(["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"]),q=h(["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"]),Y=h(["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"]),$=h(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),K=g(/\{\{[\w\W]*|[\w\W]*\}\}/gm),V=g(/<%[\w\W]*|[\w\W]*%>/gm),X=g(/\${[\w\W]*}/gm),Z=g(/^data-[\-\w.\u00B7-\uFFFF]/),J=g(/^aria-[\-\w]+$/),Q=g(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ee=g(/^(?:\w+script|data):/i),te=g(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ne=g(/^html$/i),re=function(){return"undefined"==typeof window?null:window},oe=function(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var r=null,o="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(o)&&(r=n.currentScript.getAttribute(o));var a="dompurify"+(r?"#"+r:"");try{return t.createPolicy(a,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+a+" could not be created."),null}};function ae(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:re(),n=function(e){return ae(e)};if(n.version="2.4.1",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,a=t.document,i=t.DocumentFragment,l=t.HTMLTemplateElement,c=t.Node,u=t.Element,s=t.NodeFilter,m=t.NamedNodeMap,f=void 0===m?t.NamedNodeMap||t.MozNamedAttrMap:m,p=t.HTMLFormElement,d=t.DOMParser,g=t.trustedTypes,y=u.prototype,b=F(y,"cloneNode"),v=F(y,"nextSibling"),T=F(y,"childNodes"),L=F(y,"parentNode");if("function"==typeof l){var R=a.createElement("template");R.content&&R.content.ownerDocument&&(a=R.content.ownerDocument)}var ie=oe(g,r),le=ie?ie.createHTML(""):"",ce=a,ue=ce.implementation,se=ce.createNodeIterator,me=ce.createDocumentFragment,fe=ce.getElementsByTagName,pe=r.importNode,de={};try{de=I(a).documentMode?a.documentMode:{}}catch(e){}var he={};n.isSupported="function"==typeof L&&ue&&void 0!==ue.createHTMLDocument&&9!==de;var ge,ye,be=K,ve=V,Te=X,Ne=Z,Ae=J,Ee=ee,we=te,Se=Q,ke=null,xe=M({},[].concat(o(U),o(H),o(z),o(B),o(G))),_e=null,Ce=M({},[].concat(o(W),o(q),o(Y),o($))),Oe=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),De=null,Le=null,Re=!0,Me=!0,Ie=!1,Fe=!1,Ue=!1,He=!1,ze=!1,Pe=!1,Be=!1,je=!1,Ge=!0,We=!1,qe="user-content-",Ye=!0,$e=!1,Ke={},Ve=null,Xe=M({},["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"]),Ze=null,Je=M({},["audio","video","img","source","image","track"]),Qe=null,et=M({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",rt="http://www.w3.org/1999/xhtml",ot=rt,at=!1,it=null,lt=M({},[tt,nt,rt],S),ct=["application/xhtml+xml","text/html"],ut="text/html",st=null,mt=a.createElement("form"),ft=function(e){return e instanceof RegExp||e instanceof Function},pt=function(t){st&&st===t||(t&&"object"===e(t)||(t={}),t=I(t),ge=ge=-1===ct.indexOf(t.PARSER_MEDIA_TYPE)?ut:t.PARSER_MEDIA_TYPE,ye="application/xhtml+xml"===ge?S:w,ke="ALLOWED_TAGS"in t?M({},t.ALLOWED_TAGS,ye):xe,_e="ALLOWED_ATTR"in t?M({},t.ALLOWED_ATTR,ye):Ce,it="ALLOWED_NAMESPACES"in t?M({},t.ALLOWED_NAMESPACES,S):lt,Qe="ADD_URI_SAFE_ATTR"in t?M(I(et),t.ADD_URI_SAFE_ATTR,ye):et,Ze="ADD_DATA_URI_TAGS"in t?M(I(Je),t.ADD_DATA_URI_TAGS,ye):Je,Ve="FORBID_CONTENTS"in t?M({},t.FORBID_CONTENTS,ye):Xe,De="FORBID_TAGS"in t?M({},t.FORBID_TAGS,ye):{},Le="FORBID_ATTR"in t?M({},t.FORBID_ATTR,ye):{},Ke="USE_PROFILES"in t&&t.USE_PROFILES,Re=!1!==t.ALLOW_ARIA_ATTR,Me=!1!==t.ALLOW_DATA_ATTR,Ie=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Fe=t.SAFE_FOR_TEMPLATES||!1,Ue=t.WHOLE_DOCUMENT||!1,Pe=t.RETURN_DOM||!1,Be=t.RETURN_DOM_FRAGMENT||!1,je=t.RETURN_TRUSTED_TYPE||!1,ze=t.FORCE_BODY||!1,Ge=!1!==t.SANITIZE_DOM,We=t.SANITIZE_NAMED_PROPS||!1,Ye=!1!==t.KEEP_CONTENT,$e=t.IN_PLACE||!1,Se=t.ALLOWED_URI_REGEXP||Se,ot=t.NAMESPACE||rt,t.CUSTOM_ELEMENT_HANDLING&&ft(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Oe.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&ft(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Oe.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Oe.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Fe&&(Me=!1),Be&&(Pe=!0),Ke&&(ke=M({},o(G)),_e=[],!0===Ke.html&&(M(ke,U),M(_e,W)),!0===Ke.svg&&(M(ke,H),M(_e,q),M(_e,$)),!0===Ke.svgFilters&&(M(ke,z),M(_e,q),M(_e,$)),!0===Ke.mathMl&&(M(ke,B),M(_e,Y),M(_e,$))),t.ADD_TAGS&&(ke===xe&&(ke=I(ke)),M(ke,t.ADD_TAGS,ye)),t.ADD_ATTR&&(_e===Ce&&(_e=I(_e)),M(_e,t.ADD_ATTR,ye)),t.ADD_URI_SAFE_ATTR&&M(Qe,t.ADD_URI_SAFE_ATTR,ye),t.FORBID_CONTENTS&&(Ve===Xe&&(Ve=I(Ve)),M(Ve,t.FORBID_CONTENTS,ye)),Ye&&(ke["#text"]=!0),Ue&&M(ke,["html","head","body"]),ke.table&&(M(ke,["tbody"]),delete De.tbody),h&&h(t),st=t)},dt=M({},["mi","mo","mn","ms","mtext"]),ht=M({},["foreignobject","desc","title","annotation-xml"]),gt=M({},["title","style","font","a","script"]),yt=M({},H);M(yt,z),M(yt,P);var bt=M({},B);M(bt,j);var vt=function(e){var t=L(e);t&&t.tagName||(t={namespaceURI:ot,tagName:"template"});var n=w(e.tagName),r=w(t.tagName);return!!it[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===rt?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===r||dt[r]):Boolean(yt[n]):e.namespaceURI===tt?t.namespaceURI===rt?"math"===n:t.namespaceURI===nt?"math"===n&&ht[r]:Boolean(bt[n]):e.namespaceURI===rt?!(t.namespaceURI===nt&&!ht[r])&&!(t.namespaceURI===tt&&!dt[r])&&!bt[n]&&(gt[n]||!yt[n]):!("application/xhtml+xml"!==ge||!it[e.namespaceURI]))},Tt=function(e){E(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=le}catch(t){e.remove()}}},Nt=function(e,t){try{E(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){E(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!_e[e])if(Pe||Be)try{Tt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},At=function(e){var t,n;if(ze)e="<remove></remove>"+e;else{var r=k(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===ge&&ot===rt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var o=ie?ie.createHTML(e):e;if(ot===rt)try{t=(new d).parseFromString(o,ge)}catch(e){}if(!t||!t.documentElement){t=ue.createDocument(ot,"template",null);try{t.documentElement.innerHTML=at?"":o}catch(e){}}var i=t.body||t.documentElement;return e&&n&&i.insertBefore(a.createTextNode(n),i.childNodes[0]||null),ot===rt?fe.call(t,Ue?"html":"body")[0]:Ue?t.documentElement:i},Et=function(e){return se.call(e.ownerDocument||e,e,s.SHOW_ELEMENT|s.SHOW_COMMENT|s.SHOW_TEXT,null,!1)},wt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof f)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},St=function(t){return"object"===e(c)?t instanceof c:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},kt=function(e,t,r){he[e]&&N(he[e],(function(e){e.call(n,t,r,st)}))},xt=function(e){var t;if(kt("beforeSanitizeElements",e,null),wt(e))return Tt(e),!0;if(O(/[\u0080-\uFFFF]/,e.nodeName))return Tt(e),!0;var r=ye(e.nodeName);if(kt("uponSanitizeElement",e,{tagName:r,allowedTags:ke}),e.hasChildNodes()&&!St(e.firstElementChild)&&(!St(e.content)||!St(e.content.firstElementChild))&&O(/<[/\w]/g,e.innerHTML)&&O(/<[/\w]/g,e.textContent))return Tt(e),!0;if("select"===r&&O(/<template/i,e.innerHTML))return Tt(e),!0;if(!ke[r]||De[r]){if(!De[r]&&Ct(r)){if(Oe.tagNameCheck instanceof RegExp&&O(Oe.tagNameCheck,r))return!1;if(Oe.tagNameCheck instanceof Function&&Oe.tagNameCheck(r))return!1}if(Ye&&!Ve[r]){var o=L(e)||e.parentNode,a=T(e)||e.childNodes;if(a&&o)for(var i=a.length-1;i>=0;--i)o.insertBefore(b(a[i],!0),v(e))}return Tt(e),!0}return e instanceof u&&!vt(e)?(Tt(e),!0):"noscript"!==r&&"noembed"!==r||!O(/<\/no(script|embed)/i,e.innerHTML)?(Fe&&3===e.nodeType&&(t=e.textContent,t=x(t,be," "),t=x(t,ve," "),t=x(t,Te," "),e.textContent!==t&&(E(n.removed,{element:e.cloneNode()}),e.textContent=t)),kt("afterSanitizeElements",e,null),!1):(Tt(e),!0)},_t=function(e,t,n){if(Ge&&("id"===t||"name"===t)&&(n in a||n in mt))return!1;if(Me&&!Le[t]&&O(Ne,t));else if(Re&&O(Ae,t));else if(!_e[t]||Le[t]){if(!(Ct(e)&&(Oe.tagNameCheck instanceof RegExp&&O(Oe.tagNameCheck,e)||Oe.tagNameCheck instanceof Function&&Oe.tagNameCheck(e))&&(Oe.attributeNameCheck instanceof RegExp&&O(Oe.attributeNameCheck,t)||Oe.attributeNameCheck instanceof Function&&Oe.attributeNameCheck(t))||"is"===t&&Oe.allowCustomizedBuiltInElements&&(Oe.tagNameCheck instanceof RegExp&&O(Oe.tagNameCheck,n)||Oe.tagNameCheck instanceof Function&&Oe.tagNameCheck(n))))return!1}else if(Qe[t]);else if(O(Se,x(n,we,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==_(n,"data:")||!Ze[e])if(Ie&&!O(Ee,x(n,we,"")));else if(n)return!1;return!0},Ct=function(e){return e.indexOf("-")>0},Ot=function(t){var r,o,a,i;kt("beforeSanitizeAttributes",t,null);var l=t.attributes;if(l){var c={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_e};for(i=l.length;i--;){var u=r=l[i],s=u.name,m=u.namespaceURI;if(o="value"===s?r.value:C(r.value),a=ye(s),c.attrName=a,c.attrValue=o,c.keepAttr=!0,c.forceKeepAttr=void 0,kt("uponSanitizeAttribute",t,c),o=c.attrValue,!c.forceKeepAttr&&(Nt(s,t),c.keepAttr))if(O(/\/>/i,o))Nt(s,t);else{Fe&&(o=x(o,be," "),o=x(o,ve," "),o=x(o,Te," "));var f=ye(t.nodeName);if(_t(f,a,o)){if(!We||"id"!==a&&"name"!==a||(Nt(s,t),o=qe+o),ie&&"object"===e(g)&&"function"==typeof g.getAttributeType)if(m);else switch(g.getAttributeType(f,a)){case"TrustedHTML":o=ie.createHTML(o);break;case"TrustedScriptURL":o=ie.createScriptURL(o)}try{m?t.setAttributeNS(m,s,o):t.setAttribute(s,o),A(n.removed)}catch(e){}}}}kt("afterSanitizeAttributes",t,null)}},Dt=function e(t){var n,r=Et(t);for(kt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)kt("uponSanitizeShadowNode",n,null),xt(n)||(n.content instanceof i&&e(n.content),Ot(n));kt("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(o){var a,l,u,s,m,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((at=!o)&&(o="\x3c!--\x3e"),"string"!=typeof o&&!St(o)){if("function"!=typeof o.toString)throw D("toString is not a function");if("string"!=typeof(o=o.toString()))throw D("dirty is not a string, aborting")}if(!n.isSupported){if("object"===e(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof o)return t.toStaticHTML(o);if(St(o))return t.toStaticHTML(o.outerHTML)}return o}if(He||pt(f),n.removed=[],"string"==typeof o&&($e=!1),$e){if(o.nodeName){var p=ye(o.nodeName);if(!ke[p]||De[p])throw D("root node is forbidden and cannot be sanitized in-place")}}else if(o instanceof c)1===(l=(a=At("\x3c!----\x3e")).ownerDocument.importNode(o,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?a=l:a.appendChild(l);else{if(!Pe&&!Fe&&!Ue&&-1===o.indexOf("<"))return ie&&je?ie.createHTML(o):o;if(!(a=At(o)))return Pe?null:je?le:""}a&&ze&&Tt(a.firstChild);for(var d=Et($e?o:a);u=d.nextNode();)3===u.nodeType&&u===s||xt(u)||(u.content instanceof i&&Dt(u.content),Ot(u),s=u);if(s=null,$e)return o;if(Pe){if(Be)for(m=me.call(a.ownerDocument);a.firstChild;)m.appendChild(a.firstChild);else m=a;return _e.shadowroot&&(m=pe.call(r,m,!0)),m}var h=Ue?a.outerHTML:a.innerHTML;return Ue&&ke["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&O(ne,a.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+a.ownerDocument.doctype.name+">\n"+h),Fe&&(h=x(h,be," "),h=x(h,ve," "),h=x(h,Te," ")),ie&&je?ie.createHTML(h):h},n.setConfig=function(e){pt(e),He=!0},n.clearConfig=function(){st=null,He=!1},n.isValidAttribute=function(e,t,n){st||pt({});var r=ye(e),o=ye(t);return _t(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&(he[e]=he[e]||[],E(he[e],t))},n.removeHook=function(e){if(he[e])return A(he[e])},n.removeHooks=function(e){he[e]&&(he[e]=[])},n.removeAllHooks=function(){he={}},n}return ae()}()}}]);