@lithent/lithent-template-parser 0.1.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/LICENSE +21 -0
- package/README.md +159 -0
- package/dist/codegen/createElement.d.ts +10 -0
- package/dist/codegen/index.d.ts +1 -0
- package/dist/compiler.d.ts +26 -0
- package/dist/docPipe/index.d.ts +40 -0
- package/dist/docPipe/scan.d.ts +6 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.mjs +2302 -0
- package/dist/index.mjs.map +1 -0
- package/dist/index.umd.cjs +13 -0
- package/dist/index.umd.cjs.map +1 -0
- package/dist/parser/ast.d.ts +207 -0
- package/dist/parser/lexer.d.ts +109 -0
- package/dist/parser/parser.d.ts +79 -0
- package/dist/parser/tokens.d.ts +51 -0
- package/dist/transform/directives.d.ts +30 -0
- package/dist/transform/index.d.ts +14 -0
- package/dist/transform/optimize.d.ts +21 -0
- package/package.json +53 -0
- package/src/codegen/createElement.ts +661 -0
- package/src/codegen/index.ts +1 -0
- package/src/compiler.ts +70 -0
- package/src/docPipe/index.ts +104 -0
- package/src/docPipe/scan.ts +318 -0
- package/src/index.ts +16 -0
- package/src/parser/ast.ts +478 -0
- package/src/parser/lexer.ts +561 -0
- package/src/parser/parser.ts +514 -0
- package/src/parser/tokens.ts +84 -0
- package/src/playground/main.ts +206 -0
- package/src/playground/style.css +135 -0
- package/src/shims/babel-env.ts +17 -0
- package/src/tests/compiler.test.ts +434 -0
- package/src/tests/docPipe.test.ts +41 -0
- package/src/tests/helpers.ts +96 -0
- package/src/tests/lexer.test.ts +282 -0
- package/src/tests/parser.test.ts +691 -0
- package/src/transform/directives.ts +160 -0
- package/src/transform/index.ts +29 -0
- package/src/transform/optimize.ts +203 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2302 @@
|
|
|
1
|
+
var ht = Object.defineProperty;
|
|
2
|
+
var lt = (i, t, e) => t in i ? ht(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var g = (i, t, e) => lt(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
var c = /* @__PURE__ */ ((i) => (i.TAG_OPEN_START = "TAG_OPEN_START", i.TAG_OPEN_END = "TAG_OPEN_END", i.TAG_CLOSE_START = "TAG_CLOSE_START", i.TAG_SELF_CLOSE = "TAG_SELF_CLOSE", i.IDENTIFIER = "IDENTIFIER", i.ATTRIBUTE_EQUALS = "ATTRIBUTE_EQUALS", i.STRING_LITERAL = "STRING_LITERAL", i.EXPRESSION_START = "EXPRESSION_START", i.EXPRESSION_END = "EXPRESSION_END", i.EXPRESSION_CONTENT = "EXPRESSION_CONTENT", i.DIRECTIVE_IF = "DIRECTIVE_IF", i.DIRECTIVE_ELSE_IF = "DIRECTIVE_ELSE_IF", i.DIRECTIVE_ELSE = "DIRECTIVE_ELSE", i.DIRECTIVE_FOR = "DIRECTIVE_FOR", i.FRAGMENT_OPEN = "FRAGMENT_OPEN", i.FRAGMENT_CLOSE = "FRAGMENT_CLOSE", i.KEYWORD_REF = "KEYWORD_REF", i.TEXT = "TEXT", i.COMMENT = "COMMENT", i.WHITESPACE = "WHITESPACE", i.EOF = "EOF", i))(c || {});
|
|
5
|
+
function ct(i, t, e) {
|
|
6
|
+
return { line: i, column: t, offset: e };
|
|
7
|
+
}
|
|
8
|
+
function p(i, t, e, n) {
|
|
9
|
+
return { type: i, value: t, start: e, end: n };
|
|
10
|
+
}
|
|
11
|
+
class at {
|
|
12
|
+
constructor(t) {
|
|
13
|
+
g(this, "input");
|
|
14
|
+
g(this, "position", 0);
|
|
15
|
+
g(this, "line", 1);
|
|
16
|
+
g(this, "column", 1);
|
|
17
|
+
g(this, "tokens", []);
|
|
18
|
+
this.input = t;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Tokenize the entire input
|
|
22
|
+
*/
|
|
23
|
+
tokenize() {
|
|
24
|
+
for (; this.position < this.input.length; )
|
|
25
|
+
this.readToken();
|
|
26
|
+
const t = this.getCurrentPosition();
|
|
27
|
+
return this.tokens.push(p(c.EOF, "", t, t)), this.tokens;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get current position
|
|
31
|
+
*/
|
|
32
|
+
getCurrentPosition() {
|
|
33
|
+
return ct(this.line, this.column, this.position);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Peek at character without consuming
|
|
37
|
+
*/
|
|
38
|
+
peek(t = 0) {
|
|
39
|
+
return this.input[this.position + t] || "";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Consume and return current character
|
|
43
|
+
*/
|
|
44
|
+
advance() {
|
|
45
|
+
const t = this.input[this.position];
|
|
46
|
+
return this.position++, t === `
|
|
47
|
+
` ? (this.line++, this.column = 1) : this.column++, t;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if we've reached the end
|
|
51
|
+
*/
|
|
52
|
+
isEOF() {
|
|
53
|
+
return this.position >= this.input.length;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Read next token
|
|
57
|
+
*/
|
|
58
|
+
readToken() {
|
|
59
|
+
const t = this.peek();
|
|
60
|
+
if (t === "<" && this.peek(1) === ">") {
|
|
61
|
+
this.readFragmentOpen();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (t === "<" && this.peek(1) === "/" && this.peek(2) === ">") {
|
|
65
|
+
this.readFragmentClose();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (t === "<" && this.peek(1) === "!" && this.peek(2) === "-" && this.peek(3) === "-") {
|
|
69
|
+
this.readComment();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (t === "<") {
|
|
73
|
+
this.peek(1) === "/" ? this.readCloseTag() : this.readOpenTag();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (t === "{") {
|
|
77
|
+
this.readExpression();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (this.isWhitespace(t)) {
|
|
81
|
+
this.readWhitespace();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
this.readText();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Read HTML comment
|
|
88
|
+
*/
|
|
89
|
+
readComment() {
|
|
90
|
+
const t = this.getCurrentPosition();
|
|
91
|
+
let e = "";
|
|
92
|
+
for (e += this.advance() + this.advance() + this.advance() + this.advance(); !this.isEOF(); ) {
|
|
93
|
+
if (this.peek() === "-" && this.peek(1) === "-" && this.peek(2) === ">") {
|
|
94
|
+
e += this.advance() + this.advance() + this.advance();
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
e += this.advance();
|
|
98
|
+
}
|
|
99
|
+
const n = this.getCurrentPosition();
|
|
100
|
+
this.tokens.push(p(c.COMMENT, e, t, n));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Read opening tag <
|
|
104
|
+
*/
|
|
105
|
+
readOpenTag() {
|
|
106
|
+
const t = this.getCurrentPosition();
|
|
107
|
+
this.advance();
|
|
108
|
+
const e = this.getCurrentPosition();
|
|
109
|
+
this.tokens.push(p(c.TAG_OPEN_START, "<", t, e)), this.readTagContent();
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Read closing tag </
|
|
113
|
+
*/
|
|
114
|
+
readCloseTag() {
|
|
115
|
+
const t = this.getCurrentPosition();
|
|
116
|
+
this.advance(), this.advance();
|
|
117
|
+
const e = this.getCurrentPosition();
|
|
118
|
+
if (this.tokens.push(p(c.TAG_CLOSE_START, "</", t, e)), this.skipWhitespace(), this.readIdentifier(), this.skipWhitespace(), this.peek() === ">") {
|
|
119
|
+
const n = this.getCurrentPosition();
|
|
120
|
+
this.advance();
|
|
121
|
+
const r = this.getCurrentPosition();
|
|
122
|
+
this.tokens.push(p(c.TAG_OPEN_END, ">", n, r));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Read tag content (tag name and attributes)
|
|
127
|
+
*/
|
|
128
|
+
readTagContent() {
|
|
129
|
+
for (this.skipWhitespace(), this.readIdentifier(); !this.isEOF(); ) {
|
|
130
|
+
this.skipWhitespace();
|
|
131
|
+
const t = this.peek();
|
|
132
|
+
if (t === "/" && this.peek(1) === ">") {
|
|
133
|
+
const e = this.getCurrentPosition();
|
|
134
|
+
this.advance(), this.advance();
|
|
135
|
+
const n = this.getCurrentPosition();
|
|
136
|
+
this.tokens.push(
|
|
137
|
+
p(c.TAG_SELF_CLOSE, "/>", e, n)
|
|
138
|
+
);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (t === ">") {
|
|
142
|
+
const e = this.getCurrentPosition();
|
|
143
|
+
this.advance();
|
|
144
|
+
const n = this.getCurrentPosition();
|
|
145
|
+
this.tokens.push(p(c.TAG_OPEN_END, ">", e, n));
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
this.readAttribute();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Read an attribute (name and optional value)
|
|
153
|
+
*/
|
|
154
|
+
readAttribute() {
|
|
155
|
+
if (this.readIdentifier() && (this.skipWhitespace(), this.peek() === "=")) {
|
|
156
|
+
const e = this.getCurrentPosition();
|
|
157
|
+
this.advance();
|
|
158
|
+
const n = this.getCurrentPosition();
|
|
159
|
+
this.tokens.push(
|
|
160
|
+
p(c.ATTRIBUTE_EQUALS, "=", e, n)
|
|
161
|
+
), this.skipWhitespace();
|
|
162
|
+
const r = this.peek();
|
|
163
|
+
r === '"' || r === "'" ? this.readStringLiteral() : r === "{" && this.readExpression();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Read identifier (tag name or attribute name)
|
|
168
|
+
*/
|
|
169
|
+
readIdentifier() {
|
|
170
|
+
const t = this.getCurrentPosition();
|
|
171
|
+
let e = "";
|
|
172
|
+
const n = this.peek();
|
|
173
|
+
if (this.isIdentifierStart(n))
|
|
174
|
+
e += this.advance();
|
|
175
|
+
else {
|
|
176
|
+
const o = this.getCurrentPosition(), l = this.advance(), h = this.getCurrentPosition();
|
|
177
|
+
return this.tokens.push(
|
|
178
|
+
p(c.TEXT, l, o, h)
|
|
179
|
+
), "";
|
|
180
|
+
}
|
|
181
|
+
for (; !this.isEOF() && this.isIdentifierPart(this.peek()); )
|
|
182
|
+
e += this.advance();
|
|
183
|
+
const r = this.getCurrentPosition(), s = this.getIdentifierTokenType(e);
|
|
184
|
+
return this.tokens.push(p(s, e, t, r)), e;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Determine token type for identifier
|
|
188
|
+
*/
|
|
189
|
+
getIdentifierTokenType(t) {
|
|
190
|
+
switch (t) {
|
|
191
|
+
case "l-if":
|
|
192
|
+
return c.DIRECTIVE_IF;
|
|
193
|
+
case "l-else-if":
|
|
194
|
+
return c.DIRECTIVE_ELSE_IF;
|
|
195
|
+
case "l-else":
|
|
196
|
+
return c.DIRECTIVE_ELSE;
|
|
197
|
+
case "l-for":
|
|
198
|
+
return c.DIRECTIVE_FOR;
|
|
199
|
+
case "ref":
|
|
200
|
+
return c.KEYWORD_REF;
|
|
201
|
+
default:
|
|
202
|
+
return c.IDENTIFIER;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Read string literal
|
|
207
|
+
*/
|
|
208
|
+
readStringLiteral() {
|
|
209
|
+
const t = this.getCurrentPosition(), e = this.advance();
|
|
210
|
+
let n = e, r = !1;
|
|
211
|
+
for (; !this.isEOF(); ) {
|
|
212
|
+
const o = this.peek();
|
|
213
|
+
if (r) {
|
|
214
|
+
n += this.advance(), r = !1;
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (o === "\\") {
|
|
218
|
+
r = !0, n += this.advance();
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (o === e) {
|
|
222
|
+
n += this.advance();
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
n += this.advance();
|
|
226
|
+
}
|
|
227
|
+
const s = this.getCurrentPosition();
|
|
228
|
+
this.tokens.push(p(c.STRING_LITERAL, n, t, s));
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Read fragment open <>
|
|
232
|
+
*/
|
|
233
|
+
readFragmentOpen() {
|
|
234
|
+
const t = this.getCurrentPosition();
|
|
235
|
+
this.advance(), this.advance();
|
|
236
|
+
const e = this.getCurrentPosition();
|
|
237
|
+
this.tokens.push(p(c.FRAGMENT_OPEN, "<>", t, e));
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Read fragment close </>
|
|
241
|
+
*/
|
|
242
|
+
readFragmentClose() {
|
|
243
|
+
const t = this.getCurrentPosition();
|
|
244
|
+
this.advance(), this.advance(), this.advance();
|
|
245
|
+
const e = this.getCurrentPosition();
|
|
246
|
+
this.tokens.push(p(c.FRAGMENT_CLOSE, "</>", t, e));
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Read expression content inside {}
|
|
250
|
+
*/
|
|
251
|
+
readExpression() {
|
|
252
|
+
const t = this.getCurrentPosition();
|
|
253
|
+
this.advance();
|
|
254
|
+
const e = this.getCurrentPosition();
|
|
255
|
+
this.tokens.push(
|
|
256
|
+
p(c.EXPRESSION_START, "{", t, e)
|
|
257
|
+
);
|
|
258
|
+
let n = "", r = 1, s = null, o = !1, l = null, h = e;
|
|
259
|
+
const a = () => {
|
|
260
|
+
const u = this.getCurrentPosition(), d = this.advance(), y = this.getCurrentPosition();
|
|
261
|
+
return n += d, l || (l = u), h = y, d;
|
|
262
|
+
};
|
|
263
|
+
for (; !this.isEOF() && r > 0; ) {
|
|
264
|
+
const u = this.peek();
|
|
265
|
+
if (s) {
|
|
266
|
+
if (o) {
|
|
267
|
+
a(), o = !1;
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (u === "\\") {
|
|
271
|
+
o = !0, a();
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (u === s) {
|
|
275
|
+
a(), s = null;
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
a();
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
if (u === '"' || u === "'" || u === "`") {
|
|
282
|
+
s = u, a();
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
if (u === "{") {
|
|
286
|
+
r++, a();
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
if (u === "}") {
|
|
290
|
+
if (r--, r === 0) {
|
|
291
|
+
if (n.trim()) {
|
|
292
|
+
const st = l ?? e, ot = h;
|
|
293
|
+
this.tokens.push(
|
|
294
|
+
p(c.EXPRESSION_CONTENT, n, st, ot)
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
const d = this.getCurrentPosition();
|
|
298
|
+
this.advance();
|
|
299
|
+
const y = this.getCurrentPosition();
|
|
300
|
+
this.tokens.push(
|
|
301
|
+
p(c.EXPRESSION_END, "}", d, y)
|
|
302
|
+
);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
a();
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
a();
|
|
309
|
+
}
|
|
310
|
+
if (n.trim()) {
|
|
311
|
+
const u = l ?? e, d = l ? h : this.getCurrentPosition();
|
|
312
|
+
this.tokens.push(
|
|
313
|
+
p(c.EXPRESSION_CONTENT, n, u, d)
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Read text content
|
|
319
|
+
*/
|
|
320
|
+
readText() {
|
|
321
|
+
const t = this.getCurrentPosition();
|
|
322
|
+
let e = "";
|
|
323
|
+
for (; !this.isEOF(); ) {
|
|
324
|
+
const n = this.peek();
|
|
325
|
+
if (n === "<" || n === "{")
|
|
326
|
+
break;
|
|
327
|
+
e += this.advance();
|
|
328
|
+
}
|
|
329
|
+
if (e) {
|
|
330
|
+
const n = this.getCurrentPosition();
|
|
331
|
+
this.tokens.push(p(c.TEXT, e, t, n));
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Read whitespace
|
|
336
|
+
*/
|
|
337
|
+
readWhitespace() {
|
|
338
|
+
const t = this.getCurrentPosition();
|
|
339
|
+
let e = "";
|
|
340
|
+
for (; !this.isEOF() && this.isWhitespace(this.peek()); )
|
|
341
|
+
e += this.advance();
|
|
342
|
+
const n = this.getCurrentPosition();
|
|
343
|
+
this.tokens.push(p(c.WHITESPACE, e, t, n));
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Skip whitespace without creating tokens
|
|
347
|
+
*/
|
|
348
|
+
skipWhitespace() {
|
|
349
|
+
for (; !this.isEOF() && this.isWhitespace(this.peek()); )
|
|
350
|
+
this.advance();
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Check if character is whitespace
|
|
354
|
+
*/
|
|
355
|
+
isWhitespace(t) {
|
|
356
|
+
return /\s/.test(t);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Check if character can start an identifier
|
|
360
|
+
*/
|
|
361
|
+
isIdentifierStart(t) {
|
|
362
|
+
return /[a-zA-Z_$:]/.test(t);
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Check if character can be part of an identifier
|
|
366
|
+
*/
|
|
367
|
+
isIdentifierPart(t) {
|
|
368
|
+
return /[a-zA-Z0-9_$:.-]/.test(t);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
function Y(i) {
|
|
372
|
+
return new at(i).tokenize();
|
|
373
|
+
}
|
|
374
|
+
var f = /* @__PURE__ */ ((i) => (i.ROOT = "Root", i.ELEMENT = "Element", i.FRAGMENT = "Fragment", i.TEXT = "Text", i.INTERPOLATION = "Interpolation", i.COMMENT = "Comment", i.ATTRIBUTE = "Attribute", i.DIRECTIVE_IF = "DirectiveIf", i.DIRECTIVE_ELSE_IF = "DirectiveElseIf", i.DIRECTIVE_ELSE = "DirectiveElse", i.DIRECTIVE_FOR = "DirectiveFor", i))(f || {});
|
|
375
|
+
function le(i) {
|
|
376
|
+
return i.type === "Element";
|
|
377
|
+
}
|
|
378
|
+
function ce(i) {
|
|
379
|
+
return i.type === "Fragment";
|
|
380
|
+
}
|
|
381
|
+
function ae(i) {
|
|
382
|
+
return i.type === "Text";
|
|
383
|
+
}
|
|
384
|
+
function ue(i) {
|
|
385
|
+
return i.type === "Interpolation";
|
|
386
|
+
}
|
|
387
|
+
function fe(i) {
|
|
388
|
+
return i.type === "Comment";
|
|
389
|
+
}
|
|
390
|
+
function de(i) {
|
|
391
|
+
return i.type === "DirectiveIf" || i.type === "DirectiveElseIf" || i.type === "DirectiveElse" || i.type === "DirectiveFor";
|
|
392
|
+
}
|
|
393
|
+
function ut(i, t, e) {
|
|
394
|
+
return {
|
|
395
|
+
type: "Root",
|
|
396
|
+
children: i,
|
|
397
|
+
start: t,
|
|
398
|
+
end: e
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
function x(i, t, e, n, r, s, o) {
|
|
402
|
+
const l = /^[A-Z]/.test(i) || i.includes("."), h = t.find((u) => u.name === "ref"), a = h != null && h.value ? typeof h.value == "string" ? h.value : h.value.expression : void 0;
|
|
403
|
+
return {
|
|
404
|
+
type: "Element",
|
|
405
|
+
tag: i,
|
|
406
|
+
isComponent: l,
|
|
407
|
+
isSelfClosing: r,
|
|
408
|
+
attributes: t,
|
|
409
|
+
directives: e,
|
|
410
|
+
children: n,
|
|
411
|
+
ref: a,
|
|
412
|
+
start: s,
|
|
413
|
+
end: o
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
function ft(i, t, e) {
|
|
417
|
+
return {
|
|
418
|
+
type: "Fragment",
|
|
419
|
+
children: i,
|
|
420
|
+
start: t,
|
|
421
|
+
end: e
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
function Z(i, t, e) {
|
|
425
|
+
return {
|
|
426
|
+
type: "Text",
|
|
427
|
+
content: i,
|
|
428
|
+
start: t,
|
|
429
|
+
end: e
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
function dt(i, t, e) {
|
|
433
|
+
return {
|
|
434
|
+
type: "Interpolation",
|
|
435
|
+
expression: i,
|
|
436
|
+
start: t,
|
|
437
|
+
end: e
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
function pt(i, t, e) {
|
|
441
|
+
return {
|
|
442
|
+
type: "Comment",
|
|
443
|
+
content: i,
|
|
444
|
+
start: t,
|
|
445
|
+
end: e
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
function A(i, t, e, n, r) {
|
|
449
|
+
return {
|
|
450
|
+
type: "Attribute",
|
|
451
|
+
name: i,
|
|
452
|
+
value: t,
|
|
453
|
+
isDynamic: e,
|
|
454
|
+
start: n,
|
|
455
|
+
end: r
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
function gt(i, t, e) {
|
|
459
|
+
return {
|
|
460
|
+
type: "DirectiveIf",
|
|
461
|
+
condition: i,
|
|
462
|
+
start: t,
|
|
463
|
+
end: e
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
function Et(i, t, e) {
|
|
467
|
+
return {
|
|
468
|
+
type: "DirectiveElseIf",
|
|
469
|
+
condition: i,
|
|
470
|
+
start: t,
|
|
471
|
+
end: e
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function mt(i, t) {
|
|
475
|
+
return {
|
|
476
|
+
type: "DirectiveElse",
|
|
477
|
+
start: i,
|
|
478
|
+
end: t
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
function Ct(i, t, e, n, r) {
|
|
482
|
+
return {
|
|
483
|
+
type: "DirectiveFor",
|
|
484
|
+
item: i,
|
|
485
|
+
index: e,
|
|
486
|
+
list: t,
|
|
487
|
+
start: n,
|
|
488
|
+
end: r
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
function M(i, t) {
|
|
492
|
+
i.type === "Root" ? i.children.forEach((e) => {
|
|
493
|
+
t(e), M(e, t);
|
|
494
|
+
}) : (i.type === "Element" || i.type === "Fragment") && i.children.forEach((e) => {
|
|
495
|
+
t(e), M(e, t);
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
function L(i, t) {
|
|
499
|
+
if (i.type === "Root")
|
|
500
|
+
return {
|
|
501
|
+
...i,
|
|
502
|
+
children: i.children.map((e) => {
|
|
503
|
+
const n = t(e);
|
|
504
|
+
return L(n, t);
|
|
505
|
+
})
|
|
506
|
+
};
|
|
507
|
+
if (i.type === "Element") {
|
|
508
|
+
const e = t(i);
|
|
509
|
+
return e.type === "Element" ? {
|
|
510
|
+
...e,
|
|
511
|
+
children: e.children.map((n) => {
|
|
512
|
+
const r = t(n);
|
|
513
|
+
return L(r, t);
|
|
514
|
+
})
|
|
515
|
+
} : e;
|
|
516
|
+
} else if (i.type === "Fragment") {
|
|
517
|
+
const e = t(i);
|
|
518
|
+
return e.type === "Fragment" ? {
|
|
519
|
+
...e,
|
|
520
|
+
children: e.children.map((n) => {
|
|
521
|
+
const r = t(n);
|
|
522
|
+
return L(r, t);
|
|
523
|
+
})
|
|
524
|
+
} : e;
|
|
525
|
+
}
|
|
526
|
+
return t(i);
|
|
527
|
+
}
|
|
528
|
+
class Tt {
|
|
529
|
+
constructor(t) {
|
|
530
|
+
g(this, "tokens");
|
|
531
|
+
g(this, "position", 0);
|
|
532
|
+
this.tokens = t.filter((e) => e.type !== c.WHITESPACE);
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Parse tokens into AST
|
|
536
|
+
*/
|
|
537
|
+
parse() {
|
|
538
|
+
const t = [];
|
|
539
|
+
for (; !this.isEOF(); ) {
|
|
540
|
+
const r = this.parseTemplateNode();
|
|
541
|
+
r && t.push(r);
|
|
542
|
+
}
|
|
543
|
+
const e = t.length > 0 ? t[0].start : { line: 1, column: 1, offset: 0 }, n = t.length > 0 ? t[t.length - 1].end : { line: 1, column: 1, offset: 0 };
|
|
544
|
+
return ut(t, e, n);
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Parse a single template node
|
|
548
|
+
*/
|
|
549
|
+
parseTemplateNode() {
|
|
550
|
+
switch (this.peek().type) {
|
|
551
|
+
case c.TAG_OPEN_START:
|
|
552
|
+
return this.parseElement();
|
|
553
|
+
case c.FRAGMENT_OPEN:
|
|
554
|
+
return this.parseFragment();
|
|
555
|
+
case c.TEXT:
|
|
556
|
+
return this.parseText();
|
|
557
|
+
case c.EXPRESSION_START:
|
|
558
|
+
return this.parseInterpolation();
|
|
559
|
+
case c.COMMENT:
|
|
560
|
+
return this.parseComment();
|
|
561
|
+
case c.TAG_CLOSE_START:
|
|
562
|
+
return this.advance(), null;
|
|
563
|
+
case c.FRAGMENT_CLOSE:
|
|
564
|
+
return this.advance(), null;
|
|
565
|
+
case c.EOF:
|
|
566
|
+
return null;
|
|
567
|
+
default:
|
|
568
|
+
return this.advance(), null;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Parse fragment node
|
|
573
|
+
*/
|
|
574
|
+
parseFragment() {
|
|
575
|
+
const t = this.peek().start;
|
|
576
|
+
this.expect(c.FRAGMENT_OPEN);
|
|
577
|
+
const e = [];
|
|
578
|
+
for (; !this.isEOF() && !this.check(c.FRAGMENT_CLOSE); ) {
|
|
579
|
+
const n = this.parseTemplateNode();
|
|
580
|
+
n && e.push(n);
|
|
581
|
+
}
|
|
582
|
+
if (this.check(c.FRAGMENT_CLOSE)) {
|
|
583
|
+
const n = this.expect(c.FRAGMENT_CLOSE);
|
|
584
|
+
return ft(e, t, n.end);
|
|
585
|
+
}
|
|
586
|
+
throw new Error(
|
|
587
|
+
`Unclosed fragment starting at line ${t.line}, column ${t.column}`
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Parse element
|
|
592
|
+
*/
|
|
593
|
+
parseElement() {
|
|
594
|
+
const t = this.peek().start;
|
|
595
|
+
this.expect(c.TAG_OPEN_START);
|
|
596
|
+
const e = this.peek();
|
|
597
|
+
if (e.type !== c.IDENTIFIER)
|
|
598
|
+
throw new Error(
|
|
599
|
+
`Expected tag name at line ${e.start.line}, column ${e.start.column}`
|
|
600
|
+
);
|
|
601
|
+
const n = e.value;
|
|
602
|
+
this.advance();
|
|
603
|
+
const { attributes: r, directives: s } = this.parseAttributesAndDirectives();
|
|
604
|
+
if (this.check(c.TAG_SELF_CLOSE)) {
|
|
605
|
+
const h = this.peek().end;
|
|
606
|
+
return this.advance(), x(
|
|
607
|
+
n,
|
|
608
|
+
r,
|
|
609
|
+
s,
|
|
610
|
+
[],
|
|
611
|
+
!0,
|
|
612
|
+
t,
|
|
613
|
+
h
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
this.expect(c.TAG_OPEN_END);
|
|
617
|
+
const o = [];
|
|
618
|
+
for (; !this.isEOF() && !this.check(c.TAG_CLOSE_START); ) {
|
|
619
|
+
const h = this.parseTemplateNode();
|
|
620
|
+
h && o.push(h);
|
|
621
|
+
}
|
|
622
|
+
if (this.check(c.TAG_CLOSE_START)) {
|
|
623
|
+
this.advance();
|
|
624
|
+
const h = this.peek();
|
|
625
|
+
if (h.type !== c.IDENTIFIER) {
|
|
626
|
+
const d = new Error(
|
|
627
|
+
`Expected closing tag name at line ${h.start.line}, column ${h.start.column}`
|
|
628
|
+
);
|
|
629
|
+
throw d.line = h.start.line, d.column = h.start.column, d;
|
|
630
|
+
}
|
|
631
|
+
const a = h.value;
|
|
632
|
+
if (a !== n) {
|
|
633
|
+
const d = new Error(
|
|
634
|
+
`Mismatched closing tag: expected </${n}> but got </${a}> at line ${h.start.line}, column ${h.start.column}`
|
|
635
|
+
);
|
|
636
|
+
throw d.line = h.start.line, d.column = h.start.column, d;
|
|
637
|
+
}
|
|
638
|
+
this.advance();
|
|
639
|
+
const u = this.peek().end;
|
|
640
|
+
return this.expect(c.TAG_OPEN_END), x(
|
|
641
|
+
n,
|
|
642
|
+
r,
|
|
643
|
+
s,
|
|
644
|
+
o,
|
|
645
|
+
!1,
|
|
646
|
+
t,
|
|
647
|
+
u
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
const l = o.length > 0 ? o[o.length - 1].end : t;
|
|
651
|
+
return x(
|
|
652
|
+
n,
|
|
653
|
+
r,
|
|
654
|
+
s,
|
|
655
|
+
o,
|
|
656
|
+
!1,
|
|
657
|
+
t,
|
|
658
|
+
l
|
|
659
|
+
);
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Parse attributes and directives
|
|
663
|
+
*/
|
|
664
|
+
parseAttributesAndDirectives() {
|
|
665
|
+
const t = [], e = [];
|
|
666
|
+
for (; !this.isEOF() && !this.check(c.TAG_OPEN_END) && !this.check(c.TAG_SELF_CLOSE); ) {
|
|
667
|
+
const n = this.peek();
|
|
668
|
+
if (n.type === c.DIRECTIVE_IF || n.type === c.DIRECTIVE_ELSE_IF || n.type === c.DIRECTIVE_ELSE || n.type === c.DIRECTIVE_FOR) {
|
|
669
|
+
const r = this.parseDirective();
|
|
670
|
+
r && e.push(r);
|
|
671
|
+
} else if (n.type === c.IDENTIFIER || n.type === c.KEYWORD_REF) {
|
|
672
|
+
const r = this.parseAttribute();
|
|
673
|
+
r && t.push(r);
|
|
674
|
+
} else
|
|
675
|
+
this.advance();
|
|
676
|
+
}
|
|
677
|
+
return { attributes: t, directives: e };
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Parse attribute
|
|
681
|
+
*/
|
|
682
|
+
parseAttribute() {
|
|
683
|
+
const t = this.peek().start, e = this.advance(), n = e.value;
|
|
684
|
+
if (!this.check(c.ATTRIBUTE_EQUALS))
|
|
685
|
+
return A(n, null, !1, t, e.end);
|
|
686
|
+
this.advance();
|
|
687
|
+
const r = this.peek();
|
|
688
|
+
let s, o = !1, l = r.end;
|
|
689
|
+
if (r.type === c.STRING_LITERAL)
|
|
690
|
+
s = r.value.slice(1, -1), this.advance();
|
|
691
|
+
else if (r.type === c.EXPRESSION_START) {
|
|
692
|
+
this.advance();
|
|
693
|
+
const h = this.peek();
|
|
694
|
+
h.type === c.EXPRESSION_CONTENT ? (s = { expression: h.value.trim() }, o = !0, this.advance()) : (s = { expression: "" }, o = !0), this.check(c.EXPRESSION_END) && (l = this.peek().end, this.advance());
|
|
695
|
+
} else
|
|
696
|
+
return A(n, null, !1, t, e.end);
|
|
697
|
+
return A(n, s, o, t, l);
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Parse directive
|
|
701
|
+
*/
|
|
702
|
+
parseDirective() {
|
|
703
|
+
const t = this.peek().start, e = this.advance();
|
|
704
|
+
switch (e.type) {
|
|
705
|
+
case c.DIRECTIVE_IF:
|
|
706
|
+
case c.DIRECTIVE_ELSE_IF: {
|
|
707
|
+
this.expect(c.ATTRIBUTE_EQUALS), this.expect(c.EXPRESSION_START);
|
|
708
|
+
const n = this.peek();
|
|
709
|
+
let r = "";
|
|
710
|
+
n.type === c.EXPRESSION_CONTENT && (r = n.value.trim(), this.advance());
|
|
711
|
+
const s = this.peek().end;
|
|
712
|
+
return this.expect(c.EXPRESSION_END), e.type === c.DIRECTIVE_IF ? gt(r, t, s) : Et(r, t, s);
|
|
713
|
+
}
|
|
714
|
+
case c.DIRECTIVE_ELSE: {
|
|
715
|
+
const n = e.end;
|
|
716
|
+
return mt(t, n);
|
|
717
|
+
}
|
|
718
|
+
case c.DIRECTIVE_FOR: {
|
|
719
|
+
this.expect(c.ATTRIBUTE_EQUALS), this.expect(c.EXPRESSION_START);
|
|
720
|
+
const n = this.peek();
|
|
721
|
+
let r = "";
|
|
722
|
+
n.type === c.EXPRESSION_CONTENT && (r = n.value.trim(), this.advance());
|
|
723
|
+
const s = this.peek().end;
|
|
724
|
+
this.expect(c.EXPRESSION_END);
|
|
725
|
+
const { item: o, index: l, list: h } = this.parseForExpression(r);
|
|
726
|
+
return Ct(o, h, l, t, s);
|
|
727
|
+
}
|
|
728
|
+
default:
|
|
729
|
+
return null;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Parse l-for expression
|
|
734
|
+
*/
|
|
735
|
+
parseForExpression(t) {
|
|
736
|
+
const e = "[A-Za-z_$][\\w$]*", n = new RegExp(
|
|
737
|
+
`^\\s*\\(\\s*(${e})\\s*,\\s*(${e})\\s*\\)\\s+in\\s+([\\s\\S]+)$`
|
|
738
|
+
), r = new RegExp(
|
|
739
|
+
`^\\s*(${e})\\s+in\\s+([\\s\\S]+)$`
|
|
740
|
+
), s = t.match(n);
|
|
741
|
+
if (s)
|
|
742
|
+
return {
|
|
743
|
+
item: s[1],
|
|
744
|
+
index: s[2],
|
|
745
|
+
list: s[3].trim()
|
|
746
|
+
};
|
|
747
|
+
const o = t.match(r);
|
|
748
|
+
return o ? {
|
|
749
|
+
item: o[1],
|
|
750
|
+
list: o[2].trim()
|
|
751
|
+
} : {
|
|
752
|
+
item: "item",
|
|
753
|
+
list: t
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Parse text node
|
|
758
|
+
*/
|
|
759
|
+
parseText() {
|
|
760
|
+
const t = this.advance();
|
|
761
|
+
return Z(t.value, t.start, t.end);
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Parse interpolation node
|
|
765
|
+
*/
|
|
766
|
+
parseInterpolation() {
|
|
767
|
+
const t = this.peek().start;
|
|
768
|
+
this.expect(c.EXPRESSION_START);
|
|
769
|
+
const e = this.peek();
|
|
770
|
+
let n = "";
|
|
771
|
+
e.type === c.EXPRESSION_CONTENT && (n = e.value.trim(), this.advance());
|
|
772
|
+
const r = this.peek().end;
|
|
773
|
+
return this.expect(c.EXPRESSION_END), dt(n, t, r);
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* Parse comment node
|
|
777
|
+
*/
|
|
778
|
+
parseComment() {
|
|
779
|
+
const t = this.advance(), e = t.value.replace(/^<!--\s*|\s*-->$/g, "");
|
|
780
|
+
return pt(e, t.start, t.end);
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Peek at current token without consuming
|
|
784
|
+
*/
|
|
785
|
+
peek() {
|
|
786
|
+
return this.tokens[this.position];
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Advance to next token and return current
|
|
790
|
+
*/
|
|
791
|
+
advance() {
|
|
792
|
+
const t = this.tokens[this.position];
|
|
793
|
+
return this.position++, t;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Check if current token matches type
|
|
797
|
+
*/
|
|
798
|
+
check(t) {
|
|
799
|
+
return this.isEOF() ? !1 : this.peek().type === t;
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Expect a token of specific type, throw error if not found
|
|
803
|
+
*/
|
|
804
|
+
expect(t) {
|
|
805
|
+
const e = this.peek();
|
|
806
|
+
if (e.type !== t) {
|
|
807
|
+
const n = new Error(
|
|
808
|
+
`Expected token ${t} but got ${e.type} at line ${e.start.line}, column ${e.start.column}`
|
|
809
|
+
);
|
|
810
|
+
throw n.line = e.start.line, n.column = e.start.column, n;
|
|
811
|
+
}
|
|
812
|
+
return this.advance();
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Check if we've reached EOF
|
|
816
|
+
*/
|
|
817
|
+
isEOF() {
|
|
818
|
+
return this.position >= this.tokens.length || this.peek().type === c.EOF;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
function J(i) {
|
|
822
|
+
return new Tt(i).parse();
|
|
823
|
+
}
|
|
824
|
+
function wt(i) {
|
|
825
|
+
return {
|
|
826
|
+
...i,
|
|
827
|
+
children: v(i.children)
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
function v(i) {
|
|
831
|
+
const t = [];
|
|
832
|
+
for (let e = 0; e < i.length; e++) {
|
|
833
|
+
const n = i[e];
|
|
834
|
+
if (n.type === f.ELEMENT) {
|
|
835
|
+
const r = {
|
|
836
|
+
...n,
|
|
837
|
+
children: v(n.children)
|
|
838
|
+
};
|
|
839
|
+
if (n.directives.find(
|
|
840
|
+
(o) => o.type === f.DIRECTIVE_IF
|
|
841
|
+
)) {
|
|
842
|
+
const o = {
|
|
843
|
+
if: r,
|
|
844
|
+
elseIfs: []
|
|
845
|
+
};
|
|
846
|
+
let l = e + 1;
|
|
847
|
+
for (; l < i.length; ) {
|
|
848
|
+
const h = i[l];
|
|
849
|
+
if (h.type === f.ELEMENT) {
|
|
850
|
+
const a = h.directives.find(
|
|
851
|
+
(d) => d.type === f.DIRECTIVE_ELSE_IF
|
|
852
|
+
), u = h.directives.find(
|
|
853
|
+
(d) => d.type === f.DIRECTIVE_ELSE
|
|
854
|
+
);
|
|
855
|
+
if (a) {
|
|
856
|
+
o.elseIfs.push({
|
|
857
|
+
...h,
|
|
858
|
+
children: v(h.children)
|
|
859
|
+
}), l++;
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
if (u) {
|
|
863
|
+
o.else = {
|
|
864
|
+
...h,
|
|
865
|
+
children: v(h.children)
|
|
866
|
+
}, l++;
|
|
867
|
+
break;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
break;
|
|
871
|
+
}
|
|
872
|
+
r.__conditionalGroup = o, e = l - 1;
|
|
873
|
+
}
|
|
874
|
+
t.push(r);
|
|
875
|
+
} else n.type === f.FRAGMENT ? t.push({
|
|
876
|
+
...n,
|
|
877
|
+
children: v(n.children)
|
|
878
|
+
}) : t.push(n);
|
|
879
|
+
}
|
|
880
|
+
return t;
|
|
881
|
+
}
|
|
882
|
+
function vt(i) {
|
|
883
|
+
return i.__conditionalGroup;
|
|
884
|
+
}
|
|
885
|
+
function pe(i, t) {
|
|
886
|
+
return i.directives.some((e) => e.type === t);
|
|
887
|
+
}
|
|
888
|
+
function X(i, t) {
|
|
889
|
+
return i.directives.find((e) => e.type === t);
|
|
890
|
+
}
|
|
891
|
+
function It(i, t) {
|
|
892
|
+
const e = {
|
|
893
|
+
mergeTextNodes: !0,
|
|
894
|
+
removeWhitespace: !0,
|
|
895
|
+
trimText: !0,
|
|
896
|
+
...t
|
|
897
|
+
};
|
|
898
|
+
return {
|
|
899
|
+
...i,
|
|
900
|
+
children: F(i.children, e)
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
function F(i, t) {
|
|
904
|
+
let e = i.map((n) => St(n, t));
|
|
905
|
+
return t.mergeTextNodes && (e = Nt(e)), t.removeWhitespace && (e = Ot(e)), e;
|
|
906
|
+
}
|
|
907
|
+
function St(i, t) {
|
|
908
|
+
return i.type === f.ELEMENT ? _t(i, t) : i.type === f.FRAGMENT ? Rt(i, t) : i.type === f.TEXT ? kt(i, t) : i;
|
|
909
|
+
}
|
|
910
|
+
function _t(i, t) {
|
|
911
|
+
return {
|
|
912
|
+
...i,
|
|
913
|
+
children: F(i.children, t)
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
function Rt(i, t) {
|
|
917
|
+
return {
|
|
918
|
+
...i,
|
|
919
|
+
children: F(i.children, t)
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
function kt(i, t) {
|
|
923
|
+
let e = i.content;
|
|
924
|
+
return t.trimText && (e = e.trim()), {
|
|
925
|
+
...i,
|
|
926
|
+
content: e
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
function Nt(i) {
|
|
930
|
+
const t = [];
|
|
931
|
+
let e = null;
|
|
932
|
+
for (const n of i)
|
|
933
|
+
n.type === f.TEXT ? e ? e = Z(
|
|
934
|
+
e.content + n.content,
|
|
935
|
+
e.start,
|
|
936
|
+
n.end
|
|
937
|
+
) : e = n : (e && (t.push(e), e = null), t.push(n));
|
|
938
|
+
return e && t.push(e), t;
|
|
939
|
+
}
|
|
940
|
+
function Ot(i) {
|
|
941
|
+
return i.filter((t) => t.type === f.TEXT ? t.content.trim().length > 0 : !0);
|
|
942
|
+
}
|
|
943
|
+
function ge(i) {
|
|
944
|
+
return i.content.trim().length === 0;
|
|
945
|
+
}
|
|
946
|
+
function V(i) {
|
|
947
|
+
let t = 1;
|
|
948
|
+
return i.type === f.ROOT ? i.children.forEach((e) => {
|
|
949
|
+
t += V(e);
|
|
950
|
+
}) : (i.type === f.ELEMENT || i.type === f.FRAGMENT) && i.children.forEach((e) => {
|
|
951
|
+
t += V(e);
|
|
952
|
+
}), t;
|
|
953
|
+
}
|
|
954
|
+
function q(i, t) {
|
|
955
|
+
let e = i;
|
|
956
|
+
return e = wt(e), (t == null ? void 0 : t.optimize) !== !1 && (e = It(e, t == null ? void 0 : t.optimizeOptions)), e;
|
|
957
|
+
}
|
|
958
|
+
function tt(i, t) {
|
|
959
|
+
const e = {
|
|
960
|
+
templateFactory: "h",
|
|
961
|
+
templateFragmentFactory: "Fragment",
|
|
962
|
+
...t
|
|
963
|
+
};
|
|
964
|
+
return bt(i.children, e);
|
|
965
|
+
}
|
|
966
|
+
function bt(i, t) {
|
|
967
|
+
const e = i.map((n) => D(n, t)).filter((n) => n !== "");
|
|
968
|
+
return e.length === 0 ? "null" : e.length === 1 ? e[0] : `[${e.join(", ")}]`;
|
|
969
|
+
}
|
|
970
|
+
function D(i, t) {
|
|
971
|
+
switch (i.type) {
|
|
972
|
+
case f.ELEMENT:
|
|
973
|
+
return yt(i, t);
|
|
974
|
+
case f.FRAGMENT:
|
|
975
|
+
return xt(i, t);
|
|
976
|
+
case f.TEXT:
|
|
977
|
+
return Lt(i);
|
|
978
|
+
case f.INTERPOLATION:
|
|
979
|
+
return Ft(i, t);
|
|
980
|
+
case f.COMMENT:
|
|
981
|
+
return "";
|
|
982
|
+
default:
|
|
983
|
+
return "";
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
function yt(i, t) {
|
|
987
|
+
const e = vt(i);
|
|
988
|
+
if (e)
|
|
989
|
+
return Pt(e, t);
|
|
990
|
+
const n = i.directives.find(
|
|
991
|
+
(r) => r.type === f.DIRECTIVE_FOR
|
|
992
|
+
);
|
|
993
|
+
return n ? Dt(i, n, t) : m(i, t);
|
|
994
|
+
}
|
|
995
|
+
function m(i, t) {
|
|
996
|
+
const e = t.templateFactory, n = i.isComponent ? i.tag : `'${i.tag}'`, r = At(i, t), s = i.children.map((o) => D(o, t)).filter((o) => o !== "");
|
|
997
|
+
return s.length === 0 ? `${e}(${n}, ${r})` : `${e}(${n}, ${r}, ${s.join(", ")})`;
|
|
998
|
+
}
|
|
999
|
+
function xt(i, t) {
|
|
1000
|
+
const e = t.templateFactory, n = t.templateFragmentFactory, r = i.children.map((s) => D(s, t)).filter((s) => s !== "");
|
|
1001
|
+
return r.length === 0 ? `${e}(${n}, null)` : `${e}(${n}, null, ${r.join(", ")})`;
|
|
1002
|
+
}
|
|
1003
|
+
function At(i, t) {
|
|
1004
|
+
return i.attributes.length === 0 ? "null" : `{ ${i.attributes.map((n) => {
|
|
1005
|
+
const r = n.name;
|
|
1006
|
+
let s;
|
|
1007
|
+
return n.value === null ? s = "true" : typeof n.value == "string" ? s = `'${n.value.replace(/'/g, "\\'")}'` : s = nt(n.value.expression, t), `${r}: ${s}`;
|
|
1008
|
+
}).join(", ")} }`;
|
|
1009
|
+
}
|
|
1010
|
+
function Lt(i) {
|
|
1011
|
+
return `'${i.content.replace(/\\/g, "\\\\").replace(/\r/g, "\\r").replace(/\n/g, "\\n").replace(/'/g, "\\'")}'`;
|
|
1012
|
+
}
|
|
1013
|
+
function Ft(i, t) {
|
|
1014
|
+
return nt(i.expression, t);
|
|
1015
|
+
}
|
|
1016
|
+
function Dt(i, t, e) {
|
|
1017
|
+
const { item: n, index: r, list: s } = t, o = {
|
|
1018
|
+
...i,
|
|
1019
|
+
directives: i.directives.filter((h) => h.type !== f.DIRECTIVE_FOR)
|
|
1020
|
+
}, l = m(o, e);
|
|
1021
|
+
return r ? `(${s}).map((${n}, ${r}) => ${l})` : `(${s}).map(${n} => ${l})`;
|
|
1022
|
+
}
|
|
1023
|
+
function Pt(i, t) {
|
|
1024
|
+
const e = X(i.if, f.DIRECTIVE_IF);
|
|
1025
|
+
if (!e)
|
|
1026
|
+
return m(i.if, t);
|
|
1027
|
+
const n = {
|
|
1028
|
+
...i.if,
|
|
1029
|
+
directives: i.if.directives.filter(
|
|
1030
|
+
(s) => s.type !== f.DIRECTIVE_IF
|
|
1031
|
+
)
|
|
1032
|
+
};
|
|
1033
|
+
let r = `(${e.condition}) ? ${m(n, t)}`;
|
|
1034
|
+
for (const s of i.elseIfs || []) {
|
|
1035
|
+
const o = X(
|
|
1036
|
+
s,
|
|
1037
|
+
f.DIRECTIVE_ELSE_IF
|
|
1038
|
+
);
|
|
1039
|
+
if (!o) continue;
|
|
1040
|
+
const l = {
|
|
1041
|
+
...s,
|
|
1042
|
+
directives: s.directives.filter(
|
|
1043
|
+
(h) => h.type !== f.DIRECTIVE_ELSE_IF
|
|
1044
|
+
)
|
|
1045
|
+
};
|
|
1046
|
+
r += ` : (${o.condition}) ? ${m(l, t)}`;
|
|
1047
|
+
}
|
|
1048
|
+
if (i.else) {
|
|
1049
|
+
const s = {
|
|
1050
|
+
...i.else,
|
|
1051
|
+
directives: i.else.directives.filter(
|
|
1052
|
+
(o) => o.type !== f.DIRECTIVE_ELSE
|
|
1053
|
+
)
|
|
1054
|
+
};
|
|
1055
|
+
r += ` : ${m(s, t)}`;
|
|
1056
|
+
} else
|
|
1057
|
+
r += " : null";
|
|
1058
|
+
return r;
|
|
1059
|
+
}
|
|
1060
|
+
function Ee(i) {
|
|
1061
|
+
return i;
|
|
1062
|
+
}
|
|
1063
|
+
const W = (i) => i >= 48 && i <= 57 || // 0-9
|
|
1064
|
+
i >= 65 && i <= 90 || // A-Z
|
|
1065
|
+
i >= 97 && i <= 122 || // a-z
|
|
1066
|
+
i === 95 || // _
|
|
1067
|
+
i === 36, $t = (i, t) => {
|
|
1068
|
+
if (i[t] !== "<")
|
|
1069
|
+
return !1;
|
|
1070
|
+
const e = i.charCodeAt(t + 1);
|
|
1071
|
+
if (Number.isNaN(e) || !(e === 47 || // /
|
|
1072
|
+
e === 62 || // >
|
|
1073
|
+
e === 33 || // !
|
|
1074
|
+
W(e)))
|
|
1075
|
+
return !1;
|
|
1076
|
+
let r = t - 1;
|
|
1077
|
+
for (; r >= 0; ) {
|
|
1078
|
+
const s = i.charCodeAt(r);
|
|
1079
|
+
if (s === 32 || s === 9 || s === 10 || s === 13) {
|
|
1080
|
+
r--;
|
|
1081
|
+
continue;
|
|
1082
|
+
}
|
|
1083
|
+
if (W(s))
|
|
1084
|
+
return !1;
|
|
1085
|
+
break;
|
|
1086
|
+
}
|
|
1087
|
+
return !0;
|
|
1088
|
+
}, _ = (i, t, e) => {
|
|
1089
|
+
let n = t + 1;
|
|
1090
|
+
for (; n < i.length; ) {
|
|
1091
|
+
const r = i[n];
|
|
1092
|
+
if (r === "\\") {
|
|
1093
|
+
n += 2;
|
|
1094
|
+
continue;
|
|
1095
|
+
}
|
|
1096
|
+
if (r === e)
|
|
1097
|
+
return n + 1;
|
|
1098
|
+
n++;
|
|
1099
|
+
}
|
|
1100
|
+
return i.length;
|
|
1101
|
+
}, R = (i, t) => {
|
|
1102
|
+
let e = t + 1;
|
|
1103
|
+
for (; e < i.length; ) {
|
|
1104
|
+
const n = i[e];
|
|
1105
|
+
if (n === "\\") {
|
|
1106
|
+
e += 2;
|
|
1107
|
+
continue;
|
|
1108
|
+
}
|
|
1109
|
+
if (n === "`")
|
|
1110
|
+
return e + 1;
|
|
1111
|
+
if (n === "$" && i[e + 1] === "{") {
|
|
1112
|
+
e = et(i, e + 2);
|
|
1113
|
+
continue;
|
|
1114
|
+
}
|
|
1115
|
+
e++;
|
|
1116
|
+
}
|
|
1117
|
+
return i.length;
|
|
1118
|
+
}, k = (i, t) => {
|
|
1119
|
+
let e = t;
|
|
1120
|
+
for (; e < i.length && i[e] !== "\\n"; )
|
|
1121
|
+
e++;
|
|
1122
|
+
return e;
|
|
1123
|
+
}, N = (i, t) => {
|
|
1124
|
+
const e = i.indexOf("*/", t);
|
|
1125
|
+
return e === -1 ? i.length : e + 2;
|
|
1126
|
+
}, Gt = (i, t) => {
|
|
1127
|
+
const e = i.indexOf("-->", t);
|
|
1128
|
+
return e === -1 ? i.length : e + 3;
|
|
1129
|
+
}, et = (i, t) => {
|
|
1130
|
+
let e = 1, n = t;
|
|
1131
|
+
for (; n < i.length; ) {
|
|
1132
|
+
const r = i[n];
|
|
1133
|
+
if (r === "\\") {
|
|
1134
|
+
n += 2;
|
|
1135
|
+
continue;
|
|
1136
|
+
}
|
|
1137
|
+
if (r === "'" || r === '"') {
|
|
1138
|
+
n = _(i, n, r);
|
|
1139
|
+
continue;
|
|
1140
|
+
}
|
|
1141
|
+
if (r === "`") {
|
|
1142
|
+
n = R(i, n);
|
|
1143
|
+
continue;
|
|
1144
|
+
}
|
|
1145
|
+
if (r === "/" && i[n + 1] === "*") {
|
|
1146
|
+
n = N(i, n + 2);
|
|
1147
|
+
continue;
|
|
1148
|
+
}
|
|
1149
|
+
if (r === "/" && i[n + 1] === "/") {
|
|
1150
|
+
n = k(i, n + 2);
|
|
1151
|
+
continue;
|
|
1152
|
+
}
|
|
1153
|
+
if (r === "{") {
|
|
1154
|
+
e++, n++;
|
|
1155
|
+
continue;
|
|
1156
|
+
}
|
|
1157
|
+
if (r === "}") {
|
|
1158
|
+
if (e--, n++, e === 0)
|
|
1159
|
+
return n;
|
|
1160
|
+
continue;
|
|
1161
|
+
}
|
|
1162
|
+
n++;
|
|
1163
|
+
}
|
|
1164
|
+
return i.length;
|
|
1165
|
+
}, U = (i, t, e) => {
|
|
1166
|
+
let n = t;
|
|
1167
|
+
for (; n < i.length; ) {
|
|
1168
|
+
const r = i[n];
|
|
1169
|
+
if (r === "'" || r === '"') {
|
|
1170
|
+
n = _(i, n, r);
|
|
1171
|
+
continue;
|
|
1172
|
+
}
|
|
1173
|
+
if (r === "`") {
|
|
1174
|
+
n = R(i, n);
|
|
1175
|
+
continue;
|
|
1176
|
+
}
|
|
1177
|
+
if (r === "{") {
|
|
1178
|
+
n = et(i, n + 1);
|
|
1179
|
+
continue;
|
|
1180
|
+
}
|
|
1181
|
+
if (r === "/" && i[n + 1] === "*") {
|
|
1182
|
+
n = N(i, n + 2);
|
|
1183
|
+
continue;
|
|
1184
|
+
}
|
|
1185
|
+
if (r === "/" && i[n + 1] === "/") {
|
|
1186
|
+
n = k(i, n + 2);
|
|
1187
|
+
continue;
|
|
1188
|
+
}
|
|
1189
|
+
if (r === ">") {
|
|
1190
|
+
const s = !e && i[n - 1] === "/";
|
|
1191
|
+
return { position: n + 1, selfClosing: s };
|
|
1192
|
+
}
|
|
1193
|
+
n++;
|
|
1194
|
+
}
|
|
1195
|
+
return null;
|
|
1196
|
+
}, Mt = (i, t) => {
|
|
1197
|
+
const e = i.length;
|
|
1198
|
+
let n = t, r = 0;
|
|
1199
|
+
for (; n < e; ) {
|
|
1200
|
+
const s = i[n];
|
|
1201
|
+
if (s === "'" || s === '"') {
|
|
1202
|
+
n = _(i, n, s);
|
|
1203
|
+
continue;
|
|
1204
|
+
}
|
|
1205
|
+
if (s === "`") {
|
|
1206
|
+
n = R(i, n);
|
|
1207
|
+
continue;
|
|
1208
|
+
}
|
|
1209
|
+
if (s === "/" && i[n + 1] === "*") {
|
|
1210
|
+
n = N(i, n + 2);
|
|
1211
|
+
continue;
|
|
1212
|
+
}
|
|
1213
|
+
if (s === "/" && i[n + 1] === "/") {
|
|
1214
|
+
n = k(i, n + 2);
|
|
1215
|
+
continue;
|
|
1216
|
+
}
|
|
1217
|
+
if (s === "<") {
|
|
1218
|
+
if (i.startsWith("<!--", n)) {
|
|
1219
|
+
n = Gt(i, n + 4);
|
|
1220
|
+
continue;
|
|
1221
|
+
}
|
|
1222
|
+
if (i[n + 1] === "/") {
|
|
1223
|
+
r--;
|
|
1224
|
+
const o = U(i, n + 2, !0);
|
|
1225
|
+
if (!o)
|
|
1226
|
+
return null;
|
|
1227
|
+
if (n = o.position, r === 0)
|
|
1228
|
+
return {
|
|
1229
|
+
start: t,
|
|
1230
|
+
end: n,
|
|
1231
|
+
snippet: i.slice(t, n)
|
|
1232
|
+
};
|
|
1233
|
+
continue;
|
|
1234
|
+
} else {
|
|
1235
|
+
r++;
|
|
1236
|
+
const o = U(i, n + 1, !1);
|
|
1237
|
+
if (!o)
|
|
1238
|
+
return null;
|
|
1239
|
+
if (n = o.position, o.selfClosing && (r--, r === 0))
|
|
1240
|
+
return {
|
|
1241
|
+
start: t,
|
|
1242
|
+
end: n,
|
|
1243
|
+
snippet: i.slice(t, n)
|
|
1244
|
+
};
|
|
1245
|
+
continue;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
n++;
|
|
1249
|
+
}
|
|
1250
|
+
return null;
|
|
1251
|
+
}, Xt = (i) => {
|
|
1252
|
+
const t = [], e = i.length;
|
|
1253
|
+
let n = 0;
|
|
1254
|
+
for (; n < e; ) {
|
|
1255
|
+
const r = i[n];
|
|
1256
|
+
if (r === "'" || r === '"') {
|
|
1257
|
+
n = _(i, n, r);
|
|
1258
|
+
continue;
|
|
1259
|
+
}
|
|
1260
|
+
if (r === "`") {
|
|
1261
|
+
n = R(i, n);
|
|
1262
|
+
continue;
|
|
1263
|
+
}
|
|
1264
|
+
if (r === "/" && i[n + 1] === "*") {
|
|
1265
|
+
n = N(i, n + 2);
|
|
1266
|
+
continue;
|
|
1267
|
+
}
|
|
1268
|
+
if (r === "/" && i[n + 1] === "/") {
|
|
1269
|
+
n = k(i, n + 2);
|
|
1270
|
+
continue;
|
|
1271
|
+
}
|
|
1272
|
+
if (r === "<" && $t(i, n)) {
|
|
1273
|
+
const s = Mt(i, n);
|
|
1274
|
+
if (s) {
|
|
1275
|
+
t.push(s), n = s.end;
|
|
1276
|
+
continue;
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
n++;
|
|
1280
|
+
}
|
|
1281
|
+
return t;
|
|
1282
|
+
};
|
|
1283
|
+
function nt(i, t) {
|
|
1284
|
+
if (!i.includes("<"))
|
|
1285
|
+
return i;
|
|
1286
|
+
const e = Xt(i);
|
|
1287
|
+
if (e.length === 0)
|
|
1288
|
+
return i;
|
|
1289
|
+
let n = "", r = 0, s = !1;
|
|
1290
|
+
for (const o of e) {
|
|
1291
|
+
let l = null;
|
|
1292
|
+
try {
|
|
1293
|
+
l = Vt(o.snippet, t);
|
|
1294
|
+
} catch {
|
|
1295
|
+
l = null;
|
|
1296
|
+
}
|
|
1297
|
+
if (!l) {
|
|
1298
|
+
n += i.slice(r, o.end), r = o.end;
|
|
1299
|
+
continue;
|
|
1300
|
+
}
|
|
1301
|
+
n += i.slice(r, o.start) + l, r = o.end, s = !0;
|
|
1302
|
+
}
|
|
1303
|
+
return n += i.slice(r), s ? n : i;
|
|
1304
|
+
}
|
|
1305
|
+
function Vt(i, t) {
|
|
1306
|
+
const e = Y(i), n = J(e), r = q(n);
|
|
1307
|
+
return tt(r, t);
|
|
1308
|
+
}
|
|
1309
|
+
function Wt(i, t) {
|
|
1310
|
+
try {
|
|
1311
|
+
const e = Y(i), n = J(e), r = q(n, t == null ? void 0 : t.transform);
|
|
1312
|
+
return {
|
|
1313
|
+
code: tt(r, t == null ? void 0 : t.generate),
|
|
1314
|
+
ast: r,
|
|
1315
|
+
errors: []
|
|
1316
|
+
};
|
|
1317
|
+
} catch (e) {
|
|
1318
|
+
const n = e;
|
|
1319
|
+
return {
|
|
1320
|
+
code: "",
|
|
1321
|
+
ast: null,
|
|
1322
|
+
errors: [
|
|
1323
|
+
{
|
|
1324
|
+
message: e instanceof Error ? e.message : String(e),
|
|
1325
|
+
line: n.line ?? 0,
|
|
1326
|
+
column: n.column ?? 0
|
|
1327
|
+
}
|
|
1328
|
+
]
|
|
1329
|
+
};
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
var Ut = 44, jt = 59, j = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", it = new Uint8Array(64), Bt = new Uint8Array(128);
|
|
1333
|
+
for (let i = 0; i < j.length; i++) {
|
|
1334
|
+
const t = j.charCodeAt(i);
|
|
1335
|
+
it[i] = t, Bt[t] = i;
|
|
1336
|
+
}
|
|
1337
|
+
function T(i, t, e) {
|
|
1338
|
+
let n = t - e;
|
|
1339
|
+
n = n < 0 ? -n << 1 | 1 : n << 1;
|
|
1340
|
+
do {
|
|
1341
|
+
let r = n & 31;
|
|
1342
|
+
n >>>= 5, n > 0 && (r |= 32), i.write(it[r]);
|
|
1343
|
+
} while (n > 0);
|
|
1344
|
+
return t;
|
|
1345
|
+
}
|
|
1346
|
+
var B = 1024 * 16, z = typeof TextDecoder < "u" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer < "u" ? {
|
|
1347
|
+
decode(i) {
|
|
1348
|
+
return Buffer.from(i.buffer, i.byteOffset, i.byteLength).toString();
|
|
1349
|
+
}
|
|
1350
|
+
} : {
|
|
1351
|
+
decode(i) {
|
|
1352
|
+
let t = "";
|
|
1353
|
+
for (let e = 0; e < i.length; e++)
|
|
1354
|
+
t += String.fromCharCode(i[e]);
|
|
1355
|
+
return t;
|
|
1356
|
+
}
|
|
1357
|
+
}, zt = class {
|
|
1358
|
+
constructor() {
|
|
1359
|
+
this.pos = 0, this.out = "", this.buffer = new Uint8Array(B);
|
|
1360
|
+
}
|
|
1361
|
+
write(i) {
|
|
1362
|
+
const { buffer: t } = this;
|
|
1363
|
+
t[this.pos++] = i, this.pos === B && (this.out += z.decode(t), this.pos = 0);
|
|
1364
|
+
}
|
|
1365
|
+
flush() {
|
|
1366
|
+
const { buffer: i, out: t, pos: e } = this;
|
|
1367
|
+
return e > 0 ? t + z.decode(i.subarray(0, e)) : t;
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
function Ht(i) {
|
|
1371
|
+
const t = new zt();
|
|
1372
|
+
let e = 0, n = 0, r = 0, s = 0;
|
|
1373
|
+
for (let o = 0; o < i.length; o++) {
|
|
1374
|
+
const l = i[o];
|
|
1375
|
+
if (o > 0 && t.write(jt), l.length === 0) continue;
|
|
1376
|
+
let h = 0;
|
|
1377
|
+
for (let a = 0; a < l.length; a++) {
|
|
1378
|
+
const u = l[a];
|
|
1379
|
+
a > 0 && t.write(Ut), h = T(t, u[0], h), u.length !== 1 && (e = T(t, u[1], e), n = T(t, u[2], n), r = T(t, u[3], r), u.length !== 4 && (s = T(t, u[4], s)));
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
return t.flush();
|
|
1383
|
+
}
|
|
1384
|
+
class S {
|
|
1385
|
+
constructor(t) {
|
|
1386
|
+
this.bits = t instanceof S ? t.bits.slice() : [];
|
|
1387
|
+
}
|
|
1388
|
+
add(t) {
|
|
1389
|
+
this.bits[t >> 5] |= 1 << (t & 31);
|
|
1390
|
+
}
|
|
1391
|
+
has(t) {
|
|
1392
|
+
return !!(this.bits[t >> 5] & 1 << (t & 31));
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
class I {
|
|
1396
|
+
constructor(t, e, n) {
|
|
1397
|
+
this.start = t, this.end = e, this.original = n, this.intro = "", this.outro = "", this.content = n, this.storeName = !1, this.edited = !1, this.previous = null, this.next = null;
|
|
1398
|
+
}
|
|
1399
|
+
appendLeft(t) {
|
|
1400
|
+
this.outro += t;
|
|
1401
|
+
}
|
|
1402
|
+
appendRight(t) {
|
|
1403
|
+
this.intro = this.intro + t;
|
|
1404
|
+
}
|
|
1405
|
+
clone() {
|
|
1406
|
+
const t = new I(this.start, this.end, this.original);
|
|
1407
|
+
return t.intro = this.intro, t.outro = this.outro, t.content = this.content, t.storeName = this.storeName, t.edited = this.edited, t;
|
|
1408
|
+
}
|
|
1409
|
+
contains(t) {
|
|
1410
|
+
return this.start < t && t < this.end;
|
|
1411
|
+
}
|
|
1412
|
+
eachNext(t) {
|
|
1413
|
+
let e = this;
|
|
1414
|
+
for (; e; )
|
|
1415
|
+
t(e), e = e.next;
|
|
1416
|
+
}
|
|
1417
|
+
eachPrevious(t) {
|
|
1418
|
+
let e = this;
|
|
1419
|
+
for (; e; )
|
|
1420
|
+
t(e), e = e.previous;
|
|
1421
|
+
}
|
|
1422
|
+
edit(t, e, n) {
|
|
1423
|
+
return this.content = t, n || (this.intro = "", this.outro = ""), this.storeName = e, this.edited = !0, this;
|
|
1424
|
+
}
|
|
1425
|
+
prependLeft(t) {
|
|
1426
|
+
this.outro = t + this.outro;
|
|
1427
|
+
}
|
|
1428
|
+
prependRight(t) {
|
|
1429
|
+
this.intro = t + this.intro;
|
|
1430
|
+
}
|
|
1431
|
+
reset() {
|
|
1432
|
+
this.intro = "", this.outro = "", this.edited && (this.content = this.original, this.storeName = !1, this.edited = !1);
|
|
1433
|
+
}
|
|
1434
|
+
split(t) {
|
|
1435
|
+
const e = t - this.start, n = this.original.slice(0, e), r = this.original.slice(e);
|
|
1436
|
+
this.original = n;
|
|
1437
|
+
const s = new I(t, this.end, r);
|
|
1438
|
+
return s.outro = this.outro, this.outro = "", this.end = t, this.edited ? (s.edit("", !1), this.content = "") : this.content = n, s.next = this.next, s.next && (s.next.previous = s), s.previous = this, this.next = s, s;
|
|
1439
|
+
}
|
|
1440
|
+
toString() {
|
|
1441
|
+
return this.intro + this.content + this.outro;
|
|
1442
|
+
}
|
|
1443
|
+
trimEnd(t) {
|
|
1444
|
+
if (this.outro = this.outro.replace(t, ""), this.outro.length) return !0;
|
|
1445
|
+
const e = this.content.replace(t, "");
|
|
1446
|
+
if (e.length)
|
|
1447
|
+
return e !== this.content && (this.split(this.start + e.length).edit("", void 0, !0), this.edited && this.edit(e, this.storeName, !0)), !0;
|
|
1448
|
+
if (this.edit("", void 0, !0), this.intro = this.intro.replace(t, ""), this.intro.length) return !0;
|
|
1449
|
+
}
|
|
1450
|
+
trimStart(t) {
|
|
1451
|
+
if (this.intro = this.intro.replace(t, ""), this.intro.length) return !0;
|
|
1452
|
+
const e = this.content.replace(t, "");
|
|
1453
|
+
if (e.length) {
|
|
1454
|
+
if (e !== this.content) {
|
|
1455
|
+
const n = this.split(this.end - e.length);
|
|
1456
|
+
this.edited && n.edit(e, this.storeName, !0), this.edit("", void 0, !0);
|
|
1457
|
+
}
|
|
1458
|
+
return !0;
|
|
1459
|
+
} else if (this.edit("", void 0, !0), this.outro = this.outro.replace(t, ""), this.outro.length) return !0;
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
function Qt() {
|
|
1463
|
+
return typeof globalThis < "u" && typeof globalThis.btoa == "function" ? (i) => globalThis.btoa(unescape(encodeURIComponent(i))) : typeof Buffer == "function" ? (i) => Buffer.from(i, "utf-8").toString("base64") : () => {
|
|
1464
|
+
throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
const Kt = /* @__PURE__ */ Qt();
|
|
1468
|
+
class Yt {
|
|
1469
|
+
constructor(t) {
|
|
1470
|
+
this.version = 3, this.file = t.file, this.sources = t.sources, this.sourcesContent = t.sourcesContent, this.names = t.names, this.mappings = Ht(t.mappings), typeof t.x_google_ignoreList < "u" && (this.x_google_ignoreList = t.x_google_ignoreList), typeof t.debugId < "u" && (this.debugId = t.debugId);
|
|
1471
|
+
}
|
|
1472
|
+
toString() {
|
|
1473
|
+
return JSON.stringify(this);
|
|
1474
|
+
}
|
|
1475
|
+
toUrl() {
|
|
1476
|
+
return "data:application/json;charset=utf-8;base64," + Kt(this.toString());
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
function Zt(i) {
|
|
1480
|
+
const t = i.split(`
|
|
1481
|
+
`), e = t.filter((s) => /^\t+/.test(s)), n = t.filter((s) => /^ {2,}/.test(s));
|
|
1482
|
+
if (e.length === 0 && n.length === 0)
|
|
1483
|
+
return null;
|
|
1484
|
+
if (e.length >= n.length)
|
|
1485
|
+
return " ";
|
|
1486
|
+
const r = n.reduce((s, o) => {
|
|
1487
|
+
const l = /^ +/.exec(o)[0].length;
|
|
1488
|
+
return Math.min(l, s);
|
|
1489
|
+
}, 1 / 0);
|
|
1490
|
+
return new Array(r + 1).join(" ");
|
|
1491
|
+
}
|
|
1492
|
+
function Jt(i, t) {
|
|
1493
|
+
const e = i.split(/[/\\]/), n = t.split(/[/\\]/);
|
|
1494
|
+
for (e.pop(); e[0] === n[0]; )
|
|
1495
|
+
e.shift(), n.shift();
|
|
1496
|
+
if (e.length) {
|
|
1497
|
+
let r = e.length;
|
|
1498
|
+
for (; r--; ) e[r] = "..";
|
|
1499
|
+
}
|
|
1500
|
+
return e.concat(n).join("/");
|
|
1501
|
+
}
|
|
1502
|
+
const qt = Object.prototype.toString;
|
|
1503
|
+
function te(i) {
|
|
1504
|
+
return qt.call(i) === "[object Object]";
|
|
1505
|
+
}
|
|
1506
|
+
function H(i) {
|
|
1507
|
+
const t = i.split(`
|
|
1508
|
+
`), e = [];
|
|
1509
|
+
for (let n = 0, r = 0; n < t.length; n++)
|
|
1510
|
+
e.push(r), r += t[n].length + 1;
|
|
1511
|
+
return function(r) {
|
|
1512
|
+
let s = 0, o = e.length;
|
|
1513
|
+
for (; s < o; ) {
|
|
1514
|
+
const a = s + o >> 1;
|
|
1515
|
+
r < e[a] ? o = a : s = a + 1;
|
|
1516
|
+
}
|
|
1517
|
+
const l = s - 1, h = r - e[l];
|
|
1518
|
+
return { line: l, column: h };
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
const ee = /\w/;
|
|
1522
|
+
class ne {
|
|
1523
|
+
constructor(t) {
|
|
1524
|
+
this.hires = t, this.generatedCodeLine = 0, this.generatedCodeColumn = 0, this.raw = [], this.rawSegments = this.raw[this.generatedCodeLine] = [], this.pending = null;
|
|
1525
|
+
}
|
|
1526
|
+
addEdit(t, e, n, r) {
|
|
1527
|
+
if (e.length) {
|
|
1528
|
+
const s = e.length - 1;
|
|
1529
|
+
let o = e.indexOf(`
|
|
1530
|
+
`, 0), l = -1;
|
|
1531
|
+
for (; o >= 0 && s > o; ) {
|
|
1532
|
+
const a = [this.generatedCodeColumn, t, n.line, n.column];
|
|
1533
|
+
r >= 0 && a.push(r), this.rawSegments.push(a), this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn = 0, l = o, o = e.indexOf(`
|
|
1534
|
+
`, o + 1);
|
|
1535
|
+
}
|
|
1536
|
+
const h = [this.generatedCodeColumn, t, n.line, n.column];
|
|
1537
|
+
r >= 0 && h.push(r), this.rawSegments.push(h), this.advance(e.slice(l + 1));
|
|
1538
|
+
} else this.pending && (this.rawSegments.push(this.pending), this.advance(e));
|
|
1539
|
+
this.pending = null;
|
|
1540
|
+
}
|
|
1541
|
+
addUneditedChunk(t, e, n, r, s) {
|
|
1542
|
+
let o = e.start, l = !0, h = !1;
|
|
1543
|
+
for (; o < e.end; ) {
|
|
1544
|
+
if (n[o] === `
|
|
1545
|
+
`)
|
|
1546
|
+
r.line += 1, r.column = 0, this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn = 0, l = !0, h = !1;
|
|
1547
|
+
else {
|
|
1548
|
+
if (this.hires || l || s.has(o)) {
|
|
1549
|
+
const a = [this.generatedCodeColumn, t, r.line, r.column];
|
|
1550
|
+
this.hires === "boundary" ? ee.test(n[o]) ? h || (this.rawSegments.push(a), h = !0) : (this.rawSegments.push(a), h = !1) : this.rawSegments.push(a);
|
|
1551
|
+
}
|
|
1552
|
+
r.column += 1, this.generatedCodeColumn += 1, l = !1;
|
|
1553
|
+
}
|
|
1554
|
+
o += 1;
|
|
1555
|
+
}
|
|
1556
|
+
this.pending = null;
|
|
1557
|
+
}
|
|
1558
|
+
advance(t) {
|
|
1559
|
+
if (!t) return;
|
|
1560
|
+
const e = t.split(`
|
|
1561
|
+
`);
|
|
1562
|
+
if (e.length > 1) {
|
|
1563
|
+
for (let n = 0; n < e.length - 1; n++)
|
|
1564
|
+
this.generatedCodeLine++, this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
1565
|
+
this.generatedCodeColumn = 0;
|
|
1566
|
+
}
|
|
1567
|
+
this.generatedCodeColumn += e[e.length - 1].length;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
const w = `
|
|
1571
|
+
`, E = {
|
|
1572
|
+
insertLeft: !1,
|
|
1573
|
+
insertRight: !1,
|
|
1574
|
+
storeName: !1
|
|
1575
|
+
};
|
|
1576
|
+
class P {
|
|
1577
|
+
constructor(t, e = {}) {
|
|
1578
|
+
const n = new I(0, t.length, t);
|
|
1579
|
+
Object.defineProperties(this, {
|
|
1580
|
+
original: { writable: !0, value: t },
|
|
1581
|
+
outro: { writable: !0, value: "" },
|
|
1582
|
+
intro: { writable: !0, value: "" },
|
|
1583
|
+
firstChunk: { writable: !0, value: n },
|
|
1584
|
+
lastChunk: { writable: !0, value: n },
|
|
1585
|
+
lastSearchedChunk: { writable: !0, value: n },
|
|
1586
|
+
byStart: { writable: !0, value: {} },
|
|
1587
|
+
byEnd: { writable: !0, value: {} },
|
|
1588
|
+
filename: { writable: !0, value: e.filename },
|
|
1589
|
+
indentExclusionRanges: { writable: !0, value: e.indentExclusionRanges },
|
|
1590
|
+
sourcemapLocations: { writable: !0, value: new S() },
|
|
1591
|
+
storedNames: { writable: !0, value: {} },
|
|
1592
|
+
indentStr: { writable: !0, value: void 0 },
|
|
1593
|
+
ignoreList: { writable: !0, value: e.ignoreList },
|
|
1594
|
+
offset: { writable: !0, value: e.offset || 0 }
|
|
1595
|
+
}), this.byStart[0] = n, this.byEnd[t.length] = n;
|
|
1596
|
+
}
|
|
1597
|
+
addSourcemapLocation(t) {
|
|
1598
|
+
this.sourcemapLocations.add(t);
|
|
1599
|
+
}
|
|
1600
|
+
append(t) {
|
|
1601
|
+
if (typeof t != "string") throw new TypeError("outro content must be a string");
|
|
1602
|
+
return this.outro += t, this;
|
|
1603
|
+
}
|
|
1604
|
+
appendLeft(t, e) {
|
|
1605
|
+
if (t = t + this.offset, typeof e != "string") throw new TypeError("inserted content must be a string");
|
|
1606
|
+
this._split(t);
|
|
1607
|
+
const n = this.byEnd[t];
|
|
1608
|
+
return n ? n.appendLeft(e) : this.intro += e, this;
|
|
1609
|
+
}
|
|
1610
|
+
appendRight(t, e) {
|
|
1611
|
+
if (t = t + this.offset, typeof e != "string") throw new TypeError("inserted content must be a string");
|
|
1612
|
+
this._split(t);
|
|
1613
|
+
const n = this.byStart[t];
|
|
1614
|
+
return n ? n.appendRight(e) : this.outro += e, this;
|
|
1615
|
+
}
|
|
1616
|
+
clone() {
|
|
1617
|
+
const t = new P(this.original, { filename: this.filename, offset: this.offset });
|
|
1618
|
+
let e = this.firstChunk, n = t.firstChunk = t.lastSearchedChunk = e.clone();
|
|
1619
|
+
for (; e; ) {
|
|
1620
|
+
t.byStart[n.start] = n, t.byEnd[n.end] = n;
|
|
1621
|
+
const r = e.next, s = r && r.clone();
|
|
1622
|
+
s && (n.next = s, s.previous = n, n = s), e = r;
|
|
1623
|
+
}
|
|
1624
|
+
return t.lastChunk = n, this.indentExclusionRanges && (t.indentExclusionRanges = this.indentExclusionRanges.slice()), t.sourcemapLocations = new S(this.sourcemapLocations), t.intro = this.intro, t.outro = this.outro, t;
|
|
1625
|
+
}
|
|
1626
|
+
generateDecodedMap(t) {
|
|
1627
|
+
t = t || {};
|
|
1628
|
+
const e = 0, n = Object.keys(this.storedNames), r = new ne(t.hires), s = H(this.original);
|
|
1629
|
+
return this.intro && r.advance(this.intro), this.firstChunk.eachNext((o) => {
|
|
1630
|
+
const l = s(o.start);
|
|
1631
|
+
o.intro.length && r.advance(o.intro), o.edited ? r.addEdit(
|
|
1632
|
+
e,
|
|
1633
|
+
o.content,
|
|
1634
|
+
l,
|
|
1635
|
+
o.storeName ? n.indexOf(o.original) : -1
|
|
1636
|
+
) : r.addUneditedChunk(e, o, this.original, l, this.sourcemapLocations), o.outro.length && r.advance(o.outro);
|
|
1637
|
+
}), this.outro && r.advance(this.outro), {
|
|
1638
|
+
file: t.file ? t.file.split(/[/\\]/).pop() : void 0,
|
|
1639
|
+
sources: [
|
|
1640
|
+
t.source ? Jt(t.file || "", t.source) : t.file || ""
|
|
1641
|
+
],
|
|
1642
|
+
sourcesContent: t.includeContent ? [this.original] : void 0,
|
|
1643
|
+
names: n,
|
|
1644
|
+
mappings: r.raw,
|
|
1645
|
+
x_google_ignoreList: this.ignoreList ? [e] : void 0
|
|
1646
|
+
};
|
|
1647
|
+
}
|
|
1648
|
+
generateMap(t) {
|
|
1649
|
+
return new Yt(this.generateDecodedMap(t));
|
|
1650
|
+
}
|
|
1651
|
+
_ensureindentStr() {
|
|
1652
|
+
this.indentStr === void 0 && (this.indentStr = Zt(this.original));
|
|
1653
|
+
}
|
|
1654
|
+
_getRawIndentString() {
|
|
1655
|
+
return this._ensureindentStr(), this.indentStr;
|
|
1656
|
+
}
|
|
1657
|
+
getIndentString() {
|
|
1658
|
+
return this._ensureindentStr(), this.indentStr === null ? " " : this.indentStr;
|
|
1659
|
+
}
|
|
1660
|
+
indent(t, e) {
|
|
1661
|
+
const n = /^[^\r\n]/gm;
|
|
1662
|
+
if (te(t) && (e = t, t = void 0), t === void 0 && (this._ensureindentStr(), t = this.indentStr || " "), t === "") return this;
|
|
1663
|
+
e = e || {};
|
|
1664
|
+
const r = {};
|
|
1665
|
+
e.exclude && (typeof e.exclude[0] == "number" ? [e.exclude] : e.exclude).forEach((u) => {
|
|
1666
|
+
for (let d = u[0]; d < u[1]; d += 1)
|
|
1667
|
+
r[d] = !0;
|
|
1668
|
+
});
|
|
1669
|
+
let s = e.indentStart !== !1;
|
|
1670
|
+
const o = (a) => s ? `${t}${a}` : (s = !0, a);
|
|
1671
|
+
this.intro = this.intro.replace(n, o);
|
|
1672
|
+
let l = 0, h = this.firstChunk;
|
|
1673
|
+
for (; h; ) {
|
|
1674
|
+
const a = h.end;
|
|
1675
|
+
if (h.edited)
|
|
1676
|
+
r[l] || (h.content = h.content.replace(n, o), h.content.length && (s = h.content[h.content.length - 1] === `
|
|
1677
|
+
`));
|
|
1678
|
+
else
|
|
1679
|
+
for (l = h.start; l < a; ) {
|
|
1680
|
+
if (!r[l]) {
|
|
1681
|
+
const u = this.original[l];
|
|
1682
|
+
u === `
|
|
1683
|
+
` ? s = !0 : u !== "\r" && s && (s = !1, l === h.start || (this._splitChunk(h, l), h = h.next), h.prependRight(t));
|
|
1684
|
+
}
|
|
1685
|
+
l += 1;
|
|
1686
|
+
}
|
|
1687
|
+
l = h.end, h = h.next;
|
|
1688
|
+
}
|
|
1689
|
+
return this.outro = this.outro.replace(n, o), this;
|
|
1690
|
+
}
|
|
1691
|
+
insert() {
|
|
1692
|
+
throw new Error(
|
|
1693
|
+
"magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)"
|
|
1694
|
+
);
|
|
1695
|
+
}
|
|
1696
|
+
insertLeft(t, e) {
|
|
1697
|
+
return E.insertLeft || (console.warn(
|
|
1698
|
+
"magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"
|
|
1699
|
+
), E.insertLeft = !0), this.appendLeft(t, e);
|
|
1700
|
+
}
|
|
1701
|
+
insertRight(t, e) {
|
|
1702
|
+
return E.insertRight || (console.warn(
|
|
1703
|
+
"magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"
|
|
1704
|
+
), E.insertRight = !0), this.prependRight(t, e);
|
|
1705
|
+
}
|
|
1706
|
+
move(t, e, n) {
|
|
1707
|
+
if (t = t + this.offset, e = e + this.offset, n = n + this.offset, n >= t && n <= e) throw new Error("Cannot move a selection inside itself");
|
|
1708
|
+
this._split(t), this._split(e), this._split(n);
|
|
1709
|
+
const r = this.byStart[t], s = this.byEnd[e], o = r.previous, l = s.next, h = this.byStart[n];
|
|
1710
|
+
if (!h && s === this.lastChunk) return this;
|
|
1711
|
+
const a = h ? h.previous : this.lastChunk;
|
|
1712
|
+
return o && (o.next = l), l && (l.previous = o), a && (a.next = r), h && (h.previous = s), r.previous || (this.firstChunk = s.next), s.next || (this.lastChunk = r.previous, this.lastChunk.next = null), r.previous = a, s.next = h || null, a || (this.firstChunk = r), h || (this.lastChunk = s), this;
|
|
1713
|
+
}
|
|
1714
|
+
overwrite(t, e, n, r) {
|
|
1715
|
+
return r = r || {}, this.update(t, e, n, { ...r, overwrite: !r.contentOnly });
|
|
1716
|
+
}
|
|
1717
|
+
update(t, e, n, r) {
|
|
1718
|
+
if (t = t + this.offset, e = e + this.offset, typeof n != "string") throw new TypeError("replacement content must be a string");
|
|
1719
|
+
if (this.original.length !== 0) {
|
|
1720
|
+
for (; t < 0; ) t += this.original.length;
|
|
1721
|
+
for (; e < 0; ) e += this.original.length;
|
|
1722
|
+
}
|
|
1723
|
+
if (e > this.original.length) throw new Error("end is out of bounds");
|
|
1724
|
+
if (t === e)
|
|
1725
|
+
throw new Error(
|
|
1726
|
+
"Cannot overwrite a zero-length range – use appendLeft or prependRight instead"
|
|
1727
|
+
);
|
|
1728
|
+
this._split(t), this._split(e), r === !0 && (E.storeName || (console.warn(
|
|
1729
|
+
"The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"
|
|
1730
|
+
), E.storeName = !0), r = { storeName: !0 });
|
|
1731
|
+
const s = r !== void 0 ? r.storeName : !1, o = r !== void 0 ? r.overwrite : !1;
|
|
1732
|
+
if (s) {
|
|
1733
|
+
const a = this.original.slice(t, e);
|
|
1734
|
+
Object.defineProperty(this.storedNames, a, {
|
|
1735
|
+
writable: !0,
|
|
1736
|
+
value: !0,
|
|
1737
|
+
enumerable: !0
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1740
|
+
const l = this.byStart[t], h = this.byEnd[e];
|
|
1741
|
+
if (l) {
|
|
1742
|
+
let a = l;
|
|
1743
|
+
for (; a !== h; ) {
|
|
1744
|
+
if (a.next !== this.byStart[a.end])
|
|
1745
|
+
throw new Error("Cannot overwrite across a split point");
|
|
1746
|
+
a = a.next, a.edit("", !1);
|
|
1747
|
+
}
|
|
1748
|
+
l.edit(n, s, !o);
|
|
1749
|
+
} else {
|
|
1750
|
+
const a = new I(t, e, "").edit(n, s);
|
|
1751
|
+
h.next = a, a.previous = h;
|
|
1752
|
+
}
|
|
1753
|
+
return this;
|
|
1754
|
+
}
|
|
1755
|
+
prepend(t) {
|
|
1756
|
+
if (typeof t != "string") throw new TypeError("outro content must be a string");
|
|
1757
|
+
return this.intro = t + this.intro, this;
|
|
1758
|
+
}
|
|
1759
|
+
prependLeft(t, e) {
|
|
1760
|
+
if (t = t + this.offset, typeof e != "string") throw new TypeError("inserted content must be a string");
|
|
1761
|
+
this._split(t);
|
|
1762
|
+
const n = this.byEnd[t];
|
|
1763
|
+
return n ? n.prependLeft(e) : this.intro = e + this.intro, this;
|
|
1764
|
+
}
|
|
1765
|
+
prependRight(t, e) {
|
|
1766
|
+
if (t = t + this.offset, typeof e != "string") throw new TypeError("inserted content must be a string");
|
|
1767
|
+
this._split(t);
|
|
1768
|
+
const n = this.byStart[t];
|
|
1769
|
+
return n ? n.prependRight(e) : this.outro = e + this.outro, this;
|
|
1770
|
+
}
|
|
1771
|
+
remove(t, e) {
|
|
1772
|
+
if (t = t + this.offset, e = e + this.offset, this.original.length !== 0) {
|
|
1773
|
+
for (; t < 0; ) t += this.original.length;
|
|
1774
|
+
for (; e < 0; ) e += this.original.length;
|
|
1775
|
+
}
|
|
1776
|
+
if (t === e) return this;
|
|
1777
|
+
if (t < 0 || e > this.original.length) throw new Error("Character is out of bounds");
|
|
1778
|
+
if (t > e) throw new Error("end must be greater than start");
|
|
1779
|
+
this._split(t), this._split(e);
|
|
1780
|
+
let n = this.byStart[t];
|
|
1781
|
+
for (; n; )
|
|
1782
|
+
n.intro = "", n.outro = "", n.edit(""), n = e > n.end ? this.byStart[n.end] : null;
|
|
1783
|
+
return this;
|
|
1784
|
+
}
|
|
1785
|
+
reset(t, e) {
|
|
1786
|
+
if (t = t + this.offset, e = e + this.offset, this.original.length !== 0) {
|
|
1787
|
+
for (; t < 0; ) t += this.original.length;
|
|
1788
|
+
for (; e < 0; ) e += this.original.length;
|
|
1789
|
+
}
|
|
1790
|
+
if (t === e) return this;
|
|
1791
|
+
if (t < 0 || e > this.original.length) throw new Error("Character is out of bounds");
|
|
1792
|
+
if (t > e) throw new Error("end must be greater than start");
|
|
1793
|
+
this._split(t), this._split(e);
|
|
1794
|
+
let n = this.byStart[t];
|
|
1795
|
+
for (; n; )
|
|
1796
|
+
n.reset(), n = e > n.end ? this.byStart[n.end] : null;
|
|
1797
|
+
return this;
|
|
1798
|
+
}
|
|
1799
|
+
lastChar() {
|
|
1800
|
+
if (this.outro.length) return this.outro[this.outro.length - 1];
|
|
1801
|
+
let t = this.lastChunk;
|
|
1802
|
+
do {
|
|
1803
|
+
if (t.outro.length) return t.outro[t.outro.length - 1];
|
|
1804
|
+
if (t.content.length) return t.content[t.content.length - 1];
|
|
1805
|
+
if (t.intro.length) return t.intro[t.intro.length - 1];
|
|
1806
|
+
} while (t = t.previous);
|
|
1807
|
+
return this.intro.length ? this.intro[this.intro.length - 1] : "";
|
|
1808
|
+
}
|
|
1809
|
+
lastLine() {
|
|
1810
|
+
let t = this.outro.lastIndexOf(w);
|
|
1811
|
+
if (t !== -1) return this.outro.substr(t + 1);
|
|
1812
|
+
let e = this.outro, n = this.lastChunk;
|
|
1813
|
+
do {
|
|
1814
|
+
if (n.outro.length > 0) {
|
|
1815
|
+
if (t = n.outro.lastIndexOf(w), t !== -1) return n.outro.substr(t + 1) + e;
|
|
1816
|
+
e = n.outro + e;
|
|
1817
|
+
}
|
|
1818
|
+
if (n.content.length > 0) {
|
|
1819
|
+
if (t = n.content.lastIndexOf(w), t !== -1) return n.content.substr(t + 1) + e;
|
|
1820
|
+
e = n.content + e;
|
|
1821
|
+
}
|
|
1822
|
+
if (n.intro.length > 0) {
|
|
1823
|
+
if (t = n.intro.lastIndexOf(w), t !== -1) return n.intro.substr(t + 1) + e;
|
|
1824
|
+
e = n.intro + e;
|
|
1825
|
+
}
|
|
1826
|
+
} while (n = n.previous);
|
|
1827
|
+
return t = this.intro.lastIndexOf(w), t !== -1 ? this.intro.substr(t + 1) + e : this.intro + e;
|
|
1828
|
+
}
|
|
1829
|
+
slice(t = 0, e = this.original.length - this.offset) {
|
|
1830
|
+
if (t = t + this.offset, e = e + this.offset, this.original.length !== 0) {
|
|
1831
|
+
for (; t < 0; ) t += this.original.length;
|
|
1832
|
+
for (; e < 0; ) e += this.original.length;
|
|
1833
|
+
}
|
|
1834
|
+
let n = "", r = this.firstChunk;
|
|
1835
|
+
for (; r && (r.start > t || r.end <= t); ) {
|
|
1836
|
+
if (r.start < e && r.end >= e)
|
|
1837
|
+
return n;
|
|
1838
|
+
r = r.next;
|
|
1839
|
+
}
|
|
1840
|
+
if (r && r.edited && r.start !== t)
|
|
1841
|
+
throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);
|
|
1842
|
+
const s = r;
|
|
1843
|
+
for (; r; ) {
|
|
1844
|
+
r.intro && (s !== r || r.start === t) && (n += r.intro);
|
|
1845
|
+
const o = r.start < e && r.end >= e;
|
|
1846
|
+
if (o && r.edited && r.end !== e)
|
|
1847
|
+
throw new Error(`Cannot use replaced character ${e} as slice end anchor.`);
|
|
1848
|
+
const l = s === r ? t - r.start : 0, h = o ? r.content.length + e - r.end : r.content.length;
|
|
1849
|
+
if (n += r.content.slice(l, h), r.outro && (!o || r.end === e) && (n += r.outro), o)
|
|
1850
|
+
break;
|
|
1851
|
+
r = r.next;
|
|
1852
|
+
}
|
|
1853
|
+
return n;
|
|
1854
|
+
}
|
|
1855
|
+
// TODO deprecate this? not really very useful
|
|
1856
|
+
snip(t, e) {
|
|
1857
|
+
const n = this.clone();
|
|
1858
|
+
return n.remove(0, t), n.remove(e, n.original.length), n;
|
|
1859
|
+
}
|
|
1860
|
+
_split(t) {
|
|
1861
|
+
if (this.byStart[t] || this.byEnd[t]) return;
|
|
1862
|
+
let e = this.lastSearchedChunk, n = e;
|
|
1863
|
+
const r = t > e.end;
|
|
1864
|
+
for (; e; ) {
|
|
1865
|
+
if (e.contains(t)) return this._splitChunk(e, t);
|
|
1866
|
+
if (e = r ? this.byStart[e.end] : this.byEnd[e.start], e === n) return;
|
|
1867
|
+
n = e;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
_splitChunk(t, e) {
|
|
1871
|
+
if (t.edited && t.content.length) {
|
|
1872
|
+
const r = H(this.original)(e);
|
|
1873
|
+
throw new Error(
|
|
1874
|
+
`Cannot split a chunk that has already been edited (${r.line}:${r.column} – "${t.original}")`
|
|
1875
|
+
);
|
|
1876
|
+
}
|
|
1877
|
+
const n = t.split(e);
|
|
1878
|
+
return this.byEnd[e] = t, this.byStart[e] = n, this.byEnd[n.end] = n, t === this.lastChunk && (this.lastChunk = n), this.lastSearchedChunk = t, !0;
|
|
1879
|
+
}
|
|
1880
|
+
toString() {
|
|
1881
|
+
let t = this.intro, e = this.firstChunk;
|
|
1882
|
+
for (; e; )
|
|
1883
|
+
t += e.toString(), e = e.next;
|
|
1884
|
+
return t + this.outro;
|
|
1885
|
+
}
|
|
1886
|
+
isEmpty() {
|
|
1887
|
+
let t = this.firstChunk;
|
|
1888
|
+
do
|
|
1889
|
+
if (t.intro.length && t.intro.trim() || t.content.length && t.content.trim() || t.outro.length && t.outro.trim())
|
|
1890
|
+
return !1;
|
|
1891
|
+
while (t = t.next);
|
|
1892
|
+
return !0;
|
|
1893
|
+
}
|
|
1894
|
+
length() {
|
|
1895
|
+
let t = this.firstChunk, e = 0;
|
|
1896
|
+
do
|
|
1897
|
+
e += t.intro.length + t.content.length + t.outro.length;
|
|
1898
|
+
while (t = t.next);
|
|
1899
|
+
return e;
|
|
1900
|
+
}
|
|
1901
|
+
trimLines() {
|
|
1902
|
+
return this.trim("[\\r\\n]");
|
|
1903
|
+
}
|
|
1904
|
+
trim(t) {
|
|
1905
|
+
return this.trimStart(t).trimEnd(t);
|
|
1906
|
+
}
|
|
1907
|
+
trimEndAborted(t) {
|
|
1908
|
+
const e = new RegExp((t || "\\s") + "+$");
|
|
1909
|
+
if (this.outro = this.outro.replace(e, ""), this.outro.length) return !0;
|
|
1910
|
+
let n = this.lastChunk;
|
|
1911
|
+
do {
|
|
1912
|
+
const r = n.end, s = n.trimEnd(e);
|
|
1913
|
+
if (n.end !== r && (this.lastChunk === n && (this.lastChunk = n.next), this.byEnd[n.end] = n, this.byStart[n.next.start] = n.next, this.byEnd[n.next.end] = n.next), s) return !0;
|
|
1914
|
+
n = n.previous;
|
|
1915
|
+
} while (n);
|
|
1916
|
+
return !1;
|
|
1917
|
+
}
|
|
1918
|
+
trimEnd(t) {
|
|
1919
|
+
return this.trimEndAborted(t), this;
|
|
1920
|
+
}
|
|
1921
|
+
trimStartAborted(t) {
|
|
1922
|
+
const e = new RegExp("^" + (t || "\\s") + "+");
|
|
1923
|
+
if (this.intro = this.intro.replace(e, ""), this.intro.length) return !0;
|
|
1924
|
+
let n = this.firstChunk;
|
|
1925
|
+
do {
|
|
1926
|
+
const r = n.end, s = n.trimStart(e);
|
|
1927
|
+
if (n.end !== r && (n === this.lastChunk && (this.lastChunk = n.next), this.byEnd[n.end] = n, this.byStart[n.next.start] = n.next, this.byEnd[n.next.end] = n.next), s) return !0;
|
|
1928
|
+
n = n.next;
|
|
1929
|
+
} while (n);
|
|
1930
|
+
return !1;
|
|
1931
|
+
}
|
|
1932
|
+
trimStart(t) {
|
|
1933
|
+
return this.trimStartAborted(t), this;
|
|
1934
|
+
}
|
|
1935
|
+
hasChanged() {
|
|
1936
|
+
return this.original !== this.toString();
|
|
1937
|
+
}
|
|
1938
|
+
_replaceRegexp(t, e) {
|
|
1939
|
+
function n(s, o) {
|
|
1940
|
+
return typeof e == "string" ? e.replace(/\$(\$|&|\d+)/g, (l, h) => h === "$" ? "$" : h === "&" ? s[0] : +h < s.length ? s[+h] : `$${h}`) : e(...s, s.index, o, s.groups);
|
|
1941
|
+
}
|
|
1942
|
+
function r(s, o) {
|
|
1943
|
+
let l;
|
|
1944
|
+
const h = [];
|
|
1945
|
+
for (; l = s.exec(o); )
|
|
1946
|
+
h.push(l);
|
|
1947
|
+
return h;
|
|
1948
|
+
}
|
|
1949
|
+
if (t.global)
|
|
1950
|
+
r(t, this.original).forEach((o) => {
|
|
1951
|
+
if (o.index != null) {
|
|
1952
|
+
const l = n(o, this.original);
|
|
1953
|
+
l !== o[0] && this.overwrite(o.index, o.index + o[0].length, l);
|
|
1954
|
+
}
|
|
1955
|
+
});
|
|
1956
|
+
else {
|
|
1957
|
+
const s = this.original.match(t);
|
|
1958
|
+
if (s && s.index != null) {
|
|
1959
|
+
const o = n(s, this.original);
|
|
1960
|
+
o !== s[0] && this.overwrite(s.index, s.index + s[0].length, o);
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
return this;
|
|
1964
|
+
}
|
|
1965
|
+
_replaceString(t, e) {
|
|
1966
|
+
const { original: n } = this, r = n.indexOf(t);
|
|
1967
|
+
return r !== -1 && (typeof e == "function" && (e = e(t, r, n)), t !== e && this.overwrite(r, r + t.length, e)), this;
|
|
1968
|
+
}
|
|
1969
|
+
replace(t, e) {
|
|
1970
|
+
return typeof t == "string" ? this._replaceString(t, e) : this._replaceRegexp(t, e);
|
|
1971
|
+
}
|
|
1972
|
+
_replaceAllString(t, e) {
|
|
1973
|
+
const { original: n } = this, r = t.length;
|
|
1974
|
+
for (let s = n.indexOf(t); s !== -1; s = n.indexOf(t, s + r)) {
|
|
1975
|
+
const o = n.slice(s, s + r);
|
|
1976
|
+
let l = e;
|
|
1977
|
+
typeof e == "function" && (l = e(o, s, n)), o !== l && this.overwrite(s, s + r, l);
|
|
1978
|
+
}
|
|
1979
|
+
return this;
|
|
1980
|
+
}
|
|
1981
|
+
replaceAll(t, e) {
|
|
1982
|
+
if (typeof t == "string")
|
|
1983
|
+
return this._replaceAllString(t, e);
|
|
1984
|
+
if (!t.global)
|
|
1985
|
+
throw new TypeError(
|
|
1986
|
+
"MagicString.prototype.replaceAll called with a non-global RegExp argument"
|
|
1987
|
+
);
|
|
1988
|
+
return this._replaceRegexp(t, e);
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
const C = /* @__PURE__ */ new Set();
|
|
1992
|
+
for (let i = 48; i <= 57; i++)
|
|
1993
|
+
C.add(i);
|
|
1994
|
+
for (let i = 65; i <= 90; i++)
|
|
1995
|
+
C.add(i);
|
|
1996
|
+
for (let i = 97; i <= 122; i++)
|
|
1997
|
+
C.add(i);
|
|
1998
|
+
C.add(95);
|
|
1999
|
+
C.add(36);
|
|
2000
|
+
const Q = (i) => C.has(i), ie = (i, t) => {
|
|
2001
|
+
if (i[t] !== "<")
|
|
2002
|
+
return !1;
|
|
2003
|
+
const e = i.charCodeAt(t + 1);
|
|
2004
|
+
if (Number.isNaN(e) || !(e === 47 || // /
|
|
2005
|
+
e === 62 || // >
|
|
2006
|
+
e === 33 || // ! (e.g. <!-- -->)
|
|
2007
|
+
Q(e)))
|
|
2008
|
+
return !1;
|
|
2009
|
+
let r = t - 1;
|
|
2010
|
+
for (; r >= 0; ) {
|
|
2011
|
+
const s = i.charCodeAt(r);
|
|
2012
|
+
if (s === 32 || s === 9 || s === 10 || s === 13) {
|
|
2013
|
+
r--;
|
|
2014
|
+
continue;
|
|
2015
|
+
}
|
|
2016
|
+
if (Q(s))
|
|
2017
|
+
return !1;
|
|
2018
|
+
break;
|
|
2019
|
+
}
|
|
2020
|
+
return !0;
|
|
2021
|
+
}, $ = (i, t, e) => {
|
|
2022
|
+
let n = t + 1;
|
|
2023
|
+
for (; n < i.length; ) {
|
|
2024
|
+
const r = i[n];
|
|
2025
|
+
if (r === "\\") {
|
|
2026
|
+
n += 2;
|
|
2027
|
+
continue;
|
|
2028
|
+
}
|
|
2029
|
+
if (r === e)
|
|
2030
|
+
return n + 1;
|
|
2031
|
+
n++;
|
|
2032
|
+
}
|
|
2033
|
+
return i.length;
|
|
2034
|
+
}, rt = (i, t) => {
|
|
2035
|
+
let e = t + 1;
|
|
2036
|
+
for (; e < i.length; ) {
|
|
2037
|
+
const n = i[e];
|
|
2038
|
+
if (n === "\\") {
|
|
2039
|
+
e += 2;
|
|
2040
|
+
continue;
|
|
2041
|
+
}
|
|
2042
|
+
if (n === "`")
|
|
2043
|
+
return e + 1;
|
|
2044
|
+
if (n === "$" && i[e + 1] === "{") {
|
|
2045
|
+
const r = G(i, e + 2);
|
|
2046
|
+
if (r == null)
|
|
2047
|
+
return i.length;
|
|
2048
|
+
e = r;
|
|
2049
|
+
continue;
|
|
2050
|
+
}
|
|
2051
|
+
e++;
|
|
2052
|
+
}
|
|
2053
|
+
return i.length;
|
|
2054
|
+
}, O = (i, t) => {
|
|
2055
|
+
let e = t;
|
|
2056
|
+
for (; e < i.length && i[e] !== `
|
|
2057
|
+
`; )
|
|
2058
|
+
e++;
|
|
2059
|
+
return e;
|
|
2060
|
+
}, b = (i, t) => {
|
|
2061
|
+
const e = i.indexOf("*/", t);
|
|
2062
|
+
return e === -1 ? i.length : e + 2;
|
|
2063
|
+
}, re = (i, t) => {
|
|
2064
|
+
const e = i.indexOf("-->", t);
|
|
2065
|
+
return e === -1 ? i.length : e + 3;
|
|
2066
|
+
}, G = (i, t) => {
|
|
2067
|
+
let e = 1, n = t;
|
|
2068
|
+
for (; n < i.length; ) {
|
|
2069
|
+
const r = i[n];
|
|
2070
|
+
if (r === "\\") {
|
|
2071
|
+
n += 2;
|
|
2072
|
+
continue;
|
|
2073
|
+
}
|
|
2074
|
+
if (r === "'" || r === '"') {
|
|
2075
|
+
n = $(i, n, r);
|
|
2076
|
+
continue;
|
|
2077
|
+
}
|
|
2078
|
+
if (r === "`") {
|
|
2079
|
+
n = rt(i, n);
|
|
2080
|
+
continue;
|
|
2081
|
+
}
|
|
2082
|
+
if (r === "/" && i[n + 1] === "*") {
|
|
2083
|
+
n = b(i, n + 2);
|
|
2084
|
+
continue;
|
|
2085
|
+
}
|
|
2086
|
+
if (r === "/" && i[n + 1] === "/") {
|
|
2087
|
+
n = O(i, n + 2);
|
|
2088
|
+
continue;
|
|
2089
|
+
}
|
|
2090
|
+
if (r === "{") {
|
|
2091
|
+
e++, n++;
|
|
2092
|
+
continue;
|
|
2093
|
+
}
|
|
2094
|
+
if (r === "}") {
|
|
2095
|
+
if (e--, n++, e === 0)
|
|
2096
|
+
return n;
|
|
2097
|
+
continue;
|
|
2098
|
+
}
|
|
2099
|
+
n++;
|
|
2100
|
+
}
|
|
2101
|
+
return null;
|
|
2102
|
+
}, K = (i, t, e) => {
|
|
2103
|
+
let n = t;
|
|
2104
|
+
for (; n < i.length; ) {
|
|
2105
|
+
const r = i[n];
|
|
2106
|
+
if (r === "'" || r === '"') {
|
|
2107
|
+
n = $(i, n, r);
|
|
2108
|
+
continue;
|
|
2109
|
+
}
|
|
2110
|
+
if (r === "{") {
|
|
2111
|
+
const s = G(i, n + 1);
|
|
2112
|
+
if (s == null)
|
|
2113
|
+
return null;
|
|
2114
|
+
n = s;
|
|
2115
|
+
continue;
|
|
2116
|
+
}
|
|
2117
|
+
if (r === "/" && i[n + 1] === "*") {
|
|
2118
|
+
n = b(i, n + 2);
|
|
2119
|
+
continue;
|
|
2120
|
+
}
|
|
2121
|
+
if (r === "/" && i[n + 1] === "/") {
|
|
2122
|
+
n = O(i, n + 2);
|
|
2123
|
+
continue;
|
|
2124
|
+
}
|
|
2125
|
+
if (r === ">") {
|
|
2126
|
+
const s = !e && i[n - 1] === "/";
|
|
2127
|
+
return { position: n + 1, selfClosing: s };
|
|
2128
|
+
}
|
|
2129
|
+
n++;
|
|
2130
|
+
}
|
|
2131
|
+
return null;
|
|
2132
|
+
}, se = (i, t) => {
|
|
2133
|
+
const e = i.length;
|
|
2134
|
+
let n = t, r = 0;
|
|
2135
|
+
for (; n < e; ) {
|
|
2136
|
+
const s = i[n];
|
|
2137
|
+
if (s === "/" && i[n + 1] === "*") {
|
|
2138
|
+
n = b(i, n + 2);
|
|
2139
|
+
continue;
|
|
2140
|
+
}
|
|
2141
|
+
if (s === "/" && i[n + 1] === "/") {
|
|
2142
|
+
n = O(i, n + 2);
|
|
2143
|
+
continue;
|
|
2144
|
+
}
|
|
2145
|
+
if (s === "{") {
|
|
2146
|
+
const o = G(i, n + 1);
|
|
2147
|
+
if (o != null) {
|
|
2148
|
+
n = o;
|
|
2149
|
+
continue;
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
if (s === "<") {
|
|
2153
|
+
if (i.startsWith("<!--", n)) {
|
|
2154
|
+
n = re(i, n + 4);
|
|
2155
|
+
continue;
|
|
2156
|
+
}
|
|
2157
|
+
if (i[n + 1] === "/") {
|
|
2158
|
+
r--;
|
|
2159
|
+
const o = K(i, n + 2, !0);
|
|
2160
|
+
if (!o)
|
|
2161
|
+
return null;
|
|
2162
|
+
if (n = o.position, r === 0)
|
|
2163
|
+
return {
|
|
2164
|
+
start: t,
|
|
2165
|
+
end: n,
|
|
2166
|
+
snippet: i.slice(t, n)
|
|
2167
|
+
};
|
|
2168
|
+
continue;
|
|
2169
|
+
} else {
|
|
2170
|
+
r++;
|
|
2171
|
+
const o = K(i, n + 1, !1);
|
|
2172
|
+
if (!o)
|
|
2173
|
+
return null;
|
|
2174
|
+
if (n = o.position, o.selfClosing && (r--, r === 0))
|
|
2175
|
+
return {
|
|
2176
|
+
start: t,
|
|
2177
|
+
end: n,
|
|
2178
|
+
snippet: i.slice(t, n)
|
|
2179
|
+
};
|
|
2180
|
+
continue;
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
n++;
|
|
2184
|
+
}
|
|
2185
|
+
return null;
|
|
2186
|
+
}, oe = (i) => {
|
|
2187
|
+
const t = [], e = i.length;
|
|
2188
|
+
let n = 0;
|
|
2189
|
+
for (; n < e; ) {
|
|
2190
|
+
const r = i[n];
|
|
2191
|
+
if (r === "'" || r === '"') {
|
|
2192
|
+
n = $(i, n, r);
|
|
2193
|
+
continue;
|
|
2194
|
+
}
|
|
2195
|
+
if (r === "`") {
|
|
2196
|
+
n = rt(i, n);
|
|
2197
|
+
continue;
|
|
2198
|
+
}
|
|
2199
|
+
if (r === "/" && i[n + 1] === "*") {
|
|
2200
|
+
n = b(i, n + 2);
|
|
2201
|
+
continue;
|
|
2202
|
+
}
|
|
2203
|
+
if (r === "/" && i[n + 1] === "/") {
|
|
2204
|
+
n = O(i, n + 2);
|
|
2205
|
+
continue;
|
|
2206
|
+
}
|
|
2207
|
+
if (r === "<" && ie(i, n)) {
|
|
2208
|
+
const s = se(i, n);
|
|
2209
|
+
if (s) {
|
|
2210
|
+
t.push(s), n = s.end;
|
|
2211
|
+
continue;
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
n++;
|
|
2215
|
+
}
|
|
2216
|
+
return t;
|
|
2217
|
+
}, me = (i, t = {}) => {
|
|
2218
|
+
const e = oe(i);
|
|
2219
|
+
if (e.length === 0)
|
|
2220
|
+
return {
|
|
2221
|
+
code: i,
|
|
2222
|
+
map: null,
|
|
2223
|
+
transformed: !1,
|
|
2224
|
+
errors: [],
|
|
2225
|
+
matches: []
|
|
2226
|
+
};
|
|
2227
|
+
const n = new P(i), r = [];
|
|
2228
|
+
let s = !1;
|
|
2229
|
+
for (const h of e) {
|
|
2230
|
+
const a = Wt(h.snippet, t.compileOptions);
|
|
2231
|
+
if (a.errors.length > 0 || !a.code) {
|
|
2232
|
+
for (const u of a.errors)
|
|
2233
|
+
r.push({ match: h, error: u });
|
|
2234
|
+
continue;
|
|
2235
|
+
}
|
|
2236
|
+
n.overwrite(h.start, h.end, a.code), s = !0;
|
|
2237
|
+
}
|
|
2238
|
+
if (!s)
|
|
2239
|
+
return {
|
|
2240
|
+
code: i,
|
|
2241
|
+
map: null,
|
|
2242
|
+
transformed: !1,
|
|
2243
|
+
errors: r,
|
|
2244
|
+
matches: e
|
|
2245
|
+
};
|
|
2246
|
+
const o = n.toString();
|
|
2247
|
+
let l = null;
|
|
2248
|
+
if (t.generateSourceMap) {
|
|
2249
|
+
const h = t.source ? { source: t.source, hires: !0 } : { hires: !0 };
|
|
2250
|
+
l = n.generateMap(h);
|
|
2251
|
+
}
|
|
2252
|
+
return {
|
|
2253
|
+
code: o,
|
|
2254
|
+
map: l,
|
|
2255
|
+
transformed: !0,
|
|
2256
|
+
errors: r,
|
|
2257
|
+
matches: e
|
|
2258
|
+
};
|
|
2259
|
+
};
|
|
2260
|
+
export {
|
|
2261
|
+
at as Lexer,
|
|
2262
|
+
f as NodeType,
|
|
2263
|
+
Tt as Parser,
|
|
2264
|
+
c as TokenType,
|
|
2265
|
+
Wt as compile,
|
|
2266
|
+
V as countNodes,
|
|
2267
|
+
A as createAttributeNode,
|
|
2268
|
+
pt as createCommentNode,
|
|
2269
|
+
Et as createDirectiveElseIfNode,
|
|
2270
|
+
mt as createDirectiveElseNode,
|
|
2271
|
+
Ct as createDirectiveForNode,
|
|
2272
|
+
gt as createDirectiveIfNode,
|
|
2273
|
+
x as createElementNode,
|
|
2274
|
+
ft as createFragmentNode,
|
|
2275
|
+
dt as createInterpolationNode,
|
|
2276
|
+
ct as createPosition,
|
|
2277
|
+
ut as createRootNode,
|
|
2278
|
+
Z as createTextNode,
|
|
2279
|
+
p as createToken,
|
|
2280
|
+
Ee as formatCode,
|
|
2281
|
+
tt as generate,
|
|
2282
|
+
vt as getConditionalGroup,
|
|
2283
|
+
X as getDirective,
|
|
2284
|
+
pe as hasDirective,
|
|
2285
|
+
fe as isCommentNode,
|
|
2286
|
+
de as isDirective,
|
|
2287
|
+
le as isElementNode,
|
|
2288
|
+
ce as isFragmentNode,
|
|
2289
|
+
ue as isInterpolationNode,
|
|
2290
|
+
ae as isTextNode,
|
|
2291
|
+
ge as isWhitespaceOnly,
|
|
2292
|
+
It as optimize,
|
|
2293
|
+
J as parse,
|
|
2294
|
+
oe as scanTemplates,
|
|
2295
|
+
Y as tokenize,
|
|
2296
|
+
q as transform,
|
|
2297
|
+
wt as transformDirectives,
|
|
2298
|
+
me as transformDocument,
|
|
2299
|
+
L as transformTree,
|
|
2300
|
+
M as walk
|
|
2301
|
+
};
|
|
2302
|
+
//# sourceMappingURL=index.mjs.map
|