@lifesg/react-design-system 3.5.0-canary.2 → 3.5.0-canary.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/data-table/data-table.js +1 -1
- package/cjs/data-table/data-table.js.map +1 -1
- package/cjs/data-table/data-table.styles.js +61 -52
- package/cjs/data-table/data-table.styles.js.map +1 -1
- package/cjs/external/dompurify/dist/purify.es.js +2 -2
- package/cjs/external/dompurify/dist/purify.es.js.map +1 -1
- package/cjs/file-upload/file-list-item/file-list-item.styles.js +4 -3
- package/cjs/file-upload/file-list-item/file-list-item.styles.js.map +1 -1
- package/cjs/form/form-textarea.style.js +1 -1
- package/cjs/form/form-textarea.style.js.map +1 -1
- package/cjs/input-textarea/textarea.style.js +1 -0
- package/cjs/input-textarea/textarea.style.js.map +1 -1
- package/cjs/predictive-text-input/predictive-text-input.js +1 -1
- package/cjs/predictive-text-input/predictive-text-input.js.map +1 -1
- package/cjs/shared/dropdown-wrapper/element-with-dropdown.js +1 -1
- package/cjs/shared/dropdown-wrapper/element-with-dropdown.js.map +1 -1
- package/cjs/table/table.styles.js +4 -6
- package/cjs/table/table.styles.js.map +1 -1
- package/cjs/util/use-throttle.js +2 -0
- package/cjs/util/use-throttle.js.map +1 -0
- package/codemods/data.ts +33 -1
- package/codemods/index.ts +140 -55
- package/data-table/data-table.js +1 -1
- package/data-table/data-table.js.map +1 -1
- package/data-table/data-table.styles.d.ts +11 -11
- package/data-table/data-table.styles.js +73 -64
- package/data-table/data-table.styles.js.map +1 -1
- package/external/dompurify/dist/purify.es.js +2 -2
- package/external/dompurify/dist/purify.es.js.map +1 -1
- package/file-upload/file-list-item/file-list-item.styles.js +1 -0
- package/file-upload/file-list-item/file-list-item.styles.js.map +1 -1
- package/form/form-textarea.style.js +1 -1
- package/form/form-textarea.style.js.map +1 -1
- package/input-textarea/textarea.style.js +19 -18
- package/input-textarea/textarea.style.js.map +1 -1
- package/package.json +1 -1
- package/predictive-text-input/predictive-text-input.js +1 -1
- package/predictive-text-input/predictive-text-input.js.map +1 -1
- package/shared/dropdown-wrapper/element-with-dropdown.d.ts +5 -4
- package/shared/dropdown-wrapper/element-with-dropdown.js +1 -1
- package/shared/dropdown-wrapper/element-with-dropdown.js.map +1 -1
- package/table/table.styles.js +10 -12
- package/table/table.styles.js.map +1 -1
- package/util/index.d.ts +1 -0
- package/util/use-throttle.d.ts +1 -0
- package/util/use-throttle.js +2 -0
- package/util/use-throttle.js.map +1 -0
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import e,{css as
|
|
2
|
-
overflow
|
|
1
|
+
import e,{css as t}from"styled-components";import{BasicButton as r}from"../shared/input-wrapper/input-wrapper.js";import{lineClampCss as o}from"../shared/styles/index.js";import{Colour as i,Border as d,Radius as s,Font as l,Motion as n,Spacing as a,Shadow as $}from"../theme/index.js";import{Typography as c}from"../typography/typography.js";const m=i.border,p=i.text,h=e.div`
|
|
2
|
+
/* we separate the overflow styles so that sticky elements can still work
|
|
3
|
+
with horizontal scrolling on supported browsers
|
|
4
|
+
see: https://github.com/w3c/csswg-drafts/issues/12289 */
|
|
5
|
+
overflow-y: ${e=>e.$scrollable?"auto":"clip"};
|
|
6
|
+
overflow-x: auto;
|
|
7
|
+
position: relative;
|
|
3
8
|
display: flex;
|
|
4
9
|
flex-direction: column;
|
|
5
|
-
border: ${d["width-010"]} ${d.solid} ${
|
|
6
|
-
border-radius: ${
|
|
10
|
+
border: ${d["width-010"]} ${d.solid} ${m};
|
|
11
|
+
border-radius: ${s.md};
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
/* Hide scrollbar */
|
|
14
|
+
scrollbar-width: none; /* Firefox */
|
|
15
|
+
-ms-overflow-style: none; /* IE 10+ */
|
|
9
16
|
&::-webkit-scrollbar {
|
|
10
|
-
display: none;
|
|
11
|
-
}
|
|
12
|
-
* {
|
|
13
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
14
|
-
scrollbar-width: none; /* Firefox */
|
|
17
|
+
display: none; /* Chrome/Safari/Webkit */
|
|
15
18
|
}
|
|
16
19
|
`,b=e.div`
|
|
17
20
|
flex: 1;
|
|
18
|
-
`,
|
|
21
|
+
`,g=e.table`
|
|
19
22
|
th:last-child,
|
|
20
23
|
td:last-child {
|
|
21
24
|
padding-right: 1.5rem;
|
|
@@ -28,32 +31,30 @@ import e,{css as r}from"styled-components";import{BasicButton as t}from"../share
|
|
|
28
31
|
border-collapse: separate;
|
|
29
32
|
border-spacing: 0;
|
|
30
33
|
width: 100%;
|
|
31
|
-
|
|
32
|
-
${e=>{if(e.$stickyHeader)return
|
|
33
|
-
thead {
|
|
34
|
-
position: sticky;
|
|
35
|
-
top: 0;
|
|
36
|
-
z-index: 20;
|
|
37
|
-
}
|
|
38
|
-
`}};
|
|
39
|
-
`,f=e.tbody`
|
|
40
|
-
tr:last-child {
|
|
41
|
-
td {
|
|
42
|
-
border-bottom: ${e=>e.$showLastRowBottomBorder?`${d["width-010"]} ${d.solid} ${c}`:"none"};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
`,x=e.div`
|
|
46
|
-
bottom: 0;
|
|
47
|
-
${e=>{if(e.$fixed){const t=e.$left?`${e.$left}px`:"0",o=e.$width?`${e.$width}px`:"100%";return r`
|
|
48
|
-
position: fixed;
|
|
49
|
-
left: ${t};
|
|
50
|
-
width: ${o};
|
|
51
|
-
`}return r`
|
|
34
|
+
`,f=e.thead`
|
|
35
|
+
${e=>{if(e.$stickyHeader)return t`
|
|
52
36
|
position: sticky;
|
|
53
|
-
|
|
37
|
+
top: 0;
|
|
38
|
+
z-index: 20;
|
|
54
39
|
`}};
|
|
55
|
-
`,u=e
|
|
56
|
-
${
|
|
40
|
+
`,w=e.tbody``,u=e.div`
|
|
41
|
+
${e=>{const r=e.$left?`${e.$left}px`:"0",o=e.$width?`${e.$width}px`:"100%";switch(e.$strategy){case"inline":return t`
|
|
42
|
+
position: absolute;
|
|
43
|
+
bottom: 0;
|
|
44
|
+
left: 0;
|
|
45
|
+
width: ${o};
|
|
46
|
+
`;case"fixed":return t`
|
|
47
|
+
position: fixed;
|
|
48
|
+
bottom: 0;
|
|
49
|
+
left: ${r};
|
|
50
|
+
width: ${o};
|
|
51
|
+
`;case"sticky":return t`
|
|
52
|
+
position: sticky;
|
|
53
|
+
bottom: 0;
|
|
54
|
+
width: ${o};
|
|
55
|
+
`}}}
|
|
56
|
+
`,x=e(r)`
|
|
57
|
+
${l["body-md-semibold"]}
|
|
57
58
|
cursor: pointer;
|
|
58
59
|
color: ${i["text-primary"]};
|
|
59
60
|
transition: ${n["duration-150"]} ${n["ease-default"]};
|
|
@@ -63,44 +64,46 @@ import e,{css as r}from"styled-components";import{BasicButton as t}from"../share
|
|
|
63
64
|
&:hover {
|
|
64
65
|
color: ${i["text-hover"]};
|
|
65
66
|
}
|
|
66
|
-
`,
|
|
67
|
+
`,y=e.div`
|
|
67
68
|
overflow: hidden;
|
|
68
69
|
display: flex;
|
|
69
70
|
align-items: center;
|
|
70
71
|
height: 3.5rem;
|
|
71
72
|
padding: ${a["spacing-16"]} ${a["spacing-24"]};
|
|
72
|
-
border-top: ${d["width-010"]} ${d.solid} ${
|
|
73
|
+
border-top: ${d["width-010"]} ${d.solid} ${m};
|
|
73
74
|
background-color: ${i["bg-selected"]};
|
|
74
|
-
transition:
|
|
75
|
-
${e=>e.$float?
|
|
75
|
+
transition: transform ${n["duration-350"]} ${n["ease-default"]};
|
|
76
|
+
${e=>e.$float?t`
|
|
76
77
|
transform: translateX(0.5rem) translateY(-2rem);
|
|
77
|
-
border-radius: ${
|
|
78
|
+
border-radius: ${s.sm};
|
|
78
79
|
box-shadow: ${$["xs-subtle"]};
|
|
79
80
|
width: calc(100% - ${a["spacing-16"]});
|
|
80
|
-
border: ${d["width-010"]} ${d.solid} ${
|
|
81
|
-
`:
|
|
82
|
-
border-radius: ${
|
|
83
|
-
${
|
|
81
|
+
border: ${d["width-010"]} ${d.solid} ${m};
|
|
82
|
+
`:t`
|
|
83
|
+
border-radius: ${s.none} ${s.none}
|
|
84
|
+
${s.sm} ${s.sm};
|
|
84
85
|
`}
|
|
85
|
-
`,
|
|
86
|
+
`,v=e.div`
|
|
87
|
+
height: 3.5rem;
|
|
88
|
+
`,k=e.tr`
|
|
86
89
|
background-color: ${i["bg-stronger"]};
|
|
87
90
|
height: 6rem;
|
|
88
|
-
border-bottom: ${d["width-010"]} ${d.solid} ${
|
|
89
|
-
`,
|
|
91
|
+
border-bottom: ${d["width-010"]} ${d.solid} ${m};
|
|
92
|
+
`,j=e.th`
|
|
90
93
|
padding: ${e=>e.$isCheckbox?"1.25rem 0.5rem 1.25rem 1.5rem":"1.25rem 1rem"};
|
|
91
94
|
text-align: left;
|
|
92
95
|
cursor: ${e=>e.$clickable?"pointer":"default"};
|
|
93
96
|
vertical-align: middle;
|
|
94
97
|
color: ${p};
|
|
95
|
-
border-bottom: ${d["width-010"]} ${d.solid} ${
|
|
96
|
-
${e=>{if(e.$isCheckbox)return
|
|
98
|
+
border-bottom: ${d["width-010"]} ${d.solid} ${m};
|
|
99
|
+
${e=>{if(e.$isCheckbox)return t`
|
|
97
100
|
width: 4rem;
|
|
98
101
|
`}};
|
|
99
102
|
&:focus-within {
|
|
100
103
|
outline: 2px solid ${i["focus-ring"]};
|
|
101
104
|
outline-offset: -3px;
|
|
102
105
|
}
|
|
103
|
-
`,
|
|
106
|
+
`,B=e.div`
|
|
104
107
|
display: flex;
|
|
105
108
|
flex-direction: row;
|
|
106
109
|
align-items: center;
|
|
@@ -109,41 +112,47 @@ import e,{css as r}from"styled-components";import{BasicButton as t}from"../share
|
|
|
109
112
|
color: ${p};
|
|
110
113
|
margin-left: 0.5rem;
|
|
111
114
|
}
|
|
112
|
-
`,
|
|
113
|
-
background-color: ${e=>e.$isSelected?
|
|
115
|
+
`,C=e.tr`
|
|
116
|
+
background-color: ${e=>e.$isSelected?t`
|
|
114
117
|
${i["bg-selected"]};
|
|
115
|
-
`:e.$alternating?
|
|
118
|
+
`:e.$alternating?t`
|
|
116
119
|
${i["bg-strong"]};
|
|
117
|
-
`:
|
|
120
|
+
`:t`
|
|
118
121
|
${i.bg};
|
|
119
122
|
`};
|
|
120
|
-
border-top: ${d["width-010"]} ${d.solid} ${
|
|
123
|
+
border-top: ${d["width-010"]} ${d.solid} ${m};
|
|
121
124
|
&:hover {
|
|
122
|
-
${e=>{if(e.$isSelectable)return
|
|
125
|
+
${e=>{if(e.$isSelectable)return t`
|
|
123
126
|
background-color: ${i["bg-hover-strong"]};
|
|
124
127
|
`}};
|
|
125
128
|
}
|
|
126
|
-
|
|
129
|
+
|
|
130
|
+
&:last-child {
|
|
131
|
+
td {
|
|
132
|
+
border-bottom: ${e=>e.$showLastRowBottomBorder?`${d["width-010"]} ${d.solid} ${m}`:"none"};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
`,S=e.td`
|
|
127
136
|
padding: ${e=>e.$isCheckbox?"1.25rem 0.5rem 1.25rem 1.5rem":"1.25rem 1rem"};
|
|
128
137
|
vertical-align: middle;
|
|
129
138
|
color: ${p};
|
|
130
|
-
border-bottom: ${d["width-010"]} ${d.solid} ${
|
|
131
|
-
`,
|
|
139
|
+
border-bottom: ${d["width-010"]} ${d.solid} ${m};
|
|
140
|
+
`,H=e(c.BodyBL)`
|
|
132
141
|
${o(2)}
|
|
133
142
|
text-overflow: ellipsis;
|
|
134
|
-
`,
|
|
143
|
+
`,z=e.div`
|
|
135
144
|
display: flex;
|
|
136
145
|
align-items: center;
|
|
137
146
|
justify-content: center;
|
|
138
|
-
`,
|
|
147
|
+
`,L=e.div`
|
|
139
148
|
display: flex;
|
|
140
149
|
flex-direction: column;
|
|
141
150
|
align-items: center;
|
|
142
151
|
padding: 4rem 0;
|
|
143
|
-
`,E=e(
|
|
152
|
+
`,E=e(c.HeadingSM)`
|
|
144
153
|
margin-top: 2rem;
|
|
145
154
|
margin-bottom: 1rem;
|
|
146
|
-
`,
|
|
155
|
+
`,F=e.td`
|
|
147
156
|
padding: 4rem 0;
|
|
148
|
-
`;export{
|
|
157
|
+
`;export{y as ActionBar,v as ActionBarSpacer,u as ActionBarWrapper,S as BodyCell,H as BodyCellContent,C as BodyRow,z as CheckBoxWrapper,F as EmptyViewCell,E as ErrorDisplayTitle,j as HeaderCell,B as HeaderCellWrapper,k as HeaderRow,L as LoaderWrapper,g as Table,w as TableBody,b as TableContainer,f as TableHead,h as TableWrapper,x as TextButton};
|
|
149
158
|
//# sourceMappingURL=data-table.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table.styles.js","sources":["../../src/data-table/data-table.styles.tsx"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { BasicButton } from \"../shared/input-wrapper\";\nimport { lineClampCss } from \"../shared/styles\";\nimport {\n Border,\n Colour,\n Font,\n Motion,\n Radius,\n Shadow,\n Spacing,\n} from \"../theme\";\nimport { Typography } from \"../typography\";\n\n// =============================================================================\n// STYLE INTERFACE, transient props are denoted with $\n// See more https://styled-components.com/docs/api#transient-props\n// =============================================================================\ninterface TableProps {\n $end: boolean;\n $scrollable: boolean;\n $stickyHeader: boolean | undefined;\n}\ninterface TableBodyProps {\n $showLastRowBottomBorder: boolean;\n}\ninterface HeaderCellProps {\n $clickable: boolean;\n $isCheckbox: boolean;\n}\ninterface BodyRowProps {\n $alternating: boolean;\n $isSelected?: boolean;\n $isSelectable?: boolean;\n}\n\ninterface BodyCellProps {\n $isCheckbox: boolean;\n}\n\ninterface ActionBarWrapperProps {\n $fixed: boolean;\n $left?: number | undefined;\n $width?: number | undefined;\n}\n\ninterface ActionBarProps {\n $float: boolean;\n $scrollable: boolean;\n}\n\n// =============================================================================\n// STYLES CONSTANTS\n// =============================================================================\nconst borderColor = Colour[\"border\"];\nconst fontColor = Colour[\"text\"];\n\n// =============================================================================\n// STYLES\n// =============================================================================\nexport const TableWrapper = styled.div`\n overflow: auto;\n display: flex;\n flex-direction: column;\n border: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n border-radius: ${Radius[\"md\"]};\n\n // Hide scrollbar\n &::-webkit-scrollbar {\n display: none;\n }\n * {\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n`;\n\nexport const TableContainer = styled.div`\n flex: 1;\n`;\n\nexport const Table = styled.table<TableProps>`\n th:last-child,\n td:last-child {\n padding-right: 1.5rem;\n }\n th:first-child,\n td:first-child {\n padding-left: 1.5rem;\n }\n text-align: left;\n border-collapse: separate;\n border-spacing: 0;\n width: 100%;\n\n ${(props) => {\n if (props.$stickyHeader) {\n return css`\n thead {\n position: sticky;\n top: 0;\n z-index: 20;\n }\n `;\n }\n }};\n`;\n\nexport const TableBody = styled.tbody<TableBodyProps>`\n tr:last-child {\n td {\n border-bottom: ${(props) =>\n props.$showLastRowBottomBorder\n ? `${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor}`\n : \"none\"};\n }\n }\n`;\n\nexport const ActionBarWrapper = styled.div<ActionBarWrapperProps>`\n bottom: 0;\n ${(props) => {\n if (props.$fixed) {\n const left = props.$left ? `${props.$left}px` : \"0\";\n const width = props.$width ? `${props.$width}px` : \"100%\";\n return css`\n position: fixed;\n left: ${left};\n width: ${width};\n `;\n } else {\n return css`\n position: sticky;\n left: 0;\n `;\n }\n }};\n`;\n\nexport const TextButton = styled(BasicButton)`\n ${Font[\"body-md-semibold\"]}\n cursor: pointer;\n color: ${Colour[\"text-primary\"]};\n transition: ${Motion[\"duration-150\"]} ${Motion[\"ease-default\"]};\n padding: 0.75rem;\n margin: -0.75rem 0;\n\n &:hover {\n color: ${Colour[\"text-hover\"]};\n }\n`;\n\nexport const ActionBar = styled.div<ActionBarProps>`\n overflow: hidden;\n display: flex;\n align-items: center;\n height: 3.5rem;\n padding: ${Spacing[\"spacing-16\"]} ${Spacing[\"spacing-24\"]};\n border-top: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n background-color: ${Colour[\"bg-selected\"]};\n transition: all 300ms ease;\n ${(props) => {\n if (props.$float) {\n return css`\n transform: translateX(0.5rem) translateY(-2rem);\n border-radius: ${Radius[\"sm\"]};\n box-shadow: ${Shadow[\"xs-subtle\"]};\n width: calc(100% - ${Spacing[\"spacing-16\"]});\n border: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n `;\n } else {\n return css`\n border-radius: ${Radius[\"none\"]} ${Radius[\"none\"]}\n ${Radius[\"sm\"]} ${Radius[\"sm\"]};\n `;\n }\n }}\n`;\n\nexport const HeaderRow = styled.tr`\n background-color: ${Colour[\"bg-stronger\"]};\n height: 6rem;\n border-bottom: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n`;\n\nexport const HeaderCell = styled.th<HeaderCellProps>`\n padding: ${(props) =>\n props.$isCheckbox ? \"1.25rem 0.5rem 1.25rem 1.5rem\" : \"1.25rem 1rem\"};\n text-align: left;\n cursor: ${(props) => (props.$clickable ? \"pointer\" : \"default\")};\n vertical-align: middle;\n color: ${fontColor};\n border-bottom: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n ${(props) => {\n if (props.$isCheckbox) {\n return css`\n width: 4rem;\n `;\n }\n }};\n &:focus-within {\n outline: 2px solid ${Colour[\"focus-ring\"]};\n outline-offset: -3px;\n }\n`;\n\nexport const HeaderCellWrapper = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n\n svg {\n color: ${fontColor};\n margin-left: 0.5rem;\n }\n`;\n\nexport const BodyRow = styled.tr<BodyRowProps>`\n background-color: ${(props) => {\n if (props.$isSelected) {\n return css`\n ${Colour[\"bg-selected\"]};\n `;\n } else if (props.$alternating) {\n return css`\n ${Colour[\"bg-strong\"]};\n `;\n } else {\n return css`\n ${Colour[\"bg\"]};\n `;\n }\n }};\n border-top: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n &:hover {\n ${(props) => {\n if (props.$isSelectable) {\n return css`\n background-color: ${Colour[\"bg-hover-strong\"]};\n `;\n }\n }};\n }\n`;\n\nexport const BodyCell = styled.td<BodyCellProps>`\n padding: ${(props) =>\n props.$isCheckbox ? \"1.25rem 0.5rem 1.25rem 1.5rem\" : \"1.25rem 1rem\"};\n vertical-align: middle;\n color: ${fontColor};\n border-bottom: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n`;\n\nexport const BodyCellContent = styled(Typography.BodyBL)`\n ${lineClampCss(2)}\n text-overflow: ellipsis;\n`;\n\nexport const CheckBoxWrapper = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nexport const LoaderWrapper = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 4rem 0;\n`;\n\nexport const ErrorDisplayTitle = styled(Typography.HeadingSM)`\n margin-top: 2rem;\n margin-bottom: 1rem;\n`;\n\nexport const EmptyViewCell = styled.td`\n padding: 4rem 0;\n`;\n"],"names":["borderColor","Colour","fontColor","TableWrapper","styled","div","Border","Radius","TableContainer","Table","table","props","$stickyHeader","css","TableBody","tbody","$showLastRowBottomBorder","ActionBarWrapper","$fixed","left","$left","width","$width","TextButton","BasicButton","Font","Motion","ActionBar","Spacing","$float","Shadow","HeaderRow","tr","HeaderCell","th","$isCheckbox","$clickable","HeaderCellWrapper","BodyRow","$isSelected","$alternating","$isSelectable","BodyCell","td","BodyCellContent","Typography","BodyBL","lineClampCss","CheckBoxWrapper","LoaderWrapper","ErrorDisplayTitle","HeadingSM","EmptyViewCell"],"mappings":"sVAsDA,MAAMA,EAAcC,EAAe,OAC7BC,EAAYD,EAAa,KAKlBE,EAAeC,EAAOC,GAAG;;;;cAIxBC,EAAO,gBAAgBA,EAAc,SAAKN;qBACnCO,EAAW;;;;;;;;;;EAYnBC,EAAiBJ,EAAOC,GAAG;;EAI3BI,EAAQL,EAAOM,KAAiB;;;;;;;;;;;;;;MActCC,IACC,GAAIA,EAAMC,cACN,OAAOC,CAAG;;;;;;aAOd;EAIKC,EAAYV,EAAOW,KAAqB;;;6BAGvBJ,GACdA,EAAMK,yBACA,GAAGV,EAAO,gBAAgBA,EAAc,SAAKN,IAC7C;;;EAKTiB,EAAmBb,EAAOC,GAA0B;;MAE1DM,IACC,GAAIA,EAAMO,OAAQ,CACd,MAAMC,EAAOR,EAAMS,MAAQ,GAAGT,EAAMS,UAAY,IAC1CC,EAAQV,EAAMW,OAAS,GAAGX,EAAMW,WAAa,OACnD,OAAOT,CAAG;;wBAEEM;yBACCE;aAEjB,CACI,OAAOR,CAAG;;;aAId;EAIKU,EAAanB,EAAOoB,EAAY;MACvCC,EAAK;;aAEExB,EAAO;kBACFyB,EAAO,mBAAmBA,EAAO;;;;;iBAKlCzB,EAAO;;EAIX0B,EAAYvB,EAAOC,GAAmB;;;;;eAKpCuB,EAAQ,iBAAiBA,EAAQ;kBAC9BtB,EAAO,gBAAgBA,EAAc,SAAKN;wBACpCC,EAAO;;MAExBU,GACKA,EAAMkB,OACChB,CAAG;;iCAEWN,EAAW;8BACduB,EAAO;qCACAF,EAAQ;0BACnBtB,EAAO,gBAAgBA,EAAc,SAAKN;cAGjDa,CAAG;iCACWN,EAAa,QAAKA,EAAa;sBAC1CA,EAAW,MAAKA,EAAW;;EAMpCwB,EAAY3B,EAAO4B,EAAE;wBACV/B,EAAO;;qBAEVK,EAAO,gBAAgBA,EAAc,SAAKN;EAGlDiC,EAAa7B,EAAO8B,EAAmB;eACpCvB,GACRA,EAAMwB,YAAc,gCAAkC;;cAE/CxB,GAAWA,EAAMyB,WAAa,UAAY;;aAE5ClC;qBACQI,EAAO,gBAAgBA,EAAc,SAAKN;MACxDW,IACC,GAAIA,EAAMwB,YACN,OAAOtB,CAAG;;aAGd;;6BAGqBZ,EAAO;;;EAKvBoC,EAAoBjC,EAAOC,GAAG;;;;;;iBAM1BH;;;EAKJoC,EAAUlC,EAAO4B,EAAgB;wBACrBrB,GACbA,EAAM4B,YACC1B,CAAG;kBACJZ,EAAO;cAENU,EAAM6B,aACN3B,CAAG;kBACJZ,EAAO;cAGNY,CAAG;kBACJZ,EAAW;;kBAIXK,EAAO,gBAAgBA,EAAc,SAAKN;;UAEjDW,IACC,GAAIA,EAAM8B,cACN,OAAO5B,CAAG;wCACcZ,EAAO;iBAEnC;;EAKCyC,EAAWtC,EAAOuC,EAAiB;eAChChC,GACRA,EAAMwB,YAAc,gCAAkC;;aAEjDjC;qBACQI,EAAO,gBAAgBA,EAAc,SAAKN;EAGlD4C,EAAkBxC,EAAOyC,EAAWC,OAAO;MAClDC,EAAa;;EAINC,EAAkB5C,EAAOC,GAAG;;;;EAM5B4C,EAAgB7C,EAAOC,GAAG;;;;;EAO1B6C,EAAoB9C,EAAOyC,EAAWM,UAAU;;;EAKhDC,EAAgBhD,EAAOuC,EAAE;;"}
|
|
1
|
+
{"version":3,"file":"data-table.styles.js","sources":["../../src/data-table/data-table.styles.tsx"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { BasicButton } from \"../shared/input-wrapper\";\nimport { lineClampCss } from \"../shared/styles\";\nimport {\n Border,\n Colour,\n Font,\n Motion,\n Radius,\n Shadow,\n Spacing,\n} from \"../theme\";\nimport { Typography } from \"../typography\";\n\n// =============================================================================\n// STYLE INTERFACE, transient props are denoted with $\n// See more https://styled-components.com/docs/api#transient-props\n// =============================================================================\ninterface TableWrapperProps {\n $scrollable: boolean;\n}\ninterface TableHeadProps {\n $stickyHeader: boolean | undefined;\n}\ninterface HeaderCellProps {\n $clickable: boolean;\n $isCheckbox: boolean;\n}\ninterface BodyRowProps {\n $alternating: boolean;\n $isSelected?: boolean;\n $isSelectable?: boolean;\n $showLastRowBottomBorder?: boolean;\n}\n\ninterface BodyCellProps {\n $isCheckbox: boolean;\n}\n\ninterface ActionBarWrapperProps {\n $strategy: \"fixed\" | \"sticky\" | \"inline\";\n $left?: number | undefined;\n $width?: number | undefined;\n}\n\ninterface ActionBarProps {\n $float: boolean;\n}\n\n// =============================================================================\n// STYLES CONSTANTS\n// =============================================================================\nconst borderColor = Colour[\"border\"];\nconst fontColor = Colour[\"text\"];\n\n// =============================================================================\n// STYLES\n// =============================================================================\nexport const TableWrapper = styled.div<TableWrapperProps>`\n /* we separate the overflow styles so that sticky elements can still work\n with horizontal scrolling on supported browsers\n see: https://github.com/w3c/csswg-drafts/issues/12289 */\n overflow-y: ${(props) => (props.$scrollable ? \"auto\" : \"clip\")};\n overflow-x: auto;\n position: relative;\n display: flex;\n flex-direction: column;\n border: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n border-radius: ${Radius[\"md\"]};\n\n /* Hide scrollbar */\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE 10+ */\n &::-webkit-scrollbar {\n display: none; /* Chrome/Safari/Webkit */\n }\n`;\n\nexport const TableContainer = styled.div`\n flex: 1;\n`;\n\nexport const Table = styled.table`\n th:last-child,\n td:last-child {\n padding-right: 1.5rem;\n }\n th:first-child,\n td:first-child {\n padding-left: 1.5rem;\n }\n text-align: left;\n border-collapse: separate;\n border-spacing: 0;\n width: 100%;\n`;\n\nexport const TableHead = styled.thead<TableHeadProps>`\n ${(props) => {\n if (props.$stickyHeader) {\n return css`\n position: sticky;\n top: 0;\n z-index: 20;\n `;\n }\n }};\n`;\n\nexport const TableBody = styled.tbody``;\n\nexport const ActionBarWrapper = styled.div<ActionBarWrapperProps>`\n ${(props) => {\n const left = props.$left ? `${props.$left}px` : \"0\";\n const width = props.$width ? `${props.$width}px` : \"100%\";\n\n switch (props.$strategy) {\n case \"inline\":\n return css`\n position: absolute;\n bottom: 0;\n left: 0;\n width: ${width};\n `;\n case \"fixed\":\n return css`\n position: fixed;\n bottom: 0;\n left: ${left};\n width: ${width};\n `;\n case \"sticky\":\n return css`\n position: sticky;\n bottom: 0;\n width: ${width};\n `;\n }\n }}\n`;\n\nexport const TextButton = styled(BasicButton)`\n ${Font[\"body-md-semibold\"]}\n cursor: pointer;\n color: ${Colour[\"text-primary\"]};\n transition: ${Motion[\"duration-150\"]} ${Motion[\"ease-default\"]};\n padding: 0.75rem;\n margin: -0.75rem 0;\n\n &:hover {\n color: ${Colour[\"text-hover\"]};\n }\n`;\n\nexport const ActionBar = styled.div<ActionBarProps>`\n overflow: hidden;\n display: flex;\n align-items: center;\n height: 3.5rem;\n padding: ${Spacing[\"spacing-16\"]} ${Spacing[\"spacing-24\"]};\n border-top: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n background-color: ${Colour[\"bg-selected\"]};\n transition: transform ${Motion[\"duration-350\"]} ${Motion[\"ease-default\"]};\n ${(props) => {\n if (props.$float) {\n return css`\n transform: translateX(0.5rem) translateY(-2rem);\n border-radius: ${Radius[\"sm\"]};\n box-shadow: ${Shadow[\"xs-subtle\"]};\n width: calc(100% - ${Spacing[\"spacing-16\"]});\n border: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n `;\n } else {\n return css`\n border-radius: ${Radius[\"none\"]} ${Radius[\"none\"]}\n ${Radius[\"sm\"]} ${Radius[\"sm\"]};\n `;\n }\n }}\n`;\n\nexport const ActionBarSpacer = styled.div`\n height: 3.5rem;\n`;\n\nexport const HeaderRow = styled.tr`\n background-color: ${Colour[\"bg-stronger\"]};\n height: 6rem;\n border-bottom: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n`;\n\nexport const HeaderCell = styled.th<HeaderCellProps>`\n padding: ${(props) =>\n props.$isCheckbox ? \"1.25rem 0.5rem 1.25rem 1.5rem\" : \"1.25rem 1rem\"};\n text-align: left;\n cursor: ${(props) => (props.$clickable ? \"pointer\" : \"default\")};\n vertical-align: middle;\n color: ${fontColor};\n border-bottom: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n ${(props) => {\n if (props.$isCheckbox) {\n return css`\n width: 4rem;\n `;\n }\n }};\n &:focus-within {\n outline: 2px solid ${Colour[\"focus-ring\"]};\n outline-offset: -3px;\n }\n`;\n\nexport const HeaderCellWrapper = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n\n svg {\n color: ${fontColor};\n margin-left: 0.5rem;\n }\n`;\n\nexport const BodyRow = styled.tr<BodyRowProps>`\n background-color: ${(props) => {\n if (props.$isSelected) {\n return css`\n ${Colour[\"bg-selected\"]};\n `;\n } else if (props.$alternating) {\n return css`\n ${Colour[\"bg-strong\"]};\n `;\n } else {\n return css`\n ${Colour[\"bg\"]};\n `;\n }\n }};\n border-top: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n &:hover {\n ${(props) => {\n if (props.$isSelectable) {\n return css`\n background-color: ${Colour[\"bg-hover-strong\"]};\n `;\n }\n }};\n }\n\n &:last-child {\n td {\n border-bottom: ${(props) =>\n props.$showLastRowBottomBorder\n ? `${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor}`\n : \"none\"};\n }\n }\n`;\n\nexport const BodyCell = styled.td<BodyCellProps>`\n padding: ${(props) =>\n props.$isCheckbox ? \"1.25rem 0.5rem 1.25rem 1.5rem\" : \"1.25rem 1rem\"};\n vertical-align: middle;\n color: ${fontColor};\n border-bottom: ${Border[\"width-010\"]} ${Border[\"solid\"]} ${borderColor};\n`;\n\nexport const BodyCellContent = styled(Typography.BodyBL)`\n ${lineClampCss(2)}\n text-overflow: ellipsis;\n`;\n\nexport const CheckBoxWrapper = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nexport const LoaderWrapper = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 4rem 0;\n`;\n\nexport const ErrorDisplayTitle = styled(Typography.HeadingSM)`\n margin-top: 2rem;\n margin-bottom: 1rem;\n`;\n\nexport const EmptyViewCell = styled.td`\n padding: 4rem 0;\n`;\n"],"names":["borderColor","Colour","fontColor","TableWrapper","styled","div","props","$scrollable","Border","Radius","TableContainer","Table","table","TableHead","thead","$stickyHeader","css","TableBody","tbody","ActionBarWrapper","left","$left","width","$width","$strategy","TextButton","BasicButton","Font","Motion","ActionBar","Spacing","$float","Shadow","ActionBarSpacer","HeaderRow","tr","HeaderCell","th","$isCheckbox","$clickable","HeaderCellWrapper","BodyRow","$isSelected","$alternating","$isSelectable","$showLastRowBottomBorder","BodyCell","td","BodyCellContent","Typography","BodyBL","lineClampCss","CheckBoxWrapper","LoaderWrapper","ErrorDisplayTitle","HeadingSM","EmptyViewCell"],"mappings":"sVAoDA,MAAMA,EAAcC,EAAe,OAC7BC,EAAYD,EAAa,KAKlBE,EAAeC,EAAOC,GAAsB;;;;kBAItCC,GAAWA,EAAMC,YAAc,OAAS;;;;;cAK7CC,EAAO,gBAAgBA,EAAc,SAAKR;qBACnCS,EAAW;;;;;;;;EAUnBC,EAAiBN,EAAOC,GAAG;;EAI3BM,EAAQP,EAAOQ,KAAK;;;;;;;;;;;;;EAepBC,EAAYT,EAAOU,KAAqB;MAC9CR,IACC,GAAIA,EAAMS,cACN,OAAOC,CAAG;;;;aAKd;EAIKC,EAAYb,EAAOc,KAAK,GAExBC,EAAmBf,EAAOC,GAA0B;MAC1DC,IACC,MAAMc,EAAOd,EAAMe,MAAQ,GAAGf,EAAMe,UAAY,IAC1CC,EAAQhB,EAAMiB,OAAS,GAAGjB,EAAMiB,WAAa,OAEnD,OAAQjB,EAAMkB,WACV,IAAK,SACD,OAAOR,CAAG;;;;6BAIGM;kBAEjB,IAAK,QACD,OAAON,CAAG;;;4BAGEI;6BACCE;kBAEjB,IAAK,SACD,OAAON,CAAG;;;6BAGGM;;EAMhBG,EAAarB,EAAOsB,EAAY;MACvCC,EAAK;;aAEE1B,EAAO;kBACF2B,EAAO,mBAAmBA,EAAO;;;;;iBAKlC3B,EAAO;;EAIX4B,EAAYzB,EAAOC,GAAmB;;;;;eAKpCyB,EAAQ,iBAAiBA,EAAQ;kBAC9BtB,EAAO,gBAAgBA,EAAc,SAAKR;wBACpCC,EAAO;4BACH2B,EAAO,mBAAmBA,EAAO;MACtDtB,GACKA,EAAMyB,OACCf,CAAG;;iCAEWP,EAAW;8BACduB,EAAO;qCACAF,EAAQ;0BACnBtB,EAAO,gBAAgBA,EAAc,SAAKR;cAGjDgB,CAAG;iCACWP,EAAa,QAAKA,EAAa;sBAC1CA,EAAW,MAAKA,EAAW;;EAMpCwB,EAAkB7B,EAAOC,GAAG;;EAI5B6B,EAAY9B,EAAO+B,EAAE;wBACVlC,EAAO;;qBAEVO,EAAO,gBAAgBA,EAAc,SAAKR;EAGlDoC,EAAahC,EAAOiC,EAAmB;eACpC/B,GACRA,EAAMgC,YAAc,gCAAkC;;cAE/ChC,GAAWA,EAAMiC,WAAa,UAAY;;aAE5CrC;qBACQM,EAAO,gBAAgBA,EAAc,SAAKR;MACxDM,IACC,GAAIA,EAAMgC,YACN,OAAOtB,CAAG;;aAGd;;6BAGqBf,EAAO;;;EAKvBuC,EAAoBpC,EAAOC,GAAG;;;;;;iBAM1BH;;;EAKJuC,EAAUrC,EAAO+B,EAAgB;wBACrB7B,GACbA,EAAMoC,YACC1B,CAAG;kBACJf,EAAO;cAENK,EAAMqC,aACN3B,CAAG;kBACJf,EAAO;cAGNe,CAAG;kBACJf,EAAW;;kBAIXO,EAAO,gBAAgBA,EAAc,SAAKR;;UAEjDM,IACC,GAAIA,EAAMsC,cACN,OAAO5B,CAAG;wCACcf,EAAO;iBAEnC;;;;;6BAMkBK,GACdA,EAAMuC,yBACA,GAAGrC,EAAO,gBAAgBA,EAAc,SAAKR,IAC7C;;;EAKT8C,EAAW1C,EAAO2C,EAAiB;eAChCzC,GACRA,EAAMgC,YAAc,gCAAkC;;aAEjDpC;qBACQM,EAAO,gBAAgBA,EAAc,SAAKR;EAGlDgD,EAAkB5C,EAAO6C,EAAWC,OAAO;MAClDC,EAAa;;EAINC,EAAkBhD,EAAOC,GAAG;;;;EAM5BgD,EAAgBjD,EAAOC,GAAG;;;;;EAO1BiD,EAAoBlD,EAAO6C,EAAWM,UAAU;;;EAKhDC,EAAgBpD,EAAO2C,EAAE;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! @license DOMPurify 3.4.
|
|
2
|
-
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function t(t,n){return function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(c=(o=i.call(n)).done)&&(l.push(o.value),l.length!==t);c=!0);}catch(e){s=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw r}}return l}}(t,n)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(t,n):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const n=Object.entries,o=Object.setPrototypeOf,r=Object.isFrozen,i=Object.getPrototypeOf,a=Object.getOwnPropertyDescriptor;let l=Object.freeze,c=Object.seal,s=Object.create,u="undefined"!=typeof Reflect&&Reflect,f=u.apply,m=u.construct;l||(l=function(e){return e}),c||(c=function(e){return e}),f||(f=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];return e.apply(t,o)}),m||(m=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return new e(...n)});const p=L(Array.prototype.forEach),d=L(Array.prototype.lastIndexOf),h=L(Array.prototype.pop),g=L(Array.prototype.push),y=L(Array.prototype.splice),T=Array.isArray,b=L(String.prototype.toLowerCase),S=L(String.prototype.toString),E=L(String.prototype.match),A=L(String.prototype.replace),N=L(String.prototype.indexOf),_=L(String.prototype.trim),w=L(Number.prototype.toString),O=L(Boolean.prototype.toString),v="undefined"==typeof BigInt?null:L(BigInt.prototype.toString),D="undefined"==typeof Symbol?null:L(Symbol.prototype.toString),R=L(Object.prototype.hasOwnProperty),C=L(Object.prototype.toString),I=L(RegExp.prototype.test),k=(x=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m(x,t)});var x;function L(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return f(e,t,o)}}function M(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:b;if(o&&o(e,null),!T(t))return e;let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(r(t)||(t[i]=e),o=e)}e[o]=!0}return e}function z(e){for(let t=0;t<e.length;t++){R(e,t)||(e[t]=null)}return e}function P(e){const o=s(null);for(const i of n(e)){var r=t(i,2);const n=r[0],a=r[1];R(e,n)&&(T(a)?o[n]=z(a):a&&"object"==typeof a&&a.constructor===Object?o[n]=P(a):o[n]=a)}return o}function U(e,t){for(;null!==e;){const n=a(e,t);if(n){if(n.get)return L(n.get);if("function"==typeof n.value)return L(n.value)}e=i(e)}return function(){return null}}const F=l(["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","search","section","select","shadow","slot","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=l(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),j=l(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),B=l(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),G=l(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),W=l(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Y=l(["#text"]),q=l(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),X=l(["accent-height","accumulate","additive","alignment-baseline","amplitude","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","exponent","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","intercept","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","mask-type","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","slope","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","tablevalues","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"]),$=l(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),K=l(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),V=c(/{{[\w\W]*|^[\w\W]*}}/g),Z=c(/<%[\w\W]*|^[\w\W]*%>/g),J=c(/\${[\w\W]*/g),Q=c(/^data-[\-\w.\u00B7-\uFFFF]+$/),ee=c(/^aria-[\-\w]+$/),te=c(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ne=c(/^(?:\w+script|data):/i),oe=c(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),re=c(/^html$/i),ie=c(/^[a-z][.\w]*(-[.\w]+)+$/i),ae=c(/<[/\w!]/g),le=c(/<[/\w]/g),ce=c(/<\/no(script|embed|frames)/i),se=c(/\/>/i),ue=1,fe=3,me=7,pe=8,de=9,he=11,ge=function(){return"undefined"==typeof window?null:window},ye=function(e,t,n,o){return R(e,t)&&T(e[t])?M(o.base?P(o.base):{},e[t],o.transform):n};var Te=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ge();const o=t=>e(t);if(o.version="3.4.11",o.removed=[],!t||!t.document||t.document.nodeType!==de||!t.Element)return o.isSupported=!1,o;let r=t.document;const i=r,a=i.currentScript;t.DocumentFragment;const u=t.HTMLTemplateElement,f=t.Node,m=t.Element,x=t.NodeFilter,L=t.NamedNodeMap;void 0===L&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const z=t.DOMParser,Te=t.trustedTypes,be=m.prototype,Se=U(be,"cloneNode"),Ee=U(be,"remove"),Ae=U(be,"nextSibling"),Ne=U(be,"childNodes"),_e=U(be,"parentNode"),we=U(be,"shadowRoot"),Oe=U(be,"attributes"),ve=f&&f.prototype?U(f.prototype,"nodeType"):null,De=f&&f.prototype?U(f.prototype,"nodeName"):null;if("function"==typeof u){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let Re,Ce,Ie="",ke=!1,xe=0;const Le=function(){if(xe>0)throw k('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Me=function(e){Le(),xe++;try{return Re.createHTML(e)}finally{xe--}},ze=function(){return ke||(Ce=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(Te,a),ke=!0),Ce},Pe=r,Ue=Pe.implementation,Fe=Pe.createNodeIterator,He=Pe.createDocumentFragment,je=Pe.getElementsByTagName,Be=i.importNode;let Ge={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};o.isSupported="function"==typeof n&&"function"==typeof _e&&Ue&&void 0!==Ue.createHTMLDocument;const We=V,Ye=Z,qe=J,Xe=Q,$e=ee,Ke=ne,Ve=oe,Ze=ie;let Je=te,Qe=null;const et=M({},[...F,...H,...j,...G,...Y]);let tt=null;const nt=M({},[...q,...X,...$,...K]);let ot=Object.seal(s(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}})),rt=null,it=null;const at=Object.seal(s(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let lt=!0,ct=!0,st=!1,ut=!0,ft=!1,mt=!0,pt=!1,dt=!1,ht=null,gt=null,yt=!1,Tt=!1,bt=!1,St=!1,Et=!0,At=!1;const Nt="user-content-";let _t=!0,wt=!1,Ot={},vt=null;const Dt=M({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Rt=null;const Ct=M({},["audio","video","img","source","image","track"]);let It=null;const kt=M({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),xt="http://www.w3.org/1998/Math/MathML",Lt="http://www.w3.org/2000/svg",Mt="http://www.w3.org/1999/xhtml";let zt=Mt,Pt=!1,Ut=null;const Ft=M({},[xt,Lt,Mt],S),Ht=l(["mi","mo","mn","ms","mtext"]);let jt=M({},Ht);const Bt=l(["annotation-xml"]);let Gt=M({},Bt);const Wt=M({},["title","style","font","a","script"]);let Yt=null;const qt=["application/xhtml+xml","text/html"];let Xt=null,$t=null;const Kt=r.createElement("form"),Vt=function(e){return e instanceof RegExp||e instanceof Function},Zt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if($t&&$t===e)return;e&&"object"==typeof e||(e={}),e=P(e),Yt=-1===qt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Xt="application/xhtml+xml"===Yt?S:b,Qe=ye(e,"ALLOWED_TAGS",et,{transform:Xt}),tt=ye(e,"ALLOWED_ATTR",nt,{transform:Xt}),Ut=ye(e,"ALLOWED_NAMESPACES",Ft,{transform:S}),It=ye(e,"ADD_URI_SAFE_ATTR",kt,{transform:Xt,base:kt}),Rt=ye(e,"ADD_DATA_URI_TAGS",Ct,{transform:Xt,base:Ct}),vt=ye(e,"FORBID_CONTENTS",Dt,{transform:Xt}),rt=ye(e,"FORBID_TAGS",P({}),{transform:Xt}),it=ye(e,"FORBID_ATTR",P({}),{transform:Xt}),Ot=!!R(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?P(e.USE_PROFILES):e.USE_PROFILES),lt=!1!==e.ALLOW_ARIA_ATTR,ct=!1!==e.ALLOW_DATA_ATTR,st=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ut=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,ft=e.SAFE_FOR_TEMPLATES||!1,mt=!1!==e.SAFE_FOR_XML,pt=e.WHOLE_DOCUMENT||!1,Tt=e.RETURN_DOM||!1,bt=e.RETURN_DOM_FRAGMENT||!1,St=e.RETURN_TRUSTED_TYPE||!1,yt=e.FORCE_BODY||!1,Et=!1!==e.SANITIZE_DOM,At=e.SANITIZE_NAMED_PROPS||!1,_t=!1!==e.KEEP_CONTENT,wt=e.IN_PLACE||!1,Je=function(e){try{return I(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:te,zt="string"==typeof e.NAMESPACE?e.NAMESPACE:Mt,jt=R(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?P(e.MATHML_TEXT_INTEGRATION_POINTS):M({},Ht),Gt=R(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?P(e.HTML_INTEGRATION_POINTS):M({},Bt);const t=R(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?P(e.CUSTOM_ELEMENT_HANDLING):s(null);if(ot=s(null),R(t,"tagNameCheck")&&Vt(t.tagNameCheck)&&(ot.tagNameCheck=t.tagNameCheck),R(t,"attributeNameCheck")&&Vt(t.attributeNameCheck)&&(ot.attributeNameCheck=t.attributeNameCheck),R(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(ot.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),c(ot),ft&&(ct=!1),bt&&(Tt=!0),Ot&&(Qe=M({},Y),tt=s(null),!0===Ot.html&&(M(Qe,F),M(tt,q)),!0===Ot.svg&&(M(Qe,H),M(tt,X),M(tt,K)),!0===Ot.svgFilters&&(M(Qe,j),M(tt,X),M(tt,K)),!0===Ot.mathMl&&(M(Qe,G),M(tt,$),M(tt,K))),at.tagCheck=null,at.attributeCheck=null,R(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?at.tagCheck=e.ADD_TAGS:T(e.ADD_TAGS)&&(Qe===et&&(Qe=P(Qe)),M(Qe,e.ADD_TAGS,Xt))),R(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?at.attributeCheck=e.ADD_ATTR:T(e.ADD_ATTR)&&(tt===nt&&(tt=P(tt)),M(tt,e.ADD_ATTR,Xt))),R(e,"ADD_URI_SAFE_ATTR")&&T(e.ADD_URI_SAFE_ATTR)&&M(It,e.ADD_URI_SAFE_ATTR,Xt),R(e,"FORBID_CONTENTS")&&T(e.FORBID_CONTENTS)&&(vt===Dt&&(vt=P(vt)),M(vt,e.FORBID_CONTENTS,Xt)),R(e,"ADD_FORBID_CONTENTS")&&T(e.ADD_FORBID_CONTENTS)&&(vt===Dt&&(vt=P(vt)),M(vt,e.ADD_FORBID_CONTENTS,Xt)),_t&&(Qe["#text"]=!0),pt&&M(Qe,["html","head","body"]),Qe.table&&(M(Qe,["tbody"]),delete rt.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw k('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw k('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=Re;Re=e.TRUSTED_TYPES_POLICY;try{Ie=Me("")}catch(e){throw Re=t,e}}else null===e.TRUSTED_TYPES_POLICY?(Re=void 0,Ie=""):(void 0===Re&&(Re=ze()),Re&&"string"==typeof Ie&&(Ie=Me("")));l&&l(e),$t=e},Jt=M({},[...H,...j,...B]),Qt=M({},[...G,...W]),en=function(e){let t=_e(e);t&&t.tagName||(t={namespaceURI:zt,tagName:"template"});const n=b(e.tagName),o=b(t.tagName);return!!Ut[e.namespaceURI]&&(e.namespaceURI===Lt?function(e,t,n){return t.namespaceURI===Mt?"svg"===e:t.namespaceURI===xt?"svg"===e&&("annotation-xml"===n||jt[n]):Boolean(Jt[e])}(n,t,o):e.namespaceURI===xt?function(e,t,n){return t.namespaceURI===Mt?"math"===e:t.namespaceURI===Lt?"math"===e&&Gt[n]:Boolean(Qt[e])}(n,t,o):e.namespaceURI===Mt?function(e,t,n){return!(t.namespaceURI===Lt&&!Gt[n])&&!(t.namespaceURI===xt&&!jt[n])&&!Qt[e]&&(Wt[e]||!Jt[e])}(n,t,o):!("application/xhtml+xml"!==Yt||!Ut[e.namespaceURI]))},tn=function(e){g(o.removed,{element:e});try{_e(e).removeChild(e)}catch(t){if(Ee(e),!_e(e))throw k("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},nn=function(e){const t=Ne(e);if(t){const e=[];p(t,(t=>{g(e,t)})),p(e,(e=>{try{Ee(e)}catch(e){}}))}const n=Oe(e);if(n)for(let t=n.length-1;t>=0;--t){const o=n[t],r=o&&o.name;if("string"==typeof r)try{e.removeAttribute(r)}catch(e){}}},on=function(e,t){try{g(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){g(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Tt||bt)try{tn(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},rn=function(e){const t=Oe(e);if(t)for(let n=t.length-1;n>=0;--n){const o=t[n],r=o&&o.name;if("string"==typeof r&&!tt[Xt(r)])try{e.removeAttribute(r)}catch(e){}}},an=function(e){let t=null,n=null;if(yt)e="<remove></remove>"+e;else{const t=E(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Yt&&zt===Mt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=Re?Me(e):e;if(zt===Mt)try{t=(new z).parseFromString(o,Yt)}catch(e){}if(!t||!t.documentElement){t=Ue.createDocument(zt,"template",null);try{t.documentElement.innerHTML=Pt?Ie:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),zt===Mt?je.call(t,pt?"html":"body")[0]:pt?t.documentElement:i},ln=function(e){return Fe.call(e.ownerDocument||e,e,x.SHOW_ELEMENT|x.SHOW_COMMENT|x.SHOW_TEXT|x.SHOW_PROCESSING_INSTRUCTION|x.SHOW_CDATA_SECTION,null)},cn=function(e){return e=A(e,We," "),e=A(e,Ye," "),e=A(e,qe," ")},sn=function(e){var t;e.normalize();const n=Fe.call(e.ownerDocument||e,e,x.SHOW_TEXT|x.SHOW_COMMENT|x.SHOW_CDATA_SECTION|x.SHOW_PROCESSING_INSTRUCTION,null);let o=n.nextNode();for(;o;)o.data=cn(o.data),o=n.nextNode();const r=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");r&&p(r,(e=>{fn(e.content)&&sn(e.content)}))},un=function(e){const t=De?De(e):null;return"string"==typeof t&&("form"===Xt(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==Oe(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==ve(e)||e.childNodes!==Ne(e)))},fn=function(e){if(!ve||"object"!=typeof e||null===e)return!1;try{return ve(e)===he}catch(e){return!1}},mn=function(e){if(!ve||"object"!=typeof e||null===e)return!1;try{return"number"==typeof ve(e)}catch(e){return!1}};function pn(e,t,n){0!==e.length&&p(e,(e=>{e.call(o,t,n,$t)}))}const dn=function(e){if(pn(Ge.beforeSanitizeElements,e,null),un(e))return tn(e),!0;const t=Xt(De?De(e):e.nodeName);if(pn(Ge.uponSanitizeElement,e,{tagName:t,allowedTags:Qe}),function(e,t){return!!(mt&&e.hasChildNodes()&&!mn(e.firstElementChild)&&I(ae,e.textContent)&&I(ae,e.innerHTML))||!(!mt||e.namespaceURI!==Mt||"style"!==t||!mn(e.firstElementChild))||e.nodeType===me||!(!mt||e.nodeType!==pe||!I(le,e.data))}(e,t))return tn(e),!0;if(rt[t]||!(at.tagCheck instanceof Function&&at.tagCheck(t))&&!Qe[t])return function(e,t){if(!rt[t]&&yn(t)){if(ot.tagNameCheck instanceof RegExp&&I(ot.tagNameCheck,t))return!1;if(ot.tagNameCheck instanceof Function&&ot.tagNameCheck(t))return!1}if(_t&&!vt[t]){const t=_e(e),n=Ne(e);if(n&&t)for(let o=n.length-1;o>=0;--o){const r=wt?n[o]:Se(n[o],!0);t.insertBefore(r,Ae(e))}}return tn(e),!0}(e,t);if((ve?ve(e):e.nodeType)===ue&&!en(e))return tn(e),!0;if(("noscript"===t||"noembed"===t||"noframes"===t)&&I(ce,e.innerHTML))return tn(e),!0;if(ft&&e.nodeType===fe){const t=cn(e.textContent);e.textContent!==t&&(g(o.removed,{element:e.cloneNode()}),e.textContent=t)}return pn(Ge.afterSanitizeElements,e,null),!1},hn=function(e,t,n){if(it[t])return!1;if(Et&&("id"===t||"name"===t)&&(n in r||n in Kt))return!1;const o=tt[t]||at.attributeCheck instanceof Function&&at.attributeCheck(t,e);if(ct&&I(Xe,t));else if(lt&&I($e,t));else if(o)if(It[t]);else if(I(Je,A(n,Ve,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==N(n,"data:")||!Rt[e]){if(st&&!I(Ke,A(n,Ve,"")));else if(n)return!1}else;else if(!(yn(e)&&(ot.tagNameCheck instanceof RegExp&&I(ot.tagNameCheck,e)||ot.tagNameCheck instanceof Function&&ot.tagNameCheck(e))&&(ot.attributeNameCheck instanceof RegExp&&I(ot.attributeNameCheck,t)||ot.attributeNameCheck instanceof Function&&ot.attributeNameCheck(t,e))||"is"===t&&ot.allowCustomizedBuiltInElements&&(ot.tagNameCheck instanceof RegExp&&I(ot.tagNameCheck,n)||ot.tagNameCheck instanceof Function&&ot.tagNameCheck(n))))return!1;return!0},gn=M({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),yn=function(e){return!gn[b(e)]&&I(Ze,e)},Tn=function(e,t,n,o){if(Re&&"object"==typeof Te&&"function"==typeof Te.getAttributeType&&!n)switch(Te.getAttributeType(e,t)){case"TrustedHTML":return Me(o);case"TrustedScriptURL":return function(e){Le(),xe++;try{return Re.createScriptURL(e)}finally{xe--}}(o)}return o},bn=function(e,t,n,r){try{n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),un(e)?tn(e):h(o.removed)}catch(n){on(t,e)}},Sn=function(e){pn(Ge.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||un(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:tt,forceKeepAttr:void 0};let o=t.length;const r=Xt(e.nodeName);for(;o--;){const i=t[o],a=i.name,l=i.namespaceURI,c=i.value,s=Xt(a),u=c;let f="value"===a?u:_(u);n.attrName=s,n.attrValue=f,n.keepAttr=!0,n.forceKeepAttr=void 0,pn(Ge.uponSanitizeAttribute,e,n),f=n.attrValue,!At||"id"!==s&&"name"!==s||0===N(f,Nt)||(on(a,e),f=Nt+f),mt&&I(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)?on(a,e):"attributename"===s&&E(f,"href")?on(a,e):n.forceKeepAttr||(n.keepAttr&&(ut||!I(se,f))?(ft&&(f=cn(f)),hn(r,s,f)?(f=Tn(r,s,l,f),f!==u&&bn(e,a,l,f)):on(a,e)):on(a,e))}pn(Ge.afterSanitizeAttributes,e,null)},En=function(e){let t=null;const n=ln(e);for(pn(Ge.beforeSanitizeShadowDOM,e,null);t=n.nextNode();){pn(Ge.uponSanitizeShadowNode,t,null),dn(t),Sn(t),fn(t.content)&&En(t.content);if((ve?ve(t):t.nodeType)===ue){const e=we(t);fn(e)&&(An(e),En(e))}}pn(Ge.afterSanitizeShadowDOM,e,null)},An=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){En(e.shadow);continue}const n=e.node,o=(ve?ve(n):n.nodeType)===ue,r=Ne(n);if(r)for(let e=r.length-1;e>=0;--e)t.push({node:r[e],shadow:null});if(o){const e=De?De(n):null;if("string"==typeof e&&"template"===Xt(e)){const e=n.content;fn(e)&&t.push({node:e,shadow:null})}}if(o){const e=we(n);fn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,a=null,l=null;if(Pt=!e,Pt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!mn(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return w(e);case"boolean":return O(e);case"bigint":return v?v(e):"0";case"symbol":return D?D(e):"Symbol()";case"undefined":default:return C(e);case"function":case"object":{if(null===e)return C(e);const t=e,n=U(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:C(e)}return C(e)}}}(e)))throw k("dirty is not a string, aborting");if(!o.isSupported)return e;dt?(Qe=ht,tt=gt):Zt(t),(Ge.uponSanitizeElement.length>0||Ge.uponSanitizeAttribute.length>0)&&(Qe=P(Qe)),Ge.uponSanitizeAttribute.length>0&&(tt=P(tt)),o.removed=[];const c=wt&&"string"!=typeof e&&mn(e);if(c){const t=De?De(e):e.nodeName;if("string"==typeof t){const e=Xt(t);if(!Qe[e]||rt[e])throw k("root node is forbidden and cannot be sanitized in-place")}if(un(e))throw k("root node is clobbered and cannot be sanitized in-place");try{An(e)}catch(t){throw nn(e),t}}else if(mn(e))n=an("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),r.nodeType===ue&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r),An(r);else{if(!Tt&&!ft&&!pt&&-1===e.indexOf("<"))return Re&&St?Me(e):e;if(n=an(e),!n)return Tt?null:St?Ie:""}n&&yt&&tn(n.firstChild);const s=ln(c?e:n);try{for(;a=s.nextNode();)dn(a),Sn(a),fn(a.content)&&En(a.content)}catch(t){throw c&&nn(e),t}if(c)return p(o.removed,(e=>{e.element&&function(e){const t=[e];for(;t.length>0;){const e=t.pop();(ve?ve(e):e.nodeType)===ue&&rn(e);const n=Ne(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}}(e.element)})),ft&&sn(e),e;if(Tt){if(ft&&sn(n),bt)for(l=He.call(n.ownerDocument);n.firstChild;)l.appendChild(n.firstChild);else l=n;return(tt.shadowroot||tt.shadowrootmode)&&(l=Be.call(i,l,!0)),l}let u=pt?n.outerHTML:n.innerHTML;return pt&&Qe["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&I(re,n.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+u),ft&&(u=cn(u)),Re&&St?Me(u):u},o.setConfig=function(){Zt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),dt=!0,ht=Qe,gt=tt},o.clearConfig=function(){$t=null,dt=!1,ht=null,gt=null,Re=Ce,Ie=""},o.isValidAttribute=function(e,t,n){$t||Zt({});const o=Xt(e),r=Xt(t);return hn(o,r,n)},o.addHook=function(e,t){"function"==typeof t&&R(Ge,e)&&g(Ge[e],t)},o.removeHook=function(e,t){if(R(Ge,e)){if(void 0!==t){const n=d(Ge[e],t);return-1===n?void 0:y(Ge[e],n,1)[0]}return h(Ge[e])}},o.removeHooks=function(e){R(Ge,e)&&(Ge[e]=[])},o.removeAllHooks=function(){Ge={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},o}();export{Te as default};
|
|
1
|
+
/*! @license DOMPurify 3.4.12 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.12/LICENSE */
|
|
2
|
+
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function t(t,n){return function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(c=(o=i.call(n)).done)&&(l.push(o.value),l.length!==t);c=!0);}catch(e){s=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw r}}return l}}(t,n)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(t,n):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const n=Object.entries,o=Object.setPrototypeOf,r=Object.isFrozen,i=Object.getPrototypeOf,a=Object.getOwnPropertyDescriptor;let l=Object.freeze,c=Object.seal,s=Object.create,u="undefined"!=typeof Reflect&&Reflect,f=u.apply,p=u.construct;l||(l=function(e){return e}),c||(c=function(e){return e}),f||(f=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];return e.apply(t,o)}),p||(p=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return new e(...n)});const m=L(Array.prototype.forEach),d=L(Array.prototype.lastIndexOf),h=L(Array.prototype.pop),g=L(Array.prototype.push),y=L(Array.prototype.splice),b=Array.isArray,T=L(String.prototype.toLowerCase),S=L(String.prototype.toString),E=L(String.prototype.match),A=L(String.prototype.replace),N=L(String.prototype.indexOf),_=L(String.prototype.trim),w=L(Number.prototype.toString),O=L(Boolean.prototype.toString),v="undefined"==typeof BigInt?null:L(BigInt.prototype.toString),D="undefined"==typeof Symbol?null:L(Symbol.prototype.toString),R=L(Object.prototype.hasOwnProperty),C=L(Object.prototype.toString),I=L(RegExp.prototype.test),k=(x=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p(x,t)});var x;function L(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return f(e,t,o)}}function M(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:T;if(o&&o(e,null),!b(t))return e;let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(r(t)||(t[i]=e),o=e)}e[o]=!0}return e}function z(e){for(let t=0;t<e.length;t++){R(e,t)||(e[t]=null)}return e}function P(e){const o=s(null);for(const i of n(e)){var r=t(i,2);const n=r[0],a=r[1];R(e,n)&&(b(a)?o[n]=z(a):a&&"object"==typeof a&&a.constructor===Object?o[n]=P(a):o[n]=a)}return o}function U(e,t){for(;null!==e;){const n=a(e,t);if(n){if(n.get)return L(n.get);if("function"==typeof n.value)return L(n.value)}e=i(e)}return function(){return null}}const F=l(["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","search","section","select","shadow","slot","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=l(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),j=l(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),B=l(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),G=l(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),W=l(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Y=l(["#text"]),q=l(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),X=l(["accent-height","accumulate","additive","alignment-baseline","amplitude","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","dominant-baseline","dur","edgemode","elevation","end","exponent","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","intercept","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","mask-type","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","slope","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","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","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"]),$=l(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),K=l(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),V=c(/{{[\w\W]*|^[\w\W]*}}/g),Z=c(/<%[\w\W]*|^[\w\W]*%>/g),J=c(/\${[\w\W]*/g),Q=c(/^data-[\-\w.\u00B7-\uFFFF]+$/),ee=c(/^aria-[\-\w]+$/),te=c(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ne=c(/^(?:\w+script|data):/i),oe=c(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),re=c(/^html$/i),ie=c(/^[a-z][.\w]*(-[.\w]+)+$/i),ae=c(/<[/\w!]/g),le=c(/<[/\w]/g),ce=c(/<\/no(script|embed|frames)/i),se=c(/\/>/i),ue=1,fe=3,pe=7,me=8,de=9,he=11,ge=function(){return"undefined"==typeof window?null:window},ye=function(e,t,n,o){return R(e,t)&&b(e[t])?M(o.base?P(o.base):{},e[t],o.transform):n};var be=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ge();const o=t=>e(t);if(o.version="3.4.12",o.removed=[],!t||!t.document||t.document.nodeType!==de||!t.Element)return o.isSupported=!1,o;let r=t.document;const i=r,a=i.currentScript;t.DocumentFragment;const u=t.HTMLTemplateElement,f=t.Node,p=t.Element,x=t.NodeFilter,L=t.NamedNodeMap;void 0===L&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const z=t.DOMParser,be=t.trustedTypes,Te=p.prototype,Se=U(Te,"cloneNode"),Ee=U(Te,"remove"),Ae=U(Te,"nextSibling"),Ne=U(Te,"childNodes"),_e=U(Te,"parentNode"),we=U(Te,"shadowRoot"),Oe=U(Te,"attributes"),ve=f&&f.prototype?U(f.prototype,"nodeType"):null,De=f&&f.prototype?U(f.prototype,"nodeName"):null;if("function"==typeof u){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let Re,Ce,Ie="",ke=!1,xe=0;const Le=function(){if(xe>0)throw k('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Me=function(e){Le(),xe++;try{return Re.createHTML(e)}finally{xe--}},ze=function(){return ke||(Ce=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(be,a),ke=!0),Ce},Pe=r,Ue=Pe.implementation,Fe=Pe.createNodeIterator,He=Pe.createDocumentFragment,je=Pe.getElementsByTagName,Be=i.importNode;let Ge={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};o.isSupported="function"==typeof n&&"function"==typeof _e&&Ue&&void 0!==Ue.createHTMLDocument;const We=V,Ye=Z,qe=J,Xe=Q,$e=ee,Ke=ne,Ve=oe,Ze=ie;let Je=te,Qe=null;const et=M({},[...F,...H,...j,...G,...Y]);let tt=null;const nt=M({},[...q,...X,...$,...K]);let ot=Object.seal(s(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}})),rt=null,it=null;const at=Object.seal(s(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let lt=!0,ct=!0,st=!1,ut=!0,ft=!1,pt=!0,mt=!1,dt=!1,ht=null,gt=null,yt=!1,bt=!1,Tt=!1,St=!1,Et=!0,At=!1;const Nt="user-content-";let _t=!0,wt=!1,Ot={},vt=null;const Dt=M({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Rt=null;const Ct=M({},["audio","video","img","source","image","track"]);let It=null;const kt=M({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),xt="http://www.w3.org/1998/Math/MathML",Lt="http://www.w3.org/2000/svg",Mt="http://www.w3.org/1999/xhtml";let zt=Mt,Pt=!1,Ut=null;const Ft=M({},[xt,Lt,Mt],S),Ht=l(["mi","mo","mn","ms","mtext"]);let jt=M({},Ht);const Bt=l(["annotation-xml"]);let Gt=M({},Bt);const Wt=M({},["title","style","font","a","script"]);let Yt=null;const qt=["application/xhtml+xml","text/html"];let Xt=null,$t=null;const Kt=r.createElement("form"),Vt=function(e){return e instanceof RegExp||e instanceof Function},Zt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if($t&&$t===e)return;e&&"object"==typeof e||(e={}),e=P(e),Yt=-1===qt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Xt="application/xhtml+xml"===Yt?S:T,Qe=ye(e,"ALLOWED_TAGS",et,{transform:Xt}),tt=ye(e,"ALLOWED_ATTR",nt,{transform:Xt}),Ut=ye(e,"ALLOWED_NAMESPACES",Ft,{transform:S}),It=ye(e,"ADD_URI_SAFE_ATTR",kt,{transform:Xt,base:kt}),Rt=ye(e,"ADD_DATA_URI_TAGS",Ct,{transform:Xt,base:Ct}),vt=ye(e,"FORBID_CONTENTS",Dt,{transform:Xt}),rt=ye(e,"FORBID_TAGS",P({}),{transform:Xt}),it=ye(e,"FORBID_ATTR",P({}),{transform:Xt}),Ot=!!R(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?P(e.USE_PROFILES):e.USE_PROFILES),lt=!1!==e.ALLOW_ARIA_ATTR,ct=!1!==e.ALLOW_DATA_ATTR,st=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ut=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,ft=e.SAFE_FOR_TEMPLATES||!1,pt=!1!==e.SAFE_FOR_XML,mt=e.WHOLE_DOCUMENT||!1,bt=e.RETURN_DOM||!1,Tt=e.RETURN_DOM_FRAGMENT||!1,St=e.RETURN_TRUSTED_TYPE||!1,yt=e.FORCE_BODY||!1,Et=!1!==e.SANITIZE_DOM,At=e.SANITIZE_NAMED_PROPS||!1,_t=!1!==e.KEEP_CONTENT,wt=e.IN_PLACE||!1,Je=function(e){try{return I(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:te,zt="string"==typeof e.NAMESPACE?e.NAMESPACE:Mt,jt=R(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?P(e.MATHML_TEXT_INTEGRATION_POINTS):M({},Ht),Gt=R(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?P(e.HTML_INTEGRATION_POINTS):M({},Bt);const t=R(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?P(e.CUSTOM_ELEMENT_HANDLING):s(null);if(ot=s(null),R(t,"tagNameCheck")&&Vt(t.tagNameCheck)&&(ot.tagNameCheck=t.tagNameCheck),R(t,"attributeNameCheck")&&Vt(t.attributeNameCheck)&&(ot.attributeNameCheck=t.attributeNameCheck),R(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(ot.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),c(ot),ft&&(ct=!1),Tt&&(bt=!0),Ot&&(Qe=M({},Y),tt=s(null),!0===Ot.html&&(M(Qe,F),M(tt,q)),!0===Ot.svg&&(M(Qe,H),M(tt,X),M(tt,K)),!0===Ot.svgFilters&&(M(Qe,j),M(tt,X),M(tt,K)),!0===Ot.mathMl&&(M(Qe,G),M(tt,$),M(tt,K))),at.tagCheck=null,at.attributeCheck=null,R(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?at.tagCheck=e.ADD_TAGS:b(e.ADD_TAGS)&&(Qe===et&&(Qe=P(Qe)),M(Qe,e.ADD_TAGS,Xt))),R(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?at.attributeCheck=e.ADD_ATTR:b(e.ADD_ATTR)&&(tt===nt&&(tt=P(tt)),M(tt,e.ADD_ATTR,Xt))),R(e,"ADD_URI_SAFE_ATTR")&&b(e.ADD_URI_SAFE_ATTR)&&M(It,e.ADD_URI_SAFE_ATTR,Xt),R(e,"FORBID_CONTENTS")&&b(e.FORBID_CONTENTS)&&(vt===Dt&&(vt=P(vt)),M(vt,e.FORBID_CONTENTS,Xt)),R(e,"ADD_FORBID_CONTENTS")&&b(e.ADD_FORBID_CONTENTS)&&(vt===Dt&&(vt=P(vt)),M(vt,e.ADD_FORBID_CONTENTS,Xt)),_t&&(Qe["#text"]=!0),mt&&M(Qe,["html","head","body"]),Qe.table&&(M(Qe,["tbody"]),delete rt.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw k('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw k('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=Re;Re=e.TRUSTED_TYPES_POLICY;try{Ie=Me("")}catch(e){throw Re=t,e}}else null===e.TRUSTED_TYPES_POLICY?(Re=void 0,Ie=""):(void 0===Re&&(Re=ze()),Re&&"string"==typeof Ie&&(Ie=Me("")));l&&l(e),$t=e},Jt=M({},[...H,...j,...B]),Qt=M({},[...G,...W]),en=function(e){let t=_e(e);t&&t.tagName||(t={namespaceURI:zt,tagName:"template"});const n=T(e.tagName),o=T(t.tagName);return!!Ut[e.namespaceURI]&&(e.namespaceURI===Lt?function(e,t,n){return t.namespaceURI===Mt?"svg"===e:t.namespaceURI===xt?"svg"===e&&("annotation-xml"===n||jt[n]):Boolean(Jt[e])}(n,t,o):e.namespaceURI===xt?function(e,t,n){return t.namespaceURI===Mt?"math"===e:t.namespaceURI===Lt?"math"===e&&Gt[n]:Boolean(Qt[e])}(n,t,o):e.namespaceURI===Mt?function(e,t,n){return!(t.namespaceURI===Lt&&!Gt[n])&&!(t.namespaceURI===xt&&!jt[n])&&!Qt[e]&&(Wt[e]||!Jt[e])}(n,t,o):!("application/xhtml+xml"!==Yt||!Ut[e.namespaceURI]))},tn=function(e){g(o.removed,{element:e});try{_e(e).removeChild(e)}catch(t){if(Ee(e),!_e(e))throw k("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},nn=function(e){an(e);const t=Ne(e);if(t){const e=[];m(t,(t=>{g(e,t)})),m(e,(e=>{try{Ee(e)}catch(e){}}))}const n=Oe(e);if(n)for(let t=n.length-1;t>=0;--t){const o=n[t],r=o&&o.name;if("string"==typeof r)try{e.removeAttribute(r)}catch(e){}}},on=function(e,t){try{g(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){g(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(bt||Tt)try{tn(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},rn=function(e){const t=Oe(e);if(t)for(let n=t.length-1;n>=0;--n){const o=t[n],r=o&&o.name;if("string"==typeof r&&!tt[Xt(r)])try{e.removeAttribute(r)}catch(e){}}},an=function(e){const t=[e];for(;t.length>0;){const e=t.pop();(ve?ve(e):e.nodeType)===ue&&rn(e);const n=Ne(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ln=function(e){let t=null,n=null;if(yt)e="<remove></remove>"+e;else{const t=E(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===Yt&&zt===Mt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=Re?Me(e):e;if(zt===Mt)try{t=(new z).parseFromString(o,Yt)}catch(e){}if(!t||!t.documentElement){t=Ue.createDocument(zt,"template",null);try{t.documentElement.innerHTML=Pt?Ie:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),zt===Mt?je.call(t,mt?"html":"body")[0]:mt?t.documentElement:i},cn=function(e){return Fe.call(e.ownerDocument||e,e,x.SHOW_ELEMENT|x.SHOW_COMMENT|x.SHOW_TEXT|x.SHOW_PROCESSING_INSTRUCTION|x.SHOW_CDATA_SECTION,null)},sn=function(e){return e=A(e,We," "),e=A(e,Ye," "),e=A(e,qe," ")},un=function(e){var t;e.normalize();const n=Fe.call(e.ownerDocument||e,e,x.SHOW_TEXT|x.SHOW_COMMENT|x.SHOW_CDATA_SECTION|x.SHOW_PROCESSING_INSTRUCTION,null);let o=n.nextNode();for(;o;)o.data=sn(o.data),o=n.nextNode();const r=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");r&&m(r,(e=>{pn(e.content)&&un(e.content)}))},fn=function(e){const t=De?De(e):null;return"string"==typeof t&&("form"===Xt(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==Oe(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==ve(e)||e.childNodes!==Ne(e)))},pn=function(e){if(!ve||"object"!=typeof e||null===e)return!1;try{return ve(e)===he}catch(e){return!1}},mn=function(e){if(!ve||"object"!=typeof e||null===e)return!1;try{return"number"==typeof ve(e)}catch(e){return!1}};function dn(e,t,n){0!==e.length&&m(e,(e=>{e.call(o,t,n,$t)}))}const hn=function(e,t){if(dn(Ge.beforeSanitizeElements,e,null),e!==t&&null===_e(e))return!0;if(fn(e))return tn(e),!0;const n=Xt(De?De(e):e.nodeName);if(dn(Ge.uponSanitizeElement,e,{tagName:n,allowedTags:Qe}),e!==t&&null===_e(e))return!0;if(function(e,t){return!!(pt&&e.hasChildNodes()&&!mn(e.firstElementChild)&&I(ae,e.textContent)&&I(ae,e.innerHTML))||!(!pt||e.namespaceURI!==Mt||"style"!==t||!mn(e.firstElementChild))||e.nodeType===pe||!(!pt||e.nodeType!==me||!I(le,e.data))}(e,n))return tn(e),!0;if(rt[n]||!(at.tagCheck instanceof Function&&at.tagCheck(n))&&!Qe[n]){const t=function(e,t){if(!rt[t]&&bn(t)){if(ot.tagNameCheck instanceof RegExp&&I(ot.tagNameCheck,t))return!1;if(ot.tagNameCheck instanceof Function&&ot.tagNameCheck(t))return!1}if(_t&&!vt[t]){const t=_e(e),n=Ne(e);if(n&&t)for(let o=n.length-1;o>=0;--o){const r=wt?n[o]:Se(n[o],!0);t.insertBefore(r,Ae(e))}}return tn(e),!0}(e,n);return!1===t&&dn(Ge.afterSanitizeElements,e,null),t}if((ve?ve(e):e.nodeType)===ue&&!en(e))return tn(e),!0;if(("noscript"===n||"noembed"===n||"noframes"===n)&&I(ce,e.innerHTML))return tn(e),!0;if(ft&&e.nodeType===fe){const t=sn(e.textContent);e.textContent!==t&&(g(o.removed,{element:e.cloneNode()}),e.textContent=t)}return dn(Ge.afterSanitizeElements,e,null),!1},gn=function(e,t,n){if(it[t])return!1;if(pt&&"patchsrc"===t)return!1;if(pt&&"for"===t&&"label"!==e&&"output"!==e)return!1;if(Et&&("id"===t||"name"===t)&&(n in r||n in Kt))return!1;const o=tt[t]||at.attributeCheck instanceof Function&&at.attributeCheck(t,e);if(ct&&I(Xe,t));else if(lt&&I($e,t));else if(o)if(It[t]);else if(I(Je,A(n,Ve,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==N(n,"data:")||!Rt[e]){if(st&&!I(Ke,A(n,Ve,"")));else if(n)return!1}else;else if(!(bn(e)&&(ot.tagNameCheck instanceof RegExp&&I(ot.tagNameCheck,e)||ot.tagNameCheck instanceof Function&&ot.tagNameCheck(e))&&(ot.attributeNameCheck instanceof RegExp&&I(ot.attributeNameCheck,t)||ot.attributeNameCheck instanceof Function&&ot.attributeNameCheck(t,e))||"is"===t&&ot.allowCustomizedBuiltInElements&&(ot.tagNameCheck instanceof RegExp&&I(ot.tagNameCheck,n)||ot.tagNameCheck instanceof Function&&ot.tagNameCheck(n))))return!1;return!0},yn=M({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),bn=function(e){return!yn[T(e)]&&I(Ze,e)},Tn=function(e,t,n,o){if(Re&&"object"==typeof be&&"function"==typeof be.getAttributeType&&!n)switch(be.getAttributeType(e,t)){case"TrustedHTML":return Me(o);case"TrustedScriptURL":return function(e){Le(),xe++;try{return Re.createScriptURL(e)}finally{xe--}}(o)}return o},Sn=function(e,t,n,r){try{n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),fn(e)?tn(e):h(o.removed)}catch(n){on(t,e)}},En=function(e){dn(Ge.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||fn(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:tt,forceKeepAttr:void 0};let o=t.length;const r=Xt(e.nodeName);for(;o--;){const i=t[o],a=i.name,l=i.namespaceURI,c=i.value,s=Xt(a),u=c;let f="value"===a?u:_(u);n.attrName=s,n.attrValue=f,n.keepAttr=!0,n.forceKeepAttr=void 0,dn(Ge.uponSanitizeAttribute,e,n),f=n.attrValue,!At||"id"!==s&&"name"!==s||0===N(f,Nt)||(on(a,e),f=Nt+f),pt&&I(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)?on(a,e):"attributename"===s&&E(f,"href")?on(a,e):n.forceKeepAttr||(n.keepAttr&&(ut||!I(se,f))?(ft&&(f=sn(f)),gn(r,s,f)?(f=Tn(r,s,l,f),f!==u&&Sn(e,a,l,f)):on(a,e)):on(a,e))}dn(Ge.afterSanitizeAttributes,e,null)},An=function(e){let t=null;const n=cn(e);for(dn(Ge.beforeSanitizeShadowDOM,e,null);t=n.nextNode();){dn(Ge.uponSanitizeShadowNode,t,null),hn(t,e),En(t),pn(t.content)&&An(t.content);if((ve?ve(t):t.nodeType)===ue){const e=we(t);pn(e)&&(Nn(e),An(e))}}dn(Ge.afterSanitizeShadowDOM,e,null)},Nn=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){An(e.shadow);continue}const n=e.node,o=(ve?ve(n):n.nodeType)===ue,r=Ne(n);if(r)for(let e=r.length-1;e>=0;--e)t.push({node:r[e],shadow:null});if(o){const e=De?De(n):null;if("string"==typeof e&&"template"===Xt(e)){const e=n.content;pn(e)&&t.push({node:e,shadow:null})}}if(o){const e=we(n);pn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,a=null,l=null;if(Pt=!e,Pt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!mn(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return w(e);case"boolean":return O(e);case"bigint":return v?v(e):"0";case"symbol":return D?D(e):"Symbol()";case"undefined":default:return C(e);case"function":case"object":{if(null===e)return C(e);const t=e,n=U(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:C(e)}return C(e)}}}(e)))throw k("dirty is not a string, aborting");if(!o.isSupported)return e;dt?(Qe=ht,tt=gt):Zt(t),(Ge.uponSanitizeElement.length>0||Ge.uponSanitizeAttribute.length>0)&&(Qe=P(Qe)),Ge.uponSanitizeAttribute.length>0&&(tt=P(tt)),o.removed=[];const c=wt&&"string"!=typeof e&&mn(e);if(c){!function(e){if(!pt)return;const t=[e];for(;t.length>0;){const e=t.pop(),n=ve?ve(e):e.nodeType;if(n===pe||n===me&&I(le,e.data)){try{Ee(e)}catch(e){}continue}if(n===ue){const t=e,n=Xt(De?De(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&"label"!==n&&"output"!==n&&t.removeAttribute("for")}catch(e){}}const o=Ne(e);if(o)for(let e=o.length-1;e>=0;--e)t.push(o[e])}}(e);const t=De?De(e):e.nodeName;if("string"==typeof t){const n=Xt(t);if(!Qe[n]||rt[n])throw nn(e),k("root node is forbidden and cannot be sanitized in-place")}if(fn(e))throw nn(e),k("root node is clobbered and cannot be sanitized in-place");try{Nn(e)}catch(t){throw nn(e),t}}else if(mn(e))n=ln("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),r.nodeType===ue&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r),Nn(r);else{if(!bt&&!ft&&!mt&&-1===e.indexOf("<"))return Re&&St?Me(e):e;if(n=ln(e),!n)return bt?null:St?Ie:""}n&&yt&&tn(n.firstChild);const s=c?e:n,u=cn(s);try{for(;a=u.nextNode();)hn(a,s),En(a),pn(a.content)&&An(a.content)}catch(t){throw c&&(nn(e),m(o.removed,(e=>{e.element&&an(e.element)}))),t}if(c)return m(o.removed,(e=>{e.element&&an(e.element)})),ft&&un(e),e;if(bt){if(ft&&un(n),Tt)for(l=He.call(n.ownerDocument);n.firstChild;)l.appendChild(n.firstChild);else l=n;return(tt.shadowroot||tt.shadowrootmode)&&(l=Be.call(i,l,!0)),l}let f=mt?n.outerHTML:n.innerHTML;return mt&&Qe["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&I(re,n.ownerDocument.doctype.name)&&(f="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+f),ft&&(f=sn(f)),Re&&St?Me(f):f},o.setConfig=function(){Zt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),dt=!0,ht=Qe,gt=tt},o.clearConfig=function(){$t=null,dt=!1,ht=null,gt=null,Re=Ce,Ie=""},o.isValidAttribute=function(e,t,n){$t||Zt({});const o=Xt(e),r=Xt(t);return gn(o,r,n)},o.addHook=function(e,t){"function"==typeof t&&R(Ge,e)&&g(Ge[e],t)},o.removeHook=function(e,t){if(R(Ge,e)){if(void 0!==t){const n=d(Ge[e],t);return-1===n?void 0:y(Ge[e],n,1)[0]}return h(Ge[e])}},o.removeHooks=function(e){R(Ge,e)&&(Ge[e]=[])},o.removeAllHooks=function(){Ge={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},o}();export{be as default};
|
|
3
3
|
//# sourceMappingURL=purify.es.js.map
|