@dbml/parse 3.15.0-alpha.0 → 5.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- var Wn = typeof global == "object" && global && global.Object === Object && global, zs = typeof self == "object" && self && self.Object === Object && self, _e = Wn || zs || Function("return this")(), Ne = _e.Symbol, Hn = Object.prototype, Ys = Hn.hasOwnProperty, qs = Hn.toString, ze = Ne ? Ne.toStringTag : void 0;
2
- function Ks(e) {
3
- var t = Ys.call(e, ze), n = e[ze];
1
+ var Wn = typeof global == "object" && global && global.Object === Object && global, Ks = typeof self == "object" && self && self.Object === Object && self, ge = Wn || Ks || Function("return this")(), Ne = ge.Symbol, Hn = Object.prototype, zs = Hn.hasOwnProperty, Ys = Hn.toString, Ke = Ne ? Ne.toStringTag : void 0;
2
+ function qs(e) {
3
+ var t = zs.call(e, Ke), n = e[Ke];
4
4
  try {
5
- e[ze] = void 0;
5
+ e[Ke] = void 0;
6
6
  var s = !0;
7
7
  } catch {
8
8
  }
9
- var r = qs.call(e);
10
- return s && (t ? e[ze] = n : delete e[ze]), r;
9
+ var r = Ys.call(e);
10
+ return s && (t ? e[Ke] = n : delete e[Ke]), r;
11
11
  }
12
12
  var Qs = Object.prototype, Js = Qs.toString;
13
13
  function Zs(e) {
@@ -15,7 +15,7 @@ function Zs(e) {
15
15
  }
16
16
  var er = "[object Null]", tr = "[object Undefined]", sn = Ne ? Ne.toStringTag : void 0;
17
17
  function Xe(e) {
18
- return e == null ? e === void 0 ? tr : er : sn && sn in Object(e) ? Ks(e) : Zs(e);
18
+ return e == null ? e === void 0 ? tr : er : sn && sn in Object(e) ? qs(e) : Zs(e);
19
19
  }
20
20
  function xe(e) {
21
21
  return e != null && typeof e == "object";
@@ -24,17 +24,17 @@ var nr = "[object Symbol]";
24
24
  function dt(e) {
25
25
  return typeof e == "symbol" || xe(e) && Xe(e) == nr;
26
26
  }
27
- function zn(e, t) {
27
+ function Kn(e, t) {
28
28
  for (var n = -1, s = e == null ? 0 : e.length, r = Array(s); ++n < s; )
29
29
  r[n] = t(e[n], n, e);
30
30
  return r;
31
31
  }
32
32
  var pe = Array.isArray, rn = Ne ? Ne.prototype : void 0, an = rn ? rn.toString : void 0;
33
- function Yn(e) {
33
+ function zn(e) {
34
34
  if (typeof e == "string")
35
35
  return e;
36
36
  if (pe(e))
37
- return zn(e, Yn) + "";
37
+ return Kn(e, zn) + "";
38
38
  if (dt(e))
39
39
  return an ? an.call(e) : "";
40
40
  var t = e + "";
@@ -88,13 +88,13 @@ function Et(e) {
88
88
  return e;
89
89
  }
90
90
  var Er = "[object AsyncFunction]", Nr = "[object Function]", Tr = "[object GeneratorFunction]", br = "[object Proxy]";
91
- function qn(e) {
91
+ function Yn(e) {
92
92
  if (!Ge(e))
93
93
  return !1;
94
94
  var t = Xe(e);
95
95
  return t == Nr || t == Tr || t == Er || t == br;
96
96
  }
97
- var yt = _e["__core-js_shared__"], cn = function() {
97
+ var yt = ge["__core-js_shared__"], cn = function() {
98
98
  var e = /[^.]+$/.exec(yt && yt.keys && yt.keys.IE_PROTO || "");
99
99
  return e ? "Symbol(src)_1." + e : "";
100
100
  }();
@@ -115,13 +115,13 @@ function Me(e) {
115
115
  }
116
116
  return "";
117
117
  }
118
- var gr = /[\\^$.*+?()[\]{}|]/g, Ar = /^\[object .+?Constructor\]$/, Lr = Function.prototype, vr = Object.prototype, yr = Lr.toString, wr = vr.hasOwnProperty, Sr = RegExp(
118
+ var gr = /[\\^$.*+?()[\]{}|]/g, Ar = /^\[object .+?Constructor\]$/, Lr = Function.prototype, vr = Object.prototype, yr = Lr.toString, wr = vr.hasOwnProperty, Pr = RegExp(
119
119
  "^" + yr.call(wr).replace(gr, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
120
120
  );
121
- function Pr(e) {
121
+ function Sr(e) {
122
122
  if (!Ge(e) || mr(e))
123
123
  return !1;
124
- var t = qn(e) ? Sr : Ar;
124
+ var t = Yn(e) ? Pr : Ar;
125
125
  return t.test(Me(e));
126
126
  }
127
127
  function Or(e, t) {
@@ -129,9 +129,9 @@ function Or(e, t) {
129
129
  }
130
130
  function Fe(e, t) {
131
131
  var n = Or(e, t);
132
- return Pr(n) ? n : void 0;
132
+ return Sr(n) ? n : void 0;
133
133
  }
134
- var Pt = Fe(_e, "WeakMap");
134
+ var St = Fe(ge, "WeakMap");
135
135
  function xr(e, t, n) {
136
136
  switch (n.length) {
137
137
  case 0:
@@ -145,11 +145,11 @@ function xr(e, t, n) {
145
145
  }
146
146
  return e.apply(t, n);
147
147
  }
148
- var Dr = 800, Rr = 16, kr = Date.now;
148
+ var Dr = 800, kr = 16, Rr = Date.now;
149
149
  function Ur(e) {
150
150
  var t = 0, n = 0;
151
151
  return function() {
152
- var s = kr(), r = Rr - (s - n);
152
+ var s = Rr(), r = kr - (s - n);
153
153
  if (n = s, r > 0) {
154
154
  if (++t >= Dr)
155
155
  return arguments[0];
@@ -177,17 +177,17 @@ var un = function() {
177
177
  writable: !0
178
178
  });
179
179
  } : Et, Br = Ur(Fr);
180
- function Vr(e, t, n, s) {
180
+ function Cr(e, t, n, s) {
181
181
  e.length;
182
182
  for (var r = n + 1; r--; )
183
183
  if (t(e[r], r, e))
184
184
  return r;
185
185
  return -1;
186
186
  }
187
- var Cr = 9007199254740991, Gr = /^(?:0|[1-9]\d*)$/;
188
- function Kn(e, t) {
187
+ var Vr = 9007199254740991, Gr = /^(?:0|[1-9]\d*)$/;
188
+ function qn(e, t) {
189
189
  var n = typeof e;
190
- return t = t ?? Cr, !!t && (n == "number" || n != "symbol" && Gr.test(e)) && e > -1 && e % 1 == 0 && e < t;
190
+ return t = t ?? Vr, !!t && (n == "number" || n != "symbol" && Gr.test(e)) && e > -1 && e % 1 == 0 && e < t;
191
191
  }
192
192
  function Qn(e, t) {
193
193
  return e === t || e !== e && t !== t;
@@ -211,7 +211,7 @@ function Bt(e) {
211
211
  return typeof e == "number" && e > -1 && e % 1 == 0 && e <= jr;
212
212
  }
213
213
  function Nt(e) {
214
- return e != null && Bt(e.length) && !qn(e);
214
+ return e != null && Bt(e.length) && !Yn(e);
215
215
  }
216
216
  var Wr = Object.prototype;
217
217
  function Jn(e) {
@@ -227,15 +227,15 @@ var Hr = "[object Arguments]";
227
227
  function fn(e) {
228
228
  return xe(e) && Xe(e) == Hr;
229
229
  }
230
- var es = Object.prototype, zr = es.hasOwnProperty, Yr = es.propertyIsEnumerable, Vt = fn(/* @__PURE__ */ function() {
230
+ var es = Object.prototype, Kr = es.hasOwnProperty, zr = es.propertyIsEnumerable, Ct = fn(/* @__PURE__ */ function() {
231
231
  return arguments;
232
232
  }()) ? fn : function(e) {
233
- return xe(e) && zr.call(e, "callee") && !Yr.call(e, "callee");
233
+ return xe(e) && Kr.call(e, "callee") && !zr.call(e, "callee");
234
234
  };
235
- function qr() {
235
+ function Yr() {
236
236
  return !1;
237
237
  }
238
- var ts = typeof exports == "object" && exports && !exports.nodeType && exports, pn = ts && typeof module == "object" && module && !module.nodeType && module, Kr = pn && pn.exports === ts, dn = Kr ? _e.Buffer : void 0, Qr = dn ? dn.isBuffer : void 0, Ot = Qr || qr, Jr = "[object Arguments]", Zr = "[object Array]", ei = "[object Boolean]", ti = "[object Date]", ni = "[object Error]", si = "[object Function]", ri = "[object Map]", ii = "[object Number]", ai = "[object Object]", oi = "[object RegExp]", li = "[object Set]", ci = "[object String]", ui = "[object WeakMap]", hi = "[object ArrayBuffer]", fi = "[object DataView]", pi = "[object Float32Array]", di = "[object Float64Array]", Ei = "[object Int8Array]", Ni = "[object Int16Array]", Ti = "[object Int32Array]", bi = "[object Uint8Array]", mi = "[object Uint8ClampedArray]", Ii = "[object Uint16Array]", _i = "[object Uint32Array]", O = {};
238
+ var ts = typeof exports == "object" && exports && !exports.nodeType && exports, pn = ts && typeof module == "object" && module && !module.nodeType && module, qr = pn && pn.exports === ts, dn = qr ? ge.Buffer : void 0, Qr = dn ? dn.isBuffer : void 0, Ot = Qr || Yr, Jr = "[object Arguments]", Zr = "[object Array]", ei = "[object Boolean]", ti = "[object Date]", ni = "[object Error]", si = "[object Function]", ri = "[object Map]", ii = "[object Number]", ai = "[object Object]", oi = "[object RegExp]", li = "[object Set]", ci = "[object String]", ui = "[object WeakMap]", hi = "[object ArrayBuffer]", fi = "[object DataView]", pi = "[object Float32Array]", di = "[object Float64Array]", Ei = "[object Int8Array]", Ni = "[object Int16Array]", Ti = "[object Int32Array]", bi = "[object Uint8Array]", mi = "[object Uint8ClampedArray]", Ii = "[object Uint16Array]", _i = "[object Uint32Array]", O = {};
239
239
  O[pi] = O[di] = O[Ei] = O[Ni] = O[Ti] = O[bi] = O[mi] = O[Ii] = O[_i] = !0;
240
240
  O[Jr] = O[Zr] = O[hi] = O[ei] = O[fi] = O[ti] = O[ni] = O[si] = O[ri] = O[ii] = O[ai] = O[oi] = O[li] = O[ci] = O[ui] = !1;
241
241
  function gi(e) {
@@ -246,21 +246,21 @@ function Ai(e) {
246
246
  return e(t);
247
247
  };
248
248
  }
249
- var ns = typeof exports == "object" && exports && !exports.nodeType && exports, Ye = ns && typeof module == "object" && module && !module.nodeType && module, Li = Ye && Ye.exports === ns, wt = Li && Wn.process, En = function() {
249
+ var ns = typeof exports == "object" && exports && !exports.nodeType && exports, ze = ns && typeof module == "object" && module && !module.nodeType && module, Li = ze && ze.exports === ns, wt = Li && Wn.process, En = function() {
250
250
  try {
251
- var e = Ye && Ye.require && Ye.require("util").types;
251
+ var e = ze && ze.require && ze.require("util").types;
252
252
  return e || wt && wt.binding && wt.binding("util");
253
253
  } catch {
254
254
  }
255
255
  }(), Nn = En && En.isTypedArray, ss = Nn ? Ai(Nn) : gi, vi = Object.prototype, yi = vi.hasOwnProperty;
256
256
  function rs(e, t) {
257
- var n = pe(e), s = !n && Vt(e), r = !n && !s && Ot(e), i = !n && !s && !r && ss(e), a = n || s || r || i, o = a ? Zn(e.length, String) : [], u = o.length;
257
+ var n = pe(e), s = !n && Ct(e), r = !n && !s && Ot(e), i = !n && !s && !r && ss(e), a = n || s || r || i, o = a ? Zn(e.length, String) : [], u = o.length;
258
258
  for (var p in e)
259
259
  (t || yi.call(e, p)) && !(a && // Safari 9 has enumerable `arguments.length` in strict mode.
260
260
  (p == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
261
261
  r && (p == "offset" || p == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
262
262
  i && (p == "buffer" || p == "byteLength" || p == "byteOffset") || // Skip index properties.
263
- Kn(p, u))) && o.push(p);
263
+ qn(p, u))) && o.push(p);
264
264
  return o;
265
265
  }
266
266
  function wi(e, t) {
@@ -268,16 +268,16 @@ function wi(e, t) {
268
268
  return e(t(n));
269
269
  };
270
270
  }
271
- var Si = wi(Object.keys, Object), Pi = Object.prototype, Oi = Pi.hasOwnProperty;
271
+ var Pi = wi(Object.keys, Object), Si = Object.prototype, Oi = Si.hasOwnProperty;
272
272
  function xi(e) {
273
273
  if (!Jn(e))
274
- return Si(e);
274
+ return Pi(e);
275
275
  var t = [];
276
276
  for (var n in Object(e))
277
277
  Oi.call(e, n) && n != "constructor" && t.push(n);
278
278
  return t;
279
279
  }
280
- function Ct(e) {
280
+ function Vt(e) {
281
281
  return Nt(e) ? rs(e) : xi(e);
282
282
  }
283
283
  function Di(e) {
@@ -287,13 +287,13 @@ function Di(e) {
287
287
  t.push(n);
288
288
  return t;
289
289
  }
290
- var Ri = Object.prototype, ki = Ri.hasOwnProperty;
290
+ var ki = Object.prototype, Ri = ki.hasOwnProperty;
291
291
  function Ui(e) {
292
292
  if (!Ge(e))
293
293
  return Di(e);
294
294
  var t = Jn(e), n = [];
295
295
  for (var s in e)
296
- s == "constructor" && (t || !ki.call(e, s)) || n.push(s);
296
+ s == "constructor" && (t || !Ri.call(e, s)) || n.push(s);
297
297
  return n;
298
298
  }
299
299
  function Mi(e) {
@@ -306,32 +306,32 @@ function Gt(e, t) {
306
306
  var n = typeof e;
307
307
  return n == "number" || n == "symbol" || n == "boolean" || e == null || dt(e) ? !0 : Bi.test(e) || !Fi.test(e) || t != null && e in Object(t);
308
308
  }
309
- var Ke = Fe(Object, "create");
310
- function Vi() {
311
- this.__data__ = Ke ? Ke(null) : {}, this.size = 0;
309
+ var qe = Fe(Object, "create");
310
+ function Ci() {
311
+ this.__data__ = qe ? qe(null) : {}, this.size = 0;
312
312
  }
313
- function Ci(e) {
313
+ function Vi(e) {
314
314
  var t = this.has(e) && delete this.__data__[e];
315
315
  return this.size -= t ? 1 : 0, t;
316
316
  }
317
317
  var Gi = "__lodash_hash_undefined__", $i = Object.prototype, Xi = $i.hasOwnProperty;
318
318
  function ji(e) {
319
319
  var t = this.__data__;
320
- if (Ke) {
320
+ if (qe) {
321
321
  var n = t[e];
322
322
  return n === Gi ? void 0 : n;
323
323
  }
324
324
  return Xi.call(t, e) ? t[e] : void 0;
325
325
  }
326
326
  var Wi = Object.prototype, Hi = Wi.hasOwnProperty;
327
- function zi(e) {
327
+ function Ki(e) {
328
328
  var t = this.__data__;
329
- return Ke ? t[e] !== void 0 : Hi.call(t, e);
329
+ return qe ? t[e] !== void 0 : Hi.call(t, e);
330
330
  }
331
- var Yi = "__lodash_hash_undefined__";
332
- function qi(e, t) {
331
+ var zi = "__lodash_hash_undefined__";
332
+ function Yi(e, t) {
333
333
  var n = this.__data__;
334
- return this.size += this.has(e) ? 0 : 1, n[e] = Ke && t === void 0 ? Yi : t, this;
334
+ return this.size += this.has(e) ? 0 : 1, n[e] = qe && t === void 0 ? zi : t, this;
335
335
  }
336
336
  function De(e) {
337
337
  var t = -1, n = e == null ? 0 : e.length;
@@ -340,12 +340,12 @@ function De(e) {
340
340
  this.set(s[0], s[1]);
341
341
  }
342
342
  }
343
- De.prototype.clear = Vi;
344
- De.prototype.delete = Ci;
343
+ De.prototype.clear = Ci;
344
+ De.prototype.delete = Vi;
345
345
  De.prototype.get = ji;
346
- De.prototype.has = zi;
347
- De.prototype.set = qi;
348
- function Ki() {
346
+ De.prototype.has = Ki;
347
+ De.prototype.set = Yi;
348
+ function qi() {
349
349
  this.__data__ = [], this.size = 0;
350
350
  }
351
351
  function Tt(e, t) {
@@ -373,23 +373,23 @@ function na(e, t) {
373
373
  var n = this.__data__, s = Tt(n, e);
374
374
  return s < 0 ? (++this.size, n.push([e, t])) : n[s][1] = t, this;
375
375
  }
376
- function ge(e) {
376
+ function Ae(e) {
377
377
  var t = -1, n = e == null ? 0 : e.length;
378
378
  for (this.clear(); ++t < n; ) {
379
379
  var s = e[t];
380
380
  this.set(s[0], s[1]);
381
381
  }
382
382
  }
383
- ge.prototype.clear = Ki;
384
- ge.prototype.delete = Zi;
385
- ge.prototype.get = ea;
386
- ge.prototype.has = ta;
387
- ge.prototype.set = na;
388
- var Qe = Fe(_e, "Map");
383
+ Ae.prototype.clear = qi;
384
+ Ae.prototype.delete = Zi;
385
+ Ae.prototype.get = ea;
386
+ Ae.prototype.has = ta;
387
+ Ae.prototype.set = na;
388
+ var Qe = Fe(ge, "Map");
389
389
  function sa() {
390
390
  this.size = 0, this.__data__ = {
391
391
  hash: new De(),
392
- map: new (Qe || ge)(),
392
+ map: new (Qe || Ae)(),
393
393
  string: new De()
394
394
  };
395
395
  }
@@ -415,18 +415,18 @@ function la(e, t) {
415
415
  var n = bt(this, e), s = n.size;
416
416
  return n.set(e, t), this.size += n.size == s ? 0 : 1, this;
417
417
  }
418
- function Ae(e) {
418
+ function Le(e) {
419
419
  var t = -1, n = e == null ? 0 : e.length;
420
420
  for (this.clear(); ++t < n; ) {
421
421
  var s = e[t];
422
422
  this.set(s[0], s[1]);
423
423
  }
424
424
  }
425
- Ae.prototype.clear = sa;
426
- Ae.prototype.delete = ia;
427
- Ae.prototype.get = aa;
428
- Ae.prototype.has = oa;
429
- Ae.prototype.set = la;
425
+ Le.prototype.clear = sa;
426
+ Le.prototype.delete = ia;
427
+ Le.prototype.get = aa;
428
+ Le.prototype.has = oa;
429
+ Le.prototype.set = la;
430
430
  var ca = "Expected a function";
431
431
  function $t(e, t) {
432
432
  if (typeof e != "function" || t != null && typeof t != "function")
@@ -438,9 +438,9 @@ function $t(e, t) {
438
438
  var a = e.apply(this, s);
439
439
  return n.cache = i.set(r, a) || i, a;
440
440
  };
441
- return n.cache = new ($t.Cache || Ae)(), n;
441
+ return n.cache = new ($t.Cache || Le)(), n;
442
442
  }
443
- $t.Cache = Ae;
443
+ $t.Cache = Le;
444
444
  var ua = 500;
445
445
  function ha(e) {
446
446
  var t = $t(e, function(s) {
@@ -455,7 +455,7 @@ var fa = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=
455
455
  }), t;
456
456
  });
457
457
  function Ea(e) {
458
- return e == null ? "" : Yn(e);
458
+ return e == null ? "" : zn(e);
459
459
  }
460
460
  function is(e, t) {
461
461
  return pe(e) ? e : Gt(e, t) ? [e] : da(Ea(e));
@@ -483,7 +483,7 @@ function ls(e, t) {
483
483
  }
484
484
  var Tn = Ne ? Ne.isConcatSpreadable : void 0;
485
485
  function Na(e) {
486
- return pe(e) || Vt(e) || !!(Tn && e && e[Tn]);
486
+ return pe(e) || Ct(e) || !!(Tn && e && e[Tn]);
487
487
  }
488
488
  function Ta(e, t, n, s, r) {
489
489
  var i = -1, a = e.length;
@@ -498,7 +498,7 @@ function bn(e) {
498
498
  return t ? Ta(e) : [];
499
499
  }
500
500
  function ba() {
501
- this.__data__ = new ge(), this.size = 0;
501
+ this.__data__ = new Ae(), this.size = 0;
502
502
  }
503
503
  function ma(e) {
504
504
  var t = this.__data__, n = t.delete(e);
@@ -513,23 +513,23 @@ function _a(e) {
513
513
  var ga = 200;
514
514
  function Aa(e, t) {
515
515
  var n = this.__data__;
516
- if (n instanceof ge) {
516
+ if (n instanceof Ae) {
517
517
  var s = n.__data__;
518
518
  if (!Qe || s.length < ga - 1)
519
519
  return s.push([e, t]), this.size = ++n.size, this;
520
- n = this.__data__ = new Ae(s);
520
+ n = this.__data__ = new Le(s);
521
521
  }
522
522
  return n.set(e, t), this.size = n.size, this;
523
523
  }
524
- function Ie(e) {
525
- var t = this.__data__ = new ge(e);
524
+ function _e(e) {
525
+ var t = this.__data__ = new Ae(e);
526
526
  this.size = t.size;
527
527
  }
528
- Ie.prototype.clear = ba;
529
- Ie.prototype.delete = ma;
530
- Ie.prototype.get = Ia;
531
- Ie.prototype.has = _a;
532
- Ie.prototype.set = Aa;
528
+ _e.prototype.clear = ba;
529
+ _e.prototype.delete = ma;
530
+ _e.prototype.get = Ia;
531
+ _e.prototype.has = _a;
532
+ _e.prototype.set = Aa;
533
533
  function cs(e, t) {
534
534
  for (var n = -1, s = e == null ? 0 : e.length, r = 0, i = []; ++n < s; ) {
535
535
  var a = e[n];
@@ -545,16 +545,16 @@ var va = Object.prototype, ya = va.propertyIsEnumerable, mn = Object.getOwnPrope
545
545
  return ya.call(e, t);
546
546
  }));
547
547
  } : La;
548
- function Sa(e, t, n) {
548
+ function Pa(e, t, n) {
549
549
  var s = t(e);
550
550
  return pe(e) ? s : ls(s, n(e));
551
551
  }
552
552
  function In(e) {
553
- return Sa(e, Ct, wa);
553
+ return Pa(e, Vt, wa);
554
554
  }
555
- var xt = Fe(_e, "DataView"), Dt = Fe(_e, "Promise"), Rt = Fe(_e, "Set"), _n = "[object Map]", Pa = "[object Object]", gn = "[object Promise]", An = "[object Set]", Ln = "[object WeakMap]", vn = "[object DataView]", Oa = Me(xt), xa = Me(Qe), Da = Me(Dt), Ra = Me(Rt), ka = Me(Pt), we = Xe;
556
- (xt && we(new xt(new ArrayBuffer(1))) != vn || Qe && we(new Qe()) != _n || Dt && we(Dt.resolve()) != gn || Rt && we(new Rt()) != An || Pt && we(new Pt()) != Ln) && (we = function(e) {
557
- var t = Xe(e), n = t == Pa ? e.constructor : void 0, s = n ? Me(n) : "";
555
+ var xt = Fe(ge, "DataView"), Dt = Fe(ge, "Promise"), kt = Fe(ge, "Set"), _n = "[object Map]", Sa = "[object Object]", gn = "[object Promise]", An = "[object Set]", Ln = "[object WeakMap]", vn = "[object DataView]", Oa = Me(xt), xa = Me(Qe), Da = Me(Dt), ka = Me(kt), Ra = Me(St), we = Xe;
556
+ (xt && we(new xt(new ArrayBuffer(1))) != vn || Qe && we(new Qe()) != _n || Dt && we(Dt.resolve()) != gn || kt && we(new kt()) != An || St && we(new St()) != Ln) && (we = function(e) {
557
+ var t = Xe(e), n = t == Sa ? e.constructor : void 0, s = n ? Me(n) : "";
558
558
  if (s)
559
559
  switch (s) {
560
560
  case Oa:
@@ -563,14 +563,14 @@ var xt = Fe(_e, "DataView"), Dt = Fe(_e, "Promise"), Rt = Fe(_e, "Set"), _n = "[
563
563
  return _n;
564
564
  case Da:
565
565
  return gn;
566
- case Ra:
567
- return An;
568
566
  case ka:
567
+ return An;
568
+ case Ra:
569
569
  return Ln;
570
570
  }
571
571
  return t;
572
572
  });
573
- var yn = _e.Uint8Array, Ua = "__lodash_hash_undefined__";
573
+ var yn = ge.Uint8Array, Ua = "__lodash_hash_undefined__";
574
574
  function Ma(e) {
575
575
  return this.__data__.set(e, Ua), this;
576
576
  }
@@ -579,7 +579,7 @@ function Fa(e) {
579
579
  }
580
580
  function ot(e) {
581
581
  var t = -1, n = e == null ? 0 : e.length;
582
- for (this.__data__ = new Ae(); ++t < n; )
582
+ for (this.__data__ = new Le(); ++t < n; )
583
583
  this.add(e[t]);
584
584
  }
585
585
  ot.prototype.add = ot.prototype.push = Ma;
@@ -590,12 +590,12 @@ function Ba(e, t) {
590
590
  return !0;
591
591
  return !1;
592
592
  }
593
- function Va(e, t) {
593
+ function Ca(e, t) {
594
594
  return e.has(t);
595
595
  }
596
- var Ca = 1, Ga = 2;
596
+ var Va = 1, Ga = 2;
597
597
  function us(e, t, n, s, r, i) {
598
- var a = n & Ca, o = e.length, u = t.length;
598
+ var a = n & Va, o = e.length, u = t.length;
599
599
  if (o != u && !(a && u > o))
600
600
  return !1;
601
601
  var p = i.get(e), h = i.get(t);
@@ -613,9 +613,9 @@ function us(e, t, n, s, r, i) {
613
613
  break;
614
614
  }
615
615
  if (b) {
616
- if (!Ba(t, function(H, z) {
617
- if (!Va(b, z) && (A === H || r(A, H, n, s, i)))
618
- return b.push(z);
616
+ if (!Ba(t, function(H, K) {
617
+ if (!Ca(b, K) && (A === H || r(A, H, n, s, i)))
618
+ return b.push(K);
619
619
  })) {
620
620
  N = !1;
621
621
  break;
@@ -639,7 +639,7 @@ function Xa(e) {
639
639
  n[++t] = s;
640
640
  }), n;
641
641
  }
642
- var ja = 1, Wa = 2, Ha = "[object Boolean]", za = "[object Date]", Ya = "[object Error]", qa = "[object Map]", Ka = "[object Number]", Qa = "[object RegExp]", Ja = "[object Set]", Za = "[object String]", eo = "[object Symbol]", to = "[object ArrayBuffer]", no = "[object DataView]", wn = Ne ? Ne.prototype : void 0, St = wn ? wn.valueOf : void 0;
642
+ var ja = 1, Wa = 2, Ha = "[object Boolean]", Ka = "[object Date]", za = "[object Error]", Ya = "[object Map]", qa = "[object Number]", Qa = "[object RegExp]", Ja = "[object Set]", Za = "[object String]", eo = "[object Symbol]", to = "[object ArrayBuffer]", no = "[object DataView]", wn = Ne ? Ne.prototype : void 0, Pt = wn ? wn.valueOf : void 0;
643
643
  function so(e, t, n, s, r, i, a) {
644
644
  switch (n) {
645
645
  case no:
@@ -649,15 +649,15 @@ function so(e, t, n, s, r, i, a) {
649
649
  case to:
650
650
  return !(e.byteLength != t.byteLength || !i(new yn(e), new yn(t)));
651
651
  case Ha:
652
- case za:
653
652
  case Ka:
653
+ case qa:
654
654
  return Qn(+e, +t);
655
- case Ya:
655
+ case za:
656
656
  return e.name == t.name && e.message == t.message;
657
657
  case Qa:
658
658
  case Za:
659
659
  return e == t + "";
660
- case qa:
660
+ case Ya:
661
661
  var o = $a;
662
662
  case Ja:
663
663
  var u = s & ja;
@@ -670,8 +670,8 @@ function so(e, t, n, s, r, i, a) {
670
670
  var h = us(o(e), o(t), s, r, i, a);
671
671
  return a.delete(e), h;
672
672
  case eo:
673
- if (St)
674
- return St.call(e) == St.call(t);
673
+ if (Pt)
674
+ return Pt.call(e) == Pt.call(t);
675
675
  }
676
676
  return !1;
677
677
  }
@@ -692,25 +692,25 @@ function oo(e, t, n, s, r, i) {
692
692
  i.set(e, t), i.set(t, e);
693
693
  for (var v = a; ++d < u; ) {
694
694
  N = o[d];
695
- var H = e[N], z = t[N];
695
+ var H = e[N], K = t[N];
696
696
  if (s)
697
- var w = a ? s(z, H, N, t, e, i) : s(H, z, N, e, t, i);
698
- if (!(w === void 0 ? H === z || r(H, z, n, s, i) : w)) {
697
+ var w = a ? s(K, H, N, t, e, i) : s(H, K, N, e, t, i);
698
+ if (!(w === void 0 ? H === K || r(H, K, n, s, i) : w)) {
699
699
  m = !1;
700
700
  break;
701
701
  }
702
702
  v || (v = N == "constructor");
703
703
  }
704
704
  if (m && !v) {
705
- var J = e.constructor, G = t.constructor;
706
- J != G && "constructor" in e && "constructor" in t && !(typeof J == "function" && J instanceof J && typeof G == "function" && G instanceof G) && (m = !1);
705
+ var J = e.constructor, V = t.constructor;
706
+ J != V && "constructor" in e && "constructor" in t && !(typeof J == "function" && J instanceof J && typeof V == "function" && V instanceof V) && (m = !1);
707
707
  }
708
708
  return i.delete(e), i.delete(t), m;
709
709
  }
710
- var lo = 1, Sn = "[object Arguments]", Pn = "[object Array]", st = "[object Object]", co = Object.prototype, On = co.hasOwnProperty;
710
+ var lo = 1, Pn = "[object Arguments]", Sn = "[object Array]", st = "[object Object]", co = Object.prototype, On = co.hasOwnProperty;
711
711
  function uo(e, t, n, s, r, i) {
712
- var a = pe(e), o = pe(t), u = a ? Pn : we(e), p = o ? Pn : we(t);
713
- u = u == Sn ? st : u, p = p == Sn ? st : p;
712
+ var a = pe(e), o = pe(t), u = a ? Sn : we(e), p = o ? Sn : we(t);
713
+ u = u == Pn ? st : u, p = p == Pn ? st : p;
714
714
  var h = u == st, d = p == st, N = u == p;
715
715
  if (N && Ot(e)) {
716
716
  if (!Ot(t))
@@ -718,15 +718,15 @@ function uo(e, t, n, s, r, i) {
718
718
  a = !0, h = !1;
719
719
  }
720
720
  if (N && !h)
721
- return i || (i = new Ie()), a || ss(e) ? us(e, t, n, s, r, i) : so(e, t, u, n, s, r, i);
721
+ return i || (i = new _e()), a || ss(e) ? us(e, t, n, s, r, i) : so(e, t, u, n, s, r, i);
722
722
  if (!(n & lo)) {
723
723
  var b = h && On.call(e, "__wrapped__"), A = d && On.call(t, "__wrapped__");
724
724
  if (b || A) {
725
725
  var m = b ? e.value() : e, v = A ? t.value() : t;
726
- return i || (i = new Ie()), r(m, v, n, s, i);
726
+ return i || (i = new _e()), r(m, v, n, s, i);
727
727
  }
728
728
  }
729
- return N ? (i || (i = new Ie()), oo(e, t, n, s, r, i)) : !1;
729
+ return N ? (i || (i = new _e()), oo(e, t, n, s, r, i)) : !1;
730
730
  }
731
731
  function Xt(e, t, n, s, r) {
732
732
  return e === t ? !0 : e == null || t == null || !xe(e) && !xe(t) ? e !== e && t !== t : uo(e, t, n, s, Xt, r);
@@ -748,7 +748,7 @@ function po(e, t, n, s) {
748
748
  if (u === void 0 && !(o in e))
749
749
  return !1;
750
750
  } else {
751
- var h = new Ie(), d;
751
+ var h = new _e(), d;
752
752
  if (!(d === void 0 ? Xt(p, u, ho | fo, s, h) : d))
753
753
  return !1;
754
754
  }
@@ -759,7 +759,7 @@ function hs(e) {
759
759
  return e === e && !Ge(e);
760
760
  }
761
761
  function Eo(e) {
762
- for (var t = Ct(e), n = t.length; n--; ) {
762
+ for (var t = Vt(e), n = t.length; n--; ) {
763
763
  var s = t[n], r = e[s];
764
764
  t[n] = [s, r, hs(r)];
765
765
  }
@@ -787,7 +787,7 @@ function bo(e, t, n) {
787
787
  break;
788
788
  e = e[a];
789
789
  }
790
- return i || ++s != r ? i : (r = e == null ? 0 : e.length, !!r && Bt(r) && Kn(a, r) && (pe(e) || Vt(e)));
790
+ return i || ++s != r ? i : (r = e == null ? 0 : e.length, !!r && Bt(r) && qn(a, r) && (pe(e) || Ct(e)));
791
791
  }
792
792
  function mo(e, t) {
793
793
  return e != null && bo(e, t, To);
@@ -834,9 +834,9 @@ function yo(e) {
834
834
  }
835
835
  var Es = yo();
836
836
  function wo(e, t) {
837
- return e && Es(e, t, Ct);
837
+ return e && Es(e, t, Vt);
838
838
  }
839
- function So(e, t) {
839
+ function Po(e, t) {
840
840
  return function(n, s) {
841
841
  if (n == null)
842
842
  return n;
@@ -847,9 +847,9 @@ function So(e, t) {
847
847
  return n;
848
848
  };
849
849
  }
850
- var Po = So(wo);
850
+ var So = Po(wo);
851
851
  function Oo(e, t, n, s) {
852
- return Po(e, function(r, i, a) {
852
+ return So(e, function(r, i, a) {
853
853
  t(s, r, n(r), a);
854
854
  }), s;
855
855
  }
@@ -862,33 +862,33 @@ function xo(e, t) {
862
862
  function Do(e) {
863
863
  return xe(e) && Nt(e);
864
864
  }
865
- function F(e) {
865
+ function M(e) {
866
866
  var t = e == null ? 0 : e.length;
867
867
  return t ? e[t - 1] : void 0;
868
868
  }
869
- function Ro(e) {
869
+ function ko(e) {
870
870
  return typeof e == "function" ? e : Et;
871
871
  }
872
- var ko = Math.max, Uo = Math.min;
872
+ var Ro = Math.max, Uo = Math.min;
873
873
  function Mo(e, t, n) {
874
874
  var s = e == null ? 0 : e.length;
875
875
  if (!s)
876
876
  return -1;
877
877
  var r = s - 1;
878
- return n !== void 0 && (r = dr(n), r = n < 0 ? ko(s + r, 0) : Uo(r, s - 1)), Vr(e, ds(t), r);
878
+ return n !== void 0 && (r = dr(n), r = n < 0 ? Ro(s + r, 0) : Uo(r, s - 1)), Cr(e, ds(t), r);
879
879
  }
880
880
  function Fo(e) {
881
881
  return e && e.length ? e[0] : void 0;
882
882
  }
883
883
  function Je(e, t) {
884
- return e == null ? e : Es(e, Ro(t), Mi);
884
+ return e == null ? e : Es(e, ko(t), Mi);
885
885
  }
886
886
  var oe = xo(function(e, t, n) {
887
887
  e[n ? 0 : 1].push(t);
888
888
  }, function() {
889
889
  return [[], []];
890
890
  }), Bo = Math.max;
891
- function Vo(e) {
891
+ function Co(e) {
892
892
  if (!(e && e.length))
893
893
  return [];
894
894
  var t = 0;
@@ -896,11 +896,11 @@ function Vo(e) {
896
896
  if (Do(n))
897
897
  return t = Bo(n.length, t), !0;
898
898
  }), Zn(t, function(n) {
899
- return zn(e, ps(n));
899
+ return Kn(e, ps(n));
900
900
  });
901
901
  }
902
- var kt = Xr(Vo), f = /* @__PURE__ */ ((e) => (e.SPACE = "<space>", e.TAB = "<tab>", e.NEWLINE = "<newline>", e.COMMA = "<comma>", e.LPAREN = "<lparen>", e.RPAREN = "<rparen>", e.LBRACE = "<lbrace>", e.RBRACE = "<rbrace>", e.LBRACKET = "<lbracket>", e.RBRACKET = "<rbracket>", e.LANGLE = "<langle>", e.RANGLE = "<rangle>", e.OP = "<op>", e.EOF = "<eof>", e.NUMERIC_LITERAL = "<number>", e.STRING_LITERAL = "<string>", e.COLOR_LITERAL = "<color>", e.FUNCTION_EXPRESSION = "<function-expression>", e.QUOTED_STRING = "<variable>", e.IDENTIFIER = "<identifier>", e.SEMICOLON = "<semicolon>", e.COLON = "<colon>", e.TILDE = "<tilde>", e.SINGLE_LINE_COMMENT = "<single-line-comment>", e.MULTILINE_COMMENT = "<multiline-comment>", e))(f || {});
903
- function Co(e) {
902
+ var Rt = Xr(Co), f = /* @__PURE__ */ ((e) => (e.SPACE = "<space>", e.TAB = "<tab>", e.NEWLINE = "<newline>", e.COMMA = "<comma>", e.LPAREN = "<lparen>", e.RPAREN = "<rparen>", e.LBRACE = "<lbrace>", e.RBRACE = "<rbrace>", e.LBRACKET = "<lbracket>", e.RBRACKET = "<rbracket>", e.LANGLE = "<langle>", e.RANGLE = "<rangle>", e.OP = "<op>", e.EOF = "<eof>", e.NUMERIC_LITERAL = "<number>", e.STRING_LITERAL = "<string>", e.COLOR_LITERAL = "<color>", e.FUNCTION_EXPRESSION = "<function-expression>", e.QUOTED_STRING = "<variable>", e.IDENTIFIER = "<identifier>", e.SEMICOLON = "<semicolon>", e.COLON = "<colon>", e.TILDE = "<tilde>", e.SINGLE_LINE_COMMENT = "<single-line-comment>", e.MULTILINE_COMMENT = "<multiline-comment>", e))(f || {});
903
+ function Vo(e) {
904
904
  switch (e.kind) {
905
905
  case "<newline>":
906
906
  case "<space>":
@@ -954,7 +954,7 @@ function Ut(e) {
954
954
  return e.trailingTrivia.find(({ kind: t }) => [f.SPACE, f.TAB].includes(t)) !== void 0;
955
955
  }
956
956
  function Ts(e) {
957
- return e.trailingTrivia.length === 0 ? e.end : Ts(F(e.trailingTrivia));
957
+ return e.trailingTrivia.length === 0 ? e.end : Ts(M(e.trailingTrivia));
958
958
  }
959
959
  function bs(e) {
960
960
  return e.leadingTrivia.length === 0 ? e.start : bs(e.leadingTrivia[0]);
@@ -975,7 +975,7 @@ class Xo {
975
975
  return this.id++;
976
976
  }
977
977
  }
978
- class U {
978
+ class R {
979
979
  // The symbol that this syntax node refers to
980
980
  // args must be passed in order of appearance in the node
981
981
  constructor(t, n, s) {
@@ -995,12 +995,12 @@ class U {
995
995
  }
996
996
  }
997
997
  var Oe = /* @__PURE__ */ ((e) => (e.PROGRAM = "<program>", e.ELEMENT_DECLARATION = "<element-declaration>", e.ATTRIBUTE = "<attribute>", e.IDENTIFIER_STREAM = "<identifer-stream>", e.LITERAL = "<literal>", e.VARIABLE = "<variable>", e.PREFIX_EXPRESSION = "<prefix-expression>", e.INFIX_EXPRESSION = "<infix-expression>", e.POSTFIX_EXPRESSION = "<postfix-expression>", e.FUNCTION_EXPRESSION = "<function-expression>", e.FUNCTION_APPLICATION = "<function-application>", e.BLOCK_EXPRESSION = "<block-expression>", e.LIST_EXPRESSION = "<list-expression>", e.TUPLE_EXPRESSION = "<tuple-expression>", e.CALL_EXPRESSION = "<call-expression>", e.PRIMARY_EXPRESSION = "<primary-expression>", e.GROUP_EXPRESSION = "<group-expression>", e.DUMMY = "<dummy>", e.ARRAY = "<array>", e.PARTIAL_INJECTION = "<partial-injection>", e))(Oe || {});
998
- class ne extends U {
998
+ class ne extends R {
999
999
  constructor({ body: t = [], eof: n }, s) {
1000
1000
  super(s, "<program>", [...t, n]), this.body = t, this.eof = n;
1001
1001
  }
1002
1002
  }
1003
- class P extends U {
1003
+ class S extends R {
1004
1004
  constructor({
1005
1005
  type: t,
1006
1006
  name: n,
@@ -1018,17 +1018,17 @@ class P extends U {
1018
1018
  i,
1019
1019
  a,
1020
1020
  o
1021
- ]), o && a && !(o instanceof y || o instanceof P))
1021
+ ]), o && a && !(o instanceof y || o instanceof S))
1022
1022
  throw new Error("If an element has a simple body, it must be a function application node");
1023
1023
  this.type = t, this.name = n, this.as = s, this.alias = r, this.attributeList = i, this.bodyColon = a, this.body = o;
1024
1024
  }
1025
1025
  }
1026
- class ce extends U {
1026
+ class ce extends R {
1027
1027
  constructor({ identifiers: t = [] }, n) {
1028
1028
  super(n, "<identifer-stream>", t || []), this.identifiers = t;
1029
1029
  }
1030
1030
  }
1031
- class ue extends U {
1031
+ class ue extends R {
1032
1032
  constructor({
1033
1033
  name: t,
1034
1034
  colon: n,
@@ -1037,12 +1037,12 @@ class ue extends U {
1037
1037
  super(r, "<attribute>", [t, n, s]), this.name = t, this.value = s, this.colon = n;
1038
1038
  }
1039
1039
  }
1040
- class re extends U {
1040
+ class re extends R {
1041
1041
  constructor({ op: t, expression: n }, s) {
1042
1042
  super(s, "<prefix-expression>", [t, n]), this.op = t, this.expression = n;
1043
1043
  }
1044
1044
  }
1045
- class Te extends U {
1045
+ class Te extends R {
1046
1046
  constructor({
1047
1047
  op: t,
1048
1048
  leftExpression: n,
@@ -1051,22 +1051,22 @@ class Te extends U {
1051
1051
  super(r, "<infix-expression>", [n, t, s]), this.op = t, this.leftExpression = n, this.rightExpression = s;
1052
1052
  }
1053
1053
  }
1054
- class It extends U {
1054
+ class It extends R {
1055
1055
  constructor({ op: t, expression: n }, s) {
1056
1056
  super(s, "<postfix-expression>", [n, t]), this.op = t, this.expression = n;
1057
1057
  }
1058
1058
  }
1059
- class ie extends U {
1059
+ class ie extends R {
1060
1060
  constructor({ value: t }, n) {
1061
1061
  super(n, "<function-expression>", [t]), this.value = t;
1062
1062
  }
1063
1063
  }
1064
- class y extends U {
1064
+ class y extends R {
1065
1065
  constructor({ callee: t, args: n = [] }, s) {
1066
1066
  super(s, "<function-application>", [t, ...n]), this.callee = t, this.args = n;
1067
1067
  }
1068
1068
  }
1069
- class Ee extends U {
1069
+ class Ee extends R {
1070
1070
  constructor({
1071
1071
  blockOpenBrace: t,
1072
1072
  body: n = [],
@@ -1075,12 +1075,12 @@ class Ee extends U {
1075
1075
  super(r, "<block-expression>", [t, ...n, s]), this.blockOpenBrace = t, this.body = n, this.blockCloseBrace = s;
1076
1076
  }
1077
1077
  }
1078
- class Re extends U {
1078
+ class ke extends R {
1079
1079
  constructor({ op: t, partial: n }, s) {
1080
1080
  super(s, "<partial-injection>", [t, n]), this.partial = n;
1081
1081
  }
1082
1082
  }
1083
- class k extends U {
1083
+ class k extends R {
1084
1084
  constructor({
1085
1085
  listOpenBracket: t,
1086
1086
  elementList: n = [],
@@ -1094,7 +1094,7 @@ class k extends U {
1094
1094
  ]), this.listOpenBracket = t, this.elementList = n, this.commaList = s, this.listCloseBracket = r;
1095
1095
  }
1096
1096
  }
1097
- class be extends U {
1097
+ class be extends R {
1098
1098
  constructor({
1099
1099
  tupleOpenParen: t,
1100
1100
  elementList: n = [],
@@ -1125,7 +1125,7 @@ class jt extends be {
1125
1125
  ), this.kind = "<group-expression>";
1126
1126
  }
1127
1127
  }
1128
- class ae extends U {
1128
+ class ae extends R {
1129
1129
  constructor({
1130
1130
  callee: t,
1131
1131
  argumentList: n
@@ -1133,28 +1133,28 @@ class ae extends U {
1133
1133
  super(s, "<call-expression>", [t, n]), this.callee = t, this.argumentList = n;
1134
1134
  }
1135
1135
  }
1136
- class je extends U {
1136
+ class je extends R {
1137
1137
  constructor({ literal: t }, n) {
1138
1138
  super(n, "<literal>", [t]), this.literal = t;
1139
1139
  }
1140
1140
  }
1141
- class de extends U {
1141
+ class de extends R {
1142
1142
  constructor({ variable: t }, n) {
1143
1143
  super(n, "<variable>", [t]), this.variable = t;
1144
1144
  }
1145
1145
  }
1146
- class Y extends U {
1146
+ class z extends R {
1147
1147
  constructor({ expression: t }, n) {
1148
1148
  super(n, "<primary-expression>", [t]), this.expression = t;
1149
1149
  }
1150
1150
  }
1151
- class rt extends U {
1151
+ class rt extends R {
1152
1152
  constructor({ pre: t }, n) {
1153
1153
  const s = te.create(f.SPACE, t.endPos, t.endPos, " ", !1);
1154
1154
  super(n, "<dummy>", [s]);
1155
1155
  }
1156
1156
  }
1157
- class ke extends U {
1157
+ class Re extends R {
1158
1158
  constructor({ expression: t, indexer: n }, s) {
1159
1159
  super(s, "<array>", [t, n]), this.array = t, this.indexer = n;
1160
1160
  }
@@ -1165,11 +1165,11 @@ function ms(e, t) {
1165
1165
  if (!t || t.length === 0)
1166
1166
  return e || [];
1167
1167
  const [n] = e, [s] = t;
1168
- return (n.start < s.start ? bn(kt(e, t)) : bn(kt(t, e))).filter(
1168
+ return (n.start < s.start ? bn(Rt(e, t)) : bn(Rt(t, e))).filter(
1169
1169
  (r) => r !== null
1170
1170
  );
1171
1171
  }
1172
- function ac(e, t = !1) {
1172
+ function oc(e, t = !1) {
1173
1173
  return JSON.stringify(
1174
1174
  e,
1175
1175
  function(n, s) {
@@ -1195,7 +1195,7 @@ function ac(e, t = !1) {
1195
1195
  t ? 2 : 0
1196
1196
  );
1197
1197
  }
1198
- class V {
1198
+ class B {
1199
1199
  constructor(t) {
1200
1200
  this.value = t;
1201
1201
  }
@@ -1210,7 +1210,7 @@ class V {
1210
1210
  return t(this.value);
1211
1211
  }
1212
1212
  map(t) {
1213
- return new V(t(this.value));
1213
+ return new B(t(this.value));
1214
1214
  }
1215
1215
  isOk() {
1216
1216
  return !0;
@@ -1252,19 +1252,19 @@ function _t(e) {
1252
1252
  function Ht(e) {
1253
1253
  return `Enum:${e}`;
1254
1254
  }
1255
- function zt(e) {
1255
+ function Kt(e) {
1256
1256
  return `Enum field:${e}`;
1257
1257
  }
1258
- function Yt(e) {
1258
+ function zt(e) {
1259
1259
  return `TableGroup:${e}`;
1260
1260
  }
1261
- function qt(e) {
1261
+ function Yt(e) {
1262
1262
  return `TableGroup field:${e}`;
1263
1263
  }
1264
1264
  function jo(e) {
1265
1265
  return `Note:${e}`;
1266
1266
  }
1267
- function Kt(e) {
1267
+ function qt(e) {
1268
1268
  return `TablePartial:${e}`;
1269
1269
  }
1270
1270
  function Is(e) {
@@ -1277,24 +1277,24 @@ function it(e, t) {
1277
1277
  case "Enum":
1278
1278
  return Ht(e);
1279
1279
  case "Enum field":
1280
- return zt(e);
1280
+ return Kt(e);
1281
1281
  case "Schema":
1282
1282
  return Wt(e);
1283
1283
  case "Table":
1284
1284
  return lt(e);
1285
1285
  case "TableGroup":
1286
- return Yt(e);
1286
+ return zt(e);
1287
1287
  case "TableGroup field":
1288
- return qt(e);
1288
+ return Yt(e);
1289
1289
  case "TablePartial":
1290
- return Kt(e);
1290
+ return qt(e);
1291
1291
  default:
1292
1292
  throw new Error("Unreachable");
1293
1293
  }
1294
1294
  }
1295
1295
  function he(e) {
1296
1296
  const [t, n] = e.split(":");
1297
- return Object.values(I).includes(t) ? new V({
1297
+ return Object.values(I).includes(t) ? new B({
1298
1298
  name: n,
1299
1299
  kind: t
1300
1300
  }) : new x();
@@ -1312,7 +1312,7 @@ function Ho(e) {
1312
1312
  const { kind: n } = t;
1313
1313
  return n === "TablePartialInjection";
1314
1314
  }
1315
- function zo(e) {
1315
+ function Ko(e) {
1316
1316
  const t = he(e).unwrap_or(void 0);
1317
1317
  if (!t) return null;
1318
1318
  const { kind: n, name: s } = t;
@@ -1322,7 +1322,7 @@ function zo(e) {
1322
1322
  /* TablePartial */
1323
1323
  ) : null;
1324
1324
  }
1325
- class Yo {
1325
+ class zo {
1326
1326
  constructor() {
1327
1327
  this.id = 0;
1328
1328
  }
@@ -1338,12 +1338,12 @@ class _s {
1338
1338
  this.references = [], this.id = n, this.symbolTable = t;
1339
1339
  }
1340
1340
  }
1341
- class qo {
1341
+ class Yo {
1342
1342
  constructor({ symbolTable: t, declaration: n }, s) {
1343
1343
  this.references = [], this.id = s, this.symbolTable = t, this.declaration = n;
1344
1344
  }
1345
1345
  }
1346
- class Ko {
1346
+ class qo {
1347
1347
  constructor({ declaration: t }, n) {
1348
1348
  this.references = [], this.id = n, this.declaration = t;
1349
1349
  }
@@ -1388,11 +1388,11 @@ function nl(e) {
1388
1388
  Wt,
1389
1389
  lt,
1390
1390
  Ht,
1391
- Yt,
1392
- _t,
1393
1391
  zt,
1394
- qt,
1392
+ _t,
1395
1393
  Kt,
1394
+ Yt,
1395
+ qt,
1396
1396
  Is
1397
1397
  ].map((t) => t(e));
1398
1398
  }
@@ -1410,16 +1410,16 @@ function rl(e) {
1410
1410
  const [t] = e;
1411
1411
  return ct(t) || gt(t) && t.toLowerCase() >= "a" && t.toLowerCase() <= "f";
1412
1412
  }
1413
- function Ce(e) {
1413
+ function Ve(e) {
1414
1414
  return gt(e) || ct(e);
1415
1415
  }
1416
- function Rn(e, t) {
1416
+ function kn(e, t) {
1417
1417
  const n = [], s = Math.min(e.length, t.length);
1418
1418
  for (let r = 0; r < s; r += 1)
1419
1419
  n.push(e[r], t[r]);
1420
1420
  return n.push(...e.slice(s), ...t.slice(s)), n;
1421
1421
  }
1422
- function qe(e, t) {
1422
+ function Ye(e, t) {
1423
1423
  return e >= t.start && e < t.end;
1424
1424
  }
1425
1425
  function As(e) {
@@ -1430,7 +1430,7 @@ function Mt(e) {
1430
1430
  var t;
1431
1431
  return e instanceof re ? ((t = e.op) == null ? void 0 : t.value) === "-" ? -Mt(e.expression) : Mt(e.expression) : Number.parseFloat(e.expression.literal.value);
1432
1432
  }
1433
- var l = /* @__PURE__ */ ((e) => (e[e.UNKNOWN_SYMBOL = 1e3] = "UNKNOWN_SYMBOL", e[e.UNEXPECTED_SYMBOL = 1001] = "UNEXPECTED_SYMBOL", e[e.UNEXPECTED_EOF = 1002] = "UNEXPECTED_EOF", e[e.UNEXPECTED_NEWLINE = 1003] = "UNEXPECTED_NEWLINE", e[e.UNKNOWN_TOKEN = 1004] = "UNKNOWN_TOKEN", e[e.UNEXPECTED_TOKEN = 1005] = "UNEXPECTED_TOKEN", e[e.UNEXPECTED_ELEMENT_DECLARATION = 1006] = "UNEXPECTED_ELEMENT_DECLARATION", e[e.MISSING_SPACES = 1007] = "MISSING_SPACES", e[e.UNKNOWN_PREFIX_OP = 1008] = "UNKNOWN_PREFIX_OP", e[e.INVALID_OPERAND = 1009] = "INVALID_OPERAND", e[e.EMPTY_ATTRIBUTE_NAME = 1010] = "EMPTY_ATTRIBUTE_NAME", e[e.INVALID_ESCAPE_SEQUENCE = 1011] = "INVALID_ESCAPE_SEQUENCE", e[e.INVALID_NAME = 3e3] = "INVALID_NAME", e[e.UNEXPECTED_NAME = 3001] = "UNEXPECTED_NAME", e[e.NAME_NOT_FOUND = 3002] = "NAME_NOT_FOUND", e[e.DUPLICATE_NAME = 3003] = "DUPLICATE_NAME", e[e.INVALID_ALIAS = 3004] = "INVALID_ALIAS", e[e.UNEXPECTED_ALIAS = 3005] = "UNEXPECTED_ALIAS", e[e.UNEXPECTED_SETTINGS = 3006] = "UNEXPECTED_SETTINGS", e[e.INVALID_SETTINGS = 3007] = "INVALID_SETTINGS", e[e.UNEXPECTED_SIMPLE_BODY = 3008] = "UNEXPECTED_SIMPLE_BODY", e[e.UNEXPECTED_COMPLEX_BODY = 3009] = "UNEXPECTED_COMPLEX_BODY", e[e.INVALID_TABLE_CONTEXT = 3010] = "INVALID_TABLE_CONTEXT", e[e.UNKNOWN_TABLE_SETTING = 3011] = "UNKNOWN_TABLE_SETTING", e[e.DUPLICATE_TABLE_SETTING = 3012] = "DUPLICATE_TABLE_SETTING", e[e.INVALID_TABLEGROUP_CONTEXT = 3013] = "INVALID_TABLEGROUP_CONTEXT", e[e.INVALID_TABLEGROUP_ELEMENT_NAME = 3014] = "INVALID_TABLEGROUP_ELEMENT_NAME", e[e.DUPLICATE_TABLEGROUP_ELEMENT_NAME = 3015] = "DUPLICATE_TABLEGROUP_ELEMENT_NAME", e[e.DUPLICATE_TABLEGROUP_FIELD_NAME = 3016] = "DUPLICATE_TABLEGROUP_FIELD_NAME", e[e.INVALID_TABLEGROUP_FIELD = 3017] = "INVALID_TABLEGROUP_FIELD", e[e.EMPTY_TABLE = 3018] = "EMPTY_TABLE", e[e.INVALID_COLUMN = 3019] = "INVALID_COLUMN", e[e.INVALID_COLUMN_NAME = 3020] = "INVALID_COLUMN_NAME", e[e.UNKNOWN_COLUMN_SETTING = 3021] = "UNKNOWN_COLUMN_SETTING", e[e.INVALID_COLUMN_TYPE = 3022] = "INVALID_COLUMN_TYPE", e[e.DUPLICATE_COLUMN_NAME = 3023] = "DUPLICATE_COLUMN_NAME", e[e.DUPLICATE_COLUMN_SETTING = 3024] = "DUPLICATE_COLUMN_SETTING", e[e.INVALID_COLUMN_SETTING_VALUE = 3025] = "INVALID_COLUMN_SETTING_VALUE", e[e.INVALID_ENUM_CONTEXT = 3026] = "INVALID_ENUM_CONTEXT", e[e.INVALID_ENUM_ELEMENT_NAME = 3027] = "INVALID_ENUM_ELEMENT_NAME", e[e.INVALID_ENUM_ELEMENT = 3028] = "INVALID_ENUM_ELEMENT", e[e.DUPLICATE_ENUM_ELEMENT_NAME = 3029] = "DUPLICATE_ENUM_ELEMENT_NAME", e[e.UNKNOWN_ENUM_ELEMENT_SETTING = 3030] = "UNKNOWN_ENUM_ELEMENT_SETTING", e[e.DUPLICATE_ENUM_ELEMENT_SETTING = 3031] = "DUPLICATE_ENUM_ELEMENT_SETTING", e[e.INVALID_ENUM_ELEMENT_SETTING = 3032] = "INVALID_ENUM_ELEMENT_SETTING", e[e.EMPTY_ENUM = 3033] = "EMPTY_ENUM", e[e.INVALID_REF_CONTEXT = 3034] = "INVALID_REF_CONTEXT", e[e.UNKNOWN_REF_SETTING = 3035] = "UNKNOWN_REF_SETTING", e[e.DUPLICATE_REF_SETTING = 3036] = "DUPLICATE_REF_SETTING", e[e.INVALID_REF_SETTING_VALUE = 3037] = "INVALID_REF_SETTING_VALUE", e[e.INVALID_REF_RELATIONSHIP = 3038] = "INVALID_REF_RELATIONSHIP", e[e.INVALID_REF_FIELD = 3039] = "INVALID_REF_FIELD", e[e.EMPTY_REF = 3040] = "EMPTY_REF", e[e.REF_REDEFINED = 3041] = "REF_REDEFINED", e[e.INVALID_NOTE_CONTEXT = 3042] = "INVALID_NOTE_CONTEXT", e[e.INVALID_NOTE = 3043] = "INVALID_NOTE", e[e.NOTE_REDEFINED = 3044] = "NOTE_REDEFINED", e[e.NOTE_CONTENT_REDEFINED = 3045] = "NOTE_CONTENT_REDEFINED", e[e.EMPTY_NOTE = 3046] = "EMPTY_NOTE", e[e.INVALID_INDEXES_CONTEXT = 3047] = "INVALID_INDEXES_CONTEXT", e[e.INVALID_INDEXES_FIELD = 3048] = "INVALID_INDEXES_FIELD", e[e.INVALID_INDEX = 3049] = "INVALID_INDEX", e[e.UNKNOWN_INDEX_SETTING = 3050] = "UNKNOWN_INDEX_SETTING", e[e.DUPLICATE_INDEX_SETTING = 3051] = "DUPLICATE_INDEX_SETTING", e[e.UNEXPECTED_INDEX_SETTING_VALUE = 3052] = "UNEXPECTED_INDEX_SETTING_VALUE", e[e.INVALID_INDEX_SETTING_VALUE = 3053] = "INVALID_INDEX_SETTING_VALUE", e[e.INVALID_PROJECT_CONTEXT = 3054] = "INVALID_PROJECT_CONTEXT", e[e.PROJECT_REDEFINED = 3055] = "PROJECT_REDEFINED", e[e.INVALID_PROJECT_FIELD = 3056] = "INVALID_PROJECT_FIELD", e[e.INVALID_CUSTOM_CONTEXT = 3057] = "INVALID_CUSTOM_CONTEXT", e[e.INVALID_CUSTOM_ELEMENT_VALUE = 3058] = "INVALID_CUSTOM_ELEMENT_VALUE", e[e.INVALID_ELEMENT_IN_SIMPLE_BODY = 3059] = "INVALID_ELEMENT_IN_SIMPLE_BODY", e[e.INVALID_TABLE_PARTIAL_CONTEXT = 3060] = "INVALID_TABLE_PARTIAL_CONTEXT", e[e.INVALID_TABLE_PARTIAL_ELEMENT_NAME = 3061] = "INVALID_TABLE_PARTIAL_ELEMENT_NAME", e[e.INVALID_TABLE_PARTIAL_SETTING_VALUE = 3062] = "INVALID_TABLE_PARTIAL_SETTING_VALUE", e[e.DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME = 3063] = "DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME", e[e.DUPLICATE_TABLE_PARTIAL_SETTING = 3064] = "DUPLICATE_TABLE_PARTIAL_SETTING", e[e.INVALID_TABLE_PARTIAL_INJECTION = 3065] = "INVALID_TABLE_PARTIAL_INJECTION", e[e.INVALID_TABLE_PARTIAL_INJECTION_OP = 3066] = "INVALID_TABLE_PARTIAL_INJECTION_OP", e[e.INVALID_TABLE_PARTIAL_INJECTION_NAME = 3067] = "INVALID_TABLE_PARTIAL_INJECTION_NAME", e[e.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME = 3068] = "DUPLICATE_TABLE_PARTIAL_INJECTION_NAME", e[e.UNKNOWN_TABLE_PARTIAL_SETTING = 3069] = "UNKNOWN_TABLE_PARTIAL_SETTING", e[e.INVALID_TABLE_SETTING_VALUE = 3070] = "INVALID_TABLE_SETTING_VALUE", e[e.INVALID_CONSTRAINTS_CONTEXT = 3071] = "INVALID_CONSTRAINTS_CONTEXT", e[e.INVALID_CONSTRAINTS_FIELD = 3072] = "INVALID_CONSTRAINTS_FIELD", e[e.INVALID_CONSTRAINT = 3073] = "INVALID_CONSTRAINT", e[e.UNKNOWN_CONSTRAINT_SETTING = 3074] = "UNKNOWN_CONSTRAINT_SETTING", e[e.DUPLICATE_CONSTRAINT_SETTING = 3075] = "DUPLICATE_CONSTRAINT_SETTING", e[e.INVALID_CONSTRAINT_SETTING_VALUE = 3076] = "INVALID_CONSTRAINT_SETTING_VALUE", e[e.BINDING_ERROR = 4e3] = "BINDING_ERROR", e[e.UNSUPPORTED = 5e3] = "UNSUPPORTED", e[e.CIRCULAR_REF = 5001] = "CIRCULAR_REF", e[e.SAME_ENDPOINT = 5002] = "SAME_ENDPOINT", e[e.UNEQUAL_FIELDS_BINARY_REF = 5003] = "UNEQUAL_FIELDS_BINARY_REF", e[e.CONFLICTING_SETTING = 5004] = "CONFLICTING_SETTING", e[e.TABLE_REAPPEAR_IN_TABLEGROUP = 5005] = "TABLE_REAPPEAR_IN_TABLEGROUP", e))(l || {});
1433
+ var l = /* @__PURE__ */ ((e) => (e[e.UNKNOWN_SYMBOL = 1e3] = "UNKNOWN_SYMBOL", e[e.UNEXPECTED_SYMBOL = 1001] = "UNEXPECTED_SYMBOL", e[e.UNEXPECTED_EOF = 1002] = "UNEXPECTED_EOF", e[e.UNEXPECTED_NEWLINE = 1003] = "UNEXPECTED_NEWLINE", e[e.UNKNOWN_TOKEN = 1004] = "UNKNOWN_TOKEN", e[e.UNEXPECTED_TOKEN = 1005] = "UNEXPECTED_TOKEN", e[e.UNEXPECTED_ELEMENT_DECLARATION = 1006] = "UNEXPECTED_ELEMENT_DECLARATION", e[e.MISSING_SPACES = 1007] = "MISSING_SPACES", e[e.UNKNOWN_PREFIX_OP = 1008] = "UNKNOWN_PREFIX_OP", e[e.INVALID_OPERAND = 1009] = "INVALID_OPERAND", e[e.EMPTY_ATTRIBUTE_NAME = 1010] = "EMPTY_ATTRIBUTE_NAME", e[e.INVALID_ESCAPE_SEQUENCE = 1011] = "INVALID_ESCAPE_SEQUENCE", e[e.INVALID_NAME = 3e3] = "INVALID_NAME", e[e.UNEXPECTED_NAME = 3001] = "UNEXPECTED_NAME", e[e.NAME_NOT_FOUND = 3002] = "NAME_NOT_FOUND", e[e.DUPLICATE_NAME = 3003] = "DUPLICATE_NAME", e[e.INVALID_ALIAS = 3004] = "INVALID_ALIAS", e[e.UNEXPECTED_ALIAS = 3005] = "UNEXPECTED_ALIAS", e[e.UNEXPECTED_SETTINGS = 3006] = "UNEXPECTED_SETTINGS", e[e.INVALID_SETTINGS = 3007] = "INVALID_SETTINGS", e[e.UNEXPECTED_SIMPLE_BODY = 3008] = "UNEXPECTED_SIMPLE_BODY", e[e.UNEXPECTED_COMPLEX_BODY = 3009] = "UNEXPECTED_COMPLEX_BODY", e[e.INVALID_TABLE_CONTEXT = 3010] = "INVALID_TABLE_CONTEXT", e[e.UNKNOWN_TABLE_SETTING = 3011] = "UNKNOWN_TABLE_SETTING", e[e.DUPLICATE_TABLE_SETTING = 3012] = "DUPLICATE_TABLE_SETTING", e[e.INVALID_TABLEGROUP_CONTEXT = 3013] = "INVALID_TABLEGROUP_CONTEXT", e[e.INVALID_TABLEGROUP_ELEMENT_NAME = 3014] = "INVALID_TABLEGROUP_ELEMENT_NAME", e[e.DUPLICATE_TABLEGROUP_ELEMENT_NAME = 3015] = "DUPLICATE_TABLEGROUP_ELEMENT_NAME", e[e.DUPLICATE_TABLEGROUP_FIELD_NAME = 3016] = "DUPLICATE_TABLEGROUP_FIELD_NAME", e[e.INVALID_TABLEGROUP_FIELD = 3017] = "INVALID_TABLEGROUP_FIELD", e[e.EMPTY_TABLE = 3018] = "EMPTY_TABLE", e[e.INVALID_COLUMN = 3019] = "INVALID_COLUMN", e[e.INVALID_COLUMN_NAME = 3020] = "INVALID_COLUMN_NAME", e[e.UNKNOWN_COLUMN_SETTING = 3021] = "UNKNOWN_COLUMN_SETTING", e[e.INVALID_COLUMN_TYPE = 3022] = "INVALID_COLUMN_TYPE", e[e.DUPLICATE_COLUMN_NAME = 3023] = "DUPLICATE_COLUMN_NAME", e[e.DUPLICATE_COLUMN_SETTING = 3024] = "DUPLICATE_COLUMN_SETTING", e[e.INVALID_COLUMN_SETTING_VALUE = 3025] = "INVALID_COLUMN_SETTING_VALUE", e[e.INVALID_ENUM_CONTEXT = 3026] = "INVALID_ENUM_CONTEXT", e[e.INVALID_ENUM_ELEMENT_NAME = 3027] = "INVALID_ENUM_ELEMENT_NAME", e[e.INVALID_ENUM_ELEMENT = 3028] = "INVALID_ENUM_ELEMENT", e[e.DUPLICATE_ENUM_ELEMENT_NAME = 3029] = "DUPLICATE_ENUM_ELEMENT_NAME", e[e.UNKNOWN_ENUM_ELEMENT_SETTING = 3030] = "UNKNOWN_ENUM_ELEMENT_SETTING", e[e.DUPLICATE_ENUM_ELEMENT_SETTING = 3031] = "DUPLICATE_ENUM_ELEMENT_SETTING", e[e.INVALID_ENUM_ELEMENT_SETTING = 3032] = "INVALID_ENUM_ELEMENT_SETTING", e[e.EMPTY_ENUM = 3033] = "EMPTY_ENUM", e[e.INVALID_REF_CONTEXT = 3034] = "INVALID_REF_CONTEXT", e[e.UNKNOWN_REF_SETTING = 3035] = "UNKNOWN_REF_SETTING", e[e.DUPLICATE_REF_SETTING = 3036] = "DUPLICATE_REF_SETTING", e[e.INVALID_REF_SETTING_VALUE = 3037] = "INVALID_REF_SETTING_VALUE", e[e.INVALID_REF_RELATIONSHIP = 3038] = "INVALID_REF_RELATIONSHIP", e[e.INVALID_REF_FIELD = 3039] = "INVALID_REF_FIELD", e[e.EMPTY_REF = 3040] = "EMPTY_REF", e[e.REF_REDEFINED = 3041] = "REF_REDEFINED", e[e.INVALID_NOTE_CONTEXT = 3042] = "INVALID_NOTE_CONTEXT", e[e.INVALID_NOTE = 3043] = "INVALID_NOTE", e[e.NOTE_REDEFINED = 3044] = "NOTE_REDEFINED", e[e.NOTE_CONTENT_REDEFINED = 3045] = "NOTE_CONTENT_REDEFINED", e[e.EMPTY_NOTE = 3046] = "EMPTY_NOTE", e[e.INVALID_INDEXES_CONTEXT = 3047] = "INVALID_INDEXES_CONTEXT", e[e.INVALID_INDEXES_FIELD = 3048] = "INVALID_INDEXES_FIELD", e[e.INVALID_INDEX = 3049] = "INVALID_INDEX", e[e.UNKNOWN_INDEX_SETTING = 3050] = "UNKNOWN_INDEX_SETTING", e[e.DUPLICATE_INDEX_SETTING = 3051] = "DUPLICATE_INDEX_SETTING", e[e.UNEXPECTED_INDEX_SETTING_VALUE = 3052] = "UNEXPECTED_INDEX_SETTING_VALUE", e[e.INVALID_INDEX_SETTING_VALUE = 3053] = "INVALID_INDEX_SETTING_VALUE", e[e.INVALID_PROJECT_CONTEXT = 3054] = "INVALID_PROJECT_CONTEXT", e[e.PROJECT_REDEFINED = 3055] = "PROJECT_REDEFINED", e[e.INVALID_PROJECT_FIELD = 3056] = "INVALID_PROJECT_FIELD", e[e.INVALID_CUSTOM_CONTEXT = 3057] = "INVALID_CUSTOM_CONTEXT", e[e.INVALID_CUSTOM_ELEMENT_VALUE = 3058] = "INVALID_CUSTOM_ELEMENT_VALUE", e[e.INVALID_ELEMENT_IN_SIMPLE_BODY = 3059] = "INVALID_ELEMENT_IN_SIMPLE_BODY", e[e.INVALID_TABLE_PARTIAL_CONTEXT = 3060] = "INVALID_TABLE_PARTIAL_CONTEXT", e[e.INVALID_TABLE_PARTIAL_ELEMENT_NAME = 3061] = "INVALID_TABLE_PARTIAL_ELEMENT_NAME", e[e.INVALID_TABLE_PARTIAL_SETTING_VALUE = 3062] = "INVALID_TABLE_PARTIAL_SETTING_VALUE", e[e.DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME = 3063] = "DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME", e[e.DUPLICATE_TABLE_PARTIAL_SETTING = 3064] = "DUPLICATE_TABLE_PARTIAL_SETTING", e[e.INVALID_TABLE_PARTIAL_INJECTION = 3065] = "INVALID_TABLE_PARTIAL_INJECTION", e[e.INVALID_TABLE_PARTIAL_INJECTION_OP = 3066] = "INVALID_TABLE_PARTIAL_INJECTION_OP", e[e.INVALID_TABLE_PARTIAL_INJECTION_NAME = 3067] = "INVALID_TABLE_PARTIAL_INJECTION_NAME", e[e.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME = 3068] = "DUPLICATE_TABLE_PARTIAL_INJECTION_NAME", e[e.UNKNOWN_TABLE_PARTIAL_SETTING = 3069] = "UNKNOWN_TABLE_PARTIAL_SETTING", e[e.INVALID_TABLE_SETTING_VALUE = 3070] = "INVALID_TABLE_SETTING_VALUE", e[e.INVALID_CHECKS_CONTEXT = 3071] = "INVALID_CHECKS_CONTEXT", e[e.INVALID_CHECKS_FIELD = 3072] = "INVALID_CHECKS_FIELD", e[e.INVALID_CHECK = 3073] = "INVALID_CHECK", e[e.UNKNOWN_CHECK_SETTING = 3074] = "UNKNOWN_CHECK_SETTING", e[e.DUPLICATE_CHECK_SETTING = 3075] = "DUPLICATE_CHECK_SETTING", e[e.INVALID_CHECK_SETTING_VALUE = 3076] = "INVALID_CHECK_SETTING_VALUE", e[e.BINDING_ERROR = 4e3] = "BINDING_ERROR", e[e.UNSUPPORTED = 5e3] = "UNSUPPORTED", e[e.CIRCULAR_REF = 5001] = "CIRCULAR_REF", e[e.SAME_ENDPOINT = 5002] = "SAME_ENDPOINT", e[e.UNEQUAL_FIELDS_BINARY_REF = 5003] = "UNEQUAL_FIELDS_BINARY_REF", e[e.CONFLICTING_SETTING = 5004] = "CONFLICTING_SETTING", e[e.TABLE_REAPPEAR_IN_TABLEGROUP = 5005] = "TABLE_REAPPEAR_IN_TABLEGROUP", e))(l || {});
1434
1434
  class c extends Error {
1435
1435
  constructor(t, n, s) {
1436
1436
  super(n), this.code = t, this.diagnostic = n, this.nodeOrToken = s, this.start = s.start, this.end = s.end, this.name = this.constructor.name, Object.setPrototypeOf(this, c.prototype);
@@ -1455,16 +1455,16 @@ class se {
1455
1455
  }
1456
1456
  }
1457
1457
  function il(e, t, n) {
1458
- if (!e || !Se(e) || t.length === 0)
1458
+ if (!e || !Pe(e) || t.length === 0)
1459
1459
  return new x();
1460
- const s = [...t], r = kn(e).unwrap(), i = s.pop();
1460
+ const s = [...t], r = Rn(e).unwrap(), i = s.pop();
1461
1461
  if (!(i instanceof Ee))
1462
1462
  return new x();
1463
- const a = F(s) instanceof k ? s.pop() : void 0;
1463
+ const a = M(s) instanceof k ? s.pop() : void 0;
1464
1464
  if (s.length === 3) {
1465
- const o = kn(s[1]).value;
1466
- return !o || !Ft(o) ? new x() : new V(
1467
- n.create(P, {
1465
+ const o = Rn(s[1]).value;
1466
+ return !o || !Ft(o) ? new x() : new B(
1467
+ n.create(S, {
1468
1468
  type: r,
1469
1469
  name: s[0],
1470
1470
  as: o,
@@ -1474,15 +1474,15 @@ function il(e, t, n) {
1474
1474
  })
1475
1475
  );
1476
1476
  }
1477
- return s.length === 1 ? new V(
1478
- n.create(P, {
1477
+ return s.length === 1 ? new B(
1478
+ n.create(S, {
1479
1479
  type: r,
1480
1480
  name: s[0],
1481
1481
  attributeList: a,
1482
1482
  body: i
1483
1483
  })
1484
- ) : s.length === 0 ? new V(
1485
- n.create(P, {
1484
+ ) : s.length === 0 ? new B(
1485
+ n.create(S, {
1486
1486
  type: r,
1487
1487
  attributeList: a,
1488
1488
  body: i
@@ -1499,7 +1499,7 @@ function al(e) {
1499
1499
  e.kind !== f.EOF && (e.isInvalid = !0);
1500
1500
  }
1501
1501
  function ol(e) {
1502
- if (e instanceof P)
1502
+ if (e instanceof S)
1503
1503
  g(e.type), g(e.name), g(e.as), g(e.alias), g(e.bodyColon), g(e.attributeList), g(e.body);
1504
1504
  else if (e instanceof ce)
1505
1505
  e.identifiers.forEach(g);
@@ -1521,7 +1521,7 @@ function ol(e) {
1521
1521
  g(e.callee), g(e.argumentList);
1522
1522
  else if (e instanceof y)
1523
1523
  g(e.callee), e.args.forEach(g);
1524
- else if (e instanceof Y)
1524
+ else if (e instanceof z)
1525
1525
  g(e.expression);
1526
1526
  else if (e instanceof ie)
1527
1527
  g(e.value);
@@ -1540,7 +1540,7 @@ function X(...e) {
1540
1540
  function ll(e) {
1541
1541
  if (e instanceof ne)
1542
1542
  return X(...e.body, e.eof);
1543
- if (e instanceof P)
1543
+ if (e instanceof S)
1544
1544
  return X(
1545
1545
  e.type,
1546
1546
  e.name,
@@ -1573,50 +1573,50 @@ function ll(e) {
1573
1573
  if (e instanceof k)
1574
1574
  return X(
1575
1575
  e.listOpenBracket,
1576
- ...Rn(e.elementList, e.commaList),
1576
+ ...kn(e.elementList, e.commaList),
1577
1577
  e.listCloseBracket
1578
1578
  );
1579
1579
  if (e instanceof be)
1580
1580
  return X(
1581
1581
  e.tupleOpenParen,
1582
- ...Rn(e.elementList, e.commaList),
1582
+ ...kn(e.elementList, e.commaList),
1583
1583
  e.tupleCloseParen
1584
1584
  );
1585
1585
  if (e instanceof ae)
1586
1586
  return X(e.callee, e.argumentList);
1587
- if (e instanceof Y)
1587
+ if (e instanceof z)
1588
1588
  return X(e.expression);
1589
- if (e instanceof ke)
1589
+ if (e instanceof Re)
1590
1590
  return X(
1591
1591
  e.array,
1592
1592
  e.indexer
1593
1593
  );
1594
- if (e instanceof Re) return X(e.partial);
1594
+ if (e instanceof ke) return X(e.partial);
1595
1595
  throw e instanceof jt ? new Error("This case is already handled by TupleExpressionNode") : new Error("Unreachable - no other possible cases");
1596
1596
  }
1597
- function kn(e) {
1598
- return W(e) ? new V(e.expression.variable) : new x();
1597
+ function Rn(e) {
1598
+ return W(e) ? new B(e.expression.variable) : new x();
1599
1599
  }
1600
- function q(e) {
1600
+ function Y(e) {
1601
1601
  var t;
1602
- return e instanceof Y && (e.expression instanceof de && e.expression.variable instanceof te && e.expression.variable.kind === f.QUOTED_STRING || e.expression instanceof je && ((t = e.expression.literal) == null ? void 0 : t.kind) === f.STRING_LITERAL);
1602
+ return e instanceof z && (e.expression instanceof de && e.expression.variable instanceof te && e.expression.variable.kind === f.QUOTED_STRING || e.expression instanceof je && ((t = e.expression.literal) == null ? void 0 : t.kind) === f.STRING_LITERAL);
1603
1603
  }
1604
1604
  function W(e) {
1605
- return e instanceof Y && e.expression instanceof de && e.expression.variable instanceof te;
1605
+ return e instanceof z && e.expression instanceof de && e.expression.variable instanceof te;
1606
1606
  }
1607
- function Se(e) {
1607
+ function Pe(e) {
1608
1608
  var t;
1609
- return e instanceof Y && e.expression instanceof de && ((t = e.expression.variable) == null ? void 0 : t.kind) === f.IDENTIFIER;
1609
+ return e instanceof z && e.expression instanceof de && ((t = e.expression.variable) == null ? void 0 : t.kind) === f.IDENTIFIER;
1610
1610
  }
1611
1611
  function Jt(e) {
1612
1612
  var t;
1613
- return e instanceof Te && e.leftExpression instanceof U && e.rightExpression instanceof U && ((t = e.op) == null ? void 0 : t.value) === ".";
1613
+ return e instanceof Te && e.leftExpression instanceof R && e.rightExpression instanceof R && ((t = e.op) == null ? void 0 : t.value) === ".";
1614
1614
  }
1615
1615
  function $e(e) {
1616
1616
  if (e === void 0)
1617
1617
  return new x();
1618
1618
  const t = e.identifiers.map((n) => n.value).join(" ");
1619
- return t === "" ? new x() : new V(t);
1619
+ return t === "" ? new x() : new B(t);
1620
1620
  }
1621
1621
  class cl {
1622
1622
  // list of errors during lexing
@@ -1759,7 +1759,7 @@ class cl {
1759
1759
  let t = !0, n = [], s;
1760
1760
  const r = [];
1761
1761
  for (const i of this.tokens)
1762
- Co(i) ? (n.push(i), i.kind === f.NEWLINE && s && (s.trailingTrivia = n, t = !0, s = void 0, n = [])) : (t ? i.leadingTrivia = n : s.trailingTrivia = n, r.push(i), n = [], s = i, t = !1);
1762
+ Vo(i) ? (n.push(i), i.kind === f.NEWLINE && s && (s.trailingTrivia = n, t = !0, s = void 0, n = [])) : (t ? i.leadingTrivia = n : s.trailingTrivia = n, r.push(i), n = [], s = i, t = !1);
1763
1763
  this.tokens = r;
1764
1764
  }
1765
1765
  gatherInvalid() {
@@ -1854,7 +1854,7 @@ class cl {
1854
1854
  });
1855
1855
  }
1856
1856
  identifier() {
1857
- for (; !this.isAtEnd() && Ce(this.peek()); )
1857
+ for (; !this.isAtEnd() && Ve(this.peek()); )
1858
1858
  this.advance();
1859
1859
  this.addToken(f.IDENTIFIER);
1860
1860
  }
@@ -1886,26 +1886,26 @@ class cl {
1886
1886
  break;
1887
1887
  if (!n && this.current.offset === this.text.length - 1)
1888
1888
  return this.advance(), this.addToken(f.NUMERIC_LITERAL);
1889
- if (!n && !Ce(this.peek()))
1889
+ if (!n && !Ve(this.peek()))
1890
1890
  return this.addToken(f.NUMERIC_LITERAL);
1891
1891
  if (!n && !ct(this.peek()))
1892
1892
  break;
1893
1893
  this.advance();
1894
1894
  }
1895
1895
  if (t > 0) {
1896
- for (; !this.isAtEnd() && (this.check(".") || Ce(this.peek())); )
1896
+ for (; !this.isAtEnd() && (this.check(".") || Ve(this.peek())); )
1897
1897
  this.advance();
1898
1898
  const n = this.createToken(f.NUMERIC_LITERAL, !0);
1899
1899
  this.tokens.push(n), this.errors.push(new c(l.UNKNOWN_TOKEN, "Invalid number", n));
1900
1900
  } else {
1901
- for (; !this.isAtEnd() && Ce(this.peek()); )
1901
+ for (; !this.isAtEnd() && Ve(this.peek()); )
1902
1902
  this.advance();
1903
1903
  const n = this.createToken(f.IDENTIFIER, !1);
1904
1904
  this.tokens.push(n);
1905
1905
  }
1906
1906
  }
1907
1907
  colorLiteral() {
1908
- for (; !this.isAtEnd() && Ce(this.peek()); )
1908
+ for (; !this.isAtEnd() && Ve(this.peek()); )
1909
1909
  this.advance();
1910
1910
  this.addToken(f.COLOR_LITERAL);
1911
1911
  }
@@ -1948,7 +1948,7 @@ class cl {
1948
1948
  case "u": {
1949
1949
  let n = "";
1950
1950
  for (let s = 0; s <= 3; s += 1) {
1951
- if (this.isAtEnd() || !Ce(this.peek()))
1951
+ if (this.isAtEnd() || !Ve(this.peek()))
1952
1952
  return this.errors.push(new c(l.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`, te.create(f.STRING_LITERAL, t, this.current, `\\u${n}`, !0))), `\\u${n}`;
1953
1953
  n += this.advance();
1954
1954
  }
@@ -1972,7 +1972,7 @@ class ul {
1972
1972
  return t === 0 && (this.numberOfNestedLBrackets -= 1), t === 1 && (this.numberOfNestedLParens -= 1), t === 2 && (this.numberOfNestedLBraces -= 1), t;
1973
1973
  }
1974
1974
  top() {
1975
- return F(this.stack);
1975
+ return M(this.stack);
1976
1976
  }
1977
1977
  isWithinGroupExpressionContext() {
1978
1978
  return this.numberOfNestedLParens > 0;
@@ -2072,7 +2072,7 @@ class fl {
2072
2072
  for (; !this.isAtEnd() && !this.check(f.RBRACE); )
2073
2073
  try {
2074
2074
  if (this.match(f.TILDE)) {
2075
- const i = this.previous(), a = this.variable(), o = this.nodeFactory.create(Re, { op: i, partial: a });
2075
+ const i = this.previous(), a = this.variable(), o = this.nodeFactory.create(ke, { op: i, partial: a });
2076
2076
  s.body.push(o);
2077
2077
  } else
2078
2078
  s.body.push(this.canBeField() ? this.fieldDeclaration() : this.expression());
@@ -2132,7 +2132,7 @@ class fl {
2132
2132
  } catch (a) {
2133
2133
  if (!(a instanceof T))
2134
2134
  throw a;
2135
- if (a.partialNode instanceof U && s.elementList.push(a.partialNode), !this.canHandle(a))
2135
+ if (a.partialNode instanceof R && s.elementList.push(a.partialNode), !this.canHandle(a))
2136
2136
  throw new T(a.token, i(), a.handlerContext);
2137
2137
  this.synchronizeTuple();
2138
2138
  }
@@ -2180,7 +2180,7 @@ class fl {
2180
2180
  } catch (i) {
2181
2181
  if (!(i instanceof T))
2182
2182
  throw i;
2183
- if (i.partialNode instanceof U && s.elementList.push(i.partialNode), !this.canHandle(i))
2183
+ if (i.partialNode instanceof R && s.elementList.push(i.partialNode), !this.canHandle(i))
2184
2184
  throw new T(i.token, r(), i.handlerContext);
2185
2185
  this.synchronizeList();
2186
2186
  }
@@ -2221,10 +2221,10 @@ class fl {
2221
2221
  return this.current >= this.tokens.length || this.tokens[this.current].kind === f.EOF;
2222
2222
  }
2223
2223
  advance() {
2224
- return this.isAtEnd() ? F(this.tokens) : this.tokens[this.current++];
2224
+ return this.isAtEnd() ? M(this.tokens) : this.tokens[this.current++];
2225
2225
  }
2226
2226
  peek(t = 0) {
2227
- return t + this.current >= this.tokens.length ? F(this.tokens) : this.tokens[this.current + t];
2227
+ return t + this.current >= this.tokens.length ? M(this.tokens) : this.tokens[this.current + t];
2228
2228
  }
2229
2229
  match(...t) {
2230
2230
  const n = this.check(...t);
@@ -2290,7 +2290,7 @@ class fl {
2290
2290
  }
2291
2291
  /* Parsing and synchronizing top-level ElementDeclarationNode */
2292
2292
  elementDeclaration() {
2293
- const t = {}, n = () => this.nodeFactory.create(P, t);
2293
+ const t = {}, n = () => this.nodeFactory.create(S, t);
2294
2294
  try {
2295
2295
  this.consume("Expect an identifier", f.IDENTIFIER), t.type = this.previous();
2296
2296
  } catch (s) {
@@ -2334,13 +2334,13 @@ class fl {
2334
2334
  if (this.match(f.COLON)) {
2335
2335
  t.bodyColon = this.previous();
2336
2336
  const s = this.expression();
2337
- s instanceof P ? (g(s), this.logError(s, l.UNEXPECTED_ELEMENT_DECLARATION, "An element's simple body must not be an element declaration")) : t.body = s;
2337
+ s instanceof S ? (g(s), this.logError(s, l.UNEXPECTED_ELEMENT_DECLARATION, "An element's simple body must not be an element declaration")) : t.body = s;
2338
2338
  } else
2339
2339
  t.body = this.blockExpression();
2340
2340
  } catch (s) {
2341
2341
  throw s instanceof T ? (t.body = s.partialNode, new T(s.token, n(), s.handlerContext)) : s;
2342
2342
  }
2343
- return this.nodeFactory.create(P, t);
2343
+ return this.nodeFactory.create(S, t);
2344
2344
  }
2345
2345
  /* Parsing nested element declarations with simple body */
2346
2346
  // e.g
@@ -2349,7 +2349,7 @@ class fl {
2349
2349
  // Note: 'This is a note' // fieldDeclaration() handles this
2350
2350
  // }
2351
2351
  fieldDeclaration() {
2352
- const t = {}, n = () => this.nodeFactory.create(P, t);
2352
+ const t = {}, n = () => this.nodeFactory.create(S, t);
2353
2353
  try {
2354
2354
  this.consume("Expect an identifier", f.IDENTIFIER), t.type = this.previous();
2355
2355
  } catch (s) {
@@ -2362,11 +2362,11 @@ class fl {
2362
2362
  }
2363
2363
  try {
2364
2364
  const s = this.expression();
2365
- s instanceof P ? this.errors.push(new c(l.INVALID_ELEMENT_IN_SIMPLE_BODY, "Simple body cannot be an element declaration", s)) : t.body = s;
2365
+ s instanceof S ? this.errors.push(new c(l.INVALID_ELEMENT_IN_SIMPLE_BODY, "Simple body cannot be an element declaration", s)) : t.body = s;
2366
2366
  } catch (s) {
2367
2367
  throw s instanceof T ? (t.body = s.partialNode, new T(s.token, n(), s.handlerContext)) : s;
2368
2368
  }
2369
- return this.nodeFactory.create(P, t);
2369
+ return this.nodeFactory.create(S, t);
2370
2370
  }
2371
2371
  /* Parsing any ExpressionNode, including non-NormalExpression */
2372
2372
  expression() {
@@ -2428,12 +2428,12 @@ class fl {
2428
2428
  if (Ut(this.previous()))
2429
2429
  break;
2430
2430
  try {
2431
- n = this.nodeFactory.create(ke, {
2431
+ n = this.nodeFactory.create(Re, {
2432
2432
  expression: n,
2433
2433
  indexer: this.listExpression()
2434
2434
  });
2435
2435
  } catch (r) {
2436
- throw r instanceof T ? (n = this.nodeFactory.create(ke, {
2436
+ throw r instanceof T ? (n = this.nodeFactory.create(Re, {
2437
2437
  expression: n,
2438
2438
  indexer: r.partialNode
2439
2439
  }), new T(r.token, n, r.handlerContext)) : r;
@@ -2556,11 +2556,11 @@ class fl {
2556
2556
  f.STRING_LITERAL,
2557
2557
  f.NUMERIC_LITERAL
2558
2558
  ))
2559
- return this.nodeFactory.create(Y, {
2559
+ return this.nodeFactory.create(z, {
2560
2560
  expression: this.nodeFactory.create(je, { literal: this.previous() })
2561
2561
  });
2562
2562
  if (this.match(f.QUOTED_STRING, f.IDENTIFIER))
2563
- return this.nodeFactory.create(Y, {
2563
+ return this.nodeFactory.create(z, {
2564
2564
  expression: this.nodeFactory.create(de, { variable: this.previous() })
2565
2565
  });
2566
2566
  throw this.logError(this.peek(), l.UNEXPECTED_TOKEN, "Expect a variable or literal"), new T(
@@ -2661,8 +2661,8 @@ const Tl = {
2661
2661
  function Un(e) {
2662
2662
  return Tl[e.value] || { left: null, right: null };
2663
2663
  }
2664
- var _ = /* @__PURE__ */ ((e) => (e.Table = "table", e.Enum = "enum", e.Ref = "ref", e.Note = "note", e.Project = "project", e.Indexes = "indexes", e.TableGroup = "tablegroup", e.TablePartial = "tablepartial", e.Constraints = "constraints", e))(_ || {}), E = /* @__PURE__ */ ((e) => (e.Color = "color", e.HeaderColor = "headercolor", e.Note = "note", e.PK = "pk", e.PrimaryKey = "primary key", e.Unique = "unique", e.Ref = "ref", e.NotNull = "not null", e.Null = "null", e.Increment = "increment", e.Default = "default", e.Name = "name", e.Type = "type", e.Constraint = "constraint", e.Update = "update", e.Delete = "delete", e))(E || {});
2665
- function Pe(e) {
2664
+ var _ = /* @__PURE__ */ ((e) => (e.Table = "table", e.Enum = "enum", e.Ref = "ref", e.Note = "note", e.Project = "project", e.Indexes = "indexes", e.TableGroup = "tablegroup", e.TablePartial = "tablepartial", e.Check = "checks", e))(_ || {}), E = /* @__PURE__ */ ((e) => (e.Color = "color", e.HeaderColor = "headercolor", e.Note = "note", e.PK = "pk", e.PrimaryKey = "primary key", e.Unique = "unique", e.Ref = "ref", e.NotNull = "not null", e.Null = "null", e.Increment = "increment", e.Default = "default", e.Name = "name", e.Type = "type", e.Check = "check", e.Update = "update", e.Delete = "delete", e))(E || {});
2665
+ function Se(e) {
2666
2666
  var n;
2667
2667
  const t = (n = e == null ? void 0 : e.type) == null ? void 0 : n.value.toLowerCase();
2668
2668
  switch (t) {
@@ -2674,16 +2674,17 @@ function Pe(e) {
2674
2674
  case _.Ref:
2675
2675
  case _.TableGroup:
2676
2676
  case _.TablePartial:
2677
- return new V(t);
2677
+ case _.Check:
2678
+ return new B(t);
2678
2679
  default:
2679
2680
  return new x();
2680
2681
  }
2681
2682
  }
2682
2683
  function Be(e) {
2683
2684
  if (!Jt(e))
2684
- return new V([e]);
2685
+ return new B([e]);
2685
2686
  const t = Be(e.leftExpression).unwrap_or(void 0);
2686
- return t ? (t.push(e.rightExpression), new V(t)) : new x();
2687
+ return t ? (t.push(e.rightExpression), new B(t)) : new x();
2687
2688
  }
2688
2689
  function Q(e) {
2689
2690
  if (e === void 0)
@@ -2693,12 +2694,12 @@ function Q(e) {
2693
2694
  return new x();
2694
2695
  const n = [];
2695
2696
  for (const s of t) {
2696
- const r = K(s).unwrap_or(void 0);
2697
+ const r = q(s).unwrap_or(void 0);
2697
2698
  if (!r)
2698
2699
  return new x();
2699
2700
  n.push(r);
2700
2701
  }
2701
- return new V(n);
2702
+ return new B(n);
2702
2703
  }
2703
2704
  function Ze(e) {
2704
2705
  if (e === void 0)
@@ -2708,52 +2709,50 @@ function Ze(e) {
2708
2709
  return new x();
2709
2710
  const n = [];
2710
2711
  let s;
2711
- if (!W(F(t))) {
2712
+ if (!W(M(t))) {
2712
2713
  const r = t.pop();
2713
- if (Ps(r))
2714
- s = r.elementList.map(
2715
- (i) => j(i).unwrap()
2716
- );
2714
+ if (Ss(r))
2715
+ s = r.elementList.map((i) => j(i).unwrap());
2717
2716
  else
2718
2717
  return new x();
2719
2718
  }
2720
2719
  for (const r of t) {
2721
- const i = K(r).unwrap_or(void 0);
2720
+ const i = q(r).unwrap_or(void 0);
2722
2721
  if (!i)
2723
2722
  return new x();
2724
2723
  n.push(i);
2725
2724
  }
2726
- return new V({
2725
+ return new B({
2727
2726
  variables: n,
2728
2727
  tupleElements: s
2729
2728
  });
2730
2729
  }
2731
- function K(e) {
2732
- return W(e) ? new V(e.expression.variable.value) : new x();
2730
+ function q(e) {
2731
+ return W(e) ? new B(e.expression.variable.value) : new x();
2733
2732
  }
2734
2733
  function ut(e) {
2735
2734
  if (Mn(e))
2736
- return e instanceof ie ? new V({ functional: [e], nonFunctional: [] }) : new V({ functional: [], nonFunctional: [e] });
2735
+ return e instanceof ie ? new B({ functional: [e], nonFunctional: [] }) : new B({ functional: [], nonFunctional: [e] });
2737
2736
  if (e instanceof be && e.elementList.every(Mn)) {
2738
2737
  const t = e.elementList.filter(
2739
2738
  (s) => s instanceof ie
2740
2739
  ), n = e.elementList.filter(W);
2741
- return new V({ functional: t, nonFunctional: n });
2740
+ return new B({ functional: t, nonFunctional: n });
2742
2741
  }
2743
2742
  return new x();
2744
2743
  }
2745
2744
  function j(e) {
2746
2745
  var n;
2747
2746
  const t = (n = e == null ? void 0 : e.expression.variable) == null ? void 0 : n.value;
2748
- return t === void 0 ? new x() : new V(t);
2747
+ return t === void 0 ? new x() : new B(t);
2749
2748
  }
2750
2749
  function bl(e) {
2751
2750
  var n, s;
2752
2751
  const t = (s = (n = e == null ? void 0 : e.partial) == null ? void 0 : n.variable) == null ? void 0 : s.value;
2753
- return t === void 0 ? new x() : new V(t);
2752
+ return t === void 0 ? new x() : new B(t);
2754
2753
  }
2755
2754
  function C(e) {
2756
- return q(e) ? e.expression instanceof de ? new V(e.expression.variable.value) : new V(e.expression.literal.value) : new x();
2755
+ return Y(e) ? e.expression instanceof de ? new B(e.expression.variable.value) : new B(e.expression.literal.value) : new x();
2757
2756
  }
2758
2757
  function ml(e) {
2759
2758
  var t;
@@ -2767,7 +2766,7 @@ function Il(e) {
2767
2766
  return (s == null ? void 0 : s.length) === (r == null ? void 0 : r.length);
2768
2767
  }
2769
2768
  function Mn(e) {
2770
- return e instanceof Y && e.expression instanceof de || e instanceof ie;
2769
+ return e instanceof z && e.expression instanceof de || e instanceof ie;
2771
2770
  }
2772
2771
  function Fn(e, t) {
2773
2772
  var r, i, a, o;
@@ -2788,10 +2787,16 @@ class _l {
2788
2787
  this.declarationNode = t, this.publicSymbolTable = n, this.symbolFactory = s;
2789
2788
  }
2790
2789
  validate() {
2791
- return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
2790
+ return [
2791
+ ...this.validateContext(),
2792
+ ...this.validateName(this.declarationNode.name),
2793
+ ...this.validateAlias(this.declarationNode.alias),
2794
+ ...this.validateSettingList(this.declarationNode.attributeList),
2795
+ ...this.validateBody(this.declarationNode.body)
2796
+ ];
2792
2797
  }
2793
2798
  validateContext() {
2794
- return this.declarationNode.parent instanceof ne || Pe(this.declarationNode.parent).unwrap_or(void 0) !== _.Project ? [new c(l.INVALID_CUSTOM_CONTEXT, "A custom element can only appear in a Project", this.declarationNode)] : [];
2799
+ return this.declarationNode.parent instanceof ne || Se(this.declarationNode.parent).unwrap_or(void 0) !== _.Project ? [new c(l.INVALID_CUSTOM_CONTEXT, "A Custom element can only appear in a Project", this.declarationNode)] : [];
2795
2800
  }
2796
2801
  validateName(t) {
2797
2802
  return t ? [new c(l.UNEXPECTED_NAME, "A Custom element shouldn't have a name", t)] : [];
@@ -2808,7 +2813,7 @@ class _l {
2808
2813
  if (t instanceof Ee)
2809
2814
  return [new c(l.UNEXPECTED_COMPLEX_BODY, "A Custom element can only have an inline field", t)];
2810
2815
  const n = [];
2811
- return q(t.callee) || n.push(new c(l.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", t)), t.args.length > 0 && n.push(...t.args.map((s) => new c(l.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
2816
+ return Y(t.callee) || n.push(new c(l.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", t)), t.args.length > 0 && n.push(...t.args.map((s) => new c(l.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", s))), n;
2812
2817
  }
2813
2818
  }
2814
2819
  class We {
@@ -2836,10 +2841,17 @@ class gl {
2836
2841
  this.declarationNode = t, this.publicSymbolTable = n, this.symbolFactory = s;
2837
2842
  }
2838
2843
  validate() {
2839
- return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.registerElement(), ...this.validateBody(this.declarationNode.body)];
2844
+ return [
2845
+ ...this.validateContext(),
2846
+ ...this.validateName(this.declarationNode.name),
2847
+ ...this.validateAlias(this.declarationNode.alias),
2848
+ ...this.validateSettingList(this.declarationNode.attributeList),
2849
+ ...this.registerElement(),
2850
+ ...this.validateBody(this.declarationNode.body)
2851
+ ];
2840
2852
  }
2841
2853
  validateContext() {
2842
- return this.declarationNode.parent instanceof P ? [new c(l.INVALID_PROJECT_CONTEXT, "An Enum can only appear top-level", this.declarationNode)] : [];
2854
+ return this.declarationNode.parent instanceof S ? [new c(l.INVALID_PROJECT_CONTEXT, "An Enum can only appear top-level", this.declarationNode)] : [];
2843
2855
  }
2844
2856
  validateName(t) {
2845
2857
  return t ? vs(t) ? [] : [new c(l.INVALID_NAME, "An Enum name must be of the form <enum> or <schema>.<enum>", t)] : [new c(l.NAME_NOT_FOUND, "An Enum must have a name", this.declarationNode)];
@@ -2849,7 +2861,7 @@ class gl {
2849
2861
  }
2850
2862
  registerElement() {
2851
2863
  const t = [];
2852
- this.declarationNode.symbol = this.symbolFactory.create(qo, { declaration: this.declarationNode, symbolTable: new We() });
2864
+ this.declarationNode.symbol = this.symbolFactory.create(Yo, { declaration: this.declarationNode, symbolTable: new We() });
2853
2865
  const { name: n } = this.declarationNode, s = Q(n);
2854
2866
  if (s.isOk()) {
2855
2867
  const r = s.unwrap(), i = r.pop(), a = At(r, this.publicSymbolTable, this.symbolFactory), o = Ht(i);
@@ -2873,17 +2885,17 @@ class gl {
2873
2885
  const s = [];
2874
2886
  n.callee && !W(n.callee) && s.push(new c(l.INVALID_ENUM_ELEMENT_NAME, "An enum field must be an identifier or a quoted identifier", n.callee));
2875
2887
  const r = [...n.args];
2876
- return F(r) instanceof k ? (s.push(...this.validateFieldSettings(F(r))), r.pop()) : r[0] instanceof k && (s.push(...this.validateFieldSettings(r[0])), r.shift()), r.length > 0 && s.push(...r.map((i) => new c(l.INVALID_ENUM_ELEMENT, "An Enum must have only a field and optionally a setting list", i))), s.push(...this.registerField(n)), s;
2888
+ return M(r) instanceof k ? (s.push(...this.validateFieldSettings(M(r))), r.pop()) : r[0] instanceof k && (s.push(...this.validateFieldSettings(r[0])), r.shift()), r.length > 0 && s.push(...r.map((i) => new c(l.INVALID_ENUM_ELEMENT, "An Enum must have only a field and optionally a setting list", i))), s.push(...this.registerField(n)), s;
2877
2889
  });
2878
2890
  }
2879
2891
  validateFieldSettings(t) {
2880
- const n = B(t), s = n.getErrors(), r = n.getValue();
2892
+ const n = F(t), s = n.getErrors(), r = n.getValue();
2881
2893
  for (const i in r) {
2882
2894
  const a = r[i];
2883
2895
  switch (i) {
2884
2896
  case "note":
2885
2897
  a.length > 1 && a.forEach((o) => s.push(new c(l.DUPLICATE_ENUM_ELEMENT_SETTING, "'note' can only appear once", o))), a.forEach((o) => {
2886
- q(o.value) || s.push(new c(l.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", o));
2898
+ Y(o.value) || s.push(new c(l.INVALID_ENUM_ELEMENT_SETTING, "'note' must be a string", o));
2887
2899
  });
2888
2900
  break;
2889
2901
  default:
@@ -2902,7 +2914,7 @@ class gl {
2902
2914
  }
2903
2915
  registerField(t) {
2904
2916
  if (t.callee && W(t.callee)) {
2905
- const n = j(t.callee).unwrap(), s = zt(n), r = this.symbolFactory.create(Ko, { declaration: t });
2917
+ const n = j(t.callee).unwrap(), s = Kt(n), r = this.symbolFactory.create(qo, { declaration: t });
2906
2918
  t.symbol = r;
2907
2919
  const i = this.declarationNode.symbol.symbolTable;
2908
2920
  if (i.has(s)) {
@@ -2937,7 +2949,7 @@ class Al {
2937
2949
  this.declarationNode
2938
2950
  );
2939
2951
  if (this.declarationNode.parent instanceof ne) return [t];
2940
- const n = Pe(this.declarationNode.parent).unwrap_or(void 0);
2952
+ const n = Se(this.declarationNode.parent).unwrap_or(void 0);
2941
2953
  return n && [_.Table, _.TablePartial].includes(n) ? [] : [t];
2942
2954
  }
2943
2955
  validateName(t) {
@@ -2962,7 +2974,7 @@ class Al {
2962
2974
  if (!n.callee)
2963
2975
  return [];
2964
2976
  const s = [], r = [n.callee, ...n.args];
2965
- return F(r) instanceof k && s.push(...this.validateFieldSetting(r.pop())), r.forEach((i) => {
2977
+ return M(r) instanceof k && s.push(...this.validateFieldSetting(r.pop())), r.forEach((i) => {
2966
2978
  for (; i instanceof ae; )
2967
2979
  i.argumentList && !ut(i.argumentList).isOk() && s.push(new c(l.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", i.argumentList)), i = i.callee;
2968
2980
  ut(i).isOk() || s.push(new c(l.INVALID_INDEXES_FIELD, "An index field must be an identifier, a quoted identifier, a functional expression or a tuple of such", i));
@@ -2970,14 +2982,14 @@ class Al {
2970
2982
  });
2971
2983
  }
2972
2984
  validateFieldSetting(t) {
2973
- const n = B(t), s = n.getErrors(), r = n.getValue();
2985
+ const n = F(t), s = n.getErrors(), r = n.getValue();
2974
2986
  for (const i in r) {
2975
2987
  const a = r[i];
2976
2988
  switch (i) {
2977
2989
  case "note":
2978
2990
  case "name":
2979
2991
  a.length > 1 && a.forEach((o) => s.push(new c(l.DUPLICATE_INDEX_SETTING, `'${i}' can only appear once`, o))), a.forEach((o) => {
2980
- q(o.value) || s.push(new c(l.INVALID_INDEX_SETTING_VALUE, `'${i}' must be a string`, o));
2992
+ Y(o.value) || s.push(new c(l.INVALID_INDEX_SETTING_VALUE, `'${i}' must be a string`, o));
2981
2993
  });
2982
2994
  break;
2983
2995
  case "unique":
@@ -3025,7 +3037,7 @@ class Ll {
3025
3037
  _.TableGroup,
3026
3038
  _.TablePartial,
3027
3039
  _.Project
3028
- ].includes(Pe(this.declarationNode.parent).unwrap_or(void 0)) ? [new c(
3040
+ ].includes(Se(this.declarationNode.parent).unwrap_or(void 0)) ? [new c(
3029
3041
  l.INVALID_NOTE_CONTEXT,
3030
3042
  "A Note can only appear inside a Table, a TableGroup, a TablePartial or a Project. Sticky note can only appear at the global scope.",
3031
3043
  this.declarationNode
@@ -3057,7 +3069,7 @@ class Ll {
3057
3069
  }
3058
3070
  validateFields(t) {
3059
3071
  const n = [];
3060
- return t.length === 0 ? [new c(l.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (t.length > 1 && t.slice(1).forEach((s) => n.push(new c(l.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), q(t[0].callee) || n.push(new c(l.INVALID_NOTE, "A Note content must be a quoted string", t[0])), t[0].args.length > 0 && n.push(...t[0].args.map((s) => new c(l.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
3072
+ return t.length === 0 ? [new c(l.EMPTY_NOTE, "A Note must have a content", this.declarationNode)] : (t.length > 1 && t.slice(1).forEach((s) => n.push(new c(l.NOTE_CONTENT_REDEFINED, "A Note can only contain one string", s))), Y(t[0].callee) || n.push(new c(l.INVALID_NOTE, "A Note content must be a quoted string", t[0])), t[0].args.length > 0 && n.push(...t[0].args.map((s) => new c(l.INVALID_NOTE, "A Note can only contain one quoted string", s))), n);
3061
3073
  }
3062
3074
  validateSubElements(t) {
3063
3075
  return t.flatMap((n) => {
@@ -3076,7 +3088,7 @@ class vl {
3076
3088
  return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
3077
3089
  }
3078
3090
  validateContext() {
3079
- return this.declarationNode.parent instanceof P ? [new c(l.INVALID_PROJECT_CONTEXT, "A Project can only appear top-level", this.declarationNode)] : [];
3091
+ return this.declarationNode.parent instanceof S ? [new c(l.INVALID_PROJECT_CONTEXT, "A Project can only appear top-level", this.declarationNode)] : [];
3080
3092
  }
3081
3093
  validateName(t) {
3082
3094
  return t ? He(t) ? [] : [new c(l.INVALID_NAME, "A Project's name is optional or must be an identifier or a quoted identifer", t)] : [];
@@ -3112,7 +3124,13 @@ class yl {
3112
3124
  this.declarationNode = t, this.publicSymbolTable = n, this.symbolFactory = s;
3113
3125
  }
3114
3126
  validate() {
3115
- return [...this.validateContext(), ...this.validateName(this.declarationNode.name), ...this.validateAlias(this.declarationNode.alias), ...this.validateSettingList(this.declarationNode.attributeList), ...this.validateBody(this.declarationNode.body)];
3127
+ return [
3128
+ ...this.validateContext(),
3129
+ ...this.validateName(this.declarationNode.name),
3130
+ ...this.validateAlias(this.declarationNode.alias),
3131
+ ...this.validateSettingList(this.declarationNode.attributeList),
3132
+ ...this.validateBody(this.declarationNode.body)
3133
+ ];
3116
3134
  }
3117
3135
  validateContext() {
3118
3136
  return this.declarationNode.parent instanceof ne ? [] : [new c(l.INVALID_REF_CONTEXT, "A Ref must appear top-level", this.declarationNode)];
@@ -3141,15 +3159,15 @@ class yl {
3141
3159
  return t.length > 1 && n.push(...t.slice(1).map((s) => new c(l.REF_REDEFINED, "A Ref can only contain one binary relationship", s))), t.forEach((s) => {
3142
3160
  s.callee && !ml(s.callee) && n.push(new c(l.INVALID_REF_FIELD, "A Ref field must be a binary relationship", s.callee)), s.callee && !Il(s.callee) && n.push(new c(l.UNEQUAL_FIELDS_BINARY_REF, "Unequal fields in ref endpoints", s.callee));
3143
3161
  const r = [...s.args];
3144
- if (F(r) instanceof k) {
3145
- const i = this.validateFieldSettings(F(r));
3162
+ if (M(r) instanceof k) {
3163
+ const i = this.validateFieldSettings(M(r));
3146
3164
  n.push(...i), r.pop();
3147
3165
  } else r[0] instanceof k && (n.push(...this.validateFieldSettings(r[0])), r.shift());
3148
3166
  r.length > 0 && n.push(...r.map((i) => new c(l.INVALID_REF_FIELD, "A Ref field should only have a single binary relationship", i)));
3149
3167
  }), n;
3150
3168
  }
3151
3169
  validateFieldSettings(t) {
3152
- const n = B(t), s = n.getErrors(), r = n.getValue();
3170
+ const n = F(t), s = n.getErrors(), r = n.getValue();
3153
3171
  for (const i in r) {
3154
3172
  const a = r[i];
3155
3173
  switch (i) {
@@ -3196,7 +3214,7 @@ function wl(e) {
3196
3214
  }
3197
3215
  return !1;
3198
3216
  }
3199
- class Sl {
3217
+ class Pl {
3200
3218
  constructor(t, n, s) {
3201
3219
  this.declarationNode = t, this.symbolFactory = s, this.publicSymbolTable = n;
3202
3220
  }
@@ -3211,16 +3229,16 @@ class Sl {
3211
3229
  ];
3212
3230
  }
3213
3231
  validateContext() {
3214
- return this.declarationNode.parent instanceof P ? [new c(l.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
3232
+ return this.declarationNode.parent instanceof S ? [new c(l.INVALID_TABLE_CONTEXT, "Table must appear top-level", this.declarationNode)] : [];
3215
3233
  }
3216
3234
  validateName(t) {
3217
- return t ? t instanceof ke ? [new c(l.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", t)] : vs(t) ? [] : [new c(l.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", t)] : [new c(l.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
3235
+ return t ? t instanceof Re ? [new c(l.INVALID_NAME, "Invalid array as Table name, maybe you forget to add a space between the name and the setting list?", t)] : vs(t) ? [] : [new c(l.INVALID_NAME, "A Table name must be of the form <table> or <schema>.<table>", t)] : [new c(l.NAME_NOT_FOUND, "A Table must have a name", this.declarationNode)];
3218
3236
  }
3219
3237
  validateAlias(t) {
3220
- return t ? kl(t) ? [] : [new c(l.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", t)] : [];
3238
+ return t ? Rl(t) ? [] : [new c(l.INVALID_ALIAS, "Table aliases can only contains alphanumeric and underscore unless surrounded by double quotes", t)] : [];
3221
3239
  }
3222
3240
  validateSettingList(t) {
3223
- const n = B(t), s = n.getErrors(), r = n.getValue();
3241
+ const n = F(t), s = n.getErrors(), r = n.getValue();
3224
3242
  return Je(r, (i, a) => {
3225
3243
  switch (a) {
3226
3244
  case E.HeaderColor:
@@ -3230,7 +3248,7 @@ class Sl {
3230
3248
  break;
3231
3249
  case E.Note:
3232
3250
  i.length > 1 && s.push(...i.map((o) => new c(l.DUPLICATE_TABLE_SETTING, "'note' can only appear once", o))), i.forEach((o) => {
3233
- q(o.value) || s.push(new c(l.INVALID_TABLE_SETTING_VALUE, "'note' must be a string literal", o.value || o.name));
3251
+ Y(o.value) || s.push(new c(l.INVALID_TABLE_SETTING_VALUE, "'note' must be a string literal", o.value || o.name));
3234
3252
  });
3235
3253
  break;
3236
3254
  default:
@@ -3246,7 +3264,7 @@ class Sl {
3246
3264
  const i = [...r.unwrap()], a = i.pop(), o = At(i, this.publicSymbolTable, this.symbolFactory), u = lt(a);
3247
3265
  o.has(u) && t.push(new c(l.DUPLICATE_NAME, `Table name '${a}' already exists in schema '${i.join(".") || "public"}'`, n)), o.set(u, this.declarationNode.symbol);
3248
3266
  }
3249
- if (s && He(s) && !Pl(s.expression.variable.value, r.unwrap_or([]))) {
3267
+ if (s && He(s) && !Sl(s.expression.variable.value, r.unwrap_or([]))) {
3250
3268
  const i = j(s).unwrap(), a = lt(i);
3251
3269
  this.publicSymbolTable.has(a) && t.push(new c(l.DUPLICATE_NAME, `Table name '${i}' already exists`, n)), this.publicSymbolTable.set(a, this.declarationNode.symbol);
3252
3270
  }
@@ -3257,7 +3275,7 @@ class Sl {
3257
3275
  return [];
3258
3276
  if (t instanceof y)
3259
3277
  return [new c(l.UNEXPECTED_SIMPLE_BODY, "A Table's body must be a block", t)];
3260
- const [n, s, r] = t.body.reduce((i, a) => (a instanceof y ? i[0].push(a) : a instanceof Re ? i[1].push(a) : a instanceof P && i[2].push(a), i), [[], [], []]);
3278
+ const [n, s, r] = t.body.reduce((i, a) => (a instanceof y ? i[0].push(a) : a instanceof ke ? i[1].push(a) : a instanceof S && i[2].push(a), i), [[], [], []]);
3261
3279
  return [
3262
3280
  ...this.validateFields(n),
3263
3281
  ...this.validateInjections(s),
@@ -3306,13 +3324,13 @@ class Sl {
3306
3324
  }
3307
3325
  // This is needed to support legacy inline settings
3308
3326
  validateFieldSetting(t) {
3309
- if (!t.slice(0, -1).every(Se) || !t.slice(-1).every((u) => Se(u) || u instanceof k))
3327
+ if (!t.slice(0, -1).every(Pe) || !t.slice(-1).every((u) => Pe(u) || u instanceof k))
3310
3328
  return [...t.map((u) => new c(l.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", u))];
3311
3329
  if (t.length === 0)
3312
3330
  return [];
3313
3331
  let n;
3314
- F(t) instanceof k && (n = t.pop());
3315
- const s = B(n), r = s.getErrors(), i = s.getValue();
3332
+ M(t) instanceof k && (n = t.pop());
3333
+ const s = F(n), r = s.getErrors(), i = s.getValue();
3316
3334
  t.forEach((u) => {
3317
3335
  const p = j(u).unwrap_or("").toLowerCase();
3318
3336
  if (p !== "pk" && p !== "unique") {
@@ -3328,12 +3346,12 @@ class Sl {
3328
3346
  switch (p) {
3329
3347
  case E.Note:
3330
3348
  u.length > 1 && r.push(...u.map((h) => new c(l.DUPLICATE_COLUMN_SETTING, "note can only appear once", h))), u.forEach((h) => {
3331
- q(h.value) || r.push(new c(l.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", h.value || h.name));
3349
+ Y(h.value) || r.push(new c(l.INVALID_COLUMN_SETTING_VALUE, "'note' must be a quoted string", h.value || h.name));
3332
3350
  });
3333
3351
  break;
3334
3352
  case E.Ref:
3335
3353
  u.forEach((h) => {
3336
- Ss(h.value) || r.push(new c(l.INVALID_COLUMN_SETTING_VALUE, "'ref' must be a valid unary relationship", h.value || h.name));
3354
+ Ps(h.value) || r.push(new c(l.INVALID_COLUMN_SETTING_VALUE, "'ref' must be a valid unary relationship", h.value || h.name));
3337
3355
  });
3338
3356
  break;
3339
3357
  case E.PrimaryKey:
@@ -3380,9 +3398,9 @@ class Sl {
3380
3398
  ));
3381
3399
  });
3382
3400
  break;
3383
- case E.Constraint:
3401
+ case E.Check:
3384
3402
  u.forEach((h) => {
3385
- h.value instanceof ie || r.push(new c(l.INVALID_COLUMN_SETTING_VALUE, "'constraint' must be a function expression", h.value || h.name));
3403
+ h.value instanceof ie || r.push(new c(l.INVALID_COLUMN_SETTING_VALUE, "'check' must be a function expression", h.value || h.name));
3386
3404
  });
3387
3405
  break;
3388
3406
  default:
@@ -3403,7 +3421,7 @@ class Sl {
3403
3421
  return s.length > 1 && n.push(...s.map((r) => new c(l.NOTE_REDEFINED, "Duplicate notes are defined", r))), n;
3404
3422
  }
3405
3423
  }
3406
- function Pl(e, t) {
3424
+ function Sl(e, t) {
3407
3425
  return t.length === 1 && e === t[0];
3408
3426
  }
3409
3427
  class Ol {
@@ -3421,7 +3439,7 @@ class Ol {
3421
3439
  ];
3422
3440
  }
3423
3441
  validateContext() {
3424
- return this.declarationNode.parent instanceof P ? [new c(
3442
+ return this.declarationNode.parent instanceof S ? [new c(
3425
3443
  l.INVALID_TABLEGROUP_CONTEXT,
3426
3444
  "TableGroup must appear top-level",
3427
3445
  this.declarationNode
@@ -3450,7 +3468,7 @@ class Ol {
3450
3468
  this.declarationNode.symbol = this.symbolFactory.create(Qo, { declaration: this.declarationNode, symbolTable: new We() });
3451
3469
  const n = Q(t);
3452
3470
  if (n.isOk()) {
3453
- const s = n.unwrap(), r = s.pop(), i = At(s, this.publicSymbolTable, this.symbolFactory), a = Yt(r);
3471
+ const s = n.unwrap(), r = s.pop(), i = At(s, this.publicSymbolTable, this.symbolFactory), a = zt(r);
3454
3472
  if (i.has(a))
3455
3473
  return [new c(l.DUPLICATE_NAME, `TableGroup name '${r}' already exists`, t)];
3456
3474
  i.set(a, this.declarationNode.symbol);
@@ -3458,7 +3476,7 @@ class Ol {
3458
3476
  return [];
3459
3477
  }
3460
3478
  validateSettingList(t) {
3461
- const n = B(t), s = n.getErrors(), r = n.getValue();
3479
+ const n = F(t), s = n.getErrors(), r = n.getValue();
3462
3480
  return Je(r, (i, a) => {
3463
3481
  switch (a) {
3464
3482
  case "color":
@@ -3479,7 +3497,7 @@ class Ol {
3479
3497
  l.DUPLICATE_TABLE_SETTING,
3480
3498
  "'note' can only appear once",
3481
3499
  o
3482
- ))), i.filter((o) => !q(o.value)).forEach((o) => {
3500
+ ))), i.filter((o) => !Y(o.value)).forEach((o) => {
3483
3501
  s.push(new c(
3484
3502
  l.INVALID_TABLE_SETTING_VALUE,
3485
3503
  "'note' must be a string literal",
@@ -3531,7 +3549,7 @@ class Ol {
3531
3549
  }
3532
3550
  registerField(t) {
3533
3551
  if (t.callee && W(t.callee)) {
3534
- const n = j(t.callee).unwrap(), s = qt(n), r = this.symbolFactory.create(Jo, { declaration: t });
3552
+ const n = j(t.callee).unwrap(), s = Yt(n), r = this.symbolFactory.create(Jo, { declaration: t });
3535
3553
  t.symbol = r;
3536
3554
  const i = this.declarationNode.symbol.symbolTable;
3537
3555
  if (i.has(s)) {
@@ -3562,7 +3580,7 @@ class Dl {
3562
3580
  ];
3563
3581
  }
3564
3582
  validateContext() {
3565
- return this.declarationNode.parent instanceof P ? [new c(
3583
+ return this.declarationNode.parent instanceof S ? [new c(
3566
3584
  l.INVALID_TABLE_PARTIAL_CONTEXT,
3567
3585
  "TablePartial must appear top-level",
3568
3586
  this.declarationNode
@@ -3587,7 +3605,7 @@ class Dl {
3587
3605
  )] : [];
3588
3606
  }
3589
3607
  validateSettingList(t) {
3590
- const n = B(t), s = n.getErrors(), r = n.getValue();
3608
+ const n = F(t), s = n.getErrors(), r = n.getValue();
3591
3609
  return Je(r, (i, a) => {
3592
3610
  switch (a) {
3593
3611
  case E.HeaderColor:
@@ -3597,7 +3615,7 @@ class Dl {
3597
3615
  break;
3598
3616
  case E.Note:
3599
3617
  i.length > 1 && s.push(...i.map((o) => new c(l.DUPLICATE_TABLE_PARTIAL_SETTING, `'${a}' can only appear once`, o))), i.forEach((o) => {
3600
- q(o.value) || s.push(new c(l.INVALID_TABLE_PARTIAL_SETTING_VALUE, `'${a}' must be a string literal`, o.value || o.name));
3618
+ Y(o.value) || s.push(new c(l.INVALID_TABLE_PARTIAL_SETTING_VALUE, `'${a}' must be a string literal`, o.value || o.name));
3601
3619
  });
3602
3620
  break;
3603
3621
  default:
@@ -3610,7 +3628,7 @@ class Dl {
3610
3628
  this.declarationNode.symbol = this.symbolFactory.create(Zo, { declaration: this.declarationNode, symbolTable: new We() });
3611
3629
  const n = Q(t);
3612
3630
  if (!n.isOk()) return [];
3613
- const s = n.unwrap(), r = s.pop(), i = At(s, this.publicSymbolTable, this.symbolFactory), a = Kt(r);
3631
+ const s = n.unwrap(), r = s.pop(), i = At(s, this.publicSymbolTable, this.symbolFactory), a = qt(r);
3614
3632
  return i.has(a) ? [new c(l.DUPLICATE_NAME, `TablePartial name '${r}' already exists`, t)] : (i.set(a, this.declarationNode.symbol), []);
3615
3633
  }
3616
3634
  validateBody(t) {
@@ -3651,13 +3669,13 @@ class Dl {
3651
3669
  }
3652
3670
  // This is needed to support legacy inline settings
3653
3671
  validateFieldSetting(t) {
3654
- const n = F(t);
3655
- if (!t.slice(0, -1).every(Se) || !(Se(n) || n instanceof k))
3672
+ const n = M(t);
3673
+ if (!t.slice(0, -1).every(Pe) || !(Pe(n) || n instanceof k))
3656
3674
  return [...t.map((p) => new c(l.INVALID_COLUMN, "These fields must be some inline settings optionally ended with a setting list", p))];
3657
3675
  if (t.length === 0) return [];
3658
3676
  let s;
3659
- F(t) instanceof k && (s = t.pop());
3660
- const r = B(s), i = r.getErrors(), a = r.getValue();
3677
+ M(t) instanceof k && (s = t.pop());
3678
+ const r = F(s), i = r.getErrors(), a = r.getValue();
3661
3679
  t.forEach((p) => {
3662
3680
  const h = j(p).unwrap_or("").toLowerCase();
3663
3681
  if (h !== E.PK && h !== E.Unique) {
@@ -3675,12 +3693,12 @@ class Dl {
3675
3693
  switch (h) {
3676
3694
  case E.Note:
3677
3695
  p.length > 1 && i.push(...p.map((d) => new c(l.DUPLICATE_COLUMN_SETTING, `'${h}' can only appear once`, d))), p.forEach((d) => {
3678
- q(d.value) || i.push(new c(l.INVALID_COLUMN_SETTING_VALUE, `'${h}' must be a quoted string`, d.value || d.name));
3696
+ Y(d.value) || i.push(new c(l.INVALID_COLUMN_SETTING_VALUE, `'${h}' must be a quoted string`, d.value || d.name));
3679
3697
  });
3680
3698
  break;
3681
3699
  case E.Ref:
3682
3700
  p.forEach((d) => {
3683
- Ss(d.value) || i.push(new c(l.INVALID_COLUMN_SETTING_VALUE, `'${h}' must be a valid unary relationship`, d.value || d.name));
3701
+ Ps(d.value) || i.push(new c(l.INVALID_COLUMN_SETTING_VALUE, `'${h}' must be a valid unary relationship`, d.value || d.name));
3684
3702
  });
3685
3703
  break;
3686
3704
  case E.PrimaryKey:
@@ -3729,9 +3747,9 @@ class Dl {
3729
3747
  ));
3730
3748
  });
3731
3749
  break;
3732
- case E.Constraint:
3750
+ case E.Check:
3733
3751
  p.forEach((d) => {
3734
- d.value instanceof ie || i.push(new c(l.INVALID_COLUMN_SETTING_VALUE, "'constraint' must be a function expression", d.value || d.name));
3752
+ d.value instanceof ie || i.push(new c(l.INVALID_COLUMN_SETTING_VALUE, "'check' must be a function expression", d.value || d.name));
3735
3753
  });
3736
3754
  break;
3737
3755
  default:
@@ -3752,7 +3770,7 @@ class Dl {
3752
3770
  return s.length > 1 && n.push(...s.map((r) => new c(l.NOTE_REDEFINED, "Duplicate notes are defined", r))), n;
3753
3771
  }
3754
3772
  }
3755
- class Rl {
3773
+ class kl {
3756
3774
  constructor(t, n, s) {
3757
3775
  this.declarationNode = t, this.publicSymbolTable = n, this.symbolFactory = s;
3758
3776
  }
@@ -3767,28 +3785,28 @@ class Rl {
3767
3785
  }
3768
3786
  validateContext() {
3769
3787
  const t = new c(
3770
- l.INVALID_CONSTRAINTS_CONTEXT,
3771
- "A Constraints can only appear inside a Table or a TablePartial",
3788
+ l.INVALID_CHECKS_CONTEXT,
3789
+ "A Checks can only appear inside a Table or a TablePartial",
3772
3790
  this.declarationNode
3773
3791
  );
3774
3792
  if (this.declarationNode.parent instanceof ne) return [t];
3775
- const n = Pe(this.declarationNode.parent).unwrap_or(void 0);
3793
+ const n = Se(this.declarationNode.parent).unwrap_or(void 0);
3776
3794
  return n && [_.Table, _.TablePartial].includes(n) ? [] : [t];
3777
3795
  }
3778
3796
  validateName(t) {
3779
- return t ? [new c(l.UNEXPECTED_NAME, "A Constraints shouldn't have a name", t)] : [];
3797
+ return t ? [new c(l.UNEXPECTED_NAME, "A Checks shouldn't have a name", t)] : [];
3780
3798
  }
3781
3799
  validateAlias(t) {
3782
- return t ? [new c(l.UNEXPECTED_ALIAS, "A Constraints shouldn't have an alias", t)] : [];
3800
+ return t ? [new c(l.UNEXPECTED_ALIAS, "A Checks shouldn't have an alias", t)] : [];
3783
3801
  }
3784
3802
  validateSettingList(t) {
3785
- return t ? [new c(l.UNEXPECTED_SETTINGS, "A Constraints shouldn't have a setting list", t)] : [];
3803
+ return t ? [new c(l.UNEXPECTED_SETTINGS, "A Checks shouldn't have a setting list", t)] : [];
3786
3804
  }
3787
3805
  validateBody(t) {
3788
3806
  if (!t)
3789
3807
  return [];
3790
3808
  if (t instanceof y)
3791
- return [new c(l.UNEXPECTED_SIMPLE_BODY, "A Constraints must have a complex body", t)];
3809
+ return [new c(l.UNEXPECTED_SIMPLE_BODY, "A Checks must have a complex body", t)];
3792
3810
  const [n, s] = oe(t.body, (r) => r instanceof y);
3793
3811
  return [...this.validateFields(n), ...this.validateSubElements(s)];
3794
3812
  }
@@ -3797,21 +3815,21 @@ class Rl {
3797
3815
  if (!n.callee)
3798
3816
  return [];
3799
3817
  const s = [], r = [n.callee, ...n.args];
3800
- return F(r) instanceof k && s.push(...this.validateFieldSetting(r.pop())), (r.length > 1 || !(r[0] instanceof ie)) && s.push(new c(l.INVALID_CONSTRAINTS_FIELD, "A constraint field must be a function expression", n)), s;
3818
+ return M(r) instanceof k && s.push(...this.validateFieldSetting(r.pop())), (r.length > 1 || !(r[0] instanceof ie)) && s.push(new c(l.INVALID_CHECKS_FIELD, "A check field must be a function expression", n)), s;
3801
3819
  });
3802
3820
  }
3803
3821
  validateFieldSetting(t) {
3804
- const n = B(t), s = n.getErrors(), r = n.getValue();
3822
+ const n = F(t), s = n.getErrors(), r = n.getValue();
3805
3823
  for (const i in r) {
3806
3824
  const a = r[i];
3807
3825
  switch (i) {
3808
3826
  case "name":
3809
- a.length > 1 && a.forEach((o) => s.push(new c(l.DUPLICATE_CONSTRAINT_SETTING, `'${i}' can only appear once`, o))), a.forEach((o) => {
3810
- q(o.value) || s.push(new c(l.INVALID_CONSTRAINT_SETTING_VALUE, `'${i}' must be a string`, o));
3827
+ a.length > 1 && a.forEach((o) => s.push(new c(l.DUPLICATE_CHECK_SETTING, `'${i}' can only appear once`, o))), a.forEach((o) => {
3828
+ Y(o.value) || s.push(new c(l.INVALID_CHECK_SETTING_VALUE, `'${i}' must be a string`, o));
3811
3829
  });
3812
3830
  break;
3813
3831
  default:
3814
- a.forEach((o) => s.push(new c(l.UNKNOWN_CONSTRAINT_SETTING, `Unknown constraint setting '${i}'`, o)));
3832
+ a.forEach((o) => s.push(new c(l.UNKNOWN_CHECK_SETTING, `Unknown check setting '${i}'`, o)));
3815
3833
  }
3816
3834
  }
3817
3835
  return s;
@@ -3830,7 +3848,7 @@ function me(e) {
3830
3848
  case _.Enum:
3831
3849
  return gl;
3832
3850
  case _.Table:
3833
- return Sl;
3851
+ return Pl;
3834
3852
  case _.TableGroup:
3835
3853
  return Ol;
3836
3854
  case _.Project:
@@ -3843,8 +3861,8 @@ function me(e) {
3843
3861
  return Al;
3844
3862
  case _.TablePartial:
3845
3863
  return Dl;
3846
- case _.Constraints:
3847
- return Rl;
3864
+ case _.Check:
3865
+ return kl;
3848
3866
  default:
3849
3867
  return _l;
3850
3868
  }
@@ -3852,11 +3870,11 @@ function me(e) {
3852
3870
  function vs(e) {
3853
3871
  return !!Q(e).unwrap_or(!1);
3854
3872
  }
3855
- function kl(e) {
3873
+ function Rl(e) {
3856
3874
  return He(e);
3857
3875
  }
3858
3876
  function He(e) {
3859
- return e instanceof Y && e.expression instanceof de;
3877
+ return e instanceof z && e.expression instanceof de;
3860
3878
  }
3861
3879
  function At(e, t, n) {
3862
3880
  var r;
@@ -3882,7 +3900,7 @@ function ys(e) {
3882
3900
  }
3883
3901
  function Lt(e) {
3884
3902
  var n;
3885
- if (!(e instanceof Y) || !(e.expression instanceof je) || ((n = e.expression.literal) == null ? void 0 : n.kind) !== f.COLOR_LITERAL)
3903
+ if (!(e instanceof z) || !(e.expression instanceof je) || ((n = e.expression.literal) == null ? void 0 : n.kind) !== f.COLOR_LITERAL)
3886
3904
  return !1;
3887
3905
  const t = e.expression.literal.value;
3888
3906
  if (t.length !== 4 && t.length !== 7 || t[0] !== "#")
@@ -3897,31 +3915,31 @@ function ee(e) {
3897
3915
  }
3898
3916
  function ws(e) {
3899
3917
  var t;
3900
- return !!(q(e) || Ue(e) || Se(e) && ["true", "false", "null"].includes(e.expression.variable.value.toLowerCase()) || e instanceof re && xl.includes((t = e.op) == null ? void 0 : t.value) && Ue(e.expression) || e instanceof ie);
3918
+ return !!(Y(e) || Ue(e) || Pe(e) && ["true", "false", "null"].includes(e.expression.variable.value.toLowerCase()) || e instanceof re && xl.includes((t = e.op) == null ? void 0 : t.value) && Ue(e.expression) || e instanceof ie);
3901
3919
  }
3902
3920
  function Ue(e) {
3903
3921
  var t, n, s;
3904
- return e instanceof re ? ((t = e.op) == null ? void 0 : t.value) !== "-" && ((n = e.op) == null ? void 0 : n.value) !== "+" ? !1 : Ue(e.expression) : e instanceof Y && e.expression instanceof je && ((s = e.expression.literal) == null ? void 0 : s.kind) === f.NUMERIC_LITERAL;
3922
+ return e instanceof re ? ((t = e.op) == null ? void 0 : t.value) !== "-" && ((n = e.op) == null ? void 0 : n.value) !== "+" ? !1 : Ue(e.expression) : e instanceof z && e.expression instanceof je && ((s = e.expression.literal) == null ? void 0 : s.kind) === f.NUMERIC_LITERAL;
3905
3923
  }
3906
- function Ss(e) {
3924
+ function Ps(e) {
3907
3925
  var n;
3908
3926
  if (!(e instanceof re) || !ys((n = e.op) == null ? void 0 : n.value))
3909
3927
  return !1;
3910
3928
  const t = Q(e.expression).unwrap_or(void 0);
3911
3929
  return t !== void 0 && t.length > 0;
3912
3930
  }
3913
- function Ps(e) {
3931
+ function Ss(e) {
3914
3932
  return e instanceof be && e.elementList.every(W);
3915
3933
  }
3916
3934
  function Os(e) {
3917
- if (!(e instanceof ae || Jt(e) || e instanceof Y || e instanceof ke))
3935
+ if (!(e instanceof ae || Jt(e) || e instanceof z || e instanceof Re))
3918
3936
  return !1;
3919
3937
  if (e instanceof ae) {
3920
- if (e.callee === void 0 || e.argumentList === void 0 || !e.argumentList.elementList.every((n) => Ue(n) || q(n) || Se(n)))
3938
+ if (e.callee === void 0 || e.argumentList === void 0 || !e.argumentList.elementList.every((n) => Ue(n) || Y(n) || Pe(n)))
3921
3939
  return !1;
3922
3940
  e = e.callee;
3923
3941
  }
3924
- for (; e instanceof ke; ) {
3942
+ for (; e instanceof Re; ) {
3925
3943
  if (e.array === void 0 || e.indexer === void 0 || !e.indexer.elementList.every((n) => !n.colon && !n.value && Ue(n.name)))
3926
3944
  return !1;
3927
3945
  e = e.array;
@@ -3929,7 +3947,7 @@ function Os(e) {
3929
3947
  const t = Q(e).unwrap_or(void 0);
3930
3948
  return t !== void 0 && t.length > 0;
3931
3949
  }
3932
- function B(e) {
3950
+ function F(e) {
3933
3951
  var s;
3934
3952
  const t = {}, n = [];
3935
3953
  if (!e)
@@ -3937,7 +3955,7 @@ function B(e) {
3937
3955
  for (const r of e.elementList) {
3938
3956
  if (!r.name)
3939
3957
  continue;
3940
- if (r.name instanceof Y) {
3958
+ if (r.name instanceof z) {
3941
3959
  n.push(new c(l.INVALID_SETTINGS, "A setting name must be a stream of identifiers", r.name));
3942
3960
  continue;
3943
3961
  }
@@ -3964,11 +3982,11 @@ class Bn {
3964
3982
  );
3965
3983
  t.push(...i.validate());
3966
3984
  });
3967
- const n = this.ast.body.filter((s) => Pe(s).unwrap_or(void 0) === _.Project);
3985
+ const n = this.ast.body.filter((s) => Se(s).unwrap_or(void 0) === _.Project);
3968
3986
  return n.length > 1 && n.forEach((s) => t.push(new c(l.PROJECT_REDEFINED, "Only one project can exist", s))), new se(this.ast, t);
3969
3987
  }
3970
3988
  }
3971
- class Le {
3989
+ class Ie {
3972
3990
  constructor(t, n) {
3973
3991
  this.declarationNode = t, this.errors = n;
3974
3992
  }
@@ -3977,7 +3995,7 @@ class Le {
3977
3995
  }
3978
3996
  bindSettingList(t, n) {
3979
3997
  t && t.elementList.forEach((s) => {
3980
- if (s.name instanceof Y) return;
3998
+ if (s.name instanceof z) return;
3981
3999
  const r = $e(s.name).unwrap_or(void 0);
3982
4000
  if (!r) return;
3983
4001
  const i = n[r.toLowerCase()];
@@ -3989,15 +4007,15 @@ class Le {
3989
4007
  if (!t.body) return;
3990
4008
  const { body: n } = t;
3991
4009
  n instanceof Ee ? n.body.forEach((s) => {
3992
- if (s instanceof P) {
3993
- if (!s.type || Pe(this.declarationNode).unwrap_or(null) === _.TablePartial && Pe(s).unwrap_or(null) === _.Indexes) return;
4010
+ if (s instanceof S) {
4011
+ if (!s.type || Se(this.declarationNode).unwrap_or(null) === _.TablePartial && Se(s).unwrap_or(null) === _.Indexes) return;
3994
4012
  const r = xs(s);
3995
4013
  new r(s, this.errors).bind();
3996
4014
  } else s instanceof y ? this.bindSubfield(s) : this.bindPartialInjection(s);
3997
4015
  }) : this.bindSubfield(n);
3998
4016
  }
3999
4017
  bindSubfield(t) {
4000
- const n = [t.callee, ...t.args], s = F(n);
4018
+ const n = [t.callee, ...t.args], s = M(n);
4001
4019
  s instanceof k && (n.pop(), this.bindSettingList(s, this.subfield.settingList));
4002
4020
  const { argBinderRules: r } = this.subfield.arg;
4003
4021
  for (let i = 0; i < Math.min(n.length, r.length); i += 1)
@@ -4011,18 +4029,18 @@ class Le {
4011
4029
  scanAndBind(t, n) {
4012
4030
  var s, r;
4013
4031
  if (t)
4014
- if (t instanceof Y) {
4032
+ if (t instanceof z) {
4015
4033
  if (t.expression instanceof de && ((r = n.keywords) != null && r.includes((s = t.expression.variable) == null ? void 0 : s.value.toLowerCase())))
4016
4034
  return;
4017
4035
  this.bindFragments([t], n);
4018
- } else t instanceof Te ? Jt(t) ? this.bindFragments(Be(t).unwrap_or([]), n) : (this.scanAndBind(t.leftExpression, n), this.scanAndBind(t.rightExpression, n)) : t instanceof re ? this.scanAndBind(t.expression, n) : t instanceof It ? this.scanAndBind(t.expression, n) : t instanceof be ? t.elementList.forEach((i) => this.scanAndBind(i, n)) : t instanceof Re && this.bindFragments([t], n);
4036
+ } else t instanceof Te ? Jt(t) ? this.bindFragments(Be(t).unwrap_or([]), n) : (this.scanAndBind(t.leftExpression, n), this.scanAndBind(t.rightExpression, n)) : t instanceof re ? this.scanAndBind(t.expression, n) : t instanceof It ? this.scanAndBind(t.expression, n) : t instanceof be ? t.elementList.forEach((i) => this.scanAndBind(i, n)) : t instanceof ke && this.bindFragments([t], n);
4019
4037
  }
4020
4038
  // Bind the fragments of a member access expression
4021
4039
  // which can be a simple expression like v1.User,
4022
4040
  // or a complex tuple like v1.User.(id, name)
4023
4041
  bindFragments(t, n) {
4024
4042
  if (t.length === 0) return;
4025
- const s = t.length === 1 && t[0] instanceof Re, r = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: i } = n, a = s ? -1 : t.findIndex((N) => !W(N)), u = a !== -1 && Ps(t[a]) ? t[a] : void 0, p = a >= 0 ? r.pop() : void 0, h = t.slice(
4043
+ const s = t.length === 1 && t[0] instanceof ke, r = [...n.topSubnamesSymbolKind], { remainingSubnamesSymbolKind: i } = n, a = s ? -1 : t.findIndex((N) => !W(N)), u = a !== -1 && Ss(t[a]) ? t[a] : void 0, p = a >= 0 ? r.pop() : void 0, h = t.slice(
4026
4044
  0,
4027
4045
  a === -1 ? void 0 : a
4028
4046
  );
@@ -4096,7 +4114,7 @@ class Le {
4096
4114
  n.forEach((i, a) => {
4097
4115
  var p, h;
4098
4116
  if (!Ho(a)) return;
4099
- const o = Fn(zo(a), this.declarationNode), u = (h = (p = o == null ? void 0 : o.declaration) == null ? void 0 : p.symbol) == null ? void 0 : h.symbolTable;
4117
+ const o = Fn(Ko(a), this.declarationNode), u = (h = (p = o == null ? void 0 : o.declaration) == null ? void 0 : p.symbol) == null ? void 0 : h.symbolTable;
4100
4118
  u && u.forEach((d, N) => {
4101
4119
  n.has(N) || s.set(N, { injectorFieldSymbol: d, injectorDeclaration: i.declaration });
4102
4120
  });
@@ -4108,7 +4126,21 @@ class Le {
4108
4126
  });
4109
4127
  }
4110
4128
  }
4111
- class Ul extends Le {
4129
+ class Ul extends Ie {
4130
+ constructor() {
4131
+ super(...arguments), this.subfield = {
4132
+ arg: {
4133
+ argBinderRules: [
4134
+ {
4135
+ shouldBind: !1
4136
+ }
4137
+ ]
4138
+ },
4139
+ settingList: {}
4140
+ }, this.settingList = {};
4141
+ }
4142
+ }
4143
+ class Ml extends Ie {
4112
4144
  constructor() {
4113
4145
  super(...arguments), this.subfield = {
4114
4146
  arg: {
@@ -4118,7 +4150,7 @@ class Ul extends Le {
4118
4150
  }, this.settingList = {};
4119
4151
  }
4120
4152
  }
4121
- class Ml extends Le {
4153
+ class Fl extends Ie {
4122
4154
  constructor() {
4123
4155
  super(...arguments), this.subfield = {
4124
4156
  arg: {
@@ -4128,7 +4160,7 @@ class Ml extends Le {
4128
4160
  }, this.settingList = {};
4129
4161
  }
4130
4162
  }
4131
- class Fl extends Le {
4163
+ class Bl extends Ie {
4132
4164
  constructor() {
4133
4165
  super(...arguments), this.subfield = {
4134
4166
  arg: {
@@ -4163,7 +4195,7 @@ class Fl extends Le {
4163
4195
  }, this.settingList = {};
4164
4196
  }
4165
4197
  }
4166
- class Bl extends Le {
4198
+ class Cl extends Ie {
4167
4199
  constructor() {
4168
4200
  super(...arguments), this.subfield = {
4169
4201
  arg: {
@@ -4173,7 +4205,7 @@ class Bl extends Le {
4173
4205
  }, this.settingList = {};
4174
4206
  }
4175
4207
  }
4176
- class Vl extends Le {
4208
+ class Vl extends Ie {
4177
4209
  constructor() {
4178
4210
  super(...arguments), this.subfield = {
4179
4211
  arg: {
@@ -4183,7 +4215,7 @@ class Vl extends Le {
4183
4215
  }, this.settingList = {};
4184
4216
  }
4185
4217
  }
4186
- class Cl extends Le {
4218
+ class Gl extends Ie {
4187
4219
  constructor() {
4188
4220
  super(...arguments), this.subfield = {
4189
4221
  arg: {
@@ -4200,7 +4232,7 @@ class Cl extends Le {
4200
4232
  }, this.settingList = {};
4201
4233
  }
4202
4234
  }
4203
- class Gl extends Le {
4235
+ class $l extends Ie {
4204
4236
  constructor() {
4205
4237
  super(...arguments), this.subfield = {
4206
4238
  arg: {
@@ -4224,7 +4256,7 @@ class Gl extends Le {
4224
4256
  default: {
4225
4257
  shouldBind: !1
4226
4258
  },
4227
- constraint: {
4259
+ check: {
4228
4260
  shouldBind: !1
4229
4261
  }
4230
4262
  }
@@ -4236,7 +4268,7 @@ class Gl extends Le {
4236
4268
  };
4237
4269
  }
4238
4270
  }
4239
- class $l extends Le {
4271
+ class Xl extends Ie {
4240
4272
  constructor() {
4241
4273
  super(...arguments), this.subfield = {
4242
4274
  arg: {
@@ -4253,7 +4285,7 @@ class $l extends Le {
4253
4285
  }, this.settingList = {};
4254
4286
  }
4255
4287
  }
4256
- class Xl extends Le {
4288
+ class jl extends Ie {
4257
4289
  constructor() {
4258
4290
  super(...arguments), this.subfield = {
4259
4291
  arg: {
@@ -4276,6 +4308,9 @@ class Xl extends Le {
4276
4308
  },
4277
4309
  default: {
4278
4310
  shouldBind: !1
4311
+ },
4312
+ check: {
4313
+ shouldBind: !1
4279
4314
  }
4280
4315
  }
4281
4316
  }, this.settingList = {};
@@ -4284,26 +4319,28 @@ class Xl extends Le {
4284
4319
  function xs(e) {
4285
4320
  switch (e.type.value.toLowerCase()) {
4286
4321
  case _.Enum:
4287
- return Ml;
4322
+ return Fl;
4288
4323
  case _.Table:
4289
- return Gl;
4290
- case _.TableGroup:
4291
4324
  return $l;
4325
+ case _.TableGroup:
4326
+ return Xl;
4292
4327
  case _.Project:
4293
4328
  return Vl;
4294
4329
  case _.Ref:
4295
- return Cl;
4330
+ return Gl;
4296
4331
  case _.Note:
4297
- return Bl;
4332
+ return Cl;
4298
4333
  case _.Indexes:
4299
- return Fl;
4334
+ return Bl;
4300
4335
  case _.TablePartial:
4301
- return Xl;
4302
- default:
4336
+ return jl;
4337
+ case _.Check:
4303
4338
  return Ul;
4339
+ default:
4340
+ return Ml;
4304
4341
  }
4305
4342
  }
4306
- class jl {
4343
+ class Wl {
4307
4344
  constructor(t) {
4308
4345
  this.ast = t, this.errors = [];
4309
4346
  }
@@ -4315,7 +4352,7 @@ class jl {
4315
4352
  }).forEach((n) => n == null ? void 0 : n.bind()), new se(this.ast, this.errors);
4316
4353
  }
4317
4354
  }
4318
- class Wl {
4355
+ class Hl {
4319
4356
  constructor(t) {
4320
4357
  this.generator = t;
4321
4358
  }
@@ -4323,20 +4360,20 @@ class Wl {
4323
4360
  return new t(n, this.generator.nextId());
4324
4361
  }
4325
4362
  }
4326
- class Hl {
4363
+ class Kl {
4327
4364
  constructor(t, n) {
4328
- this.ast = t, this.symbolFactory = new Wl(n);
4365
+ this.ast = t, this.symbolFactory = new Hl(n);
4329
4366
  }
4330
4367
  // Analyzing: Invoking both the validator and binder
4331
4368
  analyze() {
4332
- return new Bn(this.ast, this.symbolFactory).validate().chain((n) => new jl(n).resolve(this.symbolFactory));
4369
+ return new Bn(this.ast, this.symbolFactory).validate().chain((n) => new Wl(n).resolve(this.symbolFactory));
4333
4370
  }
4334
4371
  // For invoking the validator only
4335
4372
  validate() {
4336
4373
  return new Bn(this.ast, this.symbolFactory).validate().chain((n) => new se(n, []));
4337
4374
  }
4338
4375
  }
4339
- function Vn(e, t) {
4376
+ function Cn(e, t) {
4340
4377
  const { variables: n, tupleElements: s } = Ze(e).unwrap();
4341
4378
  return s ? n.length === 0 ? {
4342
4379
  schemaName: t.schemaName,
@@ -4389,7 +4426,7 @@ function ht(e) {
4389
4426
  const t = (n = Be(e).unwrap_or(void 0)) == null ? void 0 : n.pop();
4390
4427
  return t instanceof be ? t.elementList.map((s) => s.referee) : [t.referee];
4391
4428
  }
4392
- function Ve(e) {
4429
+ function Ce(e) {
4393
4430
  const t = Q(e).unwrap();
4394
4431
  return {
4395
4432
  name: t.pop(),
@@ -4399,7 +4436,7 @@ function Ve(e) {
4399
4436
  function tt(e) {
4400
4437
  return e.expression.literal.value;
4401
4438
  }
4402
- function Rs(e, t) {
4439
+ function ks(e, t) {
4403
4440
  if (Array.isArray(e)) {
4404
4441
  const r = e.map(({ id: a }) => a).sort().join(","), i = t.map(({ id: a }) => a).sort().join(",");
4405
4442
  return r < i ? `${r}-${i}` : `${i}-${r}`;
@@ -4410,7 +4447,7 @@ function Rs(e, t) {
4410
4447
  function Zt(e, t) {
4411
4448
  if (Array.isArray(e)) {
4412
4449
  const r = e.map(({ id: a }) => a).sort(), i = t.map(({ id: a }) => a).sort();
4413
- return kt(r, i).every(([a, o]) => a === o);
4450
+ return Rt(r, i).every(([a, o]) => a === o);
4414
4451
  }
4415
4452
  const n = e.id, s = t.id;
4416
4453
  return n === s;
@@ -4421,9 +4458,9 @@ function fe(e) {
4421
4458
  return n.map((i) => i.slice(r)).join(`
4422
4459
  `);
4423
4460
  }
4424
- function ks(e) {
4461
+ function Rs(e) {
4425
4462
  if (e) {
4426
- if (q(e))
4463
+ if (Y(e))
4427
4464
  return {
4428
4465
  value: C(e).unwrap(),
4429
4466
  type: "string"
@@ -4433,7 +4470,7 @@ function ks(e) {
4433
4470
  type: "number",
4434
4471
  value: Mt(e)
4435
4472
  };
4436
- if (Se(e))
4473
+ if (Pe(e))
4437
4474
  return {
4438
4475
  value: e.expression.variable.value.toLowerCase(),
4439
4476
  type: "boolean"
@@ -4448,11 +4485,11 @@ function ks(e) {
4448
4485
  }
4449
4486
  function Us(e) {
4450
4487
  let t = null;
4451
- e instanceof ae && (t = e.argumentList.elementList.map((i) => Ue(i) ? As(i) : q(i) ? C(i).unwrap() : K(i).unwrap()).join(","), e = e.callee);
4488
+ e instanceof ae && (t = e.argumentList.elementList.map((i) => Ue(i) ? As(i) : Y(i) ? C(i).unwrap() : q(i).unwrap()).join(","), e = e.callee);
4452
4489
  let n = "";
4453
- for (; e instanceof ke; )
4490
+ for (; e instanceof Re; )
4454
4491
  n = `[${e.indexer.elementList.map((i) => i.name.expression.literal.value).join(",")}]${n}`, e = e.array;
4455
- const { name: s, schemaName: r } = Ve(e);
4492
+ const { name: s, schemaName: r } = Ce(e);
4456
4493
  return r.length > 1 ? new se(
4457
4494
  {
4458
4495
  schemaName: r.length === 0 ? null : r[0],
@@ -4476,7 +4513,7 @@ class Ms {
4476
4513
  token: void 0,
4477
4514
  indexes: [],
4478
4515
  partials: [],
4479
- constraints: []
4516
+ checks: []
4480
4517
  }, this.pkColumns = [];
4481
4518
  }
4482
4519
  interpret() {
@@ -4501,7 +4538,7 @@ class Ms {
4501
4538
  })), t;
4502
4539
  }
4503
4540
  interpretName(t) {
4504
- const { name: n, schemaName: s } = Ve(t);
4541
+ const { name: n, schemaName: s } = Ce(t);
4505
4542
  return s.length > 1 ? (this.table.name = n, this.table.schemaName = s.join("."), [new c(l.UNSUPPORTED, "Nested schema is not supported", t)]) : (this.table.name = n, this.table.schemaName = s.length ? s[0] : null, []);
4506
4543
  }
4507
4544
  interpretAlias(t) {
@@ -4519,7 +4556,7 @@ class Ms {
4519
4556
  }
4520
4557
  interpretSettingList(t) {
4521
4558
  var r, i, a;
4522
- const n = B(t).getValue();
4559
+ const n = F(t).getValue();
4523
4560
  this.table.headerColor = (r = n[E.HeaderColor]) != null && r.length ? tt((a = (i = n[E.HeaderColor]) == null ? void 0 : i.at(0)) == null ? void 0 : a.value) : void 0;
4524
4561
  const [s] = n[E.Note] || [];
4525
4562
  return this.table.note = s && {
@@ -4528,7 +4565,7 @@ class Ms {
4528
4565
  }, [];
4529
4566
  }
4530
4567
  interpretBody(t) {
4531
- const [n, s] = oe(t.body, (r) => r instanceof y || r instanceof Re);
4568
+ const [n, s] = oe(t.body, (r) => r instanceof y || r instanceof ke);
4532
4569
  return [
4533
4570
  ...this.interpretFields(n),
4534
4571
  ...this.interpretSubElements(s)
@@ -4547,8 +4584,8 @@ class Ms {
4547
4584
  }, [];
4548
4585
  case _.Indexes:
4549
4586
  return this.interpretIndexes(n);
4550
- case _.Constraints:
4551
- return this.interpretConstraints(n);
4587
+ case _.Check:
4588
+ return this.interpretChecks(n);
4552
4589
  default:
4553
4590
  return [];
4554
4591
  }
@@ -4576,9 +4613,9 @@ class Ms {
4576
4613
  const r = Us(t.args[0]);
4577
4614
  s.type = r.getValue(), n.push(...r.getErrors()), s.token = L(t), s.inline_refs = [];
4578
4615
  const i = t.args.slice(1);
4579
- if (F(i) instanceof k) {
4580
- const m = B(i.pop()).getValue();
4581
- s.pk = !!((a = m[E.PK]) != null && a.length) || !!((o = m[E.PrimaryKey]) != null && o.length), s.increment = !!((u = m[E.Increment]) != null && u.length), s.unique = !!((p = m[E.Unique]) != null && p.length), s.not_null = (h = m[E.NotNull]) != null && h.length ? !0 : (d = m[E.Null]) != null && d.length ? !1 : void 0, s.dbdefault = ks((b = (N = m[E.Default]) == null ? void 0 : N.at(0)) == null ? void 0 : b.value);
4616
+ if (M(i) instanceof k) {
4617
+ const m = F(i.pop()).getValue();
4618
+ s.pk = !!((a = m[E.PK]) != null && a.length) || !!((o = m[E.PrimaryKey]) != null && o.length), s.increment = !!((u = m[E.Increment]) != null && u.length), s.unique = !!((p = m[E.Unique]) != null && p.length), s.not_null = (h = m[E.NotNull]) != null && h.length ? !0 : (d = m[E.Null]) != null && d.length ? !1 : void 0, s.dbdefault = Rs((b = (N = m[E.Default]) == null ? void 0 : N.at(0)) == null ? void 0 : b.value);
4582
4619
  const v = (A = m[E.Note]) == null ? void 0 : A.at(0);
4583
4620
  s.note = v && {
4584
4621
  value: C(v.value).map(fe).unwrap(),
@@ -4589,60 +4626,59 @@ class Ms {
4589
4626
  const [J] = ht(w.value.expression);
4590
4627
  if (Zt(J, t.symbol))
4591
4628
  return n.push(new c(l.SAME_ENDPOINT, "Two endpoints are the same", w)), [];
4592
- const G = w.value.op, D = Q(w.value.expression).unwrap();
4629
+ const V = w.value.op, G = Q(w.value.expression).unwrap();
4593
4630
  let le;
4594
- if (D.length === 1) {
4595
- const [Z] = D;
4631
+ if (G.length === 1) {
4632
+ const [Z] = G;
4596
4633
  le = {
4597
4634
  schemaName: this.table.schemaName,
4598
4635
  tableName: this.table.name,
4599
4636
  fieldNames: [Z],
4600
- relation: G.value,
4637
+ relation: V.value,
4601
4638
  token: L(w)
4602
4639
  };
4603
- } else if (D.length === 2) {
4604
- const [Z, ye] = D;
4640
+ } else if (G.length === 2) {
4641
+ const [Z, ye] = G;
4605
4642
  le = {
4606
4643
  schemaName: null,
4607
4644
  tableName: Z,
4608
4645
  fieldNames: [ye],
4609
- relation: G.value,
4646
+ relation: V.value,
4610
4647
  token: L(w)
4611
4648
  };
4612
- } else if (D.length === 3) {
4613
- const [Z, ye, nn] = D;
4649
+ } else if (G.length === 3) {
4650
+ const [Z, ye, nn] = G;
4614
4651
  le = {
4615
4652
  schemaName: Z,
4616
4653
  tableName: ye,
4617
4654
  fieldNames: [nn],
4618
- relation: G.value,
4655
+ relation: V.value,
4619
4656
  token: L(w)
4620
4657
  };
4621
4658
  } else {
4622
4659
  n.push(new c(l.UNSUPPORTED, "Nested schema is not supported", w));
4623
- const Z = D.pop(), ye = D.pop();
4660
+ const Z = G.pop(), ye = G.pop();
4624
4661
  le = {
4625
- schemaName: D.join("."),
4662
+ schemaName: G.join("."),
4626
4663
  tableName: ye,
4627
4664
  fieldNames: [Z],
4628
- relation: G.value,
4665
+ relation: V.value,
4629
4666
  token: L(w)
4630
4667
  };
4631
4668
  }
4632
4669
  const ve = this.registerInlineRefToEnv(t, J, le, w);
4633
4670
  return n.push(...ve), ve.length === 0 ? le : [];
4634
4671
  });
4635
- const z = m[E.Constraint] || [];
4636
- s.constraints = z.map((w) => {
4637
- var D;
4638
- const J = L(w), G = (D = w.value.value) == null ? void 0 : D.value;
4672
+ const K = m[E.Check] || [];
4673
+ s.checks = K.map((w) => {
4674
+ const J = L(w), V = w.value.value.value;
4639
4675
  return {
4640
4676
  token: J,
4641
- expression: G
4677
+ expression: V
4642
4678
  };
4643
4679
  });
4644
4680
  }
4645
- return s.pk || (s.pk = i.some((m) => K(m).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = i.some((m) => K(m).unwrap().toLowerCase() === "unique")), this.table.fields.push(s), s.pk && this.pkColumns.push(s), n;
4681
+ return s.pk || (s.pk = i.some((m) => q(m).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = i.some((m) => q(m).unwrap().toLowerCase() === "unique")), this.table.fields.push(s), s.pk && this.pkColumns.push(s), n;
4646
4682
  }
4647
4683
  interpretIndexes(t) {
4648
4684
  return this.table.indexes.push(...t.body.body.map((n) => {
@@ -4650,14 +4686,14 @@ class Ms {
4650
4686
  const s = { columns: [] }, r = n;
4651
4687
  s.token = L(r);
4652
4688
  const i = [r.callee, ...r.args];
4653
- if (F(i) instanceof k) {
4654
- const b = B(i.pop()).getValue();
4689
+ if (M(i) instanceof k) {
4690
+ const b = F(i.pop()).getValue();
4655
4691
  s.pk = !!((a = b[E.PK]) != null && a.length), s.unique = !!((o = b[E.Unique]) != null && o.length), s.name = C((p = (u = b[E.Name]) == null ? void 0 : u.at(0)) == null ? void 0 : p.value).unwrap_or(void 0);
4656
4692
  const A = (h = b[E.Note]) == null ? void 0 : h.at(0);
4657
4693
  s.note = A && {
4658
4694
  value: C(A.value).unwrap(),
4659
4695
  token: L(A)
4660
- }, s.type = K((N = (d = b[E.Type]) == null ? void 0 : d.at(0)) == null ? void 0 : N.value).unwrap_or(void 0);
4696
+ }, s.type = q((N = (d = b[E.Type]) == null ? void 0 : d.at(0)) == null ? void 0 : N.value).unwrap_or(void 0);
4661
4697
  }
4662
4698
  return i.flatMap((b) => {
4663
4699
  if (!(b instanceof ae))
@@ -4683,19 +4719,19 @@ class Ms {
4683
4719
  }), s;
4684
4720
  })), [];
4685
4721
  }
4686
- interpretConstraints(t) {
4687
- return this.table.constraints.push(...t.body.body.map((n) => {
4688
- var i, a, o;
4722
+ interpretChecks(t) {
4723
+ return this.table.checks.push(...t.body.body.map((n) => {
4724
+ var i, a;
4689
4725
  const s = {}, r = n;
4690
4726
  if (s.token = L(r), r.args[0] instanceof k) {
4691
- const u = B(r.args[0]).getValue();
4692
- s.name = C((a = (i = u[E.Name]) == null ? void 0 : i.at(0)) == null ? void 0 : a.value).unwrap_or(void 0);
4727
+ const o = F(r.args[0]).getValue();
4728
+ s.name = C((a = (i = o[E.Name]) == null ? void 0 : i.at(0)) == null ? void 0 : a.value).unwrap_or(void 0);
4693
4729
  }
4694
- return s.expression = (o = r.callee.value) == null ? void 0 : o.value, s;
4730
+ return s.expression = r.callee.value.value, s;
4695
4731
  })), [];
4696
4732
  }
4697
4733
  registerInlineRefToEnv(t, n, s, r) {
4698
- const i = Rs(t.symbol, n);
4734
+ const i = ks(t.symbol, n);
4699
4735
  if (this.env.refIds[i])
4700
4736
  return [
4701
4737
  new c(l.CIRCULAR_REF, "References with same endpoints exist", r),
@@ -4714,7 +4750,7 @@ class Ms {
4714
4750
  {
4715
4751
  schemaName: this.table.schemaName,
4716
4752
  tableName: this.table.name,
4717
- fieldNames: [K(t.callee).unwrap()],
4753
+ fieldNames: [q(t.callee).unwrap()],
4718
4754
  token: L(t),
4719
4755
  relation: a[0]
4720
4756
  }
@@ -4734,12 +4770,12 @@ class zl {
4734
4770
  ];
4735
4771
  }
4736
4772
  interpretName(t) {
4737
- const { name: n } = Ve(t);
4773
+ const { name: n } = Ce(t);
4738
4774
  return this.note.name = n, [];
4739
4775
  }
4740
4776
  interpretSettingList(t) {
4741
4777
  var s, r, i;
4742
- const n = B(t).getValue();
4778
+ const n = F(t).getValue();
4743
4779
  return this.note.headerColor = (s = n.headercolor) != null && s.length ? tt((i = (r = n.headercolor) == null ? void 0 : r.at(0)) == null ? void 0 : i.value) : void 0, [];
4744
4780
  }
4745
4781
  interpretBody(t) {
@@ -4755,7 +4791,7 @@ class zl {
4755
4791
  }
4756
4792
  class Fs {
4757
4793
  constructor(t, n) {
4758
- this.declarationNode = t, this.env = n, this.container = this.declarationNode.parent instanceof P ? this.env.tables.get(this.declarationNode.parent) : void 0, this.ref = {};
4794
+ this.declarationNode = t, this.env = n, this.container = this.declarationNode.parent instanceof S ? this.env.tables.get(this.declarationNode.parent) : void 0, this.ref = {};
4759
4795
  }
4760
4796
  interpret() {
4761
4797
  return this.ref.token = L(this.declarationNode), this.env.ref.set(this.declarationNode, this.ref), [
@@ -4775,27 +4811,27 @@ class Fs {
4775
4811
  const n = t.callee.op.value, { leftExpression: s, rightExpression: r } = t.callee, i = ht(s), a = ht(r);
4776
4812
  if (Zt(i, a))
4777
4813
  return [new c(l.SAME_ENDPOINT, "Two endpoints are the same", t)];
4778
- const o = Rs(i, a);
4814
+ const o = ks(i, a);
4779
4815
  if (this.env.refIds[o])
4780
4816
  return [
4781
4817
  new c(l.CIRCULAR_REF, "References with same endpoints exist", this.declarationNode),
4782
4818
  new c(l.CIRCULAR_REF, "References with same endpoints exist", this.env.refIds[o])
4783
4819
  ];
4784
4820
  if (t.args[0]) {
4785
- const v = B(t.args[0]).getValue(), H = (h = (p = v.delete) == null ? void 0 : p.at(0)) == null ? void 0 : h.value;
4786
- this.ref.onDelete = H instanceof ce ? $e(H).unwrap_or(void 0) : K(H).unwrap_or(void 0);
4787
- const z = (N = (d = v.update) == null ? void 0 : d.at(0)) == null ? void 0 : N.value;
4788
- this.ref.onUpdate = z instanceof ce ? $e(z).unwrap_or(void 0) : K(z).unwrap_or(void 0), this.ref.color = (b = v.color) != null && b.length ? tt((m = (A = v.color) == null ? void 0 : A.at(0)) == null ? void 0 : m.value) : void 0;
4821
+ const v = F(t.args[0]).getValue(), H = (h = (p = v.delete) == null ? void 0 : p.at(0)) == null ? void 0 : h.value;
4822
+ this.ref.onDelete = H instanceof ce ? $e(H).unwrap_or(void 0) : q(H).unwrap_or(void 0);
4823
+ const K = (N = (d = v.update) == null ? void 0 : d.at(0)) == null ? void 0 : N.value;
4824
+ this.ref.onUpdate = K instanceof ce ? $e(K).unwrap_or(void 0) : q(K).unwrap_or(void 0), this.ref.color = (b = v.color) != null && b.length ? tt((m = (A = v.color) == null ? void 0 : A.at(0)) == null ? void 0 : m.value) : void 0;
4789
4825
  }
4790
4826
  const u = Ds(n);
4791
4827
  return this.ref.endpoints = [
4792
4828
  {
4793
- ...Vn(s, this.container),
4829
+ ...Cn(s, this.container),
4794
4830
  relation: u[0],
4795
4831
  token: L(s)
4796
4832
  },
4797
4833
  {
4798
- ...Vn(r, this.container),
4834
+ ...Cn(r, this.container),
4799
4835
  relation: u[1],
4800
4836
  token: L(r)
4801
4837
  }
@@ -4815,7 +4851,7 @@ class Bs {
4815
4851
  ), t;
4816
4852
  }
4817
4853
  interpretName(t) {
4818
- const n = [], { name: s, schemaName: r } = Ve(t);
4854
+ const n = [], { name: s, schemaName: r } = Ce(t);
4819
4855
  return r.length >= 2 && (this.tableGroup.name = s, this.tableGroup.schemaName = r.join("."), n.push(new c(l.UNSUPPORTED, "Nested schema is not supported", this.declarationNode.name))), this.tableGroup.name = s, this.tableGroup.schemaName = r[0] || null, n;
4820
4856
  }
4821
4857
  interpretBody(t) {
@@ -4860,7 +4896,7 @@ class Bs {
4860
4896
  }
4861
4897
  interpretSettingList(t) {
4862
4898
  var r, i, a;
4863
- const n = B(t).getValue();
4899
+ const n = F(t).getValue();
4864
4900
  this.tableGroup.color = (r = n.color) != null && r.length ? tt((a = (i = n.color) == null ? void 0 : i.at(0)) == null ? void 0 : a.value) : void 0;
4865
4901
  const [s] = n.note || [];
4866
4902
  return this.tableGroup.note = s && {
@@ -4869,7 +4905,7 @@ class Bs {
4869
4905
  }, [];
4870
4906
  }
4871
4907
  }
4872
- class Vs {
4908
+ class Cs {
4873
4909
  constructor(t, n) {
4874
4910
  this.declarationNode = t, this.env = n, this.enum = { values: [] };
4875
4911
  }
@@ -4877,15 +4913,15 @@ class Vs {
4877
4913
  return this.enum.token = L(this.declarationNode), this.env.enums.set(this.declarationNode, this.enum), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
4878
4914
  }
4879
4915
  interpretName(t) {
4880
- const { name: n, schemaName: s } = Ve(t);
4916
+ const { name: n, schemaName: s } = Ce(t);
4881
4917
  return s.length > 1 ? (this.enum.name = n, this.enum.schemaName = s.join("."), [new c(l.UNSUPPORTED, "Nested schema is not supported", t)]) : (this.enum.name = n, this.enum.schemaName = s.length ? s[0] : null, []);
4882
4918
  }
4883
4919
  interpretBody(t) {
4884
4920
  return t.body.flatMap((n) => {
4885
4921
  var o;
4886
4922
  const s = n, r = {};
4887
- r.token = L(s), r.name = K(s.callee).unwrap();
4888
- const a = (o = B(s.args[0]).getValue().note) == null ? void 0 : o.at(0);
4923
+ r.token = L(s), r.name = q(s.callee).unwrap();
4924
+ const a = (o = F(s.args[0]).getValue().note) == null ? void 0 : o.at(0);
4889
4925
  return r.note = a && {
4890
4926
  value: C(a.value).map(fe).unwrap(),
4891
4927
  token: L(a)
@@ -4893,14 +4929,14 @@ class Vs {
4893
4929
  });
4894
4930
  }
4895
4931
  }
4896
- class Cs {
4932
+ class Vs {
4897
4933
  constructor(t, n) {
4898
4934
  this.declarationNode = t, this.env = n, this.tablePartial = {
4899
4935
  name: void 0,
4900
4936
  fields: [],
4901
4937
  token: void 0,
4902
4938
  indexes: [],
4903
- constraints: []
4939
+ checks: []
4904
4940
  }, this.pkColumns = [];
4905
4941
  }
4906
4942
  interpret() {
@@ -4924,11 +4960,11 @@ class Cs {
4924
4960
  })), t;
4925
4961
  }
4926
4962
  interpretName(t) {
4927
- const { name: n } = Ve(t);
4963
+ const { name: n } = Ce(t);
4928
4964
  return this.tablePartial.name = n, [];
4929
4965
  }
4930
4966
  interpretSettingList(t) {
4931
- const n = B(t).getValue(), s = Fo(n[E.HeaderColor]);
4967
+ const n = F(t).getValue(), s = Fo(n[E.HeaderColor]);
4932
4968
  this.tablePartial.headerColor = s ? tt(s.value) : void 0;
4933
4969
  const [r] = n[E.Note] || [];
4934
4970
  return this.tablePartial.note = r && {
@@ -4956,8 +4992,8 @@ class Cs {
4956
4992
  }, [];
4957
4993
  case _.Indexes:
4958
4994
  return this.interpretIndexes(n);
4959
- case _.Constraints:
4960
- return this.interpretConstraints(n);
4995
+ case _.Check:
4996
+ return this.interpretChecks(n);
4961
4997
  default:
4962
4998
  return [];
4963
4999
  }
@@ -4973,9 +5009,9 @@ class Cs {
4973
5009
  const r = Us(t.args[0]);
4974
5010
  s.type = r.getValue(), n.push(...r.getErrors()), s.token = L(t), s.inline_refs = [];
4975
5011
  const i = t.args.slice(1);
4976
- if (F(i) instanceof k) {
4977
- const m = B(i.pop()).getValue();
4978
- s.pk = !!((a = m[E.PK]) != null && a.length) || !!((o = m[E.PrimaryKey]) != null && o.length), s.increment = !!((u = m[E.Increment]) != null && u.length), s.unique = !!((p = m[E.Unique]) != null && p.length), s.not_null = (h = m[E.NotNull]) != null && h.length ? !0 : (d = m[E.Null]) != null && d.length ? !1 : void 0, s.dbdefault = ks((b = (N = m[E.Default]) == null ? void 0 : N.at(0)) == null ? void 0 : b.value);
5012
+ if (M(i) instanceof k) {
5013
+ const m = F(i.pop()).getValue();
5014
+ s.pk = !!((a = m[E.PK]) != null && a.length) || !!((o = m[E.PrimaryKey]) != null && o.length), s.increment = !!((u = m[E.Increment]) != null && u.length), s.unique = !!((p = m[E.Unique]) != null && p.length), s.not_null = (h = m[E.NotNull]) != null && h.length ? !0 : (d = m[E.Null]) != null && d.length ? !1 : void 0, s.dbdefault = Rs((b = (N = m[E.Default]) == null ? void 0 : N.at(0)) == null ? void 0 : b.value);
4979
5015
  const v = (A = m[E.Note]) == null ? void 0 : A.at(0);
4980
5016
  s.note = v && {
4981
5017
  value: C(v.value).map(fe).unwrap(),
@@ -4986,50 +5022,49 @@ class Cs {
4986
5022
  const [J] = ht(w.value.expression);
4987
5023
  if (Zt(J, t.symbol))
4988
5024
  return n.push(new c(l.SAME_ENDPOINT, "Two endpoints are the same", w)), [];
4989
- const G = w.value.op, D = Q(w.value.expression).unwrap();
5025
+ const V = w.value.op, G = Q(w.value.expression).unwrap();
4990
5026
  let le;
4991
- if (D.length === 2) {
4992
- const [ve, Z] = D;
5027
+ if (G.length === 2) {
5028
+ const [ve, Z] = G;
4993
5029
  le = {
4994
5030
  schemaName: null,
4995
5031
  tableName: ve,
4996
5032
  fieldNames: [Z],
4997
- relation: G.value,
5033
+ relation: V.value,
4998
5034
  token: L(w)
4999
5035
  };
5000
- } else if (D.length === 3) {
5001
- const [ve, Z, ye] = D;
5036
+ } else if (G.length === 3) {
5037
+ const [ve, Z, ye] = G;
5002
5038
  le = {
5003
5039
  schemaName: ve,
5004
5040
  tableName: Z,
5005
5041
  fieldNames: [ye],
5006
- relation: G.value,
5042
+ relation: V.value,
5007
5043
  token: L(w)
5008
5044
  };
5009
5045
  } else {
5010
5046
  n.push(new c(l.UNSUPPORTED, "Unsupported", w));
5011
- const ve = D.pop(), Z = D.pop();
5047
+ const ve = G.pop(), Z = G.pop();
5012
5048
  le = {
5013
- schemaName: D.join("."),
5049
+ schemaName: G.join("."),
5014
5050
  tableName: Z,
5015
5051
  fieldNames: [ve],
5016
- relation: G.value,
5052
+ relation: V.value,
5017
5053
  token: L(w)
5018
5054
  };
5019
5055
  }
5020
5056
  return le;
5021
5057
  });
5022
- const z = m[E.Constraint] || [];
5023
- s.constraints = z.map((w) => {
5024
- var D;
5025
- const J = L(w), G = (D = w.value.value) == null ? void 0 : D.value;
5058
+ const K = m[E.Check] || [];
5059
+ s.checks = K.map((w) => {
5060
+ const J = L(w), V = w.value.value.value;
5026
5061
  return {
5027
5062
  token: J,
5028
- expression: G
5063
+ expression: V
5029
5064
  };
5030
5065
  });
5031
5066
  }
5032
- return s.pk || (s.pk = i.some((m) => K(m).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = i.some((m) => K(m).unwrap().toLowerCase() === "unique")), this.tablePartial.fields.push(s), s.pk && this.pkColumns.push(s), n;
5067
+ return s.pk || (s.pk = i.some((m) => q(m).unwrap().toLowerCase() === "pk")), s.unique || (s.unique = i.some((m) => q(m).unwrap().toLowerCase() === "unique")), this.tablePartial.fields.push(s), s.pk && this.pkColumns.push(s), n;
5033
5068
  }
5034
5069
  interpretIndexes(t) {
5035
5070
  return this.tablePartial.indexes.push(...t.body.body.map((n) => {
@@ -5037,14 +5072,14 @@ class Cs {
5037
5072
  const s = { columns: [] }, r = n;
5038
5073
  s.token = L(r);
5039
5074
  const i = [r.callee, ...r.args];
5040
- if (F(i) instanceof k) {
5041
- const b = B(i.pop()).getValue();
5075
+ if (M(i) instanceof k) {
5076
+ const b = F(i.pop()).getValue();
5042
5077
  s.pk = !!((a = b[E.PK]) != null && a.length), s.unique = !!((o = b[E.Unique]) != null && o.length), s.name = C((p = (u = b[E.Name]) == null ? void 0 : u.at(0)) == null ? void 0 : p.value).unwrap_or(void 0);
5043
5078
  const A = (h = b[E.Note]) == null ? void 0 : h.at(0);
5044
5079
  s.note = A && {
5045
5080
  value: C(A.value).unwrap(),
5046
5081
  token: L(A)
5047
- }, s.type = K((N = (d = b[E.Type]) == null ? void 0 : d.at(0)) == null ? void 0 : N.value).unwrap_or(void 0);
5082
+ }, s.type = q((N = (d = b[E.Type]) == null ? void 0 : d.at(0)) == null ? void 0 : N.value).unwrap_or(void 0);
5048
5083
  }
5049
5084
  return i.flatMap((b) => {
5050
5085
  if (!(b instanceof ae)) return b;
@@ -5070,21 +5105,27 @@ class Cs {
5070
5105
  }), s;
5071
5106
  })), [];
5072
5107
  }
5073
- interpretConstraints(t) {
5074
- return this.tablePartial.constraints.push(...t.body.body.map((n) => {
5075
- var i, a, o;
5108
+ interpretChecks(t) {
5109
+ return this.tablePartial.checks.push(...t.body.body.map((n) => {
5110
+ var i, a;
5076
5111
  const s = {}, r = n;
5077
5112
  if (s.token = L(r), r.args[0] instanceof k) {
5078
- const u = B(r.args[0]).getValue();
5079
- s.name = C((a = (i = u[E.Name]) == null ? void 0 : i.at(0)) == null ? void 0 : a.value).unwrap_or(void 0);
5113
+ const o = F(r.args[0]).getValue();
5114
+ s.name = C((a = (i = o[E.Name]) == null ? void 0 : i.at(0)) == null ? void 0 : a.value).unwrap_or(void 0);
5080
5115
  }
5081
- return s.expression = (o = r.callee.value) == null ? void 0 : o.value, s;
5116
+ return s.expression = r.callee.value.value, s;
5082
5117
  })), [];
5083
5118
  }
5084
5119
  }
5085
5120
  class Yl {
5086
5121
  constructor(t, n) {
5087
- this.declarationNode = t, this.env = n, this.project = { enums: [], refs: [], tableGroups: [], tables: [], tablePartials: [] };
5122
+ this.declarationNode = t, this.env = n, this.project = {
5123
+ enums: [],
5124
+ refs: [],
5125
+ tableGroups: [],
5126
+ tables: [],
5127
+ tablePartials: []
5128
+ };
5088
5129
  }
5089
5130
  interpret() {
5090
5131
  return this.env.project.set(this.declarationNode, this.project), this.project.token = L(this.declarationNode), [...this.interpretName(this.declarationNode.name), ...this.interpretBody(this.declarationNode.body)];
@@ -5092,7 +5133,7 @@ class Yl {
5092
5133
  interpretName(t) {
5093
5134
  if (!t)
5094
5135
  return this.project.name = null, [];
5095
- const { name: n } = Ve(t);
5136
+ const { name: n } = Ce(t);
5096
5137
  return this.project.name = n, [];
5097
5138
  }
5098
5139
  interpretBody(t) {
@@ -5113,7 +5154,7 @@ class Yl {
5113
5154
  return this.project.tableGroups.push(this.env.tableGroups.get(s)), i;
5114
5155
  }
5115
5156
  case "enum": {
5116
- const i = new Vs(s, this.env).interpret();
5157
+ const i = new Cs(s, this.env).interpret();
5117
5158
  return this.project.enums.push(this.env.enums.get(s)), i;
5118
5159
  }
5119
5160
  case "note":
@@ -5122,7 +5163,7 @@ class Yl {
5122
5163
  token: L(s)
5123
5164
  }, [];
5124
5165
  case "tablepartial": {
5125
- const i = new Cs(s, this.env).interpret();
5166
+ const i = new Vs(s, this.env).interpret();
5126
5167
  return this.project.tablePartials.push(this.env.tablePartials.get(s)), i;
5127
5168
  }
5128
5169
  default:
@@ -5144,7 +5185,7 @@ function ql(e) {
5144
5185
  tablePartials: Array.from(e.tablePartials.values())
5145
5186
  };
5146
5187
  }
5147
- class Kl {
5188
+ class Ql {
5148
5189
  constructor(t) {
5149
5190
  this.ast = t, this.env = {
5150
5191
  schema: [],
@@ -5162,7 +5203,7 @@ class Kl {
5162
5203
  }
5163
5204
  interpret() {
5164
5205
  const t = this.ast.body.flatMap((n) => {
5165
- switch (Pe(n).unwrap_or(void 0)) {
5206
+ switch (Se(n).unwrap_or(void 0)) {
5166
5207
  case _.Table:
5167
5208
  return new Ms(n, this.env).interpret();
5168
5209
  case _.Note:
@@ -5172,9 +5213,9 @@ class Kl {
5172
5213
  case _.TableGroup:
5173
5214
  return new Bs(n, this.env).interpret();
5174
5215
  case _.TablePartial:
5175
- return new Cs(n, this.env).interpret();
5176
- case _.Enum:
5177
5216
  return new Vs(n, this.env).interpret();
5217
+ case _.Enum:
5218
+ return new Cs(n, this.env).interpret();
5178
5219
  case _.Project:
5179
5220
  return new Yl(n, this.env).interpret();
5180
5221
  default:
@@ -5184,25 +5225,25 @@ class Kl {
5184
5225
  return new se(ql(this.env), t);
5185
5226
  }
5186
5227
  }
5187
- var S = /* @__PURE__ */ ((e) => (e[e.Function = 1] = "Function", e[e.Constructor = 2] = "Constructor", e[e.Field = 3] = "Field", e[e.Variable = 4] = "Variable", e[e.Class = 5] = "Class", e[e.Struct = 6] = "Struct", e[e.Interface = 7] = "Interface", e[e.Module = 8] = "Module", e[e.Property = 9] = "Property", e[e.Event = 10] = "Event", e[e.Operator = 11] = "Operator", e[e.Unit = 12] = "Unit", e[e.Value = 13] = "Value", e[e.Constant = 14] = "Constant", e[e.Enum = 15] = "Enum", e[e.EnumMember = 16] = "EnumMember", e[e.Keyword = 17] = "Keyword", e[e.Text = 18] = "Text", e[e.Color = 19] = "Color", e[e.File = 20] = "File", e[e.Reference = 21] = "Reference", e[e.Customcolor = 22] = "Customcolor", e[e.Folder = 23] = "Folder", e[e.TypeParameter = 24] = "TypeParameter", e[e.User = 25] = "User", e[e.Issue = 26] = "Issue", e[e.Snippet = 27] = "Snippet", e))(S || {}), M = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.KeepWhitespace = 1] = "KeepWhitespace", e[e.InsertAsSnippet = 4] = "InsertAsSnippet", e))(M || {});
5228
+ var P = /* @__PURE__ */ ((e) => (e[e.Function = 1] = "Function", e[e.Constructor = 2] = "Constructor", e[e.Field = 3] = "Field", e[e.Variable = 4] = "Variable", e[e.Class = 5] = "Class", e[e.Struct = 6] = "Struct", e[e.Interface = 7] = "Interface", e[e.Module = 8] = "Module", e[e.Property = 9] = "Property", e[e.Event = 10] = "Event", e[e.Operator = 11] = "Operator", e[e.Unit = 12] = "Unit", e[e.Value = 13] = "Value", e[e.Constant = 14] = "Constant", e[e.Enum = 15] = "Enum", e[e.EnumMember = 16] = "EnumMember", e[e.Keyword = 17] = "Keyword", e[e.Text = 18] = "Text", e[e.Color = 19] = "Color", e[e.File = 20] = "File", e[e.Reference = 21] = "Reference", e[e.Customcolor = 22] = "Customcolor", e[e.Folder = 23] = "Folder", e[e.TypeParameter = 24] = "TypeParameter", e[e.User = 25] = "User", e[e.Issue = 26] = "Issue", e[e.Snippet = 27] = "Snippet", e))(P || {}), U = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.KeepWhitespace = 1] = "KeepWhitespace", e[e.InsertAsSnippet = 4] = "InsertAsSnippet", e))(U || {});
5188
5229
  function et(e) {
5189
5230
  switch (e) {
5190
5231
  case I.Schema:
5191
- return S.Module;
5232
+ return P.Module;
5192
5233
  case I.Table:
5193
5234
  case I.TablePartial:
5194
- return S.Class;
5235
+ return P.Class;
5195
5236
  case I.Column:
5196
5237
  case I.TableGroupField:
5197
- return S.Field;
5238
+ return P.Field;
5198
5239
  case I.Enum:
5199
- return S.Enum;
5240
+ return P.Enum;
5200
5241
  case I.EnumField:
5201
- return S.EnumMember;
5242
+ return P.EnumMember;
5202
5243
  case I.TableGroup:
5203
- return S.Struct;
5244
+ return P.Struct;
5204
5245
  default:
5205
- return S.Text;
5246
+ return P.Text;
5206
5247
  }
5207
5248
  }
5208
5249
  function ft(e, t) {
@@ -5253,14 +5294,14 @@ class Gs {
5253
5294
  ...(i == null ? void 0 : i.trailingTrivia) || [],
5254
5295
  ...(i == null ? void 0 : i.leadingTrivia) || [],
5255
5296
  ...(o == null ? void 0 : o.leadingTrivia) || []
5256
- ].find((N) => $o(N) && qe(s, N)))
5297
+ ].find((N) => $o(N) && Ye(s, N)))
5257
5298
  return $();
5258
5299
  if (a === void 0)
5259
5300
  return jn();
5260
- if ([f.STRING_LITERAL, f.QUOTED_STRING].includes(i.kind) && qe(s, i))
5301
+ if ([f.STRING_LITERAL, f.QUOTED_STRING].includes(i.kind) && Ye(s, i))
5261
5302
  return $();
5262
5303
  const u = this.compiler.container.element(s);
5263
- if (this.compiler.container.scopeKind(s) === R.TOPLEVEL || u instanceof P && u.type && u.type.start <= s && u.type.end >= s)
5304
+ if (this.compiler.container.scopeKind(s) === D.TOPLEVEL || u instanceof S && u.type && u.type.start <= s && u.type.end >= s)
5264
5305
  return jn();
5265
5306
  const p = [...this.compiler.container.stack(s)].reverse();
5266
5307
  for (const N of p)
@@ -5270,7 +5311,7 @@ class Gs {
5270
5311
  case "<":
5271
5312
  case "<>":
5272
5313
  case "-":
5273
- return Cn(
5314
+ return Vn(
5274
5315
  this.compiler,
5275
5316
  s,
5276
5317
  N
@@ -5282,7 +5323,7 @@ class Gs {
5282
5323
  case "<":
5283
5324
  case "<>":
5284
5325
  case "-":
5285
- return Cn(
5326
+ return Vn(
5286
5327
  this.compiler,
5287
5328
  s,
5288
5329
  N
@@ -5300,27 +5341,27 @@ class Gs {
5300
5341
  if (N instanceof k)
5301
5342
  return Gn(this.compiler, s, N);
5302
5343
  if (N instanceof be)
5344
+ return Zl(this.compiler, s);
5345
+ if (N instanceof ke)
5303
5346
  return Jl(this.compiler, s);
5304
- if (N instanceof Re)
5305
- return Ql(this.compiler, s);
5306
5347
  if (N instanceof y)
5307
5348
  return Xn(this.compiler, s, N);
5308
- if (N instanceof P && (N.bodyColon && s >= N.bodyColon.end || N.body && qe(s, N.body)))
5349
+ if (N instanceof S && (N.bodyColon && s >= N.bodyColon.end || N.body && Ye(s, N.body)))
5309
5350
  return Xn(this.compiler, s, void 0);
5310
5351
  }
5311
5352
  return $();
5312
5353
  }
5313
5354
  }
5314
- function Ql(e, t) {
5355
+ function Jl(e, t) {
5315
5356
  const n = e.container.element(t);
5316
5357
  return nt(e, t, n, [I.TablePartial]);
5317
5358
  }
5318
- function Cn(e, t, n) {
5359
+ function Vn(e, t, n) {
5319
5360
  const s = e.container.scopeKind(t);
5320
5361
  if ([
5321
- R.REF,
5322
- R.TABLE,
5323
- R.TABLEPARTIAL
5362
+ D.REF,
5363
+ D.TABLE,
5364
+ D.TABLEPARTIAL
5324
5365
  ].includes(s)) {
5325
5366
  const r = nt(e, t, e.container.element(t), [
5326
5367
  I.Table,
@@ -5344,23 +5385,23 @@ function nt(e, t, n, s) {
5344
5385
  ...e.symbol.members(o).filter(({ kind: u }) => s.includes(u)).map(({ name: u, kind: p }) => ({
5345
5386
  label: u,
5346
5387
  insertText: u,
5347
- insertTextRules: M.KeepWhitespace,
5388
+ insertTextRules: U.KeepWhitespace,
5348
5389
  kind: et(p),
5349
5390
  sortText: et(p).toString().padStart(2, "0"),
5350
5391
  range: void 0
5351
5392
  }))
5352
5393
  );
5353
5394
  }
5354
- r = r instanceof P ? r.parent : void 0;
5395
+ r = r instanceof S ? r.parent : void 0;
5355
5396
  }
5356
5397
  return vt(i);
5357
5398
  }
5358
- function Jl(e, t) {
5399
+ function Zl(e, t) {
5359
5400
  var s;
5360
5401
  switch (e.container.scopeKind(t)) {
5361
- case R.INDEXES:
5402
+ case D.INDEXES:
5362
5403
  return js(e, t);
5363
- case R.REF:
5404
+ case D.REF:
5364
5405
  {
5365
5406
  const r = [...e.container.stack(t)];
5366
5407
  for (; r.length > 0; ) {
@@ -5386,7 +5427,7 @@ function Gn(e, t, n) {
5386
5427
  if (n.name && n.name.start <= t && n.name.end >= t)
5387
5428
  return $n(e, t);
5388
5429
  if (n.name instanceof ce) {
5389
- const r = Zl(
5430
+ const r = ec(
5390
5431
  e,
5391
5432
  t,
5392
5433
  $e(n.name).unwrap_or("")
@@ -5399,14 +5440,14 @@ function $n(e, t) {
5399
5440
  const n = e.container.element(t);
5400
5441
  if (n instanceof ne) return $();
5401
5442
  const s = e.container.scopeKind(t);
5402
- if (n.body && !qe(t, n.body)) {
5443
+ if (n.body && !Ye(t, n.body)) {
5403
5444
  let r;
5404
5445
  switch (s) {
5405
- case R.TABLE:
5406
- case R.TABLEPARTIAL:
5446
+ case D.TABLE:
5447
+ case D.TABLEPARTIAL:
5407
5448
  r = [E.HeaderColor, E.Note];
5408
5449
  break;
5409
- case R.TABLEGROUP:
5450
+ case D.TABLEGROUP:
5410
5451
  r = [E.Color, E.Note];
5411
5452
  break;
5412
5453
  default:
@@ -5416,15 +5457,15 @@ function $n(e, t) {
5416
5457
  suggestions: r.map((i) => ({
5417
5458
  label: i,
5418
5459
  insertText: `${i}: `,
5419
- kind: S.Field,
5420
- insertTextRules: M.KeepWhitespace,
5460
+ kind: P.Field,
5461
+ insertTextRules: U.KeepWhitespace,
5421
5462
  range: void 0
5422
5463
  }))
5423
5464
  };
5424
5465
  }
5425
5466
  switch (s) {
5426
- case R.TABLE:
5427
- case R.TABLEPARTIAL:
5467
+ case D.TABLE:
5468
+ case D.TABLEPARTIAL:
5428
5469
  return {
5429
5470
  suggestions: [
5430
5471
  ...[
@@ -5437,51 +5478,51 @@ function $n(e, t) {
5437
5478
  ].map((r) => ({
5438
5479
  label: r,
5439
5480
  insertText: r,
5440
- kind: S.Property,
5441
- insertTextRules: M.KeepWhitespace,
5481
+ kind: P.Property,
5482
+ insertTextRules: U.KeepWhitespace,
5442
5483
  range: void 0
5443
5484
  })),
5444
- ...[E.Ref, E.Default, E.Note, E.Constraint].map((r) => ({
5485
+ ...[E.Ref, E.Default, E.Note, E.Check].map((r) => ({
5445
5486
  label: r,
5446
5487
  insertText: `${r}: `,
5447
- kind: S.Property,
5448
- insertTextRules: M.KeepWhitespace,
5488
+ kind: P.Property,
5489
+ insertTextRules: U.KeepWhitespace,
5449
5490
  range: void 0
5450
5491
  }))
5451
5492
  ]
5452
5493
  };
5453
- case R.ENUM:
5494
+ case D.ENUM:
5454
5495
  return {
5455
5496
  suggestions: [
5456
5497
  ...[E.Note].map((r) => ({
5457
5498
  label: r,
5458
5499
  insertText: `${r}: `,
5459
- kind: S.Property,
5460
- insertTextRules: M.KeepWhitespace,
5500
+ kind: P.Property,
5501
+ insertTextRules: U.KeepWhitespace,
5461
5502
  range: void 0
5462
5503
  }))
5463
5504
  ]
5464
5505
  };
5465
- case R.INDEXES:
5506
+ case D.INDEXES:
5466
5507
  return {
5467
5508
  suggestions: [
5468
5509
  ...[E.Unique, E.PK].map((r) => ({
5469
5510
  label: r,
5470
5511
  insertText: r,
5471
- insertTextRules: M.KeepWhitespace,
5472
- kind: S.Property,
5512
+ insertTextRules: U.KeepWhitespace,
5513
+ kind: P.Property,
5473
5514
  range: void 0
5474
5515
  })),
5475
5516
  ...[E.Note, E.Name, E.Type].map((r) => ({
5476
5517
  label: r,
5477
5518
  insertText: `${r}: `,
5478
- kind: S.Property,
5479
- insertTextRules: M.KeepWhitespace,
5519
+ kind: P.Property,
5520
+ insertTextRules: U.KeepWhitespace,
5480
5521
  range: void 0
5481
5522
  }))
5482
5523
  ]
5483
5524
  };
5484
- case R.REF:
5525
+ case D.REF:
5485
5526
  return {
5486
5527
  suggestions: [
5487
5528
  E.Update,
@@ -5490,27 +5531,27 @@ function $n(e, t) {
5490
5531
  ].map((r) => ({
5491
5532
  label: r,
5492
5533
  insertText: `${r}: `,
5493
- kind: S.Property,
5494
- insertTextRules: M.KeepWhitespace,
5534
+ kind: P.Property,
5535
+ insertTextRules: U.KeepWhitespace,
5495
5536
  range: void 0
5496
5537
  }))
5497
5538
  };
5498
- case R.CONSTRAINTS:
5539
+ case D.CHECKS:
5499
5540
  return {
5500
5541
  suggestions: [
5501
5542
  E.Name
5502
5543
  ].map((r) => ({
5503
5544
  label: r,
5504
5545
  insertText: `${r}: `,
5505
- kind: S.Property,
5506
- insertTextRules: M.KeepWhitespace,
5546
+ kind: P.Property,
5547
+ insertTextRules: U.KeepWhitespace,
5507
5548
  range: void 0
5508
5549
  }))
5509
5550
  };
5510
5551
  }
5511
5552
  return $();
5512
5553
  }
5513
- function Zl(e, t, n) {
5554
+ function ec(e, t, n) {
5514
5555
  switch (n == null ? void 0 : n.toLowerCase()) {
5515
5556
  case "update":
5516
5557
  case "delete":
@@ -5518,8 +5559,8 @@ function Zl(e, t, n) {
5518
5559
  suggestions: ["cascade", "set default", "set null", "restrict"].map((s) => ({
5519
5560
  label: s,
5520
5561
  insertText: s,
5521
- kind: S.Value,
5522
- insertTextRules: M.KeepWhitespace,
5562
+ kind: P.Value,
5563
+ insertTextRules: U.KeepWhitespace,
5523
5564
  range: void 0
5524
5565
  }))
5525
5566
  };
@@ -5528,8 +5569,8 @@ function Zl(e, t, n) {
5528
5569
  suggestions: ["btree", "hash"].map((s) => ({
5529
5570
  label: s,
5530
5571
  insertText: `${s}`,
5531
- kind: S.Value,
5532
- insertTextRules: M.KeepWhitespace,
5572
+ kind: P.Value,
5573
+ insertTextRules: U.KeepWhitespace,
5533
5574
  range: void 0
5534
5575
  }))
5535
5576
  };
@@ -5540,7 +5581,7 @@ function $s(e, t, n) {
5540
5581
  const s = Be(n).unwrap_or([]);
5541
5582
  if (s.pop(), s.some((i) => !W(i)))
5542
5583
  return $();
5543
- const r = s.map((i) => K(i).unwrap());
5584
+ const r = s.map((i) => q(i).unwrap());
5544
5585
  return vt({
5545
5586
  suggestions: e.symbol.ofName({ nameStack: r, owner: e.container.element(t) }).flatMap(({ symbol: i }) => e.symbol.members(i)).map(({ kind: i, name: a }) => ({
5546
5587
  label: a,
@@ -5553,21 +5594,21 @@ function $s(e, t, n) {
5553
5594
  function Xn(e, t, n) {
5554
5595
  var r;
5555
5596
  switch (e.container.scopeKind(t)) {
5556
- case R.TABLE:
5557
- case R.TABLEPARTIAL:
5558
- return tc(e, t, n);
5559
- case R.PROJECT:
5597
+ case D.TABLE:
5598
+ case D.TABLEPARTIAL:
5560
5599
  return nc(e, t, n);
5561
- case R.INDEXES:
5562
- return rc(e, t);
5563
- case R.ENUM:
5564
- return ec(e, t, n);
5565
- case R.REF: {
5600
+ case D.PROJECT:
5601
+ return sc(e, t, n);
5602
+ case D.INDEXES:
5603
+ return ic(e, t);
5604
+ case D.ENUM:
5605
+ return tc(e, t, n);
5606
+ case D.REF: {
5566
5607
  const i = Xs(e, t);
5567
5608
  return ((r = e.container.token(t).token) == null ? void 0 : r.kind) === f.COLON && ft(e.container.token(t).token, t) ? pt(i) : i;
5568
5609
  }
5569
- case R.TABLEGROUP:
5570
- return sc(e);
5610
+ case D.TABLEGROUP:
5611
+ return rc(e);
5571
5612
  default:
5572
5613
  return $();
5573
5614
  }
@@ -5577,28 +5618,28 @@ function jn() {
5577
5618
  suggestions: ["Table", "TableGroup", "Enum", "Project", "Ref", "TablePartial"].map((e) => ({
5578
5619
  label: e,
5579
5620
  insertText: e,
5580
- insertTextRules: M.KeepWhitespace,
5581
- kind: S.Keyword,
5621
+ insertTextRules: U.KeepWhitespace,
5622
+ kind: P.Keyword,
5582
5623
  range: void 0
5583
5624
  }))
5584
5625
  };
5585
5626
  }
5586
- function ec(e, t, n) {
5627
+ function tc(e, t, n) {
5587
5628
  return n != null && n.callee && tn(t, n) === 1 ? nt(e, t, e.container.element(t), [
5588
5629
  I.Schema,
5589
5630
  I.Table,
5590
5631
  I.Column
5591
5632
  ]) : $();
5592
5633
  }
5593
- function tc(e, t, n) {
5594
- const s = ["Note", "indexes", "constraints"];
5634
+ function nc(e, t, n) {
5635
+ const s = ["Note", "indexes", "checks"];
5595
5636
  if (!(n != null && n.callee))
5596
5637
  return {
5597
5638
  suggestions: s.map((i) => ({
5598
5639
  label: i,
5599
5640
  insertText: i,
5600
- insertTextRules: M.KeepWhitespace,
5601
- kind: S.Keyword,
5641
+ insertTextRules: U.KeepWhitespace,
5642
+ kind: P.Keyword,
5602
5643
  range: void 0
5603
5644
  }))
5604
5645
  };
@@ -5607,28 +5648,28 @@ function tc(e, t, n) {
5607
5648
  suggestions: s.map((i) => ({
5608
5649
  label: i,
5609
5650
  insertText: i,
5610
- insertTextRules: M.KeepWhitespace,
5611
- kind: S.Keyword,
5651
+ insertTextRules: U.KeepWhitespace,
5652
+ kind: P.Keyword,
5612
5653
  range: void 0
5613
5654
  }))
5614
- } : r === 1 ? ic(e, t) : $();
5655
+ } : r === 1 ? ac(e, t) : $();
5615
5656
  }
5616
- function nc(e, t, n) {
5657
+ function sc(e, t, n) {
5617
5658
  const s = ["Table", "TableGroup", "Enum", "Note", "Ref", "TablePartial"];
5618
5659
  return n != null && n.callee ? tn(t, n) === 0 ? {
5619
5660
  suggestions: s.map((i) => ({
5620
5661
  label: i,
5621
5662
  insertText: i,
5622
- insertTextRules: M.KeepWhitespace,
5623
- kind: S.Keyword,
5663
+ insertTextRules: U.KeepWhitespace,
5664
+ kind: P.Keyword,
5624
5665
  range: void 0
5625
5666
  }))
5626
5667
  } : $() : {
5627
5668
  suggestions: s.map((i) => ({
5628
5669
  label: i,
5629
5670
  insertText: i,
5630
- insertTextRules: M.KeepWhitespace,
5631
- kind: S.Keyword,
5671
+ insertTextRules: U.KeepWhitespace,
5672
+ kind: P.Keyword,
5632
5673
  range: void 0
5633
5674
  }))
5634
5675
  };
@@ -5640,7 +5681,7 @@ function Xs(e, t) {
5640
5681
  I.Column
5641
5682
  ]);
5642
5683
  }
5643
- function sc(e) {
5684
+ function rc(e) {
5644
5685
  return {
5645
5686
  suggestions: [
5646
5687
  ...vt({
@@ -5651,7 +5692,7 @@ function sc(e) {
5651
5692
  return s !== I.Table && s !== I.Schema ? [] : {
5652
5693
  label: r,
5653
5694
  insertText: r,
5654
- insertTextRules: M.KeepWhitespace,
5695
+ insertTextRules: U.KeepWhitespace,
5655
5696
  kind: et(s),
5656
5697
  range: void 0
5657
5698
  };
@@ -5660,17 +5701,17 @@ function sc(e) {
5660
5701
  ...["Note"].map((t) => ({
5661
5702
  label: t,
5662
5703
  insertText: t,
5663
- insertTextRules: M.KeepWhitespace,
5664
- kind: S.Keyword,
5704
+ insertTextRules: U.KeepWhitespace,
5705
+ kind: P.Keyword,
5665
5706
  range: void 0
5666
5707
  }))
5667
5708
  ]
5668
5709
  };
5669
5710
  }
5670
- function rc(e, t) {
5711
+ function ic(e, t) {
5671
5712
  return js(e, t);
5672
5713
  }
5673
- function ic(e, t) {
5714
+ function ac(e, t) {
5674
5715
  return {
5675
5716
  suggestions: [
5676
5717
  ...[
@@ -5733,9 +5774,9 @@ function ic(e, t) {
5733
5774
  ].map((n) => ({
5734
5775
  label: n,
5735
5776
  insertText: n,
5736
- insertTextRules: M.KeepWhitespace,
5737
- kind: S.TypeParameter,
5738
- sortText: S.TypeParameter.toString().padStart(2, "0"),
5777
+ insertTextRules: U.KeepWhitespace,
5778
+ kind: P.TypeParameter,
5779
+ sortText: P.TypeParameter.toString().padStart(2, "0"),
5739
5780
  range: void 0
5740
5781
  })),
5741
5782
  ...nt(e, t, e.container.element(t), [
@@ -5759,7 +5800,7 @@ function js(e, t) {
5759
5800
  return {
5760
5801
  label: o,
5761
5802
  insertText: o,
5762
- insertTextRules: M.KeepWhitespace,
5803
+ insertTextRules: U.KeepWhitespace,
5763
5804
  kind: et(I.Column),
5764
5805
  range: void 0
5765
5806
  };
@@ -5833,37 +5874,31 @@ class Hs {
5833
5874
  return [];
5834
5875
  }
5835
5876
  }
5836
- const oc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5877
+ const lc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5837
5878
  __proto__: null,
5838
- CompletionItemInsertTextRule: M,
5839
- CompletionItemKind: S,
5879
+ CompletionItemInsertTextRule: U,
5880
+ CompletionItemKind: P,
5840
5881
  DBMLCompletionItemProvider: Gs,
5841
5882
  DBMLDefinitionProvider: Ws,
5842
5883
  DBMLReferencesProvider: Hs
5843
5884
  }, Symbol.toStringTag, { value: "Module" }));
5844
- var R = /* @__PURE__ */ ((e) => (e[e.TABLE = 0] = "TABLE", e[e.ENUM = 1] = "ENUM", e[e.TABLEGROUP = 2] = "TABLEGROUP", e[e.INDEXES = 3] = "INDEXES", e[e.NOTE = 4] = "NOTE", e[e.REF = 5] = "REF", e[e.PROJECT = 6] = "PROJECT", e[e.CUSTOM = 7] = "CUSTOM", e[e.TOPLEVEL = 8] = "TOPLEVEL", e[e.TABLEPARTIAL = 9] = "TABLEPARTIAL", e[e.CONSTRAINTS = 10] = "CONSTRAINTS", e))(R || {});
5845
- class lc {
5885
+ var D = /* @__PURE__ */ ((e) => (e[e.TABLE = 0] = "TABLE", e[e.ENUM = 1] = "ENUM", e[e.TABLEGROUP = 2] = "TABLEGROUP", e[e.INDEXES = 3] = "INDEXES", e[e.NOTE = 4] = "NOTE", e[e.REF = 5] = "REF", e[e.PROJECT = 6] = "PROJECT", e[e.CUSTOM = 7] = "CUSTOM", e[e.TOPLEVEL = 8] = "TOPLEVEL", e[e.TABLEPARTIAL = 9] = "TABLEPARTIAL", e[e.CHECKS = 10] = "CHECKS", e))(D || {});
5886
+ class cc {
5846
5887
  constructor() {
5847
5888
  this.source = "", this.cache = new Array(
5848
5889
  16
5849
5890
  /* TOTAL_QUERY_COUNT */
5850
- ).fill(null), this.nodeIdGenerator = new Xo(), this.symbolIdGenerator = new Yo(), this.token = {
5851
- invalidStream: this.createQuery(
5852
- 6,
5853
- () => this.parse.tokens().filter(Ls)
5854
- ),
5891
+ ).fill(null), this.nodeIdGenerator = new Xo(), this.symbolIdGenerator = new zo(), this.token = {
5892
+ invalidStream: this.createQuery(6, () => this.parse.tokens().filter(Ls)),
5855
5893
  // Valid + Invalid tokens (which are guarenteed to be non-trivials) are included in the stream
5856
- flatStream: this.createQuery(
5857
- 7,
5858
- () => this.parse.tokens().flatMap((t) => [...t.leadingInvalid, t, ...t.trailingInvalid])
5859
- )
5894
+ flatStream: this.createQuery(7, () => this.parse.tokens().flatMap((t) => [...t.leadingInvalid, t, ...t.trailingInvalid]))
5860
5895
  }, this.parse = {
5861
5896
  source: () => this.source,
5862
5897
  _: this.createQuery(
5863
5898
  0,
5864
5899
  () => {
5865
- const t = new cl(this.source).lex().chain((n) => new fl(n, this.nodeIdGenerator).parse()).chain(({ ast: n, tokens: s }) => new Hl(n, this.symbolIdGenerator).analyze().map(() => ({ ast: n, tokens: s })));
5866
- return t.getErrors().length > 0 ? t : t.chain(({ ast: n, tokens: s }) => new Kl(n).interpret().map((i) => ({ ast: n, tokens: s, rawDb: i })));
5900
+ const t = new cl(this.source).lex().chain((n) => new fl(n, this.nodeIdGenerator).parse()).chain(({ ast: n, tokens: s }) => new Kl(n, this.symbolIdGenerator).analyze().map(() => ({ ast: n, tokens: s })));
5901
+ return t.getErrors().length > 0 ? t : t.chain(({ ast: n, tokens: s }) => new Ql(n).interpret().map((i) => ({ ast: n, tokens: s, rawDb: i })));
5867
5902
  }
5868
5903
  ),
5869
5904
  ast: this.createQuery(
@@ -5894,7 +5929,7 @@ class lc {
5894
5929
  let o = this.parse.ast();
5895
5930
  const u = [o];
5896
5931
  for (; ; ) {
5897
- const h = ll(o).find((d) => qe(a, d));
5932
+ const h = ll(o).find((d) => Ye(a, d));
5898
5933
  if (h === void 0 || h instanceof te)
5899
5934
  break;
5900
5935
  u.push(h), o = h;
@@ -5903,7 +5938,7 @@ class lc {
5903
5938
  return u;
5904
5939
  for (; u.length > 0; ) {
5905
5940
  let p = !1;
5906
- const h = F(u);
5941
+ const h = M(u);
5907
5942
  if (h instanceof y) {
5908
5943
  const d = this.parse.source();
5909
5944
  for (let N = h.end; N < t; N += 1)
@@ -5911,8 +5946,8 @@ class lc {
5911
5946
  ` && (u.pop(), p = !0);
5912
5947
  } else h instanceof re || h instanceof Te ? this.container.token(t).token !== h.op && (u.pop(), p = !0) : h instanceof k ? h.listCloseBracket && h.end <= t && (u.pop(), p = !0) : h instanceof be ? h.tupleCloseParen && h.end <= t && (u.pop(), p = !0) : h instanceof Ee ? h.blockCloseBrace && h.end <= t && (u.pop(), p = !0) : h instanceof ce || h.end < t && (u.pop(), p = !0);
5913
5948
  if (p) {
5914
- const d = F(u);
5915
- d instanceof P && d.end <= t && u.pop();
5949
+ const d = M(u);
5950
+ d instanceof S && d.end <= t && u.pop();
5916
5951
  }
5917
5952
  if (!p)
5918
5953
  break;
@@ -5935,7 +5970,7 @@ class lc {
5935
5970
  (t) => {
5936
5971
  const n = this.container.stack(t);
5937
5972
  for (let s = n.length - 1; s >= 0; s -= 1)
5938
- if (n[s] instanceof P)
5973
+ if (n[s] instanceof S)
5939
5974
  return n[s];
5940
5975
  return this.parse.ast();
5941
5976
  }
@@ -5968,7 +6003,7 @@ class lc {
5968
6003
  return 6;
5969
6004
  case "tablepartial":
5970
6005
  return 9;
5971
- case "constraints":
6006
+ case "checks":
5972
6007
  return 10;
5973
6008
  default:
5974
6009
  return 7;
@@ -5989,20 +6024,16 @@ class lc {
5989
6024
  if (t.length === 0)
5990
6025
  return [];
5991
6026
  const s = [];
5992
- for (let i = n; i; i = i instanceof P ? i.parent : void 0) {
6027
+ for (let i = n; i; i = i instanceof S ? i.parent : void 0) {
5993
6028
  if (!((r = i.symbol) != null && r.symbolTable))
5994
6029
  continue;
5995
6030
  const { symbolTable: a } = i.symbol;
5996
6031
  let o = [a], u = [];
5997
6032
  for (const p of t)
5998
- u = o.flatMap(
5999
- (h) => nl(p).flatMap((d) => {
6000
- const N = h.get(d), b = he(d).unwrap_or(void 0);
6001
- return !N || !b ? [] : { ...b, symbol: N };
6002
- })
6003
- ), o = u.flatMap(
6004
- (h) => h.symbol.symbolTable ? h.symbol.symbolTable : []
6005
- );
6033
+ u = o.flatMap((h) => nl(p).flatMap((d) => {
6034
+ const N = h.get(d), b = he(d).unwrap_or(void 0);
6035
+ return !N || !b ? [] : { ...b, symbol: N };
6036
+ })), o = u.flatMap((h) => h.symbol.symbolTable ? h.symbol.symbolTable : []);
6006
6037
  s.push(...u);
6007
6038
  }
6008
6039
  return s;
@@ -6048,15 +6079,15 @@ class lc {
6048
6079
  export {
6049
6080
  c as CompileError,
6050
6081
  l as CompileErrorCode,
6051
- lc as Compiler,
6052
- P as ElementDeclarationNode,
6082
+ cc as Compiler,
6083
+ S as ElementDeclarationNode,
6053
6084
  _ as ElementKind,
6054
6085
  ne as ProgramNode,
6055
- R as ScopeKind,
6056
- U as SyntaxNode,
6086
+ D as ScopeKind,
6087
+ R as SyntaxNode,
6057
6088
  Oe as SyntaxNodeKind,
6058
6089
  te as SyntaxToken,
6059
6090
  f as SyntaxTokenKind,
6060
- ac as serialize,
6061
- oc as services
6091
+ oc as serialize,
6092
+ lc as services
6062
6093
  };