dorian 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +15 -0
  3. data/.github/workflows/ci.yml +38 -0
  4. data/.gitignore +30 -0
  5. data/.node-version +1 -0
  6. data/.prettierignore +2 -0
  7. data/.rubocop.yml +129 -0
  8. data/.ruby-version +1 -0
  9. data/.tool-versions +3 -0
  10. data/Gemfile +20 -0
  11. data/Gemfile.lock +186 -0
  12. data/LICENSE +19 -0
  13. data/README.md +24 -0
  14. data/VERSION +1 -1
  15. data/bin/bundle +123 -0
  16. data/bin/bundle-audit +31 -0
  17. data/bin/bundler-audit +31 -0
  18. data/bin/rspec +31 -0
  19. data/bin/rubocop +31 -0
  20. data/dorian.gemspec +35 -0
  21. data/lib/dorian/bin.rb +739 -81
  22. data/package-lock.json +39 -0
  23. data/package.json +11 -0
  24. data/samples/books.json +33 -0
  25. data/samples/books.jsonl +3 -0
  26. data/samples/config.yml +27 -0
  27. data/samples/config_2.yml +22 -0
  28. data/samples/maths.js +1 -0
  29. data/samples/numbers.raw +10 -0
  30. data/samples/people.csv +6 -0
  31. data/samples/people.yml +28 -0
  32. data/samples/query.sql +7 -0
  33. data/samples/user.json +31 -0
  34. data/spec/dorian_spec.rb +276 -0
  35. data/spec/spec_helper.rb +3 -0
  36. data/vendor/groovy-beautify/LICENSE.MD +21 -0
  37. data/vendor/groovy-beautify/README.md +65 -0
  38. data/vendor/groovy-beautify/dist/__tests__/index.test.d.ts +1 -0
  39. data/vendor/groovy-beautify/dist/cjs/index.js +573 -0
  40. data/vendor/groovy-beautify/dist/cjs/package.json +3 -0
  41. data/vendor/groovy-beautify/dist/es/index.js +682 -0
  42. data/vendor/groovy-beautify/dist/es/package.json +3 -0
  43. data/vendor/groovy-beautify/dist/formatter/FormatRule.d.ts +14 -0
  44. data/vendor/groovy-beautify/dist/formatter/Formatter.d.ts +11 -0
  45. data/vendor/groovy-beautify/dist/formatter/GroovyFormatRules.d.ts +3 -0
  46. data/vendor/groovy-beautify/dist/formatter/__tests__/formatter.test.d.ts +1 -0
  47. data/vendor/groovy-beautify/dist/index.d.ts +5 -0
  48. data/vendor/groovy-beautify/dist/parser/GroovyParseRules.d.ts +3 -0
  49. data/vendor/groovy-beautify/dist/parser/ParseRule.d.ts +23 -0
  50. data/vendor/groovy-beautify/dist/parser/Parser.d.ts +29 -0
  51. data/vendor/groovy-beautify/dist/parser/__tests__/parser.test.d.ts +1 -0
  52. data/vendor/groovy-beautify/dist/parser/types.d.ts +6 -0
  53. data/vendor/groovy-beautify/dist/utils/text.d.ts +4 -0
  54. data/vendor/groovy-beautify/package.json +55 -0
  55. data/vendor/prettier/LICENSE +4379 -0
  56. data/vendor/prettier/README.md +109 -0
  57. data/vendor/prettier/bin/prettier.cjs +71 -0
  58. data/vendor/prettier/doc.d.ts +243 -0
  59. data/vendor/prettier/doc.js +1545 -0
  60. data/vendor/prettier/doc.mjs +1503 -0
  61. data/vendor/prettier/index.cjs +825 -0
  62. data/vendor/prettier/index.d.ts +941 -0
  63. data/vendor/prettier/index.mjs +25899 -0
  64. data/vendor/prettier/internal/cli.mjs +4366 -0
  65. data/vendor/prettier/package.json +198 -0
  66. data/vendor/prettier/plugins/acorn.d.ts +6 -0
  67. data/vendor/prettier/plugins/acorn.js +6618 -0
  68. data/vendor/prettier/plugins/acorn.mjs +6456 -0
  69. data/vendor/prettier/plugins/angular.d.ts +8 -0
  70. data/vendor/prettier/plugins/angular.js +2435 -0
  71. data/vendor/prettier/plugins/angular.mjs +2375 -0
  72. data/vendor/prettier/plugins/babel.d.ts +18 -0
  73. data/vendor/prettier/plugins/babel.js +14271 -0
  74. data/vendor/prettier/plugins/babel.mjs +13986 -0
  75. data/vendor/prettier/plugins/estree.d.ts +1 -0
  76. data/vendor/prettier/plugins/estree.js +9487 -0
  77. data/vendor/prettier/plugins/estree.mjs +9279 -0
  78. data/vendor/prettier/plugins/flow.d.ts +5 -0
  79. data/vendor/prettier/plugins/flow.js +51477 -0
  80. data/vendor/prettier/plugins/flow.mjs +51219 -0
  81. data/vendor/prettier/plugins/glimmer.d.ts +5 -0
  82. data/vendor/prettier/plugins/glimmer.js +8534 -0
  83. data/vendor/prettier/plugins/glimmer.mjs +8421 -0
  84. data/vendor/prettier/plugins/graphql.d.ts +5 -0
  85. data/vendor/prettier/plugins/graphql.js +2421 -0
  86. data/vendor/prettier/plugins/graphql.mjs +2347 -0
  87. data/vendor/prettier/plugins/html.d.ts +8 -0
  88. data/vendor/prettier/plugins/html.js +8182 -0
  89. data/vendor/prettier/plugins/html.mjs +8077 -0
  90. data/vendor/prettier/plugins/markdown.d.ts +7 -0
  91. data/vendor/prettier/plugins/markdown.js +9068 -0
  92. data/vendor/prettier/plugins/markdown.mjs +8977 -0
  93. data/vendor/prettier/plugins/meriyah.d.ts +5 -0
  94. data/vendor/prettier/plugins/meriyah.js +5953 -0
  95. data/vendor/prettier/plugins/meriyah.mjs +5800 -0
  96. data/vendor/prettier/plugins/postcss.d.ts +7 -0
  97. data/vendor/prettier/plugins/postcss.js +9244 -0
  98. data/vendor/prettier/plugins/postcss.mjs +9046 -0
  99. data/vendor/prettier/plugins/typescript.d.ts +5 -0
  100. data/vendor/prettier/plugins/typescript.js +38058 -0
  101. data/vendor/prettier/plugins/typescript.mjs +37732 -0
  102. data/vendor/prettier/plugins/yaml.d.ts +5 -0
  103. data/vendor/prettier/plugins/yaml.js +7425 -0
  104. data/vendor/prettier/plugins/yaml.mjs +7329 -0
  105. data/vendor/prettier/standalone.d.ts +33 -0
  106. data/vendor/prettier/standalone.js +3984 -0
  107. data/vendor/prettier/standalone.mjs +3938 -0
  108. data/vendor/sql-formatter.js +18762 -0
  109. metadata +205 -2
