@sheetxl/sdk 0.8.0-beta.17 → 0.8.0-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/browser/esm/{CAjITJT3eLst9Rhi.mjs → -P0fym6eh9hn9row.mjs} +2 -2
  2. package/browser/esm/{CFywn1iiD35nNNUP.mjs → -nOfWMHdlTb9ShjF.mjs} +9 -9
  3. package/browser/esm/{Byp_bvP9G-tN6hcz.mjs → 0Mw5Ew_7tAiWgc5J.mjs} +14 -14
  4. package/browser/esm/{CHByUyHFA3ESf7DX.mjs → 1ktaHvjuYL6stU4C.mjs} +1 -1
  5. package/browser/esm/{CVV4xqwD8gIjYj1E.mjs → B3ifnlsuky2L9HmB.mjs} +33 -33
  6. package/browser/esm/{WR3-xqcK1gF3ewAR.mjs → B67q5ZrwyKvm3d6W.mjs} +3 -3
  7. package/browser/esm/{DTXsi--x2wgqgwtf.mjs → BQSd_URWugiyNoNj.mjs} +2 -2
  8. package/browser/esm/{C0o6WpBojS7XhV5m.mjs → BWHHWC6H2JgG11Kq.mjs} +2 -2
  9. package/browser/esm/{BlkstmZEklk6Y1QD.mjs → BYbb2weYQCb_7KI3.mjs} +21 -21
  10. package/browser/esm/{DJTEQZiR9IFTuN_4.mjs → B_hrmyuWaH5VIFpV.mjs} +2 -2
  11. package/browser/esm/{O970I8lbI7okqG7N.mjs → Bql31KGUYo0SCMwZ.mjs} +392 -392
  12. package/browser/esm/{YwDdO4YwcIE4OB0D.mjs → BtVpErObXYKJCwHG.mjs} +1 -1
  13. package/browser/esm/{B-Q1-7RgSnA75J32.mjs → By7_c19Kv2YQaDVF.mjs} +475 -475
  14. package/browser/esm/{taTjDyUIIxq2eClH.mjs → C6M_XM08QtHuaInQ.mjs} +3 -3
  15. package/browser/esm/{DDNerAeet8uDYKhf.mjs → CBHwju4PYiv85_jD.mjs} +2 -2
  16. package/browser/esm/{Dx_dZ7jrw5Hxeoot.mjs → CJhYhZtsey3OnWKd.mjs} +1 -1
  17. package/browser/esm/{DnMFW_oKYQxRjP1l.mjs → CQlxAbhdxgfu0ERF.mjs} +1 -1
  18. package/browser/esm/{CLT3qGy_brDIwbYd.mjs → CVXOtvee4oFImGyR.mjs} +504 -504
  19. package/browser/esm/{Dlk1kRgkiBIpUxd9.mjs → CXQLYHAhE5MLKxZ4.mjs} +37 -37
  20. package/browser/esm/{jotvQFBWO2jXAhWx.mjs → CZiJYw94Yt7xslXS.mjs} +1 -1
  21. package/browser/esm/{aYpwVCDSwMUuz147.mjs → ChRUNekYurtOtrP1.mjs} +113 -113
  22. package/browser/esm/{JmmPE8Vsj85wdV8H.mjs → CnobgPLHEsTPTFY5.mjs} +1 -1
  23. package/browser/esm/{DGUOlgm1_WFmf_xO.mjs → CxNnMvwtOf76r7yY.mjs} +1 -1
  24. package/browser/esm/{DW3kFc5t4Wnh5E9S.mjs → CzmmdfrOYDUGx-Yh.mjs} +1 -1
  25. package/browser/esm/{XHhDDWrJiZJgWxPM.mjs → D2P43UD6TGSXErhr.mjs} +2 -2
  26. package/browser/esm/{DrmOaEx6CQ91zBsP.mjs → DH8NuKmZAC9EaqwP.mjs} +18 -18
  27. package/browser/esm/{DUB6Oj_aiV3f8s5_.mjs → DJuiV0Y8olnwuqB-.mjs} +21 -21
  28. package/browser/esm/{DkmqFp_-iUIy_l3D.mjs → DKFaQ2QOyUPCk0sD.mjs} +3 -3
  29. package/browser/esm/{BI6NwRrdLCbPdz6f.mjs → DLR8g1DkooIBl8S1.mjs} +2 -2
  30. package/browser/esm/{DsWDvmky7CgzX_7W.mjs → DNAXbbB8DGE2xeHy.mjs} +2 -2
  31. package/browser/esm/{BY_-BTa5h6HnnZ1W.mjs → DQTUUXcERWI4l0to.mjs} +2 -2
  32. package/browser/esm/{DJrnSjYjFxJvpQiH.mjs → DpFowFtk9AeU-89B.mjs} +1 -1
  33. package/browser/esm/{Dy0TAi9WafVT8eke.mjs → DyRVg5YJn7voOO6z.mjs} +2 -2
  34. package/browser/esm/{qNv1x-Ny9TPbvZzj.mjs → Pn5Jc-47dk16sYQ4.mjs} +1 -1
  35. package/browser/esm/{CWkaF7gYWCkW7vDA.mjs → _WWjW2f-YW-AVqAL.mjs} +1 -1
  36. package/browser/esm/{gQzj95vSMXdKhpWf.mjs → _lh_Rr5SwLthmbmu.mjs} +7797 -5857
  37. package/browser/esm/index.mjs +367 -366
  38. package/browser/esm/{yudASWe8CWXYcGt3.mjs → mecFApGwMvcIzlpd.mjs} +36 -36
  39. package/browser/esm/{mufbL88lyIKJEWyP.mjs → n4LOSiYtWTzqQa4w.mjs} +661 -661
  40. package/{node/esm/Cle-_21jebWv_-D4.mjs → browser/esm/tJB0V8fKbukOYt9U.mjs} +2 -2
  41. package/browser/esm/{BWNQcQyx8wt6huOq.mjs → yRhetuEQfV7moa4B.mjs} +1 -1
  42. package/browser/esm/{BuKA3E-Ev8Dp5W2I.mjs → ybFoQ6IijUJnBeCF.mjs} +1 -1
  43. package/node/esm/{Yo7_havHbr9VL8R4.mjs → 0313aQKBU4DE3v2j.mjs} +1 -1
  44. package/node/esm/{DfrxGbxxowFmm3SF.mjs → 3gjEEXV2aSt7cKeD.mjs} +1 -1
  45. package/node/esm/{NnrDjio_xwTBs05n.mjs → 3smtwEJ0ASF0tKBY.mjs} +2 -2
  46. package/node/esm/{cRz94rkuvDrA8mr9.mjs → 4k3KKByrUw2Wr2TX.mjs} +1 -1
  47. package/node/esm/{jqBKdf9DG54xqpaw.mjs → 90jp-mCVEr43zZTj.mjs} +2 -2
  48. package/node/esm/{OCrS6pBT6lGRu82d.mjs → BAEmzj0gb8Cbgz7p.mjs} +3293 -3293
  49. package/node/esm/{CIxb44vA81H9lRip.mjs → BBC5dL9bXzOrQDGY.mjs} +1 -1
  50. package/node/esm/{7ZwdVIsOdcziHpMD.mjs → BV0cJ_YP_0qzJuPt.mjs} +180 -180
  51. package/node/esm/{DxnBYzOueAKEqaQT.mjs → BcxcYoF_4GFL7Zkl.mjs} +15 -15
  52. package/node/esm/{BwyoLlHutolJw7OW.mjs → BesaVk0x7UyfLDk2.mjs} +1 -1
  53. package/node/esm/{ClJJC8tBpgsqHwdn.mjs → C-LmDC9oNcbENOK1.mjs} +1 -1
  54. package/node/esm/{BSlFO0_8UZ38gfeE.mjs → CDkUQn5AwYGomlsT.mjs} +36 -36
  55. package/node/esm/{CjCqcGyCYGkaMQI9.mjs → CE4I5qfVmUBf7mED.mjs} +1 -1
  56. package/node/esm/{DgsBYF3xbjgx9Mzp.mjs → CO0UDgbkHGwyTfev.mjs} +1 -1
  57. package/node/esm/{DfbVTAhNutxM74E8.mjs → CTWihjVB5uFX7U4j.mjs} +2 -2
  58. package/node/esm/{-q1xF3_2jmk3QHIY.mjs → CUNaLYCntlclipWu.mjs} +497 -497
  59. package/node/esm/{BhosJbKOPgbJSZMY.mjs → CY9JqXFJTt5pGhC3.mjs} +1 -1
  60. package/node/esm/{B6BQYUDRxbRnzca4.mjs → C_Sqy290v4uzyi1E.mjs} +3 -3
  61. package/node/esm/{BoLecFnIxhYKGor-.mjs → Cf-cK3yPe9bjK6o2.mjs} +561 -561
  62. package/node/esm/{Cb1-r2RCxcJZB6fM.mjs → CpvUwhAeDmdEpdR-.mjs} +10018 -8039
  63. package/{browser/esm/DCs7bk-yx0UhCvQ4.mjs → node/esm/Crhg3srH-O5sJERh.mjs} +2 -2
  64. package/node/esm/{M3jahkTgfUxGyeZv.mjs → Cx2U91jhiTDz600y.mjs} +116 -116
  65. package/node/esm/{BQko-9y6mf2oQK7u.mjs → CyWWKan_uk4dHZ6P.mjs} +1 -1
  66. package/node/esm/{Bgy7uWJVGwkN7AlD.mjs → D48MjKzkj37XsVm1.mjs} +2 -2
  67. package/node/esm/{XhDjStxKy-dd3WKa.mjs → D7c0zfLVoG7EEln5.mjs} +43 -43
  68. package/node/esm/{CIlH2fSEpdYBZwUA.mjs → D8J4JmOPwG_Yr2GD.mjs} +1 -1
  69. package/node/esm/{oGGVbqahqfK45-Uz.mjs → D91qb21TrJX98Rw8.mjs} +3 -3
  70. package/node/esm/{btVWSwUwMjM0J5fS.mjs → D9D2NyyKbWXpTj5I.mjs} +2 -2
  71. package/node/esm/{DCSJKgcCQzOV-dMJ.mjs → DBF7pIpitcmhi65H.mjs} +2 -2
  72. package/node/esm/{CDgUHRW6vSASfqNr.mjs → DLPVrV723TSxkXqL.mjs} +1 -1
  73. package/node/esm/{DTkV7IK2_ODMJAP5.mjs → DWsnb-a-9dfRn5jJ.mjs} +24 -24
  74. package/node/esm/{DCaLNIs-_4Y6hJ8S.mjs → Dj1pybJRqeZiP1Z6.mjs} +1 -1
  75. package/node/esm/{BBUVvO9Ma1RzbKux.mjs → DtNJOImWtsXVrQps.mjs} +2 -2
  76. package/node/esm/{zh6vcRzFqdV1aYh5.mjs → DxROQlX1KHLb9tHS.mjs} +1 -1
  77. package/node/esm/{B8MYgBe4XICBSROW.mjs → dp4LxzOEkfTbVX_1.mjs} +21 -21
  78. package/node/esm/{CHS84ZGEoH6aeHsZ.mjs → ee_DgHTffiVTOiU2.mjs} +21 -21
  79. package/node/esm/{fwfAgq8qIADcHmY4.mjs → fMFapG4AGMQKX8c5.mjs} +33 -33
  80. package/node/esm/index.mjs +545 -544
  81. package/node/esm/{nxxwAZZF8NsdErJW.mjs → jmElgIMAkpc2Ab1m.mjs} +1 -1
  82. package/node/esm/{D51xu0rubo34Ppeg.mjs → yVJ2lEYZob1gwiRZ.mjs} +14 -14
  83. package/package.json +6 -6
  84. package/resources/locales/de/model.msg.json +15 -0
  85. package/resources/locales/en/model.msg.json +15 -0
  86. package/types/scripting-api.json +11445 -11299
  87. package/types/scripting-enums.json +22 -1
  88. package/types/scripting.d.ts +623 -0
  89. package/types/src/address/index.d.ts +2 -0
  90. package/types/src/anomalies/_Anomalies.d.ts +34 -0
  91. package/types/src/anomalies/_CompletenessChecks.d.ts +32 -0
  92. package/types/src/cell/ICell.d.ts +36 -1
  93. package/types/src/cellRange/ICellRange.d.ts +106 -0
  94. package/types/src/index.d.ts +1 -0
  95. package/types/src/license/runtime.browser.d.ts +3 -1
  96. package/types/src/sheet/IWorksheet.d.ts +17 -0
  97. package/types/src/sheet/SheetCell.d.ts +3 -0
  98. package/types/src/sheet/SheetRange.d.ts +6 -0
  99. package/types/src/sheet/Worksheet.d.ts +103 -1
  100. package/types/src/sheet/_ListenerAnchor.d.ts +14 -0
  101. package/types/src/sheet/_SheetStateTypes.d.ts +13 -0
  102. package/types/src/sparkline/ISparklineGroup.d.ts +338 -0
  103. package/types/src/sparkline/ISparklineGroupCollection.d.ts +68 -0
  104. package/types/src/sparkline/SparklineGroup.d.ts +271 -0
  105. package/types/src/sparkline/SparklineGroupCollection.d.ts +25 -0
  106. package/types/src/sparkline/SparklineRanges.d.ts +195 -0
  107. package/types/src/sparkline/index.d.ts +4 -0
  108. package/types/src/sparkline/layout/SparklineLayout.d.ts +71 -0
  109. package/types/src/sparkline/layout/_layoutSparkline.d.ts +42 -0
  110. package/types/src/sparkline/layout/index.d.ts +2 -0
@@ -1,130 +1,130 @@
1
1
  /**
2
- * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.17
2
+ * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.18
3
3
  *
4
4
  * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
5
  * License: SheetXL EULA — https://www.sheetxl.com/eula
6
6
  */
7
- import { Aa as e, Ar as t, Ct as n, Kr as r, Mr as i, Or as l, Qi as s, St as o, Ur as a, _ as u, bt as c, ci as f, di as p, dt as d, ei as g, f as v, fi as h, h as m, ia as y, jr as I, jt as b, la as x, n as R, p as E, pi as T, ri as A, s as S, si as w, ti as C, u as N, ur as F } from "./Cb1-r2RCxcJZB6fM.mjs";
8
- import { an as P } from "./D51xu0rubo34Ppeg.mjs";
9
- import { FormulaError as L, Scalar as k, ScalarType as $, ValueKind as O, isLazyValue as B } from "@sheetxl/primitives";
7
+ import { $i as e, Ct as t, Mr as n, Nr as r, St as i, Wr as l, _ as s, aa as o, bt as a, ci as u, dr as c, dt as f, f as p, fi as d, h as g, ii as v, ja as h, jr as m, jt as y, kr as I, li as b, mi as x, n as R, ni as E, p as T, pi as A, qr as S, s as w, ti as C, u as N, ua as F } from "./CpvUwhAeDmdEpdR-.mjs";
8
+ import { an as P } from "./yVJ2lEYZob1gwiRZ.mjs";
9
+ import { FormulaError as k, Scalar as L, ScalarType as $, ValueKind as O, isLazyValue as B } from "@sheetxl/primitives";
10
10
  import { CommonUtils as V } from "@sheetxl/utils";
