@arcgis/arcade-languageservice 5.0.0-next.8 → 5.0.0-next.80

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +89 -14
  2. package/dist/index.js +1396 -1355
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { CompletionItemKind as F, InsertTextFormat as B, InsertTextMode as S, DiagnosticSeverity as A } from "vscode-languageserver-types";
2
- import { DiagnosticSeverity as pi } from "vscode-languageserver-types";
3
- import { isDictionaryVariable as Gt, isValueVariable as Ct, ApiService as Jt } from "@arcgis/languages-api-utils";
4
- const j = {
1
+ import { CompletionItemKind as g, InsertTextFormat as B, InsertTextMode as S, DiagnosticSeverity as A } from "vscode-languageserver-types";
2
+ import { DiagnosticSeverity as fi } from "vscode-languageserver-types";
3
+ import { isDictionaryVariable as Je, isValueVariable as Ee, ApiService as Qe } from "@arcgis/languages-api-utils";
4
+ const V = {
5
5
  False: "false",
6
6
  Null: "null",
7
7
  True: "true"
@@ -18,7 +18,7 @@ const j = {
18
18
  Return: "return",
19
19
  Var: "var",
20
20
  While: "while"
21
- }, tt = {
21
+ }, te = {
22
22
  From: "from",
23
23
  Of: "of"
24
24
  }, u = {
@@ -44,11 +44,13 @@ const j = {
44
44
  LineComment: "LineComment",
45
45
  Literal: "Literal",
46
46
  LogicalExpression: "LogicalExpression",
47
+ MemberAccessChainExpression: "MemberAccessChainExpression",
47
48
  MemberExpression: "MemberExpression",
48
49
  ObjectExpression: "ObjectExpression",
49
50
  Program: "Program",
50
51
  Property: "Property",
51
52
  ReturnStatement: "ReturnStatement",
53
+ SafeMemberExpression: "SafeMemberExpression",
52
54
  TemplateElement: "TemplateElement",
53
55
  TemplateLiteral: "TemplateLiteral",
54
56
  UnaryExpression: "UnaryExpression",
@@ -56,7 +58,7 @@ const j = {
56
58
  VariableDeclaration: "VariableDeclaration",
57
59
  VariableDeclarator: "VariableDeclarator",
58
60
  WhileStatement: "WhileStatement"
59
- }, st = ["++", "--"], Pt = ["-", "+", "!", "~"], Nt = ["=", "/=", "*=", "%=", "+=", "-="], Mt = ["||", "&&"], Qt = [
61
+ }, ue = ["++", "--"], Ne = ["-", "+", "!", "~"], Me = ["=", "/=", "*=", "%=", "+=", "-="], Ue = ["||", "&&"], Ze = [
60
62
  "|",
61
63
  "&",
62
64
  ">>",
@@ -74,7 +76,7 @@ const j = {
74
76
  "*",
75
77
  "/",
76
78
  "%"
77
- ], H = {
79
+ ], w = "?.", q = {
78
80
  "||": 1,
79
81
  "&&": 2,
80
82
  "|": 3,
@@ -104,7 +106,7 @@ const j = {
104
106
  Punctuator: 7,
105
107
  StringLiteral: 8,
106
108
  Template: 10
107
- }, Ut = [
109
+ }, Oe = [
108
110
  "Unknown",
109
111
  "Boolean",
110
112
  "<end>",
@@ -145,7 +147,7 @@ const j = {
145
147
  UnexpectedString: "UnexpectedString",
146
148
  UnexpectedTemplate: "UnexpectedTemplate",
147
149
  UnexpectedToken: "UnexpectedToken"
148
- }, Ot = {
150
+ }, je = {
149
151
  [h.InvalidModuleUri]: "Module uri must be a text literal.",
150
152
  [h.ForInOfLoopInitializer]: "for-in loop variable declaration may not have an initializer.",
151
153
  [h.IdentifierExpected]: "'${value}' is an invalid identifier.",
@@ -176,8 +178,8 @@ const j = {
176
178
  [h.UnexpectedToken]: "Unexpected token '${value}'."
177
179
  };
178
180
  class z extends Error {
179
- constructor({ code: t, index: e, line: i, column: r, len: s = 0, description: a, data: o }) {
180
- super(a ?? t), this.declaredRootClass = "esri.arcade.lib.diagnostic", this.name = "ParsingError", this.code = t, this.index = e, this.line = i, this.column = r, this.len = s, this.data = o, this.description = a, this.range = {
181
+ constructor({ code: e, index: t, line: i, column: r, len: s = 0, description: a, data: o }) {
182
+ super(a ?? e), this.declaredRootClass = "esri.arcade.lib.diagnostic", this.name = "ParsingError", this.code = e, this.index = t, this.line = i, this.column = r, this.len = s, this.data = o, this.description = a, this.range = {
181
183
  start: { line: i, column: r - 1 },
182
184
  end: { line: i, column: r + s }
183
185
  }, Error.captureStackTrace?.(
@@ -186,186 +188,192 @@ class z extends Error {
186
188
  );
187
189
  }
188
190
  }
189
- function Zt(n) {
191
+ function Xe(n) {
190
192
  return !!n && typeof n == "object" && "type" in n && n.type === u.Program;
191
193
  }
192
- function w(n) {
194
+ function I(n) {
193
195
  return !!n && typeof n == "object" && "type" in n && n.type === u.BlockStatement;
194
196
  }
195
- function Yt(n) {
197
+ function Ye(n) {
196
198
  return !!n && typeof n == "object" && "type" in n && n.type === u.BlockComment;
197
199
  }
198
- function Dt(n) {
200
+ function pe(n) {
199
201
  return !!n && typeof n == "object" && "type" in n && n.type === u.EmptyStatement;
200
202
  }
201
- function Xt(n) {
203
+ function et(n) {
202
204
  return !!n && typeof n == "object" && "type" in n && n.type === u.ExpressionStatement;
203
205
  }
204
- function Et(n) {
206
+ function xe(n) {
205
207
  return !!n && typeof n == "object" && "type" in n && n.type === u.FunctionDeclaration;
206
208
  }
207
- function ut(n) {
209
+ function ae(n) {
208
210
  return !!n && typeof n == "object" && "type" in n && n.type === u.IfStatement;
209
211
  }
210
- function q(n) {
212
+ function G(n) {
211
213
  return !!n && typeof n == "object" && "type" in n && n.type === u.VariableDeclaration;
212
214
  }
213
- function G(n) {
215
+ function J(n) {
214
216
  return !!n && typeof n == "object" && "type" in n && n.type === u.ArrayExpression;
215
217
  }
216
- function at(n) {
218
+ function oe(n) {
217
219
  return !!n && typeof n == "object" && "type" in n && n.type === u.BinaryExpression;
218
220
  }
219
- function I(n) {
221
+ function b(n) {
220
222
  return !!n && typeof n == "object" && "type" in n && n.type === u.Identifier;
221
223
  }
222
- function zt(n) {
224
+ function ze(n) {
223
225
  return !!n && typeof n == "object" && "type" in n && n.type === u.Literal;
224
226
  }
225
- function ot(n) {
227
+ function ce(n) {
226
228
  return !!n && typeof n == "object" && "type" in n && n.type === u.LogicalExpression;
227
229
  }
228
- function gt(n) {
230
+ function ge(n) {
229
231
  return !!n && typeof n == "object" && "type" in n && n.type === u.ObjectExpression;
230
232
  }
231
- function Ft(n) {
233
+ function Fe(n) {
232
234
  return !!n && typeof n == "object" && "type" in n && n.type === u.MemberExpression;
233
235
  }
234
- function te(n) {
236
+ function tt(n) {
237
+ return !!n && typeof n == "object" && "type" in n && n.type === u.SafeMemberExpression;
238
+ }
239
+ function it(n) {
240
+ return !!n && typeof n == "object" && "type" in n && n.type === u.MemberAccessChainExpression;
241
+ }
242
+ function nt(n) {
235
243
  return !!n && typeof n == "object" && "type" in n && n.type === u.UnaryExpression;
236
244
  }
237
- function ee(n) {
245
+ function rt(n) {
238
246
  return !!n && typeof n == "object" && "type" in n && n.type === u.UpdateExpression;
239
247
  }
240
- function jt(n) {
248
+ function Ve(n) {
241
249
  return !!n && typeof n == "object" && "type" in n && n.type === u.VariableDeclarator;
242
250
  }
243
- function ie(n) {
251
+ function st(n) {
244
252
  return !!n && typeof n == "object" && "type" in n && n.type === u.Property;
245
253
  }
246
- function et(n, t) {
247
- return t.loc.end.line === n.loc.start.line && t.loc.end.column <= n.loc.start.column;
254
+ function ie(n, e) {
255
+ return e.loc.end.line === n.loc.start.line && e.loc.end.column <= n.loc.start.column;
248
256
  }
249
- function xt(n, t) {
250
- return n.range[0] >= t.range[0] && n.range[1] <= t.range[1];
257
+ function Ae(n, e) {
258
+ return n.range[0] >= e.range[0] && n.range[1] <= e.range[1];
251
259
  }
252
- class ne {
260
+ class ut {
253
261
  constructor() {
254
262
  this.comments = [], this._nodeStack = [], this._newComments = [];
255
263
  }
256
- insertInnerComments(t) {
257
- if (!w(t) || t.body.length !== 0)
264
+ insertInnerComments(e) {
265
+ if (!I(e) || e.body.length !== 0)
258
266
  return;
259
- const e = [];
267
+ const t = [];
260
268
  for (let i = this._newComments.length - 1; i >= 0; i--) {
261
269
  const r = this._newComments[i];
262
- t.range[1] >= r.range[0] && (e.unshift(r), this._newComments.splice(i, 1));
270
+ e.range[1] >= r.range[0] && (t.unshift(r), this._newComments.splice(i, 1));
263
271
  }
264
- e.length && (t.innerComments = e);
272
+ t.length && (e.innerComments = t);
265
273
  }
266
- attachTrailingComments(t) {
267
- const e = this._nodeStack.at(-1);
268
- if (!e)
274
+ attachTrailingComments(e) {
275
+ const t = this._nodeStack.at(-1);
276
+ if (!t)
269
277
  return;
270
- if (w(t) && xt(e, t))
278
+ if (I(e) && Ae(t, e))
271
279
  for (let r = this._newComments.length - 1; r >= 0; r--) {
272
280
  const s = this._newComments[r];
273
- xt(s, t) && (e.trailingComments = [...e.trailingComments ?? [], s], this._newComments.splice(r, 1));
281
+ Ae(s, e) && (t.trailingComments = [...t.trailingComments ?? [], s], this._newComments.splice(r, 1));
274
282
  }
275
283
  let i = [];
276
284
  if (this._newComments.length > 0)
277
285
  for (let r = this._newComments.length - 1; r >= 0; r--) {
278
286
  const s = this._newComments[r];
279
- et(s, e) ? (e.trailingComments = [...e.trailingComments ?? [], s], this._newComments.splice(r, 1)) : et(s, t) && (i.unshift(s), this._newComments.splice(r, 1));
287
+ ie(s, t) ? (t.trailingComments = [...t.trailingComments ?? [], s], this._newComments.splice(r, 1)) : ie(s, e) && (i.unshift(s), this._newComments.splice(r, 1));
280
288
  }
281
- if (e.trailingComments) {
282
- const r = e.trailingComments[0];
283
- et(r, t) && (i = [...i, ...e.trailingComments], delete e.trailingComments);
289
+ if (t.trailingComments) {
290
+ const r = t.trailingComments[0];
291
+ ie(r, e) && (i = [...i, ...t.trailingComments], delete t.trailingComments);
284
292
  }
285
- i.length > 0 && (t.trailingComments = i);
293
+ i.length > 0 && (e.trailingComments = i);
286
294
  }
287
- attachLeadingComments(t) {
288
- let e;
295
+ attachLeadingComments(e) {
296
+ let t;
289
297
  for (; this._nodeStack.length > 0; ) {
290
298
  const s = this._nodeStack[this._nodeStack.length - 1];
291
- if (t.range[0] <= s.range[0]) {
292
- e = s, this._nodeStack.pop();
299
+ if (e.range[0] <= s.range[0]) {
300
+ t = s, this._nodeStack.pop();
293
301
  continue;
294
302
  }
295
303
  break;
296
304
  }
297
305
  const i = [], r = [];
298
- if (e != null) {
299
- if (!e.leadingComments)
306
+ if (t != null) {
307
+ if (!t.leadingComments)
300
308
  return;
301
- for (let s = e.leadingComments.length - 1; s >= 0; s--) {
302
- const a = e.leadingComments[s];
303
- if (t.range[0] >= a.range[1]) {
304
- i.unshift(a), e.leadingComments.splice(s, 1);
309
+ for (let s = t.leadingComments.length - 1; s >= 0; s--) {
310
+ const a = t.leadingComments[s];
311
+ if (e.range[0] >= a.range[1]) {
312
+ i.unshift(a), t.leadingComments.splice(s, 1);
305
313
  continue;
306
314
  }
307
- jt(t) && !Yt(a) && (r.unshift(a), e.leadingComments.splice(s, 1));
315
+ Ve(e) && !Ye(a) && (r.unshift(a), t.leadingComments.splice(s, 1));
308
316
  }
309
- e.leadingComments.length === 0 && delete e.leadingComments, i.length && (t.leadingComments = i), r.length && (t.trailingComments = [...r, ...t.trailingComments ?? []]);
317
+ t.leadingComments.length === 0 && delete t.leadingComments, i.length && (e.leadingComments = i), r.length && (e.trailingComments = [...r, ...e.trailingComments ?? []]);
310
318
  return;
311
319
  }
312
320
  for (let s = this._newComments.length - 1; s >= 0; s--) {
313
321
  const a = this._newComments[s];
314
- t.range[0] >= a.range[0] && (i.unshift(a), this._newComments.splice(s, 1));
322
+ e.range[0] >= a.range[0] && (i.unshift(a), this._newComments.splice(s, 1));
315
323
  }
316
- i.length && (t.leadingComments = i);
324
+ i.length && (e.leadingComments = i);
317
325
  }
318
- attachComments(t) {
319
- if (Zt(t) && t.body.length > 0) {
320
- const e = this._nodeStack.at(-1);
321
- if (e) {
322
- e.trailingComments = [...e.trailingComments ?? [], ...this._newComments], this._newComments.length = 0, this._nodeStack.pop();
326
+ attachComments(e) {
327
+ if (Xe(e) && e.body.length > 0) {
328
+ const t = this._nodeStack.at(-1);
329
+ if (t) {
330
+ t.trailingComments = [...t.trailingComments ?? [], ...this._newComments], this._newComments.length = 0, this._nodeStack.pop();
323
331
  return;
324
332
  }
325
- t.trailingComments = [...this._newComments], this._newComments.length = 0;
333
+ e.trailingComments = [...this._newComments], this._newComments.length = 0;
326
334
  return;
327
335
  }
328
- this.attachTrailingComments(t), this.attachLeadingComments(t), this.insertInnerComments(t), this._nodeStack.push(t);
336
+ this.attachTrailingComments(e), this.attachLeadingComments(e), this.insertInnerComments(e), this._nodeStack.push(e);
329
337
  }
330
- collectComment(t) {
331
- this.comments.push(t), this._newComments.push(t);
338
+ collectComment(e) {
339
+ this.comments.push(e), this._newComments.push(e);
332
340
  }
333
341
  }
334
- const re = /\$\{(.*?)\}/gu;
335
- function ct(n, t) {
336
- const e = Ot[n];
337
- return t ? e.replace(re, (i, r) => t[r]?.toString() ?? "") : e;
342
+ const at = /\$\{(.*?)\}/gu;
343
+ function he(n, e) {
344
+ const t = je[n];
345
+ return e ? t.replace(at, (i, r) => e[r]?.toString() ?? "") : t;
338
346
  }
339
- class Vt {
340
- constructor(t = !1) {
341
- this.tolerant = t, this.errors = [];
347
+ class _e {
348
+ constructor(e = !1) {
349
+ this.tolerant = e, this.errors = [];
342
350
  }
343
- recordError(t) {
344
- this.errors.push(t);
351
+ recordError(e) {
352
+ this.errors.push(e);
345
353
  }
346
- tolerate(t) {
354
+ tolerate(e) {
347
355
  if (this.tolerant)
348
- this.recordError(t);
356
+ this.recordError(e);
349
357
  else
350
- throw t;
358
+ throw e;
351
359
  }
352
- throwError(t) {
353
- throw t.description ??= ct(t.code, t.data), new z(t);
360
+ throwError(e) {
361
+ throw e.description ??= he(e.code, e.data), new z(e);
354
362
  }
355
- tolerateError(t) {
356
- t.description ??= ct(t.code, t.data);
357
- const e = new z(t);
363
+ tolerateError(e) {
364
+ e.description ??= he(e.code, e.data);
365
+ const t = new z(e);
358
366
  if (this.tolerant)
359
- this.recordError(e);
367
+ this.recordError(t);
360
368
  else
361
- throw e;
369
+ throw t;
362
370
  }
363
371
  }
364
- function At(n, t) {
372
+ function ye(n, e) {
365
373
  if (!n)
366
- throw new Error(`ASSERT: ${t}`);
374
+ throw new Error(`ASSERT: ${e}`);
367
375
  }
368
- const yt = {
376
+ const Be = {
369
377
  // Unicode v12.1.0 NonAsciiIdentifierStart:
370
378
  NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/u,
371
379
  // Unicode v12.1.0 NonAsciiIdentifierPart:
@@ -408,7 +416,7 @@ const yt = {
408
416
  n >= 65 && n <= 90 || // A..Z
409
417
  n >= 97 && n <= 122 || // a..z
410
418
  n === 92 || // \ (backslash)
411
- n >= 128 && yt.NonAsciiIdentifierStart.test(m.fromCodePoint(n));
419
+ n >= 128 && Be.NonAsciiIdentifierStart.test(m.fromCodePoint(n));
412
420
  },
413
421
  isIdentifierPart(n) {
414
422
  return n === 36 || n === 95 || // $ (dollar) and _ (underscore)
@@ -416,7 +424,7 @@ const yt = {
416
424
  n >= 97 && n <= 122 || // a..z
417
425
  n >= 48 && n <= 57 || // 0..9
418
426
  n === 92 || // \ (backslash)
419
- n >= 128 && yt.NonAsciiIdentifierPart.test(m.fromCodePoint(n));
427
+ n >= 128 && Be.NonAsciiIdentifierPart.test(m.fromCodePoint(n));
420
428
  },
421
429
  // https://tc39.github.io/ecma262/#sec-literals-numeric-literals
422
430
  isDecimalDigit(n) {
@@ -431,21 +439,22 @@ const yt = {
431
439
  return n >= 48 && n <= 55;
432
440
  }
433
441
  };
434
- function Bt(n) {
442
+ function Se(n) {
435
443
  return "0123456789abcdef".indexOf(n.toLowerCase());
436
444
  }
437
- function it(n) {
445
+ function ne(n) {
438
446
  return "01234567".indexOf(n);
439
447
  }
440
- const P = [[], [], []];
441
- st.forEach((n) => P[n.length - 1]?.push(n));
442
- Pt.forEach((n) => P[n.length - 1]?.push(n));
443
- Mt.forEach((n) => P[n.length - 1]?.push(n));
444
- Nt.forEach((n) => P[n.length - 1]?.push(n));
445
- Qt.forEach((n) => P[n.length - 1]?.push(n));
446
- class _t {
447
- constructor(t, e) {
448
- this.source = t, this.errorHandler = e, this._length = t.length, this.index = 0, this.lineNumber = 1, this.lineStart = 0, this.curlyStack = [];
448
+ const N = [[], [], []];
449
+ ue.forEach((n) => N[n.length - 1].push(n));
450
+ Ne.forEach((n) => N[n.length - 1].push(n));
451
+ Ue.forEach((n) => N[n.length - 1].push(n));
452
+ Me.forEach((n) => N[n.length - 1].push(n));
453
+ Ze.forEach((n) => N[n.length - 1].push(n));
454
+ N[w.length - 1].push(w);
455
+ class $e {
456
+ constructor(e, t) {
457
+ this.source = e, this.errorHandler = t, this._length = e.length, this.index = 0, this.lineNumber = 1, this.lineStart = 0, this.curlyStack = [];
449
458
  }
450
459
  saveState() {
451
460
  return {
@@ -455,34 +464,34 @@ class _t {
455
464
  curlyStack: this.curlyStack.slice()
456
465
  };
457
466
  }
458
- restoreState(t) {
459
- this.index = t.index, this.lineNumber = t.lineNumber, this.lineStart = t.lineStart, this.curlyStack = t.curlyStack;
467
+ restoreState(e) {
468
+ this.index = e.index, this.lineNumber = e.lineNumber, this.lineStart = e.lineStart, this.curlyStack = e.curlyStack;
460
469
  }
461
470
  eof() {
462
471
  return this.index >= this._length;
463
472
  }
464
- throwUnexpectedToken(t = h.UnexpectedToken) {
473
+ throwUnexpectedToken(e = h.UnexpectedToken) {
465
474
  this.errorHandler.throwError({
466
- code: t,
475
+ code: e,
467
476
  index: this.index,
468
477
  line: this.lineNumber,
469
478
  column: this.index - this.lineStart + 1,
470
479
  data: { value: this.source.charAt(this.index) }
471
480
  });
472
481
  }
473
- tolerateUnexpectedToken(t = h.UnexpectedToken) {
482
+ tolerateUnexpectedToken(e = h.UnexpectedToken) {
474
483
  this.errorHandler.tolerateError({
475
- code: t,
484
+ code: e,
476
485
  index: this.index,
477
486
  line: this.lineNumber,
478
487
  column: this.index - this.lineStart + 1
479
488
  });
480
489
  }
481
- skipSingleLineComment(t) {
482
- const e = [], i = this.index - t, r = {
490
+ skipSingleLineComment(e) {
491
+ const t = [], i = this.index - e, r = {
483
492
  start: {
484
493
  line: this.lineNumber,
485
- column: this.index - this.lineStart - t
494
+ column: this.index - this.lineStart - e
486
495
  },
487
496
  end: { line: 0, column: 0 }
488
497
  // Fake for now
@@ -496,12 +505,12 @@ class _t {
496
505
  };
497
506
  const o = {
498
507
  multiLine: !1,
499
- start: i + t,
508
+ start: i + e,
500
509
  end: this.index - 1,
501
510
  range: [i, this.index - 1],
502
511
  loc: r
503
512
  };
504
- return e.push(o), a === 13 && this.source.charCodeAt(this.index) === 10 && (this.index += 1), this.lineNumber += 1, this.lineStart = this.index, e;
513
+ return t.push(o), a === 13 && this.source.charCodeAt(this.index) === 10 && (this.index += 1), this.lineNumber += 1, this.lineStart = this.index, t;
505
514
  }
506
515
  }
507
516
  r.end = {
@@ -510,15 +519,15 @@ class _t {
510
519
  };
511
520
  const s = {
512
521
  multiLine: !1,
513
- start: i + t,
522
+ start: i + e,
514
523
  end: this.index,
515
524
  range: [i, this.index],
516
525
  loc: r
517
526
  };
518
- return e.push(s), e;
527
+ return t.push(s), t;
519
528
  }
520
529
  skipMultiLineComment() {
521
- const t = [], e = this.index - 2, i = {
530
+ const e = [], t = this.index - 2, i = {
522
531
  start: {
523
532
  line: this.lineNumber,
524
533
  column: this.index - this.lineStart - 2
@@ -538,12 +547,12 @@ class _t {
538
547
  };
539
548
  const a = {
540
549
  multiLine: !0,
541
- start: e + 2,
550
+ start: t + 2,
542
551
  end: this.index - 2,
543
- range: [e, this.index],
552
+ range: [t, this.index],
544
553
  loc: i
545
554
  };
546
- return t.push(a), t;
555
+ return e.push(a), e;
547
556
  }
548
557
  this.index += 1;
549
558
  } else
@@ -555,131 +564,131 @@ class _t {
555
564
  };
556
565
  const r = {
557
566
  multiLine: !0,
558
- start: e + 2,
567
+ start: t + 2,
559
568
  end: this.index,
560
- range: [e, this.index],
569
+ range: [t, this.index],
561
570
  loc: i
562
571
  };
563
- return t.push(r), this.tolerateUnexpectedToken(), t;
572
+ return e.push(r), this.tolerateUnexpectedToken(), e;
564
573
  }
565
574
  scanComments() {
566
- let t = [];
575
+ let e = [];
567
576
  for (; !this.eof(); ) {
568
- let e = this.source.charCodeAt(this.index);
569
- if (m.isWhiteSpace(e))
577
+ let t = this.source.charCodeAt(this.index);
578
+ if (m.isWhiteSpace(t))
570
579
  this.index += 1;
571
- else if (m.isLineTerminator(e))
572
- this.index += 1, e === 13 && this.source.charCodeAt(this.index) === 10 && (this.index += 1), this.lineNumber += 1, this.lineStart = this.index;
573
- else if (e === 47)
574
- if (e = this.source.charCodeAt(this.index + 1), e === 47) {
580
+ else if (m.isLineTerminator(t))
581
+ this.index += 1, t === 13 && this.source.charCodeAt(this.index) === 10 && (this.index += 1), this.lineNumber += 1, this.lineStart = this.index;
582
+ else if (t === 47)
583
+ if (t = this.source.charCodeAt(this.index + 1), t === 47) {
575
584
  this.index += 2;
576
585
  const i = this.skipSingleLineComment(2);
577
- t = [...t, ...i];
578
- } else if (e === 42) {
586
+ e = [...e, ...i];
587
+ } else if (t === 42) {
579
588
  this.index += 2;
580
589
  const i = this.skipMultiLineComment();
581
- t = [...t, ...i];
590
+ e = [...e, ...i];
582
591
  } else
583
592
  break;
584
593
  else
585
594
  break;
586
595
  }
587
- return t;
596
+ return e;
588
597
  }
589
- isKeyword(t) {
590
- switch (t = t.toLowerCase(), t.length) {
598
+ isKeyword(e) {
599
+ switch (e = e.toLowerCase(), e.length) {
591
600
  case 2:
592
- return t === f.If || t === f.In;
601
+ return e === f.If || e === f.In;
593
602
  case 3:
594
- return t === f.Var || t === f.For;
603
+ return e === f.Var || e === f.For;
595
604
  case 4:
596
- return t === f.Else;
605
+ return e === f.Else;
597
606
  case 5:
598
- return t === f.Break || t === f.While;
607
+ return e === f.Break || e === f.While;
599
608
  case 6:
600
- return t === f.Return || t === f.Import || t === f.Export;
609
+ return e === f.Return || e === f.Import || e === f.Export;
601
610
  case 8:
602
- return t === f.Function || t === f.Continue;
611
+ return e === f.Function || e === f.Continue;
603
612
  default:
604
613
  return !1;
605
614
  }
606
615
  }
607
- codePointAt(t) {
608
- let e = this.source.charCodeAt(t);
609
- if (e >= 55296 && e <= 56319) {
610
- const i = this.source.charCodeAt(t + 1);
611
- i >= 56320 && i <= 57343 && (e = (e - 55296) * 1024 + i - 56320 + 65536);
616
+ codePointAt(e) {
617
+ let t = this.source.charCodeAt(e);
618
+ if (t >= 55296 && t <= 56319) {
619
+ const i = this.source.charCodeAt(e + 1);
620
+ i >= 56320 && i <= 57343 && (t = (t - 55296) * 1024 + i - 56320 + 65536);
612
621
  }
613
- return e;
622
+ return t;
614
623
  }
615
- scanHexEscape(t) {
616
- const e = t === "u" ? 4 : 2;
624
+ scanHexEscape(e) {
625
+ const t = e === "u" ? 4 : 2;
617
626
  let i = 0;
618
- for (let r = 0; r < e; r++)
627
+ for (let r = 0; r < t; r++)
619
628
  if (!this.eof() && m.isHexDigit(this.source.charCodeAt(this.index)))
620
- i = i * 16 + Bt(this.source[this.index] ?? ""), this.index += 1;
629
+ i = i * 16 + Se(this.source[this.index] ?? ""), this.index += 1;
621
630
  else
622
631
  return null;
623
632
  return String.fromCharCode(i);
624
633
  }
625
634
  scanUnicodeCodePointEscape() {
626
- let t = this.source[this.index], e = 0;
627
- for (t === "}" && this.throwUnexpectedToken(); !this.eof() && (t = this.source[this.index] ?? "", this.index += 1, !!m.isHexDigit(t.charCodeAt(0))); )
628
- e = e * 16 + Bt(t);
629
- return (e > 1114111 || t !== "}") && this.throwUnexpectedToken(), m.fromCodePoint(e);
635
+ let e = this.source[this.index], t = 0;
636
+ for (e === "}" && this.throwUnexpectedToken(); !this.eof() && (e = this.source[this.index] ?? "", this.index += 1, !!m.isHexDigit(e.charCodeAt(0))); )
637
+ t = t * 16 + Se(e);
638
+ return (t > 1114111 || e !== "}") && this.throwUnexpectedToken(), m.fromCodePoint(t);
630
639
  }
631
640
  getIdentifier() {
632
- const t = this.index;
641
+ const e = this.index;
633
642
  for (this.index += 1; !this.eof(); ) {
634
- const e = this.source.charCodeAt(this.index);
635
- if (e === 92)
636
- return this.index = t, this.getComplexIdentifier();
637
- if (e >= 55296 && e < 57343)
638
- return this.index = t, this.getComplexIdentifier();
639
- if (m.isIdentifierPart(e))
643
+ const t = this.source.charCodeAt(this.index);
644
+ if (t === 92)
645
+ return this.index = e, this.getComplexIdentifier();
646
+ if (t >= 55296 && t < 57343)
647
+ return this.index = e, this.getComplexIdentifier();
648
+ if (m.isIdentifierPart(t))
640
649
  this.index += 1;
641
650
  else
642
651
  break;
643
652
  }
644
- return this.source.slice(t, this.index);
653
+ return this.source.slice(e, this.index);
645
654
  }
646
655
  getComplexIdentifier() {
647
- let t = this.codePointAt(this.index), e = m.fromCodePoint(t);
648
- this.index += e.length;
656
+ let e = this.codePointAt(this.index), t = m.fromCodePoint(e);
657
+ this.index += t.length;
649
658
  let i;
650
- for (t === 92 && (this.source.charCodeAt(this.index) !== 117 && this.throwUnexpectedToken(), this.index += 1, this.source[this.index] === "{" ? (this.index += 1, i = this.scanUnicodeCodePointEscape()) : (i = this.scanHexEscape("u"), (i === null || i === "\\" || !m.isIdentifierStart(i.charCodeAt(0))) && this.throwUnexpectedToken()), e = i); !this.eof() && (t = this.codePointAt(this.index), !!m.isIdentifierPart(t)); )
651
- i = m.fromCodePoint(t), e += i, this.index += i.length, t === 92 && (e = e.substring(0, e.length - 1), this.source.charCodeAt(this.index) !== 117 && this.throwUnexpectedToken(), this.index += 1, this.source[this.index] === "{" ? (this.index += 1, i = this.scanUnicodeCodePointEscape()) : (i = this.scanHexEscape("u"), (i === null || i === "\\" || !m.isIdentifierPart(i.charCodeAt(0))) && this.throwUnexpectedToken()), e += i);
652
- return e;
659
+ for (e === 92 && (this.source.charCodeAt(this.index) !== 117 && this.throwUnexpectedToken(), this.index += 1, this.source[this.index] === "{" ? (this.index += 1, i = this.scanUnicodeCodePointEscape()) : (i = this.scanHexEscape("u"), (i === null || i === "\\" || !m.isIdentifierStart(i.charCodeAt(0))) && this.throwUnexpectedToken()), t = i); !this.eof() && (e = this.codePointAt(this.index), !!m.isIdentifierPart(e)); )
660
+ i = m.fromCodePoint(e), t += i, this.index += i.length, e === 92 && (t = t.substring(0, t.length - 1), this.source.charCodeAt(this.index) !== 117 && this.throwUnexpectedToken(), this.index += 1, this.source[this.index] === "{" ? (this.index += 1, i = this.scanUnicodeCodePointEscape()) : (i = this.scanHexEscape("u"), (i === null || i === "\\" || !m.isIdentifierPart(i.charCodeAt(0))) && this.throwUnexpectedToken()), t += i);
661
+ return t;
653
662
  }
654
- octalToDecimal(t) {
655
- let e = t !== "0", i = it(t);
656
- return !this.eof() && m.isOctalDigit(this.source.charCodeAt(this.index)) && (e = !0, i = i * 8 + it(this.source[this.index] ?? ""), this.index += 1, "0123".includes(t) && !this.eof() && m.isOctalDigit(this.source.charCodeAt(this.index)) && (i = i * 8 + it(this.source[this.index] ?? ""), this.index += 1)), { code: i, octal: e };
663
+ octalToDecimal(e) {
664
+ let t = e !== "0", i = ne(e);
665
+ return !this.eof() && m.isOctalDigit(this.source.charCodeAt(this.index)) && (t = !0, i = i * 8 + ne(this.source[this.index] ?? ""), this.index += 1, "0123".includes(e) && !this.eof() && m.isOctalDigit(this.source.charCodeAt(this.index)) && (i = i * 8 + ne(this.source[this.index] ?? ""), this.index += 1)), { code: i, octal: t };
657
666
  }
658
667
  // https://tc39.github.io/ecma262/#sec-names-and-keywords
659
668
  scanIdentifier() {
660
- let t;
661
- const e = this.index, i = this.source.charCodeAt(e) === 92 ? this.getComplexIdentifier() : this.getIdentifier();
662
- if (i.length === 1 ? t = l.Identifier : this.isKeyword(i) ? t = l.Keyword : i.toLowerCase() === j.Null ? t = l.NullLiteral : i.toLowerCase() === j.True || i.toLowerCase() === j.False ? t = l.BooleanLiteral : t = l.Identifier, t !== l.Identifier && e + i.length !== this.index) {
669
+ let e;
670
+ const t = this.index, i = this.source.charCodeAt(t) === 92 ? this.getComplexIdentifier() : this.getIdentifier();
671
+ if (i.length === 1 ? e = l.Identifier : this.isKeyword(i) ? e = l.Keyword : i.toLowerCase() === V.Null ? e = l.NullLiteral : i.toLowerCase() === V.True || i.toLowerCase() === V.False ? e = l.BooleanLiteral : e = l.Identifier, e !== l.Identifier && t + i.length !== this.index) {
663
672
  const r = this.index;
664
- this.index = e, this.tolerateUnexpectedToken(h.InvalidEscapedReservedWord), this.index = r;
673
+ this.index = t, this.tolerateUnexpectedToken(h.InvalidEscapedReservedWord), this.index = r;
665
674
  }
666
675
  return {
667
- type: t,
676
+ type: e,
668
677
  value: i,
669
678
  lineNumber: this.lineNumber,
670
679
  lineStart: this.lineStart,
671
- start: e,
680
+ start: t,
672
681
  end: this.index
673
682
  };
674
683
  }
675
684
  // https://tc39.github.io/ecma262/#sec-punctuators
676
685
  scanPunctuator() {
677
- const t = this.index;
678
- let e = this.source[this.index] ?? "";
679
- switch (e) {
686
+ const e = this.index;
687
+ let t = this.source[this.index] ?? "";
688
+ switch (t) {
680
689
  case "(":
681
690
  case "{":
682
- e === "{" && this.curlyStack.push("{"), this.index += 1;
691
+ t === "{" && this.curlyStack.push("{"), this.index += 1;
683
692
  break;
684
693
  case ".":
685
694
  this.index += 1;
@@ -693,102 +702,101 @@ class _t {
693
702
  case "[":
694
703
  case "]":
695
704
  case ":":
696
- case "?":
697
705
  case "~":
698
706
  this.index += 1;
699
707
  break;
700
708
  default:
701
- for (let i = P.length; i > 0; i--)
702
- if (e = this.source.substring(this.index, this.index + i), P[i - 1]?.includes(e)) {
709
+ for (let i = N.length; i > 0; i--)
710
+ if (t = this.source.substring(this.index, this.index + i), N[i - 1]?.includes(t)) {
703
711
  this.index += i;
704
712
  break;
705
713
  }
706
714
  }
707
- return this.index === t && this.throwUnexpectedToken(), {
715
+ return this.index === e && this.throwUnexpectedToken(), {
708
716
  type: l.Punctuator,
709
- value: e,
717
+ value: t,
710
718
  lineNumber: this.lineNumber,
711
719
  lineStart: this.lineStart,
712
- start: t,
720
+ start: e,
713
721
  end: this.index
714
722
  };
715
723
  }
716
724
  // https://tc39.github.io/ecma262/#sec-literals-numeric-literals
717
- scanHexLiteral(t) {
718
- let e = "";
725
+ scanHexLiteral(e) {
726
+ let t = "";
719
727
  for (; !this.eof() && m.isHexDigit(this.source.charCodeAt(this.index)); )
720
- e += this.source[this.index], this.index += 1;
721
- return e.length === 0 && this.throwUnexpectedToken(), m.isIdentifierStart(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(), {
728
+ t += this.source[this.index], this.index += 1;
729
+ return t.length === 0 && this.throwUnexpectedToken(), m.isIdentifierStart(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(), {
722
730
  type: l.NumericLiteral,
723
- value: Number.parseInt(`0x${e}`, 16),
731
+ value: Number.parseInt(`0x${t}`, 16),
724
732
  lineNumber: this.lineNumber,
725
733
  lineStart: this.lineStart,
726
- start: t,
734
+ start: e,
727
735
  end: this.index
728
736
  };
729
737
  }
730
- scanBinaryLiteral(t) {
731
- let e = "";
738
+ scanBinaryLiteral(e) {
739
+ let t = "";
732
740
  for (; !this.eof(); ) {
733
741
  const i = this.source[this.index];
734
742
  if (i !== "0" && i !== "1")
735
743
  break;
736
- e += this.source[this.index], this.index += 1;
744
+ t += this.source[this.index], this.index += 1;
737
745
  }
738
- if (e.length === 0 && this.throwUnexpectedToken(), !this.eof()) {
746
+ if (t.length === 0 && this.throwUnexpectedToken(), !this.eof()) {
739
747
  const i = this.source.charCodeAt(this.index);
740
748
  (m.isIdentifierStart(i) || m.isDecimalDigit(i)) && this.throwUnexpectedToken();
741
749
  }
742
750
  return {
743
751
  type: l.NumericLiteral,
744
- value: Number.parseInt(e, 2),
752
+ value: Number.parseInt(t, 2),
745
753
  lineNumber: this.lineNumber,
746
754
  lineStart: this.lineStart,
747
- start: t,
755
+ start: e,
748
756
  end: this.index
749
757
  };
750
758
  }
751
- scanOctalLiteral(t, e) {
759
+ scanOctalLiteral(e, t) {
752
760
  let i = "", r = !1;
753
- for (m.isOctalDigit(t.charCodeAt(0)) && (r = !0, i = `0${this.source[this.index]}`), this.index += 1; !this.eof() && m.isOctalDigit(this.source.charCodeAt(this.index)); )
761
+ for (m.isOctalDigit(e.charCodeAt(0)) && (r = !0, i = `0${this.source[this.index]}`), this.index += 1; !this.eof() && m.isOctalDigit(this.source.charCodeAt(this.index)); )
754
762
  i += this.source[this.index], this.index += 1;
755
763
  return !r && i.length === 0 && this.throwUnexpectedToken(), (m.isIdentifierStart(this.source.charCodeAt(this.index)) || m.isDecimalDigit(this.source.charCodeAt(this.index))) && this.throwUnexpectedToken(), {
756
764
  type: l.NumericLiteral,
757
765
  value: Number.parseInt(i, 8),
758
766
  lineNumber: this.lineNumber,
759
767
  lineStart: this.lineStart,
760
- start: e,
768
+ start: t,
761
769
  end: this.index
762
770
  };
763
771
  }
764
772
  scanNumericLiteral() {
765
- const t = this.index;
766
- let e = this.source[t] ?? "";
767
- At(
768
- m.isDecimalDigit(e.charCodeAt(0)) || e === ".",
773
+ const e = this.index;
774
+ let t = this.source[e] ?? "";
775
+ ye(
776
+ m.isDecimalDigit(t.charCodeAt(0)) || t === ".",
769
777
  "Numeric literal must start with a decimal digit or a decimal point"
770
778
  );
771
779
  let i = "";
772
- if (e !== ".") {
773
- if (i = this.source[this.index] ?? "", this.index += 1, e = this.source[this.index] ?? "", i === "0") {
774
- if (e === "x" || e === "X")
775
- return this.index += 1, this.scanHexLiteral(t);
776
- if (e === "b" || e === "B")
777
- return this.index += 1, this.scanBinaryLiteral(t);
778
- if (e === "o" || e === "O")
779
- return this.scanOctalLiteral(e, t);
780
+ if (t !== ".") {
781
+ if (i = this.source[this.index] ?? "", this.index += 1, t = this.source[this.index] ?? "", i === "0") {
782
+ if (t === "x" || t === "X")
783
+ return this.index += 1, this.scanHexLiteral(e);
784
+ if (t === "b" || t === "B")
785
+ return this.index += 1, this.scanBinaryLiteral(e);
786
+ if (t === "o" || t === "O")
787
+ return this.scanOctalLiteral(t, e);
780
788
  }
781
789
  for (; m.isDecimalDigit(this.source.charCodeAt(this.index)); )
782
790
  i += this.source[this.index], this.index += 1;
783
- e = this.source[this.index] ?? "";
791
+ t = this.source[this.index] ?? "";
784
792
  }
785
- if (e === ".") {
793
+ if (t === ".") {
786
794
  for (i += this.source[this.index], this.index += 1; m.isDecimalDigit(this.source.charCodeAt(this.index)); )
787
795
  i += this.source[this.index], this.index += 1;
788
- e = this.source[this.index] ?? "";
796
+ t = this.source[this.index] ?? "";
789
797
  }
790
- if (e === "e" || e === "E")
791
- if (i += this.source[this.index], this.index += 1, e = this.source[this.index] ?? "", (e === "+" || e === "-") && (i += this.source[this.index], this.index += 1), m.isDecimalDigit(this.source.charCodeAt(this.index)))
798
+ if (t === "e" || t === "E")
799
+ if (i += this.source[this.index], this.index += 1, t = this.source[this.index] ?? "", (t === "+" || t === "-") && (i += this.source[this.index], this.index += 1), m.isDecimalDigit(this.source.charCodeAt(this.index)))
792
800
  for (; m.isDecimalDigit(this.source.charCodeAt(this.index)); )
793
801
  i += this.source[this.index], this.index += 1;
794
802
  else
@@ -798,19 +806,19 @@ class _t {
798
806
  value: Number.parseFloat(i),
799
807
  lineNumber: this.lineNumber,
800
808
  lineStart: this.lineStart,
801
- start: t,
809
+ start: e,
802
810
  end: this.index
803
811
  };
804
812
  }
805
813
  scanStringLiteral() {
806
- const t = this.index;
807
- let e = this.source[t];
808
- At(e === "'" || e === '"', "String literal must starts with a quote"), this.index += 1;
814
+ const e = this.index;
815
+ let t = this.source[e];
816
+ ye(t === "'" || t === '"', "String literal must starts with a quote"), this.index += 1;
809
817
  let i = !1, r = "";
810
818
  for (; !this.eof(); ) {
811
819
  let s = this.source[this.index] ?? "";
812
- if (this.index += 1, s === e) {
813
- e = "";
820
+ if (this.index += 1, s === t) {
821
+ t = "";
814
822
  break;
815
823
  }
816
824
  if (s === "\\")
@@ -869,31 +877,31 @@ class _t {
869
877
  r += s;
870
878
  }
871
879
  }
872
- return e !== "" && (this.index = t, this.throwUnexpectedToken()), {
880
+ return t !== "" && (this.index = e, this.throwUnexpectedToken()), {
873
881
  type: l.StringLiteral,
874
882
  value: r,
875
883
  lineNumber: this.lineNumber,
876
884
  lineStart: this.lineStart,
877
- start: t,
885
+ start: e,
878
886
  end: this.index
879
887
  };
880
888
  }
881
889
  scanTemplate() {
882
- let t = "", e = !1;
890
+ let e = "", t = !1;
883
891
  const i = this.index, r = this.source[i] === "`";
884
892
  let s = !1, a = 2;
885
893
  for (this.index += 1; !this.eof(); ) {
886
894
  let o = this.source[this.index] ?? "";
887
895
  if (this.index += 1, o === "`") {
888
- a = 1, s = !0, e = !0;
896
+ a = 1, s = !0, t = !0;
889
897
  break;
890
898
  }
891
899
  if (o === "$") {
892
900
  if (this.source[this.index] === "{") {
893
- this.curlyStack.push("${"), this.index += 1, e = !0;
901
+ this.curlyStack.push("${"), this.index += 1, t = !0;
894
902
  break;
895
903
  }
896
- t += o;
904
+ e += o;
897
905
  continue;
898
906
  }
899
907
  if (o === "\\") {
@@ -903,55 +911,55 @@ class _t {
903
911
  else
904
912
  switch (o) {
905
913
  case "n":
906
- t += `
914
+ e += `
907
915
  `;
908
916
  break;
909
917
  case "r":
910
- t += "\r";
918
+ e += "\r";
911
919
  break;
912
920
  case "t":
913
- t += " ";
921
+ e += " ";
914
922
  break;
915
923
  case "u":
916
924
  if (this.source[this.index] === "{")
917
- this.index += 1, t += this.scanUnicodeCodePointEscape();
925
+ this.index += 1, e += this.scanUnicodeCodePointEscape();
918
926
  else {
919
927
  const c = this.index, d = this.scanHexEscape(o);
920
- d !== null ? t += d : (this.index = c, t += o);
928
+ d !== null ? e += d : (this.index = c, e += o);
921
929
  }
922
930
  break;
923
931
  case "x": {
924
932
  const c = this.scanHexEscape(o);
925
- c === null && this.throwUnexpectedToken(h.InvalidHexEscapeSequence), t += c;
933
+ c === null && this.throwUnexpectedToken(h.InvalidHexEscapeSequence), e += c;
926
934
  break;
927
935
  }
928
936
  case "b":
929
- t += "\b";
937
+ e += "\b";
930
938
  break;
931
939
  case "f":
932
- t += "\f";
940
+ e += "\f";
933
941
  break;
934
942
  case "v":
935
- t += "\v";
943
+ e += "\v";
936
944
  break;
937
945
  default:
938
- o === "0" ? (m.isDecimalDigit(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(h.TemplateOctalLiteral), t += "\0") : m.isOctalDigit(o.charCodeAt(0)) ? this.throwUnexpectedToken(h.TemplateOctalLiteral) : t += o;
946
+ o === "0" ? (m.isDecimalDigit(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(h.TemplateOctalLiteral), e += "\0") : m.isOctalDigit(o.charCodeAt(0)) ? this.throwUnexpectedToken(h.TemplateOctalLiteral) : e += o;
939
947
  break;
940
948
  }
941
949
  continue;
942
950
  }
943
951
  if (m.isLineTerminator(o.charCodeAt(0))) {
944
952
  this.lineNumber += 1, o === "\r" && this.source[this.index] === `
945
- ` && (this.index += 1), this.lineStart = this.index, t += `
953
+ ` && (this.index += 1), this.lineStart = this.index, e += `
946
954
  `;
947
955
  continue;
948
956
  }
949
- t += o;
957
+ e += o;
950
958
  }
951
- return e || this.throwUnexpectedToken(), r || this.curlyStack.pop(), {
959
+ return t || this.throwUnexpectedToken(), r || this.curlyStack.pop(), {
952
960
  type: l.Template,
953
961
  value: this.source.slice(i + 1, this.index - a),
954
- cooked: t,
962
+ cooked: e,
955
963
  head: r,
956
964
  tail: s,
957
965
  lineNumber: this.lineNumber,
@@ -970,8 +978,8 @@ class _t {
970
978
  start: this.index,
971
979
  end: this.index
972
980
  };
973
- const t = this.source.charCodeAt(this.index);
974
- return m.isIdentifierStart(t) ? this.scanIdentifier() : t === 40 || t === 41 || t === 59 ? this.scanPunctuator() : t === 39 || t === 34 ? this.scanStringLiteral() : t === 46 ? m.isDecimalDigit(this.source.charCodeAt(this.index + 1)) ? this.scanNumericLiteral() : this.scanPunctuator() : m.isDecimalDigit(t) ? this.scanNumericLiteral() : t === 96 || t === 125 && this.curlyStack[this.curlyStack.length - 1] === "${" ? this.scanTemplate() : t >= 55296 && t < 57343 && m.isIdentifierStart(this.codePointAt(this.index)) ? this.scanIdentifier() : this.scanPunctuator();
981
+ const e = this.source.charCodeAt(this.index);
982
+ return m.isIdentifierStart(e) ? this.scanIdentifier() : e === 40 || e === 41 || e === 59 ? this.scanPunctuator() : e === 39 || e === 34 ? this.scanStringLiteral() : e === 46 ? m.isDecimalDigit(this.source.charCodeAt(this.index + 1)) ? this.scanNumericLiteral() : this.scanPunctuator() : m.isDecimalDigit(e) ? this.scanNumericLiteral() : e === 96 || e === 125 && this.curlyStack[this.curlyStack.length - 1] === "${" ? this.scanTemplate() : e >= 55296 && e < 57343 && m.isIdentifierStart(this.codePointAt(this.index)) ? this.scanIdentifier() : this.scanPunctuator();
975
983
  }
976
984
  }
977
985
  const y = {
@@ -981,33 +989,33 @@ const y = {
981
989
  ForLoop: 4,
982
990
  ForOfLoop: 8,
983
991
  WhileLoop: 16
984
- }, nt = {
992
+ }, re = {
985
993
  AsObject: 0,
986
994
  Automatic: 1
987
995
  };
988
- function St(n, t = 0) {
989
- let e = n.start - n.lineStart, i = n.lineNumber;
990
- return e < 0 && (e += t, i -= 1), { index: n.start, line: i, column: e };
996
+ function be(n, e = 0) {
997
+ let t = n.start - n.lineStart, i = n.lineNumber;
998
+ return t < 0 && (t += e, i -= 1), { index: n.start, line: i, column: t };
991
999
  }
992
- function It(n) {
1000
+ function Ie(n) {
993
1001
  return [
994
1002
  { index: n.range[0], ...n.loc.start },
995
1003
  { index: n.range[1], ...n.loc.end }
996
1004
  ];
997
1005
  }
998
- function wt(n) {
999
- return n in H ? H[n] : 0;
1006
+ function we(n) {
1007
+ return n in q ? q[n] : 0;
1000
1008
  }
1001
- class se {
1002
- constructor(t, e = {}, i) {
1009
+ class ot {
1010
+ constructor(e, t = {}, i) {
1003
1011
  this.delegate = i, this.hasLineTerminator = !1, this.options = {
1004
- tokens: typeof e.tokens == "boolean" && e.tokens,
1005
- comments: typeof e.comments == "boolean" && e.comments,
1006
- tolerant: typeof e.tolerant == "boolean" && e.tolerant
1007
- }, this.options.comments && (this.commentHandler = new ne()), this.errorHandler = new Vt(this.options.tolerant), this.scanner = new _t(t, this.errorHandler), this.context = {
1012
+ tokens: typeof t.tokens == "boolean" && t.tokens,
1013
+ comments: typeof t.comments == "boolean" && t.comments,
1014
+ tolerant: typeof t.tolerant == "boolean" && t.tolerant
1015
+ }, this.options.comments && (this.commentHandler = new ut()), this.errorHandler = new _e(this.options.tolerant), this.scanner = new $e(e, this.errorHandler), this.context = {
1008
1016
  isAssignmentTarget: !1,
1009
1017
  blockContext: y.None,
1010
- curlyParsingType: nt.AsObject
1018
+ curlyParsingType: re.AsObject
1011
1019
  }, this.rawToken = {
1012
1020
  type: l.EOF,
1013
1021
  value: "",
@@ -1029,26 +1037,26 @@ class se {
1029
1037
  column: this.scanner.index - this.scanner.lineStart
1030
1038
  };
1031
1039
  }
1032
- throwIfInvalidType(t, e, {
1040
+ throwIfInvalidType(e, t, {
1033
1041
  validTypes: i,
1034
1042
  invalidTypes: r
1035
1043
  }) {
1036
- i?.some((s) => t.type === s) || r?.some((s) => t.type === s) && this.throwError(h.InvalidExpression, e);
1044
+ i?.some((s) => e.type === s) || r?.some((s) => e.type === s) && this.throwError(h.InvalidExpression, t);
1037
1045
  }
1038
- throwError(t, e, i = this.endMarker) {
1039
- const { index: r, line: s, column: a } = e, o = i.index - r - 1;
1040
- this.errorHandler.throwError({ code: t, index: r, line: s, column: a + 1, len: o });
1046
+ throwError(e, t, i = this.endMarker) {
1047
+ const { index: r, line: s, column: a } = t, o = i.index - r - 1;
1048
+ this.errorHandler.throwError({ code: e, index: r, line: s, column: a + 1, len: o });
1041
1049
  }
1042
- tolerateError(t, e) {
1050
+ tolerateError(e, t) {
1043
1051
  throw new Error("######################################### !!!");
1044
1052
  }
1045
1053
  // Throw an exception because of the token.
1046
- unexpectedTokenError(t = {}) {
1047
- const { rawToken: e } = t;
1048
- let { code: i, data: r } = t, s;
1049
- if (e) {
1054
+ unexpectedTokenError(e = {}) {
1055
+ const { rawToken: t } = e;
1056
+ let { code: i, data: r } = e, s;
1057
+ if (t) {
1050
1058
  if (!i)
1051
- switch (e.type) {
1059
+ switch (t.type) {
1052
1060
  case l.EOF:
1053
1061
  i = h.UnexpectedEndOfScript;
1054
1062
  break;
@@ -1065,19 +1073,19 @@ class se {
1065
1073
  i = h.UnexpectedTemplate;
1066
1074
  break;
1067
1075
  }
1068
- s = e.value.toString();
1076
+ s = t.value.toString();
1069
1077
  } else
1070
1078
  s = "ILLEGAL";
1071
1079
  i ??= h.UnexpectedToken, r ??= { value: s };
1072
- const a = ct(i, r);
1073
- if (e) {
1074
- const d = e.start, C = e.lineNumber, x = e.start - e.lineStart + 1;
1080
+ const a = he(i, r);
1081
+ if (t) {
1082
+ const d = t.start, C = t.lineNumber, F = t.start - t.lineStart + 1;
1075
1083
  return new z({
1076
1084
  code: i,
1077
1085
  index: d,
1078
1086
  line: C,
1079
- column: x,
1080
- len: e.end - e.start - 1,
1087
+ column: F,
1088
+ len: t.end - t.start - 1,
1081
1089
  data: r,
1082
1090
  description: a
1083
1091
  });
@@ -1085,33 +1093,33 @@ class se {
1085
1093
  const { index: o, line: c } = this.endMarker;
1086
1094
  return new z({ code: i, index: o, line: c, column: this.endMarker.column + 1, data: r, description: a });
1087
1095
  }
1088
- throwUnexpectedToken(t = {}) {
1089
- throw t.rawToken ??= this.rawToken, this.unexpectedTokenError(t);
1096
+ throwUnexpectedToken(e = {}) {
1097
+ throw e.rawToken ??= this.rawToken, this.unexpectedTokenError(e);
1090
1098
  }
1091
- collectComments(t) {
1092
- const { commentHandler: e } = this;
1093
- !e || !t.length || t.forEach((i) => {
1099
+ collectComments(e) {
1100
+ const { commentHandler: t } = this;
1101
+ !t || !e.length || e.forEach((i) => {
1094
1102
  const r = {
1095
1103
  type: i.multiLine ? u.BlockComment : u.LineComment,
1096
1104
  value: this.getSourceValue(i),
1097
1105
  range: i.range,
1098
1106
  loc: i.loc
1099
1107
  };
1100
- e.collectComment(r);
1108
+ t.collectComment(r);
1101
1109
  });
1102
1110
  }
1103
- peekAhead(t) {
1104
- const e = () => (this.scanner.scanComments(), this.scanner.lex()), i = this.scanner.saveState(), r = t.call(this, e);
1111
+ peekAhead(e) {
1112
+ const t = () => (this.scanner.scanComments(), this.scanner.lex()), i = this.scanner.saveState(), r = e.call(this, t);
1105
1113
  return this.scanner.restoreState(i), r;
1106
1114
  }
1107
- getSourceValue(t) {
1108
- return this.scanner.source.slice(t.start, t.end);
1115
+ getSourceValue(e) {
1116
+ return this.scanner.source.slice(e.start, e.end);
1109
1117
  }
1110
- convertToToken(t) {
1118
+ convertToToken(e) {
1111
1119
  return {
1112
- type: Ut[t.type],
1113
- value: this.getSourceValue(t),
1114
- range: [t.start, t.end],
1120
+ type: Oe[e.type],
1121
+ value: this.getSourceValue(e),
1122
+ range: [e.start, e.end],
1115
1123
  loc: {
1116
1124
  start: {
1117
1125
  line: this.startMarker.line,
@@ -1126,8 +1134,8 @@ class se {
1126
1134
  }
1127
1135
  readNextRawToken() {
1128
1136
  this.endMarker.index = this.scanner.index, this.endMarker.line = this.scanner.lineNumber, this.endMarker.column = this.scanner.index - this.scanner.lineStart;
1129
- const t = this.rawToken;
1130
- this.collectComments(this.scanner.scanComments()), this.scanner.index !== this.startMarker.index && (this.startMarker.index = this.scanner.index, this.startMarker.line = this.scanner.lineNumber, this.startMarker.column = this.scanner.index - this.scanner.lineStart), this.rawToken = this.scanner.lex(), this.hasLineTerminator = t.lineNumber !== this.rawToken.lineNumber, this.options.tokens && this.rawToken.type !== l.EOF && this.tokens.push(this.convertToToken(this.rawToken));
1137
+ const e = this.rawToken;
1138
+ this.collectComments(this.scanner.scanComments()), this.scanner.index !== this.startMarker.index && (this.startMarker.index = this.scanner.index, this.startMarker.line = this.scanner.lineNumber, this.startMarker.column = this.scanner.index - this.scanner.lineStart), this.rawToken = this.scanner.lex(), this.hasLineTerminator = e.lineNumber !== this.rawToken.lineNumber, this.options.tokens && this.rawToken.type !== l.EOF && this.tokens.push(this.convertToToken(this.rawToken));
1131
1139
  }
1132
1140
  captureStartMarker() {
1133
1141
  return {
@@ -1136,13 +1144,13 @@ class se {
1136
1144
  column: this.startMarker.column
1137
1145
  };
1138
1146
  }
1139
- getItemLocation(t) {
1147
+ getItemLocation(e) {
1140
1148
  return {
1141
- range: [t.index, this.endMarker.index],
1149
+ range: [e.index, this.endMarker.index],
1142
1150
  loc: {
1143
1151
  start: {
1144
- line: t.line,
1145
- column: t.column
1152
+ line: e.line,
1153
+ column: e.column
1146
1154
  },
1147
1155
  end: {
1148
1156
  line: this.endMarker.line,
@@ -1151,43 +1159,43 @@ class se {
1151
1159
  }
1152
1160
  };
1153
1161
  }
1154
- finalize(t) {
1155
- return (this.delegate ?? this.commentHandler) && (this.commentHandler?.attachComments(t), this.delegate?.(t)), t;
1162
+ finalize(e) {
1163
+ return (this.delegate ?? this.commentHandler) && (this.commentHandler?.attachComments(e), this.delegate?.(e)), e;
1156
1164
  }
1157
- expectPunctuator(t) {
1158
- const e = this.rawToken;
1159
- if (this.matchPunctuator(t)) {
1165
+ expectPunctuator(e) {
1166
+ const t = this.rawToken;
1167
+ if (this.matchPunctuator(e)) {
1160
1168
  this.readNextRawToken();
1161
1169
  return;
1162
1170
  }
1163
- this.throwUnexpectedToken({ rawToken: e, code: h.PunctuatorExpected, data: { value: t } });
1171
+ this.throwUnexpectedToken({ rawToken: t, code: h.PunctuatorExpected, data: { value: e } });
1164
1172
  }
1165
- expectKeyword(t) {
1166
- if (this.rawToken.type === l.Keyword && this.rawToken.value.toLowerCase() === t.toString()) {
1173
+ expectKeyword(e) {
1174
+ if (this.rawToken.type === l.Keyword && this.rawToken.value.toLowerCase() === e.toString()) {
1167
1175
  this.readNextRawToken();
1168
1176
  return;
1169
1177
  }
1170
1178
  this.throwUnexpectedToken({ rawToken: this.rawToken });
1171
1179
  }
1172
- expectContextualKeyword(t) {
1173
- if (this.rawToken.type === l.Identifier && this.rawToken.value.toLowerCase() === t) {
1180
+ expectContextualKeyword(e) {
1181
+ if (this.rawToken.type === l.Identifier && this.rawToken.value.toLowerCase() === e) {
1174
1182
  this.readNextRawToken();
1175
1183
  return;
1176
1184
  }
1177
1185
  this.throwUnexpectedToken({ rawToken: this.rawToken });
1178
1186
  }
1179
- matchKeyword(t) {
1180
- return this.rawToken.type === l.Keyword && this.rawToken.value.toLowerCase() === t;
1187
+ matchKeyword(e) {
1188
+ return this.rawToken.type === l.Keyword && this.rawToken.value.toLowerCase() === e;
1181
1189
  }
1182
- matchContextualKeyword(t) {
1183
- return this.rawToken.type === l.Identifier && this.rawToken.value === t;
1190
+ matchContextualKeyword(e) {
1191
+ return this.rawToken.type === l.Identifier && this.rawToken.value === e;
1184
1192
  }
1185
- matchPunctuator(t) {
1186
- return this.rawToken.type === l.Punctuator && this.rawToken.value === t;
1193
+ matchPunctuator(e) {
1194
+ return this.rawToken.type === l.Punctuator && this.rawToken.value === e;
1187
1195
  }
1188
- getMatchingPunctuator(t) {
1189
- if (typeof t == "string" && (t = t.split("")), !(this.rawToken.type !== l.Punctuator || !t.length))
1190
- return t.find(this.matchPunctuator.bind(this));
1196
+ getMatchingPunctuator(e) {
1197
+ if (typeof e == "string" && (e = e.split("")), !(this.rawToken.type !== l.Punctuator || !e.length))
1198
+ return e.find(this.matchPunctuator.bind(this));
1191
1199
  }
1192
1200
  // Cover grammar support.
1193
1201
  //
@@ -1218,24 +1226,24 @@ class se {
1218
1226
  // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates
1219
1227
  // the flags outside of the parser. This means the production the parser parses is used as a part of a potential
1220
1228
  // pattern. The CoverInitializedName check is deferred.
1221
- isolateCoverGrammar(t) {
1222
- const e = this.context.isAssignmentTarget;
1229
+ isolateCoverGrammar(e) {
1230
+ const t = this.context.isAssignmentTarget;
1223
1231
  this.context.isAssignmentTarget = !0;
1224
- const i = t.call(this);
1225
- return this.context.isAssignmentTarget = e, i;
1232
+ const i = e.call(this);
1233
+ return this.context.isAssignmentTarget = t, i;
1226
1234
  }
1227
- inheritCoverGrammar(t) {
1228
- const e = this.context.isAssignmentTarget;
1235
+ inheritCoverGrammar(e) {
1236
+ const t = this.context.isAssignmentTarget;
1229
1237
  this.context.isAssignmentTarget = !0;
1230
- const i = t.call(this);
1231
- return this.context.isAssignmentTarget &&= e, i;
1238
+ const i = e.call(this);
1239
+ return this.context.isAssignmentTarget &&= t, i;
1232
1240
  }
1233
- withBlockContext(t, e) {
1241
+ withBlockContext(e, t) {
1234
1242
  const i = this.context.blockContext;
1235
- this.context.blockContext |= t;
1243
+ this.context.blockContext |= e;
1236
1244
  const r = this.context.curlyParsingType;
1237
- this.context.curlyParsingType = nt.Automatic;
1238
- const s = e.call(this);
1245
+ this.context.curlyParsingType = re.Automatic;
1246
+ const s = t.call(this);
1239
1247
  return this.context.blockContext = i, this.context.curlyParsingType = r, s;
1240
1248
  }
1241
1249
  consumeSemicolon() {
@@ -1252,43 +1260,43 @@ class se {
1252
1260
  }
1253
1261
  }
1254
1262
  parsePrimaryExpression() {
1255
- const t = this.captureStartMarker(), e = this.rawToken;
1256
- switch (e.type) {
1263
+ const e = this.captureStartMarker(), t = this.rawToken;
1264
+ switch (t.type) {
1257
1265
  case l.Identifier:
1258
1266
  return this.readNextRawToken(), this.finalize({
1259
1267
  type: u.Identifier,
1260
- name: e.value,
1261
- ...this.getItemLocation(t)
1268
+ name: t.value,
1269
+ ...this.getItemLocation(e)
1262
1270
  });
1263
1271
  case l.NumericLiteral:
1264
1272
  case l.StringLiteral:
1265
1273
  return this.context.isAssignmentTarget = !1, this.readNextRawToken(), this.finalize({
1266
1274
  type: u.Literal,
1267
- value: e.value,
1268
- raw: this.getSourceValue(e),
1269
- isString: typeof e.value == "string",
1270
- ...this.getItemLocation(t)
1275
+ value: t.value,
1276
+ raw: this.getSourceValue(t),
1277
+ isString: typeof t.value == "string",
1278
+ ...this.getItemLocation(e)
1271
1279
  });
1272
1280
  case l.BooleanLiteral:
1273
1281
  return this.context.isAssignmentTarget = !1, this.readNextRawToken(), this.finalize({
1274
1282
  type: u.Literal,
1275
- value: e.value.toLowerCase() === j.True,
1276
- raw: this.getSourceValue(e),
1283
+ value: t.value.toLowerCase() === V.True,
1284
+ raw: this.getSourceValue(t),
1277
1285
  isString: !1,
1278
- ...this.getItemLocation(t)
1286
+ ...this.getItemLocation(e)
1279
1287
  });
1280
1288
  case l.NullLiteral:
1281
1289
  return this.context.isAssignmentTarget = !1, this.readNextRawToken(), this.finalize({
1282
1290
  type: u.Literal,
1283
1291
  value: null,
1284
- raw: this.getSourceValue(e),
1292
+ raw: this.getSourceValue(t),
1285
1293
  isString: !1,
1286
- ...this.getItemLocation(t)
1294
+ ...this.getItemLocation(e)
1287
1295
  });
1288
1296
  case l.Template:
1289
1297
  return this.parseTemplateLiteral();
1290
1298
  case l.Punctuator:
1291
- switch (e.value) {
1299
+ switch (t.value) {
1292
1300
  case "(":
1293
1301
  return this.inheritCoverGrammar(this.parseGroupExpression.bind(this));
1294
1302
  case "[":
@@ -1305,25 +1313,25 @@ class se {
1305
1313
  }
1306
1314
  }
1307
1315
  parseArrayInitializer() {
1308
- const t = this.captureStartMarker();
1316
+ const e = this.captureStartMarker();
1309
1317
  this.expectPunctuator("[");
1310
- const e = [];
1318
+ const t = [];
1311
1319
  for (; !this.matchPunctuator("]"); ) {
1312
1320
  const i = this.captureStartMarker();
1313
- this.matchPunctuator(",") ? (this.readNextRawToken(), this.throwError(h.InvalidExpression, i)) : (e.push(this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this))), this.matchPunctuator("]") || this.expectPunctuator(","));
1321
+ this.matchPunctuator(",") ? (this.readNextRawToken(), this.throwError(h.InvalidExpression, i)) : (t.push(this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this))), this.matchPunctuator("]") || this.expectPunctuator(","));
1314
1322
  }
1315
- return this.expectPunctuator("]"), this.finalize({ type: u.ArrayExpression, elements: e, ...this.getItemLocation(t) });
1323
+ return this.expectPunctuator("]"), this.finalize({ type: u.ArrayExpression, elements: t, ...this.getItemLocation(e) });
1316
1324
  }
1317
1325
  parseObjectPropertyKey() {
1318
- const t = this.captureStartMarker(), e = this.rawToken;
1319
- switch (e.type) {
1326
+ const e = this.captureStartMarker(), t = this.rawToken;
1327
+ switch (t.type) {
1320
1328
  case l.StringLiteral:
1321
1329
  return this.readNextRawToken(), this.finalize({
1322
1330
  type: u.Literal,
1323
- value: e.value,
1324
- raw: this.getSourceValue(e),
1331
+ value: t.value,
1332
+ raw: this.getSourceValue(t),
1325
1333
  isString: !0,
1326
- ...this.getItemLocation(t)
1334
+ ...this.getItemLocation(e)
1327
1335
  });
1328
1336
  case l.Identifier:
1329
1337
  case l.BooleanLiteral:
@@ -1331,43 +1339,43 @@ class se {
1331
1339
  case l.Keyword:
1332
1340
  return this.readNextRawToken(), this.finalize({
1333
1341
  type: u.Identifier,
1334
- name: e.value,
1335
- ...this.getItemLocation(t)
1342
+ name: t.value,
1343
+ ...this.getItemLocation(e)
1336
1344
  });
1337
1345
  default:
1338
- this.throwError(h.KeyMustBeString, t);
1346
+ this.throwError(h.KeyMustBeString, e);
1339
1347
  }
1340
1348
  }
1341
1349
  parseObjectProperty() {
1342
- const t = this.rawToken, e = this.captureStartMarker(), i = this.parseObjectPropertyKey();
1350
+ const e = this.rawToken, t = this.captureStartMarker(), i = this.parseObjectPropertyKey();
1343
1351
  let r = !1, s = null;
1344
- return this.matchPunctuator(":") ? (this.readNextRawToken(), s = this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this))) : t.type === l.Identifier ? (r = !0, s = this.finalize({
1352
+ return this.matchPunctuator(":") ? (this.readNextRawToken(), s = this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this))) : e.type === l.Identifier ? (r = !0, s = this.finalize({
1345
1353
  type: u.Identifier,
1346
- name: t.value,
1347
- ...this.getItemLocation(e)
1354
+ name: e.value,
1355
+ ...this.getItemLocation(t)
1348
1356
  })) : this.throwUnexpectedToken({ rawToken: this.rawToken }), this.finalize({
1349
1357
  type: u.Property,
1350
1358
  kind: "init",
1351
1359
  key: i,
1352
1360
  value: s,
1353
1361
  shorthand: r,
1354
- ...this.getItemLocation(e)
1362
+ ...this.getItemLocation(t)
1355
1363
  });
1356
1364
  }
1357
1365
  parseObjectExpression() {
1358
- const t = this.captureStartMarker();
1366
+ const e = this.captureStartMarker();
1359
1367
  this.expectPunctuator("{");
1360
- const e = [];
1368
+ const t = [];
1361
1369
  for (; !this.matchPunctuator("}"); )
1362
- e.push(this.parseObjectProperty()), this.matchPunctuator("}") || this.expectPunctuator(",");
1363
- return this.expectPunctuator("}"), this.finalize({ type: u.ObjectExpression, properties: e, ...this.getItemLocation(t) });
1370
+ t.push(this.parseObjectProperty()), this.matchPunctuator("}") || this.expectPunctuator(",");
1371
+ return this.expectPunctuator("}"), this.finalize({ type: u.ObjectExpression, properties: t, ...this.getItemLocation(e) });
1364
1372
  }
1365
- parseTemplateElement(t = !1) {
1366
- const e = this.rawToken;
1367
- e.type !== l.Template && this.throwUnexpectedToken({ rawToken: e }), t && !e.head && this.throwUnexpectedToken({ code: h.InvalidTemplateHead, rawToken: e });
1373
+ parseTemplateElement(e = !1) {
1374
+ const t = this.rawToken;
1375
+ t.type !== l.Template && this.throwUnexpectedToken({ rawToken: t }), e && !t.head && this.throwUnexpectedToken({ code: h.InvalidTemplateHead, rawToken: t });
1368
1376
  const i = this.captureStartMarker();
1369
1377
  this.readNextRawToken();
1370
- const { value: r, cooked: s, tail: a } = e, o = this.finalize({
1378
+ const { value: r, cooked: s, tail: a } = t, o = this.finalize({
1371
1379
  type: u.TemplateElement,
1372
1380
  value: { raw: r, cooked: s },
1373
1381
  tail: a,
@@ -1376,230 +1384,247 @@ class se {
1376
1384
  return o.loc.start.column += 1, o.loc.end.column -= a ? 1 : 2, o;
1377
1385
  }
1378
1386
  parseTemplateLiteral() {
1379
- const t = this.captureStartMarker(), e = [], i = [];
1387
+ const e = this.captureStartMarker(), t = [], i = [];
1380
1388
  let r = this.parseTemplateElement(!0);
1381
1389
  for (i.push(r); !r.tail; )
1382
- e.push(this.parseExpression()), r = this.parseTemplateElement(), i.push(r);
1390
+ t.push(this.parseExpression()), r = this.parseTemplateElement(), i.push(r);
1383
1391
  return this.finalize({
1384
1392
  type: u.TemplateLiteral,
1385
1393
  quasis: i,
1386
- expressions: e,
1387
- ...this.getItemLocation(t)
1394
+ expressions: t,
1395
+ ...this.getItemLocation(e)
1388
1396
  });
1389
1397
  }
1390
1398
  parseGroupExpression() {
1391
1399
  this.expectPunctuator("(");
1392
- const t = this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this));
1393
- return this.expectPunctuator(")"), t;
1400
+ const e = this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this));
1401
+ return this.expectPunctuator(")"), e;
1394
1402
  }
1395
1403
  parseArguments() {
1396
1404
  this.expectPunctuator("(");
1397
- const t = [];
1405
+ const e = [];
1398
1406
  if (!this.matchPunctuator(")"))
1399
1407
  for (; ; ) {
1400
- const e = this.isolateCoverGrammar(this.parseAssignmentExpression.bind(this));
1401
- if (t.push(e), this.matchPunctuator(")") || (this.expectPunctuator(","), this.matchPunctuator(")")))
1408
+ const t = this.isolateCoverGrammar(this.parseAssignmentExpression.bind(this));
1409
+ if (e.push(t), this.matchPunctuator(")") || (this.expectPunctuator(","), this.matchPunctuator(")")))
1402
1410
  break;
1403
1411
  }
1404
- return this.expectPunctuator(")"), t;
1412
+ return this.expectPunctuator(")"), e;
1405
1413
  }
1406
1414
  parseMemberName() {
1407
- const t = this.rawToken, e = this.captureStartMarker();
1408
- return this.readNextRawToken(), t.type !== l.NullLiteral && t.type !== l.Identifier && t.type !== l.Keyword && t.type !== l.BooleanLiteral && this.throwUnexpectedToken({ rawToken: t }), this.finalize({
1415
+ const e = this.rawToken, t = this.captureStartMarker();
1416
+ return this.readNextRawToken(), e.type !== l.NullLiteral && e.type !== l.Identifier && e.type !== l.Keyword && e.type !== l.BooleanLiteral && this.throwUnexpectedToken({ rawToken: e }), this.finalize({
1409
1417
  type: u.Identifier,
1410
- name: t.value,
1411
- ...this.getItemLocation(e)
1418
+ name: e.value,
1419
+ ...this.getItemLocation(t)
1412
1420
  });
1413
1421
  }
1414
1422
  parseLeftHandSideExpression() {
1415
- const t = this.captureStartMarker();
1416
- let e = this.inheritCoverGrammar(this.parsePrimaryExpression.bind(this));
1423
+ const e = this.captureStartMarker();
1424
+ let t = this.inheritCoverGrammar(this.parsePrimaryExpression.bind(this));
1417
1425
  const i = this.captureStartMarker();
1418
- let r;
1419
- for (; r = this.getMatchingPunctuator("([."); )
1420
- switch (r) {
1426
+ let r = !1, s;
1427
+ for (; s = this.getMatchingPunctuator(["(", "[", ".", w]); ) {
1428
+ let a = !1;
1429
+ switch (s === w && (r = !0, a = !0, this.expectPunctuator(w), this.getMatchingPunctuator("[") ? s = "[" : s = "."), s) {
1421
1430
  case "(": {
1422
- this.context.isAssignmentTarget = !1, e.type !== u.Identifier && e.type !== u.MemberExpression && this.throwError(h.IdentifierExpected, t, i);
1423
- const s = this.parseArguments();
1424
- e = this.finalize({
1431
+ this.context.isAssignmentTarget = !1, t.type !== u.Identifier && t.type !== u.MemberExpression && t.type !== u.SafeMemberExpression && this.throwError(h.IdentifierExpected, e, i);
1432
+ const o = this.parseArguments();
1433
+ t = this.finalize({
1425
1434
  type: u.CallExpression,
1426
- callee: e,
1427
- arguments: s,
1428
- ...this.getItemLocation(t)
1435
+ callee: t,
1436
+ arguments: o,
1437
+ ...this.getItemLocation(e)
1429
1438
  });
1430
1439
  continue;
1431
1440
  }
1432
1441
  case "[": {
1433
- this.context.isAssignmentTarget = !0, this.expectPunctuator("[");
1434
- const s = this.isolateCoverGrammar(() => this.parseExpression());
1435
- this.expectPunctuator("]"), e = this.finalize({
1436
- type: u.MemberExpression,
1442
+ this.context.isAssignmentTarget = !a, this.expectPunctuator("[");
1443
+ const o = this.isolateCoverGrammar(() => this.parseExpression());
1444
+ this.expectPunctuator("]"), t = this.finalize({
1445
+ type: a ? u.SafeMemberExpression : u.MemberExpression,
1437
1446
  computed: !0,
1438
- object: e,
1439
- property: s,
1440
- ...this.getItemLocation(t)
1447
+ object: t,
1448
+ property: o,
1449
+ ...this.getItemLocation(e)
1441
1450
  });
1442
1451
  continue;
1443
1452
  }
1444
1453
  case ".": {
1445
- this.context.isAssignmentTarget = !0, this.expectPunctuator(".");
1446
- const s = this.parseMemberName();
1447
- e = this.finalize({
1448
- type: u.MemberExpression,
1454
+ this.context.isAssignmentTarget = !a, a || this.expectPunctuator(".");
1455
+ const o = this.parseMemberName();
1456
+ t = this.finalize({
1457
+ type: a ? u.SafeMemberExpression : u.MemberExpression,
1449
1458
  computed: !1,
1450
- object: e,
1451
- property: s,
1452
- ...this.getItemLocation(t)
1459
+ object: t,
1460
+ property: o,
1461
+ ...this.getItemLocation(e)
1453
1462
  });
1454
1463
  continue;
1455
1464
  }
1456
1465
  }
1457
- return e;
1466
+ }
1467
+ return r ? this.finalize({
1468
+ type: u.MemberAccessChainExpression,
1469
+ expression: t,
1470
+ ...this.getItemLocation(e)
1471
+ }) : t;
1458
1472
  }
1459
1473
  parseUpdateExpression() {
1460
- const t = this.captureStartMarker();
1461
- let e = this.getMatchingPunctuator(st);
1462
- if (e) {
1474
+ const e = this.captureStartMarker();
1475
+ let t = this.getMatchingPunctuator(ue);
1476
+ if (t) {
1463
1477
  this.readNextRawToken();
1464
1478
  const a = this.captureStartMarker(), o = this.inheritCoverGrammar(this.parseUnaryExpression.bind(this));
1465
- return o.type !== u.Identifier && o.type !== u.MemberExpression && o.type !== u.CallExpression && this.throwError(h.InvalidExpression, a), this.context.isAssignmentTarget || this.tolerateError(h.InvalidLeftHandSideInAssignment, t), this.context.isAssignmentTarget = !1, this.finalize({
1479
+ return o.type !== u.Identifier && o.type !== u.MemberExpression && o.type !== u.CallExpression && this.throwError(h.InvalidExpression, a), this.context.isAssignmentTarget || this.tolerateError(h.InvalidLeftHandSideInAssignment, e), this.context.isAssignmentTarget = !1, this.finalize({
1466
1480
  type: u.UpdateExpression,
1467
- operator: e,
1481
+ operator: t,
1468
1482
  argument: o,
1469
1483
  prefix: !0,
1470
- ...this.getItemLocation(t)
1484
+ ...this.getItemLocation(e)
1471
1485
  });
1472
1486
  }
1473
1487
  const i = this.captureStartMarker(), r = this.inheritCoverGrammar(this.parseLeftHandSideExpression.bind(this)), s = this.captureStartMarker();
1474
- return this.hasLineTerminator || (e = this.getMatchingPunctuator(st), !e) ? r : (r.type !== u.Identifier && r.type !== u.MemberExpression && this.throwError(h.InvalidExpression, i, s), this.context.isAssignmentTarget || this.tolerateError(h.InvalidLeftHandSideInAssignment, t), this.readNextRawToken(), this.context.isAssignmentTarget = !1, this.finalize({
1488
+ return this.hasLineTerminator || (t = this.getMatchingPunctuator(ue), !t) ? r : (r.type !== u.Identifier && r.type !== u.MemberExpression && this.throwError(h.InvalidExpression, i, s), this.context.isAssignmentTarget || this.tolerateError(h.InvalidLeftHandSideInAssignment, e), this.readNextRawToken(), this.context.isAssignmentTarget = !1, this.finalize({
1475
1489
  type: u.UpdateExpression,
1476
- operator: e,
1490
+ operator: t,
1477
1491
  argument: r,
1478
1492
  prefix: !1,
1479
- ...this.getItemLocation(t)
1493
+ ...this.getItemLocation(e)
1480
1494
  }));
1481
1495
  }
1482
1496
  parseUnaryExpression() {
1483
- const t = this.getMatchingPunctuator(Pt);
1484
- if (t) {
1485
- const e = this.captureStartMarker();
1497
+ const e = this.getMatchingPunctuator(Ne);
1498
+ if (e) {
1499
+ const t = this.captureStartMarker();
1486
1500
  this.readNextRawToken();
1487
1501
  const i = this.inheritCoverGrammar(this.parseUnaryExpression.bind(this));
1488
1502
  return this.context.isAssignmentTarget = !1, this.finalize({
1489
1503
  type: u.UnaryExpression,
1490
- operator: t,
1504
+ operator: e,
1491
1505
  argument: i,
1492
1506
  prefix: !0,
1493
- ...this.getItemLocation(e)
1507
+ ...this.getItemLocation(t)
1494
1508
  });
1495
1509
  }
1496
1510
  return this.parseUpdateExpression();
1497
1511
  }
1498
1512
  parseBinaryExpression() {
1499
- const t = this.rawToken;
1500
- let e = this.inheritCoverGrammar(this.parseUnaryExpression.bind(this));
1513
+ const e = this.rawToken;
1514
+ let t = this.inheritCoverGrammar(this.parseUnaryExpression.bind(this));
1501
1515
  if (this.rawToken.type !== l.Punctuator)
1502
- return e;
1516
+ return t;
1503
1517
  const i = this.rawToken.value;
1504
- let r = wt(i);
1518
+ let r = we(i);
1505
1519
  if (r === 0)
1506
- return e;
1520
+ return t;
1507
1521
  this.readNextRawToken(), this.context.isAssignmentTarget = !1;
1508
- const s = [t, this.rawToken];
1509
- let a = e, o = this.inheritCoverGrammar(
1522
+ const s = [e, this.rawToken];
1523
+ let a = t, o = this.inheritCoverGrammar(
1510
1524
  this.parseUnaryExpression.bind(this)
1511
1525
  );
1512
1526
  const c = [a, i, o], d = [r];
1513
- for (; this.rawToken.type === l.Punctuator && (r = wt(this.rawToken.value)) > 0; ) {
1527
+ for (; this.rawToken.type === l.Punctuator && (r = we(this.rawToken.value)) > 0; ) {
1514
1528
  for (; c.length > 2 && r <= d[d.length - 1]; ) {
1515
1529
  o = c.pop();
1516
1530
  const k = c.pop();
1517
1531
  d.pop(), a = c.pop(), s.pop();
1518
- const $ = s[s.length - 1], X = St($, $.lineStart);
1519
- c.push(this.finalize(this.createBinaryOrLogicalExpression(X, k, a, o)));
1532
+ const R = s[s.length - 1], ee = be(R, R.lineStart);
1533
+ c.push(this.finalize(this.createBinaryOrLogicalExpression(ee, k, a, o)));
1520
1534
  }
1521
1535
  c.push(this.rawToken.value), d.push(r), s.push(this.rawToken), this.readNextRawToken(), c.push(this.inheritCoverGrammar(this.parseUnaryExpression.bind(this)));
1522
1536
  }
1523
1537
  let C = c.length - 1;
1524
- e = c[C];
1525
- let x = s.pop();
1538
+ t = c[C];
1539
+ let F = s.pop();
1526
1540
  for (; C > 1; ) {
1527
1541
  const k = s.pop();
1528
1542
  if (!k)
1529
1543
  break;
1530
- const $ = x?.lineStart, X = St(k, $), qt = c[C - 1];
1531
- e = this.finalize(
1532
- this.createBinaryOrLogicalExpression(X, qt, c[C - 2], e)
1533
- ), C -= 2, x = k;
1544
+ const R = F?.lineStart, ee = be(k, R), Ge = c[C - 1];
1545
+ t = this.finalize(
1546
+ this.createBinaryOrLogicalExpression(ee, Ge, c[C - 2], t)
1547
+ ), C -= 2, F = k;
1534
1548
  }
1535
- return e;
1549
+ return t;
1536
1550
  }
1537
- createBinaryOrLogicalExpression(t, e, i, r) {
1538
- const s = Mt.includes(e) ? u.LogicalExpression : u.BinaryExpression;
1539
- return s === u.BinaryExpression ? { type: s, operator: e, left: i, right: r, ...this.getItemLocation(t) } : ((i.type === u.AssignmentExpression || i.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, ...It(i)), (r.type === u.AssignmentExpression || r.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, ...It(i)), { type: s, operator: e, left: i, right: r, ...this.getItemLocation(t) });
1551
+ createBinaryOrLogicalExpression(e, t, i, r) {
1552
+ return Ue.includes(t) ? ((i.type === u.AssignmentExpression || i.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, ...Ie(i)), (r.type === u.AssignmentExpression || r.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, ...Ie(i)), {
1553
+ type: u.LogicalExpression,
1554
+ operator: t,
1555
+ left: i,
1556
+ right: r,
1557
+ ...this.getItemLocation(e)
1558
+ }) : {
1559
+ type: u.BinaryExpression,
1560
+ operator: t,
1561
+ left: i,
1562
+ right: r,
1563
+ ...this.getItemLocation(e)
1564
+ };
1540
1565
  }
1541
1566
  parseAssignmentExpression() {
1542
- const t = this.captureStartMarker(), e = this.inheritCoverGrammar(this.parseBinaryExpression.bind(this)), i = this.captureStartMarker(), r = this.getMatchingPunctuator(Nt);
1567
+ const e = this.captureStartMarker(), t = this.inheritCoverGrammar(this.parseBinaryExpression.bind(this)), i = this.captureStartMarker(), r = this.getMatchingPunctuator(Me);
1543
1568
  if (!r)
1544
- return e;
1545
- e.type !== u.Identifier && e.type !== u.MemberExpression && this.throwError(h.InvalidExpression, t, i), this.context.isAssignmentTarget || this.tolerateError(h.InvalidLeftHandSideInAssignment, t), this.matchPunctuator("=") || (this.context.isAssignmentTarget = !1), this.readNextRawToken();
1569
+ return t;
1570
+ t.type !== u.Identifier && t.type !== u.MemberExpression && this.throwError(h.InvalidExpression, e, i), this.context.isAssignmentTarget || this.tolerateError(h.InvalidLeftHandSideInAssignment, e), this.matchPunctuator("=") || (this.context.isAssignmentTarget = !1), this.readNextRawToken();
1546
1571
  const s = this.isolateCoverGrammar(this.parseAssignmentExpression.bind(this));
1547
1572
  return this.finalize({
1548
1573
  type: u.AssignmentExpression,
1549
- left: e,
1574
+ left: t,
1550
1575
  operator: r,
1551
1576
  right: s,
1552
- ...this.getItemLocation(t)
1577
+ ...this.getItemLocation(e)
1553
1578
  });
1554
1579
  }
1555
1580
  parseExpression() {
1556
1581
  return this.isolateCoverGrammar(this.parseAssignmentExpression.bind(this));
1557
1582
  }
1558
- parseStatements(t) {
1559
- const e = [];
1560
- for (; this.rawToken.type !== l.EOF && !this.matchPunctuator(t); ) {
1583
+ parseStatements(e) {
1584
+ const t = [];
1585
+ for (; this.rawToken.type !== l.EOF && !this.matchPunctuator(e); ) {
1561
1586
  const i = this.parseStatementListItem();
1562
- Dt(i) || e.push(i);
1587
+ pe(i) || t.push(i);
1563
1588
  }
1564
- return e;
1589
+ return t;
1565
1590
  }
1566
1591
  parseStatementListItem() {
1567
1592
  return this.context.isAssignmentTarget = !0, this.matchKeyword(f.Function) ? this.parseFunctionDeclaration() : this.matchKeyword(f.Export) ? this.parseExportDeclaration() : this.matchKeyword(f.Import) ? this.parseImportDeclaration() : this.parseStatement();
1568
1593
  }
1569
1594
  parseBlock() {
1570
- const t = this.captureStartMarker();
1595
+ const e = this.captureStartMarker();
1571
1596
  this.expectPunctuator("{");
1572
- const e = this.parseStatements("}");
1573
- return this.expectPunctuator("}"), this.finalize({ type: u.BlockStatement, body: e, ...this.getItemLocation(t) });
1597
+ const t = this.parseStatements("}");
1598
+ return this.expectPunctuator("}"), this.finalize({ type: u.BlockStatement, body: t, ...this.getItemLocation(e) });
1574
1599
  }
1575
1600
  parseObjectStatement() {
1576
- const t = this.captureStartMarker(), e = this.parseObjectExpression();
1601
+ const e = this.captureStartMarker(), t = this.parseObjectExpression();
1577
1602
  return this.finalize({
1578
1603
  type: u.ExpressionStatement,
1579
- expression: e,
1580
- ...this.getItemLocation(t)
1604
+ expression: t,
1605
+ ...this.getItemLocation(e)
1581
1606
  });
1582
1607
  }
1583
1608
  parseBlockOrObjectStatement() {
1584
- return this.context.curlyParsingType === nt.AsObject ? this.parseObjectStatement() : this.peekAhead((t) => {
1585
- let e = t();
1586
- return !(e.type !== l.Identifier && e.type !== l.StringLiteral || (e = t(), e.type !== l.Punctuator || e.value !== ":"));
1609
+ return this.context.curlyParsingType === re.AsObject ? this.parseObjectStatement() : this.peekAhead((e) => {
1610
+ let t = e();
1611
+ return !(t.type !== l.Identifier && t.type !== l.StringLiteral || (t = e(), t.type !== l.Punctuator || t.value !== ":"));
1587
1612
  }) ? this.parseObjectStatement() : this.parseBlock();
1588
1613
  }
1589
1614
  parseIdentifier() {
1590
- const t = this.rawToken;
1591
- if (t.type !== l.Identifier)
1615
+ const e = this.rawToken;
1616
+ if (e.type !== l.Identifier)
1592
1617
  return null;
1593
- const e = this.captureStartMarker();
1618
+ const t = this.captureStartMarker();
1594
1619
  return this.readNextRawToken(), this.finalize({
1595
1620
  type: u.Identifier,
1596
- name: t.value,
1597
- ...this.getItemLocation(e)
1621
+ name: e.value,
1622
+ ...this.getItemLocation(t)
1598
1623
  });
1599
1624
  }
1600
1625
  parseVariableDeclarator() {
1601
- const t = this.captureStartMarker(), e = this.parseIdentifier();
1602
- e || this.throwUnexpectedToken({ code: h.IdentifierExpected });
1626
+ const e = this.captureStartMarker(), t = this.parseIdentifier();
1627
+ t || this.throwUnexpectedToken({ code: h.IdentifierExpected });
1603
1628
  let i = null;
1604
1629
  if (this.matchPunctuator("=")) {
1605
1630
  this.readNextRawToken();
@@ -1610,45 +1635,45 @@ class se {
1610
1635
  this.throwUnexpectedToken({ rawToken: r, code: h.InvalidVariableAssignment });
1611
1636
  }
1612
1637
  }
1613
- return this.finalize({ type: u.VariableDeclarator, id: e, init: i, ...this.getItemLocation(t) });
1638
+ return this.finalize({ type: u.VariableDeclarator, id: t, init: i, ...this.getItemLocation(e) });
1614
1639
  }
1615
1640
  parseVariableDeclarators() {
1616
- const t = [this.parseVariableDeclarator()];
1641
+ const e = [this.parseVariableDeclarator()];
1617
1642
  for (; this.matchPunctuator(","); )
1618
- this.readNextRawToken(), t.push(this.parseVariableDeclarator());
1619
- return t;
1643
+ this.readNextRawToken(), e.push(this.parseVariableDeclarator());
1644
+ return e;
1620
1645
  }
1621
1646
  parseVariableDeclaration() {
1622
- const t = this.captureStartMarker();
1647
+ const e = this.captureStartMarker();
1623
1648
  this.expectKeyword(f.Var);
1624
- const e = this.parseVariableDeclarators();
1649
+ const t = this.parseVariableDeclarators();
1625
1650
  return this.consumeSemicolon(), this.finalize({
1626
1651
  type: u.VariableDeclaration,
1627
- declarations: e,
1652
+ declarations: t,
1628
1653
  kind: "var",
1629
- ...this.getItemLocation(t)
1654
+ ...this.getItemLocation(e)
1630
1655
  });
1631
1656
  }
1632
1657
  parseEmptyStatement() {
1633
- const t = this.captureStartMarker();
1634
- return this.expectPunctuator(";"), this.finalize({ type: u.EmptyStatement, ...this.getItemLocation(t) });
1658
+ const e = this.captureStartMarker();
1659
+ return this.expectPunctuator(";"), this.finalize({ type: u.EmptyStatement, ...this.getItemLocation(e) });
1635
1660
  }
1636
1661
  parseExpressionStatement() {
1637
- const t = this.captureStartMarker(), e = this.parseExpression();
1662
+ const e = this.captureStartMarker(), t = this.parseExpression();
1638
1663
  return this.consumeSemicolon(), this.finalize({
1639
1664
  type: u.ExpressionStatement,
1640
- expression: e,
1641
- ...this.getItemLocation(t)
1665
+ expression: t,
1666
+ ...this.getItemLocation(e)
1642
1667
  });
1643
1668
  }
1644
1669
  parseIfClause() {
1645
1670
  return this.withBlockContext(y.IfClause, this.parseStatement.bind(this));
1646
1671
  }
1647
1672
  parseIfStatement() {
1648
- const t = this.captureStartMarker();
1673
+ const e = this.captureStartMarker();
1649
1674
  this.expectKeyword(f.If), this.expectPunctuator("(");
1650
- const e = this.captureStartMarker(), i = this.parseExpression(), r = this.captureStartMarker();
1651
- this.expectPunctuator(")"), (i.type === u.AssignmentExpression || i.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, e, r);
1675
+ const t = this.captureStartMarker(), i = this.parseExpression(), r = this.captureStartMarker();
1676
+ this.expectPunctuator(")"), (i.type === u.AssignmentExpression || i.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, t, r);
1652
1677
  const s = this.parseIfClause();
1653
1678
  let a = null;
1654
1679
  return this.matchKeyword(f.Else) && (this.readNextRawToken(), a = this.parseIfClause()), this.finalize({
@@ -1656,57 +1681,57 @@ class se {
1656
1681
  test: i,
1657
1682
  consequent: s,
1658
1683
  alternate: a,
1659
- ...this.getItemLocation(t)
1684
+ ...this.getItemLocation(e)
1660
1685
  });
1661
1686
  }
1662
1687
  parseWhileStatement() {
1663
- const t = this.captureStartMarker();
1688
+ const e = this.captureStartMarker();
1664
1689
  this.expectKeyword(f.While), this.expectPunctuator("(");
1665
- const e = this.captureStartMarker(), i = this.parseExpression(), r = this.captureStartMarker();
1666
- this.expectPunctuator(")"), (i.type === u.AssignmentExpression || i.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, e, r);
1690
+ const t = this.captureStartMarker(), i = this.parseExpression(), r = this.captureStartMarker();
1691
+ this.expectPunctuator(")"), (i.type === u.AssignmentExpression || i.type === u.UpdateExpression) && this.throwError(h.InvalidExpression, t, r);
1667
1692
  const s = this.withBlockContext(y.WhileLoop, this.parseStatement.bind(this));
1668
1693
  return this.finalize({
1669
1694
  type: u.WhileStatement,
1670
1695
  test: i,
1671
1696
  body: s,
1672
- ...this.getItemLocation(t)
1697
+ ...this.getItemLocation(e)
1673
1698
  });
1674
1699
  }
1675
1700
  parseForStatement() {
1676
- let t = u.ForStatement, e = null, i = null, r = null, s = null, a = null;
1701
+ let e = u.ForStatement, t = null, i = null, r = null, s = null, a = null;
1677
1702
  const o = this.captureStartMarker();
1678
1703
  if (this.expectKeyword(f.For), this.expectPunctuator("("), this.matchKeyword(f.Var)) {
1679
1704
  const d = this.captureStartMarker();
1680
1705
  this.readNextRawToken();
1681
1706
  const C = this.parseVariableDeclarators();
1682
- e = this.finalize({
1707
+ t = this.finalize({
1683
1708
  type: u.VariableDeclaration,
1684
1709
  declarations: C,
1685
1710
  kind: "var",
1686
1711
  ...this.getItemLocation(d)
1687
1712
  });
1688
- const x = this.matchKeyword(f.In), k = this.matchContextualKeyword(tt.Of);
1689
- C.length === 1 && (x || k) && (C[0].init && this.throwError(h.ForInOfLoopInitializer, d), t = x ? u.ForInStatement : u.ForOfStatement, s = e);
1713
+ const F = this.matchKeyword(f.In), k = this.matchContextualKeyword(te.Of);
1714
+ C.length === 1 && (F || k) && (C[0].init && this.throwError(h.ForInOfLoopInitializer, d), e = F ? u.ForInStatement : u.ForOfStatement, s = t);
1690
1715
  } else if (!this.matchPunctuator(";")) {
1691
1716
  const d = this.context.isAssignmentTarget, C = this.captureStartMarker();
1692
- e = this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this));
1693
- const x = this.matchKeyword(f.In), k = this.matchContextualKeyword(tt.Of);
1694
- x || k ? (this.context.isAssignmentTarget || this.tolerateError(h.InvalidLeftHandSideInForIn, C), e.type !== u.Identifier && this.throwError(h.InvalidLeftHandSideInForIn, C), t = x ? u.ForInStatement : u.ForOfStatement, s = e) : this.context.isAssignmentTarget = d;
1717
+ t = this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this));
1718
+ const F = this.matchKeyword(f.In), k = this.matchContextualKeyword(te.Of);
1719
+ F || k ? (this.context.isAssignmentTarget || this.tolerateError(h.InvalidLeftHandSideInForIn, C), t.type !== u.Identifier && this.throwError(h.InvalidLeftHandSideInForIn, C), e = F ? u.ForInStatement : u.ForOfStatement, s = t) : this.context.isAssignmentTarget = d;
1695
1720
  }
1696
- t === u.ForStatement ? (this.expectPunctuator(";"), i = this.matchPunctuator(";") ? null : this.isolateCoverGrammar(this.parseExpression.bind(this)), this.expectPunctuator(";"), r = this.matchPunctuator(")") ? null : this.isolateCoverGrammar(this.parseExpression.bind(this))) : (this.readNextRawToken(), a = this.parseExpression()), this.expectPunctuator(")");
1721
+ e === u.ForStatement ? (this.expectPunctuator(";"), i = this.matchPunctuator(";") ? null : this.isolateCoverGrammar(this.parseExpression.bind(this)), this.expectPunctuator(";"), r = this.matchPunctuator(")") ? null : this.isolateCoverGrammar(this.parseExpression.bind(this))) : (this.readNextRawToken(), a = this.parseExpression()), this.expectPunctuator(")");
1697
1722
  const c = this.withBlockContext(
1698
- t === u.ForOfStatement ? y.ForOfLoop : y.ForLoop,
1723
+ e === u.ForOfStatement ? y.ForOfLoop : y.ForLoop,
1699
1724
  () => this.isolateCoverGrammar(this.parseStatement.bind(this))
1700
1725
  );
1701
- return t === u.ForInStatement || t === u.ForOfStatement ? this.finalize({
1702
- type: t,
1726
+ return e === u.ForInStatement || e === u.ForOfStatement ? this.finalize({
1727
+ type: e,
1703
1728
  left: s,
1704
1729
  right: a,
1705
1730
  body: c,
1706
1731
  ...this.getItemLocation(o)
1707
1732
  }) : this.finalize({
1708
- type: t,
1709
- init: e,
1733
+ type: e,
1734
+ init: t,
1710
1735
  test: i,
1711
1736
  update: r,
1712
1737
  body: c,
@@ -1714,18 +1739,18 @@ class se {
1714
1739
  });
1715
1740
  }
1716
1741
  parseContinueStatement() {
1717
- const t = this.captureStartMarker();
1718
- return this.expectKeyword(f.Continue), this.consumeSemicolon(), this.finalize({ type: u.ContinueStatement, ...this.getItemLocation(t) });
1742
+ const e = this.captureStartMarker();
1743
+ return this.expectKeyword(f.Continue), this.consumeSemicolon(), this.finalize({ type: u.ContinueStatement, ...this.getItemLocation(e) });
1719
1744
  }
1720
1745
  parseBreakStatement() {
1721
- const t = this.captureStartMarker();
1722
- return this.expectKeyword(f.Break), this.consumeSemicolon(), this.finalize({ type: u.BreakStatement, ...this.getItemLocation(t) });
1746
+ const e = this.captureStartMarker();
1747
+ return this.expectKeyword(f.Break), this.consumeSemicolon(), this.finalize({ type: u.BreakStatement, ...this.getItemLocation(e) });
1723
1748
  }
1724
1749
  parseReturnStatement() {
1725
- const t = this.captureStartMarker();
1750
+ const e = this.captureStartMarker();
1726
1751
  this.expectKeyword(f.Return);
1727
- const e = !this.matchPunctuator(";") && !this.matchPunctuator("}") && !this.hasLineTerminator && this.rawToken.type !== l.EOF || this.rawToken.type === l.StringLiteral || this.rawToken.type === l.Template ? this.parseExpression() : null;
1728
- return this.consumeSemicolon(), this.finalize({ type: u.ReturnStatement, argument: e, ...this.getItemLocation(t) });
1752
+ const t = !this.matchPunctuator(";") && !this.matchPunctuator("}") && !this.hasLineTerminator && this.rawToken.type !== l.EOF || this.rawToken.type === l.StringLiteral || this.rawToken.type === l.Template ? this.parseExpression() : null;
1753
+ return this.consumeSemicolon(), this.finalize({ type: u.ReturnStatement, argument: t, ...this.getItemLocation(e) });
1729
1754
  }
1730
1755
  parseStatement() {
1731
1756
  switch (this.rawToken.type) {
@@ -1764,91 +1789,91 @@ class se {
1764
1789
  }
1765
1790
  }
1766
1791
  parseFormalParameters() {
1767
- const t = [];
1792
+ const e = [];
1768
1793
  if (this.expectPunctuator("("), !this.matchPunctuator(")"))
1769
1794
  for (; this.rawToken.type !== l.EOF; ) {
1770
- const e = this.parseIdentifier();
1771
- if (e || this.throwUnexpectedToken({ rawToken: this.rawToken, code: h.IdentifierExpected }), t.push(e), this.matchPunctuator(")") || (this.expectPunctuator(","), this.matchPunctuator(")")))
1795
+ const t = this.parseIdentifier();
1796
+ if (t || this.throwUnexpectedToken({ rawToken: this.rawToken, code: h.IdentifierExpected }), e.push(t), this.matchPunctuator(")") || (this.expectPunctuator(","), this.matchPunctuator(")")))
1772
1797
  break;
1773
1798
  }
1774
- return this.expectPunctuator(")"), t;
1799
+ return this.expectPunctuator(")"), e;
1775
1800
  }
1776
1801
  parseFunctionDeclaration() {
1777
1802
  (this.context.blockContext & y.Function) === y.Function && this.throwUnexpectedToken({ code: h.NoFunctionInsideFunction }), ((this.context.blockContext & y.WhileLoop) === y.WhileLoop || (this.context.blockContext & y.ForOfLoop) === y.ForOfLoop || (this.context.blockContext & y.IfClause) === y.IfClause) && this.throwUnexpectedToken({ code: h.NoFunctionInsideBlock });
1778
- const t = this.captureStartMarker();
1803
+ const e = this.captureStartMarker();
1779
1804
  this.expectKeyword(f.Function);
1780
- const e = this.parseIdentifier();
1781
- e || this.throwUnexpectedToken({ code: h.InvalidFunctionIdentifier });
1805
+ const t = this.parseIdentifier();
1806
+ t || this.throwUnexpectedToken({ code: h.InvalidFunctionIdentifier });
1782
1807
  const i = this.parseFormalParameters(), r = this.context.blockContext;
1783
1808
  this.context.blockContext |= y.Function;
1784
1809
  const s = this.parseBlock();
1785
1810
  return this.context.blockContext = r, this.finalize({
1786
1811
  type: u.FunctionDeclaration,
1787
- id: e,
1812
+ id: t,
1788
1813
  params: i,
1789
1814
  body: s,
1790
- ...this.getItemLocation(t)
1815
+ ...this.getItemLocation(e)
1791
1816
  });
1792
1817
  }
1793
1818
  parseScript() {
1794
- const t = this.captureStartMarker(), e = this.parseStatements(), i = this.finalize({
1819
+ const e = this.captureStartMarker(), t = this.parseStatements(), i = this.finalize({
1795
1820
  type: u.Program,
1796
- body: e,
1797
- ...this.getItemLocation(t)
1821
+ body: t,
1822
+ ...this.getItemLocation(e)
1798
1823
  });
1799
1824
  return this.options.tokens && (i.tokens = this.tokens), this.options.tolerant && (i.errors = this.errorHandler.errors), i;
1800
1825
  }
1801
1826
  parseExportDeclaration() {
1802
1827
  this.context.blockContext !== y.None && this.throwUnexpectedToken({ code: h.ModuleExportRootOnly });
1803
- let t = null;
1804
- const e = this.captureStartMarker();
1805
- return this.expectKeyword(f.Export), this.matchKeyword(f.Var) ? t = this.parseVariableDeclaration() : this.matchKeyword("function") ? t = this.parseFunctionDeclaration() : this.throwUnexpectedToken({ code: h.InvalidExpression }), this.finalize({
1828
+ let e = null;
1829
+ const t = this.captureStartMarker();
1830
+ return this.expectKeyword(f.Export), this.matchKeyword(f.Var) ? e = this.parseVariableDeclaration() : this.matchKeyword("function") ? e = this.parseFunctionDeclaration() : this.throwUnexpectedToken({ code: h.InvalidExpression }), this.finalize({
1806
1831
  type: u.ExportNamedDeclaration,
1807
- declaration: t,
1832
+ declaration: e,
1808
1833
  specifiers: [],
1809
1834
  source: null,
1810
- ...this.getItemLocation(e)
1835
+ ...this.getItemLocation(t)
1811
1836
  });
1812
1837
  }
1813
1838
  // The module specified part of a import XX from 'MODULESPECIFIER'
1814
1839
  parseModuleSpecifier() {
1815
- const t = this.captureStartMarker(), e = this.rawToken;
1816
- if (e.type === l.StringLiteral)
1840
+ const e = this.captureStartMarker(), t = this.rawToken;
1841
+ if (t.type === l.StringLiteral)
1817
1842
  return this.readNextRawToken(), this.finalize({
1818
1843
  type: u.Literal,
1819
- value: e.value,
1820
- raw: this.getSourceValue(e),
1844
+ value: t.value,
1845
+ raw: this.getSourceValue(t),
1821
1846
  isString: !0,
1822
- ...this.getItemLocation(t)
1847
+ ...this.getItemLocation(e)
1823
1848
  });
1824
- this.throwError(h.InvalidModuleUri, t);
1849
+ this.throwError(h.InvalidModuleUri, e);
1825
1850
  }
1826
1851
  parseDefaultSpecifier() {
1827
- const t = this.captureStartMarker(), e = this.parseIdentifier();
1828
- return e || this.throwUnexpectedToken({ code: h.IdentifierExpected }), this.finalize({
1852
+ const e = this.captureStartMarker(), t = this.parseIdentifier();
1853
+ return t || this.throwUnexpectedToken({ code: h.IdentifierExpected }), this.finalize({
1829
1854
  type: u.ImportDefaultSpecifier,
1830
- local: e,
1831
- ...this.getItemLocation(t)
1855
+ local: t,
1856
+ ...this.getItemLocation(e)
1832
1857
  });
1833
1858
  }
1834
1859
  parseImportDeclaration() {
1835
1860
  this.context.blockContext !== y.None && this.throwUnexpectedToken({ code: h.ModuleImportRootOnly });
1836
- const t = this.captureStartMarker();
1861
+ const e = this.captureStartMarker();
1837
1862
  this.expectKeyword(f.Import);
1838
- const e = this.parseDefaultSpecifier();
1839
- this.expectContextualKeyword(tt.From);
1863
+ const t = this.parseDefaultSpecifier();
1864
+ this.expectContextualKeyword(te.From);
1840
1865
  const i = this.parseModuleSpecifier();
1841
1866
  return this.finalize({
1842
1867
  type: u.ImportDeclaration,
1843
- specifiers: [e],
1868
+ specifiers: [t],
1844
1869
  source: i,
1845
- ...this.getItemLocation(t)
1870
+ ...this.getItemLocation(e)
1846
1871
  });
1847
1872
  }
1848
1873
  }
1849
- class ue {
1850
- constructor(t, e) {
1851
- this.errorHandler = new Vt(), this.errorHandler.tolerant = e ? typeof e.tolerant == "boolean" && e.tolerant : !1, this.scanner = new _t(t, this.errorHandler), this.trackComments = e ? typeof e.comment == "boolean" && e.comment : !1, this.buffer = [];
1874
+ class ct {
1875
+ constructor(e, t) {
1876
+ this.errorHandler = new _e(), this.errorHandler.tolerant = t ? typeof t.tolerant == "boolean" && t.tolerant : !1, this.scanner = new $e(e, this.errorHandler), this.trackComments = t ? typeof t.comment == "boolean" && t.comment : !1, this.buffer = [];
1852
1877
  }
1853
1878
  errors() {
1854
1879
  return this.errorHandler.errors;
@@ -1858,27 +1883,27 @@ class ue {
1858
1883
  */
1859
1884
  getNextToken() {
1860
1885
  if (this.buffer.length === 0) {
1861
- const t = this.scanner.scanComments();
1862
- if (this.trackComments && t.forEach((e) => {
1863
- const i = this.scanner.source.slice(e.start, e.end), r = {
1864
- type: e.multiLine ? u.BlockComment : u.LineComment,
1886
+ const e = this.scanner.scanComments();
1887
+ if (this.trackComments && e.forEach((t) => {
1888
+ const i = this.scanner.source.slice(t.start, t.end), r = {
1889
+ type: t.multiLine ? u.BlockComment : u.LineComment,
1865
1890
  value: i,
1866
- range: e.range,
1867
- loc: e.loc
1891
+ range: t.range,
1892
+ loc: t.loc
1868
1893
  };
1869
1894
  this.buffer.push(r);
1870
1895
  }), !this.scanner.eof()) {
1871
- const e = {
1896
+ const t = {
1872
1897
  line: this.scanner.lineNumber,
1873
1898
  column: this.scanner.index - this.scanner.lineStart
1874
1899
  }, i = this.scanner.lex(), r = {
1875
1900
  line: this.scanner.lineNumber,
1876
1901
  column: this.scanner.index - this.scanner.lineStart
1877
1902
  }, s = {
1878
- type: Ut[i.type],
1903
+ type: Oe[i.type],
1879
1904
  value: this.scanner.source.slice(i.start, i.end),
1880
1905
  range: [i.start, i.end],
1881
- loc: { start: e, end: r }
1906
+ loc: { start: t, end: r }
1882
1907
  };
1883
1908
  this.buffer.push(s);
1884
1909
  }
@@ -1886,16 +1911,16 @@ class ue {
1886
1911
  return this.buffer.shift();
1887
1912
  }
1888
1913
  }
1889
- function $t(n, t, e) {
1890
- return new se(n, t, e).parseScript();
1914
+ function Re(n, e, t) {
1915
+ return new ot(n, e, t).parseScript();
1891
1916
  }
1892
- function ae(n, t, e) {
1893
- const i = new ue(n, t), r = [];
1917
+ function ht(n, e, t) {
1918
+ const i = new ct(n, e), r = [];
1894
1919
  let s;
1895
1920
  try {
1896
1921
  let a;
1897
1922
  for (; a = i.getNextToken(); )
1898
- e && (a = e(a)), r.push(a);
1923
+ t && (a = t(a)), r.push(a);
1899
1924
  } catch (a) {
1900
1925
  a instanceof Error && i.errorHandler.tolerate(a);
1901
1926
  }
@@ -1923,7 +1948,7 @@ const p = {
1923
1948
  UnexpectedEmptyFunction: "UnexpectedEmptyFunction",
1924
1949
  UnexpectedPropertyIdentifier: "UnexpectedPropertyIdentifier",
1925
1950
  UnknownPropertyIdentifier: "UnknownPropertyIdentifier"
1926
- }, oe = {
1951
+ }, lt = {
1927
1952
  [p.AlreadyDefined]: "'${identifier}' is already defined.",
1928
1953
  [p.ApiConflict]: "'${identifier}' is already defined as an Arcade constant or function.",
1929
1954
  [p.AssignedNeverUsed]: "'${identifier}' is assigned but never used.",
@@ -1945,54 +1970,54 @@ const p = {
1945
1970
  [p.UnexpectedEmptyFunction]: "Unexpected empty function '${identifier}'.",
1946
1971
  [p.UnexpectedPropertyIdentifier]: "Unexpected property identifier.",
1947
1972
  [p.UnknownPropertyIdentifier]: "Unknown property identifier '${identifier}'.",
1948
- ...Ot
1973
+ ...je
1949
1974
  };
1950
- function J(n, t) {
1951
- return n.line - t.line || n.column - t.column;
1975
+ function Q(n, e) {
1976
+ return n.line - e.line || n.column - e.column;
1952
1977
  }
1953
- function ce(n, t) {
1954
- const e = {
1978
+ function Dt(n, e) {
1979
+ const t = {
1955
1980
  start: n.loc.start,
1956
1981
  end: n.loc.end
1957
- }, i = (r) => he(e, r.loc);
1958
- return J(e.start, e.end) < 0 && (e.start = { ...e.start }, t.skipSpaces(e.start), J(e.start, e.end) < 0 && (e.end = { ...e.end }, t.skipSpaces(e.end, !0))), n.leadingComments?.forEach(i), n.trailingComments?.forEach(i), e;
1982
+ }, i = (r) => pt(t, r.loc);
1983
+ return Q(t.start, t.end) < 0 && (t.start = { ...t.start }, e.skipSpaces(t.start), Q(t.start, t.end) < 0 && (t.end = { ...t.end }, e.skipSpaces(t.end, !0))), n.leadingComments?.forEach(i), n.trailingComments?.forEach(i), t;
1959
1984
  }
1960
- function he(n, t) {
1961
- J(t.start, n.start) < 0 && (n.start = t.start), J(n.end, t.end) < 0 && (n.end = t.end);
1985
+ function pt(n, e) {
1986
+ Q(e.start, n.start) < 0 && (n.start = e.start), Q(n.end, e.end) < 0 && (n.end = e.end);
1962
1987
  }
1963
- const le = /\S/u;
1964
- function R(n = "") {
1965
- return !le.test(n);
1988
+ const dt = /\S/u;
1989
+ function W(n = "") {
1990
+ return !dt.test(n);
1966
1991
  }
1967
- const rt = {
1992
+ const se = {
1968
1993
  indentWidth: 2,
1969
1994
  wrapColumn: 80,
1970
1995
  quote: null
1971
1996
  };
1972
- function pt(n) {
1997
+ function de(n) {
1973
1998
  return {
1974
- indentWidth: n?.indentWidth ?? rt.indentWidth,
1975
- wrapColumn: n?.wrapColumn ?? rt.wrapColumn,
1976
- quote: n?.quote ?? rt.quote
1999
+ indentWidth: n?.indentWidth ?? se.indentWidth,
2000
+ wrapColumn: n?.wrapColumn ?? se.wrapColumn,
2001
+ quote: n?.quote ?? se.quote
1977
2002
  };
1978
2003
  }
1979
- const De = /^\s*/u, pe = /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u;
1980
- class Q {
2004
+ const mt = /^\s*/u, ft = /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u;
2005
+ class Z {
1981
2006
  // private cachedIndentWidth: number | void = void 0;
1982
- constructor(t) {
1983
- this.lineRecords = t, this.length = t.length;
2007
+ constructor(e) {
2008
+ this.lineRecords = e, this.length = e.length;
1984
2009
  }
1985
2010
  // private static emptyLines = this.fromString("");
1986
- static fromString(t, e) {
1987
- if (typeof t != "string")
1988
- return t;
1989
- const i = e?.indentWidth;
1990
- return new Q(
1991
- t.split(pe).map((s) => {
1992
- const a = De.exec(s)?.[0] ?? "";
2011
+ static fromString(e, t) {
2012
+ if (typeof e != "string")
2013
+ return e;
2014
+ const i = t?.indentWidth;
2015
+ return new Z(
2016
+ e.split(ft).map((s) => {
2017
+ const a = mt.exec(s)?.[0] ?? "";
1993
2018
  return {
1994
2019
  line: s,
1995
- indentation: de(a, i),
2020
+ indentation: Ct(a, i),
1996
2021
  // Boolean indicating whether this line can be re-indented.
1997
2022
  locked: !1,
1998
2023
  sliceStart: a.length,
@@ -2004,51 +2029,51 @@ class Q {
2004
2029
  toString() {
2005
2030
  return this.sliceString(this.firstPos(), this.lastPos());
2006
2031
  }
2007
- charAt(t) {
2008
- const { line: e, column: i } = t, r = this.lineRecords[e - 1];
2032
+ charAt(e) {
2033
+ const { line: t, column: i } = e, r = this.lineRecords[t - 1];
2009
2034
  if (typeof r > "u" || i < 0)
2010
2035
  return "";
2011
- const s = this.getIndentationAt(e);
2036
+ const s = this.getIndentationAt(t);
2012
2037
  if (i < s)
2013
2038
  return " ";
2014
2039
  const a = i + r.sliceStart - s;
2015
- return a === r.sliceEnd && e < this.length ? `
2040
+ return a === r.sliceEnd && t < this.length ? `
2016
2041
  ` : a >= r.sliceEnd ? "" : r.line.charAt(a);
2017
2042
  }
2018
- getIndentationAt(t) {
2019
- return Math.max(this.lineRecords[t - 1].indentation, 0);
2043
+ getIndentationAt(e) {
2044
+ return Math.max(this.lineRecords[e - 1].indentation, 0);
2020
2045
  }
2021
- getLineLength(t) {
2022
- const e = this.lineRecords[t - 1];
2023
- return this.getIndentationAt(t) + e.sliceEnd - e.sliceStart;
2046
+ getLineLength(e) {
2047
+ const t = this.lineRecords[e - 1];
2048
+ return this.getIndentationAt(e) + t.sliceEnd - t.sliceStart;
2024
2049
  }
2025
- getStatementLineSeparators(t) {
2026
- const e = this.slice(t, this.skipSpaces({ ...t }) ?? this.lastPos());
2027
- return e.length === 1 || !R(e.lineRecords[1].line) ? [`
2050
+ getStatementLineSeparators(e) {
2051
+ const t = this.slice(e, this.skipSpaces({ ...e }) ?? this.lastPos());
2052
+ return t.length === 1 || !W(t.lineRecords[1].line) ? [`
2028
2053
  `] : [`
2029
2054
  `, `
2030
2055
  `];
2031
2056
  }
2032
- getLeadingCommentSeparators(t) {
2033
- const e = this.slice(t, this.skipSpaces({ ...t }) ?? this.lastPos());
2034
- return e.length === 1 ? [" "] : R(e.lineRecords[1].line) ? [`
2057
+ getLeadingCommentSeparators(e) {
2058
+ const t = this.slice(e, this.skipSpaces({ ...e }) ?? this.lastPos());
2059
+ return t.length === 1 ? [" "] : W(t.lineRecords[1].line) ? [`
2035
2060
  `, `
2036
2061
  `] : [`
2037
2062
  `];
2038
2063
  }
2039
- nextPos(t, e = !1) {
2040
- const i = Math.max(t.line, 0);
2041
- return Math.max(t.column, 0) < this.getLineLength(i) ? (t.column += 1, e ? !!this.skipSpaces(t) : !0) : i < this.length ? (t.line += 1, t.column = 0, e ? !!this.skipSpaces(t) : !0) : !1;
2064
+ nextPos(e, t = !1) {
2065
+ const i = Math.max(e.line, 0);
2066
+ return Math.max(e.column, 0) < this.getLineLength(i) ? (e.column += 1, t ? !!this.skipSpaces(e) : !0) : i < this.length ? (e.line += 1, e.column = 0, t ? !!this.skipSpaces(e) : !0) : !1;
2042
2067
  }
2043
- prevPos(t, e = !1) {
2044
- let i = t.line, r = t.column;
2068
+ prevPos(e, t = !1) {
2069
+ let i = e.line, r = e.column;
2045
2070
  if (r < 1) {
2046
2071
  if (i -= 1, i < 1)
2047
2072
  return !1;
2048
2073
  r = this.getLineLength(i);
2049
2074
  } else
2050
2075
  r = Math.min(r - 1, this.getLineLength(i));
2051
- return t.line = i, t.column = r, e ? !!this.skipSpaces(t, !0) : !0;
2076
+ return e.line = i, e.column = r, t ? !!this.skipSpaces(e, !0) : !0;
2052
2077
  }
2053
2078
  firstPos() {
2054
2079
  return { line: 1, column: 0 };
@@ -2059,32 +2084,32 @@ class Q {
2059
2084
  column: this.getLineLength(this.length)
2060
2085
  };
2061
2086
  }
2062
- skipSpaces(t, e = !1) {
2063
- if (e) {
2064
- for (; this.prevPos(t); )
2065
- if (!R(this.charAt(t)) && this.nextPos(t))
2066
- return t;
2087
+ skipSpaces(e, t = !1) {
2088
+ if (t) {
2089
+ for (; this.prevPos(e); )
2090
+ if (!W(this.charAt(e)) && this.nextPos(e))
2091
+ return e;
2067
2092
  return null;
2068
2093
  } else {
2069
- for (; R(this.charAt(t)); )
2070
- if (!this.nextPos(t))
2094
+ for (; W(this.charAt(e)); )
2095
+ if (!this.nextPos(e))
2071
2096
  return null;
2072
- return t;
2097
+ return e;
2073
2098
  }
2074
2099
  }
2075
- slice(t, e) {
2076
- if (!e && !t)
2100
+ slice(e, t) {
2101
+ if (!t && !e)
2077
2102
  return this;
2078
- if (e ??= this.lastPos(), !t)
2103
+ if (t ??= this.lastPos(), !e)
2079
2104
  throw new Error("cannot slice with end but not start");
2080
- const i = this.lineRecords.slice(t.line - 1, e.line);
2081
- return t.line === e.line ? i[0] = U(i[0], t.column, e.column) : (i[0] = U(i[0], t.column), i.push(U(i.pop() ?? i[0], 0, e.column))), new Q(i);
2105
+ const i = this.lineRecords.slice(e.line - 1, t.line);
2106
+ return e.line === t.line ? i[0] = O(i[0], e.column, t.column) : (i[0] = O(i[0], e.column), i.push(O(i.pop() ?? i[0], 0, t.column))), new Z(i);
2082
2107
  }
2083
- sliceString(t = this.firstPos(), e = this.lastPos()) {
2108
+ sliceString(e = this.firstPos(), t = this.lastPos()) {
2084
2109
  const i = [];
2085
- for (let r = t.line; r <= e.line; r++) {
2110
+ for (let r = e.line; r <= t.line; r++) {
2086
2111
  let s = this.lineRecords[r - 1];
2087
- r === t.line ? r === e.line ? s = U(s, t.column, e.column) : s = U(s, t.column) : r === e.line && (s = U(s, 0, e.column));
2112
+ r === e.line ? r === t.line ? s = O(s, e.column, t.column) : s = O(s, e.column) : r === t.line && (s = O(s, 0, t.column));
2088
2113
  let a = "";
2089
2114
  const o = Math.max(s.indentation, 0);
2090
2115
  o > 0 && (a += new Array(o + 1).join(" ")), a += s.line.slice(s.sliceStart, s.sliceEnd), i.push(a);
@@ -2093,14 +2118,14 @@ class Q {
2093
2118
  `);
2094
2119
  }
2095
2120
  }
2096
- function de(n, t = 2) {
2097
- let e = 0;
2121
+ function Ct(n, e = 2) {
2122
+ let t = 0;
2098
2123
  const i = n.length;
2099
2124
  for (let r = 0; r < i; r++)
2100
2125
  switch (n.charCodeAt(r)) {
2101
2126
  case 9: {
2102
- const s = Math.ceil(e / t) * t;
2103
- s === e ? e += t : e = s;
2127
+ const s = Math.ceil(t / e) * e;
2128
+ s === t ? t += e : t = s;
2104
2129
  break;
2105
2130
  }
2106
2131
  case 11:
@@ -2114,31 +2139,31 @@ function de(n, t = 2) {
2114
2139
  case 32:
2115
2140
  // ' '
2116
2141
  default:
2117
- e += 1;
2142
+ t += 1;
2118
2143
  break;
2119
2144
  }
2120
- return e;
2145
+ return t;
2121
2146
  }
2122
- function U(n, t, e) {
2147
+ function O(n, e, t) {
2123
2148
  let i = n.sliceStart, r = n.sliceEnd, s = Math.max(n.indentation, 0);
2124
2149
  const a = s + r - i;
2125
- return e ??= a, t = Math.max(t, 0), e = Math.min(e, a), e = Math.max(e, t), e < s ? (s = e, r = i) : r -= a - e, t < s ? s -= t : (t -= s, s = 0, i += t), n.indentation === s && n.sliceStart === i && n.sliceEnd === r ? n : {
2150
+ return t ??= a, e = Math.max(e, 0), t = Math.min(t, a), t = Math.max(t, e), t < s ? (s = t, r = i) : r -= a - t, e < s ? s -= e : (e -= s, s = 0, i += e), n.indentation === s && n.sliceStart === i && n.sliceEnd === r ? n : {
2126
2151
  line: n.line,
2127
2152
  indentation: s,
2128
2153
  sliceStart: i,
2129
2154
  sliceEnd: r
2130
2155
  };
2131
2156
  }
2132
- function kt(n, t, e) {
2133
- return !n && !e ? "" : n ? e ? `${n}${t}${e}` : n : e;
2157
+ function ke(n, e, t) {
2158
+ return !n && !t ? "" : n ? t ? `${n}${e}${t}` : n : t;
2134
2159
  }
2135
- const me = /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u;
2160
+ const Et = /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u;
2136
2161
  class D {
2137
- constructor(t = []) {
2138
- this.lines = t;
2162
+ constructor(e = []) {
2163
+ this.lines = e;
2139
2164
  }
2140
- static fromString(t) {
2141
- return new D(t.split(me));
2165
+ static fromString(e) {
2166
+ return new D(e.split(Et));
2142
2167
  }
2143
2168
  /**
2144
2169
  * Append the elements lines together into a new FormattedLines.
@@ -2146,11 +2171,11 @@ class D {
2146
2171
  * @param elements
2147
2172
  * @returns
2148
2173
  */
2149
- static appendLines(t = []) {
2150
- const e = new D();
2151
- return t.forEach((i) => {
2152
- i != null && (typeof i == "string" ? e.lines.push(i) : e.lines.push(...i.lines));
2153
- }), e;
2174
+ static appendLines(e = []) {
2175
+ const t = new D();
2176
+ return e.forEach((i) => {
2177
+ i != null && (typeof i == "string" ? t.lines.push(i) : t.lines.push(...i.lines));
2178
+ }), t;
2154
2179
  }
2155
2180
  /**
2156
2181
  * Join the last line of each element to the first line of the next element.
@@ -2160,13 +2185,13 @@ class D {
2160
2185
  * @param elements
2161
2186
  * @returns
2162
2187
  */
2163
- static joinLines(t = [], e = "") {
2188
+ static joinLines(e = [], t = "") {
2164
2189
  const i = new D();
2165
- return t.forEach((r) => {
2190
+ return e.forEach((r) => {
2166
2191
  if (r == null)
2167
2192
  return;
2168
2193
  const s = i.lines.pop() ?? "";
2169
- typeof r == "string" ? i.lines.push(kt(s, e, r)) : (i.lines.push(kt(s, e, r.lines.slice(0)[0])), i.lines.push(...r.lines.slice(1)));
2194
+ typeof r == "string" ? i.lines.push(ke(s, t, r)) : (i.lines.push(ke(s, t, r.lines.slice(0)[0])), i.lines.push(...r.lines.slice(1)));
2170
2195
  }), i;
2171
2196
  }
2172
2197
  /**
@@ -2180,22 +2205,22 @@ class D {
2180
2205
  * @param indentation
2181
2206
  * @returns
2182
2207
  */
2183
- static aggregateLines(t, e, i, r, s) {
2208
+ static aggregateLines(e, t, i, r, s) {
2184
2209
  if (i.isEmpty)
2185
- return t;
2186
- if (!e || t.isEmpty)
2210
+ return e;
2211
+ if (!t || e.isEmpty)
2187
2212
  return i.indentFirstLine(s);
2188
- const a = r.start.line - e.end.line;
2213
+ const a = r.start.line - t.end.line;
2189
2214
  if (a === 0)
2190
- return D.joinLines([t, " ", i]);
2215
+ return D.joinLines([e, " ", i]);
2191
2216
  const o = a === 1 ? void 0 : "";
2192
- return D.appendLines([t, o, i.indentFirstLine(s)]);
2217
+ return D.appendLines([e, o, i.indentFirstLine(s)]);
2193
2218
  }
2194
2219
  get isEmpty() {
2195
2220
  return this.lines.length === 0 || this.lines.length === 1 && this.lines[0].length === 0;
2196
2221
  }
2197
2222
  get maxLineLength() {
2198
- return this.lines.reduce((t, e) => Math.max(t, e.length), 0);
2223
+ return this.lines.reduce((e, t) => Math.max(e, t.length), 0);
2199
2224
  }
2200
2225
  get firstLineLength() {
2201
2226
  return (this.lines[0] ?? "").length;
@@ -2203,58 +2228,68 @@ class D {
2203
2228
  get lastLineLength() {
2204
2229
  return (this.lines[this.lines.length - 1] ?? "").length;
2205
2230
  }
2206
- surroundWith(t = "", e = "") {
2207
- return !t && !e ? this : this.isEmpty ? new D([t + e]) : this.lines.length === 1 ? new D([t + this.lines[0] + e]) : D.joinLines([t, this, e]);
2231
+ surroundWith(e = "", t = "") {
2232
+ return !e && !t ? this : this.isEmpty ? new D([e + t]) : this.lines.length === 1 ? new D([e + this.lines[0] + t]) : D.joinLines([e, this, t]);
2208
2233
  }
2209
- indentFirstLine(t = "") {
2210
- return this.isEmpty ? this : (this.lines[0] = t + this.lines[0], this);
2234
+ indentFirstLine(e = "") {
2235
+ return this.isEmpty ? this : (this.lines[0] = e + this.lines[0], this);
2211
2236
  }
2212
- suffixWith(t) {
2213
- return this.surroundWith("", t);
2237
+ suffixWith(e) {
2238
+ return this.surroundWith("", e);
2214
2239
  }
2215
- toString(t = `
2240
+ toString(e = `
2216
2241
  `) {
2217
- return this.lines.join(t);
2242
+ return this.lines.join(e);
2218
2243
  }
2219
2244
  }
2220
- function dt(n, t) {
2221
- return n * (t.indentWidth ?? 2);
2245
+ function me(n, e) {
2246
+ return n * (e.indentWidth ?? 2);
2222
2247
  }
2223
- function N(n = 0, t) {
2224
- const { indentWidth: e = 2 } = pt(t);
2225
- return new Array(n * e + 1).join(" ");
2248
+ function M(n = 0, e) {
2249
+ const { indentWidth: t = 2 } = de(e);
2250
+ return new Array(n * t + 1).join(" ");
2226
2251
  }
2227
- function W(n) {
2228
- return n.replace(/['"]/gu, (t) => t === '"' ? "'" : '"');
2252
+ function K(n) {
2253
+ return n.replace(/['"]/gu, (e) => e === '"' ? "'" : '"');
2229
2254
  }
2230
- function fe(n, t) {
2255
+ function xt(n, e) {
2231
2256
  switch (n.type) {
2232
2257
  case u.UnaryExpression:
2233
- return Ft(t) && t.object === n;
2258
+ return (Fe(e) || tt(e)) && e.object === n;
2234
2259
  case u.BinaryExpression:
2235
2260
  case u.LogicalExpression:
2236
- switch (t.type) {
2261
+ switch (e.type) {
2237
2262
  case u.UnaryExpression:
2238
2263
  return !0;
2239
2264
  case u.MemberExpression:
2240
- return t.object === n;
2265
+ case u.SafeMemberExpression:
2266
+ return e.object === n;
2241
2267
  case u.BinaryExpression:
2242
2268
  case u.LogicalExpression:
2243
- return H[t.operator] > H[n.operator];
2269
+ return q[e.operator] > q[n.operator];
2244
2270
  default:
2245
2271
  return !1;
2246
2272
  }
2247
2273
  case u.Literal:
2248
- return Ft(t) && typeof n.value == "number" && t.object === n;
2274
+ return Fe(e) && typeof n.value == "number" && e.object === n;
2249
2275
  case u.AssignmentExpression:
2250
- switch (t.type) {
2276
+ switch (e.type) {
2251
2277
  case u.UnaryExpression:
2252
2278
  case u.BinaryExpression:
2253
2279
  case u.LogicalExpression:
2254
2280
  case u.ReturnStatement:
2255
2281
  return !0;
2256
2282
  case u.MemberExpression:
2257
- return t.object === n;
2283
+ case u.SafeMemberExpression:
2284
+ return e.object === n;
2285
+ default:
2286
+ return !1;
2287
+ }
2288
+ case u.MemberAccessChainExpression:
2289
+ switch (e.type) {
2290
+ case u.MemberExpression:
2291
+ case u.SafeMemberExpression:
2292
+ return e.object === n;
2258
2293
  default:
2259
2294
  return !1;
2260
2295
  }
@@ -2262,99 +2297,101 @@ function fe(n, t) {
2262
2297
  return !1;
2263
2298
  }
2264
2299
  }
2265
- function E(n, t, e) {
2300
+ function E(n, e, t) {
2266
2301
  switch (n?.type) {
2267
2302
  case u.BinaryExpression:
2268
2303
  case u.LogicalExpression:
2269
- return Ce(n, t, e);
2304
+ return gt(n, e, t);
2270
2305
  case u.AssignmentExpression:
2271
- return new mt(n, t, e);
2306
+ return new fe(n, e, t);
2272
2307
  case u.MemberExpression:
2273
- return new Kt(n, t, e);
2308
+ case u.SafeMemberExpression:
2309
+ return new He(n, e, t);
2274
2310
  case u.Identifier:
2275
- return new ht(n, t, e);
2311
+ return new le(n, e, t);
2276
2312
  case u.CallExpression:
2277
- return new ge(n, t, e);
2313
+ return new At(n, e, t);
2278
2314
  case u.ObjectExpression:
2279
- return M(n, t, e);
2315
+ return U(n, e, t);
2280
2316
  case u.ArrayExpression:
2281
- return M(n, t, e);
2317
+ return U(n, e, t);
2282
2318
  case u.Literal:
2283
- return new ht(n, t, e);
2319
+ return new le(n, e, t);
2284
2320
  case u.UpdateExpression:
2285
2321
  case u.UnaryExpression:
2286
- return new Wt(n, t, e);
2322
+ case u.MemberAccessChainExpression:
2323
+ return new Ke(n, e, t);
2287
2324
  case u.TemplateLiteral:
2288
- return new xe(n, t, e);
2325
+ return new Bt(n, e, t);
2289
2326
  case u.VariableDeclaration:
2290
- return new lt(n, t, e);
2327
+ return new De(n, e, t);
2291
2328
  default:
2292
2329
  throw new Error(`unknown type: ${JSON.stringify(n)}`);
2293
2330
  }
2294
2331
  }
2295
- function M(n, t, e) {
2296
- const i = new Y(n, t, e);
2332
+ function U(n, e, t) {
2333
+ const i = new Y(n, e, t);
2297
2334
  switch (n.type) {
2298
2335
  case u.ArrayExpression:
2299
2336
  return i.setupCollection(
2300
- n.elements.map((r) => E(r, n, e)),
2337
+ n.elements.map((r) => E(r, n, t)),
2301
2338
  "SquareBrackets"
2302
2339
  ), i;
2303
2340
  case u.ObjectExpression:
2304
2341
  return i.setupCollection(
2305
- n.properties.map((r) => new Fe(r, n, e)),
2342
+ n.properties.map((r) => new yt(r, n, t)),
2306
2343
  "CurlyBrackets"
2307
2344
  ), i;
2308
2345
  case u.VariableDeclaration:
2309
2346
  return i.prefix = "var ", i.setupCollection(
2310
- n.declarations.map((r) => Rt(r, n, e)),
2347
+ n.declarations.map((r) => We(r, n, t)),
2311
2348
  "None"
2312
2349
  ), i;
2313
2350
  case u.FunctionDeclaration:
2314
2351
  return i.prefix = `function ${n.id.name}`, i.setupCollection(
2315
- n.params.map((r) => E(r, n, e)),
2352
+ n.params.map((r) => E(r, n, t)),
2316
2353
  "Parentheses"
2317
2354
  ), i;
2318
2355
  case u.ForStatement:
2319
2356
  return i.prefix = "for ", i.setupCollection(
2320
2357
  [
2321
- E(n.init, n, e),
2322
- E(n.test, n, e),
2323
- E(n.update, n, e)
2358
+ E(n.init, n, t),
2359
+ E(n.test, n, t),
2360
+ E(n.update, n, t)
2324
2361
  ],
2325
2362
  "Parentheses",
2326
2363
  ";"
2327
2364
  ), i;
2328
2365
  case u.ForInStatement:
2329
2366
  case u.ForOfStatement:
2330
- return i.prefix = "for ", i.setupCollection([new mt(n, t, e)], "Parentheses", ""), i;
2367
+ return i.prefix = "for ", i.setupCollection([new fe(n, e, t)], "Parentheses", ""), i;
2331
2368
  case u.IfStatement:
2332
- return i.prefix = "if ", i.setupCollection([E(n.test, n, e)], "Parentheses", ""), i;
2369
+ return i.prefix = "if ", i.setupCollection([E(n.test, n, t)], "Parentheses", ""), i;
2333
2370
  case u.WhileStatement:
2334
- return i.prefix = "while ", i.setupCollection([E(n.test, n, e)], "Parentheses", ""), i;
2371
+ return i.prefix = "while ", i.setupCollection([E(n.test, n, t)], "Parentheses", ""), i;
2335
2372
  default:
2336
2373
  return i;
2337
2374
  }
2338
2375
  }
2339
- function Rt(n, t, e) {
2340
- return n.init ? new mt(n, t, e) : new ht(n.id, t, e);
2376
+ function We(n, e, t) {
2377
+ return n.init ? new fe(n, e, t) : new le(n.id, e, t);
2341
2378
  }
2342
- function Ce(n, t, e) {
2379
+ function gt(n, e, t) {
2343
2380
  const r = [
2344
- ...Z(n.left, n.operator),
2345
- ...Z(n.right, n.operator)
2346
- ].map((a) => E(a, n, e)), s = new Y(n, t, e);
2381
+ ...X(n.left, n.operator),
2382
+ ...X(n.right, n.operator)
2383
+ ].map((a) => E(a, n, t)), s = new Y(n, e, t);
2347
2384
  return s.setupCollection(r, "None", ` ${n.operator}`), s;
2348
2385
  }
2349
- function Z(n, t) {
2350
- return n.type !== u.BinaryExpression && n.type !== u.LogicalExpression ? [n] : n.operator !== t ? [n] : [
2351
- ...Z(n.left, t),
2352
- ...Z(n.right, t)
2386
+ function X(n, e) {
2387
+ return n.type !== u.BinaryExpression && n.type !== u.LogicalExpression ? [n] : n.operator !== e ? [n] : [
2388
+ ...X(n.left, e),
2389
+ ...X(n.right, e)
2353
2390
  ];
2354
2391
  }
2355
- class b {
2356
- constructor(t, e, i) {
2357
- this.node = t, this.parent = e, this.options = i, this.prefix = "", this.suffix = "", this.groupingParentheses = !1, this.groupingParentheses = fe(t, e);
2392
+ class L {
2393
+ constructor(e, t, i) {
2394
+ this.node = e, this.parent = t, this.options = i, this.prefix = "", this.suffix = "", this.groupingParentheses = !1, this.groupingParentheses = xt(e, t);
2358
2395
  }
2359
2396
  get openingParenthesis() {
2360
2397
  return this.groupingParentheses ? "(" : "";
@@ -2368,22 +2405,22 @@ class b {
2368
2405
  get trailingString() {
2369
2406
  return [this.closingParenthesis, this.suffix].join("");
2370
2407
  }
2371
- finalize(t) {
2372
- return typeof t == "string" && (t = D.fromString(t)), t.surroundWith(this.leadingString, this.trailingString);
2408
+ finalize(e) {
2409
+ return typeof e == "string" && (e = D.fromString(e)), e.surroundWith(this.leadingString, this.trailingString);
2373
2410
  }
2374
2411
  }
2375
- class Y extends b {
2376
- constructor(t, e, i) {
2377
- super(t, e, i), this.node = t, this.parent = e, this.options = i, this.type = "CollectionPrinter", this.bracketsType = "None", this.separator = ",", this.printers = [];
2412
+ class Y extends L {
2413
+ constructor(e, t, i) {
2414
+ super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "CollectionPrinter", this.bracketsType = "None", this.separator = ",", this.printers = [];
2378
2415
  }
2379
- setupCollection(t = [], e = "None", i) {
2380
- return this.bracketsType = e, this.separator = i ?? this.separator, this.printers = t, this;
2416
+ setupCollection(e = [], t = "None", i) {
2417
+ return this.bracketsType = t, this.separator = i ?? this.separator, this.printers = e, this;
2381
2418
  }
2382
- getOpeningBracket(t = !1, e = "singleLine") {
2419
+ getOpeningBracket(e = !1, t = "singleLine") {
2383
2420
  if (this.bracketsType === "None")
2384
2421
  return "";
2385
2422
  if (this.bracketsType === "CurlyBrackets")
2386
- return `{${t || e === "multiline" ? "" : " "}`;
2423
+ return `{${e || t === "multiline" ? "" : " "}`;
2387
2424
  switch (this.bracketsType) {
2388
2425
  case "Parentheses":
2389
2426
  return "(";
@@ -2393,11 +2430,11 @@ class Y extends b {
2393
2430
  return "";
2394
2431
  }
2395
2432
  }
2396
- getClosingBracket(t = !1, e = "singleLine") {
2433
+ getClosingBracket(e = !1, t = "singleLine") {
2397
2434
  if (this.bracketsType === "None")
2398
2435
  return "";
2399
2436
  if (this.bracketsType === "CurlyBrackets")
2400
- return `${t || e === "multiline" ? "" : " "}}`;
2437
+ return `${e || t === "multiline" ? "" : " "}}`;
2401
2438
  switch (this.bracketsType) {
2402
2439
  case "Parentheses":
2403
2440
  return ")";
@@ -2407,250 +2444,254 @@ class Y extends b {
2407
2444
  return "";
2408
2445
  }
2409
2446
  }
2410
- getLinesLevel(t = 0) {
2411
- return this.bracketsType !== "None" || Xt(this.parent) || jt(this.parent) || (ot(this.node) || at(this.node)) && (ot(this.parent) || at(this.parent)) ? t + 1 : t;
2447
+ getLinesLevel(e = 0) {
2448
+ return this.bracketsType !== "None" || et(this.parent) || Ve(this.parent) || (ce(this.node) || oe(this.node)) && (ce(this.parent) || oe(this.parent)) ? e + 1 : e;
2412
2449
  }
2413
- finalize(t, e = "singleLine", i = 0) {
2450
+ finalize(e, t = "singleLine", i = 0) {
2414
2451
  if (this.bracketsType === "None")
2415
- return super.finalize(t);
2416
- const r = this.getOpeningBracket(t.isEmpty, e), s = this.getClosingBracket(t.isEmpty, e);
2417
- if (e === "singleLine")
2418
- return super.finalize(t.surroundWith(r, s));
2419
- const a = N(i, this.options);
2420
- return super.finalize(D.appendLines([r, t, a + s]));
2452
+ return super.finalize(e);
2453
+ const r = this.getOpeningBracket(e.isEmpty, t), s = this.getClosingBracket(e.isEmpty, t);
2454
+ if (t === "singleLine")
2455
+ return super.finalize(e.surroundWith(r, s));
2456
+ const a = M(i, this.options);
2457
+ return super.finalize(D.appendLines([r, e, a + s]));
2421
2458
  }
2422
- singleLineFormat(t = 0) {
2423
- const e = this.printers.length - 1;
2459
+ singleLineFormat(e = 0) {
2460
+ const t = this.printers.length - 1;
2424
2461
  return D.joinLines(
2425
2462
  this.printers.map(
2426
- (i, r) => i.format("singleLine", t).suffixWith(r < e ? this.separator : "")
2463
+ (i, r) => i.format("singleLine", e).suffixWith(r < t ? this.separator : "")
2427
2464
  ),
2428
2465
  " "
2429
2466
  );
2430
2467
  }
2431
- optimizedPrinterFormat(t, e, i = 0) {
2432
- const r = this.getLinesLevel(i), s = N(r, this.options), a = this.bracketsType === "None" && e === 0 ? "" : s, o = e < this.printers.length - 1 ? this.separator : "", c = t.format("singleLine", r).suffixWith(o);
2433
- return c.maxLineLength + s.length <= this.options.wrapColumn ? c.indentFirstLine(a) : t.format("multiline", r).suffixWith(o).indentFirstLine(a);
2468
+ optimizedPrinterFormat(e, t, i = 0) {
2469
+ const r = this.getLinesLevel(i), s = M(r, this.options), a = this.bracketsType === "None" && t === 0 ? "" : s, o = t < this.printers.length - 1 ? this.separator : "", c = e.format("singleLine", r).suffixWith(o);
2470
+ return c.maxLineLength + s.length <= this.options.wrapColumn ? c.indentFirstLine(a) : e.format("multiline", r).suffixWith(o).indentFirstLine(a);
2434
2471
  }
2435
- multilineFormat(t = 0) {
2472
+ multilineFormat(e = 0) {
2436
2473
  return D.appendLines(
2437
- this.printers.map((e, i) => this.optimizedPrinterFormat(e, i, t))
2474
+ this.printers.map((t, i) => this.optimizedPrinterFormat(t, i, e))
2438
2475
  );
2439
2476
  }
2440
- format(t = "singleLine", e = 0) {
2477
+ format(e = "singleLine", t = 0) {
2441
2478
  if (this.printers.length === 0) {
2442
- const r = this.getOpeningBracket(!0, t), s = this.getClosingBracket(!0, t);
2479
+ const r = this.getOpeningBracket(!0, e), s = this.getClosingBracket(!0, e);
2443
2480
  return super.finalize(D.fromString(r + s));
2444
2481
  }
2445
- if (t === "singleLine") {
2446
- const r = this.singleLineFormat(e);
2447
- return this.finalize(r, t, e);
2482
+ if (e === "singleLine") {
2483
+ const r = this.singleLineFormat(t);
2484
+ return this.finalize(r, e, t);
2448
2485
  }
2449
- const i = this.multilineFormat(e);
2450
- return this.finalize(i, t, e);
2486
+ const i = this.multilineFormat(t);
2487
+ return this.finalize(i, e, t);
2451
2488
  }
2452
2489
  }
2453
- const Ee = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/u;
2454
- class ht extends b {
2455
- constructor(t, e, i) {
2456
- super(t, e, i), this.node = t, this.parent = e, this.options = i, this.type = "StringPrinter";
2490
+ const Ft = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/u;
2491
+ class le extends L {
2492
+ constructor(e, t, i) {
2493
+ super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "StringPrinter";
2457
2494
  }
2458
2495
  format() {
2459
- if (I(this.node))
2496
+ if (b(this.node))
2460
2497
  return this.finalize(this.node.name);
2461
2498
  if (typeof this.node.value != "string")
2462
2499
  return this.finalize(this.node.raw);
2463
- if (ie(this.parent) && this.parent.key === this.node && zt(this.node) && typeof this.node.value == "string" && Ee.test(this.node.value))
2500
+ if (st(this.parent) && this.parent.key === this.node && ze(this.node) && typeof this.node.value == "string" && Ft.test(this.node.value))
2464
2501
  return this.finalize(this.node.value);
2465
2502
  switch (this.options.quote) {
2466
2503
  case "auto": {
2467
- const t = JSON.stringify(this.node.value), e = W(JSON.stringify(W(this.node.value)));
2468
- return this.finalize(t.length > e.length ? e : t);
2504
+ const e = JSON.stringify(this.node.value), t = K(JSON.stringify(K(this.node.value)));
2505
+ return this.finalize(e.length > t.length ? t : e);
2469
2506
  }
2470
2507
  case "single":
2471
- return this.finalize(W(JSON.stringify(W(this.node.value))));
2508
+ return this.finalize(K(JSON.stringify(K(this.node.value))));
2472
2509
  default:
2473
2510
  return this.finalize(JSON.stringify(this.node.value));
2474
2511
  }
2475
2512
  }
2476
2513
  }
2477
- class Wt extends b {
2478
- constructor(t, e, i) {
2479
- super(t, e, i), this.node = t, this.parent = e, this.options = i, this.type = "SingleExpressionPrinter";
2480
- const r = te(t), s = ee(t);
2514
+ class Ke extends L {
2515
+ constructor(e, t, i) {
2516
+ super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "SingleExpressionPrinter";
2517
+ const r = nt(e), s = rt(e);
2481
2518
  if (r || s) {
2482
- this.prefix = r ? t.operator : "", this.suffix = s && !t.prefix ? t.operator : "", this.printer = E(t.argument, t, this.options);
2519
+ this.prefix = r ? e.operator : "", this.suffix = s && !e.prefix ? e.operator : "", this.printer = E(e.argument, e, this.options);
2520
+ return;
2521
+ }
2522
+ if (it(e)) {
2523
+ this.printer = E(e.expression, e, this.options);
2483
2524
  return;
2484
2525
  }
2485
- this.printer = E(t, e, this.options);
2526
+ this.printer = E(e, t, this.options);
2486
2527
  }
2487
- format(t = "singleLine", e = 0) {
2488
- return this.finalize(this.printer.format(t, e));
2528
+ format(e = "singleLine", t = 0) {
2529
+ return this.finalize(this.printer.format(e, t));
2489
2530
  }
2490
2531
  }
2491
- class lt extends b {
2492
- constructor(t, e, i) {
2493
- super(t, e, i), this.node = t, this.parent = e, this.options = i, this.type = "VariableDeclaratorsPrinter", t.declarations.length === 1 ? (this.printer = Rt(t.declarations[0], t, this.options), this.printer.prefix = "var ") : this.printer = M(t, e, this.options);
2532
+ class De extends L {
2533
+ constructor(e, t, i) {
2534
+ super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "VariableDeclaratorsPrinter", e.declarations.length === 1 ? (this.printer = We(e.declarations[0], e, this.options), this.printer.prefix = "var ") : this.printer = U(e, t, this.options);
2494
2535
  }
2495
- format(t = "singleLine", e = 0) {
2496
- return this.finalize(this.printer.format(t, e));
2536
+ format(e = "singleLine", t = 0) {
2537
+ return this.finalize(this.printer.format(e, t));
2497
2538
  }
2498
2539
  }
2499
- class ge extends b {
2500
- constructor(t, e, i) {
2501
- super(t, e, i), this.node = t, this.parent = e, this.options = i, this.type = "CallExpressionPrinter", this.argumentsPrinter = new Y(t, e, i), this.argumentsPrinter.setupCollection(
2502
- t.arguments.map((r) => E(r, t, i)),
2540
+ class At extends L {
2541
+ constructor(e, t, i) {
2542
+ super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "CallExpressionPrinter", this.argumentsPrinter = new Y(e, t, i), this.argumentsPrinter.setupCollection(
2543
+ e.arguments.map((r) => E(r, e, i)),
2503
2544
  "Parentheses"
2504
- ), I(t.callee) ? this.argumentsPrinter.prefix = t.callee.name : this.memberExpressionPrinter = new Kt(t.callee, e, i);
2545
+ ), b(e.callee) ? this.argumentsPrinter.prefix = e.callee.name : this.memberExpressionPrinter = new He(e.callee, t, i);
2505
2546
  }
2506
- format(t = "singleLine", e = 0) {
2547
+ format(e = "singleLine", t = 0) {
2507
2548
  if (!this.memberExpressionPrinter)
2508
- return this.finalize(this.argumentsPrinter.format(t, e));
2509
- let i = this.memberExpressionPrinter.format("singleLine", e), r = this.argumentsPrinter.format("singleLine", e);
2510
- if (t === "singleLine")
2549
+ return this.finalize(this.argumentsPrinter.format(e, t));
2550
+ let i = this.memberExpressionPrinter.format("singleLine", t), r = this.argumentsPrinter.format("singleLine", t);
2551
+ if (e === "singleLine")
2511
2552
  return this.finalize(D.joinLines([i, r]));
2512
- let s = dt(e, this.options) + this.leadingString.length + i.firstLineLength;
2513
- return s + 1 < this.options.wrapColumn ? (r = this.argumentsPrinter.format("multiline", e), this.finalize(D.joinLines([i, r]))) : (i = this.memberExpressionPrinter.format("multiline", e), s = i.lastLineLength, s + r.maxLineLength > this.options.wrapColumn && (r = this.argumentsPrinter.format("multiline", e + 1)), this.finalize(D.joinLines([i, r])));
2553
+ let s = me(t, this.options) + this.leadingString.length + i.firstLineLength;
2554
+ return s + 1 < this.options.wrapColumn ? (r = this.argumentsPrinter.format("multiline", t), this.finalize(D.joinLines([i, r]))) : (i = this.memberExpressionPrinter.format("multiline", t), s = i.lastLineLength, s + r.maxLineLength > this.options.wrapColumn && (r = this.argumentsPrinter.format("multiline", t + 1)), this.finalize(D.joinLines([i, r])));
2514
2555
  }
2515
2556
  }
2516
- class Kt extends b {
2517
- constructor(t, e, i) {
2518
- if (super(t, e, i), this.node = t, this.parent = e, this.options = i, this.type = "MemberExpressionPrinter", this.objectPrinter = E(t.object, t, this.options), t.computed) {
2519
- const r = new Y(t.property, t, this.options);
2520
- r.setupCollection([E(t.property, t, this.options)], "SquareBrackets"), this.propertyPrinter = r;
2557
+ class He extends L {
2558
+ constructor(e, t, i) {
2559
+ if (super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "MemberExpressionPrinter", this.objectPrinter = E(e.object, e, this.options), e.computed) {
2560
+ const r = new Y(e.property, e, this.options);
2561
+ r.setupCollection([E(e.property, e, this.options)], "SquareBrackets"), r.prefix = e.type === "SafeMemberExpression" ? w : "", this.propertyPrinter = r;
2521
2562
  } else {
2522
- const r = new Wt(t.property, t, this.options);
2523
- r.prefix = ".", this.propertyPrinter = r;
2563
+ const r = new Ke(e.property, e, this.options);
2564
+ r.prefix = e.type === "SafeMemberExpression" ? w : ".", this.propertyPrinter = r;
2524
2565
  }
2525
2566
  }
2526
- format(t = "singleLine", e = 0) {
2527
- let i = this.objectPrinter.format("singleLine", e), r = this.propertyPrinter.format("singleLine", e);
2528
- if (t === "singleLine")
2567
+ format(e = "singleLine", t = 0) {
2568
+ let i = this.objectPrinter.format("singleLine", t), r = this.propertyPrinter.format("singleLine", t);
2569
+ if (e === "singleLine")
2529
2570
  return this.finalize(D.joinLines([i, r]));
2530
- let s = dt(e, this.options) + this.leadingString.length + i.firstLineLength;
2531
- s > this.options.wrapColumn && (i = this.objectPrinter.format("multiline", e), s = i.lastLineLength);
2571
+ let s = me(t, this.options) + this.leadingString.length + i.firstLineLength;
2572
+ s > this.options.wrapColumn && (i = this.objectPrinter.format("multiline", t), s = i.lastLineLength);
2532
2573
  let a = r.firstLineLength + this.trailingString.length;
2533
2574
  if (s + a < this.options.wrapColumn)
2534
2575
  return this.finalize(D.joinLines([i, r]));
2535
2576
  if (this.node.computed)
2536
- return this.finalize(D.joinLines([i, this.propertyPrinter.format("multiline", e)]));
2537
- const o = e + 1, c = N(o, this.options);
2538
- return r = this.propertyPrinter.format("singleLine", e), a = c.length + r.lastLineLength + this.trailingString.length, a > this.options.wrapColumn && (r = this.propertyPrinter.format("multiline", o)), this.finalize(D.appendLines([i, r.indentFirstLine(c)]));
2577
+ return this.finalize(D.joinLines([i, this.propertyPrinter.format("multiline", t)]));
2578
+ const o = t + 1, c = M(o, this.options);
2579
+ return r = this.propertyPrinter.format("singleLine", t), a = c.length + r.lastLineLength + this.trailingString.length, a > this.options.wrapColumn && (r = this.propertyPrinter.format("multiline", o)), this.finalize(D.appendLines([i, r.indentFirstLine(c)]));
2539
2580
  }
2540
2581
  }
2541
- class Fe extends b {
2542
- constructor(t, e, i) {
2543
- super(t, e, i), this.node = t, this.parent = e, this.options = i, this.type = "PropertyPrinter", this.key = E(t.key, t, this.options), t.shorthand || (this.key.suffix = ":", this.value = E(t.value, t, this.options));
2582
+ class yt extends L {
2583
+ constructor(e, t, i) {
2584
+ super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "PropertyPrinter", this.key = E(e.key, e, this.options), e.shorthand || (this.key.suffix = ":", this.value = E(e.value, e, this.options));
2544
2585
  }
2545
- format(t = "singleLine", e = 0) {
2586
+ format(e = "singleLine", t = 0) {
2546
2587
  if (this.node.shorthand || !this.value)
2547
- return this.finalize(this.key.format(t, e));
2548
- const i = this.key.format("singleLine", e);
2549
- if (t === "singleLine") {
2550
- const o = this.value.format("singleLine", e);
2588
+ return this.finalize(this.key.format(e, t));
2589
+ const i = this.key.format("singleLine", t);
2590
+ if (e === "singleLine") {
2591
+ const o = this.value.format("singleLine", t);
2551
2592
  return this.finalize(D.joinLines([i, o], " "));
2552
2593
  }
2553
- if (G(this.node.value) || G(this.node.value)) {
2554
- const o = this.value.format("multiline", e);
2594
+ if (J(this.node.value) || J(this.node.value)) {
2595
+ const o = this.value.format("multiline", t);
2555
2596
  return this.finalize(D.joinLines([i, o], " "));
2556
2597
  }
2557
- const r = N(e + 1, this.options);
2558
- let s = this.value.format("singleLine", e + 1).indentFirstLine(r);
2559
- return s.maxLineLength + this.trailingString.length + 1 <= this.options.wrapColumn ? this.finalize(D.appendLines([i, s])) : (s = this.value.format("multiline", e + 1).indentFirstLine(r), this.finalize(D.appendLines([i, s])));
2598
+ const r = M(t + 1, this.options);
2599
+ let s = this.value.format("singleLine", t + 1).indentFirstLine(r);
2600
+ return s.maxLineLength + this.trailingString.length + 1 <= this.options.wrapColumn ? this.finalize(D.appendLines([i, s])) : (s = this.value.format("multiline", t + 1).indentFirstLine(r), this.finalize(D.appendLines([i, s])));
2560
2601
  }
2561
2602
  }
2562
- class mt extends b {
2563
- constructor(t, e, i) {
2564
- switch (super(t, e, i), this.node = t, this.parent = e, this.options = i, this.type = "OperationPrinter", this.operator = "", this.noNewLineWrapping = !1, t.type) {
2603
+ class fe extends L {
2604
+ constructor(e, t, i) {
2605
+ switch (super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "OperationPrinter", this.operator = "", this.noNewLineWrapping = !1, e.type) {
2565
2606
  case u.AssignmentExpression:
2566
- this.leftPrinter = E(t.left, t, this.options), this.operator = ` ${t.operator}`, this.rightPrinter = E(t.right, t, this.options), this.noNewLineWrapping = (I(t.left) || zt(t.left)) && (G(t.right) || gt(t.right));
2607
+ this.leftPrinter = E(e.left, e, this.options), this.operator = ` ${e.operator}`, this.rightPrinter = E(e.right, e, this.options), this.noNewLineWrapping = (b(e.left) || ze(e.left)) && (J(e.right) || ge(e.right));
2567
2608
  return;
2568
2609
  case u.VariableDeclarator:
2569
- this.leftPrinter = E(t.id, t, this.options), t.init && (this.operator = " =", this.rightPrinter = E(t.init, t, this.options)), this.noNewLineWrapping = G(t.init) || gt(t.init);
2610
+ this.leftPrinter = E(e.id, e, this.options), e.init && (this.operator = " =", this.rightPrinter = E(e.init, e, this.options)), this.noNewLineWrapping = J(e.init) || ge(e.init);
2570
2611
  return;
2571
2612
  case u.ForInStatement:
2572
2613
  case u.ForOfStatement:
2573
- this.leftPrinter = E(t.left, t, this.options), this.operator = t.type === "ForInStatement" ? " in" : " of", this.rightPrinter = E(t.right, t, this.options);
2614
+ this.leftPrinter = E(e.left, e, this.options), this.operator = e.type === "ForInStatement" ? " in" : " of", this.rightPrinter = E(e.right, e, this.options);
2574
2615
  return;
2575
2616
  case u.BinaryExpression:
2576
2617
  case u.LogicalExpression:
2577
- this.leftPrinter = E(t.left, t, this.options), this.operator = ` ${t.operator}`, this.rightPrinter = E(t.right, t, this.options);
2618
+ this.leftPrinter = E(e.left, e, this.options), this.operator = ` ${e.operator}`, this.rightPrinter = E(e.right, e, this.options);
2578
2619
  return;
2579
2620
  }
2580
2621
  }
2581
- format(t = "singleLine", e = 0) {
2622
+ format(e = "singleLine", t = 0) {
2582
2623
  if (!this.rightPrinter)
2583
- return this.finalize(this.leftPrinter.format(t, e));
2584
- let i = this.leftPrinter.format("singleLine", e).suffixWith(this.operator), r = this.rightPrinter.format("singleLine", e);
2585
- if (t === "singleLine")
2624
+ return this.finalize(this.leftPrinter.format(e, t));
2625
+ let i = this.leftPrinter.format("singleLine", t).suffixWith(this.operator), r = this.rightPrinter.format("singleLine", t);
2626
+ if (e === "singleLine")
2586
2627
  return this.finalize(D.joinLines([i, r], " "));
2587
- let s = dt(e, this.options) + this.leadingString.length + i.maxLineLength + 1;
2588
- s > this.options.wrapColumn && (i = this.leftPrinter.format("multiline", e).suffixWith(this.operator), s = i.lastLineLength + 1);
2628
+ let s = me(t, this.options) + this.leadingString.length + i.maxLineLength + 1;
2629
+ s > this.options.wrapColumn && (i = this.leftPrinter.format("multiline", t).suffixWith(this.operator), s = i.lastLineLength + 1);
2589
2630
  const a = r.firstLineLength + this.trailingString.length + 1;
2590
2631
  if (s + a < this.options.wrapColumn)
2591
2632
  return this.finalize(D.joinLines([i, r], " "));
2592
- const o = this.rightPrinter.format("multiline", e);
2593
- return o.firstLineLength + this.trailingString.length + 1 + s < this.options.wrapColumn || this.noNewLineWrapping ? this.finalize(D.joinLines([i, o], " ")) : (a > this.options.wrapColumn && (r = this.rightPrinter.format("multiline", e + 1)), r = r.indentFirstLine(N(e + 1)), this.finalize(D.appendLines([i, r])));
2633
+ const o = this.rightPrinter.format("multiline", t);
2634
+ return o.firstLineLength + this.trailingString.length + 1 + s < this.options.wrapColumn || this.noNewLineWrapping ? this.finalize(D.joinLines([i, o], " ")) : (a > this.options.wrapColumn && (r = this.rightPrinter.format("multiline", t + 1)), r = r.indentFirstLine(M(t + 1)), this.finalize(D.appendLines([i, r])));
2594
2635
  }
2595
2636
  }
2596
- class xe extends b {
2597
- constructor(t, e, i) {
2598
- super(t, e, i), this.node = t, this.parent = e, this.options = i, this.type = "TemplateLiteralPrinter", this.parts = [];
2599
- const r = t.expressions.map(
2600
- (s) => E(s, t, this.options)
2637
+ class Bt extends L {
2638
+ constructor(e, t, i) {
2639
+ super(e, t, i), this.node = e, this.parent = t, this.options = i, this.type = "TemplateLiteralPrinter", this.parts = [];
2640
+ const r = e.expressions.map(
2641
+ (s) => E(s, e, this.options)
2601
2642
  );
2602
- this.parts.push("`"), t.quasis.forEach((s, a) => {
2643
+ this.parts.push("`"), e.quasis.forEach((s, a) => {
2603
2644
  this.parts.push(s.value.raw), a < r.length && (this.parts.push("${"), this.parts.push(r[a]), this.parts.push("}"));
2604
2645
  }), this.parts.push("`");
2605
2646
  }
2606
- format(t = "singleLine", e = 0) {
2647
+ format(e = "singleLine", t = 0) {
2607
2648
  return this.finalize(
2608
- D.joinLines(this.parts.map((i) => typeof i == "string" ? i : i.format(t, e)))
2649
+ D.joinLines(this.parts.map((i) => typeof i == "string" ? i : i.format(e, t)))
2609
2650
  );
2610
2651
  }
2611
2652
  }
2612
- function Ae(n) {
2613
- const t = { ...n.leadingComments?.slice(0, 1)[0]?.loc.start ?? n.loc.start }, e = { ...n.trailingComments?.slice(-1)[0]?.loc.end ?? n.loc.end };
2614
- return { start: t, end: e };
2653
+ function St(n) {
2654
+ const e = { ...n.leadingComments?.slice(0, 1)[0]?.loc.start ?? n.loc.start }, t = { ...n.trailingComments?.slice(-1)[0]?.loc.end ?? n.loc.end };
2655
+ return { start: e, end: t };
2615
2656
  }
2616
- function ye(n) {
2657
+ function bt(n) {
2617
2658
  return n.trailingComments?.slice(-1)[0]?.type === u.LineComment;
2618
2659
  }
2619
- class L {
2620
- constructor(t, e, i) {
2621
- this.node = t, this.parent = e, this.options = i, this.indentStatementFirstLine = !0, this.externalOffset = 0, this.options = pt(this.options);
2660
+ class T {
2661
+ constructor(e, t, i) {
2662
+ this.node = e, this.parent = t, this.options = i, this.indentStatementFirstLine = !0, this.externalOffset = 0, this.options = de(this.options);
2622
2663
  }
2623
- createStatementPrinter(t) {
2624
- switch (t.type) {
2664
+ createStatementPrinter(e) {
2665
+ switch (e.type) {
2625
2666
  case u.Program:
2626
- return new _(t, this.node, this.options);
2667
+ return new $(e, this.node, this.options);
2627
2668
  case u.ImportDeclaration:
2628
- return new be(t, this.node, this.options);
2669
+ return new vt(e, this.node, this.options);
2629
2670
  case u.ExpressionStatement:
2630
- return new we(t, this.node, this.options);
2671
+ return new Lt(e, this.node, this.options);
2631
2672
  case u.FunctionDeclaration:
2632
- return new Lt(t, this.node, this.options);
2673
+ return new Te(e, this.node, this.options);
2633
2674
  case u.ExportNamedDeclaration:
2634
- return q(t) ? new bt(t, this.node, this.options) : new Lt(t, this.node, this.options);
2675
+ return G(e) ? new Le(e, this.node, this.options) : new Te(e, this.node, this.options);
2635
2676
  case u.BlockStatement:
2636
- return new _(t, this.node, this.options);
2677
+ return new $(e, this.node, this.options);
2637
2678
  case u.ReturnStatement:
2638
- return new ke(t, this.node, this.options);
2679
+ return new Tt(e, this.node, this.options);
2639
2680
  case u.VariableDeclaration:
2640
- return new bt(t, this.node, this.options);
2681
+ return new Le(e, this.node, this.options);
2641
2682
  case u.IfStatement:
2642
- return new Se(t, this.node, this.options);
2683
+ return new wt(e, this.node, this.options);
2643
2684
  case u.ForStatement:
2644
2685
  case u.ForInStatement:
2645
2686
  case u.ForOfStatement:
2646
2687
  case u.WhileStatement:
2647
- return new Ie(t, this.node, this.options);
2688
+ return new kt(e, this.node, this.options);
2648
2689
  case u.EmptyStatement:
2649
2690
  case u.BreakStatement:
2650
2691
  case u.ContinueStatement:
2651
- return new Be(t, this.node, this.options);
2692
+ return new It(e, this.node, this.options);
2652
2693
  default:
2653
- throw new Error(`unknown type: ${JSON.stringify(t)}`);
2694
+ throw new Error(`unknown type: ${JSON.stringify(e)}`);
2654
2695
  }
2655
2696
  }
2656
2697
  /**
@@ -2660,25 +2701,25 @@ class L {
2660
2701
  * @param level
2661
2702
  * @returns
2662
2703
  */
2663
- getFormattedBody(t, e = 0) {
2664
- if (this.cachedBody && this.cachedBody.level === e)
2704
+ getFormattedBody(e, t = 0) {
2705
+ if (this.cachedBody && this.cachedBody.level === t)
2665
2706
  return this.cachedBody.body;
2666
- const i = t.format(e);
2667
- return this.cachedBody = { body: i, level: e }, i;
2707
+ const i = e.format(t);
2708
+ return this.cachedBody = { body: i, level: t }, i;
2668
2709
  }
2669
- getStatementIndentation(t = 0) {
2670
- return this.indentStatementFirstLine ? N(t, this.options) : "";
2710
+ getStatementIndentation(e = 0) {
2711
+ return this.indentStatementFirstLine ? M(e, this.options) : "";
2671
2712
  }
2672
- getStatementIndentationLength(t = 0) {
2673
- return this.indentStatementFirstLine ? t * this.options.indentWidth : 0;
2713
+ getStatementIndentationLength(e = 0) {
2714
+ return this.indentStatementFirstLine ? e * this.options.indentWidth : 0;
2674
2715
  }
2675
2716
  /**
2676
2717
  * Gets the indentation string for the corresponding level
2677
2718
  * @param level
2678
2719
  * @returns
2679
2720
  */
2680
- getIndentation(t = 0) {
2681
- return N(t, this.options);
2721
+ getIndentation(e = 0) {
2722
+ return M(e, this.options);
2682
2723
  }
2683
2724
  /**
2684
2725
  * Once the statement has been formatted, we need to wrap the leading and the
@@ -2687,10 +2728,10 @@ class L {
2687
2728
  * @param level
2688
2729
  * @returns
2689
2730
  */
2690
- addComments(t, e = 0) {
2691
- const i = this.getStatementIndentation(e);
2731
+ addComments(e, t = 0) {
2732
+ const i = this.getStatementIndentation(t);
2692
2733
  if (!this.node.leadingComments?.length && !this.node.trailingComments?.length)
2693
- return t.indentFirstLine(i);
2734
+ return e.indentFirstLine(i);
2694
2735
  const r = (this.node.leadingComments ?? []).reduce(
2695
2736
  (o, c) => {
2696
2737
  const d = this.formatComment(c);
@@ -2709,7 +2750,7 @@ class L {
2709
2750
  ), s = D.aggregateLines(
2710
2751
  r.formattedLines,
2711
2752
  r.location,
2712
- t,
2753
+ e,
2713
2754
  this.node.loc,
2714
2755
  i
2715
2756
  );
@@ -2730,10 +2771,10 @@ class L {
2730
2771
  { formattedLines: s, location: this.node.loc }
2731
2772
  ) ?? { formattedLines: s }).formattedLines;
2732
2773
  }
2733
- formatInnerComments(t = 0) {
2734
- if (!w(this.node) || !Array.isArray(this.node.innerComments) || !this.node.innerComments.length)
2774
+ formatInnerComments(e = 0) {
2775
+ if (!I(this.node) || !Array.isArray(this.node.innerComments) || !this.node.innerComments.length)
2735
2776
  return new D();
2736
- const e = this.getIndentation(t);
2777
+ const t = this.getIndentation(e);
2737
2778
  return this.node.innerComments.reduce(
2738
2779
  (r, s) => {
2739
2780
  const a = this.formatComment(s);
@@ -2743,7 +2784,7 @@ class L {
2743
2784
  r.location,
2744
2785
  a,
2745
2786
  s.loc,
2746
- e
2787
+ t
2747
2788
  ),
2748
2789
  location: s.loc
2749
2790
  };
@@ -2751,12 +2792,12 @@ class L {
2751
2792
  { formattedLines: new D() }
2752
2793
  ).formattedLines;
2753
2794
  }
2754
- formatComment(t) {
2755
- switch (t.type) {
2795
+ formatComment(e) {
2796
+ switch (e.type) {
2756
2797
  case u.BlockComment:
2757
- return D.fromString(t.value).surroundWith("/*", "*/");
2798
+ return D.fromString(e.value).surroundWith("/*", "*/");
2758
2799
  default:
2759
- return D.fromString(t.value.trimEnd()).surroundWith("//");
2800
+ return D.fromString(e.value.trimEnd()).surroundWith("//");
2760
2801
  }
2761
2802
  }
2762
2803
  /**
@@ -2767,38 +2808,38 @@ class L {
2767
2808
  * @param offset
2768
2809
  * @returns
2769
2810
  */
2770
- canFitSingleLine(t, e = 0, i = 0) {
2771
- return this.externalOffset + i + this.getStatementIndentationLength(e) + t.lastLineLength <= this.options.wrapColumn;
2811
+ canFitSingleLine(e, t = 0, i = 0) {
2812
+ return this.externalOffset + i + this.getStatementIndentationLength(t) + e.lastLineLength <= this.options.wrapColumn;
2772
2813
  }
2773
2814
  }
2774
- class _ extends L {
2775
- constructor(t, e, i) {
2776
- super(t, e, i), this.node = t, this.printers = [], this.printers = t.body.map((r) => this.createStatementPrinter(r));
2815
+ class $ extends T {
2816
+ constructor(e, t, i) {
2817
+ super(e, t, i), this.node = e, this.printers = [], this.printers = e.body.map((r) => this.createStatementPrinter(r));
2777
2818
  }
2778
- format(t = 0) {
2819
+ format(e = 0) {
2779
2820
  if (this.printers.length === 0)
2780
- return this.formatEmptyBlock(t);
2781
- const e = [], i = w(this.node);
2782
- i && e.push("{");
2783
- const r = i ? t + 1 : t;
2821
+ return this.formatEmptyBlock(e);
2822
+ const t = [], i = I(this.node);
2823
+ i && t.push("{");
2824
+ const r = i ? e + 1 : e;
2784
2825
  let s;
2785
2826
  return this.printers.forEach((a) => {
2786
- if (Dt(a.node))
2827
+ if (pe(a.node))
2787
2828
  return;
2788
- const o = Ae(a.node);
2789
- s && o.start.line - s.end.line > 1 && e.push(""), s = o, e.push(a.format(r));
2790
- }), i && e.push(`${this.getIndentation(t)}}`), this.addComments(D.appendLines(e), t);
2829
+ const o = St(a.node);
2830
+ s && o.start.line - s.end.line > 1 && t.push(""), s = o, t.push(a.format(r));
2831
+ }), i && t.push(`${this.getIndentation(e)}}`), this.addComments(D.appendLines(t), e);
2791
2832
  }
2792
- formatEmptyBlock(t = 0) {
2793
- if (!w(this.node))
2794
- return this.addComments(D.fromString(""), t);
2795
- const e = this.formatInnerComments(t + 1), i = "{", r = `${this.getIndentation(t)}}`;
2796
- return e.isEmpty ? ut(this.parent) ? this.addComments(D.appendLines([i, r]), t) : this.addComments(D.fromString("{}"), t) : this.addComments(D.appendLines([i, e, r]), t);
2833
+ formatEmptyBlock(e = 0) {
2834
+ if (!I(this.node))
2835
+ return this.addComments(D.fromString(""), e);
2836
+ const t = this.formatInnerComments(e + 1), i = "{", r = `${this.getIndentation(e)}}`;
2837
+ return t.isEmpty ? ae(this.parent) ? this.addComments(D.appendLines([i, r]), e) : this.addComments(D.fromString("{}"), e) : this.addComments(D.appendLines([i, t, r]), e);
2797
2838
  }
2798
2839
  }
2799
- class Be extends L {
2800
- constructor(t, e, i) {
2801
- switch (super(t, e, i), this.node = t, this.keyword = "", this.node.type) {
2840
+ class It extends T {
2841
+ constructor(e, t, i) {
2842
+ switch (super(e, t, i), this.node = e, this.keyword = "", this.node.type) {
2802
2843
  case u.ContinueStatement:
2803
2844
  this.keyword = "continue;";
2804
2845
  break;
@@ -2809,172 +2850,172 @@ class Be extends L {
2809
2850
  this.keyword = ";";
2810
2851
  }
2811
2852
  }
2812
- format(t = 0) {
2813
- return this.addComments(D.fromString(this.keyword), t);
2853
+ format(e = 0) {
2854
+ return this.addComments(D.fromString(this.keyword), e);
2814
2855
  }
2815
2856
  }
2816
- class bt extends L {
2817
- constructor(t, e, i) {
2818
- if (super(t, e, i), this.node = t, q(t))
2819
- this.printer = new lt(t, e, i);
2820
- else if (q(t.declaration))
2821
- this.printer = new lt(t.declaration, e, i), this.printer.prefix = "export ";
2857
+ class Le extends T {
2858
+ constructor(e, t, i) {
2859
+ if (super(e, t, i), this.node = e, G(e))
2860
+ this.printer = new De(e, t, i);
2861
+ else if (G(e.declaration))
2862
+ this.printer = new De(e.declaration, t, i), this.printer.prefix = "export ";
2822
2863
  else
2823
- throw new Error(`invalid type: ${JSON.stringify(t)}`);
2864
+ throw new Error(`invalid type: ${JSON.stringify(e)}`);
2824
2865
  }
2825
- format(t = 0, e = "optimized") {
2826
- if (e === "singleLine" || e === "optimized") {
2827
- const i = this.printer.format("singleLine", t).suffixWith(";");
2828
- if (e === "singleLine" || this.canFitSingleLine(i, t))
2829
- return this.addComments(i, t);
2866
+ format(e = 0, t = "optimized") {
2867
+ if (t === "singleLine" || t === "optimized") {
2868
+ const i = this.printer.format("singleLine", e).suffixWith(";");
2869
+ if (t === "singleLine" || this.canFitSingleLine(i, e))
2870
+ return this.addComments(i, e);
2830
2871
  }
2831
- return this.addComments(this.printer.format("multiline", t).suffixWith(";"), t);
2872
+ return this.addComments(this.printer.format("multiline", e).suffixWith(";"), e);
2832
2873
  }
2833
2874
  }
2834
- class Lt extends L {
2835
- constructor(t, e, i) {
2836
- if (super(t, e, i), this.node = t, Et(t))
2837
- this.header = M(t, e, i), this.body = new _(t.body, t, i);
2838
- else if (Et(t.declaration))
2839
- this.header = M(t.declaration, e, i), this.header.prefix = "export ", this.body = new _(t.declaration.body, t, i);
2875
+ class Te extends T {
2876
+ constructor(e, t, i) {
2877
+ if (super(e, t, i), this.node = e, xe(e))
2878
+ this.header = U(e, t, i), this.body = new $(e.body, e, i);
2879
+ else if (xe(e.declaration))
2880
+ this.header = U(e.declaration, t, i), this.header.prefix = "export ", this.body = new $(e.declaration.body, e, i);
2840
2881
  else
2841
- throw new Error(`invalid type: ${JSON.stringify(t)}`);
2882
+ throw new Error(`invalid type: ${JSON.stringify(e)}`);
2842
2883
  }
2843
- format(t = 0, e = "optimized") {
2884
+ format(e = 0, t = "optimized") {
2844
2885
  this.body.indentStatementFirstLine = !1;
2845
- const i = this.getFormattedBody(this.body, t);
2846
- if (e === "singleLine" || e === "optimized") {
2847
- const s = this.header.format("singleLine", t);
2848
- if (e === "singleLine" || this.canFitSingleLine(s, t, i.firstLineLength + 1))
2849
- return this.addComments(D.joinLines([s, i], " "), t);
2886
+ const i = this.getFormattedBody(this.body, e);
2887
+ if (t === "singleLine" || t === "optimized") {
2888
+ const s = this.header.format("singleLine", e);
2889
+ if (t === "singleLine" || this.canFitSingleLine(s, e, i.firstLineLength + 1))
2890
+ return this.addComments(D.joinLines([s, i], " "), e);
2850
2891
  }
2851
- const r = this.header.format("multiline", t);
2852
- return this.addComments(D.joinLines([r, i], " "), t);
2892
+ const r = this.header.format("multiline", e);
2893
+ return this.addComments(D.joinLines([r, i], " "), e);
2853
2894
  }
2854
2895
  }
2855
- class Se extends L {
2856
- constructor(t, e, i) {
2857
- super(t, e, i), this.node = t, this.header = M(t, e, i), this.consequent = this.createStatementPrinter(t.consequent), this.consequent.indentStatementFirstLine = !1, t.alternate && (this.alternate = this.createStatementPrinter(t.alternate), this.alternate.indentStatementFirstLine = !1);
2896
+ class wt extends T {
2897
+ constructor(e, t, i) {
2898
+ super(e, t, i), this.node = e, this.header = U(e, t, i), this.consequent = this.createStatementPrinter(e.consequent), this.consequent.indentStatementFirstLine = !1, e.alternate && (this.alternate = this.createStatementPrinter(e.alternate), this.alternate.indentStatementFirstLine = !1);
2858
2899
  }
2859
- format(t = 0, e = "optimized") {
2900
+ format(e = 0, t = "optimized") {
2860
2901
  let i = !1, r;
2861
- if (e === "singleLine" || e === "optimized") {
2862
- const c = this.header.format("singleLine", t), d = w(this.node.consequent) ? 2 : 0;
2863
- (e === "singleLine" || this.canFitSingleLine(c, t, d)) && (r = c);
2902
+ if (t === "singleLine" || t === "optimized") {
2903
+ const c = this.header.format("singleLine", e), d = I(this.node.consequent) ? 2 : 0;
2904
+ (t === "singleLine" || this.canFitSingleLine(c, e, d)) && (r = c);
2864
2905
  }
2865
- r || (i = !0, r = this.header.format("multiline", t));
2906
+ r || (i = !0, r = this.header.format("multiline", e));
2866
2907
  let s;
2867
- if (w(this.node.consequent)) {
2868
- const c = this.consequent.format(t, "optimized");
2908
+ if (I(this.node.consequent)) {
2909
+ const c = this.consequent.format(e, "optimized");
2869
2910
  s = D.joinLines([r, " ", c]);
2870
- } else if (i || ut(this.node.consequent)) {
2911
+ } else if (i || ae(this.node.consequent)) {
2871
2912
  this.consequent.indentStatementFirstLine = !0;
2872
- let c = this.consequent.format(t + 1, "singleLine");
2873
- this.canFitSingleLine(c, t + 1) || (c = this.consequent.format(t + 1, "multiline")), s = D.appendLines([r, c]);
2913
+ let c = this.consequent.format(e + 1, "singleLine");
2914
+ this.canFitSingleLine(c, e + 1) || (c = this.consequent.format(e + 1, "multiline")), s = D.appendLines([r, c]);
2874
2915
  } else {
2875
2916
  this.consequent.indentStatementFirstLine = !1;
2876
- let c = this.consequent.format(t, "singleLine");
2877
- this.canFitSingleLine(c, 0, r.lastLineLength + 1) ? s = D.joinLines([r, " ", c]) : (this.consequent.indentStatementFirstLine = !0, c = this.consequent.format(t + 1, "optimized"), s = D.appendLines([r, c]));
2917
+ let c = this.consequent.format(e, "singleLine");
2918
+ this.canFitSingleLine(c, 0, r.lastLineLength + 1) ? s = D.joinLines([r, " ", c]) : (this.consequent.indentStatementFirstLine = !0, c = this.consequent.format(e + 1, "optimized"), s = D.appendLines([r, c]));
2878
2919
  }
2879
2920
  if (!this.alternate)
2880
- return this.addComments(s, t);
2881
- const a = ye(this.node.consequent) || !w(this.node.consequent);
2921
+ return this.addComments(s, e);
2922
+ const a = bt(this.node.consequent) || !I(this.node.consequent);
2882
2923
  let o;
2883
- if (this.alternate.externalOffset = 0, w(this.node.alternate) || ut(this.node.alternate))
2884
- this.alternate.indentStatementFirstLine = !1, this.alternate.externalOffset = a ? 5 : s.lastLineLength + 6, o = this.alternate.format(t, "optimized"), o = D.joinLines(["else ", o]);
2924
+ if (this.alternate.externalOffset = 0, I(this.node.alternate) || ae(this.node.alternate))
2925
+ this.alternate.indentStatementFirstLine = !1, this.alternate.externalOffset = a ? 5 : s.lastLineLength + 6, o = this.alternate.format(e, "optimized"), o = D.joinLines(["else ", o]);
2885
2926
  else {
2886
2927
  const c = a ? 4 : s.lastLineLength + 4;
2887
- this.alternate.indentStatementFirstLine = !1, o = this.alternate.format(t, "singleLine"), this.canFitSingleLine(o, t, c + 1) ? o = D.joinLines(["else ", o]) : (this.alternate.indentStatementFirstLine = !0, o = this.alternate.format(t + 1, "optimized"), o = D.appendLines(["else", o]));
2928
+ this.alternate.indentStatementFirstLine = !1, o = this.alternate.format(e, "singleLine"), this.canFitSingleLine(o, e, c + 1) ? o = D.joinLines(["else ", o]) : (this.alternate.indentStatementFirstLine = !0, o = this.alternate.format(e + 1, "optimized"), o = D.appendLines(["else", o]));
2888
2929
  }
2889
- return a ? s = D.appendLines([s, o.indentFirstLine(this.getIndentation(t))]) : s = D.joinLines([s, o], " "), this.addComments(s, t);
2930
+ return a ? s = D.appendLines([s, o.indentFirstLine(this.getIndentation(e))]) : s = D.joinLines([s, o], " "), this.addComments(s, e);
2890
2931
  }
2891
2932
  }
2892
- class Ie extends L {
2893
- constructor(t, e, i) {
2894
- super(t, e, i), this.node = t, this.header = M(t, e, i), this.body = this.createStatementPrinter(t.body);
2933
+ class kt extends T {
2934
+ constructor(e, t, i) {
2935
+ super(e, t, i), this.node = e, this.header = U(e, t, i), this.body = this.createStatementPrinter(e.body);
2895
2936
  }
2896
- format(t = 0, e = "optimized") {
2937
+ format(e = 0, t = "optimized") {
2897
2938
  this.body.indentStatementFirstLine = !1;
2898
- const i = this.getFormattedBody(this.body, t);
2899
- if (e === "singleLine" || e === "optimized") {
2900
- const s = this.header.format("singleLine", t);
2901
- if (e === "singleLine" || this.canFitSingleLine(s, t, i.firstLineLength + 1))
2902
- return this.addComments(D.joinLines([s, i], " "), t);
2939
+ const i = this.getFormattedBody(this.body, e);
2940
+ if (t === "singleLine" || t === "optimized") {
2941
+ const s = this.header.format("singleLine", e);
2942
+ if (t === "singleLine" || this.canFitSingleLine(s, e, i.firstLineLength + 1))
2943
+ return this.addComments(D.joinLines([s, i], " "), e);
2903
2944
  }
2904
- const r = this.header.format("multiline", t);
2905
- return this.addComments(D.joinLines([r, i], " "), t);
2945
+ const r = this.header.format("multiline", e);
2946
+ return this.addComments(D.joinLines([r, i], " "), e);
2906
2947
  }
2907
2948
  }
2908
- class we extends L {
2909
- constructor(t, e, i) {
2910
- super(t, e, i), this.node = t, this.expression = E(t.expression, t, i);
2949
+ class Lt extends T {
2950
+ constructor(e, t, i) {
2951
+ super(e, t, i), this.node = e, this.expression = E(e.expression, e, i);
2911
2952
  }
2912
- format(t = 0, e = "optimized") {
2913
- if (e === "singleLine" || e === "optimized") {
2914
- const i = this.expression.format("singleLine", t).suffixWith(";");
2915
- if (e === "singleLine" || this.canFitSingleLine(i, t))
2916
- return this.addComments(i, t);
2953
+ format(e = 0, t = "optimized") {
2954
+ if (t === "singleLine" || t === "optimized") {
2955
+ const i = this.expression.format("singleLine", e).suffixWith(";");
2956
+ if (t === "singleLine" || this.canFitSingleLine(i, e))
2957
+ return this.addComments(i, e);
2917
2958
  }
2918
- return this.addComments(this.expression.format("multiline", t).suffixWith(";"), t);
2959
+ return this.addComments(this.expression.format("multiline", e).suffixWith(";"), e);
2919
2960
  }
2920
2961
  }
2921
- class ke extends L {
2922
- constructor(t, e, i) {
2923
- super(t, e, i), this.node = t, this.argument = E(t.argument, t, i);
2962
+ class Tt extends T {
2963
+ constructor(e, t, i) {
2964
+ super(e, t, i), this.node = e, this.argument = E(e.argument, e, i);
2924
2965
  }
2925
- format(t = 0, e = "optimized") {
2926
- if (e === "singleLine" || e === "optimized") {
2927
- const a = this.argument.format("singleLine", t).surroundWith("return ", ";");
2928
- if (e === "singleLine" || this.canFitSingleLine(a, t))
2929
- return this.addComments(a, t);
2966
+ format(e = 0, t = "optimized") {
2967
+ if (t === "singleLine" || t === "optimized") {
2968
+ const a = this.argument.format("singleLine", e).surroundWith("return ", ";");
2969
+ if (t === "singleLine" || this.canFitSingleLine(a, e))
2970
+ return this.addComments(a, e);
2930
2971
  }
2931
- if (!ot(this.node.argument) && !at(this.node.argument)) {
2932
- const a = this.argument.format("multiline", t).surroundWith("return ", ";");
2933
- return this.addComments(a, t);
2972
+ if (!ce(this.node.argument) && !oe(this.node.argument)) {
2973
+ const a = this.argument.format("multiline", e).surroundWith("return ", ";");
2974
+ return this.addComments(a, e);
2934
2975
  }
2935
- const i = this.getIndentation(t + 1), r = this.argument.format("multiline", t + 1).indentFirstLine(i), s = this.getIndentation(t);
2936
- return this.addComments(D.appendLines(["return (", r, `${s});`]), t);
2976
+ const i = this.getIndentation(e + 1), r = this.argument.format("multiline", e + 1).indentFirstLine(i), s = this.getIndentation(e);
2977
+ return this.addComments(D.appendLines(["return (", r, `${s});`]), e);
2937
2978
  }
2938
2979
  }
2939
- class be extends L {
2940
- constructor(t, e, i) {
2941
- super(t, e, i), this.node = t, this.libraryNamePrinter = E(t.specifiers[0].local, t, i), this.librarySourcePrinter = E(t.source, t, i);
2980
+ class vt extends T {
2981
+ constructor(e, t, i) {
2982
+ super(e, t, i), this.node = e, this.libraryNamePrinter = E(e.specifiers[0].local, e, i), this.librarySourcePrinter = E(e.source, e, i);
2942
2983
  }
2943
- format(t = 0) {
2984
+ format(e = 0) {
2944
2985
  return this.addComments(
2945
2986
  D.joinLines([
2946
2987
  "import",
2947
2988
  " ",
2948
- this.libraryNamePrinter.format("singleLine", t),
2989
+ this.libraryNamePrinter.format("singleLine", e),
2949
2990
  " from ",
2950
2991
  this.librarySourcePrinter.format("singleLine")
2951
2992
  ]).suffixWith(";"),
2952
- t
2993
+ e
2953
2994
  );
2954
2995
  }
2955
2996
  }
2956
- const Le = { quote: "auto" };
2957
- function ci(n, t = {}) {
2997
+ const Pt = { quote: "auto" };
2998
+ function Di(n, e = {}) {
2958
2999
  try {
2959
- const e = n.getText(), i = n.positionAt(e.length), r = { start: { line: 0, character: 0 }, end: i }, s = { ...Le, ...t.formattingOptions ?? {} }, a = Te(e, s);
3000
+ const t = n.getText(), i = n.positionAt(t.length), r = { start: { line: 0, character: 0 }, end: i }, s = { ...Pt, ...e.formattingOptions ?? {} }, a = Nt(t, s);
2960
3001
  return [{ range: r, newText: a }];
2961
- } catch (e) {
2962
- return console.error("Arcade Formatting Error:", e), [];
3002
+ } catch (t) {
3003
+ return console.error("Arcade Formatting Error:", t), [];
2963
3004
  }
2964
3005
  }
2965
- function Te(n, t) {
3006
+ function Nt(n, e) {
2966
3007
  if (!n)
2967
3008
  return "";
2968
- const e = pt(t), i = Q.fromString(n, e), r = i.toString(), s = $t(r, {
3009
+ const t = de(e), i = Z.fromString(n, t), r = i.toString(), s = Re(r, {
2969
3010
  tolerant: !0,
2970
3011
  comments: !0
2971
- }), a = ce(s, i);
2972
- return s.loc.start = a.start, s.loc.end = a.end, new _(s, null, e).format().toString();
3012
+ }), a = Dt(s, i);
3013
+ return s.loc.start = a.start, s.loc.end = a.end, new $(s, null, t).format().toString();
2973
3014
  }
2974
- const ve = Object.values(f), Pe = Object.values(j), Ne = ["case", "catch", "debugger", "switch", "try"], Me = Pe.map((n) => ({ label: n, kind: F.Constant })), Ue = ve.map((n) => ({ label: n, kind: F.Keyword })), Oe = [
3015
+ const Mt = Object.values(f), Ut = Object.values(V), Ot = ["case", "catch", "debugger", "switch", "try"], jt = Ut.map((n) => ({ label: n, kind: g.Constant })), zt = Mt.map((n) => ({ label: n, kind: g.Keyword })), Vt = [
2975
3016
  {
2976
3017
  label: "exportfunction",
2977
- kind: F.Snippet,
3018
+ kind: g.Snippet,
2978
3019
  detail: "Export Function Statement",
2979
3020
  insertText: `export function \${1:functionName} ($2) {
2980
3021
  $0
@@ -2984,7 +3025,7 @@ const ve = Object.values(f), Pe = Object.values(j), Ne = ["case", "catch", "debu
2984
3025
  },
2985
3026
  {
2986
3027
  label: "exportvar",
2987
- kind: F.Snippet,
3028
+ kind: g.Snippet,
2988
3029
  detail: "Export Variable Statement",
2989
3030
  insertText: "export var ${0:variableName}\n",
2990
3031
  insertTextMode: S.adjustIndentation,
@@ -2992,7 +3033,7 @@ const ve = Object.values(f), Pe = Object.values(j), Ne = ["case", "catch", "debu
2992
3033
  },
2993
3034
  {
2994
3035
  label: "for",
2995
- kind: F.Snippet,
3036
+ kind: g.Snippet,
2996
3037
  detail: "For Loop Statement",
2997
3038
  insertText: "for (var ${1:i} = 0; ${1:i} < ${2:array.length}; ${1:i}++) {\n $0\n}",
2998
3039
  insertTextMode: S.adjustIndentation,
@@ -3000,7 +3041,7 @@ const ve = Object.values(f), Pe = Object.values(j), Ne = ["case", "catch", "debu
3000
3041
  },
3001
3042
  {
3002
3043
  label: "forin",
3003
- kind: F.Snippet,
3044
+ kind: g.Snippet,
3004
3045
  detail: "For-In Loop Statement",
3005
3046
  insertText: "for (var ${1:i} in ${2:arrayOrObject}) {\n $0\n}",
3006
3047
  insertTextMode: S.adjustIndentation,
@@ -3008,7 +3049,7 @@ const ve = Object.values(f), Pe = Object.values(j), Ne = ["case", "catch", "debu
3008
3049
  },
3009
3050
  {
3010
3051
  label: "forof",
3011
- kind: F.Snippet,
3052
+ kind: g.Snippet,
3012
3053
  detail: "For-Of Loop Statement",
3013
3054
  insertText: "for (var ${1:i} of ${2:arrayOrObject}) {\n $0\n}",
3014
3055
  insertTextMode: S.adjustIndentation,
@@ -3016,7 +3057,7 @@ const ve = Object.values(f), Pe = Object.values(j), Ne = ["case", "catch", "debu
3016
3057
  },
3017
3058
  {
3018
3059
  label: "function",
3019
- kind: F.Snippet,
3060
+ kind: g.Snippet,
3020
3061
  detail: "Function Statement",
3021
3062
  insertText: `function \${1:functionName} ($2) {
3022
3063
  $0
@@ -3026,7 +3067,7 @@ const ve = Object.values(f), Pe = Object.values(j), Ne = ["case", "catch", "debu
3026
3067
  },
3027
3068
  {
3028
3069
  label: "if",
3029
- kind: F.Snippet,
3070
+ kind: g.Snippet,
3030
3071
  detail: "If Statement",
3031
3072
  insertText: `if (\${1:1==1}) {
3032
3073
  $0
@@ -3036,7 +3077,7 @@ const ve = Object.values(f), Pe = Object.values(j), Ne = ["case", "catch", "debu
3036
3077
  },
3037
3078
  {
3038
3079
  label: "ifelse",
3039
- kind: F.Snippet,
3080
+ kind: g.Snippet,
3040
3081
  detail: "If-Else Statement",
3041
3082
  insertText: `if (\${1:1==1}) {
3042
3083
  $0
@@ -3048,7 +3089,7 @@ const ve = Object.values(f), Pe = Object.values(j), Ne = ["case", "catch", "debu
3048
3089
  },
3049
3090
  {
3050
3091
  label: "else",
3051
- kind: F.Snippet,
3092
+ kind: g.Snippet,
3052
3093
  detail: "Else Statement",
3053
3094
  insertText: `else {
3054
3095
  $0
@@ -3058,7 +3099,7 @@ const ve = Object.values(f), Pe = Object.values(j), Ne = ["case", "catch", "debu
3058
3099
  },
3059
3100
  {
3060
3101
  label: "import",
3061
- kind: F.Snippet,
3102
+ kind: g.Snippet,
3062
3103
  detail: "Import Statement",
3063
3104
  insertText: 'import ${1:namespace} from "${0:uri}"',
3064
3105
  insertTextMode: S.adjustIndentation,
@@ -3066,7 +3107,7 @@ const ve = Object.values(f), Pe = Object.values(j), Ne = ["case", "catch", "debu
3066
3107
  },
3067
3108
  {
3068
3109
  label: "while",
3069
- kind: F.Snippet,
3110
+ kind: g.Snippet,
3070
3111
  detail: "While Loop Statement",
3071
3112
  insertText: `while (\${1:false}) {
3072
3113
  $0
@@ -3074,26 +3115,26 @@ const ve = Object.values(f), Pe = Object.values(j), Ne = ["case", "catch", "debu
3074
3115
  insertTextMode: S.adjustIndentation,
3075
3116
  insertTextFormat: B.Snippet
3076
3117
  }
3077
- ], ze = /\$\{(.*?)\}/gu;
3078
- function V(n, t) {
3079
- return t ? n.replace(ze, (e, i) => t[i].toString()) : n;
3118
+ ], _t = /\$\{(.*?)\}/gu;
3119
+ function _(n, e) {
3120
+ return e ? n.replace(_t, (t, i) => e[i].toString()) : n;
3080
3121
  }
3081
- const ft = /[-[\]/{}()*+?.\\^$|]/gu;
3082
- function je(n, t) {
3083
- return n.line > t.end.line;
3122
+ const Ce = /[-[\]/{}()*+?.\\^$|]/gu;
3123
+ function $t(n, e) {
3124
+ return n.line > e.end.line;
3084
3125
  }
3085
- function Ve(n, t) {
3086
- return n.line < t.start.line;
3126
+ function Rt(n, e) {
3127
+ return n.line < e.start.line;
3087
3128
  }
3088
- function Ht(n, t) {
3089
- return !(Ve(n, t) || je(n, t) || n.line === t.start.line && n.column < t.start.column || n.line === t.end.line && n.column > t.end.column);
3129
+ function qe(n, e) {
3130
+ return !(Rt(n, e) || $t(n, e) || n.line === e.start.line && n.column < e.start.column || n.line === e.end.line && n.column > e.end.column);
3090
3131
  }
3091
- const g = {
3132
+ const x = {
3092
3133
  None: 0,
3093
3134
  Keywords: 1,
3094
3135
  All: 255,
3095
3136
  NoKeywords: 254
3096
- }, T = {
3137
+ }, v = {
3097
3138
  identifiers: "a",
3098
3139
  profileVariables: "aa",
3099
3140
  constants: "ab",
@@ -3102,157 +3143,157 @@ const g = {
3102
3143
  snippets: "b",
3103
3144
  keywords: "c"
3104
3145
  };
3105
- function _e(n, t, e, i = {}) {
3106
- const r = n.getText({ start: { line: 0, character: 0 }, end: t }), { tokens: s, errors: a = [] } = ae(r, { loc: !0, tolerant: !0 });
3146
+ function Wt(n, e, t, i = {}) {
3147
+ const r = n.getText({ start: { line: 0, character: 0 }, end: e }), { tokens: s, errors: a = [] } = ht(r, { loc: !0, tolerant: !0 });
3107
3148
  if (a.length)
3108
3149
  return { isIncomplete: !1, items: [] };
3109
3150
  let o = s.at(s.length - 1), c = "";
3110
- const d = ti(t);
3111
- o?.type === "Identifier" && Ht(d, o.loc) && (c = o.value, s.pop(), o = s[s.length - 1]);
3151
+ const d = ni(e);
3152
+ o?.type === "Identifier" && qe(d, o.loc) && (c = o.value, s.pop(), o = s[s.length - 1]);
3112
3153
  const C = {
3113
3154
  variables: i.profile?.variables ?? [],
3114
- additionalCompletionItems: (i.snippets ?? []).map((x) => ({
3115
- kind: F.Snippet,
3155
+ additionalCompletionItems: (i.snippets ?? []).map((F) => ({
3156
+ kind: g.Snippet,
3116
3157
  insertTextMode: S.adjustIndentation,
3117
3158
  insertTextFormat: B.Snippet,
3118
- ...x
3159
+ ...F
3119
3160
  })),
3120
- apiDatabase: e
3161
+ apiDatabase: t
3121
3162
  };
3122
- return o?.type === "Punctuator" && o.value === "." ? Re(s, c, C) : $e(s, c, d, C);
3163
+ return o?.type === "Punctuator" && (o.value === "." || o.value === w) ? Ht(s, c, C) : Kt(s, c, d, C);
3123
3164
  }
3124
- function $e(n, t, e, i) {
3125
- const r = He(n, e);
3126
- if (r === g.None)
3165
+ function Kt(n, e, t, i) {
3166
+ const r = Jt(n, t);
3167
+ if (r === x.None)
3127
3168
  return { isIncomplete: !1, items: [] };
3128
- const s = Je(n), a = [], o = new RegExp(t.replaceAll(ft, "\\$&"), "i");
3169
+ const s = Xt(n), a = [], o = new RegExp(e.replaceAll(Ce, "\\$&"), "i");
3129
3170
  return s.forEach((c, d) => {
3130
- o.test(d) && a.push({ ...c, sortText: T.identifiers });
3171
+ o.test(d) && a.push({ ...c, sortText: v.identifiers });
3131
3172
  }), i.variables.forEach((c) => {
3132
- o.test(c.name) && c.completion && a.push({ ...c.completion, sortText: T.profileVariables });
3133
- }), Tt(r) && Oe.forEach((c) => {
3134
- c.label.startsWith(t) && a.push({ ...c, sortText: T.snippets });
3173
+ o.test(c.name) && c.completion && a.push({ ...c.completion, sortText: v.profileVariables });
3174
+ }), ve(r) && Vt.forEach((c) => {
3175
+ c.label.startsWith(e) && a.push({ ...c, sortText: v.snippets });
3135
3176
  }), i.additionalCompletionItems.forEach((c) => {
3136
- o.test(c.label) && a.push({ ...c, sortText: T.snippets });
3137
- }), Tt(r) && Ue.forEach((c) => {
3138
- o.test(c.label) && a.push({ ...c, sortText: T.keywords });
3139
- }), Me.forEach((c) => {
3140
- o.test(c.label) && a.push({ ...c, sortText: T.literals });
3177
+ o.test(c.label) && a.push({ ...c, sortText: v.snippets });
3178
+ }), ve(r) && zt.forEach((c) => {
3179
+ o.test(c.label) && a.push({ ...c, sortText: v.keywords });
3180
+ }), jt.forEach((c) => {
3181
+ o.test(c.label) && a.push({ ...c, sortText: v.literals });
3141
3182
  }), i.apiDatabase.constantDefinitions.forEach((c, d) => {
3142
- c.type === "constant" && c.disableDocumentation === !0 || !o.test(d) || a.push({ ...c.completion, sortText: T.constants });
3183
+ c.type === "constant" && c.disableDocumentation === !0 || !o.test(d) || a.push({ ...c.completion, sortText: v.constants });
3143
3184
  }), i.apiDatabase.functionDefinitions.forEach((c, d) => {
3144
3185
  o.test(d) && c.overloads.forEach((C) => {
3145
- C.disableDocumentation || a.push({ ...C.completion, sortText: T.functions });
3186
+ C.disableDocumentation || a.push({ ...C.completion, sortText: v.functions });
3146
3187
  });
3147
3188
  }), { isIncomplete: !1, items: a };
3148
3189
  }
3149
- function Re(n, t, e) {
3190
+ function Ht(n, e, t) {
3150
3191
  const i = [...n];
3151
3192
  let r = i.pop();
3152
3193
  const s = r;
3153
3194
  let a = [];
3154
- for (; r && !(r.type !== "Punctuator" || r.value !== "." || (r = i.pop(), r?.type !== "Identifier")); )
3195
+ for (; r && !(r.type !== "Punctuator" || r.value !== "." && r.value !== w || (r = i.pop(), r?.type !== "Identifier")); )
3155
3196
  a = [r.value.toLowerCase(), ...a], r = i.pop();
3156
3197
  if (a.length === 0 || !s)
3157
3198
  return { isIncomplete: !1, items: [] };
3158
- let o = We(a, t, e);
3159
- return o || (o = Ke(a, t, s, e), o) ? o : { isIncomplete: !1, items: [] };
3199
+ let o = qt(a, e, t);
3200
+ return o || (o = Gt(a, e, s, t), o) ? o : { isIncomplete: !1, items: [] };
3160
3201
  }
3161
- function We(n, t, e) {
3202
+ function qt(n, e, t) {
3162
3203
  if (n.length > 1)
3163
3204
  return null;
3164
- const i = e.apiDatabase.constantDefinitions.get(n[0]);
3205
+ const i = t.apiDatabase.constantDefinitions.get(n[0]);
3165
3206
  if (!i)
3166
3207
  return null;
3167
3208
  if (i.type !== "namespace")
3168
3209
  return { isIncomplete: !1, items: [] };
3169
- const r = [], s = new RegExp(t.replaceAll(ft, "\\$&"), "i");
3210
+ const r = [], s = new RegExp(e.replaceAll(Ce, "\\$&"), "i");
3170
3211
  return i.members.forEach((a) => {
3171
3212
  a.disableDocumentation === !0 || !s.test(a.name) || r.push(a.completion);
3172
3213
  }), { isIncomplete: !1, items: r };
3173
3214
  }
3174
- function Ke(n, t, e, i) {
3215
+ function Gt(n, e, t, i) {
3175
3216
  if (!i.variables.length || !n.length)
3176
3217
  return null;
3177
3218
  let r = n.shift(), s = i.variables;
3178
3219
  for (; r; ) {
3179
3220
  const d = s.find((C) => C.name.toLowerCase() === r);
3180
- if (!Gt(d))
3221
+ if (!Je(d))
3181
3222
  return null;
3182
3223
  s = d.properties ?? [], r = n.shift();
3183
3224
  }
3184
- const a = [], o = new RegExp(t.replaceAll(ft, "\\$&"), "i"), c = ei(e.loc.start);
3225
+ const a = [], o = new RegExp(e.replaceAll(Ce, "\\$&"), "i"), c = ri(t.loc.start);
3185
3226
  return s.forEach((d) => {
3186
- o.test(d.name) && d.completion && a.push(Xe(c, d.completion));
3227
+ o.test(d.name) && d.completion && (t.value === "." ? a.push(ii(c, d.completion)) : a.push(d.completion));
3187
3228
  }), { isIncomplete: !1, items: a };
3188
3229
  }
3189
- function Tt(n) {
3190
- return (n & g.Keywords) === g.Keywords;
3230
+ function ve(n) {
3231
+ return (n & x.Keywords) === x.Keywords;
3191
3232
  }
3192
- function He(n, t) {
3233
+ function Jt(n, e) {
3193
3234
  if (!n.length)
3194
- return g.All;
3195
- const e = n[n.length - 1];
3196
- switch (e.type) {
3235
+ return x.All;
3236
+ const t = n[n.length - 1];
3237
+ switch (t.type) {
3197
3238
  case "Identifier":
3198
- return g.All;
3239
+ return x.All;
3199
3240
  case "Keyword":
3200
- return ["return", "in", "else"].includes(e.value) ? g.NoKeywords : g.None;
3241
+ return ["return", "in", "else"].includes(t.value) ? x.NoKeywords : x.None;
3201
3242
  case "Punctuator":
3202
- return qe(n);
3243
+ return Qt(n);
3203
3244
  case "Template":
3204
- return e.value.endsWith("${") ? g.NoKeywords : g.All;
3245
+ return t.value.endsWith("${") ? x.NoKeywords : x.All;
3205
3246
  default:
3206
- return Ht(t, e.loc) ? g.None : g.All;
3207
- }
3208
- }
3209
- function qe(n) {
3210
- const t = [...n];
3211
- let e = t.pop();
3212
- if (!e)
3213
- return g.All;
3214
- if (e.type !== "Punctuator")
3215
- return g.None;
3216
- if (e.value !== "(" && e.value !== ",")
3217
- return g.All;
3218
- if (e.value === "(")
3219
- return vt(t);
3247
+ return qe(e, t.loc) ? x.None : x.All;
3248
+ }
3249
+ }
3250
+ function Qt(n) {
3251
+ const e = [...n];
3252
+ let t = e.pop();
3253
+ if (!t)
3254
+ return x.All;
3255
+ if (t.type !== "Punctuator")
3256
+ return x.None;
3257
+ if (t.value !== "(" && t.value !== ",")
3258
+ return x.All;
3259
+ if (t.value === "(")
3260
+ return Pe(e);
3220
3261
  let i = 0;
3221
- for (e = t.pop(); e; ) {
3222
- if (e.type === "Keyword")
3223
- return g.None;
3224
- if (e.type !== "Punctuator") {
3225
- e = t.pop();
3262
+ for (t = e.pop(); t; ) {
3263
+ if (t.type === "Keyword")
3264
+ return x.None;
3265
+ if (t.type !== "Punctuator") {
3266
+ t = e.pop();
3226
3267
  continue;
3227
3268
  }
3228
- if (e.value === ")" || e.value === "]") {
3229
- i -= 1, e = t.pop();
3269
+ if (t.value === ")" || t.value === "]") {
3270
+ i -= 1, t = e.pop();
3230
3271
  continue;
3231
3272
  }
3232
- if (e.value === "[") {
3273
+ if (t.value === "[") {
3233
3274
  if (i === 0)
3234
- return g.NoKeywords;
3235
- i += 1, e = t.pop();
3275
+ return x.NoKeywords;
3276
+ i += 1, t = e.pop();
3236
3277
  continue;
3237
3278
  }
3238
- if (e.value === "(") {
3279
+ if (t.value === "(") {
3239
3280
  if (i === 0)
3240
- return vt(t);
3241
- i += 1, e = t.pop();
3281
+ return Pe(e);
3282
+ i += 1, t = e.pop();
3242
3283
  continue;
3243
3284
  }
3244
- e = t.pop();
3285
+ t = e.pop();
3245
3286
  }
3246
- return g.None;
3287
+ return x.None;
3247
3288
  }
3248
- function vt(n) {
3249
- const t = [...n];
3250
- let e = t.pop();
3251
- return e ? e.type === "Keyword" ? e.value.toLowerCase() === "for" ? g.All : g.NoKeywords : e.type !== "Identifier" ? g.All : (e = t.pop(), e?.type === "Keyword" && e.value.toLowerCase() === "function" ? g.None : g.NoKeywords) : g.All;
3289
+ function Pe(n) {
3290
+ const e = [...n];
3291
+ let t = e.pop();
3292
+ return t ? t.type === "Keyword" ? t.value.toLowerCase() === "for" ? x.All : x.NoKeywords : t.type !== "Identifier" ? x.All : (t = e.pop(), t?.type === "Keyword" && t.value.toLowerCase() === "function" ? x.None : x.NoKeywords) : x.All;
3252
3293
  }
3253
- class Ge {
3254
- constructor(t) {
3255
- this.tokens = t, this.currentIndex = 0;
3294
+ class Zt {
3295
+ constructor(e) {
3296
+ this.tokens = e, this.currentIndex = 0;
3256
3297
  }
3257
3298
  increment() {
3258
3299
  if (!(this.currentIndex >= this.tokens.length))
@@ -3268,40 +3309,40 @@ class Ge {
3268
3309
  return this.tokens[this.currentIndex];
3269
3310
  }
3270
3311
  }
3271
- const K = {
3312
+ const H = {
3272
3313
  parameterFormat: "(parameter) ${name}",
3273
3314
  variableFormat: "var ${name}",
3274
3315
  functionFormat: "function ${name} (${paramsDetail})"
3275
3316
  };
3276
- function Je(n) {
3277
- const t = /* @__PURE__ */ new Map();
3317
+ function Xt(n) {
3318
+ const e = /* @__PURE__ */ new Map();
3278
3319
  if (!n.length)
3279
- return t;
3280
- const e = new Ge(n);
3281
- for (; e.current; ) {
3282
- if (e.current.type === "Keyword") {
3283
- if (e.current.value.toLowerCase() === "var") {
3284
- e.increment(), Qe(e, t);
3320
+ return e;
3321
+ const t = new Zt(n);
3322
+ for (; t.current; ) {
3323
+ if (t.current.type === "Keyword") {
3324
+ if (t.current.value.toLowerCase() === "var") {
3325
+ t.increment(), Yt(t, e);
3285
3326
  continue;
3286
3327
  }
3287
- if (e.current.value.toLowerCase() === "function") {
3288
- e.increment(), Ze(e, t);
3328
+ if (t.current.value.toLowerCase() === "function") {
3329
+ t.increment(), ei(t, e);
3289
3330
  continue;
3290
3331
  }
3291
3332
  }
3292
- e.increment();
3333
+ t.increment();
3293
3334
  }
3294
- return t;
3335
+ return e;
3295
3336
  }
3296
- function Qe(n, t) {
3337
+ function Yt(n, e) {
3297
3338
  for (; n.current; ) {
3298
3339
  if (n.current.type !== "Identifier")
3299
3340
  return;
3300
- const e = n.current.value, i = e.toLowerCase();
3301
- t.set(i, {
3302
- label: e,
3303
- kind: F.Variable,
3304
- detail: V(K.variableFormat, { name: e })
3341
+ const t = n.current.value, i = t.toLowerCase();
3342
+ e.set(i, {
3343
+ label: t,
3344
+ kind: g.Variable,
3345
+ detail: _(H.variableFormat, { name: t })
3305
3346
  });
3306
3347
  const r = n.increment();
3307
3348
  if (r?.type !== "Punctuator")
@@ -3311,66 +3352,66 @@ function Qe(n, t) {
3311
3352
  continue;
3312
3353
  }
3313
3354
  if (r.value === "=") {
3314
- n.increment(), Ye(n);
3355
+ n.increment(), ti(n);
3315
3356
  continue;
3316
3357
  }
3317
3358
  }
3318
3359
  }
3319
- function Ze(n, t) {
3360
+ function ei(n, e) {
3320
3361
  for (; n.current; ) {
3321
3362
  if (n.current.type !== "Identifier")
3322
3363
  return;
3323
- const e = n.current.value, i = e.toLowerCase(), r = {
3324
- label: e,
3325
- kind: F.Function,
3326
- detail: V(K.functionFormat, { name: e, paramsDetail: "" }),
3327
- insertText: `${e}()`,
3364
+ const t = n.current.value, i = t.toLowerCase(), r = {
3365
+ label: t,
3366
+ kind: g.Function,
3367
+ detail: _(H.functionFormat, { name: t, paramsDetail: "" }),
3368
+ insertText: `${t}()`,
3328
3369
  insertTextMode: S.adjustIndentation,
3329
3370
  insertTextFormat: B.Snippet
3330
3371
  };
3331
- t.set(i, r);
3372
+ e.set(i, r);
3332
3373
  let s = n.increment();
3333
- if (!v(s, "("))
3374
+ if (!P(s, "("))
3334
3375
  return;
3335
3376
  s = n.increment();
3336
3377
  const a = [];
3337
- for (; s && !(s.type !== "Identifier" || (a.push(s.value), s = n.increment(), !v(s, ","))); )
3378
+ for (; s && !(s.type !== "Identifier" || (a.push(s.value), s = n.increment(), !P(s, ","))); )
3338
3379
  s = n.increment();
3339
3380
  if (a.length) {
3340
- r.detail = V(K.functionFormat, {
3381
+ r.detail = _(H.functionFormat, {
3341
3382
  name: r.label,
3342
3383
  paramsDetail: a.join(", ")
3343
3384
  });
3344
- const d = a.map((C, x) => `\${${x + 1}:${C}}`).join(", ");
3385
+ const d = a.map((C, F) => `\${${F + 1}:${C}}`).join(", ");
3345
3386
  r.insertText = `${r.label}(${d})`;
3346
3387
  }
3347
- if (!v(s, ")") || (s = n.increment(), !v(s, "{")))
3388
+ if (!P(s, ")") || (s = n.increment(), !P(s, "{")))
3348
3389
  return;
3349
3390
  s = n.increment();
3350
3391
  const o = n.currentIndex;
3351
3392
  let c = 1;
3352
3393
  for (; s && c > 0; )
3353
- v(s, "{") ? c += 1 : v(s, "}") && (c -= 1), s = n.increment();
3394
+ P(s, "{") ? c += 1 : P(s, "}") && (c -= 1), s = n.increment();
3354
3395
  if (c === 0)
3355
3396
  return;
3356
3397
  n.currentIndex = o, a.forEach((d) => {
3357
3398
  const C = d.toLowerCase();
3358
- t.set(C, {
3399
+ e.set(C, {
3359
3400
  label: d,
3360
- kind: F.Variable,
3361
- detail: V(K.parameterFormat, { name: d })
3401
+ kind: g.Variable,
3402
+ detail: _(H.parameterFormat, { name: d })
3362
3403
  });
3363
3404
  });
3364
3405
  }
3365
3406
  }
3366
- function v(n, t) {
3367
- return n?.type === "Punctuator" && n.value === t;
3407
+ function P(n, e) {
3408
+ return n?.type === "Punctuator" && n.value === e;
3368
3409
  }
3369
- function Ye(n) {
3370
- let t = 0;
3410
+ function ti(n) {
3411
+ let e = 0;
3371
3412
  for (; n.current; ) {
3372
3413
  if (n.current.type === "Keyword") {
3373
- if (v(n.previous, ".")) {
3414
+ if (P(n.previous, ".") || P(n.previous, w)) {
3374
3415
  n.increment();
3375
3416
  continue;
3376
3417
  }
@@ -3379,30 +3420,30 @@ function Ye(n) {
3379
3420
  if (n.current.type === "Punctuator" && n.current.value === ";")
3380
3421
  return;
3381
3422
  if (n.current.type === "Template" && n.current.value.startsWith("`")) {
3382
- t += 1, n.increment();
3423
+ e += 1, n.increment();
3383
3424
  continue;
3384
3425
  }
3385
3426
  if (n.current.type === "Punctuator" && ["(", "[", "{"].includes(n.current.value)) {
3386
- t += 1, n.increment();
3427
+ e += 1, n.increment();
3387
3428
  continue;
3388
3429
  }
3389
3430
  if (n.current.type === "Template" && n.current.value.endsWith("`")) {
3390
- t -= 1, n.increment();
3431
+ e -= 1, n.increment();
3391
3432
  continue;
3392
3433
  }
3393
3434
  if (n.current.type === "Punctuator" && [")", "]", "}"].includes(n.current.value)) {
3394
- t -= 1, n.increment();
3435
+ e -= 1, n.increment();
3395
3436
  continue;
3396
3437
  }
3397
- if (!t && n.current.type === "Punctuator" && n.current.value === ",") {
3438
+ if (!e && n.current.type === "Punctuator" && n.current.value === ",") {
3398
3439
  n.increment();
3399
3440
  return;
3400
3441
  }
3401
3442
  n.increment();
3402
3443
  }
3403
3444
  }
3404
- function Xe(n, t) {
3405
- return t.insertText?.startsWith("[") && (t.additionalTextEdits = [
3445
+ function ii(n, e) {
3446
+ return e.insertText?.startsWith("[") && (e.additionalTextEdits = [
3406
3447
  {
3407
3448
  newText: "",
3408
3449
  range: {
@@ -3413,18 +3454,18 @@ function Xe(n, t) {
3413
3454
  }
3414
3455
  }
3415
3456
  }
3416
- ]), t;
3457
+ ]), e;
3417
3458
  }
3418
- function ti(n) {
3459
+ function ni(n) {
3419
3460
  return { line: n.line + 1, column: n.character };
3420
3461
  }
3421
- function ei(n) {
3462
+ function ri(n) {
3422
3463
  return { line: n.line - 1, character: n.column };
3423
3464
  }
3424
- class ii {
3425
- constructor(t, e = []) {
3426
- this._apiDatabase = t, this._profileVariables = e, this._isInBlock = !1, this._isInCallExpression = !1, this._identifierBeingAssigned = void 0, this._assignmentValidationMode = "disabled", this._scriptScopeIdentifiers = /* @__PURE__ */ new Map(), this._diagnostics = [], this._undeclaredIdentifiersInFunctions = /* @__PURE__ */ new Map(), this.handleException = (i) => {
3427
- if (ni(i)) {
3465
+ class si {
3466
+ constructor(e, t = []) {
3467
+ this._apiDatabase = e, this._profileVariables = t, this._isInBlock = !1, this._isInCallExpression = !1, this._identifierBeingAssigned = void 0, this._assignmentValidationMode = "disabled", this._scriptScopeIdentifiers = /* @__PURE__ */ new Map(), this._diagnostics = [], this._undeclaredIdentifiersInFunctions = /* @__PURE__ */ new Map(), this.handleException = (i) => {
3468
+ if (ui(i)) {
3428
3469
  const { range: r, code: s, data: a } = i;
3429
3470
  this.logDiagnostic(r, { code: s, data: a });
3430
3471
  } else
@@ -3517,13 +3558,13 @@ class ii {
3517
3558
  }
3518
3559
  };
3519
3560
  }
3520
- validateScript(t) {
3521
- if (!t)
3561
+ validateScript(e) {
3562
+ if (!e)
3522
3563
  return { diagnostics: [], program: null };
3523
3564
  this._isInBlock = !1, this._identifierBeingAssigned = void 0, this._assignmentValidationMode = "disabled", this._diagnostics = [], this._scriptScopeIdentifiers.clear(), this._undeclaredIdentifiersInFunctions.clear(), this._functionScopeIdentifiers = void 0;
3524
- let e = null;
3565
+ let t = null;
3525
3566
  try {
3526
- e = $t(t, { tolerant: !0 }), this.handleErrors(e.errors), e.body.forEach(this.validateStatement), this.diagnoseIdentifiers(), this._undeclaredIdentifiersInFunctions.size > 0 && this._undeclaredIdentifiersInFunctions.forEach((i) => {
3567
+ t = Re(e, { tolerant: !0 }), this.handleErrors(t.errors), t.body.forEach(this.validateStatement), this.diagnoseIdentifiers(), this._undeclaredIdentifiersInFunctions.size > 0 && this._undeclaredIdentifiersInFunctions.forEach((i) => {
3527
3568
  for (const r of i)
3528
3569
  this.logDiagnostic(r.node.loc, {
3529
3570
  code: p.NotDefined,
@@ -3533,229 +3574,229 @@ class ii {
3533
3574
  } catch (i) {
3534
3575
  this.handleException(i);
3535
3576
  }
3536
- return { diagnostics: this._diagnostics, program: e };
3577
+ return { diagnostics: this._diagnostics, program: t };
3537
3578
  }
3538
- disableRecordIdentifierAssignment(t, e) {
3579
+ disableRecordIdentifierAssignment(e, t) {
3539
3580
  const i = this._assignmentValidationMode;
3540
- this._assignmentValidationMode = "disabled", t.call(this, e), this._assignmentValidationMode = i;
3581
+ this._assignmentValidationMode = "disabled", e.call(this, t), this._assignmentValidationMode = i;
3541
3582
  }
3542
- inBlock(t, e) {
3583
+ inBlock(e, t) {
3543
3584
  const i = this._isInBlock;
3544
- this._isInBlock = !0, t.call(this, e), this._isInBlock = i;
3585
+ this._isInBlock = !0, e.call(this, t), this._isInBlock = i;
3545
3586
  }
3546
3587
  get _isInFunctionScope() {
3547
3588
  return !!this._functionScopeIdentifiers;
3548
3589
  }
3549
- inFunctionScope(t) {
3550
- this._functionScopeIdentifiers = /* @__PURE__ */ new Map(), t.call(this), this.diagnoseIdentifiers(), this._functionScopeIdentifiers = void 0;
3590
+ inFunctionScope(e) {
3591
+ this._functionScopeIdentifiers = /* @__PURE__ */ new Map(), e.call(this), this.diagnoseIdentifiers(), this._functionScopeIdentifiers = void 0;
3551
3592
  }
3552
- logDiagnostic(t, e) {
3593
+ logDiagnostic(e, t) {
3553
3594
  const i = {
3554
3595
  severity: A.Error,
3555
- ...e,
3556
- message: V(oe[e.code], e.data),
3596
+ ...t,
3597
+ message: _(lt[t.code], t.data),
3557
3598
  range: {
3558
- start: { line: t.start.line - 1, character: t.start.column },
3559
- end: { line: t.end.line - 1, character: t.end.column }
3599
+ start: { line: e.start.line - 1, character: e.start.column },
3600
+ end: { line: e.end.line - 1, character: e.end.column }
3560
3601
  }
3561
3602
  };
3562
3603
  this._diagnostics.push(i);
3563
3604
  }
3564
- handleErrors(t) {
3565
- (t ?? []).forEach(this.handleException);
3605
+ handleErrors(e) {
3606
+ (e ?? []).forEach(this.handleException);
3566
3607
  }
3567
- getIdentifierInfo(t) {
3568
- return this._functionScopeIdentifiers?.get(t) ?? this._scriptScopeIdentifiers.get(t);
3608
+ getIdentifierInfo(e) {
3609
+ return this._functionScopeIdentifiers?.get(e) ?? this._scriptScopeIdentifiers.get(e);
3569
3610
  }
3570
- setIdentifierInfo(t, e) {
3611
+ setIdentifierInfo(e, t) {
3571
3612
  if (this._functionScopeIdentifiers) {
3572
- this._functionScopeIdentifiers.set(t, e);
3613
+ this._functionScopeIdentifiers.set(e, t);
3573
3614
  return;
3574
3615
  }
3575
- this._scriptScopeIdentifiers.set(t, e), this._undeclaredIdentifiersInFunctions.has(t) && (this._undeclaredIdentifiersInFunctions.delete(t), e.used = !0);
3616
+ this._scriptScopeIdentifiers.set(e, t), this._undeclaredIdentifiersInFunctions.has(e) && (this._undeclaredIdentifiersInFunctions.delete(e), t.used = !0);
3576
3617
  }
3577
- isProfileVariable(t) {
3578
- return this._profileVariables.some((e) => e.name.toLowerCase() === t);
3618
+ isProfileVariable(e) {
3619
+ return this._profileVariables.some((t) => t.name.toLowerCase() === e);
3579
3620
  }
3580
- isApiConstant(t) {
3581
- return !!this._apiDatabase?.constantDefinitions.get(t);
3621
+ isApiConstant(e) {
3622
+ return !!this._apiDatabase?.constantDefinitions.get(e);
3582
3623
  }
3583
- isApiFunction(t) {
3584
- return !!this._apiDatabase?.functionDefinitions.get(t);
3624
+ isApiFunction(e) {
3625
+ return !!this._apiDatabase?.functionDefinitions.get(e);
3585
3626
  }
3586
- isApiItem(t) {
3587
- return this.isApiConstant(t) || this.isApiFunction(t);
3627
+ isApiItem(e) {
3628
+ return this.isApiConstant(e) || this.isApiFunction(e);
3588
3629
  }
3589
- validateVariableDeclarator(t) {
3590
- this.validateExpression(t.init), this.recordVariableIdentifier(t.id, { initialized: !!t.init });
3630
+ validateVariableDeclarator(e) {
3631
+ this.validateExpression(e.init), this.recordVariableIdentifier(e.id, { initialized: !!e.init });
3591
3632
  }
3592
- validateFunctionDeclaration(t) {
3593
- this.recordFunctionIdentifier(t), this.inFunctionScope(() => {
3594
- t.params.forEach((e) => this.recordParamAsIdentifier(e)), O(t.body) && this.logDiagnostic(t.body.loc, {
3633
+ validateFunctionDeclaration(e) {
3634
+ this.recordFunctionIdentifier(e), this.inFunctionScope(() => {
3635
+ e.params.forEach((t) => this.recordParamAsIdentifier(t)), j(e.body) && this.logDiagnostic(e.body.loc, {
3595
3636
  code: p.UnexpectedEmptyFunction,
3596
- data: { identifier: t.id.name },
3637
+ data: { identifier: e.id.name },
3597
3638
  severity: A.Warning
3598
- }), this.validateStatement(t.body);
3639
+ }), this.validateStatement(e.body);
3599
3640
  });
3600
3641
  }
3601
- validateExportDeclaration(t) {
3602
- this.validateStatement(t.declaration);
3642
+ validateExportDeclaration(e) {
3643
+ this.validateStatement(e.declaration);
3603
3644
  }
3604
- validateImportDeclaration(t) {
3605
- this.recordImportIdentifier(t);
3645
+ validateImportDeclaration(e) {
3646
+ this.recordImportIdentifier(e);
3606
3647
  }
3607
- validateForStatement(t) {
3608
- q(t.init) ? this.inBlock(this.validateStatement, t.init) : this.validateExpression(t.init), this.validateExpression(t.update), this.validateExpression(t.test), O(t.body) && this.logDiagnostic(t.body.loc, {
3648
+ validateForStatement(e) {
3649
+ G(e.init) ? this.inBlock(this.validateStatement, e.init) : this.validateExpression(e.init), this.validateExpression(e.update), this.validateExpression(e.test), j(e.body) && this.logDiagnostic(e.body.loc, {
3609
3650
  code: p.EmptyBlockStatement,
3610
3651
  severity: A.Warning
3611
- }), this.inBlock(this.validateStatement, t.body);
3652
+ }), this.inBlock(this.validateStatement, e.body);
3612
3653
  }
3613
- validateWhileStatement(t) {
3614
- this.validateExpression(t.test), O(t.body) && this.logDiagnostic(t.body.loc, {
3654
+ validateWhileStatement(e) {
3655
+ this.validateExpression(e.test), j(e.body) && this.logDiagnostic(e.body.loc, {
3615
3656
  code: p.EmptyBlockStatement,
3616
3657
  severity: A.Warning
3617
- }), this.inBlock(this.validateStatement, t.body);
3658
+ }), this.inBlock(this.validateStatement, e.body);
3618
3659
  }
3619
- validateForInOfStatement(t) {
3620
- if (I(t.left)) {
3621
- const e = this._assignmentValidationMode;
3622
- this._assignmentValidationMode = "left", this._identifierBeingAssigned = t.left.name.toLowerCase(), this.validateExpression(t.left), this._assignmentValidationMode = e;
3660
+ validateForInOfStatement(e) {
3661
+ if (b(e.left)) {
3662
+ const t = this._assignmentValidationMode;
3663
+ this._assignmentValidationMode = "left", this._identifierBeingAssigned = e.left.name.toLowerCase(), this.validateExpression(e.left), this._assignmentValidationMode = t;
3623
3664
  } else
3624
- this.recordVariableIdentifier(t.left.declarations[0].id, { initialized: !0, inBlock: !0 });
3625
- this.validateExpression(t.right), O(t.body) && this.logDiagnostic(t.body.loc, {
3665
+ this.recordVariableIdentifier(e.left.declarations[0].id, { initialized: !0, inBlock: !0 });
3666
+ this.validateExpression(e.right), j(e.body) && this.logDiagnostic(e.body.loc, {
3626
3667
  code: p.EmptyBlockStatement,
3627
3668
  severity: A.Warning
3628
- }), this.validateStatement(t.body);
3669
+ }), this.validateStatement(e.body);
3629
3670
  }
3630
- validateIfStatement(t) {
3631
- this.validateExpression(t.test), O(t.consequent) && this.logDiagnostic(t.consequent.loc, {
3671
+ validateIfStatement(e) {
3672
+ this.validateExpression(e.test), j(e.consequent) && this.logDiagnostic(e.consequent.loc, {
3632
3673
  code: p.EmptyBlockStatement,
3633
3674
  severity: A.Warning
3634
- }), t.alternate && O(t.alternate) && this.logDiagnostic(t.alternate.loc, {
3675
+ }), e.alternate && j(e.alternate) && this.logDiagnostic(e.alternate.loc, {
3635
3676
  code: p.EmptyBlockStatement,
3636
3677
  severity: A.Warning
3637
- }), this.inBlock(this.validateStatement, t.consequent), this.inBlock(this.validateStatement, t.alternate);
3678
+ }), this.inBlock(this.validateStatement, e.consequent), this.inBlock(this.validateStatement, e.alternate);
3638
3679
  }
3639
- validateAssignmentExpression(t) {
3640
- const e = this._identifierBeingAssigned, i = this._assignmentValidationMode;
3641
- I(t.left) && (this._identifierBeingAssigned = t.left.name.toLowerCase(), this._assignmentValidationMode = "left"), this.validateExpression(t.left), I(t.left) && (this._assignmentValidationMode = "right"), this.validateExpression(t.right), this._identifierBeingAssigned = e, this._assignmentValidationMode = i;
3680
+ validateAssignmentExpression(e) {
3681
+ const t = this._identifierBeingAssigned, i = this._assignmentValidationMode;
3682
+ b(e.left) && (this._identifierBeingAssigned = e.left.name.toLowerCase(), this._assignmentValidationMode = "left"), this.validateExpression(e.left), b(e.left) && (this._assignmentValidationMode = "right"), this.validateExpression(e.right), this._identifierBeingAssigned = t, this._assignmentValidationMode = i;
3642
3683
  }
3643
- validateCallExpression(t) {
3644
- const e = this._isInCallExpression;
3645
- if (this._isInCallExpression = !0, this.validateExpression(t.callee), I(t.callee)) {
3646
- const i = t.callee.name.toLowerCase(), r = this.getIdentifierInfo(i), s = this._apiDatabase?.functionDefinitions.get(i);
3684
+ validateCallExpression(e) {
3685
+ const t = this._isInCallExpression;
3686
+ if (this._isInCallExpression = !0, this.validateExpression(e.callee), b(e.callee)) {
3687
+ const i = e.callee.name.toLowerCase(), r = this.getIdentifierInfo(i), s = this._apiDatabase?.functionDefinitions.get(i);
3647
3688
  if (!r && s) {
3648
- const a = ri(s, t.arguments.length);
3649
- a && this.logDiagnostic(t.loc, a);
3689
+ const a = ai(s, e.arguments.length);
3690
+ a && this.logDiagnostic(e.loc, a);
3650
3691
  }
3651
3692
  }
3652
- t.arguments.forEach(this.validateExpression), this._isInCallExpression = e;
3693
+ e.arguments.forEach(this.validateExpression), this._isInCallExpression = t;
3653
3694
  }
3654
- validateIdentifier(t) {
3655
- const e = t.name.toLowerCase(), i = this.getIdentifierInfo(e);
3695
+ validateIdentifier(e) {
3696
+ const t = e.name.toLowerCase(), i = this.getIdentifierInfo(t);
3656
3697
  if (i) {
3657
- if (this._assignmentValidationMode === "left" && this._identifierBeingAssigned === e) {
3698
+ if (this._assignmentValidationMode === "left" && this._identifierBeingAssigned === t) {
3658
3699
  i.initialized = !0;
3659
3700
  return;
3660
3701
  }
3661
- if (this._assignmentValidationMode === "right" && this._identifierBeingAssigned === e)
3702
+ if (this._assignmentValidationMode === "right" && this._identifierBeingAssigned === t)
3662
3703
  return;
3663
3704
  i.used = !0;
3664
3705
  return;
3665
3706
  }
3666
- if (!(this.isProfileVariable(e) || this.isApiConstant(e))) {
3667
- if (this.isApiFunction(e)) {
3707
+ if (!(this.isProfileVariable(t) || this.isApiConstant(t))) {
3708
+ if (this.isApiFunction(t)) {
3668
3709
  if (this._isInCallExpression)
3669
3710
  return;
3670
- this.logDiagnostic(t.loc, {
3711
+ this.logDiagnostic(e.loc, {
3671
3712
  code: p.InvalidApiFunctionUsage,
3672
- data: { identifier: t.name }
3713
+ data: { identifier: e.name }
3673
3714
  });
3674
3715
  return;
3675
3716
  }
3676
3717
  if (this._isInFunctionScope) {
3677
- let r = this._undeclaredIdentifiersInFunctions.get(e);
3678
- r || (r = [], this._undeclaredIdentifiersInFunctions.set(e, r)), r.push({ node: t, identifier: e });
3718
+ let r = this._undeclaredIdentifiersInFunctions.get(t);
3719
+ r || (r = [], this._undeclaredIdentifiersInFunctions.set(t, r)), r.push({ node: e, identifier: t });
3679
3720
  return;
3680
3721
  }
3681
- this.logDiagnostic(t.loc, { code: p.NotDefined, data: { identifier: t.name } });
3722
+ this.logDiagnostic(e.loc, { code: p.NotDefined, data: { identifier: e.name } });
3682
3723
  }
3683
3724
  }
3684
- validateLiteral(t) {
3685
- ui(t.raw).forEach((e) => {
3686
- const i = this.getIdentifierInfo(e.toLowerCase());
3725
+ validateLiteral(e) {
3726
+ ci(e.raw).forEach((t) => {
3727
+ const i = this.getIdentifierInfo(t.toLowerCase());
3687
3728
  i && (i.used = !0);
3688
3729
  });
3689
3730
  }
3690
- logProfileOrApiConflict(t) {
3691
- const e = t.name.toLowerCase(), i = this.isProfileVariable(e), r = this.isApiItem(e);
3692
- !i && !r || this.logDiagnostic(t.loc, {
3731
+ logProfileOrApiConflict(e) {
3732
+ const t = e.name.toLowerCase(), i = this.isProfileVariable(t), r = this.isApiItem(t);
3733
+ !i && !r || this.logDiagnostic(e.loc, {
3693
3734
  code: i ? p.ProfileVariablesConflict : p.ApiConflict,
3694
3735
  severity: A.Warning,
3695
3736
  data: {
3696
- identifier: t.name
3737
+ identifier: e.name
3697
3738
  }
3698
3739
  });
3699
3740
  }
3700
- logReservedKeywordsConflict(t) {
3701
- const e = t.name.toLowerCase();
3702
- Ne.includes(e) && this.logDiagnostic(t.loc, {
3741
+ logReservedKeywordsConflict(e) {
3742
+ const t = e.name.toLowerCase();
3743
+ Ot.includes(t) && this.logDiagnostic(e.loc, {
3703
3744
  code: p.ReservedKeyword,
3704
3745
  severity: A.Warning,
3705
3746
  data: {
3706
- identifier: t.name
3747
+ identifier: e.name
3707
3748
  }
3708
3749
  });
3709
3750
  }
3710
- validateObjectExpression(t) {
3711
- t.properties.forEach((e) => {
3712
- this.validateExpression(e.value);
3751
+ validateObjectExpression(e) {
3752
+ e.properties.forEach((t) => {
3753
+ this.validateExpression(t.value);
3713
3754
  });
3714
3755
  }
3715
- validateUnaryExpression(t) {
3716
- this.validateExpression(t.argument);
3756
+ validateUnaryExpression(e) {
3757
+ this.validateExpression(e.argument);
3717
3758
  }
3718
- validateUpdateExpression(t) {
3719
- this.validateExpression(t.argument);
3759
+ validateUpdateExpression(e) {
3760
+ this.validateExpression(e.argument);
3720
3761
  }
3721
- validateBinaryAndLogicalExpression(t) {
3722
- this.validateExpression(t.left), this.validateExpression(t.right);
3762
+ validateBinaryAndLogicalExpression(e) {
3763
+ this.validateExpression(e.left), this.validateExpression(e.right);
3723
3764
  }
3724
- validateMemberExpression(t) {
3725
- const e = this.flattenMemberExpressionAndValidate(t), i = e[0].object;
3726
- this.disableRecordIdentifierAssignment(this.validateExpression, i), I(i) && (this.getIdentifierInfo(i.name.toLowerCase()) || this.validateMemberExpressionWithProfile(e) || this.validateConstantMemberExpression(e));
3765
+ validateMemberExpression(e) {
3766
+ const t = this.flattenMemberExpressionAndValidate(e), i = t[0].object;
3767
+ this.disableRecordIdentifierAssignment(this.validateExpression, i), b(i) && (this.getIdentifierInfo(i.name.toLowerCase()) || this.validateMemberExpressionWithProfile(t) || this.validateConstantMemberExpression(t));
3727
3768
  }
3728
- flattenMemberExpressionAndValidate(t) {
3729
- switch (t.type) {
3769
+ flattenMemberExpressionAndValidate(e) {
3770
+ switch (e.type) {
3730
3771
  case u.MemberExpression:
3731
- return (!I(t.property) || t.computed) && this.validateExpression(t.property), [...this.flattenMemberExpressionAndValidate(t.object), t];
3772
+ return (!b(e.property) || e.computed) && this.validateExpression(e.property), [...this.flattenMemberExpressionAndValidate(e.object), e];
3732
3773
  default:
3733
3774
  return [];
3734
3775
  }
3735
3776
  }
3736
- extractAndValidatePropertyName(t) {
3737
- switch (t.type) {
3777
+ extractAndValidatePropertyName(e) {
3778
+ switch (e.type) {
3738
3779
  case u.Identifier:
3739
- return t.name.toLowerCase();
3780
+ return e.name.toLowerCase();
3740
3781
  case u.Literal:
3741
- return typeof t.value != "string" ? (this.logDiagnostic(t.loc, { code: p.UnexpectedPropertyIdentifier }), null) : t.value.toLowerCase();
3782
+ return typeof e.value != "string" ? (this.logDiagnostic(e.loc, { code: p.UnexpectedPropertyIdentifier }), null) : e.value.toLowerCase();
3742
3783
  default:
3743
- return this.logDiagnostic(t.loc, { code: p.UnexpectedPropertyIdentifier }), null;
3784
+ return this.logDiagnostic(e.loc, { code: p.UnexpectedPropertyIdentifier }), null;
3744
3785
  }
3745
3786
  }
3746
- validateConstantMemberExpression(t) {
3747
- const e = t[0];
3748
- if (!I(e.object))
3787
+ validateConstantMemberExpression(e) {
3788
+ const t = e[0];
3789
+ if (!b(t.object))
3749
3790
  return !1;
3750
- const i = e.object.name.toLowerCase(), r = this._apiDatabase?.constantDefinitions.get(i);
3791
+ const i = t.object.name.toLowerCase(), r = this._apiDatabase?.constantDefinitions.get(i);
3751
3792
  if (!r)
3752
3793
  return !1;
3753
3794
  if (r.type !== "namespace")
3754
- return this.logDiagnostic(e.property.loc, {
3795
+ return this.logDiagnostic(t.property.loc, {
3755
3796
  code: p.NotADictionary,
3756
3797
  data: { identifier: i }
3757
3798
  }), !0;
3758
- const s = this.extractAndValidatePropertyName(e.property);
3799
+ const s = this.extractAndValidatePropertyName(t.property);
3759
3800
  if (!s)
3760
3801
  return !0;
3761
3802
  if (!r.members.some((a) => a.name.toLowerCase() === s)) {
@@ -3763,41 +3804,41 @@ class ii {
3763
3804
  (o, c) => `${o}${o ? " | " : ""}${c.completion.label.split(".").pop()}`,
3764
3805
  ""
3765
3806
  );
3766
- this.logDiagnostic(e.property.loc, {
3807
+ this.logDiagnostic(t.property.loc, {
3767
3808
  code: p.InvalidConstantIdentifier,
3768
3809
  data: { list: a }
3769
3810
  });
3770
3811
  }
3771
- return t.length > 1 && this.logDiagnostic(t[1].property.loc, { code: p.UnexpectedPropertyIdentifier }), !0;
3812
+ return e.length > 1 && this.logDiagnostic(e[1].property.loc, { code: p.UnexpectedPropertyIdentifier }), !0;
3772
3813
  }
3773
- validateMemberExpressionWithProfile(t) {
3774
- const e = t[0];
3775
- if (e.object.type !== u.Identifier)
3814
+ validateMemberExpressionWithProfile(e) {
3815
+ const t = e[0];
3816
+ if (t.object.type !== u.Identifier)
3776
3817
  return !1;
3777
- const i = e.object.name.toLowerCase(), r = this._profileVariables.find((a) => a.name.toLowerCase() === i);
3818
+ const i = t.object.name.toLowerCase(), r = this._profileVariables.find((a) => a.name.toLowerCase() === i);
3778
3819
  if (!r)
3779
3820
  return !1;
3780
- if (Ct(r))
3781
- return this.logDiagnostic(e.object.loc, {
3821
+ if (Ee(r))
3822
+ return this.logDiagnostic(t.object.loc, {
3782
3823
  code: p.NotADictionary,
3783
3824
  data: { identifier: r.name }
3784
3825
  }), !0;
3785
3826
  if (this._identifierBeingAssigned === i)
3786
- return this.logDiagnostic(e.loc, { code: p.ProfileVariablesAreImmutable }), !0;
3827
+ return this.logDiagnostic(t.loc, { code: p.ProfileVariablesAreImmutable }), !0;
3787
3828
  let s = r;
3788
- for (let a = 0; a < t.length; a++) {
3789
- if (t[a].computed)
3829
+ for (let a = 0; a < e.length; a++) {
3830
+ if (e[a].computed)
3790
3831
  return !0;
3791
- if (Ct(s))
3792
- return this.logDiagnostic(t[a - 1]?.property.loc ?? t[a].object.loc, {
3832
+ if (Ee(s))
3833
+ return this.logDiagnostic(e[a - 1]?.property.loc ?? e[a].object.loc, {
3793
3834
  code: p.NotADictionary,
3794
3835
  data: { identifier: s.name }
3795
3836
  }), !0;
3796
- const o = this.extractAndValidatePropertyName(t[a].property);
3837
+ const o = this.extractAndValidatePropertyName(e[a].property);
3797
3838
  if (!o)
3798
3839
  return !0;
3799
3840
  if (!s.properties || s.properties.length === 0)
3800
- return this.logDiagnostic(t[a].property.loc, {
3841
+ return this.logDiagnostic(e[a].property.loc, {
3801
3842
  code: p.UnknownPropertyIdentifier,
3802
3843
  data: { identifier: o },
3803
3844
  severity: A.Warning
@@ -3807,10 +3848,10 @@ class ii {
3807
3848
  );
3808
3849
  if (!c) {
3809
3850
  const d = s.properties.reduce(
3810
- (C, x) => `${C}${C ? " | " : ""}${x.name.split(".").pop()}`,
3851
+ (C, F) => `${C}${C ? " | " : ""}${F.name.split(".").pop()}`,
3811
3852
  ""
3812
3853
  );
3813
- return this.logDiagnostic(t[a].property.loc, {
3854
+ return this.logDiagnostic(e[a].property.loc, {
3814
3855
  code: p.InvalidPropertyIdentifier,
3815
3856
  data: { list: d }
3816
3857
  }), !0;
@@ -3819,128 +3860,128 @@ class ii {
3819
3860
  }
3820
3861
  return !0;
3821
3862
  }
3822
- recordVariableIdentifier(t, e) {
3823
- this.logReservedKeywordsConflict(t), this.logProfileOrApiConflict(t);
3824
- const i = t.name.toLowerCase();
3863
+ recordVariableIdentifier(e, t) {
3864
+ this.logReservedKeywordsConflict(e), this.logProfileOrApiConflict(e);
3865
+ const i = e.name.toLowerCase();
3825
3866
  let r = this.getIdentifierInfo(i);
3826
3867
  const s = this._isInFunctionScope && r?.scope === "function", a = !this._isInFunctionScope && r?.scope === "script";
3827
- (s || a) && this.logDiagnostic(t.loc, {
3868
+ (s || a) && this.logDiagnostic(e.loc, {
3828
3869
  code: p.AlreadyDefined,
3829
- data: { identifier: t.name },
3870
+ data: { identifier: e.name },
3830
3871
  severity: A.Warning
3831
3872
  });
3832
- const o = e.inBlock ?? this._isInBlock, { initialized: c } = e;
3873
+ const o = t.inBlock ?? this._isInBlock, { initialized: c } = t;
3833
3874
  if (!r || this._isInFunctionScope && r.scope !== "function") {
3834
3875
  const d = this._isInFunctionScope ? "function" : o ? "block" : "script";
3835
3876
  r = {
3836
- node: t,
3877
+ node: e,
3837
3878
  used: !1,
3838
3879
  initialized: c,
3839
3880
  scope: d
3840
3881
  };
3841
3882
  } else
3842
- r.node = t, r.used = !1, r.initialized = c;
3843
- return r.scope === "block" && !o && (r.scope = "script", this.logDiagnostic(t.loc, {
3883
+ r.node = e, r.used = !1, r.initialized = c;
3884
+ return r.scope === "block" && !o && (r.scope = "script", this.logDiagnostic(e.loc, {
3844
3885
  code: p.AlreadyDefined,
3845
- data: { identifier: t.name },
3886
+ data: { identifier: e.name },
3846
3887
  severity: A.Warning
3847
3888
  })), this.setIdentifierInfo(i, r), !1;
3848
3889
  }
3849
- recordImportIdentifier(t) {
3850
- const e = t.specifiers[0].local;
3851
- this.logProfileOrApiConflict(e);
3852
- const i = e.name.toLowerCase();
3890
+ recordImportIdentifier(e) {
3891
+ const t = e.specifiers[0].local;
3892
+ this.logProfileOrApiConflict(t);
3893
+ const i = t.name.toLowerCase();
3853
3894
  let r = this.getIdentifierInfo(i);
3854
- r?.scope && this.logDiagnostic(t.specifiers[0].local.loc, {
3895
+ r?.scope && this.logDiagnostic(e.specifiers[0].local.loc, {
3855
3896
  code: p.AlreadyDefined,
3856
- data: { identifier: t.specifiers[0].local.name },
3897
+ data: { identifier: e.specifiers[0].local.name },
3857
3898
  severity: A.Warning
3858
3899
  }), r = {
3859
- node: t.specifiers[0].local,
3900
+ node: e.specifiers[0].local,
3860
3901
  used: !1,
3861
3902
  ...r,
3862
3903
  scope: "script",
3863
3904
  initialized: !0
3864
3905
  }, this.setIdentifierInfo(i, r);
3865
3906
  }
3866
- recordFunctionIdentifier(t) {
3867
- this.logProfileOrApiConflict(t.id);
3868
- const e = t.id.name.toLowerCase();
3869
- let i = this.getIdentifierInfo(e);
3870
- i?.scope && this.logDiagnostic(t.id.loc, {
3907
+ recordFunctionIdentifier(e) {
3908
+ this.logProfileOrApiConflict(e.id);
3909
+ const t = e.id.name.toLowerCase();
3910
+ let i = this.getIdentifierInfo(t);
3911
+ i?.scope && this.logDiagnostic(e.id.loc, {
3871
3912
  code: p.AlreadyDefined,
3872
- data: { identifier: t.id.name },
3913
+ data: { identifier: e.id.name },
3873
3914
  severity: A.Warning
3874
3915
  }), i = {
3875
- node: t.id,
3916
+ node: e.id,
3876
3917
  used: !1,
3877
3918
  ...i,
3878
3919
  scope: "script",
3879
3920
  initialized: !0
3880
- }, this.setIdentifierInfo(e, i);
3921
+ }, this.setIdentifierInfo(t, i);
3881
3922
  }
3882
- recordParamAsIdentifier(t) {
3883
- return this.recordVariableIdentifier(t, { initialized: !0 });
3923
+ recordParamAsIdentifier(e) {
3924
+ return this.recordVariableIdentifier(e, { initialized: !0 });
3884
3925
  }
3885
3926
  diagnoseIdentifiers() {
3886
- (this._functionScopeIdentifiers ?? this._scriptScopeIdentifiers).forEach((t) => {
3887
- t.used ? t.initialized || this.logDiagnostic(t.node.loc, {
3927
+ (this._functionScopeIdentifiers ?? this._scriptScopeIdentifiers).forEach((e) => {
3928
+ e.used ? e.initialized || this.logDiagnostic(e.node.loc, {
3888
3929
  code: p.DefinedNeverAssigned,
3889
- data: { identifier: t.node.name },
3930
+ data: { identifier: e.node.name },
3890
3931
  severity: A.Warning
3891
- }) : this.logDiagnostic(t.node.loc, {
3892
- code: t.initialized ? p.AssignedNeverUsed : p.DefinedNeverUsed,
3893
- data: { identifier: t.node.name },
3932
+ }) : this.logDiagnostic(e.node.loc, {
3933
+ code: e.initialized ? p.AssignedNeverUsed : p.DefinedNeverUsed,
3934
+ data: { identifier: e.node.name },
3894
3935
  severity: A.Warning
3895
3936
  });
3896
3937
  });
3897
3938
  }
3898
3939
  }
3899
- function ni(n) {
3940
+ function ui(n) {
3900
3941
  return !!n && n.name === "ParsingError";
3901
3942
  }
3902
- function O(n) {
3903
- return Dt(n) || w(n) && !n.body.length;
3943
+ function j(n) {
3944
+ return pe(n) || I(n) && !n.body.length;
3904
3945
  }
3905
- function ri(n, t) {
3906
- const { min: e, max: i } = n.overloads.reduce(
3946
+ function ai(n, e) {
3947
+ const { min: t, max: i } = n.overloads.reduce(
3907
3948
  (r, s) => {
3908
3949
  const { min: a, max: o } = s.parametersInfo;
3909
3950
  return r.min >= 0 && (r.min = Math.min(a, r.min)), r.max >= 0 && (r.max = o < 0 ? o : Math.max(o, r.max)), r;
3910
3951
  },
3911
3952
  { min: Number.POSITIVE_INFINITY, max: 0 }
3912
3953
  );
3913
- return t < e ? e > 0 ? { code: p.NotEnoughArguments, data: { min: e } } : { code: p.NoArgumentExpected } : i >= 0 && t > i ? { code: p.TooManyArguments, data: { max: i } } : null;
3954
+ return e < t ? t > 0 ? { code: p.NotEnoughArguments, data: { min: t } } : { code: p.NoArgumentExpected } : i >= 0 && e > i ? { code: p.TooManyArguments, data: { max: i } } : null;
3914
3955
  }
3915
- const si = /\B@\w+/gu;
3916
- function ui(n = "") {
3917
- return Array.from(n.matchAll(si), (t) => t[0].slice(1));
3956
+ const oi = /\B@\w+/gu;
3957
+ function ci(n = "") {
3958
+ return Array.from(n.matchAll(oi), (e) => e[0].slice(1));
3918
3959
  }
3919
- class hi {
3920
- configure(t) {
3921
- this.apiService = new Jt(t);
3960
+ class pi {
3961
+ configure(e) {
3962
+ this.apiService = new Qe(e);
3922
3963
  }
3923
- async doValidation(t, e) {
3964
+ async doValidation(e, t) {
3924
3965
  if (!this.apiService)
3925
3966
  return [];
3926
- const i = await this.apiService.getApiDatabase(e), { profile: { variables: r = [] } = {} } = e, { diagnostics: s } = new ii(i, r).validateScript(t.getText());
3967
+ const i = await this.apiService.getApiDatabase(t), { profile: { variables: r = [] } = {} } = t, { diagnostics: s } = new si(i, r).validateScript(e.getText());
3927
3968
  return s;
3928
3969
  }
3929
- async doComplete(t, e, i) {
3970
+ async doComplete(e, t, i) {
3930
3971
  if (!this.apiService)
3931
3972
  return { isIncomplete: !1, items: [] };
3932
3973
  const r = await this.apiService.getApiDatabase(i);
3933
- return _e(t, e, r, i);
3974
+ return Wt(e, t, r, i);
3934
3975
  }
3935
3976
  }
3936
3977
  export {
3937
- ve as ArcadeKeywords,
3938
- hi as ArcadeLanguageService,
3939
- Pe as ArcadeLiterals,
3940
- Ne as ArcadeReservedKeywords,
3941
- oe as DiagnosticMessages,
3942
- pi as DiagnosticSeverity,
3978
+ Mt as ArcadeKeywords,
3979
+ pi as ArcadeLanguageService,
3980
+ Ut as ArcadeLiterals,
3981
+ Ot as ArcadeReservedKeywords,
3982
+ lt as DiagnosticMessages,
3983
+ fi as DiagnosticSeverity,
3943
3984
  p as ValidationDiagnosticCodes,
3944
- ci as arcadeFormat,
3945
- Te as format
3985
+ Di as arcadeFormat,
3986
+ Nt as format
3946
3987
  };