@sheetxl/sdk 0.8.0-beta.16 → 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/{B6BdiHigbUdbZp3J.mjs → -P0fym6eh9hn9row.mjs} +2 -2
  2. package/browser/esm/{DlVnybrgwZWxWN3_.mjs → -nOfWMHdlTb9ShjF.mjs} +9 -9
  3. package/browser/esm/{CMChv-fCFh68VQQt.mjs → 0Mw5Ew_7tAiWgc5J.mjs} +14 -14
  4. package/browser/esm/{JV9Szh5qTssjxJoE.mjs → 1ktaHvjuYL6stU4C.mjs} +1 -1
  5. package/browser/esm/{HV0FkJ6k3Ils318J.mjs → B3ifnlsuky2L9HmB.mjs} +33 -33
  6. package/browser/esm/{BtNuoQIrrHw_jnbJ.mjs → B67q5ZrwyKvm3d6W.mjs} +3 -3
  7. package/browser/esm/{KpuD1kEcWB7cT0VM.mjs → BQSd_URWugiyNoNj.mjs} +2 -2
  8. package/browser/esm/{ad9PX897hYE4Srkc.mjs → BWHHWC6H2JgG11Kq.mjs} +2 -2
  9. package/browser/esm/{BlMYYQZP-QM-iBHz.mjs → BYbb2weYQCb_7KI3.mjs} +21 -21
  10. package/browser/esm/{WLlpmgLN5OVLoLrC.mjs → B_hrmyuWaH5VIFpV.mjs} +2 -2
  11. package/browser/esm/{d_t-7d5BD1AdHg3u.mjs → Bql31KGUYo0SCMwZ.mjs} +392 -392
  12. package/browser/esm/{D807piM0VSokWz-L.mjs → BtVpErObXYKJCwHG.mjs} +1 -1
  13. package/browser/esm/{BWY1qiidTUBVPJoD.mjs → By7_c19Kv2YQaDVF.mjs} +475 -475
  14. package/browser/esm/{Zp5-cTJ0Llb6EfGi.mjs → C6M_XM08QtHuaInQ.mjs} +3 -3
  15. package/browser/esm/{BxYuRTSF9ykc-Tpz.mjs → CBHwju4PYiv85_jD.mjs} +2 -2
  16. package/browser/esm/{D-iHJ3q4nwOLcn1D.mjs → CJhYhZtsey3OnWKd.mjs} +1 -1
  17. package/browser/esm/{Dx9Fya60meMpuHqm.mjs → CQlxAbhdxgfu0ERF.mjs} +1 -1
  18. package/browser/esm/{C3JOjQwdG9kAig7i.mjs → CVXOtvee4oFImGyR.mjs} +504 -504
  19. package/browser/esm/{9YWdxmSjzLN4j_ts.mjs → CXQLYHAhE5MLKxZ4.mjs} +37 -37
  20. package/browser/esm/{CUu3zeHqcwMRYiov.mjs → CZiJYw94Yt7xslXS.mjs} +1 -1
  21. package/browser/esm/{BxFzcCYhvo9NXFjC.mjs → ChRUNekYurtOtrP1.mjs} +113 -113
  22. package/browser/esm/{dwGdnbV-CykjNrlm.mjs → CnobgPLHEsTPTFY5.mjs} +1 -1
  23. package/browser/esm/{WR146UAqrsUsL39e.mjs → CxNnMvwtOf76r7yY.mjs} +1 -1
  24. package/browser/esm/{U4FL-QeC0bRUhTEo.mjs → CzmmdfrOYDUGx-Yh.mjs} +1 -1
  25. package/browser/esm/{4MbBwfmW2hDXk9_w.mjs → D2P43UD6TGSXErhr.mjs} +2 -2
  26. package/browser/esm/{Bf80epSsm_RyAOb9.mjs → DH8NuKmZAC9EaqwP.mjs} +18 -18
  27. package/browser/esm/{WcHfawW2lkTHtWUd.mjs → DJuiV0Y8olnwuqB-.mjs} +21 -21
  28. package/browser/esm/{DcB52JPBPmkc3l1m.mjs → DKFaQ2QOyUPCk0sD.mjs} +3 -3
  29. package/browser/esm/{CRbQATfI0yZxe1kX.mjs → DLR8g1DkooIBl8S1.mjs} +2 -2
  30. package/browser/esm/{BF_QwkZ_hs2rFoTT.mjs → DNAXbbB8DGE2xeHy.mjs} +2 -2
  31. package/browser/esm/{BMo2_9Ul36IwRm3S.mjs → DQTUUXcERWI4l0to.mjs} +2 -2
  32. package/browser/esm/{C2PvZwqK-uvsugVS.mjs → DpFowFtk9AeU-89B.mjs} +1 -1
  33. package/browser/esm/{r-o0UCm7KtluNmyK.mjs → DyRVg5YJn7voOO6z.mjs} +2 -2
  34. package/browser/esm/{DW3oQ39IF0bsc_lm.mjs → Pn5Jc-47dk16sYQ4.mjs} +1 -1
  35. package/browser/esm/{BfoE6Dn_GQCIkQD3.mjs → _WWjW2f-YW-AVqAL.mjs} +1 -1
  36. package/browser/esm/{CkZoDPUCK5jMUaeJ.mjs → _lh_Rr5SwLthmbmu.mjs} +7924 -5938
  37. package/browser/esm/index.mjs +367 -366
  38. package/browser/esm/{DvVhatd0J1ch3OCO.mjs → mecFApGwMvcIzlpd.mjs} +36 -36
  39. package/browser/esm/{BqT-ASHP0NVSUUnY.mjs → n4LOSiYtWTzqQa4w.mjs} +661 -661
  40. package/{node/esm/CgdNA3B_GFG_yJiN.mjs → browser/esm/tJB0V8fKbukOYt9U.mjs} +2 -2
  41. package/browser/esm/{C5x0EzqElYGTiTQc.mjs → yRhetuEQfV7moa4B.mjs} +1 -1
  42. package/browser/esm/{e69NcYnKMLnAmqyA.mjs → ybFoQ6IijUJnBeCF.mjs} +1 -1
  43. package/node/esm/{BywIhvYkWk2o7MSW.mjs → 0313aQKBU4DE3v2j.mjs} +1 -1
  44. package/node/esm/{C884edhUf9yMqpPp.mjs → 3gjEEXV2aSt7cKeD.mjs} +1 -1
  45. package/node/esm/{BfPBiAgVmWhuFgFP.mjs → 3smtwEJ0ASF0tKBY.mjs} +2 -2
  46. package/node/esm/{_RIAmJI98l6bIFfZ.mjs → 4k3KKByrUw2Wr2TX.mjs} +1 -1
  47. package/node/esm/{Bknw7zWZhl2-w1pi.mjs → 90jp-mCVEr43zZTj.mjs} +2 -2
  48. package/node/esm/{DfWc3nW_Z_qqc_Wf.mjs → BAEmzj0gb8Cbgz7p.mjs} +3293 -3293
  49. package/node/esm/{CERNLhFrAwtu_p-q.mjs → BBC5dL9bXzOrQDGY.mjs} +1 -1
  50. package/node/esm/{CDHY-0OyQ9348Brb.mjs → BV0cJ_YP_0qzJuPt.mjs} +180 -180
  51. package/node/esm/{DvtyKKzOnoOM80NB.mjs → BcxcYoF_4GFL7Zkl.mjs} +15 -15
  52. package/node/esm/{DOt3t-13tsnM7Fj6.mjs → BesaVk0x7UyfLDk2.mjs} +1 -1
  53. package/node/esm/{Dhv9JymnXqcF54oo.mjs → C-LmDC9oNcbENOK1.mjs} +1 -1
  54. package/node/esm/{BvIPsPiHhMclZ1kH.mjs → CDkUQn5AwYGomlsT.mjs} +36 -36
  55. package/node/esm/{BH8J6vKSO5zI_TWo.mjs → CE4I5qfVmUBf7mED.mjs} +1 -1
  56. package/node/esm/{C_fYuynP2a_70WdL.mjs → CO0UDgbkHGwyTfev.mjs} +1 -1
  57. package/node/esm/{DgnwKbUEyQN5_gWT.mjs → CTWihjVB5uFX7U4j.mjs} +2 -2
  58. package/node/esm/{Cxak8i2NidZ4Uv6v.mjs → CUNaLYCntlclipWu.mjs} +497 -497
  59. package/node/esm/{RTwm9ge1KoPdlBNt.mjs → CY9JqXFJTt5pGhC3.mjs} +1 -1
  60. package/node/esm/{DELfV5HQZo1mInBd.mjs → C_Sqy290v4uzyi1E.mjs} +3 -3
  61. package/node/esm/{BLmdKnkLwkb3wWe6.mjs → Cf-cK3yPe9bjK6o2.mjs} +561 -561
  62. package/node/esm/{CVPieTgKCwkL21nD.mjs → CpvUwhAeDmdEpdR-.mjs} +10662 -8680
  63. package/{browser/esm/C_jLGkFemj55_BP3.mjs → node/esm/Crhg3srH-O5sJERh.mjs} +2 -2
  64. package/node/esm/{CJDV8P3hI8lu--3Z.mjs → Cx2U91jhiTDz600y.mjs} +116 -116
  65. package/node/esm/{BZSxu_ZqX8-Uczzn.mjs → CyWWKan_uk4dHZ6P.mjs} +1 -1
  66. package/node/esm/{CLtUMJfKsy4SevWE.mjs → D48MjKzkj37XsVm1.mjs} +2 -2
  67. package/node/esm/{kaiXmn0AA5WDsLPo.mjs → D7c0zfLVoG7EEln5.mjs} +43 -43
  68. package/node/esm/{A3PEHO1HJvkHfb5n.mjs → D8J4JmOPwG_Yr2GD.mjs} +1 -1
  69. package/node/esm/{By2TFKOjA1HekZap.mjs → D91qb21TrJX98Rw8.mjs} +3 -3
  70. package/node/esm/{D88A3UpCyGRjcX3U.mjs → D9D2NyyKbWXpTj5I.mjs} +2 -2
  71. package/node/esm/{mTIhoz1gEcaEm7s1.mjs → DBF7pIpitcmhi65H.mjs} +2 -2
  72. package/node/esm/{KDGrIa9R5XzWfjM2.mjs → DLPVrV723TSxkXqL.mjs} +1 -1
  73. package/node/esm/{Cs3ibv6YHCDwLRlk.mjs → DWsnb-a-9dfRn5jJ.mjs} +24 -24
  74. package/node/esm/{B4WUGzJBkQu7BXRm.mjs → Dj1pybJRqeZiP1Z6.mjs} +1 -1
  75. package/node/esm/{DBIUe2BC9xU7qMHR.mjs → DtNJOImWtsXVrQps.mjs} +2 -2
  76. package/node/esm/{5OfKfTRX2_y2NwpU.mjs → DxROQlX1KHLb9tHS.mjs} +1 -1
  77. package/node/esm/{446KYBjJQa8g-8Gg.mjs → dp4LxzOEkfTbVX_1.mjs} +21 -21
  78. package/node/esm/{C3zyhnMwQ2hRQBz7.mjs → ee_DgHTffiVTOiU2.mjs} +21 -21
  79. package/node/esm/{CFkX_Cn6avQqQiVC.mjs → fMFapG4AGMQKX8c5.mjs} +33 -33
  80. package/node/esm/index.mjs +545 -544
  81. package/node/esm/{CKwiipdPJGzAiPjg.mjs → jmElgIMAkpc2Ab1m.mjs} +1 -1
  82. package/node/esm/{bIGdvfpnijWeCac6.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,31 +1,31 @@
1
1
  /**
2
- * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.16
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 a, Qi as o, St as s, Ur as c, _ as l, bt as u, ci as d, di as f, dt as p, ei as m, f as h, fi as ee, h as g, ia as _, jr as v, jt as y, la as b, n as te, p as ne, pi as x, ri as S, s as C, si as w, ti as T, u as E, ur as D } from "./CkZoDPUCK5jMUaeJ.mjs";
8
- import { an as re } from "./CMChv-fCFh68VQQt.mjs";
9
- import { FormulaError as O, Scalar as k, ScalarType as A, ValueKind as j, isLazyValue as M } from "@sheetxl/primitives";
10
- import { CommonUtils as N } from "@sheetxl/utils";
11
- var ie = (e, t) => e + t, ae = (e, t) => e - t, oe = (e, t) => p(e + t, e), se = (e, t) => p(e - t, e), ce = (e, t) => h(e * t), le = (e, t) => t === 0 ? O.BuiltIn.Div0 : h(e / t), ue = (e, t) => {
7
+ import { $i as e, Ct as t, Mr as n, Nr as r, St as i, Wr as a, _ as o, aa as s, bt as c, ci as l, dr as u, dt as d, f, fi as p, h as m, ii as h, ja as g, jr as _, jt as v, kr as y, li as b, mi as x, n as ee, ni as S, p as te, pi as ne, qr as C, s as w, ti as T, u as E, ua as D } from "./_lh_Rr5SwLthmbmu.mjs";
8
+ import { an as re } from "./0Mw5Ew_7tAiWgc5J.mjs";
9
+ import { FormulaError as O, Scalar as k, ScalarType as A, ValueKind as j, isLazyValue as ie } from "@sheetxl/primitives";
10
+ import { CommonUtils as M } from "@sheetxl/utils";
11
+ var ae = (e, t) => e + t, oe = (e, t) => e - t, se = (e, t) => d(e + t, e), ce = (e, t) => d(e - t, e), le = (e, t) => f(e * t), ue = (e, t) => t === 0 ? O.BuiltIn.Div0 : f(e / t), de = (e, t) => {
12
12
  if (e === 0) {
13
13
  if (t < 0) return O.BuiltIn.Div0;
14
14
  if (t === 0) return NaN;
15
15
  }
16
16
  if (e < 0) {
17
- if (Number.isInteger(t) && Math.abs(t) <= 4294967294) return h(e ** t);
17
+ if (Number.isInteger(t) && Math.abs(t) <= 4294967294) return f(e ** t);
18
18
  let n = Number((1 / t).toPrecision(15));
19
- return Number.isInteger(n) && Math.abs(n % 2) === 1 ? h(-((-e) ** t)) : NaN;
19
+ return Number.isInteger(n) && Math.abs(n % 2) === 1 ? f(-((-e) ** t)) : NaN;
20
20
  }
21
- return h(e ** t);
22
- }, de = (t = "", n = "") => {
23
- t === null && (t = ""), n === null && (n = "");
24
- let r = typeof n;
25
- typeof t == "boolean" && (t = e(t)), r === "boolean" && (n = e(n));
26
- let i = "" + t + n;
27
- return i.length > k.MAX_TEXT_LENGTH ? i.slice(0, k.MAX_TEXT_LENGTH) : i;
28
- }, fe = (e, t = null, n = null) => e.compare(t, n) === 0, pe = (e, t = null, n = null) => e.compare(t, n) !== 0, me = (e, t = null, n = null) => e.compare(t, n) > 0, he = (e, t = null, n = null) => e.compare(t, n) >= 0, ge = (e, t = null, n = null) => e.compare(t, n) < 0, _e = (e, t = null, n = null) => e.compare(t, n) <= 0, ve = {
21
+ return f(e ** t);
22
+ }, fe = (e = "", t = "") => {
23
+ e === null && (e = ""), t === null && (t = "");
24
+ let n = typeof t;
25
+ typeof e == "boolean" && (e = g(e)), n === "boolean" && (t = g(t));
26
+ let r = "" + e + t;
27
+ return r.length > k.MAX_TEXT_LENGTH ? r.slice(0, k.MAX_TEXT_LENGTH) : r;
28
+ }, pe = (e, t = null, n = null) => e.compare(t, n) === 0, me = (e, t = null, n = null) => e.compare(t, n) !== 0, he = (e, t = null, n = null) => e.compare(t, n) > 0, ge = (e, t = null, n = null) => e.compare(t, n) >= 0, _e = (e, t = null, n = null) => e.compare(t, n) < 0, ve = (e, t = null, n = null) => e.compare(t, n) <= 0, N = {
29
29
  type: A.Number,
30
30
  coerce: [A.Boolean, A.String],
31
31
  onError: "value",
@@ -45,19 +45,19 @@ var ie = (e, t) => e + t, ae = (e, t) => e - t, oe = (e, t) => p(e + t, e), se =
45
45
  let i, a;
46
46
  if (t?.isIRange ? i = t : n?.isIRange && (a = n), !i && !a) {
47
47
  let i = e.getRuntime();
48
- return t = C(i, t, l(t, !0), A.Number, !0), n = C(i, n, l(n, !0), A.Number, !0), t && O.isError(t) ? t : n && O.isError(n) ? n : r(t, n);
48
+ return t = w(i, t, o(t, !0), A.Number, !0), n = w(i, n, o(n, !0), A.Number, !0), t && O.isError(t) ? t : n && O.isError(n) ? n : r(t, n);
49
49
  }
50
- let o = !i, s = o ? t : n;
51
- return (i ?? a).broadcast(s, (t, n) => t && O.isError(t) ? t : n && O.isError(n) ? n : g(o ? r(n, t) : r(t, n), e), ve).fillEmpty(0);
50
+ let s = !i, c = s ? t : n;
51
+ return (i ?? a).broadcast(c, (t, n) => t && O.isError(t) ? t : n && O.isError(n) ? n : m(s ? r(n, t) : r(t, n), e), N).fillEmpty(0);
52
52
  }, I = (e, t, n, r) => {
53
- if (D(t) || D(n) || M(t) || M(n)) return O.BuiltIn.Value;
53
+ if (u(t) || u(n) || ie(t) || ie(n)) return O.BuiltIn.Value;
54
54
  if (t !== null && t.colStart !== void 0 && (t = e.getValueAt(t.rowStart, t.colStart, t.scope)) && O.isError(t)) return t;
55
55
  if (n !== null && n.colStart !== void 0 && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && O.isError(n)) return n;
56
56
  let i, a;
57
57
  t = P(t), n = P(n);
58
58
  let o = !1;
59
59
  return t?.isIRange ? (i = t, a = n) : n?.isIRange && (i = n, a = t, o = !0), i ? i.broadcast(a, (t, n) => t && O.isError(t) ? t : n && O.isError(n) ? n : (t = L(t), n = L(n), o ? r(e, n, t) : r(e, t, n)), be) : O.isError(t) ? t : O.isError(n) ? n : r(e, L(t), L(n));
60
- }, L = (e) => !0 === e?.isIRichData ? e.toPrimitive?.() ?? e : e, xe = (e, t, n) => {
60
+ }, L = (e) => !0 === e?.isIRichData ? e.toPrimitive?.() ?? e : e, R = (e, t, n) => {
61
61
  if (n ??= 0, n !== null && n.colStart !== void 0 && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && O.isError(n)) return n;
62
62
  n = P(n);
63
63
  let r, i = 1;
@@ -65,12 +65,12 @@ var ie = (e, t) => e + t, ae = (e, t) => e - t, oe = (e, t) => p(e + t, e), se =
65
65
  if (t !== "-") throw new O.Value(`Unrecognized prefix: ${t}`);
66
66
  if (i = -i, n?.isIRange && (r = n), !r) {
67
67
  let t = e.getRuntime();
68
- return typeof (n = C(t, n, l(n, !0), A.Number, !0)) == "number" ? n * i : O.BuiltIn.Value;
68
+ return typeof (n = w(t, n, o(n, !0), A.Number, !0)) == "number" ? n * i : O.BuiltIn.Value;
69
69
  }
70
- return r.broadcast(i, (e, t) => e && O.isError(e) ? e : t && O.isError(t) ? t : ce(e, t), ve);
71
- }, R = (e) => e.getCode() <= O.Code.NA ? e : O.BuiltIn.Value, z = (e, t, n, r, i) => {
72
- if (O.isError(t)) return R(t);
73
- if (n && O.isError(n)) return R(n);
70
+ return r.broadcast(i, (e, t) => e && O.isError(e) ? e : t && O.isError(t) ? t : le(e, t), N);
71
+ }, z = (e) => e.getCode() <= O.Code.NA ? e : O.BuiltIn.Value, B = (e, t, n, r, i) => {
72
+ if (O.isError(t)) return z(t);
73
+ if (n && O.isError(n)) return z(n);
74
74
  if (!t) return O.BuiltIn.Ref;
75
75
  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()), t.colStart === void 0 || (n.isIReferenceRange && (n = n.getCoords()), n.colStart === void 0)) return O.BuiltIn.Value;
76
76
  let a = t.scope ? i !== "either" || n.scope ? null : t : n;
@@ -81,24 +81,24 @@ var ie = (e, t) => e + t, ae = (e, t) => e - t, oe = (e, t) => p(e + t, e), se =
81
81
  }
82
82
  let o = r(t, n);
83
83
  return O.isError(o) ? o : o ? e.getReference(o) : O.BuiltIn.Null;
84
- }, Se = {
85
- "+": (e, t, n) => F(e, t, n, ie),
86
- "-": (e, t, n) => F(e, t, n, ae),
87
- "*": (e, t, n) => F(e, t, n, ce),
88
- "/": (e, t, n) => F(e, t, n, le),
89
- "^": (e, t, n) => F(e, t, n, ue),
90
- " ": (e, t, n, r) => z(e, t, n, o, "either"),
91
- ":": (e, t, n, r) => z(e, t, n, b, "start"),
84
+ }, xe = {
85
+ "+": (e, t, n) => F(e, t, n, ae),
86
+ "-": (e, t, n) => F(e, t, n, oe),
87
+ "*": (e, t, n) => F(e, t, n, le),
88
+ "/": (e, t, n) => F(e, t, n, ue),
89
+ "^": (e, t, n) => F(e, t, n, de),
90
+ " ": (t, n, r, i) => B(t, n, r, e, "either"),
91
+ ":": (e, t, n, r) => B(e, t, n, D, "start"),
92
92
  ".:.": (e, t, n, r) => {
93
- let i = z(e, t, n, b, "start");
93
+ let i = B(e, t, n, D, "start");
94
94
  return e.getFunction("TRIMRANGE").execute(i, 3, 3);
95
95
  },
96
96
  ".:": (e, t, n, r) => {
97
- let i = z(e, t, n, b, "start");
97
+ let i = B(e, t, n, D, "start");
98
98
  return e.getFunction("TRIMRANGE").execute(i, 1, 1);
99
99
  },
100
100
  ":.": (e, t, n, r) => {
101
- let i = z(e, t, n, b, "start");
101
+ let i = B(e, t, n, D, "start");
102
102
  return e.getFunction("TRIMRANGE").execute(i, 2, 2);
103
103
  },
104
104
  "&": (e, t, n) => ((e, t, n, r) => {
@@ -108,23 +108,23 @@ var ie = (e, t) => e + t, ae = (e, t) => e - t, oe = (e, t) => p(e + t, e), se =
108
108
  let i, a;
109
109
  if (t?.isIRange ? i = t : n?.isIRange && (a = n), !i && !a) {
110
110
  let i = e.getRuntime();
111
- return t = C(i, t, l(t, !0), A.String, !1), n = C(i, n, l(n, !0), A.String, !1), O.isError(t) ? t : O.isError(n) ? n : r(t, n);
111
+ return t = w(i, t, o(t, !0), A.String, !1), n = w(i, n, o(n, !0), A.String, !1), O.isError(t) ? t : O.isError(n) ? n : r(t, n);
112
112
  }
113
- let o = !i, s = o ? t : n;
114
- return (i ?? a).broadcast(s, (e, t) => e && O.isError(e) ? e : t && O.isError(t) ? t : o ? r(t, e) : r(e, t), ye);
115
- })(e, t, n, de),
116
- "=": (e, t, n) => I(e, t, n, fe),
117
- "<>": (e, t, n) => I(e, t, n, pe),
118
- ">": (e, t, n) => I(e, t, n, me),
119
- "<": (e, t, n) => I(e, t, n, ge),
120
- ">=": (e, t, n) => I(e, t, n, he),
121
- "<=": (e, t, n) => I(e, t, n, _e)
113
+ let s = !i, c = s ? t : n;
114
+ return (i ?? a).broadcast(c, (e, t) => e && O.isError(e) ? e : t && O.isError(t) ? t : s ? r(t, e) : r(e, t), ye);
115
+ })(e, t, n, fe),
116
+ "=": (e, t, n) => I(e, t, n, pe),
117
+ "<>": (e, t, n) => I(e, t, n, me),
118
+ ">": (e, t, n) => I(e, t, n, he),
119
+ "<": (e, t, n) => I(e, t, n, _e),
120
+ ">=": (e, t, n) => I(e, t, n, ge),
121
+ "<=": (e, t, n) => I(e, t, n, ve)
122
+ }, Se = {
123
+ "+": (e, t, n) => F(e, t, n, se),
124
+ "-": (e, t, n) => F(e, t, n, ce)
122
125
  }, Ce = {
123
- "+": (e, t, n) => F(e, t, n, oe),
124
- "-": (e, t, n) => F(e, t, n, se)
125
- }, we = {
126
- "-": (e, t) => xe(e, "-", t),
127
- "+": (e, t) => xe(e, "+", t),
126
+ "-": (e, t) => R(e, "-", t),
127
+ "+": (e, t) => R(e, "+", t),
128
128
  "@": (e, t) => {
129
129
  if (!t || !t.isIRange) return t;
130
130
  let n = t;
@@ -132,14 +132,14 @@ var ie = (e, t) => e + t, ae = (e, t) => e - t, oe = (e, t) => p(e + t, e), se =
132
132
  let r = t.getCoords(), i = n.getRowCount(), a = n.getColumnCount(), o = e.getRow() - r.rowStart, s = e.getColumn() - r.colStart, c = o >= 0 && o < i, l = s >= 0 && s < a;
133
133
  return c && l ? n.getValueAt(o, s) : c && a === 1 ? n.getValueAt(o, 0) : l && i === 1 ? n.getValueAt(0, s) : i === 1 && a === 1 ? n.getValueAt(0, 0) : O.BuiltIn.Value;
134
134
  }
135
- }, Te = {
136
- "%": (e, t) => F(e, t, 100, le),
137
- "#": (e, t) => O.isError(t) ? R(t) : t ? (t.isIReferenceRange && (t = t.getCoords()), t.colStart === void 0 ? O.BuiltIn.Value : t.rowStart !== t.rowEnd || t.colStart !== t.colEnd ? O.BuiltIn.Ref : e.getSpillAt(t.rowStart, t.colStart, t.scope) || O.BuiltIn.Ref) : O.BuiltIn.Ref
135
+ }, we = {
136
+ "%": (e, t) => F(e, t, 100, ue),
137
+ "#": (e, t) => O.isError(t) ? z(t) : t ? (t.isIReferenceRange && (t = t.getCoords()), t.colStart === void 0 ? O.BuiltIn.Value : t.rowStart !== t.rowEnd || t.colStart !== t.colEnd ? O.BuiltIn.Ref : e.getSpillAt(t.rowStart, t.colStart, t.scope) || O.BuiltIn.Ref) : O.BuiltIn.Ref
138
138
  };
139
- function B(e, t) {
139
+ function V(e, t) {
140
140
  for (let n = e.length - 1; n >= 0; n--) if (e[n].type === t) return e[n];
141
141
  }
142
- var Ee = class {
142
+ var Te = class {
143
143
  constructor() {
144
144
  this.referenceIndices = [], this.rootReferences = /* @__PURE__ */ new Set(), this.cells = /* @__PURE__ */ new Map(), this.references = /* @__PURE__ */ new Map(), this.names = /* @__PURE__ */ new Map();
145
145
  }