11
- var z = (e, t) => e + t, D = (e, t) => e - t, M = (e, t) => d(e + t, e), W = (e, t) => d(e - t, e), U = (e, t) => v(e * t), _ = (e, t) => 0 === t ? L.BuiltIn.Div0 : v(e / t), j = (e, t) => {
11
+ var z = (e, t) => e + t, D = (e, t) => e - t, M = (e, t) => f(e + t, e), W = (e, t) => f(e - t, e), U = (e, t) => p(e * t), _ = (e, t) => 0 === t ? k.BuiltIn.Div0 : p(e / t), j = (e, t) => {
12
12
  if (0 === e) {
13
- if (t < 0) return L.BuiltIn.Div0;
13
+ if (t < 0) return k.BuiltIn.Div0;
14
14
  if (0 === t) return NaN;
15
15
  }
16
16
  if (e < 0) {
17
- if (Number.isInteger(t) && Math.abs(t) <= 4294967294) return v(e ** t);
17
+ if (Number.isInteger(t) && Math.abs(t) <= 4294967294) return p(e ** t);
18
18
  const n = Number((1 / t).toPrecision(15));
19
- return Number.isInteger(n) && 1 === Math.abs(n % 2) ? v(-((-e) ** t)) : NaN;
19
+ return Number.isInteger(n) && 1 === Math.abs(n % 2) ? p(-((-e) ** t)) : NaN;
20
20
  }
21
- return v(e ** t);
22
- }, G = (t = "", n = "") => {
23
- null === t && (t = ""), null === n && (n = "");
24
- const r = typeof n;
25
- "boolean" === typeof t && (t = e(t)), "boolean" === r && (n = e(n));
26
- const i = "" + t + n;
27
- return i.length > k.MAX_TEXT_LENGTH ? i.slice(0, k.MAX_TEXT_LENGTH) : i;
28
- }, H = (e, t = null, n = null) => 0 === e.compare(t, n), X = (e, t = null, n = null) => 0 !== e.compare(t, n), K = (e, t = null, n = null) => e.compare(t, n) > 0, Z = (e, t = null, n = null) => e.compare(t, n) >= 0, q = (e, t = null, n = null) => e.compare(t, n) < 0, Q = (e, t = null, n = null) => e.compare(t, n) <= 0, J = {
21
+ return p(e ** t);
22
+ }, G = (e = "", t = "") => {
23
+ null === e && (e = ""), null === t && (t = "");
24
+ const n = typeof t;
25
+ "boolean" === typeof e && (e = h(e)), "boolean" === n && (t = h(t));
26
+ const r = "" + e + t;
27
+ return r.length > L.MAX_TEXT_LENGTH ? r.slice(0, L.MAX_TEXT_LENGTH) : r;
28
+ }, H = (e, t = null, n = null) => 0 === e.compare(t, n), X = (e, t = null, n = null) => 0 !== e.compare(t, n), q = (e, t = null, n = null) => e.compare(t, n) > 0, K = (e, t = null, n = null) => e.compare(t, n) >= 0, Z = (e, t = null, n = null) => e.compare(t, n) < 0, J = (e, t = null, n = null) => e.compare(t, n) <= 0, Q = {
29
29
  type: $.Number,
30
30
  coerce: [$.Boolean, $.String],
31
31
  onError: "value",
32
- misalignValue: L.BuiltIn.NA
32
+ misalignValue: k.BuiltIn.NA
33
33
  }, Y = {
34
34
  type: $.String,
35
35
  coerce: [$.Boolean, $.Number],
36
36
  onError: "value",
37
- misalignValue: L.BuiltIn.NA
37
+ misalignValue: k.BuiltIn.NA
38
38
  }, ee = {
39
39
  onError: "value",
40
- misalignValue: L.BuiltIn.NA
40
+ misalignValue: k.BuiltIn.NA
41
41
  }, te = (e) => null !== e && "object" == typeof e && !0 === e.isIReferenceRange && 1 === e.size ? e.getValueAt(0, 0) ?? null : e, ne = (e, t, n, r) => {
42
- if (null !== t && void 0 !== t.colStart && (t = e.getValueAt(t.rowStart, t.colStart, t.scope)) && L.isError(t)) return t;
43
- if (null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && L.isError(n)) return n;
42
+ if (null !== t && void 0 !== t.colStart && (t = e.getValueAt(t.rowStart, t.colStart, t.scope)) && k.isError(t)) return t;
43
+ if (null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && k.isError(n)) return n;
44
44
  if (t = te(t), n = te(n), "number" == typeof t && "number" == typeof n) return r(t, n);
45
45
  let i, l;
46
46
  if (t?.isIRange ? i = t : n?.isIRange && (l = n), !i && !l) {
47
47
  const i = e.getRuntime();
48
- return t = S(i, t, u(t, !0), $.Number, !0), n = S(i, n, u(n, !0), $.Number, !0), t && L.isError(t) ? t : n && L.isError(n) ? n : r(t, n);
48
+ return t = w(i, t, s(t, !0), $.Number, !0), n = w(i, n, s(n, !0), $.Number, !0), t && k.isError(t) ? t : n && k.isError(n) ? n : r(t, n);
49
49
  }
50
- const s = !i, o = s ? t : n;
51
- return (i ?? l).broadcast(o, (t, n) => t && L.isError(t) ? t : n && L.isError(n) ? n : m(s ? r(n, t) : r(t, n), e), J).fillEmpty(0);
50
+ const o = !i, a = o ? t : n;
51
+ return (i ?? l).broadcast(a, (t, n) => t && k.isError(t) ? t : n && k.isError(n) ? n : g(o ? r(n, t) : r(t, n), e), Q).fillEmpty(0);
52
52
  }, re = (e, t, n, r) => {
53
- if (F(t) || F(n)) return L.BuiltIn.Value;
54
- if (B(t) || B(n)) return L.BuiltIn.Value;
55
- if (null !== t && void 0 !== t.colStart && (t = e.getValueAt(t.rowStart, t.colStart, t.scope)) && L.isError(t)) return t;
56
- if (null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && L.isError(n)) return n;
53
+ if (c(t) || c(n)) return k.BuiltIn.Value;
54
+ if (B(t) || B(n)) return k.BuiltIn.Value;
55
+ if (null !== t && void 0 !== t.colStart && (t = e.getValueAt(t.rowStart, t.colStart, t.scope)) && k.isError(t)) return t;
56
+ if (null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && k.isError(n)) return n;
57
57
  let i, l;
58
58
  t = te(t), n = te(n);
59
59
  let s = !1;
60
- return t?.isIRange ? (i = t, l = n) : n?.isIRange && (i = n, l = t, s = !0), i ? i.broadcast(l, (t, n) => t && L.isError(t) ? t : n && L.isError(n) ? n : (t = ie(t), n = ie(n), s ? r(e, n, t) : r(e, t, n)), ee) : L.isError(t) ? t : L.isError(n) ? n : r(e, ie(t), ie(n));
60
+ return t?.isIRange ? (i = t, l = n) : n?.isIRange && (i = n, l = t, s = !0), i ? i.broadcast(l, (t, n) => t && k.isError(t) ? t : n && k.isError(n) ? n : (t = ie(t), n = ie(n), s ? r(e, n, t) : r(e, t, n)), ee) : k.isError(t) ? t : k.isError(n) ? n : r(e, ie(t), ie(n));
61
61
  }, ie = (e) => {
62
62
  if (!0 !== e?.isIRichData) return e;
63
63
  const t = e.toPrimitive?.();
64
64
  return null == t ? e : t;
65
65
  }, le = (e, t, n) => {
66
- if (null == n && (n = 0), null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && L.isError(n)) return n;
66
+ if (null == n && (n = 0), null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && k.isError(n)) return n;
67
67
  n = te(n);
68
68
  let r, i = 1;
69
69
  if ("+" === t) return n;
70
- if ("-" !== t) throw new L.Value(`Unrecognized prefix: ${t}`);
70
+ if ("-" !== t) throw new k.Value(`Unrecognized prefix: ${t}`);
71
71
  if (i = -i, n?.isIRange && (r = n), !r) {
72
72
  const t = e.getRuntime();
73
- return "number" != typeof (n = S(t, n, u(n, !0), $.Number, !0)) ? L.BuiltIn.Value : n * i;
73
+ return "number" != typeof (n = w(t, n, s(n, !0), $.Number, !0)) ? k.BuiltIn.Value : n * i;
74
74
  }
75
- return r.broadcast(i, (e, t) => e && L.isError(e) ? e : t && L.isError(t) ? t : U(e, t), J);
76
- }, se = (e) => e.getCode() <= L.Code.NA ? e : L.BuiltIn.Value, oe = (e, t, n, r, i) => {
77
- if (L.isError(t)) return se(t);
78
- if (n && L.isError(n)) return se(n);
79
- if (!t) return L.BuiltIn.Ref;
80
- if (t.isIReferenceRange && n && !n.isIReferenceRange ? n = e.getReference(n) : n && n.isIReferenceRange && t && !t.isIReferenceRange && (t = e.getReference(t)), t.isIReferenceRange && (t = t.getCoords()), void 0 === t.colStart) return L.BuiltIn.Value;
81
- if (n.isIReferenceRange && (n = n.getCoords()), void 0 === n.colStart) return L.BuiltIn.Value;
75
+ return r.broadcast(i, (e, t) => e && k.isError(e) ? e : t && k.isError(t) ? t : U(e, t), Q);
76
+ }, se = (e) => e.getCode() <= k.Code.NA ? e : k.BuiltIn.Value, oe = (e, t, n, r, i) => {
77
+ if (k.isError(t)) return se(t);
78
+ if (n && k.isError(n)) return se(n);
79
+ if (!t) return k.BuiltIn.Ref;
80
+ if (t.isIReferenceRange && n && !n.isIReferenceRange ? n = e.getReference(n) : n && n.isIReferenceRange && t && !t.isIReferenceRange && (t = e.getReference(t)), t.isIReferenceRange && (t = t.getCoords()), void 0 === t.colStart) return k.BuiltIn.Value;
81
+ if (n.isIReferenceRange && (n = n.getCoords()), void 0 === n.colStart) return k.BuiltIn.Value;
82
82
  const l = t.scope ? "either" !== i || n.scope ? null : t : n;
83
83
  if (l?.scope) {
84
84
  const t = e.getReference(l);
85
- if (L.isError(t)) return t;
86
- if (e.getSheetIndex() !== e.getSheetIndex(t)) return L.BuiltIn.Value;
85
+ if (k.isError(t)) return t;
86
+ if (e.getSheetIndex() !== e.getSheetIndex(t)) return k.BuiltIn.Value;
87
87
  }
88
88
  const s = r(t, n);
89
- return L.isError(s) ? s : s ? e.getReference(s) : L.BuiltIn.Null;
89
+ return k.isError(s) ? s : s ? e.getReference(s) : k.BuiltIn.Null;
90
90
  }, ae = {
91
91
  "+": (e, t, n) => ne(e, t, n, z),
92
92
  "-": (e, t, n) => ne(e, t, n, D),
93
93
  "*": (e, t, n) => ne(e, t, n, U),
94
94
  "/": (e, t, n) => ne(e, t, n, _),
95
95
  "^": (e, t, n) => ne(e, t, n, j),
96
- " ": (e, t, n, r) => oe(e, t, n, s, "either"),
97
- ":": (e, t, n, r) => oe(e, t, n, x, "start"),
96
+ " ": (t, n, r, i) => oe(t, n, r, e, "either"),
97
+ ":": (e, t, n, r) => oe(e, t, n, F, "start"),
98
98
  ".:.": (e, t, n, r) => {
99
- const i = oe(e, t, n, x, "start");
99
+ const i = oe(e, t, n, F, "start");
100
100
  return e.getFunction("TRIMRANGE").execute(i, 3, 3);
101
101
  },
102
102
  ".:": (e, t, n, r) => {
103
- const i = oe(e, t, n, x, "start");
103
+ const i = oe(e, t, n, F, "start");
104
104
  return e.getFunction("TRIMRANGE").execute(i, 1, 1);
105
105
  },
106
106
  ":.": (e, t, n, r) => {
107
- const i = oe(e, t, n, x, "start");
107
+ const i = oe(e, t, n, F, "start");
108
108
  return e.getFunction("TRIMRANGE").execute(i, 2, 2);
109
109
  },
110
110
  "&": (e, t, n) => ((e, t, n, r) => {
111
- if (null !== t && void 0 !== t.colStart && (t = e.getValueAt(t.rowStart, t.colStart, t.scope)) && L.isError(t)) return t;
112
- if (null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && L.isError(n)) return n;
111
+ if (null !== t && void 0 !== t.colStart && (t = e.getValueAt(t.rowStart, t.colStart, t.scope)) && k.isError(t)) return t;
112
+ if (null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && k.isError(n)) return n;
113
113
  if (t = te(t), n = te(n), "string" == typeof t && "string" == typeof n) return r(t, n);
114
114
  let i, l;
115
115
  if (t?.isIRange ? i = t : n?.isIRange && (l = n), !i && !l) {
116
116
  const i = e.getRuntime();
117
- return t = S(i, t, u(t, !0), $.String, !1), n = S(i, n, u(n, !0), $.String, !1), L.isError(t) ? t : L.isError(n) ? n : r(t, n);
117
+ return t = w(i, t, s(t, !0), $.String, !1), n = w(i, n, s(n, !0), $.String, !1), k.isError(t) ? t : k.isError(n) ? n : r(t, n);
118
118
  }
119
- const s = !i, o = s ? t : n;
120
- return (i ?? l).broadcast(o, (e, t) => e && L.isError(e) ? e : t && L.isError(t) ? t : s ? r(t, e) : r(e, t), Y);
119
+ const o = !i, a = o ? t : n;
120
+ return (i ?? l).broadcast(a, (e, t) => e && k.isError(e) ? e : t && k.isError(t) ? t : o ? r(t, e) : r(e, t), Y);
121
121
  })(e, t, n, G),
122
122
  "=": (e, t, n) => re(e, t, n, H),
123
123
  "<>": (e, t, n) => re(e, t, n, X),
124
- ">": (e, t, n) => re(e, t, n, K),
125
- "<": (e, t, n) => re(e, t, n, q),
126
- ">=": (e, t, n) => re(e, t, n, Z),
127
- "<=": (e, t, n) => re(e, t, n, Q)
124
+ ">": (e, t, n) => re(e, t, n, q),
125
+ "<": (e, t, n) => re(e, t, n, Z),
126
+ ">=": (e, t, n) => re(e, t, n, K),
127
+ "<=": (e, t, n) => re(e, t, n, J)
128
128
  }, ue = {
129
129
  "+": (e, t, n) => ne(e, t, n, M),
130
130
  "-": (e, t, n) => ne(e, t, n, W)
@@ -136,16 +136,16 @@ var z = (e, t) => e + t, D = (e, t) => e - t, M = (e, t) => d(e + t, e), W = (e,
136
136
  const n = t;
137
137
  if (!t.isIReferenceRange) return n.getValueAt(0, 0);
138
138
  const r = t.getCoords(), i = n.getRowCount(), l = n.getColumnCount(), s = e.getRow() - r.rowStart, o = e.getColumn() - r.colStart, a = s >= 0 && s < i, u = o >= 0 && o < l;
139
- return a && u ? n.getValueAt(s, o) : a && 1 === l ? n.getValueAt(s, 0) : u && 1 === i ? n.getValueAt(0, o) : 1 === i && 1 === l ? n.getValueAt(0, 0) : L.BuiltIn.Value;
139
+ return a && u ? n.getValueAt(s, o) : a && 1 === l ? n.getValueAt(s, 0) : u && 1 === i ? n.getValueAt(0, o) : 1 === i && 1 === l ? n.getValueAt(0, 0) : k.BuiltIn.Value;
140
140
  }
141
141
  }, fe = {
142
142
  "%": (e, t) => ne(e, t, 100, _),
143
143
  "#": (e, t) => {
144
- if (L.isError(t)) return se(t);
145
- if (!t) return L.BuiltIn.Ref;
146
- if (t.isIReferenceRange && (t = t.getCoords()), void 0 === t.colStart) return L.BuiltIn.Value;
147
- if (t.rowStart !== t.rowEnd || t.colStart !== t.colEnd) return L.BuiltIn.Ref;
148
- return e.getSpillAt(t.rowStart, t.colStart, t.scope) || L.BuiltIn.Ref;
144
+ if (k.isError(t)) return se(t);
145
+ if (!t) return k.BuiltIn.Ref;
146
+ if (t.isIReferenceRange && (t = t.getCoords()), void 0 === t.colStart) return k.BuiltIn.Value;
147
+ if (t.rowStart !== t.rowEnd || t.colStart !== t.colEnd) return k.BuiltIn.Ref;
148
+ return e.getSpillAt(t.rowStart, t.colStart, t.scope) || k.BuiltIn.Ref;
149
149
  }
150
150
  };
151
151
  function pe(e, t) {
@@ -165,12 +165,12 @@ var de = class {
165
165
  value: null,
166
166
  inputs: null
167
167
  };
168
- if (this.references.set(e, t), n === T.Cell) {
168
+ if (this.references.set(e, t), n === x.Cell) {
169
169
  const n = e.value;
170
170
  n.$colIndex && (t.hasHorizontalAbs = !0), n.$rowIndex && (t.hasVerticalAbs = !0), t.value = this.cells.size, this.cells.set(e, this.cells.size), this.rootReferences.add(t), e.referenceIndex = this.referenceIndices.length, this.referenceIndices.push(t.index);
171
171
  return;
172
172
  }
173
- if (n === T.Infix || n === T.Prefix || n === T.Postfix || n === T.List) {
173
+ if (n === x.Infix || n === x.Prefix || n === x.Postfix || n === x.List) {
174
174
  const n = e.inputs || [], r = n.length, i = e.value;
175
175
  t.op = i;
176
176
  const l = N(r);
@@ -179,24 +179,24 @@ var de = class {
179
179
  const r = n[e], i = this.references.get(r);
180
180
  i ? (i.hasHorizontalAbs && (t.hasHorizontalAbs = !0), i.hasVerticalAbs && (t.hasVerticalAbs = !0), l[e] = i.index) : l[e] = -1, i && this.rootReferences.delete(i);
181
181
  }
182
- if (this.rootReferences.add(t), qe.includes(i)) {
183
- const r = n[0], i = !!r && r.type === T.Cell, l = n[1], s = !!l && l.type === T.Cell;
182
+ if (this.rootReferences.add(t), Ze.includes(i)) {
183
+ const r = n[0], i = !!r && r.type === x.Cell, l = n[1], s = !!l && l.type === x.Cell;
184
184
  i && s && void 0 !== l.referenceIndex && void 0 !== r.referenceIndex && (this.referenceIndices.splice(l.referenceIndex, 1), l.referenceIndex = r.referenceIndex, e.referenceIndex = r.referenceIndex, this.referenceIndices[r.referenceIndex] = t.index);
185
185
  } else "#" === i && n[0] && (e.referenceIndex = n[0].referenceIndex);
186
186
  return;
187
187
  }
188
- if (n === T.Error || n === T.Named) {
189
- const r = n === T.Named ? e.value.nameId : g(e.value);
188
+ if (n === x.Error || n === x.Named) {
189
+ const r = n === x.Named ? e.value.nameId : C(e.value);
190
190
  let i = this.names.get(r);
191
191
  t.op = n, void 0 === i && (i = this.names.size, this.names.set(r, i)), t.value = i, this.rootReferences.add(t), e.referenceIndex = this.referenceIndices.length, this.referenceIndices.push(t.index);
192
192
  return;
193
193
  }
194
- if (n === T.TableReference) return t.op = n, this.rootReferences.add(t), e.referenceIndex = this.referenceIndices.length, void this.referenceIndices.push(t.index);
194
+ if (n === x.TableReference) return t.op = n, this.rootReferences.add(t), e.referenceIndex = this.referenceIndices.length, void this.referenceIndices.push(t.index);
195
195
  } else if (t && t.isReference) {
196
196
  const t = {
197
197
  node: e,
198
198
  index: this.references.size,
199
- op: T.Function,
199
+ op: x.Function,
200
200
  value: e.value,
201
201
  inputs: null
202
202
  };
@@ -204,229 +204,229 @@ var de = class {
204
204
  }
205
205
  }
206
206
  };
207
- function ge(e, n = !1, r = p) {
208
- const i = [], s = /* @__PURE__ */ new Set(), o = (e, t, r) => {
209
- const l = {
207
+ function ge(e, t = !1, n = d) {
208
+ const r = [], i = /* @__PURE__ */ new Set(), l = (e, n, l) => {
209
+ const s = {
210
210
  type: e.type,
211
- value: e.type === T.Error ? C(e.value) : e.value
211
+ value: e.type === x.Error ? E(e.value) : e.value
212
212
  };
213
- void 0 !== e.image && (l.text = ((e) => {
214
- const t = n ? e.value?.scopeImage : void 0;
215
- return "string" == typeof t ? t : "";
213
+ void 0 !== e.image && (s.text = ((e) => {
214
+ const n = t ? e.value?.scopeImage : void 0;
215
+ return "string" == typeof n ? n : "";
216
216
  })(e) + e.image);
217
- const o = e.evalIndex ?? r;
218
- return void 0 !== o && (l.evalIndex = o), t && (l.context = t), void 0 !== e.referenceIndex && (l.referenceIndex = e.referenceIndex), e.isReference && s.add(l), i.push(l), l;
219
- }, a = (e, t, n, r, l) => {
217
+ const o = e.evalIndex ?? l;
218
+ return void 0 !== o && (s.evalIndex = o), n && (s.context = n), void 0 !== e.referenceIndex && (s.referenceIndex = e.referenceIndex), e.isReference && i.add(s), r.push(s), s;
219
+ }, s = (e, t, n, i, l) => {
220
220
  if (null == t) return;
221
- if (i.length > 1 && e === T.Whitespace && i[i.length - 1].type === T.Whitespace) return;
221
+ if (r.length > 1 && e === x.Whitespace && r[r.length - 1].type === x.Whitespace) return;
222
222
  const s = {
223
223
  type: e,
224
224
  value: t,
225
225
  text: l ?? t
226
226
  };
227
- void 0 !== r && (s.evalIndex = r), n && (s.context = n), i.push(s);
227
+ void 0 !== i && (s.evalIndex = i), n && (s.context = n), r.push(s);
228
228
  };
229
- (function e(u, c, f) {
230
- const p = u.evalIndex ?? f ?? 0, d = u.type, g = (t, n, i) => {
229
+ (function e(o, a, u) {
230
+ const c = o.evalIndex ?? u ?? 0, f = o.type, p = (t, r, i) => {
231
231
  if (!t) return;
232
232
  const l = t.length;
233
- for (let s = 0; s < l; s++) e(t[s], n, i), s < l - 1 && a(T.Separator, ",", n, i, r.separatorFunction);
233
+ for (let o = 0; o < l; o++) e(t[o], r, i), o < l - 1 && s(x.Separator, ",", r, i, n.separatorFunction);
234
234
  };
235
- if (u.isLiteral) {
236
- if (a(T.Whitespace, u.wsBefore, c, p), d === T.Array) {
237
- a(T.Type, "{", c, p);
238
- const t = u.value, n = t.length;
239
- for (let i = 0; i < n; i++) {
240
- const l = t[i], s = l.value, o = s.length;
241
- for (let t = 0; t < o; t++) {
242
- const n = s[t];
243
- a(T.Whitespace, n.wsBefore, c, p), e(n, c, p), a(T.Whitespace, n.wsAfter, c, p), t < o - 1 && a(T.Separator, ",", c, p, r.separatorColumn);
235
+ if (o.isLiteral) {
236
+ if (s(x.Whitespace, o.wsBefore, a, c), f === x.Array) {
237
+ s(x.Type, "{", a, c);
238
+ const t = o.value, r = t.length;
239
+ for (let i = 0; i < r; i++) {
240
+ const l = t[i], o = l.value, u = o.length;
241
+ for (let t = 0; t < u; t++) {
242
+ const r = o[t];
243
+ s(x.Whitespace, r.wsBefore, a, c), e(r, a, c), s(x.Whitespace, r.wsAfter, a, c), t < u - 1 && s(x.Separator, ",", a, c, n.separatorColumn);
244
244
  }
245
- i < n - 1 && (a(T.Whitespace, l.wsBefore, c, p), a(T.Separator, ";", c, p, r.separatorRow), a(T.Whitespace, l.wsAfter, c, p));
245
+ i < r - 1 && (s(x.Whitespace, l.wsBefore, a, c), s(x.Separator, ";", a, c, n.separatorRow), s(x.Whitespace, l.wsAfter, a, c));
246
246
  }
247
- u.error || a(T.Type, "}", c, p);
248
- } else d === T.String ? (u = {
249
- type: d,
250
- value: "\"" + `${u.value}`.replace(/"/g, "\"\"") + "\"",
251
- image: u.image
252
- }, o(u, c, p)) : o(u, c, p);
253
- a(T.Whitespace, u.wsAfter, c, p);
254
- } else if (d === T.Infix) e(u.inputs[0], c, p), a(T.Whitespace, u.wsBefore, c, p), o(u, c, p), a(T.Whitespace, u.wsAfter, c, p), e(u.inputs[1], c, p);
255
- else if (d === T.Prefix) a(T.Whitespace, u.wsBefore, c, p), o(u, c, p), a(T.Whitespace, u.wsAfter, c, p), u.inputs && e(u.inputs[0], c, p);
256
- else if (d === T.Postfix) {
257
- u.inputs?.[0] && e(u.inputs[0], c, p), a(T.Whitespace, u.wsBefore, c, p);
258
- const t = o(u, c, p), n = i[i.length - 2];
259
- "#" === u.value && void 0 !== t.text && !u.wsBefore && s.has(n) && (n.text = (n.text ?? "") + t.text, t.text = ""), a(T.Whitespace, u.wsAfter, c, p);
247
+ o.error || s(x.Type, "}", a, c);
248
+ } else f === x.String ? (o = {
249
+ type: f,
250
+ value: "\"" + `${o.value}`.replace(/"/g, "\"\"") + "\"",
251
+ image: o.image
252
+ }, l(o, a, c)) : l(o, a, c);
253
+ s(x.Whitespace, o.wsAfter, a, c);
254
+ } else if (f === x.Infix) e(o.inputs[0], a, c), s(x.Whitespace, o.wsBefore, a, c), l(o, a, c), s(x.Whitespace, o.wsAfter, a, c), e(o.inputs[1], a, c);
255
+ else if (f === x.Prefix) s(x.Whitespace, o.wsBefore, a, c), l(o, a, c), s(x.Whitespace, o.wsAfter, a, c), o.inputs && e(o.inputs[0], a, c);
256
+ else if (f === x.Postfix) {
257
+ o.inputs?.[0] && e(o.inputs[0], a, c), s(x.Whitespace, o.wsBefore, a, c);
258
+ const t = l(o, a, c), n = r[r.length - 2];
259
+ "#" === o.value && void 0 !== t.text && !o.wsBefore && i.has(n) && (n.text = (n.text ?? "") + t.text, t.text = ""), s(x.Whitespace, o.wsAfter, a, c);
260
260
  } else {
261
- a(T.Whitespace, u.wsBefore, c, p);
262
- const f = u.inputs;
263
- switch (d) {
264
- case T.Function: {
265
- const t = String(u.value), n = {
266
- type: T.Function,
261
+ s(x.Whitespace, o.wsBefore, a, c);
262
+ const u = o.inputs;
263
+ switch (f) {
264
+ case x.Function: {
265
+ const t = String(o.value), i = {
266
+ type: x.Function,
267
267
  value: t,
268
- text: u.image ?? t,
269
- evalIndex: u.evalIndex
268
+ text: o.image ?? t,
269
+ evalIndex: o.evalIndex
270
270
  };
271
- c && (n.context = c), i.push(n);
271
+ a && (i.context = a), r.push(i);
272
272
  const l = {
273
273
  name: t,
274
274
  argIndex: -1,
275
- type: u.binder?.kind ?? "function"
275
+ type: o.binder?.kind ?? "function"
276
276
  };
277
- if (c?.bound && (l.bound = c.bound), a(T.Paren, "(", l, u.evalIndex), f) {
278
- const t = f.length, n = u.binder?.kind, i = "lambda" === n ? 1 : "let" === n ? 2 : 0;
279
- let s = l.bound;
277
+ if (a?.bound && (l.bound = a.bound), s(x.Paren, "(", l, o.evalIndex), u) {
278
+ const t = u.length, r = o.binder?.kind, i = "lambda" === r ? 1 : "let" === r ? 2 : 0;
279
+ let a = l.bound;
280
280
  for (let o = 0; o < t; o++) {
281
- const u = i && o >= i ? f[o - i] : void 0;
282
- if (u?.binding?.declaration) {
283
- const e = u.value.nameId, t = "let" === n ? Rt(f[o - 1]) : void 0;
284
- s = xt(s, t ? {
281
+ const f = i && o >= i ? u[o - i] : void 0;
282
+ if (f?.binding?.declaration) {
283
+ const e = f.value.nameId, t = "let" === r ? Rt(u[o - 1]) : void 0;
284
+ a = xt(a, t ? {
285
285
  name: e,
286
286
  params: t
287
287
  } : { name: e });
288
288
  }
289
- const c = {
289
+ const p = {
290
290
  ...l,
291
291
  argIndex: o
292
292
  };
293
- s && (c.bound = s), e(f[o], c, p), o < t - 1 && a(T.Separator, ",", c, p, r.separatorFunction);
293
+ a && (p.bound = a), e(u[o], p, c), o < t - 1 && s(x.Separator, ",", p, c, n.separatorFunction);
294
294
  }
295
295
  }
296
- u.error || a(T.Paren, ")", l, u.evalIndex);
296
+ o.error || s(x.Paren, ")", l, o.evalIndex);
297
297
  break;
298
298
  }
299
- case T.Call: {
300
- const n = t(u), s = i.length;
301
- if (n && e(n, c, p), n?.type === T.Named) for (let e = s; e < i.length; e++) {
302
- const t = i[e];
303
- t.type !== T.Whitespace && (t.evalIndex = u.evalIndex, t.type === T.Named && (t.type = T.Function, t.value = t.value.name));
299
+ case x.Call: {
300
+ const t = m(o), i = r.length;
301
+ if (t && e(t, a, c), t?.type === x.Named) for (let e = i; e < r.length; e++) {
302
+ const t = r[e];
303
+ t.type !== x.Whitespace && (t.evalIndex = o.evalIndex, t.type === x.Named && (t.type = x.Function, t.value = t.value.name));
304
304
  }
305
- const o = {
306
- name: n?.type === T.Named ? n.value.nameId : "",
305
+ const l = {
306
+ name: t?.type === x.Named ? t.value.nameId : "",
307
307
  argIndex: -1,
308
308
  type: "function"
309
309
  };
310
- c?.bound && (o.bound = c.bound), a(T.Paren, "(", o, u.evalIndex);
311
- const f = l(u), d = f.length;
312
- for (let t = 0; t < d; t++) {
313
- const n = {
314
- ...o,
310
+ a?.bound && (l.bound = a.bound), s(x.Paren, "(", l, o.evalIndex);
311
+ const u = I(o), f = u.length;
312
+ for (let t = 0; t < f; t++) {
313
+ const r = {
314
+ ...l,
315
315
  argIndex: t
316
316
  };
317
- e(f[t], n, p), t < d - 1 && a(T.Separator, ",", n, p, r.separatorFunction);
317
+ e(u[t], r, c), t < f - 1 && s(x.Separator, ",", r, c, n.separatorFunction);
318
318
  }
319
- u.error || a(T.Paren, ")", o, u.evalIndex);
319
+ o.error || s(x.Paren, ")", l, o.evalIndex);
320
320
  break;
321
321
  }
322
- case T.Cell:
323
- o(u, c, p);
322
+ case x.Cell:
323
+ l(o, a, c);
324
324
  break;
325
- case T.Paren:
326
- a(d, "(", c, p), g(f, c, p), u.error || a(d, ")", c, p);
325
+ case x.Paren:
326
+ s(f, "(", a, c), p(u, a, c), o.error || s(f, ")", a, c);
327
327
  break;
328
- case T.TableReference: {
329
- const t = u.value?.tableId ?? "", r = {
330
- name: t,
328
+ case x.TableReference: {
329
+ const n = o.value?.tableId ?? "", l = {
330
+ name: n,
331
331
  argIndex: -1,
332
332
  type: "table"
333
- }, l = i.length, o = u.image;
333
+ }, f = r.length, p = o.image;
334
334
  let d, g = !1;
335
- if (t && o) {
335
+ if (n && p) {
336
336
  let e = 0;
337
- if (91 === o.charCodeAt(0)) {
338
- const t = o.indexOf("]");
339
- -1 !== t && 33 === o.charCodeAt(t + 1) && (e = t + 2);
337
+ if (91 === p.charCodeAt(0)) {
338
+ const t = p.indexOf("]");
339
+ -1 !== t && 33 === p.charCodeAt(t + 1) && (e = t + 2);
340
340
  }
341
- const t = o.indexOf("[", e);
342
- if (g = 0 === t && null != f, t > 0) d = o.slice(0, t);
343
- else if (!f) {
344
- const e = o.lastIndexOf("!");
345
- d = n || -1 === e ? o : o.slice(e + 1);
341
+ const n = p.indexOf("[", e);
342
+ if (g = 0 === n && null != u, n > 0) d = p.slice(0, n);
343
+ else if (!u) {
344
+ const e = p.lastIndexOf("!");
345
+ d = t || -1 === e ? p : p.slice(e + 1);
346
346
  }
347
347
  }
348
- if (!t || g && n || a(T.TableReference, t, c, p, d), f && a(T.Paren, "[", r, p), f) {
349
- const t = f.length;
348
+ if (!n || g && t || s(x.TableReference, n, a, c, d), u && s(x.Paren, "[", l, c), u) {
349
+ const t = u.length;
350
350
  for (let n = 0; n < t; n++) {
351
- const i = {
352
- ...r,
351
+ const r = {
352
+ ...l,
353
353
  argIndex: n
354
354
  };
355
- e(f[n], i, p), n < t - 1 && a(T.Separator, ",", i, p);
355
+ e(u[n], r, c), n < t - 1 && s(x.Separator, ",", r, c);
356
356
  }
357
357
  }
358
- f && !u.error && a(T.Paren, "]", r, p);
359
- const v = u.referenceIndex;
360
- for (let e = l; e < i.length; e++) void 0 !== v && (i[e].referenceIndex = v), s.add(i[e]);
358
+ u && !o.error && s(x.Paren, "]", l, c);
359
+ const v = o.referenceIndex;
360
+ for (let e = f; e < r.length; e++) void 0 !== v && (r[e].referenceIndex = v), i.add(r[e]);
361
361
  break;
362
362
  }
363
- case T.TableSpecifier:
364
- case T.TableColumn: {
365
- const e = u.image, t = null != e && e.startsWith("[") && e.endsWith("]");
366
- t && a(T.Paren, "[", c, p);
363
+ case x.TableSpecifier:
364
+ case x.TableColumn: {
365
+ const e = o.image, t = null != e && e.startsWith("[") && e.endsWith("]");
366
+ t && s(x.Paren, "[", a, c);
367
367
  const n = {
368
- table: "table" === c?.type ? c.name : "",
369
- name: u.value
370
- }, r = {
371
- type: d,
368
+ table: "table" === a?.type ? a.name : "",
369
+ name: o.value
370
+ }, i = {
371
+ type: f,
372
372
  value: n,
373
373
  text: t ? e.slice(1, -1) : e ?? n.name
374
374
  };
375
- void 0 !== p && (r.evalIndex = p), c && (r.context = c), i.push(r), t && a(T.Paren, "]", c, p);
375
+ void 0 !== c && (i.evalIndex = c), a && (i.context = a), r.push(i), t && s(x.Paren, "]", a, c);
376
376
  break;
377
377
  }
378
- case T.List:
379
- g(f, c, p);
378
+ case x.List:
379
+ p(u, a, c);
380
380
  break;
381
- case T.Named: {
382
- const e = o(u, c, p), t = u.value;
381
+ case x.Named: {
382
+ const e = l(o, a, c), t = o.value;
383
383
  e.value = t.scope ? {
384
384
  name: t.nameId,
385
385
  scope: t.scope
386
- } : { name: t.nameId }, u.binding?.declaration && u.binding.optional && (e.value.optional = !0), u.binding && (e.type = T.Parameter, u.binding.declaration && (e.value.declaration = !0)), delete e.referenceIndex;
386
+ } : { name: t.nameId }, o.binding?.declaration && o.binding.optional && (e.value.optional = !0), o.binding && (e.type = x.Parameter, o.binding.declaration && (e.value.declaration = !0)), delete e.referenceIndex;
387
387
  break;
388
388
  }
389
- default: void 0 !== u.value && o(u, c, p), f && f.forEach((t) => e(t, c, p));
389
+ default: void 0 !== o.value && l(o, a, c), u && u.forEach((t) => e(t, a, c));
390
390
  }
391
- a(T.Whitespace, u.wsAfter, c, p);
391
+ s(x.Whitespace, o.wsAfter, a, c);
392
392
  }
393
393
  })(e);
394
- const u = /* @__PURE__ */ new Map();
395
- for (const e of i) if (e.type === T.Cell && void 0 !== e.referenceIndex) {
396
- const t = u.get(e.referenceIndex);
397
- t ? t.push(e) : u.set(e.referenceIndex, [e]);
394
+ const o = /* @__PURE__ */ new Map();
395
+ for (const e of r) if (e.type === x.Cell && void 0 !== e.referenceIndex) {
396
+ const t = o.get(e.referenceIndex);
397
+ t ? t.push(e) : o.set(e.referenceIndex, [e]);
398
398
  }
399
- for (const e of u.values()) 1 === e.length ? e[0].refSide = "self" : (e[0].refSide = "left", e[e.length - 1].refSide = "right");
400
- const c = /* @__PURE__ */ new Map();
401
- for (const e of i) if (void 0 !== e.referenceIndex && void 0 !== e.evalIndex) {
402
- const t = c.get(e.referenceIndex);
403
- (void 0 === t || e.evalIndex < t) && c.set(e.referenceIndex, e.evalIndex);
399
+ for (const e of o.values()) 1 === e.length ? e[0].refSide = "self" : (e[0].refSide = "left", e[e.length - 1].refSide = "right");
400
+ const a = /* @__PURE__ */ new Map();
401
+ for (const e of r) if (void 0 !== e.referenceIndex && void 0 !== e.evalIndex) {
402
+ const t = a.get(e.referenceIndex);
403
+ (void 0 === t || e.evalIndex < t) && a.set(e.referenceIndex, e.evalIndex);
404
404
  }
405
- if (c.size > 0) {
406
- for (const e of i) if (void 0 !== e.referenceIndex) {
407
- const t = c.get(e.referenceIndex);
405
+ if (a.size > 0) {
406
+ for (const e of r) if (void 0 !== e.referenceIndex) {
407
+ const t = a.get(e.referenceIndex);
408
408
  void 0 !== t && (e.evalIndex = t);
409
409
  }
410
410
  }
411
- return i;
411
+ return r;
412
412
  }
413
413
  function ve(e, t) {
414
414
  let n = "";
415
415
  for (let r = 0; r < e.length; r++) {
416
416
  const i = e[r], l = i.type;
417
- if (l === T.Cell || l === T.Named || l === T.Error) {
418
- const e = l === T.Cell ? i.value?.scope : (T.Named, i.value?.scope ?? void 0), r = l === T.Error ? void 0 !== i.text && A(i.text) : i.text?.includes("!") ?? !1;
417
+ if (l === x.Cell || l === x.Named || l === x.Error) {
418
+ const e = l === x.Cell ? i.value?.scope : (x.Named, i.value?.scope ?? void 0), r = l === x.Error ? void 0 !== i.text && v(i.text) : i.text?.includes("!") ?? !1;
419
419
  if (e && void 0 !== i.text && !r) {
420
- const r = t?.resolve(b.Sheet, e)?.toString() ?? e;
421
- n += y(r) + "!" + i.text;
420
+ const r = t?.resolve(y.Sheet, e)?.toString() ?? e;
421
+ n += o(r) + "!" + i.text;
422
422
  continue;
423
423
  }
424
- if (l === T.Named) {
424
+ if (l === x.Named) {
425
425
  n += i.text ?? i.value?.name ?? "";
426
426
  continue;
427
427
  }
428
428
  }
429
- if (l === T.Parameter) {
429
+ if (l === x.Parameter) {
430
430
  n += i.text ?? i.value?.name ?? "";
431
431
  continue;
432
432
  }
@@ -437,43 +437,43 @@ function ve(e, t) {
437
437
  }
438
438
  function he(e, t) {
439
439
  let n;
440
- if (f(e, (e) => {
440
+ if (b(e, (e) => {
441
441
  e.evalIndex === t && (n = e);
442
442
  }), !n) return [];
443
443
  const r = ge(n);
444
- return r.length > 1 && r[0].type === T.Whitespace && r.shift(), r.length > 1 && r[r.length - 1].type === T.Whitespace && r.pop(), r;
444
+ return r.length > 1 && r[0].type === x.Whitespace && r.shift(), r.length > 1 && r[r.length - 1].type === x.Whitespace && r.pop(), r;
445
445
  }
446
446
  function me(e) {
447
- return f(e, (e) => {
448
- if (e.type !== T.TableReference) return;
447
+ return b(e, (e) => {
448
+ if (e.type !== x.TableReference) return;
449
449
  const t = function(e) {
450
450
  if (null !== e.value && "object" == typeof e.value) return e.value;
451
451
  const t = e.value, n = e.inputs;
452
- let r = !1, i = !1, l = !1, s = !1, o = null, a = null, u = !1;
453
- const c = (e) => {
454
- e?.type === T.TableColumn && (o = e.value, a = e.value);
452
+ let r = !1, i = !1, l = !1, s = !1, o = null, a = null, c = !1;
453
+ const f = (e) => {
454
+ e?.type === x.TableColumn && (o = e.value, a = e.value);
455
455
  };
456
456
  if (n) for (const e of n) {
457
457
  const t = e.type;
458
- if (t === T.TableSpecifier) {
458
+ if (t === x.TableSpecifier) {
459
459
  const t = e.value.toUpperCase().trim();
460
- "#ALL" === t ? i = !0 : "#HEADERS" === t ? l = !0 : "#TOTALS" === t ? s = !0 : "#DATA" === t ? r = !0 : "@" !== t && "#THIS ROW" !== t || (u = !0);
461
- } else if (t === T.TableColumn) c(e);
462
- else if (t === T.Infix && ":" === e.value) {
460
+ "#ALL" === t ? i = !0 : "#HEADERS" === t ? l = !0 : "#TOTALS" === t ? s = !0 : "#DATA" === t ? r = !0 : "@" !== t && "#THIS ROW" !== t || (c = !0);
461
+ } else if (t === x.TableColumn) f(e);
462
+ else if (t === x.Infix && ":" === e.value) {
463
463
  const t = e.inputs?.[0], n = e.inputs?.[1];
464
- t?.type === T.TableColumn && (o = t.value), n?.type === T.TableColumn && (a = n.value);
465
- } else if (t === T.Prefix && "@" === e.value) {
466
- u = !0;
464
+ t?.type === x.TableColumn && (o = t.value), n?.type === x.TableColumn && (a = n.value);
465
+ } else if (t === x.Prefix && "@" === e.value) {
466
+ c = !0;
467
467
  const t = e.inputs?.[0];
468
- t?.type === T.Infix && ":" === t.value ? (t.inputs?.[0]?.type === T.TableColumn && (o = t.inputs[0].value), t.inputs?.[1]?.type === T.TableColumn && (a = t.inputs[1].value)) : c(t);
468
+ t?.type === x.Infix && ":" === t.value ? (t.inputs?.[0]?.type === x.TableColumn && (o = t.inputs[0].value), t.inputs?.[1]?.type === x.TableColumn && (a = t.inputs[1].value)) : f(t);
469
469
  }
470
470
  }
471
471
  return {
472
472
  tableId: t,
473
- spec: w(i, l, r, s),
473
+ spec: u(i, l, r, s),
474
474
  columnFromId: o,
475
475
  columnToId: a,
476
- isThisRow: u
476
+ isThisRow: c
477
477
  };
478
478
  }(e);
479
479
  return {
@@ -483,19 +483,19 @@ function me(e) {
483
483
  });
484
484
  }
485
485
  function ye(e) {
486
- return f(e, (e) => {
487
- if (e.type !== T.TableReference) return;
486
+ return b(e, (e) => {
487
+ if (e.type !== x.TableReference) return;
488
488
  const t = e.inputs;
489
489
  if (!t) return;
490
- if (-1 === t.findIndex((e) => e.type === T.TableSpecifier && "#THIS ROW" === e.value.toUpperCase().trim())) return;
490
+ if (-1 === t.findIndex((e) => e.type === x.TableSpecifier && "#THIS ROW" === e.value.toUpperCase().trim())) return;
491
491
  const n = [];
492
- let i;
492
+ let r;
493
493
  for (const e of t) {
494
- if (e.type === T.TableSpecifier && "#THIS ROW" === e.value.toUpperCase().trim()) continue;
495
- e.type !== T.TableColumn && (e.type !== T.Infix || ":" !== e.value) || i ? n.push(e) : i = e;
494
+ if (e.type === x.TableSpecifier && "#THIS ROW" === e.value.toUpperCase().trim()) continue;
495
+ e.type !== x.TableColumn && (e.type !== x.Infix || ":" !== e.value) || r ? n.push(e) : r = e;
496
496
  }
497
- if (!i) return n.push({
498
- type: T.Prefix,
497
+ if (!r) return n.push({
498
+ type: x.Prefix,
499
499
  value: "@",
500
500
  inputs: null,
501
501
  isReference: !0
@@ -503,19 +503,19 @@ function ye(e) {
503
503
  ...e,
504
504
  inputs: n
505
505
  };
506
- const l = i.image ?? i.value, s = l.startsWith("[") && l.endsWith("]") ? {
507
- ...i,
508
- image: l.slice(1, -1)
509
- } : i;
510
- return n.push(r("@", s, !0)), {
506
+ const i = r.image ?? r.value, l = i.startsWith("[") && i.endsWith("]") ? {
507
+ ...r,
508
+ image: i.slice(1, -1)
509
+ } : r;
510
+ return n.push(S("@", l, !0)), {
511
511
  ...e,
512
512
  inputs: n
513
513
  };
514
514
  });
515
515
  }
516
516
  function Ie(e) {
517
- return f(e, (e) => {
518
- if (e.type !== T.TableReference) return;
517
+ return b(e, (e) => {
518
+ if (e.type !== x.TableReference) return;
519
519
  if (0 !== e.inputs?.length || e.error) return;
520
520
  const t = e.value;
521
521
  return ("string" == typeof t ? t : t?.tableId) ? {
@@ -525,8 +525,8 @@ function Ie(e) {
525
525
  });
526
526
  }
527
527
  function be(e) {
528
- return f(e, (e) => {
529
- if (e.type !== T.TableReference || !e.inputs) return;
528
+ return b(e, (e) => {
529
+ if (e.type !== x.TableReference || !e.inputs) return;
530
530
  const t = e.value, n = "string" == typeof t ? t : t?.tableId, r = e.image;
531
531
  if (!n || 91 !== r?.charCodeAt(0)) return;
532
532
  const i = r.indexOf("]");
@@ -536,7 +536,7 @@ function be(e) {
536
536
  });
537
537
  }
538
538
  var xe = (e) => {
539
- if (e?.type !== T.TableSpecifier) return 4;
539
+ if (e?.type !== x.TableSpecifier) return 4;
540
540
  switch (e.value.toUpperCase().trim()) {
541
541
  case "#ALL": return 0;
542
542
  case "#HEADERS": return 1;
@@ -546,8 +546,8 @@ var xe = (e) => {
546
546
  }
547
547
  };
548
548
  function Re(e) {
549
- return f(e, (e) => {
550
- if (e.type !== T.TableReference) return;
549
+ return b(e, (e) => {
550
+ if (e.type !== x.TableReference) return;
551
551
  const t = e.inputs;
552
552
  if (!t || t.length < 2) return;
553
553
  const n = t.map((e, t) => ({
@@ -564,8 +564,8 @@ function Re(e) {
564
564
  function Ee(e) {
565
565
  if (!e) return V.EmptyArray;
566
566
  let t = V.EmptyArray;
567
- return f(e, (e) => {
568
- if (e.type !== T.Named || e.binding) return;
567
+ return b(e, (e) => {
568
+ if (e.type !== x.Named || e.binding) return;
569
569
  const n = e.value.nameId;
570
570
  n && (t === V.EmptyArray && (t = []), t.includes(n) || t.push(n));
571
571
  }), t;
@@ -573,12 +573,12 @@ function Ee(e) {
573
573
  function Te(e, t) {
574
574
  if (!e) return V.EmptyArray;
575
575
  let n = V.EmptyArray;
576
- return f(e, (e, r, i) => {
576
+ return b(e, (e, r, i) => {
577
577
  if (!e.isReference) return;
578
578
  if (r?.isReference) return;
579
579
  const l = e.type;
580
- if (l === T.Named || l === T.Error || l === T.TableReference) return;
581
- if (pe(i, T.TableReference)) return;
580
+ if (l === x.Named || l === x.Error || l === x.TableReference) return;
581
+ if (pe(i, x.TableReference)) return;
582
582
  const s = function(e) {
583
583
  let t = e;
584
584
  for (; t;) {
@@ -591,11 +591,11 @@ function Te(e, t) {
591
591
  let r = e;
592
592
  for (let e = t.length - 1; e >= 0; e--) {
593
593
  const i = t[e];
594
- if (i.type === T.Paren || i.isReference) {
594
+ if (i.type === x.Paren || i.isReference) {
595
595
  r = i;
596
596
  continue;
597
597
  }
598
- if (i.type !== T.Function) return !0;
598
+ if (i.type !== x.Function) return !0;
599
599
  const l = n?.(String(i.value));
600
600
  if (!l) return !0;
601
601
  const s = i.inputs ? i.inputs.indexOf(r) : -1;
@@ -612,8 +612,8 @@ function we(e, t) {
612
612
  function Ce(e, t, n) {
613
613
  if (!e || !t) return !1;
614
614
  let r = !1;
615
- return f(e, (e) => {
616
- if (r || e.type !== T.Function) return;
615
+ return b(e, (e) => {
616
+ if (r || e.type !== x.Function) return;
617
617
  const i = t(e.value)?.getName();
618
618
  i && n.has(i.toUpperCase()) && (r = !0);
619
619
  }), r;
@@ -621,31 +621,31 @@ function Ce(e, t, n) {
621
621
  function Ne(e, t) {
622
622
  if (!e || !t) return !1;
623
623
  let n = !1;
624
- return f(e, (e) => {
625
- n || e.type !== T.Function || "TABLE" === t(e.value)?.getName().toUpperCase() && (n = !0);
624
+ return b(e, (e) => {
625
+ n || e.type !== x.Function || "TABLE" === t(e.value)?.getName().toUpperCase() && (n = !0);
626
626
  }), n;
627
627
  }
628
628
  function Fe(e, t) {
629
629
  if (!e || !t) return !1;
630
630
  let n = !1;
631
- return f(e, (e) => {
632
- n || e.type !== T.Function || !0 === t(e.value)?.getDeclaration().getReturnType()?.isVolatile() && (n = !0);
631
+ return b(e, (e) => {
632
+ n || e.type !== x.Function || !0 === t(e.value)?.getDeclaration().getReturnType()?.isVolatile() && (n = !0);
633
633
  }), n;
634
634
  }
635
635
  var Pe = Object.freeze({
636
636
  value: !1,
637
637
  array: !1
638
- }), Le = (e, t) => {
638
+ }), ke = (e, t) => {
639
639
  const n = function(e, t) {
640
640
  if (!e || !t) return Pe;
641
641
  let n = !1, r = !1;
642
- return f(e, (e) => {
642
+ return b(e, (e) => {
643
643
  if (n) return;
644
644
  const i = e.type;
645
- if (i === T.Named) return void (void 0 === e.binding && (n = !0));
646
- if (i === T.Prefix) return void ("@" === e.value && (n = !0));
647
- if (i === T.Call) return void (n = !0);
648
- if (i !== T.Function) return;
645
+ if (i === x.Named) return void (void 0 === e.binding && (n = !0));
646
+ if (i === x.Prefix) return void ("@" === e.value && (n = !0));
647
+ if (i === x.Call) return void (n = !0);
648
+ if (i !== x.Function) return;
649
649
  if (void 0 !== e.binder) return;
650
650
  const l = t(e.value);
651
651
  if (!l) return void (n = !0);
@@ -664,7 +664,7 @@ var Pe = Object.freeze({
664
664
  isBlankCacheable: n.value,
665
665
  isBlankCacheableArray: n.array
666
666
  };
667
- }, ke = (e, t) => {
667
+ }, Le = (e, t) => {
668
668
  const n = e.length;
669
669
  if (0 === n) return null;
670
670
  if (t < n - 1) return e[t];
@@ -673,25 +673,25 @@ var Pe = Object.freeze({
673
673
  };
674
674
  function $e(e) {
675
675
  if (!e) return V.EmptyArray;
676
- let t = V.EmptyArray;
676
+ let n = V.EmptyArray;
677
677
  const r = (e) => {
678
- e && (t === V.EmptyArray && (t = []), t.includes(e) || t.push(e));
678
+ e && (n === V.EmptyArray && (n = []), n.includes(e) || n.push(e));
679
679
  }, i = (e) => {
680
- "string" == typeof e && r(n(e)?.bookId);
680
+ "string" == typeof e && r(t(e)?.bookId);
681
681
  };
682
- return f(e, (e) => {
683
- if (e.type === T.Named) {
682
+ return b(e, (e) => {
683
+ if (e.type === x.Named) {
684
684
  if (e.binding) return;
685
685
  const t = e.value;
686
686
  r(t.nameId), i(t.scope);
687
- } else if (e.type === T.TableReference) {
687
+ } else if (e.type === x.TableReference) {
688
688
  const t = e.value;
689
689
  r("string" == typeof t ? t : t?.tableId);
690
- } else if (e.type === T.Cell) {
690
+ } else if (e.type === x.Cell) {
691
691
  const t = e.value?.scope;
692
- i(t), c(t) && r(t);
693
- } else e.type === T.Error && i(e.value?.scope);
694
- }), t;
692
+ i(t), a(t) && r(t);
693
+ } else e.type === x.Error && i(e.value?.scope);
694
+ }), n;
695
695
  }
696
696
  var Oe = (e, t) => {
697
697
  if (!0 === e.lazyArg) return !0;
@@ -717,15 +717,15 @@ var Oe = (e, t) => {
717
717
  if (!e) return !1;
718
718
  const n = e.inputs;
719
719
  switch (e.type) {
720
- case T.Cell:
721
- case T.Named:
722
- case T.TableReference: return !0;
723
- case T.Infix:
724
- case T.Prefix:
725
- case T.Postfix: return !0 === e.isReference && "@" !== e.value;
726
- case T.Paren:
727
- case T.List: return !!n && 1 === n.length && Me(n[0], t);
728
- case T.Function: {
720
+ case x.Cell:
721
+ case x.Named:
722
+ case x.TableReference: return !0;
723
+ case x.Infix:
724
+ case x.Prefix:
725
+ case x.Postfix: return !0 === e.isReference && "@" !== e.value;
726
+ case x.Paren:
727
+ case x.List: return !!n && 1 === n.length && Me(n[0], t);
728
+ case x.Function: {
729
729
  if (void 0 !== e.binder) return !1;
730
730
  const r = String(e.value).toUpperCase();
731
731
  if (Be.has(r)) {
@@ -749,29 +749,29 @@ function Ue(e, t) {
749
749
  let n;
750
750
  const r = e.type, i = e.inputs;
751
751
  switch (r) {
752
- case T.Array:
752
+ case x.Array:
753
753
  n = !0;
754
754
  break;
755
- case T.Cell: {
755
+ case x.Cell: {
756
756
  const t = e.value;
757
757
  n = t.rowIndex === Number.MIN_SAFE_INTEGER || t.colIndex === Number.MIN_SAFE_INTEGER;
758
758
  break;
759
759
  }
760
- case T.Named:
761
- case T.Call:
762
- case T.TableReference:
760
+ case x.Named:
761
+ case x.Call:
762
+ case x.TableReference:
763
763
  n = !0;
764
764
  break;
765
- case T.Infix:
766
- case T.Prefix:
767
- case T.Postfix:
765
+ case x.Infix:
766
+ case x.Prefix:
767
+ case x.Postfix:
768
768
  n = e.isReference ? "@" !== e.value : We(i, t);
769
769
  break;
770
- case T.Paren:
771
- case T.List:
770
+ case x.Paren:
771
+ case x.List:
772
772
  n = !i || 1 !== i.length || Ue(i[0], t);
773
773
  break;
774
- case T.Function: {
774
+ case x.Function: {
775
775
  const r = e.binder;
776
776
  if (void 0 !== r) {
777
777
  n = "lambda" === r.kind || !!i && Ue(i[i.length - 1], t);
@@ -785,7 +785,7 @@ function Ue(e, t) {
785
785
  if ("INDEX" === l) {
786
786
  if (n = !1, i) for (let e = 1; e < i.length; e++) {
787
787
  const r = i[e];
788
- if (!r || r.type === T.Empty || r.isLiteral && 0 === r.value || Ue(r, t)) {
788
+ if (!r || r.type === x.Empty || r.isLiteral && 0 === r.value || Ue(r, t)) {
789
789
  n = !0;
790
790
  break;
791
791
  }
@@ -813,17 +813,17 @@ function _e(e, t) {
813
813
  const i = e.inputs;
814
814
  if (!i) return;
815
815
  const l = e.type;
816
- if (l === T.Infix || l === T.Prefix || l === T.Postfix) {
816
+ if (l === x.Infix || l === x.Prefix || l === x.Postfix) {
817
817
  const t = r && !e.isReference;
818
818
  for (let e = 0; e < i.length; e++) n(i[e], t);
819
819
  return;
820
820
  }
821
- if (l === T.Paren || l === T.List) {
821
+ if (l === x.Paren || l === x.List) {
822
822
  const e = r && 1 === i.length;
823
823
  for (let t = 0; t < i.length; t++) n(i[t], e);
824
824
  return;
825
825
  }
826
- if (l === T.Function) {
826
+ if (l === x.Function) {
827
827
  const l = e.binder;
828
828
  if (void 0 !== l) {
829
829
  const e = i.length - 1;
@@ -852,24 +852,24 @@ var je = /* @__PURE__ */ new Set([
852
852
  function He(e, t) {
853
853
  if (!e || !t) return null;
854
854
  const n = (e) => t(e.value)?.getName().toUpperCase() ?? null;
855
- let r = !1;
856
- if (f(e, (e) => {
857
- (e.hasLazyArgs || e.type === T.Call || void 0 !== e.binder) && (r = !0);
858
- }), r) return null;
859
- const l = (e) => e.type === T.Number, s = (e) => e.type === T.Number || e.type === T.String || e.type === T.Boolean, o = (e) => {
855
+ let i = !1;
856
+ if (b(e, (e) => {
857
+ (e.hasLazyArgs || e.type === x.Call || void 0 !== e.binder) && (i = !0);
858
+ }), i) return null;
859
+ const l = (e) => e.type === x.Number, s = (e) => e.type === x.Number || e.type === x.String || e.type === x.Boolean, o = (e) => {
860
860
  if (!e) return !1;
861
861
  const t = e.inputs;
862
862
  switch (e.type) {
863
- case T.Paren: return 1 === t?.length && o(t[0]);
864
- case T.Prefix: return ("-" === e.value || "+" === e.value) && o(t?.[0]);
865
- case T.Infix: {
863
+ case x.Paren: return 1 === t?.length && o(t[0]);
864
+ case x.Prefix: return ("-" === e.value || "+" === e.value) && o(t?.[0]);
865
+ case x.Infix: {
866
866
  if ("+" !== e.value && "-" !== e.value && "*" !== e.value) return !1;
867
867
  const [n, r] = t ?? [];
868
868
  return !(!n || !r) && (o(n) && (o(r) || l(r)) || l(n) && o(r));
869
869
  }
870
- case T.Function: {
870
+ case x.Function: {
871
871
  const r = n(e);
872
- if (null !== r && Ge.has(r)) return !t || 0 === t.length || 1 === t.length && t[0]?.type === T.Cell;
872
+ if (null !== r && Ge.has(r)) return !t || 0 === t.length || 1 === t.length && t[0]?.type === x.Cell;
873
873
  if ("MOD" === r && 2 === t?.length) {
874
874
  const e = t[1];
875
875
  return o(t[0]) && l(e) && 0 !== e.value;
@@ -882,13 +882,13 @@ function He(e, t) {
882
882
  if (!e) return !1;
883
883
  const t = e.inputs;
884
884
  switch (e.type) {
885
- case T.Paren: return 1 === t?.length && a(t[0]);
886
- case T.Infix: {
885
+ case x.Paren: return 1 === t?.length && a(t[0]);
886
+ case x.Infix: {
887
887
  if (!je.has(e.value)) return !1;
888
888
  const [n, r] = t ?? [];
889
889
  return !(!n || !r) && (o(n) && (o(r) || s(r)) || s(n) && o(r));
890
890
  }
891
- case T.Function: {
891
+ case x.Function: {
892
892
  const r = n(e);
893
893
  if (!t || 0 === t.length) return !1;
894
894
  if ("ISODD" === r || "ISEVEN" === r) return 1 === t.length && o(t[0]);
@@ -898,7 +898,7 @@ function He(e, t) {
898
898
  for (let n = 0; n < t.length; n++) {
899
899
  const r = t[n];
900
900
  if (!r) return !1;
901
- if (r.type !== T.Boolean) {
901
+ if (r.type !== x.Boolean) {
902
902
  if (!a(r)) return !1;
903
903
  e = !0;
904
904
  }
@@ -916,22 +916,22 @@ function He(e, t) {
916
916
  if (t) for (let e = 0; e < t.length; e++) c(t[e]);
917
917
  };
918
918
  c(e);
919
- const p = u.length;
920
- if (0 === p || p > 4) return null;
921
- const d = [];
922
- for (let t = 0; t < 1 << p; t++) {
919
+ const f = u.length;
920
+ if (0 === f || f > 4) return null;
921
+ const p = [];
922
+ for (let t = 0; t < 1 << f; t++) {
923
923
  const n = (e) => {
924
- const r = u.indexOf(e);
925
- if (-1 !== r) return i(t & 1 << r ? "TRUE" : "FALSE");
924
+ const i = u.indexOf(e);
925
+ if (-1 !== i) return r(t & 1 << i ? "TRUE" : "FALSE");
926
926
  const l = { ...e };
927
927
  return delete l.evalIndex, delete l.firstCell, delete l.inLazy, delete l.lazyArg, delete l.hasLazyArgs, delete l.deferred, e.inputs && (l.inputs = e.inputs.map((e) => e ? n(e) : e)), l;
928
928
  };
929
- d.push(n(e));
929
+ p.push(n(e));
930
930
  }
931
- return d;
931
+ return p;
932
932
  }
933
933
  var Xe = (e) => "*" === e.getRangeType() && null === e.getLambda() && e.getArrayDepth() <= (e.isRest() ? 1 : 0);
934
- function Ke(e, t, n, r = !1, i = null, l = null) {
934
+ function qe(e, t, n, r = !1, i = null, l = null) {
935
935
  let s, o, a = n;
936
936
  a = me(a), r || (a = ye(a), a = Re(a), a = Ie(a), a = be(a)), [s, o] = function(e) {
937
937
  const t = /* @__PURE__ */ new Map();
@@ -948,58 +948,58 @@ function Ke(e, t, n, r = !1, i = null, l = null) {
948
948
  n && n.inputs && (e.inputs = n.inputs.map((e) => t.get(e) ?? e));
949
949
  }), [t.get(e), n];
950
950
  }(a);
951
- const u = N(o), c = [], d = [], v = new de();
952
- let m, y = !1;
951
+ const u = N(o), c = [], f = [], p = new de();
952
+ let g, v = !1;
953
953
  (function(e, t) {
954
954
  if (!e || !t) return;
955
955
  const n = (e) => {
956
956
  if (!e) return;
957
- e.inLazy = !0, e.type === T.Named && (e.deferredResolve = !0);
957
+ e.inLazy = !0, e.type === x.Named && (e.deferredResolve = !0);
958
958
  const t = e.inputs;
959
959
  if (t) for (let e = 0; e < t.length; e++) n(t[e]);
960
960
  };
961
- f(e, (e) => {
962
- if (e.type !== T.Function) return;
961
+ b(e, (e) => {
962
+ if (e.type !== x.Function) return;
963
963
  if (void 0 !== e.binder) return;
964
964
  const r = e.inputs;
965
965
  if (!r || 0 === r.length) return;
966
966
  const i = t(e.value)?.getDeclaration().getParameters();
967
967
  if (i) for (let t = 0; t < r.length; t++) {
968
968
  const l = r[t];
969
- l && l.type !== T.Empty && ke(i, t)?.isLazy() && (l.lazyArg = !0, e.hasLazyArgs = !0, n(l));
969
+ l && l.type !== x.Empty && Le(i, t)?.isLazy() && (l.lazyArg = !0, e.hasLazyArgs = !0, n(l));
970
970
  }
971
971
  });
972
972
  })(s, l);
973
- const I = (e) => {
974
- void 0 === m && (m = /* @__PURE__ */ new Map());
975
- let t = m.get(e);
976
- return void 0 === t && m.set(e, t = []), t;
977
- }, b = (e, t) => {
978
- void 0 === e ? c.push(t) : I(e).push(t);
979
- }, x = (e) => {
980
- e?.type !== T.Infix || "+" !== e.value && "-" !== e.value || (e.snapsCancellation = !0);
973
+ const h = (e) => {
974
+ void 0 === g && (g = /* @__PURE__ */ new Map());
975
+ let t = g.get(e);
976
+ return void 0 === t && g.set(e, t = []), t;
977
+ }, m = (e, t) => {
978
+ void 0 === e ? c.push(t) : h(e).push(t);
979
+ }, y = (e) => {
980
+ e?.type !== x.Infix || "+" !== e.value && "-" !== e.value || (e.snapsCancellation = !0);
981
981
  };
982
- s = f(s, (t, n, r) => {
982
+ s = b(s, (t, n, r) => {
983
983
  const i = t.type, l = t.evalIndex;
984
- if (u[l] = null, i === T.TableColumn || i === T.TableSpecifier || t.isReference && pe(r, T.TableReference)) return;
985
- if (y = y || !tt(t), t.binding?.declaration) return d[t.binding.slot] = -1, void (u[l] = void 0);
984
+ if (u[l] = null, i === x.TableColumn || i === x.TableSpecifier || t.isReference && pe(r, x.TableReference)) return;
985
+ if (v = v || !tt(t), t.binding?.declaration) return f[t.binding.slot] = -1, void (u[l] = void 0);
986
986
  const s = ((e, t, n) => {
987
987
  if (Oe(e, t)) return e;
988
988
  for (let e = n.length - 1; e >= 0; e--) if (Oe(n[e], n[e - 1])) return n[e];
989
989
  })(t, n, r);
990
- s === t && I(t), void 0 !== s && i === T.Named && (t.deferredResolve = !0);
990
+ s === t && h(t), void 0 !== s && i === x.Named && (t.deferredResolve = !0);
991
991
  const o = t.binder;
992
992
  if (o && "let" === o.kind) {
993
993
  const e = t.inputs, n = e?.length ?? 0;
994
994
  let r = 0;
995
- for (let t = 0; t + 1 < n && r < o.slots.length; t += 2) e[t]?.binding?.declaration && (d[o.slots[r++]] = e[t + 1]?.evalIndex ?? -1);
995
+ for (let t = 0; t + 1 < n && r < o.slots.length; t += 2) e[t]?.binding?.declaration && (f[o.slots[r++]] = e[t + 1]?.evalIndex ?? -1);
996
996
  }
997
- if ((t.isReference || n && n.isReference) && (v.processNode(t, n), t.isReference)) {
998
- if (i === T.Named) return void (void 0 !== s && b(s, t));
999
- if (i === T.Cell || i === T.TableReference || i === T.Error) return;
1000
- if (i === T.Infix || i === T.Prefix || i === T.Postfix || i === T.List) return void b(s, t);
997
+ if ((t.isReference || n && n.isReference) && (p.processNode(t, n), t.isReference)) {
998
+ if (i === x.Named) return void (void 0 !== s && m(s, t));
999
+ if (i === x.Cell || i === x.TableReference || i === x.Error) return;
1000
+ if (i === x.Infix || i === x.Prefix || i === x.Postfix || i === x.List) return void m(s, t);
1001
1001
  }
1002
- if (t.isLiteral) if (i !== T.Array) u[l] = t.value;
1002
+ if (t.isLiteral) if (i !== x.Array) u[l] = t.value;
1003
1003
  else {
1004
1004
  const n = t.value, r = n.length, i = N(r);
1005
1005
  for (let e = 0; e < r; e++) {
@@ -1007,7 +1007,7 @@ function Ke(e, t, n, r = !1, i = null, l = null) {
1007
1007
  for (let e = 0; e < r; e++) {
1008
1008
  const n = t[e];
1009
1009
  let r = null;
1010
- if (n && (r = n.type === T.Error ? g(n.value) : n.value, n.type === T.Prefix)) {
1010
+ if (n && (r = n.type === x.Error ? C(n.value) : n.value, n.type === x.Prefix)) {
1011
1011
  const e = n.value;
1012
1012
  r = n.inputs[0].value, "-" === e && (r = -r);
1013
1013
  }
@@ -1015,18 +1015,18 @@ function Ke(e, t, n, r = !1, i = null, l = null) {
1015
1015
  }
1016
1016
  i[e] = l;
1017
1017
  }
1018
- const s = E(i);
1018
+ const s = T(i);
1019
1019
  u[l] = new R(e, s.values, s.coords, void 0, s.isLiteral);
1020
1020
  }
1021
1021
  else {
1022
- if (i !== T.Empty) return "lambda" === t.binder?.kind && x(t.inputs[t.inputs.length - 1]), b(s, t), t;
1022
+ if (i !== x.Empty) return "lambda" === t.binder?.kind && y(t.inputs[t.inputs.length - 1]), m(s, t), t;
1023
1023
  u[l] = void 0;
1024
1024
  }
1025
- }), x(s), m?.forEach((e, t) => {
1025
+ }), y(s), g?.forEach((e, t) => {
1026
1026
  t.deferred = e;
1027
1027
  });
1028
- const A = N(v.cells.size);
1029
- v.cells.forEach((e, t) => {
1028
+ const I = N(p.cells.size);
1029
+ p.cells.forEach((e, t) => {
1030
1030
  const n = t.value, r = n.colIndex, i = n.rowIndex, l = n.$colIndex, s = n.$rowIndex, o = {
1031
1031
  colStart: r,
1032
1032
  rowStart: i,
@@ -1037,29 +1037,29 @@ function Ke(e, t, n, r = !1, i = null, l = null) {
1037
1037
  $colEnd: l,
1038
1038
  $rowEnd: s
1039
1039
  };
1040
- r === Number.MIN_SAFE_INTEGER && (o.colEnd = Number.MAX_SAFE_INTEGER), i === Number.MIN_SAFE_INTEGER && (o.rowEnd = Number.MAX_SAFE_INTEGER), n.scope && (o.scope = n.scope), A[e] = o;
1040
+ r === Number.MIN_SAFE_INTEGER && (o.colEnd = Number.MAX_SAFE_INTEGER), i === Number.MIN_SAFE_INTEGER && (o.rowEnd = Number.MAX_SAFE_INTEGER), n.scope && (o.scope = n.scope), I[e] = o;
1041
1041
  });
1042
- const S = A.length, w = N(S);
1043
- for (let e = 0; e < S; e++) w[e] = {
1042
+ const E = I.length, S = N(E);
1043
+ for (let e = 0; e < E; e++) S[e] = {
1044
1044
  colStart: 0,
1045
1045
  rowStart: 0,
1046
1046
  colEnd: 0,
1047
1047
  rowEnd: 0,
1048
1048
  scope: null
1049
1049
  };
1050
- const C = N(v.references.size);
1051
- v.references.forEach((e) => {
1052
- C[e.index] = e;
1050
+ const w = N(p.references.size);
1051
+ p.references.forEach((e) => {
1052
+ w[e.index] = e;
1053
1053
  });
1054
1054
  const F = [];
1055
- v.rootReferences.forEach((e) => {
1055
+ p.rootReferences.forEach((e) => {
1056
1056
  F.push(e.index);
1057
1057
  }), function(e, t, n = !1) {
1058
1058
  if (n) {
1059
1059
  const t = (e) => {
1060
1060
  if (!e) return;
1061
1061
  const n = e.type;
1062
- n !== T.Function && n !== T.Call || (e.implicitIntersect = !0);
1062
+ n !== x.Function && n !== x.Call || (e.implicitIntersect = !0);
1063
1063
  const r = e.inputs;
1064
1064
  if (r) for (let e = 0; e < r.length; e++) t(r[e]);
1065
1065
  };
@@ -1069,15 +1069,15 @@ function Ke(e, t, n, r = !1, i = null, l = null) {
1069
1069
  const r = (e) => Ue(e, t), i = (e, n) => {
1070
1070
  if (!e) return;
1071
1071
  const l = e.type;
1072
- l !== T.Function && l !== T.Call || (e.implicitIntersect = n);
1072
+ l !== x.Function && l !== x.Call || (e.implicitIntersect = n);
1073
1073
  const s = e.inputs;
1074
1074
  if (s) {
1075
- if (l === T.Infix || l === T.Prefix || l === T.Postfix) {
1075
+ if (l === x.Infix || l === x.Prefix || l === x.Postfix) {
1076
1076
  const t = !e.isReference;
1077
1077
  for (let e = 0; e < s.length; e++) i(s[e], (!t || !r(s[e])) && n);
1078
1078
  return;
1079
1079
  }
1080
- if (l === T.Function) {
1080
+ if (l === x.Function) {
1081
1081
  const r = e.binder;
1082
1082
  if (void 0 !== r) {
1083
1083
  const e = "lambda" !== r.kind && n;
@@ -1101,63 +1101,63 @@ function Ke(e, t, n, r = !1, i = null, l = null) {
1101
1101
  };
1102
1102
  i(e, !r(e));
1103
1103
  }(s, l, !0 === n.legacyIntersect);
1104
- const L = (e) => {
1104
+ const k = (e) => {
1105
1105
  const t = e.length;
1106
1106
  for (let n = 0; n < t; n++) {
1107
1107
  const t = e[n], r = t.type;
1108
- if (r === T.Infix) {
1108
+ if (r === x.Infix) {
1109
1109
  if (!0 === t.snapsCancellation) {
1110
1110
  t.fn = ue[t.value];
1111
1111
  continue;
1112
1112
  }
1113
1113
  t.fn = ae[t.value];
1114
- } else if (r === T.Prefix) t.fn = ce[t.value];
1115
- else if (r === T.Postfix) t.fn = fe[t.value];
1114
+ } else if (r === x.Prefix) t.fn = ce[t.value];
1115
+ else if (r === x.Postfix) t.fn = fe[t.value];
1116
1116
  }
1117
1117
  };
1118
- let k;
1119
- L(c), m?.forEach(L);
1120
- const $ = r ? h(P(e.getLocale()).decimal) : p, O = {
1118
+ let L;
1119
+ k(c), g?.forEach(k);
1120
+ const $ = r ? A(P(e.getLocale()).decimal) : d, O = {
1121
1121
  runtime: e,
1122
1122
  symbols: t,
1123
1123
  getFunction: l,
1124
1124
  ast: s,
1125
1125
  evaluations: u,
1126
1126
  executions: c,
1127
- bindings: d,
1128
- referencesAbsolute: w,
1129
- referencesExecute: C,
1130
- referencesRelative: A,
1127
+ bindings: f,
1128
+ referencesAbsolute: S,
1129
+ referencesExecute: w,
1130
+ referencesRelative: I,
1131
1131
  referencesRoot: F,
1132
- referenceIndices: v.referenceIndices,
1132
+ referenceIndices: p.referenceIndices,
1133
1133
  formatReferenceIndices: Te(s, l),
1134
- getTokens: () => k ??= ge(s, r, $),
1134
+ getTokens: () => L ??= ge(s, r, $),
1135
1135
  namedIds: Ee(s),
1136
1136
  symbolIds: $e(s),
1137
1137
  hasTotals: we(s, l),
1138
1138
  hasPivotData: Ce(s, l, Se),
1139
1139
  hasDataTable: Ne(s, l),
1140
1140
  hasVolatile: Fe(s, l),
1141
- ...Le(s, l),
1142
- isReferenceOnly: !y,
1141
+ ...ke(s, l),
1142
+ isReferenceOnly: !v,
1143
1143
  error: i,
1144
1144
  transform: (n) => {
1145
- let o = f(s, n);
1146
- return o === s ? O : Ke(e, t, o, r, i, l);
1145
+ let o = b(s, n);
1146
+ return o === s ? O : qe(e, t, o, r, i, l);
1147
1147
  }
1148
1148
  };
1149
1149
  return O;
1150
1150
  }
1151
- function Ze(e) {
1151
+ function Ke(e) {
1152
1152
  let t = -1, n = -1;
1153
1153
  return Number.isSafeInteger(e.previousToken?.startLine) ? (t = e.previousToken.startLine, n = e.previousToken.endColumn + 1) : Number.isSafeInteger(e.token?.startLine) && (t = e.token.startLine, n = e.token.startColumn), -1 !== t ? (e.errorLocation = {
1154
1154
  line: t,
1155
1155
  column: n
1156
- }, new L.Parse(e.message, {
1156
+ }, new k.Parse(e.message, {
1157
1157
  line: t,
1158
1158
  column: n,
1159
1159
  cause: e
1160
- })) : new L.Parse(e.message, { cause: e });
1160
+ })) : new k.Parse(e.message, { cause: e });
1161
1161
  }
1162
1162
  Object.freeze([
1163
1163
  [
@@ -1179,29 +1179,29 @@ Object.freeze([
1179
1179
  ">="
1180
1180
  ]
1181
1181
  ]);
1182
- var qe = Object.freeze([
1182
+ var Ze = Object.freeze([
1183
1183
  ":",
1184
1184
  ".:.",
1185
1185
  ".:",
1186
1186
  ":."
1187
- ]), Qe = Object.freeze([
1187
+ ]), Je = Object.freeze([
1188
1188
  ":",
1189
1189
  " ",
1190
1190
  ".:.",
1191
1191
  ".:",
1192
1192
  ":."
1193
- ]), Je = Object.freeze(["@"]), Ye = Object.freeze(["#"]), et = Object.freeze(Qe.concat(Ye)), tt = (Object.freeze(Qe.concat(Je).concat(Ye)), (e) => {
1193
+ ]), Qe = Object.freeze(["@"]), Ye = Object.freeze(["#"]), et = Object.freeze(Je.concat(Ye)), tt = (Object.freeze(Je.concat(Qe).concat(Ye)), (e) => {
1194
1194
  if (!e) return !1;
1195
1195
  const t = e.type;
1196
- if (t === T.Cell) return !0;
1197
- if (t === T.TableReference) return !0;
1198
- if (t === T.Infix) {
1199
- if (!Qe.includes(e.value)) return !1;
1196
+ if (t === x.Cell) return !0;
1197
+ if (t === x.TableReference) return !0;
1198
+ if (t === x.Infix) {
1199
+ if (!Je.includes(e.value)) return !1;
1200
1200
  const t = e.inputs, n = t[0], r = t[1];
1201
1201
  return tt(n) && tt(r);
1202
1202
  }
1203
- return t === T.List && (e.inputs?.every(tt) ?? !1);
1204
- }), nt = (e) => !!e && (!(e.type !== T.Infix || !et.includes(e.value)) || !(e.type !== T.Postfix || !Ye.includes(e.value)) || e.type === T.Array || e.type === T.TableReference), rt = Object.freeze([
1203
+ return t === x.List && (e.inputs?.every(tt) ?? !1);
1204
+ }), nt = (e) => !!e && (!(e.type !== x.Infix || !et.includes(e.value)) || !(e.type !== x.Postfix || !Ye.includes(e.value)) || e.type === x.Array || e.type === x.TableReference), rt = Object.freeze([
1205
1205
  "+",
1206
1206
  "-",
1207
1207
  "*",
@@ -1217,15 +1217,15 @@ var qe = Object.freeze([
1217
1217
  ]), it = Object.freeze(["-", "+"]), lt = (e, t) => {
1218
1218
  if (!e) return !1;
1219
1219
  const n = e.type;
1220
- if (e.isLiteral) return n !== T.Error;
1221
- if (n === T.Paren || n === T.List) {
1220
+ if (e.isLiteral) return n !== x.Error;
1221
+ if (n === x.Paren || n === x.List) {
1222
1222
  const n = e.inputs;
1223
1223
  return !(!n || 0 === n.length) && n.every((e) => lt(e, t));
1224
1224
  }
1225
- if (n === T.Infix) return rt.includes(e.value);
1226
- if (n === T.Prefix) return it.includes(e.value);
1227
- if (n === T.Postfix) return "%" === e.value;
1228
- if (n === T.Function) {
1225
+ if (n === x.Infix) return rt.includes(e.value);
1226
+ if (n === x.Prefix) return it.includes(e.value);
1227
+ if (n === x.Postfix) return "%" === e.value;
1228
+ if (n === x.Function) {
1229
1229
  if (!t) return !1;
1230
1230
  const n = t(e.value);
1231
1231
  if (!n) return !1;
@@ -1238,7 +1238,7 @@ var qe = Object.freeze([
1238
1238
  let n = null;
1239
1239
  const r = (e) => {
1240
1240
  if (n || !e) return;
1241
- if (e.type === T.Infix && " " === e.value) {
1241
+ if (e.type === x.Infix && " " === e.value) {
1242
1242
  const r = e.inputs, i = r?.[0], l = r?.[1];
1243
1243
  if (lt(i, t)) return void (n = i);
1244
1244
  if (lt(l, t)) return void (n = l);
@@ -1252,7 +1252,7 @@ var qe = Object.freeze([
1252
1252
  let n = null;
1253
1253
  const r = (e) => {
1254
1254
  if (n || !e) return;
1255
- if (e.type === T.Postfix && "#" === e.value) {
1255
+ if (e.type === x.Postfix && "#" === e.value) {
1256
1256
  const r = e.inputs?.[0];
1257
1257
  if (r && lt(r, t)) return void (n = r);
1258
1258
  }
@@ -1293,7 +1293,7 @@ var qe = Object.freeze([
1293
1293
  let t = null;
1294
1294
  const n = (e) => {
1295
1295
  if (t || !e) return;
1296
- if (e.type === T.Array && Array.isArray(e.value)) {
1296
+ if (e.type === x.Array && Array.isArray(e.value)) {
1297
1297
  const n = e.value, r = (n[0]?.value)?.length ?? 0;
1298
1298
  for (let e = 1; e < n.length && !t; e++) {
1299
1299
  const i = (n[e]?.value)?.length ?? 0;
@@ -1309,7 +1309,7 @@ var qe = Object.freeze([
1309
1309
  let n = null;
1310
1310
  const r = (e) => {
1311
1311
  if (n || !e) return;
1312
- if (e.type === T.Function) {
1312
+ if (e.type === x.Function) {
1313
1313
  const r = e.value, i = t(r);
1314
1314
  if (i) {
1315
1315
  const t = i.getDeclaration(), l = t.getParameters(), s = e.inputs?.length ?? 0, o = t.getMaxArguments();
@@ -1336,7 +1336,7 @@ var qe = Object.freeze([
1336
1336
  let n = null;
1337
1337
  const r = (e) => {
1338
1338
  if (n || !e) return;
1339
- if (e.type === T.Function) {
1339
+ if (e.type === x.Function) {
1340
1340
  const r = t(e.value);
1341
1341
  if (r) {
1342
1342
  const i = r.getDeclaration().getParameters(), l = e.inputs;
@@ -1373,7 +1373,7 @@ var qe = Object.freeze([
1373
1373
  let n = null;
1374
1374
  const r = (e) => {
1375
1375
  if (n || !e) return;
1376
- if (e.type === T.Call) {
1376
+ if (e.type === x.Call) {
1377
1377
  const r = e.inputs?.[0];
1378
1378
  if (r && lt(r, t)) return void (n = "This expression always produces a value, so it cannot be called as a function.");
1379
1379
  }
@@ -1382,28 +1382,28 @@ var qe = Object.freeze([
1382
1382
  };
1383
1383
  return r(e), n;
1384
1384
  }, gt = (e, t) => {
1385
- if (e.type !== T.Function) return;
1385
+ if (e.type !== x.Function) return;
1386
1386
  const n = e.value;
1387
1387
  if ("string" != typeof n) return;
1388
1388
  const r = (t?.(n)?.getName() ?? n).toUpperCase();
1389
1389
  return "LET" === r ? "let" : "LAMBDA" === r ? "lambda" : void 0;
1390
1390
  }, vt = (e) => {
1391
- if (e?.type !== T.Named) return;
1391
+ if (e?.type !== x.Named) return;
1392
1392
  const t = e.value;
1393
1393
  return t?.nameId && !t.scope && !0 !== t.optional ? t.nameId : void 0;
1394
1394
  }, ht = /^[A-Za-z_\\][A-Za-z0-9_\\]*$/, mt = /* @__PURE__ */ new Set(["TRUE", "FALSE"]), yt = (e) => {
1395
- if (e?.type === T.Named) {
1395
+ if (e?.type === x.Named) {
1396
1396
  const t = e.value;
1397
1397
  if (!0 !== t?.optional || !t.nameId || t.scope) return;
1398
1398
  return t.nameId;
1399
1399
  }
1400
- if (e?.type !== T.TableReference) return;
1400
+ if (e?.type !== x.TableReference) return;
1401
1401
  const t = e.value;
1402
1402
  let n;
1403
1403
  if (null === t || "string" == typeof t) {
1404
1404
  if (t) return;
1405
1405
  const r = e.inputs;
1406
- if (!r || 1 !== r.length || r[0]?.type !== T.TableColumn) return;
1406
+ if (!r || 1 !== r.length || r[0]?.type !== x.TableColumn) return;
1407
1407
  const i = r[0].value;
1408
1408
  if ("string" != typeof i) return;
1409
1409
  n = i;
@@ -1415,10 +1415,10 @@ var qe = Object.freeze([
1415
1415
  }
1416
1416
  return ht.test(n) && !mt.has(n.toUpperCase()) && e.image === `[${n}]` ? n : void 0;
1417
1417
  }, It = (e) => {
1418
- const t = a(e.image ?? e.value);
1418
+ const t = l(e.image ?? e.value);
1419
1419
  t.image = e.image ?? e.value, t.wsBefore = e.wsBefore;
1420
1420
  const n = {
1421
- type: T.Call,
1421
+ type: x.Call,
1422
1422
  value: null,
1423
1423
  inputs: [t, ...e.inputs ?? []],
1424
1424
  wsAfter: e.wsAfter
@@ -1426,8 +1426,8 @@ var qe = Object.freeze([
1426
1426
  return e.error && (n.error = e.error), n;
1427
1427
  };
1428
1428
  function bt(e, t) {
1429
- return e && t ? f(e, (e) => {
1430
- if (e.type === T.Function && "string" == typeof e.value && !t(e.value)) return It(e);
1429
+ return e && t ? b(e, (e) => {
1430
+ if (e.type === x.Function && "string" == typeof e.value && !t(e.value)) return It(e);
1431
1431
  }) : e;
1432
1432
  }
1433
1433
  function xt(e, t) {
@@ -1435,7 +1435,7 @@ function xt(e, t) {
1435
1435
  return r.push(t), r;
1436
1436
  }
1437
1437
  function Rt(e) {
1438
- if (e?.type !== T.Function || "lambda" !== e.binder?.kind) return;
1438
+ if (e?.type !== x.Function || "lambda" !== e.binder?.kind) return;
1439
1439
  const t = e.inputs ?? [], n = [];
1440
1440
  for (let e = 0; e < t.length - 1; e++) {
1441
1441
  const r = t[e];
@@ -1454,7 +1454,7 @@ var Et = /* @__PURE__ */ new Set([
1454
1454
  "IFNA"
1455
1455
  ]);
1456
1456
  function Tt(e, t) {
1457
- if (!e || e.type !== T.Function || "string" != typeof e.value) return e;
1457
+ if (!e || e.type !== x.Function || "string" != typeof e.value) return e;
1458
1458
  const n = (t?.(e.value)?.getName() ?? e.value).toUpperCase();
1459
1459
  if (!Et.has(n)) return e;
1460
1460
  const r = e.inputs;
@@ -1507,7 +1507,7 @@ function At(e, t = null) {
1507
1507
  name: l
1508
1508
  }), c.push(o), f[e] = s ? {
1509
1509
  ...i,
1510
- type: T.Named,
1510
+ type: x.Named,
1511
1511
  value: {
1512
1512
  nameId: l,
1513
1513
  scope: null
@@ -1545,7 +1545,7 @@ function At(e, t = null) {
1545
1545
  }
1546
1546
  };
1547
1547
  })(e, s);
1548
- if (e.type === T.Function && "string" == typeof e.value) {
1548
+ if (e.type === x.Function && "string" == typeof e.value) {
1549
1549
  const r = e.value.toUpperCase();
1550
1550
  if (n.some((e) => e.key === r) && !t?.(e.value)) return i(It(e));
1551
1551
  }
@@ -1559,7 +1559,7 @@ function At(e, t = null) {
1559
1559
  });
1560
1560
  }
1561
1561
  }
1562
- if (e.type === T.Named) {
1562
+ if (e.type === x.Named) {
1563
1563
  const t = vt(e);
1564
1564
  if (void 0 !== t) {
1565
1565
  const r = t.toUpperCase();
@@ -1579,7 +1579,7 @@ function At(e, t = null) {
1579
1579
  return e;
1580
1580
  }
1581
1581
  const o = i(e);
1582
- if (o.type === T.Function && "string" == typeof o.value && "ISOMITTED" === (t?.(o.value)?.getName() ?? o.value).toUpperCase()) {
1582
+ if (o.type === x.Function && "string" == typeof o.value && "ISOMITTED" === (t?.(o.value)?.getName() ?? o.value).toUpperCase()) {
1583
1583
  const e = o.inputs;
1584
1584
  if (e) {
1585
1585
  let n;
@@ -1606,37 +1606,37 @@ function At(e, t = null) {
1606
1606
  return l(e);
1607
1607
  }
1608
1608
  var St = (e) => {
1609
- if (e?.type !== T.Cell || void 0 === e.image) return !1;
1609
+ if (e?.type !== x.Cell || void 0 === e.image) return !1;
1610
1610
  const t = e.value;
1611
1611
  return t.rowIndex === Number.MIN_SAFE_INTEGER && !0 !== t.$colIndex && !t.scope;
1612
1612
  }, wt = (e) => {
1613
- const t = a(e.image);
1614
- return I(t, e), t;
1615
- }, Ct = (e) => e?.type === T.Cell, Nt = (e, t = null) => {
1613
+ const t = l(e.image);
1614
+ return n(t, e), t;
1615
+ }, Ct = (e) => e?.type === x.Cell, Nt = (e, t = null) => {
1616
1616
  if (!e) return e;
1617
- let n = !1;
1618
- const r = (e) => {
1619
- if (n || !e) return;
1620
- const i = gt(e, t), l = e.inputs;
1621
- if (i && l) {
1622
- const e = "let" === i ? 2 : 1;
1623
- for (let t = 0; t < l.length - 1; t += e) if (Ct(l[t])) return void (n = !0);
1617
+ let r = !1;
1618
+ const i = (e) => {
1619
+ if (r || !e) return;
1620
+ const n = gt(e, t), l = e.inputs;
1621
+ if (n && l) {
1622
+ const e = "let" === n ? 2 : 1;
1623
+ for (let t = 0; t < l.length - 1; t += e) if (Ct(l[t])) return void (r = !0);
1624
1624
  }
1625
- if (l) for (let e = 0; e < l.length && !n; e++) r(l[e]);
1625
+ if (l) for (let e = 0; e < l.length && !r; e++) i(l[e]);
1626
1626
  };
1627
- if (r(e), !n) return e;
1628
- let i = null;
1629
- const l = f(e, (e) => {
1630
- if (e?.type !== T.Cell) return;
1631
- const t = e.value, n = e.image;
1632
- if (!0 === t?.$colIndex || !0 === t?.$rowIndex) return void (i ??= `'${n ?? "a reference"}' cannot be absolute here. A LET/LAMBDA name that is a cell reference makes every reference in the formula a name, and a name cannot contain '$'.`);
1633
- if (void 0 === n) return;
1634
- const r = a(n);
1635
- I(r, e);
1636
- const l = t?.scope;
1637
- return l && (r.value.scope = l, r.value.scopeImage = t.scopeImage), r;
1627
+ if (i(e), !r) return e;
1628
+ let s = null;
1629
+ const o = b(e, (e) => {
1630
+ if (e?.type !== x.Cell) return;
1631
+ const t = e.value, r = e.image;
1632
+ if (!0 === t?.$colIndex || !0 === t?.$rowIndex) return void (s ??= `'${r ?? "a reference"}' cannot be absolute here. A LET/LAMBDA name that is a cell reference makes every reference in the formula a name, and a name cannot contain '$'.`);
1633
+ if (void 0 === r) return;
1634
+ const i = l(r);
1635
+ n(i, e);
1636
+ const o = t?.scope;
1637
+ return o && (i.value.scope = o, i.value.scopeImage = t.scopeImage), i;
1638
1638
  });
1639
- return i ?? l;
1639
+ return s ?? o;
1640
1640
  }, Ft = (e, t) => {
1641
1641
  if (!e) return null;
1642
1642
  let n = null;
@@ -1647,7 +1647,7 @@ var St = (e) => {
1647
1647
  const r = "let" === t ? "LET" : "LAMBDA", i = e.inputs, l = i?.length ?? 0;
1648
1648
  if (!i || l < 2) return;
1649
1649
  if ("let" === t && l % 2 == 0) return void (n = `Wrong number of arguments for LET. Expected name/value pairs followed by a calculation, but got ${l}.`);
1650
- if ("lambda" === t && i[l - 1]?.type === T.Empty) return void (n = "LAMBDA has no calculation: the last argument is empty.");
1650
+ if ("lambda" === t && i[l - 1]?.type === x.Empty) return void (n = "LAMBDA has no calculation: the last argument is empty.");
1651
1651
  const s = /* @__PURE__ */ new Set(), o = "let" === t ? 2 : 1;
1652
1652
  let a = !1;
1653
1653
  for (let e = 0; e < l - 1; e += o) {
@@ -1666,109 +1666,109 @@ var St = (e) => {
1666
1666
  };
1667
1667
  return r(e), n;
1668
1668
  };
1669
- function Pt(e, t, n, r, i) {
1670
- const l = r;
1671
- let s;
1672
- const a = () => (void 0 === s && (s = i && n ? t.bind(b.Table, "", { at: {
1673
- scope: n,
1674
- rowIndex: i.rowIndex,
1675
- colIndex: i.colIndex
1676
- } }) : null), s);
1677
- return f(e, (e, r, i = []) => {
1678
- let s;
1679
- const u = e.type;
1680
- if (u === T.Cell) {
1669
+ function Pt(e, t, r, l, s) {
1670
+ const o = l;
1671
+ let a;
1672
+ const u = () => (void 0 === a && (a = s && r ? t.bind(y.Table, "", { at: {
1673
+ scope: r,
1674
+ rowIndex: s.rowIndex,
1675
+ colIndex: s.colIndex
1676
+ } }) : null), a);
1677
+ return b(e, (e, l, s = []) => {
1678
+ let a;
1679
+ const c = e.type;
1680
+ if (c === x.Cell) {
1681
1681
  const n = e.value;
1682
1682
  if (n?.scope) {
1683
- const r = t.bind(b.Sheet, n.scope, l);
1684
- null !== r && (s || (s = { ...e }), s.value = {
1683
+ const r = t.bind(y.Sheet, n.scope, o);
1684
+ null !== r && (a || (a = { ...e }), a.value = {
1685
1685
  ...n,
1686
1686
  scope: r
1687
1687
  });
1688
1688
  }
1689
- } else if (u === T.Named) {
1690
- const r = e.value;
1691
- if (r && !e.binding) {
1692
- const i = function(e, t, n, r) {
1689
+ } else if (c === x.Named) {
1690
+ const l = e.value;
1691
+ if (l && !e.binding) {
1692
+ const s = function(e, t, r, l) {
1693
1693
  if (t.scope) {
1694
- const e = n.bind(b.Sheet, t.scope, r);
1695
- if (null === e || o(e)) return;
1694
+ const e = r.bind(y.Sheet, t.scope, l);
1695
+ if (null === e || i(e)) return;
1696
1696
  }
1697
- const i = n.bind(b.Table, t.nameId, { existing: !0 });
1698
- if (null === i) return;
1699
- const l = {
1700
- type: T.TableReference,
1701
- value: i,
1697
+ const s = r.bind(y.Table, t.nameId, { existing: !0 });
1698
+ if (null === s) return;
1699
+ const o = {
1700
+ type: x.TableReference,
1701
+ value: s,
1702
1702
  inputs: null,
1703
1703
  isReference: !0
1704
1704
  };
1705
- I(l, e);
1706
- const s = t.scopeImage;
1707
- return "string" == typeof s && void 0 !== e.image && (l.image = s + e.image), l;
1708
- }(e, r, t, l);
1709
- if (i) return i;
1710
- const a = r.scope ? t.bind(b.Sheet, r.scope, l) : null, u = (null !== a ? o(a) ? a : t.resolve(b.Sheet, a)?.toString() ?? r.scope : r.scope) ?? n, c = t.bind(b.NamedFormula, r.nameId, u ? { scope: u } : void 0);
1711
- null === c && null === a || (s || (s = { ...e }), s.value = {
1712
- ...r,
1713
- nameId: c ?? r.nameId,
1714
- ...null !== a ? { scope: a } : void 0
1705
+ n(o, e);
1706
+ const a = t.scopeImage;
1707
+ return "string" == typeof a && void 0 !== e.image && (o.image = a + e.image), o;
1708
+ }(e, l, t, o);
1709
+ if (s) return s;
1710
+ const u = l.scope ? t.bind(y.Sheet, l.scope, o) : null, c = (null !== u ? i(u) ? u : t.resolve(y.Sheet, u)?.toString() ?? l.scope : l.scope) ?? r, f = t.bind(y.NamedFormula, l.nameId, c ? { scope: c } : void 0);
1711
+ null === f && null === u || (a || (a = { ...e }), a.value = {
1712
+ ...l,
1713
+ nameId: f ?? l.nameId,
1714
+ ...null !== u ? { scope: u } : void 0
1715
1715
  });
1716
1716
  }
1717
- } else if (u === T.Error) {
1717
+ } else if (c === x.Error) {
1718
1718
  const n = e.value;
1719
1719
  if (n?.scope) {
1720
- const r = t.bind(b.Sheet, n.scope, l);
1721
- null !== r && (s || (s = { ...e }), s.value = {
1720
+ const r = t.bind(y.Sheet, n.scope, o);
1721
+ null !== r && (a || (a = { ...e }), a.value = {
1722
1722
  ...n,
1723
1723
  scope: r
1724
1724
  });
1725
1725
  }
1726
- } else if (u === T.TableReference) {
1726
+ } else if (c === x.TableReference) {
1727
1727
  const n = e.value;
1728
1728
  if (n) {
1729
- const r = t.bind(b.Table, n);
1730
- s || (s = { ...e }), null !== r && (s.value = r);
1729
+ const r = t.bind(y.Table, n);
1730
+ a || (a = { ...e }), null !== r && (a.value = r);
1731
1731
  } else if ("string" == typeof n) {
1732
- const n = a();
1733
- if (null !== n && Lt(e, t)) return {
1732
+ const n = u();
1733
+ if (null !== n && kt(e, t)) return {
1734
1734
  ...e,
1735
1735
  value: n
1736
1736
  };
1737
1737
  }
1738
- } else if (u === T.TableColumn) {
1738
+ } else if (c === x.TableColumn) {
1739
1739
  const n = e.value;
1740
1740
  if (n) {
1741
- const r = pe(i, T.TableReference), l = r?.value || (r ? a() ?? void 0 : void 0), o = t.bind(b.TableColumn, n, l ? { tableName: l } : void 0);
1742
- s || (s = { ...e }), null !== o && (s.value = o);
1741
+ const r = pe(s, x.TableReference), i = r?.value || (r ? u() ?? void 0 : void 0), l = t.bind(y.TableColumn, n, i ? { tableName: i } : void 0);
1742
+ a || (a = { ...e }), null !== l && (a.value = l);
1743
1743
  }
1744
- } else if (u === T.Function) {
1744
+ } else if (c === x.Function) {
1745
1745
  const n = e.value;
1746
1746
  if (n) {
1747
- const r = t.bind(b.Function, n);
1748
- s || (s = { ...e }), null !== r && (s.value = r);
1747
+ const r = t.bind(y.Function, n);
1748
+ a || (a = { ...e }), null !== r && (a.value = r);
1749
1749
  }
1750
1750
  }
1751
- return s;
1751
+ return a;
1752
1752
  });
1753
1753
  }
1754
- function Lt(e, t) {
1754
+ function kt(e, t) {
1755
1755
  let n = !0;
1756
1756
  const r = e.inputs;
1757
1757
  if (!r) return !0;
1758
- for (let e = 0; e < r.length && n; e++) f(r[e], (e) => {
1759
- e.type === T.TableColumn && null === t.resolve(b.TableColumn, e.value) && (n = !1);
1758
+ for (let e = 0; e < r.length && n; e++) b(r[e], (e) => {
1759
+ e.type === x.TableColumn && null === t.resolve(y.TableColumn, e.value) && (n = !1);
1760
1760
  });
1761
1761
  return n;
1762
1762
  }
1763
- function kt(e, t) {
1763
+ function Lt(e, t) {
1764
1764
  let n = null;
1765
- return f(e, (e) => {
1766
- if (n || e.type !== T.TableReference) return;
1765
+ return b(e, (e) => {
1766
+ if (n || e.type !== x.TableReference) return;
1767
1767
  if ("" === e.value) return void (n = "A structured reference without a table name must be in a table that has its columns.");
1768
1768
  const r = e.value;
1769
1769
  if (!t || "string" != typeof r) return;
1770
- const i = t.resolve(b.Table, r)?.toString() ?? r;
1771
- null === t.bind(b.Table, i, { existing: !0 }) ? n = `There is no table named '${i}'.` : Lt(e, t) || (n = "The table has no such column.");
1770
+ const i = t.resolve(y.Table, r)?.toString() ?? r;
1771
+ null === t.bind(y.Table, i, { existing: !0 }) ? n = `There is no table named '${i}'.` : kt(e, t) || (n = "The table has no such column.");
1772
1772
  }), n;
1773
1773
  }
1774
- export { ce as A, Re as C, ve as D, bt as E, ae as O, qe as S, ye as T, nt as _, Ke as a, He as b, dt as c, st as d, kt as f, he as g, ge as h, Ie as i, ue as j, fe as k, ct as l, Ze as m, xt as n, ft as o, pt as p, At as r, Ft as s, _e as t, ot as u, Pt as v, Nt as w, be as x, me as y };
1774
+ export { ce as A, Re as C, ve as D, bt as E, ae as O, Ze as S, ye as T, nt as _, qe as a, He as b, dt as c, st as d, Lt as f, he as g, ge as h, Ie as i, ue as j, fe as k, ct as l, Ke as m, xt as n, ft as o, pt as p, At as r, Ft as s, _e as t, ot as u, Pt as v, Nt as w, be as x, me as y };