@xaendar/compiler 0.3.31 → 0.3.34

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.
@@ -1,36 +1,36 @@
1
- import { Stack as e } from "@xaendar/common";
2
- import t from "typescript";
1
+ import { Stack as e, indent as t } from "@xaendar/common";
2
+ import n from "typescript";
3
3
  //#region ../packages/compiler/src/lexer/types/lexer-state.enum.ts
4
- var n = /* @__PURE__ */ function(e) {
4
+ var r = /* @__PURE__ */ function(e) {
5
5
  return e.START = "start", e.TEXT = "text", e.TAG_OPEN_NAME = "tag-open-name", e.TAG_BODY = "tag-body", e.TAG_OPEN_END = "tag-open-end", e.TAG_CLOSE = "tag-close", e.ATTRIBUTE = "attribute", e.EVENT = "event", e.FLOW_CONTROL = "flow-control", e.FLOW_CONTROL_CONDITION = "flow-control-condition", e.CASE_FLOW_CONTROL_CONDITION = "case-flow-control-condition", e.FLOW_CONTROL_BLOCK = "flow-control-block", e.INTERPOLATION = "interpolation", e.INTERPOLATION_EXPRESSION = "interpolation-expression", e.INTERPOLATION_LITERAL = "interpolation-literal", e.CONST_DECLARATION = "const-declaration", e;
6
- }({}), r = /* @__PURE__ */ function(e) {
6
+ }({}), i = /* @__PURE__ */ function(e) {
7
7
  return e[e.TEXT = 0] = "TEXT", e[e.TAG_OPEN_NAME = 1] = "TAG_OPEN_NAME", e[e.TAG_SELF_CLOSE = 2] = "TAG_SELF_CLOSE", e[e.TAG_OPEN_END = 3] = "TAG_OPEN_END", e[e.TAG_CLOSE_NAME = 4] = "TAG_CLOSE_NAME", e[e.ATTRIBUTE = 5] = "ATTRIBUTE", e[e.EVENT = 6] = "EVENT", e[e.INTERPOLATION_LITERAL = 7] = "INTERPOLATION_LITERAL", e[e.INTERPOLATION_EXPRESSION = 8] = "INTERPOLATION_EXPRESSION", e[e.CONST_DECLARATION = 9] = "CONST_DECLARATION", e[e.IF = 10] = "IF", e[e.FOR = 11] = "FOR", e[e.ELSE = 12] = "ELSE", e[e.ELSE_IF = 13] = "ELSE_IF", e[e.SWITCH = 14] = "SWITCH", e[e.CASE = 15] = "CASE", e[e.DEFAULT = 16] = "DEFAULT", e[e.CONDITION = 17] = "CONDITION", e[e.BLOCK_OPEN = 18] = "BLOCK_OPEN", e[e.BLOCK_CLOSE = 19] = "BLOCK_CLOSE", e[e.EOF = 20] = "EOF", e;
8
8
  }({});
9
9
  //#endregion
10
10
  //#region ../packages/compiler/src/lexer/states/attribute.state.ts
11
- function i(e, t) {
12
- let i = !0, a = "", o;
13
- for (; i;) switch (e.peek()) {
11
+ function a(e, t) {
12
+ let n = !0, a = "", o;
13
+ for (; n;) switch (e.peek()) {
14
14
  case 32:
15
15
  case 47:
16
16
  case 62:
17
17
  o = {
18
- state: n.TAG_BODY,
18
+ state: r.TAG_BODY,
19
19
  tokens: [{
20
- type: r.ATTRIBUTE,
20
+ type: i.ATTRIBUTE,
21
21
  parts: [a]
22
22
  }]
23
- }, i = !1;
23
+ }, n = !1;
24
24
  break;
25
25
  case 123:
26
26
  o = {
27
- state: n.INTERPOLATION,
27
+ state: r.INTERPOLATION,
28
28
  tokens: [{
29
- type: r.ATTRIBUTE,
29
+ type: i.ATTRIBUTE,
30
30
  parts: [a]
31
31
  }],
32
32
  pushState: !0
33
- }, i = !1;
33
+ }, n = !1;
34
34
  break;
35
35
  default: e.advance(), a = `${a}${e.currentChar.value}`;
36
36
  }
@@ -38,63 +38,63 @@ function i(e, t) {
38
38
  }
39
39
  //#endregion
40
40
  //#region ../packages/compiler/src/lexer/utils/consume-flow-control-condition.utils.ts
41
- function a(e, t) {
41
+ function o(e, t) {
42
42
  if (e.skipSpaces(), e.peek() !== 40) throw Error(`Expected '(' but got '${String.fromCharCode(e.peek())}' at row ${e.position.row}, col ${e.position.column}`);
43
43
  e.advance();
44
44
  let n = "", r = 1;
45
45
  for (; r > 0;) switch (e.peek()) {
46
46
  case 40:
47
- r++, n = o(e, n);
47
+ r++, n = s(e, n);
48
48
  break;
49
49
  case 41:
50
50
  if (r--, !r) {
51
51
  e.advance();
52
52
  break;
53
53
  }
54
- n = o(e, n);
54
+ n = s(e, n);
55
55
  break;
56
- default: n = o(e, n);
56
+ default: n = s(e, n);
57
57
  }
58
58
  return n;
59
59
  }
60
- function o(e, t) {
60
+ function s(e, t) {
61
61
  return e.advance(), `${t}${e.currentChar.value}`;
62
62
  }
63
63
  //#endregion
64
64
  //#region ../packages/compiler/src/lexer/states/case-flow-control-condition.state.ts
65
- function s(e, t) {
66
- let i = a(e, t);
65
+ function c(e, t) {
66
+ let n = o(e, t);
67
67
  return e.skipSpaces(), {
68
- state: e.peekMatch("@case") ? n.FLOW_CONTROL : n.FLOW_CONTROL_BLOCK,
68
+ state: e.peekMatch("@case") ? r.FLOW_CONTROL : r.FLOW_CONTROL_BLOCK,
69
69
  tokens: [{
70
- type: r.CONDITION,
71
- parts: [i]
70
+ type: i.CONDITION,
71
+ parts: [n]
72
72
  }],
73
73
  popState: !0
74
74
  };
75
75
  }
76
76
  //#endregion
77
77
  //#region ../packages/compiler/src/lexer/states/const-declaration.ts
78
- function c(e, t) {
79
- let i = !0, a = "", o = "", s;
80
- for (e.skipSpaces(); i;) switch (e.peek()) {
78
+ function l(e, t) {
79
+ let n = !0, a = "", o = "", s;
80
+ for (e.skipSpaces(); n;) switch (e.peek()) {
81
81
  case 32:
82
- i = !1;
82
+ n = !1;
83
83
  break;
84
84
  default: e.advance(), a = `${a}${e.currentChar.value}`;
85
85
  }
86
86
  e.skipSpaces();
87
87
  let c = e.peek();
88
88
  if (c !== 61) throw Error(`Unexpected character ${String.fromCharCode(c)}.\nExpected '=' `);
89
- for (e.advance(), e.skipSpaces(), i = !0; i;) switch (e.peek()) {
89
+ for (e.advance(), e.skipSpaces(), n = !0; n;) switch (e.peek()) {
90
90
  case 59:
91
91
  s = {
92
- state: n.TEXT,
92
+ state: r.TEXT,
93
93
  tokens: [{
94
- type: r.CONST_DECLARATION,
94
+ type: i.CONST_DECLARATION,
95
95
  parts: [a, o]
96
96
  }]
97
- }, i = !1;
97
+ }, n = !1;
98
98
  break;
99
99
  default: e.advance(), o = `${o}${e.currentChar.value}`;
100
100
  }
@@ -102,19 +102,19 @@ function c(e, t) {
102
102
  }
103
103
  //#endregion
104
104
  //#region ../packages/compiler/src/lexer/states/event.state.ts
105
- function l(e, t) {
106
- let i = !0, a = "", o;
107
- for (e.advance(); i;) switch (e.peek()) {
105
+ function u(e, t) {
106
+ let n = !0, a = "", o;
107
+ for (e.advance(); n;) switch (e.peek()) {
108
108
  case 32:
109
109
  case 47:
110
110
  case 62:
111
111
  a.includes("=") || (a = `${a}=on${a[0].toUpperCase()}${a.slice(1)}($event)`), o = {
112
- state: n.TAG_BODY,
112
+ state: r.TAG_BODY,
113
113
  tokens: [{
114
- type: r.EVENT,
114
+ type: i.EVENT,
115
115
  parts: [a]
116
116
  }]
117
- }, i = !1;
117
+ }, n = !1;
118
118
  break;
119
119
  default: e.advance(), a = `${a}${e.currentChar.value}`;
120
120
  }
@@ -122,117 +122,117 @@ function l(e, t) {
122
122
  }
123
123
  //#endregion
124
124
  //#region ../packages/compiler/src/lexer/states/flow-control-block.state.ts
125
- function u(e, t) {
125
+ function d(e, t) {
126
126
  if (e.skipSpaces(), e.peek() !== 123) throw Error(`Expected '{' but got '${String.fromCharCode(e.peek())}' at row ${e.position.row}, col ${e.position.column}`);
127
127
  return e.advance(), {
128
- state: n.TEXT,
129
- tokens: [{ type: r.BLOCK_OPEN }],
128
+ state: r.TEXT,
129
+ tokens: [{ type: i.BLOCK_OPEN }],
130
130
  pushState: !0
131
131
  };
132
132
  }
133
133
  //#endregion
134
134
  //#region ../packages/compiler/src/lexer/states/default-flow-control-condition.state.ts
135
- function d(e, t) {
135
+ function f(e, t) {
136
136
  return {
137
- state: n.FLOW_CONTROL_BLOCK,
137
+ state: r.FLOW_CONTROL_BLOCK,
138
138
  tokens: [{
139
- type: r.CONDITION,
140
- parts: [a(e, t)]
139
+ type: i.CONDITION,
140
+ parts: [o(e, t)]
141
141
  }],
142
142
  popState: !0
143
143
  };
144
144
  }
145
145
  //#endregion
146
146
  //#region ../packages/compiler/src/lexer/states/flow-control.ts
147
- function f(e, t) {
148
- let i;
149
- return e.advance(), e.peekMatch("for ") ? (e.advance(4), i = {
150
- state: n.FLOW_CONTROL_CONDITION,
151
- tokens: [{ type: r.FOR }],
147
+ function p(e, t) {
148
+ let n;
149
+ return e.advance(), e.peekMatch("for ") ? (e.advance(4), n = {
150
+ state: r.FLOW_CONTROL_CONDITION,
151
+ tokens: [{ type: i.FOR }],
152
152
  pushState: !0
153
- }) : e.peekMatch("if ") ? (e.advance(2), i = {
154
- state: n.FLOW_CONTROL_CONDITION,
155
- tokens: [{ type: r.IF }],
153
+ }) : e.peekMatch("if ") ? (e.advance(2), n = {
154
+ state: r.FLOW_CONTROL_CONDITION,
155
+ tokens: [{ type: i.IF }],
156
156
  pushState: !0
157
- }) : e.peekMatch("else if ") ? (e.advance(8), i = {
158
- state: n.FLOW_CONTROL_CONDITION,
159
- tokens: [{ type: r.ELSE_IF }],
157
+ }) : e.peekMatch("else if ") ? (e.advance(8), n = {
158
+ state: r.FLOW_CONTROL_CONDITION,
159
+ tokens: [{ type: i.ELSE_IF }],
160
160
  pushState: !0
161
- }) : e.peekMatch("else ") ? (e.advance(5), i = {
162
- state: n.FLOW_CONTROL_BLOCK,
163
- tokens: [{ type: r.ELSE }]
164
- }) : e.peekMatch("switch ") ? (e.advance(7), i = {
165
- state: n.FLOW_CONTROL_CONDITION,
166
- tokens: [{ type: r.SWITCH }],
161
+ }) : e.peekMatch("else ") ? (e.advance(5), n = {
162
+ state: r.FLOW_CONTROL_BLOCK,
163
+ tokens: [{ type: i.ELSE }]
164
+ }) : e.peekMatch("switch ") ? (e.advance(7), n = {
165
+ state: r.FLOW_CONTROL_CONDITION,
166
+ tokens: [{ type: i.SWITCH }],
167
167
  pushState: !0
168
- }) : e.peekMatch("case ") ? (e.advance(5), i = {
169
- state: n.CASE_FLOW_CONTROL_CONDITION,
170
- tokens: [{ type: r.CASE }],
168
+ }) : e.peekMatch("case ") ? (e.advance(5), n = {
169
+ state: r.CASE_FLOW_CONTROL_CONDITION,
170
+ tokens: [{ type: i.CASE }],
171
171
  pushState: !0
172
- }) : e.peekMatch("default ") ? (e.advance(8), i = {
173
- state: n.FLOW_CONTROL_BLOCK,
174
- tokens: [{ type: r.DEFAULT }]
175
- }) : e.peekMatch("const ") && (e.advance(6), i = { state: n.CONST_DECLARATION }), i;
172
+ }) : e.peekMatch("default ") ? (e.advance(8), n = {
173
+ state: r.FLOW_CONTROL_BLOCK,
174
+ tokens: [{ type: i.DEFAULT }]
175
+ }) : e.peekMatch("const ") && (e.advance(6), n = { state: r.CONST_DECLARATION }), n;
176
176
  }
177
177
  //#endregion
178
178
  //#region ../packages/compiler/src/lexer/states/interpolation-expression.state.ts
179
- function p(e, t) {
180
- let i = !0, a = "", o = 1, s;
181
- for (; i;) switch (e.peek()) {
179
+ function m(e, t) {
180
+ let n = !0, a = "", o = 1, s;
181
+ for (; n;) switch (e.peek()) {
182
182
  case 123:
183
- o++, a = m(e, a);
183
+ o++, a = h(e, a);
184
184
  break;
185
185
  case 125:
186
186
  if (o--, o === 0) {
187
187
  e.advance();
188
188
  let o = t.history.pop(), c;
189
189
  switch (o) {
190
- case n.ATTRIBUTE:
190
+ case r.ATTRIBUTE:
191
191
  let e = t.tokens[t.tokens.length - 1];
192
- e?.type === r.ATTRIBUTE && !e.parts[0] && (e.parts[0] = `${a}=`), c = n.TAG_BODY;
192
+ e?.type === i.ATTRIBUTE && !e.parts[0] && (e.parts[0] = `${a}=`), c = r.TAG_BODY;
193
193
  break;
194
- case n.TEXT: c = n.TEXT;
194
+ case r.TEXT: c = r.TEXT;
195
195
  }
196
196
  s = {
197
197
  state: c,
198
198
  tokens: [{
199
- type: r.INTERPOLATION_EXPRESSION,
199
+ type: i.INTERPOLATION_EXPRESSION,
200
200
  parts: [a]
201
201
  }],
202
202
  popState: !0
203
- }, i = !1;
204
- } else a = m(e, a);
203
+ }, n = !1;
204
+ } else a = h(e, a);
205
205
  break;
206
- default: a = m(e, a);
206
+ default: a = h(e, a);
207
207
  }
208
208
  return s;
209
209
  }
210
- function m(e, t) {
210
+ function h(e, t) {
211
211
  return e.advance(1), `${t}${e.currentChar.value}`;
212
212
  }
213
213
  //#endregion
214
214
  //#region ../packages/compiler/src/lexer/states/interpolation-literal.state.ts
215
- function h(e, t) {
216
- let i = !0, a = "`", o;
217
- for (e.advance(); i;) switch (e.peek()) {
215
+ function ee(e, t) {
216
+ let n = !0, a = "`", o;
217
+ for (e.advance(); n;) switch (e.peek()) {
218
218
  case 96:
219
219
  if (a = g(e, a), e.peek() === 125) {
220
220
  e.advance();
221
221
  let s = t.history.pop(), c;
222
222
  switch (s) {
223
- case n.ATTRIBUTE:
224
- c = n.TAG_BODY;
223
+ case r.ATTRIBUTE:
224
+ c = r.TAG_BODY;
225
225
  break;
226
- case n.TEXT: c = n.TEXT;
226
+ case r.TEXT: c = r.TEXT;
227
227
  }
228
228
  o = {
229
229
  state: c,
230
230
  tokens: [{
231
- type: r.INTERPOLATION_LITERAL,
231
+ type: i.INTERPOLATION_LITERAL,
232
232
  parts: [a]
233
233
  }],
234
234
  popState: !0
235
- }, i = !1;
235
+ }, n = !1;
236
236
  } else a = `${a}${e.currentChar.value}`;
237
237
  break;
238
238
  default: a = g(e, a);
@@ -244,55 +244,55 @@ function g(e, t) {
244
244
  }
245
245
  //#endregion
246
246
  //#region ../packages/compiler/src/utils/chars.utils.ts
247
- function _(e) {
247
+ function te(e) {
248
248
  return /\S/.test(e);
249
249
  }
250
- function v(e) {
250
+ function ne(e) {
251
251
  return e >= 65 && e <= 90 || e >= 97 && e <= 122 || e === 36 || e === 95;
252
252
  }
253
253
  //#endregion
254
254
  //#region ../packages/compiler/src/lexer/states/interpolation.state.ts
255
- function y(e, t) {
256
- let r;
255
+ function _(e, t) {
256
+ let n;
257
257
  e.advance(), e.skipSpaces();
258
258
  let i = e.peek();
259
- if (i === 96) r = { state: n.INTERPOLATION_LITERAL };
260
- else if (v(i)) r = { state: n.INTERPOLATION_EXPRESSION };
259
+ if (i === 96) n = { state: r.INTERPOLATION_LITERAL };
260
+ else if (ne(i)) n = { state: r.INTERPOLATION_EXPRESSION };
261
261
  else throw Error(`Unrecognized First Character ${String.fromCharCode(i)} in interpolation`);
262
- return r;
262
+ return n;
263
263
  }
264
264
  //#endregion
265
265
  //#region ../packages/compiler/src/lexer/states/tag-body.state.ts
266
- function b(e, t) {
267
- let r = !0, i;
268
- for (; r;) switch (e.peek()) {
266
+ function v(e, t) {
267
+ let n = !0, i;
268
+ for (; n;) switch (e.peek()) {
269
269
  case 64:
270
- i = { state: n.EVENT }, r = !1;
270
+ i = { state: r.EVENT }, n = !1;
271
271
  break;
272
272
  case 32:
273
273
  e.skipSpaces();
274
274
  break;
275
275
  case 62:
276
276
  case 47:
277
- i = { state: n.TAG_OPEN_END }, r = !1;
277
+ i = { state: r.TAG_OPEN_END }, n = !1;
278
278
  break;
279
- default: i = { state: n.ATTRIBUTE }, r = !1;
279
+ default: i = { state: r.ATTRIBUTE }, n = !1;
280
280
  }
281
281
  return i;
282
282
  }
283
283
  //#endregion
284
284
  //#region ../packages/compiler/src/lexer/states/tag-close.state.ts
285
- function ee(e, t) {
286
- let i = !0, a = "", o;
287
- for (e.advance(2), e.skipSpaces(); i;) switch (e.peek()) {
285
+ function y(e, t) {
286
+ let n = !0, a = "", o;
287
+ for (e.advance(2), e.skipSpaces(); n;) switch (e.peek()) {
288
288
  case 62:
289
289
  e.advance(), o = {
290
- state: n.TEXT,
290
+ state: r.TEXT,
291
291
  tokens: [{
292
- type: r.TAG_CLOSE_NAME,
292
+ type: i.TAG_CLOSE_NAME,
293
293
  parts: [a]
294
294
  }]
295
- }, i = !1;
295
+ }, n = !1;
296
296
  break;
297
297
  case 32: throw Error("Tag Close Name cannot contains spaces");
298
298
  default: e.advance(), a = `${a}${e.currentChar.value}`;
@@ -301,44 +301,44 @@ function ee(e, t) {
301
301
  }
302
302
  //#endregion
303
303
  //#region ../packages/compiler/src/lexer/states/tag-open-end.state.ts
304
- function te(e, t) {
305
- let i;
306
- if (e.peek() === 62) e.advance(), i = {
307
- state: n.TEXT,
304
+ function b(e, t) {
305
+ let n;
306
+ if (e.peek() === 62) e.advance(), n = {
307
+ state: r.TEXT,
308
308
  tokens: [{
309
- type: r.TAG_OPEN_END,
309
+ type: i.TAG_OPEN_END,
310
310
  parts: []
311
311
  }]
312
312
  };
313
313
  else {
314
314
  e.advance();
315
315
  let t = e.peek();
316
- if (t === 62) e.advance(), i = {
317
- state: n.TEXT,
316
+ if (t === 62) e.advance(), n = {
317
+ state: r.TEXT,
318
318
  tokens: [{
319
- type: r.TAG_SELF_CLOSE,
319
+ type: i.TAG_SELF_CLOSE,
320
320
  parts: []
321
321
  }]
322
322
  };
323
323
  else throw Error(`Unexpected character ${t} for closing tag.\nExpected />\nRead of /${String.fromCharCode(t)}\nAt line ${e.position.row + 1} col ${e.position.column + 1}`);
324
324
  }
325
- return i;
325
+ return n;
326
326
  }
327
327
  //#endregion
328
328
  //#region ../packages/compiler/src/lexer/states/tag-open-name.state.ts
329
- function ne(e, t) {
330
- let i = !0, a = "", o;
331
- for (e.advance(), e.skipSpaces(); i;) switch (e.peek()) {
329
+ function x(e, t) {
330
+ let n = !0, a = "", o;
331
+ for (e.advance(), e.skipSpaces(); n;) switch (e.peek()) {
332
332
  case 32:
333
333
  case 47:
334
334
  case 62:
335
335
  o = {
336
- state: n.TAG_BODY,
336
+ state: r.TAG_BODY,
337
337
  tokens: [{
338
- type: r.TAG_OPEN_NAME,
338
+ type: i.TAG_OPEN_NAME,
339
339
  parts: [a]
340
340
  }]
341
- }, i = !1;
341
+ }, n = !1;
342
342
  break;
343
343
  default: e.advance(), a = `${a}${e.currentChar.value}`;
344
344
  }
@@ -346,27 +346,27 @@ function ne(e, t) {
346
346
  }
347
347
  //#endregion
348
348
  //#region ../packages/compiler/src/lexer/states/text.state.ts
349
- function x(e, t) {
350
- let i = !0, a = "", o;
351
- for (; i;) switch (e.peek()) {
349
+ function S(e, t) {
350
+ let n = !0, a = "", o;
351
+ for (; n;) switch (e.peek()) {
352
352
  case 60:
353
- o = { state: e.peek(1, { offset: 1 }) === 47 ? n.TAG_CLOSE : n.TAG_OPEN_NAME }, i = !1;
353
+ o = { state: e.peek(1, { offset: 1 }) === 47 ? r.TAG_CLOSE : r.TAG_OPEN_NAME }, n = !1;
354
354
  break;
355
355
  case 123:
356
356
  o = {
357
- state: n.INTERPOLATION,
357
+ state: r.INTERPOLATION,
358
358
  pushState: !0
359
- }, i = !1;
359
+ }, n = !1;
360
360
  break;
361
361
  case 64:
362
- o = { state: n.FLOW_CONTROL }, i = !1;
362
+ o = { state: r.FLOW_CONTROL }, n = !1;
363
363
  break;
364
364
  case 125:
365
- t.history[t.history.length - 1] === n.FLOW_CONTROL_BLOCK ? (e.advance(), o = {
366
- state: n.TEXT,
367
- tokens: [{ type: r.BLOCK_CLOSE }],
365
+ t.history[t.history.length - 1] === r.FLOW_CONTROL_BLOCK ? (e.advance(), o = {
366
+ state: r.TEXT,
367
+ tokens: [{ type: i.BLOCK_CLOSE }],
368
368
  popState: !0
369
- }, i = !1) : (e.advance(), a = `${a}${e.currentChar.value}`);
369
+ }, n = !1) : (e.advance(), a = `${a}${e.currentChar.value}`);
370
370
  break;
371
371
  case 10:
372
372
  case 13:
@@ -374,8 +374,8 @@ function x(e, t) {
374
374
  break;
375
375
  default: e.advance(), a = `${a}${e.currentChar.value}`;
376
376
  }
377
- return o.tokens ??= _(a) ? [{
378
- type: r.TEXT,
377
+ return o.tokens ??= te(a) ? [{
378
+ type: i.TEXT,
379
379
  parts: [a]
380
380
  }] : void 0, o;
381
381
  }
@@ -440,26 +440,26 @@ var re = class {
440
440
  }, ie = class {
441
441
  input;
442
442
  _cursor;
443
- _state = n.START;
443
+ _state = r.START;
444
444
  _stack = new e();
445
445
  _tokens = [];
446
446
  _states = {
447
- [n.START]: x,
448
- [n.TEXT]: x,
449
- [n.TAG_OPEN_NAME]: ne,
450
- [n.TAG_BODY]: b,
451
- [n.TAG_OPEN_END]: te,
452
- [n.TAG_CLOSE]: ee,
453
- [n.ATTRIBUTE]: i,
454
- [n.FLOW_CONTROL]: f,
455
- [n.FLOW_CONTROL_CONDITION]: d,
456
- [n.CASE_FLOW_CONTROL_CONDITION]: s,
457
- [n.FLOW_CONTROL_BLOCK]: u,
458
- [n.EVENT]: l,
459
- [n.INTERPOLATION]: y,
460
- [n.INTERPOLATION_EXPRESSION]: p,
461
- [n.INTERPOLATION_LITERAL]: h,
462
- [n.CONST_DECLARATION]: c
447
+ [r.START]: S,
448
+ [r.TEXT]: S,
449
+ [r.TAG_OPEN_NAME]: x,
450
+ [r.TAG_BODY]: v,
451
+ [r.TAG_OPEN_END]: b,
452
+ [r.TAG_CLOSE]: y,
453
+ [r.ATTRIBUTE]: a,
454
+ [r.FLOW_CONTROL]: p,
455
+ [r.FLOW_CONTROL_CONDITION]: f,
456
+ [r.CASE_FLOW_CONTROL_CONDITION]: c,
457
+ [r.FLOW_CONTROL_BLOCK]: d,
458
+ [r.EVENT]: u,
459
+ [r.INTERPOLATION]: _,
460
+ [r.INTERPOLATION_EXPRESSION]: m,
461
+ [r.INTERPOLATION_LITERAL]: ee,
462
+ [r.CONST_DECLARATION]: l
463
463
  };
464
464
  constructor(e) {
465
465
  this.input = e, this._cursor = new re(this.input);
@@ -481,7 +481,7 @@ var re = class {
481
481
  }, ae = class {
482
482
  _tokens;
483
483
  _currentToken = {
484
- value: { type: r.EOF },
484
+ value: { type: i.EOF },
485
485
  index: -1
486
486
  };
487
487
  get currentToken() {
@@ -493,7 +493,7 @@ var re = class {
493
493
  advance(e = 1) {
494
494
  if (e < 1) throw Error(`${e} is not a valid value. Please enter a number equal or greater than 1`);
495
495
  let t = this._currentToken.index + e;
496
- t >= this._tokens.length ? (this._currentToken.value = { type: r.EOF }, this._currentToken.index = -1) : (this._currentToken.index = t, this._currentToken.value = this._tokens[t]);
496
+ t >= this._tokens.length ? (this._currentToken.value = { type: i.EOF }, this._currentToken.index = -1) : (this._currentToken.index = t, this._currentToken.value = this._tokens[t]);
497
497
  }
498
498
  peek(e, t) {
499
499
  let n = typeof e == "number" ? e : 1, r = (typeof e == "object" ? e : t)?.offset ?? 0;
@@ -505,45 +505,45 @@ var re = class {
505
505
  return t;
506
506
  }
507
507
  peekOneToken(e) {
508
- return e < this._tokens.length ? this._tokens[e] : { type: r.EOF };
508
+ return e < this._tokens.length ? this._tokens[e] : { type: i.EOF };
509
509
  }
510
- }, S = /* @__PURE__ */ function(e) {
510
+ }, C = /* @__PURE__ */ function(e) {
511
511
  return e[e.Element = 0] = "Element", e[e.Text = 1] = "Text", e[e.Interpolation = 2] = "Interpolation", e[e.If = 3] = "If", e[e.Else = 4] = "Else", e[e.ElseIf = 5] = "ElseIf", e[e.For = 6] = "For", e[e.Switch = 7] = "Switch", e[e.Case = 8] = "Case", e[e.ConstDeclaration = 9] = "ConstDeclaration", e;
512
512
  }({});
513
513
  //#endregion
514
514
  //#region ../packages/compiler/src/parser/states/parse-const-declaration.state.ts
515
515
  function oe(e, t, n) {
516
516
  return e.advance(), {
517
- type: S.ConstDeclaration,
517
+ type: C.ConstDeclaration,
518
518
  varName: n.parts[0],
519
519
  expression: n.parts[1]
520
520
  };
521
521
  }
522
522
  //#endregion
523
523
  //#region ../packages/compiler/src/parser/states/parse-interpolation.state.ts
524
- function C(e, t, n) {
524
+ function w(e, t, n) {
525
525
  return e.advance(), {
526
- type: S.Interpolation,
526
+ type: C.Interpolation,
527
527
  expression: n.parts[0]
528
528
  };
529
529
  }
530
530
  //#endregion
531
531
  //#region ../packages/compiler/src/parser/states/parse-attribute.state.ts
532
- function w(e, t, n) {
532
+ function se(e, t, n) {
533
533
  e.advance();
534
- let i = n.parts[0];
535
- if (!i.includes("=")) return {
536
- name: i,
534
+ let r = n.parts[0];
535
+ if (!r.includes("=")) return {
536
+ name: r,
537
537
  value: "true"
538
538
  };
539
- let [a, o] = i.split("=");
540
- if (!a) throw Error(`[Parser] Attribute name missing in: ${i}`);
539
+ let [a, o] = r.split("=");
540
+ if (!a) throw Error(`[Parser] Attribute name missing in: ${r}`);
541
541
  let s = e.peek();
542
- if (s.type === r.INTERPOLATION_EXPRESSION || s.type === r.INTERPOLATION_LITERAL) return {
542
+ if (s.type === i.INTERPOLATION_EXPRESSION || s.type === i.INTERPOLATION_LITERAL) return {
543
543
  name: a,
544
- value: C(e, t, s)
544
+ value: w(e, t, s)
545
545
  };
546
- if (!o) throw Error(`[Parser] Attribute value missing for ${a} in: ${i}`);
546
+ if (!o) throw Error(`[Parser] Attribute value missing for ${a} in: ${r}`);
547
547
  return {
548
548
  name: a,
549
549
  value: o.replace(/^['']|['']$/g, "")
@@ -551,7 +551,7 @@ function w(e, t, n) {
551
551
  }
552
552
  //#endregion
553
553
  //#region ../packages/compiler/src/parser/states/parse-event.state.ts
554
- function se(e, t, n) {
554
+ function ce(e, t, n) {
555
555
  e.advance();
556
556
  let r = n.parts[0], [i, a] = r.split("=");
557
557
  if (!i || !a) throw Error(`[Parser] Invalid event format: ${r}`);
@@ -562,137 +562,137 @@ function se(e, t, n) {
562
562
  }
563
563
  //#endregion
564
564
  //#region ../packages/compiler/src/parser/states/parse-element.state.ts
565
- function ce(e, t, n) {
565
+ function le(e, t, n) {
566
566
  e.advance();
567
- let i = n.parts[0], a = [], o = [], s = !0;
567
+ let r = n.parts[0], a = [], o = [], s = !0;
568
568
  for (; s;) {
569
569
  let n = e.peek();
570
570
  switch (n.type) {
571
- case r.ATTRIBUTE:
572
- a.push(w(e, t, n));
571
+ case i.ATTRIBUTE:
572
+ a.push(se(e, t, n));
573
573
  break;
574
- case r.EVENT:
575
- o.push(se(e, t, n));
574
+ case i.EVENT:
575
+ o.push(ce(e, t, n));
576
576
  break;
577
577
  default: s = !1;
578
578
  }
579
579
  }
580
- if (e.peek().type === r.TAG_OPEN_END && e.advance(), e.peek().type === r.TAG_SELF_CLOSE) return e.advance(), {
581
- type: S.Element,
582
- tagName: i,
580
+ if (e.peek().type === i.TAG_OPEN_END && e.advance(), e.peek().type === i.TAG_SELF_CLOSE) return e.advance(), {
581
+ type: C.Element,
582
+ tagName: r,
583
583
  attributes: a,
584
584
  events: o,
585
585
  children: []
586
586
  };
587
587
  let c = [];
588
- for (; !le(e, i);) {
588
+ for (; !ue(e, r);) {
589
589
  let e = t();
590
590
  e && c.push(e);
591
591
  }
592
592
  return e.advance(), {
593
- type: S.Element,
594
- tagName: i,
593
+ type: C.Element,
594
+ tagName: r,
595
595
  attributes: a,
596
596
  events: o,
597
597
  children: c
598
598
  };
599
599
  }
600
- function le(e, t) {
600
+ function ue(e, t) {
601
601
  let n = e.peek();
602
- return n.type === r.TAG_CLOSE_NAME && n.parts[0] === t;
602
+ return n.type === i.TAG_CLOSE_NAME && n.parts[0] === t;
603
603
  }
604
604
  //#endregion
605
605
  //#region ../packages/compiler/src/parser/utils/expression-validator.ts
606
606
  function T(e) {
607
- let n = t.createSourceFile("expression.ts", `const x = ${e}`, t.ScriptTarget.ESNext, !0).statements[0].declarationList.declarations[0].initializer, r = [];
608
- if (E(n, 10, r), r.length) throw Error(r.reduce((e, t) => `${e}${t.message}\n`, ""));
609
- return { node: n };
607
+ let t = n.createSourceFile("expression.ts", `const x = ${e}`, n.ScriptTarget.ESNext, !0).statements[0].declarationList.declarations[0].initializer, r = [];
608
+ if (E(t, 10, r), r.length) throw Error(r.reduce((e, t) => `${e}${t.message}\n`, ""));
609
+ return { node: t };
610
610
  }
611
- function E(e, n, r) {
611
+ function E(e, t, r) {
612
612
  if (!D(e)) throw Error(O(e));
613
- if (t.forEachChild(e, (e) => E(e, n, r)), r.length) throw Error(r[0].message);
613
+ if (n.forEachChild(e, (e) => E(e, t, r)), r.length) throw Error(r[0].message);
614
614
  }
615
615
  function D(e) {
616
616
  switch (e.kind) {
617
- case t.SyntaxKind.StringLiteral:
618
- case t.SyntaxKind.NumericLiteral:
619
- case t.SyntaxKind.BigIntLiteral:
620
- case t.SyntaxKind.TrueKeyword:
621
- case t.SyntaxKind.FalseKeyword:
622
- case t.SyntaxKind.NullKeyword:
623
- case t.SyntaxKind.UndefinedKeyword:
624
- case t.SyntaxKind.Identifier:
625
- case t.SyntaxKind.PropertyAccessExpression:
626
- case t.SyntaxKind.ElementAccessExpression:
627
- case t.SyntaxKind.CallExpression:
628
- case t.SyntaxKind.BinaryExpression:
629
- case t.SyntaxKind.EqualsEqualsToken:
630
- case t.SyntaxKind.EqualsEqualsEqualsToken:
631
- case t.SyntaxKind.ExclamationEqualsToken:
632
- case t.SyntaxKind.ExclamationEqualsEqualsToken:
633
- case t.SyntaxKind.LessThanToken:
634
- case t.SyntaxKind.LessThanEqualsToken:
635
- case t.SyntaxKind.GreaterThanToken:
636
- case t.SyntaxKind.GreaterThanEqualsToken:
637
- case t.SyntaxKind.PlusToken:
638
- case t.SyntaxKind.MinusToken:
639
- case t.SyntaxKind.AsteriskToken:
640
- case t.SyntaxKind.SlashToken:
641
- case t.SyntaxKind.PercentToken:
642
- case t.SyntaxKind.AsteriskAsteriskToken:
643
- case t.SyntaxKind.AmpersandAmpersandToken:
644
- case t.SyntaxKind.BarBarToken:
645
- case t.SyntaxKind.QuestionQuestionToken:
646
- case t.SyntaxKind.AmpersandToken:
647
- case t.SyntaxKind.BarToken:
648
- case t.SyntaxKind.CaretToken:
649
- case t.SyntaxKind.LessThanLessThanToken:
650
- case t.SyntaxKind.GreaterThanGreaterThanToken:
651
- case t.SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
652
- case t.SyntaxKind.InstanceOfKeyword:
653
- case t.SyntaxKind.InKeyword:
654
- case t.SyntaxKind.PrefixUnaryExpression:
655
- case t.SyntaxKind.PostfixUnaryExpression:
656
- case t.SyntaxKind.TypeOfExpression:
657
- case t.SyntaxKind.VoidExpression:
658
- case t.SyntaxKind.ConditionalExpression:
659
- case t.SyntaxKind.ParenthesizedExpression:
660
- case t.SyntaxKind.TemplateExpression:
661
- case t.SyntaxKind.NoSubstitutionTemplateLiteral:
662
- case t.SyntaxKind.TemplateHead:
663
- case t.SyntaxKind.TemplateMiddle:
664
- case t.SyntaxKind.TemplateTail:
665
- case t.SyntaxKind.TemplateSpan:
666
- case t.SyntaxKind.ArrayLiteralExpression:
667
- case t.SyntaxKind.ObjectLiteralExpression:
668
- case t.SyntaxKind.PropertyAssignment:
669
- case t.SyntaxKind.ShorthandPropertyAssignment:
670
- case t.SyntaxKind.SpreadAssignment:
671
- case t.SyntaxKind.SpreadElement:
672
- case t.SyntaxKind.SyntaxList: return !0;
617
+ case n.SyntaxKind.StringLiteral:
618
+ case n.SyntaxKind.NumericLiteral:
619
+ case n.SyntaxKind.BigIntLiteral:
620
+ case n.SyntaxKind.TrueKeyword:
621
+ case n.SyntaxKind.FalseKeyword:
622
+ case n.SyntaxKind.NullKeyword:
623
+ case n.SyntaxKind.UndefinedKeyword:
624
+ case n.SyntaxKind.Identifier:
625
+ case n.SyntaxKind.PropertyAccessExpression:
626
+ case n.SyntaxKind.ElementAccessExpression:
627
+ case n.SyntaxKind.CallExpression:
628
+ case n.SyntaxKind.BinaryExpression:
629
+ case n.SyntaxKind.EqualsEqualsToken:
630
+ case n.SyntaxKind.EqualsEqualsEqualsToken:
631
+ case n.SyntaxKind.ExclamationEqualsToken:
632
+ case n.SyntaxKind.ExclamationEqualsEqualsToken:
633
+ case n.SyntaxKind.LessThanToken:
634
+ case n.SyntaxKind.LessThanEqualsToken:
635
+ case n.SyntaxKind.GreaterThanToken:
636
+ case n.SyntaxKind.GreaterThanEqualsToken:
637
+ case n.SyntaxKind.PlusToken:
638
+ case n.SyntaxKind.MinusToken:
639
+ case n.SyntaxKind.AsteriskToken:
640
+ case n.SyntaxKind.SlashToken:
641
+ case n.SyntaxKind.PercentToken:
642
+ case n.SyntaxKind.AsteriskAsteriskToken:
643
+ case n.SyntaxKind.AmpersandAmpersandToken:
644
+ case n.SyntaxKind.BarBarToken:
645
+ case n.SyntaxKind.QuestionQuestionToken:
646
+ case n.SyntaxKind.AmpersandToken:
647
+ case n.SyntaxKind.BarToken:
648
+ case n.SyntaxKind.CaretToken:
649
+ case n.SyntaxKind.LessThanLessThanToken:
650
+ case n.SyntaxKind.GreaterThanGreaterThanToken:
651
+ case n.SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
652
+ case n.SyntaxKind.InstanceOfKeyword:
653
+ case n.SyntaxKind.InKeyword:
654
+ case n.SyntaxKind.PrefixUnaryExpression:
655
+ case n.SyntaxKind.PostfixUnaryExpression:
656
+ case n.SyntaxKind.TypeOfExpression:
657
+ case n.SyntaxKind.VoidExpression:
658
+ case n.SyntaxKind.ConditionalExpression:
659
+ case n.SyntaxKind.ParenthesizedExpression:
660
+ case n.SyntaxKind.TemplateExpression:
661
+ case n.SyntaxKind.NoSubstitutionTemplateLiteral:
662
+ case n.SyntaxKind.TemplateHead:
663
+ case n.SyntaxKind.TemplateMiddle:
664
+ case n.SyntaxKind.TemplateTail:
665
+ case n.SyntaxKind.TemplateSpan:
666
+ case n.SyntaxKind.ArrayLiteralExpression:
667
+ case n.SyntaxKind.ObjectLiteralExpression:
668
+ case n.SyntaxKind.PropertyAssignment:
669
+ case n.SyntaxKind.ShorthandPropertyAssignment:
670
+ case n.SyntaxKind.SpreadAssignment:
671
+ case n.SyntaxKind.SpreadElement:
672
+ case n.SyntaxKind.SyntaxList: return !0;
673
673
  default: return !1;
674
674
  }
675
675
  }
676
676
  function O(e) {
677
677
  switch (e.kind) {
678
- case t.SyntaxKind.AwaitExpression: return "'await' is not allowed inside template expressions.";
679
- case t.SyntaxKind.YieldExpression: return "'yield' is not allowed inside template expressions.";
680
- case t.SyntaxKind.NewExpression: return "'new' is not allowed inside template expressions.";
681
- case t.SyntaxKind.ArrowFunction:
682
- case t.SyntaxKind.FunctionExpression: return "Function expressions are not allowed inside template expressions.";
683
- case t.SyntaxKind.TaggedTemplateExpression: return "Tagged template expressions are not allowed inside template expressions.";
684
- case t.SyntaxKind.BinaryExpression: return k(e.operatorToken.kind) ? "Assignments are not allowed inside template expressions. Use @const to declare local template variables instead." : `'${t.SyntaxKind[e.kind]}' is not allowed inside template expressions.`;
685
- default: return `'${t.SyntaxKind[e.kind]}' is not allowed inside template expressions.`;
678
+ case n.SyntaxKind.AwaitExpression: return "'await' is not allowed inside template expressions.";
679
+ case n.SyntaxKind.YieldExpression: return "'yield' is not allowed inside template expressions.";
680
+ case n.SyntaxKind.NewExpression: return "'new' is not allowed inside template expressions.";
681
+ case n.SyntaxKind.ArrowFunction:
682
+ case n.SyntaxKind.FunctionExpression: return "Function expressions are not allowed inside template expressions.";
683
+ case n.SyntaxKind.TaggedTemplateExpression: return "Tagged template expressions are not allowed inside template expressions.";
684
+ case n.SyntaxKind.BinaryExpression: return k(e.operatorToken.kind) ? "Assignments are not allowed inside template expressions. Use @const to declare local template variables instead." : `'${n.SyntaxKind[e.kind]}' is not allowed inside template expressions.`;
685
+ default: return `'${n.SyntaxKind[e.kind]}' is not allowed inside template expressions.`;
686
686
  }
687
687
  }
688
688
  function k(e) {
689
- return e >= t.SyntaxKind.FirstAssignment && e <= t.SyntaxKind.LastAssignment;
689
+ return e >= n.SyntaxKind.FirstAssignment && e <= n.SyntaxKind.LastAssignment;
690
690
  }
691
691
  //#endregion
692
692
  //#region ../packages/compiler/src/parser/states/parse-block-children.state.ts
693
693
  function A(e, t) {
694
694
  let n = [];
695
- for (; e.peek().type !== r.BLOCK_CLOSE;) {
695
+ for (; e.peek().type !== i.BLOCK_CLOSE;) {
696
696
  let e = t();
697
697
  e && n.push(e);
698
698
  }
@@ -702,13 +702,13 @@ function A(e, t) {
702
702
  //#region ../packages/compiler/src/parser/states/parse-for.state.ts
703
703
  function j(e, t, n) {
704
704
  e.advance();
705
- let i = e.peek();
706
- if (i.type !== r.CONDITION) throw Error(`[Parser] Expected CONDITION after FOR, got ${r[i.type]}`);
707
- let a = M(i.parts[0], 0);
705
+ let r = e.peek();
706
+ if (r.type !== i.CONDITION) throw Error(`[Parser] Expected CONDITION after FOR, got ${i[r.type]}`);
707
+ let a = M(r.parts[0], 0);
708
708
  e.advance(2);
709
709
  let o = A(e, t);
710
710
  return {
711
- type: S.For,
711
+ type: C.For,
712
712
  ...a,
713
713
  children: o
714
714
  };
@@ -783,8 +783,8 @@ function P(e) {
783
783
  }
784
784
  function F(e) {
785
785
  if (!e.length) return !1;
786
- let n = t.createSourceFile("__id.ts", e, t.ScriptTarget.ESNext, !1).statements[0];
787
- return !!n && t.isExpressionStatement(n) && t.isIdentifier(n.expression) && n.expression.text === e;
786
+ let t = n.createSourceFile("__id.ts", e, n.ScriptTarget.ESNext, !1).statements[0];
787
+ return !!t && n.isExpressionStatement(t) && n.isIdentifier(t.expression) && t.expression.text === e;
788
788
  }
789
789
  //#endregion
790
790
  //#region ../packages/compiler/src/parser/states/parse-if.state.ts
@@ -793,25 +793,25 @@ function I(e, t, n) {
793
793
  }
794
794
  function L(e, t, n) {
795
795
  switch (n.type) {
796
- case r.IF:
797
- case r.ELSE_IF:
796
+ case i.IF:
797
+ case i.ELSE_IF:
798
798
  e.advance();
799
- let i = e.peek();
800
- if (i.type !== r.CONDITION) throw Error(`[Parser] Expected CONDITION after ${r[n.type]}, got ${r[i.type]}`);
799
+ let r = e.peek();
800
+ if (r.type !== i.CONDITION) throw Error(`[Parser] Expected CONDITION after ${i[n.type]}, got ${i[r.type]}`);
801
801
  e.advance(2);
802
- let a = i.parts[0], o = T(a), s = A(e, t);
802
+ let a = r.parts[0], o = T(a), s = A(e, t);
803
803
  return {
804
- type: n.type === r.IF ? S.If : S.ElseIf,
804
+ type: n.type === i.IF ? C.If : C.ElseIf,
805
805
  condition: a,
806
806
  conditionNode: o.node,
807
807
  consequent: s,
808
808
  alternate: L(e, t, e.peek())
809
809
  };
810
- case r.ELSE:
810
+ case i.ELSE:
811
811
  e.advance(2);
812
812
  let c = A(e, t);
813
813
  return {
814
- type: S.Else,
814
+ type: C.Else,
815
815
  consequent: c
816
816
  };
817
817
  }
@@ -820,36 +820,36 @@ function L(e, t, n) {
820
820
  //#region ../packages/compiler/src/parser/states/parse-switch.state.ts
821
821
  function R(e, t, n) {
822
822
  e.advance();
823
- let i = e.peek();
824
- if (i.type !== r.CONDITION) throw Error(`[Parser] Expected CONDITION after SWITCH, got ${r[i.type]}`);
825
- let a = i.parts[0];
823
+ let r = e.peek();
824
+ if (r.type !== i.CONDITION) throw Error(`[Parser] Expected CONDITION after SWITCH, got ${i[r.type]}`);
825
+ let a = r.parts[0];
826
826
  e.advance(2);
827
827
  let o = [];
828
- for (; e.peek().type !== r.BLOCK_CLOSE;) switch (e.peek().type) {
829
- case r.CASE:
828
+ for (; e.peek().type !== i.BLOCK_CLOSE;) switch (e.peek().type) {
829
+ case i.CASE:
830
830
  let n = [];
831
831
  do {
832
832
  e.advance();
833
833
  let t = e.peek();
834
- if (t.type !== r.CONDITION) throw Error("[Parser] Expected CONDITION after CASE");
834
+ if (t.type !== i.CONDITION) throw Error("[Parser] Expected CONDITION after CASE");
835
835
  n.push(t.parts[0]), e.advance();
836
- } while (e.peek().type !== r.BLOCK_OPEN);
836
+ } while (e.peek().type !== i.BLOCK_OPEN);
837
837
  e.advance(), o.push({
838
- type: S.Case,
838
+ type: C.Case,
839
839
  condition: n,
840
840
  children: A(e, t)
841
841
  });
842
842
  break;
843
- case r.DEFAULT:
843
+ case i.DEFAULT:
844
844
  e.advance(2), o.push({
845
- type: S.Case,
845
+ type: C.Case,
846
846
  condition: null,
847
847
  children: A(e, t)
848
848
  });
849
849
  break;
850
850
  }
851
851
  return e.advance(), {
852
- type: S.Switch,
852
+ type: C.Switch,
853
853
  expression: a,
854
854
  cases: o
855
855
  };
@@ -858,7 +858,7 @@ function R(e, t, n) {
858
858
  //#region ../packages/compiler/src/parser/states/parse-text.state.ts
859
859
  function z(e, t, n) {
860
860
  return e.advance(), {
861
- type: S.Text,
861
+ type: C.Text,
862
862
  value: n.parts[0]
863
863
  };
864
864
  }
@@ -868,21 +868,21 @@ var B = class {
868
868
  tokens;
869
869
  _cursor;
870
870
  _states = {
871
- [r.TEXT]: z,
872
- [r.INTERPOLATION_EXPRESSION]: C,
873
- [r.INTERPOLATION_LITERAL]: C,
874
- [r.TAG_OPEN_NAME]: ce,
875
- [r.IF]: I,
876
- [r.FOR]: j,
877
- [r.SWITCH]: R,
878
- [r.CONST_DECLARATION]: oe
871
+ [i.TEXT]: z,
872
+ [i.INTERPOLATION_EXPRESSION]: w,
873
+ [i.INTERPOLATION_LITERAL]: w,
874
+ [i.TAG_OPEN_NAME]: le,
875
+ [i.IF]: I,
876
+ [i.FOR]: j,
877
+ [i.SWITCH]: R,
878
+ [i.CONST_DECLARATION]: oe
879
879
  };
880
880
  constructor(e) {
881
881
  this.tokens = e, this._cursor = new ae(this.tokens);
882
882
  }
883
883
  parse() {
884
884
  let e = [];
885
- for (; this._cursor.peek().type !== r.EOF;) {
885
+ for (; this._cursor.peek().type !== i.EOF;) {
886
886
  let t = this.parseNode();
887
887
  t && e.push(t);
888
888
  }
@@ -890,9 +890,9 @@ var B = class {
890
890
  }
891
891
  parseNode() {
892
892
  let e = this._cursor.peek();
893
- if (e.type === r.EOF) return;
893
+ if (e.type === i.EOF) return;
894
894
  let t = this._states[e.type];
895
- if (!t) throw Error(`[Parser] No transition function for token type ${r[e.type]}`);
895
+ if (!t) throw Error(`[Parser] No transition function for token type ${i[e.type]}`);
896
896
  return t(this._cursor, this.parseNode.bind(this), e);
897
897
  }
898
898
  }, V = class {
@@ -908,30 +908,27 @@ var B = class {
908
908
  getIdentifier(e) {
909
909
  return this._identifiers.includes(e) ? e : this._parent?.getIdentifier(e);
910
910
  }
911
- }, ue = new Set(/* @__PURE__ */ "undefined.NaN.Infinity.globalThis.eval.isFinite.isNaN.parseFloat.parseInt.decodeURI.decodeURIComponent.encodeURI.encodeURIComponent.escape.unescape.Object.Function.Boolean.Symbol.Error.AggregateError.EvalError.RangeError.ReferenceError.SyntaxError.TypeError.URIError.SuppressedError.InternalError.Number.BigInt.Math.Date.Temporal.String.RegExp.Array.TypedArray.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Uint16Array.Int32Array.Uint32Array.BigInt64Array.BigUint64Array.Float16Array.Float32Array.Float64Array.Map.Set.WeakMap.WeakSet.ArrayBuffer.SharedArrayBuffer.DataView.Atomics.JSON.WeakRef.FinalizationRegistry.Iterator.AsyncIterator.Promise.GeneratorFunction.AsyncGeneratorFunction.Generator.AsyncGenerator.AsyncFunction.DisposableStack.AsyncDisposableStack.Reflect.Proxy.Intl.WebAssembly.window.document.navigator.location.history.screen.console.performance.crypto.fetch.alert.confirm.prompt.setTimeout.setInterval.clearTimeout.clearInterval.requestAnimationFrame.cancelAnimationFrame.queueMicrotask.structuredClone.URL.URLSearchParams.FormData.Headers.Request.Response.AbortController.AbortSignal.CustomEvent.Event.EventTarget.MutationObserver.IntersectionObserver.ResizeObserver.PerformanceObserver.Worker.SharedWorker.ServiceWorker.Blob.File.FileReader.ReadableStream.WritableStream.TransformStream.TextEncoder.TextDecoder.ImageData.Canvas.Storage.localStorage.sessionStorage.indexedDB.WebSocket.XMLHttpRequest.HTMLElement.HTMLInputElement.HTMLButtonElement.HTMLFormElement.HTMLAnchorElement.HTMLImageElement.HTMLVideoElement.HTMLAudioElement.HTMLCanvasElement.HTMLSelectElement.HTMLTextAreaElement.HTMLDivElement.HTMLSpanElement.HTMLParagraphElement.HTMLHeadingElement.HTMLTableElement.HTMLTableRowElement.HTMLTableCellElement.HTMLUListElement.HTMLOListElement.HTMLLIElement.HTMLLabelElement.HTMLDialogElement.HTMLDetailsElement.HTMLSlotElement.HTMLTemplateElement.SVGElement.SVGSVGElement.Element.Node.NodeList.DocumentFragment.ShadowRoot.Document.Window".split(".")), H = "this._root";
912
- function U(e, t) {
913
- return typeof e == "string" ? t.getIdentifier(e) ?? `this.${e}` : W(e, e, t);
911
+ }, H = new Set(/* @__PURE__ */ "undefined.NaN.Infinity.globalThis.eval.isFinite.isNaN.parseFloat.parseInt.decodeURI.decodeURIComponent.encodeURI.encodeURIComponent.escape.unescape.Object.Function.Boolean.Symbol.Error.AggregateError.EvalError.RangeError.ReferenceError.SyntaxError.TypeError.URIError.SuppressedError.InternalError.Number.BigInt.Math.Date.Temporal.String.RegExp.Array.TypedArray.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Uint16Array.Int32Array.Uint32Array.BigInt64Array.BigUint64Array.Float16Array.Float32Array.Float64Array.Map.Set.WeakMap.WeakSet.ArrayBuffer.SharedArrayBuffer.DataView.Atomics.JSON.WeakRef.FinalizationRegistry.Iterator.AsyncIterator.Promise.GeneratorFunction.AsyncGeneratorFunction.Generator.AsyncGenerator.AsyncFunction.DisposableStack.AsyncDisposableStack.Reflect.Proxy.Intl.WebAssembly.window.document.navigator.location.history.screen.console.performance.crypto.fetch.alert.confirm.prompt.setTimeout.setInterval.clearTimeout.clearInterval.requestAnimationFrame.cancelAnimationFrame.queueMicrotask.structuredClone.URL.URLSearchParams.FormData.Headers.Request.Response.AbortController.AbortSignal.CustomEvent.Event.EventTarget.MutationObserver.IntersectionObserver.ResizeObserver.PerformanceObserver.Worker.SharedWorker.ServiceWorker.Blob.File.FileReader.ReadableStream.WritableStream.TransformStream.TextEncoder.TextDecoder.ImageData.Canvas.Storage.localStorage.sessionStorage.indexedDB.WebSocket.XMLHttpRequest.HTMLElement.HTMLInputElement.HTMLButtonElement.HTMLFormElement.HTMLAnchorElement.HTMLImageElement.HTMLVideoElement.HTMLAudioElement.HTMLCanvasElement.HTMLSelectElement.HTMLTextAreaElement.HTMLDivElement.HTMLSpanElement.HTMLParagraphElement.HTMLHeadingElement.HTMLTableElement.HTMLTableRowElement.HTMLTableCellElement.HTMLUListElement.HTMLOListElement.HTMLLIElement.HTMLLabelElement.HTMLDialogElement.HTMLDetailsElement.HTMLSlotElement.HTMLTemplateElement.SVGElement.SVGSVGElement.Element.Node.NodeList.DocumentFragment.ShadowRoot.Document.Window".split(".")), U = "this._root";
912
+ function W(e, t) {
913
+ return typeof e == "string" ? t.getIdentifier(e) ?? `this.${e}` : G(e, e, t);
914
914
  }
915
- function W(e, n, r) {
916
- if (t.isIdentifier(e) && K(e, n)) return r.getIdentifier(e.text) ?? `this.${e.text}`;
917
- if (!G(e, n)) return e.getText();
915
+ function G(e, t, r) {
916
+ if (n.isIdentifier(e) && q(e, t)) return r.getIdentifier(e.text) ?? `this.${e.text}`;
917
+ if (!K(e, t)) return e.getText();
918
918
  let i = e.getSourceFile().text, a = "", o = e.getStart();
919
- return t.forEachChild(e, (t) => {
920
- a = `${a}${i.slice(o, t.getStart())}${W(t, e, r)}`, o = t.getEnd();
919
+ return n.forEachChild(e, (t) => {
920
+ a = `${a}${i.slice(o, t.getStart())}${G(t, e, r)}`, o = t.getEnd();
921
921
  }), `${a}${i.slice(o, e.getEnd())}`;
922
922
  }
923
- function G(e, n) {
924
- if (t.isIdentifier(e) && K(e, n)) return !0;
923
+ function K(e, t) {
924
+ if (n.isIdentifier(e) && q(e, t)) return !0;
925
925
  let r = !1;
926
- return t.forEachChild(e, (t) => {
927
- r ||= G(t, e);
926
+ return n.forEachChild(e, (t) => {
927
+ r ||= K(t, e);
928
928
  }), r;
929
929
  }
930
- function K(e, n) {
931
- return !(t.isPropertyAccessExpression(n) && n.name === e || ue.has(e.text));
932
- }
933
- function q(...e) {
934
- return e.map((e) => ` ${e}`);
930
+ function q(e, t) {
931
+ return !(n.isPropertyAccessExpression(t) && t.name === e || H.has(e.text));
935
932
  }
936
933
  function de(e, t, n) {
937
934
  return t === "this._root" ? `${e.tagName}${n}` : `${t}_${e.tagName}${n}`;
@@ -942,17 +939,17 @@ function J(e, t, n = "text") {
942
939
  //#endregion
943
940
  //#region ../packages/compiler/src/render-generator/states/process-const-declaration.state.ts
944
941
  function fe(e, t, n, r) {
945
- return r.addIdentifier(e.varName), [`const ${e.varName} = ${U(e.expression, r)};`];
942
+ return r.addIdentifier(e.varName), [`const ${e.varName} = ${W(e.expression, r)};`];
946
943
  }
947
944
  //#endregion
948
945
  //#region ../packages/compiler/src/render-generator/states/process-element.state.ts
949
- function Y(e, t, n, r) {
946
+ function pe(e, t, n, r) {
950
947
  let i = new V([], r);
951
948
  return [
952
949
  `const ${t} = document.createElement("${e.tagName}");`,
953
950
  ...e.attributes?.map((e) => {
954
951
  let n = e.value;
955
- return typeof n == "string" ? `${t}.setAttribute('${e.name}', ${n});` : `effect(() => ${t}.setAttribute('${e.name}', ${U(n.expression, r)}));`;
952
+ return typeof n == "string" ? `${t}.setAttribute('${e.name}', ${n});` : `effect(() => ${t}.setAttribute('${e.name}', ${W(n.expression, r)}));`;
956
953
  }) || [],
957
954
  ...e.events?.map((e) => `${t}.addEventListener("${e.name}", ($event) => this.${e.handler});`) || [],
958
955
  `${n}.appendChild(${t});`,
@@ -961,66 +958,60 @@ function Y(e, t, n, r) {
961
958
  }
962
959
  //#endregion
963
960
  //#region ../packages/compiler/src/render-generator/states/process-for.state.ts
964
- function pe(e, t, n, r) {
965
- let i = e.iterableSource, a = r.getIdentifier(i) ?? `this.${i}`, o = J(n, t, "items"), s = J(n, t, "i"), c = X(e, "$index"), l = X(e, "$first"), u = X(e, "$last"), d = X(e, "$even"), f = X(e, "$odd"), p = new V([
961
+ function me(e, n, r, i) {
962
+ let a = e.iterableSource, o = i.getIdentifier(a) ?? `this.${a}`, s = J(r, n, "items"), c = J(r, n, "i"), l = Y(e, "$index"), u = Y(e, "$first"), d = Y(e, "$last"), f = Y(e, "$even"), p = Y(e, "$odd"), m = new V([
966
963
  e.itemAlias,
967
- c,
968
964
  l,
969
965
  u,
970
966
  d,
971
- f
972
- ], r);
967
+ f,
968
+ p
969
+ ], i);
973
970
  return [
974
- `const ${o} = ${a};`,
975
- `for (let ${s} = 0; ${s} < ${o}.length; ${s}++) {`,
976
- ...q(`const ${e.itemAlias} = ${o}[${s}];`),
977
- ...q(`const ${c} = ${s};`),
978
- ...q(`const ${l} = ${s} === 0;`),
979
- ...q(`const ${u} = ${s} === ${o}.length - 1;`),
980
- ...q(`const ${d} = ${s} % 2 === 0;`),
981
- ...q(`const ${f} = ${s} % 2 !== 0;`),
982
- ...q(""),
983
- ...e.children.flatMap((e, r) => q(...$(e, `${t}_${r}`, n, p))),
971
+ `const ${s} = ${o};`,
972
+ `for (let ${c} = 0; ${c} < ${s}.length; ${c}++) {`,
973
+ ...t(`const ${e.itemAlias} = ${s}[${c}];`, `const ${l} = ${c};`, `const ${u} = ${c} === 0;`, `const ${d} = ${c} === ${s}.length - 1;`, `const ${f} = ${c} % 2 === 0;`, `const ${p} = ${c} % 2 !== 0;`),
974
+ ...e.children.flatMap((e, i) => t(...$(e, `${n}_${i}`, r, m))),
984
975
  "}"
985
976
  ];
986
977
  }
987
- function X(e, t) {
978
+ function Y(e, t) {
988
979
  return e.implicitAliases.get(t) ?? t;
989
980
  }
990
981
  //#endregion
991
982
  //#region ../packages/compiler/src/render-generator/states/process-if.state.ts
992
- function me(e, t, n, r) {
983
+ function he(e, t, n, r) {
993
984
  let i = new V([], r), a = [
994
- `if (${U(e.conditionNode, r)}) {`,
995
- ...Z(e, t, n, i),
985
+ `if (${W(e.conditionNode, r)}) {`,
986
+ ...X(e, t, n, i),
996
987
  "}"
997
988
  ], o = e.alternate;
998
- for (; o?.type === S.ElseIf;) {
989
+ for (; o?.type === C.ElseIf;) {
999
990
  let e = new V([], r);
1000
- a[a.length - 1] += ` else if (${U(o.conditionNode, r)}) {`, a.push(...Z(o, t, n, e), "}"), o = o.alternate;
991
+ a[a.length - 1] += ` else if (${W(o.conditionNode, r)}) {`, a.push(...X(o, t, n, e), "}"), o = o.alternate;
1001
992
  }
1002
993
  if (o) {
1003
994
  let e = new V([], r);
1004
- a[a.length - 1] += " else {", a.push(...Z(o, t, n, e), "}");
995
+ a[a.length - 1] += " else {", a.push(...X(o, t, n, e), "}");
1005
996
  }
1006
997
  return a;
1007
998
  }
1008
- function Z(e, t, n, r) {
1009
- return e.consequent.map((e, i) => q(...$(e, `${t}_${i}`, n, r))).flat();
999
+ function X(e, n, r, i) {
1000
+ return e.consequent.map((e, a) => t(...$(e, `${n}_${a}`, r, i))).flat();
1010
1001
  }
1011
1002
  //#endregion
1012
1003
  //#region ../packages/compiler/src/render-generator/states/process-switch.state.ts
1013
- function he(e, t, n, r) {
1004
+ function Z(e, n, r, i) {
1014
1005
  return [
1015
- `switch (${U(e.expression, r)}) {`,
1016
- ...e.cases.map((e) => [...q(...e.condition ? e.condition.map((e, t, n) => `case ${e}:${t === n.length - 1 ? " {" : ""}`) : ["default: {"], ...e.children.map((e, i) => q(...$(e, `${t}_${i}_${i}`, n, new V([], r)))).flat(), `${q("break;")}`, "}")]).flat(),
1006
+ `switch (${W(e.expression, i)}) {`,
1007
+ ...e.cases.map((e) => [...t(...e.condition ? e.condition.map((e, t, n) => `case ${e}:${t === n.length - 1 ? " {" : ""}`) : ["default: {"], ...e.children.map((e, a) => t(...$(e, `${n}_${a}_${a}`, r, new V([], i)))).flat(), `${t("break;")}`, "}")]).flat(),
1017
1008
  "}"
1018
1009
  ];
1019
1010
  }
1020
1011
  //#endregion
1021
1012
  //#region ../packages/compiler/src/render-generator/states/process-text-and-interpolation.state.ts
1022
1013
  function ge(e, t, n, r) {
1023
- let i = e.type === S.Text ? JSON.stringify(e.value) : U(e.expression, r);
1014
+ let i = e.type === C.Text ? JSON.stringify(e.value) : W(e.expression, r);
1024
1015
  return [
1025
1016
  `const ${t} = document.createTextNode(${i});`,
1026
1017
  `${n}.appendChild(${t});`,
@@ -1030,34 +1021,34 @@ function ge(e, t, n, r) {
1030
1021
  //#endregion
1031
1022
  //#region ../packages/compiler/src/render-generator/render-generator.ts
1032
1023
  var Q = /* @__PURE__ */ new Map();
1033
- function _e(e, t) {
1024
+ function _e(e, n) {
1034
1025
  Q.clear();
1035
- let n = new V(), r = [
1026
+ let r = new V(), i = [
1036
1027
  "_render() {",
1037
- ...q(`this._root.adoptedStyleSheets = [${t}];`, ...e.map((e, t) => [...$(e, t.toString(), H, n)]).flat()),
1028
+ ...t(`this._root.adoptedStyleSheets = [${n}];`, ...e.map((e, t) => [...$(e, t.toString(), U, r)]).flat()),
1038
1029
  "}"
1039
1030
  ];
1040
1031
  for (; Q.size > 0;) {
1041
- let [e, t] = Q.entries().next().value;
1042
- r.push(`${e} {`, ...q(...t()), "}"), Q.delete(e);
1032
+ let [e, n] = Q.entries().next().value;
1033
+ i.push(`${e} {`, ...t(...n()), "}"), Q.delete(e);
1043
1034
  }
1044
- return r.join("\n");
1035
+ return i.join("\n");
1045
1036
  }
1046
1037
  function $(e, t, n, r) {
1047
1038
  switch (e.type) {
1048
- case S.Text:
1049
- case S.Interpolation: return ge(e, J(n, t), n, r);
1050
- case S.Element: return Y(e, de(e, n, t), n, r);
1051
- case S.If:
1052
- let i = `control_flow_if_${t}()`;
1053
- return Q.set(i, () => me(e, t, n, r)), [`this.${i};`];
1054
- case S.For:
1055
- let a = `control_flow_for_${t}()`;
1056
- return Q.set(a, () => pe(e, t, n, r)), [`this.${a};`];
1057
- case S.Switch:
1058
- let o = `control_flow_switch_${t}()`;
1059
- return Q.set(o, () => he(e, t, n, r)), [`this.${o};`];
1060
- case S.ConstDeclaration: return fe(e, t, n, r);
1039
+ case C.Text:
1040
+ case C.Interpolation: return ge(e, J(n, t), n, r);
1041
+ case C.Element: return pe(e, de(e, n, t), n, r);
1042
+ case C.If:
1043
+ let i = `if_${t}()`;
1044
+ return Q.set(i, () => he(e, t, n, r)), [`this.${i};`];
1045
+ case C.For:
1046
+ let a = `for_${t}()`;
1047
+ return Q.set(a, () => me(e, t, n, r)), [`this.${a};`];
1048
+ case C.Switch:
1049
+ let o = `switch_${t}()`;
1050
+ return Q.set(o, () => Z(e, t, n, r)), [`this.${o};`];
1051
+ case C.ConstDeclaration: return fe(e, t, n, r);
1061
1052
  default: return [];
1062
1053
  }
1063
1054
  }