@sheetxl/scripting 0.8.0-beta.6 → 0.8.0-beta.9

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.
@@ -38,7 +38,7 @@ var c = class {
38
38
  }
39
39
  terminate() {
40
40
  }
41
- }, s = `var yt = Object.defineProperty, Yt = (e, t, r) => () => {
41
+ }, s = `var yt = Object.defineProperty, qt = (e, t, r) => () => {
42
42
  if (r) throw r[0];
43
43
  try {
44
44
  return e && (t = e(e = 0)), t;
@@ -116,7 +116,7 @@ function rn(e) {
116
116
  })(e) && !en(e);
117
117
  }
118
118
  function Ne(e, t) {
119
- return t.clone !== !1 && t.isMergeableObject(e) ? Ee((r = e, Array.isArray(r) ? [] : {}), e, t) : e;
119
+ return t.clone !== !1 && t.isMergeableObject(e) ? ve((r = e, Array.isArray(r) ? [] : {}), e, t) : e;
120
120
  var r;
121
121
  }
122
122
  function nn(e, t, r) {
@@ -124,14 +124,14 @@ function nn(e, t, r) {
124
124
  return Ne(n, r);
125
125
  });
126
126
  }
127
- function St(e) {
127
+ function bt(e) {
128
128
  return Object.keys(e).concat((function(t) {
129
129
  return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(r) {
130
130
  return Object.propertyIsEnumerable.call(t, r);
131
131
  }) : [];
132
132
  })(e));
133
133
  }
