@dbml/parse 3.13.0-alpha.1 → 3.13.0-alpha.2

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 (78) hide show
  1. package/dist/dbml-parse.js +6 -6
  2. package/dist/dbml-parse.mjs +737 -740
  3. package/dist/{lib → src/lib}/analyzer/binder/elementBinder/elementBinder.d.ts +2 -2
  4. package/dist/{lib → src/lib}/analyzer/binder/elementBinder/table.d.ts +6 -8
  5. package/dist/{lib → src/lib}/analyzer/binder/types.d.ts +0 -3
  6. package/dist/{lib → src/lib}/analyzer/symbol/symbols.d.ts +6 -4
  7. package/dist/src/lib/analyzer/symbol/utils.d.ts +4 -0
  8. package/dist/{lib → src/lib}/analyzer/utils.d.ts +2 -1
  9. package/dist/{lib → src/lib}/analyzer/validator/elementValidators/table.d.ts +3 -4
  10. package/dist/tests/NaN_errors/interpreter_NaN.test.d.ts +1 -0
  11. package/dist/tests/binder/binder.test.d.ts +1 -0
  12. package/dist/tests/interpreter/interpreter.test.d.ts +1 -0
  13. package/dist/tests/jestHelpers.d.ts +1 -0
  14. package/dist/tests/lexer/lexer.test.d.ts +1 -0
  15. package/dist/tests/parser/parser.test.d.ts +1 -0
  16. package/dist/tests/validator/validator.test.d.ts +1 -0
  17. package/package.json +4 -2
  18. package/dist/lib/analyzer/symbol/utils.d.ts +0 -2
  19. /package/dist/{compiler.d.ts → src/compiler.d.ts} +0 -0
  20. /package/dist/{constants.d.ts → src/constants.d.ts} +0 -0
  21. /package/dist/{index.d.ts → src/index.d.ts} +0 -0
  22. /package/dist/{lib → src/lib}/analyzer/analyzer.d.ts +0 -0
  23. /package/dist/{lib → src/lib}/analyzer/binder/binder.d.ts +0 -0
  24. /package/dist/{lib → src/lib}/analyzer/binder/elementBinder/custom.d.ts +0 -0
  25. /package/dist/{lib → src/lib}/analyzer/binder/elementBinder/enum.d.ts +0 -0
  26. /package/dist/{lib → src/lib}/analyzer/binder/elementBinder/indexes.d.ts +0 -0
  27. /package/dist/{lib → src/lib}/analyzer/binder/elementBinder/note.d.ts +0 -0
  28. /package/dist/{lib → src/lib}/analyzer/binder/elementBinder/project.d.ts +0 -0
  29. /package/dist/{lib → src/lib}/analyzer/binder/elementBinder/ref.d.ts +0 -0
  30. /package/dist/{lib → src/lib}/analyzer/binder/elementBinder/tableGroup.d.ts +0 -0
  31. /package/dist/{lib → src/lib}/analyzer/binder/elementBinder/tablePartial.d.ts +0 -0
  32. /package/dist/{lib → src/lib}/analyzer/binder/utils.d.ts +0 -0
  33. /package/dist/{lib → src/lib}/analyzer/symbol/factory.d.ts +0 -0
  34. /package/dist/{lib → src/lib}/analyzer/symbol/symbolIndex.d.ts +0 -0
  35. /package/dist/{lib → src/lib}/analyzer/symbol/symbolTable.d.ts +0 -0
  36. /package/dist/{lib → src/lib}/analyzer/types.d.ts +0 -0
  37. /package/dist/{lib → src/lib}/analyzer/validator/elementValidators/custom.d.ts +0 -0
  38. /package/dist/{lib → src/lib}/analyzer/validator/elementValidators/enum.d.ts +0 -0
  39. /package/dist/{lib → src/lib}/analyzer/validator/elementValidators/indexes.d.ts +0 -0
  40. /package/dist/{lib → src/lib}/analyzer/validator/elementValidators/note.d.ts +0 -0
  41. /package/dist/{lib → src/lib}/analyzer/validator/elementValidators/project.d.ts +0 -0
  42. /package/dist/{lib → src/lib}/analyzer/validator/elementValidators/ref.d.ts +0 -0
  43. /package/dist/{lib → src/lib}/analyzer/validator/elementValidators/tableGroup.d.ts +0 -0
  44. /package/dist/{lib → src/lib}/analyzer/validator/elementValidators/tablePartial.d.ts +0 -0
  45. /package/dist/{lib → src/lib}/analyzer/validator/types.d.ts +0 -0
  46. /package/dist/{lib → src/lib}/analyzer/validator/utils.d.ts +0 -0
  47. /package/dist/{lib → src/lib}/analyzer/validator/validator.d.ts +0 -0
  48. /package/dist/{lib → src/lib}/errors.d.ts +0 -0
  49. /package/dist/{lib → src/lib}/interpreter/elementInterpreter/enum.d.ts +0 -0
  50. /package/dist/{lib → src/lib}/interpreter/elementInterpreter/project.d.ts +0 -0
  51. /package/dist/{lib → src/lib}/interpreter/elementInterpreter/ref.d.ts +0 -0
  52. /package/dist/{lib → src/lib}/interpreter/elementInterpreter/sticky_note.d.ts +0 -0
  53. /package/dist/{lib → src/lib}/interpreter/elementInterpreter/table.d.ts +0 -0
  54. /package/dist/{lib → src/lib}/interpreter/elementInterpreter/tableGroup.d.ts +0 -0
  55. /package/dist/{lib → src/lib}/interpreter/elementInterpreter/tablePartial.d.ts +0 -0
  56. /package/dist/{lib → src/lib}/interpreter/interpreter.d.ts +0 -0
  57. /package/dist/{lib → src/lib}/interpreter/types.d.ts +0 -0
  58. /package/dist/{lib → src/lib}/interpreter/utils.d.ts +0 -0
  59. /package/dist/{lib → src/lib}/lexer/lexer.d.ts +0 -0
  60. /package/dist/{lib → src/lib}/lexer/tokens.d.ts +0 -0
  61. /package/dist/{lib → src/lib}/lexer/utils.d.ts +0 -0
  62. /package/dist/{lib → src/lib}/option.d.ts +0 -0
  63. /package/dist/{lib → src/lib}/parser/contextStack.d.ts +0 -0
  64. /package/dist/{lib → src/lib}/parser/factory.d.ts +0 -0
  65. /package/dist/{lib → src/lib}/parser/nodes.d.ts +0 -0
  66. /package/dist/{lib → src/lib}/parser/parser.d.ts +0 -0
  67. /package/dist/{lib → src/lib}/parser/utils.d.ts +0 -0
  68. /package/dist/{lib → src/lib}/report.d.ts +0 -0
  69. /package/dist/{lib → src/lib}/serialization/serialize.d.ts +0 -0
  70. /package/dist/{lib → src/lib}/types.d.ts +0 -0
  71. /package/dist/{lib → src/lib}/utils.d.ts +0 -0
  72. /package/dist/{services → src/services}/definition/provider.d.ts +0 -0
  73. /package/dist/{services → src/services}/index.d.ts +0 -0
  74. /package/dist/{services → src/services}/references/provider.d.ts +0 -0
  75. /package/dist/{services → src/services}/suggestions/provider.d.ts +0 -0
  76. /package/dist/{services → src/services}/suggestions/utils.d.ts +0 -0
  77. /package/dist/{services → src/services}/types.d.ts +0 -0
  78. /package/dist/{services → src/services}/utils.d.ts +0 -0
@@ -1,4 +1,4 @@
1
- import _, { last as Ze, forIn as ft, partition as nn, findLastIndex as sn } from "lodash";
1
+ import _, { last as Ze, forIn as pt, partition as nn, findLastIndex as sn } from "lodash";
2
2
  var h = /* @__PURE__ */ ((t) => (t.SPACE = "<space>", t.TAB = "<tab>", t.NEWLINE = "<newline>", t.COMMA = "<comma>", t.LPAREN = "<lparen>", t.RPAREN = "<rparen>", t.LBRACE = "<lbrace>", t.RBRACE = "<rbrace>", t.LBRACKET = "<lbracket>", t.RBRACKET = "<rbracket>", t.LANGLE = "<langle>", t.RANGLE = "<rangle>", t.OP = "<op>", t.EOF = "<eof>", t.NUMERIC_LITERAL = "<number>", t.STRING_LITERAL = "<string>", t.COLOR_LITERAL = "<color>", t.FUNCTION_EXPRESSION = "<function-expression>", t.QUOTED_STRING = "<variable>", t.IDENTIFIER = "<identifier>", t.SEMICOLON = "<semicolon>", t.COLON = "<colon>", t.TILDE = "<tilde>", t.SINGLE_LINE_COMMENT = "<single-line-comment>", t.MULTILINE_COMMENT = "<multiline-comment>", t))(h || {});
