@webskill/chatbot 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chatbot.css +4 -0
- package/dist/config.d.ts +104 -0
- package/dist/config.js +144 -0
- package/dist/core-D3Tq37jA.js +3063 -0
- package/dist/core-DBetA176.js +2035 -0
- package/dist/index-B25ux241.d.ts +390 -0
- package/dist/index.d.ts +6 -389
- package/dist/index.js +300 -6152
- package/dist/markdown-4gn774sm.js +280 -0
- package/dist/parse-79VbXLl4.js +642 -0
- package/dist/parse-Cc8nFxir.d.ts +280 -0
- package/dist/tsx-DDiQWvTL.js +28 -0
- package/dist/types-C4dzGOPp.js +511 -0
- package/dist/vite.d.ts +33 -0
- package/dist/vite.js +132 -0
- package/package.json +20 -3
- package/virtual.d.ts +27 -0
|
@@ -0,0 +1,3063 @@
|
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-DZ8SGSJo.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/comma-separated-tokens@2.0.3/node_modules/comma-separated-tokens/index.js
|
|
4
|
+
/**
|
|
5
|
+
* @typedef Options
|
|
6
|
+
* Configuration for `stringify`.
|
|
7
|
+
* @property {boolean} [padLeft=true]
|
|
8
|
+
* Whether to pad a space before a token.
|
|
9
|
+
* @property {boolean} [padRight=false]
|
|
10
|
+
* Whether to pad a space after a token.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {Options} StringifyOptions
|
|
14
|
+
* Please use `StringifyOptions` instead.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Parse comma-separated tokens to an array.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} value
|
|
20
|
+
* Comma-separated tokens.
|
|
21
|
+
* @returns {Array<string>}
|
|
22
|
+
* List of tokens.
|
|
23
|
+
*/
|
|
24
|
+
function parse$1(value) {
|
|
25
|
+
/** @type {Array<string>} */
|
|
26
|
+
const tokens = [];
|
|
27
|
+
const input = String(value || "");
|
|
28
|
+
let index = input.indexOf(",");
|
|
29
|
+
let start = 0;
|
|
30
|
+
/** @type {boolean} */
|
|
31
|
+
let end = false;
|
|
32
|
+
while (!end) {
|
|
33
|
+
if (index === -1) {
|
|
34
|
+
index = input.length;
|
|
35
|
+
end = true;
|
|
36
|
+
}
|
|
37
|
+
const token = input.slice(start, index).trim();
|
|
38
|
+
if (token || !end) tokens.push(token);
|
|
39
|
+
start = index + 1;
|
|
40
|
+
index = input.indexOf(",", start);
|
|
41
|
+
}
|
|
42
|
+
return tokens;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Serialize an array of strings or numbers to comma-separated tokens.
|
|
46
|
+
*
|
|
47
|
+
* @param {Array<string|number>} values
|
|
48
|
+
* List of tokens.
|
|
49
|
+
* @param {Options} [options]
|
|
50
|
+
* Configuration for `stringify` (optional).
|
|
51
|
+
* @returns {string}
|
|
52
|
+
* Comma-separated tokens.
|
|
53
|
+
*/
|
|
54
|
+
function stringify$2(values, options) {
|
|
55
|
+
const settings = options || {};
|
|
56
|
+
return (values[values.length - 1] === "" ? [...values, ""] : values).join((settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")).trim();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/schema.js
|
|
61
|
+
/**
|
|
62
|
+
* @import {Schema as SchemaType, Space} from 'property-information'
|
|
63
|
+
*/
|
|
64
|
+
/** @type {SchemaType} */
|
|
65
|
+
var Schema = class {
|
|
66
|
+
/**
|
|
67
|
+
* @param {SchemaType['property']} property
|
|
68
|
+
* Property.
|
|
69
|
+
* @param {SchemaType['normal']} normal
|
|
70
|
+
* Normal.
|
|
71
|
+
* @param {Space | undefined} [space]
|
|
72
|
+
* Space.
|
|
73
|
+
* @returns
|
|
74
|
+
* Schema.
|
|
75
|
+
*/
|
|
76
|
+
constructor(property, normal, space) {
|
|
77
|
+
this.normal = normal;
|
|
78
|
+
this.property = property;
|
|
79
|
+
if (space) this.space = space;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
Schema.prototype.normal = {};
|
|
83
|
+
Schema.prototype.property = {};
|
|
84
|
+
Schema.prototype.space = void 0;
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/merge.js
|
|
88
|
+
/**
|
|
89
|
+
* @import {Info, Space} from 'property-information'
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* @param {ReadonlyArray<Schema>} definitions
|
|
93
|
+
* Definitions.
|
|
94
|
+
* @param {Space | undefined} [space]
|
|
95
|
+
* Space.
|
|
96
|
+
* @returns {Schema}
|
|
97
|
+
* Schema.
|
|
98
|
+
*/
|
|
99
|
+
function merge(definitions, space) {
|
|
100
|
+
/** @type {Record<string, Info>} */
|
|
101
|
+
const property = {};
|
|
102
|
+
/** @type {Record<string, string>} */
|
|
103
|
+
const normal = {};
|
|
104
|
+
for (const definition of definitions) {
|
|
105
|
+
Object.assign(property, definition.property);
|
|
106
|
+
Object.assign(normal, definition.normal);
|
|
107
|
+
}
|
|
108
|
+
return new Schema(property, normal, space);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/normalize.js
|
|
113
|
+
/**
|
|
114
|
+
* Get the cleaned case insensitive form of an attribute or property.
|
|
115
|
+
*
|
|
116
|
+
* @param {string} value
|
|
117
|
+
* An attribute-like or property-like name.
|
|
118
|
+
* @returns {string}
|
|
119
|
+
* Value that can be used to look up the properly cased property on a
|
|
120
|
+
* `Schema`.
|
|
121
|
+
*/
|
|
122
|
+
function normalize(value) {
|
|
123
|
+
return value.toLowerCase();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/info.js
|
|
128
|
+
/**
|
|
129
|
+
* @import {Info as InfoType} from 'property-information'
|
|
130
|
+
*/
|
|
131
|
+
/** @type {InfoType} */
|
|
132
|
+
var Info = class {
|
|
133
|
+
/**
|
|
134
|
+
* @param {string} property
|
|
135
|
+
* Property.
|
|
136
|
+
* @param {string} attribute
|
|
137
|
+
* Attribute.
|
|
138
|
+
* @returns
|
|
139
|
+
* Info.
|
|
140
|
+
*/
|
|
141
|
+
constructor(property, attribute) {
|
|
142
|
+
this.attribute = attribute;
|
|
143
|
+
this.property = property;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
Info.prototype.attribute = "";
|
|
147
|
+
Info.prototype.booleanish = false;
|
|
148
|
+
Info.prototype.boolean = false;
|
|
149
|
+
Info.prototype.commaOrSpaceSeparated = false;
|
|
150
|
+
Info.prototype.commaSeparated = false;
|
|
151
|
+
Info.prototype.defined = false;
|
|
152
|
+
Info.prototype.mustUseProperty = false;
|
|
153
|
+
Info.prototype.number = false;
|
|
154
|
+
Info.prototype.overloadedBoolean = false;
|
|
155
|
+
Info.prototype.property = "";
|
|
156
|
+
Info.prototype.spaceSeparated = false;
|
|
157
|
+
Info.prototype.space = void 0;
|
|
158
|
+
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/types.js
|
|
161
|
+
var types_exports = /* @__PURE__ */ __exportAll({
|
|
162
|
+
boolean: () => boolean,
|
|
163
|
+
booleanish: () => booleanish,
|
|
164
|
+
commaOrSpaceSeparated: () => commaOrSpaceSeparated,
|
|
165
|
+
commaSeparated: () => commaSeparated,
|
|
166
|
+
number: () => number,
|
|
167
|
+
overloadedBoolean: () => overloadedBoolean,
|
|
168
|
+
spaceSeparated: () => spaceSeparated
|
|
169
|
+
});
|
|
170
|
+
let powers = 0;
|
|
171
|
+
const boolean = increment();
|
|
172
|
+
const booleanish = increment();
|
|
173
|
+
const overloadedBoolean = increment();
|
|
174
|
+
const number = increment();
|
|
175
|
+
const spaceSeparated = increment();
|
|
176
|
+
const commaSeparated = increment();
|
|
177
|
+
const commaOrSpaceSeparated = increment();
|
|
178
|
+
function increment() {
|
|
179
|
+
return 2 ** ++powers;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/defined-info.js
|
|
184
|
+
/**
|
|
185
|
+
* @import {Space} from 'property-information'
|
|
186
|
+
*/
|
|
187
|
+
const checks = Object.keys(types_exports);
|
|
188
|
+
var DefinedInfo = class extends Info {
|
|
189
|
+
/**
|
|
190
|
+
* @constructor
|
|
191
|
+
* @param {string} property
|
|
192
|
+
* Property.
|
|
193
|
+
* @param {string} attribute
|
|
194
|
+
* Attribute.
|
|
195
|
+
* @param {number | null | undefined} [mask]
|
|
196
|
+
* Mask.
|
|
197
|
+
* @param {Space | undefined} [space]
|
|
198
|
+
* Space.
|
|
199
|
+
* @returns
|
|
200
|
+
* Info.
|
|
201
|
+
*/
|
|
202
|
+
constructor(property, attribute, mask, space) {
|
|
203
|
+
let index = -1;
|
|
204
|
+
super(property, attribute);
|
|
205
|
+
mark(this, "space", space);
|
|
206
|
+
if (typeof mask === "number") while (++index < checks.length) {
|
|
207
|
+
const check = checks[index];
|
|
208
|
+
mark(this, checks[index], (mask & types_exports[check]) === types_exports[check]);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
DefinedInfo.prototype.defined = true;
|
|
213
|
+
/**
|
|
214
|
+
* @template {keyof DefinedInfo} Key
|
|
215
|
+
* Key type.
|
|
216
|
+
* @param {DefinedInfo} values
|
|
217
|
+
* Info.
|
|
218
|
+
* @param {Key} key
|
|
219
|
+
* Key.
|
|
220
|
+
* @param {DefinedInfo[Key]} value
|
|
221
|
+
* Value.
|
|
222
|
+
* @returns {undefined}
|
|
223
|
+
* Nothing.
|
|
224
|
+
*/
|
|
225
|
+
function mark(values, key, value) {
|
|
226
|
+
if (value) values[key] = value;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/create.js
|
|
231
|
+
/**
|
|
232
|
+
* @import {Info, Space} from 'property-information'
|
|
233
|
+
*/
|
|
234
|
+
/**
|
|
235
|
+
* @typedef Definition
|
|
236
|
+
* Definition of a schema.
|
|
237
|
+
* @property {Record<string, string> | undefined} [attributes]
|
|
238
|
+
* Normalzed names to special attribute case.
|
|
239
|
+
* @property {ReadonlyArray<string> | undefined} [mustUseProperty]
|
|
240
|
+
* Normalized names that must be set as properties.
|
|
241
|
+
* @property {Record<string, number | null>} properties
|
|
242
|
+
* Property names to their types.
|
|
243
|
+
* @property {Space | undefined} [space]
|
|
244
|
+
* Space.
|
|
245
|
+
* @property {Transform} transform
|
|
246
|
+
* Transform a property name.
|
|
247
|
+
*/
|
|
248
|
+
/**
|
|
249
|
+
* @callback Transform
|
|
250
|
+
* Transform.
|
|
251
|
+
* @param {Record<string, string>} attributes
|
|
252
|
+
* Attributes.
|
|
253
|
+
* @param {string} property
|
|
254
|
+
* Property.
|
|
255
|
+
* @returns {string}
|
|
256
|
+
* Attribute.
|
|
257
|
+
*/
|
|
258
|
+
/**
|
|
259
|
+
* @param {Definition} definition
|
|
260
|
+
* Definition.
|
|
261
|
+
* @returns {Schema}
|
|
262
|
+
* Schema.
|
|
263
|
+
*/
|
|
264
|
+
function create(definition) {
|
|
265
|
+
/** @type {Record<string, Info>} */
|
|
266
|
+
const properties = {};
|
|
267
|
+
/** @type {Record<string, string>} */
|
|
268
|
+
const normals = {};
|
|
269
|
+
for (const [property, value] of Object.entries(definition.properties)) {
|
|
270
|
+
const info = new DefinedInfo(property, definition.transform(definition.attributes || {}, property), value, definition.space);
|
|
271
|
+
if (definition.mustUseProperty && definition.mustUseProperty.includes(property)) info.mustUseProperty = true;
|
|
272
|
+
properties[property] = info;
|
|
273
|
+
normals[normalize(property)] = property;
|
|
274
|
+
normals[normalize(info.attribute)] = property;
|
|
275
|
+
}
|
|
276
|
+
return new Schema(properties, normals, definition.space);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/aria.js
|
|
281
|
+
const aria = create({
|
|
282
|
+
properties: {
|
|
283
|
+
ariaActiveDescendant: null,
|
|
284
|
+
ariaAtomic: booleanish,
|
|
285
|
+
ariaAutoComplete: null,
|
|
286
|
+
ariaBusy: booleanish,
|
|
287
|
+
ariaChecked: booleanish,
|
|
288
|
+
ariaColCount: number,
|
|
289
|
+
ariaColIndex: number,
|
|
290
|
+
ariaColSpan: number,
|
|
291
|
+
ariaControls: spaceSeparated,
|
|
292
|
+
ariaCurrent: null,
|
|
293
|
+
ariaDescribedBy: spaceSeparated,
|
|
294
|
+
ariaDetails: null,
|
|
295
|
+
ariaDisabled: booleanish,
|
|
296
|
+
ariaDropEffect: spaceSeparated,
|
|
297
|
+
ariaErrorMessage: null,
|
|
298
|
+
ariaExpanded: booleanish,
|
|
299
|
+
ariaFlowTo: spaceSeparated,
|
|
300
|
+
ariaGrabbed: booleanish,
|
|
301
|
+
ariaHasPopup: null,
|
|
302
|
+
ariaHidden: booleanish,
|
|
303
|
+
ariaInvalid: null,
|
|
304
|
+
ariaKeyShortcuts: null,
|
|
305
|
+
ariaLabel: null,
|
|
306
|
+
ariaLabelledBy: spaceSeparated,
|
|
307
|
+
ariaLevel: number,
|
|
308
|
+
ariaLive: null,
|
|
309
|
+
ariaModal: booleanish,
|
|
310
|
+
ariaMultiLine: booleanish,
|
|
311
|
+
ariaMultiSelectable: booleanish,
|
|
312
|
+
ariaOrientation: null,
|
|
313
|
+
ariaOwns: spaceSeparated,
|
|
314
|
+
ariaPlaceholder: null,
|
|
315
|
+
ariaPosInSet: number,
|
|
316
|
+
ariaPressed: booleanish,
|
|
317
|
+
ariaReadOnly: booleanish,
|
|
318
|
+
ariaRelevant: null,
|
|
319
|
+
ariaRequired: booleanish,
|
|
320
|
+
ariaRoleDescription: spaceSeparated,
|
|
321
|
+
ariaRowCount: number,
|
|
322
|
+
ariaRowIndex: number,
|
|
323
|
+
ariaRowSpan: number,
|
|
324
|
+
ariaSelected: booleanish,
|
|
325
|
+
ariaSetSize: number,
|
|
326
|
+
ariaSort: null,
|
|
327
|
+
ariaValueMax: number,
|
|
328
|
+
ariaValueMin: number,
|
|
329
|
+
ariaValueNow: number,
|
|
330
|
+
ariaValueText: null,
|
|
331
|
+
role: null
|
|
332
|
+
},
|
|
333
|
+
transform(_, property) {
|
|
334
|
+
return property === "role" ? property : "aria-" + property.slice(4).toLowerCase();
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/case-sensitive-transform.js
|
|
340
|
+
/**
|
|
341
|
+
* @param {Record<string, string>} attributes
|
|
342
|
+
* Attributes.
|
|
343
|
+
* @param {string} attribute
|
|
344
|
+
* Attribute.
|
|
345
|
+
* @returns {string}
|
|
346
|
+
* Transformed attribute.
|
|
347
|
+
*/
|
|
348
|
+
function caseSensitiveTransform(attributes, attribute) {
|
|
349
|
+
return attribute in attributes ? attributes[attribute] : attribute;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/case-insensitive-transform.js
|
|
354
|
+
/**
|
|
355
|
+
* @param {Record<string, string>} attributes
|
|
356
|
+
* Attributes.
|
|
357
|
+
* @param {string} property
|
|
358
|
+
* Property.
|
|
359
|
+
* @returns {string}
|
|
360
|
+
* Transformed property.
|
|
361
|
+
*/
|
|
362
|
+
function caseInsensitiveTransform(attributes, property) {
|
|
363
|
+
return caseSensitiveTransform(attributes, property.toLowerCase());
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/html.js
|
|
368
|
+
const html$1 = create({
|
|
369
|
+
attributes: {
|
|
370
|
+
acceptcharset: "accept-charset",
|
|
371
|
+
classname: "class",
|
|
372
|
+
htmlfor: "for",
|
|
373
|
+
httpequiv: "http-equiv"
|
|
374
|
+
},
|
|
375
|
+
mustUseProperty: [
|
|
376
|
+
"checked",
|
|
377
|
+
"multiple",
|
|
378
|
+
"muted",
|
|
379
|
+
"selected"
|
|
380
|
+
],
|
|
381
|
+
properties: {
|
|
382
|
+
abbr: null,
|
|
383
|
+
accept: commaSeparated,
|
|
384
|
+
acceptCharset: spaceSeparated,
|
|
385
|
+
accessKey: spaceSeparated,
|
|
386
|
+
action: null,
|
|
387
|
+
allow: null,
|
|
388
|
+
allowFullScreen: boolean,
|
|
389
|
+
allowPaymentRequest: boolean,
|
|
390
|
+
allowUserMedia: boolean,
|
|
391
|
+
alpha: boolean,
|
|
392
|
+
alt: null,
|
|
393
|
+
as: null,
|
|
394
|
+
async: boolean,
|
|
395
|
+
autoCapitalize: null,
|
|
396
|
+
autoComplete: spaceSeparated,
|
|
397
|
+
autoFocus: boolean,
|
|
398
|
+
autoPlay: boolean,
|
|
399
|
+
blocking: spaceSeparated,
|
|
400
|
+
capture: null,
|
|
401
|
+
charSet: null,
|
|
402
|
+
checked: boolean,
|
|
403
|
+
cite: null,
|
|
404
|
+
className: spaceSeparated,
|
|
405
|
+
closedBy: null,
|
|
406
|
+
colorSpace: null,
|
|
407
|
+
cols: number,
|
|
408
|
+
colSpan: number,
|
|
409
|
+
command: null,
|
|
410
|
+
commandFor: null,
|
|
411
|
+
content: null,
|
|
412
|
+
contentEditable: booleanish,
|
|
413
|
+
controls: boolean,
|
|
414
|
+
controlsList: spaceSeparated,
|
|
415
|
+
coords: number | commaSeparated,
|
|
416
|
+
crossOrigin: null,
|
|
417
|
+
data: null,
|
|
418
|
+
dateTime: null,
|
|
419
|
+
decoding: null,
|
|
420
|
+
default: boolean,
|
|
421
|
+
defer: boolean,
|
|
422
|
+
dir: null,
|
|
423
|
+
dirName: null,
|
|
424
|
+
disabled: boolean,
|
|
425
|
+
download: overloadedBoolean,
|
|
426
|
+
draggable: booleanish,
|
|
427
|
+
encType: null,
|
|
428
|
+
enterKeyHint: null,
|
|
429
|
+
fetchPriority: null,
|
|
430
|
+
form: null,
|
|
431
|
+
formAction: null,
|
|
432
|
+
formEncType: null,
|
|
433
|
+
formMethod: null,
|
|
434
|
+
formNoValidate: boolean,
|
|
435
|
+
formTarget: null,
|
|
436
|
+
headers: spaceSeparated,
|
|
437
|
+
height: number,
|
|
438
|
+
hidden: overloadedBoolean,
|
|
439
|
+
high: number,
|
|
440
|
+
href: null,
|
|
441
|
+
hrefLang: null,
|
|
442
|
+
htmlFor: spaceSeparated,
|
|
443
|
+
httpEquiv: spaceSeparated,
|
|
444
|
+
id: null,
|
|
445
|
+
imageSizes: null,
|
|
446
|
+
imageSrcSet: null,
|
|
447
|
+
inert: boolean,
|
|
448
|
+
inputMode: null,
|
|
449
|
+
integrity: null,
|
|
450
|
+
is: null,
|
|
451
|
+
isMap: boolean,
|
|
452
|
+
itemId: null,
|
|
453
|
+
itemProp: spaceSeparated,
|
|
454
|
+
itemRef: spaceSeparated,
|
|
455
|
+
itemScope: boolean,
|
|
456
|
+
itemType: spaceSeparated,
|
|
457
|
+
kind: null,
|
|
458
|
+
label: null,
|
|
459
|
+
lang: null,
|
|
460
|
+
language: null,
|
|
461
|
+
list: null,
|
|
462
|
+
loading: null,
|
|
463
|
+
loop: boolean,
|
|
464
|
+
low: number,
|
|
465
|
+
manifest: null,
|
|
466
|
+
max: null,
|
|
467
|
+
maxLength: number,
|
|
468
|
+
media: null,
|
|
469
|
+
method: null,
|
|
470
|
+
min: null,
|
|
471
|
+
minLength: number,
|
|
472
|
+
multiple: boolean,
|
|
473
|
+
muted: boolean,
|
|
474
|
+
name: null,
|
|
475
|
+
nonce: null,
|
|
476
|
+
noModule: boolean,
|
|
477
|
+
noValidate: boolean,
|
|
478
|
+
onAbort: null,
|
|
479
|
+
onAfterPrint: null,
|
|
480
|
+
onAuxClick: null,
|
|
481
|
+
onBeforeMatch: null,
|
|
482
|
+
onBeforePrint: null,
|
|
483
|
+
onBeforeToggle: null,
|
|
484
|
+
onBeforeUnload: null,
|
|
485
|
+
onBlur: null,
|
|
486
|
+
onCancel: null,
|
|
487
|
+
onCanPlay: null,
|
|
488
|
+
onCanPlayThrough: null,
|
|
489
|
+
onChange: null,
|
|
490
|
+
onClick: null,
|
|
491
|
+
onClose: null,
|
|
492
|
+
onContextLost: null,
|
|
493
|
+
onContextMenu: null,
|
|
494
|
+
onContextRestored: null,
|
|
495
|
+
onCopy: null,
|
|
496
|
+
onCueChange: null,
|
|
497
|
+
onCut: null,
|
|
498
|
+
onDblClick: null,
|
|
499
|
+
onDrag: null,
|
|
500
|
+
onDragEnd: null,
|
|
501
|
+
onDragEnter: null,
|
|
502
|
+
onDragExit: null,
|
|
503
|
+
onDragLeave: null,
|
|
504
|
+
onDragOver: null,
|
|
505
|
+
onDragStart: null,
|
|
506
|
+
onDrop: null,
|
|
507
|
+
onDurationChange: null,
|
|
508
|
+
onEmptied: null,
|
|
509
|
+
onEnded: null,
|
|
510
|
+
onError: null,
|
|
511
|
+
onFocus: null,
|
|
512
|
+
onFormData: null,
|
|
513
|
+
onHashChange: null,
|
|
514
|
+
onInput: null,
|
|
515
|
+
onInvalid: null,
|
|
516
|
+
onKeyDown: null,
|
|
517
|
+
onKeyPress: null,
|
|
518
|
+
onKeyUp: null,
|
|
519
|
+
onLanguageChange: null,
|
|
520
|
+
onLoad: null,
|
|
521
|
+
onLoadedData: null,
|
|
522
|
+
onLoadedMetadata: null,
|
|
523
|
+
onLoadEnd: null,
|
|
524
|
+
onLoadStart: null,
|
|
525
|
+
onMessage: null,
|
|
526
|
+
onMessageError: null,
|
|
527
|
+
onMouseDown: null,
|
|
528
|
+
onMouseEnter: null,
|
|
529
|
+
onMouseLeave: null,
|
|
530
|
+
onMouseMove: null,
|
|
531
|
+
onMouseOut: null,
|
|
532
|
+
onMouseOver: null,
|
|
533
|
+
onMouseUp: null,
|
|
534
|
+
onOffline: null,
|
|
535
|
+
onOnline: null,
|
|
536
|
+
onPageHide: null,
|
|
537
|
+
onPageShow: null,
|
|
538
|
+
onPaste: null,
|
|
539
|
+
onPause: null,
|
|
540
|
+
onPlay: null,
|
|
541
|
+
onPlaying: null,
|
|
542
|
+
onPopState: null,
|
|
543
|
+
onProgress: null,
|
|
544
|
+
onRateChange: null,
|
|
545
|
+
onRejectionHandled: null,
|
|
546
|
+
onReset: null,
|
|
547
|
+
onResize: null,
|
|
548
|
+
onScroll: null,
|
|
549
|
+
onScrollEnd: null,
|
|
550
|
+
onSecurityPolicyViolation: null,
|
|
551
|
+
onSeeked: null,
|
|
552
|
+
onSeeking: null,
|
|
553
|
+
onSelect: null,
|
|
554
|
+
onSlotChange: null,
|
|
555
|
+
onStalled: null,
|
|
556
|
+
onStorage: null,
|
|
557
|
+
onSubmit: null,
|
|
558
|
+
onSuspend: null,
|
|
559
|
+
onTimeUpdate: null,
|
|
560
|
+
onToggle: null,
|
|
561
|
+
onUnhandledRejection: null,
|
|
562
|
+
onUnload: null,
|
|
563
|
+
onVolumeChange: null,
|
|
564
|
+
onWaiting: null,
|
|
565
|
+
onWheel: null,
|
|
566
|
+
open: boolean,
|
|
567
|
+
optimum: number,
|
|
568
|
+
pattern: null,
|
|
569
|
+
ping: spaceSeparated,
|
|
570
|
+
placeholder: null,
|
|
571
|
+
playsInline: boolean,
|
|
572
|
+
popover: null,
|
|
573
|
+
popoverTarget: null,
|
|
574
|
+
popoverTargetAction: null,
|
|
575
|
+
poster: null,
|
|
576
|
+
preload: null,
|
|
577
|
+
readOnly: boolean,
|
|
578
|
+
referrerPolicy: null,
|
|
579
|
+
rel: spaceSeparated,
|
|
580
|
+
required: boolean,
|
|
581
|
+
reversed: boolean,
|
|
582
|
+
rows: number,
|
|
583
|
+
rowSpan: number,
|
|
584
|
+
sandbox: spaceSeparated,
|
|
585
|
+
scope: null,
|
|
586
|
+
scoped: boolean,
|
|
587
|
+
seamless: boolean,
|
|
588
|
+
selected: boolean,
|
|
589
|
+
shadowRootClonable: boolean,
|
|
590
|
+
shadowRootCustomElementRegistry: boolean,
|
|
591
|
+
shadowRootDelegatesFocus: boolean,
|
|
592
|
+
shadowRootMode: null,
|
|
593
|
+
shadowRootSerializable: boolean,
|
|
594
|
+
shape: null,
|
|
595
|
+
size: number,
|
|
596
|
+
sizes: null,
|
|
597
|
+
slot: null,
|
|
598
|
+
span: number,
|
|
599
|
+
spellCheck: booleanish,
|
|
600
|
+
src: null,
|
|
601
|
+
srcDoc: null,
|
|
602
|
+
srcLang: null,
|
|
603
|
+
srcSet: null,
|
|
604
|
+
start: number,
|
|
605
|
+
step: null,
|
|
606
|
+
style: null,
|
|
607
|
+
tabIndex: number,
|
|
608
|
+
target: null,
|
|
609
|
+
title: null,
|
|
610
|
+
translate: null,
|
|
611
|
+
type: null,
|
|
612
|
+
typeMustMatch: boolean,
|
|
613
|
+
useMap: null,
|
|
614
|
+
value: booleanish,
|
|
615
|
+
width: number,
|
|
616
|
+
wrap: null,
|
|
617
|
+
writingSuggestions: null,
|
|
618
|
+
align: null,
|
|
619
|
+
aLink: null,
|
|
620
|
+
archive: spaceSeparated,
|
|
621
|
+
axis: null,
|
|
622
|
+
background: null,
|
|
623
|
+
bgColor: null,
|
|
624
|
+
border: number,
|
|
625
|
+
borderColor: null,
|
|
626
|
+
bottomMargin: number,
|
|
627
|
+
cellPadding: null,
|
|
628
|
+
cellSpacing: null,
|
|
629
|
+
char: null,
|
|
630
|
+
charOff: null,
|
|
631
|
+
classId: null,
|
|
632
|
+
clear: null,
|
|
633
|
+
code: null,
|
|
634
|
+
codeBase: null,
|
|
635
|
+
codeType: null,
|
|
636
|
+
color: null,
|
|
637
|
+
compact: boolean,
|
|
638
|
+
declare: boolean,
|
|
639
|
+
event: null,
|
|
640
|
+
face: null,
|
|
641
|
+
frame: null,
|
|
642
|
+
frameBorder: null,
|
|
643
|
+
hSpace: number,
|
|
644
|
+
leftMargin: number,
|
|
645
|
+
link: null,
|
|
646
|
+
longDesc: null,
|
|
647
|
+
lowSrc: null,
|
|
648
|
+
marginHeight: number,
|
|
649
|
+
marginWidth: number,
|
|
650
|
+
noResize: boolean,
|
|
651
|
+
noHref: boolean,
|
|
652
|
+
noShade: boolean,
|
|
653
|
+
noWrap: boolean,
|
|
654
|
+
object: null,
|
|
655
|
+
profile: null,
|
|
656
|
+
prompt: null,
|
|
657
|
+
rev: null,
|
|
658
|
+
rightMargin: number,
|
|
659
|
+
rules: null,
|
|
660
|
+
scheme: null,
|
|
661
|
+
scrolling: booleanish,
|
|
662
|
+
standby: null,
|
|
663
|
+
summary: null,
|
|
664
|
+
text: null,
|
|
665
|
+
topMargin: number,
|
|
666
|
+
valueType: null,
|
|
667
|
+
version: null,
|
|
668
|
+
vAlign: null,
|
|
669
|
+
vLink: null,
|
|
670
|
+
vSpace: number,
|
|
671
|
+
allowTransparency: null,
|
|
672
|
+
autoCorrect: null,
|
|
673
|
+
autoSave: null,
|
|
674
|
+
credentialless: boolean,
|
|
675
|
+
disablePictureInPicture: boolean,
|
|
676
|
+
disableRemotePlayback: boolean,
|
|
677
|
+
exportParts: commaSeparated,
|
|
678
|
+
part: spaceSeparated,
|
|
679
|
+
prefix: null,
|
|
680
|
+
property: null,
|
|
681
|
+
results: number,
|
|
682
|
+
security: null,
|
|
683
|
+
unselectable: null
|
|
684
|
+
},
|
|
685
|
+
space: "html",
|
|
686
|
+
transform: caseInsensitiveTransform
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
//#endregion
|
|
690
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/svg.js
|
|
691
|
+
const svg$1 = create({
|
|
692
|
+
attributes: {
|
|
693
|
+
accentHeight: "accent-height",
|
|
694
|
+
alignmentBaseline: "alignment-baseline",
|
|
695
|
+
arabicForm: "arabic-form",
|
|
696
|
+
baselineShift: "baseline-shift",
|
|
697
|
+
capHeight: "cap-height",
|
|
698
|
+
className: "class",
|
|
699
|
+
clipPath: "clip-path",
|
|
700
|
+
clipRule: "clip-rule",
|
|
701
|
+
colorInterpolation: "color-interpolation",
|
|
702
|
+
colorInterpolationFilters: "color-interpolation-filters",
|
|
703
|
+
colorProfile: "color-profile",
|
|
704
|
+
colorRendering: "color-rendering",
|
|
705
|
+
crossOrigin: "crossorigin",
|
|
706
|
+
dataType: "datatype",
|
|
707
|
+
dominantBaseline: "dominant-baseline",
|
|
708
|
+
enableBackground: "enable-background",
|
|
709
|
+
fillOpacity: "fill-opacity",
|
|
710
|
+
fillRule: "fill-rule",
|
|
711
|
+
floodColor: "flood-color",
|
|
712
|
+
floodOpacity: "flood-opacity",
|
|
713
|
+
fontFamily: "font-family",
|
|
714
|
+
fontSize: "font-size",
|
|
715
|
+
fontSizeAdjust: "font-size-adjust",
|
|
716
|
+
fontStretch: "font-stretch",
|
|
717
|
+
fontStyle: "font-style",
|
|
718
|
+
fontVariant: "font-variant",
|
|
719
|
+
fontWeight: "font-weight",
|
|
720
|
+
glyphName: "glyph-name",
|
|
721
|
+
glyphOrientationHorizontal: "glyph-orientation-horizontal",
|
|
722
|
+
glyphOrientationVertical: "glyph-orientation-vertical",
|
|
723
|
+
hrefLang: "hreflang",
|
|
724
|
+
horizAdvX: "horiz-adv-x",
|
|
725
|
+
horizOriginX: "horiz-origin-x",
|
|
726
|
+
horizOriginY: "horiz-origin-y",
|
|
727
|
+
imageRendering: "image-rendering",
|
|
728
|
+
letterSpacing: "letter-spacing",
|
|
729
|
+
lightingColor: "lighting-color",
|
|
730
|
+
markerEnd: "marker-end",
|
|
731
|
+
markerMid: "marker-mid",
|
|
732
|
+
markerStart: "marker-start",
|
|
733
|
+
maskType: "mask-type",
|
|
734
|
+
navDown: "nav-down",
|
|
735
|
+
navDownLeft: "nav-down-left",
|
|
736
|
+
navDownRight: "nav-down-right",
|
|
737
|
+
navLeft: "nav-left",
|
|
738
|
+
navNext: "nav-next",
|
|
739
|
+
navPrev: "nav-prev",
|
|
740
|
+
navRight: "nav-right",
|
|
741
|
+
navUp: "nav-up",
|
|
742
|
+
navUpLeft: "nav-up-left",
|
|
743
|
+
navUpRight: "nav-up-right",
|
|
744
|
+
onAbort: "onabort",
|
|
745
|
+
onActivate: "onactivate",
|
|
746
|
+
onAfterPrint: "onafterprint",
|
|
747
|
+
onBeforePrint: "onbeforeprint",
|
|
748
|
+
onBegin: "onbegin",
|
|
749
|
+
onCancel: "oncancel",
|
|
750
|
+
onCanPlay: "oncanplay",
|
|
751
|
+
onCanPlayThrough: "oncanplaythrough",
|
|
752
|
+
onChange: "onchange",
|
|
753
|
+
onClick: "onclick",
|
|
754
|
+
onClose: "onclose",
|
|
755
|
+
onCopy: "oncopy",
|
|
756
|
+
onCueChange: "oncuechange",
|
|
757
|
+
onCut: "oncut",
|
|
758
|
+
onDblClick: "ondblclick",
|
|
759
|
+
onDrag: "ondrag",
|
|
760
|
+
onDragEnd: "ondragend",
|
|
761
|
+
onDragEnter: "ondragenter",
|
|
762
|
+
onDragExit: "ondragexit",
|
|
763
|
+
onDragLeave: "ondragleave",
|
|
764
|
+
onDragOver: "ondragover",
|
|
765
|
+
onDragStart: "ondragstart",
|
|
766
|
+
onDrop: "ondrop",
|
|
767
|
+
onDurationChange: "ondurationchange",
|
|
768
|
+
onEmptied: "onemptied",
|
|
769
|
+
onEnd: "onend",
|
|
770
|
+
onEnded: "onended",
|
|
771
|
+
onError: "onerror",
|
|
772
|
+
onFocus: "onfocus",
|
|
773
|
+
onFocusIn: "onfocusin",
|
|
774
|
+
onFocusOut: "onfocusout",
|
|
775
|
+
onHashChange: "onhashchange",
|
|
776
|
+
onInput: "oninput",
|
|
777
|
+
onInvalid: "oninvalid",
|
|
778
|
+
onKeyDown: "onkeydown",
|
|
779
|
+
onKeyPress: "onkeypress",
|
|
780
|
+
onKeyUp: "onkeyup",
|
|
781
|
+
onLoad: "onload",
|
|
782
|
+
onLoadedData: "onloadeddata",
|
|
783
|
+
onLoadedMetadata: "onloadedmetadata",
|
|
784
|
+
onLoadStart: "onloadstart",
|
|
785
|
+
onMessage: "onmessage",
|
|
786
|
+
onMouseDown: "onmousedown",
|
|
787
|
+
onMouseEnter: "onmouseenter",
|
|
788
|
+
onMouseLeave: "onmouseleave",
|
|
789
|
+
onMouseMove: "onmousemove",
|
|
790
|
+
onMouseOut: "onmouseout",
|
|
791
|
+
onMouseOver: "onmouseover",
|
|
792
|
+
onMouseUp: "onmouseup",
|
|
793
|
+
onMouseWheel: "onmousewheel",
|
|
794
|
+
onOffline: "onoffline",
|
|
795
|
+
onOnline: "ononline",
|
|
796
|
+
onPageHide: "onpagehide",
|
|
797
|
+
onPageShow: "onpageshow",
|
|
798
|
+
onPaste: "onpaste",
|
|
799
|
+
onPause: "onpause",
|
|
800
|
+
onPlay: "onplay",
|
|
801
|
+
onPlaying: "onplaying",
|
|
802
|
+
onPopState: "onpopstate",
|
|
803
|
+
onProgress: "onprogress",
|
|
804
|
+
onRateChange: "onratechange",
|
|
805
|
+
onRepeat: "onrepeat",
|
|
806
|
+
onReset: "onreset",
|
|
807
|
+
onResize: "onresize",
|
|
808
|
+
onScroll: "onscroll",
|
|
809
|
+
onSeeked: "onseeked",
|
|
810
|
+
onSeeking: "onseeking",
|
|
811
|
+
onSelect: "onselect",
|
|
812
|
+
onShow: "onshow",
|
|
813
|
+
onStalled: "onstalled",
|
|
814
|
+
onStorage: "onstorage",
|
|
815
|
+
onSubmit: "onsubmit",
|
|
816
|
+
onSuspend: "onsuspend",
|
|
817
|
+
onTimeUpdate: "ontimeupdate",
|
|
818
|
+
onToggle: "ontoggle",
|
|
819
|
+
onUnload: "onunload",
|
|
820
|
+
onVolumeChange: "onvolumechange",
|
|
821
|
+
onWaiting: "onwaiting",
|
|
822
|
+
onZoom: "onzoom",
|
|
823
|
+
overlinePosition: "overline-position",
|
|
824
|
+
overlineThickness: "overline-thickness",
|
|
825
|
+
paintOrder: "paint-order",
|
|
826
|
+
panose1: "panose-1",
|
|
827
|
+
pointerEvents: "pointer-events",
|
|
828
|
+
referrerPolicy: "referrerpolicy",
|
|
829
|
+
renderingIntent: "rendering-intent",
|
|
830
|
+
shapeRendering: "shape-rendering",
|
|
831
|
+
stopColor: "stop-color",
|
|
832
|
+
stopOpacity: "stop-opacity",
|
|
833
|
+
strikethroughPosition: "strikethrough-position",
|
|
834
|
+
strikethroughThickness: "strikethrough-thickness",
|
|
835
|
+
strokeDashArray: "stroke-dasharray",
|
|
836
|
+
strokeDashOffset: "stroke-dashoffset",
|
|
837
|
+
strokeLineCap: "stroke-linecap",
|
|
838
|
+
strokeLineJoin: "stroke-linejoin",
|
|
839
|
+
strokeMiterLimit: "stroke-miterlimit",
|
|
840
|
+
strokeOpacity: "stroke-opacity",
|
|
841
|
+
strokeWidth: "stroke-width",
|
|
842
|
+
tabIndex: "tabindex",
|
|
843
|
+
textAnchor: "text-anchor",
|
|
844
|
+
textDecoration: "text-decoration",
|
|
845
|
+
textRendering: "text-rendering",
|
|
846
|
+
transformOrigin: "transform-origin",
|
|
847
|
+
typeOf: "typeof",
|
|
848
|
+
underlinePosition: "underline-position",
|
|
849
|
+
underlineThickness: "underline-thickness",
|
|
850
|
+
unicodeBidi: "unicode-bidi",
|
|
851
|
+
unicodeRange: "unicode-range",
|
|
852
|
+
unitsPerEm: "units-per-em",
|
|
853
|
+
vAlphabetic: "v-alphabetic",
|
|
854
|
+
vHanging: "v-hanging",
|
|
855
|
+
vIdeographic: "v-ideographic",
|
|
856
|
+
vMathematical: "v-mathematical",
|
|
857
|
+
vectorEffect: "vector-effect",
|
|
858
|
+
vertAdvY: "vert-adv-y",
|
|
859
|
+
vertOriginX: "vert-origin-x",
|
|
860
|
+
vertOriginY: "vert-origin-y",
|
|
861
|
+
wordSpacing: "word-spacing",
|
|
862
|
+
writingMode: "writing-mode",
|
|
863
|
+
xHeight: "x-height",
|
|
864
|
+
playbackOrder: "playbackorder",
|
|
865
|
+
timelineBegin: "timelinebegin"
|
|
866
|
+
},
|
|
867
|
+
properties: {
|
|
868
|
+
about: commaOrSpaceSeparated,
|
|
869
|
+
accentHeight: number,
|
|
870
|
+
accumulate: null,
|
|
871
|
+
additive: null,
|
|
872
|
+
alignmentBaseline: null,
|
|
873
|
+
alphabetic: number,
|
|
874
|
+
amplitude: number,
|
|
875
|
+
arabicForm: null,
|
|
876
|
+
ascent: number,
|
|
877
|
+
attributeName: null,
|
|
878
|
+
attributeType: null,
|
|
879
|
+
azimuth: number,
|
|
880
|
+
bandwidth: null,
|
|
881
|
+
baselineShift: null,
|
|
882
|
+
baseFrequency: null,
|
|
883
|
+
baseProfile: null,
|
|
884
|
+
bbox: null,
|
|
885
|
+
begin: null,
|
|
886
|
+
bias: number,
|
|
887
|
+
by: null,
|
|
888
|
+
calcMode: null,
|
|
889
|
+
capHeight: number,
|
|
890
|
+
className: spaceSeparated,
|
|
891
|
+
clip: null,
|
|
892
|
+
clipPath: null,
|
|
893
|
+
clipPathUnits: null,
|
|
894
|
+
clipRule: null,
|
|
895
|
+
color: null,
|
|
896
|
+
colorInterpolation: null,
|
|
897
|
+
colorInterpolationFilters: null,
|
|
898
|
+
colorProfile: null,
|
|
899
|
+
colorRendering: null,
|
|
900
|
+
content: null,
|
|
901
|
+
contentScriptType: null,
|
|
902
|
+
contentStyleType: null,
|
|
903
|
+
crossOrigin: null,
|
|
904
|
+
cursor: null,
|
|
905
|
+
cx: null,
|
|
906
|
+
cy: null,
|
|
907
|
+
d: null,
|
|
908
|
+
dataType: null,
|
|
909
|
+
defaultAction: null,
|
|
910
|
+
descent: number,
|
|
911
|
+
diffuseConstant: number,
|
|
912
|
+
direction: null,
|
|
913
|
+
display: null,
|
|
914
|
+
dur: null,
|
|
915
|
+
divisor: number,
|
|
916
|
+
dominantBaseline: null,
|
|
917
|
+
download: boolean,
|
|
918
|
+
dx: null,
|
|
919
|
+
dy: null,
|
|
920
|
+
edgeMode: null,
|
|
921
|
+
editable: null,
|
|
922
|
+
elevation: number,
|
|
923
|
+
enableBackground: null,
|
|
924
|
+
end: null,
|
|
925
|
+
event: null,
|
|
926
|
+
exponent: number,
|
|
927
|
+
externalResourcesRequired: null,
|
|
928
|
+
fill: null,
|
|
929
|
+
fillOpacity: number,
|
|
930
|
+
fillRule: null,
|
|
931
|
+
filter: null,
|
|
932
|
+
filterRes: null,
|
|
933
|
+
filterUnits: null,
|
|
934
|
+
floodColor: null,
|
|
935
|
+
floodOpacity: null,
|
|
936
|
+
focusable: null,
|
|
937
|
+
focusHighlight: null,
|
|
938
|
+
fontFamily: null,
|
|
939
|
+
fontSize: null,
|
|
940
|
+
fontSizeAdjust: null,
|
|
941
|
+
fontStretch: null,
|
|
942
|
+
fontStyle: null,
|
|
943
|
+
fontVariant: null,
|
|
944
|
+
fontWeight: null,
|
|
945
|
+
format: null,
|
|
946
|
+
fr: null,
|
|
947
|
+
from: null,
|
|
948
|
+
fx: null,
|
|
949
|
+
fy: null,
|
|
950
|
+
g1: commaSeparated,
|
|
951
|
+
g2: commaSeparated,
|
|
952
|
+
glyphName: commaSeparated,
|
|
953
|
+
glyphOrientationHorizontal: null,
|
|
954
|
+
glyphOrientationVertical: null,
|
|
955
|
+
glyphRef: null,
|
|
956
|
+
gradientTransform: null,
|
|
957
|
+
gradientUnits: null,
|
|
958
|
+
handler: null,
|
|
959
|
+
hanging: number,
|
|
960
|
+
hatchContentUnits: null,
|
|
961
|
+
hatchUnits: null,
|
|
962
|
+
height: null,
|
|
963
|
+
href: null,
|
|
964
|
+
hrefLang: null,
|
|
965
|
+
horizAdvX: number,
|
|
966
|
+
horizOriginX: number,
|
|
967
|
+
horizOriginY: number,
|
|
968
|
+
id: null,
|
|
969
|
+
ideographic: number,
|
|
970
|
+
imageRendering: null,
|
|
971
|
+
initialVisibility: null,
|
|
972
|
+
in: null,
|
|
973
|
+
in2: null,
|
|
974
|
+
intercept: number,
|
|
975
|
+
k: number,
|
|
976
|
+
k1: number,
|
|
977
|
+
k2: number,
|
|
978
|
+
k3: number,
|
|
979
|
+
k4: number,
|
|
980
|
+
kernelMatrix: commaOrSpaceSeparated,
|
|
981
|
+
kernelUnitLength: null,
|
|
982
|
+
keyPoints: null,
|
|
983
|
+
keySplines: null,
|
|
984
|
+
keyTimes: null,
|
|
985
|
+
kerning: null,
|
|
986
|
+
lang: null,
|
|
987
|
+
lengthAdjust: null,
|
|
988
|
+
letterSpacing: null,
|
|
989
|
+
lightingColor: null,
|
|
990
|
+
limitingConeAngle: number,
|
|
991
|
+
local: null,
|
|
992
|
+
markerEnd: null,
|
|
993
|
+
markerMid: null,
|
|
994
|
+
markerStart: null,
|
|
995
|
+
markerHeight: null,
|
|
996
|
+
markerUnits: null,
|
|
997
|
+
markerWidth: null,
|
|
998
|
+
mask: null,
|
|
999
|
+
maskContentUnits: null,
|
|
1000
|
+
maskType: null,
|
|
1001
|
+
maskUnits: null,
|
|
1002
|
+
mathematical: null,
|
|
1003
|
+
max: null,
|
|
1004
|
+
media: null,
|
|
1005
|
+
mediaCharacterEncoding: null,
|
|
1006
|
+
mediaContentEncodings: null,
|
|
1007
|
+
mediaSize: number,
|
|
1008
|
+
mediaTime: null,
|
|
1009
|
+
method: null,
|
|
1010
|
+
min: null,
|
|
1011
|
+
mode: null,
|
|
1012
|
+
name: null,
|
|
1013
|
+
navDown: null,
|
|
1014
|
+
navDownLeft: null,
|
|
1015
|
+
navDownRight: null,
|
|
1016
|
+
navLeft: null,
|
|
1017
|
+
navNext: null,
|
|
1018
|
+
navPrev: null,
|
|
1019
|
+
navRight: null,
|
|
1020
|
+
navUp: null,
|
|
1021
|
+
navUpLeft: null,
|
|
1022
|
+
navUpRight: null,
|
|
1023
|
+
numOctaves: null,
|
|
1024
|
+
observer: null,
|
|
1025
|
+
offset: null,
|
|
1026
|
+
onAbort: null,
|
|
1027
|
+
onActivate: null,
|
|
1028
|
+
onAfterPrint: null,
|
|
1029
|
+
onBeforePrint: null,
|
|
1030
|
+
onBegin: null,
|
|
1031
|
+
onCancel: null,
|
|
1032
|
+
onCanPlay: null,
|
|
1033
|
+
onCanPlayThrough: null,
|
|
1034
|
+
onChange: null,
|
|
1035
|
+
onClick: null,
|
|
1036
|
+
onClose: null,
|
|
1037
|
+
onCopy: null,
|
|
1038
|
+
onCueChange: null,
|
|
1039
|
+
onCut: null,
|
|
1040
|
+
onDblClick: null,
|
|
1041
|
+
onDrag: null,
|
|
1042
|
+
onDragEnd: null,
|
|
1043
|
+
onDragEnter: null,
|
|
1044
|
+
onDragExit: null,
|
|
1045
|
+
onDragLeave: null,
|
|
1046
|
+
onDragOver: null,
|
|
1047
|
+
onDragStart: null,
|
|
1048
|
+
onDrop: null,
|
|
1049
|
+
onDurationChange: null,
|
|
1050
|
+
onEmptied: null,
|
|
1051
|
+
onEnd: null,
|
|
1052
|
+
onEnded: null,
|
|
1053
|
+
onError: null,
|
|
1054
|
+
onFocus: null,
|
|
1055
|
+
onFocusIn: null,
|
|
1056
|
+
onFocusOut: null,
|
|
1057
|
+
onHashChange: null,
|
|
1058
|
+
onInput: null,
|
|
1059
|
+
onInvalid: null,
|
|
1060
|
+
onKeyDown: null,
|
|
1061
|
+
onKeyPress: null,
|
|
1062
|
+
onKeyUp: null,
|
|
1063
|
+
onLoad: null,
|
|
1064
|
+
onLoadedData: null,
|
|
1065
|
+
onLoadedMetadata: null,
|
|
1066
|
+
onLoadStart: null,
|
|
1067
|
+
onMessage: null,
|
|
1068
|
+
onMouseDown: null,
|
|
1069
|
+
onMouseEnter: null,
|
|
1070
|
+
onMouseLeave: null,
|
|
1071
|
+
onMouseMove: null,
|
|
1072
|
+
onMouseOut: null,
|
|
1073
|
+
onMouseOver: null,
|
|
1074
|
+
onMouseUp: null,
|
|
1075
|
+
onMouseWheel: null,
|
|
1076
|
+
onOffline: null,
|
|
1077
|
+
onOnline: null,
|
|
1078
|
+
onPageHide: null,
|
|
1079
|
+
onPageShow: null,
|
|
1080
|
+
onPaste: null,
|
|
1081
|
+
onPause: null,
|
|
1082
|
+
onPlay: null,
|
|
1083
|
+
onPlaying: null,
|
|
1084
|
+
onPopState: null,
|
|
1085
|
+
onProgress: null,
|
|
1086
|
+
onRateChange: null,
|
|
1087
|
+
onRepeat: null,
|
|
1088
|
+
onReset: null,
|
|
1089
|
+
onResize: null,
|
|
1090
|
+
onScroll: null,
|
|
1091
|
+
onSeeked: null,
|
|
1092
|
+
onSeeking: null,
|
|
1093
|
+
onSelect: null,
|
|
1094
|
+
onShow: null,
|
|
1095
|
+
onStalled: null,
|
|
1096
|
+
onStorage: null,
|
|
1097
|
+
onSubmit: null,
|
|
1098
|
+
onSuspend: null,
|
|
1099
|
+
onTimeUpdate: null,
|
|
1100
|
+
onToggle: null,
|
|
1101
|
+
onUnload: null,
|
|
1102
|
+
onVolumeChange: null,
|
|
1103
|
+
onWaiting: null,
|
|
1104
|
+
onZoom: null,
|
|
1105
|
+
opacity: null,
|
|
1106
|
+
operator: null,
|
|
1107
|
+
order: null,
|
|
1108
|
+
orient: null,
|
|
1109
|
+
orientation: null,
|
|
1110
|
+
origin: null,
|
|
1111
|
+
overflow: null,
|
|
1112
|
+
overlay: null,
|
|
1113
|
+
overlinePosition: number,
|
|
1114
|
+
overlineThickness: number,
|
|
1115
|
+
paintOrder: null,
|
|
1116
|
+
panose1: null,
|
|
1117
|
+
path: null,
|
|
1118
|
+
pathLength: number,
|
|
1119
|
+
patternContentUnits: null,
|
|
1120
|
+
patternTransform: null,
|
|
1121
|
+
patternUnits: null,
|
|
1122
|
+
phase: null,
|
|
1123
|
+
ping: spaceSeparated,
|
|
1124
|
+
pitch: null,
|
|
1125
|
+
playbackOrder: null,
|
|
1126
|
+
pointerEvents: null,
|
|
1127
|
+
points: null,
|
|
1128
|
+
pointsAtX: number,
|
|
1129
|
+
pointsAtY: number,
|
|
1130
|
+
pointsAtZ: number,
|
|
1131
|
+
preserveAlpha: null,
|
|
1132
|
+
preserveAspectRatio: null,
|
|
1133
|
+
primitiveUnits: null,
|
|
1134
|
+
propagate: null,
|
|
1135
|
+
property: commaOrSpaceSeparated,
|
|
1136
|
+
r: null,
|
|
1137
|
+
radius: null,
|
|
1138
|
+
referrerPolicy: null,
|
|
1139
|
+
refX: null,
|
|
1140
|
+
refY: null,
|
|
1141
|
+
rel: commaOrSpaceSeparated,
|
|
1142
|
+
rev: commaOrSpaceSeparated,
|
|
1143
|
+
renderingIntent: null,
|
|
1144
|
+
repeatCount: null,
|
|
1145
|
+
repeatDur: null,
|
|
1146
|
+
requiredExtensions: commaOrSpaceSeparated,
|
|
1147
|
+
requiredFeatures: commaOrSpaceSeparated,
|
|
1148
|
+
requiredFonts: commaOrSpaceSeparated,
|
|
1149
|
+
requiredFormats: commaOrSpaceSeparated,
|
|
1150
|
+
resource: null,
|
|
1151
|
+
restart: null,
|
|
1152
|
+
result: null,
|
|
1153
|
+
rotate: null,
|
|
1154
|
+
rx: null,
|
|
1155
|
+
ry: null,
|
|
1156
|
+
scale: null,
|
|
1157
|
+
seed: null,
|
|
1158
|
+
shapeRendering: null,
|
|
1159
|
+
side: null,
|
|
1160
|
+
slope: null,
|
|
1161
|
+
snapshotTime: null,
|
|
1162
|
+
specularConstant: number,
|
|
1163
|
+
specularExponent: number,
|
|
1164
|
+
spreadMethod: null,
|
|
1165
|
+
spacing: null,
|
|
1166
|
+
startOffset: null,
|
|
1167
|
+
stdDeviation: null,
|
|
1168
|
+
stemh: null,
|
|
1169
|
+
stemv: null,
|
|
1170
|
+
stitchTiles: null,
|
|
1171
|
+
stopColor: null,
|
|
1172
|
+
stopOpacity: null,
|
|
1173
|
+
strikethroughPosition: number,
|
|
1174
|
+
strikethroughThickness: number,
|
|
1175
|
+
string: null,
|
|
1176
|
+
stroke: null,
|
|
1177
|
+
strokeDashArray: commaOrSpaceSeparated,
|
|
1178
|
+
strokeDashOffset: null,
|
|
1179
|
+
strokeLineCap: null,
|
|
1180
|
+
strokeLineJoin: null,
|
|
1181
|
+
strokeMiterLimit: number,
|
|
1182
|
+
strokeOpacity: number,
|
|
1183
|
+
strokeWidth: null,
|
|
1184
|
+
style: null,
|
|
1185
|
+
surfaceScale: number,
|
|
1186
|
+
syncBehavior: null,
|
|
1187
|
+
syncBehaviorDefault: null,
|
|
1188
|
+
syncMaster: null,
|
|
1189
|
+
syncTolerance: null,
|
|
1190
|
+
syncToleranceDefault: null,
|
|
1191
|
+
systemLanguage: commaOrSpaceSeparated,
|
|
1192
|
+
tabIndex: number,
|
|
1193
|
+
tableValues: null,
|
|
1194
|
+
target: null,
|
|
1195
|
+
targetX: number,
|
|
1196
|
+
targetY: number,
|
|
1197
|
+
textAnchor: null,
|
|
1198
|
+
textDecoration: null,
|
|
1199
|
+
textRendering: null,
|
|
1200
|
+
textLength: null,
|
|
1201
|
+
timelineBegin: null,
|
|
1202
|
+
title: null,
|
|
1203
|
+
transformBehavior: null,
|
|
1204
|
+
type: null,
|
|
1205
|
+
typeOf: commaOrSpaceSeparated,
|
|
1206
|
+
to: null,
|
|
1207
|
+
transform: null,
|
|
1208
|
+
transformOrigin: null,
|
|
1209
|
+
u1: null,
|
|
1210
|
+
u2: null,
|
|
1211
|
+
underlinePosition: number,
|
|
1212
|
+
underlineThickness: number,
|
|
1213
|
+
unicode: null,
|
|
1214
|
+
unicodeBidi: null,
|
|
1215
|
+
unicodeRange: null,
|
|
1216
|
+
unitsPerEm: number,
|
|
1217
|
+
values: null,
|
|
1218
|
+
vAlphabetic: number,
|
|
1219
|
+
vMathematical: number,
|
|
1220
|
+
vectorEffect: null,
|
|
1221
|
+
vHanging: number,
|
|
1222
|
+
vIdeographic: number,
|
|
1223
|
+
version: null,
|
|
1224
|
+
vertAdvY: number,
|
|
1225
|
+
vertOriginX: number,
|
|
1226
|
+
vertOriginY: number,
|
|
1227
|
+
viewBox: null,
|
|
1228
|
+
viewTarget: null,
|
|
1229
|
+
visibility: null,
|
|
1230
|
+
width: null,
|
|
1231
|
+
widths: null,
|
|
1232
|
+
wordSpacing: null,
|
|
1233
|
+
writingMode: null,
|
|
1234
|
+
x: null,
|
|
1235
|
+
x1: null,
|
|
1236
|
+
x2: null,
|
|
1237
|
+
xChannelSelector: null,
|
|
1238
|
+
xHeight: number,
|
|
1239
|
+
y: null,
|
|
1240
|
+
y1: null,
|
|
1241
|
+
y2: null,
|
|
1242
|
+
yChannelSelector: null,
|
|
1243
|
+
z: null,
|
|
1244
|
+
zoomAndPan: null
|
|
1245
|
+
},
|
|
1246
|
+
space: "svg",
|
|
1247
|
+
transform: caseSensitiveTransform
|
|
1248
|
+
});
|
|
1249
|
+
|
|
1250
|
+
//#endregion
|
|
1251
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/xlink.js
|
|
1252
|
+
const xlink = create({
|
|
1253
|
+
properties: {
|
|
1254
|
+
xLinkActuate: null,
|
|
1255
|
+
xLinkArcRole: null,
|
|
1256
|
+
xLinkHref: null,
|
|
1257
|
+
xLinkRole: null,
|
|
1258
|
+
xLinkShow: null,
|
|
1259
|
+
xLinkTitle: null,
|
|
1260
|
+
xLinkType: null
|
|
1261
|
+
},
|
|
1262
|
+
space: "xlink",
|
|
1263
|
+
transform(_, property) {
|
|
1264
|
+
return "xlink:" + property.slice(5).toLowerCase();
|
|
1265
|
+
}
|
|
1266
|
+
});
|
|
1267
|
+
|
|
1268
|
+
//#endregion
|
|
1269
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/xmlns.js
|
|
1270
|
+
const xmlns = create({
|
|
1271
|
+
attributes: { xmlnsxlink: "xmlns:xlink" },
|
|
1272
|
+
properties: {
|
|
1273
|
+
xmlnsXLink: null,
|
|
1274
|
+
xmlns: null
|
|
1275
|
+
},
|
|
1276
|
+
space: "xmlns",
|
|
1277
|
+
transform: caseInsensitiveTransform
|
|
1278
|
+
});
|
|
1279
|
+
|
|
1280
|
+
//#endregion
|
|
1281
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/xml.js
|
|
1282
|
+
const xml = create({
|
|
1283
|
+
properties: {
|
|
1284
|
+
xmlBase: null,
|
|
1285
|
+
xmlLang: null,
|
|
1286
|
+
xmlSpace: null
|
|
1287
|
+
},
|
|
1288
|
+
space: "xml",
|
|
1289
|
+
transform(_, property) {
|
|
1290
|
+
return "xml:" + property.slice(3).toLowerCase();
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1293
|
+
|
|
1294
|
+
//#endregion
|
|
1295
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/find.js
|
|
1296
|
+
/**
|
|
1297
|
+
* @import {Schema} from 'property-information'
|
|
1298
|
+
*/
|
|
1299
|
+
const cap = /[A-Z]/g;
|
|
1300
|
+
const dash = /-[a-z]/g;
|
|
1301
|
+
const valid = /^data[-\w.:]+$/i;
|
|
1302
|
+
/**
|
|
1303
|
+
* Look up info on a property.
|
|
1304
|
+
*
|
|
1305
|
+
* In most cases the given `schema` contains info on the property.
|
|
1306
|
+
* All standard,
|
|
1307
|
+
* most legacy,
|
|
1308
|
+
* and some non-standard properties are supported.
|
|
1309
|
+
* For these cases,
|
|
1310
|
+
* the returned `Info` has hints about the value of the property.
|
|
1311
|
+
*
|
|
1312
|
+
* `name` can also be a valid data attribute or property,
|
|
1313
|
+
* in which case an `Info` object with the correctly cased `attribute` and
|
|
1314
|
+
* `property` is returned.
|
|
1315
|
+
*
|
|
1316
|
+
* `name` can be an unknown attribute,
|
|
1317
|
+
* in which case an `Info` object with `attribute` and `property` set to the
|
|
1318
|
+
* given name is returned.
|
|
1319
|
+
* It is not recommended to provide unsupported legacy or recently specced
|
|
1320
|
+
* properties.
|
|
1321
|
+
*
|
|
1322
|
+
*
|
|
1323
|
+
* @param {Schema} schema
|
|
1324
|
+
* Schema;
|
|
1325
|
+
* either the `html` or `svg` export.
|
|
1326
|
+
* @param {string} value
|
|
1327
|
+
* An attribute-like or property-like name;
|
|
1328
|
+
* it will be passed through `normalize` to hopefully find the correct info.
|
|
1329
|
+
* @returns {Info}
|
|
1330
|
+
* Info.
|
|
1331
|
+
*/
|
|
1332
|
+
function find(schema, value) {
|
|
1333
|
+
const normal = normalize(value);
|
|
1334
|
+
let property = value;
|
|
1335
|
+
let Type = Info;
|
|
1336
|
+
if (normal in schema.normal) return schema.property[schema.normal[normal]];
|
|
1337
|
+
if (normal.length > 4 && normal.slice(0, 4) === "data" && valid.test(value)) {
|
|
1338
|
+
if (value.charAt(4) === "-") {
|
|
1339
|
+
const rest = value.slice(5).replace(dash, camelcase);
|
|
1340
|
+
property = "data" + rest.charAt(0).toUpperCase() + rest.slice(1);
|
|
1341
|
+
} else {
|
|
1342
|
+
const rest = value.slice(4);
|
|
1343
|
+
if (!dash.test(rest)) {
|
|
1344
|
+
let dashes = rest.replace(cap, kebab);
|
|
1345
|
+
if (dashes.charAt(0) !== "-") dashes = "-" + dashes;
|
|
1346
|
+
value = "data" + dashes;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
Type = DefinedInfo;
|
|
1350
|
+
}
|
|
1351
|
+
return new Type(property, value);
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* @param {string} $0
|
|
1355
|
+
* Value.
|
|
1356
|
+
* @returns {string}
|
|
1357
|
+
* Kebab.
|
|
1358
|
+
*/
|
|
1359
|
+
function kebab($0) {
|
|
1360
|
+
return "-" + $0.toLowerCase();
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* @param {string} $0
|
|
1364
|
+
* Value.
|
|
1365
|
+
* @returns {string}
|
|
1366
|
+
* Camel.
|
|
1367
|
+
*/
|
|
1368
|
+
function camelcase($0) {
|
|
1369
|
+
return $0.charAt(1).toUpperCase();
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
//#endregion
|
|
1373
|
+
//#region ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/index.js
|
|
1374
|
+
const html = merge([
|
|
1375
|
+
aria,
|
|
1376
|
+
html$1,
|
|
1377
|
+
xlink,
|
|
1378
|
+
xmlns,
|
|
1379
|
+
xml
|
|
1380
|
+
], "html");
|
|
1381
|
+
const svg = merge([
|
|
1382
|
+
aria,
|
|
1383
|
+
svg$1,
|
|
1384
|
+
xlink,
|
|
1385
|
+
xmlns,
|
|
1386
|
+
xml
|
|
1387
|
+
], "svg");
|
|
1388
|
+
|
|
1389
|
+
//#endregion
|
|
1390
|
+
//#region ../../node_modules/.pnpm/space-separated-tokens@2.0.2/node_modules/space-separated-tokens/index.js
|
|
1391
|
+
/**
|
|
1392
|
+
* Parse space-separated tokens to an array of strings.
|
|
1393
|
+
*
|
|
1394
|
+
* @param {string} value
|
|
1395
|
+
* Space-separated tokens.
|
|
1396
|
+
* @returns {Array<string>}
|
|
1397
|
+
* List of tokens.
|
|
1398
|
+
*/
|
|
1399
|
+
function parse(value) {
|
|
1400
|
+
const input = String(value || "").trim();
|
|
1401
|
+
return input ? input.split(/[ \t\n\r\f]+/g) : [];
|
|
1402
|
+
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Serialize an array of strings as space separated-tokens.
|
|
1405
|
+
*
|
|
1406
|
+
* @param {Array<string|number>} values
|
|
1407
|
+
* List of tokens.
|
|
1408
|
+
* @returns {string}
|
|
1409
|
+
* Space-separated tokens.
|
|
1410
|
+
*/
|
|
1411
|
+
function stringify$1(values) {
|
|
1412
|
+
return values.join(" ").trim();
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
//#endregion
|
|
1416
|
+
//#region ../../node_modules/.pnpm/hast-util-parse-selector@4.0.0/node_modules/hast-util-parse-selector/lib/index.js
|
|
1417
|
+
/**
|
|
1418
|
+
* @typedef {import('hast').Element} Element
|
|
1419
|
+
* @typedef {import('hast').Properties} Properties
|
|
1420
|
+
*/
|
|
1421
|
+
/**
|
|
1422
|
+
* @template {string} SimpleSelector
|
|
1423
|
+
* Selector type.
|
|
1424
|
+
* @template {string} DefaultTagName
|
|
1425
|
+
* Default tag name.
|
|
1426
|
+
* @typedef {(
|
|
1427
|
+
* SimpleSelector extends ''
|
|
1428
|
+
* ? DefaultTagName
|
|
1429
|
+
* : SimpleSelector extends `${infer TagName}.${infer Rest}`
|
|
1430
|
+
* ? ExtractTagName<TagName, DefaultTagName>
|
|
1431
|
+
* : SimpleSelector extends `${infer TagName}#${infer Rest}`
|
|
1432
|
+
* ? ExtractTagName<TagName, DefaultTagName>
|
|
1433
|
+
* : SimpleSelector extends string
|
|
1434
|
+
* ? SimpleSelector
|
|
1435
|
+
* : DefaultTagName
|
|
1436
|
+
* )} ExtractTagName
|
|
1437
|
+
* Extract tag name from a simple selector.
|
|
1438
|
+
*/
|
|
1439
|
+
const search = /[#.]/g;
|
|
1440
|
+
/**
|
|
1441
|
+
* Create a hast element from a simple CSS selector.
|
|
1442
|
+
*
|
|
1443
|
+
* @template {string} Selector
|
|
1444
|
+
* Type of selector.
|
|
1445
|
+
* @template {string} [DefaultTagName='div']
|
|
1446
|
+
* Type of default tag name (default: `'div'`).
|
|
1447
|
+
* @param {Selector | null | undefined} [selector]
|
|
1448
|
+
* Simple CSS selector (optional).
|
|
1449
|
+
*
|
|
1450
|
+
* Can contain a tag name (`foo`), classes (`.bar`), and an ID (`#baz`).
|
|
1451
|
+
* Multiple classes are allowed.
|
|
1452
|
+
* Uses the last ID if multiple IDs are found.
|
|
1453
|
+
* @param {DefaultTagName | null | undefined} [defaultTagName='div']
|
|
1454
|
+
* Tag name to use if `selector` does not specify one (default: `'div'`).
|
|
1455
|
+
* @returns {Element & {tagName: ExtractTagName<Selector, DefaultTagName>}}
|
|
1456
|
+
* Built element.
|
|
1457
|
+
*/
|
|
1458
|
+
function parseSelector(selector, defaultTagName) {
|
|
1459
|
+
const value = selector || "";
|
|
1460
|
+
/** @type {Properties} */
|
|
1461
|
+
const props = {};
|
|
1462
|
+
let start = 0;
|
|
1463
|
+
/** @type {string | undefined} */
|
|
1464
|
+
let previous;
|
|
1465
|
+
/** @type {string | undefined} */
|
|
1466
|
+
let tagName;
|
|
1467
|
+
while (start < value.length) {
|
|
1468
|
+
search.lastIndex = start;
|
|
1469
|
+
const match = search.exec(value);
|
|
1470
|
+
const subvalue = value.slice(start, match ? match.index : value.length);
|
|
1471
|
+
if (subvalue) {
|
|
1472
|
+
if (!previous) tagName = subvalue;
|
|
1473
|
+
else if (previous === "#") props.id = subvalue;
|
|
1474
|
+
else if (Array.isArray(props.className)) props.className.push(subvalue);
|
|
1475
|
+
else props.className = [subvalue];
|
|
1476
|
+
start += subvalue.length;
|
|
1477
|
+
}
|
|
1478
|
+
if (match) {
|
|
1479
|
+
previous = match[0];
|
|
1480
|
+
start++;
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
return {
|
|
1484
|
+
type: "element",
|
|
1485
|
+
tagName: tagName || defaultTagName || "div",
|
|
1486
|
+
properties: props,
|
|
1487
|
+
children: []
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
//#endregion
|
|
1492
|
+
//#region ../../node_modules/.pnpm/hastscript@9.0.1/node_modules/hastscript/lib/create-h.js
|
|
1493
|
+
/**
|
|
1494
|
+
* @import {Element, Nodes, RootContent, Root} from 'hast'
|
|
1495
|
+
* @import {Info, Schema} from 'property-information'
|
|
1496
|
+
*/
|
|
1497
|
+
/**
|
|
1498
|
+
* @typedef {Array<Nodes | PrimitiveChild>} ArrayChildNested
|
|
1499
|
+
* List of children (deep).
|
|
1500
|
+
*/
|
|
1501
|
+
/**
|
|
1502
|
+
* @typedef {Array<ArrayChildNested | Nodes | PrimitiveChild>} ArrayChild
|
|
1503
|
+
* List of children.
|
|
1504
|
+
*/
|
|
1505
|
+
/**
|
|
1506
|
+
* @typedef {Array<number | string>} ArrayValue
|
|
1507
|
+
* List of property values for space- or comma separated values (such as `className`).
|
|
1508
|
+
*/
|
|
1509
|
+
/**
|
|
1510
|
+
* @typedef {ArrayChild | Nodes | PrimitiveChild} Child
|
|
1511
|
+
* Acceptable child value.
|
|
1512
|
+
*/
|
|
1513
|
+
/**
|
|
1514
|
+
* @typedef {number | string | null | undefined} PrimitiveChild
|
|
1515
|
+
* Primitive children, either ignored (nullish), or turned into text nodes.
|
|
1516
|
+
*/
|
|
1517
|
+
/**
|
|
1518
|
+
* @typedef {boolean | number | string | null | undefined} PrimitiveValue
|
|
1519
|
+
* Primitive property value.
|
|
1520
|
+
*/
|
|
1521
|
+
/**
|
|
1522
|
+
* @typedef {Record<string, PropertyValue | Style>} Properties
|
|
1523
|
+
* Acceptable value for element properties.
|
|
1524
|
+
*/
|
|
1525
|
+
/**
|
|
1526
|
+
* @typedef {ArrayValue | PrimitiveValue} PropertyValue
|
|
1527
|
+
* Primitive value or list value.
|
|
1528
|
+
*/
|
|
1529
|
+
/**
|
|
1530
|
+
* @typedef {Element | Root} Result
|
|
1531
|
+
* Result from a `h` (or `s`) call.
|
|
1532
|
+
*/
|
|
1533
|
+
/**
|
|
1534
|
+
* @typedef {number | string} StyleValue
|
|
1535
|
+
* Value for a CSS style field.
|
|
1536
|
+
*/
|
|
1537
|
+
/**
|
|
1538
|
+
* @typedef {Record<string, StyleValue>} Style
|
|
1539
|
+
* Supported value of a `style` prop.
|
|
1540
|
+
*/
|
|
1541
|
+
/**
|
|
1542
|
+
* @param {Schema} schema
|
|
1543
|
+
* Schema to use.
|
|
1544
|
+
* @param {string} defaultTagName
|
|
1545
|
+
* Default tag name.
|
|
1546
|
+
* @param {ReadonlyArray<string> | undefined} [caseSensitive]
|
|
1547
|
+
* Case-sensitive tag names (default: `undefined`).
|
|
1548
|
+
* @returns
|
|
1549
|
+
* `h`.
|
|
1550
|
+
*/
|
|
1551
|
+
function createH(schema, defaultTagName, caseSensitive) {
|
|
1552
|
+
const adjust = caseSensitive ? createAdjustMap(caseSensitive) : void 0;
|
|
1553
|
+
/**
|
|
1554
|
+
* Hyperscript compatible DSL for creating virtual hast trees.
|
|
1555
|
+
*
|
|
1556
|
+
* @overload
|
|
1557
|
+
* @param {null | undefined} [selector]
|
|
1558
|
+
* @param {...Child} children
|
|
1559
|
+
* @returns {Root}
|
|
1560
|
+
*
|
|
1561
|
+
* @overload
|
|
1562
|
+
* @param {string} selector
|
|
1563
|
+
* @param {Properties} properties
|
|
1564
|
+
* @param {...Child} children
|
|
1565
|
+
* @returns {Element}
|
|
1566
|
+
*
|
|
1567
|
+
* @overload
|
|
1568
|
+
* @param {string} selector
|
|
1569
|
+
* @param {...Child} children
|
|
1570
|
+
* @returns {Element}
|
|
1571
|
+
*
|
|
1572
|
+
* @param {string | null | undefined} [selector]
|
|
1573
|
+
* Selector.
|
|
1574
|
+
* @param {Child | Properties | null | undefined} [properties]
|
|
1575
|
+
* Properties (or first child) (default: `undefined`).
|
|
1576
|
+
* @param {...Child} children
|
|
1577
|
+
* Children.
|
|
1578
|
+
* @returns {Result}
|
|
1579
|
+
* Result.
|
|
1580
|
+
*/
|
|
1581
|
+
function h(selector, properties, ...children) {
|
|
1582
|
+
/** @type {Result} */
|
|
1583
|
+
let node;
|
|
1584
|
+
if (selector === null || selector === void 0) {
|
|
1585
|
+
node = {
|
|
1586
|
+
type: "root",
|
|
1587
|
+
children: []
|
|
1588
|
+
};
|
|
1589
|
+
const child = properties;
|
|
1590
|
+
children.unshift(child);
|
|
1591
|
+
} else {
|
|
1592
|
+
node = parseSelector(selector, defaultTagName);
|
|
1593
|
+
const lower = node.tagName.toLowerCase();
|
|
1594
|
+
const adjusted = adjust ? adjust.get(lower) : void 0;
|
|
1595
|
+
node.tagName = adjusted || lower;
|
|
1596
|
+
if (isChild(properties)) children.unshift(properties);
|
|
1597
|
+
else for (const [key, value] of Object.entries(properties)) addProperty(schema, node.properties, key, value);
|
|
1598
|
+
}
|
|
1599
|
+
for (const child of children) addChild(node.children, child);
|
|
1600
|
+
if (node.type === "element" && node.tagName === "template") {
|
|
1601
|
+
node.content = {
|
|
1602
|
+
type: "root",
|
|
1603
|
+
children: node.children
|
|
1604
|
+
};
|
|
1605
|
+
node.children = [];
|
|
1606
|
+
}
|
|
1607
|
+
return node;
|
|
1608
|
+
}
|
|
1609
|
+
return h;
|
|
1610
|
+
}
|
|
1611
|
+
/**
|
|
1612
|
+
* Check if something is properties or a child.
|
|
1613
|
+
*
|
|
1614
|
+
* @param {Child | Properties} value
|
|
1615
|
+
* Value to check.
|
|
1616
|
+
* @returns {value is Child}
|
|
1617
|
+
* Whether `value` is definitely a child.
|
|
1618
|
+
*/
|
|
1619
|
+
function isChild(value) {
|
|
1620
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return true;
|
|
1621
|
+
if (typeof value.type !== "string") return false;
|
|
1622
|
+
const record = value;
|
|
1623
|
+
const keys = Object.keys(value);
|
|
1624
|
+
for (const key of keys) {
|
|
1625
|
+
const value = record[key];
|
|
1626
|
+
if (value && typeof value === "object") {
|
|
1627
|
+
if (!Array.isArray(value)) return true;
|
|
1628
|
+
const list = value;
|
|
1629
|
+
for (const item of list) if (typeof item !== "number" && typeof item !== "string") return true;
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
if ("children" in value && Array.isArray(value.children)) return true;
|
|
1633
|
+
return false;
|
|
1634
|
+
}
|
|
1635
|
+
/**
|
|
1636
|
+
* @param {Schema} schema
|
|
1637
|
+
* Schema.
|
|
1638
|
+
* @param {Properties} properties
|
|
1639
|
+
* Properties object.
|
|
1640
|
+
* @param {string} key
|
|
1641
|
+
* Property name.
|
|
1642
|
+
* @param {PropertyValue | Style} value
|
|
1643
|
+
* Property value.
|
|
1644
|
+
* @returns {undefined}
|
|
1645
|
+
* Nothing.
|
|
1646
|
+
*/
|
|
1647
|
+
function addProperty(schema, properties, key, value) {
|
|
1648
|
+
const info = find(schema, key);
|
|
1649
|
+
/** @type {PropertyValue} */
|
|
1650
|
+
let result;
|
|
1651
|
+
if (value === null || value === void 0) return;
|
|
1652
|
+
if (typeof value === "number") {
|
|
1653
|
+
if (Number.isNaN(value)) return;
|
|
1654
|
+
result = value;
|
|
1655
|
+
} else if (typeof value === "boolean") result = value;
|
|
1656
|
+
else if (typeof value === "string") if (info.spaceSeparated) result = parse(value);
|
|
1657
|
+
else if (info.commaSeparated) result = parse$1(value);
|
|
1658
|
+
else if (info.commaOrSpaceSeparated) result = parse(parse$1(value).join(" "));
|
|
1659
|
+
else result = parsePrimitive(info, info.property, value);
|
|
1660
|
+
else if (Array.isArray(value)) result = [...value];
|
|
1661
|
+
else result = info.property === "style" ? style(value) : String(value);
|
|
1662
|
+
if (Array.isArray(result)) {
|
|
1663
|
+
/** @type {Array<number | string>} */
|
|
1664
|
+
const finalResult = [];
|
|
1665
|
+
for (const item of result) finalResult.push(parsePrimitive(info, info.property, item));
|
|
1666
|
+
result = finalResult;
|
|
1667
|
+
}
|
|
1668
|
+
if (info.property === "className" && Array.isArray(properties.className)) result = properties.className.concat(result);
|
|
1669
|
+
properties[info.property] = result;
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* @param {Array<RootContent>} nodes
|
|
1673
|
+
* Children.
|
|
1674
|
+
* @param {Child} value
|
|
1675
|
+
* Child.
|
|
1676
|
+
* @returns {undefined}
|
|
1677
|
+
* Nothing.
|
|
1678
|
+
*/
|
|
1679
|
+
function addChild(nodes, value) {
|
|
1680
|
+
if (value === null || value === void 0) {} else if (typeof value === "number" || typeof value === "string") nodes.push({
|
|
1681
|
+
type: "text",
|
|
1682
|
+
value: String(value)
|
|
1683
|
+
});
|
|
1684
|
+
else if (Array.isArray(value)) for (const child of value) addChild(nodes, child);
|
|
1685
|
+
else if (typeof value === "object" && "type" in value) if (value.type === "root") addChild(nodes, value.children);
|
|
1686
|
+
else nodes.push(value);
|
|
1687
|
+
else throw new Error("Expected node, nodes, or string, got `" + value + "`");
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Parse a single primitives.
|
|
1691
|
+
*
|
|
1692
|
+
* @param {Info} info
|
|
1693
|
+
* Property information.
|
|
1694
|
+
* @param {string} name
|
|
1695
|
+
* Property name.
|
|
1696
|
+
* @param {PrimitiveValue} value
|
|
1697
|
+
* Property value.
|
|
1698
|
+
* @returns {PrimitiveValue}
|
|
1699
|
+
* Property value.
|
|
1700
|
+
*/
|
|
1701
|
+
function parsePrimitive(info, name, value) {
|
|
1702
|
+
if (typeof value === "string") {
|
|
1703
|
+
if (info.number && value && !Number.isNaN(Number(value))) return Number(value);
|
|
1704
|
+
if ((info.boolean || info.overloadedBoolean) && (value === "" || normalize(value) === normalize(name))) return true;
|
|
1705
|
+
}
|
|
1706
|
+
return value;
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* Serialize a `style` object as a string.
|
|
1710
|
+
*
|
|
1711
|
+
* @param {Style} styles
|
|
1712
|
+
* Style object.
|
|
1713
|
+
* @returns {string}
|
|
1714
|
+
* CSS string.
|
|
1715
|
+
*/
|
|
1716
|
+
function style(styles) {
|
|
1717
|
+
/** @type {Array<string>} */
|
|
1718
|
+
const result = [];
|
|
1719
|
+
for (const [key, value] of Object.entries(styles)) result.push([key, value].join(": "));
|
|
1720
|
+
return result.join("; ");
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* Create a map to adjust casing.
|
|
1724
|
+
*
|
|
1725
|
+
* @param {ReadonlyArray<string>} values
|
|
1726
|
+
* List of properly cased keys.
|
|
1727
|
+
* @returns {Map<string, string>}
|
|
1728
|
+
* Map of lowercase keys to uppercase keys.
|
|
1729
|
+
*/
|
|
1730
|
+
function createAdjustMap(values) {
|
|
1731
|
+
/** @type {Map<string, string>} */
|
|
1732
|
+
const result = /* @__PURE__ */ new Map();
|
|
1733
|
+
for (const value of values) result.set(value.toLowerCase(), value);
|
|
1734
|
+
return result;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
//#endregion
|
|
1738
|
+
//#region ../../node_modules/.pnpm/hastscript@9.0.1/node_modules/hastscript/lib/svg-case-sensitive-tag-names.js
|
|
1739
|
+
/**
|
|
1740
|
+
* List of case-sensitive SVG tag names.
|
|
1741
|
+
*
|
|
1742
|
+
* @type {ReadonlyArray<string>}
|
|
1743
|
+
*/
|
|
1744
|
+
const svgCaseSensitiveTagNames = [
|
|
1745
|
+
"altGlyph",
|
|
1746
|
+
"altGlyphDef",
|
|
1747
|
+
"altGlyphItem",
|
|
1748
|
+
"animateColor",
|
|
1749
|
+
"animateMotion",
|
|
1750
|
+
"animateTransform",
|
|
1751
|
+
"clipPath",
|
|
1752
|
+
"feBlend",
|
|
1753
|
+
"feColorMatrix",
|
|
1754
|
+
"feComponentTransfer",
|
|
1755
|
+
"feComposite",
|
|
1756
|
+
"feConvolveMatrix",
|
|
1757
|
+
"feDiffuseLighting",
|
|
1758
|
+
"feDisplacementMap",
|
|
1759
|
+
"feDistantLight",
|
|
1760
|
+
"feDropShadow",
|
|
1761
|
+
"feFlood",
|
|
1762
|
+
"feFuncA",
|
|
1763
|
+
"feFuncB",
|
|
1764
|
+
"feFuncG",
|
|
1765
|
+
"feFuncR",
|
|
1766
|
+
"feGaussianBlur",
|
|
1767
|
+
"feImage",
|
|
1768
|
+
"feMerge",
|
|
1769
|
+
"feMergeNode",
|
|
1770
|
+
"feMorphology",
|
|
1771
|
+
"feOffset",
|
|
1772
|
+
"fePointLight",
|
|
1773
|
+
"feSpecularLighting",
|
|
1774
|
+
"feSpotLight",
|
|
1775
|
+
"feTile",
|
|
1776
|
+
"feTurbulence",
|
|
1777
|
+
"foreignObject",
|
|
1778
|
+
"glyphRef",
|
|
1779
|
+
"linearGradient",
|
|
1780
|
+
"radialGradient",
|
|
1781
|
+
"solidColor",
|
|
1782
|
+
"textArea",
|
|
1783
|
+
"textPath"
|
|
1784
|
+
];
|
|
1785
|
+
|
|
1786
|
+
//#endregion
|
|
1787
|
+
//#region ../../node_modules/.pnpm/hastscript@9.0.1/node_modules/hastscript/lib/index.js
|
|
1788
|
+
/**
|
|
1789
|
+
* @typedef {import('./jsx-classic.js').Element} h.JSX.Element
|
|
1790
|
+
* @typedef {import('./jsx-classic.js').ElementChildrenAttribute} h.JSX.ElementChildrenAttribute
|
|
1791
|
+
* @typedef {import('./jsx-classic.js').IntrinsicAttributes} h.JSX.IntrinsicAttributes
|
|
1792
|
+
* @typedef {import('./jsx-classic.js').IntrinsicElements} h.JSX.IntrinsicElements
|
|
1793
|
+
*/
|
|
1794
|
+
/**
|
|
1795
|
+
* @typedef {import('./jsx-classic.js').Element} s.JSX.Element
|
|
1796
|
+
* @typedef {import('./jsx-classic.js').ElementChildrenAttribute} s.JSX.ElementChildrenAttribute
|
|
1797
|
+
* @typedef {import('./jsx-classic.js').IntrinsicAttributes} s.JSX.IntrinsicAttributes
|
|
1798
|
+
* @typedef {import('./jsx-classic.js').IntrinsicElements} s.JSX.IntrinsicElements
|
|
1799
|
+
*/
|
|
1800
|
+
/** @type {ReturnType<createH>} */
|
|
1801
|
+
const h = createH(html, "div");
|
|
1802
|
+
/** @type {ReturnType<createH>} */
|
|
1803
|
+
const s = createH(svg, "g", svgCaseSensitiveTagNames);
|
|
1804
|
+
|
|
1805
|
+
//#endregion
|
|
1806
|
+
//#region ../../node_modules/.pnpm/character-entities-legacy@3.0.0/node_modules/character-entities-legacy/index.js
|
|
1807
|
+
/**
|
|
1808
|
+
* List of legacy HTML named character references that don’t need a trailing semicolon.
|
|
1809
|
+
*
|
|
1810
|
+
* @type {Array<string>}
|
|
1811
|
+
*/
|
|
1812
|
+
const characterEntitiesLegacy = [
|
|
1813
|
+
"AElig",
|
|
1814
|
+
"AMP",
|
|
1815
|
+
"Aacute",
|
|
1816
|
+
"Acirc",
|
|
1817
|
+
"Agrave",
|
|
1818
|
+
"Aring",
|
|
1819
|
+
"Atilde",
|
|
1820
|
+
"Auml",
|
|
1821
|
+
"COPY",
|
|
1822
|
+
"Ccedil",
|
|
1823
|
+
"ETH",
|
|
1824
|
+
"Eacute",
|
|
1825
|
+
"Ecirc",
|
|
1826
|
+
"Egrave",
|
|
1827
|
+
"Euml",
|
|
1828
|
+
"GT",
|
|
1829
|
+
"Iacute",
|
|
1830
|
+
"Icirc",
|
|
1831
|
+
"Igrave",
|
|
1832
|
+
"Iuml",
|
|
1833
|
+
"LT",
|
|
1834
|
+
"Ntilde",
|
|
1835
|
+
"Oacute",
|
|
1836
|
+
"Ocirc",
|
|
1837
|
+
"Ograve",
|
|
1838
|
+
"Oslash",
|
|
1839
|
+
"Otilde",
|
|
1840
|
+
"Ouml",
|
|
1841
|
+
"QUOT",
|
|
1842
|
+
"REG",
|
|
1843
|
+
"THORN",
|
|
1844
|
+
"Uacute",
|
|
1845
|
+
"Ucirc",
|
|
1846
|
+
"Ugrave",
|
|
1847
|
+
"Uuml",
|
|
1848
|
+
"Yacute",
|
|
1849
|
+
"aacute",
|
|
1850
|
+
"acirc",
|
|
1851
|
+
"acute",
|
|
1852
|
+
"aelig",
|
|
1853
|
+
"agrave",
|
|
1854
|
+
"amp",
|
|
1855
|
+
"aring",
|
|
1856
|
+
"atilde",
|
|
1857
|
+
"auml",
|
|
1858
|
+
"brvbar",
|
|
1859
|
+
"ccedil",
|
|
1860
|
+
"cedil",
|
|
1861
|
+
"cent",
|
|
1862
|
+
"copy",
|
|
1863
|
+
"curren",
|
|
1864
|
+
"deg",
|
|
1865
|
+
"divide",
|
|
1866
|
+
"eacute",
|
|
1867
|
+
"ecirc",
|
|
1868
|
+
"egrave",
|
|
1869
|
+
"eth",
|
|
1870
|
+
"euml",
|
|
1871
|
+
"frac12",
|
|
1872
|
+
"frac14",
|
|
1873
|
+
"frac34",
|
|
1874
|
+
"gt",
|
|
1875
|
+
"iacute",
|
|
1876
|
+
"icirc",
|
|
1877
|
+
"iexcl",
|
|
1878
|
+
"igrave",
|
|
1879
|
+
"iquest",
|
|
1880
|
+
"iuml",
|
|
1881
|
+
"laquo",
|
|
1882
|
+
"lt",
|
|
1883
|
+
"macr",
|
|
1884
|
+
"micro",
|
|
1885
|
+
"middot",
|
|
1886
|
+
"nbsp",
|
|
1887
|
+
"not",
|
|
1888
|
+
"ntilde",
|
|
1889
|
+
"oacute",
|
|
1890
|
+
"ocirc",
|
|
1891
|
+
"ograve",
|
|
1892
|
+
"ordf",
|
|
1893
|
+
"ordm",
|
|
1894
|
+
"oslash",
|
|
1895
|
+
"otilde",
|
|
1896
|
+
"ouml",
|
|
1897
|
+
"para",
|
|
1898
|
+
"plusmn",
|
|
1899
|
+
"pound",
|
|
1900
|
+
"quot",
|
|
1901
|
+
"raquo",
|
|
1902
|
+
"reg",
|
|
1903
|
+
"sect",
|
|
1904
|
+
"shy",
|
|
1905
|
+
"sup1",
|
|
1906
|
+
"sup2",
|
|
1907
|
+
"sup3",
|
|
1908
|
+
"szlig",
|
|
1909
|
+
"thorn",
|
|
1910
|
+
"times",
|
|
1911
|
+
"uacute",
|
|
1912
|
+
"ucirc",
|
|
1913
|
+
"ugrave",
|
|
1914
|
+
"uml",
|
|
1915
|
+
"uuml",
|
|
1916
|
+
"yacute",
|
|
1917
|
+
"yen",
|
|
1918
|
+
"yuml"
|
|
1919
|
+
];
|
|
1920
|
+
|
|
1921
|
+
//#endregion
|
|
1922
|
+
//#region ../../node_modules/.pnpm/character-reference-invalid@2.0.1/node_modules/character-reference-invalid/index.js
|
|
1923
|
+
/**
|
|
1924
|
+
* Map of invalid numeric character references to their replacements, according to HTML.
|
|
1925
|
+
*
|
|
1926
|
+
* @type {Record<number, string>}
|
|
1927
|
+
*/
|
|
1928
|
+
const characterReferenceInvalid = {
|
|
1929
|
+
0: "�",
|
|
1930
|
+
128: "€",
|
|
1931
|
+
130: "‚",
|
|
1932
|
+
131: "ƒ",
|
|
1933
|
+
132: "„",
|
|
1934
|
+
133: "…",
|
|
1935
|
+
134: "†",
|
|
1936
|
+
135: "‡",
|
|
1937
|
+
136: "ˆ",
|
|
1938
|
+
137: "‰",
|
|
1939
|
+
138: "Š",
|
|
1940
|
+
139: "‹",
|
|
1941
|
+
140: "Œ",
|
|
1942
|
+
142: "Ž",
|
|
1943
|
+
145: "‘",
|
|
1944
|
+
146: "’",
|
|
1945
|
+
147: "“",
|
|
1946
|
+
148: "”",
|
|
1947
|
+
149: "•",
|
|
1948
|
+
150: "–",
|
|
1949
|
+
151: "—",
|
|
1950
|
+
152: "˜",
|
|
1951
|
+
153: "™",
|
|
1952
|
+
154: "š",
|
|
1953
|
+
155: "›",
|
|
1954
|
+
156: "œ",
|
|
1955
|
+
158: "ž",
|
|
1956
|
+
159: "Ÿ"
|
|
1957
|
+
};
|
|
1958
|
+
|
|
1959
|
+
//#endregion
|
|
1960
|
+
//#region ../../node_modules/.pnpm/is-decimal@2.0.1/node_modules/is-decimal/index.js
|
|
1961
|
+
/**
|
|
1962
|
+
* Check if the given character code, or the character code at the first
|
|
1963
|
+
* character, is decimal.
|
|
1964
|
+
*
|
|
1965
|
+
* @param {string|number} character
|
|
1966
|
+
* @returns {boolean} Whether `character` is a decimal
|
|
1967
|
+
*/
|
|
1968
|
+
function isDecimal(character) {
|
|
1969
|
+
const code = typeof character === "string" ? character.charCodeAt(0) : character;
|
|
1970
|
+
return code >= 48 && code <= 57;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
//#endregion
|
|
1974
|
+
//#region ../../node_modules/.pnpm/is-hexadecimal@2.0.1/node_modules/is-hexadecimal/index.js
|
|
1975
|
+
/**
|
|
1976
|
+
* Check if the given character code, or the character code at the first
|
|
1977
|
+
* character, is hexadecimal.
|
|
1978
|
+
*
|
|
1979
|
+
* @param {string|number} character
|
|
1980
|
+
* @returns {boolean} Whether `character` is hexadecimal
|
|
1981
|
+
*/
|
|
1982
|
+
function isHexadecimal(character) {
|
|
1983
|
+
const code = typeof character === "string" ? character.charCodeAt(0) : character;
|
|
1984
|
+
return code >= 97 && code <= 102 || code >= 65 && code <= 70 || code >= 48 && code <= 57;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
//#endregion
|
|
1988
|
+
//#region ../../node_modules/.pnpm/is-alphabetical@2.0.1/node_modules/is-alphabetical/index.js
|
|
1989
|
+
/**
|
|
1990
|
+
* Check if the given character code, or the character code at the first
|
|
1991
|
+
* character, is alphabetical.
|
|
1992
|
+
*
|
|
1993
|
+
* @param {string|number} character
|
|
1994
|
+
* @returns {boolean} Whether `character` is alphabetical.
|
|
1995
|
+
*/
|
|
1996
|
+
function isAlphabetical(character) {
|
|
1997
|
+
const code = typeof character === "string" ? character.charCodeAt(0) : character;
|
|
1998
|
+
return code >= 97 && code <= 122 || code >= 65 && code <= 90;
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
//#endregion
|
|
2002
|
+
//#region ../../node_modules/.pnpm/is-alphanumerical@2.0.1/node_modules/is-alphanumerical/index.js
|
|
2003
|
+
/**
|
|
2004
|
+
* Check if the given character code, or the character code at the first
|
|
2005
|
+
* character, is alphanumerical.
|
|
2006
|
+
*
|
|
2007
|
+
* @param {string|number} character
|
|
2008
|
+
* @returns {boolean} Whether `character` is alphanumerical.
|
|
2009
|
+
*/
|
|
2010
|
+
function isAlphanumerical(character) {
|
|
2011
|
+
return isAlphabetical(character) || isDecimal(character);
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
//#endregion
|
|
2015
|
+
//#region ../../node_modules/.pnpm/decode-named-character-reference@1.3.0/node_modules/decode-named-character-reference/index.dom.js
|
|
2016
|
+
const element = document.createElement("i");
|
|
2017
|
+
/**
|
|
2018
|
+
* @param {string} value
|
|
2019
|
+
* @returns {string | false}
|
|
2020
|
+
*/
|
|
2021
|
+
function decodeNamedCharacterReference(value) {
|
|
2022
|
+
const characterReference = "&" + value + ";";
|
|
2023
|
+
element.innerHTML = characterReference;
|
|
2024
|
+
const character = element.textContent;
|
|
2025
|
+
if (character.charCodeAt(character.length - 1) === 59 && value !== "semi") return false;
|
|
2026
|
+
return character === characterReference ? false : character;
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
//#endregion
|
|
2030
|
+
//#region ../../node_modules/.pnpm/parse-entities@4.0.2/node_modules/parse-entities/lib/index.js
|
|
2031
|
+
/**
|
|
2032
|
+
* @import {Point} from 'unist'
|
|
2033
|
+
* @import {Options} from '../index.js'
|
|
2034
|
+
*/
|
|
2035
|
+
const messages = [
|
|
2036
|
+
"",
|
|
2037
|
+
"Named character references must be terminated by a semicolon",
|
|
2038
|
+
"Numeric character references must be terminated by a semicolon",
|
|
2039
|
+
"Named character references cannot be empty",
|
|
2040
|
+
"Numeric character references cannot be empty",
|
|
2041
|
+
"Named character references must be known",
|
|
2042
|
+
"Numeric character references cannot be disallowed",
|
|
2043
|
+
"Numeric character references cannot be outside the permissible Unicode range"
|
|
2044
|
+
];
|
|
2045
|
+
/**
|
|
2046
|
+
* Parse HTML character references.
|
|
2047
|
+
*
|
|
2048
|
+
* @param {string} value
|
|
2049
|
+
* @param {Readonly<Options> | null | undefined} [options]
|
|
2050
|
+
*/
|
|
2051
|
+
function parseEntities(value, options) {
|
|
2052
|
+
const settings = options || {};
|
|
2053
|
+
const additional = typeof settings.additional === "string" ? settings.additional.charCodeAt(0) : settings.additional;
|
|
2054
|
+
/** @type {Array<string>} */
|
|
2055
|
+
const result = [];
|
|
2056
|
+
let index = 0;
|
|
2057
|
+
let lines = -1;
|
|
2058
|
+
let queue = "";
|
|
2059
|
+
/** @type {Point | undefined} */
|
|
2060
|
+
let point;
|
|
2061
|
+
/** @type {Array<number>|undefined} */
|
|
2062
|
+
let indent;
|
|
2063
|
+
if (settings.position) if ("start" in settings.position || "indent" in settings.position) {
|
|
2064
|
+
indent = settings.position.indent;
|
|
2065
|
+
point = settings.position.start;
|
|
2066
|
+
} else point = settings.position;
|
|
2067
|
+
let line = (point ? point.line : 0) || 1;
|
|
2068
|
+
let column = (point ? point.column : 0) || 1;
|
|
2069
|
+
let previous = now();
|
|
2070
|
+
/** @type {number|undefined} */
|
|
2071
|
+
let character;
|
|
2072
|
+
index--;
|
|
2073
|
+
while (++index <= value.length) {
|
|
2074
|
+
if (character === 10) column = (indent ? indent[lines] : 0) || 1;
|
|
2075
|
+
character = value.charCodeAt(index);
|
|
2076
|
+
if (character === 38) {
|
|
2077
|
+
const following = value.charCodeAt(index + 1);
|
|
2078
|
+
if (following === 9 || following === 10 || following === 12 || following === 32 || following === 38 || following === 60 || Number.isNaN(following) || additional && following === additional) {
|
|
2079
|
+
queue += String.fromCharCode(character);
|
|
2080
|
+
column++;
|
|
2081
|
+
continue;
|
|
2082
|
+
}
|
|
2083
|
+
const start = index + 1;
|
|
2084
|
+
let begin = start;
|
|
2085
|
+
let end = start;
|
|
2086
|
+
/** @type {string} */
|
|
2087
|
+
let type;
|
|
2088
|
+
if (following === 35) {
|
|
2089
|
+
end = ++begin;
|
|
2090
|
+
const following = value.charCodeAt(end);
|
|
2091
|
+
if (following === 88 || following === 120) {
|
|
2092
|
+
type = "hexadecimal";
|
|
2093
|
+
end = ++begin;
|
|
2094
|
+
} else type = "decimal";
|
|
2095
|
+
} else type = "named";
|
|
2096
|
+
let characterReferenceCharacters = "";
|
|
2097
|
+
let characterReference = "";
|
|
2098
|
+
let characters = "";
|
|
2099
|
+
const test = type === "named" ? isAlphanumerical : type === "decimal" ? isDecimal : isHexadecimal;
|
|
2100
|
+
end--;
|
|
2101
|
+
while (++end <= value.length) {
|
|
2102
|
+
const following = value.charCodeAt(end);
|
|
2103
|
+
if (!test(following)) break;
|
|
2104
|
+
characters += String.fromCharCode(following);
|
|
2105
|
+
if (type === "named" && characterEntitiesLegacy.includes(characters)) {
|
|
2106
|
+
characterReferenceCharacters = characters;
|
|
2107
|
+
characterReference = decodeNamedCharacterReference(characters);
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
let terminated = value.charCodeAt(end) === 59;
|
|
2111
|
+
if (terminated) {
|
|
2112
|
+
end++;
|
|
2113
|
+
const namedReference = type === "named" ? decodeNamedCharacterReference(characters) : false;
|
|
2114
|
+
if (namedReference) {
|
|
2115
|
+
characterReferenceCharacters = characters;
|
|
2116
|
+
characterReference = namedReference;
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
let diff = 1 + end - start;
|
|
2120
|
+
let reference = "";
|
|
2121
|
+
if (!terminated && settings.nonTerminated === false) {} else if (!characters) {
|
|
2122
|
+
if (type !== "named") warning(4, diff);
|
|
2123
|
+
} else if (type === "named") {
|
|
2124
|
+
if (terminated && !characterReference) warning(5, 1);
|
|
2125
|
+
else {
|
|
2126
|
+
if (characterReferenceCharacters !== characters) {
|
|
2127
|
+
end = begin + characterReferenceCharacters.length;
|
|
2128
|
+
diff = 1 + end - begin;
|
|
2129
|
+
terminated = false;
|
|
2130
|
+
}
|
|
2131
|
+
if (!terminated) {
|
|
2132
|
+
const reason = characterReferenceCharacters ? 1 : 3;
|
|
2133
|
+
if (settings.attribute) {
|
|
2134
|
+
const following = value.charCodeAt(end);
|
|
2135
|
+
if (following === 61) {
|
|
2136
|
+
warning(reason, diff);
|
|
2137
|
+
characterReference = "";
|
|
2138
|
+
} else if (isAlphanumerical(following)) characterReference = "";
|
|
2139
|
+
else warning(reason, diff);
|
|
2140
|
+
} else warning(reason, diff);
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
reference = characterReference;
|
|
2144
|
+
} else {
|
|
2145
|
+
if (!terminated) warning(2, diff);
|
|
2146
|
+
let referenceCode = Number.parseInt(characters, type === "hexadecimal" ? 16 : 10);
|
|
2147
|
+
if (prohibited(referenceCode)) {
|
|
2148
|
+
warning(7, diff);
|
|
2149
|
+
reference = String.fromCharCode(65533);
|
|
2150
|
+
} else if (referenceCode in characterReferenceInvalid) {
|
|
2151
|
+
warning(6, diff);
|
|
2152
|
+
reference = characterReferenceInvalid[referenceCode];
|
|
2153
|
+
} else {
|
|
2154
|
+
let output = "";
|
|
2155
|
+
if (disallowed(referenceCode)) warning(6, diff);
|
|
2156
|
+
if (referenceCode > 65535) {
|
|
2157
|
+
referenceCode -= 65536;
|
|
2158
|
+
output += String.fromCharCode(referenceCode >>> 10 | 55296);
|
|
2159
|
+
referenceCode = 56320 | referenceCode & 1023;
|
|
2160
|
+
}
|
|
2161
|
+
reference = output + String.fromCharCode(referenceCode);
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
if (reference) {
|
|
2165
|
+
flush();
|
|
2166
|
+
previous = now();
|
|
2167
|
+
index = end - 1;
|
|
2168
|
+
column += end - start + 1;
|
|
2169
|
+
result.push(reference);
|
|
2170
|
+
const next = now();
|
|
2171
|
+
next.offset++;
|
|
2172
|
+
if (settings.reference) settings.reference.call(settings.referenceContext || void 0, reference, {
|
|
2173
|
+
start: previous,
|
|
2174
|
+
end: next
|
|
2175
|
+
}, value.slice(start - 1, end));
|
|
2176
|
+
previous = next;
|
|
2177
|
+
} else {
|
|
2178
|
+
characters = value.slice(start - 1, end);
|
|
2179
|
+
queue += characters;
|
|
2180
|
+
column += characters.length;
|
|
2181
|
+
index = end - 1;
|
|
2182
|
+
}
|
|
2183
|
+
} else {
|
|
2184
|
+
if (character === 10) {
|
|
2185
|
+
line++;
|
|
2186
|
+
lines++;
|
|
2187
|
+
column = 0;
|
|
2188
|
+
}
|
|
2189
|
+
if (Number.isNaN(character)) flush();
|
|
2190
|
+
else {
|
|
2191
|
+
queue += String.fromCharCode(character);
|
|
2192
|
+
column++;
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
return result.join("");
|
|
2197
|
+
function now() {
|
|
2198
|
+
return {
|
|
2199
|
+
line,
|
|
2200
|
+
column,
|
|
2201
|
+
offset: index + ((point ? point.offset : 0) || 0)
|
|
2202
|
+
};
|
|
2203
|
+
}
|
|
2204
|
+
/**
|
|
2205
|
+
* Handle the warning.
|
|
2206
|
+
*
|
|
2207
|
+
* @param {1|2|3|4|5|6|7} code
|
|
2208
|
+
* @param {number} offset
|
|
2209
|
+
*/
|
|
2210
|
+
function warning(code, offset) {
|
|
2211
|
+
/** @type {ReturnType<now>} */
|
|
2212
|
+
let position;
|
|
2213
|
+
if (settings.warning) {
|
|
2214
|
+
position = now();
|
|
2215
|
+
position.column += offset;
|
|
2216
|
+
position.offset += offset;
|
|
2217
|
+
settings.warning.call(settings.warningContext || void 0, messages[code], position, code);
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
/**
|
|
2221
|
+
* Flush `queue` (normal text).
|
|
2222
|
+
* Macro invoked before each reference and at the end of `value`.
|
|
2223
|
+
* Does nothing when `queue` is empty.
|
|
2224
|
+
*/
|
|
2225
|
+
function flush() {
|
|
2226
|
+
if (queue) {
|
|
2227
|
+
result.push(queue);
|
|
2228
|
+
if (settings.text) settings.text.call(settings.textContext || void 0, queue, {
|
|
2229
|
+
start: previous,
|
|
2230
|
+
end: now()
|
|
2231
|
+
});
|
|
2232
|
+
queue = "";
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
/**
|
|
2237
|
+
* Check if `character` is outside the permissible unicode range.
|
|
2238
|
+
*
|
|
2239
|
+
* @param {number} code
|
|
2240
|
+
* @returns {boolean}
|
|
2241
|
+
*/
|
|
2242
|
+
function prohibited(code) {
|
|
2243
|
+
return code >= 55296 && code <= 57343 || code > 1114111;
|
|
2244
|
+
}
|
|
2245
|
+
/**
|
|
2246
|
+
* Check if `character` is disallowed.
|
|
2247
|
+
*
|
|
2248
|
+
* @param {number} code
|
|
2249
|
+
* @returns {boolean}
|
|
2250
|
+
*/
|
|
2251
|
+
function disallowed(code) {
|
|
2252
|
+
return code >= 1 && code <= 8 || code === 11 || code >= 13 && code <= 31 || code >= 127 && code <= 159 || code >= 64976 && code <= 65007 || (code & 65535) === 65535 || (code & 65535) === 65534;
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
//#endregion
|
|
2256
|
+
//#region ../../node_modules/.pnpm/refractor@5.0.0/node_modules/refractor/lib/prism-core.js
|
|
2257
|
+
var uniqueId = 0;
|
|
2258
|
+
var plainTextGrammar = {};
|
|
2259
|
+
var _ = {
|
|
2260
|
+
/**
|
|
2261
|
+
* A namespace for utility methods.
|
|
2262
|
+
*
|
|
2263
|
+
* All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
|
|
2264
|
+
* change or disappear at any time.
|
|
2265
|
+
*
|
|
2266
|
+
* @namespace
|
|
2267
|
+
* @memberof Prism
|
|
2268
|
+
*/
|
|
2269
|
+
util: {
|
|
2270
|
+
/**
|
|
2271
|
+
* Returns the name of the type of the given value.
|
|
2272
|
+
*
|
|
2273
|
+
* @param {any} o
|
|
2274
|
+
* @returns {string}
|
|
2275
|
+
* @example
|
|
2276
|
+
* type(null) === 'Null'
|
|
2277
|
+
* type(undefined) === 'Undefined'
|
|
2278
|
+
* type(123) === 'Number'
|
|
2279
|
+
* type('foo') === 'String'
|
|
2280
|
+
* type(true) === 'Boolean'
|
|
2281
|
+
* type([1, 2]) === 'Array'
|
|
2282
|
+
* type({}) === 'Object'
|
|
2283
|
+
* type(String) === 'Function'
|
|
2284
|
+
* type(/abc+/) === 'RegExp'
|
|
2285
|
+
*/
|
|
2286
|
+
type: function(o) {
|
|
2287
|
+
return Object.prototype.toString.call(o).slice(8, -1);
|
|
2288
|
+
},
|
|
2289
|
+
/**
|
|
2290
|
+
* Returns a unique number for the given object. Later calls will still return the same number.
|
|
2291
|
+
*
|
|
2292
|
+
* @param {Object} obj
|
|
2293
|
+
* @returns {number}
|
|
2294
|
+
*/
|
|
2295
|
+
objId: function(obj) {
|
|
2296
|
+
if (!obj["__id"]) Object.defineProperty(obj, "__id", { value: ++uniqueId });
|
|
2297
|
+
return obj["__id"];
|
|
2298
|
+
},
|
|
2299
|
+
/**
|
|
2300
|
+
* Creates a deep clone of the given object.
|
|
2301
|
+
*
|
|
2302
|
+
* The main intended use of this function is to clone language definitions.
|
|
2303
|
+
*
|
|
2304
|
+
* @param {T} o
|
|
2305
|
+
* @param {Record<number, any>} [visited]
|
|
2306
|
+
* @returns {T}
|
|
2307
|
+
* @template T
|
|
2308
|
+
*/
|
|
2309
|
+
clone: function deepClone(o, visited) {
|
|
2310
|
+
visited = visited || {};
|
|
2311
|
+
var clone;
|
|
2312
|
+
var id;
|
|
2313
|
+
switch (_.util.type(o)) {
|
|
2314
|
+
case "Object":
|
|
2315
|
+
id = _.util.objId(o);
|
|
2316
|
+
if (visited[id]) return visited[id];
|
|
2317
|
+
clone = {};
|
|
2318
|
+
visited[id] = clone;
|
|
2319
|
+
for (var key in o) if (o.hasOwnProperty(key)) clone[key] = deepClone(o[key], visited);
|
|
2320
|
+
return clone;
|
|
2321
|
+
case "Array":
|
|
2322
|
+
id = _.util.objId(o);
|
|
2323
|
+
if (visited[id]) return visited[id];
|
|
2324
|
+
clone = [];
|
|
2325
|
+
visited[id] = clone;
|
|
2326
|
+
/** @type {Array} */ o.forEach(function(v, i) {
|
|
2327
|
+
clone[i] = deepClone(v, visited);
|
|
2328
|
+
});
|
|
2329
|
+
return clone;
|
|
2330
|
+
default: return o;
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
},
|
|
2334
|
+
/**
|
|
2335
|
+
* This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
|
|
2336
|
+
*
|
|
2337
|
+
* @namespace
|
|
2338
|
+
* @memberof Prism
|
|
2339
|
+
* @public
|
|
2340
|
+
*/
|
|
2341
|
+
languages: {
|
|
2342
|
+
/**
|
|
2343
|
+
* The grammar for plain, unformatted text.
|
|
2344
|
+
*/
|
|
2345
|
+
plain: plainTextGrammar,
|
|
2346
|
+
plaintext: plainTextGrammar,
|
|
2347
|
+
text: plainTextGrammar,
|
|
2348
|
+
txt: plainTextGrammar,
|
|
2349
|
+
/**
|
|
2350
|
+
* Creates a deep copy of the language with the given id and appends the given tokens.
|
|
2351
|
+
*
|
|
2352
|
+
* If a token in `redef` also appears in the copied language, then the existing token in the copied language
|
|
2353
|
+
* will be overwritten at its original position.
|
|
2354
|
+
*
|
|
2355
|
+
* ## Best practices
|
|
2356
|
+
*
|
|
2357
|
+
* Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
|
|
2358
|
+
* doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
|
|
2359
|
+
* understand the language definition because, normally, the order of tokens matters in Prism grammars.
|
|
2360
|
+
*
|
|
2361
|
+
* Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
|
|
2362
|
+
* Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
|
|
2363
|
+
*
|
|
2364
|
+
* @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
|
|
2365
|
+
* @param {Grammar} redef The new tokens to append.
|
|
2366
|
+
* @returns {Grammar} The new language created.
|
|
2367
|
+
* @public
|
|
2368
|
+
* @example
|
|
2369
|
+
* Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
|
|
2370
|
+
* // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
|
|
2371
|
+
* // at its original position
|
|
2372
|
+
* 'comment': { ... },
|
|
2373
|
+
* // CSS doesn't have a 'color' token, so this token will be appended
|
|
2374
|
+
* 'color': /\b(?:red|green|blue)\b/
|
|
2375
|
+
* });
|
|
2376
|
+
*/
|
|
2377
|
+
extend: function(id, redef) {
|
|
2378
|
+
var lang = _.util.clone(_.languages[id]);
|
|
2379
|
+
for (var key in redef) lang[key] = redef[key];
|
|
2380
|
+
return lang;
|
|
2381
|
+
},
|
|
2382
|
+
/**
|
|
2383
|
+
* Inserts tokens _before_ another token in a language definition or any other grammar.
|
|
2384
|
+
*
|
|
2385
|
+
* ## Usage
|
|
2386
|
+
*
|
|
2387
|
+
* This helper method makes it easy to modify existing languages. For example, the CSS language definition
|
|
2388
|
+
* not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
|
|
2389
|
+
* in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
|
|
2390
|
+
* appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
|
|
2391
|
+
* this:
|
|
2392
|
+
*
|
|
2393
|
+
* ```js
|
|
2394
|
+
* Prism.languages.markup.style = {
|
|
2395
|
+
* // token
|
|
2396
|
+
* };
|
|
2397
|
+
* ```
|
|
2398
|
+
*
|
|
2399
|
+
* then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
|
|
2400
|
+
* before existing tokens. For the CSS example above, you would use it like this:
|
|
2401
|
+
*
|
|
2402
|
+
* ```js
|
|
2403
|
+
* Prism.languages.insertBefore('markup', 'cdata', {
|
|
2404
|
+
* 'style': {
|
|
2405
|
+
* // token
|
|
2406
|
+
* }
|
|
2407
|
+
* });
|
|
2408
|
+
* ```
|
|
2409
|
+
*
|
|
2410
|
+
* ## Special cases
|
|
2411
|
+
*
|
|
2412
|
+
* If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
|
|
2413
|
+
* will be ignored.
|
|
2414
|
+
*
|
|
2415
|
+
* This behavior can be used to insert tokens after `before`:
|
|
2416
|
+
*
|
|
2417
|
+
* ```js
|
|
2418
|
+
* Prism.languages.insertBefore('markup', 'comment', {
|
|
2419
|
+
* 'comment': Prism.languages.markup.comment,
|
|
2420
|
+
* // tokens after 'comment'
|
|
2421
|
+
* });
|
|
2422
|
+
* ```
|
|
2423
|
+
*
|
|
2424
|
+
* ## Limitations
|
|
2425
|
+
*
|
|
2426
|
+
* The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
|
|
2427
|
+
* properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
|
|
2428
|
+
* differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
|
|
2429
|
+
* deleting properties which is necessary to insert at arbitrary positions.
|
|
2430
|
+
*
|
|
2431
|
+
* To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
|
|
2432
|
+
* Instead, it will create a new object and replace all references to the target object with the new one. This
|
|
2433
|
+
* can be done without temporarily deleting properties, so the iteration order is well-defined.
|
|
2434
|
+
*
|
|
2435
|
+
* However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
|
|
2436
|
+
* you hold the target object in a variable, then the value of the variable will not change.
|
|
2437
|
+
*
|
|
2438
|
+
* ```js
|
|
2439
|
+
* var oldMarkup = Prism.languages.markup;
|
|
2440
|
+
* var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
|
|
2441
|
+
*
|
|
2442
|
+
* assert(oldMarkup !== Prism.languages.markup);
|
|
2443
|
+
* assert(newMarkup === Prism.languages.markup);
|
|
2444
|
+
* ```
|
|
2445
|
+
*
|
|
2446
|
+
* @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
|
|
2447
|
+
* object to be modified.
|
|
2448
|
+
* @param {string} before The key to insert before.
|
|
2449
|
+
* @param {Grammar} insert An object containing the key-value pairs to be inserted.
|
|
2450
|
+
* @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
|
|
2451
|
+
* object to be modified.
|
|
2452
|
+
*
|
|
2453
|
+
* Defaults to `Prism.languages`.
|
|
2454
|
+
* @returns {Grammar} The new grammar object.
|
|
2455
|
+
* @public
|
|
2456
|
+
*/
|
|
2457
|
+
insertBefore: function(inside, before, insert, root) {
|
|
2458
|
+
root = root || _.languages;
|
|
2459
|
+
var grammar = root[inside];
|
|
2460
|
+
/** @type {Grammar} */
|
|
2461
|
+
var ret = {};
|
|
2462
|
+
for (var token in grammar) if (grammar.hasOwnProperty(token)) {
|
|
2463
|
+
if (token == before) {
|
|
2464
|
+
for (var newToken in insert) if (insert.hasOwnProperty(newToken)) ret[newToken] = insert[newToken];
|
|
2465
|
+
}
|
|
2466
|
+
if (!insert.hasOwnProperty(token)) ret[token] = grammar[token];
|
|
2467
|
+
}
|
|
2468
|
+
var old = root[inside];
|
|
2469
|
+
root[inside] = ret;
|
|
2470
|
+
_.languages.DFS(_.languages, function(key, value) {
|
|
2471
|
+
if (value === old && key != inside) this[key] = ret;
|
|
2472
|
+
});
|
|
2473
|
+
return ret;
|
|
2474
|
+
},
|
|
2475
|
+
DFS: function DFS(o, callback, type, visited) {
|
|
2476
|
+
visited = visited || {};
|
|
2477
|
+
var objId = _.util.objId;
|
|
2478
|
+
for (var i in o) if (o.hasOwnProperty(i)) {
|
|
2479
|
+
callback.call(o, i, o[i], type || i);
|
|
2480
|
+
var property = o[i];
|
|
2481
|
+
var propertyType = _.util.type(property);
|
|
2482
|
+
if (propertyType === "Object" && !visited[objId(property)]) {
|
|
2483
|
+
visited[objId(property)] = true;
|
|
2484
|
+
DFS(property, callback, null, visited);
|
|
2485
|
+
} else if (propertyType === "Array" && !visited[objId(property)]) {
|
|
2486
|
+
visited[objId(property)] = true;
|
|
2487
|
+
DFS(property, callback, i, visited);
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
},
|
|
2492
|
+
plugins: {},
|
|
2493
|
+
/**
|
|
2494
|
+
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
|
2495
|
+
* and the language definitions to use, and returns a string with the HTML produced.
|
|
2496
|
+
*
|
|
2497
|
+
* The following hooks will be run:
|
|
2498
|
+
* 1. `before-tokenize`
|
|
2499
|
+
* 2. `after-tokenize`
|
|
2500
|
+
* 3. `wrap`: On each {@link Token}.
|
|
2501
|
+
*
|
|
2502
|
+
* @param {string} text A string with the code to be highlighted.
|
|
2503
|
+
* @param {Grammar} grammar An object containing the tokens to use.
|
|
2504
|
+
*
|
|
2505
|
+
* Usually a language definition like `Prism.languages.markup`.
|
|
2506
|
+
* @param {string} language The name of the language definition passed to `grammar`.
|
|
2507
|
+
* @returns {string} The highlighted HTML.
|
|
2508
|
+
* @memberof Prism
|
|
2509
|
+
* @public
|
|
2510
|
+
* @example
|
|
2511
|
+
* Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
|
|
2512
|
+
*/
|
|
2513
|
+
highlight: function(text, grammar, language) {
|
|
2514
|
+
var env = {
|
|
2515
|
+
code: text,
|
|
2516
|
+
grammar,
|
|
2517
|
+
language
|
|
2518
|
+
};
|
|
2519
|
+
_.hooks.run("before-tokenize", env);
|
|
2520
|
+
if (!env.grammar) throw new Error("The language \"" + env.language + "\" has no grammar.");
|
|
2521
|
+
env.tokens = _.tokenize(env.code, env.grammar);
|
|
2522
|
+
_.hooks.run("after-tokenize", env);
|
|
2523
|
+
return Token.stringify(_.util.encode(env.tokens), env.language);
|
|
2524
|
+
},
|
|
2525
|
+
/**
|
|
2526
|
+
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
|
2527
|
+
* and the language definitions to use, and returns an array with the tokenized code.
|
|
2528
|
+
*
|
|
2529
|
+
* When the language definition includes nested tokens, the function is called recursively on each of these tokens.
|
|
2530
|
+
*
|
|
2531
|
+
* This method could be useful in other contexts as well, as a very crude parser.
|
|
2532
|
+
*
|
|
2533
|
+
* @param {string} text A string with the code to be highlighted.
|
|
2534
|
+
* @param {Grammar} grammar An object containing the tokens to use.
|
|
2535
|
+
*
|
|
2536
|
+
* Usually a language definition like `Prism.languages.markup`.
|
|
2537
|
+
* @returns {TokenStream} An array of strings and tokens, a token stream.
|
|
2538
|
+
* @memberof Prism
|
|
2539
|
+
* @public
|
|
2540
|
+
* @example
|
|
2541
|
+
* let code = `var foo = 0;`;
|
|
2542
|
+
* let tokens = Prism.tokenize(code, Prism.languages.javascript);
|
|
2543
|
+
* tokens.forEach(token => {
|
|
2544
|
+
* if (token instanceof Prism.Token && token.type === 'number') {
|
|
2545
|
+
* console.log(`Found numeric literal: ${token.content}`);
|
|
2546
|
+
* }
|
|
2547
|
+
* });
|
|
2548
|
+
*/
|
|
2549
|
+
tokenize: function(text, grammar) {
|
|
2550
|
+
var rest = grammar.rest;
|
|
2551
|
+
if (rest) {
|
|
2552
|
+
for (var token in rest) grammar[token] = rest[token];
|
|
2553
|
+
delete grammar.rest;
|
|
2554
|
+
}
|
|
2555
|
+
var tokenList = new LinkedList();
|
|
2556
|
+
addAfter(tokenList, tokenList.head, text);
|
|
2557
|
+
matchGrammar(text, tokenList, grammar, tokenList.head, 0);
|
|
2558
|
+
return toArray(tokenList);
|
|
2559
|
+
},
|
|
2560
|
+
/**
|
|
2561
|
+
* @namespace
|
|
2562
|
+
* @memberof Prism
|
|
2563
|
+
* @public
|
|
2564
|
+
*/
|
|
2565
|
+
hooks: {
|
|
2566
|
+
all: {},
|
|
2567
|
+
/**
|
|
2568
|
+
* Adds the given callback to the list of callbacks for the given hook.
|
|
2569
|
+
*
|
|
2570
|
+
* The callback will be invoked when the hook it is registered for is run.
|
|
2571
|
+
* Hooks are usually directly run by a highlight function but you can also run hooks yourself.
|
|
2572
|
+
*
|
|
2573
|
+
* One callback function can be registered to multiple hooks and the same hook multiple times.
|
|
2574
|
+
*
|
|
2575
|
+
* @param {string} name The name of the hook.
|
|
2576
|
+
* @param {HookCallback} callback The callback function which is given environment variables.
|
|
2577
|
+
* @public
|
|
2578
|
+
*/
|
|
2579
|
+
add: function(name, callback) {
|
|
2580
|
+
var hooks = _.hooks.all;
|
|
2581
|
+
hooks[name] = hooks[name] || [];
|
|
2582
|
+
hooks[name].push(callback);
|
|
2583
|
+
},
|
|
2584
|
+
/**
|
|
2585
|
+
* Runs a hook invoking all registered callbacks with the given environment variables.
|
|
2586
|
+
*
|
|
2587
|
+
* Callbacks will be invoked synchronously and in the order in which they were registered.
|
|
2588
|
+
*
|
|
2589
|
+
* @param {string} name The name of the hook.
|
|
2590
|
+
* @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
|
|
2591
|
+
* @public
|
|
2592
|
+
*/
|
|
2593
|
+
run: function(name, env) {
|
|
2594
|
+
var callbacks = _.hooks.all[name];
|
|
2595
|
+
if (!callbacks || !callbacks.length) return;
|
|
2596
|
+
for (var i = 0, callback; callback = callbacks[i++];) callback(env);
|
|
2597
|
+
}
|
|
2598
|
+
},
|
|
2599
|
+
Token
|
|
2600
|
+
};
|
|
2601
|
+
/**
|
|
2602
|
+
* Creates a new token.
|
|
2603
|
+
*
|
|
2604
|
+
* @param {string} type See {@link Token#type type}
|
|
2605
|
+
* @param {string | TokenStream} content See {@link Token#content content}
|
|
2606
|
+
* @param {string|string[]} [alias] The alias(es) of the token.
|
|
2607
|
+
* @param {string} [matchedStr=""] A copy of the full string this token was created from.
|
|
2608
|
+
* @class
|
|
2609
|
+
* @global
|
|
2610
|
+
* @public
|
|
2611
|
+
*/
|
|
2612
|
+
function Token(type, content, alias, matchedStr) {
|
|
2613
|
+
/**
|
|
2614
|
+
* The type of the token.
|
|
2615
|
+
*
|
|
2616
|
+
* This is usually the key of a pattern in a {@link Grammar}.
|
|
2617
|
+
*
|
|
2618
|
+
* @type {string}
|
|
2619
|
+
* @see GrammarToken
|
|
2620
|
+
* @public
|
|
2621
|
+
*/
|
|
2622
|
+
this.type = type;
|
|
2623
|
+
/**
|
|
2624
|
+
* The strings or tokens contained by this token.
|
|
2625
|
+
*
|
|
2626
|
+
* This will be a token stream if the pattern matched also defined an `inside` grammar.
|
|
2627
|
+
*
|
|
2628
|
+
* @type {string | TokenStream}
|
|
2629
|
+
* @public
|
|
2630
|
+
*/
|
|
2631
|
+
this.content = content;
|
|
2632
|
+
/**
|
|
2633
|
+
* The alias(es) of the token.
|
|
2634
|
+
*
|
|
2635
|
+
* @type {string|string[]}
|
|
2636
|
+
* @see GrammarToken
|
|
2637
|
+
* @public
|
|
2638
|
+
*/
|
|
2639
|
+
this.alias = alias;
|
|
2640
|
+
this.length = (matchedStr || "").length | 0;
|
|
2641
|
+
}
|
|
2642
|
+
/**
|
|
2643
|
+
* A token stream is an array of strings and {@link Token Token} objects.
|
|
2644
|
+
*
|
|
2645
|
+
* Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
|
|
2646
|
+
* them.
|
|
2647
|
+
*
|
|
2648
|
+
* 1. No adjacent strings.
|
|
2649
|
+
* 2. No empty strings.
|
|
2650
|
+
*
|
|
2651
|
+
* The only exception here is the token stream that only contains the empty string and nothing else.
|
|
2652
|
+
*
|
|
2653
|
+
* @typedef {Array<string | Token>} TokenStream
|
|
2654
|
+
* @global
|
|
2655
|
+
* @public
|
|
2656
|
+
*/
|
|
2657
|
+
/**
|
|
2658
|
+
* @param {RegExp} pattern
|
|
2659
|
+
* @param {number} pos
|
|
2660
|
+
* @param {string} text
|
|
2661
|
+
* @param {boolean} lookbehind
|
|
2662
|
+
* @returns {RegExpExecArray | null}
|
|
2663
|
+
*/
|
|
2664
|
+
function matchPattern(pattern, pos, text, lookbehind) {
|
|
2665
|
+
pattern.lastIndex = pos;
|
|
2666
|
+
var match = pattern.exec(text);
|
|
2667
|
+
if (match && lookbehind && match[1]) {
|
|
2668
|
+
var lookbehindLength = match[1].length;
|
|
2669
|
+
match.index += lookbehindLength;
|
|
2670
|
+
match[0] = match[0].slice(lookbehindLength);
|
|
2671
|
+
}
|
|
2672
|
+
return match;
|
|
2673
|
+
}
|
|
2674
|
+
/**
|
|
2675
|
+
* @param {string} text
|
|
2676
|
+
* @param {LinkedList<string | Token>} tokenList
|
|
2677
|
+
* @param {any} grammar
|
|
2678
|
+
* @param {LinkedListNode<string | Token>} startNode
|
|
2679
|
+
* @param {number} startPos
|
|
2680
|
+
* @param {RematchOptions} [rematch]
|
|
2681
|
+
* @returns {void}
|
|
2682
|
+
* @private
|
|
2683
|
+
*
|
|
2684
|
+
* @typedef RematchOptions
|
|
2685
|
+
* @property {string} cause
|
|
2686
|
+
* @property {number} reach
|
|
2687
|
+
*/
|
|
2688
|
+
function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
|
|
2689
|
+
for (var token in grammar) {
|
|
2690
|
+
if (!grammar.hasOwnProperty(token) || !grammar[token]) continue;
|
|
2691
|
+
var patterns = grammar[token];
|
|
2692
|
+
patterns = Array.isArray(patterns) ? patterns : [patterns];
|
|
2693
|
+
for (var j = 0; j < patterns.length; ++j) {
|
|
2694
|
+
if (rematch && rematch.cause == token + "," + j) return;
|
|
2695
|
+
var patternObj = patterns[j];
|
|
2696
|
+
var inside = patternObj.inside;
|
|
2697
|
+
var lookbehind = !!patternObj.lookbehind;
|
|
2698
|
+
var greedy = !!patternObj.greedy;
|
|
2699
|
+
var alias = patternObj.alias;
|
|
2700
|
+
if (greedy && !patternObj.pattern.global) {
|
|
2701
|
+
var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
|
|
2702
|
+
patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
|
|
2703
|
+
}
|
|
2704
|
+
/** @type {RegExp} */
|
|
2705
|
+
var pattern = patternObj.pattern || patternObj;
|
|
2706
|
+
for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
|
|
2707
|
+
if (rematch && pos >= rematch.reach) break;
|
|
2708
|
+
var str = currentNode.value;
|
|
2709
|
+
if (tokenList.length > text.length) return;
|
|
2710
|
+
if (str instanceof Token) continue;
|
|
2711
|
+
var removeCount = 1;
|
|
2712
|
+
var match;
|
|
2713
|
+
if (greedy) {
|
|
2714
|
+
match = matchPattern(pattern, pos, text, lookbehind);
|
|
2715
|
+
if (!match || match.index >= text.length) break;
|
|
2716
|
+
var from = match.index;
|
|
2717
|
+
var to = match.index + match[0].length;
|
|
2718
|
+
var p = pos;
|
|
2719
|
+
p += currentNode.value.length;
|
|
2720
|
+
while (from >= p) {
|
|
2721
|
+
currentNode = currentNode.next;
|
|
2722
|
+
p += currentNode.value.length;
|
|
2723
|
+
}
|
|
2724
|
+
p -= currentNode.value.length;
|
|
2725
|
+
pos = p;
|
|
2726
|
+
if (currentNode.value instanceof Token) continue;
|
|
2727
|
+
for (var k = currentNode; k !== tokenList.tail && (p < to || typeof k.value === "string"); k = k.next) {
|
|
2728
|
+
removeCount++;
|
|
2729
|
+
p += k.value.length;
|
|
2730
|
+
}
|
|
2731
|
+
removeCount--;
|
|
2732
|
+
str = text.slice(pos, p);
|
|
2733
|
+
match.index -= pos;
|
|
2734
|
+
} else {
|
|
2735
|
+
match = matchPattern(pattern, 0, str, lookbehind);
|
|
2736
|
+
if (!match) continue;
|
|
2737
|
+
}
|
|
2738
|
+
var from = match.index;
|
|
2739
|
+
var matchStr = match[0];
|
|
2740
|
+
var before = str.slice(0, from);
|
|
2741
|
+
var after = str.slice(from + matchStr.length);
|
|
2742
|
+
var reach = pos + str.length;
|
|
2743
|
+
if (rematch && reach > rematch.reach) rematch.reach = reach;
|
|
2744
|
+
var removeFrom = currentNode.prev;
|
|
2745
|
+
if (before) {
|
|
2746
|
+
removeFrom = addAfter(tokenList, removeFrom, before);
|
|
2747
|
+
pos += before.length;
|
|
2748
|
+
}
|
|
2749
|
+
removeRange(tokenList, removeFrom, removeCount);
|
|
2750
|
+
var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
|
|
2751
|
+
currentNode = addAfter(tokenList, removeFrom, wrapped);
|
|
2752
|
+
if (after) addAfter(tokenList, currentNode, after);
|
|
2753
|
+
if (removeCount > 1) {
|
|
2754
|
+
/** @type {RematchOptions} */
|
|
2755
|
+
var nestedRematch = {
|
|
2756
|
+
cause: token + "," + j,
|
|
2757
|
+
reach
|
|
2758
|
+
};
|
|
2759
|
+
matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
|
|
2760
|
+
if (rematch && nestedRematch.reach > rematch.reach) rematch.reach = nestedRematch.reach;
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
/**
|
|
2767
|
+
* @typedef LinkedListNode
|
|
2768
|
+
* @property {T} value
|
|
2769
|
+
* @property {LinkedListNode<T> | null} prev The previous node.
|
|
2770
|
+
* @property {LinkedListNode<T> | null} next The next node.
|
|
2771
|
+
* @template T
|
|
2772
|
+
* @private
|
|
2773
|
+
*/
|
|
2774
|
+
/**
|
|
2775
|
+
* @template T
|
|
2776
|
+
* @private
|
|
2777
|
+
*/
|
|
2778
|
+
function LinkedList() {
|
|
2779
|
+
/** @type {LinkedListNode<T>} */
|
|
2780
|
+
var head = {
|
|
2781
|
+
value: null,
|
|
2782
|
+
prev: null,
|
|
2783
|
+
next: null
|
|
2784
|
+
};
|
|
2785
|
+
/** @type {LinkedListNode<T>} */
|
|
2786
|
+
var tail = {
|
|
2787
|
+
value: null,
|
|
2788
|
+
prev: head,
|
|
2789
|
+
next: null
|
|
2790
|
+
};
|
|
2791
|
+
head.next = tail;
|
|
2792
|
+
/** @type {LinkedListNode<T>} */
|
|
2793
|
+
this.head = head;
|
|
2794
|
+
/** @type {LinkedListNode<T>} */
|
|
2795
|
+
this.tail = tail;
|
|
2796
|
+
this.length = 0;
|
|
2797
|
+
}
|
|
2798
|
+
/**
|
|
2799
|
+
* Adds a new node with the given value to the list.
|
|
2800
|
+
*
|
|
2801
|
+
* @param {LinkedList<T>} list
|
|
2802
|
+
* @param {LinkedListNode<T>} node
|
|
2803
|
+
* @param {T} value
|
|
2804
|
+
* @returns {LinkedListNode<T>} The added node.
|
|
2805
|
+
* @template T
|
|
2806
|
+
*/
|
|
2807
|
+
function addAfter(list, node, value) {
|
|
2808
|
+
var next = node.next;
|
|
2809
|
+
var newNode = {
|
|
2810
|
+
value,
|
|
2811
|
+
prev: node,
|
|
2812
|
+
next
|
|
2813
|
+
};
|
|
2814
|
+
node.next = newNode;
|
|
2815
|
+
next.prev = newNode;
|
|
2816
|
+
list.length++;
|
|
2817
|
+
return newNode;
|
|
2818
|
+
}
|
|
2819
|
+
/**
|
|
2820
|
+
* Removes `count` nodes after the given node. The given node will not be removed.
|
|
2821
|
+
*
|
|
2822
|
+
* @param {LinkedList<T>} list
|
|
2823
|
+
* @param {LinkedListNode<T>} node
|
|
2824
|
+
* @param {number} count
|
|
2825
|
+
* @template T
|
|
2826
|
+
*/
|
|
2827
|
+
function removeRange(list, node, count) {
|
|
2828
|
+
var next = node.next;
|
|
2829
|
+
for (var i = 0; i < count && next !== list.tail; i++) next = next.next;
|
|
2830
|
+
node.next = next;
|
|
2831
|
+
next.prev = node;
|
|
2832
|
+
list.length -= i;
|
|
2833
|
+
}
|
|
2834
|
+
/**
|
|
2835
|
+
* @param {LinkedList<T>} list
|
|
2836
|
+
* @returns {T[]}
|
|
2837
|
+
* @template T
|
|
2838
|
+
*/
|
|
2839
|
+
function toArray(list) {
|
|
2840
|
+
var array = [];
|
|
2841
|
+
var node = list.head.next;
|
|
2842
|
+
while (node !== list.tail) {
|
|
2843
|
+
array.push(node.value);
|
|
2844
|
+
node = node.next;
|
|
2845
|
+
}
|
|
2846
|
+
return array;
|
|
2847
|
+
}
|
|
2848
|
+
const Prism = _;
|
|
2849
|
+
|
|
2850
|
+
//#endregion
|
|
2851
|
+
//#region ../../node_modules/.pnpm/refractor@5.0.0/node_modules/refractor/lib/core.js
|
|
2852
|
+
/**
|
|
2853
|
+
* @import {Element, Root, Text} from 'hast'
|
|
2854
|
+
* @import {Grammar, Languages} from 'prismjs'
|
|
2855
|
+
*/
|
|
2856
|
+
/**
|
|
2857
|
+
* @typedef _Token
|
|
2858
|
+
* Hidden Prism token.
|
|
2859
|
+
* @property {string} alias
|
|
2860
|
+
* Alias.
|
|
2861
|
+
* @property {string} content
|
|
2862
|
+
* Content.
|
|
2863
|
+
* @property {number} length
|
|
2864
|
+
* Length.
|
|
2865
|
+
* @property {string} type
|
|
2866
|
+
* Type.
|
|
2867
|
+
*/
|
|
2868
|
+
/**
|
|
2869
|
+
* @typedef _Env
|
|
2870
|
+
* Hidden Prism environment.
|
|
2871
|
+
* @property {Record<string, string>} attributes
|
|
2872
|
+
* Attributes.
|
|
2873
|
+
* @property {Array<string>} classes
|
|
2874
|
+
* Classes.
|
|
2875
|
+
* @property {Array<Element | Text> | Element | Text} content
|
|
2876
|
+
* Content.
|
|
2877
|
+
* @property {string} language
|
|
2878
|
+
* Language.
|
|
2879
|
+
* @property {string} tag
|
|
2880
|
+
* Tag.
|
|
2881
|
+
* @property {string} type
|
|
2882
|
+
* Type.
|
|
2883
|
+
*/
|
|
2884
|
+
/**
|
|
2885
|
+
* @typedef {((prism: Refractor) => undefined | void) & {aliases?: Array<string> | undefined, displayName: string}} Syntax
|
|
2886
|
+
* Refractor syntax function.
|
|
2887
|
+
*/
|
|
2888
|
+
/**
|
|
2889
|
+
* @typedef Refractor
|
|
2890
|
+
* Virtual syntax highlighting
|
|
2891
|
+
* @property {typeof alias} alias
|
|
2892
|
+
* @property {Languages} languages
|
|
2893
|
+
* @property {typeof listLanguages} listLanguages
|
|
2894
|
+
* @property {typeof highlight} highlight
|
|
2895
|
+
* @property {typeof registered} registered
|
|
2896
|
+
* @property {typeof register} register
|
|
2897
|
+
*/
|
|
2898
|
+
var core_exports = /* @__PURE__ */ __exportAll({ refractor: () => refractor });
|
|
2899
|
+
function Refractor() {}
|
|
2900
|
+
Refractor.prototype = Prism;
|
|
2901
|
+
/** @type {Refractor} */
|
|
2902
|
+
const refractor = new Refractor();
|
|
2903
|
+
refractor.highlight = highlight;
|
|
2904
|
+
refractor.register = register;
|
|
2905
|
+
refractor.alias = alias;
|
|
2906
|
+
refractor.registered = registered;
|
|
2907
|
+
refractor.listLanguages = listLanguages;
|
|
2908
|
+
refractor.util.encode = encode;
|
|
2909
|
+
refractor.Token.stringify = stringify;
|
|
2910
|
+
/**
|
|
2911
|
+
* Highlight `value` (code) as `language` (programming language).
|
|
2912
|
+
*
|
|
2913
|
+
* @param {string} value
|
|
2914
|
+
* Code to highlight.
|
|
2915
|
+
* @param {Grammar | string} language
|
|
2916
|
+
* Programming language name, alias, or grammar.
|
|
2917
|
+
* @returns {Root}
|
|
2918
|
+
* Node representing highlighted code.
|
|
2919
|
+
*/
|
|
2920
|
+
function highlight(value, language) {
|
|
2921
|
+
if (typeof value !== "string") throw new TypeError("Expected `string` for `value`, got `" + value + "`");
|
|
2922
|
+
/** @type {Grammar} */
|
|
2923
|
+
let grammar;
|
|
2924
|
+
/** @type {string | undefined} */
|
|
2925
|
+
let name;
|
|
2926
|
+
/* c8 ignore next 2 */
|
|
2927
|
+
if (language && typeof language === "object") grammar = language;
|
|
2928
|
+
else {
|
|
2929
|
+
name = language;
|
|
2930
|
+
if (typeof name !== "string") throw new TypeError("Expected `string` for `name`, got `" + name + "`");
|
|
2931
|
+
if (Object.hasOwn(refractor.languages, name)) grammar = refractor.languages[name];
|
|
2932
|
+
else throw new Error("Unknown language: `" + name + "` is not registered");
|
|
2933
|
+
}
|
|
2934
|
+
return {
|
|
2935
|
+
type: "root",
|
|
2936
|
+
children: Prism.highlight.call(refractor, value, grammar, name)
|
|
2937
|
+
};
|
|
2938
|
+
}
|
|
2939
|
+
/**
|
|
2940
|
+
* Register a syntax.
|
|
2941
|
+
*
|
|
2942
|
+
* @param {Syntax} syntax
|
|
2943
|
+
* Language function made for refractor, as in, the files in
|
|
2944
|
+
* `refractor/lang/*.js`.
|
|
2945
|
+
* @returns {undefined}
|
|
2946
|
+
* Nothing.
|
|
2947
|
+
*/
|
|
2948
|
+
function register(syntax) {
|
|
2949
|
+
if (typeof syntax !== "function" || !syntax.displayName) throw new Error("Expected `function` for `syntax`, got `" + syntax + "`");
|
|
2950
|
+
if (!Object.hasOwn(refractor.languages, syntax.displayName)) syntax(refractor);
|
|
2951
|
+
}
|
|
2952
|
+
/**
|
|
2953
|
+
* Register aliases for already registered languages.
|
|
2954
|
+
*
|
|
2955
|
+
* @param {Record<string, ReadonlyArray<string> | string> | string} language
|
|
2956
|
+
* Language to alias.
|
|
2957
|
+
* @param {ReadonlyArray<string> | string | null | undefined} [alias]
|
|
2958
|
+
* Aliases.
|
|
2959
|
+
* @returns {undefined}
|
|
2960
|
+
* Nothing.
|
|
2961
|
+
*/
|
|
2962
|
+
function alias(language, alias) {
|
|
2963
|
+
const languages = refractor.languages;
|
|
2964
|
+
/** @type {Record<string, ReadonlyArray<string> | string>} */
|
|
2965
|
+
let map = {};
|
|
2966
|
+
if (typeof language === "string") {
|
|
2967
|
+
if (alias) map[language] = alias;
|
|
2968
|
+
} else map = language;
|
|
2969
|
+
/** @type {string} */
|
|
2970
|
+
let key;
|
|
2971
|
+
for (key in map) if (Object.hasOwn(map, key)) {
|
|
2972
|
+
const value = map[key];
|
|
2973
|
+
const list = typeof value === "string" ? [value] : value;
|
|
2974
|
+
let index = -1;
|
|
2975
|
+
while (++index < list.length) languages[list[index]] = languages[key];
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
/**
|
|
2979
|
+
* Check whether an `alias` or `language` is registered.
|
|
2980
|
+
*
|
|
2981
|
+
* @param {string} aliasOrLanguage
|
|
2982
|
+
* Language or alias to check.
|
|
2983
|
+
* @returns {boolean}
|
|
2984
|
+
* Whether the language is registered.
|
|
2985
|
+
*/
|
|
2986
|
+
function registered(aliasOrLanguage) {
|
|
2987
|
+
if (typeof aliasOrLanguage !== "string") throw new TypeError("Expected `string` for `aliasOrLanguage`, got `" + aliasOrLanguage + "`");
|
|
2988
|
+
return Object.hasOwn(refractor.languages, aliasOrLanguage);
|
|
2989
|
+
}
|
|
2990
|
+
/**
|
|
2991
|
+
* List all registered languages (names and aliases).
|
|
2992
|
+
*
|
|
2993
|
+
* @returns {Array<string>}
|
|
2994
|
+
* List of language names.
|
|
2995
|
+
*/
|
|
2996
|
+
function listLanguages() {
|
|
2997
|
+
const languages = refractor.languages;
|
|
2998
|
+
/** @type {Array<string>} */
|
|
2999
|
+
const list = [];
|
|
3000
|
+
/** @type {string} */
|
|
3001
|
+
let language;
|
|
3002
|
+
for (language in languages) if (Object.hasOwn(languages, language) && typeof languages[language] === "object") list.push(language);
|
|
3003
|
+
return list;
|
|
3004
|
+
}
|
|
3005
|
+
/**
|
|
3006
|
+
* @param {Array<_Token | string> | _Token | string} value
|
|
3007
|
+
* Token to stringify.
|
|
3008
|
+
* @param {string} language
|
|
3009
|
+
* Language of the token.
|
|
3010
|
+
* @returns {Array<Element | Text> | Element | Text}
|
|
3011
|
+
* Node representing the token.
|
|
3012
|
+
*/
|
|
3013
|
+
function stringify(value, language) {
|
|
3014
|
+
if (typeof value === "string") return {
|
|
3015
|
+
type: "text",
|
|
3016
|
+
value
|
|
3017
|
+
};
|
|
3018
|
+
if (Array.isArray(value)) {
|
|
3019
|
+
/** @type {Array<Element | Text>} */
|
|
3020
|
+
const result = [];
|
|
3021
|
+
let index = -1;
|
|
3022
|
+
while (++index < value.length) if (value[index] !== null && value[index] !== void 0 && value[index] !== "") result.push(stringify(value[index], language));
|
|
3023
|
+
return result;
|
|
3024
|
+
}
|
|
3025
|
+
/** @type {_Env} */
|
|
3026
|
+
const env = {
|
|
3027
|
+
attributes: {},
|
|
3028
|
+
classes: ["token", value.type],
|
|
3029
|
+
content: stringify(value.content, language),
|
|
3030
|
+
language,
|
|
3031
|
+
tag: "span",
|
|
3032
|
+
type: value.type
|
|
3033
|
+
};
|
|
3034
|
+
if (value.alias) env.classes.push(...typeof value.alias === "string" ? [value.alias] : value.alias);
|
|
3035
|
+
refractor.hooks.run("wrap", env);
|
|
3036
|
+
return h(env.tag + "." + env.classes.join("."), attributes(env.attributes), env.content);
|
|
3037
|
+
}
|
|
3038
|
+
/**
|
|
3039
|
+
* @template {unknown} T
|
|
3040
|
+
* Tokens.
|
|
3041
|
+
* @param {T} tokens
|
|
3042
|
+
* Input.
|
|
3043
|
+
* @returns {T}
|
|
3044
|
+
* Output, same as input.
|
|
3045
|
+
*/
|
|
3046
|
+
function encode(tokens) {
|
|
3047
|
+
return tokens;
|
|
3048
|
+
}
|
|
3049
|
+
/**
|
|
3050
|
+
* @param {Record<string, string>} record
|
|
3051
|
+
* Attributes.
|
|
3052
|
+
* @returns {Record<string, string>}
|
|
3053
|
+
* Attributes.
|
|
3054
|
+
*/
|
|
3055
|
+
function attributes(record) {
|
|
3056
|
+
/** @type {string} */
|
|
3057
|
+
let key;
|
|
3058
|
+
for (key in record) if (Object.hasOwn(record, key)) record[key] = parseEntities(record[key]);
|
|
3059
|
+
return record;
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
//#endregion
|
|
3063
|
+
export { svg as a, html as i, refractor as n, find as o, stringify$1 as r, stringify$2 as s, core_exports as t };
|