@@ -167,14 +167,14 @@ var Ee = class {
167
167
  let r = n[e], i = this.references.get(r);
168
168
  i ? (i.hasHorizontalAbs && (t.hasHorizontalAbs = !0), i.hasVerticalAbs && (t.hasVerticalAbs = !0), a[e] = i.index) : a[e] = -1, i && this.rootReferences.delete(i);
169
169
  }
170
- if (this.rootReferences.add(t), it.includes(i)) {
170
+ if (this.rootReferences.add(t), rt.includes(i)) {
171
171
  let r = n[0], i = !!r && r.type === x.Cell, a = n[1], o = !!a && a.type === x.Cell;
172
172
  i && o && a.referenceIndex !== void 0 && r.referenceIndex !== void 0 && (this.referenceIndices.splice(a.referenceIndex, 1), a.referenceIndex = r.referenceIndex, e.referenceIndex = r.referenceIndex, this.referenceIndices[r.referenceIndex] = t.index);
173
173
  } else i === "#" && n[0] && (e.referenceIndex = n[0].referenceIndex);
174
174
  return;
175
175
  }
176
176
  if (n === x.Error || n === x.Named) {
177
- let r = n === x.Named ? e.value.nameId : m(e.value), i = this.names.get(r);
177
+ let r = n === x.Named ? e.value.nameId : T(e.value), i = this.names.get(r);
178
178
  t.op = n, i === void 0 && (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);
179
179
  return;
180
180
  }
@@ -191,218 +191,218 @@ var Ee = class {
191
191
  }
192
192
  }
193
193
  };
