@trinityui/design-system 2.11.0 → 2.11.1
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/CHANGELOG.md +54 -0
- package/MIGRATION.md +25 -0
- package/dist/app-shell.js +2964 -2904
- package/dist/components/AI/AIChainOfThought.d.ts +38 -0
- package/dist/components/AI/AIChainOfThought.d.ts.map +1 -1
- package/dist/components/AI/AIChainOfThought.types.d.ts +12 -2
- package/dist/components/AI/AIChainOfThought.types.d.ts.map +1 -1
- package/dist/components/AI/AISources.d.ts +10 -2
- package/dist/components/AI/AISources.d.ts.map +1 -1
- package/dist/components/AI/AITextBlock.d.ts +4 -2
- package/dist/components/AI/AITextBlock.d.ts.map +1 -1
- package/dist/components/AI/InsightEngineInput.d.ts +5 -1
- package/dist/components/AI/InsightEngineInput.d.ts.map +1 -1
- package/dist/components/HtmlToMui/HtmlToMui.d.ts +32 -2
- package/dist/components/HtmlToMui/HtmlToMui.d.ts.map +1 -1
- package/dist/components/SandboxedIframeRenderer/SandboxedIframeRenderer.d.ts +48 -4
- package/dist/components/SandboxedIframeRenderer/SandboxedIframeRenderer.d.ts.map +1 -1
- package/dist/components/shared/safeContent.d.ts +129 -0
- package/dist/components/shared/safeContent.d.ts.map +1 -0
- package/dist/components/shared/warnDeprecated.d.ts.map +1 -1
- package/dist/safe-content.js +792 -0
- package/dist/trinity.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
import * as L from "react";
|
|
2
|
+
const k = {
|
|
3
|
+
AMP: "&",
|
|
4
|
+
COPY: "©",
|
|
5
|
+
GT: ">",
|
|
6
|
+
LT: "<",
|
|
7
|
+
QUOT: '"',
|
|
8
|
+
REG: "®",
|
|
9
|
+
AElig: "Æ",
|
|
10
|
+
Aacute: "Á",
|
|
11
|
+
Acirc: "Â",
|
|
12
|
+
Agrave: "À",
|
|
13
|
+
Alpha: "Α",
|
|
14
|
+
Aring: "Å",
|
|
15
|
+
Atilde: "Ã",
|
|
16
|
+
Auml: "Ä",
|
|
17
|
+
Beta: "Β",
|
|
18
|
+
Ccedil: "Ç",
|
|
19
|
+
Chi: "Χ",
|
|
20
|
+
Dagger: "‡",
|
|
21
|
+
Delta: "Δ",
|
|
22
|
+
ETH: "Ð",
|
|
23
|
+
Eacute: "É",
|
|
24
|
+
Ecirc: "Ê",
|
|
25
|
+
Egrave: "È",
|
|
26
|
+
Epsilon: "Ε",
|
|
27
|
+
Eta: "Η",
|
|
28
|
+
Euml: "Ë",
|
|
29
|
+
Gamma: "Γ",
|
|
30
|
+
Hat: "^",
|
|
31
|
+
Iacute: "Í",
|
|
32
|
+
Icirc: "Î",
|
|
33
|
+
Igrave: "Ì",
|
|
34
|
+
Iota: "Ι",
|
|
35
|
+
Iuml: "Ï",
|
|
36
|
+
Kappa: "Κ",
|
|
37
|
+
Lambda: "Λ",
|
|
38
|
+
Mu: "Μ",
|
|
39
|
+
NewLine: `
|
|
40
|
+
`,
|
|
41
|
+
Ntilde: "Ñ",
|
|
42
|
+
Nu: "Ν",
|
|
43
|
+
OElig: "Œ",
|
|
44
|
+
Oacute: "Ó",
|
|
45
|
+
Ocirc: "Ô",
|
|
46
|
+
Ograve: "Ò",
|
|
47
|
+
Omega: "Ω",
|
|
48
|
+
Omicron: "Ο",
|
|
49
|
+
Oslash: "Ø",
|
|
50
|
+
Otilde: "Õ",
|
|
51
|
+
Ouml: "Ö",
|
|
52
|
+
Phi: "Φ",
|
|
53
|
+
Pi: "Π",
|
|
54
|
+
Prime: "″",
|
|
55
|
+
Psi: "Ψ",
|
|
56
|
+
Rho: "Ρ",
|
|
57
|
+
Scaron: "Š",
|
|
58
|
+
Sigma: "Σ",
|
|
59
|
+
THORN: "Þ",
|
|
60
|
+
Tab: " ",
|
|
61
|
+
Tau: "Τ",
|
|
62
|
+
Theta: "Θ",
|
|
63
|
+
Uacute: "Ú",
|
|
64
|
+
Ucirc: "Û",
|
|
65
|
+
Ugrave: "Ù",
|
|
66
|
+
Upsilon: "Υ",
|
|
67
|
+
Uuml: "Ü",
|
|
68
|
+
Xi: "Ξ",
|
|
69
|
+
Yacute: "Ý",
|
|
70
|
+
Yuml: "Ÿ",
|
|
71
|
+
Zeta: "Ζ",
|
|
72
|
+
aacute: "á",
|
|
73
|
+
acirc: "â",
|
|
74
|
+
acute: "´",
|
|
75
|
+
aelig: "æ",
|
|
76
|
+
agrave: "à",
|
|
77
|
+
alefsym: "ℵ",
|
|
78
|
+
alpha: "α",
|
|
79
|
+
amp: "&",
|
|
80
|
+
and: "∧",
|
|
81
|
+
ang: "∠",
|
|
82
|
+
apos: "'",
|
|
83
|
+
aring: "å",
|
|
84
|
+
ast: "*",
|
|
85
|
+
asymp: "≈",
|
|
86
|
+
atilde: "ã",
|
|
87
|
+
auml: "ä",
|
|
88
|
+
bdquo: "„",
|
|
89
|
+
beta: "β",
|
|
90
|
+
brvbar: "¦",
|
|
91
|
+
bsol: "\\",
|
|
92
|
+
bull: "•",
|
|
93
|
+
cap: "∩",
|
|
94
|
+
ccedil: "ç",
|
|
95
|
+
cedil: "¸",
|
|
96
|
+
cent: "¢",
|
|
97
|
+
chi: "χ",
|
|
98
|
+
circ: "ˆ",
|
|
99
|
+
clubs: "♣",
|
|
100
|
+
colon: ":",
|
|
101
|
+
comma: ",",
|
|
102
|
+
commat: "@",
|
|
103
|
+
cong: "≅",
|
|
104
|
+
copy: "©",
|
|
105
|
+
crarr: "↵",
|
|
106
|
+
cup: "∪",
|
|
107
|
+
curren: "¤",
|
|
108
|
+
dArr: "⇓",
|
|
109
|
+
dagger: "†",
|
|
110
|
+
darr: "↓",
|
|
111
|
+
dash: "-",
|
|
112
|
+
deg: "°",
|
|
113
|
+
delta: "δ",
|
|
114
|
+
diams: "♦",
|
|
115
|
+
divide: "÷",
|
|
116
|
+
dollar: "$",
|
|
117
|
+
eacute: "é",
|
|
118
|
+
ecirc: "ê",
|
|
119
|
+
egrave: "è",
|
|
120
|
+
empty: "∅",
|
|
121
|
+
emsp: " ",
|
|
122
|
+
ensp: " ",
|
|
123
|
+
epsilon: "ε",
|
|
124
|
+
equals: "=",
|
|
125
|
+
equiv: "≡",
|
|
126
|
+
eta: "η",
|
|
127
|
+
eth: "ð",
|
|
128
|
+
euml: "ë",
|
|
129
|
+
euro: "€",
|
|
130
|
+
excl: "!",
|
|
131
|
+
exist: "∃",
|
|
132
|
+
fnof: "ƒ",
|
|
133
|
+
forall: "∀",
|
|
134
|
+
frac12: "½",
|
|
135
|
+
frac14: "¼",
|
|
136
|
+
frac34: "¾",
|
|
137
|
+
frasl: "⁄",
|
|
138
|
+
gamma: "γ",
|
|
139
|
+
ge: "≥",
|
|
140
|
+
grave: "`",
|
|
141
|
+
gt: ">",
|
|
142
|
+
hArr: "⇔",
|
|
143
|
+
harr: "↔",
|
|
144
|
+
hearts: "♥",
|
|
145
|
+
hellip: "…",
|
|
146
|
+
hyphen: "-",
|
|
147
|
+
iacute: "í",
|
|
148
|
+
icirc: "î",
|
|
149
|
+
iexcl: "¡",
|
|
150
|
+
igrave: "ì",
|
|
151
|
+
image: "ℑ",
|
|
152
|
+
infin: "∞",
|
|
153
|
+
int: "∫",
|
|
154
|
+
iota: "ι",
|
|
155
|
+
iquest: "¿",
|
|
156
|
+
isin: "∈",
|
|
157
|
+
iuml: "ï",
|
|
158
|
+
kappa: "κ",
|
|
159
|
+
lArr: "⇐",
|
|
160
|
+
lambda: "λ",
|
|
161
|
+
lang: "〈",
|
|
162
|
+
laquo: "«",
|
|
163
|
+
larr: "←",
|
|
164
|
+
lceil: "⌈",
|
|
165
|
+
lcub: "{",
|
|
166
|
+
ldquo: "“",
|
|
167
|
+
le: "≤",
|
|
168
|
+
lfloor: "⌊",
|
|
169
|
+
lowast: "∗",
|
|
170
|
+
lowbar: "_",
|
|
171
|
+
loz: "◊",
|
|
172
|
+
lpar: "(",
|
|
173
|
+
lrm: "",
|
|
174
|
+
lsaquo: "‹",
|
|
175
|
+
lsqb: "[",
|
|
176
|
+
lsquo: "‘",
|
|
177
|
+
lt: "<",
|
|
178
|
+
macr: "¯",
|
|
179
|
+
mdash: "—",
|
|
180
|
+
micro: "µ",
|
|
181
|
+
middot: "·",
|
|
182
|
+
minus: "−",
|
|
183
|
+
mu: "μ",
|
|
184
|
+
nabla: "∇",
|
|
185
|
+
nbsp: " ",
|
|
186
|
+
ndash: "–",
|
|
187
|
+
ne: "≠",
|
|
188
|
+
ni: "∋",
|
|
189
|
+
not: "¬",
|
|
190
|
+
notin: "∉",
|
|
191
|
+
nsub: "⊄",
|
|
192
|
+
ntilde: "ñ",
|
|
193
|
+
nu: "ν",
|
|
194
|
+
num: "#",
|
|
195
|
+
oacute: "ó",
|
|
196
|
+
ocirc: "ô",
|
|
197
|
+
oelig: "œ",
|
|
198
|
+
ograve: "ò",
|
|
199
|
+
oline: "‾",
|
|
200
|
+
omega: "ω",
|
|
201
|
+
omicron: "ο",
|
|
202
|
+
oplus: "⊕",
|
|
203
|
+
or: "∨",
|
|
204
|
+
ordf: "ª",
|
|
205
|
+
ordm: "º",
|
|
206
|
+
oslash: "ø",
|
|
207
|
+
otilde: "õ",
|
|
208
|
+
otimes: "⊗",
|
|
209
|
+
ouml: "ö",
|
|
210
|
+
para: "¶",
|
|
211
|
+
part: "∂",
|
|
212
|
+
percnt: "%",
|
|
213
|
+
period: ".",
|
|
214
|
+
permil: "‰",
|
|
215
|
+
perp: "⊥",
|
|
216
|
+
phi: "φ",
|
|
217
|
+
pi: "π",
|
|
218
|
+
piv: "ϖ",
|
|
219
|
+
plus: "+",
|
|
220
|
+
plusmn: "±",
|
|
221
|
+
pound: "£",
|
|
222
|
+
prime: "′",
|
|
223
|
+
prod: "∏",
|
|
224
|
+
prop: "∝",
|
|
225
|
+
psi: "ψ",
|
|
226
|
+
quest: "?",
|
|
227
|
+
quot: '"',
|
|
228
|
+
rArr: "⇒",
|
|
229
|
+
radic: "√",
|
|
230
|
+
rang: "〉",
|
|
231
|
+
raquo: "»",
|
|
232
|
+
rarr: "→",
|
|
233
|
+
rceil: "⌉",
|
|
234
|
+
rcub: "}",
|
|
235
|
+
rdquo: "”",
|
|
236
|
+
real: "ℜ",
|
|
237
|
+
reg: "®",
|
|
238
|
+
rfloor: "⌋",
|
|
239
|
+
rho: "ρ",
|
|
240
|
+
rlm: "",
|
|
241
|
+
rpar: ")",
|
|
242
|
+
rsaquo: "›",
|
|
243
|
+
rsqb: "]",
|
|
244
|
+
rsquo: "’",
|
|
245
|
+
sbquo: "‚",
|
|
246
|
+
scaron: "š",
|
|
247
|
+
sdot: "⋅",
|
|
248
|
+
sect: "§",
|
|
249
|
+
semi: ";",
|
|
250
|
+
shy: "",
|
|
251
|
+
sigma: "σ",
|
|
252
|
+
sigmaf: "ς",
|
|
253
|
+
sim: "∼",
|
|
254
|
+
sol: "/",
|
|
255
|
+
spades: "♠",
|
|
256
|
+
sub: "⊂",
|
|
257
|
+
sube: "⊆",
|
|
258
|
+
sum: "∑",
|
|
259
|
+
sup: "⊃",
|
|
260
|
+
sup1: "¹",
|
|
261
|
+
sup2: "²",
|
|
262
|
+
sup3: "³",
|
|
263
|
+
supe: "⊇",
|
|
264
|
+
szlig: "ß",
|
|
265
|
+
tau: "τ",
|
|
266
|
+
there4: "∴",
|
|
267
|
+
theta: "θ",
|
|
268
|
+
thetasym: "ϑ",
|
|
269
|
+
thinsp: " ",
|
|
270
|
+
thorn: "þ",
|
|
271
|
+
tilde: "˜",
|
|
272
|
+
times: "×",
|
|
273
|
+
trade: "™",
|
|
274
|
+
uArr: "⇑",
|
|
275
|
+
uacute: "ú",
|
|
276
|
+
uarr: "↑",
|
|
277
|
+
ucirc: "û",
|
|
278
|
+
ugrave: "ù",
|
|
279
|
+
uml: "¨",
|
|
280
|
+
upsih: "ϒ",
|
|
281
|
+
upsilon: "υ",
|
|
282
|
+
uuml: "ü",
|
|
283
|
+
verbar: "|",
|
|
284
|
+
weierp: "℘",
|
|
285
|
+
xi: "ξ",
|
|
286
|
+
yacute: "ý",
|
|
287
|
+
yen: "¥",
|
|
288
|
+
yuml: "ÿ",
|
|
289
|
+
zeta: "ζ",
|
|
290
|
+
zwj: "",
|
|
291
|
+
zwnj: ""
|
|
292
|
+
}, R = {
|
|
293
|
+
128: 8364,
|
|
294
|
+
130: 8218,
|
|
295
|
+
131: 402,
|
|
296
|
+
132: 8222,
|
|
297
|
+
133: 8230,
|
|
298
|
+
134: 8224,
|
|
299
|
+
135: 8225,
|
|
300
|
+
136: 710,
|
|
301
|
+
137: 8240,
|
|
302
|
+
138: 352,
|
|
303
|
+
139: 8249,
|
|
304
|
+
140: 338,
|
|
305
|
+
142: 381,
|
|
306
|
+
145: 8216,
|
|
307
|
+
146: 8217,
|
|
308
|
+
147: 8220,
|
|
309
|
+
148: 8221,
|
|
310
|
+
149: 8226,
|
|
311
|
+
150: 8211,
|
|
312
|
+
151: 8212,
|
|
313
|
+
152: 732,
|
|
314
|
+
153: 8482,
|
|
315
|
+
154: 353,
|
|
316
|
+
155: 8250,
|
|
317
|
+
156: 339,
|
|
318
|
+
158: 382,
|
|
319
|
+
159: 376
|
|
320
|
+
};
|
|
321
|
+
function F(a) {
|
|
322
|
+
return !Number.isFinite(a) || a <= 0 || a > 1114111 || a >= 55296 && a <= 57343 ? "�" : String.fromCodePoint(R[a] ?? a);
|
|
323
|
+
}
|
|
324
|
+
const z = /* @__PURE__ */ new Set([
|
|
325
|
+
"AElig",
|
|
326
|
+
"AMP",
|
|
327
|
+
"Aacute",
|
|
328
|
+
"Acirc",
|
|
329
|
+
"Agrave",
|
|
330
|
+
"Aring",
|
|
331
|
+
"Atilde",
|
|
332
|
+
"Auml",
|
|
333
|
+
"COPY",
|
|
334
|
+
"Ccedil",
|
|
335
|
+
"ETH",
|
|
336
|
+
"Eacute",
|
|
337
|
+
"Ecirc",
|
|
338
|
+
"Egrave",
|
|
339
|
+
"Euml",
|
|
340
|
+
"GT",
|
|
341
|
+
"Iacute",
|
|
342
|
+
"Icirc",
|
|
343
|
+
"Igrave",
|
|
344
|
+
"Iuml",
|
|
345
|
+
"LT",
|
|
346
|
+
"Ntilde",
|
|
347
|
+
"Oacute",
|
|
348
|
+
"Ocirc",
|
|
349
|
+
"Ograve",
|
|
350
|
+
"Oslash",
|
|
351
|
+
"Otilde",
|
|
352
|
+
"Ouml",
|
|
353
|
+
"QUOT",
|
|
354
|
+
"REG",
|
|
355
|
+
"THORN",
|
|
356
|
+
"Uacute",
|
|
357
|
+
"Ucirc",
|
|
358
|
+
"Ugrave",
|
|
359
|
+
"Uuml",
|
|
360
|
+
"Yacute",
|
|
361
|
+
"aacute",
|
|
362
|
+
"acirc",
|
|
363
|
+
"acute",
|
|
364
|
+
"aelig",
|
|
365
|
+
"agrave",
|
|
366
|
+
"amp",
|
|
367
|
+
"aring",
|
|
368
|
+
"atilde",
|
|
369
|
+
"auml",
|
|
370
|
+
"brvbar",
|
|
371
|
+
"ccedil",
|
|
372
|
+
"cedil",
|
|
373
|
+
"cent",
|
|
374
|
+
"copy",
|
|
375
|
+
"curren",
|
|
376
|
+
"deg",
|
|
377
|
+
"divide",
|
|
378
|
+
"eacute",
|
|
379
|
+
"ecirc",
|
|
380
|
+
"egrave",
|
|
381
|
+
"eth",
|
|
382
|
+
"euml",
|
|
383
|
+
"frac12",
|
|
384
|
+
"frac14",
|
|
385
|
+
"frac34",
|
|
386
|
+
"gt",
|
|
387
|
+
"iacute",
|
|
388
|
+
"icirc",
|
|
389
|
+
"iexcl",
|
|
390
|
+
"igrave",
|
|
391
|
+
"iquest",
|
|
392
|
+
"iuml",
|
|
393
|
+
"laquo",
|
|
394
|
+
"lt",
|
|
395
|
+
"macr",
|
|
396
|
+
"micro",
|
|
397
|
+
"middot",
|
|
398
|
+
"nbsp",
|
|
399
|
+
"not",
|
|
400
|
+
"ntilde",
|
|
401
|
+
"oacute",
|
|
402
|
+
"ocirc",
|
|
403
|
+
"ograve",
|
|
404
|
+
"ordf",
|
|
405
|
+
"ordm",
|
|
406
|
+
"oslash",
|
|
407
|
+
"otilde",
|
|
408
|
+
"ouml",
|
|
409
|
+
"para",
|
|
410
|
+
"plusmn",
|
|
411
|
+
"pound",
|
|
412
|
+
"quot",
|
|
413
|
+
"raquo",
|
|
414
|
+
"reg",
|
|
415
|
+
"sect",
|
|
416
|
+
"shy",
|
|
417
|
+
"sup1",
|
|
418
|
+
"sup2",
|
|
419
|
+
"sup3",
|
|
420
|
+
"szlig",
|
|
421
|
+
"thorn",
|
|
422
|
+
"times",
|
|
423
|
+
"uacute",
|
|
424
|
+
"ucirc",
|
|
425
|
+
"ugrave",
|
|
426
|
+
"uml",
|
|
427
|
+
"uuml",
|
|
428
|
+
"yacute",
|
|
429
|
+
"yen",
|
|
430
|
+
"yuml"
|
|
431
|
+
]), H = Math.max(...Array.from(z, (a) => a.length));
|
|
432
|
+
function _(a, e = !1) {
|
|
433
|
+
return a.includes("&") ? a.replace(/&(#[xX][0-9a-fA-F]+|#\d+|[a-zA-Z][a-zA-Z0-9]*);?/g, (t, r, n) => {
|
|
434
|
+
if (r[0] === "#") {
|
|
435
|
+
const s = r[1] === "x" || r[1] === "X" ? parseInt(r.slice(2), 16) : parseInt(r.slice(1), 10);
|
|
436
|
+
return F(s);
|
|
437
|
+
}
|
|
438
|
+
if (t.endsWith(";"))
|
|
439
|
+
return Object.prototype.hasOwnProperty.call(k, r) ? k[r] : t;
|
|
440
|
+
for (let s = Math.min(r.length, H); s > 0; s -= 1) {
|
|
441
|
+
const u = r.slice(0, s);
|
|
442
|
+
if (!z.has(u)) continue;
|
|
443
|
+
const h = a[n + 1 + s] ?? "";
|
|
444
|
+
return e && /[=A-Za-z0-9]/.test(h) ? t : k[u] + r.slice(s);
|
|
445
|
+
}
|
|
446
|
+
return t;
|
|
447
|
+
}) : a;
|
|
448
|
+
}
|
|
449
|
+
function y(a) {
|
|
450
|
+
return _(a).replace(/[\u0000- \u007F]+/g, "");
|
|
451
|
+
}
|
|
452
|
+
function I(a) {
|
|
453
|
+
const e = /^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(a);
|
|
454
|
+
return e ? e[1].toLowerCase() : null;
|
|
455
|
+
}
|
|
456
|
+
const M = /* @__PURE__ */ new Set(["http", "https", "mailto", "tel"]), $ = /* @__PURE__ */ new Set(["http", "https", "blob"]), j = /^data:image\/(png|jpeg|jpg|gif|webp|avif|bmp|x-icon|vnd\.microsoft\.icon)[;,]/i;
|
|
457
|
+
function W(a) {
|
|
458
|
+
if (a == null) return !1;
|
|
459
|
+
const e = y(String(a));
|
|
460
|
+
if (e === "") return !1;
|
|
461
|
+
const t = I(e);
|
|
462
|
+
return t === null || M.has(t);
|
|
463
|
+
}
|
|
464
|
+
function ne(a) {
|
|
465
|
+
if (a == null) return !1;
|
|
466
|
+
const e = y(String(a));
|
|
467
|
+
if (e === "") return !1;
|
|
468
|
+
const t = I(e);
|
|
469
|
+
return t === null ? !0 : t === "data" ? j.test(e) : $.has(t);
|
|
470
|
+
}
|
|
471
|
+
const C = /* @__PURE__ */ new Set();
|
|
472
|
+
function ae(a, e, t = "link") {
|
|
473
|
+
if (process.env.NODE_ENV === "production") return;
|
|
474
|
+
const r = I(y(String(e ?? ""))) ?? (e ? "relative" : "empty"), n = `${a}:${t}:${r}`;
|
|
475
|
+
if (C.has(n)) return;
|
|
476
|
+
C.add(n);
|
|
477
|
+
const s = t === "link" ? `[trinity] ${a}: a link with the "${r}" scheme was shown as plain text. Links render only for http(s), mailto, tel and relative URLs - pass one of those to keep it clickable.` : `[trinity] ${a}: an image with a "${r}" source was not loaded. Images load only from http(s), blob:, relative URLs or raster data:image (png, jpeg, gif, webp, avif, bmp, ico) - pass one of those to show it.`;
|
|
478
|
+
console.warn(s);
|
|
479
|
+
}
|
|
480
|
+
const Z = /* @__PURE__ */ new Set([
|
|
481
|
+
"script",
|
|
482
|
+
"style",
|
|
483
|
+
"iframe",
|
|
484
|
+
"object",
|
|
485
|
+
"embed",
|
|
486
|
+
"link",
|
|
487
|
+
"meta",
|
|
488
|
+
"base",
|
|
489
|
+
"form",
|
|
490
|
+
"input",
|
|
491
|
+
"button",
|
|
492
|
+
"textarea",
|
|
493
|
+
"select",
|
|
494
|
+
"option",
|
|
495
|
+
"template",
|
|
496
|
+
"noscript",
|
|
497
|
+
"svg",
|
|
498
|
+
"math",
|
|
499
|
+
"title",
|
|
500
|
+
"frame",
|
|
501
|
+
"frameset",
|
|
502
|
+
"noembed",
|
|
503
|
+
"noframes",
|
|
504
|
+
"xmp",
|
|
505
|
+
"plaintext",
|
|
506
|
+
"applet",
|
|
507
|
+
"portal"
|
|
508
|
+
]), Y = /* @__PURE__ */ new Set(["script", "style", "textarea", "title", "xmp", "iframe", "noembed", "noframes", "noscript", "plaintext"]), x = /* @__PURE__ */ new Set([
|
|
509
|
+
"b",
|
|
510
|
+
"strong",
|
|
511
|
+
"i",
|
|
512
|
+
"em",
|
|
513
|
+
"code",
|
|
514
|
+
"br",
|
|
515
|
+
"p",
|
|
516
|
+
"ul",
|
|
517
|
+
"ol",
|
|
518
|
+
"li",
|
|
519
|
+
"span",
|
|
520
|
+
"a",
|
|
521
|
+
"mark"
|
|
522
|
+
]), T = /* @__PURE__ */ new Set([
|
|
523
|
+
"br",
|
|
524
|
+
"hr",
|
|
525
|
+
"img",
|
|
526
|
+
"wbr",
|
|
527
|
+
"area",
|
|
528
|
+
"col",
|
|
529
|
+
"source",
|
|
530
|
+
"track",
|
|
531
|
+
"input",
|
|
532
|
+
"link",
|
|
533
|
+
"meta",
|
|
534
|
+
"base",
|
|
535
|
+
"embed",
|
|
536
|
+
"param"
|
|
537
|
+
]), X = /* @__PURE__ */ new Set(["p", "ul", "ol", "li"]), B = /* @__PURE__ */ new Set(["b", "strong", "i", "em", "code", "span", "a", "mark"]), v = /* @__PURE__ */ new Set(["ul", "ol"]), q = /* @__PURE__ */ new Set([
|
|
538
|
+
"div",
|
|
539
|
+
"h1",
|
|
540
|
+
"h2",
|
|
541
|
+
"h3",
|
|
542
|
+
"h4",
|
|
543
|
+
"h5",
|
|
544
|
+
"h6",
|
|
545
|
+
"table",
|
|
546
|
+
"thead",
|
|
547
|
+
"tbody",
|
|
548
|
+
"tfoot",
|
|
549
|
+
"tr",
|
|
550
|
+
"td",
|
|
551
|
+
"th",
|
|
552
|
+
"caption",
|
|
553
|
+
"blockquote",
|
|
554
|
+
"pre",
|
|
555
|
+
"section",
|
|
556
|
+
"article",
|
|
557
|
+
"header",
|
|
558
|
+
"footer",
|
|
559
|
+
"aside",
|
|
560
|
+
"nav",
|
|
561
|
+
"main",
|
|
562
|
+
"figure",
|
|
563
|
+
"figcaption",
|
|
564
|
+
"dl",
|
|
565
|
+
"dt",
|
|
566
|
+
"dd",
|
|
567
|
+
"address",
|
|
568
|
+
"details",
|
|
569
|
+
"summary",
|
|
570
|
+
"hr",
|
|
571
|
+
"br"
|
|
572
|
+
]), K = 64, V = /[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDFFF]/g, U = /--!?>/g;
|
|
573
|
+
function Q(a) {
|
|
574
|
+
const e = a.replace(/\u0000/g, "").replace(V, (h) => h.length === 2 ? h : "�"), t = [], r = e.length;
|
|
575
|
+
let n = 0, s = "";
|
|
576
|
+
const u = () => {
|
|
577
|
+
s && (t.push({ kind: "text", value: _(s) }), s = "");
|
|
578
|
+
};
|
|
579
|
+
for (; n < r; ) {
|
|
580
|
+
const h = e[n];
|
|
581
|
+
if (h !== "<") {
|
|
582
|
+
s += h, n += 1;
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
585
|
+
const b = e[n + 1];
|
|
586
|
+
if (e.startsWith("<!--", n)) {
|
|
587
|
+
if (u(), e.startsWith("<!-->", n)) {
|
|
588
|
+
n += 5;
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
if (e.startsWith("<!--->", n)) {
|
|
592
|
+
n += 6;
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
U.lastIndex = n + 4;
|
|
596
|
+
const c = U.exec(e);
|
|
597
|
+
n = c ? c.index + c[0].length : r;
|
|
598
|
+
continue;
|
|
599
|
+
}
|
|
600
|
+
if (b === "!" || b === "?") {
|
|
601
|
+
u();
|
|
602
|
+
const c = e.indexOf(">", n + 2);
|
|
603
|
+
n = c === -1 ? r : c + 1;
|
|
604
|
+
continue;
|
|
605
|
+
}
|
|
606
|
+
const S = b === "/", O = S ? n + 2 : n + 1;
|
|
607
|
+
if (!/[a-zA-Z]/.test(e[O] ?? "")) {
|
|
608
|
+
s += h, n += 1;
|
|
609
|
+
continue;
|
|
610
|
+
}
|
|
611
|
+
let l = O;
|
|
612
|
+
for (; l < r && /[a-zA-Z0-9-]/.test(e[l]); ) l += 1;
|
|
613
|
+
const m = e.slice(O, l).toLowerCase(), g = /* @__PURE__ */ Object.create(null);
|
|
614
|
+
let w = !1, i = !1;
|
|
615
|
+
for (; l < r; ) {
|
|
616
|
+
const c = e[l];
|
|
617
|
+
if (c === ">") {
|
|
618
|
+
i = !0, l += 1;
|
|
619
|
+
break;
|
|
620
|
+
}
|
|
621
|
+
if (c === "/") {
|
|
622
|
+
w = e[l + 1] === ">", l += 1;
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
if (/\s/.test(c)) {
|
|
626
|
+
l += 1;
|
|
627
|
+
continue;
|
|
628
|
+
}
|
|
629
|
+
let o = l;
|
|
630
|
+
for (; o < r && !/[\s/>=]/.test(e[o]); ) o += 1;
|
|
631
|
+
const p = e.slice(l, o).toLowerCase();
|
|
632
|
+
for (l = o; l < r && /\s/.test(e[l]); ) l += 1;
|
|
633
|
+
let d = "";
|
|
634
|
+
if (e[l] === "=") {
|
|
635
|
+
for (l += 1; l < r && /\s/.test(e[l]); ) l += 1;
|
|
636
|
+
const A = e[l];
|
|
637
|
+
if (A === '"' || A === "'") {
|
|
638
|
+
const f = e.indexOf(A, l + 1);
|
|
639
|
+
d = e.slice(l + 1, f === -1 ? r : f), l = f === -1 ? r : f + 1;
|
|
640
|
+
} else {
|
|
641
|
+
let f = l;
|
|
642
|
+
for (; f < r && !/[\s>]/.test(e[f]); ) f += 1;
|
|
643
|
+
d = e.slice(l, f), l = f;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
p && !Object.prototype.hasOwnProperty.call(g, p) && (g[p] = _(d, !0));
|
|
647
|
+
}
|
|
648
|
+
if (!i) {
|
|
649
|
+
u(), n = r;
|
|
650
|
+
break;
|
|
651
|
+
}
|
|
652
|
+
if (u(), S) {
|
|
653
|
+
t.push({ kind: "end", name: m }), n = l;
|
|
654
|
+
continue;
|
|
655
|
+
}
|
|
656
|
+
if (t.push({ kind: "start", name: m, attrs: g, selfClosing: w }), n = l, Y.has(m) && !w) {
|
|
657
|
+
const c = new RegExp(`</${m}(?![a-z0-9-])`, "gi");
|
|
658
|
+
c.lastIndex = n;
|
|
659
|
+
const o = c.exec(e), p = o ? o.index : -1;
|
|
660
|
+
if (p === -1)
|
|
661
|
+
t.push({ kind: "text", value: e.slice(n) }), t.push({ kind: "end", name: m }), n = r;
|
|
662
|
+
else {
|
|
663
|
+
p > n && t.push({ kind: "text", value: e.slice(n, p) });
|
|
664
|
+
const d = e.indexOf(">", p);
|
|
665
|
+
t.push({ kind: "end", name: m }), n = d === -1 ? r : d + 1;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
return u(), t;
|
|
670
|
+
}
|
|
671
|
+
const D = /* @__PURE__ */ new Set();
|
|
672
|
+
function J(a) {
|
|
673
|
+
if (!a) return new Set(x);
|
|
674
|
+
const e = /* @__PURE__ */ new Set();
|
|
675
|
+
for (const t of a)
|
|
676
|
+
x.has(t) ? e.add(t) : process.env.NODE_ENV !== "production" && !D.has(t) && (D.add(t), console.warn(
|
|
677
|
+
`[trinity] renderSafeHtml: allowTags "${t}" is not supported and is shown as text. Only a subset of ${[...x].join(", ")} can be kept.`
|
|
678
|
+
));
|
|
679
|
+
return e;
|
|
680
|
+
}
|
|
681
|
+
function ee(a, e) {
|
|
682
|
+
const t = J(e.allowTags), r = e.allowClasses ?? {}, n = { tag: "#root", props: {}, children: [] }, s = [n], u = () => s[s.length - 1], h = (i) => s.some((c) => c.tag === i), b = (i) => {
|
|
683
|
+
for (; s.length > 1; )
|
|
684
|
+
if (s.pop().tag === i) return;
|
|
685
|
+
}, S = (i, c) => {
|
|
686
|
+
i.children.push(c), i.endsWithSpace = !1;
|
|
687
|
+
}, O = () => {
|
|
688
|
+
if (v.has(u().tag)) {
|
|
689
|
+
const i = { tag: "li", props: {}, children: [], implicit: !0 };
|
|
690
|
+
S(u(), i), s.push(i);
|
|
691
|
+
}
|
|
692
|
+
}, l = (i) => {
|
|
693
|
+
if (typeof i == "string" && v.has(u().tag) && !i.trim())
|
|
694
|
+
return;
|
|
695
|
+
O();
|
|
696
|
+
const c = u();
|
|
697
|
+
if (typeof i != "string") {
|
|
698
|
+
S(c, i);
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
i && (c.endsWithSpace = /\s/.test(i.charAt(i.length - 1)));
|
|
702
|
+
const o = c.children[c.children.length - 1];
|
|
703
|
+
typeof o == "string" ? c.children[c.children.length - 1] = o + i : c.children.push(i);
|
|
704
|
+
}, m = () => {
|
|
705
|
+
const i = u();
|
|
706
|
+
i.children.length === 0 || i.endsWithSpace || l(" ");
|
|
707
|
+
};
|
|
708
|
+
let g = 0, w = "";
|
|
709
|
+
for (const i of a) {
|
|
710
|
+
if (g > 0) {
|
|
711
|
+
i.kind === "start" && i.name === w && !i.selfClosing && (g += 1), i.kind === "end" && i.name === w && (g -= 1);
|
|
712
|
+
continue;
|
|
713
|
+
}
|
|
714
|
+
if (i.kind === "text") {
|
|
715
|
+
l(i.value);
|
|
716
|
+
continue;
|
|
717
|
+
}
|
|
718
|
+
if (i.kind === "start") {
|
|
719
|
+
const { name: o } = i;
|
|
720
|
+
if (Z.has(o)) {
|
|
721
|
+
!i.selfClosing && !T.has(o) && o !== "frame" && (g = 1, w = o);
|
|
722
|
+
continue;
|
|
723
|
+
}
|
|
724
|
+
if (!t.has(o)) {
|
|
725
|
+
q.has(o) && m();
|
|
726
|
+
continue;
|
|
727
|
+
}
|
|
728
|
+
if (s.length > K && !T.has(o)) continue;
|
|
729
|
+
const p = te(o, i.attrs, r);
|
|
730
|
+
if (p === null) continue;
|
|
731
|
+
if (o === "li") {
|
|
732
|
+
let f = -1;
|
|
733
|
+
for (let E = s.length - 1; E > 0; E -= 1)
|
|
734
|
+
if (v.has(s[E].tag)) {
|
|
735
|
+
f = E;
|
|
736
|
+
break;
|
|
737
|
+
}
|
|
738
|
+
if (f === -1) continue;
|
|
739
|
+
const N = s.findIndex((E, P) => P > f && E.tag === "li");
|
|
740
|
+
s.length = N === -1 ? f + 1 : N;
|
|
741
|
+
}
|
|
742
|
+
if ((o === "p" || v.has(o)) && h("p") && b("p"), X.has(o))
|
|
743
|
+
for (; B.has(u().tag); ) s.pop();
|
|
744
|
+
o === "a" && h("a") && b("a");
|
|
745
|
+
const d = p.__tag ?? o;
|
|
746
|
+
delete p.__tag;
|
|
747
|
+
const A = { tag: d, props: p, children: [] };
|
|
748
|
+
o === "li" ? S(u(), A) : l(A), !T.has(o) && !i.selfClosing && (A.source = o, s.push(A));
|
|
749
|
+
continue;
|
|
750
|
+
}
|
|
751
|
+
const c = (() => {
|
|
752
|
+
for (let o = s.length - 1; o > 0; o -= 1) {
|
|
753
|
+
const p = s[o];
|
|
754
|
+
if ((p.source ?? p.tag) === i.name) return o;
|
|
755
|
+
}
|
|
756
|
+
return -1;
|
|
757
|
+
})();
|
|
758
|
+
c > 0 ? s.length = c : q.has(i.name) && m();
|
|
759
|
+
}
|
|
760
|
+
return n.children;
|
|
761
|
+
}
|
|
762
|
+
function te(a, e, t) {
|
|
763
|
+
if (a === "a") {
|
|
764
|
+
const r = e.href;
|
|
765
|
+
if (!r || !W(r)) return null;
|
|
766
|
+
const n = { href: r, rel: "noopener noreferrer" };
|
|
767
|
+
return e.title && (n.title = e.title), e.target === "_blank" && (n.target = "_blank"), n;
|
|
768
|
+
}
|
|
769
|
+
if (a === "span" || a === "mark") {
|
|
770
|
+
const r = (e.class ?? "").split(/\s+/).filter((s) => s && Object.prototype.hasOwnProperty.call(t, s) && (t[s] === "span" || t[s] === "mark")), n = {};
|
|
771
|
+
return r.length && (n.className = r.join(" "), r.some((s) => t[s] === "mark") && (n.__tag = "mark")), n;
|
|
772
|
+
}
|
|
773
|
+
return {};
|
|
774
|
+
}
|
|
775
|
+
function G(a, e) {
|
|
776
|
+
return a.map((t, r) => {
|
|
777
|
+
if (typeof t == "string") return t;
|
|
778
|
+
const n = `${e}${r}`;
|
|
779
|
+
return T.has(t.tag) ? L.createElement(t.tag, { key: n }) : L.createElement(t.tag, { key: n, ...t.props }, ...G(t.children, `${n}.`));
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
function re(a, e = {}) {
|
|
783
|
+
if (!a) return null;
|
|
784
|
+
const t = G(ee(Q(String(a)), e), "h");
|
|
785
|
+
return t.length === 1 ? t[0] : t;
|
|
786
|
+
}
|
|
787
|
+
export {
|
|
788
|
+
W as a,
|
|
789
|
+
ne as i,
|
|
790
|
+
re as r,
|
|
791
|
+
ae as w
|
|
792
|
+
};
|