134
- function bt(e, t) {
134
+ function St(e, t) {
135
135
  try {
136
136
  return t in e;
137
137
  } catch {
@@ -140,27 +140,27 @@ function bt(e, t) {
140
140
  }
141
141
  function on(e, t, r) {
142
142
  let n = {};
143
- return r.isMergeableObject(e) && St(e).forEach(function(o) {
143
+ return r.isMergeableObject(e) && bt(e).forEach(function(o) {
144
144
  n[o] = Ne(e[o], r);
145
- }), St(t).forEach(function(o) {
145
+ }), bt(t).forEach(function(o) {
146
146
  (function(a, l) {
147
- return bt(a, l) && !(Object.hasOwnProperty.call(a, l) && Object.propertyIsEnumerable.call(a, l));
148
- })(e, o) || (bt(e, o) && r.isMergeableObject(t[o]) ? n[o] = (function(a, l) {
149
- if (!l.customMerge) return Ee;
147
+ return St(a, l) && !(Object.hasOwnProperty.call(a, l) && Object.propertyIsEnumerable.call(a, l));
148
+ })(e, o) || (St(e, o) && r.isMergeableObject(t[o]) ? n[o] = (function(a, l) {
149
+ if (!l.customMerge) return ve;
150
150
  let i = l.customMerge(a);
151
- return typeof i == "function" ? i : Ee;
151
+ return typeof i == "function" ? i : ve;
152
152
  })(o, r)(e[o], t[o], r) : n[o] = Ne(t[o], r));
153
153
  }), n;
154
154
  }
155
- function Ee(e, t, r) {
155
+ function ve(e, t, r) {
156
156
  (r ||= {}).arrayMerge = r.arrayMerge || nn, r.isMergeableObject = r.isMergeableObject || rn, r.cloneUnlessOtherwiseSpecified = Ne;
157
157
  let n = Array.isArray(t);
158
158
  return n === Array.isArray(e) ? n ? r.arrayMerge(e, t, r) : on(e, t, r) : Ne(t, r);
159
159
  }
160
- Ee.all = function(e, t) {
160
+ ve.all = function(e, t) {
161
161
  if (!Array.isArray(e)) throw Error("first argument should be an array");
162
162
  return e.reduce(function(r, n) {
163
- return Ee(r, n, t);
163
+ return ve(r, n, t);
164
164
  }, {});
165
165
  };
166
166
  var Qt = he({
@@ -173,12 +173,12 @@ var Qt = he({
173
173
  camelToPrettyCase: () => cn,
174
174
  castToString: () => Cn,
175
175
  cloneObject: () => gn,
176
- consoleWithNoSource: () => Ln,
176
+ consoleWithNoSource: () => kn,
177
177
  deepEqual: () => Be,
178
178
  deepFreeze: () => sr,
179
- deepMerge: () => Ee,
180
- diffValues: () => En,
181
- findEqualOrGreater: () => vn,
179
+ deepMerge: () => ve,
180
+ diffValues: () => vn,
181
+ findEqualOrGreater: () => En,
182
182
  findEqualOrLesser: () => xn,
183
183
  getFromPath: () => _n,
184
184
  getPlatform: () => Xe,
@@ -188,22 +188,22 @@ var Qt = he({
188
188
  isEqualBounds: () => yn,
189
189
  isNullOrUndefined: () => ir,
190
190
  isNumeric: () => fn,
191
- isObject: () => ke,
191
+ isObject: () => Le,
192
192
  isPromiseLike: () => $n,
193
193
  isRectInsideRect: () => Rn,
194
194
  isRectIntersect: () => lr,
195
- mergeContentful: () => bn,
195
+ mergeContentful: () => Sn,
196
196
  removeEmptyProperties: () => rr,
197
197
  removeEqualValues: () => or,
198
198
  removeEqualValuesLayered: () => ar,
199
199
  removeListenerAll: () => wn,
200
200
  roundAccurately: () => mn,
201
- setToPath: () => kn,
201
+ setToPath: () => Ln,
202
202
  splitNumber: () => pn,
203
203
  subtractRect: () => Nn,
204
204
  textToKey: () => un,
205
205
  toSafeJSON: () => at,
206
- transpose: () => Sn,
206
+ transpose: () => bn,
207
207
  uuidV4: () => Ke,
208
208
  validEnumValue: () => sn
209
209
  }), _e = Object.freeze([]), an = Object.freeze({}), ln = Promise.resolve(), er = (e) => e;
@@ -239,7 +239,7 @@ function fn(e) {
239
239
  let t = 1 * e;
240
240
  return Number.isFinite(t) && typeof t == "number";
241
241
  }
242
- var We = [
242
+ var Je = [
243
243
  1,
244
244
  10,
245
245
  100,
@@ -262,11 +262,11 @@ function pn(e) {
262
262
  let t = Math.abs(e);
263
263
  if (!Number.isFinite(t)) return null;
264
264
  let r = Math.trunc(t), n = t - r, o;
265
- r > 2 ** 53 - 1 ? o = Number(r.toExponential().split("e")[1]) + 1 : (o = Math.ceil(Math.log10(r + 1)), We[o] <= r && o++);
265
+ r > 2 ** 53 - 1 ? o = Number(r.toExponential().split("e")[1]) + 1 : (o = Math.ceil(Math.log10(r + 1)), Je[o] <= r && o++);
266
266
  let a = 0, l = 0, i = 15 - o;
267
267
  if (n > 0 && i > 0) {
268
- let u = We[i];
269
- if (a = Math.round(n * u), a === u) r++, a = 0, r >= We[o] && o++;
268
+ let u = Je[i];
269
+ if (a = Math.round(n * u), a === u) r++, a = 0, r >= Je[o] && o++;
270
270
  else if (a > 0) for (l = i; a % 10 == 0;) a /= 10, l--;
271
271
  }
272
272
  return {
@@ -296,7 +296,7 @@ function tr(e, t, r) {
296
296
  function yn(e, t) {
297
297
  return e === t || !(!e || !t) && e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
298
298
  }
299
- function ke(e) {
299
+ function Le(e) {
300
300
  return typeof e == "object" && !Array.isArray(e) && e !== null;
301
301
  }
302
302
  function rr(e) {
@@ -315,7 +315,7 @@ function wn(e, t) {
315
315
  }
316
316
  return _e;
317
317
  }
318
- function Sn(e) {
318
+ function bn(e) {
319
319
  if (!e) return e;
320
320
  let t = e.length, r = e[0].length, n = [];
321
321
  for (let o = 0; o < r; o++) n[o] = Array(t);
@@ -358,14 +358,14 @@ function ar(e, t, r = nr) {
358
358
  }
359
359
  return l && Object.keys(e).length === 0;
360
360
  }
361
- function bn(...e) {
361
+ function Sn(...e) {
362
362
  let t = e.length;
363
- if (t > 0 && e[t - 1] !== void 0 && !ke(e[t - 1])) return e[t - 1];
363
+ if (t > 0 && e[t - 1] !== void 0 && !Le(e[t - 1])) return e[t - 1];
364
364
  let r = e[0] || {};
365
- for (let n = 1; n < t; n++) r = Ee(r, e[n] || {}, { arrayMerge: (o, a) => [...a] });
365
+ for (let n = 1; n < t; n++) r = ve(r, e[n] || {}, { arrayMerge: (o, a) => [...a] });
366
366
  return r;
367
367
  }
368
- function En(e, t) {
368
+ function vn(e, t) {
369
369
  let r = {}, n = Object.keys(t), o = n.length;
370
370
  for (let a = 0; a < o; a++) {
371
371
  let l = n[a], i = e[l], u = t[l];
@@ -373,7 +373,7 @@ function En(e, t) {
373
373
  }
374
374
  return Object.keys(r).length === 0 ? null : r;
375
375
  }
376
- function vn(e, t, r = er) {
376
+ function En(e, t, r = er) {
377
377
  let n = 0, o = e.length - 1;
378
378
  for (; n <= o;) {
379
379
  let a = Math.floor((n + o) / 2), l = r(e[a]);
@@ -460,24 +460,24 @@ function _n(e, t) {
460
460
  let l = r[a];
461
461
  if (!n) return null;
462
462
  let i = n[l];
463
- if (typeof i == "function" && (i = i.bind(n)()), !i || !ke(i)) return i;
463
+ if (typeof i == "function" && (i = i.bind(n)()), !i || !Le(i)) return i;
464
464
  n = i;
465
465
  }
466
466
  return n ?? null;
467
467
  }
468
- function kn(e, t, r) {
468
+ function Ln(e, t, r) {
469
469
  let n = t.split("."), o = e;
470
470
  if (!o) throw Error("Can not set path to a null path.");
471
471
  let a = n.length;
472
472
  for (let l = 0; o && l < a - 1; l++) {
473
473
  let i = n[l], u = o[i];
474
- if (u ?? (u = {}, o[i] = u), !ke(u)) throw Error("Can not set path to a non object path.");
474
+ if (u ?? (u = {}, o[i] = u), !Le(u)) throw Error("Can not set path to a non object path.");
475
475
  o = u;
476
476
  }
477
- if (typeof r != "number" && typeof r != "boolean" && typeof r != "string" && !ke(r)) throw Error(\`Can not set path to \${r} that is not a a supported primitive.\`);
477
+ if (typeof r != "number" && typeof r != "boolean" && typeof r != "string" && !Le(r)) throw Error(\`Can not set path to \${r} that is not a a supported primitive.\`);
478
478
  return o[n[a - 1]] = r, e;
479
479
  }
480
- function Ln(...e) {
480
+ function kn(...e) {
481
481
  return new Promise((t) => {
482
482
  setTimeout(() => {
483
483
  Function("console.log.apply(console, arguments)").apply(null, e), t();
@@ -518,28 +518,28 @@ he({
518
518
  EmptyCell: () => cr,
519
519
  EmptyRange: () => On,
520
520
  EmptyRanges: () => Mn,
521
- EmptySelection: () => Dn,
522
- InsertCutShift: () => be,
521
+ EmptySelection: () => Fn,
522
+ InsertCutShift: () => Se,
523
523
  cellToRange: () => jn,
524
- classifyInsertCut: () => Jn,
524
+ classifyInsertCut: () => Yn,
525
525
  columnFirstCellComparator: () => mr,
526
526
  columnFirstRangeComparator: () => ur,
527
- createCellComparator: () => Fn,
528
- createConflatingRanges: () => Wn,
527
+ createCellComparator: () => Dn,
528
+ createConflatingRanges: () => Jn,
529
529
  createRangeComparator: () => wr,
530
530
  defaultRange: () => Gn,
531
531
  extendRangeToIntersectingRanges: () => Tr,
532
532
  extendRangeToUnionRanges: () => zn,
533
- intersectRanges: () => vr,
534
- isCellWithinRange: () => Pn,
535
- isEqualCells: () => Sr,
533
+ intersectRanges: () => Er,
534
+ isCellWithinRange: () => Un,
535
+ isEqualCells: () => br,
536
536
  isEqualRanges: () => dt,
537
- isEqualRangesArrays: () => Er,
537
+ isEqualRangesArrays: () => vr,
538
538
  isEqualSelectionCoords: () => xr,
539
- isRangeWithinRange: () => br,
539
+ isRangeWithinRange: () => Sr,
540
540
  isRangesIntersect: () => ft,
541
- isRefusedInsertCut: () => Yn,
542
- isSingleCell: () => Un,
541
+ isRefusedInsertCut: () => qn,
542
+ isSingleCell: () => Pn,
543
543
  isValidRange: () => Kn,
544
544
  mergeRangeCoordValues: () => Ar,
545
545
  reverseColumnFirstCellComparator: () => yr,
@@ -562,7 +562,7 @@ var cr = Object.freeze({
562
562
  rowStart: 0,
563
563
  colEnd: 0,
564
564
  rowEnd: 0
565
- }), Mn = _e, Dn = Object.freeze({
565
+ }), Mn = _e, Fn = Object.freeze({
566
566
  cell: cr,
567
567
  ranges: _e,
568
568
  rangeIndex: -1
@@ -594,35 +594,35 @@ function yr(e, t) {
594
594
  function wr(e = ue.Row, t = !1) {
595
595
  return t ? e === ue.Column ? pr : fr : e === ue.Column ? ur : dr;
596
596
  }
597
- function Fn(e = ue.Row, t = !1) {
597
+ function Dn(e = ue.Row, t = !1) {
598
598
  return t ? e === ue.Column ? yr : hr : e === ue.Column ? mr : gr;
599
599
  }
600
- function Sr(e, t) {
600
+ function br(e, t) {
601
601
  return e === t || !(!e || !t) && e.rowIndex === t.rowIndex && e.colIndex === t.colIndex && e.scope === t.scope;
602
602
  }
603
603
  function dt(e, t) {
604
604
  return e === t || !(!e || !t) && e.rowStart === t.rowStart && e.rowEnd === t.rowEnd && e.colStart === t.colStart && e.colEnd === t.colEnd && e.scope === t.scope;
605
605
  }
606
- function Pn(e, t) {
606
+ function Un(e, t) {
607
607
  if (!e || !t) return !1;
608
608
  let r = e.rowIndex;
609
609
  if (r < t.rowStart || r > t.rowEnd) return !1;
610
610
  let n = e.colIndex;
611
611
  return !(n < t.colStart || n > t.colEnd);
612
612
  }
613
- function br(e, t) {
613
+ function Sr(e, t) {
614
614
  return !(!e || !t) && !(e.rowStart < t.rowStart || e.rowEnd > t.rowEnd) && !(e.colStart < t.colStart || e.colEnd > t.colEnd);
615
615
  }
616
616
  function ft(e, t) {
617
617
  return !(!e || !t) && !(e.colStart > t.colEnd || t.colStart > e.colEnd) && !(e.rowStart > t.rowEnd || t.rowStart > e.rowEnd);
618
618
  }
619
- function Er(e, t) {
619
+ function vr(e, t) {
620
620
  if (e === t) return !0;
621
621
  if (!e || !t || e.length !== t.length) return !1;
622
622
  for (let r = 0; r < e.length; r++) if (!dt(e[r], t[r])) return !1;
623
623
  return !0;
624
624
  }
625
- function Un(e) {
625
+ function Pn(e) {
626
626
  return !!e && e.rowEnd === e.rowStart && e.colStart === e.colEnd;
627
627
  }
628
628
  function jn(e, t) {
@@ -630,7 +630,7 @@ function jn(e, t) {
630
630
  let r = t;
631
631
  return r || (r = { ...e }, delete r.colIndex, delete r.rowIndex), r.colStart = e.colIndex ?? 0, r.rowStart = e.rowIndex ?? 0, r.colEnd = e.colIndex ?? 0, r.rowEnd = e.rowIndex ?? 0, r;
632
632
  }
633
- function vr(e, t, r) {
633
+ function Er(e, t, r) {
634
634
  if (!e) return r ? t : { ...t };
635
635
  if (!t) return r ? e : { ...e };
636
636
  if (!e && !t || e.rowStart > t.rowEnd || e.rowEnd < t.rowStart || e.colStart > t.colEnd || e.colEnd < t.colStart) return null;
@@ -655,7 +655,7 @@ function it(e, t, r) {
655
655
  }, i;
656
656
  }
657
657
  function xr(e, t) {
658
- return e === t || !(!e || !t) && e.rangeIndex === t.rangeIndex && !!Sr(e.cell, t.cell) && Er(e.ranges, t.ranges);
658
+ return e === t || !(!e || !t) && e.rangeIndex === t.rangeIndex && !!br(e.cell, t.cell) && vr(e.ranges, t.ranges);
659
659
  }
660
660
  function Bn(e, t, r) {
661
661
  if (!e || e.length === 0) return null;
@@ -718,7 +718,7 @@ function Gn(e, t, r) {
718
718
  rowEnd: e.rowEnd ?? t.rowEnd
719
719
  } : t;
720
720
  }
721
- var qn = [null, null], Hn = (e, t, r) => {
721
+ var Hn = [null, null], Wn = (e, t, r) => {
722
722
  if (e[0].value === e[1].value) return t;
723
723
  };
724
724
  function Ar(e, t = 2, r, n = ue.Row, o) {
@@ -728,32 +728,32 @@ function Ar(e, t = 2, r, n = ue.Row, o) {
728
728
  do {
729
729
  let p = a.sort(wr(l ? ue.Row : ue.Column));
730
730
  a = [], a.push(p[0]);
731
- let h = p.length, c = 0, g = p[0], T = g.colStart, I = g.rowStart, M = g.colEnd, q = g.rowEnd;
732
- for (let v = 1; v < h; v++) {
733
- let C = p[v], R = !1;
734
- if (R = l ? g && I === C.rowStart && q === C.rowEnd && M + 1 === C.colStart : g && T === C.colStart && M === C.colEnd && q + 1 === C.rowStart, R) {
735
- let U = {
731
+ let h = p.length, c = 0, g = p[0], T = g.colStart, I = g.rowStart, M = g.colEnd, H = g.rowEnd;
732
+ for (let E = 1; E < h; E++) {
733
+ let C = p[E], R = !1;
734
+ if (R = l ? g && I === C.rowStart && H === C.rowEnd && M + 1 === C.colStart : g && T === C.colStart && M === C.colEnd && H + 1 === C.rowStart, R) {
735
+ let P = {
736
736
  colStart: T,
737
737
  rowStart: I,
738
738
  colEnd: l ? C.colEnd : M,
739
- rowEnd: l ? q : C.rowEnd
739
+ rowEnd: l ? H : C.rowEnd
740
740
  };
741
- if (g.value !== void 0 && (U.value = g.value), r) {
741
+ if (g.value !== void 0 && (P.value = g.value), r) {
742
742
  let Z = o ?? [null, null];
743
- Z[0] = g, Z[1] = C, U = r(Z, U, n);
743
+ Z[0] = g, Z[1] = C, P = r(Z, P, n);
744
744
  }
745
- if (U) {
746
- a[c] = U, u = !0, g = U, T = g.colStart, I = g.rowStart, M = g.colEnd, q = g.rowEnd;
745
+ if (P) {
746
+ a[c] = P, u = !0, g = P, T = g.colStart, I = g.rowStart, M = g.colEnd, H = g.rowEnd;
747
747
  continue;
748
748
  }
749
749
  }
750
- a[++c] = C, g = C, T = g.colStart, I = g.rowStart, M = g.colEnd, q = g.rowEnd;
750
+ a[++c] = C, g = C, T = g.colStart, I = g.rowStart, M = g.colEnd, H = g.rowEnd;
751
751
  }
752
752
  i++, l = !l, i === 1 && (u = !0);
753
753
  } while (i < t && u && a.length > 1);
754
754
  return a;
755
755
  }
756
- function Wn(e, t = !1) {
756
+ function Jn(e, t = !1) {
757
757
  let r = [], n, o = null, a = -(2 ** 53 - 1), l = -(2 ** 53 - 1);
758
758
  return {
759
759
  append: (i, u, p) => {
@@ -772,28 +772,28 @@ function Wn(e, t = !1) {
772
772
  rowEnd: T
773
773
  }, c && (o.value = p), a = i, l = u, n = p;
774
774
  },
775
- done: (i) => (o &&= (r.push(o), null), i ? Ar(r, 3, i === !0 ? Hn : i, t ? ue.Column : ue.Row, qn) : r)
775
+ done: (i) => (o &&= (r.push(o), null), i ? Ar(r, 3, i === !0 ? Wn : i, t ? ue.Column : ue.Row, Hn) : r)
776
776
  };
777
777
  }
778
- var be = {
778
+ var Se = {
779
779
  Close: "close",
780
780
  Blank: "blank",
781
781
  Inside: "inside",
782
782
  Tear: "tear"
783
783
  };
784
- function Jn(e, t, r) {
784
+ function Yn(e, t, r) {
785
785
  let n = r === ue.Row;
786
- return (n ? e.colStart === t.colStart && e.colEnd === t.colEnd : e.rowStart === t.rowStart && e.rowEnd === t.rowEnd) ? (n ? t.rowStart > e.rowStart && t.rowStart <= e.rowEnd : t.colStart > e.colStart && t.colStart <= e.colEnd) ? be.Inside : be.Close : (n ? e.rowEnd >= t.rowStart && e.colStart <= t.colEnd && e.colEnd >= t.colStart : e.colEnd >= t.colStart && e.rowStart <= t.rowEnd && e.rowEnd >= t.rowStart) ? be.Tear : be.Blank;
786
+ return (n ? e.colStart === t.colStart && e.colEnd === t.colEnd : e.rowStart === t.rowStart && e.rowEnd === t.rowEnd) ? (n ? t.rowStart > e.rowStart && t.rowStart <= e.rowEnd : t.colStart > e.colStart && t.colStart <= e.colEnd) ? Se.Inside : Se.Close : (n ? e.rowEnd >= t.rowStart && e.colStart <= t.colEnd && e.colEnd >= t.colStart : e.colEnd >= t.colStart && e.rowStart <= t.rowEnd && e.rowEnd >= t.rowStart) ? Se.Tear : Se.Blank;
787
787
  }
788
- function Yn(e) {
789
- return e === be.Inside || e === be.Tear;
788
+ function qn(e) {
789
+ return e === Se.Inside || e === Se.Tear;
790
790
  }
791
- var Y = {
791
+ var q = {
792
792
  Up: "up",
793
793
  Down: "down",
794
794
  Left: "left",
795
795
  Right: "right"
796
- }, H = {
796
+ }, W = {
797
797
  Html: "text/html",
798
798
  Plain: "text/plain",
799
799
  Png: "image/png"
@@ -804,7 +804,7 @@ he({
804
804
  });
805
805
  function de(e, t, r, n) {
806
806
  if (!e) return t;
807
- let o = t, a = r === Y.Right || r === Y.Down;
807
+ let o = t, a = r === q.Right || r === q.Down;
808
808
  for (;;) {
809
809
  let l = e(o, !a);
810
810
  if (l === 0) return o;
@@ -813,7 +813,7 @@ function de(e, t, r, n) {
813
813
  o = i;
814
814
  }
815
815
  }
816
- function Ir(e, t = Y.Right, r, n, o, a = null) {
816
+ function Ir(e, t = q.Right, r, n, o, a = null) {
817
817
  if (a && xr(a, e)) return e;
818
818
  let l = e.ranges, i = e.rangeIndex, u = l[i];
819
819
  if (!ft({
@@ -824,16 +824,16 @@ function Ir(e, t = Y.Right, r, n, o, a = null) {
824
824
  }, u)) return e;
825
825
  let p = { ...e.cell }, h = i;
826
826
  switch (t) {
827
- case Y.Right:
827
+ case q.Right:
828
828
  p.colIndex = de(o, p.colIndex + 1, t, u.colEnd + 1);
829
829
  break;
830
- case Y.Left:
830
+ case q.Left:
831
831
  p.colIndex = de(o, p.colIndex - 1, t, u.colStart - 1);
832
832
  break;
833
- case Y.Down:
833
+ case q.Down:
834
834
  p.rowIndex = de(n, p.rowIndex + 1, t, u.rowEnd + 1);
835
835
  break;
836
- case Y.Up: p.rowIndex = de(n, p.rowIndex - 1, t, u.rowStart - 1);
836
+ case q.Up: p.rowIndex = de(n, p.rowIndex - 1, t, u.rowStart - 1);
837
837
  }
838
838
  let c = (I) => {
839
839
  if (I) {
@@ -852,23 +852,23 @@ function Ir(e, t = Y.Right, r, n, o, a = null) {
852
852
  };
853
853
  }
854
854
  };
855
- if (t === Y.Right && p.colIndex > u.colEnd && p.rowIndex === u.rowEnd) c(!0);
856
- else if (t === Y.Left && p.colIndex < u.colStart && p.rowIndex === u.rowStart) c(!1);
857
- else if (t === Y.Down && p.colIndex === u.colEnd && p.rowIndex > u.rowEnd) c(!0);
858
- else if (t === Y.Up && p.colIndex === u.colStart && p.rowIndex < u.rowStart) c(!1);
855
+ if (t === q.Right && p.colIndex > u.colEnd && p.rowIndex === u.rowEnd) c(!0);
856
+ else if (t === q.Left && p.colIndex < u.colStart && p.rowIndex === u.rowStart) c(!1);
857
+ else if (t === q.Down && p.colIndex === u.colEnd && p.rowIndex > u.rowEnd) c(!0);
858
+ else if (t === q.Up && p.colIndex === u.colStart && p.rowIndex < u.rowStart) c(!1);
859
859
  else {
860
860
  let I = p.rowIndex, M = p.colIndex;
861
861
  switch (t) {
862
- case Y.Right:
862
+ case q.Right:
863
863
  M > u.colEnd && (I = de(n, I + 1, t, u.rowEnd + 1), M = u.colStart, I > u.rowEnd && (I = u.rowStart));
864
864
  break;
865
- case Y.Left:
865
+ case q.Left:
866
866
  M < u.colStart && (I = de(n, I - 1, t, u.rowStart - 1), M = u.colEnd, I < u.rowStart && (I = u.rowEnd));
867
867
  break;
868
- case Y.Down:
868
+ case q.Down:
869
869
  I > u.rowEnd && (M = de(o, M + 1, t, u.colEnd + 1), I = u.rowStart, M > u.colEnd && (M = u.colStart));
870
870
  break;
871
- case Y.Up: I < u.rowStart && (M = de(o, M - 1, t, u.colStart - 1), I = u.rowEnd, M < u.colStart && (M = u.colEnd));
871
+ case q.Up: I < u.rowStart && (M = de(o, M - 1, t, u.colStart - 1), I = u.rowEnd, M < u.colStart && (M = u.colEnd));
872
872
  }
873
873
  p = {
874
874
  rowIndex: I,
@@ -876,28 +876,28 @@ function Ir(e, t = Y.Right, r, n, o, a = null) {
876
876
  };
877
877
  }
878
878
  let g = r(p);
879
- if (!br(g, u)) {
880
- let I = vr(g, u);
879
+ if (!Sr(g, u)) {
880
+ let I = Er(g, u);
881
881
  I && (g = I);
882
882
  }
883
883
  let T = {
884
- rowStart: de(n, g.rowStart, Y.Down, g.rowEnd),
885
- colStart: de(o, g.colStart, Y.Right, g.colEnd),
886
- rowEnd: de(n, g.rowEnd, Y.Up, g.rowStart),
887
- colEnd: de(o, g.colEnd, Y.Left, g.colStart)
884
+ rowStart: de(n, g.rowStart, q.Down, g.rowEnd),
885
+ colStart: de(o, g.colStart, q.Right, g.colEnd),
886
+ rowEnd: de(n, g.rowEnd, q.Up, g.rowStart),
887
+ colEnd: de(o, g.colEnd, q.Left, g.colStart)
888
888
  };
889
889
  if (T.rowStart !== p.rowIndex || T.colStart !== p.colIndex) {
890
890
  switch (t) {
891
- case Y.Right:
891
+ case q.Right:
892
892
  l[h].colStart === T.colStart && l[h].colEnd === T.colEnd && (p.rowIndex = T.rowEnd), p.colIndex = T.colEnd;
893
893
  break;
894
- case Y.Left:
894
+ case q.Left:
895
895
  l[h].colStart === T.colStart && l[h].colEnd === T.colEnd && (p.rowIndex = T.rowStart), p.rowIndex === T.rowStart ? p.colIndex = T.colStart + 1 : p.colIndex = T.colStart;
896
896
  break;
897
- case Y.Down:
897
+ case q.Down:
898
898
  l[h].rowStart === T.rowStart && l[h].rowEnd === T.rowEnd && (p.colIndex = T.colEnd), p.rowIndex = T.rowEnd;
899
899
  break;
900
- case Y.Up: l[h].rowStart === T.rowStart && l[h].rowEnd === T.rowEnd && (p.colIndex = T.colStart), p.colIndex === T.colStart ? p.rowIndex = T.rowStart + 1 : p.rowIndex = T.rowStart;
900
+ case q.Up: l[h].rowStart === T.rowStart && l[h].rowEnd === T.rowEnd && (p.colIndex = T.colStart), p.colIndex === T.colStart ? p.rowIndex = T.rowStart + 1 : p.rowIndex = T.rowStart;
901
901
  }
902
902
  return Ir({
903
903
  cell: p,
@@ -948,7 +948,7 @@ var Zn = class {
948
948
  }
949
949
  };
950
950
  new Zn();
951
- var Je;
951
+ var Ye;
952
952
  he({
953
953
  EmptyBounds: () => to,
954
954
  EmptyRect: () => eo,
@@ -999,16 +999,16 @@ var $r = !(typeof window > "u" || !window.document || !window.document.createEle
999
999
  return typeof window == "object" && (e = window.devicePixelRatio || 1), e;
1000
1000
  }, Rr = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), oo = (e, t, r = "auto") => {
1001
1001
  if ((() => {
1002
- if (Je === void 0) {
1002
+ if (Ye === void 0) {
1003
1003
  let u = !1;
1004
1004
  try {
1005
1005
  document.createElement("div").scrollIntoView({ get container() {
1006
1006
  return u = !0, "nearest";
1007
1007
  } });
1008
1008
  } catch {}
1009
- Je = u;
1009
+ Ye = u;
1010
1010
  }
1011
- return Je;
1011
+ return Ye;
1012
1012
  })()) return void t.scrollIntoView({
1013
1013
  block: "nearest",
1014
1014
  inline: "nearest",
@@ -1033,7 +1033,7 @@ he({
1033
1033
  requestTimeout: () => po,
1034
1034
  throttle: () => lo
1035
1035
  });
1036
- var Le = globalThis.requestAnimationFrame, io = globalThis.cancelAnimationFrame;
1036
+ var ke = globalThis.requestAnimationFrame, io = globalThis.cancelAnimationFrame;
1037
1037
  function lo(e, t) {
1038
1038
  let r = null;
1039
1039
  return (...n) => {
@@ -1064,10 +1064,10 @@ var co = (e) => {
1064
1064
  r = !1, e(t);
1065
1065
  };
1066
1066
  return function(o) {
1067
- t = o, t && t.persist && t.persist(), r || (r = !0, Le(n));
1067
+ t = o, t && t.persist && t.persist(), r || (r = !0, ke(n));
1068
1068
  };
1069
1069
  }, uo = (e) => {
1070
- if (typeof Le == "function") Le(() => {
1070
+ if (typeof ke == "function") ke(() => {
1071
1071
  e();
1072
1072
  });
1073
1073
  else {
@@ -1076,11 +1076,11 @@ var co = (e) => {
1076
1076
  e();
1077
1077
  });
1078
1078
  }
1079
- }, Et = typeof performance == "object" && typeof performance.now == "function" ? () => performance.now() : () => Date.now(), fo = (e) => {
1079
+ }, vt = typeof performance == "object" && typeof performance.now == "function" ? () => performance.now() : () => Date.now(), fo = (e) => {
1080
1080
  io(e.id);
1081
1081
  }, po = (e, t) => {
1082
- let r = Et(), n = { id: Le(function o() {
1083
- Et() - r >= t ? e.call(null) : n.id = Le(o);
1082
+ let r = vt(), n = { id: ke(function o() {
1083
+ vt() - r >= t ? e.call(null) : n.id = ke(o);
1084
1084
  }) };
1085
1085
  return n;
1086
1086
  };
@@ -1089,15 +1089,15 @@ var mo = (e) => \`Invalid argument: '\${e}'.\`;
1089
1089
  he({
1090
1090
  APP_MIME_TYPE: () => go,
1091
1091
  DEFAULT_MIME_TYPE: () => "*/*",
1092
- JSONStableStringify: () => bo,
1092
+ JSONStableStringify: () => So,
1093
1093
  arrayBufferToBase64: () => Nr,
1094
- base64ToArrayBuffer: () => So,
1094
+ base64ToArrayBuffer: () => bo,
1095
1095
  blobToString: () => lt,
1096
1096
  isLittleEndian: () => wo,
1097
1097
  isNodeBuffer: () => ho,
1098
1098
  isSharedArrayBufferSupported: () => yo
1099
1099
  });
1100
- var go = "application/octet-stream", Ae = globalThis.Buffer, ho = (e) => Ae?.isBuffer(e) ?? !1, yo = typeof SharedArrayBuffer == "function" && (globalThis.crossOriginIsolated === void 0 || globalThis.crossOriginIsolated === !0), wo = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1, vt = globalThis.FileReader, So = (e) => {
1100
+ var go = "application/octet-stream", Ae = globalThis.Buffer, ho = (e) => Ae?.isBuffer(e) ?? !1, yo = typeof SharedArrayBuffer == "function" && (globalThis.crossOriginIsolated === void 0 || globalThis.crossOriginIsolated === !0), wo = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1, Et = globalThis.FileReader, bo = (e) => {
1101
1101
  let t = typeof globalThis.atob == "function" ? globalThis.atob(e) : Ae.from(e, "base64").toString("binary"), r = t.length, n = new Uint8Array(r);
1102
1102
  for (let o = 0; o < r; o++) n[o] = t.charCodeAt(o);
1103
1103
  return n.buffer;
@@ -1108,8 +1108,8 @@ var go = "application/octet-stream", Ae = globalThis.Buffer, ho = (e) => Ae?.isB
1108
1108
  if (Ae) return Ae.from(n, "binary").toString("base64");
1109
1109
  throw Error("Unsupported environment");
1110
1110
  }, lt = (e) => new Promise((t, r) => {
1111
- if (e) if (vt) {
1112
- let n = new vt();
1111
+ if (e) if (Et) {
1112
+ let n = new Et();
1113
1113
  n.onload = () => {
1114
1114
  t(n.result);
1115
1115
  }, n.onerror = () => {
@@ -1125,7 +1125,7 @@ var go = "application/octet-stream", Ae = globalThis.Buffer, ho = (e) => Ae?.isB
1125
1125
  } else r(/* @__PURE__ */ Error("Unsupported environment"));
1126
1126
  else t("");
1127
1127
  });
1128
- function bo(e, t) {
1128
+ function So(e, t) {
1129
1129
  t ||= {}, typeof t == "function" && (t = { cmp: t });
1130
1130
  let r = typeof t.cycles == "boolean" && t.cycles, n = t.cmp && (o = t.cmp, function(l) {
1131
1131
  return function(i, u) {
@@ -1164,13 +1164,13 @@ function bo(e, t) {
1164
1164
  return a.splice(p, 1), "{" + u + "}";
1165
1165
  })(e);
1166
1166
  }
1167
- var Eo;
1167
+ var vo;
1168
1168
  he({
1169
1169
  DATA_URL_PNG_PREFIX: () => _r,
1170
- getImageDataUrl: () => vo,
1170
+ getImageDataUrl: () => Eo,
1171
1171
  loadImageDetails: () => xo
1172
1172
  });
1173
- var _r = "data:image/png;base64,", kr = "Unable to resolve image.", xt = (e) => new Promise(async (t, r) => {
1173
+ var _r = "data:image/png;base64,", Lr = "Unable to resolve image.", xt = (e) => new Promise(async (t, r) => {
1174
1174
  let n = null;
1175
1175
  try {
1176
1176
  let o = n = new Image();
@@ -1187,8 +1187,8 @@ var _r = "data:image/png;base64,", kr = "Unable to resolve image.", xt = (e) =>
1187
1187
  } catch {
1188
1188
  n?.src && URL.revokeObjectURL(n.src);
1189
1189
  }
1190
- n || r(Error(kr));
1191
- }), vo = (e, t = 1) => new Promise(async (r, n) => {
1190
+ n || r(Error(Lr));
1191
+ }), Eo = (e, t = 1) => new Promise(async (r, n) => {
1192
1192
  let o = null;
1193
1193
  try {
1194
1194
  let a = o = new Image();
@@ -1213,8 +1213,8 @@ var _r = "data:image/png;base64,", kr = "Unable to resolve image.", xt = (e) =>
1213
1213
  } catch {
1214
1214
  o?.src && URL.revokeObjectURL(o.src);
1215
1215
  }
1216
- o || n(Error(kr));
1217
- }), Ye = "image/svg+xml", xo = async (e, t = null) => {
1216
+ o || n(Error(Lr));
1217
+ }), qe = "image/svg+xml", xo = async (e, t = null) => {
1218
1218
  let r = null, n = async () => {
1219
1219
  try {
1220
1220
  let a = t ?? "image/*", l = URL.createObjectURL(new Blob([e], { type: a }));
@@ -1226,16 +1226,16 @@ var _r = "data:image/png;base64,", kr = "Unable to resolve image.", xt = (e) =>
1226
1226
  } catch {}
1227
1227
  }, o = async () => {
1228
1228
  try {
1229
- let a = new TextDecoder().decode(e), l = URL.createObjectURL(new Blob([a], { type: Ye })), i = await xt(l);
1229
+ let a = new TextDecoder().decode(e), l = URL.createObjectURL(new Blob([a], { type: qe })), i = await xt(l);
1230
1230
  r = {
1231
- mimeType: t ?? Ye,
1231
+ mimeType: t ?? qe,
1232
1232
  naturalSize: i,
1233
1233
  asUrl: l,
1234
1234
  asSVGText: a
1235
1235
  };
1236
1236
  } catch {}
1237
1237
  };
1238
- if (t === Ye ? await o() : t?.startsWith("image/") ? await n() : (await n(), r || await o()), !r) throw Error("Failed to load image");
1238
+ if (t === qe ? await o() : t?.startsWith("image/") ? await n() : (await n(), r || await o()), !r) throw Error("Failed to load image");
1239
1239
  return r;
1240
1240
  }, Tt = /* @__PURE__ */ new Set(), To = (e) => {
1241
1241
  Tt.has(e) || (Tt.add(e), console.warn(\`Unknown property '\${e}' in update; ignoring.\`));
@@ -1264,34 +1264,34 @@ var _r = "data:image/png;base64,", kr = "Unable to resolve image.", xt = (e) =>
1264
1264
  h = null;
1265
1265
  let g = c.length;
1266
1266
  for (let T = 0; T < g; T++) {
1267
- let I = c[T], M, q = i?.[I];
1268
- if (q !== void 0) {
1269
- let v = u[I];
1270
- if (!v) {
1267
+ let I = c[T], M, H = i?.[I];
1268
+ if (H !== void 0) {
1269
+ let E = u[I];
1270
+ if (!E) {
1271
1271
  To(I);
1272
1272
  continue;
1273
1273
  }
1274
- M = t(q, v, o, a?.[I], l);
1274
+ M = t(H, E, o, a?.[I], l);
1275
1275
  } else M = a?.[I];
1276
- M == null ? l && q === null && (h ??= {}, h[I] = null) : (h ??= {}, h[I] = M);
1276
+ M == null ? l && H === null && (h ??= {}, h[I] = null) : (h ??= {}, h[I] = M);
1277
1277
  }
1278
1278
  }
1279
1279
  return h;
1280
1280
  };
1281
- })(Eo ||= {});
1281
+ })(vo ||= {});
1282
1282
  var pt = {
1283
1283
  code: "safari",
1284
1284
  message: \`The Safari browser does not support advanced copy and paste.
1285
1285
  Copy and paste will be limited to within the browser tab.
1286
1286
 
1287
1287
  Please use Chrome or Edge if external copy and paste is required.\`
1288
- }, Lr = {
1288
+ }, kr = {
1289
1289
  code: "perms",
1290
1290
  message: \`You do not have permissions to access the clipboard.
1291
1291
  All copy and paste operations will be limited to the browser tab.\`
1292
- }, Ct = Xe() === fe.Safari ? pt : Lr, Co = {
1292
+ }, Ct = Xe() === fe.Safari ? pt : kr, Co = {
1293
1293
  Safari: pt,
1294
- Perms: Lr,
1294
+ Perms: kr,
1295
1295
  PermsWrite: Ct,
1296
1296
  PermsRead: Ct
1297
1297
  }, Ze = async () => new Promise((e) => {
@@ -1320,7 +1320,7 @@ All copy and paste operations will be limited to the browser tab.\`
1320
1320
  }, Or = async (e) => {
1321
1321
  if (!e) return null;
1322
1322
  try {
1323
- return await e.read({ unsanitized: [H.Html] });
1323
+ return await e.read({ unsanitized: [W.Html] });
1324
1324
  } catch {}
1325
1325
  return await e.read();
1326
1326
  }, Ao = async (e, t) => {
@@ -1353,7 +1353,7 @@ if (!globalThis.ClipboardItem) {
1353
1353
  }
1354
1354
  globalThis.ClipboardItem = t;
1355
1355
  }
1356
- var At, st = async (e, t = H.Html) => new Promise(async (r, n) => {
1356
+ var At, st = async (e, t = W.Html) => new Promise(async (r, n) => {
1357
1357
  try {
1358
1358
  let o = await Ao(e, t);
1359
1359
  if (o) {
@@ -1367,28 +1367,28 @@ var At, st = async (e, t = H.Html) => new Promise(async (r, n) => {
1367
1367
  } catch (o) {
1368
1368
  n(o);
1369
1369
  }
1370
- }), It = async (e, t = H.Html) => {
1370
+ }), It = async (e, t = W.Html) => {
1371
1371
  let r = await st(e, t);
1372
1372
  if (!r) return null;
1373
1373
  let n = null;
1374
1374
  try {
1375
- n = new DOMParser().parseFromString(r, H.Html);
1375
+ n = new DOMParser().parseFromString(r, W.Html);
1376
1376
  } catch {
1377
1377
  console.warn("Can't parse html from clipboard.");
1378
1378
  }
1379
1379
  return n;
1380
1380
  }, Io = async (e) => {
1381
1381
  e && await e.writeText("");
1382
- }, Oe = "clipboard-uuid", Re = "web text/uuid", $t = (e) => \`<div style="display:none" \${Oe}="\${e}"/>\`, Rt = { type: H.Plain }, Nt = { type: H.Html }, _t = { type: Re }, $o = (e, t) => {
1382
+ }, Oe = "clipboard-uuid", Re = "web text/uuid", $t = (e) => \`<div style="display:none" \${Oe}="\${e}"/>\`, Rt = { type: W.Plain }, Nt = { type: W.Html }, _t = { type: Re }, $o = (e, t) => {
1383
1383
  let r = null;
1384
1384
  try {
1385
- let n = new DOMParser().parseFromString(t, H.Html);
1385
+ let n = new DOMParser().parseFromString(t, W.Html);
1386
1386
  n.body.firstElementChild?.setAttribute(Oe, e), r = n.getElementsByTagName("body")[0].innerHTML;
1387
1387
  } catch (n) {
1388
1388
  console.warn("Can't embed uuid.", n);
1389
1389
  }
1390
1390
  return r;
1391
- }, kt = (e, t) => {
1391
+ }, Lt = (e, t) => {
1392
1392
  if (!t || !e) return !1;
1393
1393
  try {
1394
1394
  let r = t.querySelectorAll(\`[\${Oe}="\${e}"]\`);
@@ -1398,7 +1398,7 @@ var At, st = async (e, t = H.Html) => new Promise(async (r, n) => {
1398
1398
  } catch {
1399
1399
  return !1;
1400
1400
  }
1401
- }, Lt = class {
1401
+ }, kt = class {
1402
1402
  constructor(e) {
1403
1403
  if (this._state = null, this._nativeClipboard = null, this._onFocus = null, this._onBlur = null, e?.nativeClipboard === void 0 || e?.nativeClipboard === !0) try {
1404
1404
  this._nativeClipboard = globalThis?.navigator.clipboard;
@@ -1413,8 +1413,8 @@ var At, st = async (e, t = H.Html) => new Promise(async (r, n) => {
1413
1413
  await Ze();
1414
1414
  let e = await st(this._nativeClipboard, Re);
1415
1415
  if (!this._state || e && e === this._state.uuid) return !0;
1416
- let t = await It(this._nativeClipboard, H.Html);
1417
- return !this._state || (kt(this._state.uuid, t) || this.clear(), !0);
1416
+ let t = await It(this._nativeClipboard, W.Html);
1417
+ return !this._state || (Lt(this._state.uuid, t) || this.clear(), !0);
1418
1418
  }, async (e) => {
1419
1419
  e?.message === "denied" || e.message?.includes("Document is not focused") || Xe() === fe.Safari || console.warn("Unable to detect clipboard changes: ", e);
1420
1420
  });
@@ -1436,8 +1436,8 @@ var At, st = async (e, t = H.Html) => new Promise(async (r, n) => {
1436
1436
  if (await Ze(), this._state?.uuid) {
1437
1437
  let t = await st(this._nativeClipboard, Re);
1438
1438
  if (t && t === e._state?.uuid) return !0;
1439
- let r = await It(this._nativeClipboard, H.Html);
1440
- if (kt(e._state?.uuid, r)) return !0;
1439
+ let r = await It(this._nativeClipboard, W.Html);
1440
+ if (Lt(e._state?.uuid, r)) return !0;
1441
1441
  }
1442
1442
  return e._state = {
1443
1443
  items: await Or(this._nativeClipboard),
@@ -1465,18 +1465,18 @@ var At, st = async (e, t = H.Html) => new Promise(async (r, n) => {
1465
1465
  }, t.dispatchEvent(new Event("clipboardwrite")), t.dispatchEvent(new Event("clipboardchange"));
1466
1466
  };
1467
1467
  await Qe("clipboard-write", async () => {
1468
- await Ze(), n && o.length === 0 && (o.push(new ClipboardItem({ [Re]: new Blob([n], _t) })), o.push(new ClipboardItem({ [H.Html]: new Blob([$t(n)], Nt) })));
1468
+ await Ze(), n && o.length === 0 && (o.push(new ClipboardItem({ [Re]: new Blob([n], _t) })), o.push(new ClipboardItem({ [W.Html]: new Blob([$t(n)], Nt) })));
1469
1469
  for (let l = 0; l < Math.min(1, o.length); l++) {
1470
- let i = o[l], u = i.types.indexOf(H.Html), p = null;
1471
- if (u !== -1 && (p = await lt(await i.getType(H.Html)), p &&= $o(n, p)), !p && i.types.includes(H.Plain)) {
1472
- let I = await i.getType(H.Plain);
1470
+ let i = o[l], u = i.types.indexOf(W.Html), p = null;
1471
+ if (u !== -1 && (p = await lt(await i.getType(W.Html)), p &&= $o(n, p)), !p && i.types.includes(W.Plain)) {
1472
+ let I = await i.getType(W.Plain);
1473
1473
  if (I) {
1474
1474
  let M = null;
1475
1475
  typeof I == "string" ? (console.warn("text as string", I), M = I) : M = await lt(I), M && (p = \`<div \${Oe}="\${n}">\${M}</div>\`);
1476
1476
  }
1477
1477
  }
1478
- if (!p && i.types.includes(H.Png)) {
1479
- let I = Nr(await (await i.getType(H.Png)).arrayBuffer());
1478
+ if (!p && i.types.includes(W.Png)) {
1479
+ let I = Nr(await (await i.getType(W.Png)).arrayBuffer());
1480
1480
  p = \`<div \${Oe}="\${n}"><img src="\${_r + I}"/></div>\`;
1481
1481
  }
1482
1482
  !p && n && (p = $t(n));
@@ -1485,7 +1485,7 @@ var At, st = async (e, t = H.Html) => new Promise(async (r, n) => {
1485
1485
  let M = g[I];
1486
1486
  c[M] = I === u ? h : i.getType(M);
1487
1487
  }
1488
- p && u === -1 && (c[H.Html] = h), n && (c[Re] = new Blob([n], _t)), r.push(new ClipboardItem(c));
1488
+ p && u === -1 && (c[W.Html] = h), n && (c[Re] = new Blob([n], _t)), r.push(new ClipboardItem(c));
1489
1489
  }
1490
1490
  try {
1491
1491
  r && r.length !== 0 ? await this._nativeClipboard.write(r) : await Io(this._nativeClipboard);
@@ -1502,19 +1502,19 @@ var At, st = async (e, t = H.Html) => new Promise(async (r, n) => {
1502
1502
  let t = null, r = {};
1503
1503
  try {
1504
1504
  let o = await e.toText?.() ?? null;
1505
- o && (r[H.Plain] = new Blob([o ?? ""], Rt));
1505
+ o && (r[W.Plain] = new Blob([o ?? ""], Rt));
1506
1506
  } catch (o) {
1507
1507
  t = o;
1508
1508
  }
1509
1509
  try {
1510
1510
  let o = await e.toHtml?.() ?? null;
1511
- o && (r[H.Html] = new Blob([o], { type: H.Html }));
1511
+ o && (r[W.Html] = new Blob([o], { type: W.Html }));
1512
1512
  } catch (o) {
1513
1513
  t = o, console.warn("export to html", o);
1514
1514
  }
1515
1515
  try {
1516
1516
  let o = await e.toImage?.() ?? null;
1517
- o && (r[H.Png] = o);
1517
+ o && (r[W.Png] = o);
1518
1518
  } catch (o) {
1519
1519
  t = o, console.warn("export to png", o);
1520
1520
  }
@@ -1541,7 +1541,7 @@ var At, st = async (e, t = H.Html) => new Promise(async (r, n) => {
1541
1541
  let r = await this.read(), n = null, o = r ? r.length : 0;
1542
1542
  for (let l = 0; !n && l < o; l++) {
1543
1543
  let i = r[l];
1544
- i.types.includes(H.Plain) && (n = await i.getType(H.Plain));
1544
+ i.types.includes(W.Plain) && (n = await i.getType(W.Plain));
1545
1545
  }
1546
1546
  if (!n) return void e("");
1547
1547
  let a = new FileReader();
@@ -1553,7 +1553,7 @@ var At, st = async (e, t = H.Html) => new Promise(async (r, n) => {
1553
1553
  });
1554
1554
  }
1555
1555
  async writeText(e) {
1556
- let t = [new ClipboardItem({ [H.Plain]: new Blob([e], Rt) })];
1556
+ let t = [new ClipboardItem({ [W.Plain]: new Blob([e], Rt) })];
1557
1557
  return this._write({
1558
1558
  uuid: Ke(),
1559
1559
  items: t,
@@ -1586,13 +1586,13 @@ var At, st = async (e, t = H.Html) => new Promise(async (r, n) => {
1586
1586
  this._onFocus && globalThis.removeEventListener?.("focus", this._onFocus), this._onBlur && globalThis.removeEventListener?.("blur", this._onBlur);
1587
1587
  }
1588
1588
  };
1589
- (At = Lt ||= {}).ErrorMessages = Co, At.Global = new Lt();
1589
+ (At = kt ||= {}).ErrorMessages = Co, At.Global = new kt();
1590
1590
  var Mr = (e) => e === " " || e === " " || e === \`
1591
1591
  \` || e === "\\r";
1592
1592
  function Ot(e, t) {
1593
1593
  for (; t.i < e.length && Mr(e[t.i]);) t.i++;
1594
1594
  }
1595
- function Dr(e, t, r, n) {
1595
+ function Fr(e, t, r, n) {
1596
1596
  let o = [], a = "", l = () => {
1597
1597
  a &&= (o.push(a), "");
1598
1598
  };
@@ -1668,7 +1668,7 @@ function Ro(e, t, r, n) {
1668
1668
  if (g.startsWith("offset:")) h = parseInt(g.slice(7), 10) || 0;
1669
1669
  else {
1670
1670
  if (Ot(e, t), e[t.i] !== "{") break;
1671
- t.i++, p[g] = Dr(e, t, i !== "select" || r, n + 1), e[t.i] === "}" && t.i++;
1671
+ t.i++, p[g] = Fr(e, t, i !== "select" || r, n + 1), e[t.i] === "}" && t.i++;
1672
1672
  }
1673
1673
  }
1674
1674
  return {
@@ -1680,7 +1680,7 @@ function Ro(e, t, r, n) {
1680
1680
  };
1681
1681
  }
1682
1682
  var No = /* @__PURE__ */ new Map(), _o = /* @__PURE__ */ new Map(), Mt = /* @__PURE__ */ new Map();
1683
- function ko(e, t) {
1683
+ function Lo(e, t) {
1684
1684
  let r = t ? _o : No, n = r.get(e);
1685
1685
  if (!n) {
1686
1686
  try {
@@ -1692,7 +1692,7 @@ function ko(e, t) {
1692
1692
  }
1693
1693
  return n;
1694
1694
  }
1695
- function Lo(e) {
1695
+ function ko(e) {
1696
1696
  let t = Mt.get(e);
1697
1697
  if (!t) {
1698
1698
  try {
@@ -1717,7 +1717,7 @@ function ze(e, t, r, n) {
1717
1717
  continue;
1718
1718
  }
1719
1719
  if (a.kind === "hash") {
1720
- o += n === void 0 ? "#" : Lo(r).format(n);
1720
+ o += n === void 0 ? "#" : ko(r).format(n);
1721
1721
  continue;
1722
1722
  }
1723
1723
  let l = t?.[a.name];
@@ -1734,7 +1734,7 @@ function ze(e, t, r, n) {
1734
1734
  }
1735
1735
  let u = a.branches[\`=\${i}\`], p = i - a.offset;
1736
1736
  if (!u) {
1737
- let h = ko(r, a.type === "selectordinal").select(p);
1737
+ let h = Lo(r, a.type === "selectordinal").select(p);
1738
1738
  u = a.branches[h] ?? a.branches.other;
1739
1739
  }
1740
1740
  o += u ? ze(u, t, r, p) : String(l);
@@ -1742,7 +1742,93 @@ function ze(e, t, r, n) {
1742
1742
  return o;
1743
1743
  }
1744
1744
  new TextDecoder();
1745
- var Do;
1745
+ const w = Object.freeze({
1746
+ /** Exported function has no body. */
1747
+ NoBody: "SXL1001",
1748
+ /** Anonymous exported function is not allowed. */
1749
+ Anonymous: "SXL1002",
1750
+ /** Internal parse failure while analyzing the module. */
1751
+ ParseError: "SXL1003",
1752
+ /** Invalid parameter type. */
1753
+ InvalidParamType: "SXL2001",
1754
+ /** Invalid return type. */
1755
+ InvalidReturnType: "SXL2002",
1756
+ /** \`undefined\` / \`null\` / \`void\` is not valid as an input type. */
1757
+ UndefinedInput: "SXL2003",
1758
+ /** A type annotation is required but missing. */
1759
+ MissingType: "SXL2004",
1760
+ /** An \`Array\` must be typed (e.g. \`number[]\`, not bare \`[]\`). */
1761
+ UntypedArray: "SXL2005",
1762
+ /** A generic type must be supplied exactly one type argument. */
1763
+ GenericArity: "SXL2006",
1764
+ /** A return type cannot combine multiple modifiers (e.g. async + stream). */
1765
+ MultipleModifiers: "SXL2007",
1766
+ /** A context parameter must be the first parameter. */
1767
+ ContextNotFirst: "SXL2010",
1768
+ /** More than one \`Lambda\` parameter. */
1769
+ MultipleLambda: "SXL2020",
1770
+ /** A \`Lambda\` parameter must be the last parameter. */
1771
+ LambdaNotLast: "SXL2021",
1772
+ /** A \`Lambda\` parameter/return scalar type mismatch. */
1773
+ LambdaScalarMismatch: "SXL2022",
1774
+ /** \`Lambda\` is not valid as a return type. */
1775
+ LambdaReturn: "SXL2023",
1776
+ /** A bare function type is not valid as a return type. */
1777
+ FunctionReturn: "SXL2024",
1778
+ /** A \`Lambda\` function type has the wrong number of parameters. */
1779
+ LambdaArity: "SXL2025",
1780
+ /** Arrays of more than 2 dimensions are not supported. */
1781
+ ArrayDepth: "SXL2030",
1782
+ /** \`Repeating<T>\` used somewhere it cannot be (a return type, a rest parameter, nested in an array). */
1783
+ RepeatingPosition: "SXL2040",
1784
+ /** More than one \`Repeating<T>\` parameter. */
1785
+ MultipleRepeating: "SXL2041",
1786
+ /** A \`Repeating<T>\` group's slots are malformed (unlabelled tuple member, or a 1-element tuple). */
1787
+ RepeatingSlots: "SXL2042",
1788
+ /** An optional parameter/slot where a repeating group does not allow one. */
1789
+ RepeatingOptional: "SXL2043",
1790
+ /** \`Repeating<T, Max>\`'s maximum argument count is not a whole number in range. */
1791
+ RepeatingMax: "SXL2044",
1792
+ /** An enum mixes number and string members. */
1793
+ EnumMixed: "SXL2050",
1794
+ /** An enum member is not a constant number or string. */
1795
+ EnumMemberNotConstant: "SXL2051",
1796
+ /** A parameter type that is not declared in this module, so an enum behind it cannot be read. */
1797
+ EnumNotLocal: "SXL2052",
1798
+ /** An \`as const\` object used as a parameter type without its same-name type alias. */
1799
+ EnumMissingAlias: "SXL2053",
1800
+ /** An enum where no single argument is coerced to it (\`IRange<E>\`, \`Lazy<E>\`). */
1801
+ EnumPosition: "SXL2054",
1802
+ /** \`Omittable<E, V>\` whose \`V\` is neither a member of \`E\` nor \`null\`. */
1803
+ EnumOmittedValue: "SXL2055",
1804
+ /** No exported functions found in the module. */
1805
+ NoExports: "SXL3001",
1806
+ /** A \`@param\` tag references a parameter that does not exist. */
1807
+ UnknownParam: "SXL3002",
1808
+ /** A calculation function takes a built-in function's name. */
1809
+ BuiltInName: "SXL3003",
1810
+ /** A \`@returnKind\` tag names a value kind that does not exist, or names none at all. */
1811
+ UnknownReturnKind: "SXL3005",
1812
+ /** A calculation function's name (its \`@name\`, or else its own) is not a name a formula can call. */
1813
+ InvalidName: "SXL3006",
1814
+ /** Two functions in one module register under the same name (an \`@name\` repeats another's). */
1815
+ DuplicateName: "SXL3007",
1816
+ /** A function has no JSDoc description. */
1817
+ MissingSummary: "SXL9001",
1818
+ /** A \`@param\` is missing a description. */
1819
+ MissingParamDescription: "SXL9002",
1820
+ /**
1821
+ * Missing \`@returns\` on a non-void function.
1822
+ * @deprecated Retained for code stability but no longer emitted - Excel-style tooltips describe
1823
+ * behavior via the summary, so a standalone \`@returns\` warning is noise.
1824
+ */
1825
+ MissingReturns: "SXL9003",
1826
+ /** Two enum members share a value. */
1827
+ EnumDuplicateValue: "SXL9004",
1828
+ /** An enum member has no doc comment. */
1829
+ EnumMemberUndocumented: "SXL9005"
1830
+ });
1831
+ var Fo;
1746
1832
  (function(e) {
1747
1833
  e.MAX_TEXT_LENGTH = 32767;
1748
1834
  let t = e.MAX_SIGNIFICANT_DIGITS = 15;
@@ -1759,15 +1845,15 @@ var Do;
1759
1845
  }
1760
1846
  return a === null ? r : a.join("");
1761
1847
  };
1762
- })(Do ||= {});
1763
- var Pt, et, Fo, b, me = {
1848
+ })(Fo ||= {});
1849
+ var Ut, et, Do, S, me = {
1764
1850
  Number: "number",
1765
1851
  String: "string",
1766
1852
  Boolean: "boolean",
1767
1853
  Error: "error",
1768
1854
  RichData: "richData",
1769
1855
  Null: "null"
1770
- }, Ut = {
1856
+ }, Pt = {
1771
1857
  ...me,
1772
1858
  Date: "date"
1773
1859
  }, jt = {
@@ -1777,18 +1863,18 @@ var Pt, et, Fo, b, me = {
1777
1863
  Lambda: "lambda",
1778
1864
  Omitted: "omitted"
1779
1865
  };
1780
- (et = Pt ||= {}).Axis = {
1866
+ (et = Ut ||= {}).Axis = {
1781
1867
  Column: "column",
1782
1868
  Row: "row"
1783
1869
  }, et.AxisSelection = {
1784
- ...Pt.Axis,
1870
+ ...Ut.Axis,
1785
1871
  Both: "both"
1786
1872
  }, et.Direction = {
1787
1873
  Up: "up",
1788
1874
  Down: "down",
1789
1875
  Left: "left",
1790
1876
  Right: "right"
1791
- }, (Fo ||= {}).Aggregate = {
1877
+ }, (Do ||= {}).Aggregate = {
1792
1878
  Count: "count",
1793
1879
  NumericalCount: "numericalCount",
1794
1880
  Sum: "sum",
@@ -1840,11 +1926,11 @@ var Pt, et, Fo, b, me = {
1840
1926
  Timeout: "#TIMEOUT!"
1841
1927
  };
1842
1928
  class n extends Error {
1843
- constructor(N, k, pe, W) {
1844
- super(pe, W), this._label = k, this._code = N, this.details = W;
1929
+ constructor(N, L, pe, J) {
1930
+ super(pe, J), this._label = L, this._code = N, this.details = J;
1845
1931
  }
1846
1932
  static {
1847
- this.code = b.Code.Unknown;
1933
+ this.code = S.Code.Unknown;
1848
1934
  }
1849
1935
  get isFormulaError() {
1850
1936
  return !0;
@@ -1867,11 +1953,11 @@ var Pt, et, Fo, b, me = {
1867
1953
  }
1868
1954
  e.Known = n;
1869
1955
  class o extends n {
1870
- constructor(N, k) {
1871
- super(t.Parse, r.Parse, N, k);
1956
+ constructor(N, L) {
1957
+ super(t.Parse, r.Parse, N, L);
1872
1958
  }
1873
1959
  static {
1874
- this.code = b.Code.Parse;
1960
+ this.code = S.Code.Parse;
1875
1961
  }
1876
1962
  getDetails() {
1877
1963
  let N = this.details;
@@ -1885,195 +1971,195 @@ var Pt, et, Fo, b, me = {
1885
1971
  }
1886
1972
  e.Parse = o;
1887
1973
  class a extends n {
1888
- constructor(N, k) {
1889
- super(t.Null, r.Null, N, k);
1974
+ constructor(N, L) {
1975
+ super(t.Null, r.Null, N, L);
1890
1976
  }
1891
1977
  static {
1892
- this.code = b.Code.Null;
1978
+ this.code = S.Code.Null;
1893
1979
  }
1894
1980
  }
1895
1981
  e.Null = a;
1896
1982
  class l extends n {
1897
- constructor(N, k) {
1898
- super(t.Div0, r.Div0, N, k);
1983
+ constructor(N, L) {
1984
+ super(t.Div0, r.Div0, N, L);
1899
1985
  }
1900
1986
  static {
1901
- this.code = b.Code.Div0;
1987
+ this.code = S.Code.Div0;
1902
1988
  }
1903
1989
  }
1904
1990
  e.Div0 = l;
1905
1991
  class i extends n {
1906
- constructor(N, k) {
1907
- super(t.Value, r.Value, N, k);
1992
+ constructor(N, L) {
1993
+ super(t.Value, r.Value, N, L);
1908
1994
  }
1909
1995
  static {
1910
- this.code = b.Code.Value;
1996
+ this.code = S.Code.Value;
1911
1997
  }
1912
1998
  }
1913
1999
  e.Value = i;
1914
2000
  class u extends n {
1915
- constructor(N, k) {
1916
- super(t.Ref, r.Ref, N, k);
2001
+ constructor(N, L) {
2002
+ super(t.Ref, r.Ref, N, L);
1917
2003
  }
1918
2004
  static {
1919
- this.code = b.Code.Ref;
2005
+ this.code = S.Code.Ref;
1920
2006
  }
1921
2007
  }
1922
2008
  e.Ref = u;
1923
2009
  class p extends n {
1924
- constructor(N, k) {
1925
- super(t.Name, r.Name, N, k);
2010
+ constructor(N, L) {
2011
+ super(t.Name, r.Name, N, L);
1926
2012
  }
1927
2013
  static {
1928
- this.code = b.Code.Name;
2014
+ this.code = S.Code.Name;
1929
2015
  }
1930
2016
  }
1931
2017
  e.Name = p;
1932
2018
  class h extends n {
1933
- constructor(N, k) {
1934
- super(t.Num, r.Num, N, k);
2019
+ constructor(N, L) {
2020
+ super(t.Num, r.Num, N, L);
1935
2021
  }
1936
2022
  static {
1937
- this.code = b.Code.Num;
2023
+ this.code = S.Code.Num;
1938
2024
  }
1939
2025
  }
1940
2026
  e.Num = h;
1941
2027
  class c extends n {
1942
- constructor(N, k) {
1943
- super(t.NA, r.NA, N, k);
2028
+ constructor(N, L) {
2029
+ super(t.NA, r.NA, N, L);
1944
2030
  }
1945
2031
  static {
1946
- this.code = b.Code.NA;
2032
+ this.code = S.Code.NA;
1947
2033
  }
1948
2034
  }
1949
2035
  e.NA = c;
1950
2036
  class g extends n {
1951
- constructor(N, k) {
1952
- super(t.GettingData, r.GettingData, N, k);
2037
+ constructor(N, L) {
2038
+ super(t.GettingData, r.GettingData, N, L);
1953
2039
  }
1954
2040
  static {
1955
- this.code = b.Code.GettingData;
2041
+ this.code = S.Code.GettingData;
1956
2042
  }
1957
2043
  }
1958
2044
  e.GettingData = g;
1959
2045
  class T extends n {
1960
- constructor(N, k) {
1961
- super(t.Spill, r.Spill, N, k);
2046
+ constructor(N, L) {
2047
+ super(t.Spill, r.Spill, N, L);
1962
2048
  }
1963
2049
  static {
1964
- this.code = b.Code.Spill;
2050
+ this.code = S.Code.Spill;
1965
2051
  }
1966
2052
  }
1967
2053
  e.Spill = T;
1968
2054
  class I extends n {
1969
- constructor(N, k) {
1970
- super(t.Connect, r.Connect, N, k);
2055
+ constructor(N, L) {
2056
+ super(t.Connect, r.Connect, N, L);
1971
2057
  }
1972
2058
  static {
1973
- this.code = b.Code.Connect;
2059
+ this.code = S.Code.Connect;
1974
2060
  }
1975
2061
  }
1976
2062
  e.Connect = I;
1977
2063
  class M extends n {
1978
- constructor(N, k) {
1979
- super(t.Blocked, r.Blocked, N, k);
2064
+ constructor(N, L) {
2065
+ super(t.Blocked, r.Blocked, N, L);
1980
2066
  }
1981
2067
  static {
1982
- this.code = b.Code.Blocked;
2068
+ this.code = S.Code.Blocked;
1983
2069
  }
1984
2070
  }
1985
2071
  e.Blocked = M;
1986
- class q extends n {
1987
- constructor(N, k) {
1988
- super(t.Unknown, r.Unknown, N, k);
2072
+ class H extends n {
2073
+ constructor(N, L) {
2074
+ super(t.Unknown, r.Unknown, N, L);
1989
2075
  }
1990
2076
  static {
1991
- this.code = b.Code.Unknown;
2077
+ this.code = S.Code.Unknown;
1992
2078
  }
1993
2079
  }
1994
- e.Unknown = q;
1995
- class v extends n {
1996
- constructor(N, k) {
1997
- super(t.Field, r.Field, N, k);
2080
+ e.Unknown = H;
2081
+ class E extends n {
2082
+ constructor(N, L) {
2083
+ super(t.Field, r.Field, N, L);
1998
2084
  }
1999
2085
  static {
2000
- this.code = b.Code.Field;
2086
+ this.code = S.Code.Field;
2001
2087
  }
2002
2088
  }
2003
- e.Field = v;
2089
+ e.Field = E;
2004
2090
  class C extends n {
2005
- constructor(N, k) {
2006
- super(t.Calc, r.Calc, N, k);
2091
+ constructor(N, L) {
2092
+ super(t.Calc, r.Calc, N, L);
2007
2093
  }
2008
2094
  static {
2009
- this.code = b.Code.Calc;
2095
+ this.code = S.Code.Calc;
2010
2096
  }
2011
2097
  }
2012
2098
  e.Calc = C;
2013
2099
  class R extends n {
2014
- constructor(N, k) {
2015
- super(t.Busy, r.Busy, N, k);
2100
+ constructor(N, L) {
2101
+ super(t.Busy, r.Busy, N, L);
2016
2102
  }
2017
2103
  static {
2018
- this.code = b.Code.Busy;
2104
+ this.code = S.Code.Busy;
2019
2105
  }
2020
2106
  }
2021
2107
  e.Busy = R;
2022
- class U extends n {
2023
- constructor(N, k) {
2024
- super(t.Python, r.Python, N, k);
2108
+ class P extends n {
2109
+ constructor(N, L) {
2110
+ super(t.Python, r.Python, N, L);
2025
2111
  }
2026
2112
  static {
2027
- this.code = b.Code.Python;
2113
+ this.code = S.Code.Python;
2028
2114
  }
2029
2115
  }
2030
- e.Python = U;
2116
+ e.Python = P;
2031
2117
  class Z extends n {
2032
- constructor(N, k) {
2033
- super(t.Timeout, r.Timeout, N, k);
2118
+ constructor(N, L) {
2119
+ super(t.Timeout, r.Timeout, N, L);
2034
2120
  }
2035
2121
  static {
2036
- this.code = b.Code.Timeout;
2122
+ this.code = S.Code.Timeout;
2037
2123
  }
2038
2124
  }
2039
2125
  e.Timeout = Z;
2040
- })(b ||= {});
2126
+ })(S ||= {});
2041
2127
  var te = {};
2042
- te[b.Code.Parse] = b.Parse, te[b.Code.Null] = b.Null, te[b.Code.Div0] = b.Div0, te[b.Code.Value] = b.Value, te[b.Code.Ref] = b.Ref, te[b.Code.Name] = b.Name, te[b.Code.Num] = b.Num, te[b.Code.NA] = b.NA, te[b.Code.GettingData] = b.GettingData, te[b.Code.Spill] = b.Spill, te[b.Code.Connect] = b.Connect, te[b.Code.Blocked] = b.Blocked, te[b.Code.Unknown] = b.Unknown, te[b.Code.Field] = b.Field, te[b.Code.Calc] = b.Calc, te[b.Code.Busy] = b.Busy, te[b.Code.Python] = b.Python, te[b.Code.Timeout] = b.Timeout;
2043
- var Fr = /* @__PURE__ */ new Map(), Pr = /* @__PURE__ */ new Map(), Ur = /* @__PURE__ */ new Map(), jr = /* @__PURE__ */ new Map(), Bt = Object.keys(te);
2128
+ te[S.Code.Parse] = S.Parse, te[S.Code.Null] = S.Null, te[S.Code.Div0] = S.Div0, te[S.Code.Value] = S.Value, te[S.Code.Ref] = S.Ref, te[S.Code.Name] = S.Name, te[S.Code.Num] = S.Num, te[S.Code.NA] = S.NA, te[S.Code.GettingData] = S.GettingData, te[S.Code.Spill] = S.Spill, te[S.Code.Connect] = S.Connect, te[S.Code.Blocked] = S.Blocked, te[S.Code.Unknown] = S.Unknown, te[S.Code.Field] = S.Field, te[S.Code.Calc] = S.Calc, te[S.Code.Busy] = S.Busy, te[S.Code.Python] = S.Python, te[S.Code.Timeout] = S.Timeout;
2129
+ var Dr = /* @__PURE__ */ new Map(), Ur = /* @__PURE__ */ new Map(), Pr = /* @__PURE__ */ new Map(), jr = /* @__PURE__ */ new Map(), Bt = Object.keys(te);
2044
2130
  for (let e = 0; e < Bt.length; e++) {
2045
2131
  let t = te[Bt[e]], r = new t();
2046
- Ur.set(r.getLabel(), t), jr.set(r.getCode(), t), Fr.set(r.getLabel(), r), Pr.set(r.getCode(), r);
2132
+ Pr.set(r.getLabel(), t), jr.set(r.getCode(), t), Dr.set(r.getLabel(), r), Ur.set(r.getCode(), r);
2047
2133
  }
2048
2134
  (function(e) {
2049
- let t = e.getBuiltInByCode = (r) => Pr.get(r);
2135
+ let t = e.getBuiltInByCode = (r) => Ur.get(r);
2050
2136
  e.BuiltIn = {
2051
- Parse: t(b.Code.Parse),
2052
- Null: t(b.Code.Null),
2053
- Div0: t(b.Code.Div0),
2054
- Value: t(b.Code.Value),
2055
- Ref: t(b.Code.Ref),
2056
- Name: t(b.Code.Name),
2057
- Num: t(b.Code.Num),
2058
- NA: t(b.Code.NA),
2059
- GettingData: t(b.Code.GettingData),
2060
- Spill: t(b.Code.Spill),
2061
- Connect: t(b.Code.Connect),
2062
- Blocked: t(b.Code.Blocked),
2063
- Unknown: t(b.Code.Unknown),
2064
- Field: t(b.Code.Field),
2065
- Calc: t(b.Code.Calc),
2066
- Busy: t(b.Code.Busy),
2067
- Python: t(b.Code.Python),
2068
- Timeout: t(b.Code.Timeout)
2137
+ Parse: t(S.Code.Parse),
2138
+ Null: t(S.Code.Null),
2139
+ Div0: t(S.Code.Div0),
2140
+ Value: t(S.Code.Value),
2141
+ Ref: t(S.Code.Ref),
2142
+ Name: t(S.Code.Name),
2143
+ Num: t(S.Code.Num),
2144
+ NA: t(S.Code.NA),
2145
+ GettingData: t(S.Code.GettingData),
2146
+ Spill: t(S.Code.Spill),
2147
+ Connect: t(S.Code.Connect),
2148
+ Blocked: t(S.Code.Blocked),
2149
+ Unknown: t(S.Code.Unknown),
2150
+ Field: t(S.Code.Field),
2151
+ Calc: t(S.Code.Calc),
2152
+ Busy: t(S.Code.Busy),
2153
+ Python: t(S.Code.Python),
2154
+ Timeout: t(S.Code.Timeout)
2069
2155
  }, e.newTypedError = (r, n, o) => {
2070
2156
  let a;
2071
- return a = typeof r == "string" ? Ur.get(r) : jr.get(r), a ||= b.Unknown, new a(n, o);
2072
- }, e.getBuiltInByLabel = (r) => Fr.get(r), e.isError = function(r, n) {
2157
+ return a = typeof r == "string" ? Pr.get(r) : jr.get(r), a ||= S.Unknown, new a(n, o);
2158
+ }, e.getBuiltInByLabel = (r) => Dr.get(r), e.isError = function(r, n) {
2073
2159
  return !!r && r.isFormulaError === !0 && (n === void 0 || r.getCode() === n);
2074
2160
  };
2075
- })(b ||= {});
2076
- var Po = class {
2161
+ })(S ||= {});
2162
+ var Uo = class {
2077
2163
  createRange(e, t, r) {
2078
2164
  throw new oe();
2079
2165
  }
@@ -2165,7 +2251,7 @@ var Po = class {
2165
2251
  }
2166
2252
  parseAsLiteral(e) {
2167
2253
  let t = e.toUpperCase();
2168
- return t === "TRUE" || t !== "FALSE" && b.getBuiltInByLabel(t);
2254
+ return t === "TRUE" || t !== "FALSE" && S.getBuiltInByLabel(t);
2169
2255
  }
2170
2256
  toText(e) {
2171
2257
  return typeof e == "string" ? e : e == null ? "" : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : e?.isFormulaError ? e.getLabel() : String(e);
@@ -2176,7 +2262,7 @@ var Po = class {
2176
2262
  return n === o ? e < t ? -1 : +(e > t) : n < o ? -1 : 1;
2177
2263
  }
2178
2264
  getRuntime() {
2179
- return Uo;
2265
+ return Po;
2180
2266
  }
2181
2267
  getArgs() {
2182
2268
  throw new oe(Br);
@@ -2198,7 +2284,7 @@ var Po = class {
2198
2284
  rowStart: 0,
2199
2285
  colEnd: 2 ** 14 - 1,
2200
2286
  rowEnd: 2 ** 20 - 1
2201
- }), Uo = {
2287
+ }), Po = {
2202
2288
  isDate1904: () => !1,
2203
2289
  getLocale: () => zt.tag,
2204
2290
  getLocaleProfile: () => zt,
@@ -2210,12 +2296,12 @@ var Po = class {
2210
2296
  getOS: () => "unknown",
2211
2297
  getUser: () => "unidentified",
2212
2298
  getDescription: () => "Stubbed Formula Context"
2213
- }, jo = 2958465, Pe = new Po(), Bo = class {
2299
+ }, jo = 2958465, Ue = new Uo(), Bo = class {
2214
2300
  constructor() {
2215
- this._scope = Pe, this._argsFn = null;
2301
+ this._scope = Ue, this._argsFn = null;
2216
2302
  }
2217
2303
  _setScope(e) {
2218
- this._scope = e ?? Pe;
2304
+ this._scope = e ?? Ue;
2219
2305
  }
2220
2306
  _getScope() {
2221
2307
  return this._scope;
@@ -2243,7 +2329,7 @@ var Po = class {
2243
2329
  }
2244
2330
  parseAsLiteral(e) {
2245
2331
  let t = this._getScope();
2246
- return t.parseAsLiteral ? t.parseAsLiteral(e) : Pe.parseAsLiteral(e);
2332
+ return t.parseAsLiteral ? t.parseAsLiteral(e) : Ue.parseAsLiteral(e);
2247
2333
  }
2248
2334
  toText(e) {
2249
2335
  return this._getScope().toText(e);
@@ -2330,7 +2416,7 @@ var Po = class {
2330
2416
  return this._getScope().getAddress(e, t);
2331
2417
  }
2332
2418
  compare(e, t, r) {
2333
- return this._getScope().compare?.(e, t, r) ?? Pe.compare(e, t, r);
2419
+ return this._getScope().compare?.(e, t, r) ?? Ue.compare(e, t, r);
2334
2420
  }
2335
2421
  getRuntime() {
2336
2422
  return this._getScope().getRuntime();
@@ -2428,92 +2514,7 @@ var Po = class {
2428
2514
  })
2429
2515
  });
2430
2516
  new Bo();
2431
- const w = Object.freeze({
2432
- /** Exported function has no body. */
2433
- NoBody: "SXL1001",
2434
- /** Anonymous exported function is not allowed. */
2435
- Anonymous: "SXL1002",
2436
- /** Internal parse failure while analyzing the module. */
2437
- ParseError: "SXL1003",
2438
- /** Invalid parameter type. */
2439
- InvalidParamType: "SXL2001",
2440
- /** Invalid return type. */
2441
- InvalidReturnType: "SXL2002",
2442
- /** \`undefined\` / \`null\` / \`void\` is not valid as an input type. */
2443
- UndefinedInput: "SXL2003",
2444
- /** A type annotation is required but missing. */
2445
- MissingType: "SXL2004",
2446
- /** An \`Array\` must be typed (e.g. \`number[]\`, not bare \`[]\`). */
2447
- UntypedArray: "SXL2005",
2448
- /** A generic type must be supplied exactly one type argument. */
2449
- GenericArity: "SXL2006",
2450
- /** A return type cannot combine multiple modifiers (e.g. async + stream). */
2451
- MultipleModifiers: "SXL2007",
2452
- /** A context parameter must be the first parameter. */
2453
- ContextNotFirst: "SXL2010",
2454
- /** More than one \`Lambda\` parameter. */
2455
- MultipleLambda: "SXL2020",
2456
- /** A \`Lambda\` parameter must be the last parameter. */
2457
- LambdaNotLast: "SXL2021",
2458
- /** A \`Lambda\` parameter/return scalar type mismatch. */
2459
- LambdaScalarMismatch: "SXL2022",
2460
- /** \`Lambda\` is not valid as a return type. */
2461
- LambdaReturn: "SXL2023",
2462
- /** A bare function type is not valid as a return type. */
2463
- FunctionReturn: "SXL2024",
2464
- /** A \`Lambda\` function type has the wrong number of parameters. */
2465
- LambdaArity: "SXL2025",
2466
- /** Arrays of more than 2 dimensions are not supported. */
2467
- ArrayDepth: "SXL2030",
2468
- /** \`Repeating<T>\` used somewhere it cannot be (a return type, a rest parameter, nested in an array). */
2469
- RepeatingPosition: "SXL2040",
2470
- /** More than one \`Repeating<T>\` parameter. */
2471
- MultipleRepeating: "SXL2041",
2472
- /** A \`Repeating<T>\` group's slots are malformed (unlabelled tuple member, or a 1-element tuple). */
2473
- RepeatingSlots: "SXL2042",
2474
- /** An optional parameter/slot where a repeating group does not allow one. */
2475
- RepeatingOptional: "SXL2043",
2476
- /** \`Repeating<T, Max>\`'s maximum argument count is not a whole number in range. */
2477
- RepeatingMax: "SXL2044",
2478
- /** An enum mixes number and string members. */
2479
- EnumMixed: "SXL2050",
2480
- /** An enum member is not a constant number or string. */
2481
- EnumMemberNotConstant: "SXL2051",
2482
- /** A parameter type that is not declared in this module, so an enum behind it cannot be read. */
2483
- EnumNotLocal: "SXL2052",
2484
- /** An \`as const\` object used as a parameter type without its same-name type alias. */
2485
- EnumMissingAlias: "SXL2053",
2486
- /** An enum where no single argument is coerced to it (\`IRange<E>\`, \`Lazy<E>\`). */
2487
- EnumPosition: "SXL2054",
2488
- /** \`Omittable<E, V>\` whose \`V\` is neither a member of \`E\` nor \`null\`. */
2489
- EnumOmittedValue: "SXL2055",
2490
- /** No exported functions found in the module. */
2491
- NoExports: "SXL3001",
2492
- /** A \`@param\` tag references a parameter that does not exist. */
2493
- UnknownParam: "SXL3002",
2494
- /** A calculation function takes a built-in function's name. */
2495
- BuiltInName: "SXL3003",
2496
- /** A \`@returnKind\` tag names a value kind that does not exist, or names none at all. */
2497
- UnknownReturnKind: "SXL3005",
2498
- /** A calculation function's name (its \`@name\`, or else its own) is not a name a formula can call. */
2499
- InvalidName: "SXL3006",
2500
- /** Two functions in one module register under the same name (an \`@name\` repeats another's). */
2501
- DuplicateName: "SXL3007",
2502
- /** A function has no JSDoc description. */
2503
- MissingSummary: "SXL9001",
2504
- /** A \`@param\` is missing a description. */
2505
- MissingParamDescription: "SXL9002",
2506
- /**
2507
- * Missing \`@returns\` on a non-void function.
2508
- * @deprecated Retained for code stability but no longer emitted - Excel-style tooltips describe
2509
- * behavior via the summary, so a standalone \`@returns\` warning is noise.
2510
- */
2511
- MissingReturns: "SXL9003",
2512
- /** Two enum members share a value. */
2513
- EnumDuplicateValue: "SXL9004",
2514
- /** An enum member has no doc comment. */
2515
- EnumMemberUndocumented: "SXL9005"
2516
- }), Ko = [
2517
+ const Ko = [
2517
2518
  {
2518
2519
  name: "param",
2519
2520
  group: "jsdoc",
@@ -2594,21 +2595,21 @@ const ct = /* @__PURE__ */ new Map([["IReferenceRange", "p"], ["IRange", "r"]]),
2594
2595
  const n = t.get(r);
2595
2596
  t.set(\`\${e}.\${r}\`, n);
2596
2597
  });
2597
- }, qo = /* @__PURE__ */ new Map([
2598
+ }, Ho = /* @__PURE__ */ new Map([
2598
2599
  ["Scalar", "*"],
2599
2600
  ["Lambda", "l"],
2600
2601
  ["FormulaError.Known", me.Error],
2601
- ["Date", Ut.Date],
2602
- ["IRichData", Ut.RichData]
2603
- ]), zr = /* @__PURE__ */ new Map([["Repeating", "repeating"]]), Ho = /* @__PURE__ */ new Set(["Flatten", "SheetXL.Flatten"]), Vr = /* @__PURE__ */ new Set(["AcceptError"]), Xr = /* @__PURE__ */ new Set(["Omittable"]), Gr = /* @__PURE__ */ new Set(["NoLift"]), qr = /* @__PURE__ */ new Set(["NoFilter"]), Hr = /* @__PURE__ */ new Set(["Lazy"]), ut = /* @__PURE__ */ new Set(["ReportType"]), Vt = 255, Wo = /^[a-zA-Z_-￿][a-zA-Z0-9_.-￿]*$/, Jo = /^([a-z]{1,3})([0-9]+)$/i, Yo = /^r[0-9]*c[0-9]*$/i, Zo = (e) => {
2604
- if (Yo.test(e)) return !0;
2605
- const t = Jo.exec(e);
2602
+ ["Date", Pt.Date],
2603
+ ["IRichData", Pt.RichData]
2604
+ ]), zr = /* @__PURE__ */ new Map([["Repeating", "repeating"]]), Wo = /* @__PURE__ */ new Set(["Flatten", "SheetXL.Flatten"]), Vr = /* @__PURE__ */ new Set(["AcceptError"]), Xr = /* @__PURE__ */ new Set(["Omittable"]), Gr = /* @__PURE__ */ new Set(["NoLift"]), Hr = /* @__PURE__ */ new Set(["NoFilter"]), Wr = /* @__PURE__ */ new Set(["Lazy"]), ut = /* @__PURE__ */ new Set(["ReportType"]), Vt = 255, Jo = /^[a-zA-Z_-￿][a-zA-Z0-9_.-￿]*$/, Yo = /^([a-z]{1,3})([0-9]+)$/i, qo = /^r[0-9]*c[0-9]*$/i, Zo = (e) => {
2605
+ if (qo.test(e)) return !0;
2606
+ const t = Yo.exec(e);
2606
2607
  if (!t) return !1;
2607
2608
  let r = 0;
2608
2609
  for (const o of t[1].toUpperCase()) r = r * 26 + (o.charCodeAt(0) - 64);
2609
2610
  const n = Number(t[2]);
2610
2611
  return r <= 16384 && n >= 1 && n <= 1048576;
2611
- }, le = "SheetXL", ve = (e) => {
2612
+ }, le = "SheetXL", Ee = (e) => {
2612
2613
  const t = e.typeName.getText();
2613
2614
  return t.startsWith(\`\${le}.\`) ? t.slice(8) : t;
2614
2615
  };
@@ -2618,8 +2619,8 @@ gt(le, zr);
2618
2619
  Vr.add("SheetXL.AcceptError");
2619
2620
  Xr.add(\`\${le}.Omittable\`);
2620
2621
  Gr.add(\`\${le}.NoLift\`);
2621
- qr.add(\`\${le}.NoFilter\`);
2622
- Hr.add(\`\${le}.Lazy\`);
2622
+ Hr.add(\`\${le}.NoFilter\`);
2623
+ Wr.add(\`\${le}.Lazy\`);
2623
2624
  ut.add(\`\${le}.ReportType\`);
2624
2625
  const Qo = /* @__PURE__ */ new Map([
2625
2626
  ["Promise", () => ({ async: !0 })],
@@ -2630,7 +2631,7 @@ const Qo = /* @__PURE__ */ new Map([
2630
2631
  "IScript.ScriptContext",
2631
2632
  \`\${le}.IScript.ScriptContext\`,
2632
2633
  "ScriptContext"
2633
- ]), qt = (e, t) => {
2634
+ ]), Ht = (e, t) => {
2634
2635
  const r = t.literal;
2635
2636
  if (r === void 0) return;
2636
2637
  const n = e.SyntaxKind;
@@ -2687,34 +2688,34 @@ function ta(e, t, r, n) {
2687
2688
  };
2688
2689
  }
2689
2690
  }, h = (s, f, d, y) => {
2690
- const { start: E, length: L } = p(s);
2691
+ const { start: v, length: k } = p(s);
2691
2692
  i.push({
2692
- start: E,
2693
- length: L,
2693
+ start: v,
2694
+ length: k,
2694
2695
  severity: d,
2695
2696
  code: f,
2696
2697
  message: y
2697
2698
  });
2698
2699
  }, c = (s, f, d) => {
2699
2700
  h(s, f, "error", d);
2700
- }, g = (s) => s?.parent?.name?.escapedText, T = (s, f, d, y, E = !1, L = !1, j = !1) => {
2701
- const O = { count: 0 }, A = W(s, f, d, y, O, E, L, j);
2701
+ }, g = (s) => s?.parent?.name?.escapedText, T = (s, f, d, y, v = !1, k = !1, j = !1) => {
2702
+ const O = { count: 0 }, A = J(s, f, d, y, O, v, k, j);
2702
2703
  O.count >= 2 && (f.range || (f.range = "m", O.count -= 2), !y && O.count >= 1 && (O.count -= 1, O.count > 0 && c(s, w.ArrayDepth, \`Arrays of more than 2 dimensions are not supported: '\${g(s)}'.\`))), O.count > 0 && (f.arrayDepth = O.count);
2703
- const F = f.enum;
2704
- return F && (O.count > (j ? 1 : 0) || f.range) && !U.has(f) && (f.valueOrRange || (c(s, w.EnumPosition, \`A list cannot hold the enum '\${F.id}': '\${f.name ?? g(s)}'. Its members reach the body as they are, so nothing checks them against the enum. Take one value per argument ('...x: \${F.id}[]'), or type the list by its scalar ('\${F.type}').\`), delete f.enum)), A;
2705
- }, I = (s, f, d, y, E) => {
2704
+ const D = f.enum;
2705
+ return D && (O.count > (j ? 1 : 0) || f.range) && !P.has(f) && (f.valueOrRange || (c(s, w.EnumPosition, \`A list cannot hold the enum '\${D.id}': '\${f.name ?? g(s)}'. Its members reach the body as they are, so nothing checks them against the enum. Take one value per argument ('...x: \${D.id}[]'), or type the list by its scalar ('\${D.type}').\`), delete f.enum)), A;
2706
+ }, I = (s, f, d, y, v) => {
2706
2707
  if (f !== "Lambda" && f !== \`\${le}.Lambda\`) return !1;
2707
- const L = s.typeArguments;
2708
+ const k = s.typeArguments;
2708
2709
  let j = "*";
2709
- if (L && L.length === 2) if (E && L[0].kind === e.SyntaxKind.TupleType && (d.lambdaArity = L[0].elements.length), L[1].kind === e.SyntaxKind.AnyKeyword) j = "raw";
2710
+ if (k && k.length === 2) if (v && k[0].kind === e.SyntaxKind.TupleType && (d.lambdaArity = k[0].elements.length), k[1].kind === e.SyntaxKind.AnyKeyword) j = "raw";
2710
2711
  else {
2711
2712
  const O = {};
2712
- W(L[1], O, y, !1, { count: 0 }), j = O.scalar ?? "*";
2713
+ J(k[1], O, y, !1, { count: 0 }), j = O.scalar ?? "*";
2713
2714
  }
2714
- else if (L && L.length === 1 && L[0].kind !== e.SyntaxKind.TupleType && L[0].kind !== e.SyntaxKind.ArrayType) if (E && (d.lambdaArity = 2), L[0].kind === e.SyntaxKind.AnyKeyword) j = "raw";
2715
+ else if (k && k.length === 1 && k[0].kind !== e.SyntaxKind.TupleType && k[0].kind !== e.SyntaxKind.ArrayType) if (v && (d.lambdaArity = 2), k[0].kind === e.SyntaxKind.AnyKeyword) j = "raw";
2715
2716
  else {
2716
2717
  const O = {};
2717
- W(L[0], O, y, !1, { count: 0 }), j = O.scalar ?? "*";
2718
+ J(k[0], O, y, !1, { count: 0 }), j = O.scalar ?? "*";
2718
2719
  }
2719
2720
  return d.lambda = j, !0;
2720
2721
  }, M = (s, f, d, y) => {
@@ -2722,158 +2723,158 @@ function ta(e, t, r, n) {
2722
2723
  c(s, w.FunctionReturn, \`Function type is not a valid return type: '\${g(s)}'. Declare a 'Lambda' return instead.\`);
2723
2724
  return;
2724
2725
  }
2725
- const E = s.type, L = {};
2726
+ const v = s.type, k = {};
2726
2727
  let j = "*";
2727
- E && (E.kind === e.SyntaxKind.AnyKeyword ? j = "raw" : (W(E, L, d, !1, { count: 0 }), j = L.scalar ?? "*"));
2728
+ v && (v.kind === e.SyntaxKind.AnyKeyword ? j = "raw" : (J(v, k, d, !1, { count: 0 }), j = k.scalar ?? "*"));
2728
2729
  const O = s.parameters;
2729
2730
  O && !O.some((A) => A.dotDotDotToken) && (f.lambdaArity = O.length), f.lambda = j;
2730
- }, q = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Set(), U = /* @__PURE__ */ new WeakSet(), Z = (s) => s !== void 0 && s.getSourceFile() === t, P = (s, f = !1) => {
2731
+ }, H = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new WeakSet(), Z = (s) => s !== void 0 && s.getSourceFile() === t, U = (s, f = !1) => {
2731
2732
  return s.getJsDocTags(r).find((y) => y.name === "name")?.text?.map((y) => y.text).join("").trim() || (f ? Qt.camelToPrettyCase(s.name) : s.name);
2732
2733
  }, N = (s) => {
2733
2734
  const f = s.getJsDocTags(r).find((d) => d.name === "deprecated");
2734
2735
  if (f) return f.text?.map((d) => d.text).join("").trim() || !0;
2735
- }, k = (s, f) => {
2736
- const d = e.isTypeReferenceNode(s) ? s.typeName : void 0, y = d ? r.getSymbolAtLocation(d) : void 0, E = y?.declarations?.length ? y : void 0;
2736
+ }, L = (s, f) => {
2737
+ const d = e.isTypeReferenceNode(s) ? s.typeName : void 0, y = d ? r.getSymbolAtLocation(d) : void 0, v = y?.declarations?.length ? y : void 0;
2737
2738
  if (d) {
2738
- if (E && E.flags & e.SymbolFlags.Alias) {
2739
+ if (v && v.flags & e.SymbolFlags.Alias) {
2739
2740
  c(s, w.EnumNotLocal, \`'\${d.getText()}' is imported, so its declaration cannot be read: '\${f}'. An enum must be declared in the module that uses it.\`);
2740
2741
  return;
2741
2742
  }
2742
- if (!E || !(E.flags & e.SymbolFlags.Type)) {
2743
- const S = d.getText();
2744
- if (!(E ? (E.flags & e.SymbolFlags.Variable) !== 0 : t.statements.some((x) => e.isVariableStatement(x) && x.declarationList.declarations.some((K) => e.isIdentifier(K.name) && K.name.text === S)))) return null;
2745
- c(s, w.EnumMissingAlias, \`'\${S}' is a value, not a type: '\${f}'. Pair the object with a same-name type — 'type \${S} = typeof \${S}[keyof typeof \${S}];' — or declare it as 'enum \${S} { … }'.\`);
2743
+ if (!v || !(v.flags & e.SymbolFlags.Type)) {
2744
+ const b = d.getText();
2745
+ if (!(v ? (v.flags & e.SymbolFlags.Variable) !== 0 : t.statements.some((x) => e.isVariableStatement(x) && x.declarationList.declarations.some((K) => e.isIdentifier(K.name) && K.name.text === b)))) return null;
2746
+ c(s, w.EnumMissingAlias, \`'\${b}' is a value, not a type: '\${f}'. Pair the object with a same-name type — 'type \${b} = typeof \${b}[keyof typeof \${b}];' — or declare it as 'enum \${b} { … }'.\`);
2746
2747
  return;
2747
2748
  }
2748
- const m = q.get(E);
2749
+ const m = H.get(v);
2749
2750
  if (m !== void 0) return m;
2750
- if (R.has(E)) return;
2751
+ if (R.has(v)) return;
2751
2752
  }
2752
- const L = [];
2753
+ const k = [];
2753
2754
  let j = !1;
2754
- if (E && E.flags & e.SymbolFlags.Enum) {
2755
- if (!E.declarations?.some(Z)) {
2756
- c(s, w.EnumNotLocal, \`'\${E.name}' is not declared in this module: '\${f}'. An enum must be declared in the module that uses it.\`);
2755
+ if (v && v.flags & e.SymbolFlags.Enum) {
2756
+ if (!v.declarations?.some(Z)) {
2757
+ c(s, w.EnumNotLocal, \`'\${v.name}' is not declared in this module: '\${f}'. An enum must be declared in the module that uses it.\`);
2757
2758
  return;
2758
2759
  }
2759
2760
  j = !0;
2760
2761
  let m = !1;
2761
- if (E.exports?.forEach((S) => {
2762
- const x = S.valueDeclaration;
2762
+ if (v.exports?.forEach((b) => {
2763
+ const x = b.valueDeclaration;
2763
2764
  if (!x || !e.isEnumMember(x)) return;
2764
2765
  const K = r.getConstantValue(x);
2765
2766
  if (K === void 0) {
2766
- c(x, w.EnumMemberNotConstant, \`'\${E.name}.\${S.name}' is not a constant number or string. A formula passes the VALUE, so every member needs one that can be read at compile time.\`), m = !0;
2767
+ c(x, w.EnumMemberNotConstant, \`'\${v.name}.\${b.name}' is not a constant number or string. A formula passes the VALUE, so every member needs one that can be read at compile time.\`), m = !0;
2767
2768
  return;
2768
2769
  }
2769
- L.push([
2770
- P(S, !0),
2770
+ k.push([
2771
+ U(b, !0),
2771
2772
  K,
2772
2773
  x,
2773
- $e(S.getDocumentationComment(r)),
2774
- N(S)
2774
+ $e(b.getDocumentationComment(r)),
2775
+ N(b)
2775
2776
  ]);
2776
2777
  }), m) {
2777
- R.add(E);
2778
+ R.add(v);
2778
2779
  return;
2779
2780
  }
2780
2781
  } else {
2781
- const m = r.getTypeFromTypeNode(s), S = e.TypeFlags.Null | e.TypeFlags.Undefined | e.TypeFlags.Void, x = (m.isUnion() ? m.types : [m]).filter((D) => !(D.flags & S)), K = [];
2782
- for (const D of x) {
2783
- if (!(D.flags & (e.TypeFlags.NumberLiteral | e.TypeFlags.StringLiteral))) return E && q.set(E, null), null;
2784
- K.push(D.value);
2782
+ const m = r.getTypeFromTypeNode(s), b = e.TypeFlags.Null | e.TypeFlags.Undefined | e.TypeFlags.Void, x = (m.isUnion() ? m.types : [m]).filter((F) => !(F.flags & b)), K = [];
2783
+ for (const F of x) {
2784
+ if (!(F.flags & (e.TypeFlags.NumberLiteral | e.TypeFlags.StringLiteral))) return v && H.set(v, null), null;
2785
+ K.push(F.value);
2785
2786
  }
2786
2787
  if (K.length === 0) return null;
2787
- const re = E?.declarations?.find((D) => e.isTypeAliasDeclaration(D)), J = e.isUnionTypeNode(s) ? s : re?.type;
2788
- if (J && e.isUnionTypeNode(J)) {
2789
- const D = J.types.map(($) => {
2788
+ const re = v?.declarations?.find((F) => e.isTypeAliasDeclaration(F)), Y = e.isUnionTypeNode(s) ? s : re?.type;
2789
+ if (Y && e.isUnionTypeNode(Y)) {
2790
+ const F = Y.types.map(($) => {
2790
2791
  const ne = r.getTypeFromTypeNode($);
2791
2792
  return ne.isLiteral() ? ne.value : void 0;
2792
2793
  }), _ = ($) => {
2793
- const ne = D.indexOf($);
2794
- return ne < 0 ? D.length : ne;
2794
+ const ne = F.indexOf($);
2795
+ return ne < 0 ? F.length : ne;
2795
2796
  };
2796
2797
  K.sort(($, ne) => _($) - _(ne));
2797
2798
  }
2798
- const ee = E && E.flags & e.SymbolFlags.Variable ? E.valueDeclaration : void 0, ge = new Set(K);
2799
- if (E && ee && Z(ee)) for (const D of r.getTypeOfSymbolAtLocation(E, ee).getProperties()) {
2800
- const _ = D.valueDeclaration, $ = r.getTypeOfSymbolAtLocation(D, _ ?? ee);
2799
+ const ee = v && v.flags & e.SymbolFlags.Variable ? v.valueDeclaration : void 0, ge = new Set(K);
2800
+ if (v && ee && Z(ee)) for (const F of r.getTypeOfSymbolAtLocation(v, ee).getProperties()) {
2801
+ const _ = F.valueDeclaration, $ = r.getTypeOfSymbolAtLocation(F, _ ?? ee);
2801
2802
  if (!($.flags & (e.TypeFlags.NumberLiteral | e.TypeFlags.StringLiteral))) continue;
2802
2803
  const ne = $.value;
2803
- K.includes(ne) && (j = !0, ge.delete(ne), L.push([
2804
- P(D, !0),
2804
+ K.includes(ne) && (j = !0, ge.delete(ne), k.push([
2805
+ U(F, !0),
2805
2806
  ne,
2806
2807
  _,
2807
- $e(D.getDocumentationComment(r)),
2808
- N(D)
2808
+ $e(F.getDocumentationComment(r)),
2809
+ N(F)
2809
2810
  ]));
2810
2811
  }
2811
- for (const D of K) ge.has(D) && L.push([
2812
- String(D),
2813
- D,
2812
+ for (const F of K) ge.has(F) && k.push([
2813
+ String(F),
2814
+ F,
2814
2815
  void 0,
2815
2816
  null
2816
2817
  ]);
2817
2818
  }
2818
- if (L.length === 0) return null;
2819
- const O = typeof L[0][1] == "number";
2820
- if (L.some(([, m]) => typeof m == "number" !== O)) {
2821
- c(s, w.EnumMixed, \`'\${E?.name ?? s.getText()}' mixes number and string members: '\${f}'. A parameter has one type, so an enum is all numbers or all strings.\`);
2819
+ if (k.length === 0) return null;
2820
+ const O = typeof k[0][1] == "number";
2821
+ if (k.some(([, m]) => typeof m == "number" !== O)) {
2822
+ c(s, w.EnumMixed, \`'\${v?.name ?? s.getText()}' mixes number and string members: '\${f}'. A parameter has one type, so an enum is all numbers or all strings.\`);
2822
2823
  return;
2823
2824
  }
2824
- const A = E ? P(E) : L.map(([, m]) => String(m)).join("|"), F = E ? void 0 : v.get(A);
2825
- if (F) return F;
2825
+ const A = v ? U(v) : k.map(([, m]) => String(m)).join("|"), D = v ? void 0 : E.get(A);
2826
+ if (D) return D;
2826
2827
  if (j) {
2827
2828
  const m = /* @__PURE__ */ new Map();
2828
- for (const [S, x, K, re] of L) {
2829
- const J = K?.name?.getText() ?? S, ee = m.get(x);
2830
- ee !== void 0 ? h(K ?? s, w.EnumDuplicateValue, "warning", \`'\${A}.\${J}' has the same value as '\${A}.\${ee}' (\${JSON.stringify(x)}). A formula passes the value, so the two cannot be told apart.\`) : m.set(x, J), re === "" && h(K ?? s, w.EnumMemberUndocumented, "warning", \`'\${A}.\${J}' is missing a description. Add a doc comment above the member — it is what the argument dropdown shows.\`);
2829
+ for (const [b, x, K, re] of k) {
2830
+ const Y = K?.name?.getText() ?? b, ee = m.get(x);
2831
+ ee !== void 0 ? h(K ?? s, w.EnumDuplicateValue, "warning", \`'\${A}.\${Y}' has the same value as '\${A}.\${ee}' (\${JSON.stringify(x)}). A formula passes the value, so the two cannot be told apart.\`) : m.set(x, Y), re === "" && h(K ?? s, w.EnumMemberUndocumented, "warning", \`'\${A}.\${Y}' is missing a description. Add a doc comment above the member — it is what the argument dropdown shows.\`);
2831
2832
  }
2832
2833
  }
2833
2834
  const V = {
2834
2835
  id: A,
2835
2836
  type: O ? me.Number : me.String,
2836
- members: L.map(([m, S, , , x]) => x ? [
2837
+ members: k.map(([m, b, , , x]) => x ? [
2837
2838
  m,
2838
- S,
2839
+ b,
2839
2840
  x
2840
- ] : [m, S])
2841
+ ] : [m, b])
2841
2842
  };
2842
- E ? q.set(E, V) : v.set(A, V);
2843
- const z = E ? $e(E.getDocumentationComment(r)) : "", B = {};
2844
- for (const [m, , , S] of L) S && (B[m] = { description: S });
2843
+ v ? H.set(v, V) : E.set(A, V);
2844
+ const z = v ? $e(v.getDocumentationComment(r)) : "", B = {};
2845
+ for (const [m, , , b] of k) b && (B[m] = { description: b });
2845
2846
  if (z || Object.keys(B).length > 0) {
2846
2847
  const m = {};
2847
2848
  z && (m.summary = z), Object.keys(B).length > 0 && (m.members = B), C.set(V, m);
2848
2849
  }
2849
2850
  return V;
2850
2851
  }, pe = (s, f, d, y) => {
2851
- const E = (O, A, F) => {
2852
+ const v = (O, A, D) => {
2852
2853
  const V = { name: O };
2853
- return T(A, V, d, !0), F && (V.optional = !0), y && !V.acceptError && (V.acceptError = !0), V;
2854
+ return T(A, V, d, !0), D && (V.optional = !0), y && !V.acceptError && (V.acceptError = !0), V;
2854
2855
  };
2855
- if (s.kind !== e.SyntaxKind.TupleType) return [E(f, s, !1)];
2856
- const L = s.elements;
2857
- if (L.length < 2) return c(s, w.RepeatingSlots, \`'\${f}': a repeating group of period \${L.length} must be spelled 'Repeating<T>' without the tuple.\`), null;
2856
+ if (s.kind !== e.SyntaxKind.TupleType) return [v(f, s, !1)];
2857
+ const k = s.elements;
2858
+ if (k.length < 2) return c(s, w.RepeatingSlots, \`'\${f}': a repeating group of period \${k.length} must be spelled 'Repeating<T>' without the tuple.\`), null;
2858
2859
  const j = [];
2859
- for (let O = 0; O < L.length; O++) {
2860
- const A = L[O];
2860
+ for (let O = 0; O < k.length; O++) {
2861
+ const A = k[O];
2861
2862
  if (A.kind !== e.SyntaxKind.NamedTupleMember) return c(A, w.RepeatingSlots, \`'\${f}': every slot of a repeating group must be labelled, e.g. 'Repeating<[criteriaRange: IRange, criteria: Scalar]>'.\`), null;
2862
- const F = !!A.questionToken;
2863
- if (F && O !== L.length - 1) return c(A, w.RepeatingOptional, \`'\${f}': only the LAST slot of a repeating group may be optional (slot '\${A.name?.getText?.()}' is not).\`), null;
2864
- j.push(E(A.name?.getText?.() ?? \`\${O}\`, A.type, F));
2863
+ const D = !!A.questionToken;
2864
+ if (D && O !== k.length - 1) return c(A, w.RepeatingOptional, \`'\${f}': only the LAST slot of a repeating group may be optional (slot '\${A.name?.getText?.()}' is not).\`), null;
2865
+ j.push(v(A.name?.getText?.() ?? \`\${O}\`, A.type, D));
2865
2866
  }
2866
2867
  return j;
2867
- }, W = (s, f, d, y, E, L = !1, j = !1, O = !1) => {
2868
+ }, J = (s, f, d, y, v, k = !1, j = !1, O = !1) => {
2868
2869
  if (!s) {
2869
2870
  c(s, w.MissingType, \`Type is not defined for '\${f?.name ?? "return"}'.\`);
2870
2871
  return;
2871
2872
  }
2872
- if (s.kind === e.SyntaxKind.ParenthesizedType) return W(s.type, f, d, y, E, L, j, O);
2873
+ if (s.kind === e.SyntaxKind.ParenthesizedType) return J(s.type, f, d, y, v, k, j, O);
2873
2874
  if (s.kind === e.SyntaxKind.UnionType) {
2874
- const A = (z) => z.kind === e.SyntaxKind.UndefinedKeyword || z.kind === e.SyntaxKind.VoidKeyword || z.kind === e.SyntaxKind.NullKeyword || z.kind === e.SyntaxKind.LiteralType && z.literal?.kind === e.SyntaxKind.NullKeyword, F = s.types.filter((z) => !A(z));
2875
- if (F.length === 1) return W(F[0], f, d, y, E, L, j, O);
2876
- const V = k(s, f.name ?? g(s));
2875
+ const A = (z) => z.kind === e.SyntaxKind.UndefinedKeyword || z.kind === e.SyntaxKind.VoidKeyword || z.kind === e.SyntaxKind.NullKeyword || z.kind === e.SyntaxKind.LiteralType && z.literal?.kind === e.SyntaxKind.NullKeyword, D = s.types.filter((z) => !A(z));
2876
+ if (D.length === 1) return J(D[0], f, d, y, v, k, j, O);
2877
+ const V = L(s, f.name ?? g(s));
2877
2878
  if (V === void 0) return;
2878
2879
  if (V !== null) {
2879
2880
  f.scalar = V.type, y && (f.enum = V);
@@ -2883,31 +2884,31 @@ function ta(e, t, r, n) {
2883
2884
  f.scalar = "*";
2884
2885
  return;
2885
2886
  }
2886
- if (F.length === 2) {
2887
- const z = (m) => m.kind !== e.SyntaxKind.TypeReference ? !1 : e.isTypeReferenceNode(m) && ve(m) === "Lambda", B = F.findIndex(z);
2888
- if (B >= 0 && !z(F[1 - B])) {
2889
- W(F[1 - B], f, d, y, E, L, j, O), I(F[B], ve(F[B]), f, d, y);
2887
+ if (D.length === 2) {
2888
+ const z = (m) => m.kind !== e.SyntaxKind.TypeReference ? !1 : e.isTypeReferenceNode(m) && Ee(m) === "Lambda", B = D.findIndex(z);
2889
+ if (B >= 0 && !z(D[1 - B])) {
2890
+ J(D[1 - B], f, d, y, v, k, j, O), I(D[B], Ee(D[B]), f, d, y);
2890
2891
  return;
2891
2892
  }
2892
2893
  }
2893
- if (y && F.length === 2) {
2894
+ if (y && D.length === 2) {
2894
2895
  const z = (m) => {
2895
- if (!(m.kind !== e.SyntaxKind.TypeReference || m.typeArguments?.length)) return ct.get(ve(m));
2896
- }, B = F.findIndex((m) => z(m) !== void 0);
2897
- if (B >= 0 && z(F[1 - B]) === void 0) {
2898
- const m = {}, S = E.count;
2899
- if (W(F[1 - B], m, d, y, E, L, !1), m.scalar && !m.range && m.lambda == null && E.count === S) {
2900
- f.range = z(F[B]), f.scalar = m.scalar, f.valueOrRange = !0;
2896
+ if (!(m.kind !== e.SyntaxKind.TypeReference || m.typeArguments?.length)) return ct.get(Ee(m));
2897
+ }, B = D.findIndex((m) => z(m) !== void 0);
2898
+ if (B >= 0 && z(D[1 - B]) === void 0) {
2899
+ const m = {}, b = v.count;
2900
+ if (J(D[1 - B], m, d, y, v, k, !1), m.scalar && !m.range && m.lambda == null && v.count === b) {
2901
+ f.range = z(D[B]), f.scalar = m.scalar, f.valueOrRange = !0;
2901
2902
  const x = m.enum;
2902
2903
  x && (f.enum = x);
2903
2904
  return;
2904
2905
  }
2905
2906
  }
2906
2907
  }
2907
- if (y && F.length === 2) {
2908
- const z = (m) => m.kind === e.SyntaxKind.TypeReference && !m.typeArguments?.length && ve(m) === "Scalar", B = F.findIndex(z);
2909
- if (B >= 0 && !z(F[1 - B])) {
2910
- const m = k(F[1 - B], f.name ?? g(s));
2908
+ if (y && D.length === 2) {
2909
+ const z = (m) => m.kind === e.SyntaxKind.TypeReference && !m.typeArguments?.length && Ee(m) === "Scalar", B = D.findIndex(z);
2910
+ if (B >= 0 && !z(D[1 - B])) {
2911
+ const m = L(D[1 - B], f.name ?? g(s));
2911
2912
  if (m === void 0) return;
2912
2913
  if (m !== null) {
2913
2914
  f.scalar = "*", f.enum = m;
@@ -2936,23 +2937,23 @@ function ta(e, t, r, n) {
2936
2937
  return;
2937
2938
  }
2938
2939
  if (y && j) {
2939
- const F = f, V = F.name ?? g(s) ?? "parameter", z = F.acceptError;
2940
- delete F.acceptError;
2940
+ const D = f, V = D.name ?? g(s) ?? "parameter", z = D.acceptError;
2941
+ delete D.acceptError;
2941
2942
  const B = { name: V };
2942
- T(A, B, d, !0), z && !B.acceptError && (B.acceptError = !0), F.repeating = [B];
2943
+ T(A, B, d, !0), z && !B.acceptError && (B.acceptError = !0), D.repeating = [B];
2943
2944
  return;
2944
2945
  }
2945
- E.count++, W(A, f, d, y, E);
2946
+ v.count++, J(A, f, d, y, v);
2946
2947
  } else if (s.kind !== e.SyntaxKind.TupleType) if (s.kind === e.SyntaxKind.TypeReference) {
2947
- const A = ve(s);
2948
+ const A = Ee(s);
2948
2949
  if (Vr.has(A)) {
2949
2950
  const m = g(s);
2950
2951
  if (!y) {
2951
2952
  c(s, w.InvalidReturnType, \`'\${A}' is not a valid return type: '\${m}'. It describes how an ARGUMENT is received.\`);
2952
2953
  return;
2953
2954
  }
2954
- const S = f;
2955
- if (S.acceptError) {
2955
+ const b = f;
2956
+ if (b.acceptError) {
2956
2957
  c(s, w.InvalidParamType, \`'\${m}' declares 'AcceptError' more than once.\`);
2957
2958
  return;
2958
2959
  }
@@ -2961,7 +2962,7 @@ function ta(e, t, r, n) {
2961
2962
  c(s, w.GenericArity, \`'\${A}' must be typed with exactly 1 type: '\${m}'.\`);
2962
2963
  return;
2963
2964
  }
2964
- return S.acceptError = !0, W(x[0], f, d, y, E, L, j, O);
2965
+ return b.acceptError = !0, J(x[0], f, d, y, v, k, j, O);
2965
2966
  }
2966
2967
  if (ut.has(A)) {
2967
2968
  const m = f.name ?? g(s);
@@ -2969,12 +2970,12 @@ function ta(e, t, r, n) {
2969
2970
  c(s, w.InvalidReturnType, \`'ReportType' is not a valid return type: '\${m}'. It describes how an ARGUMENT is received.\`);
2970
2971
  return;
2971
2972
  }
2972
- const S = s.typeArguments;
2973
- if (!S || S.length !== 1) {
2973
+ const b = s.typeArguments;
2974
+ if (!b || b.length !== 1) {
2974
2975
  c(s, w.GenericArity, \`'\${A}' must be typed with exactly 1 type: '\${m}'.\`);
2975
2976
  return;
2976
2977
  }
2977
- return f.reportType = !0, W(S[0], f, d, y, E, L, j, O);
2978
+ return f.reportType = !0, J(b[0], f, d, y, v, k, j, O);
2978
2979
  }
2979
2980
  if (Gr.has(A)) {
2980
2981
  const m = f.name ?? g(s);
@@ -2982,32 +2983,32 @@ function ta(e, t, r, n) {
2982
2983
  c(s, w.InvalidReturnType, \`'NoLift' is not a valid return type: '\${m}'. It describes how an ARGUMENT is received.\`);
2983
2984
  return;
2984
2985
  }
2985
- const S = s.typeArguments;
2986
- if (!S || S.length !== 1) {
2986
+ const b = s.typeArguments;
2987
+ if (!b || b.length !== 1) {
2987
2988
  c(s, w.GenericArity, \`'\${A}' must be typed with exactly 1 type: '\${m}'.\`);
2988
2989
  return;
2989
2990
  }
2990
2991
  const x = f;
2991
2992
  x.noLift = !0;
2992
- const K = E.count;
2993
- W(S[0], f, d, y, E, L, j, O), (x.range || x.lambda != null || x.repeating || E.count !== K) && c(s, w.InvalidParamType, \`'\${m}': 'NoLift' applies to a SCALAR parameter only - a range, list, repeating or lambda slot never lifts.\`);
2993
+ const K = v.count;
2994
+ J(b[0], f, d, y, v, k, j, O), (x.range || x.lambda != null || x.repeating || v.count !== K) && c(s, w.InvalidParamType, \`'\${m}': 'NoLift' applies to a SCALAR parameter only - a range, list, repeating or lambda slot never lifts.\`);
2994
2995
  return;
2995
2996
  }
2996
- if (qr.has(A)) {
2997
+ if (Hr.has(A)) {
2997
2998
  const m = f.name ?? g(s);
2998
2999
  if (!y) {
2999
3000
  c(s, w.InvalidReturnType, \`'NoFilter' is not a valid return type: '\${m}'. It describes how an ARGUMENT is received.\`);
3000
3001
  return;
3001
3002
  }
3002
- const S = s.typeArguments;
3003
- if (!S || S.length !== 1) {
3003
+ const b = s.typeArguments;
3004
+ if (!b || b.length !== 1) {
3004
3005
  c(s, w.GenericArity, \`'\${A}' must be typed with exactly 1 type: '\${m}'.\`);
3005
3006
  return;
3006
3007
  }
3007
3008
  const x = f;
3008
3009
  x.noFilter = !0;
3009
- const K = E.count;
3010
- if (W(S[0], f, d, y, E, L, j, O), x.range || x.lambda != null || E.count !== K) {
3010
+ const K = v.count;
3011
+ if (J(b[0], f, d, y, v, k, j, O), x.range || x.lambda != null || v.count !== K) {
3011
3012
  c(s, w.InvalidParamType, \`'\${m}': 'NoFilter' applies to a SCALAR slot only - a range, list or lambda slot has no members to coerce.\`);
3012
3013
  return;
3013
3014
  }
@@ -3027,31 +3028,31 @@ function ta(e, t, r, n) {
3027
3028
  c(s, w.InvalidReturnType, \`'Omittable' is not a valid return type: '\${m}'. It describes how an ARGUMENT is received.\`);
3028
3029
  return;
3029
3030
  }
3030
- const S = s.typeArguments;
3031
- if (!S || S.length < 1 || S.length > 2) {
3031
+ const b = s.typeArguments;
3032
+ if (!b || b.length < 1 || b.length > 2) {
3032
3033
  c(s, w.GenericArity, \`'\${A}' must be typed with 1 or 2 types: '\${m}'.\`);
3033
3034
  return;
3034
3035
  }
3035
3036
  const x = f;
3036
- if (x.omittable = !0, S.length === 2) {
3037
- const J = qt(e, S[1]);
3038
- if (J === void 0) {
3037
+ if (x.omittable = !0, b.length === 2) {
3038
+ const Y = Ht(e, b[1]);
3039
+ if (Y === void 0) {
3039
3040
  c(s, w.InvalidParamType, \`'\${m}' declares '\${A}' with a second type that is not a literal value. Use a number, string, boolean or null - the engine substitutes it for an omitted argument.\`);
3040
3041
  return;
3041
3042
  }
3042
- x.omittedValue = J;
3043
+ x.omittedValue = Y;
3043
3044
  }
3044
- const K = W(S[0], f, d, y, E, L, j, O), re = x.omittedValue;
3045
- return x.enum && re !== void 0 && re !== null && !x.enum.members.some(([, J]) => J === re) && c(S[1], w.EnumOmittedValue, \`'\${m}': \${JSON.stringify(re)} is not a member of '\${x.enum.id}'. An omitted argument must mean a member (\${x.enum.members.map(([, J]) => JSON.stringify(J)).join(", ")}) or null.\`), K;
3045
+ const K = J(b[0], f, d, y, v, k, j, O), re = x.omittedValue;
3046
+ return x.enum && re !== void 0 && re !== null && !x.enum.members.some(([, Y]) => Y === re) && c(b[1], w.EnumOmittedValue, \`'\${m}': \${JSON.stringify(re)} is not a member of '\${x.enum.id}'. An omitted argument must mean a member (\${x.enum.members.map(([, Y]) => JSON.stringify(Y)).join(", ")}) or null.\`), K;
3046
3047
  }
3047
- if (Hr.has(A)) {
3048
+ if (Wr.has(A)) {
3048
3049
  const m = f.name ?? g(s);
3049
3050
  if (!y) {
3050
3051
  c(s, w.InvalidReturnType, \`'Lazy' is not a valid return type: '\${m}'. It describes how an ARGUMENT is received.\`);
3051
3052
  return;
3052
3053
  }
3053
- const S = f;
3054
- if (S.lazy) {
3054
+ const b = f;
3055
+ if (b.lazy) {
3055
3056
  c(s, w.InvalidParamType, \`'\${m}' declares 'Lazy' more than once.\`);
3056
3057
  return;
3057
3058
  }
@@ -3060,29 +3061,29 @@ function ta(e, t, r, n) {
3060
3061
  c(s, w.GenericArity, \`'\${A}' must be typed with 1 or 2 types: '\${m}'.\`);
3061
3062
  return;
3062
3063
  }
3063
- if (S.lazy = !0, x.length === 2) {
3064
- const K = qt(e, x[1]);
3064
+ if (b.lazy = !0, x.length === 2) {
3065
+ const K = Ht(e, x[1]);
3065
3066
  if (K === void 0) {
3066
3067
  c(s, w.InvalidParamType, \`'\${m}' declares '\${A}' with a second type that is not a literal value. Use a number, string, boolean or null - the engine substitutes it for an absent argument.\`);
3067
3068
  return;
3068
3069
  }
3069
- S.optional = !0, S.defaultValue = K;
3070
+ b.optional = !0, b.defaultValue = K;
3070
3071
  }
3071
- W(x[0], f, d, y, E, L, j, O), S.enum ? (c(s, w.EnumPosition, \`'\${m}': 'Lazy' cannot hold the enum '\${S.enum.id}'. The argument may never be evaluated, so there is no point at which it could be checked against the members.\`), delete S.enum) : S.lambda != null ? c(s, w.InvalidParamType, \`'\${m}': 'Lazy' cannot be combined with a Lambda parameter - a callable slot is already the body's to call, or not.\`) : S.repeating && c(s, w.InvalidParamType, \`'\${m}': 'Lazy' applies to a VALUE, not to a repeating group - mark the group's slots instead.\`);
3072
+ J(x[0], f, d, y, v, k, j, O), b.enum ? (c(s, w.EnumPosition, \`'\${m}': 'Lazy' cannot hold the enum '\${b.enum.id}'. The argument may never be evaluated, so there is no point at which it could be checked against the members.\`), delete b.enum) : b.lambda != null ? c(s, w.InvalidParamType, \`'\${m}': 'Lazy' cannot be combined with a Lambda parameter - a callable slot is already the body's to call, or not.\`) : b.repeating && c(s, w.InvalidParamType, \`'\${m}': 'Lazy' applies to a VALUE, not to a repeating group - mark the group's slots instead.\`);
3072
3073
  return;
3073
3074
  }
3074
- if (Ho.has(A)) {
3075
+ if (Wo.has(A)) {
3075
3076
  const m = f.name ?? g(s);
3076
3077
  if (!y) {
3077
3078
  c(s, w.InvalidReturnType, \`'Flatten' is not a valid return type: '\${m}'. It describes how an ARGUMENT is received.\`);
3078
3079
  return;
3079
3080
  }
3080
- const S = s.typeArguments;
3081
- if (!S || S.length !== 1) {
3081
+ const b = s.typeArguments;
3082
+ if (!b || b.length !== 1) {
3082
3083
  c(s, w.GenericArity, \`'\${A}' must be typed with exactly 1 type: '\${m}'.\`);
3083
3084
  return;
3084
3085
  }
3085
- return E.count++, W(S[0], f, d, y, E, L);
3086
+ return v.count++, J(b[0], f, d, y, v, k);
3086
3087
  }
3087
3088
  if (zr.get(A) === "repeating") {
3088
3089
  const m = f.name ?? g(s);
@@ -3090,41 +3091,41 @@ function ta(e, t, r, n) {
3090
3091
  c(s, w.RepeatingPosition, \`'Repeating' is not a valid return type: '\${m}'.\`);
3091
3092
  return;
3092
3093
  }
3093
- if (E.count !== 0) {
3094
+ if (v.count !== 0) {
3094
3095
  c(s, w.RepeatingPosition, \`'Repeating' cannot be nested inside another type: '\${m}'.\`);
3095
3096
  return;
3096
3097
  }
3097
- const S = f, x = s.typeArguments;
3098
+ const b = f, x = s.typeArguments;
3098
3099
  if (!x || x.length < 1 || x.length > 2) {
3099
3100
  c(s, w.GenericArity, \`'\${A}' must be typed with 1 type, optionally followed by a maximum argument count: '\${m}'.\`);
3100
3101
  return;
3101
3102
  }
3102
3103
  let K;
3103
3104
  if (x.length === 2) {
3104
- const ee = x[1], ge = ee.kind === e.SyntaxKind.LiteralType ? ee.literal : null, D = ge && ge.kind === e.SyntaxKind.NumericLiteral ? Number(ge.text) : NaN;
3105
- if (!Number.isInteger(D) || D < 1 || D > Vt) {
3105
+ const ee = x[1], ge = ee.kind === e.SyntaxKind.LiteralType ? ee.literal : null, F = ge && ge.kind === e.SyntaxKind.NumericLiteral ? Number(ge.text) : NaN;
3106
+ if (!Number.isInteger(F) || F < 1 || F > Vt) {
3106
3107
  c(ee, w.RepeatingMax, \`'\${m}': '\${A}'’s maximum must be a whole number between 1 and \${Vt}.\`);
3107
3108
  return;
3108
3109
  }
3109
- K = D, d.maxArguments = D;
3110
+ K = F, d.maxArguments = F;
3110
3111
  }
3111
3112
  if (O) {
3112
3113
  if (K === void 0) {
3113
3114
  c(s, w.RepeatingPosition, \`'\${m}' is a rest parameter and a repeating group. A group already repeats — drop the '...', or give the group a maximum ('Repeating<T, 254>') if the ceiling is all you meant.\`);
3114
3115
  return;
3115
3116
  }
3116
- return W(x[0], f, d, y, E, L, j);
3117
+ return J(x[0], f, d, y, v, k, j);
3117
3118
  }
3118
- const re = S.acceptError;
3119
- delete S.acceptError;
3120
- const J = pe(x[0], m ?? "parameter", d, re);
3121
- J && (S.repeating = J);
3119
+ const re = b.acceptError;
3120
+ delete b.acceptError;
3121
+ const Y = pe(x[0], m ?? "parameter", d, re);
3122
+ Y && (b.repeating = Y);
3122
3123
  return;
3123
3124
  }
3124
- const F = ct.get(A);
3125
+ const D = ct.get(A);
3125
3126
  let V = !1;
3126
- F && (f.range = F, V = !0);
3127
- const z = qo.get(A);
3127
+ D && (f.range = D, V = !0);
3128
+ const z = Ho.get(A);
3128
3129
  if (z && (f.scalar = z), z !== void 0 && (V = !0), I(s, A, f, d, y)) return;
3129
3130
  if (y) {
3130
3131
  if (A === "Volatile" || A === \`\${le}.Volatile\`) {
@@ -3137,9 +3138,9 @@ function ta(e, t, r, n) {
3137
3138
  } else {
3138
3139
  const m = Qo.get(A);
3139
3140
  if (m) {
3140
- const S = Object.assign(f, m());
3141
+ const b = Object.assign(f, m());
3141
3142
  let x = 0;
3142
- if (S.async && x++, S.stream && x++, x > 1) {
3143
+ if (b.async && x++, b.stream && x++, x > 1) {
3143
3144
  c(s, w.MultipleModifiers, \`'\${A}' cannot have multiple modifiers: '\${g(s)}'.\`);
3144
3145
  return;
3145
3146
  }
@@ -3147,7 +3148,7 @@ function ta(e, t, r, n) {
3147
3148
  }
3148
3149
  }
3149
3150
  if (!V) {
3150
- const m = k(s, f.name ?? g(s));
3151
+ const m = L(s, f.name ?? g(s));
3151
3152
  if (m === void 0) return;
3152
3153
  if (m !== null) {
3153
3154
  f.scalar = m.type, y && (f.enum = m);
@@ -3155,9 +3156,9 @@ function ta(e, t, r, n) {
3155
3156
  }
3156
3157
  }
3157
3158
  if (!V) {
3158
- const m = "number, string, boolean, Scalar, Lambda, Date, FormulaError.Known, IRichData, IRange, IReferenceRange (and arrays of these; optionally wrapped in AcceptError<T>, or grouped with Repeating<T>)", S = "number, string, boolean, Scalar, Date, FormulaError.Known, IRichData, IRange, Promise<T>, Observable<T>, Volatile<T> (and arrays of these)";
3159
+ const m = "number, string, boolean, Scalar, Lambda, Date, FormulaError.Known, IRichData, IRange, IReferenceRange (and arrays of these; optionally wrapped in AcceptError<T>, or grouped with Repeating<T>)", b = "number, string, boolean, Scalar, Date, FormulaError.Known, IRichData, IRange, Promise<T>, Observable<T>, Volatile<T> (and arrays of these)";
3159
3160
  let x;
3160
- y ? L ? x = \`'\${A}' is not a valid first parameter: '\${g(s)}'. The first parameter is EITHER a macro target (making this a macro) OR a calculation input (making this a calculation function). Allowed: \${Go.join(", ")} (macro target); \${m} (calculation input).\` : x = \`'\${A}' is not a valid parameter type: '\${g(s)}'. Allowed: \${m}.\` : x = \`'\${A}' is not a valid return type: '\${g(s)}'. Allowed: \${S}.\`, c(s, y ? w.InvalidParamType : w.InvalidReturnType, x);
3161
+ y ? k ? x = \`'\${A}' is not a valid first parameter: '\${g(s)}'. The first parameter is EITHER a macro target (making this a macro) OR a calculation input (making this a calculation function). Allowed: \${Go.join(", ")} (macro target); \${m} (calculation input).\` : x = \`'\${A}' is not a valid parameter type: '\${g(s)}'. Allowed: \${m}.\` : x = \`'\${A}' is not a valid return type: '\${g(s)}'. Allowed: \${b}.\`, c(s, y ? w.InvalidParamType : w.InvalidReturnType, x);
3161
3162
  return;
3162
3163
  }
3163
3164
  const B = s.typeArguments;
@@ -3166,13 +3167,13 @@ function ta(e, t, r, n) {
3166
3167
  c(s, w.GenericArity, \`'\${A}' must be typed with exactly 1 type: '\${g(s)}'.\`);
3167
3168
  return;
3168
3169
  }
3169
- const m = B[0], S = y && e.isTypeReferenceNode(m) && ut.has(ve(m)), x = f.reportType;
3170
- S && U.add(f), T(m, f, d, y), S && x === void 0 && delete f.reportType;
3170
+ const m = B[0], b = y && e.isTypeReferenceNode(m) && ut.has(Ee(m)), x = f.reportType;
3171
+ b && P.add(f), T(m, f, d, y), b && x === void 0 && delete f.reportType;
3171
3172
  const K = f.enum;
3172
- K && !S && (c(B[0], w.EnumPosition, \`'\${A}' cannot hold the enum '\${K.id}': '\${g(s)}'. The members of a range reach the body as they are, so nothing checks them against the enum. Take the enum as a value, or type the range by its scalar ('\${A}<\${K.type}>').\`), delete f.enum);
3173
+ K && !b && (c(B[0], w.EnumPosition, \`'\${A}' cannot hold the enum '\${K.id}': '\${g(s)}'. The members of a range reach the body as they are, so nothing checks them against the enum. Take the enum as a value, or type the range by its scalar ('\${A}<\${K.type}>').\`), delete f.enum);
3173
3174
  }
3174
3175
  } else s.kind === e.SyntaxKind.FunctionType && M(s, f, d, y);
3175
- }, Ge = (s) => (e.getCombinedModifierFlags(s) & e.ModifierFlags.Export) !== 0, qe = (s) => (e.getCombinedModifierFlags(s) & e.ModifierFlags.Default) !== 0;
3176
+ }, Ge = (s) => (e.getCombinedModifierFlags(s) & e.ModifierFlags.Export) !== 0, He = (s) => (e.getCombinedModifierFlags(s) & e.ModifierFlags.Default) !== 0;
3176
3177
  try {
3177
3178
  e.forEachChild(t, (s) => {
3178
3179
  if (Ge(s) && e.isFunctionDeclaration(s)) {
@@ -3188,25 +3189,25 @@ function ta(e, t, r, n) {
3188
3189
  const d = {}, y = { parameters: {} };
3189
3190
  try {
3190
3191
  d.name = f;
3191
- const E = r.getSymbolAtLocation(s.name), L = $e(E?.getDocumentationComment(r));
3192
- L && (y.summary = L);
3192
+ const v = r.getSymbolAtLocation(s.name), k = $e(v?.getDocumentationComment(r));
3193
+ k && (y.summary = k);
3193
3194
  const j = {};
3194
3195
  T(s.type, j, d, !1), d.returnType = j;
3195
3196
  const O = {};
3196
- qe(s) && (O.default = !0, u = f), d.parameters = [];
3197
- const A = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Set();
3198
- let z = null, B = null, m = null, S = 0, x = !1, K = 0;
3199
- for (let D = 0; D < s.parameters.length; D++) {
3200
- const _ = s.parameters[D], $ = {};
3197
+ He(s) && (O.default = !0, u = f), d.parameters = [];
3198
+ const A = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Set();
3199
+ let z = null, B = null, m = null, b = 0, x = !1, K = 0;
3200
+ for (let F = 0; F < s.parameters.length; F++) {
3201
+ const _ = s.parameters[F], $ = {};
3201
3202
  $.name = _.name?.getText();
3202
3203
  const ne = d.parameters.length === 0;
3203
- if (n?.lenient && D === 0 && !_.type && O.default) {
3204
+ if (n?.lenient && F === 0 && !_.type && O.default) {
3204
3205
  d.context = Gt;
3205
3206
  continue;
3206
3207
  }
3207
3208
  const Ie = T(_.type, $, d, !0, ne, !_.dotDotDotToken, !!_.dotDotDotToken);
3208
3209
  if (Ie === Xt) {
3209
- D === 0 && d.context === void 0 && (d.context = Gt);
3210
+ F === 0 && d.context === void 0 && (d.context = Gt);
3210
3211
  continue;
3211
3212
  }
3212
3213
  if (Ie) {
@@ -3261,13 +3262,13 @@ function ta(e, t, r, n) {
3261
3262
  c(_, w.RepeatingOptional, \`'\${d.name}' parameter '\${m}' is optional and precedes the repeating group '\${$.name}'. Every parameter outside a group must be required.\`);
3262
3263
  return;
3263
3264
  }
3264
- B = $.name, S = X.length, x = X[X.length - 1].optional === !0;
3265
+ B = $.name, b = X.length, x = X[X.length - 1].optional === !0;
3265
3266
  } else if (B !== null && $.rest) {
3266
3267
  c(_, w.RepeatingOptional, \`'\${d.name}' parameter '\${$.name}' is a rest parameter and follows the repeating group '\${B}'. Two variadic tails would make the argument count ambiguous.\`);
3267
3268
  return;
3268
3269
  } else if (B !== null && ye) {
3269
- if (K >= S - 1) {
3270
- c(_, w.RepeatingOptional, S === 1 ? \`'\${d.name}' parameter '\${$.name}' is optional and follows the period-1 repeating group '\${B}'. One more argument is indistinguishable from one more repetition — make it required, or give the group a period.\` : \`'\${d.name}' has \${K + 1} optional parameters after the repeating group '\${B}', which has period \${S}. At most \${S - 1} may be optional, or the argument count no longer decides the parse.\`);
3270
+ if (K >= b - 1) {
3271
+ c(_, w.RepeatingOptional, b === 1 ? \`'\${d.name}' parameter '\${$.name}' is optional and follows the period-1 repeating group '\${B}'. One more argument is indistinguishable from one more repetition — make it required, or give the group a period.\` : \`'\${d.name}' has \${K + 1} optional parameters after the repeating group '\${B}', which has period \${b}. At most \${b - 1} may be optional, or the argument count no longer decides the parse.\`);
3271
3272
  return;
3272
3273
  }
3273
3274
  if (x) {
@@ -3285,38 +3286,38 @@ function ta(e, t, r, n) {
3285
3286
  d.parameters.push($);
3286
3287
  const se = { description: "" };
3287
3288
  y.parameters[$.name] = se;
3288
- const He = r.getSymbolAtLocation(_.name);
3289
- se.description = $e(He?.getDocumentationComment(r)), ae !== void 0 && ($.defaultValue = ae);
3289
+ const We = r.getSymbolAtLocation(_.name);
3290
+ se.description = $e(We?.getDocumentationComment(r)), ae !== void 0 && ($.defaultValue = ae);
3290
3291
  for (const ce of [$, ...$.repeating ?? []]) {
3291
3292
  const we = ce.enum ? C.get(ce.enum) : void 0;
3292
3293
  we && ((y.enums ??= {})[ce.enum.id] = we);
3293
3294
  }
3294
- if (A.set($.name, $), F.set($.name, _), X && X.length > 1) {
3295
+ if (A.set($.name, $), D.set($.name, _), X && X.length > 1) {
3295
3296
  V.add($.name);
3296
3297
  for (const ce of X) {
3297
3298
  const we = \`\${$.name}.\${ce.name}\`;
3298
- y.parameters[we] = { description: "" }, A.set(we, ce), F.set(we, _);
3299
+ y.parameters[we] = { description: "" }, A.set(we, ce), D.set(we, _);
3299
3300
  }
3300
3301
  }
3301
3302
  }
3302
3303
  const re = d.maxArguments;
3303
3304
  if (re !== void 0) {
3304
- const D = d.parameters ?? [];
3305
- if (!D.some(($) => $.rest === !0 || $.repeating !== void 0)) {
3306
- c(s, w.RepeatingMax, \`'\${d.name}' declares a maximum of \${re} arguments but takes a fixed \${D.length}. A maximum only means something on a variadic tail.\`);
3305
+ const F = d.parameters ?? [];
3306
+ if (!F.some(($) => $.rest === !0 || $.repeating !== void 0)) {
3307
+ c(s, w.RepeatingMax, \`'\${d.name}' declares a maximum of \${re} arguments but takes a fixed \${F.length}. A maximum only means something on a variadic tail.\`);
3307
3308
  return;
3308
3309
  }
3309
3310
  let _ = 0;
3310
- for (const $ of D) $.rest === !0 || $.optional === !0 || (_ += $.repeating ? $.repeating.length : 1);
3311
+ for (const $ of F) $.rest === !0 || $.optional === !0 || (_ += $.repeating ? $.repeating.length : 1);
3311
3312
  if (re < _) {
3312
3313
  c(s, w.RepeatingMax, \`'\${d.name}' declares a maximum of \${re} arguments but requires \${_}.\`);
3313
3314
  return;
3314
3315
  }
3315
3316
  }
3316
3317
  if (s.jsDoc && s.jsDoc.length > 0) {
3317
- const D = s.jsDoc, _ = D.length;
3318
+ const F = s.jsDoc, _ = F.length;
3318
3319
  for (let $ = 0; $ < _; $++) {
3319
- const ne = D[$]?.tags;
3320
+ const ne = F[$]?.tags;
3320
3321
  if (!ne) continue;
3321
3322
  const Ie = ne.length;
3322
3323
  for (let ye = 0; ye < Ie; ye++) {
@@ -3335,12 +3336,12 @@ function ta(e, t, r, n) {
3335
3336
  \`)[0].trim(), !G || G.length === 0))) {
3336
3337
  if (G && typeof G == "string") {
3337
3338
  const Q = /\\{@link(code|plain)?\\s+([^}|]+)(?:\\s*\\|\\s*([^}]+))?\\}/g;
3338
- let se, He = G, ce = [];
3339
+ let se, We = G, ce = [];
3339
3340
  for (; (se = Q.exec(G)) !== null;) {
3340
- const [we, Ta, Zr, ht] = se, Qr = [Zr.trim()];
3341
+ const [we, wa, Zr, ht] = se, Qr = [Zr.trim()];
3341
3342
  ht && Qr.push(ht.trim());
3342
3343
  }
3343
- G = He, ce.length > 0 && X === "see" && (y.links || (y.links = []), y.links.push(...ce));
3344
+ G = We, ce.length > 0 && X === "see" && (y.links || (y.links = []), y.links.push(...ce));
3344
3345
  }
3345
3346
  if (X === "name") {
3346
3347
  const Q = G;
@@ -3370,15 +3371,15 @@ function ta(e, t, r, n) {
3370
3371
  }
3371
3372
  }
3372
3373
  Object.keys(d.returnType).length === 0 && delete d.returnType, Object.keys(O).length > 0 && (d.behavior = O), y.summary || h(s.name ?? s, w.MissingSummary, "warning", \`'\${f}': missing a description. Add a JSDoc comment above the function.\`);
3373
- const J = !d.context, ee = J && y.name || f;
3374
- if (J && !Wo.test(ee)) {
3375
- const D = y.name ? \`'@name \${y.name}'\` : \`'\${ee}'\`;
3376
- c(s.name ?? s, w.InvalidName, \`'\${f}': \${D} cannot be called from a formula. A function name starts with a letter or '_', and continues with letters, digits, '_' or '.'.\` + (y.name ? "" : " Add an '@name' tag to register it under another name."));
3374
+ const Y = !d.context, ee = Y && y.name || f;
3375
+ if (Y && !Jo.test(ee)) {
3376
+ const F = y.name ? \`'@name \${y.name}'\` : \`'\${ee}'\`;
3377
+ c(s.name ?? s, w.InvalidName, \`'\${f}': \${F} cannot be called from a formula. A function name starts with a letter or '_', and continues with letters, digits, '_' or '.'.\` + (y.name ? "" : " Add an '@name' tag to register it under another name."));
3377
3378
  return;
3378
3379
  }
3379
- if (J && !n?.isBuiltIn && Zo(ee)) {
3380
- const D = y.name ? \`'@name \${y.name}'\` : \`'\${ee}'\`;
3381
- c(s.name ?? s, w.InvalidName, \`'\${f}': \${D} cannot be called from a formula. It reads as a cell address.\` + (y.name ? "" : " Add an '@name' tag to register it under another name."));
3380
+ if (Y && !n?.isBuiltIn && Zo(ee)) {
3381
+ const F = y.name ? \`'@name \${y.name}'\` : \`'\${ee}'\`;
3382
+ c(s.name ?? s, w.InvalidName, \`'\${f}': \${F} cannot be called from a formula. It reads as a cell address.\` + (y.name ? "" : " Add an '@name' tag to register it under another name."));
3382
3383
  return;
3383
3384
  }
3384
3385
  const ge = l.get(ee.toUpperCase());
@@ -3386,20 +3387,20 @@ function ta(e, t, r, n) {
3386
3387
  c(s.name ?? s, w.DuplicateName, \`'\${f}': '\${ee}' is already the name of '\${ge}' in this module.\`);
3387
3388
  return;
3388
3389
  }
3389
- if (l.set(ee.toUpperCase(), f), J && o?.has(ee.toUpperCase())) {
3390
+ if (l.set(ee.toUpperCase(), f), Y && o?.has(ee.toUpperCase())) {
3390
3391
  c(s.name ?? s, w.BuiltInName, \`'\${ee}' is a built-in function. Choose a different name - a calculation function cannot replace a built-in.\`);
3391
3392
  return;
3392
3393
  }
3393
- if (J) {
3394
- const D = y.parameters ?? {};
3395
- for (const [_, $] of Object.entries(D)) if (!V.has(_) && !$.description) {
3396
- const ne = F.get(_);
3394
+ if (Y) {
3395
+ const F = y.parameters ?? {};
3396
+ for (const [_, $] of Object.entries(F)) if (!V.has(_) && !$.description) {
3397
+ const ne = D.get(_);
3397
3398
  h(ne, w.MissingParamDescription, "warning", \`'\${f}': parameter '\${_}' is missing a description. Add an '@param \${_}' tag.\`);
3398
3399
  }
3399
3400
  }
3400
3401
  a.push([d, y]);
3401
- } catch (E) {
3402
- c(s, w.ParseError, \`'\${f}': \${E.message}\`);
3402
+ } catch (v) {
3403
+ c(s, w.ParseError, \`'\${f}': \${v.message}\`);
3403
3404
  }
3404
3405
  }
3405
3406
  });
@@ -3431,64 +3432,64 @@ async function na() {
3431
3432
  }
3432
3433
  }), Te);
3433
3434
  }
3434
- var Te, oa = Yt((() => {
3435
+ var Te, oa = qt((() => {
3435
3436
  Te = null;
3436
3437
  }));
3437
- let xe = null, Ue = null;
3438
+ let xe = null, Pe = null;
3438
3439
  async function aa() {
3439
3440
  if (xe) return xe;
3440
- if (Ue) {
3441
- if (await Ue, !xe) throw new Error("ESBuild initialization promise resolved, but instance is not available.");
3441
+ if (Pe) {
3442
+ if (await Pe, !xe) throw new Error("ESBuild initialization promise resolved, but instance is not available.");
3442
3443
  return xe;
3443
3444
  }
3444
3445
  let e, t;
3445
- Ue = new Promise((r, n) => {
3446
+ Pe = new Promise((r, n) => {
3446
3447
  e = r, t = n;
3447
3448
  });
3448
3449
  try {
3449
3450
  const { initialize: r } = await Promise.resolve().then(() => (oa(), ra));
3450
3451
  return xe = await r(), e(), xe;
3451
3452
  } catch (r) {
3452
- throw console.error("Failed to import or initialize esbuild:", r), Ue = null, t(r), r;
3453
+ throw console.error("Failed to import or initialize esbuild:", r), Pe = null, t(r), r;
3453
3454
  }
3454
3455
  }
3455
3456
  const ia = { compilerOptions: { target: "esnext" } };
3456
- async function la(e, t, r = "/script.js", n = Ve) {
3457
+ async function la(e, t, r = "/script.js", n = Ve, o = !1) {
3457
3458
  try {
3458
- const o = await aa(), a = "@sheetxl/primitives", l = \`
3459
+ const a = await aa(), l = "@sheetxl/primitives", i = \`
3459
3460
  export const FormulaContext = globalThis.\${n}?.FormulaContext;
3460
3461
  export const ScalarType = globalThis.\${n}?.ScalarType;
3461
3462
  export const Observable = globalThis.\${n}?.Observable;
3462
3463
  export const IRange = globalThis.\${n}?.IRange;
3463
3464
  export const FormulaError = globalThis.\${n}?.FormulaError;
3464
3465
  // Add more exports as needed
3465
- \`, i = await o.build({
3466
+ \`, u = await a.build({
3466
3467
  entryPoints: [r],
3467
3468
  bundle: !0,
3468
3469
  write: !1,
3469
3470
  format: "esm",
3470
3471
  plugins: [{
3471
3472
  name: "sheetxl-esbuild-in-memory",
3472
- setup(u) {
3473
- const p = "sheetxl-" + (/* @__PURE__ */ new Date()).getTime();
3474
- u.onResolve({ filter: new RegExp(\`^(\${r.replace("/", "\\\\/")}|\${a})$\`) }, (h) => ({
3475
- path: h.path,
3476
- namespace: p
3477
- })), u.onResolve({ filter: /.*/ }, (h) => {
3478
- if (h.namespace !== p) return console.warn(\`esbuild: Treating import "\${h.path}" as external.\`), {
3479
- path: h.path,
3473
+ setup(p) {
3474
+ const h = "sheetxl-" + (/* @__PURE__ */ new Date()).getTime();
3475
+ p.onResolve({ filter: new RegExp(\`^(\${r.replace("/", "\\\\/")}|\${l})$\`) }, (c) => ({
3476
+ path: c.path,
3477
+ namespace: h
3478
+ })), p.onResolve({ filter: /.*/ }, (c) => {
3479
+ if (c.namespace !== h) return console.warn(\`esbuild: Treating import "\${c.path}" as external.\`), {
3480
+ path: c.path,
3480
3481
  external: !0
3481
3482
  };
3482
- }), u.onLoad({
3483
+ }), p.onLoad({
3483
3484
  filter: /.*/,
3484
- namespace: p
3485
- }, (h) => {
3486
- let c;
3487
- if (h.path === r) c = t;
3488
- else if (h.path === a) c = l;
3489
- else return { errors: [{ text: \`Cannot load unknown path in \${p}: \${h.path}\` }] };
3485
+ namespace: h
3486
+ }, (c) => {
3487
+ let g;
3488
+ if (c.path === r) g = t;
3489
+ else if (c.path === l) g = i;
3490
+ else return { errors: [{ text: \`Cannot load unknown path in \${h}: \${c.path}\` }] };
3490
3491
  return {
3491
- contents: c,
3492
+ contents: g,
3492
3493
  loader: "ts"
3493
3494
  };
3494
3495
  });
@@ -3496,14 +3497,14 @@ async function la(e, t, r = "/script.js", n = Ve) {
3496
3497
  }],
3497
3498
  sourcemap: "inline",
3498
3499
  tsconfigRaw: ia,
3499
- minify: !0,
3500
+ minify: o,
3500
3501
  platform: "neutral"
3501
3502
  });
3502
- if (i.outputFiles && i.outputFiles.length > 0) return i.outputFiles[0].text;
3503
- throw i.errors && i.errors.length > 0 ? /* @__PURE__ */ new Error(\`esbuild bundling failed: \${i.errors.map((u) => u.text).join(\`
3503
+ if (u.outputFiles && u.outputFiles.length > 0) return u.outputFiles[0].text;
3504
+ throw u.errors && u.errors.length > 0 ? /* @__PURE__ */ new Error(\`esbuild bundling failed: \${u.errors.map((p) => p.text).join(\`
3504
3505
  \`)}\`) : /* @__PURE__ */ new Error("esbuild did not produce an output file.");
3505
- } catch (o) {
3506
- throw console.error("esbuild bundling process failed:", o), o;
3506
+ } catch (a) {
3507
+ throw console.error("esbuild bundling process failed:", a), a;
3507
3508
  }
3508
3509
  }
3509
3510
  function sa(e, t, r) {
@@ -3537,56 +3538,12 @@ function sa(e, t, r) {
3537
3538
  return (c) => e.visitNode(c, h);
3538
3539
  };
3539
3540
  }
3540
- const ca = /* @__PURE__ */ new Set(["TS2339", "TS2551"]), ua = "TS2774";
3541
- function da(e, t, r) {
3542
- let n = null;
3543
- const o = (a) => {
3544
- r < a.getStart(t) || r >= a.end || (a.getStart(t) === r && (n = a), e.forEachChild(a, o));
3545
- };
3546
- return e.forEachChild(t, o), n;
3547
- }
3548
- const fa = (e, t) => t.kind === e.SyntaxKind.NullKeyword || e.isIdentifier(t) && t.text === "undefined";
3549
- function pa(e, t) {
3550
- const r = t.parent;
3551
- if (!r || !e.isPropertyAccessExpression(r) || r.name !== t) return !1;
3552
- let n = r, o = r.parent;
3553
- for (; o && (e.isParenthesizedExpression(o) || e.isNonNullExpression(o));) n = o, o = o.parent;
3554
- if (!o) return !1;
3555
- if ((e.isCallExpression(o) || e.isPropertyAccessExpression(o) || e.isElementAccessExpression(o)) && o.expression === n) return !!o.questionDotToken;
3556
- if (e.isTypeOfExpression(o)) return !0;
3557
- if (e.isPrefixUnaryExpression(o)) return o.operator === e.SyntaxKind.ExclamationToken;
3558
- if (e.isConditionalExpression(o)) return o.condition === n;
3559
- if (e.isIfStatement(o) || e.isWhileStatement(o) || e.isDoStatement(o)) return o.expression === n;
3560
- if (e.isBinaryExpression(o)) {
3561
- const a = o.operatorToken.kind, l = e.SyntaxKind;
3562
- if (a === l.AmpersandAmpersandToken || a === l.BarBarToken || a === l.QuestionQuestionToken) return o.left === n;
3563
- if (a === l.EqualsEqualsEqualsToken || a === l.ExclamationEqualsEqualsToken || a === l.EqualsEqualsToken || a === l.ExclamationEqualsToken) return fa(e, o.left === n ? o.right : o.left);
3564
- }
3565
- return !1;
3566
- }
3567
- function ma(e, t, r) {
3568
- const n = [];
3569
- for (const o of r) if (o.code !== w.MissingType) if (o.severity !== "error") n.push(o);
3570
- else if (o.code === ua) n.push({
3571
- ...o,
3572
- severity: "warning"
3573
- });
3574
- else if (ca.has(o.code)) {
3575
- const a = da(e, t, o.start);
3576
- n.push(a && pa(e, a) ? {
3577
- ...o,
3578
- severity: "warning",
3579
- message: \`\${o.message} Read as a probe, it is undefined.\`
3580
- } : o);
3581
- } else n.push(o);
3582
- return n;
3583
- }
3584
- const Ht = "//# sourceMappingURL";
3585
- var Wr = /* @__PURE__ */ Zt({
3586
- initialize: () => ga,
3587
- readLibFile: () => ha
3541
+ const Wt = "//# sourceMappingURL";
3542
+ var Jr = /* @__PURE__ */ Zt({
3543
+ initialize: () => ca,
3544
+ readLibFile: () => ua
3588
3545
  });
3589
- async function ga() {
3546
+ async function ca() {
3590
3547
  return Ce || (Ce = new Promise(async (e, t) => {
3591
3548
  let r = null;
3592
3549
  try {
@@ -3601,11 +3558,11 @@ async function ga() {
3601
3558
  r || (console.log("use script fallback"), Ce = null), e(r);
3602
3559
  }), Ce);
3603
3560
  }
3604
- function ha(e, t) {}
3605
- var Ce, Jr = Yt((() => {
3561
+ function ua(e, t) {}
3562
+ var Ce, Yr = qt((() => {
3606
3563
  Ce = null;
3607
3564
  }));
3608
- const ya = \`
3565
+ const da = \`
3609
3566
  /**
3610
3567
  * Represents the completion of an asynchronous operation
3611
3568
  */
@@ -3618,29 +3575,29 @@ interface Promise<T> {
3618
3575
  */
3619
3576
  finally(onfinally?: (() => void) | undefined | null): Promise<T>;
3620
3577
  }
3621
- \`, wa = \`
3578
+ \`, fa = \`
3622
3579
  interface FirstTest {
3623
3580
  isTrue?: boolean;
3624
3581
  }
3625
- \`, Sa = async () => wa;
3582
+ \`, pa = async () => fa;
3626
3583
  let je = null;
3627
- const rt = "sheetxl.d.ts", Wt = "sheetxl-modules.d.ts", ba = \`declare module '@sheetxl/primitives' { export = SheetXL; }
3628
- \`, Ea = [
3584
+ const rt = "sheetxl.d.ts", Jt = "sheetxl-modules.d.ts", ma = \`declare module '@sheetxl/primitives' { export = SheetXL; }
3585
+ \`, ga = [
3629
3586
  "lib.webworker.d.ts",
3630
3587
  "lib.es2020.d.ts",
3631
3588
  "lib.esnext.asynciterable.d.ts"
3632
- ], Jt = /* @__PURE__ */ new Map();
3589
+ ], Yt = /* @__PURE__ */ new Map();
3633
3590
  let nt = null, ot = null;
3634
- async function va() {
3635
- return ot || (ot = Promise.resolve().then(() => (Jr(), Wr)).then(async (e) => {
3636
- const t = await Yr();
3591
+ async function ha() {
3592
+ return ot || (ot = Promise.resolve().then(() => (Yr(), Jr)).then(async (e) => {
3593
+ const t = await qr();
3637
3594
  return e.readLibFile(t, "lib.es5.d.ts") !== void 0 ? e.readLibFile : null;
3638
3595
  })), ot;
3639
3596
  }
3640
- async function Yr() {
3597
+ async function qr() {
3641
3598
  if (je) return je;
3642
3599
  try {
3643
- const e = await (await Promise.resolve().then(() => (Jr(), Wr))).initialize();
3600
+ const e = await (await Promise.resolve().then(() => (Yr(), Jr))).initialize();
3644
3601
  if (!e) throw new Error("TypeScript could not be loaded. Check your connection and try again.");
3645
3602
  return e;
3646
3603
  } catch (e) {
@@ -3649,16 +3606,16 @@ async function Yr() {
3649
3606
  je = null;
3650
3607
  }
3651
3608
  }
3652
- async function xa(e) {
3609
+ async function ya(e) {
3653
3610
  const t = e?.source ?? null;
3654
3611
  if (!t) return {
3655
3612
  module: null,
3656
3613
  diagnostics: []
3657
3614
  };
3658
3615
  const r = (e.disableBundle || e.declarationsOnly) ?? !1, [n, o, a] = await Promise.all([
3659
- Sa(),
3660
- Yr(),
3661
- e.ambientTypes ? va() : null
3616
+ pa(),
3617
+ qr(),
3618
+ e.ambientTypes ? ha() : null
3662
3619
  ]), l = a ? e.ambientTypes ?? null : null;
3663
3620
  let i = "";
3664
3621
  const u = {
@@ -3674,31 +3631,30 @@ async function xa(e) {
3674
3631
  emitDeclarationOnly: !1,
3675
3632
  target: o.ScriptTarget.ES2020,
3676
3633
  ...l ? {
3677
- lib: Ea,
3634
+ lib: ga,
3678
3635
  skipLibCheck: !0,
3679
3636
  strict: !0
3680
- } : {},
3681
- ...l && e.lenient ? { noImplicitAny: !1 } : {}
3637
+ } : {}
3682
3638
  }, p = "script", h = \`\${p}.ts\`, c = "lib.d.ts", g = "global.d.ts", T = {
3683
3639
  [h]: t,
3684
- [c]: ya,
3640
+ [c]: da,
3685
3641
  [g]: n,
3686
3642
  ...l ? {
3687
3643
  [rt]: l,
3688
- [Wt]: ba
3644
+ [Jt]: ma
3689
3645
  } : {}
3690
3646
  }, I = (d) => T[d] ?? (a && d.startsWith("lib.") ? a(o, d) : void 0), M = {
3691
- getSourceFile: (d, y, E, L) => {
3647
+ getSourceFile: (d, y, v, k) => {
3692
3648
  if (d === rt) return nt?.text !== l && (nt = {
3693
3649
  text: l,
3694
3650
  file: o.createSourceFile(d, l, o.ScriptTarget.Latest, !1)
3695
3651
  }), nt.file;
3696
3652
  if (T[d] === void 0) {
3697
- let j = Jt.get(d);
3653
+ let j = Yt.get(d);
3698
3654
  if (!j) {
3699
3655
  const O = I(d);
3700
3656
  if (O === void 0) return;
3701
- j = o.createSourceFile(d, O, o.ScriptTarget.Latest, !1), Jt.set(d, j);
3657
+ j = o.createSourceFile(d, O, o.ScriptTarget.Latest, !1), Yt.set(d, j);
3702
3658
  }
3703
3659
  return j;
3704
3660
  }
@@ -3715,58 +3671,58 @@ async function xa(e) {
3715
3671
  getDefaultLibFileName: (d) => c,
3716
3672
  getNewLine: () => \`
3717
3673
  \`
3718
- }, q = o.createProgram([
3674
+ }, H = o.createProgram([
3719
3675
  h,
3720
3676
  g,
3721
- ...l ? [rt, Wt] : []
3722
- ], u, M), v = q.getTypeChecker(), C = q.getSourceFile(h), R = e.runGuard;
3723
- q.emit(void 0, void 0, void 0, void 0, R ? { before: [sa(o, R.key, R.timeoutMs)] } : void 0), i = T[\`\${p}.js\`] ?? "";
3724
- const U = (d) => ({
3677
+ ...l ? [rt, Jt] : []
3678
+ ], u, M), E = H.getTypeChecker(), C = H.getSourceFile(h), R = e.runGuard;
3679
+ H.emit(void 0, void 0, void 0, void 0, R ? { before: [sa(o, R.key, R.timeoutMs)] } : void 0), i = T[\`\${p}.js\`] ?? "";
3680
+ const P = (d) => ({
3725
3681
  start: d.start ?? 0,
3726
3682
  length: d.length ?? 0,
3727
3683
  severity: d.category === o.DiagnosticCategory.Warning ? "warning" : "error",
3728
3684
  code: \`TS\${d.code}\`,
3729
3685
  message: o.flattenDiagnosticMessageText(d.messageText, \`
3730
3686
  \`)
3731
- }), Z = q.getSyntacticDiagnostics(C).map(U), P = l ? q.getSemanticDiagnostics(C).filter((d) => d.category === o.DiagnosticCategory.Error || d.category === o.DiagnosticCategory.Warning).map(U) : [], N = ta(o, C, v, {
3687
+ }), Z = H.getSyntacticDiagnostics(C).map(P), U = l ? H.getSemanticDiagnostics(C).filter((d) => d.category === o.DiagnosticCategory.Error || d.category === o.DiagnosticCategory.Warning).map(P) : [], N = ta(o, C, E, {
3732
3688
  builtInNames: e.builtInNames,
3733
3689
  isBuiltIn: e.isBuiltIn,
3734
- lenient: !!l && e.lenient
3690
+ lenient: e.lenient
3735
3691
  });
3736
- let k = [
3692
+ let L = [
3737
3693
  ...Z,
3738
- ...P,
3694
+ ...U,
3739
3695
  ...N.diagnostics
3740
3696
  ];
3741
- l && e.lenient && (k = ma(o, C, k));
3742
- const pe = N.functions, W = N.autoRun, Ge = k.some((d) => d.severity === "error"), qe = \`\${Qt.uuidV4()}-script\`;
3697
+ e.lenient && (L = L.filter((d) => d.code !== w.MissingType));
3698
+ const pe = N.functions, J = N.autoRun, Ge = L.some((d) => d.severity === "error"), He = \`\${Qt.uuidV4()}-script\`;
3743
3699
  let s = null;
3744
3700
  if (Ge) i = "";
3745
3701
  else {
3746
3702
  try {
3747
- r || (i = await la(o, i, p));
3703
+ r || (i = await la(o, i, p, void 0, e.minify ?? !1));
3748
3704
  } catch {
3749
3705
  console.warn("Error bundling script");
3750
3706
  }
3751
- const d = i.indexOf(Ht);
3707
+ const d = i.indexOf(Wt);
3752
3708
  d > -1 && (s = i.substring(d + 20 + 1, i.length), i = i.substring(0, d), i = i.replaceAll("globalThis.__SHEETXL", Ve));
3753
3709
  }
3754
3710
  const f = {
3755
3711
  functions: pe,
3756
- commitId: qe,
3712
+ commitId: He,
3757
3713
  source: t,
3758
3714
  language: "typescript",
3759
3715
  compiled: i
3760
3716
  };
3761
- return s && (f.sourceMap = s), W && (f.autoRun = W), {
3717
+ return s && (f.sourceMap = s), J && (f.autoRun = J), {
3762
3718
  module: f,
3763
- diagnostics: k
3719
+ diagnostics: L
3764
3720
  };
3765
3721
  }
3766
3722
  self.addEventListener("message", async (e) => {
3767
3723
  const { id: t, params: r } = e.data;
3768
3724
  try {
3769
- const n = await xa(r);
3725
+ const n = await ya(r);
3770
3726
  self.postMessage({
3771
3727
  id: t,
3772
3728
  result: n,
@@ -3810,7 +3766,7 @@ async function m() {
3810
3766
  return await l();
3811
3767
  }
3812
3768
  var l = async () => {
3813
- const { compileModule: t } = await import("./zGQXHcrpOlM4m6Nn.mjs"), n = new u((e) => t(e));
3769
+ const { compileModule: t } = await import("./8IBYT7vkExASLJms.mjs"), n = new u((e) => t(e));
3814
3770
  return await n.start(), n;
3815
3771
  };
3816
3772
  export {