3
3
  function an(t) {
4
4
  switch (t.kind) {
@@ -12,7 +12,7 @@ function an(t) {
12
12
  return !1;
13
13
  }
14
14
  }
15
- function pt(t) {
15
+ function dt(t) {
16
16
  if (!t)
17
17
  return !1;
18
18
  switch (t) {
@@ -28,13 +28,12 @@ function pt(t) {
28
28
  case ".":
29
29
  case "&":
30
30
  case "|":
31
- case "~":
32
31
  return !0;
33
32
  default:
34
33
  return !1;
35
34
  }
36
35
  }
37
- function dt(t) {
36
+ function Et(t) {
38
37
  return t !== void 0 && t.kind === "<op>";
39
38
  }
40
39
  class J {
@@ -48,7 +47,7 @@ class J {
48
47
  function St(t) {
49
48
  return t.trailingTrivia.find(({ kind: e }) => e === h.NEWLINE) !== void 0;
50
49
  }
51
- function Et(t, e) {
50
+ function Nt(t, e) {
52
51
  return e.leadingTrivia.find(({ kind: s }) => s === h.NEWLINE) !== void 0 || St(t);
53
52
  }
54
53
  function Ke(t) {
@@ -76,7 +75,7 @@ class on {
76
75
  return this.id++;
77
76
  }
78
77
  }
79
- class D {
78
+ class x {
80
79
  // The symbol that this syntax node refers to
81
80
  // args must be passed in order of appearance in the node
82
81
  constructor(e, n, s) {
@@ -96,12 +95,12 @@ class D {
96
95
  }
97
96
  }
98
97
  var Ie = /* @__PURE__ */ ((t) => (t.PROGRAM = "<program>", t.ELEMENT_DECLARATION = "<element-declaration>", t.ATTRIBUTE = "<attribute>", t.IDENTIFIER_STREAM = "<identifer-stream>", t.LITERAL = "<literal>", t.VARIABLE = "<variable>", t.PREFIX_EXPRESSION = "<prefix-expression>", t.INFIX_EXPRESSION = "<infix-expression>", t.POSTFIX_EXPRESSION = "<postfix-expression>", t.FUNCTION_EXPRESSION = "<function-expression>", t.FUNCTION_APPLICATION = "<function-application>", t.BLOCK_EXPRESSION = "<block-expression>", t.LIST_EXPRESSION = "<list-expression>", t.TUPLE_EXPRESSION = "<tuple-expression>", t.CALL_EXPRESSION = "<call-expression>", t.PRIMARY_EXPRESSION = "<primary-expression>", t.GROUP_EXPRESSION = "<group-expression>", t.DUMMY = "<dummy>", t.ARRAY = "<array>", t.PARTIAL_INJECTION = "<partial-injection>", t))(Ie || {});
99
- class Z extends D {
98
+ class Z extends x {
100
99
  constructor({ body: e = [], eof: n }, s) {
101
100
  super(s, "<program>", [...e, n]), this.body = e, this.eof = n;
102
101
  }
103
102
  }
104
- class y extends D {
103
+ class y extends x {
105
104
  constructor({
106
105
  type: e,
107
106
  name: n,
@@ -124,12 +123,12 @@ class y extends D {
124
123
  this.type = e, this.name = n, this.as = s, this.alias = i, this.attributeList = a, this.bodyColon = r, this.body = c;
125
124
  }
126
125
  }
127
- class ne extends D {
126
+ class te extends x {
128
127
  constructor({ identifiers: e = [] }, n) {
129
128
  super(n, "<identifer-stream>", e || []), this.identifiers = e;
130
129
  }
131
130
  }
132
- class se extends D {
131
+ class ne extends x {
133
132
  constructor({
134
133
  name: e,
135
134
  colon: n,
@@ -138,12 +137,12 @@ class se extends D {
138
137
  super(i, "<attribute>", [e, n, s]), this.name = e, this.value = s, this.colon = n;
139
138
  }
140
139
  }
141
- class K extends D {
140
+ class ie extends x {
142
141
  constructor({ op: e, expression: n }, s) {
143
142
  super(s, "<prefix-expression>", [e, n]), this.op = e, this.expression = n;
144
143
  }
145
144
  }
146
- class le extends D {
145
+ class le extends x {
147
146
  constructor({
148
147
  op: e,
149
148
  leftExpression: n,
@@ -152,22 +151,22 @@ class le extends D {
152
151
  super(i, "<infix-expression>", [n, e, s]), this.op = e, this.leftExpression = n, this.rightExpression = s;
153
152
  }
154
153
  }
155
- class je extends D {
154
+ class $e extends x {
156
155
  constructor({ op: e, expression: n }, s) {
157
156
  super(s, "<postfix-expression>", [n, e]), this.op = e, this.expression = n;
158
157
  }
159
158
  }
160
- class ce extends D {
159
+ class ce extends x {
161
160
  constructor({ value: e }, n) {
162
161
  super(n, "<function-expression>", [e]), this.value = e;
163
162
  }
164
163
  }
165
- class v extends D {
164
+ class v extends x {
166
165
  constructor({ callee: e, args: n = [] }, s) {
167
166
  super(s, "<function-application>", [e, ...n]), this.callee = e, this.args = n;
168
167
  }
169
168
  }
170
- class re extends D {
169
+ class re extends x {
171
170
  constructor({
172
171
  blockOpenBrace: e,
173
172
  body: n = [],
@@ -176,12 +175,12 @@ class re extends D {
176
175
  super(i, "<block-expression>", [e, ...n, s]), this.blockOpenBrace = e, this.body = n, this.blockCloseBrace = s;
177
176
  }
178
177
  }
179
- class Le extends D {
178
+ class Le extends x {
180
179
  constructor({ op: e, partial: n }, s) {
181
180
  super(s, "<partial-injection>", [e, n]), this.partial = n;
182
181
  }
183
182
  }
184
- class R extends D {
183
+ class U extends x {
185
184
  constructor({
186
185
  listOpenBracket: e,
187
186
  elementList: n = [],
@@ -195,7 +194,7 @@ class R extends D {
195
194
  ]), this.listOpenBracket = e, this.elementList = n, this.commaList = s, this.listCloseBracket = i;
196
195
  }
197
196
  }
198
- class fe extends D {
197
+ class fe extends x {
199
198
  constructor({
200
199
  tupleOpenParen: e,
201
200
  elementList: n = [],
@@ -209,7 +208,7 @@ class fe extends D {
209
208
  ]), this.tupleOpenParen = e, this.elementList = n, this.commaList = s, this.tupleCloseParen = i;
210
209
  }
211
210
  }
212
- class tt extends fe {
211
+ class et extends fe {
213
212
  constructor({
214
213
  groupOpenParen: e,
215
214
  expression: n,
@@ -226,7 +225,7 @@ class tt extends fe {
226
225
  ), this.kind = "<group-expression>";
227
226
  }
228
227
  }
229
- class Y extends D {
228
+ class Y extends x {
230
229
  constructor({
231
230
  callee: e,
232
231
  argumentList: n
@@ -234,28 +233,28 @@ class Y extends D {
234
233
  super(s, "<call-expression>", [e, n]), this.callee = e, this.argumentList = n;
235
234
  }
236
235
  }
237
- class ve extends D {
236
+ class we extends x {
238
237
  constructor({ literal: e }, n) {
239
238
  super(n, "<literal>", [e]), this.literal = e;
240
239
  }
241
240
  }
242
- class ae extends D {
241
+ class ae extends x {
243
242
  constructor({ variable: e }, n) {
244
243
  super(n, "<variable>", [e]), this.variable = e;
245
244
  }
246
245
  }
247
- class G extends D {
246
+ class j extends x {
248
247
  constructor({ expression: e }, n) {
249
248
  super(n, "<primary-expression>", [e]), this.expression = e;
250
249
  }
251
250
  }
252
- class Ue extends D {
251
+ class Ue extends x {
253
252
  constructor({ pre: e }, n) {
254
253
  const s = J.create(h.SPACE, e.endPos, e.endPos, " ", !1);
255
254
  super(n, "<dummy>", [s]);
256
255
  }
257
256
  }
258
- class ue extends D {
257
+ class ue extends x {
259
258
  constructor({ expression: e, indexer: n }, s) {
260
259
  super(s, "<array>", [e, n]), this.array = e, this.indexer = n;
261
260
  }
@@ -270,7 +269,7 @@ function Dt(t, e) {
270
269
  (i) => i !== null
271
270
  );
272
271
  }
273
- function ys(t, e = !1) {
272
+ function Ss(t, e = !1) {
274
273
  return JSON.stringify(
275
274
  t,
276
275
  function(n, s) {
@@ -296,7 +295,7 @@ function ys(t, e = !1) {
296
295
  e ? 2 : 0
297
296
  );
298
297
  }
299
- class O {
298
+ class R {
300
299
  constructor(e) {
301
300
  this.value = e;
302
301
  }
@@ -311,14 +310,14 @@ class O {
311
310
  return e(this.value);
312
311
  }
313
312
  map(e) {
314
- return new O(e(this.value));
313
+ return new R(e(this.value));
315
314
  }
316
315
  // eslint-disable-next-line class-methods-use-this
317
316
  isOk() {
318
317
  return !0;
319
318
  }
320
319
  }
321
- class x {
320
+ class S {
322
321
  // eslint-disable-next-line class-methods-use-this
323
322
  unwrap() {
324
323
  throw new Error("Trying to unwrap a None value");
@@ -329,11 +328,11 @@ class x {
329
328
  }
330
329
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
331
330
  and_then(e) {
332
- return new x();
331
+ return new S();
333
332
  }
334
333
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
335
334
  map(e) {
336
- return new x();
335
+ return new S();
337
336
  }
338
337
  // eslint-disable-next-line class-methods-use-this
339
338
  isOk() {
@@ -341,7 +340,7 @@ class x {
341
340
  }
342
341
  }
343
342
  var m = /* @__PURE__ */ ((t) => (t.Schema = "Schema", t.Table = "Table", t.Column = "Column", t.TableGroup = "TableGroup", t.TableGroupField = "TableGroup field", t.Enum = "Enum", t.EnumField = "Enum field", t.Note = "Note", t.TablePartial = "TablePartial", t.TablePartialInjection = "TablePartialInjection", t))(m || {});
344
- function nt(t) {
343
+ function tt(t) {
345
344
  return `Schema:${t}`;
346
345
  }
347
346
  function Be(t) {
@@ -350,25 +349,25 @@ function Be(t) {
350
349
  function We(t) {
351
350
  return `Column:${t}`;
352
351
  }
353
- function st(t) {
352
+ function nt(t) {
354
353
  return `Enum:${t}`;
355
354
  }
356
- function it(t) {
355
+ function st(t) {
357
356
  return `Enum field:${t}`;
358
357
  }
359
- function at(t) {
358
+ function it(t) {
360
359
  return `TableGroup:${t}`;
361
360
  }
362
- function rt(t) {
361
+ function at(t) {
363
362
  return `TableGroup field:${t}`;
364
363
  }
365
364
  function ln(t) {
366
365
  return `Note:${t}`;
367
366
  }
368
- function Ot(t) {
367
+ function rt(t) {
369
368
  return `TablePartial:${t}`;
370
369
  }
371
- function cn(t) {
370
+ function Ot(t) {
372
371
  return `TablePartialInjection:${t}`;
373
372
  }
374
373
  function Me(t, e) {
@@ -376,45 +375,45 @@ function Me(t, e) {
376
375
  case "Column":
377
376
  return We(t);
378
377
  case "Enum":
379
- return st(t);
378
+ return nt(t);
380
379
  case "Enum field":
381
- return it(t);
380
+ return st(t);
382
381
  case "Schema":
383
- return nt(t);
382
+ return tt(t);
384
383
  case "Table":
385
384
  return Be(t);
386
385
  case "TableGroup":
387
- return at(t);
386
+ return it(t);
388
387
  case "TableGroup field":
389
- return rt(t);
388
+ return at(t);
390
389
  case "TablePartial":
391
- return Ot(t);
390
+ return rt(t);
392
391
  default:
393
392
  throw new Error("Unreachable");
394
393
  }
395
394
  }
396
395
  function oe(t) {
397
396
  const [e, n] = t.split(":");
398
- return Object.values(m).includes(e) ? new O({
397
+ return Object.values(m).includes(e) ? new R({
399
398
  name: n,
400
399
  kind: e
401
- }) : new x();
400
+ }) : new S();
402
401
  }
403
- function un(t) {
402
+ function cn(t) {
404
403
  const e = oe(t).unwrap_or(void 0);
405
404
  if (!e)
406
405
  return !1;
407
406
  const { kind: n, name: s } = e;
408
407
  return n === "Schema" && s === "public";
409
408
  }
410
- function hn(t) {
409
+ function un(t) {
411
410
  const e = oe(t).unwrap_or(void 0);
412
411
  if (!e)
413
412
  return !1;
414
413
  const { kind: n } = e;
415
414
  return n === "TablePartialInjection";
416
415
  }
417
- function fn(t) {
416
+ function hn(t) {
418
417
  const e = oe(t).unwrap_or(void 0);
419
418
  if (!e)
420
419
  return null;
@@ -425,41 +424,7 @@ function fn(t) {
425
424
  /* TablePartial */
426
425
  ) : null;
427
426
  }
428
- function pn(t) {
429
- return [
430
- nt,
431
- Be,
432
- st,
433
- at,
434
- We,
435
- it,
436
- rt
437
- ].map((e) => e(t));
438
- }
439
- function Ye(t) {
440
- return !!t.match(/(\p{L}|_|\p{M})/gu);
441
- }
442
- function Ve(t) {
443
- const [e] = t;
444
- return e >= "0" && e <= "9";
445
- }
446
- function dn(t) {
447
- const [e] = t;
448
- return Ve(e) || Ye(e) && e.toLowerCase() >= "a" && e.toLowerCase() <= "f";
449
- }
450
- function Ae(t) {
451
- return Ye(t) || Ve(t);
452
- }
453
- function Nt(t, e) {
454
- const n = [], s = Math.min(t.length, e.length);
455
- for (let i = 0; i < s; i += 1)
456
- n.push(t[i], e[i]);
457
- return n.push(...t.slice(s), ...e.slice(s)), n;
458
- }
459
- function ke(t, e) {
460
- return t >= e.start && t < e.end;
461
- }
462
- class En {
427
+ class fn {
463
428
  constructor() {
464
429
  this.id = 0;
465
430
  }
@@ -475,12 +440,12 @@ class Rt {
475
440
  this.references = [], this.id = n, this.symbolTable = e;
476
441
  }
477
442
  }
478
- class Nn {
443
+ class pn {
479
444
  constructor({ symbolTable: e, declaration: n }, s) {
480
445
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
481
446
  }
482
447
  }
483
- class mn {
448
+ class dn {
484
449
  constructor({ declaration: e }, n) {
485
450
  this.references = [], this.id = n, this.declaration = e;
486
451
  }
@@ -490,36 +455,75 @@ class Ut {
490
455
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
491
456
  }
492
457
  }
493
- class Mt {
458
+ class ot {
494
459
  constructor({ declaration: e }, n) {
495
460
  this.references = [], this.id = n, this.declaration = e;
496
461
  }
497
462
  }
498
- class Tn {
463
+ class En {
499
464
  constructor({ symbolTable: e, declaration: n }, s) {
500
465
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
501
466
  }
502
467
  }
503
- class bn {
468
+ class Nn {
504
469
  constructor({ declaration: e }, n) {
505
470
  this.references = [], this.id = n, this.declaration = e;
506
471
  }
507
472
  }
508
- class In {
473
+ class mn {
509
474
  constructor({ symbolTable: e, declaration: n }, s) {
510
475
  this.references = [], this.id = s, this.symbolTable = e, this.declaration = n;
511
476
  }
512
477
  }
513
- class Ln {
478
+ class Tn {
514
479
  constructor({ declaration: e }, n) {
515
480
  this.references = [], this.id = n, this.declaration = e;
516
481
  }
517
482
  }
518
- class _n {
519
- constructor({ injectorId: e }, n) {
520
- this.references = [], this.id = n, this.injectorId = e;
483
+ class bn {
484
+ constructor({ injectorFieldSymbol: e, injectorDeclaration: n }, s) {
485
+ this.references = [], this.id = s, this.injectorDeclaration = n, this.injectorFieldSymbol = e;
521
486
  }
522
487
  }
488
+ function In(t) {
489
+ return [
490
+ tt,
491
+ Be,
492
+ We,
493
+ nt,
494
+ st,
495
+ it,
496
+ at,
497
+ rt,
498
+ Ot
499
+ ].map((e) => e(t));
500
+ }
501
+ function Ln(t) {
502
+ return t instanceof ot ? bn : null;
503
+ }
504
+ function Ye(t) {
505
+ return !!t.match(/(\p{L}|_|\p{M})/gu);
506
+ }
507
+ function Ve(t) {
508
+ const [e] = t;
509
+ return e >= "0" && e <= "9";
510
+ }
511
+ function An(t) {
512
+ const [e] = t;
513
+ return Ve(e) || Ye(e) && e.toLowerCase() >= "a" && e.toLowerCase() <= "f";
514
+ }
515
+ function ge(t) {
516
+ return Ye(t) || Ve(t);
517
+ }
518
+ function mt(t, e) {
519
+ const n = [], s = Math.min(t.length, e.length);
520
+ for (let i = 0; i < s; i += 1)
521
+ n.push(t[i], e[i]);
522
+ return n.push(...t.slice(s), ...e.slice(s)), n;
523
+ }
524
+ function Se(t, e) {
525
+ return t >= e.start && t < e.end;
526
+ }
523
527
  var o = /* @__PURE__ */ ((t) => (t[t.UNKNOWN_SYMBOL = 1e3] = "UNKNOWN_SYMBOL", t[t.UNEXPECTED_SYMBOL = 1001] = "UNEXPECTED_SYMBOL", t[t.UNEXPECTED_EOF = 1002] = "UNEXPECTED_EOF", t[t.UNEXPECTED_NEWLINE = 1003] = "UNEXPECTED_NEWLINE", t[t.UNKNOWN_TOKEN = 1004] = "UNKNOWN_TOKEN", t[t.UNEXPECTED_TOKEN = 1005] = "UNEXPECTED_TOKEN", t[t.UNEXPECTED_ELEMENT_DECLARATION = 1006] = "UNEXPECTED_ELEMENT_DECLARATION", t[t.MISSING_SPACES = 1007] = "MISSING_SPACES", t[t.UNKNOWN_PREFIX_OP = 1008] = "UNKNOWN_PREFIX_OP", t[t.INVALID_OPERAND = 1009] = "INVALID_OPERAND", t[t.EMPTY_ATTRIBUTE_NAME = 1010] = "EMPTY_ATTRIBUTE_NAME", t[t.INVALID_ESCAPE_SEQUENCE = 1011] = "INVALID_ESCAPE_SEQUENCE", t[t.INVALID_NAME = 3e3] = "INVALID_NAME", t[t.UNEXPECTED_NAME = 3001] = "UNEXPECTED_NAME", t[t.NAME_NOT_FOUND = 3002] = "NAME_NOT_FOUND", t[t.DUPLICATE_NAME = 3003] = "DUPLICATE_NAME", t[t.INVALID_ALIAS = 3004] = "INVALID_ALIAS", t[t.UNEXPECTED_ALIAS = 3005] = "UNEXPECTED_ALIAS", t[t.UNEXPECTED_SETTINGS = 3006] = "UNEXPECTED_SETTINGS", t[t.INVALID_SETTINGS = 3007] = "INVALID_SETTINGS", t[t.UNEXPECTED_SIMPLE_BODY = 3008] = "UNEXPECTED_SIMPLE_BODY", t[t.UNEXPECTED_COMPLEX_BODY = 3009] = "UNEXPECTED_COMPLEX_BODY", t[t.INVALID_TABLE_CONTEXT = 3010] = "INVALID_TABLE_CONTEXT", t[t.INVALID_TABLE_SETTING = 3011] = "INVALID_TABLE_SETTING", t[t.DUPLICATE_TABLE_SETTING = 3012] = "DUPLICATE_TABLE_SETTING", t[t.INVALID_TABLE_FIELD = 3013] = "INVALID_TABLE_FIELD", t[t.INVALID_TABLEGROUP_CONTEXT = 3014] = "INVALID_TABLEGROUP_CONTEXT", t[t.INVALID_TABLEGROUP_ELEMENT_NAME = 3015] = "INVALID_TABLEGROUP_ELEMENT_NAME", t[t.DUPLICATE_TABLEGROUP_ELEMENT_NAME = 3016] = "DUPLICATE_TABLEGROUP_ELEMENT_NAME", t[t.DUPLICATE_TABLEGROUP_FIELD_NAME = 3017] = "DUPLICATE_TABLEGROUP_FIELD_NAME", t[t.INVALID_TABLEGROUP_FIELD = 3018] = "INVALID_TABLEGROUP_FIELD", t[t.INVALID_TABLE_PARTIAL_CONTEXT = 3019] = "INVALID_TABLE_PARTIAL_CONTEXT", t[t.INVALID_TABLE_PARTIAL_ELEMENT_NAME = 3020] = "INVALID_TABLE_PARTIAL_ELEMENT_NAME", t[t.INVALID_TABLE_PARTIAL_SETTING = 3021] = "INVALID_TABLE_PARTIAL_SETTING", t[t.DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME = 3022] = "DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME", t[t.DUPLICATE_TABLE_PARTIAL_SETTING = 3023] = "DUPLICATE_TABLE_PARTIAL_SETTING", t[t.INVALID_TABLE_PARTIAL_INJECTION = 3024] = "INVALID_TABLE_PARTIAL_INJECTION", t[t.INVALID_TABLE_PARTIAL_INJECTION_OP = 3025] = "INVALID_TABLE_PARTIAL_INJECTION_OP", t[t.INVALID_TABLE_PARTIAL_INJECTION_NAME = 3026] = "INVALID_TABLE_PARTIAL_INJECTION_NAME", t[t.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME = 3027] = "DUPLICATE_TABLE_PARTIAL_INJECTION_NAME", t[t.EMPTY_TABLE = 3028] = "EMPTY_TABLE", t[t.INVALID_COLUMN = 3029] = "INVALID_COLUMN", t[t.INVALID_COLUMN_NAME = 3030] = "INVALID_COLUMN_NAME", t[t.UNKNOWN_COLUMN_SETTING = 3031] = "UNKNOWN_COLUMN_SETTING", t[t.INVALID_COLUMN_TYPE = 3032] = "INVALID_COLUMN_TYPE", t[t.DUPLICATE_COLUMN_NAME = 3033] = "DUPLICATE_COLUMN_NAME", t[t.DUPLICATE_COLUMN_SETTING = 3034] = "DUPLICATE_COLUMN_SETTING", t[t.INVALID_COLUMN_SETTING_VALUE = 3035] = "INVALID_COLUMN_SETTING_VALUE", t[t.INVALID_ENUM_CONTEXT = 3036] = "INVALID_ENUM_CONTEXT", t[t.INVALID_ENUM_ELEMENT_NAME = 3037] = "INVALID_ENUM_ELEMENT_NAME", t[t.INVALID_ENUM_ELEMENT = 3038] = "INVALID_ENUM_ELEMENT", t[t.DUPLICATE_ENUM_ELEMENT_NAME = 3039] = "DUPLICATE_ENUM_ELEMENT_NAME", t[t.UNKNOWN_ENUM_ELEMENT_SETTING = 3040] = "UNKNOWN_ENUM_ELEMENT_SETTING", t[t.DUPLICATE_ENUM_ELEMENT_SETTING = 3041] = "DUPLICATE_ENUM_ELEMENT_SETTING", t[t.INVALID_ENUM_ELEMENT_SETTING = 3042] = "INVALID_ENUM_ELEMENT_SETTING", t[t.EMPTY_ENUM = 3043] = "EMPTY_ENUM", t[t.INVALID_REF_CONTEXT = 3044] = "INVALID_REF_CONTEXT", t[t.UNKNOWN_REF_SETTING = 3045] = "UNKNOWN_REF_SETTING", t[t.DUPLICATE_REF_SETTING = 3046] = "DUPLICATE_REF_SETTING", t[t.INVALID_REF_SETTING_VALUE = 3047] = "INVALID_REF_SETTING_VALUE", t[t.INVALID_REF_RELATIONSHIP = 3048] = "INVALID_REF_RELATIONSHIP", t[t.INVALID_REF_FIELD = 3049] = "INVALID_REF_FIELD", t[t.EMPTY_REF = 3050] = "EMPTY_REF", t[t.REF_REDEFINED = 3051] = "REF_REDEFINED", t[t.INVALID_NOTE_CONTEXT = 3052] = "INVALID_NOTE_CONTEXT", t[t.INVALID_NOTE = 3053] = "INVALID_NOTE", t[t.NOTE_REDEFINED = 3054] = "NOTE_REDEFINED", t[t.NOTE_CONTENT_REDEFINED = 3055] = "NOTE_CONTENT_REDEFINED", t[t.EMPTY_NOTE = 3056] = "EMPTY_NOTE", t[t.INVALID_INDEXES_CONTEXT = 3057] = "INVALID_INDEXES_CONTEXT", t[t.INVALID_INDEXES_FIELD = 3058] = "INVALID_INDEXES_FIELD", t[t.INVALID_INDEX = 3059] = "INVALID_INDEX", t[t.UNKNOWN_INDEX_SETTING = 3060] = "UNKNOWN_INDEX_SETTING", t[t.DUPLICATE_INDEX_SETTING = 3061] = "DUPLICATE_INDEX_SETTING", t[t.UNEXPECTED_INDEX_SETTING_VALUE = 3062] = "UNEXPECTED_INDEX_SETTING_VALUE", t[t.INVALID_INDEX_SETTING_VALUE = 3063] = "INVALID_INDEX_SETTING_VALUE", t[t.INVALID_PROJECT_CONTEXT = 3064] = "INVALID_PROJECT_CONTEXT", t[t.PROJECT_REDEFINED = 3065] = "PROJECT_REDEFINED", t[t.INVALID_PROJECT_FIELD = 3066] = "INVALID_PROJECT_FIELD", t[t.INVALID_CUSTOM_CONTEXT = 3067] = "INVALID_CUSTOM_CONTEXT", t[t.INVALID_CUSTOM_ELEMENT_VALUE = 3068] = "INVALID_CUSTOM_ELEMENT_VALUE", t[t.INVALID_ELEMENT_IN_SIMPLE_BODY = 3069] = "INVALID_ELEMENT_IN_SIMPLE_BODY", t[t.BINDING_ERROR = 4e3] = "BINDING_ERROR", t[t.UNSUPPORTED = 5e3] = "UNSUPPORTED", t[t.CIRCULAR_REF = 5001] = "CIRCULAR_REF", t[t.SAME_ENDPOINT = 5002] = "SAME_ENDPOINT", t[t.UNEQUAL_FIELDS_BINARY_REF = 5003] = "UNEQUAL_FIELDS_BINARY_REF", t[t.CONFLICTING_SETTING = 5004] = "CONFLICTING_SETTING", t[t.TABLE_REAPPEAR_IN_TABLEGROUP = 5005] = "TABLE_REAPPEAR_IN_TABLEGROUP", t))(o || {});
524
528
  class l extends Error {
525
529
  constructor(e, n, s) {
@@ -544,14 +548,14 @@ class q {
544
548
  return new q(e(this.value), this.errors);
545
549
  }
546
550
  }
547
- function An(t, e, n) {
551
+ function _n(t, e, n) {
548
552
  if (!t || !he(t) || e.length === 0)
549
- return new x();
553
+ return new S();
550
554
  const s = [...e], i = Je(t).unwrap(), a = s.pop();
551
555
  if (!(a instanceof re))
552
- return new x();
553
- const r = _.last(s) instanceof R ? s.pop() : void 0;
554
- return s.length === 3 && Je(s[1]).unwrap().value === "as" ? new O(
556
+ return new S();
557
+ const r = _.last(s) instanceof U ? s.pop() : void 0;
558
+ return s.length === 3 && Je(s[1]).unwrap().value === "as" ? new R(
555
559
  n.create(y, {
556
560
  type: i,
557
561
  name: s[0],
@@ -560,22 +564,22 @@ function An(t, e, n) {
560
564
  attributeList: r,
561
565
  body: a
562
566
  })
563
- ) : s.length === 1 ? new O(
567
+ ) : s.length === 1 ? new R(
564
568
  n.create(y, {
565
569
  type: i,
566
570
  name: s[0],
567
571
  attributeList: r,
568
572
  body: a
569
573
  })
570
- ) : s.length === 0 ? new O(
574
+ ) : s.length === 0 ? new R(
571
575
  n.create(y, {
572
576
  type: i,
573
577
  attributeList: r,
574
578
  body: a
575
579
  })
576
- ) : new x();
580
+ ) : new S();
577
581
  }
578
- function mt(t) {
582
+ function Tt(t) {
579
583
  return t.kind === h.IDENTIFIER && t.value === "as";
580
584
  }
581
585
  function T(t) {
@@ -587,19 +591,19 @@ function gn(t) {
587
591
  function vn(t) {
588
592
  if (t instanceof y)
589
593
  T(t.type), T(t.name), T(t.as), T(t.alias), T(t.bodyColon), T(t.attributeList), T(t.body);
590
- else if (t instanceof ne)
594
+ else if (t instanceof te)
591
595
  t.identifiers.forEach(T);
592
- else if (t instanceof se)
596
+ else if (t instanceof ne)
593
597
  T(t.name), T(t.colon), T(t.value);
594
- else if (t instanceof K)
598
+ else if (t instanceof ie)
595
599
  T(t.op), T(t.expression);
596
600
  else if (t instanceof le)
597
601
  T(t.leftExpression), T(t.op), T(t.rightExpression);
598
- else if (t instanceof je)
602
+ else if (t instanceof $e)
599
603
  T(t.op), T(t.expression);
600
604
  else if (t instanceof re)
601
605
  T(t.blockOpenBrace), t.body.forEach(T), T(t.blockCloseBrace);
602
- else if (t instanceof R)
606
+ else if (t instanceof U)
603
607
  T(t.listOpenBracket), t.commaList.forEach(T), t.elementList.forEach(T), T(t.listCloseBracket);
604
608
  else if (t instanceof fe)
605
609
  T(t.tupleOpenParen), t.commaList.forEach(T), t.elementList.forEach(T), T(t.tupleCloseParen);
@@ -607,28 +611,28 @@ function vn(t) {
607
611
  T(t.callee), T(t.argumentList);
608
612
  else if (t instanceof v)
609
613
  T(t.callee), t.args.forEach(T);
610
- else if (t instanceof G)
614
+ else if (t instanceof j)
611
615
  T(t.expression);
612
616
  else if (t instanceof ce)
613
617
  T(t.value);
614
618
  else if (t instanceof ae)
615
619
  T(t.variable);
616
- else if (t instanceof ve)
620
+ else if (t instanceof we)
617
621
  T(t.literal);
618
622
  else
619
- throw t instanceof tt ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
623
+ throw t instanceof et ? new Error("This case is handled by the TupleExpressionNode case") : new Error("Unreachable case in markInvalidNode");
620
624
  }
621
- function Ft(t) {
625
+ function Mt(t) {
622
626
  return !!(t != null && t.isInvalid);
623
627
  }
624
- function X(...t) {
628
+ function C(...t) {
625
629
  return t.filter((e) => e !== void 0);
626
630
  }
627
631
  function wn(t) {
628
632
  if (t instanceof Z)
629
- return X(...t.body, t.eof);
633
+ return C(...t.body, t.eof);
630
634
  if (t instanceof y)
631
- return X(
635
+ return C(
632
636
  t.type,
633
637
  t.name,
634
638
  t.as,
@@ -637,74 +641,74 @@ function wn(t) {
637
641
  t.bodyColon,
638
642
  t.body
639
643
  );
640
- if (t instanceof se)
641
- return X(t.name, t.colon, t.value);
642
644
  if (t instanceof ne)
645
+ return C(t.name, t.colon, t.value);
646
+ if (t instanceof te)
643
647
  return t.identifiers;
644
- if (t instanceof ve)
648
+ if (t instanceof we)
645
649
  return t.literal ? [t.literal] : [];
646
650
  if (t instanceof ae)
647
- return X(t.variable);
648
- if (t instanceof K)
649
- return X(t.op, t.expression);
651
+ return C(t.variable);
652
+ if (t instanceof ie)
653
+ return C(t.op, t.expression);
650
654
  if (t instanceof le)
651
- return X(t.leftExpression, t.op, t.rightExpression);
652
- if (t instanceof je)
653
- return X(t.expression, t.op);
655
+ return C(t.leftExpression, t.op, t.rightExpression);
656
+ if (t instanceof $e)
657
+ return C(t.expression, t.op);
654
658
  if (t instanceof ce)
655
- return X(t.value);
659
+ return C(t.value);
656
660
  if (t instanceof v)
657
- return X(t.callee, ...t.args);
661
+ return C(t.callee, ...t.args);
658
662
  if (t instanceof re)
659
- return X(t.blockOpenBrace, ...t.body, t.blockCloseBrace);
660
- if (t instanceof R)
661
- return X(
663
+ return C(t.blockOpenBrace, ...t.body, t.blockCloseBrace);
664
+ if (t instanceof U)
665
+ return C(
662
666
  t.listOpenBracket,
663
- ...Nt(t.elementList, t.commaList),
667
+ ...mt(t.elementList, t.commaList),
664
668
  t.listCloseBracket
665
669
  );
666
670
  if (t instanceof fe)
667
- return X(
671
+ return C(
668
672
  t.tupleOpenParen,
669
- ...Nt(t.elementList, t.commaList),
673
+ ...mt(t.elementList, t.commaList),
670
674
  t.tupleCloseParen
671
675
  );
672
676
  if (t instanceof Y)
673
- return X(t.callee, t.argumentList);
674
- if (t instanceof G)
675
- return X(t.expression);
677
+ return C(t.callee, t.argumentList);
678
+ if (t instanceof j)
679
+ return C(t.expression);
676
680
  if (t instanceof ue)
677
- return X(
681
+ return C(
678
682
  t.array,
679
683
  t.indexer
680
684
  );
681
685
  if (t instanceof Le)
682
- return X(t.partial);
683
- throw t instanceof tt ? new Error("This case is already handled by TupleExpressionNode") : new Error("Unreachable - no other possible cases");
686
+ return C(t.partial);
687
+ throw t instanceof et ? new Error("This case is already handled by TupleExpressionNode") : new Error("Unreachable - no other possible cases");
684
688
  }
685
689
  function Je(t) {
686
- return j(t) ? new O(t.expression.variable) : new x();
690
+ return $(t) ? new R(t.expression.variable) : new S();
687
691
  }
688
- function C(t) {
692
+ function G(t) {
689
693
  var e;
690
- return t instanceof G && (t.expression instanceof ae && t.expression.variable instanceof J && t.expression.variable.kind === h.QUOTED_STRING || t.expression instanceof ve && ((e = t.expression.literal) == null ? void 0 : e.kind) === h.STRING_LITERAL);
694
+ return t instanceof j && (t.expression instanceof ae && t.expression.variable instanceof J && t.expression.variable.kind === h.QUOTED_STRING || t.expression instanceof we && ((e = t.expression.literal) == null ? void 0 : e.kind) === h.STRING_LITERAL);
691
695
  }
692
- function j(t) {
693
- return t instanceof G && t.expression instanceof ae && t.expression.variable instanceof J;
696
+ function $(t) {
697
+ return t instanceof j && t.expression instanceof ae && t.expression.variable instanceof J;
694
698
  }
695
699
  function he(t) {
696
700
  var e;
697
- return t instanceof G && t.expression instanceof ae && ((e = t.expression.variable) == null ? void 0 : e.kind) === h.IDENTIFIER;
701
+ return t instanceof j && t.expression instanceof ae && ((e = t.expression.variable) == null ? void 0 : e.kind) === h.IDENTIFIER;
698
702
  }
699
703
  function qe(t) {
700
704
  var e;
701
- return t instanceof le && t.leftExpression instanceof D && t.rightExpression instanceof D && ((e = t.op) == null ? void 0 : e.value) === ".";
705
+ return t instanceof le && t.leftExpression instanceof x && t.rightExpression instanceof x && ((e = t.op) == null ? void 0 : e.value) === ".";
702
706
  }
703
- function ge(t) {
707
+ function ve(t) {
704
708
  if (t === void 0)
705
- return new x();
709
+ return new S();
706
710
  const e = t.identifiers.map((n) => n.value).join(" ");
707
- return e === "" ? new x() : new O(e);
711
+ return e === "" ? new S() : new R(e);
708
712
  }
709
713
  class yn {
710
714
  // list of errors during lexing
@@ -819,7 +823,7 @@ class yn {
819
823
  this.match("/") ? this.singleLineComment() : this.match("*") ? this.multilineComment() : this.operator();
820
824
  break;
821
825
  default:
822
- if (pt(e)) {
826
+ if (dt(e)) {
823
827
  this.operator();
824
828
  break;
825
829
  }
@@ -853,7 +857,7 @@ class yn {
853
857
  gatherInvalid() {
854
858
  let e;
855
859
  const n = [], s = [];
856
- for (e = 0; e < this.tokens.length && Ft(this.tokens[e]); e += 1)
860
+ for (e = 0; e < this.tokens.length && Mt(this.tokens[e]); e += 1)
857
861
  s.push(this.tokens[e]);
858
862
  let i = this.tokens[e];
859
863
  for (i.leadingInvalid = [...s, ...i.leadingInvalid]; e < this.tokens.length; e += 1) {
@@ -942,12 +946,12 @@ class yn {
942
946
  });
943
947
  }
944
948
  identifier() {
945
- for (; !this.isAtEnd() && Ae(this.peek()); )
949
+ for (; !this.isAtEnd() && ge(this.peek()); )
946
950
  this.advance();
947
951
  this.addToken(h.IDENTIFIER);
948
952
  }
949
953
  operator() {
950
- for (; pt(this.peek()); )
954
+ for (; dt(this.peek()); )
951
955
  this.advance();
952
956
  this.addToken(h.OP);
953
957
  }
@@ -962,26 +966,26 @@ class yn {
962
966
  break;
963
967
  if (!n && this.current.offset === this.text.length - 1)
964
968
  return this.advance(), this.addToken(h.NUMERIC_LITERAL);
965
- if (!n && !Ae(this.peek()))
969
+ if (!n && !ge(this.peek()))
966
970
  return this.addToken(h.NUMERIC_LITERAL);
967
971
  if (!n && !Ve(this.peek()))
968
972
  break;
969
973
  this.advance();
970
974
  }
971
975
  if (e > 0) {
972
- for (; !this.isAtEnd() && (this.check(".") || Ae(this.peek())); )
976
+ for (; !this.isAtEnd() && (this.check(".") || ge(this.peek())); )
973
977
  this.advance();
974
978
  const n = this.createToken(h.NUMERIC_LITERAL, !0);
975
979
  this.tokens.push(n), this.errors.push(new l(o.UNKNOWN_TOKEN, "Invalid number", n));
976
980
  } else {
977
- for (; !this.isAtEnd() && Ae(this.peek()); )
981
+ for (; !this.isAtEnd() && ge(this.peek()); )
978
982
  this.advance();
979
983
  const n = this.createToken(h.IDENTIFIER, !1);
980
984
  this.tokens.push(n);
981
985
  }
982
986
  }
983
987
  colorLiteral() {
984
- for (; !this.isAtEnd() && Ae(this.peek()); )
988
+ for (; !this.isAtEnd() && ge(this.peek()); )
985
989
  this.advance();
986
990
  this.addToken(h.COLOR_LITERAL);
987
991
  }
@@ -1022,7 +1026,7 @@ class yn {
1022
1026
  case "u": {
1023
1027
  let n = "";
1024
1028
  for (let s = 0; s <= 3; s += 1) {
1025
- if (this.isAtEnd() || !Ae(this.peek()))
1029
+ if (this.isAtEnd() || !ge(this.peek()))
1026
1030
  return this.errors.push(new l(o.INVALID_ESCAPE_SEQUENCE, `Invalid unicode escape sequence '\\u${n}', only unicode escape sequences of the form '\\uHHHH' where H is a hexadecimal number are allowed`, J.create(h.STRING_LITERAL, e, this.current, `\\u${n}`, !0))), `\\u${n}`;
1027
1031
  n += this.advance();
1028
1032
  }
@@ -1121,7 +1125,7 @@ class Pn {
1121
1125
  }, this.synchronizeElementDeclarationName = () => {
1122
1126
  for (; !this.isAtEnd(); ) {
1123
1127
  const s = this.peek();
1124
- if (mt(s) || this.check(h.COLON, h.LBRACE, h.LBRACKET))
1128
+ if (Tt(s) || this.check(h.COLON, h.LBRACE, h.LBRACKET))
1125
1129
  break;
1126
1130
  T(s), this.advance();
1127
1131
  }
@@ -1171,12 +1175,12 @@ class Pn {
1171
1175
  if (!this.check(h.RBRACE))
1172
1176
  for (T(this.advance()); !this.isAtEnd(); ) {
1173
1177
  const s = this.peek();
1174
- if (this.check(h.RBRACE) || Et(this.previous(), s))
1178
+ if (this.check(h.RBRACE) || Nt(this.previous(), s))
1175
1179
  break;
1176
1180
  T(s), this.advance();
1177
1181
  }
1178
1182
  }, this.tupleExpression = this.contextStack.withContextDo(Fe.GroupExpression, () => {
1179
- const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(tt, {
1183
+ const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(et, {
1180
1184
  groupOpenParen: s.tupleOpenParen,
1181
1185
  groupCloseParen: s.tupleCloseParen,
1182
1186
  expression: s.elementList[0]
@@ -1206,7 +1210,7 @@ class Pn {
1206
1210
  } catch (r) {
1207
1211
  if (!(r instanceof N))
1208
1212
  throw r;
1209
- if (r.partialNode instanceof D && s.elementList.push(r.partialNode), !this.canHandle(r))
1213
+ if (r.partialNode instanceof x && s.elementList.push(r.partialNode), !this.canHandle(r))
1210
1214
  throw new N(r.token, a(), r.handlerContext);
1211
1215
  this.synchronizeTuple();
1212
1216
  }
@@ -1228,7 +1232,7 @@ class Pn {
1228
1232
  T(s), this.advance();
1229
1233
  }
1230
1234
  }, this.listExpression = this.contextStack.withContextDo(Fe.ListExpression, () => {
1231
- const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(R, s);
1235
+ const s = { elementList: [], commaList: [] }, i = () => this.nodeFactory.create(U, s);
1232
1236
  try {
1233
1237
  this.consume("Expect an opening bracket '['", h.LBRACKET), s.listOpenBracket = this.previous();
1234
1238
  } catch (a) {
@@ -1254,7 +1258,7 @@ class Pn {
1254
1258
  } catch (a) {
1255
1259
  if (!(a instanceof N))
1256
1260
  throw a;
1257
- if (a.partialNode instanceof D && s.elementList.push(a.partialNode), !this.canHandle(a))
1261
+ if (a.partialNode instanceof x && s.elementList.push(a.partialNode), !this.canHandle(a))
1258
1262
  throw new N(a.token, i(), a.handlerContext);
1259
1263
  this.synchronizeList();
1260
1264
  }
@@ -1380,7 +1384,7 @@ class Pn {
1380
1384
  throw new N(s.token, n(), s.handlerContext);
1381
1385
  this.synchronizeElementDeclarationName();
1382
1386
  }
1383
- if (mt(this.peek()))
1387
+ if (Tt(this.peek()))
1384
1388
  if (e.as = this.advance(), this.check(h.COLON, h.LBRACE, h.LBRACKET))
1385
1389
  this.logError(this.peek(), o.UNEXPECTED_TOKEN, "Expect an alias");
1386
1390
  else
@@ -1444,7 +1448,7 @@ class Pn {
1444
1448
  }
1445
1449
  /* Parsing any ExpressionNode, including non-NormalExpression */
1446
1450
  expression() {
1447
- const e = { args: [] }, n = () => An(e.callee, e.args, this.nodeFactory).unwrap_or(
1451
+ const e = { args: [] }, n = () => _n(e.callee, e.args, this.nodeFactory).unwrap_or(
1448
1452
  this.nodeFactory.create(v, e)
1449
1453
  );
1450
1454
  try {
@@ -1480,12 +1484,12 @@ class Pn {
1480
1484
  for (; !this.isAtEnd(); ) {
1481
1485
  const s = this.peek();
1482
1486
  if (s.kind === h.LPAREN) {
1483
- const { left: i } = Tt(s);
1487
+ const { left: i } = bt(s);
1484
1488
  if (i < e || // When '(' is encountered,
1485
1489
  // consider it part of another expression if
1486
1490
  // it's at the start of a new line
1487
1491
  // and we're currently not having unmatched '(' or '['
1488
- Et(this.previous(), s) && !this.contextStack.isWithinGroupExpressionContext() && !this.contextStack.isWithinListExpressionContext())
1492
+ Nt(this.previous(), s) && !this.contextStack.isWithinGroupExpressionContext() && !this.contextStack.isWithinListExpressionContext())
1489
1493
  break;
1490
1494
  try {
1491
1495
  n = this.nodeFactory.create(Y, {
@@ -1512,12 +1516,12 @@ class Pn {
1512
1516
  indexer: i.partialNode
1513
1517
  }), new N(i.token, n, i.handlerContext)) : i;
1514
1518
  }
1515
- } else if (dt(s)) {
1516
- const i = s, a = Tt(i);
1519
+ } else if (Et(s)) {
1520
+ const i = s, a = bt(i);
1517
1521
  if (a.left !== null) {
1518
1522
  if (a.left <= e)
1519
1523
  break;
1520
- this.advance(), n = this.nodeFactory.create(je, {
1524
+ this.advance(), n = this.nodeFactory.create($e, {
1521
1525
  expression: n,
1522
1526
  op: i
1523
1527
  });
@@ -1547,7 +1551,7 @@ class Pn {
1547
1551
  }
1548
1552
  leftExpression_bp() {
1549
1553
  let e;
1550
- if (dt(this.peek())) {
1554
+ if (Et(this.peek())) {
1551
1555
  const n = {};
1552
1556
  n.op = this.peek();
1553
1557
  const s = Rn(n.op);
@@ -1567,11 +1571,11 @@ class Pn {
1567
1571
  } catch (i) {
1568
1572
  throw i instanceof N ? (n.expression = i.partialNode, new N(
1569
1573
  i.token,
1570
- this.nodeFactory.create(K, n),
1574
+ this.nodeFactory.create(ie, n),
1571
1575
  i.handlerContext
1572
1576
  )) : i;
1573
1577
  }
1574
- e = this.nodeFactory.create(K, n);
1578
+ e = this.nodeFactory.create(ie, n);
1575
1579
  } else if (e = this.extractOperand(), e instanceof Ue)
1576
1580
  throw new N(
1577
1581
  this.peek(),
@@ -1630,11 +1634,11 @@ class Pn {
1630
1634
  h.STRING_LITERAL,
1631
1635
  h.NUMERIC_LITERAL
1632
1636
  ))
1633
- return this.nodeFactory.create(G, {
1634
- expression: this.nodeFactory.create(ve, { literal: this.previous() })
1637
+ return this.nodeFactory.create(j, {
1638
+ expression: this.nodeFactory.create(we, { literal: this.previous() })
1635
1639
  });
1636
1640
  if (this.match(h.QUOTED_STRING, h.IDENTIFIER))
1637
- return this.nodeFactory.create(G, {
1641
+ return this.nodeFactory.create(j, {
1638
1642
  expression: this.nodeFactory.create(ae, { variable: this.previous() })
1639
1643
  });
1640
1644
  throw this.logError(this.peek(), o.UNEXPECTED_TOKEN, "Expect a variable or literal"), new N(
@@ -1651,7 +1655,7 @@ class Pn {
1651
1655
  n,
1652
1656
  o.EMPTY_ATTRIBUTE_NAME,
1653
1657
  "Expect a non-empty attribute name"
1654
- ), e.name = this.nodeFactory.create(ne, { identifiers: [] });
1658
+ ), e.name = this.nodeFactory.create(te, { identifiers: [] });
1655
1659
  } else
1656
1660
  try {
1657
1661
  e.name = this.attributeName();
@@ -1661,12 +1665,12 @@ class Pn {
1661
1665
  if (e.name = n.partialNode, !this.canHandle(n))
1662
1666
  throw new N(
1663
1667
  n.token,
1664
- this.nodeFactory.create(se, e),
1668
+ this.nodeFactory.create(ne, e),
1665
1669
  n.handlerContext
1666
1670
  );
1667
1671
  this.synchronizeAttributeName();
1668
1672
  }
1669
- return this.match(h.COLON) && (e.colon = this.previous(), e.value = this.attributeValue()), this.nodeFactory.create(se, e);
1673
+ return this.match(h.COLON) && (e.colon = this.previous(), e.value = this.attributeValue()), this.nodeFactory.create(ne, e);
1670
1674
  }
1671
1675
  attributeValue() {
1672
1676
  let e;
@@ -1689,11 +1693,11 @@ class Pn {
1689
1693
  } catch (n) {
1690
1694
  throw n instanceof N ? new N(
1691
1695
  n.token,
1692
- this.nodeFactory.create(ne, { identifiers: e }),
1696
+ this.nodeFactory.create(te, { identifiers: e }),
1693
1697
  n.handlerContext
1694
1698
  ) : n;
1695
1699
  }
1696
- return this.nodeFactory.create(ne, { identifiers: e });
1700
+ return this.nodeFactory.create(te, { identifiers: e });
1697
1701
  }
1698
1702
  logError(e, n, s) {
1699
1703
  this.errors.push(new l(n, s, e));
@@ -1732,11 +1736,11 @@ function Rn(t) {
1732
1736
  const Un = {
1733
1737
  "(": { left: 14, right: null }
1734
1738
  };
1735
- function Tt(t) {
1739
+ function bt(t) {
1736
1740
  return Un[t.value] || { left: null, right: null };
1737
1741
  }
1738
1742
  var I = /* @__PURE__ */ ((t) => (t.Table = "table", t.Enum = "enum", t.Ref = "ref", t.Note = "note", t.Project = "project", t.Indexes = "indexes", t.TableGroup = "tablegroup", t.TablePartial = "tablepartial", t))(I || {});
1739
- function xe(t) {
1743
+ function Ae(t) {
1740
1744
  var n;
1741
1745
  const e = (n = t == null ? void 0 : t.type) == null ? void 0 : n.value.toLowerCase();
1742
1746
  switch (e) {
@@ -1748,100 +1752,105 @@ function xe(t) {
1748
1752
  case I.Ref:
1749
1753
  case I.TableGroup:
1750
1754
  case I.TablePartial:
1751
- return new O(e);
1755
+ return new R(e);
1752
1756
  default:
1753
- return new x();
1757
+ return new S();
1754
1758
  }
1755
1759
  }
1756
1760
  function _e(t) {
1757
1761
  if (!qe(t))
1758
- return new O([t]);
1762
+ return new R([t]);
1759
1763
  const e = _e(t.leftExpression).unwrap_or(void 0);
1760
- return e ? (e.push(t.rightExpression), new O(e)) : new x();
1764
+ return e ? (e.push(t.rightExpression), new R(e)) : new S();
1761
1765
  }
1762
1766
  function z(t) {
1763
1767
  if (t === void 0)
1764
- return new x();
1768
+ return new S();
1765
1769
  const e = _e(t).unwrap_or(void 0);
1766
1770
  if (!e)
1767
- return new x();
1771
+ return new S();
1768
1772
  const n = [];
1769
1773
  for (const s of e) {
1770
1774
  const i = W(s).unwrap_or(void 0);
1771
1775
  if (!i)
1772
- return new x();
1776
+ return new S();
1773
1777
  n.push(i);
1774
1778
  }
1775
- return new O(n);
1779
+ return new R(n);
1776
1780
  }
1777
- function Se(t) {
1781
+ function Pe(t) {
1778
1782
  if (t === void 0)
1779
- return new x();
1783
+ return new S();
1780
1784
  const e = _e(t).unwrap_or(void 0);
1781
1785
  if (!e || e.length === 0)
1782
- return new x();
1786
+ return new S();
1783
1787
  const n = [];
1784
1788
  let s;
1785
- if (!j(_.last(e))) {
1789
+ if (!$(_.last(e))) {
1786
1790
  const i = e.pop();
1787
- if (Xt(i))
1791
+ if (Ct(i))
1788
1792
  s = i.elementList.map(
1789
- (a) => $(a).unwrap()
1793
+ (a) => X(a).unwrap()
1790
1794
  );
1791
1795
  else
1792
- return new x();
1796
+ return new S();
1793
1797
  }
1794
1798
  for (const i of e) {
1795
1799
  const a = W(i).unwrap_or(void 0);
1796
1800
  if (!a)
1797
- return new x();
1801
+ return new S();
1798
1802
  n.push(a);
1799
1803
  }
1800
- return new O({
1804
+ return new R({
1801
1805
  variables: n,
1802
1806
  tupleElements: s
1803
1807
  });
1804
1808
  }
1805
1809
  function W(t) {
1806
- return j(t) ? new O(t.expression.variable.value) : new x();
1810
+ return $(t) ? new R(t.expression.variable.value) : new S();
1807
1811
  }
1808
1812
  function Ge(t) {
1809
- if (bt(t))
1810
- return t instanceof ce ? new O({ functional: [t], nonFunctional: [] }) : new O({ functional: [], nonFunctional: [t] });
1811
- if (t instanceof fe && t.elementList.every(bt)) {
1813
+ if (It(t))
1814
+ return t instanceof ce ? new R({ functional: [t], nonFunctional: [] }) : new R({ functional: [], nonFunctional: [t] });
1815
+ if (t instanceof fe && t.elementList.every(It)) {
1812
1816
  const e = t.elementList.filter(
1813
1817
  (s) => s instanceof ce
1814
- ), n = t.elementList.filter(j);
1815
- return new O({ functional: e, nonFunctional: n });
1818
+ ), n = t.elementList.filter($);
1819
+ return new R({ functional: e, nonFunctional: n });
1816
1820
  }
1817
- return new x();
1821
+ return new S();
1818
1822
  }
1819
- function $(t) {
1823
+ function X(t) {
1820
1824
  var n;
1821
1825
  const e = (n = t == null ? void 0 : t.expression.variable) == null ? void 0 : n.value;
1822
- return e === void 0 ? new x() : new O(e);
1826
+ return e === void 0 ? new S() : new R(e);
1827
+ }
1828
+ function Mn(t) {
1829
+ var n, s;
1830
+ const e = (s = (n = t == null ? void 0 : t.partial) == null ? void 0 : n.variable) == null ? void 0 : s.value;
1831
+ return e === void 0 ? new S() : new R(e);
1823
1832
  }
1824
1833
  function M(t) {
1825
- return C(t) ? t.expression instanceof ae ? new O(t.expression.variable.value) : new O(t.expression.literal.value) : new x();
1834
+ return G(t) ? t.expression instanceof ae ? new R(t.expression.variable.value) : new R(t.expression.literal.value) : new S();
1826
1835
  }
1827
- function Mn(t) {
1836
+ function Fn(t) {
1828
1837
  var e;
1829
- return !(t instanceof le) || !Vt((e = t.op) == null ? void 0 : e.value) ? !1 : Se(t.leftExpression).and_then(() => Se(t.rightExpression)).unwrap_or(void 0) !== void 0;
1838
+ return !(t instanceof le) || !Bt((e = t.op) == null ? void 0 : e.value) ? !1 : Pe(t.leftExpression).and_then(() => Pe(t.rightExpression)).unwrap_or(void 0) !== void 0;
1830
1839
  }
1831
- function Fn(t) {
1832
- const e = Se(t.leftExpression), n = Se(t.rightExpression);
1840
+ function Bn(t) {
1841
+ const e = Pe(t.leftExpression), n = Pe(t.rightExpression);
1833
1842
  if (!e.isOk() || !n.isOk())
1834
1843
  return !1;
1835
1844
  const { tupleElements: s } = e.unwrap(), { tupleElements: i } = n.unwrap();
1836
1845
  return (s == null ? void 0 : s.length) === (i == null ? void 0 : i.length);
1837
1846
  }
1838
- function bt(t) {
1839
- return t instanceof G && t.expression instanceof ae || t instanceof ce;
1847
+ function It(t) {
1848
+ return t instanceof j && t.expression instanceof ae || t instanceof ce;
1840
1849
  }
1841
- function It(t, e) {
1850
+ function Lt(t, e) {
1842
1851
  var i, a, r, c;
1843
1852
  let n = e;
1844
- const s = un(t);
1853
+ const s = cn(t);
1845
1854
  for (; n; ) {
1846
1855
  if ((a = (i = n.symbol) == null ? void 0 : i.symbolTable) != null && a.has(t))
1847
1856
  return (r = n.symbol.symbolTable) == null ? void 0 : r.get(t);
@@ -1852,7 +1861,7 @@ function It(t, e) {
1852
1861
  n = n.parent;
1853
1862
  }
1854
1863
  }
1855
- class Bn {
1864
+ class Vn {
1856
1865
  constructor(e, n, s) {
1857
1866
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
1858
1867
  }
@@ -1860,7 +1869,7 @@ class Bn {
1860
1869
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
1861
1870
  }
1862
1871
  validateContext() {
1863
- return this.declarationNode.parent instanceof Z || xe(this.declarationNode.parent).unwrap_or(void 0) !== I.Project ? [new l(o.INVALID_CUSTOM_CONTEXT, "A custom element can only appear in a Project", this.declarationNode)] : [];
1872
+ return this.declarationNode.parent instanceof Z || Ae(this.declarationNode.parent).unwrap_or(void 0) !== I.Project ? [new l(o.INVALID_CUSTOM_CONTEXT, "A custom element can only appear in a Project", this.declarationNode)] : [];
1864
1873
  }
1865
1874
  validateName(e) {
1866
1875
  return e ? [new l(o.UNEXPECTED_NAME, "A Custom element shouldn't have a name", e)] : [];
@@ -1877,10 +1886,10 @@ class Bn {
1877
1886
  if (e instanceof re)
1878
1887
  return [new l(o.UNEXPECTED_COMPLEX_BODY, "A Custom element can only have an inline field", e)];
1879
1888
  const n = [];
1880
- return C(e.callee) || n.push(new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", e)), e.args.length > 0 && n.push(...e.args.map((s) => new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
1889
+ return G(e.callee) || n.push(new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", e)), e.args.length > 0 && n.push(...e.args.map((s) => new l(o.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
1881
1890
  }
1882
1891
  }
1883
- class we {
1892
+ class ye {
1884
1893
  constructor() {
1885
1894
  this.table = /* @__PURE__ */ new Map();
1886
1895
  }
@@ -1900,7 +1909,7 @@ class we {
1900
1909
  return this.table.forEach(e);
1901
1910
  }
1902
1911
  }
1903
- class Vn {
1912
+ class Gn {
1904
1913
  constructor(e, n, s) {
1905
1914
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
1906
1915
  }
@@ -1911,17 +1920,17 @@ class Vn {
1911
1920
  return this.declarationNode.parent instanceof y ? [new l(o.INVALID_PROJECT_CONTEXT, "An Enum can only appear top-level", this.declarationNode)] : [];
1912
1921
  }
1913
1922
  validateName(e) {
1914
- return e ? Bt(e) ? [] : [new l(o.INVALID_NAME, "An Enum name must be of the form <enum> or <schema>.<enum>", e)] : [new l(o.NAME_NOT_FOUND, "An Enum must have a name", this.declarationNode)];
1923
+ return e ? Ft(e) ? [] : [new l(o.INVALID_NAME, "An Enum name must be of the form <enum> or <schema>.<enum>", e)] : [new l(o.NAME_NOT_FOUND, "An Enum must have a name", this.declarationNode)];
1915
1924
  }
1916
1925
  validateAlias(e) {
1917
1926
  return e ? [new l(o.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", e)] : [];
1918
1927
  }
1919
1928
  registerElement() {
1920
1929
  const e = [];
1921
- this.declarationNode.symbol = this.symbolFactory.create(Nn, { declaration: this.declarationNode, symbolTable: new we() });
1930
+ this.declarationNode.symbol = this.symbolFactory.create(pn, { declaration: this.declarationNode, symbolTable: new ye() });
1922
1931
  const { name: n } = this.declarationNode, s = z(n);
1923
1932
  if (s.isOk()) {
1924
- const i = s.unwrap(), a = i.pop(), r = ze(i, this.publicSymbolTable, this.symbolFactory), c = st(a);
1933
+ const i = s.unwrap(), a = i.pop(), r = ze(i, this.publicSymbolTable, this.symbolFactory), c = nt(a);
1925
1934
  r.has(c) && e.push(new l(o.DUPLICATE_NAME, `Enum name ${a} already exists in schema '${i.join(".") || "public"}'`, n)), r.set(c, this.declarationNode.symbol);
1926
1935
  }
1927
1936
  return e;
@@ -1940,9 +1949,9 @@ class Vn {
1940
1949
  validateFields(e) {
1941
1950
  return e.length === 0 ? [new l(o.EMPTY_ENUM, "An Enum must have at least one element", this.declarationNode)] : e.flatMap((n) => {
1942
1951
  const s = [];
1943
- n.callee && !j(n.callee) && s.push(new l(o.INVALID_ENUM_ELEMENT_NAME, "An enum field must be an identifier or a quoted identifier", n.callee));
1952
+ n.callee && !$(n.callee) && s.push(new l(o.INVALID_ENUM_ELEMENT_NAME, "An enum field must be an identifier or a quoted identifier", n.callee));
1944
1953
  const i = [...n.args];
1945
- return _.last(i) instanceof R ? (s.push(...this.validateFieldSettings(_.last(i))), i.pop()) : i[0] instanceof R && (s.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && s.push(...i.map((a) => new l(o.INVALID_ENUM_ELEMENT, "An Enum must have only a field and optionally a setting list", a))), s.push(...this.registerField(n)), s;
1954
+ return _.last(i) instanceof U ? (s.push(...this.validateFieldSettings(_.last(i))), i.pop()) : i[0] instanceof U && (s.push(...this.validateFieldSettings(i[0])), i.shift()), i.length > 0 && s.push(...i.map((a) => new l(o.INVALID_ENUM_ELEMENT, "An Enum must have only a field and optionally a setting list", a))), s.push(...this.registerField(n)), s;
1946
1955
  });
1947
1956
  }
1948
1957
  validateFieldSettings(e) {
@@ -1952,7 +1961,7 @@ class Vn {
1952
1961
  switch (a) {
1953
1962
  case "note":
1954
1963
  r.length > 1 && r.forEach((c) => s.push(new l(o.DUPLICATE_ENUM_ELEMENT_SETTING, "'note' can only appear once", c))), r.forEach((c) => {
1955
- C(c.value) || s.push(new l(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", c));
1964
+ G(c.value) || s.push(new l(o.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", c));
1956
1965
  });
1957
1966
  break;
1958
1967
  default:
@@ -1970,8 +1979,8 @@ class Vn {
1970
1979
  });
1971
1980
  }
1972
1981
  registerField(e) {
1973
- if (e.callee && j(e.callee)) {
1974
- const n = $(e.callee).unwrap(), s = it(n), i = this.symbolFactory.create(mn, { declaration: e });
1982
+ if (e.callee && $(e.callee)) {
1983
+ const n = X(e.callee).unwrap(), s = st(n), i = this.symbolFactory.create(dn, { declaration: e });
1975
1984
  e.symbol = i;
1976
1985
  const a = this.declarationNode.symbol.symbolTable;
1977
1986
  if (a.has(s)) {
@@ -1986,7 +1995,7 @@ class Vn {
1986
1995
  return [];
1987
1996
  }
1988
1997
  }
1989
- class Gn {
1998
+ class Cn {
1990
1999
  constructor(e, n, s) {
1991
2000
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
1992
2001
  }
@@ -2000,7 +2009,7 @@ class Gn {
2000
2009
  "An Indexes can only appear inside a Table or a TablePartial",
2001
2010
  this.declarationNode
2002
2011
  )];
2003
- const e = xe(this.declarationNode.parent).unwrap_or(void 0);
2012
+ const e = Ae(this.declarationNode.parent).unwrap_or(void 0);
2004
2013
  return e && [I.Table, I.TablePartial].includes(e) ? [] : [new l(
2005
2014
  o.INVALID_NOTE_CONTEXT,
2006
2015
  "An Indexes can only appear inside a Table or a TablePartial",
@@ -2029,7 +2038,7 @@ class Gn {
2029
2038
  if (!n.callee)
2030
2039
  return [];
2031
2040
  const s = [], i = [n.callee, ...n.args];
2032
- return _.last(i) instanceof R && s.push(...this.validateFieldSetting(i.pop())), i.forEach((a) => {
2041
+ return _.last(i) instanceof U && s.push(...this.validateFieldSetting(i.pop())), i.forEach((a) => {
2033
2042
  for (; a instanceof Y; )
2034
2043
  a.argumentList && !Ge(a.argumentList).isOk() && s.push(new l(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", a.argumentList)), a = a.callee;
2035
2044
  Ge(a).isOk() || s.push(new l(o.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", a));
@@ -2044,7 +2053,7 @@ class Gn {
2044
2053
  case "note":
2045
2054
  case "name":
2046
2055
  r.length > 1 && r.forEach((c) => s.push(new l(o.DUPLICATE_INDEX_SETTING, `'${a}' can only appear once`, c))), r.forEach((c) => {
2047
- C(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${a}' must be a string`, c));
2056
+ G(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'${a}' must be a string`, c));
2048
2057
  });
2049
2058
  break;
2050
2059
  case "unique":
@@ -2055,7 +2064,7 @@ class Gn {
2055
2064
  break;
2056
2065
  case "type":
2057
2066
  r.length > 1 && r.forEach((c) => s.push(new l(o.DUPLICATE_INDEX_SETTING, "'type' can only appear once", c))), r.forEach((c) => {
2058
- j(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'type' must be "btree" or "hash"`, c));
2067
+ $(c.value) || s.push(new l(o.INVALID_INDEX_SETTING_VALUE, `'type' must be "btree" or "hash"`, c));
2059
2068
  });
2060
2069
  break;
2061
2070
  default:
@@ -2073,7 +2082,7 @@ class Gn {
2073
2082
  });
2074
2083
  }
2075
2084
  }
2076
- class Cn {
2085
+ class Xn {
2077
2086
  constructor(e, n, s) {
2078
2087
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2079
2088
  }
@@ -2092,7 +2101,7 @@ class Cn {
2092
2101
  I.TableGroup,
2093
2102
  I.TablePartial,
2094
2103
  I.Project
2095
- ].includes(xe(this.declarationNode.parent).unwrap_or(void 0)) ? [new l(
2104
+ ].includes(Ae(this.declarationNode.parent).unwrap_or(void 0)) ? [new l(
2096
2105
  o.INVALID_NOTE_CONTEXT,
2097
2106
  "A Note can only appear inside a Table, a TableGroup, a TablePartial or a Project. Sticky note can only appear at the global scope.",
2098
2107
  this.declarationNode
@@ -2125,7 +2134,7 @@ class Cn {
2125
2134
  }
2126
2135
  validateFields(e) {
2127
2136
  const n = [];
2128
- return e.length === 0 ? [new l(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new l(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), C(e[0].callee) || n.push(new l(o.INVALID_NOTE, "A Note content must be a quoted string", e[0])), e[0].args.length > 0 && n.push(...e[0].args.map((s) => new l(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
2137
+ return e.length === 0 ? [new l(o.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (e.length > 1 && e.slice(1).forEach((s) => n.push(new l(o.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), G(e[0].callee) || n.push(new l(o.INVALID_NOTE, "A Note content must be a quoted string", e[0])), e[0].args.length > 0 && n.push(...e[0].args.map((s) => new l(o.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
2129
2138
  }
2130
2139
  validateSubElements(e) {
2131
2140
  return e.flatMap((n) => {
@@ -2136,7 +2145,7 @@ class Cn {
2136
2145
  });
2137
2146
  }
2138
2147
  }
2139
- class Xn {
2148
+ class jn {
2140
2149
  constructor(e, n, s) {
2141
2150
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2142
2151
  }
@@ -2147,7 +2156,7 @@ class Xn {
2147
2156
  return this.declarationNode.parent instanceof y ? [new l(o.INVALID_PROJECT_CONTEXT, "A Project can only appear top-level", this.declarationNode)] : [];
2148
2157
  }
2149
2158
  validateName(e) {
2150
- return e ? ye(e) ? [] : [new l(o.INVALID_NAME, "A Project's name is optional or must be an identifier or a quoted identifer", e)] : [];
2159
+ return e ? ke(e) ? [] : [new l(o.INVALID_NAME, "A Project's name is optional or must be an identifier or a quoted identifer", e)] : [];
2151
2160
  }
2152
2161
  validateAlias(e) {
2153
2162
  return e ? [new l(o.UNEXPECTED_ALIAS, "A Project shouldn't have an alias", e)] : [];
@@ -2186,7 +2195,7 @@ class $n {
2186
2195
  return this.declarationNode.parent instanceof Z ? [] : [new l(o.INVALID_REF_CONTEXT, "A Ref must appear top-level", this.declarationNode)];
2187
2196
  }
2188
2197
  validateName(e) {
2189
- return e ? ye(e) ? [] : [new l(o.INVALID_NAME, "A Ref's name is optional or must be an identifier or a quoted identifer", e)] : [];
2198
+ return e ? ke(e) ? [] : [new l(o.INVALID_NAME, "A Ref's name is optional or must be an identifier or a quoted identifer", e)] : [];
2190
2199
  }
2191
2200
  validateAlias(e) {
2192
2201
  return e ? [new l(o.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", e)] : [];
@@ -2207,13 +2216,13 @@ class $n {
2207
2216
  return [new l(o.EMPTY_REF, "A Ref must have at least one field", this.declarationNode)];
2208
2217
  const n = [];
2209
2218
  return e.length > 1 && n.push(...e.slice(1).map((s) => new l(o.REF_REDEFINED, "A Ref can only contain one binary relationship", s))), e.forEach((s) => {
2210
- s.callee && !Mn(s.callee) && n.push(new l(o.INVALID_REF_FIELD, "A Ref field must be a binary relationship", s.callee)), s.callee && !Fn(s.callee) && n.push(new l(o.UNEQUAL_FIELDS_BINARY_REF, "Unequal fields in ref endpoints", s.callee));
2219
+ s.callee && !Fn(s.callee) && n.push(new l(o.INVALID_REF_FIELD, "A Ref field must be a binary relationship", s.callee)), s.callee && !Bn(s.callee) && n.push(new l(o.UNEQUAL_FIELDS_BINARY_REF, "Unequal fields in ref endpoints", s.callee));
2211
2220
  const i = [...s.args];
2212
- if (_.last(i) instanceof R) {
2221
+ if (_.last(i) instanceof U) {
2213
2222
  const a = this.validateFieldSettings(_.last(i));
2214
2223
  n.push(...a), i.pop();
2215
2224
  } else
2216
- i[0] instanceof R && (n.push(...this.validateFieldSettings(i[0])), i.shift());
2225
+ i[0] instanceof U && (n.push(...this.validateFieldSettings(i[0])), i.shift());
2217
2226
  i.length > 0 && n.push(...i.map((a) => new l(o.INVALID_REF_FIELD, "A Ref field should only have a single binary relationship", a)));
2218
2227
  }), n;
2219
2228
  }
@@ -2225,7 +2234,7 @@ class $n {
2225
2234
  case "delete":
2226
2235
  case "update":
2227
2236
  r.length > 1 && r.forEach((c) => s.push(new l(o.DUPLICATE_REF_SETTING, `'${a}' can only appear once`, c))), r.forEach((c) => {
2228
- jn(c.value) || s.push(new l(o.INVALID_REF_SETTING_VALUE, `'${a}' can only have values "cascade", "no action", "set null", "set default" or "restrict"`, c));
2237
+ Wn(c.value) || s.push(new l(o.INVALID_REF_SETTING_VALUE, `'${a}' can only have values "cascade", "no action", "set null", "set default" or "restrict"`, c));
2229
2238
  });
2230
2239
  break;
2231
2240
  case "color":
@@ -2248,11 +2257,11 @@ class $n {
2248
2257
  });
2249
2258
  }
2250
2259
  }
2251
- function jn(t) {
2252
- if (!(j(t) && t.expression.variable.kind !== h.QUOTED_STRING) && !(t instanceof ne))
2260
+ function Wn(t) {
2261
+ if (!($(t) && t.expression.variable.kind !== h.QUOTED_STRING) && !(t instanceof te))
2253
2262
  return !1;
2254
2263
  let e;
2255
- if (t instanceof ne ? e = ge(t).unwrap_or("") : e = t.expression.variable.value, e)
2264
+ if (t instanceof te ? e = ve(t).unwrap_or("") : e = t.expression.variable.value, e)
2256
2265
  switch (e.toLowerCase()) {
2257
2266
  case "cascade":
2258
2267
  case "no action":
@@ -2265,7 +2274,7 @@ function jn(t) {
2265
2274
  }
2266
2275
  return !1;
2267
2276
  }
2268
- class Wn {
2277
+ class Yn {
2269
2278
  constructor(e, n, s) {
2270
2279
  this.declarationNode = e, this.symbolFactory = s, this.publicSymbolTable = n;
2271
2280
  }
@@ -2276,10 +2285,10 @@ class Wn {
2276
2285
  return this.declarationNode.parent instanceof y ? [new l(o.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
2277
2286
  }
2278
2287
  validateName(e) {
2279
- return e ? e instanceof ue ? [new l(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : Bt(e) ? [] : [new l(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new l(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
2288
+ return e ? e instanceof ue ? [new l(o.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", e)] : Ft(e) ? [] : [new l(o.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", e)] : [new l(o.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
2280
2289
  }
2281
2290
  validateAlias(e) {
2282
- return e ? Jn(e) ? [] : [new l(o.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", e)] : [];
2291
+ return e ? Zn(e) ? [] : [new l(o.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", e)] : [];
2283
2292
  }
2284
2293
  validateSettingList(e) {
2285
2294
  const n = F(e), s = n.getErrors(), i = n.getValue();
@@ -2293,7 +2302,7 @@ class Wn {
2293
2302
  break;
2294
2303
  case "note":
2295
2304
  r.length > 1 && s.push(...r.map((c) => new l(o.DUPLICATE_TABLE_SETTING, "'note' can only appear once", c))), r.forEach((c) => {
2296
- C(c.value) || s.push(new l(o.INVALID_TABLE_SETTING, "'note' must be a string literal", c.value || c.name));
2305
+ G(c.value) || s.push(new l(o.INVALID_TABLE_SETTING, "'note' must be a string literal", c.value || c.name));
2297
2306
  });
2298
2307
  break;
2299
2308
  default:
@@ -2304,14 +2313,14 @@ class Wn {
2304
2313
  }
2305
2314
  registerElement() {
2306
2315
  const e = [];
2307
- this.declarationNode.symbol = this.symbolFactory.create(Ut, { declaration: this.declarationNode, symbolTable: new we() });
2316
+ this.declarationNode.symbol = this.symbolFactory.create(Ut, { declaration: this.declarationNode, symbolTable: new ye() });
2308
2317
  const { name: n, alias: s } = this.declarationNode, i = z(n);
2309
2318
  if (i.isOk()) {
2310
2319
  const a = [...i.unwrap()], r = a.pop(), c = ze(a, this.publicSymbolTable, this.symbolFactory), f = Be(r);
2311
2320
  c.has(f) && e.push(new l(o.DUPLICATE_NAME, `Table name '${r}' already exists in schema '${a.join(".") || "public"}'`, n)), c.set(f, this.declarationNode.symbol);
2312
2321
  }
2313
- if (s && ye(s) && !qn(s.expression.variable.value, i.unwrap_or([]))) {
2314
- const a = $(s).unwrap(), r = Be(a);
2322
+ if (s && ke(s) && !zn(s.expression.variable.value, i.unwrap_or([]))) {
2323
+ const a = X(s).unwrap(), r = Be(a);
2315
2324
  this.publicSymbolTable.has(r) && e.push(new l(o.DUPLICATE_NAME, `Table name '${a}' already exists`, n)), this.publicSymbolTable.set(r, this.declarationNode.symbol);
2316
2325
  }
2317
2326
  return e;
@@ -2321,50 +2330,44 @@ class Wn {
2321
2330
  return [];
2322
2331
  if (e instanceof v)
2323
2332
  return [new l(o.UNEXPECTED_SIMPLE_BODY, "A Table's body must be a block", e)];
2324
- const [n, s] = _.partition(e.body, (r) => r instanceof v), [i, a] = _.partition(s, (r) => r instanceof Le);
2333
+ const [n, s, i] = e.body.reduce((a, r) => (r instanceof v ? a[0].push(r) : r instanceof Le ? a[1].push(r) : r instanceof y && a[2].push(r), a), [[], [], []]);
2325
2334
  return [
2326
2335
  ...this.validateFields(n),
2327
- ...this.validateInjections(i),
2328
- ...this.validateSubElements(a)
2329
- ];
2330
- }
2331
- validateFields(e) {
2332
- const [n, s, i] = e.reduce((a, r) => (r.callee instanceof G ? a[0].push(r) : r.callee instanceof K ? a[1].push(r) : a[2].push(new l(o.INVALID_TABLE_FIELD, "A Table field must be a column or a TablePartial injection", r)), a), [[], [], []]);
2333
- return [
2334
- ...i,
2335
- ...this.validateColumns(n),
2336
- ...this.validateInjections(s)
2336
+ ...this.validateInjections(s),
2337
+ ...this.validateSubElements(i)
2337
2338
  ];
2338
2339
  }
2339
2340
  validateInjections(e) {
2340
2341
  return e.flatMap((n) => this.registerInjection(n));
2341
2342
  }
2342
2343
  registerInjection(e) {
2343
- var n, s;
2344
- if (e.partial && ((n = e.partial.variable) != null && n.value)) {
2345
- const i = (s = e.partial.variable) == null ? void 0 : s.value, a = cn(i), r = this.symbolFactory.create(Ln, { declaration: e });
2346
- e.symbol = r;
2347
- const c = this.declarationNode.symbol.symbolTable, f = c.get(a);
2348
- if (f)
2344
+ var n, s, i;
2345
+ if ((s = (n = e.partial) == null ? void 0 : n.variable) != null && s.value) {
2346
+ const a = (i = e.partial.variable) == null ? void 0 : i.value, r = Ot(a), c = this.symbolFactory.create(Tn, { declaration: e });
2347
+ e.symbol = c;
2348
+ const f = this.declarationNode.symbol.symbolTable, p = f.get(r);
2349
+ if (p)
2349
2350
  return [
2350
- new l(o.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME, `Duplicate injection ${i}`, e),
2351
- new l(o.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME, `Duplicate injection ${i}`, f.declaration)
2351
+ new l(o.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME, `Duplicate injection ${a}`, e),
2352
+ new l(o.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME, `Duplicate injection ${a}`, p.declaration)
2352
2353
  ];
2353
- c.set(a, r);
2354
+ f.set(r, c);
2354
2355
  }
2355
2356
  return [];
2356
2357
  }
2357
- validateColumns(e) {
2358
+ validateFields(e) {
2358
2359
  return e.length === 0 ? [new l(o.EMPTY_TABLE, "A Table must have at least one column", this.declarationNode)] : e.flatMap((n) => {
2360
+ if (!n.callee)
2361
+ return [];
2359
2362
  const s = [];
2360
- n.args.length === 0 && s.push(new l(o.INVALID_COLUMN, "A column must have a type", n.callee)), j(n.callee) || s.push(new l(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !Yn(n.args[0]) && s.push(new l(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2363
+ n.args.length === 0 && s.push(new l(o.INVALID_COLUMN, "A column must have a type", n.callee)), $(n.callee) || s.push(new l(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !qn(n.args[0]) && s.push(new l(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2361
2364
  const i = n.args.slice(1);
2362
- return s.push(...this.validateColumnSetting(i)), s.push(...this.registerColumn(n)), s;
2365
+ return s.push(...this.validateFieldSetting(i)), s.push(...this.registerField(n)), s;
2363
2366
  });
2364
2367
  }
2365
- registerColumn(e) {
2366
- if (e.callee && j(e.callee)) {
2367
- const n = $(e.callee).unwrap(), s = We(n), i = this.symbolFactory.create(Mt, { declaration: e });
2368
+ registerField(e) {
2369
+ if (e.callee && $(e.callee)) {
2370
+ const n = X(e.callee).unwrap(), s = We(n), i = this.symbolFactory.create(ot, { declaration: e });
2368
2371
  e.symbol = i;
2369
2372
  const a = this.declarationNode.symbol.symbolTable;
2370
2373
  if (a.has(s)) {
@@ -2379,16 +2382,16 @@ class Wn {
2379
2382
  return [];
2380
2383
  }
2381
2384
  // This is needed to support legacy inline settings
2382
- validateColumnSetting(e) {
2383
- if (!e.slice(0, -1).every(he) || !e.slice(-1).every((f) => he(f) || f instanceof R))
2385
+ validateFieldSetting(e) {
2386
+ if (!e.slice(0, -1).every(he) || !e.slice(-1).every((f) => he(f) || f instanceof U))
2384
2387
  return [...e.map((f) => new l(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", f))];
2385
2388
  if (e.length === 0)
2386
2389
  return [];
2387
2390
  let n;
2388
- _.last(e) instanceof R && (n = e.pop());
2391
+ _.last(e) instanceof U && (n = e.pop());
2389
2392
  const s = F(n), i = s.getErrors(), a = s.getValue();
2390
2393
  for (const f of e) {
2391
- const p = $(f).unwrap_or("").toLowerCase();
2394
+ const p = X(f).unwrap_or("").toLowerCase();
2392
2395
  if (p !== "pk" && p !== "unique") {
2393
2396
  i.push(new l(o.INVALID_SETTINGS, "Inline column settings can only be `pk` or `unique`", f));
2394
2397
  continue;
@@ -2402,12 +2405,12 @@ class Wn {
2402
2405
  switch (f) {
2403
2406
  case "note":
2404
2407
  p.length > 1 && i.push(...p.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "note can only appear once", u))), p.forEach((u) => {
2405
- C(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", u.value || u.name));
2408
+ G(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", u.value || u.name));
2406
2409
  });
2407
2410
  break;
2408
2411
  case "ref":
2409
2412
  p.forEach((u) => {
2410
- Ct(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'ref' must be a valid unary relationship", u.value || u.name));
2413
+ Gt(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'ref' must be a valid unary relationship", u.value || u.name));
2411
2414
  });
2412
2415
  break;
2413
2416
  case "primary key":
@@ -2417,7 +2420,7 @@ class Wn {
2417
2420
  break;
2418
2421
  case "pk":
2419
2422
  p.length > 1 && i.push(...p.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "'pk' can only appear once", u))), p.forEach((u) => {
2420
- u instanceof se && !H(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'pk' must not have a value", u.value || u.name));
2423
+ u instanceof ne && !H(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'pk' must not have a value", u.value || u.name));
2421
2424
  });
2422
2425
  break;
2423
2426
  case "not null":
@@ -2434,17 +2437,17 @@ class Wn {
2434
2437
  break;
2435
2438
  case "unique":
2436
2439
  p.length > 1 && i.push(...p.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "'unique' can only appear once", u))), p.forEach((u) => {
2437
- u instanceof se && !H(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'unique' must not have a value", u.value || u.name));
2440
+ u instanceof ne && !H(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'unique' must not have a value", u.value || u.name));
2438
2441
  });
2439
2442
  break;
2440
2443
  case "increment":
2441
2444
  p.length > 1 && i.push(...p.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "'increment' can only appear once", u))), p.forEach((u) => {
2442
- u instanceof se && !H(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'increment' must not have a value", u.value || u.name));
2445
+ u instanceof ne && !H(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'increment' must not have a value", u.value || u.name));
2443
2446
  });
2444
2447
  break;
2445
2448
  case "default":
2446
2449
  p.length > 1 && i.push(...p.map((u) => new l(o.DUPLICATE_TABLE_SETTING, "'default' can only appear once", u))), p.forEach((u) => {
2447
- Gt(u.value) || i.push(new l(o.INVALID_TABLE_SETTING, "'default' must be a string literal, number literal, function expression, true, false or null", u.value || u.name));
2450
+ Vt(u.value) || i.push(new l(o.INVALID_TABLE_SETTING, "'default' must be a string literal, number literal, function expression, true, false or null", u.value || u.name));
2448
2451
  });
2449
2452
  break;
2450
2453
  default:
@@ -2455,39 +2458,37 @@ class Wn {
2455
2458
  }
2456
2459
  validateSubElements(e) {
2457
2460
  const n = e.flatMap((i) => {
2458
- if (!i)
2459
- return [];
2460
2461
  if (i.parent = this.declarationNode, !i.type)
2461
2462
  return [];
2462
2463
  const a = pe(i);
2463
2464
  return new a(i, this.publicSymbolTable, this.symbolFactory).validate();
2464
2465
  }), s = e.filter((i) => {
2465
2466
  var a;
2466
- return ((a = i == null ? void 0 : i.type) == null ? void 0 : a.value.toLowerCase()) === "note";
2467
+ return ((a = i.type) == null ? void 0 : a.value.toLowerCase()) === "note";
2467
2468
  });
2468
2469
  return s.length > 1 && n.push(...s.map((i) => new l(o.NOTE_REDEFINED, "Duplicate notes are defined", i))), n;
2469
2470
  }
2470
2471
  }
2471
- function Yn(t) {
2472
- if (!(t instanceof Y || qe(t) || t instanceof G || t instanceof ue))
2472
+ function qn(t) {
2473
+ if (!(t instanceof Y || qe(t) || t instanceof j || t instanceof ue))
2473
2474
  return !1;
2474
2475
  if (t instanceof Y) {
2475
- if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => ee(n) || C(n) || he(n)))
2476
+ if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => K(n) || G(n) || he(n)))
2476
2477
  return !1;
2477
2478
  t = t.callee;
2478
2479
  }
2479
2480
  for (; t instanceof ue; ) {
2480
- if (t.array === void 0 || t.indexer === void 0 || !t.indexer.elementList.every((n) => !n.colon && !n.value && ee(n.name)))
2481
+ if (t.array === void 0 || t.indexer === void 0 || !t.indexer.elementList.every((n) => !n.colon && !n.value && K(n.name)))
2481
2482
  return !1;
2482
2483
  t = t.array;
2483
2484
  }
2484
2485
  const e = z(t).unwrap_or(void 0);
2485
2486
  return e !== void 0 && e.length > 0;
2486
2487
  }
2487
- function qn(t, e) {
2488
+ function zn(t, e) {
2488
2489
  return e.length === 1 && t === e[0];
2489
2490
  }
2490
- class zn {
2491
+ class Qn {
2491
2492
  constructor(e, n, s) {
2492
2493
  this.declarationNode = e, this.publicSymbolTable = n, this.symbolFactory = s;
2493
2494
  }
@@ -2509,7 +2510,7 @@ class zn {
2509
2510
  )] : [];
2510
2511
  }
2511
2512
  validateName(e) {
2512
- return e ? ye(e) ? [] : [new l(
2513
+ return e ? ke(e) ? [] : [new l(
2513
2514
  o.INVALID_NAME,
2514
2515
  "A TableGroup name must be a single identifier",
2515
2516
  e
@@ -2528,10 +2529,10 @@ class zn {
2528
2529
  }
2529
2530
  registerElement() {
2530
2531
  const { name: e } = this.declarationNode;
2531
- this.declarationNode.symbol = this.symbolFactory.create(Tn, { declaration: this.declarationNode, symbolTable: new we() });
2532
+ this.declarationNode.symbol = this.symbolFactory.create(En, { declaration: this.declarationNode, symbolTable: new ye() });
2532
2533
  const n = z(e);
2533
2534
  if (n.isOk()) {
2534
- const s = n.unwrap(), i = s.pop(), a = ze(s, this.publicSymbolTable, this.symbolFactory), r = at(i);
2535
+ const s = n.unwrap(), i = s.pop(), a = ze(s, this.publicSymbolTable, this.symbolFactory), r = it(i);
2535
2536
  if (a.has(r))
2536
2537
  return [new l(o.DUPLICATE_NAME, `TableGroup name '${i}' already exists`, e)];
2537
2538
  a.set(r, this.declarationNode.symbol);
@@ -2560,7 +2561,7 @@ class zn {
2560
2561
  o.DUPLICATE_TABLE_SETTING,
2561
2562
  "'note' can only appear once",
2562
2563
  c
2563
- ))), a.filter((c) => !C(c.value)).forEach((c) => {
2564
+ ))), a.filter((c) => !G(c.value)).forEach((c) => {
2564
2565
  s.push(new l(
2565
2566
  o.INVALID_TABLE_SETTING,
2566
2567
  "'note' must be a string literal",
@@ -2612,8 +2613,8 @@ class zn {
2612
2613
  return s.length > 1 && n.push(...s.map((i) => new l(o.NOTE_REDEFINED, "Duplicate notes are defined", i))), n;
2613
2614
  }
2614
2615
  registerField(e) {
2615
- if (e.callee && j(e.callee)) {
2616
- const n = $(e.callee).unwrap(), s = rt(n), i = this.symbolFactory.create(bn, { declaration: e });
2616
+ if (e.callee && $(e.callee)) {
2617
+ const n = X(e.callee).unwrap(), s = at(n), i = this.symbolFactory.create(Nn, { declaration: e });
2617
2618
  e.symbol = i;
2618
2619
  const a = this.declarationNode.symbol.symbolTable;
2619
2620
  if (a.has(s)) {
@@ -2628,24 +2629,24 @@ class zn {
2628
2629
  return [];
2629
2630
  }
2630
2631
  }
2631
- const ot = ["-", "+"];
2632
- function Qn(t) {
2633
- if (!(t instanceof Y || qe(t) || t instanceof G || t instanceof ue))
2632
+ const lt = ["-", "+"];
2633
+ function Hn(t) {
2634
+ if (!(t instanceof Y || qe(t) || t instanceof j || t instanceof ue))
2634
2635
  return !1;
2635
2636
  if (t instanceof Y) {
2636
- if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => ee(n) || C(n) || he(n)))
2637
+ if (t.callee === void 0 || t.argumentList === void 0 || !t.argumentList.elementList.every((n) => K(n) || G(n) || he(n)))
2637
2638
  return !1;
2638
2639
  t = t.callee;
2639
2640
  }
2640
2641
  for (; t instanceof ue; ) {
2641
- if (t.array === void 0 || t.indexer === void 0 || !t.indexer.elementList.every((n) => !n.colon && !n.value && ee(n.name)))
2642
+ if (t.array === void 0 || t.indexer === void 0 || !t.indexer.elementList.every((n) => !n.colon && !n.value && K(n.name)))
2642
2643
  return !1;
2643
2644
  t = t.array;
2644
2645
  }
2645
2646
  const e = z(t).unwrap_or(void 0);
2646
2647
  return e !== void 0 && e.length > 0;
2647
2648
  }
2648
- class Hn {
2649
+ class Jn {
2649
2650
  constructor(e, n, s) {
2650
2651
  this.declarationNode = e, this.symbolFactory = s, this.publicSymbolTable = n;
2651
2652
  }
@@ -2667,7 +2668,7 @@ class Hn {
2667
2668
  )] : [];
2668
2669
  }
2669
2670
  validateName(e) {
2670
- return e ? ye(e) ? [] : [new l(
2671
+ return e ? ke(e) ? [] : [new l(
2671
2672
  o.INVALID_NAME,
2672
2673
  "A TablePartial name must be an identifier or a quoted identifer",
2673
2674
  e
@@ -2686,7 +2687,7 @@ class Hn {
2686
2687
  }
2687
2688
  validateSettingList(e) {
2688
2689
  const n = F(e), s = n.getErrors(), i = n.getValue();
2689
- return ft(i, (a, r) => {
2690
+ return pt(i, (a, r) => {
2690
2691
  switch (r) {
2691
2692
  case "headercolor":
2692
2693
  a.length > 1 && s.push(...a.map((c) => new l(o.DUPLICATE_TABLE_PARTIAL_SETTING, "'headercolor' can only appear once", c))), a.forEach((c) => {
@@ -2695,7 +2696,7 @@ class Hn {
2695
2696
  break;
2696
2697
  case "note":
2697
2698
  a.length > 1 && s.push(...a.map((c) => new l(o.DUPLICATE_TABLE_PARTIAL_SETTING, "'note' can only appear once", c))), a.forEach((c) => {
2698
- C(c.value) || s.push(new l(o.INVALID_TABLE_PARTIAL_SETTING, "'note' must be a string literal", c.value || c.name));
2699
+ G(c.value) || s.push(new l(o.INVALID_TABLE_PARTIAL_SETTING, "'note' must be a string literal", c.value || c.name));
2699
2700
  });
2700
2701
  break;
2701
2702
  default:
@@ -2705,10 +2706,10 @@ class Hn {
2705
2706
  }
2706
2707
  registerElement() {
2707
2708
  const { name: e } = this.declarationNode;
2708
- this.declarationNode.symbol = this.symbolFactory.create(In, { declaration: this.declarationNode, symbolTable: new we() });
2709
+ this.declarationNode.symbol = this.symbolFactory.create(mn, { declaration: this.declarationNode, symbolTable: new ye() });
2709
2710
  const n = z(e);
2710
2711
  if (n.isOk()) {
2711
- const s = n.unwrap(), i = s.pop(), a = ze(s, this.publicSymbolTable, this.symbolFactory), r = Ot(i);
2712
+ const s = n.unwrap(), i = s.pop(), a = ze(s, this.publicSymbolTable, this.symbolFactory), r = rt(i);
2712
2713
  if (a.has(r))
2713
2714
  return [new l(o.DUPLICATE_NAME, `TablePartial name '${i}' already exists`, e)];
2714
2715
  a.set(r, this.declarationNode.symbol);
@@ -2728,14 +2729,14 @@ class Hn {
2728
2729
  if (!n.callee)
2729
2730
  return [];
2730
2731
  const s = [];
2731
- n.args.length === 0 && s.push(new l(o.INVALID_COLUMN, "A column must have a type", n.callee)), j(n.callee) || s.push(new l(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !Qn(n.args[0]) && s.push(new l(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2732
+ n.args.length === 0 && s.push(new l(o.INVALID_COLUMN, "A column must have a type", n.callee)), $(n.callee) || s.push(new l(o.INVALID_COLUMN_NAME, "A column name must be an identifier or a quoted identifier", n.callee)), n.args[0] && !Hn(n.args[0]) && s.push(new l(o.INVALID_COLUMN_TYPE, "Invalid column type", n.args[0]));
2732
2733
  const i = n.args.slice(1);
2733
2734
  return s.push(...this.validateFieldSetting(i)), s.push(...this.registerField(n)), s;
2734
2735
  });
2735
2736
  }
2736
2737
  registerField(e) {
2737
- if (e.callee && j(e.callee)) {
2738
- const n = $(e.callee).unwrap(), s = We(n), i = this.symbolFactory.create(Mt, { declaration: e });
2738
+ if (e.callee && $(e.callee)) {
2739
+ const n = X(e.callee).unwrap(), s = We(n), i = this.symbolFactory.create(ot, { declaration: e });
2739
2740
  e.symbol = i;
2740
2741
  const a = this.declarationNode.symbol.symbolTable;
2741
2742
  if (a.has(s)) {
@@ -2751,15 +2752,15 @@ class Hn {
2751
2752
  }
2752
2753
  // This is needed to support legacy inline settings
2753
2754
  validateFieldSetting(e) {
2754
- if (!e.slice(0, -1).every(he) || !e.slice(-1).every((f) => he(f) || f instanceof R))
2755
+ if (!e.slice(0, -1).every(he) || !e.slice(-1).every((f) => he(f) || f instanceof U))
2755
2756
  return [...e.map((f) => new l(o.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", f))];
2756
2757
  if (e.length === 0)
2757
2758
  return [];
2758
2759
  let n;
2759
- _.last(e) instanceof R && (n = e.pop());
2760
+ _.last(e) instanceof U && (n = e.pop());
2760
2761
  const s = F(n), i = s.getErrors(), a = s.getValue();
2761
2762
  e.forEach((f) => {
2762
- const p = $(f).unwrap_or("").toLowerCase();
2763
+ const p = X(f).unwrap_or("").toLowerCase();
2763
2764
  if (p !== "pk" && p !== "unique") {
2764
2765
  i.push(new l(o.INVALID_SETTINGS, "Inline column settings can only be `pk` or `unique`", f));
2765
2766
  return;
@@ -2771,16 +2772,16 @@ class Hn {
2771
2772
  o.DUPLICATE_COLUMN_SETTING,
2772
2773
  "Either one of 'primary key' and 'pk' can appear",
2773
2774
  f
2774
- ))), ft(a, (f, p) => {
2775
+ ))), pt(a, (f, p) => {
2775
2776
  switch (p) {
2776
2777
  case "note":
2777
2778
  f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "note can only appear once", u))), f.forEach((u) => {
2778
- C(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", u.value || u.name));
2779
+ G(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", u.value || u.name));
2779
2780
  });
2780
2781
  break;
2781
2782
  case "ref":
2782
2783
  f.forEach((u) => {
2783
- Ct(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'ref' must be a valid unary relationship", u.value || u.name));
2784
+ Gt(u.value) || i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'ref' must be a valid unary relationship", u.value || u.name));
2784
2785
  });
2785
2786
  break;
2786
2787
  case "primary key":
@@ -2790,7 +2791,7 @@ class Hn {
2790
2791
  break;
2791
2792
  case "pk":
2792
2793
  f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "'pk' can only appear once", u))), f.forEach((u) => {
2793
- u instanceof se && !H(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'pk' must not have a value", u.value || u.name));
2794
+ u instanceof ne && !H(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'pk' must not have a value", u.value || u.name));
2794
2795
  });
2795
2796
  break;
2796
2797
  case "not null":
@@ -2811,17 +2812,17 @@ class Hn {
2811
2812
  break;
2812
2813
  case "unique":
2813
2814
  f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "'unique' can only appear once", u))), f.forEach((u) => {
2814
- u instanceof se && !H(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'unique' must not have a value", u.value || u.name));
2815
+ u instanceof ne && !H(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'unique' must not have a value", u.value || u.name));
2815
2816
  });
2816
2817
  break;
2817
2818
  case "increment":
2818
2819
  f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "'increment' can only appear once", u))), f.forEach((u) => {
2819
- u instanceof se && !H(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'increment' must not have a value", u.value || u.name));
2820
+ u instanceof ne && !H(u.value) && i.push(new l(o.INVALID_COLUMN_SETTING_VALUE, "'increment' must not have a value", u.value || u.name));
2820
2821
  });
2821
2822
  break;
2822
2823
  case "default":
2823
2824
  f.length > 1 && i.push(...f.map((u) => new l(o.DUPLICATE_COLUMN_SETTING, "'default' can only appear once", u))), f.forEach((u) => {
2824
- Gt(u.value) || i.push(new l(
2825
+ Vt(u.value) || i.push(new l(
2825
2826
  o.INVALID_COLUMN_SETTING_VALUE,
2826
2827
  "'default' must be a string literal, number literal, function expression, true, false or null",
2827
2828
  u.value || u.name
@@ -2849,33 +2850,33 @@ class Hn {
2849
2850
  function pe(t) {
2850
2851
  switch (t.type.value.toLowerCase()) {
2851
2852
  case I.Enum:
2852
- return Vn;
2853
+ return Gn;
2853
2854
  case I.Table:
2854
- return Wn;
2855
+ return Yn;
2855
2856
  case I.TableGroup:
2856
- return zn;
2857
+ return Qn;
2857
2858
  case I.Project:
2858
- return Xn;
2859
+ return jn;
2859
2860
  case I.Ref:
2860
2861
  return $n;
2861
2862
  case I.Note:
2862
- return Cn;
2863
+ return Xn;
2863
2864
  case I.Indexes:
2864
- return Gn;
2865
+ return Cn;
2865
2866
  case I.TablePartial:
2866
- return Hn;
2867
+ return Jn;
2867
2868
  default:
2868
- return Bn;
2869
+ return Vn;
2869
2870
  }
2870
2871
  }
2871
- function Bt(t) {
2872
+ function Ft(t) {
2872
2873
  return !!z(t).unwrap_or(!1);
2873
2874
  }
2874
- function Jn(t) {
2875
- return ye(t);
2875
+ function Zn(t) {
2876
+ return ke(t);
2876
2877
  }
2877
- function ye(t) {
2878
- return t instanceof G && t.expression instanceof ae;
2878
+ function ke(t) {
2879
+ return t instanceof j && t.expression instanceof ae;
2879
2880
  }
2880
2881
  function ze(t, e, n) {
2881
2882
  var i;
@@ -2883,12 +2884,12 @@ function ze(t, e, n) {
2883
2884
  let s = e;
2884
2885
  for (const a of t) {
2885
2886
  let r;
2886
- const c = nt(a);
2887
+ const c = tt(a);
2887
2888
  if (s.has(c)) {
2888
2889
  if (r = (i = s.get(c)) == null ? void 0 : i.symbolTable, !r)
2889
2890
  throw new Error("Expect a symbol table in a schema symbol");
2890
2891
  } else {
2891
- r = new we();
2892
+ r = new ye();
2892
2893
  const f = n.create(Rt, { symbolTable: r });
2893
2894
  s.set(c, f);
2894
2895
  }
@@ -2896,41 +2897,41 @@ function ze(t, e, n) {
2896
2897
  }
2897
2898
  return s;
2898
2899
  }
2899
- function Vt(t) {
2900
+ function Bt(t) {
2900
2901
  return t === "-" || t === "<>" || t === ">" || t === "<";
2901
2902
  }
2902
2903
  function Qe(t) {
2903
2904
  var n;
2904
- if (!(t instanceof G) || !(t.expression instanceof ve) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== h.COLOR_LITERAL)
2905
+ if (!(t instanceof j) || !(t.expression instanceof we) || ((n = t.expression.literal) == null ? void 0 : n.kind) !== h.COLOR_LITERAL)
2905
2906
  return !1;
2906
2907
  const e = t.expression.literal.value;
2907
2908
  if (e.length !== 4 && e.length !== 7 || e[0] !== "#")
2908
2909
  return !1;
2909
2910
  for (let s = 1; s < e.length; s += 1)
2910
- if (!dn(e[s]))
2911
+ if (!An(e[s]))
2911
2912
  return !1;
2912
2913
  return !0;
2913
2914
  }
2914
2915
  function H(t) {
2915
2916
  return t === void 0;
2916
2917
  }
2917
- function Gt(t) {
2918
+ function Vt(t) {
2918
2919
  var e;
2919
- return !!(C(t) || ee(t) || he(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof K && ot.includes((e = t.op) == null ? void 0 : e.value) && ee(t.expression) || t instanceof ce);
2920
+ return !!(G(t) || K(t) || he(t) && ["true", "false", "null"].includes(t.expression.variable.value.toLowerCase()) || t instanceof ie && lt.includes((e = t.op) == null ? void 0 : e.value) && K(t.expression) || t instanceof ce);
2920
2921
  }
2921
- function ee(t) {
2922
+ function K(t) {
2922
2923
  var e;
2923
- return t instanceof G && t.expression instanceof ve && ((e = t.expression.literal) == null ? void 0 : e.kind) === h.NUMERIC_LITERAL;
2924
+ return t instanceof j && t.expression instanceof we && ((e = t.expression.literal) == null ? void 0 : e.kind) === h.NUMERIC_LITERAL;
2924
2925
  }
2925
- function Ct(t) {
2926
+ function Gt(t) {
2926
2927
  var n;
2927
- if (!(t instanceof K) || !Vt((n = t.op) == null ? void 0 : n.value))
2928
+ if (!(t instanceof ie) || !Bt((n = t.op) == null ? void 0 : n.value))
2928
2929
  return !1;
2929
2930
  const e = z(t.expression).unwrap_or(void 0);
2930
2931
  return e !== void 0 && e.length > 0;
2931
2932
  }
2932
- function Xt(t) {
2933
- return t instanceof fe && t.elementList.every(j);
2933
+ function Ct(t) {
2934
+ return t instanceof fe && t.elementList.every($);
2934
2935
  }
2935
2936
  function F(t) {
2936
2937
  var s;
@@ -2940,19 +2941,19 @@ function F(t) {
2940
2941
  for (const i of t.elementList) {
2941
2942
  if (!i.name)
2942
2943
  continue;
2943
- if (i.name instanceof G) {
2944
+ if (i.name instanceof j) {
2944
2945
  n.push(new l(o.INVALID_SETTINGS, "A setting name must be a stream of identifiers", i.name));
2945
2946
  continue;
2946
2947
  }
2947
- const a = (s = ge(i.name).unwrap_or(void 0)) == null ? void 0 : s.toLowerCase();
2948
+ const a = (s = ve(i.name).unwrap_or(void 0)) == null ? void 0 : s.toLowerCase();
2948
2949
  a && (e[a] === void 0 ? e[a] = [i] : e[a].push(i));
2949
2950
  }
2950
2951
  return new q(e, n);
2951
2952
  }
2952
- class Lt {
2953
+ class At {
2953
2954
  constructor(e, n) {
2954
2955
  this.ast = e, this.symbolFactory = n, this.publicSchemaSymbol = this.symbolFactory.create(Rt, {
2955
- symbolTable: new we()
2956
+ symbolTable: new ye()
2956
2957
  }), this.ast.symbol = this.publicSchemaSymbol, this.ast.symbol.declaration = this.ast;
2957
2958
  }
2958
2959
  validate() {
@@ -2967,7 +2968,7 @@ class Lt {
2967
2968
  );
2968
2969
  e.push(...a.validate());
2969
2970
  });
2970
- const n = this.ast.body.filter((s) => xe(s).unwrap_or(void 0) === I.Project);
2971
+ const n = this.ast.body.filter((s) => Ae(s).unwrap_or(void 0) === I.Project);
2971
2972
  return n.length > 1 && n.forEach((s) => e.push(new l(o.PROJECT_REDEFINED, "Only one project can exist", s))), new q(this.ast, e);
2972
2973
  }
2973
2974
  }
@@ -2979,56 +2980,52 @@ class de {
2979
2980
  this.bindSettingList(this.declarationNode.attributeList, this.settingList), this.bindBody();
2980
2981
  }
2981
2982
  bindSettingList(e, n) {
2982
- if (e)
2983
- for (const s of e.elementList) {
2984
- if (s.name instanceof G)
2985
- continue;
2986
- const i = ge(s.name).unwrap_or(void 0);
2987
- if (!i)
2988
- continue;
2989
- const a = n[i.toLowerCase()];
2990
- a != null && a.shouldBind && this.scanAndBind(s.value, a);
2991
- }
2983
+ e && e.elementList.forEach((s) => {
2984
+ if (s.name instanceof j)
2985
+ return;
2986
+ const i = ve(s.name).unwrap_or(void 0);
2987
+ if (!i)
2988
+ return;
2989
+ const a = n[i.toLowerCase()];
2990
+ a != null && a.shouldBind && this.scanAndBind(s.value, a);
2991
+ });
2992
2992
  }
2993
2993
  bindBody() {
2994
- var s, i;
2995
2994
  const e = this.declarationNode;
2996
2995
  if (!e.body)
2997
2996
  return;
2998
2997
  const { body: n } = e;
2999
- if (n instanceof re)
3000
- for (const a of n.body)
3001
- if (a instanceof y) {
3002
- if (((s = this.declarationNode.type) == null ? void 0 : s.value.toLowerCase()) === I.TablePartial && ((i = a.type) == null ? void 0 : i.value.toLowerCase()) === I.Indexes || !a.type)
3003
- continue;
3004
- const r = et(a);
3005
- new r(a, this.errors).bind();
3006
- } else
3007
- a instanceof v ? this.bindSubfield(a) : this.bindPartialInjection(a);
3008
- else
3009
- this.bindSubfield(n);
2998
+ n instanceof re ? n.body.forEach((s) => {
2999
+ if (s instanceof y) {
3000
+ if (!s.type || Ae(this.declarationNode).unwrap_or(null) === I.TablePartial && Ae(s).unwrap_or(null) === I.Indexes)
3001
+ return;
3002
+ const i = Xt(s);
3003
+ new i(s, this.errors).bind();
3004
+ } else
3005
+ s instanceof v ? this.bindSubfield(s) : this.bindPartialInjection(s);
3006
+ }) : this.bindSubfield(n);
3010
3007
  }
3011
3008
  bindSubfield(e) {
3012
3009
  const n = [e.callee, ...e.args], s = _.last(n);
3013
- s instanceof R && (n.pop(), this.bindSettingList(s, this.subfield.settingList));
3010
+ s instanceof U && (n.pop(), this.bindSettingList(s, this.subfield.settingList));
3014
3011
  const { argBinderRules: i } = this.subfield.arg;
3015
3012
  for (let a = 0; a < Math.min(n.length, i.length); a += 1)
3016
3013
  i[a].shouldBind && this.scanAndBind(n[a], i[a]);
3017
3014
  }
3018
3015
  bindPartialInjection(e) {
3019
3016
  var n;
3020
- (n = this.subfield.injection) != null && n.injectionBinderRule.shouldBind && this.scanAndBind(e, this.subfield.injection.injectionBinderRule);
3017
+ (n = this.injectionBinderRule) != null && n.shouldBind && this.scanAndBind(e, this.injectionBinderRule);
3021
3018
  }
3022
3019
  // Scan for variable node and member access expression in the node to bind
3023
3020
  scanAndBind(e, n) {
3024
3021
  var s, i;
3025
3022
  if (e)
3026
- if (e instanceof G) {
3023
+ if (e instanceof j) {
3027
3024
  if (e.expression instanceof ae && ((i = n.keywords) != null && i.includes((s = e.expression.variable) == null ? void 0 : s.value.toLowerCase())))
3028
3025
  return;
3029
3026
  this.bindFragments([e], n);
3030
3027
  } else
3031
- e instanceof le ? qe(e) ? this.bindFragments(_e(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof K ? this.scanAndBind(e.expression, n) : e instanceof je ? this.scanAndBind(e.expression, n) : e instanceof fe ? e.elementList.forEach((a) => this.scanAndBind(a, n)) : e instanceof Le && this.bindFragments([e], n);
3028
+ e instanceof le ? qe(e) ? this.bindFragments(_e(e).unwrap_or([]), n) : (this.scanAndBind(e.leftExpression, n), this.scanAndBind(e.rightExpression, n)) : e instanceof ie ? this.scanAndBind(e.expression, n) : e instanceof $e ? this.scanAndBind(e.expression, n) : e instanceof fe ? e.elementList.forEach((a) => this.scanAndBind(a, n)) : e instanceof Le && this.bindFragments([e], n);
3032
3029
  }
3033
3030
  // Bind the fragments of a member access expression
3034
3031
  // which can be a simple expression like v1.User,
@@ -3036,7 +3033,7 @@ class de {
3036
3033
  bindFragments(e, n) {
3037
3034
  if (e.length === 0)
3038
3035
  return;
3039
- const s = e[0] instanceof Le, i = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: a } = n, r = s ? -1 : e.findIndex((E) => !j(E)), f = r !== -1 && Xt(e[r]) ? e[r] : void 0, p = r >= 0 ? i.pop() : void 0, d = e.slice(
3036
+ const s = e.length === 1 && e[0] instanceof Le, i = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: a } = n, r = s ? -1 : e.findIndex((E) => !$(E)), f = r !== -1 && Ct(e[r]) ? e[r] : void 0, p = r >= 0 ? i.pop() : void 0, d = e.slice(
3040
3037
  0,
3041
3038
  r === -1 ? void 0 : r
3042
3039
  );
@@ -3044,41 +3041,39 @@ class de {
3044
3041
  return;
3045
3042
  const u = [];
3046
3043
  for (; i.length && d.length; ) {
3047
- const E = i.pop(), b = d.pop(), g = $(b).unwrap();
3044
+ const E = i.pop(), b = d.pop(), g = X(b).unwrap();
3048
3045
  u.unshift({
3049
3046
  index: Me(g, E),
3050
3047
  referrer: b
3051
3048
  });
3052
3049
  }
3053
3050
  for (; d.length; ) {
3054
- const E = d.pop(), b = s ? E.partial.variable.value : $(E).unwrap();
3051
+ const E = d.pop(), b = s ? Mn(E).unwrap() : X(E).unwrap();
3055
3052
  u.unshift({
3056
3053
  index: Me(b, a),
3057
3054
  referrer: E
3058
3055
  });
3059
3056
  }
3060
- return f ? f.elementList.forEach(
3061
- (E) => this.resolveIndexStack(
3062
- [
3063
- ...u,
3064
- {
3065
- index: Me(
3066
- $(E).unwrap(),
3067
- p
3068
- ),
3069
- referrer: E
3070
- }
3071
- ],
3072
- n.ignoreNameNotFound
3073
- )
3074
- ) : this.resolveIndexStack(u, n.ignoreNameNotFound);
3057
+ return f ? f.elementList.forEach((E) => this.resolveIndexStack(
3058
+ [
3059
+ ...u,
3060
+ {
3061
+ index: Me(
3062
+ X(E).unwrap(),
3063
+ p
3064
+ ),
3065
+ referrer: E
3066
+ }
3067
+ ],
3068
+ n.ignoreNameNotFound
3069
+ )) : this.resolveIndexStack(u, n.ignoreNameNotFound);
3075
3070
  }
3076
3071
  // Looking up the indexes in the subname stack from the current declaration node
3077
3072
  // Each time the index resolves to a symbol, the referrer's symbol is bound to it
3078
3073
  resolveIndexStack(e, n) {
3079
3074
  if (e.length === 0)
3080
3075
  throw new Error("Unreachable - An unresolved name must have at least one name component");
3081
- const [s, ...i] = e, a = It(s.index, this.declarationNode);
3076
+ const [s, ...i] = e, a = Lt(s.index, this.declarationNode);
3082
3077
  if (a === void 0) {
3083
3078
  const { kind: p, name: d } = oe(s.index).unwrap();
3084
3079
  this.logError(s.referrer, `Can not find ${p} '${d}'`, n);
@@ -3111,20 +3106,23 @@ class de {
3111
3106
  return;
3112
3107
  const s = /* @__PURE__ */ new Map();
3113
3108
  n.forEach((a, r) => {
3114
- var c, f, p;
3115
- if (hn(r)) {
3116
- const d = It(fn(r), this.declarationNode);
3117
- (p = (f = (c = d == null ? void 0 : d.declaration) == null ? void 0 : c.symbol) == null ? void 0 : f.symbolTable) == null || p.forEach((u, E) => {
3118
- n.has(E) || s.set(E, u);
3119
- });
3120
- }
3109
+ var p, d;
3110
+ if (!un(r))
3111
+ return;
3112
+ const c = Lt(hn(r), this.declarationNode), f = (d = (p = c == null ? void 0 : c.declaration) == null ? void 0 : p.symbol) == null ? void 0 : d.symbolTable;
3113
+ f && f.forEach((u, E) => {
3114
+ n.has(E) || s.set(E, { injectorFieldSymbol: u, injectorDeclaration: a.declaration });
3115
+ });
3121
3116
  }), s.forEach((a, r) => {
3122
- const c = e.create(_n, { injectorId: a.id });
3123
- n.set(r, c);
3117
+ const c = Ln(a.injectorFieldSymbol);
3118
+ if (!c)
3119
+ return;
3120
+ const f = e.create(c, a);
3121
+ n.set(r, f);
3124
3122
  });
3125
3123
  }
3126
3124
  }
3127
- class Zn extends de {
3125
+ class Kn extends de {
3128
3126
  constructor() {
3129
3127
  super(...arguments), this.subfield = {
3130
3128
  arg: {
@@ -3134,7 +3132,7 @@ class Zn extends de {
3134
3132
  }, this.settingList = {};
3135
3133
  }
3136
3134
  }
3137
- class Kn extends de {
3135
+ class es extends de {
3138
3136
  constructor() {
3139
3137
  super(...arguments), this.subfield = {
3140
3138
  arg: {
@@ -3144,7 +3142,7 @@ class Kn extends de {
3144
3142
  }, this.settingList = {};
3145
3143
  }
3146
3144
  }
3147
- class es extends de {
3145
+ class ts extends de {
3148
3146
  constructor() {
3149
3147
  super(...arguments), this.subfield = {
3150
3148
  arg: {
@@ -3179,7 +3177,7 @@ class es extends de {
3179
3177
  }, this.settingList = {};
3180
3178
  }
3181
3179
  }
3182
- class ts extends de {
3180
+ class ns extends de {
3183
3181
  constructor() {
3184
3182
  super(...arguments), this.subfield = {
3185
3183
  arg: {
@@ -3189,7 +3187,7 @@ class ts extends de {
3189
3187
  }, this.settingList = {};
3190
3188
  }
3191
3189
  }
3192
- class ns extends de {
3190
+ class ss extends de {
3193
3191
  constructor() {
3194
3192
  super(...arguments), this.subfield = {
3195
3193
  arg: {
@@ -3199,7 +3197,7 @@ class ns extends de {
3199
3197
  }, this.settingList = {};
3200
3198
  }
3201
3199
  }
3202
- class ss extends de {
3200
+ class is extends de {
3203
3201
  constructor() {
3204
3202
  super(...arguments), this.subfield = {
3205
3203
  arg: {
@@ -3216,7 +3214,7 @@ class ss extends de {
3216
3214
  }, this.settingList = {};
3217
3215
  }
3218
3216
  }
3219
- class is extends de {
3217
+ class as extends de {
3220
3218
  constructor() {
3221
3219
  super(...arguments), this.subfield = {
3222
3220
  arg: {
@@ -3230,14 +3228,6 @@ class is extends de {
3230
3228
  }
3231
3229
  ]
3232
3230
  },
3233
- injection: {
3234
- injectionBinderRule: {
3235
- shouldBind: !0,
3236
- topSubnamesSymbolKind: [],
3237
- remainingSubnamesSymbolKind: m.TablePartial,
3238
- ignoreNameNotFound: !1
3239
- }
3240
- },
3241
3231
  settingList: {
3242
3232
  ref: {
3243
3233
  shouldBind: !0,
@@ -3249,10 +3239,15 @@ class is extends de {
3249
3239
  shouldBind: !1
3250
3240
  }
3251
3241
  }
3252
- }, this.settingList = {};
3242
+ }, this.settingList = {}, this.injectionBinderRule = {
3243
+ shouldBind: !0,
3244
+ topSubnamesSymbolKind: [],
3245
+ remainingSubnamesSymbolKind: m.TablePartial,
3246
+ ignoreNameNotFound: !1
3247
+ };
3253
3248
  }
3254
3249
  }
3255
- class as extends de {
3250
+ class rs extends de {
3256
3251
  constructor() {
3257
3252
  super(...arguments), this.subfield = {
3258
3253
  arg: {
@@ -3269,7 +3264,7 @@ class as extends de {
3269
3264
  }, this.settingList = {};
3270
3265
  }
3271
3266
  }
3272
- class rs extends de {
3267
+ class os extends de {
3273
3268
  constructor() {
3274
3269
  super(...arguments), this.subfield = {
3275
3270
  arg: {
@@ -3297,48 +3292,42 @@ class rs extends de {
3297
3292
  }, this.settingList = {};
3298
3293
  }
3299
3294
  }
3300
- function et(t) {
3295
+ function Xt(t) {
3301
3296
  switch (t.type.value.toLowerCase()) {
3302
3297
  case I.Enum:
3303
- return Kn;
3298
+ return es;
3304
3299
  case I.Table:
3305
- return is;
3306
- case I.TableGroup:
3307
3300
  return as;
3301
+ case I.TableGroup:
3302
+ return rs;
3308
3303
  case I.Project:
3309
- return ns;
3310
- case I.Ref:
3311
3304
  return ss;
3305
+ case I.Ref:
3306
+ return is;
3312
3307
  case I.Note:
3313
- return ts;
3308
+ return ns;
3314
3309
  case I.Indexes:
3315
- return es;
3310
+ return ts;
3316
3311
  case I.TablePartial:
3317
- return rs;
3312
+ return os;
3318
3313
  default:
3319
- return Zn;
3314
+ return Kn;
3320
3315
  }
3321
3316
  }
3322
- class os {
3317
+ class ls {
3323
3318
  constructor(e) {
3324
3319
  this.ast = e, this.errors = [];
3325
3320
  }
3326
3321
  resolve(e) {
3327
- this.ast.body.forEach((n) => {
3328
- if (n.type) {
3329
- const s = et(n);
3330
- new s(n, this.errors).resolveInjections(e);
3331
- }
3332
- });
3333
- for (const n of this.ast.body)
3334
- if (n.type) {
3335
- const s = et(n);
3336
- new s(n, this.errors).bind();
3337
- }
3338
- return new q(this.ast, this.errors);
3322
+ return this.ast.body.map((n) => {
3323
+ if (!n.type)
3324
+ return null;
3325
+ const s = Xt(n), i = new s(n, this.errors);
3326
+ return i.resolveInjections(e), i;
3327
+ }).forEach((n) => n == null ? void 0 : n.bind()), new q(this.ast, this.errors);
3339
3328
  }
3340
3329
  }
3341
- class ls {
3330
+ class cs {
3342
3331
  constructor(e) {
3343
3332
  this.generator = e;
3344
3333
  }
@@ -3346,21 +3335,21 @@ class ls {
3346
3335
  return new e(n, this.generator.nextId());
3347
3336
  }
3348
3337
  }
3349
- class cs {
3338
+ class us {
3350
3339
  constructor(e, n) {
3351
- this.ast = e, this.symbolFactory = new ls(n);
3340
+ this.ast = e, this.symbolFactory = new cs(n);
3352
3341
  }
3353
3342
  // Analyzing: Invoking both the validator and binder
3354
3343
  analyze() {
3355
- return new Lt(this.ast, this.symbolFactory).validate().chain((n) => new os(n).resolve(this.symbolFactory));
3344
+ return new At(this.ast, this.symbolFactory).validate().chain((n) => new ls(n).resolve(this.symbolFactory));
3356
3345
  }
3357
3346
  // For invoking the validator only
3358
3347
  validate() {
3359
- return new Lt(this.ast, this.symbolFactory).validate().chain((n) => new q(n, []));
3348
+ return new At(this.ast, this.symbolFactory).validate().chain((n) => new q(n, []));
3360
3349
  }
3361
3350
  }
3362
3351
  function _t(t, e) {
3363
- const { variables: n, tupleElements: s } = Se(t).unwrap();
3352
+ const { variables: n, tupleElements: s } = Pe(t).unwrap();
3364
3353
  return s ? n.length === 0 ? {
3365
3354
  schemaName: e.schemaName,
3366
3355
  tableName: e.name,
@@ -3379,7 +3368,7 @@ function _t(t, e) {
3379
3368
  schemaName: n.pop() || null
3380
3369
  };
3381
3370
  }
3382
- function $t(t) {
3371
+ function jt(t) {
3383
3372
  switch (t) {
3384
3373
  case "<":
3385
3374
  return ["1", "*"];
@@ -3417,7 +3406,7 @@ function Te(t) {
3417
3406
  function De(t) {
3418
3407
  return t.expression.literal.value;
3419
3408
  }
3420
- function jt(t, e) {
3409
+ function $t(t, e) {
3421
3410
  if (Array.isArray(t)) {
3422
3411
  const i = t.map(({ id: r }) => r).sort().join(","), a = e.map(({ id: r }) => r).sort().join(",");
3423
3412
  return i < a ? `${i}-${a}` : `${a}-${i}`;
@@ -3425,7 +3414,7 @@ function jt(t, e) {
3425
3414
  const n = t.id.toString(), s = e.id.toString();
3426
3415
  return n < s ? `${n}-${s}` : `${s}-${n}`;
3427
3416
  }
3428
- function lt(t, e) {
3417
+ function ct(t, e) {
3429
3418
  if (Array.isArray(t)) {
3430
3419
  const i = t.map(({ id: r }) => r).sort(), a = e.map(({ id: r }) => r).sort();
3431
3420
  return _.zip(i, a).every(([r, c]) => r === c);
@@ -3433,7 +3422,7 @@ function lt(t, e) {
3433
3422
  const n = t.id, s = e.id;
3434
3423
  return n === s;
3435
3424
  }
3436
- function ie(t) {
3425
+ function se(t) {
3437
3426
  const e = t.split(`
3438
3427
  `), n = e.slice(e.findIndex((a) => a.trimStart() !== "")), s = n.filter((a) => a.trimStart()), i = Math.min(...s.map((a) => a.length - a.trimStart().length));
3439
3428
  return n.map((a) => a.slice(i)).join(`
@@ -3469,7 +3458,7 @@ class Wt {
3469
3458
  interpretAlias(e) {
3470
3459
  if (!e)
3471
3460
  return [];
3472
- const n = $(e).unwrap_or(null);
3461
+ const n = X(e).unwrap_or(null);
3473
3462
  return n && (this.env.aliases.push({
3474
3463
  name: n,
3475
3464
  kind: "table",
@@ -3485,7 +3474,7 @@ class Wt {
3485
3474
  this.table.headerColor = (i = n.headercolor) != null && i.length ? De((r = (a = n.headercolor) == null ? void 0 : a.at(0)) == null ? void 0 : r.value) : void 0;
3486
3475
  const [s] = n.note || [];
3487
3476
  return this.table.note = s && {
3488
- value: M(s == null ? void 0 : s.value).map(ie).unwrap(),
3477
+ value: M(s == null ? void 0 : s.value).map(se).unwrap(),
3489
3478
  token: L(s)
3490
3479
  }, [];
3491
3480
  }
@@ -3502,7 +3491,7 @@ class Wt {
3502
3491
  switch ((s = n.type) == null ? void 0 : s.value.toLowerCase()) {
3503
3492
  case "note":
3504
3493
  return this.table.note = {
3505
- value: M(n.body instanceof re ? n.body.body[0].callee : n.body.callee).map(ie).unwrap(),
3494
+ value: M(n.body instanceof re ? n.body.body[0].callee : n.body.callee).map(se).unwrap(),
3506
3495
  token: L(n)
3507
3496
  }, [];
3508
3497
  case "indexes":
@@ -3521,65 +3510,65 @@ class Wt {
3521
3510
  interpretColumn(e) {
3522
3511
  var r, c, f, p, d, u, E, b, g;
3523
3512
  const n = [], s = {};
3524
- s.name = $(e.callee).unwrap();
3525
- const i = us(e.args[0]);
3513
+ s.name = X(e.callee).unwrap();
3514
+ const i = hs(e.args[0]);
3526
3515
  s.type = i.getValue(), n.push(...i.getErrors()), s.token = L(e), s.inline_refs = [];
3527
3516
  const a = e.args.slice(1);
3528
- if (_.last(a) instanceof R) {
3517
+ if (_.last(a) instanceof U) {
3529
3518
  const A = F(a.pop()).getValue();
3530
- s.pk = !!((r = A.pk) != null && r.length) || !!((c = A["primary key"]) != null && c.length), s.increment = !!((f = A.increment) != null && f.length), s.unique = !!((p = A.unique) != null && p.length), s.not_null = (d = A["not null"]) != null && d.length ? !0 : (u = A.null) != null && u.length ? !1 : void 0, s.dbdefault = hs((b = (E = A.default) == null ? void 0 : E.at(0)) == null ? void 0 : b.value);
3519
+ s.pk = !!((r = A.pk) != null && r.length) || !!((c = A["primary key"]) != null && c.length), s.increment = !!((f = A.increment) != null && f.length), s.unique = !!((p = A.unique) != null && p.length), s.not_null = (d = A["not null"]) != null && d.length ? !0 : (u = A.null) != null && u.length ? !1 : void 0, s.dbdefault = fs((b = (E = A.default) == null ? void 0 : E.at(0)) == null ? void 0 : b.value);
3531
3520
  const k = (g = A.note) == null ? void 0 : g.at(0);
3532
3521
  s.note = k && {
3533
- value: M(k.value).map(ie).unwrap(),
3522
+ value: M(k.value).map(se).unwrap(),
3534
3523
  token: L(k)
3535
3524
  };
3536
3525
  const be = A.ref || [];
3537
- s.inline_refs = be.flatMap((S) => {
3538
- const [Re] = Ce(S.value.expression);
3539
- if (lt(Re, e.symbol))
3540
- return n.push(new l(o.SAME_ENDPOINT, "Two endpoints are the same", S)), [];
3541
- const Ee = S.value.op, V = z(S.value.expression).unwrap();
3542
- let te;
3543
- if (V.length === 1) {
3544
- const [Q] = V;
3545
- te = {
3526
+ s.inline_refs = be.flatMap((P) => {
3527
+ const [Re] = Ce(P.value.expression);
3528
+ if (ct(Re, e.symbol))
3529
+ return n.push(new l(o.SAME_ENDPOINT, "Two endpoints are the same", P)), [];
3530
+ const Ee = P.value.op, B = z(P.value.expression).unwrap();
3531
+ let ee;
3532
+ if (B.length === 1) {
3533
+ const [Q] = B;
3534
+ ee = {
3546
3535
  schemaName: this.table.schemaName,
3547
3536
  tableName: this.table.name,
3548
3537
  fieldNames: [Q],
3549
3538
  relation: Ee.value,
3550
- token: L(S)
3539
+ token: L(P)
3551
3540
  };
3552
- } else if (V.length === 2) {
3553
- const [Q, me] = V;
3554
- te = {
3541
+ } else if (B.length === 2) {
3542
+ const [Q, me] = B;
3543
+ ee = {
3555
3544
  schemaName: null,
3556
3545
  tableName: Q,
3557
3546
  fieldNames: [me],
3558
3547
  relation: Ee.value,
3559
- token: L(S)
3548
+ token: L(P)
3560
3549
  };
3561
- } else if (V.length === 3) {
3562
- const [Q, me, ht] = V;
3563
- te = {
3550
+ } else if (B.length === 3) {
3551
+ const [Q, me, ft] = B;
3552
+ ee = {
3564
3553
  schemaName: Q,
3565
3554
  tableName: me,
3566
- fieldNames: [ht],
3555
+ fieldNames: [ft],
3567
3556
  relation: Ee.value,
3568
- token: L(S)
3557
+ token: L(P)
3569
3558
  };
3570
3559
  } else {
3571
- n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", S));
3572
- const Q = V.pop(), me = V.pop();
3573
- te = {
3574
- schemaName: V.join("."),
3560
+ n.push(new l(o.UNSUPPORTED, "Nested schema is not supported", P));
3561
+ const Q = B.pop(), me = B.pop();
3562
+ ee = {
3563
+ schemaName: B.join("."),
3575
3564
  tableName: me,
3576
3565
  fieldNames: [Q],
3577
3566
  relation: Ee.value,
3578
- token: L(S)
3567
+ token: L(P)
3579
3568
  };
3580
3569
  }
3581
- const Ne = this.registerInlineRefToEnv(e, Re, te, S);
3582
- return n.push(...Ne), Ne.length === 0 ? te : [];
3570
+ const Ne = this.registerInlineRefToEnv(e, Re, ee, P);
3571
+ return n.push(...Ne), Ne.length === 0 ? ee : [];
3583
3572
  });
3584
3573
  }
3585
3574
  return s.pk || (s.pk = a.some((A) => W(A).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = a.some((A) => W(A).unwrap().toLowerCase() === "unique")), this.table.fields.push(s), s.pk && this.pkColumns.push(s), n;
@@ -3590,7 +3579,7 @@ class Wt {
3590
3579
  const s = { columns: [] }, i = n;
3591
3580
  s.token = L(i);
3592
3581
  const a = [i.callee, ...i.args];
3593
- if (_.last(a) instanceof R) {
3582
+ if (_.last(a) instanceof U) {
3594
3583
  const b = F(a.pop()).getValue();
3595
3584
  s.pk = !!((r = b.pk) != null && r.length), s.unique = !!((c = b.unique) != null && c.length), s.name = M((p = (f = b.name) == null ? void 0 : f.at(0)) == null ? void 0 : p.value).unwrap_or(void 0);
3596
3585
  const g = (d = b.note) == null ? void 0 : d.at(0);
@@ -3615,7 +3604,7 @@ class Wt {
3615
3604
  token: L(k)
3616
3605
  })),
3617
3606
  ...A.map((k) => ({
3618
- value: $(k).unwrap(),
3607
+ value: X(k).unwrap(),
3619
3608
  type: "column",
3620
3609
  token: L(k)
3621
3610
  }))
@@ -3624,13 +3613,13 @@ class Wt {
3624
3613
  })), [];
3625
3614
  }
3626
3615
  registerInlineRefToEnv(e, n, s, i) {
3627
- const a = jt(e.symbol, n);
3616
+ const a = $t(e.symbol, n);
3628
3617
  if (this.env.refIds[a])
3629
3618
  return [
3630
3619
  new l(o.CIRCULAR_REF, "References with same endpoints exist", i),
3631
3620
  new l(o.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[a])
3632
3621
  ];
3633
- const r = $t(s.relation);
3622
+ const r = jt(s.relation);
3634
3623
  return this.env.refIds[a] = i, this.env.ref.set(i, {
3635
3624
  name: null,
3636
3625
  schemaName: null,
@@ -3651,9 +3640,9 @@ class Wt {
3651
3640
  }), [];
3652
3641
  }
3653
3642
  }
3654
- function us(t) {
3643
+ function hs(t) {
3655
3644
  let e = null;
3656
- t instanceof Y && (e = t.argumentList.elementList.map((a) => ee(a) ? a.expression.literal.value : C(a) ? M(a).unwrap() : W(a).unwrap()).join(","), t = t.callee);
3645
+ t instanceof Y && (e = t.argumentList.elementList.map((a) => K(a) ? a.expression.literal.value : G(a) ? M(a).unwrap() : W(a).unwrap()).join(","), t = t.callee);
3657
3646
  let n = "";
3658
3647
  for (; t instanceof ue; )
3659
3648
  n = `[${t.indexer.elementList.map((a) => a.name.expression.literal.value).join(",")}]${n}`, t = t.array;
@@ -3671,15 +3660,15 @@ function us(t) {
3671
3660
  args: e
3672
3661
  });
3673
3662
  }
3674
- function hs(t) {
3663
+ function fs(t) {
3675
3664
  var e, n, s;
3676
3665
  if (t) {
3677
- if (C(t))
3666
+ if (G(t))
3678
3667
  return {
3679
3668
  value: M(t).unwrap(),
3680
3669
  type: "string"
3681
3670
  };
3682
- if (ee(t))
3671
+ if (K(t))
3683
3672
  return {
3684
3673
  type: "number",
3685
3674
  value: Number.parseFloat(t.expression.literal.value)
@@ -3689,7 +3678,7 @@ function hs(t) {
3689
3678
  value: t.expression.variable.value.toLowerCase(),
3690
3679
  type: "boolean"
3691
3680
  };
3692
- if (t instanceof K && ot.includes((e = t.op) == null ? void 0 : e.value) && ee(t.expression)) {
3681
+ if (t instanceof ie && lt.includes((e = t.op) == null ? void 0 : e.value) && K(t.expression)) {
3693
3682
  const i = Number.parseFloat(t.expression.expression.literal.value);
3694
3683
  return {
3695
3684
  value: ((n = t.op) == null ? void 0 : n.value) === "-" ? 0 - i : i,
@@ -3704,7 +3693,7 @@ function hs(t) {
3704
3693
  throw new Error("Unreachable");
3705
3694
  }
3706
3695
  }
3707
- class fs {
3696
+ class ps {
3708
3697
  constructor(e, n) {
3709
3698
  this.declarationNode = e, this.env = n, this.note = { name: void 0, content: void 0, token: void 0 };
3710
3699
  }
@@ -3732,7 +3721,7 @@ class fs {
3732
3721
  }
3733
3722
  interpretNote(e) {
3734
3723
  const n = _.get(e, "callee.expression.literal.value", "");
3735
- return this.note.content = ie(n), [];
3724
+ return this.note.content = se(n), [];
3736
3725
  }
3737
3726
  }
3738
3727
  class Yt {
@@ -3755,9 +3744,9 @@ class Yt {
3755
3744
  interpretField(e) {
3756
3745
  var p, d, u, E, b, g, A;
3757
3746
  const n = e.callee.op.value, { leftExpression: s, rightExpression: i } = e.callee, a = Ce(s), r = Ce(i);
3758
- if (lt(a, r))
3747
+ if (ct(a, r))
3759
3748
  return [new l(o.SAME_ENDPOINT, "Two endpoints are the same", e)];
3760
- const c = jt(a, r);
3749
+ const c = $t(a, r);
3761
3750
  if (this.env.refIds[c])
3762
3751
  return [
3763
3752
  new l(o.CIRCULAR_REF, "References with same endpoints exist", this.declarationNode),
@@ -3765,11 +3754,11 @@ class Yt {
3765
3754
  ];
3766
3755
  if (e.args[0]) {
3767
3756
  const k = F(e.args[0]).getValue(), be = (d = (p = k.delete) == null ? void 0 : p.at(0)) == null ? void 0 : d.value;
3768
- this.ref.onDelete = be instanceof ne ? ge(be).unwrap_or(void 0) : W(be).unwrap_or(void 0);
3769
- const S = (E = (u = k.update) == null ? void 0 : u.at(0)) == null ? void 0 : E.value;
3770
- this.ref.onUpdate = S instanceof ne ? ge(S).unwrap_or(void 0) : W(S).unwrap_or(void 0), this.ref.color = (b = k.color) != null && b.length ? De((A = (g = k.color) == null ? void 0 : g.at(0)) == null ? void 0 : A.value) : void 0;
3757
+ this.ref.onDelete = be instanceof te ? ve(be).unwrap_or(void 0) : W(be).unwrap_or(void 0);
3758
+ const P = (E = (u = k.update) == null ? void 0 : u.at(0)) == null ? void 0 : E.value;
3759
+ this.ref.onUpdate = P instanceof te ? ve(P).unwrap_or(void 0) : W(P).unwrap_or(void 0), this.ref.color = (b = k.color) != null && b.length ? De((A = (g = k.color) == null ? void 0 : g.at(0)) == null ? void 0 : A.value) : void 0;
3771
3760
  }
3772
- const f = $t(n);
3761
+ const f = jt(n);
3773
3762
  return this.ref.endpoints = [
3774
3763
  {
3775
3764
  ..._t(s, this.container),
@@ -3815,7 +3804,7 @@ class qt {
3815
3804
  this.tableGroup.note = {
3816
3805
  value: M(
3817
3806
  n.body instanceof re ? n.body.body[0].callee : n.body.callee
3818
- ).map(ie).unwrap(),
3807
+ ).map(se).unwrap(),
3819
3808
  token: L(n)
3820
3809
  };
3821
3810
  break;
@@ -3846,7 +3835,7 @@ class qt {
3846
3835
  this.tableGroup.color = (i = n.color) != null && i.length ? De((r = (a = n.color) == null ? void 0 : a.at(0)) == null ? void 0 : r.value) : void 0;
3847
3836
  const [s] = n.note || [];
3848
3837
  return this.tableGroup.note = s && {
3849
- value: M(s == null ? void 0 : s.value).map(ie).unwrap(),
3838
+ value: M(s == null ? void 0 : s.value).map(se).unwrap(),
3850
3839
  token: L(s)
3851
3840
  }, [];
3852
3841
  }
@@ -3869,7 +3858,7 @@ class zt {
3869
3858
  i.token = L(s), i.name = W(s.callee).unwrap();
3870
3859
  const r = (c = F(s.args[0]).getValue().note) == null ? void 0 : c.at(0);
3871
3860
  return i.note = r && {
3872
- value: M(r.value).map(ie).unwrap(),
3861
+ value: M(r.value).map(se).unwrap(),
3873
3862
  token: L(r)
3874
3863
  }, this.enum.values.push(i), [];
3875
3864
  });
@@ -3907,7 +3896,7 @@ class Qt {
3907
3896
  this.tablePartial.headerColor = (i = n.headercolor) != null && i.length ? De((r = (a = n.headercolor) == null ? void 0 : a.at(0)) == null ? void 0 : r.value) : void 0;
3908
3897
  const [s] = n.note || [];
3909
3898
  return this.tablePartial.note = s && {
3910
- value: M(s == null ? void 0 : s.value).map(ie).unwrap(),
3899
+ value: M(s == null ? void 0 : s.value).map(se).unwrap(),
3911
3900
  token: L(s)
3912
3901
  }, [];
3913
3902
  }
@@ -3921,7 +3910,7 @@ class Qt {
3921
3910
  switch ((s = n.type) == null ? void 0 : s.value.toLowerCase()) {
3922
3911
  case "note":
3923
3912
  return this.tablePartial.note = {
3924
- value: M(n.body instanceof re ? n.body.body[0].callee : n.body.callee).map(ie).unwrap(),
3913
+ value: M(n.body instanceof re ? n.body.body[0].callee : n.body.callee).map(se).unwrap(),
3925
3914
  token: L(n)
3926
3915
  }, [];
3927
3916
  case "indexes":
@@ -3936,55 +3925,55 @@ class Qt {
3936
3925
  interpretColumn(e) {
3937
3926
  var r, c, f, p, d, u, E, b, g;
3938
3927
  const n = [], s = {};
3939
- s.name = $(e.callee).unwrap();
3940
- const i = ps(e.args[0]);
3928
+ s.name = X(e.callee).unwrap();
3929
+ const i = ds(e.args[0]);
3941
3930
  s.type = i.getValue(), n.push(...i.getErrors()), s.token = L(e), s.inline_refs = [];
3942
3931
  const a = e.args.slice(1);
3943
- if (_.last(a) instanceof R) {
3932
+ if (_.last(a) instanceof U) {
3944
3933
  const A = F(a.pop()).getValue();
3945
- s.pk = !!((r = A.pk) != null && r.length) || !!((c = A["primary key"]) != null && c.length), s.increment = !!((f = A.increment) != null && f.length), s.unique = !!((p = A.unique) != null && p.length), s.not_null = (d = A["not null"]) != null && d.length ? !0 : (u = A.null) != null && u.length ? !1 : void 0, s.dbdefault = ds((b = (E = A.default) == null ? void 0 : E.at(0)) == null ? void 0 : b.value);
3934
+ s.pk = !!((r = A.pk) != null && r.length) || !!((c = A["primary key"]) != null && c.length), s.increment = !!((f = A.increment) != null && f.length), s.unique = !!((p = A.unique) != null && p.length), s.not_null = (d = A["not null"]) != null && d.length ? !0 : (u = A.null) != null && u.length ? !1 : void 0, s.dbdefault = Es((b = (E = A.default) == null ? void 0 : E.at(0)) == null ? void 0 : b.value);
3946
3935
  const k = (g = A.note) == null ? void 0 : g.at(0);
3947
3936
  s.note = k && {
3948
- value: M(k.value).map(ie).unwrap(),
3937
+ value: M(k.value).map(se).unwrap(),
3949
3938
  token: L(k)
3950
3939
  };
3951
3940
  const be = A.ref || [];
3952
- s.inline_refs = be.flatMap((S) => {
3953
- const [Re] = Ce(S.value.expression);
3954
- if (lt(Re, e.symbol))
3955
- return n.push(new l(o.SAME_ENDPOINT, "Two endpoints are the same", S)), [];
3956
- const Ee = S.value.op, V = z(S.value.expression).unwrap();
3957
- let te;
3958
- if (V.length === 2) {
3959
- const [Ne, Q] = V;
3960
- te = {
3941
+ s.inline_refs = be.flatMap((P) => {
3942
+ const [Re] = Ce(P.value.expression);
3943
+ if (ct(Re, e.symbol))
3944
+ return n.push(new l(o.SAME_ENDPOINT, "Two endpoints are the same", P)), [];
3945
+ const Ee = P.value.op, B = z(P.value.expression).unwrap();
3946
+ let ee;
3947
+ if (B.length === 2) {
3948
+ const [Ne, Q] = B;
3949
+ ee = {
3961
3950
  schemaName: null,
3962
3951
  tableName: Ne,
3963
3952
  fieldNames: [Q],
3964
3953
  relation: Ee.value,
3965
- token: L(S)
3954
+ token: L(P)
3966
3955
  };
3967
- } else if (V.length === 3) {
3968
- const [Ne, Q, me] = V;
3969
- te = {
3956
+ } else if (B.length === 3) {
3957
+ const [Ne, Q, me] = B;
3958
+ ee = {
3970
3959
  schemaName: Ne,
3971
3960
  tableName: Q,
3972
3961
  fieldNames: [me],
3973
3962
  relation: Ee.value,
3974
- token: L(S)
3963
+ token: L(P)
3975
3964
  };
3976
3965
  } else {
3977
- n.push(new l(o.UNSUPPORTED, "Unsupported", S));
3978
- const Ne = V.pop(), Q = V.pop();
3979
- te = {
3980
- schemaName: V.join("."),
3966
+ n.push(new l(o.UNSUPPORTED, "Unsupported", P));
3967
+ const Ne = B.pop(), Q = B.pop();
3968
+ ee = {
3969
+ schemaName: B.join("."),
3981
3970
  tableName: Q,
3982
3971
  fieldNames: [Ne],
3983
3972
  relation: Ee.value,
3984
- token: L(S)
3973
+ token: L(P)
3985
3974
  };
3986
3975
  }
3987
- return te;
3976
+ return ee;
3988
3977
  });
3989
3978
  }
3990
3979
  return s.pk || (s.pk = a.some((A) => W(A).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = a.some((A) => W(A).unwrap().toLowerCase() === "unique")), this.tablePartial.fields.push(s), s.pk && this.pkColumns.push(s), n;
@@ -3995,7 +3984,7 @@ class Qt {
3995
3984
  const s = { columns: [] }, i = n;
3996
3985
  s.token = L(i);
3997
3986
  const a = [i.callee, ...i.args];
3998
- if (_.last(a) instanceof R) {
3987
+ if (_.last(a) instanceof U) {
3999
3988
  const b = F(a.pop()).getValue();
4000
3989
  s.pk = !!((r = b.pk) != null && r.length), s.unique = !!((c = b.unique) != null && c.length), s.name = M((p = (f = b.name) == null ? void 0 : f.at(0)) == null ? void 0 : p.value).unwrap_or(void 0);
4001
3990
  const g = (d = b.note) == null ? void 0 : d.at(0);
@@ -4020,7 +4009,7 @@ class Qt {
4020
4009
  token: L(k)
4021
4010
  })),
4022
4011
  ...A.map((k) => ({
4023
- value: $(k).unwrap(),
4012
+ value: X(k).unwrap(),
4024
4013
  type: "column",
4025
4014
  token: L(k)
4026
4015
  }))
@@ -4061,9 +4050,9 @@ class Qt {
4061
4050
  // return [];
4062
4051
  // }
4063
4052
  }
4064
- function ps(t) {
4053
+ function ds(t) {
4065
4054
  let e = null;
4066
- t instanceof Y && (e = t.argumentList.elementList.map((a) => ee(a) ? a.expression.literal.value : C(a) ? M(a).unwrap() : W(a).unwrap()).join(","), t = t.callee);
4055
+ t instanceof Y && (e = t.argumentList.elementList.map((a) => K(a) ? a.expression.literal.value : G(a) ? M(a).unwrap() : W(a).unwrap()).join(","), t = t.callee);
4067
4056
  let n = "";
4068
4057
  for (; t instanceof ue; )
4069
4058
  n = `[${t.indexer.elementList.map((a) => a.name.expression.literal.value).join(",")}]${n}`, t = t.array;
@@ -4081,15 +4070,15 @@ function ps(t) {
4081
4070
  args: e
4082
4071
  });
4083
4072
  }
4084
- function ds(t) {
4073
+ function Es(t) {
4085
4074
  var e, n, s;
4086
4075
  if (t) {
4087
- if (C(t))
4076
+ if (G(t))
4088
4077
  return {
4089
4078
  value: M(t).unwrap(),
4090
4079
  type: "string"
4091
4080
  };
4092
- if (ee(t))
4081
+ if (K(t))
4093
4082
  return {
4094
4083
  type: "number",
4095
4084
  value: Number.parseFloat(t.expression.literal.value)
@@ -4099,7 +4088,7 @@ function ds(t) {
4099
4088
  value: t.expression.variable.value.toLowerCase(),
4100
4089
  type: "boolean"
4101
4090
  };
4102
- if (t instanceof K && ot.includes((e = t.op) == null ? void 0 : e.value) && ee(t.expression)) {
4091
+ if (t instanceof ie && lt.includes((e = t.op) == null ? void 0 : e.value) && K(t.expression)) {
4103
4092
  const i = Number.parseFloat(t.expression.expression.literal.value);
4104
4093
  return {
4105
4094
  value: ((n = t.op) == null ? void 0 : n.value) === "-" ? 0 - i : i,
@@ -4114,7 +4103,7 @@ function ds(t) {
4114
4103
  throw new Error("Unreachable");
4115
4104
  }
4116
4105
  }
4117
- class Es {
4106
+ class Ns {
4118
4107
  constructor(e, n) {
4119
4108
  this.declarationNode = e, this.env = n, this.project = { enums: [], refs: [], tableGroups: [], tables: [], tablePartials: [] };
4120
4109
  }
@@ -4150,7 +4139,7 @@ class Es {
4150
4139
  }
4151
4140
  case "note":
4152
4141
  return this.project.note = {
4153
- value: M(s.body instanceof re ? s.body.body[0].callee : s.body.callee).map(ie).unwrap(),
4142
+ value: M(s.body instanceof re ? s.body.body[0].callee : s.body.callee).map(se).unwrap(),
4154
4143
  token: L(s)
4155
4144
  }, [];
4156
4145
  case "tablepartial": {
@@ -4163,7 +4152,7 @@ class Es {
4163
4152
  });
4164
4153
  }
4165
4154
  }
4166
- class Ns {
4155
+ class ms {
4167
4156
  constructor(e) {
4168
4157
  this.ast = e, this.env = {
4169
4158
  schema: [],
@@ -4181,11 +4170,11 @@ class Ns {
4181
4170
  }
4182
4171
  interpret() {
4183
4172
  const e = this.ast.body.flatMap((n) => {
4184
- switch (xe(n).unwrap_or(void 0)) {
4173
+ switch (Ae(n).unwrap_or(void 0)) {
4185
4174
  case I.Table:
4186
4175
  return new Wt(n, this.env).interpret();
4187
4176
  case I.Note:
4188
- return new fs(n, this.env).interpret();
4177
+ return new ps(n, this.env).interpret();
4189
4178
  case I.Ref:
4190
4179
  return new Yt(n, this.env).interpret();
4191
4180
  case I.TableGroup:
@@ -4195,15 +4184,15 @@ class Ns {
4195
4184
  case I.Enum:
4196
4185
  return new zt(n, this.env).interpret();
4197
4186
  case I.Project:
4198
- return new Es(n, this.env).interpret();
4187
+ return new Ns(n, this.env).interpret();
4199
4188
  default:
4200
4189
  return [];
4201
4190
  }
4202
4191
  });
4203
- return new q(ms(this.env), e);
4192
+ return new q(Ts(this.env), e);
4204
4193
  }
4205
4194
  }
4206
- function ms(t) {
4195
+ function Ts(t) {
4207
4196
  return {
4208
4197
  schemas: [],
4209
4198
  tables: Array.from(t.tables.values()),
@@ -4216,8 +4205,8 @@ function ms(t) {
4216
4205
  tablePartials: Array.from(t.tablePartials.values())
4217
4206
  };
4218
4207
  }
4219
- var w = /* @__PURE__ */ ((t) => (t[t.Function = 1] = "Function", t[t.Constructor = 2] = "Constructor", t[t.Field = 3] = "Field", t[t.Variable = 4] = "Variable", t[t.Class = 5] = "Class", t[t.Struct = 6] = "Struct", t[t.Interface = 7] = "Interface", t[t.Module = 8] = "Module", t[t.Property = 9] = "Property", t[t.Event = 10] = "Event", t[t.Operator = 11] = "Operator", t[t.Unit = 12] = "Unit", t[t.Value = 13] = "Value", t[t.Constant = 14] = "Constant", t[t.Enum = 15] = "Enum", t[t.EnumMember = 16] = "EnumMember", t[t.Keyword = 17] = "Keyword", t[t.Text = 18] = "Text", t[t.Color = 19] = "Color", t[t.File = 20] = "File", t[t.Reference = 21] = "Reference", t[t.Customcolor = 22] = "Customcolor", t[t.Folder = 23] = "Folder", t[t.TypeParameter = 24] = "TypeParameter", t[t.User = 25] = "User", t[t.Issue = 26] = "Issue", t[t.Snippet = 27] = "Snippet", t))(w || {}), P = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.KeepWhitespace = 1] = "KeepWhitespace", t[t.InsertAsSnippet = 4] = "InsertAsSnippet", t))(P || {});
4220
- function Pe(t) {
4208
+ var w = /* @__PURE__ */ ((t) => (t[t.Function = 1] = "Function", t[t.Constructor = 2] = "Constructor", t[t.Field = 3] = "Field", t[t.Variable = 4] = "Variable", t[t.Class = 5] = "Class", t[t.Struct = 6] = "Struct", t[t.Interface = 7] = "Interface", t[t.Module = 8] = "Module", t[t.Property = 9] = "Property", t[t.Event = 10] = "Event", t[t.Operator = 11] = "Operator", t[t.Unit = 12] = "Unit", t[t.Value = 13] = "Value", t[t.Constant = 14] = "Constant", t[t.Enum = 15] = "Enum", t[t.EnumMember = 16] = "EnumMember", t[t.Keyword = 17] = "Keyword", t[t.Text = 18] = "Text", t[t.Color = 19] = "Color", t[t.File = 20] = "File", t[t.Reference = 21] = "Reference", t[t.Customcolor = 22] = "Customcolor", t[t.Folder = 23] = "Folder", t[t.TypeParameter = 24] = "TypeParameter", t[t.User = 25] = "User", t[t.Issue = 26] = "Issue", t[t.Snippet = 27] = "Snippet", t))(w || {}), D = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.KeepWhitespace = 1] = "KeepWhitespace", t[t.InsertAsSnippet = 4] = "InsertAsSnippet", t))(D || {});
4209
+ function xe(t) {
4221
4210
  switch (t) {
4222
4211
  case m.Schema:
4223
4212
  return w.Module;
@@ -4248,12 +4237,12 @@ function Xe(t, e) {
4248
4237
  }
4249
4238
  return !0;
4250
4239
  }
4251
- function B() {
4240
+ function V() {
4252
4241
  return {
4253
4242
  suggestions: []
4254
4243
  };
4255
4244
  }
4256
- function $e(t) {
4245
+ function je(t) {
4257
4246
  return {
4258
4247
  ...t,
4259
4248
  suggestions: t.suggestions.map((e) => ({
@@ -4271,7 +4260,7 @@ function He(t) {
4271
4260
  }))
4272
4261
  };
4273
4262
  }
4274
- function ct(t, e) {
4263
+ function ut(t, e) {
4275
4264
  return t.getOffsetAt(e);
4276
4265
  }
4277
4266
  class Ht {
@@ -4280,29 +4269,29 @@ class Ht {
4280
4269
  }
4281
4270
  provideCompletionItems(e, n) {
4282
4271
  var d, u;
4283
- const s = ct(e, n), i = this.compiler.token.flatStream(), { token: a, index: r } = this.compiler.container.token(s), c = r === void 0 ? i[0] : i[r + 1];
4272
+ const s = ut(e, n), i = this.compiler.token.flatStream(), { token: a, index: r } = this.compiler.container.token(s), c = r === void 0 ? i[0] : i[r + 1];
4284
4273
  if ([
4285
4274
  ...(a == null ? void 0 : a.trailingTrivia) || [],
4286
4275
  ...(a == null ? void 0 : a.leadingTrivia) || [],
4287
4276
  ...(c == null ? void 0 : c.leadingTrivia) || []
4288
- ].find((E) => rn(E) && ke(s, E)))
4289
- return B();
4277
+ ].find((E) => rn(E) && Se(s, E)))
4278
+ return V();
4290
4279
  if (r === void 0)
4291
- return yt();
4292
- if ([h.STRING_LITERAL, h.QUOTED_STRING].includes(a.kind) && ke(s, a))
4293
- return B();
4280
+ return kt();
4281
+ if ([h.STRING_LITERAL, h.QUOTED_STRING].includes(a.kind) && Se(s, a))
4282
+ return V();
4294
4283
  const f = this.compiler.container.element(s);
4295
- if (this.compiler.container.scopeKind(s) === U.TOPLEVEL || f instanceof y && f.type && f.type.start <= s && f.type.end >= s)
4296
- return yt();
4284
+ if (this.compiler.container.scopeKind(s) === O.TOPLEVEL || f instanceof y && f.type && f.type.start <= s && f.type.end >= s)
4285
+ return kt();
4297
4286
  const p = [...this.compiler.container.stack(s)].reverse();
4298
4287
  for (const E of p)
4299
- if (E instanceof K)
4288
+ if (E instanceof ie)
4300
4289
  switch ((d = E.op) == null ? void 0 : d.value) {
4301
4290
  case ">":
4302
4291
  case "<":
4303
4292
  case "<>":
4304
4293
  case "-":
4305
- return At(
4294
+ return gt(
4306
4295
  this.compiler,
4307
4296
  s,
4308
4297
  E
@@ -4314,7 +4303,7 @@ class Ht {
4314
4303
  case "<":
4315
4304
  case "<>":
4316
4305
  case "-":
4317
- return At(
4306
+ return gt(
4318
4307
  this.compiler,
4319
4308
  s,
4320
4309
  E
@@ -4327,42 +4316,46 @@ class Ht {
4327
4316
  );
4328
4317
  }
4329
4318
  else {
4330
- if (E instanceof se)
4331
- return gt(this.compiler, s, E);
4332
- if (E instanceof R)
4333
- return gt(this.compiler, s, E);
4319
+ if (E instanceof ne)
4320
+ return vt(this.compiler, s, E);
4321
+ if (E instanceof U)
4322
+ return vt(this.compiler, s, E);
4334
4323
  if (E instanceof fe)
4335
- return bs(this.compiler, s);
4324
+ return Is(this.compiler, s);
4336
4325
  if (E instanceof Le)
4337
- return Ts(this.compiler, s);
4326
+ return bs(this.compiler, s);
4338
4327
  if (E instanceof v)
4339
- return wt(this.compiler, s, E);
4340
- if (E instanceof y && (E.bodyColon && s >= E.bodyColon.end || E.body && ke(s, E.body)))
4341
- return wt(this.compiler, s, void 0);
4328
+ return yt(this.compiler, s, E);
4329
+ if (E instanceof y && (E.bodyColon && s >= E.bodyColon.end || E.body && Se(s, E.body)))
4330
+ return yt(this.compiler, s, void 0);
4342
4331
  }
4343
- return B();
4332
+ return V();
4344
4333
  }
4345
4334
  }
4346
- function Ts(t, e, n) {
4347
- const s = t.container.element(e);
4348
- return Oe(t, e, s, [m.TablePartial]);
4335
+ function bs(t, e) {
4336
+ const n = t.container.element(e);
4337
+ return Oe(t, e, n, [m.TablePartial]);
4349
4338
  }
4350
- function At(t, e, n) {
4339
+ function gt(t, e, n) {
4351
4340
  const s = t.container.scopeKind(e);
4352
- if ([U.REF, U.TABLE].includes(s)) {
4341
+ if ([
4342
+ O.REF,
4343
+ O.TABLE,
4344
+ O.TABLEPARTIAL
4345
+ ].includes(s)) {
4353
4346
  const i = Oe(t, e, t.container.element(e), [
4354
4347
  m.Table,
4355
4348
  m.Schema,
4356
4349
  m.Column
4357
4350
  ]);
4358
- return Xe(n.op, e) ? $e(i) : i;
4351
+ return Xe(n.op, e) ? je(i) : i;
4359
4352
  }
4360
- return B();
4353
+ return V();
4361
4354
  }
4362
4355
  function Oe(t, e, n, s) {
4363
4356
  var r;
4364
4357
  if (n === void 0)
4365
- return B();
4358
+ return V();
4366
4359
  let i = n;
4367
4360
  const a = { suggestions: [] };
4368
4361
  for (; i; ) {
@@ -4372,9 +4365,9 @@ function Oe(t, e, n, s) {
4372
4365
  ...t.symbol.members(c).filter(({ kind: f }) => s.includes(f)).map(({ name: f, kind: p }) => ({
4373
4366
  label: f,
4374
4367
  insertText: f,
4375
- insertTextRules: P.KeepWhitespace,
4376
- kind: Pe(p),
4377
- sortText: Pe(p).toString().padStart(2, "0"),
4368
+ insertTextRules: D.KeepWhitespace,
4369
+ kind: xe(p),
4370
+ sortText: xe(p).toString().padStart(2, "0"),
4378
4371
  range: void 0
4379
4372
  }))
4380
4373
  );
@@ -4383,12 +4376,12 @@ function Oe(t, e, n, s) {
4383
4376
  }
4384
4377
  return He(a);
4385
4378
  }
4386
- function bs(t, e) {
4379
+ function Is(t, e) {
4387
4380
  var s;
4388
4381
  switch (t.container.scopeKind(e)) {
4389
- case U.INDEXES:
4382
+ case O.INDEXES:
4390
4383
  return Kt(t, e);
4391
- case U.REF:
4384
+ case O.REF:
4392
4385
  {
4393
4386
  const i = [...t.container.stack(e)];
4394
4387
  for (; i.length > 0; ) {
@@ -4403,101 +4396,101 @@ function bs(t, e) {
4403
4396
  }
4404
4397
  return Zt(t, e);
4405
4398
  }
4406
- return B();
4399
+ return V();
4407
4400
  }
4408
- function gt(t, e, n) {
4401
+ function vt(t, e, n) {
4409
4402
  const { token: s } = t.container.token(e);
4410
4403
  if ([h.COMMA, h.LBRACKET].includes(s == null ? void 0 : s.kind)) {
4411
- const i = vt(t, e);
4412
- return (s == null ? void 0 : s.kind) === h.COMMA && Xe(s, e) ? $e(i) : i;
4404
+ const i = wt(t, e);
4405
+ return (s == null ? void 0 : s.kind) === h.COMMA && Xe(s, e) ? je(i) : i;
4413
4406
  }
4414
4407
  if (n.name && n.name.start <= e && n.name.end >= e)
4415
- return vt(t, e);
4416
- if (n.name instanceof ne) {
4417
- const i = Is(
4408
+ return wt(t, e);
4409
+ if (n.name instanceof te) {
4410
+ const i = Ls(
4418
4411
  t,
4419
4412
  e,
4420
- ge(n.name).unwrap_or("")
4413
+ ve(n.name).unwrap_or("")
4421
4414
  );
4422
- return (s == null ? void 0 : s.kind) === h.COLON && Xe(s, e) ? $e(i) : i;
4415
+ return (s == null ? void 0 : s.kind) === h.COLON && Xe(s, e) ? je(i) : i;
4423
4416
  }
4424
- return B();
4417
+ return V();
4425
4418
  }
4426
- function vt(t, e) {
4427
- const n = t.container.element(e), s = t.container.scopeKind(e);
4419
+ function wt(t, e) {
4420
+ const n = t.container.element(e);
4428
4421
  if (n instanceof Z)
4429
- return B();
4430
- if (n.body && !ke(e, n.body))
4422
+ return V();
4423
+ const s = t.container.scopeKind(e);
4424
+ if (n.body && !Se(e, n.body)) {
4425
+ let i;
4431
4426
  switch (s) {
4432
- case U.TABLE:
4433
- return {
4434
- suggestions: ["headercolor", "note"].map((i) => ({
4435
- label: i,
4436
- insertText: `${i}: `,
4437
- kind: w.Field,
4438
- insertTextRules: P.KeepWhitespace,
4439
- range: void 0
4440
- }))
4441
- };
4442
- case U.TABLEGROUP:
4443
- return {
4444
- suggestions: ["color", "note"].map((i) => ({
4445
- label: i,
4446
- insertText: `${i}: `,
4447
- kind: w.Field,
4448
- insertTextRules: P.KeepWhitespace,
4449
- range: void 0
4450
- }))
4451
- };
4427
+ case O.TABLE:
4428
+ case O.TABLEPARTIAL:
4429
+ i = ["headercolor", "note"];
4430
+ break;
4431
+ case O.TABLEGROUP:
4432
+ i = ["color", "note"];
4433
+ break;
4452
4434
  default:
4453
- return B();
4435
+ i = [];
4454
4436
  }
4437
+ return {
4438
+ suggestions: i.map((a) => ({
4439
+ label: a,
4440
+ insertText: `${a}: `,
4441
+ kind: w.Field,
4442
+ insertTextRules: D.KeepWhitespace,
4443
+ range: void 0
4444
+ }))
4445
+ };
4446
+ }
4455
4447
  switch (s) {
4456
- case U.TABLE:
4448
+ case O.TABLE:
4449
+ case O.TABLEPARTIAL:
4457
4450
  return {
4458
4451
  suggestions: [
4459
4452
  ...["primary key", "null", "not null", "increment", "pk", "unique"].map((i) => ({
4460
4453
  label: i,
4461
4454
  insertText: i,
4462
4455
  kind: w.Property,
4463
- insertTextRules: P.KeepWhitespace,
4456
+ insertTextRules: D.KeepWhitespace,
4464
4457
  range: void 0
4465
4458
  })),
4466
4459
  ...["ref", "default"].map((i) => ({
4467
4460
  label: i,
4468
4461
  insertText: `${i}: `,
4469
4462
  kind: w.Property,
4470
- insertTextRules: P.KeepWhitespace,
4463
+ insertTextRules: D.KeepWhitespace,
4471
4464
  range: void 0
4472
4465
  })),
4473
4466
  {
4474
4467
  label: "note",
4475
4468
  insertText: "note: ",
4476
4469
  kind: w.Property,
4477
- insertTextRules: P.KeepWhitespace,
4470
+ insertTextRules: D.KeepWhitespace,
4478
4471
  range: void 0
4479
4472
  }
4480
4473
  ]
4481
4474
  };
4482
- case U.ENUM:
4475
+ case O.ENUM:
4483
4476
  return {
4484
4477
  suggestions: [
4485
4478
  {
4486
4479
  label: "note",
4487
4480
  insertText: "note: ",
4488
4481
  kind: w.Property,
4489
- insertTextRules: P.KeepWhitespace,
4482
+ insertTextRules: D.KeepWhitespace,
4490
4483
  range: void 0
4491
4484
  }
4492
4485
  ]
4493
4486
  };
4494
- case U.INDEXES:
4487
+ case O.INDEXES:
4495
4488
  return {
4496
4489
  suggestions: [
4497
4490
  ...["unique", "pk"].map((i) => ({
4498
4491
  label: i,
4499
4492
  insertText: i,
4500
- insertTextRules: P.KeepWhitespace,
4493
+ insertTextRules: D.KeepWhitespace,
4501
4494
  kind: w.Property,
4502
4495
  range: void 0
4503
4496
  })),
@@ -4505,25 +4498,25 @@ function vt(t, e) {
4505
4498
  label: i,
4506
4499
  insertText: `${i}: `,
4507
4500
  kind: w.Property,
4508
- insertTextRules: P.KeepWhitespace,
4501
+ insertTextRules: D.KeepWhitespace,
4509
4502
  range: void 0
4510
4503
  }))
4511
4504
  ]
4512
4505
  };
4513
- case U.REF:
4506
+ case O.REF:
4514
4507
  return {
4515
4508
  suggestions: ["update", "delete"].map((i) => ({
4516
4509
  label: i,
4517
4510
  insertText: `${i}: `,
4518
4511
  kind: w.Property,
4519
- insertTextRules: P.KeepWhitespace,
4512
+ insertTextRules: D.KeepWhitespace,
4520
4513
  range: void 0
4521
4514
  }))
4522
4515
  };
4523
4516
  }
4524
- return B();
4517
+ return V();
4525
4518
  }
4526
- function Is(t, e, n) {
4519
+ function Ls(t, e, n) {
4527
4520
  switch (n == null ? void 0 : n.toLowerCase()) {
4528
4521
  case "update":
4529
4522
  case "delete":
@@ -4532,7 +4525,7 @@ function Is(t, e, n) {
4532
4525
  label: s,
4533
4526
  insertText: s,
4534
4527
  kind: w.Value,
4535
- insertTextRules: P.KeepWhitespace,
4528
+ insertTextRules: D.KeepWhitespace,
4536
4529
  range: void 0
4537
4530
  }))
4538
4531
  };
@@ -4542,104 +4535,105 @@ function Is(t, e, n) {
4542
4535
  label: s,
4543
4536
  insertText: `${s}`,
4544
4537
  kind: w.Value,
4545
- insertTextRules: P.KeepWhitespace,
4538
+ insertTextRules: D.KeepWhitespace,
4546
4539
  range: void 0
4547
4540
  }))
4548
4541
  };
4549
4542
  }
4550
- return B();
4543
+ return V();
4551
4544
  }
4552
4545
  function Jt(t, e, n) {
4553
4546
  const s = _e(n).unwrap_or([]);
4554
- if (s.pop(), s.some((a) => !j(a)))
4555
- return B();
4547
+ if (s.pop(), s.some((a) => !$(a)))
4548
+ return V();
4556
4549
  const i = s.map((a) => W(a).unwrap());
4557
4550
  return He({
4558
4551
  suggestions: t.symbol.ofName({ nameStack: i, owner: t.container.element(e) }).flatMap(({ symbol: a }) => t.symbol.members(a)).map(({ kind: a, name: r }) => ({
4559
4552
  label: r,
4560
4553
  insertText: r,
4561
- kind: Pe(a),
4554
+ kind: xe(a),
4562
4555
  range: void 0
4563
4556
  }))
4564
4557
  });
4565
4558
  }
4566
- function wt(t, e, n) {
4559
+ function yt(t, e, n) {
4567
4560
  var i;
4568
4561
  switch (t.container.scopeKind(e)) {
4569
- case U.TABLE:
4570
- return kt(t, e, n);
4571
- case U.TABLEPARTIAL:
4572
- return kt(t, e, n);
4573
- case U.PROJECT:
4562
+ case O.TABLE:
4563
+ case O.TABLEPARTIAL:
4574
4564
  return _s(t, e, n);
4575
- case U.INDEXES:
4576
- return gs(t, e);
4577
- case U.ENUM:
4578
- return Ls(t, e, n);
4579
- case U.REF: {
4565
+ case O.PROJECT:
4566
+ return gs(t, e, n);
4567
+ case O.INDEXES:
4568
+ return ws(t, e);
4569
+ case O.ENUM:
4570
+ return As(t, e, n);
4571
+ case O.REF: {
4580
4572
  const a = Zt(t, e);
4581
- return ((i = t.container.token(e).token) == null ? void 0 : i.kind) === h.COLON && Xe(t.container.token(e).token, e) ? $e(a) : a;
4573
+ return ((i = t.container.token(e).token) == null ? void 0 : i.kind) === h.COLON && Xe(t.container.token(e).token, e) ? je(a) : a;
4582
4574
  }
4583
- case U.TABLEGROUP:
4584
- return As(t);
4575
+ case O.TABLEGROUP:
4576
+ return vs(t);
4585
4577
  default:
4586
- return B();
4578
+ return V();
4587
4579
  }
4588
4580
  }
4589
- function yt() {
4581
+ function kt() {
4590
4582
  return {
4591
4583
  suggestions: ["Table", "TableGroup", "Enum", "Project", "Ref", "TablePartial"].map((t) => ({
4592
4584
  label: t,
4593
4585
  insertText: t,
4594
- insertTextRules: P.KeepWhitespace,
4586
+ insertTextRules: D.KeepWhitespace,
4595
4587
  kind: w.Keyword,
4596
4588
  range: void 0
4597
4589
  }))
4598
4590
  };
4599
4591
  }
4600
- function Ls(t, e, n) {
4601
- return n != null && n.callee && ut(e, n) === 1 ? Oe(t, e, t.container.element(e), [
4592
+ function As(t, e, n) {
4593
+ return n != null && n.callee && ht(e, n) === 1 ? Oe(t, e, t.container.element(e), [
4602
4594
  m.Schema,
4603
4595
  m.Table,
4604
4596
  m.Column
4605
- ]) : B();
4597
+ ]) : V();
4606
4598
  }
4607
- function kt(t, e, n) {
4599
+ function _s(t, e, n) {
4600
+ const s = ["Note", "indexes"];
4608
4601
  if (!(n != null && n.callee))
4609
4602
  return {
4610
- suggestions: ["Note", "indexes"].map((i) => ({
4611
- label: i,
4612
- insertText: i,
4613
- insertTextRules: P.KeepWhitespace,
4603
+ suggestions: s.map((a) => ({
4604
+ label: a,
4605
+ insertText: a,
4606
+ insertTextRules: D.KeepWhitespace,
4614
4607
  kind: w.Keyword,
4615
4608
  range: void 0
4616
4609
  }))
4617
4610
  };
4618
- const s = ut(e, n);
4619
- return s === 0 ? {
4620
- suggestions: ["Note", "indexes"].map((i) => ({
4621
- label: i,
4622
- insertText: i,
4623
- insertTextRules: P.KeepWhitespace,
4611
+ const i = ht(e, n);
4612
+ return i === 0 ? {
4613
+ suggestions: s.map((a) => ({
4614
+ label: a,
4615
+ insertText: a,
4616
+ insertTextRules: D.KeepWhitespace,
4624
4617
  kind: w.Keyword,
4625
4618
  range: void 0
4626
4619
  }))
4627
- } : s === 1 ? vs(t, e) : B();
4628
- }
4629
- function _s(t, e, n) {
4630
- return n != null && n.callee ? ut(e, n) === 0 ? {
4631
- suggestions: ["Table", "TableGroup", "Enum", "Note", "Ref"].map((i) => ({
4632
- label: i,
4633
- insertText: i,
4634
- insertTextRules: P.KeepWhitespace,
4620
+ } : i === 1 ? ys(t, e) : V();
4621
+ }
4622
+ function gs(t, e, n) {
4623
+ const s = ["Table", "TableGroup", "Enum", "Note", "Ref", "TablePartial"];
4624
+ return n != null && n.callee ? ht(e, n) === 0 ? {
4625
+ suggestions: s.map((a) => ({
4626
+ label: a,
4627
+ insertText: a,
4628
+ insertTextRules: D.KeepWhitespace,
4635
4629
  kind: w.Keyword,
4636
4630
  range: void 0
4637
4631
  }))
4638
- } : B() : {
4639
- suggestions: ["Table", "TableGroup", "Enum", "Note", "Ref"].map((i) => ({
4640
- label: i,
4641
- insertText: i,
4642
- insertTextRules: P.KeepWhitespace,
4632
+ } : V() : {
4633
+ suggestions: s.map((a) => ({
4634
+ label: a,
4635
+ insertText: a,
4636
+ insertTextRules: D.KeepWhitespace,
4643
4637
  kind: w.Keyword,
4644
4638
  range: void 0
4645
4639
  }))
@@ -4652,7 +4646,7 @@ function Zt(t, e) {
4652
4646
  m.Column
4653
4647
  ]);
4654
4648
  }
4655
- function As(t) {
4649
+ function vs(t) {
4656
4650
  return {
4657
4651
  suggestions: [
4658
4652
  ...He({
@@ -4664,8 +4658,8 @@ function As(t) {
4664
4658
  return s !== m.Table && s !== m.Schema ? [] : {
4665
4659
  label: i,
4666
4660
  insertText: i,
4667
- insertTextRules: P.KeepWhitespace,
4668
- kind: Pe(s),
4661
+ insertTextRules: D.KeepWhitespace,
4662
+ kind: xe(s),
4669
4663
  range: void 0
4670
4664
  };
4671
4665
  })
@@ -4673,17 +4667,17 @@ function As(t) {
4673
4667
  ...["Note"].map((e) => ({
4674
4668
  label: e,
4675
4669
  insertText: e,
4676
- insertTextRules: P.KeepWhitespace,
4670
+ insertTextRules: D.KeepWhitespace,
4677
4671
  kind: w.Keyword,
4678
4672
  range: void 0
4679
4673
  }))
4680
4674
  ]
4681
4675
  };
4682
4676
  }
4683
- function gs(t, e) {
4677
+ function ws(t, e) {
4684
4678
  return Kt(t, e);
4685
4679
  }
4686
- function vs(t, e) {
4680
+ function ys(t, e) {
4687
4681
  return {
4688
4682
  suggestions: [
4689
4683
  ...[
@@ -4746,7 +4740,7 @@ function vs(t, e) {
4746
4740
  ].map((n) => ({
4747
4741
  label: n,
4748
4742
  insertText: n,
4749
- insertTextRules: P.KeepWhitespace,
4743
+ insertTextRules: D.KeepWhitespace,
4750
4744
  kind: w.TypeParameter,
4751
4745
  sortText: w.TypeParameter.toString().padStart(2, "0"),
4752
4746
  range: void 0
@@ -4761,7 +4755,7 @@ function vs(t, e) {
4761
4755
  function Kt(t, e) {
4762
4756
  const n = t.container.element(e), s = n == null ? void 0 : n.parent;
4763
4757
  if (!((s == null ? void 0 : s.symbol) instanceof Ut))
4764
- return B();
4758
+ return V();
4765
4759
  const { symbolTable: i } = s.symbol;
4766
4760
  return He({
4767
4761
  suggestions: [...i.entries()].flatMap(([a]) => {
@@ -4772,14 +4766,14 @@ function Kt(t, e) {
4772
4766
  return {
4773
4767
  label: c,
4774
4768
  insertText: c,
4775
- insertTextRules: P.KeepWhitespace,
4776
- kind: Pe(m.Column),
4769
+ insertTextRules: D.KeepWhitespace,
4770
+ kind: xe(m.Column),
4777
4771
  range: void 0
4778
4772
  };
4779
4773
  })
4780
4774
  });
4781
4775
  }
4782
- function ut(t, e) {
4776
+ function ht(t, e) {
4783
4777
  if (!e.callee)
4784
4778
  return -1;
4785
4779
  const n = [e.callee, ...e.args], s = n.findIndex((i) => t <= i.end);
@@ -4790,23 +4784,26 @@ class en {
4790
4784
  this.compiler = e;
4791
4785
  }
4792
4786
  provideDefinition(e, n) {
4793
- var r;
4794
- const { uri: s } = e, i = ct(e, n), a = [...this.compiler.container.stack(i)];
4787
+ var r, c;
4788
+ const { uri: s } = e, i = ut(e, n), a = [...this.compiler.container.stack(i)];
4795
4789
  for (; a.length !== 0; ) {
4796
- const c = a.pop();
4797
- if ((r = c == null ? void 0 : c.referee) != null && r.declaration && [
4790
+ const f = a.pop();
4791
+ if (!(f != null && f.referee))
4792
+ continue;
4793
+ let p;
4794
+ if ((r = f.referee) != null && r.declaration && [
4798
4795
  Ie.PRIMARY_EXPRESSION,
4799
4796
  Ie.VARIABLE,
4800
4797
  Ie.PARTIAL_INJECTION
4801
- ].includes(c == null ? void 0 : c.kind)) {
4802
- const { startPos: f, endPos: p } = c.referee.declaration;
4798
+ ].includes(f == null ? void 0 : f.kind) ? { declaration: p } = f.referee : (c = f.referee) != null && c.injectorDeclaration && (p = f.referee.injectorDeclaration), p) {
4799
+ const { startPos: d, endPos: u } = p;
4803
4800
  return [
4804
4801
  {
4805
4802
  range: {
4806
- startColumn: f.column + 1,
4807
- startLineNumber: f.line + 1,
4808
- endColumn: p.column + 1,
4809
- endLineNumber: p.line + 1
4803
+ startColumn: d.column + 1,
4804
+ startLineNumber: d.line + 1,
4805
+ endColumn: u.column + 1,
4806
+ endLineNumber: u.line + 1
4810
4807
  },
4811
4808
  uri: s
4812
4809
  }
@@ -4821,7 +4818,7 @@ class tn {
4821
4818
  this.compiler = e;
4822
4819
  }
4823
4820
  provideReferences(e, n) {
4824
- const { uri: s } = e, i = ct(e, n), a = [...this.compiler.container.stack(i)];
4821
+ const { uri: s } = e, i = ut(e, n), a = [...this.compiler.container.stack(i)];
4825
4822
  for (; a.length !== 0; ) {
4826
4823
  const r = a.pop();
4827
4824
  if (r && [
@@ -4845,24 +4842,24 @@ class tn {
4845
4842
  return [];
4846
4843
  }
4847
4844
  }
4848
- const ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4845
+ const Ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4849
4846
  __proto__: null,
4850
- CompletionItemInsertTextRule: P,
4847
+ CompletionItemInsertTextRule: D,
4851
4848
  CompletionItemKind: w,
4852
4849
  DBMLCompletionItemProvider: Ht,
4853
4850
  DBMLDefinitionProvider: en,
4854
4851
  DBMLReferencesProvider: tn
4855
4852
  }, Symbol.toStringTag, { value: "Module" }));
4856
- var U = /* @__PURE__ */ ((t) => (t[t.TABLE = 0] = "TABLE", t[t.ENUM = 1] = "ENUM", t[t.TABLEGROUP = 2] = "TABLEGROUP", t[t.INDEXES = 3] = "INDEXES", t[t.NOTE = 4] = "NOTE", t[t.REF = 5] = "REF", t[t.PROJECT = 6] = "PROJECT", t[t.CUSTOM = 7] = "CUSTOM", t[t.TOPLEVEL = 8] = "TOPLEVEL", t[t.TABLEPARTIAL = 9] = "TABLEPARTIAL", t))(U || {});
4857
- class Ss {
4853
+ var O = /* @__PURE__ */ ((t) => (t[t.TABLE = 0] = "TABLE", t[t.ENUM = 1] = "ENUM", t[t.TABLEGROUP = 2] = "TABLEGROUP", t[t.INDEXES = 3] = "INDEXES", t[t.NOTE = 4] = "NOTE", t[t.REF = 5] = "REF", t[t.PROJECT = 6] = "PROJECT", t[t.CUSTOM = 7] = "CUSTOM", t[t.TOPLEVEL = 8] = "TOPLEVEL", t[t.TABLEPARTIAL = 9] = "TABLEPARTIAL", t))(O || {});
4854
+ class xs {
4858
4855
  constructor() {
4859
4856
  this.source = "", this.cache = new Array(
4860
4857
  16
4861
4858
  /* TOTAL_QUERY_COUNT */
4862
- ).fill(null), this.nodeIdGenerator = new on(), this.symbolIdGenerator = new En(), this.token = {
4859
+ ).fill(null), this.nodeIdGenerator = new on(), this.symbolIdGenerator = new fn(), this.token = {
4863
4860
  invalidStream: this.createQuery(
4864
4861
  6,
4865
- () => this.parse.tokens().filter(Ft)
4862
+ () => this.parse.tokens().filter(Mt)
4866
4863
  ),
4867
4864
  // Valid + Invalid tokens (which are guarenteed to be non-trivials) are included in the stream
4868
4865
  flatStream: this.createQuery(
@@ -4874,8 +4871,8 @@ class Ss {
4874
4871
  _: this.createQuery(
4875
4872
  0,
4876
4873
  () => {
4877
- const e = new yn(this.source).lex().chain((n) => new Pn(n, this.nodeIdGenerator).parse()).chain(({ ast: n, tokens: s }) => new cs(n, this.symbolIdGenerator).analyze().map(() => ({ ast: n, tokens: s })));
4878
- return e.getErrors().length > 0 ? e : e.chain(({ ast: n, tokens: s }) => new Ns(n).interpret().map((a) => ({ ast: n, tokens: s, rawDb: a })));
4874
+ const e = new yn(this.source).lex().chain((n) => new Pn(n, this.nodeIdGenerator).parse()).chain(({ ast: n, tokens: s }) => new us(n, this.symbolIdGenerator).analyze().map(() => ({ ast: n, tokens: s })));
4875
+ return e.getErrors().length > 0 ? e : e.chain(({ ast: n, tokens: s }) => new ms(n).interpret().map((a) => ({ ast: n, tokens: s, rawDb: a })));
4879
4876
  }
4880
4877
  ),
4881
4878
  ast: this.createQuery(
@@ -4906,7 +4903,7 @@ class Ss {
4906
4903
  let c = this.parse.ast();
4907
4904
  const f = [c];
4908
4905
  for (; ; ) {
4909
- const d = wn(c).find((u) => ke(r, u));
4906
+ const d = wn(c).find((u) => Se(r, u));
4910
4907
  if (d === void 0 || d instanceof J)
4911
4908
  break;
4912
4909
  f.push(d), c = d;
@@ -4922,7 +4919,7 @@ class Ss {
4922
4919
  u[E] === `
4923
4920
  ` && (f.pop(), p = !0);
4924
4921
  } else
4925
- d instanceof K || d instanceof le ? this.container.token(e).token !== d.op && (f.pop(), p = !0) : d instanceof R ? d.listCloseBracket && d.end <= e && (f.pop(), p = !0) : d instanceof fe ? d.tupleCloseParen && d.end <= e && (f.pop(), p = !0) : d instanceof re ? d.blockCloseBrace && d.end <= e && (f.pop(), p = !0) : d instanceof ne || d.end < e && (f.pop(), p = !0);
4922
+ d instanceof ie || d instanceof le ? this.container.token(e).token !== d.op && (f.pop(), p = !0) : d instanceof U ? d.listCloseBracket && d.end <= e && (f.pop(), p = !0) : d instanceof fe ? d.tupleCloseParen && d.end <= e && (f.pop(), p = !0) : d instanceof re ? d.blockCloseBrace && d.end <= e && (f.pop(), p = !0) : d instanceof te || d.end < e && (f.pop(), p = !0);
4926
4923
  if (p) {
4927
4924
  const u = Ze(f);
4928
4925
  u instanceof y && u.end <= e && f.pop();
@@ -5007,7 +5004,7 @@ class Ss {
5007
5004
  let c = [r], f = [];
5008
5005
  for (const p of e)
5009
5006
  f = c.flatMap(
5010
- (d) => pn(p).flatMap((u) => {
5007
+ (d) => In(p).flatMap((u) => {
5011
5008
  const E = d.get(u), b = oe(u).unwrap_or(void 0);
5012
5009
  return !E || !b ? [] : { ...b, symbol: E };
5013
5010
  })
@@ -5057,7 +5054,7 @@ class Ss {
5057
5054
  }
5058
5055
  }
5059
5056
  export {
5060
- Ss as Compiler,
5061
- ys as serialize,
5062
- ks as services
5057
+ xs as Compiler,
5058
+ Ss as serialize,
5059
+ Ps as services
5063
5060
  };