@@ -0,0 +1,2435 @@
1
+ (function (n) {
2
+ function e() {
3
+ var i = n();
4
+ return i.default || i;
5
+ }
6
+ if (typeof exports == "object" && typeof module == "object")
7
+ module.exports = e();
8
+ else if (typeof define == "function" && define.amd) define(e);
9
+ else {
10
+ var t =
11
+ typeof globalThis < "u"
12
+ ? globalThis
13
+ : typeof global < "u"
14
+ ? global
15
+ : typeof self < "u"
16
+ ? self
17
+ : this || {};
18
+ (t.prettierPlugins = t.prettierPlugins || {}),
19
+ (t.prettierPlugins.angular = e());
20
+ }
21
+ })(function () {
22
+ "use strict";
23
+ var Ut = Object.defineProperty;
24
+ var Je = Object.getOwnPropertyDescriptor;
25
+ var Xe = Object.getOwnPropertyNames;
26
+ var ts = Object.prototype.hasOwnProperty;
27
+ var ae = (r) => {
28
+ throw TypeError(r);
29
+ };
30
+ var oe = (r, t) => {
31
+ for (var e in t) Ut(r, e, { get: t[e], enumerable: !0 });
32
+ },
33
+ es = (r, t, e, s) => {
34
+ if ((t && typeof t == "object") || typeof t == "function")
35
+ for (let i of Xe(t))
36
+ !ts.call(r, i) &&
37
+ i !== e &&
38
+ Ut(r, i, {
39
+ get: () => t[i],
40
+ enumerable: !(s = Je(t, i)) || s.enumerable,
41
+ });
42
+ return r;
43
+ };
44
+ var ss = (r) => es(Ut({}, "__esModule", { value: !0 }), r);
45
+ var Ft = (r, t, e) => t.has(r) || ae("Cannot " + e);
46
+ var O = (r, t, e) => (
47
+ Ft(r, t, "read from private field"), e ? e.call(r) : t.get(r)
48
+ ),
49
+ P = (r, t, e) =>
50
+ t.has(r)
51
+ ? ae("Cannot add the same private member more than once")
52
+ : t instanceof WeakSet
53
+ ? t.add(r)
54
+ : t.set(r, e),
55
+ Y = (r, t, e, s) => (
56
+ Ft(r, t, "write to private field"), s ? s.call(r, e) : t.set(r, e), e
57
+ ),
58
+ c = (r, t, e) => (Ft(r, t, "access private method"), e);
59
+ var rr = {};
60
+ oe(rr, { parsers: () => ne });
61
+ var ne = {};
62
+ oe(ne, {
63
+ __ng_action: () => Xs,
64
+ __ng_binding: () => tr,
65
+ __ng_directive: () => sr,
66
+ __ng_interpolation: () => er,
67
+ });
68
+ var Z = class {
69
+ constructor(t, e, s, i) {
70
+ (this.input = e),
71
+ (this.errLocation = s),
72
+ (this.ctxLocation = i),
73
+ (this.message = `Parser Error: ${t} ${s} [${e}] in ${i}`);
74
+ }
75
+ },
76
+ b = class {
77
+ constructor(t, e) {
78
+ (this.start = t), (this.end = e);
79
+ }
80
+ toAbsolute(t) {
81
+ return new L(t + this.start, t + this.end);
82
+ }
83
+ },
84
+ m = class {
85
+ constructor(t, e) {
86
+ (this.span = t), (this.sourceSpan = e);
87
+ }
88
+ toString() {
89
+ return "AST";
90
+ }
91
+ },
92
+ J = class extends m {
93
+ constructor(t, e, s) {
94
+ super(t, e), (this.nameSpan = s);
95
+ }
96
+ },
97
+ $ = class extends m {
98
+ visit(t, e = null) {}
99
+ },
100
+ K = class extends m {
101
+ visit(t, e = null) {
102
+ return t.visitImplicitReceiver(this, e);
103
+ }
104
+ },
105
+ Lt = class extends K {
106
+ visit(t, e = null) {
107
+ var s;
108
+ return (s = t.visitThisReceiver) == null ? void 0 : s.call(t, this, e);
109
+ }
110
+ },
111
+ X = class extends m {
112
+ constructor(t, e, s) {
113
+ super(t, e), (this.expressions = s);
114
+ }
115
+ visit(t, e = null) {
116
+ return t.visitChain(this, e);
117
+ }
118
+ },
119
+ tt = class extends m {
120
+ constructor(t, e, s, i, n) {
121
+ super(t, e),
122
+ (this.condition = s),
123
+ (this.trueExp = i),
124
+ (this.falseExp = n);
125
+ }
126
+ visit(t, e = null) {
127
+ return t.visitConditional(this, e);
128
+ }
129
+ },
130
+ M = class extends J {
131
+ constructor(t, e, s, i, n) {
132
+ super(t, e, s), (this.receiver = i), (this.name = n);
133
+ }
134
+ visit(t, e = null) {
135
+ return t.visitPropertyRead(this, e);
136
+ }
137
+ },
138
+ et = class extends J {
139
+ constructor(t, e, s, i, n, a) {
140
+ super(t, e, s), (this.receiver = i), (this.name = n), (this.value = a);
141
+ }
142
+ visit(t, e = null) {
143
+ return t.visitPropertyWrite(this, e);
144
+ }
145
+ },
146
+ _ = class extends J {
147
+ constructor(t, e, s, i, n) {
148
+ super(t, e, s), (this.receiver = i), (this.name = n);
149
+ }
150
+ visit(t, e = null) {
151
+ return t.visitSafePropertyRead(this, e);
152
+ }
153
+ },
154
+ st = class extends m {
155
+ constructor(t, e, s, i) {
156
+ super(t, e), (this.receiver = s), (this.key = i);
157
+ }
158
+ visit(t, e = null) {
159
+ return t.visitKeyedRead(this, e);
160
+ }
161
+ },
162
+ U = class extends m {
163
+ constructor(t, e, s, i) {
164
+ super(t, e), (this.receiver = s), (this.key = i);
165
+ }
166
+ visit(t, e = null) {
167
+ return t.visitSafeKeyedRead(this, e);
168
+ }
169
+ },
170
+ rt = class extends m {
171
+ constructor(t, e, s, i, n) {
172
+ super(t, e), (this.receiver = s), (this.key = i), (this.value = n);
173
+ }
174
+ visit(t, e = null) {
175
+ return t.visitKeyedWrite(this, e);
176
+ }
177
+ },
178
+ it = class extends J {
179
+ constructor(t, e, s, i, n, a) {
180
+ super(t, e, a), (this.exp = s), (this.name = i), (this.args = n);
181
+ }
182
+ visit(t, e = null) {
183
+ return t.visitPipe(this, e);
184
+ }
185
+ },
186
+ E = class extends m {
187
+ constructor(t, e, s) {
188
+ super(t, e), (this.value = s);
189
+ }
190
+ visit(t, e = null) {
191
+ return t.visitLiteralPrimitive(this, e);
192
+ }
193
+ },
194
+ nt = class extends m {
195
+ constructor(t, e, s) {
196
+ super(t, e), (this.expressions = s);
197
+ }
198
+ visit(t, e = null) {
199
+ return t.visitLiteralArray(this, e);
200
+ }
201
+ },
202
+ at = class extends m {
203
+ constructor(t, e, s, i) {
204
+ super(t, e), (this.keys = s), (this.values = i);
205
+ }
206
+ visit(t, e = null) {
207
+ return t.visitLiteralMap(this, e);
208
+ }
209
+ },
210
+ ot = class extends m {
211
+ constructor(t, e, s, i) {
212
+ super(t, e), (this.strings = s), (this.expressions = i);
213
+ }
214
+ visit(t, e = null) {
215
+ return t.visitInterpolation(this, e);
216
+ }
217
+ },
218
+ A = class extends m {
219
+ constructor(t, e, s, i, n) {
220
+ super(t, e), (this.operation = s), (this.left = i), (this.right = n);
221
+ }
222
+ visit(t, e = null) {
223
+ return t.visitBinary(this, e);
224
+ }
225
+ },
226
+ F = class r extends A {
227
+ static createMinus(t, e, s) {
228
+ return new r(t, e, "-", s, "-", new E(t, e, 0), s);
229
+ }
230
+ static createPlus(t, e, s) {
231
+ return new r(t, e, "+", s, "-", s, new E(t, e, 0));
232
+ }
233
+ constructor(t, e, s, i, n, a, o) {
234
+ super(t, e, n, a, o),
235
+ (this.operator = s),
236
+ (this.expr = i),
237
+ (this.left = null),
238
+ (this.right = null),
239
+ (this.operation = null);
240
+ }
241
+ visit(t, e = null) {
242
+ return t.visitUnary !== void 0
243
+ ? t.visitUnary(this, e)
244
+ : t.visitBinary(this, e);
245
+ }
246
+ },
247
+ ct = class extends m {
248
+ constructor(t, e, s) {
249
+ super(t, e), (this.expression = s);
250
+ }
251
+ visit(t, e = null) {
252
+ return t.visitPrefixNot(this, e);
253
+ }
254
+ },
255
+ ht = class extends m {
256
+ constructor(t, e, s) {
257
+ super(t, e), (this.expression = s);
258
+ }
259
+ visit(t, e = null) {
260
+ return t.visitNonNullAssert(this, e);
261
+ }
262
+ },
263
+ pt = class extends m {
264
+ constructor(t, e, s, i, n) {
265
+ super(t, e),
266
+ (this.receiver = s),
267
+ (this.args = i),
268
+ (this.argumentSpan = n);
269
+ }
270
+ visit(t, e = null) {
271
+ return t.visitCall(this, e);
272
+ }
273
+ },
274
+ D = class extends m {
275
+ constructor(t, e, s, i, n) {
276
+ super(t, e),
277
+ (this.receiver = s),
278
+ (this.args = i),
279
+ (this.argumentSpan = n);
280
+ }
281
+ visit(t, e = null) {
282
+ return t.visitSafeCall(this, e);
283
+ }
284
+ },
285
+ L = class {
286
+ constructor(t, e) {
287
+ (this.start = t), (this.end = e);
288
+ }
289
+ },
290
+ R = class extends m {
291
+ constructor(t, e, s, i, n) {
292
+ super(
293
+ new b(0, e === null ? 0 : e.length),
294
+ new L(i, e === null ? i : i + e.length),
295
+ ),
296
+ (this.ast = t),
297
+ (this.source = e),
298
+ (this.location = s),
299
+ (this.errors = n);
300
+ }
301
+ visit(t, e = null) {
302
+ return t.visitASTWithSource
303
+ ? t.visitASTWithSource(this, e)
304
+ : this.ast.visit(t, e);
305
+ }
306
+ toString() {
307
+ return `${this.source} in ${this.location}`;
308
+ }
309
+ },
310
+ W = class {
311
+ constructor(t, e, s) {
312
+ (this.sourceSpan = t), (this.key = e), (this.value = s);
313
+ }
314
+ },
315
+ ut = class {
316
+ constructor(t, e, s) {
317
+ (this.sourceSpan = t), (this.key = e), (this.value = s);
318
+ }
319
+ },
320
+ Rt = class {
321
+ visit(t, e) {
322
+ t.visit(this, e);
323
+ }
324
+ visitUnary(t, e) {
325
+ this.visit(t.expr, e);
326
+ }
327
+ visitBinary(t, e) {
328
+ this.visit(t.left, e), this.visit(t.right, e);
329
+ }
330
+ visitChain(t, e) {
331
+ this.visitAll(t.expressions, e);
332
+ }
333
+ visitConditional(t, e) {
334
+ this.visit(t.condition, e),
335
+ this.visit(t.trueExp, e),
336
+ this.visit(t.falseExp, e);
337
+ }
338
+ visitPipe(t, e) {
339
+ this.visit(t.exp, e), this.visitAll(t.args, e);
340
+ }
341
+ visitImplicitReceiver(t, e) {}
342
+ visitThisReceiver(t, e) {}
343
+ visitInterpolation(t, e) {
344
+ this.visitAll(t.expressions, e);
345
+ }
346
+ visitKeyedRead(t, e) {
347
+ this.visit(t.receiver, e), this.visit(t.key, e);
348
+ }
349
+ visitKeyedWrite(t, e) {
350
+ this.visit(t.receiver, e), this.visit(t.key, e), this.visit(t.value, e);
351
+ }
352
+ visitLiteralArray(t, e) {
353
+ this.visitAll(t.expressions, e);
354
+ }
355
+ visitLiteralMap(t, e) {
356
+ this.visitAll(t.values, e);
357
+ }
358
+ visitLiteralPrimitive(t, e) {}
359
+ visitPrefixNot(t, e) {
360
+ this.visit(t.expression, e);
361
+ }
362
+ visitNonNullAssert(t, e) {
363
+ this.visit(t.expression, e);
364
+ }
365
+ visitPropertyRead(t, e) {
366
+ this.visit(t.receiver, e);
367
+ }
368
+ visitPropertyWrite(t, e) {
369
+ this.visit(t.receiver, e), this.visit(t.value, e);
370
+ }
371
+ visitSafePropertyRead(t, e) {
372
+ this.visit(t.receiver, e);
373
+ }
374
+ visitSafeKeyedRead(t, e) {
375
+ this.visit(t.receiver, e), this.visit(t.key, e);
376
+ }
377
+ visitCall(t, e) {
378
+ this.visit(t.receiver, e), this.visitAll(t.args, e);
379
+ }
380
+ visitSafeCall(t, e) {
381
+ this.visit(t.receiver, e), this.visitAll(t.args, e);
382
+ }
383
+ visitAll(t, e) {
384
+ for (let s of t) this.visit(s, e);
385
+ }
386
+ };
387
+ var ce;
388
+ (function (r) {
389
+ (r[(r.DEFAULT = 0)] = "DEFAULT"),
390
+ (r[(r.LITERAL_ATTR = 1)] = "LITERAL_ATTR"),
391
+ (r[(r.ANIMATION = 2)] = "ANIMATION"),
392
+ (r[(r.TWO_WAY = 3)] = "TWO_WAY");
393
+ })(ce || (ce = {}));
394
+ var he;
395
+ (function (r) {
396
+ (r[(r.Regular = 0)] = "Regular"),
397
+ (r[(r.Animation = 1)] = "Animation"),
398
+ (r[(r.TwoWay = 2)] = "TwoWay");
399
+ })(he || (he = {}));
400
+ var pe;
401
+ (function (r) {
402
+ (r[(r.Property = 0)] = "Property"),
403
+ (r[(r.Attribute = 1)] = "Attribute"),
404
+ (r[(r.Class = 2)] = "Class"),
405
+ (r[(r.Style = 3)] = "Style"),
406
+ (r[(r.Animation = 4)] = "Animation"),
407
+ (r[(r.TwoWay = 5)] = "TwoWay");
408
+ })(pe || (pe = {}));
409
+ function ue(r) {
410
+ return (r >= 9 && r <= 32) || r == 160;
411
+ }
412
+ function B(r) {
413
+ return 48 <= r && r <= 57;
414
+ }
415
+ function le(r) {
416
+ return (r >= 97 && r <= 122) || (r >= 65 && r <= 90);
417
+ }
418
+ function Dt(r) {
419
+ return r === 39 || r === 34 || r === 96;
420
+ }
421
+ var l;
422
+ (function (r) {
423
+ (r[(r.Character = 0)] = "Character"),
424
+ (r[(r.Identifier = 1)] = "Identifier"),
425
+ (r[(r.PrivateIdentifier = 2)] = "PrivateIdentifier"),
426
+ (r[(r.Keyword = 3)] = "Keyword"),
427
+ (r[(r.String = 4)] = "String"),
428
+ (r[(r.Operator = 5)] = "Operator"),
429
+ (r[(r.Number = 6)] = "Number"),
430
+ (r[(r.Error = 7)] = "Error");
431
+ })(l || (l = {}));
432
+ var Ps = [
433
+ "var",
434
+ "let",
435
+ "as",
436
+ "null",
437
+ "undefined",
438
+ "true",
439
+ "false",
440
+ "if",
441
+ "else",
442
+ "this",
443
+ ],
444
+ yt = class {
445
+ tokenize(t) {
446
+ let e = new Vt(t),
447
+ s = [],
448
+ i = e.scanToken();
449
+ for (; i != null; ) s.push(i), (i = e.scanToken());
450
+ return s;
451
+ }
452
+ },
453
+ I = class {
454
+ constructor(t, e, s, i, n) {
455
+ (this.index = t),
456
+ (this.end = e),
457
+ (this.type = s),
458
+ (this.numValue = i),
459
+ (this.strValue = n);
460
+ }
461
+ isCharacter(t) {
462
+ return this.type == l.Character && this.numValue == t;
463
+ }
464
+ isNumber() {
465
+ return this.type == l.Number;
466
+ }
467
+ isString() {
468
+ return this.type == l.String;
469
+ }
470
+ isOperator(t) {
471
+ return this.type == l.Operator && this.strValue == t;
472
+ }
473
+ isIdentifier() {
474
+ return this.type == l.Identifier;
475
+ }
476
+ isPrivateIdentifier() {
477
+ return this.type == l.PrivateIdentifier;
478
+ }
479
+ isKeyword() {
480
+ return this.type == l.Keyword;
481
+ }
482
+ isKeywordLet() {
483
+ return this.type == l.Keyword && this.strValue == "let";
484
+ }
485
+ isKeywordAs() {
486
+ return this.type == l.Keyword && this.strValue == "as";
487
+ }
488
+ isKeywordNull() {
489
+ return this.type == l.Keyword && this.strValue == "null";
490
+ }
491
+ isKeywordUndefined() {
492
+ return this.type == l.Keyword && this.strValue == "undefined";
493
+ }
494
+ isKeywordTrue() {
495
+ return this.type == l.Keyword && this.strValue == "true";
496
+ }
497
+ isKeywordFalse() {
498
+ return this.type == l.Keyword && this.strValue == "false";
499
+ }
500
+ isKeywordThis() {
501
+ return this.type == l.Keyword && this.strValue == "this";
502
+ }
503
+ isError() {
504
+ return this.type == l.Error;
505
+ }
506
+ toNumber() {
507
+ return this.type == l.Number ? this.numValue : -1;
508
+ }
509
+ toString() {
510
+ switch (this.type) {
511
+ case l.Character:
512
+ case l.Identifier:
513
+ case l.Keyword:
514
+ case l.Operator:
515
+ case l.PrivateIdentifier:
516
+ case l.String:
517
+ case l.Error:
518
+ return this.strValue;
519
+ case l.Number:
520
+ return this.numValue.toString();
521
+ default:
522
+ return null;
523
+ }
524
+ }
525
+ };
526
+ function ge(r, t, e) {
527
+ return new I(r, t, l.Character, e, String.fromCharCode(e));
528
+ }
529
+ function bs(r, t, e) {
530
+ return new I(r, t, l.Identifier, 0, e);
531
+ }
532
+ function Ks(r, t, e) {
533
+ return new I(r, t, l.PrivateIdentifier, 0, e);
534
+ }
535
+ function Bs(r, t, e) {
536
+ return new I(r, t, l.Keyword, 0, e);
537
+ }
538
+ function Gt(r, t, e) {
539
+ return new I(r, t, l.Operator, 0, e);
540
+ }
541
+ function Ts(r, t, e) {
542
+ return new I(r, t, l.String, 0, e);
543
+ }
544
+ function Ms(r, t, e) {
545
+ return new I(r, t, l.Number, e, "");
546
+ }
547
+ function _s(r, t, e) {
548
+ return new I(r, t, l.Error, 0, e);
549
+ }
550
+ var Bt = new I(-1, -1, l.Character, 0, ""),
551
+ Vt = class {
552
+ constructor(t) {
553
+ (this.input = t),
554
+ (this.peek = 0),
555
+ (this.index = -1),
556
+ (this.length = t.length),
557
+ this.advance();
558
+ }
559
+ advance() {
560
+ this.peek =
561
+ ++this.index >= this.length ? 0 : this.input.charCodeAt(this.index);
562
+ }
563
+ scanToken() {
564
+ let t = this.input,
565
+ e = this.length,
566
+ s = this.peek,
567
+ i = this.index;
568
+ for (; s <= 32; )
569
+ if (++i >= e) {
570
+ s = 0;
571
+ break;
572
+ } else s = t.charCodeAt(i);
573
+ if (((this.peek = s), (this.index = i), i >= e)) return null;
574
+ if (me(s)) return this.scanIdentifier();
575
+ if (B(s)) return this.scanNumber(i);
576
+ let n = i;
577
+ switch (s) {
578
+ case 46:
579
+ return (
580
+ this.advance(),
581
+ B(this.peek) ? this.scanNumber(n) : ge(n, this.index, 46)
582
+ );
583
+ case 40:
584
+ case 41:
585
+ case 123:
586
+ case 125:
587
+ case 91:
588
+ case 93:
589
+ case 44:
590
+ case 58:
591
+ case 59:
592
+ return this.scanCharacter(n, s);
593
+ case 39:
594
+ case 34:
595
+ return this.scanString();
596
+ case 35:
597
+ return this.scanPrivateIdentifier();
598
+ case 43:
599
+ case 45:
600
+ case 42:
601
+ case 47:
602
+ case 37:
603
+ case 94:
604
+ return this.scanOperator(n, String.fromCharCode(s));
605
+ case 63:
606
+ return this.scanQuestion(n);
607
+ case 60:
608
+ case 62:
609
+ return this.scanComplexOperator(n, String.fromCharCode(s), 61, "=");
610
+ case 33:
611
+ case 61:
612
+ return this.scanComplexOperator(
613
+ n,
614
+ String.fromCharCode(s),
615
+ 61,
616
+ "=",
617
+ 61,
618
+ "=",
619
+ );
620
+ case 38:
621
+ return this.scanComplexOperator(n, "&", 38, "&");
622
+ case 124:
623
+ return this.scanComplexOperator(n, "|", 124, "|");
624
+ case 160:
625
+ for (; ue(this.peek); ) this.advance();
626
+ return this.scanToken();
627
+ }
628
+ return (
629
+ this.advance(),
630
+ this.error(`Unexpected character [${String.fromCharCode(s)}]`, 0)
631
+ );
632
+ }
633
+ scanCharacter(t, e) {
634
+ return this.advance(), ge(t, this.index, e);
635
+ }
636
+ scanOperator(t, e) {
637
+ return this.advance(), Gt(t, this.index, e);
638
+ }
639
+ scanComplexOperator(t, e, s, i, n, a) {
640
+ this.advance();
641
+ let o = e;
642
+ return (
643
+ this.peek == s && (this.advance(), (o += i)),
644
+ n != null && this.peek == n && (this.advance(), (o += a)),
645
+ Gt(t, this.index, o)
646
+ );
647
+ }
648
+ scanIdentifier() {
649
+ let t = this.index;
650
+ for (this.advance(); Se(this.peek); ) this.advance();
651
+ let e = this.input.substring(t, this.index);
652
+ return Ps.indexOf(e) > -1 ? Bs(t, this.index, e) : bs(t, this.index, e);
653
+ }
654
+ scanPrivateIdentifier() {
655
+ let t = this.index;
656
+ if ((this.advance(), !me(this.peek)))
657
+ return this.error("Invalid character [#]", -1);
658
+ for (; Se(this.peek); ) this.advance();
659
+ let e = this.input.substring(t, this.index);
660
+ return Ks(t, this.index, e);
661
+ }
662
+ scanNumber(t) {
663
+ let e = this.index === t,
664
+ s = !1;
665
+ for (this.advance(); ; ) {
666
+ if (!B(this.peek))
667
+ if (this.peek === 95) {
668
+ if (
669
+ !B(this.input.charCodeAt(this.index - 1)) ||
670
+ !B(this.input.charCodeAt(this.index + 1))
671
+ )
672
+ return this.error("Invalid numeric separator", 0);
673
+ s = !0;
674
+ } else if (this.peek === 46) e = !1;
675
+ else if (Us(this.peek)) {
676
+ if (
677
+ (this.advance(), Fs(this.peek) && this.advance(), !B(this.peek))
678
+ )
679
+ return this.error("Invalid exponent", -1);
680
+ e = !1;
681
+ } else break;
682
+ this.advance();
683
+ }
684
+ let i = this.input.substring(t, this.index);
685
+ s && (i = i.replace(/_/g, ""));
686
+ let n = e ? Ws(i) : parseFloat(i);
687
+ return Ms(t, this.index, n);
688
+ }
689
+ scanString() {
690
+ let t = this.index,
691
+ e = this.peek;
692
+ this.advance();
693
+ let s = "",
694
+ i = this.index,
695
+ n = this.input;
696
+ for (; this.peek != e; )
697
+ if (this.peek == 92) {
698
+ s += n.substring(i, this.index);
699
+ let o;
700
+ if ((this.advance(), this.peek == 117)) {
701
+ let p = n.substring(this.index + 1, this.index + 5);
702
+ if (/^[0-9a-f]+$/i.test(p)) o = parseInt(p, 16);
703
+ else return this.error(`Invalid unicode escape [\\u${p}]`, 0);
704
+ for (let u = 0; u < 5; u++) this.advance();
705
+ } else (o = Ds(this.peek)), this.advance();
706
+ (s += String.fromCharCode(o)), (i = this.index);
707
+ } else {
708
+ if (this.peek == 0) return this.error("Unterminated quote", 0);
709
+ this.advance();
710
+ }
711
+ let a = n.substring(i, this.index);
712
+ return this.advance(), Ts(t, this.index, s + a);
713
+ }
714
+ scanQuestion(t) {
715
+ this.advance();
716
+ let e = "?";
717
+ return (
718
+ (this.peek === 63 || this.peek === 46) &&
719
+ ((e += this.peek === 46 ? "." : "?"), this.advance()),
720
+ Gt(t, this.index, e)
721
+ );
722
+ }
723
+ error(t, e) {
724
+ let s = this.index + e;
725
+ return _s(
726
+ s,
727
+ this.index,
728
+ `Lexer Error: ${t} at column ${s} in expression [${this.input}]`,
729
+ );
730
+ }
731
+ };
732
+ function me(r) {
733
+ return (97 <= r && r <= 122) || (65 <= r && r <= 90) || r == 95 || r == 36;
734
+ }
735
+ function Se(r) {
736
+ return le(r) || B(r) || r == 95 || r == 36;
737
+ }
738
+ function Us(r) {
739
+ return r == 101 || r == 69;
740
+ }
741
+ function Fs(r) {
742
+ return r == 45 || r == 43;
743
+ }
744
+ function Ds(r) {
745
+ switch (r) {
746
+ case 110:
747
+ return 10;
748
+ case 102:
749
+ return 12;
750
+ case 114:
751
+ return 13;
752
+ case 116:
753
+ return 9;
754
+ case 118:
755
+ return 11;
756
+ default:
757
+ return r;
758
+ }
759
+ }
760
+ function Ws(r) {
761
+ let t = parseInt(r);
762
+ if (isNaN(t)) throw new Error("Invalid integer literal when parsing " + r);
763
+ return t;
764
+ }
765
+ var Gs = [/@/, /^\s*$/, /[<>]/, /^[{}]$/, /&(#|[a-z])/i, /^\/\//];
766
+ function Ee(r, t) {
767
+ if (t != null && !(Array.isArray(t) && t.length == 2))
768
+ throw new Error(`Expected '${r}' to be an array, [start, end].`);
769
+ if (t != null) {
770
+ let e = t[0],
771
+ s = t[1];
772
+ Gs.forEach((i) => {
773
+ if (i.test(e) || i.test(s))
774
+ throw new Error(
775
+ `['${e}', '${s}'] contains unusable interpolation symbol.`,
776
+ );
777
+ });
778
+ }
779
+ }
780
+ var zt = class r {
781
+ static fromArray(t) {
782
+ return t ? (Ee("interpolation", t), new r(t[0], t[1])) : Q;
783
+ }
784
+ constructor(t, e) {
785
+ (this.start = t), (this.end = e);
786
+ }
787
+ },
788
+ Q = new zt("{{", "}}");
789
+ var qt = class {
790
+ constructor(t, e, s) {
791
+ (this.strings = t), (this.expressions = e), (this.offsets = s);
792
+ }
793
+ },
794
+ Ht = class {
795
+ constructor(t, e, s) {
796
+ (this.templateBindings = t), (this.warnings = e), (this.errors = s);
797
+ }
798
+ },
799
+ mt = class {
800
+ constructor(t) {
801
+ (this._lexer = t), (this.errors = []);
802
+ }
803
+ parseAction(t, e, s, i = Q) {
804
+ this._checkNoInterpolation(t, e, i);
805
+ let n = this._stripComments(t),
806
+ a = this._lexer.tokenize(n),
807
+ o = new z(t, e, s, a, 1, this.errors, 0).parseChain();
808
+ return new R(o, t, e, s, this.errors);
809
+ }
810
+ parseBinding(t, e, s, i = Q) {
811
+ let n = this._parseBindingAst(t, e, s, i);
812
+ return new R(n, t, e, s, this.errors);
813
+ }
814
+ checkSimpleExpression(t) {
815
+ let e = new jt();
816
+ return t.visit(e), e.errors;
817
+ }
818
+ parseSimpleBinding(t, e, s, i = Q) {
819
+ let n = this._parseBindingAst(t, e, s, i),
820
+ a = this.checkSimpleExpression(n);
821
+ return (
822
+ a.length > 0 &&
823
+ this._reportError(
824
+ `Host binding expression cannot contain ${a.join(" ")}`,
825
+ t,
826
+ e,
827
+ ),
828
+ new R(n, t, e, s, this.errors)
829
+ );
830
+ }
831
+ _reportError(t, e, s, i) {
832
+ this.errors.push(new Z(t, e, s, i));
833
+ }
834
+ _parseBindingAst(t, e, s, i) {
835
+ this._checkNoInterpolation(t, e, i);
836
+ let n = this._stripComments(t),
837
+ a = this._lexer.tokenize(n);
838
+ return new z(t, e, s, a, 0, this.errors, 0).parseChain();
839
+ }
840
+ parseTemplateBindings(t, e, s, i, n) {
841
+ let a = this._lexer.tokenize(e);
842
+ return new z(e, s, n, a, 0, this.errors, 0).parseTemplateBindings({
843
+ source: t,
844
+ span: new L(i, i + t.length),
845
+ });
846
+ }
847
+ parseInterpolation(t, e, s, i, n = Q) {
848
+ let {
849
+ strings: a,
850
+ expressions: o,
851
+ offsets: p,
852
+ } = this.splitInterpolation(t, e, i, n);
853
+ if (o.length === 0) return null;
854
+ let u = [];
855
+ for (let f = 0; f < o.length; ++f) {
856
+ let S = o[f].text,
857
+ g = this._stripComments(S),
858
+ y = this._lexer.tokenize(g),
859
+ w = new z(t, e, s, y, 0, this.errors, p[f]).parseChain();
860
+ u.push(w);
861
+ }
862
+ return this.createInterpolationAst(
863
+ a.map((f) => f.text),
864
+ u,
865
+ t,
866
+ e,
867
+ s,
868
+ );
869
+ }
870
+ parseInterpolationExpression(t, e, s) {
871
+ let i = this._stripComments(t),
872
+ n = this._lexer.tokenize(i),
873
+ a = new z(t, e, s, n, 0, this.errors, 0).parseChain(),
874
+ o = ["", ""];
875
+ return this.createInterpolationAst(o, [a], t, e, s);
876
+ }
877
+ createInterpolationAst(t, e, s, i, n) {
878
+ let a = new b(0, s.length),
879
+ o = new ot(a, a.toAbsolute(n), t, e);
880
+ return new R(o, s, i, n, this.errors);
881
+ }
882
+ splitInterpolation(t, e, s, i = Q) {
883
+ let n = [],
884
+ a = [],
885
+ o = [],
886
+ p = s ? Vs(s) : null,
887
+ u = 0,
888
+ f = !1,
889
+ S = !1,
890
+ { start: g, end: y } = i;
891
+ for (; u < t.length; )
892
+ if (f) {
893
+ let w = u,
894
+ H = w + g.length,
895
+ j = this._getInterpolationEndIndex(t, y, H);
896
+ if (j === -1) {
897
+ (f = !1), (S = !0);
898
+ break;
899
+ }
900
+ let T = j + y.length,
901
+ Nt = t.substring(H, j);
902
+ Nt.trim().length === 0 &&
903
+ this._reportError(
904
+ "Blank expressions are not allowed in interpolated strings",
905
+ t,
906
+ `at column ${u} in`,
907
+ e,
908
+ ),
909
+ a.push({ text: Nt, start: w, end: T });
910
+ let Ze = ((p == null ? void 0 : p.get(w)) ?? w) + g.length;
911
+ o.push(Ze), (u = T), (f = !1);
912
+ } else {
913
+ let w = u;
914
+ (u = t.indexOf(g, u)), u === -1 && (u = t.length);
915
+ let H = t.substring(w, u);
916
+ n.push({ text: H, start: w, end: u }), (f = !0);
917
+ }
918
+ if (!f)
919
+ if (S) {
920
+ let w = n[n.length - 1];
921
+ (w.text += t.substring(u)), (w.end = t.length);
922
+ } else n.push({ text: t.substring(u), start: u, end: t.length });
923
+ return new qt(n, a, o);
924
+ }
925
+ wrapLiteralPrimitive(t, e, s) {
926
+ let i = new b(0, t == null ? 0 : t.length);
927
+ return new R(new E(i, i.toAbsolute(s), t), t, e, s, this.errors);
928
+ }
929
+ _stripComments(t) {
930
+ let e = this._commentStart(t);
931
+ return e != null ? t.substring(0, e) : t;
932
+ }
933
+ _commentStart(t) {
934
+ let e = null;
935
+ for (let s = 0; s < t.length - 1; s++) {
936
+ let i = t.charCodeAt(s),
937
+ n = t.charCodeAt(s + 1);
938
+ if (i === 47 && n == 47 && e == null) return s;
939
+ e === i ? (e = null) : e == null && Dt(i) && (e = i);
940
+ }
941
+ return null;
942
+ }
943
+ _checkNoInterpolation(t, e, { start: s, end: i }) {
944
+ let n = -1,
945
+ a = -1;
946
+ for (let o of this._forEachUnquotedChar(t, 0))
947
+ if (n === -1) t.startsWith(s) && (n = o);
948
+ else if (((a = this._getInterpolationEndIndex(t, i, o)), a > -1))
949
+ break;
950
+ n > -1 &&
951
+ a > -1 &&
952
+ this._reportError(
953
+ `Got interpolation (${s}${i}) where expression was expected`,
954
+ t,
955
+ `at column ${n} in`,
956
+ e,
957
+ );
958
+ }
959
+ _getInterpolationEndIndex(t, e, s) {
960
+ for (let i of this._forEachUnquotedChar(t, s)) {
961
+ if (t.startsWith(e, i)) return i;
962
+ if (t.startsWith("//", i)) return t.indexOf(e, i);
963
+ }
964
+ return -1;
965
+ }
966
+ *_forEachUnquotedChar(t, e) {
967
+ let s = null,
968
+ i = 0;
969
+ for (let n = e; n < t.length; n++) {
970
+ let a = t[n];
971
+ Dt(t.charCodeAt(n)) && (s === null || s === a) && i % 2 === 0
972
+ ? (s = s === null ? a : null)
973
+ : s === null && (yield n),
974
+ (i = a === "\\" ? i + 1 : 0);
975
+ }
976
+ }
977
+ },
978
+ gt;
979
+ (function (r) {
980
+ (r[(r.None = 0)] = "None"), (r[(r.Writable = 1)] = "Writable");
981
+ })(gt || (gt = {}));
982
+ var z = class {
983
+ constructor(t, e, s, i, n, a, o) {
984
+ (this.input = t),
985
+ (this.location = e),
986
+ (this.absoluteOffset = s),
987
+ (this.tokens = i),
988
+ (this.parseFlags = n),
989
+ (this.errors = a),
990
+ (this.offset = o),
991
+ (this.rparensExpected = 0),
992
+ (this.rbracketsExpected = 0),
993
+ (this.rbracesExpected = 0),
994
+ (this.context = gt.None),
995
+ (this.sourceSpanCache = new Map()),
996
+ (this.index = 0);
997
+ }
998
+ peek(t) {
999
+ let e = this.index + t;
1000
+ return e < this.tokens.length ? this.tokens[e] : Bt;
1001
+ }
1002
+ get next() {
1003
+ return this.peek(0);
1004
+ }
1005
+ get atEOF() {
1006
+ return this.index >= this.tokens.length;
1007
+ }
1008
+ get inputIndex() {
1009
+ return this.atEOF
1010
+ ? this.currentEndIndex
1011
+ : this.next.index + this.offset;
1012
+ }
1013
+ get currentEndIndex() {
1014
+ return this.index > 0
1015
+ ? this.peek(-1).end + this.offset
1016
+ : this.tokens.length === 0
1017
+ ? this.input.length + this.offset
1018
+ : this.next.index + this.offset;
1019
+ }
1020
+ get currentAbsoluteOffset() {
1021
+ return this.absoluteOffset + this.inputIndex;
1022
+ }
1023
+ span(t, e) {
1024
+ let s = this.currentEndIndex;
1025
+ if ((e !== void 0 && e > this.currentEndIndex && (s = e), t > s)) {
1026
+ let i = s;
1027
+ (s = t), (t = i);
1028
+ }
1029
+ return new b(t, s);
1030
+ }
1031
+ sourceSpan(t, e) {
1032
+ let s = `${t}@${this.inputIndex}:${e}`;
1033
+ return (
1034
+ this.sourceSpanCache.has(s) ||
1035
+ this.sourceSpanCache.set(
1036
+ s,
1037
+ this.span(t, e).toAbsolute(this.absoluteOffset),
1038
+ ),
1039
+ this.sourceSpanCache.get(s)
1040
+ );
1041
+ }
1042
+ advance() {
1043
+ this.index++;
1044
+ }
1045
+ withContext(t, e) {
1046
+ this.context |= t;
1047
+ let s = e();
1048
+ return (this.context ^= t), s;
1049
+ }
1050
+ consumeOptionalCharacter(t) {
1051
+ return this.next.isCharacter(t) ? (this.advance(), !0) : !1;
1052
+ }
1053
+ peekKeywordLet() {
1054
+ return this.next.isKeywordLet();
1055
+ }
1056
+ peekKeywordAs() {
1057
+ return this.next.isKeywordAs();
1058
+ }
1059
+ expectCharacter(t) {
1060
+ this.consumeOptionalCharacter(t) ||
1061
+ this.error(`Missing expected ${String.fromCharCode(t)}`);
1062
+ }
1063
+ consumeOptionalOperator(t) {
1064
+ return this.next.isOperator(t) ? (this.advance(), !0) : !1;
1065
+ }
1066
+ expectOperator(t) {
1067
+ this.consumeOptionalOperator(t) ||
1068
+ this.error(`Missing expected operator ${t}`);
1069
+ }
1070
+ prettyPrintToken(t) {
1071
+ return t === Bt ? "end of input" : `token ${t}`;
1072
+ }
1073
+ expectIdentifierOrKeyword() {
1074
+ let t = this.next;
1075
+ return !t.isIdentifier() && !t.isKeyword()
1076
+ ? (t.isPrivateIdentifier()
1077
+ ? this._reportErrorForPrivateIdentifier(
1078
+ t,
1079
+ "expected identifier or keyword",
1080
+ )
1081
+ : this.error(
1082
+ `Unexpected ${this.prettyPrintToken(t)}, expected identifier or keyword`,
1083
+ ),
1084
+ null)
1085
+ : (this.advance(), t.toString());
1086
+ }
1087
+ expectIdentifierOrKeywordOrString() {
1088
+ let t = this.next;
1089
+ return !t.isIdentifier() && !t.isKeyword() && !t.isString()
1090
+ ? (t.isPrivateIdentifier()
1091
+ ? this._reportErrorForPrivateIdentifier(
1092
+ t,
1093
+ "expected identifier, keyword or string",
1094
+ )
1095
+ : this.error(
1096
+ `Unexpected ${this.prettyPrintToken(t)}, expected identifier, keyword, or string`,
1097
+ ),
1098
+ "")
1099
+ : (this.advance(), t.toString());
1100
+ }
1101
+ parseChain() {
1102
+ let t = [],
1103
+ e = this.inputIndex;
1104
+ for (; this.index < this.tokens.length; ) {
1105
+ let s = this.parsePipe();
1106
+ if ((t.push(s), this.consumeOptionalCharacter(59)))
1107
+ for (
1108
+ this.parseFlags & 1 ||
1109
+ this.error(
1110
+ "Binding expression cannot contain chained expression",
1111
+ );
1112
+ this.consumeOptionalCharacter(59);
1113
+
1114
+ );
1115
+ else if (this.index < this.tokens.length) {
1116
+ let i = this.index;
1117
+ if (
1118
+ (this.error(`Unexpected token '${this.next}'`), this.index === i)
1119
+ )
1120
+ break;
1121
+ }
1122
+ }
1123
+ if (t.length === 0) {
1124
+ let s = this.offset,
1125
+ i = this.offset + this.input.length;
1126
+ return new $(this.span(s, i), this.sourceSpan(s, i));
1127
+ }
1128
+ return t.length == 1
1129
+ ? t[0]
1130
+ : new X(this.span(e), this.sourceSpan(e), t);
1131
+ }
1132
+ parsePipe() {
1133
+ let t = this.inputIndex,
1134
+ e = this.parseExpression();
1135
+ if (this.consumeOptionalOperator("|")) {
1136
+ this.parseFlags & 1 &&
1137
+ this.error("Cannot have a pipe in an action expression");
1138
+ do {
1139
+ let s = this.inputIndex,
1140
+ i = this.expectIdentifierOrKeyword(),
1141
+ n,
1142
+ a;
1143
+ i !== null
1144
+ ? (n = this.sourceSpan(s))
1145
+ : ((i = ""),
1146
+ (a =
1147
+ this.next.index !== -1
1148
+ ? this.next.index
1149
+ : this.input.length + this.offset),
1150
+ (n = new b(a, a).toAbsolute(this.absoluteOffset)));
1151
+ let o = [];
1152
+ for (; this.consumeOptionalCharacter(58); )
1153
+ o.push(this.parseExpression());
1154
+ e = new it(this.span(t), this.sourceSpan(t, a), e, i, o, n);
1155
+ } while (this.consumeOptionalOperator("|"));
1156
+ }
1157
+ return e;
1158
+ }
1159
+ parseExpression() {
1160
+ return this.parseConditional();
1161
+ }
1162
+ parseConditional() {
1163
+ let t = this.inputIndex,
1164
+ e = this.parseLogicalOr();
1165
+ if (this.consumeOptionalOperator("?")) {
1166
+ let s = this.parsePipe(),
1167
+ i;
1168
+ if (this.consumeOptionalCharacter(58)) i = this.parsePipe();
1169
+ else {
1170
+ let n = this.inputIndex,
1171
+ a = this.input.substring(t, n);
1172
+ this.error(
1173
+ `Conditional expression ${a} requires all 3 expressions`,
1174
+ ),
1175
+ (i = new $(this.span(t), this.sourceSpan(t)));
1176
+ }
1177
+ return new tt(this.span(t), this.sourceSpan(t), e, s, i);
1178
+ } else return e;
1179
+ }
1180
+ parseLogicalOr() {
1181
+ let t = this.inputIndex,
1182
+ e = this.parseLogicalAnd();
1183
+ for (; this.consumeOptionalOperator("||"); ) {
1184
+ let s = this.parseLogicalAnd();
1185
+ e = new A(this.span(t), this.sourceSpan(t), "||", e, s);
1186
+ }
1187
+ return e;
1188
+ }
1189
+ parseLogicalAnd() {
1190
+ let t = this.inputIndex,
1191
+ e = this.parseNullishCoalescing();
1192
+ for (; this.consumeOptionalOperator("&&"); ) {
1193
+ let s = this.parseNullishCoalescing();
1194
+ e = new A(this.span(t), this.sourceSpan(t), "&&", e, s);
1195
+ }
1196
+ return e;
1197
+ }
1198
+ parseNullishCoalescing() {
1199
+ let t = this.inputIndex,
1200
+ e = this.parseEquality();
1201
+ for (; this.consumeOptionalOperator("??"); ) {
1202
+ let s = this.parseEquality();
1203
+ e = new A(this.span(t), this.sourceSpan(t), "??", e, s);
1204
+ }
1205
+ return e;
1206
+ }
1207
+ parseEquality() {
1208
+ let t = this.inputIndex,
1209
+ e = this.parseRelational();
1210
+ for (; this.next.type == l.Operator; ) {
1211
+ let s = this.next.strValue;
1212
+ switch (s) {
1213
+ case "==":
1214
+ case "===":
1215
+ case "!=":
1216
+ case "!==":
1217
+ this.advance();
1218
+ let i = this.parseRelational();
1219
+ e = new A(this.span(t), this.sourceSpan(t), s, e, i);
1220
+ continue;
1221
+ }
1222
+ break;
1223
+ }
1224
+ return e;
1225
+ }
1226
+ parseRelational() {
1227
+ let t = this.inputIndex,
1228
+ e = this.parseAdditive();
1229
+ for (; this.next.type == l.Operator; ) {
1230
+ let s = this.next.strValue;
1231
+ switch (s) {
1232
+ case "<":
1233
+ case ">":
1234
+ case "<=":
1235
+ case ">=":
1236
+ this.advance();
1237
+ let i = this.parseAdditive();
1238
+ e = new A(this.span(t), this.sourceSpan(t), s, e, i);
1239
+ continue;
1240
+ }
1241
+ break;
1242
+ }
1243
+ return e;
1244
+ }
1245
+ parseAdditive() {
1246
+ let t = this.inputIndex,
1247
+ e = this.parseMultiplicative();
1248
+ for (; this.next.type == l.Operator; ) {
1249
+ let s = this.next.strValue;
1250
+ switch (s) {
1251
+ case "+":
1252
+ case "-":
1253
+ this.advance();
1254
+ let i = this.parseMultiplicative();
1255
+ e = new A(this.span(t), this.sourceSpan(t), s, e, i);
1256
+ continue;
1257
+ }
1258
+ break;
1259
+ }
1260
+ return e;
1261
+ }
1262
+ parseMultiplicative() {
1263
+ let t = this.inputIndex,
1264
+ e = this.parsePrefix();
1265
+ for (; this.next.type == l.Operator; ) {
1266
+ let s = this.next.strValue;
1267
+ switch (s) {
1268
+ case "*":
1269
+ case "%":
1270
+ case "/":
1271
+ this.advance();
1272
+ let i = this.parsePrefix();
1273
+ e = new A(this.span(t), this.sourceSpan(t), s, e, i);
1274
+ continue;
1275
+ }
1276
+ break;
1277
+ }
1278
+ return e;
1279
+ }
1280
+ parsePrefix() {
1281
+ if (this.next.type == l.Operator) {
1282
+ let t = this.inputIndex,
1283
+ e = this.next.strValue,
1284
+ s;
1285
+ switch (e) {
1286
+ case "+":
1287
+ return (
1288
+ this.advance(),
1289
+ (s = this.parsePrefix()),
1290
+ F.createPlus(this.span(t), this.sourceSpan(t), s)
1291
+ );
1292
+ case "-":
1293
+ return (
1294
+ this.advance(),
1295
+ (s = this.parsePrefix()),
1296
+ F.createMinus(this.span(t), this.sourceSpan(t), s)
1297
+ );
1298
+ case "!":
1299
+ return (
1300
+ this.advance(),
1301
+ (s = this.parsePrefix()),
1302
+ new ct(this.span(t), this.sourceSpan(t), s)
1303
+ );
1304
+ }
1305
+ }
1306
+ return this.parseCallChain();
1307
+ }
1308
+ parseCallChain() {
1309
+ let t = this.inputIndex,
1310
+ e = this.parsePrimary();
1311
+ for (;;)
1312
+ if (this.consumeOptionalCharacter(46))
1313
+ e = this.parseAccessMember(e, t, !1);
1314
+ else if (this.consumeOptionalOperator("?."))
1315
+ this.consumeOptionalCharacter(40)
1316
+ ? (e = this.parseCall(e, t, !0))
1317
+ : (e = this.consumeOptionalCharacter(91)
1318
+ ? this.parseKeyedReadOrWrite(e, t, !0)
1319
+ : this.parseAccessMember(e, t, !0));
1320
+ else if (this.consumeOptionalCharacter(91))
1321
+ e = this.parseKeyedReadOrWrite(e, t, !1);
1322
+ else if (this.consumeOptionalCharacter(40))
1323
+ e = this.parseCall(e, t, !1);
1324
+ else if (this.consumeOptionalOperator("!"))
1325
+ e = new ht(this.span(t), this.sourceSpan(t), e);
1326
+ else return e;
1327
+ }
1328
+ parsePrimary() {
1329
+ let t = this.inputIndex;
1330
+ if (this.consumeOptionalCharacter(40)) {
1331
+ this.rparensExpected++;
1332
+ let e = this.parsePipe();
1333
+ return this.rparensExpected--, this.expectCharacter(41), e;
1334
+ } else {
1335
+ if (this.next.isKeywordNull())
1336
+ return (
1337
+ this.advance(), new E(this.span(t), this.sourceSpan(t), null)
1338
+ );
1339
+ if (this.next.isKeywordUndefined())
1340
+ return (
1341
+ this.advance(), new E(this.span(t), this.sourceSpan(t), void 0)
1342
+ );
1343
+ if (this.next.isKeywordTrue())
1344
+ return this.advance(), new E(this.span(t), this.sourceSpan(t), !0);
1345
+ if (this.next.isKeywordFalse())
1346
+ return this.advance(), new E(this.span(t), this.sourceSpan(t), !1);
1347
+ if (this.next.isKeywordThis())
1348
+ return this.advance(), new Lt(this.span(t), this.sourceSpan(t));
1349
+ if (this.consumeOptionalCharacter(91)) {
1350
+ this.rbracketsExpected++;
1351
+ let e = this.parseExpressionList(93);
1352
+ return (
1353
+ this.rbracketsExpected--,
1354
+ this.expectCharacter(93),
1355
+ new nt(this.span(t), this.sourceSpan(t), e)
1356
+ );
1357
+ } else {
1358
+ if (this.next.isCharacter(123)) return this.parseLiteralMap();
1359
+ if (this.next.isIdentifier())
1360
+ return this.parseAccessMember(
1361
+ new K(this.span(t), this.sourceSpan(t)),
1362
+ t,
1363
+ !1,
1364
+ );
1365
+ if (this.next.isNumber()) {
1366
+ let e = this.next.toNumber();
1367
+ return this.advance(), new E(this.span(t), this.sourceSpan(t), e);
1368
+ } else if (this.next.isString()) {
1369
+ let e = this.next.toString();
1370
+ return this.advance(), new E(this.span(t), this.sourceSpan(t), e);
1371
+ } else
1372
+ return this.next.isPrivateIdentifier()
1373
+ ? (this._reportErrorForPrivateIdentifier(this.next, null),
1374
+ new $(this.span(t), this.sourceSpan(t)))
1375
+ : this.index >= this.tokens.length
1376
+ ? (this.error(`Unexpected end of expression: ${this.input}`),
1377
+ new $(this.span(t), this.sourceSpan(t)))
1378
+ : (this.error(`Unexpected token ${this.next}`),
1379
+ new $(this.span(t), this.sourceSpan(t)));
1380
+ }
1381
+ }
1382
+ }
1383
+ parseExpressionList(t) {
1384
+ let e = [];
1385
+ do
1386
+ if (!this.next.isCharacter(t)) e.push(this.parsePipe());
1387
+ else break;
1388
+ while (this.consumeOptionalCharacter(44));
1389
+ return e;
1390
+ }
1391
+ parseLiteralMap() {
1392
+ let t = [],
1393
+ e = [],
1394
+ s = this.inputIndex;
1395
+ if ((this.expectCharacter(123), !this.consumeOptionalCharacter(125))) {
1396
+ this.rbracesExpected++;
1397
+ do {
1398
+ let i = this.inputIndex,
1399
+ n = this.next.isString(),
1400
+ a = this.expectIdentifierOrKeywordOrString(),
1401
+ o = { key: a, quoted: n };
1402
+ if ((t.push(o), n))
1403
+ this.expectCharacter(58), e.push(this.parsePipe());
1404
+ else if (this.consumeOptionalCharacter(58))
1405
+ e.push(this.parsePipe());
1406
+ else {
1407
+ o.isShorthandInitialized = !0;
1408
+ let p = this.span(i),
1409
+ u = this.sourceSpan(i);
1410
+ e.push(new M(p, u, u, new K(p, u), a));
1411
+ }
1412
+ } while (
1413
+ this.consumeOptionalCharacter(44) &&
1414
+ !this.next.isCharacter(125)
1415
+ );
1416
+ this.rbracesExpected--, this.expectCharacter(125);
1417
+ }
1418
+ return new at(this.span(s), this.sourceSpan(s), t, e);
1419
+ }
1420
+ parseAccessMember(t, e, s) {
1421
+ let i = this.inputIndex,
1422
+ n = this.withContext(gt.Writable, () => {
1423
+ let p = this.expectIdentifierOrKeyword() ?? "";
1424
+ return (
1425
+ p.length === 0 &&
1426
+ this.error(
1427
+ "Expected identifier for property access",
1428
+ t.span.end,
1429
+ ),
1430
+ p
1431
+ );
1432
+ }),
1433
+ a = this.sourceSpan(i),
1434
+ o;
1435
+ if (s)
1436
+ this.consumeOptionalOperator("=")
1437
+ ? (this.error("The '?.' operator cannot be used in the assignment"),
1438
+ (o = new $(this.span(e), this.sourceSpan(e))))
1439
+ : (o = new _(this.span(e), this.sourceSpan(e), a, t, n));
1440
+ else if (this.consumeOptionalOperator("=")) {
1441
+ if (!(this.parseFlags & 1))
1442
+ return (
1443
+ this.error("Bindings cannot contain assignments"),
1444
+ new $(this.span(e), this.sourceSpan(e))
1445
+ );
1446
+ let p = this.parseConditional();
1447
+ o = new et(this.span(e), this.sourceSpan(e), a, t, n, p);
1448
+ } else o = new M(this.span(e), this.sourceSpan(e), a, t, n);
1449
+ return o;
1450
+ }
1451
+ parseCall(t, e, s) {
1452
+ let i = this.inputIndex;
1453
+ this.rparensExpected++;
1454
+ let n = this.parseCallArguments(),
1455
+ a = this.span(i, this.inputIndex).toAbsolute(this.absoluteOffset);
1456
+ this.expectCharacter(41), this.rparensExpected--;
1457
+ let o = this.span(e),
1458
+ p = this.sourceSpan(e);
1459
+ return s ? new D(o, p, t, n, a) : new pt(o, p, t, n, a);
1460
+ }
1461
+ parseCallArguments() {
1462
+ if (this.next.isCharacter(41)) return [];
1463
+ let t = [];
1464
+ do t.push(this.parsePipe());
1465
+ while (this.consumeOptionalCharacter(44));
1466
+ return t;
1467
+ }
1468
+ expectTemplateBindingKey() {
1469
+ let t = "",
1470
+ e = !1,
1471
+ s = this.currentAbsoluteOffset;
1472
+ do
1473
+ (t += this.expectIdentifierOrKeywordOrString()),
1474
+ (e = this.consumeOptionalOperator("-")),
1475
+ e && (t += "-");
1476
+ while (e);
1477
+ return { source: t, span: new L(s, s + t.length) };
1478
+ }
1479
+ parseTemplateBindings(t) {
1480
+ let e = [];
1481
+ for (
1482
+ e.push(...this.parseDirectiveKeywordBindings(t));
1483
+ this.index < this.tokens.length;
1484
+
1485
+ ) {
1486
+ let s = this.parseLetBinding();
1487
+ if (s) e.push(s);
1488
+ else {
1489
+ let i = this.expectTemplateBindingKey(),
1490
+ n = this.parseAsBinding(i);
1491
+ n
1492
+ ? e.push(n)
1493
+ : ((i.source =
1494
+ t.source +
1495
+ i.source.charAt(0).toUpperCase() +
1496
+ i.source.substring(1)),
1497
+ e.push(...this.parseDirectiveKeywordBindings(i)));
1498
+ }
1499
+ this.consumeStatementTerminator();
1500
+ }
1501
+ return new Ht(e, [], this.errors);
1502
+ }
1503
+ parseKeyedReadOrWrite(t, e, s) {
1504
+ return this.withContext(gt.Writable, () => {
1505
+ this.rbracketsExpected++;
1506
+ let i = this.parsePipe();
1507
+ if (
1508
+ (i instanceof $ && this.error("Key access cannot be empty"),
1509
+ this.rbracketsExpected--,
1510
+ this.expectCharacter(93),
1511
+ this.consumeOptionalOperator("="))
1512
+ )
1513
+ if (s)
1514
+ this.error("The '?.' operator cannot be used in the assignment");
1515
+ else {
1516
+ let n = this.parseConditional();
1517
+ return new rt(this.span(e), this.sourceSpan(e), t, i, n);
1518
+ }
1519
+ else
1520
+ return s
1521
+ ? new U(this.span(e), this.sourceSpan(e), t, i)
1522
+ : new st(this.span(e), this.sourceSpan(e), t, i);
1523
+ return new $(this.span(e), this.sourceSpan(e));
1524
+ });
1525
+ }
1526
+ parseDirectiveKeywordBindings(t) {
1527
+ let e = [];
1528
+ this.consumeOptionalCharacter(58);
1529
+ let s = this.getDirectiveBoundTarget(),
1530
+ i = this.currentAbsoluteOffset,
1531
+ n = this.parseAsBinding(t);
1532
+ n ||
1533
+ (this.consumeStatementTerminator(), (i = this.currentAbsoluteOffset));
1534
+ let a = new L(t.span.start, i);
1535
+ return e.push(new ut(a, t, s)), n && e.push(n), e;
1536
+ }
1537
+ getDirectiveBoundTarget() {
1538
+ if (this.next === Bt || this.peekKeywordAs() || this.peekKeywordLet())
1539
+ return null;
1540
+ let t = this.parsePipe(),
1541
+ { start: e, end: s } = t.span,
1542
+ i = this.input.substring(e, s);
1543
+ return new R(t, i, this.location, this.absoluteOffset + e, this.errors);
1544
+ }
1545
+ parseAsBinding(t) {
1546
+ if (!this.peekKeywordAs()) return null;
1547
+ this.advance();
1548
+ let e = this.expectTemplateBindingKey();
1549
+ this.consumeStatementTerminator();
1550
+ let s = new L(t.span.start, this.currentAbsoluteOffset);
1551
+ return new W(s, e, t);
1552
+ }
1553
+ parseLetBinding() {
1554
+ if (!this.peekKeywordLet()) return null;
1555
+ let t = this.currentAbsoluteOffset;
1556
+ this.advance();
1557
+ let e = this.expectTemplateBindingKey(),
1558
+ s = null;
1559
+ this.consumeOptionalOperator("=") &&
1560
+ (s = this.expectTemplateBindingKey()),
1561
+ this.consumeStatementTerminator();
1562
+ let i = new L(t, this.currentAbsoluteOffset);
1563
+ return new W(i, e, s);
1564
+ }
1565
+ consumeStatementTerminator() {
1566
+ this.consumeOptionalCharacter(59) || this.consumeOptionalCharacter(44);
1567
+ }
1568
+ error(t, e = null) {
1569
+ this.errors.push(
1570
+ new Z(t, this.input, this.locationText(e), this.location),
1571
+ ),
1572
+ this.skip();
1573
+ }
1574
+ locationText(t = null) {
1575
+ return (
1576
+ t == null && (t = this.index),
1577
+ t < this.tokens.length
1578
+ ? `at column ${this.tokens[t].index + 1} in`
1579
+ : "at the end of the expression"
1580
+ );
1581
+ }
1582
+ _reportErrorForPrivateIdentifier(t, e) {
1583
+ let s = `Private identifiers are not supported. Unexpected private identifier: ${t}`;
1584
+ e !== null && (s += `, ${e}`), this.error(s);
1585
+ }
1586
+ skip() {
1587
+ let t = this.next;
1588
+ for (
1589
+ ;
1590
+ this.index < this.tokens.length &&
1591
+ !t.isCharacter(59) &&
1592
+ !t.isOperator("|") &&
1593
+ (this.rparensExpected <= 0 || !t.isCharacter(41)) &&
1594
+ (this.rbracesExpected <= 0 || !t.isCharacter(125)) &&
1595
+ (this.rbracketsExpected <= 0 || !t.isCharacter(93)) &&
1596
+ (!(this.context & gt.Writable) || !t.isOperator("="));
1597
+
1598
+ )
1599
+ this.next.isError() &&
1600
+ this.errors.push(
1601
+ new Z(
1602
+ this.next.toString(),
1603
+ this.input,
1604
+ this.locationText(),
1605
+ this.location,
1606
+ ),
1607
+ ),
1608
+ this.advance(),
1609
+ (t = this.next);
1610
+ }
1611
+ },
1612
+ jt = class extends Rt {
1613
+ constructor() {
1614
+ super(...arguments), (this.errors = []);
1615
+ }
1616
+ visitPipe() {
1617
+ this.errors.push("pipes");
1618
+ }
1619
+ };
1620
+ function Vs(r) {
1621
+ let t = new Map(),
1622
+ e = 0,
1623
+ s = 0,
1624
+ i = 0;
1625
+ for (; i < r.length; ) {
1626
+ let n = r[i];
1627
+ if (n.type === 9) {
1628
+ let [a, o] = n.parts;
1629
+ (e += o.length), (s += a.length);
1630
+ } else {
1631
+ let a = n.parts.reduce((o, p) => o + p.length, 0);
1632
+ (s += a), (e += a);
1633
+ }
1634
+ t.set(s, e), i++;
1635
+ }
1636
+ return t;
1637
+ }
1638
+ function Ce({ start: r, end: t }, e) {
1639
+ let s = r,
1640
+ i = t;
1641
+ for (; i !== s && /\s/.test(e[i - 1]); ) i--;
1642
+ for (; s !== i && /\s/.test(e[s]); ) s++;
1643
+ return { start: s, end: i };
1644
+ }
1645
+ function zs({ start: r, end: t }, e) {
1646
+ let s = r,
1647
+ i = t;
1648
+ for (; i !== e.length && /\s/.test(e[i]); ) i++;
1649
+ for (; s !== 0 && /\s/.test(e[s - 1]); ) s--;
1650
+ return { start: s, end: i };
1651
+ }
1652
+ function qs(r, t) {
1653
+ return t[r.start - 1] === "(" && t[r.end] === ")"
1654
+ ? { start: r.start - 1, end: r.end + 1 }
1655
+ : r;
1656
+ }
1657
+ function Ae(r, t, e) {
1658
+ let s = 0,
1659
+ i = { start: r.start, end: r.end };
1660
+ for (;;) {
1661
+ let n = zs(i, t),
1662
+ a = qs(n, t);
1663
+ if (n.start === a.start && n.end === a.end) break;
1664
+ (i.start = a.start), (i.end = a.end), s++;
1665
+ }
1666
+ return {
1667
+ hasParens: (e ? s - 1 : s) !== 0,
1668
+ outerSpan: Ce(e ? { start: i.start + 1, end: i.end - 1 } : i, t),
1669
+ innerSpan: Ce(r, t),
1670
+ };
1671
+ }
1672
+ function Oe(r) {
1673
+ return typeof r == "string" ? (t) => t === r : (t) => r.test(t);
1674
+ }
1675
+ function Ie(r, t, e) {
1676
+ let s = Oe(t);
1677
+ for (let i = e; i >= 0; i--) {
1678
+ let n = r[i];
1679
+ if (s(n)) return i;
1680
+ }
1681
+ throw new Error(
1682
+ `Cannot find front char ${t} from index ${e} in ${JSON.stringify(r)}`,
1683
+ );
1684
+ }
1685
+ function ke(r, t, e) {
1686
+ let s = Oe(t);
1687
+ for (let i = e; i < r.length; i++) {
1688
+ let n = r[i];
1689
+ if (s(n)) return i;
1690
+ }
1691
+ throw new Error(
1692
+ `Cannot find character ${t} from index ${e} in ${JSON.stringify(r)}`,
1693
+ );
1694
+ }
1695
+ function Ne(r) {
1696
+ return r.slice(0, 1).toLowerCase() + r.slice(1);
1697
+ }
1698
+ function Ct(r) {
1699
+ let { start: t, end: e } = r;
1700
+ return { start: t, end: e, range: [t, e] };
1701
+ }
1702
+ var Hs = (r) => mt.prototype._commentStart(r);
1703
+ function js(r, t) {
1704
+ let e = t ? Hs(r) : null;
1705
+ if (e === null) return { text: r, comments: [] };
1706
+ let s = {
1707
+ type: "CommentLine",
1708
+ value: r.slice(e + 2),
1709
+ ...Ct({ start: e, end: r.length }),
1710
+ };
1711
+ return { text: r.slice(0, e), comments: [s] };
1712
+ }
1713
+ function At(r, t = !0) {
1714
+ return (e) => {
1715
+ let s = new yt(),
1716
+ i = new mt(s),
1717
+ { text: n, comments: a } = js(e, t),
1718
+ o = r(n, i);
1719
+ if (o.errors.length !== 0) {
1720
+ let [{ message: p }] = o.errors;
1721
+ throw new SyntaxError(
1722
+ p.replace(/^Parser Error: | at column \d+ in [^]*$/g, ""),
1723
+ );
1724
+ }
1725
+ return { result: o, comments: a, text: n };
1726
+ };
1727
+ }
1728
+ var Le = At((r, t) => t.parseBinding(r, "", 0)),
1729
+ Ys = At((r, t) => t.parseSimpleBinding(r, "", 0)),
1730
+ Re = At((r, t) => t.parseAction(r, "", 0)),
1731
+ Pe = At((r, t) => t.parseInterpolationExpression(r, "", 0)),
1732
+ be = At((r, t) => t.parseTemplateBindings("", r, "", 0, 0), !1);
1733
+ var Js = (r, t, e) => {
1734
+ if (!(r && t == null))
1735
+ return Array.isArray(t) || typeof t == "string"
1736
+ ? t[e < 0 ? t.length + e : e]
1737
+ : t.at(e);
1738
+ },
1739
+ Tt = Js;
1740
+ var Yt = class {
1741
+ text;
1742
+ constructor(t) {
1743
+ this.text = t;
1744
+ }
1745
+ getCharacterIndex(t, e) {
1746
+ return ke(this.text, t, e);
1747
+ }
1748
+ getCharacterLastIndex(t, e) {
1749
+ return Ie(this.text, t, e);
1750
+ }
1751
+ transformSpan(t, { stripSpaces: e = !1, hasParentParens: s = !1 } = {}) {
1752
+ if (!e) return Ct(t);
1753
+ let { outerSpan: i, innerSpan: n, hasParens: a } = Ae(t, this.text, s),
1754
+ o = Ct(n);
1755
+ return (
1756
+ a &&
1757
+ (o.extra = {
1758
+ parenthesized: !0,
1759
+ parenStart: i.start,
1760
+ parenEnd: i.end,
1761
+ }),
1762
+ o
1763
+ );
1764
+ }
1765
+ createNode(t, { stripSpaces: e = !0, hasParentParens: s = !1 } = {}) {
1766
+ let { type: i, start: n, end: a } = t,
1767
+ o = {
1768
+ ...t,
1769
+ ...this.transformSpan(
1770
+ { start: n, end: a },
1771
+ { stripSpaces: e, hasParentParens: s },
1772
+ ),
1773
+ };
1774
+ switch (i) {
1775
+ case "NumericLiteral":
1776
+ case "StringLiteral": {
1777
+ let p = this.text.slice(o.start, o.end),
1778
+ { value: u } = o;
1779
+ o.extra = { ...o.extra, raw: p, rawValue: u };
1780
+ break;
1781
+ }
1782
+ case "ObjectProperty": {
1783
+ let { shorthand: p } = o;
1784
+ p && (o.extra = { ...o.extra, shorthand: p });
1785
+ break;
1786
+ }
1787
+ }
1788
+ return o;
1789
+ }
1790
+ },
1791
+ Ke = Yt;
1792
+ function Jt(r) {
1793
+ var t;
1794
+ return !!((t = r.extra) != null && t.parenthesized);
1795
+ }
1796
+ function k(r) {
1797
+ return Jt(r) ? r.extra.parenStart : r.start;
1798
+ }
1799
+ function N(r) {
1800
+ return Jt(r) ? r.extra.parenEnd : r.end;
1801
+ }
1802
+ function Be(r) {
1803
+ return (
1804
+ (r.type === "OptionalCallExpression" ||
1805
+ r.type === "OptionalMemberExpression") &&
1806
+ !Jt(r)
1807
+ );
1808
+ }
1809
+ function Te(r, t) {
1810
+ let { start: e, end: s } = r.sourceSpan;
1811
+ return e >= s || /^\s+$/.test(t.slice(e, s));
1812
+ }
1813
+ var kt,
1814
+ St,
1815
+ h,
1816
+ d,
1817
+ Ot,
1818
+ v,
1819
+ Zt,
1820
+ It = class extends Ke {
1821
+ constructor(e, s) {
1822
+ super(s);
1823
+ P(this, h);
1824
+ P(this, kt);
1825
+ P(this, St);
1826
+ Y(this, kt, e), Y(this, St, s);
1827
+ }
1828
+ get node() {
1829
+ return c(this, h, v).call(this, O(this, kt));
1830
+ }
1831
+ transformNode(e) {
1832
+ return c(this, h, Zt).call(this, e);
1833
+ }
1834
+ };
1835
+ (kt = new WeakMap()),
1836
+ (St = new WeakMap()),
1837
+ (h = new WeakSet()),
1838
+ (d = function (e, { stripSpaces: s = !0, hasParentParens: i = !1 } = {}) {
1839
+ return this.createNode(e, { stripSpaces: s, hasParentParens: i });
1840
+ }),
1841
+ (Ot = function (
1842
+ e,
1843
+ s,
1844
+ { computed: i, optional: n, end: a = N(s), hasParentParens: o = !1 },
1845
+ ) {
1846
+ if (Te(e, O(this, St)) || e.sourceSpan.start === s.start) return s;
1847
+ let p = c(this, h, v).call(this, e),
1848
+ u = Be(p);
1849
+ return c(this, h, d).call(
1850
+ this,
1851
+ {
1852
+ type: n || u ? "OptionalMemberExpression" : "MemberExpression",
1853
+ object: p,
1854
+ property: s,
1855
+ computed: i,
1856
+ ...(n ? { optional: !0 } : u ? { optional: !1 } : void 0),
1857
+ start: k(p),
1858
+ end: a,
1859
+ },
1860
+ { hasParentParens: o },
1861
+ );
1862
+ }),
1863
+ (v = function (e, s = !1) {
1864
+ return c(this, h, Zt).call(this, e, s);
1865
+ }),
1866
+ (Zt = function (e, s = !1) {
1867
+ if (e instanceof ot) {
1868
+ let { expressions: i } = e;
1869
+ if (i.length !== 1) throw new Error("Unexpected 'Interpolation'");
1870
+ return c(this, h, v).call(this, i[0]);
1871
+ }
1872
+ if (e instanceof F)
1873
+ return c(this, h, d).call(
1874
+ this,
1875
+ {
1876
+ type: "UnaryExpression",
1877
+ prefix: !0,
1878
+ argument: c(this, h, v).call(this, e.expr),
1879
+ operator: e.operator,
1880
+ ...e.sourceSpan,
1881
+ },
1882
+ { hasParentParens: s },
1883
+ );
1884
+ if (e instanceof A) {
1885
+ let { left: i, operation: n, right: a } = e,
1886
+ o = c(this, h, v).call(this, i),
1887
+ p = c(this, h, v).call(this, a),
1888
+ u = k(o),
1889
+ f = N(p),
1890
+ S = { left: o, right: p, start: u, end: f };
1891
+ return n === "&&" || n === "||" || n === "??"
1892
+ ? c(this, h, d).call(
1893
+ this,
1894
+ { ...S, type: "LogicalExpression", operator: n },
1895
+ { hasParentParens: s },
1896
+ )
1897
+ : c(this, h, d).call(
1898
+ this,
1899
+ { ...S, type: "BinaryExpression", operator: n },
1900
+ { hasParentParens: s },
1901
+ );
1902
+ }
1903
+ if (e instanceof it) {
1904
+ let { exp: i, name: n, args: a } = e,
1905
+ o = c(this, h, v).call(this, i),
1906
+ p = k(o),
1907
+ u = N(o),
1908
+ f = this.getCharacterIndex(/\S/, this.getCharacterIndex("|", u) + 1),
1909
+ S = c(this, h, d).call(this, {
1910
+ type: "Identifier",
1911
+ name: n,
1912
+ start: f,
1913
+ end: f + n.length,
1914
+ }),
1915
+ g = a.map((y) => c(this, h, v).call(this, y));
1916
+ return c(this, h, d).call(
1917
+ this,
1918
+ {
1919
+ type: "NGPipeExpression",
1920
+ left: o,
1921
+ right: S,
1922
+ arguments: g,
1923
+ start: p,
1924
+ end: N(g.length === 0 ? S : Tt(!1, g, -1)),
1925
+ },
1926
+ { hasParentParens: s },
1927
+ );
1928
+ }
1929
+ if (e instanceof X)
1930
+ return c(this, h, d).call(
1931
+ this,
1932
+ {
1933
+ type: "NGChainedExpression",
1934
+ expressions: e.expressions.map((i) => c(this, h, v).call(this, i)),
1935
+ ...e.sourceSpan,
1936
+ },
1937
+ { hasParentParens: s },
1938
+ );
1939
+ if (e instanceof tt) {
1940
+ let { condition: i, trueExp: n, falseExp: a } = e,
1941
+ o = c(this, h, v).call(this, i),
1942
+ p = c(this, h, v).call(this, n),
1943
+ u = c(this, h, v).call(this, a);
1944
+ return c(this, h, d).call(
1945
+ this,
1946
+ {
1947
+ type: "ConditionalExpression",
1948
+ test: o,
1949
+ consequent: p,
1950
+ alternate: u,
1951
+ start: k(o),
1952
+ end: N(u),
1953
+ },
1954
+ { hasParentParens: s },
1955
+ );
1956
+ }
1957
+ if (e instanceof $)
1958
+ return c(this, h, d).call(
1959
+ this,
1960
+ { type: "NGEmptyExpression", ...e.sourceSpan },
1961
+ { hasParentParens: s },
1962
+ );
1963
+ if (e instanceof K)
1964
+ return c(this, h, d).call(
1965
+ this,
1966
+ { type: "ThisExpression", ...e.sourceSpan },
1967
+ { hasParentParens: s },
1968
+ );
1969
+ if (e instanceof st || e instanceof U)
1970
+ return c(this, h, Ot).call(
1971
+ this,
1972
+ e.receiver,
1973
+ c(this, h, v).call(this, e.key),
1974
+ {
1975
+ computed: !0,
1976
+ optional: e instanceof U,
1977
+ end: e.sourceSpan.end,
1978
+ hasParentParens: s,
1979
+ },
1980
+ );
1981
+ if (e instanceof nt)
1982
+ return c(this, h, d).call(
1983
+ this,
1984
+ {
1985
+ type: "ArrayExpression",
1986
+ elements: e.expressions.map((i) => c(this, h, v).call(this, i)),
1987
+ ...e.sourceSpan,
1988
+ },
1989
+ { hasParentParens: s },
1990
+ );
1991
+ if (e instanceof at) {
1992
+ let { keys: i, values: n } = e,
1993
+ a = n.map((p) => c(this, h, v).call(this, p)),
1994
+ o = i.map(({ key: p, quoted: u }, f) => {
1995
+ let S = a[f],
1996
+ g = k(S),
1997
+ y = N(S),
1998
+ w = this.getCharacterIndex(
1999
+ /\S/,
2000
+ f === 0
2001
+ ? e.sourceSpan.start + 1
2002
+ : this.getCharacterIndex(",", N(a[f - 1])) + 1,
2003
+ ),
2004
+ H =
2005
+ g === w
2006
+ ? y
2007
+ : this.getCharacterLastIndex(
2008
+ /\S/,
2009
+ this.getCharacterLastIndex(":", g - 1) - 1,
2010
+ ) + 1,
2011
+ j = { start: w, end: H },
2012
+ T = u
2013
+ ? c(this, h, d).call(this, {
2014
+ type: "StringLiteral",
2015
+ value: p,
2016
+ ...j,
2017
+ })
2018
+ : c(this, h, d).call(this, {
2019
+ type: "Identifier",
2020
+ name: p,
2021
+ ...j,
2022
+ }),
2023
+ Nt = T.end < T.start || w === g;
2024
+ return c(this, h, d).call(this, {
2025
+ type: "ObjectProperty",
2026
+ key: T,
2027
+ value: S,
2028
+ shorthand: Nt,
2029
+ computed: !1,
2030
+ start: k(T),
2031
+ end: y,
2032
+ });
2033
+ });
2034
+ return c(this, h, d).call(
2035
+ this,
2036
+ { type: "ObjectExpression", properties: o, ...e.sourceSpan },
2037
+ { hasParentParens: s },
2038
+ );
2039
+ }
2040
+ if (e instanceof E) {
2041
+ let { value: i } = e;
2042
+ switch (typeof i) {
2043
+ case "boolean":
2044
+ return c(this, h, d).call(
2045
+ this,
2046
+ { type: "BooleanLiteral", value: i, ...e.sourceSpan },
2047
+ { hasParentParens: s },
2048
+ );
2049
+ case "number":
2050
+ return c(this, h, d).call(
2051
+ this,
2052
+ { type: "NumericLiteral", value: i, ...e.sourceSpan },
2053
+ { hasParentParens: s },
2054
+ );
2055
+ case "object":
2056
+ return c(this, h, d).call(
2057
+ this,
2058
+ { type: "NullLiteral", ...e.sourceSpan },
2059
+ { hasParentParens: s },
2060
+ );
2061
+ case "string":
2062
+ return c(this, h, d).call(
2063
+ this,
2064
+ { type: "StringLiteral", value: i, ...e.sourceSpan },
2065
+ { hasParentParens: s },
2066
+ );
2067
+ case "undefined":
2068
+ return c(this, h, d).call(
2069
+ this,
2070
+ { type: "Identifier", name: "undefined", ...e.sourceSpan },
2071
+ { hasParentParens: s },
2072
+ );
2073
+ default:
2074
+ throw new Error(
2075
+ `Unexpected LiteralPrimitive value type ${typeof i}`,
2076
+ );
2077
+ }
2078
+ }
2079
+ if (e instanceof pt || e instanceof D) {
2080
+ let i = e instanceof D,
2081
+ { receiver: n, args: a } = e,
2082
+ o =
2083
+ a.length === 1
2084
+ ? [c(this, h, v).call(this, a[0], !0)]
2085
+ : a.map((S) => c(this, h, v).call(this, S)),
2086
+ p = c(this, h, v).call(this, n),
2087
+ u = Be(p),
2088
+ f = i || u ? "OptionalCallExpression" : "CallExpression";
2089
+ return c(this, h, d).call(
2090
+ this,
2091
+ {
2092
+ type: f,
2093
+ callee: p,
2094
+ arguments: o,
2095
+ optional: f === "OptionalCallExpression" ? i : void 0,
2096
+ start: k(p),
2097
+ end: e.sourceSpan.end,
2098
+ },
2099
+ { hasParentParens: s },
2100
+ );
2101
+ }
2102
+ if (e instanceof ht) {
2103
+ let i = c(this, h, v).call(this, e.expression);
2104
+ return c(this, h, d).call(
2105
+ this,
2106
+ {
2107
+ type: "TSNonNullExpression",
2108
+ expression: i,
2109
+ start: k(i),
2110
+ end: e.sourceSpan.end,
2111
+ },
2112
+ { hasParentParens: s },
2113
+ );
2114
+ }
2115
+ if (e instanceof ct) {
2116
+ let i = c(this, h, v).call(this, e.expression);
2117
+ return c(this, h, d).call(
2118
+ this,
2119
+ {
2120
+ type: "UnaryExpression",
2121
+ prefix: !0,
2122
+ operator: "!",
2123
+ argument: i,
2124
+ start: e.sourceSpan.start,
2125
+ end: N(i),
2126
+ },
2127
+ { hasParentParens: s },
2128
+ );
2129
+ }
2130
+ if (e instanceof M || e instanceof _) {
2131
+ let { receiver: i, name: n } = e,
2132
+ a = this.getCharacterLastIndex(/\S/, e.sourceSpan.end - 1) + 1,
2133
+ o = c(this, h, d).call(
2134
+ this,
2135
+ { type: "Identifier", name: n, start: a - n.length, end: a },
2136
+ Te(i, O(this, St)) ? { hasParentParens: s } : {},
2137
+ );
2138
+ return c(this, h, Ot).call(this, i, o, {
2139
+ computed: !1,
2140
+ optional: e instanceof _,
2141
+ hasParentParens: s,
2142
+ });
2143
+ }
2144
+ if (e instanceof rt) {
2145
+ let i = c(this, h, v).call(this, e.key),
2146
+ n = c(this, h, v).call(this, e.value),
2147
+ a = c(this, h, Ot).call(this, e.receiver, i, {
2148
+ computed: !0,
2149
+ optional: !1,
2150
+ end: this.getCharacterIndex("]", N(i)) + 1,
2151
+ });
2152
+ return c(this, h, d).call(
2153
+ this,
2154
+ {
2155
+ type: "AssignmentExpression",
2156
+ left: a,
2157
+ operator: "=",
2158
+ right: n,
2159
+ start: k(a),
2160
+ end: N(n),
2161
+ },
2162
+ { hasParentParens: s },
2163
+ );
2164
+ }
2165
+ if (e instanceof et) {
2166
+ let { receiver: i, name: n, value: a } = e,
2167
+ o = c(this, h, v).call(this, a),
2168
+ p =
2169
+ this.getCharacterLastIndex(
2170
+ /\S/,
2171
+ this.getCharacterLastIndex("=", k(o) - 1) - 1,
2172
+ ) + 1,
2173
+ u = c(this, h, d).call(this, {
2174
+ type: "Identifier",
2175
+ name: n,
2176
+ start: p - n.length,
2177
+ end: p,
2178
+ }),
2179
+ f = c(this, h, Ot).call(this, i, u, { computed: !1, optional: !1 });
2180
+ return c(this, h, d).call(
2181
+ this,
2182
+ {
2183
+ type: "AssignmentExpression",
2184
+ left: f,
2185
+ operator: "=",
2186
+ right: o,
2187
+ start: k(f),
2188
+ end: N(o),
2189
+ },
2190
+ { hasParentParens: s },
2191
+ );
2192
+ }
2193
+ throw Object.assign(new Error("Unexpected node"), { node: e });
2194
+ });
2195
+ function Me(r, t) {
2196
+ return new It(r, t).node;
2197
+ }
2198
+ function _e(r) {
2199
+ return r instanceof ut;
2200
+ }
2201
+ function Ue(r) {
2202
+ return r instanceof W;
2203
+ }
2204
+ var wt,
2205
+ q,
2206
+ x,
2207
+ Fe,
2208
+ C,
2209
+ te,
2210
+ ee,
2211
+ se,
2212
+ De,
2213
+ We,
2214
+ Ge,
2215
+ Ve,
2216
+ Xt = class extends It {
2217
+ constructor(e, s) {
2218
+ super(void 0, s);
2219
+ P(this, x);
2220
+ P(this, wt);
2221
+ P(this, q);
2222
+ Y(this, wt, e), Y(this, q, s);
2223
+ for (let i of e) c(this, x, De).call(this, i);
2224
+ }
2225
+ get expressions() {
2226
+ return c(this, x, Ge).call(this);
2227
+ }
2228
+ };
2229
+ (wt = new WeakMap()),
2230
+ (q = new WeakMap()),
2231
+ (x = new WeakSet()),
2232
+ (Fe = function () {
2233
+ return O(this, wt)[0].key;
2234
+ }),
2235
+ (C = function (e, { stripSpaces: s = !0 } = {}) {
2236
+ return this.createNode(e, { stripSpaces: s });
2237
+ }),
2238
+ (te = function (e) {
2239
+ return this.transformNode(e);
2240
+ }),
2241
+ (ee = function (e) {
2242
+ return Ne(e.slice(O(this, x, Fe).source.length));
2243
+ }),
2244
+ (se = function (e) {
2245
+ let s = O(this, q);
2246
+ if (s[e.start] !== '"' && s[e.start] !== "'") return;
2247
+ let i = s[e.start],
2248
+ n = !1;
2249
+ for (let a = e.start + 1; a < s.length; a++)
2250
+ switch (s[a]) {
2251
+ case i:
2252
+ if (!n) {
2253
+ e.end = a + 1;
2254
+ return;
2255
+ }
2256
+ default:
2257
+ n = !1;
2258
+ break;
2259
+ case "\\":
2260
+ n = !n;
2261
+ break;
2262
+ }
2263
+ }),
2264
+ (De = function (e) {
2265
+ c(this, x, se).call(this, e.key.span),
2266
+ Ue(e) && e.value && c(this, x, se).call(this, e.value.span);
2267
+ }),
2268
+ (We = function (e) {
2269
+ if (!e.value || e.value.source) return e.value;
2270
+ let s = this.getCharacterIndex(/\S/, e.sourceSpan.start);
2271
+ return { source: "$implicit", span: { start: s, end: s } };
2272
+ }),
2273
+ (Ge = function () {
2274
+ let e = O(this, wt),
2275
+ [s] = e,
2276
+ i =
2277
+ O(this, q).slice(s.sourceSpan.start, s.sourceSpan.end).trim()
2278
+ .length === 0
2279
+ ? e.slice(1)
2280
+ : e,
2281
+ n = [],
2282
+ a = null;
2283
+ for (let [o, p] of i.entries()) {
2284
+ if (a && _e(a) && Ue(p) && p.value && p.value.source === a.key.source) {
2285
+ let u = c(this, x, C).call(this, {
2286
+ type: "NGMicrosyntaxKey",
2287
+ name: p.key.source,
2288
+ ...p.key.span,
2289
+ }),
2290
+ f = (y, w) => ({
2291
+ ...y,
2292
+ ...this.transformSpan({ start: y.start, end: w }),
2293
+ }),
2294
+ S = (y) => ({ ...f(y, u.end), alias: u }),
2295
+ g = n.pop();
2296
+ if (g.type === "NGMicrosyntaxExpression") n.push(S(g));
2297
+ else if (g.type === "NGMicrosyntaxKeyedExpression") {
2298
+ let y = S(g.expression);
2299
+ n.push(f({ ...g, expression: y }, y.end));
2300
+ } else throw new Error(`Unexpected type ${g.type}`);
2301
+ } else n.push(c(this, x, Ve).call(this, p, o));
2302
+ a = p;
2303
+ }
2304
+ return c(this, x, C).call(this, {
2305
+ type: "NGMicrosyntax",
2306
+ body: n,
2307
+ ...(n.length === 0
2308
+ ? e[0].sourceSpan
2309
+ : { start: n[0].start, end: Tt(!1, n, -1).end }),
2310
+ });
2311
+ }),
2312
+ (Ve = function (e, s) {
2313
+ if (_e(e)) {
2314
+ let { key: i, value: n } = e;
2315
+ return n
2316
+ ? s === 0
2317
+ ? c(this, x, C).call(this, {
2318
+ type: "NGMicrosyntaxExpression",
2319
+ expression: c(this, x, te).call(this, n.ast),
2320
+ alias: null,
2321
+ ...n.sourceSpan,
2322
+ })
2323
+ : c(this, x, C).call(this, {
2324
+ type: "NGMicrosyntaxKeyedExpression",
2325
+ key: c(this, x, C).call(this, {
2326
+ type: "NGMicrosyntaxKey",
2327
+ name: c(this, x, ee).call(this, i.source),
2328
+ ...i.span,
2329
+ }),
2330
+ expression: c(this, x, C).call(this, {
2331
+ type: "NGMicrosyntaxExpression",
2332
+ expression: c(this, x, te).call(this, n.ast),
2333
+ alias: null,
2334
+ ...n.sourceSpan,
2335
+ }),
2336
+ start: i.span.start,
2337
+ end: n.sourceSpan.end,
2338
+ })
2339
+ : c(this, x, C).call(this, {
2340
+ type: "NGMicrosyntaxKey",
2341
+ name: c(this, x, ee).call(this, i.source),
2342
+ ...i.span,
2343
+ });
2344
+ } else {
2345
+ let { key: i, sourceSpan: n } = e;
2346
+ if (/^let\s$/.test(O(this, q).slice(n.start, n.start + 4))) {
2347
+ let { value: o } = e;
2348
+ return c(this, x, C).call(this, {
2349
+ type: "NGMicrosyntaxLet",
2350
+ key: c(this, x, C).call(this, {
2351
+ type: "NGMicrosyntaxKey",
2352
+ name: i.source,
2353
+ ...i.span,
2354
+ }),
2355
+ value: o
2356
+ ? c(this, x, C).call(this, {
2357
+ type: "NGMicrosyntaxKey",
2358
+ name: o.source,
2359
+ ...o.span,
2360
+ })
2361
+ : null,
2362
+ start: n.start,
2363
+ end: o ? o.span.end : i.span.end,
2364
+ });
2365
+ } else {
2366
+ let o = c(this, x, We).call(this, e);
2367
+ return c(this, x, C).call(this, {
2368
+ type: "NGMicrosyntaxAs",
2369
+ key: c(this, x, C).call(this, {
2370
+ type: "NGMicrosyntaxKey",
2371
+ name: o.source,
2372
+ ...o.span,
2373
+ }),
2374
+ alias: c(this, x, C).call(this, {
2375
+ type: "NGMicrosyntaxKey",
2376
+ name: i.source,
2377
+ ...i.span,
2378
+ }),
2379
+ start: o.span.start,
2380
+ end: i.span.end,
2381
+ });
2382
+ }
2383
+ }
2384
+ });
2385
+ function Qe(r, t) {
2386
+ return new Xt(r, t).expressions;
2387
+ }
2388
+ function Mt({ result: { ast: r }, text: t, comments: e }) {
2389
+ return Object.assign(Me(r, t), { comments: e });
2390
+ }
2391
+ function ze({ result: { templateBindings: r }, text: t }) {
2392
+ return Qe(r, t);
2393
+ }
2394
+ var qe = (r) => Mt(Le(r));
2395
+ var He = (r) => Mt(Pe(r)),
2396
+ re = (r) => Mt(Re(r)),
2397
+ je = (r) => ze(be(r));
2398
+ function ie(r) {
2399
+ var s, i, n;
2400
+ let t = ((s = r.range) == null ? void 0 : s[0]) ?? r.start,
2401
+ e =
2402
+ (n =
2403
+ ((i = r.declaration) == null ? void 0 : i.decorators) ??
2404
+ r.decorators) == null
2405
+ ? void 0
2406
+ : n[0];
2407
+ return e ? Math.min(ie(e), t) : t;
2408
+ }
2409
+ function Ye(r) {
2410
+ var t;
2411
+ return ((t = r.range) == null ? void 0 : t[1]) ?? r.end;
2412
+ }
2413
+ function _t(r) {
2414
+ return {
2415
+ astFormat: "estree",
2416
+ parse(t) {
2417
+ let e = r(t);
2418
+ return {
2419
+ type: "NGRoot",
2420
+ node:
2421
+ r === re && e.type !== "NGChainedExpression"
2422
+ ? { ...e, type: "NGChainedExpression", expressions: [e] }
2423
+ : e,
2424
+ };
2425
+ },
2426
+ locStart: ie,
2427
+ locEnd: Ye,
2428
+ };
2429
+ }
2430
+ var Xs = _t(re),
2431
+ tr = _t(qe),
2432
+ er = _t(He),
2433
+ sr = _t(je);
2434
+ return ss(rr);
2435
+ });