194
- function V(e, n = !1, r = f) {
195
- let i = [], o = /* @__PURE__ */ new Set(), s = (e, t, r) => {
196
- let a = {
194
+ function H(e, t = !1, n = p) {
195
+ let r = [], i = /* @__PURE__ */ new Set(), a = (e, n, a) => {
196
+ let o = {
197
197
  type: e.type,
198
- value: e.type === x.Error ? T(e.value) : e.value
198
+ value: e.type === x.Error ? S(e.value) : e.value
199
199
  };
200
- e.image !== void 0 && (a.text = ((e) => {
201
- let t = n ? e.value?.scopeImage : void 0;
202
- return typeof t == "string" ? t : "";
200
+ e.image !== void 0 && (o.text = ((e) => {
201
+ let n = t ? e.value?.scopeImage : void 0;
202
+ return typeof n == "string" ? n : "";
203
203
  })(e) + e.image);
204
- let s = e.evalIndex ?? r;
205
- return s !== void 0 && (a.evalIndex = s), t && (a.context = t), e.referenceIndex !== void 0 && (a.referenceIndex = e.referenceIndex), e.isReference && o.add(a), i.push(a), a;
206
- }, c = (e, t, n, r, a) => {
207
- if (t == null || i.length > 1 && e === x.Whitespace && i[i.length - 1].type === x.Whitespace) return;
204
+ let s = e.evalIndex ?? a;
205
+ return s !== void 0 && (o.evalIndex = s), n && (o.context = n), e.referenceIndex !== void 0 && (o.referenceIndex = e.referenceIndex), e.isReference && i.add(o), r.push(o), o;
206
+ }, o = (e, t, n, i, a) => {
207
+ if (t == null || r.length > 1 && e === x.Whitespace && r[r.length - 1].type === x.Whitespace) return;
208
208
  let o = {
209
209
  type: e,
210
210
  value: t,
211
211
  text: a ?? t
212
212
  };
213
- r !== void 0 && (o.evalIndex = r), n && (o.context = n), i.push(o);
213
+ i !== void 0 && (o.evalIndex = i), n && (o.context = n), r.push(o);
214
214
  };
215
- (function e(l, u, d) {
216
- let f = l.evalIndex ?? d ?? 0, p = l.type, m = (t, n, i) => {
215
+ (function e(s, c, l) {
216
+ let u = s.evalIndex ?? l ?? 0, d = s.type, f = (t, r, i) => {
217
217
  if (!t) return;
218
218
  let a = t.length;
219
- for (let o = 0; o < a; o++) e(t[o], n, i), o < a - 1 && c(x.Separator, ",", n, i, r.separatorFunction);
219
+ for (let s = 0; s < a; s++) e(t[s], r, i), s < a - 1 && o(x.Separator, ",", r, i, n.separatorFunction);
220
220
  };
221
- if (l.isLiteral) {
222
- if (c(x.Whitespace, l.wsBefore, u, f), p === x.Array) {
223
- c(x.Type, "{", u, f);
224
- let t = l.value, n = t.length;
225
- for (let i = 0; i < n; i++) {
226
- let a = t[i], o = a.value, s = o.length;
227
- for (let t = 0; t < s; t++) {
228
- let n = o[t];
229
- c(x.Whitespace, n.wsBefore, u, f), e(n, u, f), c(x.Whitespace, n.wsAfter, u, f), t < s - 1 && c(x.Separator, ",", u, f, r.separatorColumn);
221
+ if (s.isLiteral) {
222
+ if (o(x.Whitespace, s.wsBefore, c, u), d === x.Array) {
223
+ o(x.Type, "{", c, u);
224
+ let t = s.value, r = t.length;
225
+ for (let i = 0; i < r; i++) {
226
+ let a = t[i], s = a.value, l = s.length;
227
+ for (let t = 0; t < l; t++) {
228
+ let r = s[t];
229
+ o(x.Whitespace, r.wsBefore, c, u), e(r, c, u), o(x.Whitespace, r.wsAfter, c, u), t < l - 1 && o(x.Separator, ",", c, u, n.separatorColumn);
230
230
  }
231
- i < n - 1 && (c(x.Whitespace, a.wsBefore, u, f), c(x.Separator, ";", u, f, r.separatorRow), c(x.Whitespace, a.wsAfter, u, f));
231
+ i < r - 1 && (o(x.Whitespace, a.wsBefore, c, u), o(x.Separator, ";", c, u, n.separatorRow), o(x.Whitespace, a.wsAfter, c, u));
232
232
  }
233
- l.error || c(x.Type, "}", u, f);
234
- } else p === x.String && (l = {
235
- type: p,
236
- value: "\"" + `${l.value}`.replace(/"/g, "\"\"") + "\"",
237
- image: l.image
238
- }), s(l, u, f);
239
- c(x.Whitespace, l.wsAfter, u, f);
240
- } else if (p === x.Infix) e(l.inputs[0], u, f), c(x.Whitespace, l.wsBefore, u, f), s(l, u, f), c(x.Whitespace, l.wsAfter, u, f), e(l.inputs[1], u, f);
241
- else if (p === x.Prefix) c(x.Whitespace, l.wsBefore, u, f), s(l, u, f), c(x.Whitespace, l.wsAfter, u, f), l.inputs && e(l.inputs[0], u, f);
242
- else if (p === x.Postfix) {
243
- l.inputs?.[0] && e(l.inputs[0], u, f), c(x.Whitespace, l.wsBefore, u, f);
244
- let t = s(l, u, f), n = i[i.length - 2];
245
- l.value === "#" && t.text !== void 0 && !l.wsBefore && o.has(n) && (n.text = (n.text ?? "") + t.text, t.text = ""), c(x.Whitespace, l.wsAfter, u, f);
233
+ s.error || o(x.Type, "}", c, u);
234
+ } else d === x.String && (s = {
235
+ type: d,
236
+ value: "\"" + `${s.value}`.replace(/"/g, "\"\"") + "\"",
237
+ image: s.image
238
+ }), a(s, c, u);
239
+ o(x.Whitespace, s.wsAfter, c, u);
240
+ } else if (d === x.Infix) e(s.inputs[0], c, u), o(x.Whitespace, s.wsBefore, c, u), a(s, c, u), o(x.Whitespace, s.wsAfter, c, u), e(s.inputs[1], c, u);
241
+ else if (d === x.Prefix) o(x.Whitespace, s.wsBefore, c, u), a(s, c, u), o(x.Whitespace, s.wsAfter, c, u), s.inputs && e(s.inputs[0], c, u);
242
+ else if (d === x.Postfix) {
243
+ s.inputs?.[0] && e(s.inputs[0], c, u), o(x.Whitespace, s.wsBefore, c, u);
244
+ let t = a(s, c, u), n = r[r.length - 2];
245
+ s.value === "#" && t.text !== void 0 && !s.wsBefore && i.has(n) && (n.text = (n.text ?? "") + t.text, t.text = ""), o(x.Whitespace, s.wsAfter, c, u);
246
246
  } else {
247
- c(x.Whitespace, l.wsBefore, u, f);
248
- let d = l.inputs;
249
- switch (p) {
247
+ o(x.Whitespace, s.wsBefore, c, u);
248
+ let l = s.inputs;
249
+ switch (d) {
250
250
  case x.Function: {
251
- let t = String(l.value), n = {
251
+ let t = String(s.value), i = {
252
252
  type: x.Function,
253
253
  value: t,
254
- text: l.image ?? t,
255
- evalIndex: l.evalIndex
254
+ text: s.image ?? t,
255
+ evalIndex: s.evalIndex
256
256
  };
257
- u && (n.context = u), i.push(n);
257
+ c && (i.context = c), r.push(i);
258
258
  let a = {
259
259
  name: t,
260
260
  argIndex: -1,
261
- type: l.binder?.kind ?? "function"
261
+ type: s.binder?.kind ?? "function"
262
262
  };
263
- if (u?.bound && (a.bound = u.bound), c(x.Paren, "(", a, l.evalIndex), d) {
264
- let t = d.length, n = l.binder?.kind, i = n === "lambda" ? 1 : n === "let" ? 2 : 0, o = a.bound;
263
+ if (c?.bound && (a.bound = c.bound), o(x.Paren, "(", a, s.evalIndex), l) {
264
+ let t = l.length, r = s.binder?.kind, i = r === "lambda" ? 1 : r === "let" ? 2 : 0, c = a.bound;
265
265
  for (let s = 0; s < t; s++) {
266
- let l = i && s >= i ? d[s - i] : void 0;
267
- if (l?.binding?.declaration) {
268
- let e = l.value.nameId, t = n === "let" ? wt(d[s - 1]) : void 0;
269
- o = Ct(o, t ? {
266
+ let d = i && s >= i ? l[s - i] : void 0;
267
+ if (d?.binding?.declaration) {
268
+ let e = d.value.nameId, t = r === "let" ? Ct(l[s - 1]) : void 0;
269
+ c = St(c, t ? {
270
270
  name: e,
271
271
  params: t
272
272
  } : { name: e });
273
273
  }
274
- let u = {
274
+ let f = {
275
275
  ...a,
276
276
  argIndex: s
277
277
  };
278
- o && (u.bound = o), e(d[s], u, f), s < t - 1 && c(x.Separator, ",", u, f, r.separatorFunction);
278
+ c && (f.bound = c), e(l[s], f, u), s < t - 1 && o(x.Separator, ",", f, u, n.separatorFunction);
279
279
  }
280
280
  }
281
- l.error || c(x.Paren, ")", a, l.evalIndex);
281
+ s.error || o(x.Paren, ")", a, s.evalIndex);
282
282
  break;
283
283
  }
284
284
  case x.Call: {
285
- let n = t(l), o = i.length;
286
- if (n && e(n, u, f), n?.type === x.Named) for (let e = o; e < i.length; e++) {
287
- let t = i[e];
288
- t.type !== x.Whitespace && (t.evalIndex = l.evalIndex, t.type === x.Named && (t.type = x.Function, t.value = t.value.name));
285
+ let t = _(s), i = r.length;
286
+ if (t && e(t, c, u), t?.type === x.Named) for (let e = i; e < r.length; e++) {
287
+ let t = r[e];
288
+ t.type !== x.Whitespace && (t.evalIndex = s.evalIndex, t.type === x.Named && (t.type = x.Function, t.value = t.value.name));
289
289
  }
290
- let s = {
291
- name: n?.type === x.Named ? n.value.nameId : "",
290
+ let a = {
291
+ name: t?.type === x.Named ? t.value.nameId : "",
292
292
  argIndex: -1,
293
293
  type: "function"
294
294
  };
295
- u?.bound && (s.bound = u.bound), c(x.Paren, "(", s, l.evalIndex);
296
- let d = a(l), p = d.length;
297
- for (let t = 0; t < p; t++) {
298
- let n = {
299
- ...s,
295
+ c?.bound && (a.bound = c.bound), o(x.Paren, "(", a, s.evalIndex);
296
+ let l = y(s), d = l.length;
297
+ for (let t = 0; t < d; t++) {
298
+ let r = {
299
+ ...a,
300
300
  argIndex: t
301
301
  };
302
- e(d[t], n, f), t < p - 1 && c(x.Separator, ",", n, f, r.separatorFunction);
302
+ e(l[t], r, u), t < d - 1 && o(x.Separator, ",", r, u, n.separatorFunction);
303
303
  }
304
- l.error || c(x.Paren, ")", s, l.evalIndex);
304
+ s.error || o(x.Paren, ")", a, s.evalIndex);
305
305
  break;
306
306
  }
307
307
  case x.Cell:
308
- s(l, u, f);
308
+ a(s, c, u);
309
309
  break;
310
310
  case x.Paren:
311
- c(p, "(", u, f), m(d, u, f), l.error || c(p, ")", u, f);
311
+ o(d, "(", c, u), f(l, c, u), s.error || o(d, ")", c, u);
312
312
  break;
313
313
  case x.TableReference: {
314
- let t = l.value?.tableId ?? "", r = {
315
- name: t,
314
+ let n = s.value?.tableId ?? "", a = {
315
+ name: n,
316
316
  argIndex: -1,
317
317
  type: "table"
318
- }, a = i.length, s = l.image, p, m = !1;
319
- if (t && s) {
318
+ }, d = r.length, f = s.image, p, m = !1;
319
+ if (n && f) {
320
320
  let e = 0;
321
- if (s.charCodeAt(0) === 91) {
322
- let t = s.indexOf("]");
323
- t !== -1 && s.charCodeAt(t + 1) === 33 && (e = t + 2);
321
+ if (f.charCodeAt(0) === 91) {
322
+ let t = f.indexOf("]");
323
+ t !== -1 && f.charCodeAt(t + 1) === 33 && (e = t + 2);
324
324
  }
325
- let t = s.indexOf("[", e);
326
- if (m = t === 0 && d != null, t > 0) p = s.slice(0, t);
327
- else if (!d) {
328
- let e = s.lastIndexOf("!");
329
- p = n || e === -1 ? s : s.slice(e + 1);
325
+ let n = f.indexOf("[", e);
326
+ if (m = n === 0 && l != null, n > 0) p = f.slice(0, n);
327
+ else if (!l) {
328
+ let e = f.lastIndexOf("!");
329
+ p = t || e === -1 ? f : f.slice(e + 1);
330
330
  }
331
331
  }
332
- if (!t || m && n || c(x.TableReference, t, u, f, p), d && c(x.Paren, "[", r, f), d) {
333
- let t = d.length;
332
+ if (!n || m && t || o(x.TableReference, n, c, u, p), l && o(x.Paren, "[", a, u), l) {
333
+ let t = l.length;
334
334
  for (let n = 0; n < t; n++) {
335
- let i = {
336
- ...r,
335
+ let r = {
336
+ ...a,
337
337
  argIndex: n
338
338
  };
339
- e(d[n], i, f), n < t - 1 && c(x.Separator, ",", i, f);
339
+ e(l[n], r, u), n < t - 1 && o(x.Separator, ",", r, u);
340
340
  }
341
341
  }
342
- d && !l.error && c(x.Paren, "]", r, f);
343
- let h = l.referenceIndex;
344
- for (let e = a; e < i.length; e++) h !== void 0 && (i[e].referenceIndex = h), o.add(i[e]);
342
+ l && !s.error && o(x.Paren, "]", a, u);
343
+ let h = s.referenceIndex;
344
+ for (let e = d; e < r.length; e++) h !== void 0 && (r[e].referenceIndex = h), i.add(r[e]);
345
345
  break;
346
346
  }
347
347
  case x.TableSpecifier:
348
348
  case x.TableColumn: {
349
- let e = l.image, t = e != null && e.startsWith("[") && e.endsWith("]");
350
- t && c(x.Paren, "[", u, f);
349
+ let e = s.image, t = e != null && e.startsWith("[") && e.endsWith("]");
350
+ t && o(x.Paren, "[", c, u);
351
351
  let n = {
352
- table: u?.type === "table" ? u.name : "",
353
- name: l.value
354
- }, r = {
355
- type: p,
352
+ table: c?.type === "table" ? c.name : "",
353
+ name: s.value
354
+ }, i = {
355
+ type: d,
356
356
  value: n,
357
357
  text: t ? e.slice(1, -1) : e ?? n.name
358
358
  };
359
- f !== void 0 && (r.evalIndex = f), u && (r.context = u), i.push(r), t && c(x.Paren, "]", u, f);
359
+ u !== void 0 && (i.evalIndex = u), c && (i.context = c), r.push(i), t && o(x.Paren, "]", c, u);
360
360
  break;
361
361
  }
362
362
  case x.List:
363
- m(d, u, f);
363
+ f(l, c, u);
364
364
  break;
365
365
  case x.Named: {
366
- let e = s(l, u, f), t = l.value;
366
+ let e = a(s, c, u), t = s.value;
367
367
  e.value = t.scope ? {
368
368
  name: t.nameId,
369
369
  scope: t.scope
370
- } : { name: t.nameId }, l.binding?.declaration && l.binding.optional && (e.value.optional = !0), l.binding && (e.type = x.Parameter, l.binding.declaration && (e.value.declaration = !0)), delete e.referenceIndex;
370
+ } : { name: t.nameId }, s.binding?.declaration && s.binding.optional && (e.value.optional = !0), s.binding && (e.type = x.Parameter, s.binding.declaration && (e.value.declaration = !0)), delete e.referenceIndex;
371
371
  break;
372
372
  }
373
- default: l.value !== void 0 && s(l, u, f), d && d.forEach((t) => e(t, u, f));
373
+ default: s.value !== void 0 && a(s, c, u), l && l.forEach((t) => e(t, c, u));
374
374
  }
375
- c(x.Whitespace, l.wsAfter, u, f);
375
+ o(x.Whitespace, s.wsAfter, c, u);
376
376
  }
377
377
  })(e);
378
- let l = /* @__PURE__ */ new Map();
379
- for (let e of i) if (e.type === x.Cell && e.referenceIndex !== void 0) {
380
- let t = l.get(e.referenceIndex);
381
- t ? t.push(e) : l.set(e.referenceIndex, [e]);
378
+ let s = /* @__PURE__ */ new Map();
379
+ for (let e of r) if (e.type === x.Cell && e.referenceIndex !== void 0) {
380
+ let t = s.get(e.referenceIndex);
381
+ t ? t.push(e) : s.set(e.referenceIndex, [e]);
382
382
  }
383
- for (let e of l.values()) e.length === 1 ? e[0].refSide = "self" : (e[0].refSide = "left", e[e.length - 1].refSide = "right");
384
- let u = /* @__PURE__ */ new Map();
385
- for (let e of i) if (e.referenceIndex !== void 0 && e.evalIndex !== void 0) {
386
- let t = u.get(e.referenceIndex);
387
- (t === void 0 || e.evalIndex < t) && u.set(e.referenceIndex, e.evalIndex);
383
+ for (let e of s.values()) e.length === 1 ? e[0].refSide = "self" : (e[0].refSide = "left", e[e.length - 1].refSide = "right");
384
+ let c = /* @__PURE__ */ new Map();
385
+ for (let e of r) if (e.referenceIndex !== void 0 && e.evalIndex !== void 0) {
386
+ let t = c.get(e.referenceIndex);
387
+ (t === void 0 || e.evalIndex < t) && c.set(e.referenceIndex, e.evalIndex);
388
388
  }
389
- if (u.size > 0) {
390
- for (let e of i) if (e.referenceIndex !== void 0) {
391
- let t = u.get(e.referenceIndex);
389
+ if (c.size > 0) {
390
+ for (let e of r) if (e.referenceIndex !== void 0) {
391
+ let t = c.get(e.referenceIndex);
392
392
  t !== void 0 && (e.evalIndex = t);
393
393
  }
394
394
  }
395
- return i;
395
+ return r;
396
396
  }
397
- function De(e, t) {
397
+ function Ee(e, t) {
398
398
  let n = "";
399
399
  for (let r = 0; r < e.length; r++) {
400
400
  let i = e[r], a = i.type;
401
401
  if (a === x.Cell || a === x.Named || a === x.Error) {
402
- let e = a === x.Cell ? i.value?.scope : (x.Named, i.value?.scope ?? void 0), r = a === x.Error ? i.text !== void 0 && S(i.text) : i.text?.includes("!") ?? !1;
402
+ let e = a === x.Cell ? i.value?.scope : (x.Named, i.value?.scope ?? void 0), r = a === x.Error ? i.text !== void 0 && h(i.text) : i.text?.includes("!") ?? !1;
403
403
  if (e && i.text !== void 0 && !r) {
404
- let r = t?.resolve(y.Sheet, e)?.toString() ?? e;
405
- n += _(r) + "!" + i.text;
404
+ let r = t?.resolve(v.Sheet, e)?.toString() ?? e;
405
+ n += s(r) + "!" + i.text;
406
406
  continue;
407
407
  }
408
408
  if (a === x.Named) {
@@ -419,43 +419,43 @@ function De(e, t) {
419
419
  }
420
420
  return n;
421
421
  }
422
- function Oe(e, t) {
422
+ function De(e, t) {
423
423
  let n;
424
- if (d(e, (e) => {
424
+ if (b(e, (e) => {
425
425
  e.evalIndex === t && (n = e);
426
426
  }), !n) return [];
427
- let r = V(n);
427
+ let r = H(n);
428
428
  return r.length > 1 && r[0].type === x.Whitespace && r.shift(), r.length > 1 && r[r.length - 1].type === x.Whitespace && r.pop(), r;
429
429
  }
430
- function ke(e) {
431
- return d(e, (e) => {
430
+ function Oe(e) {
431
+ return b(e, (e) => {
432
432
  if (e.type !== x.TableReference) return;
433
433
  let t = function(e) {
434
434
  if (e.value !== null && typeof e.value == "object") return e.value;
435
- let t = e.value, n = e.inputs, r = !1, i = !1, a = !1, o = !1, s = null, c = null, l = !1, u = (e) => {
435
+ let t = e.value, n = e.inputs, r = !1, i = !1, a = !1, o = !1, s = null, c = null, u = !1, d = (e) => {
436
436
  e?.type === x.TableColumn && (s = e.value, c = e.value);
437
437
  };
438
438
  if (n) for (let e of n) {
439
439
  let t = e.type;
440
440
  if (t === x.TableSpecifier) {
441
441
  let t = e.value.toUpperCase().trim();
442
- t === "#ALL" ? i = !0 : t === "#HEADERS" ? a = !0 : t === "#TOTALS" ? o = !0 : t === "#DATA" ? r = !0 : t !== "@" && t !== "#THIS ROW" || (l = !0);
443
- } else if (t === x.TableColumn) u(e);
442
+ t === "#ALL" ? i = !0 : t === "#HEADERS" ? a = !0 : t === "#TOTALS" ? o = !0 : t === "#DATA" ? r = !0 : t !== "@" && t !== "#THIS ROW" || (u = !0);
443
+ } else if (t === x.TableColumn) d(e);
444
444
  else if (t === x.Infix && e.value === ":") {
445
445
  let t = e.inputs?.[0], n = e.inputs?.[1];
446
446
  t?.type === x.TableColumn && (s = t.value), n?.type === x.TableColumn && (c = n.value);
447
447
  } else if (t === x.Prefix && e.value === "@") {
448
- l = !0;
448
+ u = !0;
449
449
  let t = e.inputs?.[0];
450
- t?.type === x.Infix && t.value === ":" ? (t.inputs?.[0]?.type === x.TableColumn && (s = t.inputs[0].value), t.inputs?.[1]?.type === x.TableColumn && (c = t.inputs[1].value)) : u(t);
450
+ t?.type === x.Infix && t.value === ":" ? (t.inputs?.[0]?.type === x.TableColumn && (s = t.inputs[0].value), t.inputs?.[1]?.type === x.TableColumn && (c = t.inputs[1].value)) : d(t);
451
451
  }
452
452
  }
453
453
  return {
454
454
  tableId: t,
455
- spec: w(i, a, r, o),
455
+ spec: l(i, a, r, o),
456
456
  columnFromId: s,
457
457
  columnToId: c,
458
- isThisRow: l
458
+ isThisRow: u
459
459
  };
460
460
  }(e);
461
461
  return {
@@ -464,14 +464,14 @@ function ke(e) {
464
464
  };
465
465
  });
466
466
  }
467
- function Ae(e) {
468
- return d(e, (e) => {
467
+ function ke(e) {
468
+ return b(e, (e) => {
469
469
  if (e.type !== x.TableReference) return;
470
470
  let t = e.inputs;
471
471
  if (!t || t.findIndex((e) => e.type === x.TableSpecifier && e.value.toUpperCase().trim() === "#THIS ROW") === -1) return;
472
- let n = [], i;
473
- for (let e of t) (e.type !== x.TableSpecifier || e.value.toUpperCase().trim() !== "#THIS ROW") && (e.type !== x.TableColumn && (e.type !== x.Infix || e.value !== ":") || i ? n.push(e) : i = e);
474
- if (!i) return n.push({
472
+ let n = [], r;
473
+ for (let e of t) (e.type !== x.TableSpecifier || e.value.toUpperCase().trim() !== "#THIS ROW") && (e.type !== x.TableColumn && (e.type !== x.Infix || e.value !== ":") || r ? n.push(e) : r = e);
474
+ if (!r) return n.push({
475
475
  type: x.Prefix,
476
476
  value: "@",
477
477
  inputs: null,
@@ -480,18 +480,18 @@ function Ae(e) {
480
480
  ...e,
481
481
  inputs: n
482
482
  };
483
- let a = i.image ?? i.value, o = a.startsWith("[") && a.endsWith("]") ? {
484
- ...i,
485
- image: a.slice(1, -1)
486
- } : i;
487
- return n.push(r("@", o, !0)), {
483
+ let i = r.image ?? r.value, a = i.startsWith("[") && i.endsWith("]") ? {
484
+ ...r,
485
+ image: i.slice(1, -1)
486
+ } : r;
487
+ return n.push(C("@", a, !0)), {
488
488
  ...e,
489
489
  inputs: n
490
490
  };
491
491
  });
492
492
  }
493
- function je(e) {
494
- return d(e, (e) => {
493
+ function Ae(e) {
494
+ return b(e, (e) => {
495
495
  if (e.type !== x.TableReference || e.inputs?.length !== 0 || e.error) return;
496
496
  let t = e.value;
497
497
  return (typeof t == "string" ? t : t?.tableId) ? {
@@ -500,8 +500,8 @@ function je(e) {
500
500
  } : void 0;
501
501
  });
502
502
  }
503
- function Me(e) {
504
- return d(e, (e) => {
503
+ function je(e) {
504
+ return b(e, (e) => {
505
505
  if (e.type !== x.TableReference || !e.inputs) return;
506
506
  let t = e.value, n = typeof t == "string" ? t : t?.tableId, r = e.image;
507
507
  if (!n || r?.charCodeAt(0) !== 91) return;
@@ -511,7 +511,7 @@ function Me(e) {
511
511
  return delete a.image, a;
512
512
  });
513
513
  }
514
- var Ne = (e) => {
514
+ var Me = (e) => {
515
515
  if (e?.type !== x.TableSpecifier) return 4;
516
516
  switch (e.value.toUpperCase().trim()) {
517
517
  case "#ALL": return 0;
@@ -521,15 +521,15 @@ var Ne = (e) => {
521
521
  default: return 4;
522
522
  }
523
523
  };
524
- function Pe(e) {
525
- return d(e, (e) => {
524
+ function Ne(e) {
525
+ return b(e, (e) => {
526
526
  if (e.type !== x.TableReference) return;
527
527
  let t = e.inputs;
528
528
  if (!t || t.length < 2) return;
529
529
  let n = t.map((e, t) => ({
530
530
  input: e,
531
531
  index: t,
532
- rank: Ne(e)
532
+ rank: Me(e)
533
533
  })).sort((e, t) => e.rank - t.rank || e.index - t.index).map((e) => e.input);
534
534
  return n.every((e, n) => e === t[n]) ? void 0 : {
535
535
  ...e,
@@ -537,22 +537,22 @@ function Pe(e) {
537
537
  };
538
538
  });
539
539
  }
540
- function Fe(e) {
541
- if (!e) return N.EmptyArray;
542
- let t = N.EmptyArray;
543
- return d(e, (e) => {
540
+ function Pe(e) {
541
+ if (!e) return M.EmptyArray;
542
+ let t = M.EmptyArray;
543
+ return b(e, (e) => {
544
544
  if (e.type !== x.Named || e.binding) return;
545
545
  let n = e.value.nameId;
546
- n && (t === N.EmptyArray && (t = []), t.includes(n) || t.push(n));
546
+ n && (t === M.EmptyArray && (t = []), t.includes(n) || t.push(n));
547
547
  }), t;
548
548
  }
549
- function Ie(e, t) {
550
- if (!e) return N.EmptyArray;
551
- let n = N.EmptyArray;
552
- return d(e, (e, r, i) => {
549
+ function Fe(e, t) {
550
+ if (!e) return M.EmptyArray;
551
+ let n = M.EmptyArray;
552
+ return b(e, (e, r, i) => {
553
553
  if (!e.isReference || r?.isReference) return;
554
554
  let a = e.type;
555
- if (a === x.Named || a === x.Error || a === x.TableReference || B(i, x.TableReference)) return;
555
+ if (a === x.Named || a === x.Error || a === x.TableReference || V(i, x.TableReference)) return;
556
556
  let o = function(e) {
557
557
  let t = e;
558
558
  for (; t;) {
@@ -573,47 +573,47 @@ function Ie(e, t) {
573
573
  let a = n?.(String(i.value));
574
574
  if (!a) return !0;
575
575
  let o = i.inputs ? i.inputs.indexOf(r) : -1;
576
- return (o >= 0 ? U(a.getDeclaration().getParameters(), o) : null)?.getRangeType() !== "p";
576
+ return (o >= 0 ? W(a.getDeclaration().getParameters(), o) : null)?.getRangeType() !== "p";
577
577
  }
578
578
  return !0;
579
- }(e, i, t) && (n === N.EmptyArray && (n = []), n.includes(o) || n.push(o));
579
+ }(e, i, t) && (n === M.EmptyArray && (n = []), n.includes(o) || n.push(o));
580
580
  }), n.length > 1 && n.sort((e, t) => e - t), n;
581
581
  }
582
- var Le = /* @__PURE__ */ new Set(["SUBTOTAL", "AGGREGATE"]), Re = /* @__PURE__ */ new Set(["GETPIVOTDATA"]);
583
- function ze(e, t) {
584
- return H(e, t, Le);
582
+ var Ie = /* @__PURE__ */ new Set(["SUBTOTAL", "AGGREGATE"]), Le = /* @__PURE__ */ new Set(["GETPIVOTDATA"]);
583
+ function Re(e, t) {
584
+ return U(e, t, Ie);
585
585
  }
586
- function H(e, t, n) {
586
+ function U(e, t, n) {
587
587
  if (!e || !t) return !1;
588
588
  let r = !1;
589
- return d(e, (e) => {
589
+ return b(e, (e) => {
590
590
  if (r || e.type !== x.Function) return;
591
591
  let i = t(e.value)?.getName();
592
592
  i && n.has(i.toUpperCase()) && (r = !0);
593
593
  }), r;
594
594
  }
595
- function Be(e, t) {
595
+ function ze(e, t) {
596
596
  if (!e || !t) return !1;
597
597
  let n = !1;
598
- return d(e, (e) => {
598
+ return b(e, (e) => {
599
599
  n || e.type !== x.Function || t(e.value)?.getName().toUpperCase() === "TABLE" && (n = !0);
600
600
  }), n;
601
601
  }
602
- function Ve(e, t) {
602
+ function Be(e, t) {
603
603
  if (!e || !t) return !1;
604
604
  let n = !1;
605
- return d(e, (e) => {
605
+ return b(e, (e) => {
606
606
  n || e.type !== x.Function || !0 === t(e.value)?.getDeclaration().getReturnType()?.isVolatile() && (n = !0);
607
607
  }), n;
608
608
  }
609
- var He = Object.freeze({
609
+ var Ve = Object.freeze({
610
610
  value: !1,
611
611
  array: !1
612
- }), Ue = (e, t) => {
612
+ }), He = (e, t) => {
613
613
  let n = function(e, t) {
614
- if (!e || !t) return He;
614
+ if (!e || !t) return Ve;
615
615
  let n = !1, r = !1;
616
- return d(e, (e) => {
616
+ return b(e, (e) => {
617
617
  if (n) return;
618
618
  let i = e.type;
619
619
  if (i === x.Named) return void (e.binding === void 0 && (n = !0));
@@ -625,8 +625,8 @@ var He = Object.freeze({
625
625
  if (r || !0 !== e.implicitIntersect) return;
626
626
  let o = a.getDeclaration().getParameters(), s = e.inputs;
627
627
  if (s) for (let e = 0; e < s.length; e++) {
628
- let n = U(o, e);
629
- if (n !== null && n.isValueOrRange() && G(s[e], t)) return void (r = !0);
628
+ let n = W(o, e);
629
+ if (n !== null && n.isValueOrRange() && K(s[e], t)) return void (r = !0);
630
630
  }
631
631
  }), {
632
632
  value: !n && !r,
@@ -637,21 +637,21 @@ var He = Object.freeze({
637
637
  isBlankCacheable: n.value,
638
638
  isBlankCacheableArray: n.array
639
639
  };
640
- }, We = (e, t) => {
640
+ }, Ue = (e, t) => {
641
641
  let n = e.length;
642
642
  if (n === 0) return null;
643
643
  if (t < n - 1) return e[t];
644
644
  let r = e[n - 1], i = r.getRepeatingTypes();
645
645
  return i && i.length !== 0 ? i[(t - (n - 1)) % i.length] : t < n ? e[t] : r.isRest() ? r : null;
646
646
  };
647
- function Ge(e) {
648
- if (!e) return N.EmptyArray;
649
- let t = N.EmptyArray, r = (e) => {
650
- e && (t === N.EmptyArray && (t = []), t.includes(e) || t.push(e));
647
+ function We(e) {
648
+ if (!e) return M.EmptyArray;
649
+ let n = M.EmptyArray, r = (e) => {
650
+ e && (n === M.EmptyArray && (n = []), n.includes(e) || n.push(e));
651
651
  }, i = (e) => {
652
- typeof e == "string" && r(n(e)?.bookId);
652
+ typeof e == "string" && r(t(e)?.bookId);
653
653
  };
654
- return d(e, (e) => {
654
+ return b(e, (e) => {
655
655
  if (e.type === x.Named) {
656
656
  if (e.binding) return;
657
657
  let t = e.value;
@@ -661,23 +661,23 @@ function Ge(e) {
661
661
  r(typeof t == "string" ? t : t?.tableId);
662
662
  } else if (e.type === x.Cell) {
663
663
  let t = e.value?.scope;
664
- i(t), u(t) && r(t);
664
+ i(t), c(t) && r(t);
665
665
  } else e.type === x.Error && i(e.value?.scope);
666
- }), t;
666
+ }), n;
667
667
  }
668
- var Ke = (e, t) => {
668
+ var Ge = (e, t) => {
669
669
  if (!0 === e.lazyArg) return !0;
670
670
  if (t?.binder?.kind !== "lambda") return !1;
671
671
  let n = t.inputs;
672
672
  return n[n.length - 1] === e;
673
- }, qe = /* @__PURE__ */ new Set([
673
+ }, Ke = /* @__PURE__ */ new Set([
674
674
  "IF",
675
675
  "IFS",
676
676
  "SWITCH",
677
677
  "CHOOSE",
678
678
  "IFERROR",
679
679
  "IFNA"
680
- ]), U = (e, t) => {
680
+ ]), W = (e, t) => {
681
681
  let n = e.length;
682
682
  if (n === 0) return null;
683
683
  if (t < n) return e[t];
@@ -685,7 +685,7 @@ var Ke = (e, t) => {
685
685
  if (!r.isRest()) return null;
686
686
  let i = r.getRepeatingTypes();
687
687
  return i && i.length !== 0 ? i[(t - (n - 1)) % i.length] : r;
688
- }, Je = (e) => e.getScalarType() !== null && e.getRangeType() === null && e.getLambda() === null && !e.isValueOrRange(), Ye = (e, t, n) => !(e.isRest() || !Je(e) || !G(t, n)) && !(e.isNoLift() && W(t, n)), W = (e, t) => {
688
+ }, qe = (e) => e.getScalarType() !== null && e.getRangeType() === null && e.getLambda() === null && !e.isValueOrRange(), Je = (e, t, n) => !(e.isRest() || !qe(e) || !K(t, n)) && !(e.isNoLift() && G(t, n)), G = (e, t) => {
689
689
  if (!e) return !1;
690
690
  let n = e.inputs;
691
691
  switch (e.type) {
@@ -696,13 +696,13 @@ var Ke = (e, t) => {
696
696
  case x.Prefix:
697
697
  case x.Postfix: return !0 === e.isReference && e.value !== "@";
698
698
  case x.Paren:
699
- case x.List: return !!n && n.length === 1 && W(n[0], t);
699
+ case x.List: return !!n && n.length === 1 && G(n[0], t);
700
700
  case x.Function: {
701
701
  if (e.binder !== void 0) return !1;
702
702
  let r = String(e.value).toUpperCase();
703
- if (qe.has(r)) {
703
+ if (Ke.has(r)) {
704
704
  if (!n) return !1;
705
- for (let e = 0; e < n.length; e++) if (W(n[e], t)) return !0;
705
+ for (let e = 0; e < n.length; e++) if (G(n[e], t)) return !0;
706
706
  return !1;
707
707
  }
708
708
  let i = t?.(e.value);
@@ -710,12 +710,12 @@ var Ke = (e, t) => {
710
710
  }
711
711
  default: return !1;
712
712
  }
713
- }, Xe = (e, t) => {
713
+ }, Ye = (e, t) => {
714
714
  if (!e) return !1;
715
- for (let n = 0; n < e.length; n++) if (G(e[n], t)) return !0;
715
+ for (let n = 0; n < e.length; n++) if (K(e[n], t)) return !0;
716
716
  return !1;
717
717
  };
718
- function G(e, t) {
718
+ function K(e, t) {
719
719
  if (!e) return !1;
720
720
  if (e.arrayValued !== void 0) return e.arrayValued;
721
721
  let n, r = e.type, i = e.inputs;
@@ -736,27 +736,27 @@ function G(e, t) {
736
736
  case x.Infix:
737
737
  case x.Prefix:
738
738
  case x.Postfix:
739
- n = e.isReference ? e.value !== "@" : Xe(i, t);
739
+ n = e.isReference ? e.value !== "@" : Ye(i, t);
740
740
  break;
741
741
  case x.Paren:
742
742
  case x.List:
743
- n = !i || i.length !== 1 || G(i[0], t);
743
+ n = !i || i.length !== 1 || K(i[0], t);
744
744
  break;
745
745
  case x.Function: {
746
746
  let r = e.binder;
747
747
  if (r !== void 0) {
748
- n = r.kind === "lambda" || !!i && G(i[i.length - 1], t);
748
+ n = r.kind === "lambda" || !!i && K(i[i.length - 1], t);
749
749
  break;
750
750
  }
751
751
  let a = String(e.value).toUpperCase();
752
- if (qe.has(a)) {
753
- n = Xe(i, t);
752
+ if (Ke.has(a)) {
753
+ n = Ye(i, t);
754
754
  break;
755
755
  }
756
756
  if (a === "INDEX") {
757
757
  if (n = !1, i) for (let e = 1; e < i.length; e++) {
758
758
  let r = i[e];
759
- if (!r || r.type === x.Empty || r.isLiteral && r.value === 0 || G(r, t)) {
759
+ if (!r || r.type === x.Empty || r.isLiteral && r.value === 0 || K(r, t)) {
760
760
  n = !0;
761
761
  break;
762
762
  }
@@ -776,7 +776,7 @@ function G(e, t) {
776
776
  }
777
777
  return e.arrayValued = n, n;
778
778
  }
779
- function Ze(e, t) {
779
+ function Xe(e, t) {
780
780
  if (e.firstCell !== void 0) return;
781
781
  let n = (e, r) => {
782
782
  if (!e) return;
@@ -799,27 +799,27 @@ function Ze(e, t) {
799
799
  }
800
800
  let o = r ? t?.(e.value)?.getDeclaration().getParameters() : null;
801
801
  for (let e = 0; e < i.length; e++) {
802
- let t = o ? U(o, e) : null;
803
- n(i[e], t !== null && (Je(t) || tt(t)));
802
+ let t = o ? W(o, e) : null;
803
+ n(i[e], t !== null && (qe(t) || et(t)));
804
804
  }
805
805
  } else for (let e = 0; e < i.length; e++) n(i[e], !1);
806
806
  };
807
807
  n(e, !0);
808
808
  }
809
- var Qe = /* @__PURE__ */ new Set([
809
+ var Ze = /* @__PURE__ */ new Set([
810
810
  "=",
811
811
  "<>",
812
812
  "<",
813
813
  ">",
814
814
  "<=",
815
815
  ">="
816
- ]), $e = /* @__PURE__ */ new Set(["ROW", "COLUMN"]);
817
- function et(e, t) {
816
+ ]), Qe = /* @__PURE__ */ new Set(["ROW", "COLUMN"]);
817
+ function $e(e, t) {
818
818
  if (!e || !t) return null;
819
- let n = (e) => t(e.value)?.getName().toUpperCase() ?? null, r = !1;
820
- if (d(e, (e) => {
821
- (e.hasLazyArgs || e.type === x.Call || e.binder !== void 0) && (r = !0);
822
- }), r) return null;
819
+ let n = (e) => t(e.value)?.getName().toUpperCase() ?? null, i = !1;
820
+ if (b(e, (e) => {
821
+ (e.hasLazyArgs || e.type === x.Call || e.binder !== void 0) && (i = !0);
822
+ }), i) return null;
823
823
  let a = (e) => e.type === x.Number, o = (e) => e.type === x.Number || e.type === x.String || e.type === x.Boolean, s = (e) => {
824
824
  if (!e) return !1;
825
825
  let t = e.inputs;
@@ -833,7 +833,7 @@ function et(e, t) {
833
833
  }
834
834
  case x.Function: {
835
835
  let r = n(e);
836
- if (r !== null && $e.has(r)) return !t || t.length === 0 || t.length === 1 && t[0]?.type === x.Cell;
836
+ if (r !== null && Qe.has(r)) return !t || t.length === 0 || t.length === 1 && t[0]?.type === x.Cell;
837
837
  if (r === "MOD" && t?.length === 2) {
838
838
  let e = t[1];
839
839
  return s(t[0]) && a(e) && e.value !== 0;
@@ -848,7 +848,7 @@ function et(e, t) {
848
848
  switch (e.type) {
849
849
  case x.Paren: return t?.length === 1 && c(t[0]);
850
850
  case x.Infix: {
851
- if (!Qe.has(e.value)) return !1;
851
+ if (!Ze.has(e.value)) return !1;
852
852
  let [n, r] = t ?? [];
853
853
  return !(!n || !r) && (s(n) && (s(r) || o(r)) || o(n) && s(r));
854
854
  }
@@ -880,24 +880,24 @@ function et(e, t) {
880
880
  if (t) for (let e = 0; e < t.length; e++) u(t[e]);
881
881
  };
882
882
  u(e);
883
- let f = l.length;
884
- if (f === 0 || f > 4) return null;
885
- let p = [];
886
- for (let t = 0; t < 1 << f; t++) {
883
+ let d = l.length;
884
+ if (d === 0 || d > 4) return null;
885
+ let f = [];
886
+ for (let t = 0; t < 1 << d; t++) {
887
887
  let n = (e) => {
888
- let r = l.indexOf(e);
889
- if (r !== -1) return i(t & 1 << r ? "TRUE" : "FALSE");
888
+ let i = l.indexOf(e);
889
+ if (i !== -1) return r(t & 1 << i ? "TRUE" : "FALSE");
890
890
  let a = { ...e };
891
891
  return delete a.evalIndex, delete a.firstCell, delete a.inLazy, delete a.lazyArg, delete a.hasLazyArgs, delete a.deferred, e.inputs && (a.inputs = e.inputs.map((e) => e && n(e))), a;
892
892
  };
893
- p.push(n(e));
893
+ f.push(n(e));
894
894
  }
895
- return p;
895
+ return f;
896
896
  }
897
- var tt = (e) => e.getRangeType() === "*" && e.getLambda() === null && e.getArrayDepth() <= +!!e.isRest();
898
- function nt(e, t, n, r = !1, i = null, a = null) {
897
+ var et = (e) => e.getRangeType() === "*" && e.getLambda() === null && e.getArrayDepth() <= +!!e.isRest();
898
+ function tt(e, t, n, r = !1, i = null, a = null) {
899
899
  let o, s, c = n;
900
- c = ke(c), r || (c = Ae(c), c = Pe(c), c = je(c), c = Me(c)), [o, s] = function(e) {
900
+ c = Oe(c), r || (c = ke(c), c = Ne(c), c = Ae(c), c = je(c)), [o, s] = function(e) {
901
901
  let t = /* @__PURE__ */ new Map(), n = 0, r = [e];
902
902
  for (; r.length > 0;) {
903
903
  let e = r.shift();
@@ -910,7 +910,7 @@ function nt(e, t, n, r = !1, i = null, a = null) {
910
910
  n && n.inputs && (e.inputs = n.inputs.map((e) => t.get(e) ?? e));
911
911
  }), [t.get(e), n];
912
912
  }(c);
913
- let l = E(s), u = [], p = [], h = new Ee(), g, _ = !1;
913
+ let l = E(s), u = [], d = [], f = new Te(), m, h = !1;
914
914
  (function(e, t) {
915
915
  if (!e || !t) return;
916
916
  let n = (e) => {
@@ -919,44 +919,44 @@ function nt(e, t, n, r = !1, i = null, a = null) {
919
919
  let t = e.inputs;
920
920
  if (t) for (let e = 0; e < t.length; e++) n(t[e]);
921
921
  };
922
- d(e, (e) => {
922
+ b(e, (e) => {
923
923
  if (e.type !== x.Function || e.binder !== void 0) return;
924
924
  let r = e.inputs;
925
925
  if (!r || r.length === 0) return;
926
926
  let i = t(e.value)?.getDeclaration().getParameters();
927
927
  if (i) for (let t = 0; t < r.length; t++) {
928
928
  let a = r[t];
929
- a && a.type !== x.Empty && We(i, t)?.isLazy() && (a.lazyArg = !0, e.hasLazyArgs = !0, n(a));
929
+ a && a.type !== x.Empty && Ue(i, t)?.isLazy() && (a.lazyArg = !0, e.hasLazyArgs = !0, n(a));
930
930
  }
931
931
  });
932
932
  })(o, a);
933
- let v = (e) => {
934
- g === void 0 && (g = /* @__PURE__ */ new Map());
935
- let t = g.get(e);
936
- return t === void 0 && g.set(e, t = []), t;
937
- }, y = (e, t) => {
938
- e === void 0 ? u.push(t) : v(e).push(t);
939
- }, b = (e) => {
933
+ let g = (e) => {
934
+ m === void 0 && (m = /* @__PURE__ */ new Map());
935
+ let t = m.get(e);
936
+ return t === void 0 && m.set(e, t = []), t;
937
+ }, _ = (e, t) => {
938
+ e === void 0 ? u.push(t) : g(e).push(t);
939
+ }, v = (e) => {
940
940
  e?.type !== x.Infix || e.value !== "+" && e.value !== "-" || (e.snapsCancellation = !0);
941
941
  };
942
- o = d(o, (t, n, r) => {
942
+ o = b(o, (t, n, r) => {
943
943
  let i = t.type, a = t.evalIndex;
944
- if (l[a] = null, i === x.TableColumn || i === x.TableSpecifier || t.isReference && B(r, x.TableReference)) return;
945
- if (_ ||= !J(t), t.binding?.declaration) return p[t.binding.slot] = -1, void (l[a] = void 0);
944
+ if (l[a] = null, i === x.TableColumn || i === x.TableSpecifier || t.isReference && V(r, x.TableReference)) return;
945
+ if (h ||= !Y(t), t.binding?.declaration) return d[t.binding.slot] = -1, void (l[a] = void 0);
946
946
  let o = ((e, t, n) => {
947
- if (Ke(e, t)) return e;
948
- for (let e = n.length - 1; e >= 0; e--) if (Ke(n[e], n[e - 1])) return n[e];
947
+ if (Ge(e, t)) return e;
948
+ for (let e = n.length - 1; e >= 0; e--) if (Ge(n[e], n[e - 1])) return n[e];
949
949
  })(t, n, r);
950
- o === t && v(t), o !== void 0 && i === x.Named && (t.deferredResolve = !0);
950
+ o === t && g(t), o !== void 0 && i === x.Named && (t.deferredResolve = !0);
951
951
  let s = t.binder;
952
952
  if (s && s.kind === "let") {
953
953
  let e = t.inputs, n = e?.length ?? 0, r = 0;
954
- for (let t = 0; t + 1 < n && r < s.slots.length; t += 2) e[t]?.binding?.declaration && (p[s.slots[r++]] = e[t + 1]?.evalIndex ?? -1);
954
+ for (let t = 0; t + 1 < n && r < s.slots.length; t += 2) e[t]?.binding?.declaration && (d[s.slots[r++]] = e[t + 1]?.evalIndex ?? -1);
955
955
  }
956
- if ((t.isReference || n && n.isReference) && (h.processNode(t, n), t.isReference)) {
957
- if (i === x.Named) return void (o !== void 0 && y(o, t));
956
+ if ((t.isReference || n && n.isReference) && (f.processNode(t, n), t.isReference)) {
957
+ if (i === x.Named) return void (o !== void 0 && _(o, t));
958
958
  if (i === x.Cell || i === x.TableReference || i === x.Error) return;
959
- if (i === x.Infix || i === x.Prefix || i === x.Postfix || i === x.List) return void y(o, t);
959
+ if (i === x.Infix || i === x.Prefix || i === x.Postfix || i === x.List) return void _(o, t);
960
960
  }
961
961
  if (t.isLiteral) {
962
962
  if (i !== x.Array) l[a] = t.value;
@@ -966,7 +966,7 @@ function nt(e, t, n, r = !1, i = null, a = null) {
966
966
  let t = n[e].value, r = t.length, a = E(r);
967
967
  for (let e = 0; e < r; e++) {
968
968
  let n = t[e], r = null;
969
- if (n && (r = n.type === x.Error ? m(n.value) : n.value, n.type === x.Prefix)) {
969
+ if (n && (r = n.type === x.Error ? T(n.value) : n.value, n.type === x.Prefix)) {
970
970
  let e = n.value;
971
971
  r = n.inputs[0].value, e === "-" && (r = -r);
972
972
  }
@@ -974,18 +974,18 @@ function nt(e, t, n, r = !1, i = null, a = null) {
974
974
  }
975
975
  i[e] = a;
976
976
  }
977
- let o = ne(i);
978
- l[a] = new te(e, o.values, o.coords, void 0, o.isLiteral);
977
+ let o = te(i);
978
+ l[a] = new ee(e, o.values, o.coords, void 0, o.isLiteral);
979
979
  }
980
980
  } else {
981
- if (i !== x.Empty) return t.binder?.kind === "lambda" && b(t.inputs[t.inputs.length - 1]), y(o, t), t;
981
+ if (i !== x.Empty) return t.binder?.kind === "lambda" && v(t.inputs[t.inputs.length - 1]), _(o, t), t;
982
982
  l[a] = void 0;
983
983
  }
984
- }), b(o), g?.forEach((e, t) => {
984
+ }), v(o), m?.forEach((e, t) => {
985
985
  t.deferred = e;
986
986
  });
987
- let S = E(h.cells.size);
988
- h.cells.forEach((e, t) => {
987
+ let y = E(f.cells.size);
988
+ f.cells.forEach((e, t) => {
989
989
  let n = t.value, r = n.colIndex, i = n.rowIndex, a = n.$colIndex, o = n.$rowIndex, s = {
990
990
  colStart: r,
991
991
  rowStart: i,
@@ -996,22 +996,22 @@ function nt(e, t, n, r = !1, i = null, a = null) {
996
996
  $colEnd: a,
997
997
  $rowEnd: o
998
998
  };
999
- r === -(2 ** 53 - 1) && (s.colEnd = 2 ** 53 - 1), i === -(2 ** 53 - 1) && (s.rowEnd = 2 ** 53 - 1), n.scope && (s.scope = n.scope), S[e] = s;
999
+ r === -(2 ** 53 - 1) && (s.colEnd = 2 ** 53 - 1), i === -(2 ** 53 - 1) && (s.rowEnd = 2 ** 53 - 1), n.scope && (s.scope = n.scope), y[e] = s;
1000
1000
  });
1001
- let C = S.length, w = E(C);
1002
- for (let e = 0; e < C; e++) w[e] = {
1001
+ let S = y.length, C = E(S);
1002
+ for (let e = 0; e < S; e++) C[e] = {
1003
1003
  colStart: 0,
1004
1004
  rowStart: 0,
1005
1005
  colEnd: 0,
1006
1006
  rowEnd: 0,
1007
1007
  scope: null
1008
1008
  };
1009
- let T = E(h.references.size);
1010
- h.references.forEach((e) => {
1011
- T[e.index] = e;
1009
+ let w = E(f.references.size);
1010
+ f.references.forEach((e) => {
1011
+ w[e.index] = e;
1012
1012
  });
1013
1013
  let D = [];
1014
- h.rootReferences.forEach((e) => {
1014
+ f.rootReferences.forEach((e) => {
1015
1015
  D.push(e.index);
1016
1016
  }), function(e, t, n = !1) {
1017
1017
  if (n) {
@@ -1025,7 +1025,7 @@ function nt(e, t, n, r = !1, i = null, a = null) {
1025
1025
  t(e);
1026
1026
  return;
1027
1027
  }
1028
- let r = (e) => G(e, t), i = (e, n) => {
1028
+ let r = (e) => K(e, t), i = (e, n) => {
1029
1029
  if (!e) return;
1030
1030
  let a = e.type;
1031
1031
  a !== x.Function && a !== x.Call || (e.implicitIntersect = n);
@@ -1047,8 +1047,8 @@ function nt(e, t, n, r = !1, i = null, a = null) {
1047
1047
  if (a) for (let e = 0; e < o.length && !s; e++) {
1048
1048
  let n = o[e];
1049
1049
  if (!n) continue;
1050
- let r = U(a, e);
1051
- r && Ye(r, n, t) && (s = !0);
1050
+ let r = W(a, e);
1051
+ r && Je(r, n, t) && (s = !0);
1052
1052
  }
1053
1053
  s && (e.implicitIntersect = !1);
1054
1054
  for (let e = 0; e < o.length; e++) i(o[e], !s && n);
@@ -1065,46 +1065,46 @@ function nt(e, t, n, r = !1, i = null, a = null) {
1065
1065
  let t = e[n], r = t.type;
1066
1066
  if (r === x.Infix) {
1067
1067
  if (!0 === t.snapsCancellation) {
1068
- t.fn = Ce[t.value];
1068
+ t.fn = Se[t.value];
1069
1069
  continue;
1070
1070
  }
1071
- t.fn = Se[t.value];
1072
- } else r === x.Prefix ? t.fn = we[t.value] : r === x.Postfix && (t.fn = Te[t.value]);
1071
+ t.fn = xe[t.value];
1072
+ } else r === x.Prefix ? t.fn = Ce[t.value] : r === x.Postfix && (t.fn = we[t.value]);
1073
1073
  }
1074
1074
  }, k;
1075
- O(u), g?.forEach(O);
1076
- let A = r ? ee(re(e.getLocale()).decimal) : f, j = {
1075
+ O(u), m?.forEach(O);
1076
+ let A = r ? ne(re(e.getLocale()).decimal) : p, j = {
1077
1077
  runtime: e,
1078
1078
  symbols: t,
1079
1079
  getFunction: a,
1080
1080
  ast: o,
1081
1081
  evaluations: l,
1082
1082
  executions: u,
1083
- bindings: p,
1084
- referencesAbsolute: w,
1085
- referencesExecute: T,
1086
- referencesRelative: S,
1083
+ bindings: d,
1084
+ referencesAbsolute: C,
1085
+ referencesExecute: w,
1086
+ referencesRelative: y,
1087
1087
  referencesRoot: D,
1088
- referenceIndices: h.referenceIndices,
1089
- formatReferenceIndices: Ie(o, a),
1090
- getTokens: () => k ??= V(o, r, A),
1091
- namedIds: Fe(o),
1092
- symbolIds: Ge(o),
1093
- hasTotals: ze(o, a),
1094
- hasPivotData: H(o, a, Re),
1095
- hasDataTable: Be(o, a),
1096
- hasVolatile: Ve(o, a),
1097
- ...Ue(o, a),
1098
- isReferenceOnly: !_,
1088
+ referenceIndices: f.referenceIndices,
1089
+ formatReferenceIndices: Fe(o, a),
1090
+ getTokens: () => k ??= H(o, r, A),
1091
+ namedIds: Pe(o),
1092
+ symbolIds: We(o),
1093
+ hasTotals: Re(o, a),
1094
+ hasPivotData: U(o, a, Le),
1095
+ hasDataTable: ze(o, a),
1096
+ hasVolatile: Be(o, a),
1097
+ ...He(o, a),
1098
+ isReferenceOnly: !h,
1099
1099
  error: i,
1100
1100
  transform: (n) => {
1101
- let s = d(o, n);
1102
- return s === o ? j : nt(e, t, s, r, i, a);
1101
+ let s = b(o, n);
1102
+ return s === o ? j : tt(e, t, s, r, i, a);
1103
1103
  }
1104
1104
  };
1105
1105
  return j;
1106
1106
  }
1107
- function rt(e) {
1107
+ function nt(e) {
1108
1108
  let t = -1, n = -1;
1109
1109
  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), t === -1 ? new O.Parse(e.message, { cause: e }) : (e.errorLocation = {
1110
1110
  line: t,
@@ -1135,28 +1135,28 @@ Object.freeze([
1135
1135
  ">="
1136
1136
  ]
1137
1137
  ]);
1138
- var it = Object.freeze([
1138
+ var rt = Object.freeze([
1139
1139
  ":",
1140
1140
  ".:.",
1141
1141
  ".:",
1142
1142
  ":."
1143
- ]), K = Object.freeze([
1143
+ ]), q = Object.freeze([
1144
1144
  ":",
1145
1145
  " ",
1146
1146
  ".:.",
1147
1147
  ".:",
1148
1148
  ":."
1149
- ]), at = Object.freeze(["@"]), q = Object.freeze(["#"]), ot = Object.freeze(K.concat(q)), J = (Object.freeze(K.concat(at).concat(q)), (e) => {
1149
+ ]), it = Object.freeze(["@"]), J = Object.freeze(["#"]), at = Object.freeze(q.concat(J)), Y = (Object.freeze(q.concat(it).concat(J)), (e) => {
1150
1150
  if (!e) return !1;
1151
1151
  let t = e.type;
1152
1152
  if (t === x.Cell || t === x.TableReference) return !0;
1153
1153
  if (t === x.Infix) {
1154
- if (!K.includes(e.value)) return !1;
1154
+ if (!q.includes(e.value)) return !1;
1155
1155
  let t = e.inputs, n = t[0], r = t[1];
1156
- return J(n) && J(r);
1156
+ return Y(n) && Y(r);
1157
1157
  }
1158
- return t === x.List && (e.inputs?.every(J) ?? !1);
1159
- }), st = (e) => !!e && (!(e.type !== x.Infix || !ot.includes(e.value)) || !(e.type !== x.Postfix || !q.includes(e.value)) || e.type === x.Array || e.type === x.TableReference), ct = Object.freeze([
1158
+ return t === x.List && (e.inputs?.every(Y) ?? !1);
1159
+ }), ot = (e) => !!e && (!(e.type !== x.Infix || !at.includes(e.value)) || !(e.type !== x.Postfix || !J.includes(e.value)) || e.type === x.Array || e.type === x.TableReference), st = Object.freeze([
1160
1160
  "+",
1161
1161
  "-",
1162
1162
  "*",
@@ -1169,16 +1169,16 @@ var it = Object.freeze([
1169
1169
  "<",
1170
1170
  ">=",
1171
1171
  "<="
1172
- ]), lt = Object.freeze(["-", "+"]), Y = (e, t) => {
1172
+ ]), ct = Object.freeze(["-", "+"]), X = (e, t) => {
1173
1173
  if (!e) return !1;
1174
1174
  let n = e.type;
1175
1175
  if (e.isLiteral) return n !== x.Error;
1176
1176
  if (n === x.Paren || n === x.List) {
1177
1177
  let n = e.inputs;
1178
- return !(!n || n.length === 0) && n.every((e) => Y(e, t));
1178
+ return !(!n || n.length === 0) && n.every((e) => X(e, t));
1179
1179
  }
1180
- if (n === x.Infix) return ct.includes(e.value);
1181
- if (n === x.Prefix) return lt.includes(e.value);
1180
+ if (n === x.Infix) return st.includes(e.value);
1181
+ if (n === x.Prefix) return ct.includes(e.value);
1182
1182
  if (n === x.Postfix) return e.value === "%";
1183
1183
  if (n === x.Function) {
1184
1184
  if (!t) return !1;
@@ -1188,35 +1188,35 @@ var it = Object.freeze([
1188
1188
  return i !== "p" && (i !== null || r.getLambda() === null && r.getScalarType() != null);
1189
1189
  }
1190
1190
  return !1;
1191
- }, ut = (e, t) => {
1191
+ }, lt = (e, t) => {
1192
1192
  if (!e) return null;
1193
1193
  let n = null, r = (e) => {
1194
1194
  if (n || !e) return;
1195
1195
  if (e.type === x.Infix && e.value === " ") {
1196
1196
  let r = e.inputs, i = r?.[0], a = r?.[1];
1197
- if (Y(i, t)) return void (n = i);
1198
- if (Y(a, t)) return void (n = a);
1197
+ if (X(i, t)) return void (n = i);
1198
+ if (X(a, t)) return void (n = a);
1199
1199
  }
1200
1200
  let i = e.inputs;
1201
1201
  if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1202
1202
  };
1203
1203
  return r(e), n;
1204
- }, dt = (e, t) => {
1204
+ }, ut = (e, t) => {
1205
1205
  if (!e) return null;
1206
1206
  let n = null, r = (e) => {
1207
1207
  if (n || !e) return;
1208
1208
  if (e.type === x.Postfix && e.value === "#") {
1209
1209
  let r = e.inputs?.[0];
1210
- if (r && Y(r, t)) return void (n = r);
1210
+ if (r && X(r, t)) return void (n = r);
1211
1211
  }
1212
1212
  let i = e.inputs;
1213
1213
  if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1214
1214
  };
1215
1215
  return r(e), n;
1216
- }, ft = (e) => {
1216
+ }, dt = (e) => {
1217
1217
  for (let t = 0; t < e.length; t++) if (e[t].getRepeatingTypes()) return t;
1218
1218
  return -1;
1219
- }, pt = (e, t, n) => {
1219
+ }, ft = (e, t, n) => {
1220
1220
  let r = e[t].getRepeatingTypes(), i = r.length, a = t, o = e.length - t - 1, s = o;
1221
1221
  for (; s > 0 && e[t + s].isOptional();) s--;
1222
1222
  let c = +!e[t].isOptional(), l = r[i - 1].isOptional();
@@ -1240,7 +1240,7 @@ var it = Object.freeze([
1240
1240
  };
1241
1241
  }
1242
1242
  return null;
1243
- }, mt = (e) => {
1243
+ }, pt = (e) => {
1244
1244
  if (!e) return null;
1245
1245
  let t = null, n = (e) => {
1246
1246
  if (t || !e) return;
@@ -1255,7 +1255,7 @@ var it = Object.freeze([
1255
1255
  if (r) for (let e = 0; e < r.length && !t; e++) n(r[e]);
1256
1256
  };
1257
1257
  return n(e), t;
1258
- }, ht = (e, t) => {
1258
+ }, mt = (e, t) => {
1259
1259
  if (!e || !t) return null;
1260
1260
  let n = null, r = (e) => {
1261
1261
  if (n || !e) return;
@@ -1264,9 +1264,9 @@ var it = Object.freeze([
1264
1264
  if (i) {
1265
1265
  let t = i.getDeclaration(), a = t.getParameters(), o = e.inputs?.length ?? 0, s = t.getMaxArguments();
1266
1266
  if (o > s) return void (n = `Too many arguments for ${r}. The most it accepts is ${s}, but got ${o}.`);
1267
- let c = a.length > 0 ? ft(a) : -1, l = a.length > 0 && a[a.length - 1].isRest();
1267
+ let c = a.length > 0 ? dt(a) : -1, l = a.length > 0 && a[a.length - 1].isRest();
1268
1268
  if (c >= 0) {
1269
- if (!pt(a, c, o)) {
1269
+ if (!ft(a, c, o)) {
1270
1270
  let e = a[c].getRepeatingTypes().length, t = a.length - 1;
1271
1271
  n = e === 1 ? `Too few arguments for ${r}. Expected at least ${t + 1}, but got ${o}.` : `Wrong number of arguments for ${r}. Expected ${t} plus a multiple of ${e}, but got ${o}.`;
1272
1272
  }
@@ -1281,7 +1281,7 @@ var it = Object.freeze([
1281
1281
  if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1282
1282
  };
1283
1283
  return r(e), n;
1284
- }, gt = (e, t) => {
1284
+ }, ht = (e, t) => {
1285
1285
  if (!e || !t) return null;
1286
1286
  let n = null, r = (e) => {
1287
1287
  if (n || !e) return;
@@ -1291,13 +1291,13 @@ var it = Object.freeze([
1291
1291
  let i = r.getDeclaration().getParameters(), a = e.inputs;
1292
1292
  if (i.length > 0 && a) {
1293
1293
  let e = ((e, t) => {
1294
- let n = Array(t), r = e.length, i = r > 0 ? ft(e) : -1;
1294
+ let n = Array(t), r = e.length, i = r > 0 ? dt(e) : -1;
1295
1295
  if (i < 0) {
1296
1296
  let i = r > 0 ? e[r - 1] : null, a = !!i && i.isRest();
1297
1297
  for (let o = 0; o < t; o++) n[o] = o < r ? e[o] : a ? i : null;
1298
1298
  return n;
1299
1299
  }
1300
- let a = e[i].getRepeatingTypes(), o = a.length, s = i, c = pt(e, i, t), l = c ? c.suffix : r - i - 1, u = Math.max(0, t - s - l);
1300
+ let a = e[i].getRepeatingTypes(), o = a.length, s = i, c = ft(e, i, t), l = c ? c.suffix : r - i - 1, u = Math.max(0, t - s - l);
1301
1301
  for (let c = 0; c < t; c++) if (c < s) n[c] = e[c];
1302
1302
  else if (c < s + u) n[c] = a[(c - s) % o];
1303
1303
  else {
@@ -1308,7 +1308,7 @@ var it = Object.freeze([
1308
1308
  })(i, a.length);
1309
1309
  for (let r = 0; r < a.length && !n; r++) {
1310
1310
  let i = e[r];
1311
- i && i.getRangeType() === "p" && Y(a[r], t) && (n = a[r]);
1311
+ i && i.getRangeType() === "p" && X(a[r], t) && (n = a[r]);
1312
1312
  }
1313
1313
  }
1314
1314
  }
@@ -1317,29 +1317,29 @@ var it = Object.freeze([
1317
1317
  if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1318
1318
  };
1319
1319
  return r(e), n;
1320
- }, _t = (e, t) => {
1320
+ }, gt = (e, t) => {
1321
1321
  if (!e) return null;
1322
1322
  let n = null, r = (e) => {
1323
1323
  if (n || !e) return;
1324
1324
  if (e.type === x.Call) {
1325
1325
  let r = e.inputs?.[0];
1326
- if (r && Y(r, t)) return void (n = "This expression always produces a value, so it cannot be called as a function.");
1326
+ if (r && X(r, t)) return void (n = "This expression always produces a value, so it cannot be called as a function.");
1327
1327
  }
1328
1328
  let i = e.inputs;
1329
1329
  if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1330
1330
  };
1331
1331
  return r(e), n;
1332
- }, X = (e, t) => {
1332
+ }, Z = (e, t) => {
1333
1333
  if (e.type !== x.Function) return;
1334
1334
  let n = e.value;
1335
1335
  if (typeof n != "string") return;
1336
1336
  let r = (t?.(n)?.getName() ?? n).toUpperCase();
1337
1337
  return r === "LET" ? "let" : r === "LAMBDA" ? "lambda" : void 0;
1338
- }, Z = (e) => {
1338
+ }, Q = (e) => {
1339
1339
  if (e?.type !== x.Named) return;
1340
1340
  let t = e.value;
1341
1341
  return t?.nameId && !t.scope && !0 !== t.optional ? t.nameId : void 0;
1342
- }, vt = /^[A-Za-z_\\][A-Za-z0-9_\\]*$/, yt = /* @__PURE__ */ new Set(["TRUE", "FALSE"]), bt = (e) => {
1342
+ }, _t = /^[A-Za-z_\\][A-Za-z0-9_\\]*$/, vt = /* @__PURE__ */ new Set(["TRUE", "FALSE"]), yt = (e) => {
1343
1343
  if (e?.type === x.Named) {
1344
1344
  let t = e.value;
1345
1345
  return !0 !== t?.optional || !t.nameId || t.scope ? void 0 : t.nameId;
@@ -1358,9 +1358,9 @@ var it = Object.freeze([
1358
1358
  if (!e || e.tableId !== "" || e.spec !== 0 || !0 === e.isThisRow || !e.columnFromId || e.columnFromId !== e.columnToId) return;
1359
1359
  n = e.columnFromId;
1360
1360
  }
1361
- return vt.test(n) && !yt.has(n.toUpperCase()) && e.image === `[${n}]` ? n : void 0;
1362
- }, xt = (e) => {
1363
- let t = c(e.image ?? e.value);
1361
+ return _t.test(n) && !vt.has(n.toUpperCase()) && e.image === `[${n}]` ? n : void 0;
1362
+ }, bt = (e) => {
1363
+ let t = a(e.image ?? e.value);
1364
1364
  t.image = e.image ?? e.value, t.wsBefore = e.wsBefore;
1365
1365
  let n = {
1366
1366
  type: x.Call,
@@ -1370,16 +1370,16 @@ var it = Object.freeze([
1370
1370
  };
1371
1371
  return e.error && (n.error = e.error), n;
1372
1372
  };
1373
- function St(e, t) {
1374
- return e && t ? d(e, (e) => {
1375
- if (e.type === x.Function && typeof e.value == "string" && !t(e.value)) return xt(e);
1373
+ function xt(e, t) {
1374
+ return e && t ? b(e, (e) => {
1375
+ if (e.type === x.Function && typeof e.value == "string" && !t(e.value)) return bt(e);
1376
1376
  }) : e;
1377
1377
  }
1378
- function Ct(e, t) {
1378
+ function St(e, t) {
1379
1379
  let n = t.name.toUpperCase(), r = e ? e.filter((e) => e.name.toUpperCase() !== n) : [];
1380
1380
  return r.push(t), r;
1381
1381
  }
1382
- function wt(e) {
1382
+ function Ct(e) {
1383
1383
  if (e?.type !== x.Function || e.binder?.kind !== "lambda") return;
1384
1384
  let t = e.inputs ?? [], n = [];
1385
1385
  for (let e = 0; e < t.length - 1; e++) {
@@ -1393,18 +1393,18 @@ function wt(e) {
1393
1393
  }
1394
1394
  return n;
1395
1395
  }
1396
- var Tt = /* @__PURE__ */ new Set([
1396
+ var wt = /* @__PURE__ */ new Set([
1397
1397
  "IF",
1398
1398
  "IFERROR",
1399
1399
  "IFNA"
1400
1400
  ]);
1401
- function Q(e, t) {
1401
+ function $(e, t) {
1402
1402
  if (!e || e.type !== x.Function || typeof e.value != "string") return e;
1403
1403
  let n = (t?.(e.value)?.getName() ?? e.value).toUpperCase();
1404
- if (!Tt.has(n)) return e;
1404
+ if (!wt.has(n)) return e;
1405
1405
  let r = e.inputs, i;
1406
1406
  if (r) for (let e = 0; e < r.length; e++) {
1407
- let n = Q(r[e], t);
1407
+ let n = $(r[e], t);
1408
1408
  n !== r[e] && ((i ??= [...r])[e] = n);
1409
1409
  }
1410
1410
  return {
@@ -1413,7 +1413,7 @@ function Q(e, t) {
1413
1413
  passOmitted: !0
1414
1414
  };
1415
1415
  }
1416
- function Et(e, t = null) {
1416
+ function Tt(e, t = null) {
1417
1417
  if (!e) return e;
1418
1418
  let n = [], r = 0, i = (e) => {
1419
1419
  let t = e.inputs;
@@ -1431,14 +1431,14 @@ function Et(e, t = null) {
1431
1431
  } : e;
1432
1432
  }, a = (e) => {
1433
1433
  if (!e) return e;
1434
- let o = X(e, t);
1434
+ let o = Z(e, t);
1435
1435
  if (o) return ((e, o) => {
1436
1436
  let s = e.inputs, c = s?.length ?? 0;
1437
1437
  if (!s || c < 1) return i(e);
1438
1438
  let l = n.length, u = [], d = [...s], f = (e, t = !1) => {
1439
- let i = d[e], a = Z(i), o = !1;
1439
+ let i = d[e], a = Q(i), o = !1;
1440
1440
  if (a === void 0 && t) {
1441
- if (a = bt(i), a === void 0) return;
1441
+ if (a = yt(i), a === void 0) return;
1442
1442
  o = !0;
1443
1443
  } else if (a === void 0) return;
1444
1444
  let s = r++;
@@ -1473,7 +1473,7 @@ function Et(e, t = null) {
1473
1473
  for (let e = 0; e < c - 1; e++) f(e, !0);
1474
1474
  d[c - 1] && (d[c - 1] = a(d[c - 1]));
1475
1475
  } else {
1476
- for (let e = 0; e + 1 < c; e += 2) d[e + 1] && (d[e + 1] = Q(a(d[e + 1]), t)), f(e);
1476
+ for (let e = 0; e + 1 < c; e += 2) d[e + 1] && (d[e + 1] = $(a(d[e + 1]), t)), f(e);
1477
1477
  c % 2 == 1 && d[c - 1] && (d[c - 1] = a(d[c - 1]));
1478
1478
  }
1479
1479
  for (; n.length > l;) n.pop();
@@ -1488,20 +1488,20 @@ function Et(e, t = null) {
1488
1488
  })(e, o);
1489
1489
  if (e.type === x.Function && typeof e.value == "string") {
1490
1490
  let r = e.value.toUpperCase();
1491
- if (n.some((e) => e.key === r) && !t?.(e.value)) return i(xt(e));
1491
+ if (n.some((e) => e.key === r) && !t?.(e.value)) return i(bt(e));
1492
1492
  }
1493
1493
  if (n.length > 0 && e.isReference && e.value === ":" && e.inputs?.length === 2) {
1494
1494
  let [t, r] = e.inputs;
1495
- if (Dt(t) && Dt(r)) {
1495
+ if (Et(t) && Et(r)) {
1496
1496
  let a = t.image.toUpperCase(), o = r.image.toUpperCase();
1497
1497
  if (n.some((e) => e.key === a || e.key === o)) return i({
1498
1498
  ...e,
1499
- inputs: [Ot(t), Ot(r)]
1499
+ inputs: [Dt(t), Dt(r)]
1500
1500
  });
1501
1501
  }
1502
1502
  }
1503
1503
  if (e.type === x.Named) {
1504
- let t = Z(e);
1504
+ let t = Q(e);
1505
1505
  if (t !== void 0) {
1506
1506
  let r = t.toUpperCase();
1507
1507
  for (let i = n.length - 1; i >= 0; i--) {
@@ -1533,7 +1533,7 @@ function Et(e, t = null) {
1533
1533
  };
1534
1534
  continue;
1535
1535
  }
1536
- let a = Q(i, t);
1536
+ let a = $(i, t);
1537
1537
  a !== i && ((n ??= [...e])[r] = a);
1538
1538
  }
1539
1539
  if (n) return {
@@ -1546,41 +1546,41 @@ function Et(e, t = null) {
1546
1546
  };
1547
1547
  return a(e);
1548
1548
  }
1549
- var Dt = (e) => {
1549
+ var Et = (e) => {
1550
1550
  if (e?.type !== x.Cell || e.image === void 0) return !1;
1551
1551
  let t = e.value;
1552
1552
  return t.rowIndex === -(2 ** 53 - 1) && !0 !== t.$colIndex && !t.scope;
1553
- }, Ot = (e) => {
1554
- let t = c(e.image);
1555
- return v(t, e), t;
1556
- }, kt = (e) => e?.type === x.Cell, At = (e, t = null) => {
1553
+ }, Dt = (e) => {
1554
+ let t = a(e.image);
1555
+ return n(t, e), t;
1556
+ }, Ot = (e) => e?.type === x.Cell, kt = (e, t = null) => {
1557
1557
  if (!e) return e;
1558
- let n = !1, r = (e) => {
1559
- if (n || !e) return;
1560
- let i = X(e, t), a = e.inputs;
1561
- if (i && a) {
1562
- let e = i === "let" ? 2 : 1;
1563
- for (let t = 0; t < a.length - 1; t += e) if (kt(a[t])) return void (n = !0);
1558
+ let r = !1, i = (e) => {
1559
+ if (r || !e) return;
1560
+ let n = Z(e, t), a = e.inputs;
1561
+ if (n && a) {
1562
+ let e = n === "let" ? 2 : 1;
1563
+ for (let t = 0; t < a.length - 1; t += e) if (Ot(a[t])) return void (r = !0);
1564
1564
  }
1565
- if (a) for (let e = 0; e < a.length && !n; e++) r(a[e]);
1565
+ if (a) for (let e = 0; e < a.length && !r; e++) i(a[e]);
1566
1566
  };
1567
- if (r(e), !n) return e;
1568
- let i = null, a = d(e, (e) => {
1567
+ if (i(e), !r) return e;
1568
+ let o = null, s = b(e, (e) => {
1569
1569
  if (e?.type !== x.Cell) return;
1570
- let t = e.value, n = e.image;
1571
- 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 '$'.`);
1572
- if (n === void 0) return;
1573
- let r = c(n);
1574
- v(r, e);
1575
- let a = t?.scope;
1576
- return a && (r.value.scope = a, r.value.scopeImage = t.scopeImage), r;
1570
+ let t = e.value, r = e.image;
1571
+ if (!0 === t?.$colIndex || !0 === t?.$rowIndex) return void (o ??= `'${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 '$'.`);
1572
+ if (r === void 0) return;
1573
+ let i = a(r);
1574
+ n(i, e);
1575
+ let s = t?.scope;
1576
+ return s && (i.value.scope = s, i.value.scopeImage = t.scopeImage), i;
1577
1577
  });
1578
- return i ?? a;
1579
- }, jt = (e, t) => {
1578
+ return o ?? s;
1579
+ }, At = (e, t) => {
1580
1580
  if (!e) return null;
1581
1581
  let n = null, r = (e) => {
1582
1582
  if (n || !e) return;
1583
- let i = X(e, t);
1583
+ let i = Z(e, t);
1584
1584
  i && ((e, t) => {
1585
1585
  let r = t === "let" ? "LET" : "LAMBDA", i = e.inputs, a = i?.length ?? 0;
1586
1586
  if (!i || a < 2) return;
@@ -1588,8 +1588,8 @@ var Dt = (e) => {
1588
1588
  if (t === "lambda" && i[a - 1]?.type === x.Empty) return void (n = "LAMBDA has no calculation: the last argument is empty.");
1589
1589
  let o = /* @__PURE__ */ new Set(), s = t === "let" ? 2 : 1, c = !1;
1590
1590
  for (let e = 0; e < a - 1; e += s) {
1591
- let a = Z(i[e]);
1592
- if (a === void 0 && t === "lambda") a = bt(i[e]), a !== void 0 && (c = !0);
1591
+ let a = Q(i[e]);
1592
+ if (a === void 0 && t === "lambda") a = yt(i[e]), a !== void 0 && (c = !0);
1593
1593
  else if (a !== void 0 && c) return void (n = `Required name '${a}' cannot follow an optional name in ${r}.`);
1594
1594
  if (a === void 0) return void (n = `Expected a name in ${r} argument ${e + 1}; a name cannot be the output of a formula.`);
1595
1595
  if (a.includes(".")) return void (n = `Expected a name in ${r} argument ${e + 1}; a name cannot contain '.'.`);
@@ -1603,105 +1603,105 @@ var Dt = (e) => {
1603
1603
  };
1604
1604
  return r(e), n;
1605
1605
  };
1606
- function Mt(e, t, n, r, i) {
1607
- let a = r, o, c = () => (o === void 0 && (o = i && n ? t.bind(y.Table, "", { at: {
1608
- scope: n,
1609
- rowIndex: i.rowIndex,
1610
- colIndex: i.colIndex
1611
- } }) : null), o);
1612
- return d(e, (e, r, i = []) => {
1613
- let o, l = e.type;
1614
- if (l === x.Cell) {
1606
+ function jt(e, t, r, a, o) {
1607
+ let s = a, c, l = () => (c === void 0 && (c = o && r ? t.bind(v.Table, "", { at: {
1608
+ scope: r,
1609
+ rowIndex: o.rowIndex,
1610
+ colIndex: o.colIndex
1611
+ } }) : null), c);
1612
+ return b(e, (e, a, o = []) => {
1613
+ let c, u = e.type;
1614
+ if (u === x.Cell) {
1615
1615
  let n = e.value;
1616
1616
  if (n?.scope) {
1617
- let r = t.bind(y.Sheet, n.scope, a);
1618
- r !== null && (o ||= { ...e }, o.value = {
1617
+ let r = t.bind(v.Sheet, n.scope, s);
1618
+ r !== null && (c ||= { ...e }, c.value = {
1619
1619
  ...n,
1620
1620
  scope: r
1621
1621
  });
1622
1622
  }
1623
- } else if (l === x.Named) {
1624
- let r = e.value;
1625
- if (r && !e.binding) {
1626
- let i = function(e, t, n, r) {
1623
+ } else if (u === x.Named) {
1624
+ let a = e.value;
1625
+ if (a && !e.binding) {
1626
+ let o = function(e, t, r, a) {
1627
1627
  if (t.scope) {
1628
- let e = n.bind(y.Sheet, t.scope, r);
1629
- if (e === null || s(e)) return;
1628
+ let e = r.bind(v.Sheet, t.scope, a);
1629
+ if (e === null || i(e)) return;
1630
1630
  }
1631
- let i = n.bind(y.Table, t.nameId, { existing: !0 });
1632
- if (i === null) return;
1633
- let a = {
1631
+ let o = r.bind(v.Table, t.nameId, { existing: !0 });
1632
+ if (o === null) return;
1633
+ let s = {
1634
1634
  type: x.TableReference,
1635
- value: i,
1635
+ value: o,
1636
1636
  inputs: null,
1637
1637
  isReference: !0
1638
1638
  };
1639
- v(a, e);
1640
- let o = t.scopeImage;
1641
- return typeof o == "string" && e.image !== void 0 && (a.image = o + e.image), a;
1642
- }(e, r, t, a);
1643
- if (i) return i;
1644
- let c = r.scope ? t.bind(y.Sheet, r.scope, a) : null, l = (c === null ? r.scope : s(c) ? c : t.resolve(y.Sheet, c)?.toString() ?? r.scope) ?? n, u = t.bind(y.NamedFormula, r.nameId, l ? { scope: l } : void 0);
1645
- u === null && c === null || (o ||= { ...e }, o.value = {
1646
- ...r,
1647
- nameId: u ?? r.nameId,
1648
- ...c === null ? void 0 : { scope: c }
1639
+ n(s, e);
1640
+ let c = t.scopeImage;
1641
+ return typeof c == "string" && e.image !== void 0 && (s.image = c + e.image), s;
1642
+ }(e, a, t, s);
1643
+ if (o) return o;
1644
+ let l = a.scope ? t.bind(v.Sheet, a.scope, s) : null, u = (l === null ? a.scope : i(l) ? l : t.resolve(v.Sheet, l)?.toString() ?? a.scope) ?? r, d = t.bind(v.NamedFormula, a.nameId, u ? { scope: u } : void 0);
1645
+ d === null && l === null || (c ||= { ...e }, c.value = {
1646
+ ...a,
1647
+ nameId: d ?? a.nameId,
1648
+ ...l === null ? void 0 : { scope: l }
1649
1649
  });
1650
1650
  }
1651
- } else if (l === x.Error) {
1651
+ } else if (u === x.Error) {
1652
1652
  let n = e.value;
1653
1653
  if (n?.scope) {
1654
- let r = t.bind(y.Sheet, n.scope, a);
1655
- r !== null && (o ||= { ...e }, o.value = {
1654
+ let r = t.bind(v.Sheet, n.scope, s);
1655
+ r !== null && (c ||= { ...e }, c.value = {
1656
1656
  ...n,
1657
1657
  scope: r
1658
1658
  });
1659
1659
  }
1660
- } else if (l === x.TableReference) {
1660
+ } else if (u === x.TableReference) {
1661
1661
  let n = e.value;
1662
1662
  if (n) {
1663
- let r = t.bind(y.Table, n);
1664
- o ||= { ...e }, r !== null && (o.value = r);
1663
+ let r = t.bind(v.Table, n);
1664
+ c ||= { ...e }, r !== null && (c.value = r);
1665
1665
  } else if (typeof n == "string") {
1666
- let n = c();
1667
- if (n !== null && $(e, t)) return {
1666
+ let n = l();
1667
+ if (n !== null && Mt(e, t)) return {
1668
1668
  ...e,
1669
1669
  value: n
1670
1670
  };
1671
1671
  }
1672
- } else if (l === x.TableColumn) {
1672
+ } else if (u === x.TableColumn) {
1673
1673
  let n = e.value;
1674
1674
  if (n) {
1675
- let r = B(i, x.TableReference), a = r?.value || (r ? c() ?? void 0 : void 0), s = t.bind(y.TableColumn, n, a ? { tableName: a } : void 0);
1676
- o ||= { ...e }, s !== null && (o.value = s);
1675
+ let r = V(o, x.TableReference), i = r?.value || (r ? l() ?? void 0 : void 0), a = t.bind(v.TableColumn, n, i ? { tableName: i } : void 0);
1676
+ c ||= { ...e }, a !== null && (c.value = a);
1677
1677
  }
1678
- } else if (l === x.Function) {
1678
+ } else if (u === x.Function) {
1679
1679
  let n = e.value;
1680
1680
  if (n) {
1681
- let r = t.bind(y.Function, n);
1682
- o ||= { ...e }, r !== null && (o.value = r);
1681
+ let r = t.bind(v.Function, n);
1682
+ c ||= { ...e }, r !== null && (c.value = r);
1683
1683
  }
1684
1684
  }
1685
- return o;
1685
+ return c;
1686
1686
  });
1687
1687
  }
1688
- function $(e, t) {
1688
+ function Mt(e, t) {
1689
1689
  let n = !0, r = e.inputs;
1690
1690
  if (!r) return !0;
1691
- for (let e = 0; e < r.length && n; e++) d(r[e], (e) => {
1692
- e.type === x.TableColumn && t.resolve(y.TableColumn, e.value) === null && (n = !1);
1691
+ for (let e = 0; e < r.length && n; e++) b(r[e], (e) => {
1692
+ e.type === x.TableColumn && t.resolve(v.TableColumn, e.value) === null && (n = !1);
1693
1693
  });
1694
1694
  return n;
1695
1695
  }
1696
1696
  function Nt(e, t) {
1697
1697
  let n = null;
1698
- return d(e, (e) => {
1698
+ return b(e, (e) => {
1699
1699
  if (n || e.type !== x.TableReference) return;
1700
1700
  if (e.value === "") return void (n = "A structured reference without a table name must be in a table that has its columns.");
1701
1701
  let r = e.value;
1702
1702
  if (!t || typeof r != "string") return;
1703
- let i = t.resolve(y.Table, r)?.toString() ?? r;
1704
- t.bind(y.Table, i, { existing: !0 }) === null ? n = `There is no table named '${i}'.` : $(e, t) || (n = "The table has no such column.");
1703
+ let i = t.resolve(v.Table, r)?.toString() ?? r;
1704
+ t.bind(v.Table, i, { existing: !0 }) === null ? n = `There is no table named '${i}'.` : Mt(e, t) || (n = "The table has no such column.");
1705
1705
  }), n;
1706
1706
  }
1707
- export { we as A, Pe as C, De as D, St as E, Se as O, it as S, Ae as T, st as _, nt as a, et as b, _t as c, ut as d, Nt as f, Oe as g, V as h, je as i, Ce as j, Te as k, mt as l, rt as m, Ct as n, ht as o, gt as p, Et as r, jt as s, Ze as t, dt as u, Mt as v, At as w, Me as x, ke as y };
1707
+ export { Ce as A, Ne as C, Ee as D, xt as E, xe as O, rt as S, ke as T, ot as _, tt as a, $e as b, gt as c, lt as d, Nt as f, De as g, H as h, Ae as i, Se as j, we as k, pt as l, nt as m, St as n, mt as o, ht as p, Tt as r, At as s, Xe as t, ut as u, jt as v, kt as w, je as x, Oe as y };