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

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 (195) hide show
  1. package/LICENSE.md +8 -7
  2. package/browser/esm/{DDQtExVGSoCzAf6-.mjs → B-Q1-7RgSnA75J32.mjs} +506 -502
  3. package/browser/esm/{Cl3jq6y4Idilod82.mjs → BI6NwRrdLCbPdz6f.mjs} +3 -3
  4. package/browser/esm/{Blo0Hwg2ojXt99Dl.mjs → BWNQcQyx8wt6huOq.mjs} +2 -2
  5. package/browser/esm/{Do8TQqQvnFXRlFu-.mjs → BY_-BTa5h6HnnZ1W.mjs} +3 -3
  6. package/browser/esm/{D4ZCoKyNCJvDQAkx.mjs → BlkstmZEklk6Y1QD.mjs} +23 -22
  7. package/browser/esm/{DpaqR081c-Q7WemN.mjs → BuKA3E-Ev8Dp5W2I.mjs} +2 -2
  8. package/browser/esm/{Bbrhl946_QbCz5WS.mjs → Byp_bvP9G-tN6hcz.mjs} +588 -587
  9. package/browser/esm/{CMSeF5rGzeuMUydM.mjs → C0o6WpBojS7XhV5m.mjs} +3 -3
  10. package/browser/esm/CAjITJT3eLst9Rhi.mjs +686 -0
  11. package/browser/esm/{CZ_ZPliIkoh8BViV.mjs → CFywn1iiD35nNNUP.mjs} +10 -10
  12. package/browser/esm/{DJNLo8Rd_5UQP0U5.mjs → CHByUyHFA3ESf7DX.mjs} +2 -2
  13. package/browser/esm/CLT3qGy_brDIwbYd.mjs +2017 -0
  14. package/browser/esm/{Blo0jHze0bQxnKh4.mjs → CVV4xqwD8gIjYj1E.mjs} +78 -78
  15. package/browser/esm/{FHp0QfwZMIfP0Sry.mjs → CWkaF7gYWCkW7vDA.mjs} +2 -2
  16. package/browser/esm/{CNM5d4p0Y7In0rTf.mjs → DCs7bk-yx0UhCvQ4.mjs} +3 -3
  17. package/browser/esm/{BsGN0Tk0jVc2n0hy.mjs → DDNerAeet8uDYKhf.mjs} +3 -3
  18. package/browser/esm/{D6OqcO9IWPaY211T.mjs → DGUOlgm1_WFmf_xO.mjs} +2 -2
  19. package/browser/esm/{Dp4OIVjjAVhpD815.mjs → DJTEQZiR9IFTuN_4.mjs} +3 -3
  20. package/browser/esm/{KgTozk3nvOZzEG27.mjs → DJrnSjYjFxJvpQiH.mjs} +2 -2
  21. package/browser/esm/{D0KMmRjGOQUs7Ls-.mjs → DTXsi--x2wgqgwtf.mjs} +3 -3
  22. package/browser/esm/{CPUobTehcKZllBDS.mjs → DUB6Oj_aiV3f8s5_.mjs} +51 -49
  23. package/browser/esm/{Bw66vzKThXKvXvPI.mjs → DW3kFc5t4Wnh5E9S.mjs} +2 -2
  24. package/browser/esm/{BzG0p8RdGDWHttVr.mjs → DkmqFp_-iUIy_l3D.mjs} +4 -4
  25. package/browser/esm/{zjEXdQiQruTkUyf5.mjs → Dlk1kRgkiBIpUxd9.mjs} +22 -22
  26. package/browser/esm/{tm7XJ-Zd_04xWKG6.mjs → DnMFW_oKYQxRjP1l.mjs} +2 -2
  27. package/browser/esm/{DA4S5eqog20pG7b2.mjs → DrmOaEx6CQ91zBsP.mjs} +29 -29
  28. package/browser/esm/{D8PxKK6OrmancpLT.mjs → DsWDvmky7CgzX_7W.mjs} +3 -3
  29. package/browser/esm/{DMbcmIZ-G2fbWn8v.mjs → Dx_dZ7jrw5Hxeoot.mjs} +2 -2
  30. package/browser/esm/{BN1MW1nuBndrzryn.mjs → Dy0TAi9WafVT8eke.mjs} +3 -3
  31. package/browser/esm/{L7SKr6r1tmMwFx6Q.mjs → JmmPE8Vsj85wdV8H.mjs} +2 -2
  32. package/browser/esm/{CIab4UYcHQQKTHeD.mjs → O970I8lbI7okqG7N.mjs} +404 -404
  33. package/browser/esm/{DwH4H_p6gTAcpQ17.mjs → WR3-xqcK1gF3ewAR.mjs} +4 -4
  34. package/browser/esm/XHhDDWrJiZJgWxPM.mjs +165 -0
  35. package/browser/esm/{KsfZhE6ocmYobGjY.mjs → YwDdO4YwcIE4OB0D.mjs} +2 -2
  36. package/browser/esm/aYpwVCDSwMUuz147.mjs +527 -0
  37. package/browser/esm/{BGPT-k25jo0UhtT5.mjs → gQzj95vSMXdKhpWf.mjs} +29032 -24101
  38. package/browser/esm/index.mjs +886 -578
  39. package/browser/esm/{CxhXbk-5XhaK8UNs.mjs → jotvQFBWO2jXAhWx.mjs} +2 -2
  40. package/browser/esm/{CWyzk_3eDCR9bKq6.mjs → mufbL88lyIKJEWyP.mjs} +1528 -1433
  41. package/browser/esm/{BVsG6Vpvb1ZzpURJ.mjs → qNv1x-Ny9TPbvZzj.mjs} +2 -2
  42. package/browser/esm/{XrasOsWQ-64jwMn1.mjs → taTjDyUIIxq2eClH.mjs} +4 -4
  43. package/browser/esm/{CqzKBrmmV-fWRoK7.mjs → yudASWe8CWXYcGt3.mjs} +22 -22
  44. package/licenses/dependencies.txt +69 -69
  45. package/node/esm/{CjwmkzMtjj6OMJbO.mjs → -q1xF3_2jmk3QHIY.mjs} +487 -483
  46. package/node/esm/{DDIiQZTdeY4vdK8_.mjs → 7ZwdVIsOdcziHpMD.mjs} +189 -189
  47. package/node/esm/{C7h7SvhWNwQ9TfGh.mjs → B6BQYUDRxbRnzca4.mjs} +4 -4
  48. package/node/esm/{DjsOfZn5vYpB7L6U.mjs → B8MYgBe4XICBSROW.mjs} +52 -50
  49. package/node/esm/{B8KEX44VZTFTTKb3.mjs → BBUVvO9Ma1RzbKux.mjs} +3 -3
  50. package/node/esm/{D9RwzPR5s2mWrbCQ.mjs → BQko-9y6mf2oQK7u.mjs} +2 -2
  51. package/node/esm/{BNiG1ISiMjs-G2mE.mjs → BSlFO0_8UZ38gfeE.mjs} +22 -22
  52. package/node/esm/{DUft-qpAS4MMANwG.mjs → Bgy7uWJVGwkN7AlD.mjs} +3 -3
  53. package/node/esm/{DyIASfKKPuNl5Xx-.mjs → BhosJbKOPgbJSZMY.mjs} +2 -2
  54. package/node/esm/BoLecFnIxhYKGor-.mjs +2040 -0
  55. package/node/esm/{WBHD7ECKG6HZ5UpY.mjs → BwyoLlHutolJw7OW.mjs} +2 -2
  56. package/node/esm/{Dh8o-woVpmUL50BD.mjs → CDgUHRW6vSASfqNr.mjs} +2 -2
  57. package/node/esm/{BZ0IRjh2hYuI86xW.mjs → CHS84ZGEoH6aeHsZ.mjs} +31 -30
  58. package/node/esm/{BRnNpoS8VpkAhdVk.mjs → CIlH2fSEpdYBZwUA.mjs} +2 -2
  59. package/node/esm/{BlzPuXtKvF3Qfr0p.mjs → CIxb44vA81H9lRip.mjs} +2 -2
  60. package/node/esm/{Cx9nQSsuyqhayyBS.mjs → Cb1-r2RCxcJZB6fM.mjs} +32675 -27215
  61. package/node/esm/{DKdFasYVvjAitASZ.mjs → CjCqcGyCYGkaMQI9.mjs} +2 -2
  62. package/node/esm/{D7ia4o3y5Wvl__9Y.mjs → ClJJC8tBpgsqHwdn.mjs} +2 -2
  63. package/node/esm/{C-JEySqMuKdpcKe0.mjs → Cle-_21jebWv_-D4.mjs} +3 -3
  64. package/node/esm/{j8DqCwPgfIPICFtf.mjs → D51xu0rubo34Ppeg.mjs} +1005 -1004
  65. package/node/esm/{Ddd1y3TP0kqnnSs7.mjs → DCSJKgcCQzOV-dMJ.mjs} +3 -3
  66. package/node/esm/{ZtF9EuipL7Z9Iwfs.mjs → DCaLNIs-_4Y6hJ8S.mjs} +2 -2
  67. package/node/esm/DTkV7IK2_ODMJAP5.mjs +115 -0
  68. package/node/esm/DfbVTAhNutxM74E8.mjs +169 -0
  69. package/node/esm/{DVejVdSBXzAFQbqo.mjs → DfrxGbxxowFmm3SF.mjs} +2 -2
  70. package/node/esm/{DW3u4bBJIUaHZ6m-.mjs → DgsBYF3xbjgx9Mzp.mjs} +2 -2
  71. package/node/esm/{CHBlLTJaoPUVxA2J.mjs → DxnBYzOueAKEqaQT.mjs} +22 -22
  72. package/node/esm/M3jahkTgfUxGyeZv.mjs +530 -0
  73. package/node/esm/{-afI0SRg_vgXtea7.mjs → NnrDjio_xwTBs05n.mjs} +3 -3
  74. package/node/esm/{BqvqbFsPQB0gEvwF.mjs → OCrS6pBT6lGRu82d.mjs} +1762 -1674
  75. package/node/esm/XhDjStxKy-dd3WKa.mjs +199 -0
  76. package/node/esm/{D9zb5xVRehABdbXL.mjs → Yo7_havHbr9VL8R4.mjs} +2 -2
  77. package/node/esm/{MtRwC1PMkOEb1Nty.mjs → btVWSwUwMjM0J5fS.mjs} +3 -3
  78. package/node/esm/{DQqXPS05dvF0F-gh.mjs → cRz94rkuvDrA8mr9.mjs} +2 -2
  79. package/node/esm/{BfXLtDqsXXYeZ6LX.mjs → fwfAgq8qIADcHmY4.mjs} +78 -78
  80. package/node/esm/index.mjs +913 -598
  81. package/node/esm/{OnkJkCGFDjamqIUQ.mjs → jqBKdf9DG54xqpaw.mjs} +3 -3
  82. package/node/esm/{C6b4rM62pIWIywlM.mjs → nxxwAZZF8NsdErJW.mjs} +2 -2
  83. package/node/esm/{B07QPde9GloqsW8e.mjs → oGGVbqahqfK45-Uz.mjs} +4 -4
  84. package/node/esm/{BlHlBRvKGt-4CS0A.mjs → zh6vcRzFqdV1aYh5.mjs} +2 -2
  85. package/package.json +7 -7
  86. package/resources/locales/de/model.msg.json +82 -1
  87. package/resources/locales/en/model.msg.json +80 -1
  88. package/types/scripting-api.json +9967 -9497
  89. package/types/scripting-enums.json +27 -0
  90. package/types/scripting.d.ts +2282 -166
  91. package/types/src/.generated/wasm/sdk.d.ts +332 -0
  92. package/types/src/calculation/Calculation.d.ts +8 -0
  93. package/types/src/calculation/ICalculation.d.ts +51 -0
  94. package/types/src/calculation/compiler/Types.d.ts +5 -0
  95. package/types/src/calculation/executor/CalcExecutorUtils.d.ts +1 -1
  96. package/types/src/calculation/formula/FormulaBlock.d.ts +2 -0
  97. package/types/src/calculation/formula/IFormulaBlock.d.ts +18 -0
  98. package/types/src/calculation/grid/CalcGrid.d.ts +5 -1
  99. package/types/src/calculation/grid/CalcGridBackend.d.ts +36 -1
  100. package/types/src/calculation/grid/CalcGridProxy.d.ts +2 -0
  101. package/types/src/calculation/grid/CalcGridUtils.d.ts +4 -2
  102. package/types/src/calculation/grid/FormulaHost.d.ts +3 -1
  103. package/types/src/calculation/grid/ICalcGrid.d.ts +88 -0
  104. package/types/src/calculation/grid/_CalcRequest.d.ts +9 -0
  105. package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +2 -0
  106. package/types/src/calculation/spatial/SpillEntry.d.ts +55 -4
  107. package/types/src/calculation/state/CalcNode.d.ts +6 -3
  108. package/types/src/calculation/state/CalculationContext.d.ts +4 -2
  109. package/types/src/calculation/state/_PivotView.d.ts +22 -0
  110. package/types/src/cell/ICell.d.ts +1 -21
  111. package/types/src/cellRange/ICellRange.d.ts +18 -2
  112. package/types/src/collections/MixedTypedArrayList.d.ts +16 -2
  113. package/types/src/condition/BuiltInOperators/AbstractOperator.d.ts +10 -0
  114. package/types/src/condition/BuiltInOperators/GreaterThanEqualToOperator.d.ts +3 -0
  115. package/types/src/condition/BuiltInOperators/GreaterThanOperator.d.ts +3 -0
  116. package/types/src/condition/BuiltInOperators/LessThanEqualToOperator.d.ts +3 -0
  117. package/types/src/condition/BuiltInOperators/LessThanOperator.d.ts +3 -0
  118. package/types/src/condition/BuiltInOperators/MatchesOperator.d.ts +10 -0
  119. package/types/src/condition/BuiltInOperators/TimePeriodOperator.d.ts +2 -0
  120. package/types/src/condition/BuiltInOperators/index.d.ts +2 -0
  121. package/types/src/condition/Condition.d.ts +1 -0
  122. package/types/src/condition/ICondition.d.ts +15 -0
  123. package/types/src/condition/_ConditionUtils.d.ts +14 -0
  124. package/types/src/conditionalFormat/ConditionalFormat.d.ts +2 -1
  125. package/types/src/conditionalFormat/IConditionalFormat.d.ts +4 -3
  126. package/types/src/license/LicenseDetails.d.ts +27 -0
  127. package/types/src/license/LicenseManager.d.ts +24 -7
  128. package/types/src/license/_Utils.d.ts +34 -3
  129. package/types/src/license/index.d.ts +1 -0
  130. package/types/src/license/runtime.browser.d.ts +32 -4
  131. package/types/src/license/runtime.node.d.ts +8 -5
  132. package/types/src/license/summary.d.ts +18 -0
  133. package/types/src/pivot/IPivotTable.d.ts +1549 -13
  134. package/types/src/pivot/IPivotTableCollection.d.ts +70 -4
  135. package/types/src/pivot/PivotCache.d.ts +95 -11
  136. package/types/src/pivot/PivotDataField.d.ts +73 -0
  137. package/types/src/pivot/PivotField.d.ts +142 -0
  138. package/types/src/pivot/PivotTable.d.ts +548 -14
  139. package/types/src/pivot/PivotTableCollection.d.ts +18 -3
  140. package/types/src/pivot/_PivotAreas.d.ts +48 -0
  141. package/types/src/pivot/_PivotControls.d.ts +140 -0
  142. package/types/src/pivot/_PivotEngine.d.ts +9 -0
  143. package/types/src/pivot/_PivotGroups.d.ts +25 -0
  144. package/types/src/pivot/_PivotItems.d.ts +167 -0
  145. package/types/src/pivot/_PivotStructure.d.ts +237 -0
  146. package/types/src/pivot/_PivotStylePreview.d.ts +21 -0
  147. package/types/src/pivot/_PivotUtils.d.ts +37 -0
  148. package/types/src/pivot/engine/PivotAdd.d.ts +37 -0
  149. package/types/src/pivot/engine/PivotData.d.ts +65 -0
  150. package/types/src/pivot/engine/PivotEdit.d.ts +45 -0
  151. package/types/src/pivot/engine/PivotFilters.d.ts +50 -0
  152. package/types/src/pivot/engine/PivotFormulas.d.ts +72 -0
  153. package/types/src/pivot/engine/PivotLayout.d.ts +133 -0
  154. package/types/src/pivot/engine/PivotMove.d.ts +24 -0
  155. package/types/src/pivot/engine/PivotRefresh.d.ts +87 -0
  156. package/types/src/pivot/engine/PivotSort.d.ts +26 -0
  157. package/types/src/pivot/engine/PivotViewBuilder.d.ts +22 -0
  158. package/types/src/pivot/engine/index.d.ts +15 -0
  159. package/types/src/pivot/index.d.ts +4 -0
  160. package/types/src/pivot/kernel/KernelPivot.d.ts +63 -0
  161. package/types/src/pivot/kernel/_KernelLeaves.d.ts +100 -0
  162. package/types/src/pivot/kernel/_PivotAxisTree.d.ts +71 -0
  163. package/types/src/primitives/Range.d.ts +12 -1
  164. package/types/src/sheet/IWorksheet.d.ts +35 -0
  165. package/types/src/sheet/SheetCell.d.ts +21 -14
  166. package/types/src/sheet/SheetRange.d.ts +3 -0
  167. package/types/src/sheet/Worksheet.d.ts +175 -7
  168. package/types/src/sheet/_PivotFootprint.d.ts +42 -0
  169. package/types/src/sheet/_SheetAutoFitUtils.d.ts +12 -1
  170. package/types/src/sheet/_SheetMutations.d.ts +47 -0
  171. package/types/src/sheet/_SheetStateTypes.d.ts +11 -0
  172. package/types/src/sheet/style/SheetCellStyle.d.ts +6 -0
  173. package/types/src/sheet/style/SheetPivotStyle.d.ts +83 -0
  174. package/types/src/sheet/style/_IndentUnit.d.ts +14 -0
  175. package/types/src/sheetHeader/SheetCellHeader.d.ts +1 -1
  176. package/types/src/slicer/ISlicer.d.ts +114 -34
  177. package/types/src/slicer/ITimeline.d.ts +61 -0
  178. package/types/src/slicer/Slicer.d.ts +76 -3
  179. package/types/src/slicer/_PivotSlicer.d.ts +51 -0
  180. package/types/src/slicer/index.d.ts +1 -0
  181. package/types/src/table/AnchoredTable.d.ts +11 -1
  182. package/types/src/table/ITable.d.ts +5 -6
  183. package/types/src/table/ITableStyle.d.ts +50 -34
  184. package/types/src/table/_BuiltInPivotStyles.d.ts +8 -0
  185. package/types/src/table/_BuiltInTableStyles.d.ts +0 -1
  186. package/types/src/type/ITypes.d.ts +5 -1
  187. package/types/src/workbook/IWorkbook.d.ts +8 -2
  188. package/types/src/workbook/Workbook.d.ts +72 -6
  189. package/browser/esm/BrHplg4RuI5jOmmr.mjs +0 -357
  190. package/browser/esm/eImPONkfn5DstmS8.mjs +0 -184
  191. package/node/esm/03AYPvCda2x9EOlY.mjs +0 -360
  192. package/node/esm/BmVQRGAijOHzgHmz.mjs +0 -199
  193. package/node/esm/Dk4KLs5GoRRuD8J4.mjs +0 -115
  194. package/types/src/pivot/_PivotXml.d.ts +0 -24
  195. package/types/src/primitives/Grouping.d.ts +0 -65
@@ -1,31 +1,31 @@
1
1
  /**
2
- * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.15
2
+ * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.17
3
3
  *
4
4
  * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
5
+ * License: SheetXL EULA — https://www.sheetxl.com/eula
6
6
  */
7
- import { Bn as e, Ct as t, In as n, Li as r, Rn as i, Sn as l, St as s, Zn as o, _ as a, _i as u, br as c, bt as f, cr as p, dr as d, dt as g, er as v, f as h, fi as m, gr as y, h as I, hr as b, jt as x, lr as R, n as E, oi as T, p as A, s as S, u as w, xr as C, yr as N, zn as F } from "./Cx9nQSsuyqhayyBS.mjs";
8
- import { nn as P } from "./j8DqCwPgfIPICFtf.mjs";
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
9
  import { FormulaError as L, Scalar as k, 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) => g(e + t, e), W = (e, t) => g(e - t, e), U = (e, t) => h(e * t), _ = (e, t) => 0 === t ? L.BuiltIn.Div0 : h(e / t), j = (e, t) => {
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) => {
12
12
  if (0 === e) {
13
13
  if (t < 0) return L.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 h(e ** t);
17
+ if (Number.isInteger(t) && Math.abs(t) <= 4294967294) return v(e ** t);
18
18
  const n = Number((1 / t).toPrecision(15));
19
- return Number.isInteger(n) && 1 === Math.abs(n % 2) ? h(-((-e) ** t)) : NaN;
19
+ return Number.isInteger(n) && 1 === Math.abs(n % 2) ? v(-((-e) ** t)) : NaN;
20
20
  }
21
- return h(e ** t);
22
- }, G = (e = "", t = "") => {
23
- null === e && (e = ""), null === t && (t = "");
24
- const n = typeof t;
25
- "boolean" === typeof e && (e = r(e)), "boolean" === n && (t = r(t));
26
- const i = "" + e + t;
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
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), Z = (e, t = null, n = null) => e.compare(t, n) > 0, K = (e, t = null, n = null) => e.compare(t, n) >= 0, q = (e, t = null, n = null) => e.compare(t, n) < 0, J = (e, t = null, n = null) => e.compare(t, n) <= 0, Q = {
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 = {
29
29
  type: $.Number,
30
30
  coerce: [$.Boolean, $.String],
31
31
  onError: "value",
@@ -45,19 +45,19 @@ var z = (e, t) => e + t, D = (e, t) => e - t, M = (e, t) => g(e + t, e), W = (e,
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, a(t, !0), $.Number, !0), n = S(i, n, a(n, !0), $.Number, !0), t && L.isError(t) ? t : n && L.isError(n) ? n : r(t, n);
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);
49
49
  }
50
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 : I(s ? r(n, t) : r(t, n), e), Q).fillEmpty(0);
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);
52
52
  }, re = (e, t, n, r) => {
53
- if (l(t) || l(n)) return L.BuiltIn.Value;
53
+ if (F(t) || F(n)) return L.BuiltIn.Value;
54
54
  if (B(t) || B(n)) return L.BuiltIn.Value;
55
55
  if (null !== t && void 0 !== t.colStart && (t = e.getValueAt(t.rowStart, t.colStart, t.scope)) && L.isError(t)) return t;
56
56
  if (null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && L.isError(n)) return n;
57
- let i, s;
57
+ let i, l;
58
58
  t = te(t), n = te(n);
59
- let o = !1;
60
- return t?.isIRange ? (i = t, s = n) : n?.isIRange && (i = n, s = t, o = !0), i ? i.broadcast(s, (t, n) => t && L.isError(t) ? t : n && L.isError(n) ? n : (t = ie(t), n = ie(n), o ? r(e, n, t) : r(e, t, n)), ee) : L.isError(t) ? t : L.isError(n) ? n : r(e, ie(t), ie(n));
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));
61
61
  }, ie = (e) => {
62
62
  if (!0 !== e?.isIRichData) return e;
63
63
  const t = e.toPrimitive?.();
@@ -70,9 +70,9 @@ var z = (e, t) => e + t, D = (e, t) => e - t, M = (e, t) => g(e + t, e), W = (e,
70
70
  if ("-" !== t) throw new L.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, a(n, !0), $.Number, !0)) ? L.BuiltIn.Value : n * i;
73
+ return "number" != typeof (n = S(t, n, u(n, !0), $.Number, !0)) ? L.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), Q);
75
+ return r.broadcast(i, (e, t) => e && L.isError(e) ? e : t && L.isError(t) ? t : U(e, t), J);
76
76
  }, se = (e) => e.getCode() <= L.Code.NA ? e : L.BuiltIn.Value, oe = (e, t, n, r, i) => {
77
77
  if (L.isError(t)) return se(t);
78
78
  if (n && L.isError(n)) return se(n);
@@ -93,18 +93,18 @@ var z = (e, t) => e + t, D = (e, t) => e - t, M = (e, t) => g(e + t, e), W = (e,
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, T, "either"),
97
- ":": (e, t, n, r) => oe(e, t, n, u, "start"),
96
+ " ": (e, t, n, r) => oe(e, t, n, s, "either"),
97
+ ":": (e, t, n, r) => oe(e, t, n, x, "start"),
98
98
  ".:.": (e, t, n, r) => {
99
- const i = oe(e, t, n, u, "start");
99
+ const i = oe(e, t, n, x, "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, u, "start");
103
+ const i = oe(e, t, n, x, "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, u, "start");
107
+ const i = oe(e, t, n, x, "start");
108
108
  return e.getFunction("TRIMRANGE").execute(i, 2, 2);
109
109
  },
110
110
  "&": (e, t, n) => ((e, t, n, r) => {
@@ -114,17 +114,17 @@ var z = (e, t) => e + t, D = (e, t) => e - t, M = (e, t) => g(e + t, e), W = (e,
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, a(t, !0), $.String, !1), n = S(i, n, a(n, !0), $.String, !1), L.isError(t) ? t : L.isError(n) ? n : r(t, n);
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);
118
118
  }
119
119
  const s = !i, o = s ? t : n;
120
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);
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, Z),
124
+ ">": (e, t, n) => re(e, t, n, K),
125
125
  "<": (e, t, n) => re(e, t, n, q),
126
- ">=": (e, t, n) => re(e, t, n, K),
127
- "<=": (e, t, n) => re(e, t, n, J)
126
+ ">=": (e, t, n) => re(e, t, n, Z),
127
+ "<=": (e, t, n) => re(e, t, n, Q)
128
128
  }, ue = {
129
129
  "+": (e, t, n) => ne(e, t, n, M),
130
130
  "-": (e, t, n) => ne(e, t, n, W)
@@ -165,38 +165,38 @@ var de = class {
165
165
  value: null,
166
166
  inputs: null
167
167
  };
168
- if (this.references.set(e, t), n === C.Cell) {
168
+ if (this.references.set(e, t), n === T.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 === C.Infix || n === C.Prefix || n === C.Postfix || n === C.List) {
173
+ if (n === T.Infix || n === T.Prefix || n === T.Postfix || n === T.List) {
174
174
  const n = e.inputs || [], r = n.length, i = e.value;
175
175
  t.op = i;
176
- const l = w(r);
176
+ const l = N(r);
177
177
  t.inputs = l;
178
178
  for (let e = 0; e < r; e++) {
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), Ze.includes(i)) {
183
- const r = n[0], i = !!r && r.type === C.Cell, l = n[1], s = !!l && l.type === C.Cell;
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;
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 === C.Error || n === C.Named) {
189
- const r = n === C.Named ? e.value.nameId : p(e.value);
188
+ if (n === T.Error || n === T.Named) {
189
+ const r = n === T.Named ? e.value.nameId : g(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 === C.TableReference) return t.op = n, this.rootReferences.add(t), e.referenceIndex = this.referenceIndices.length, void this.referenceIndices.push(t.index);
194
+ if (n === T.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: C.Function,
199
+ op: T.Function,
200
200
  value: e.value,
201
201
  inputs: null
202
202
  };
@@ -204,166 +204,166 @@ var de = class {
204
204
  }
205
205
  }
206
206
  };
207
- function ge(e, t = !1, r = N) {
208
- const l = [], s = /* @__PURE__ */ new Set(), o = (e, n, r) => {
209
- const i = {
207
+ function ge(e, n = !1, r = p) {
208
+ const i = [], s = /* @__PURE__ */ new Set(), o = (e, t, r) => {
209
+ const l = {
210
210
  type: e.type,
211
- value: e.type === C.Error ? R(e.value) : e.value
211
+ value: e.type === T.Error ? C(e.value) : e.value
212
212
  };
213
- void 0 !== e.image && (i.text = ((e) => {
214
- const n = t ? e.value?.scopeImage : void 0;
215
- return "string" == typeof n ? n : "";
213
+ void 0 !== e.image && (l.text = ((e) => {
214
+ const t = n ? e.value?.scopeImage : void 0;
215
+ return "string" == typeof t ? t : "";
216
216
  })(e) + e.image);
217
217
  const o = e.evalIndex ?? r;
218
- return void 0 !== o && (i.evalIndex = o), n && (i.context = n), void 0 !== e.referenceIndex && (i.referenceIndex = e.referenceIndex), e.isReference && s.add(i), l.push(i), i;
219
- }, a = (e, t, n, r, i) => {
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) => {
220
220
  if (null == t) return;
221
- if (l.length > 1 && e === C.Whitespace && l[l.length - 1].type === C.Whitespace) return;
221
+ if (i.length > 1 && e === T.Whitespace && i[i.length - 1].type === T.Whitespace) return;
222
222
  const s = {
223
223
  type: e,
224
224
  value: t,
225
- text: i ?? t
225
+ text: l ?? t
226
226
  };
227
- void 0 !== r && (s.evalIndex = r), n && (s.context = n), l.push(s);
227
+ void 0 !== r && (s.evalIndex = r), n && (s.context = n), i.push(s);
228
228
  };
229
229
  (function e(u, c, f) {
230
230
  const p = u.evalIndex ?? f ?? 0, d = u.type, g = (t, n, 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(C.Separator, ",", n, i, r.separatorFunction);
233
+ for (let s = 0; s < l; s++) e(t[s], n, i), s < l - 1 && a(T.Separator, ",", n, i, r.separatorFunction);
234
234
  };
235
235
  if (u.isLiteral) {
236
- if (a(C.Whitespace, u.wsBefore, c, p), d === C.Array) {
237
- a(C.Type, "{", c, p);
236
+ if (a(T.Whitespace, u.wsBefore, c, p), d === T.Array) {
237
+ a(T.Type, "{", c, p);
238
238
  const t = u.value, n = t.length;
239
239
  for (let i = 0; i < n; i++) {
240
240
  const l = t[i], s = l.value, o = s.length;
241
241
  for (let t = 0; t < o; t++) {
242
242
  const n = s[t];
243
- a(C.Whitespace, n.wsBefore, c, p), e(n, c, p), a(C.Whitespace, n.wsAfter, c, p), t < o - 1 && a(C.Separator, ",", c, p, r.separatorColumn);
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);
244
244
  }
245
- i < n - 1 && (a(C.Whitespace, l.wsBefore, c, p), a(C.Separator, ";", c, p, r.separatorRow), a(C.Whitespace, l.wsAfter, c, p));
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));
246
246
  }
247
- u.error || a(C.Type, "}", c, p);
248
- } else d === C.String ? (u = {
247
+ u.error || a(T.Type, "}", c, p);
248
+ } else d === T.String ? (u = {
249
249
  type: d,
250
250
  value: "\"" + `${u.value}`.replace(/"/g, "\"\"") + "\"",
251
251
  image: u.image
252
252
  }, o(u, c, p)) : o(u, c, p);
253
- a(C.Whitespace, u.wsAfter, c, p);
254
- } else if (d === C.Infix) e(u.inputs[0], c, p), a(C.Whitespace, u.wsBefore, c, p), o(u, c, p), a(C.Whitespace, u.wsAfter, c, p), e(u.inputs[1], c, p);
255
- else if (d === C.Prefix) a(C.Whitespace, u.wsBefore, c, p), o(u, c, p), a(C.Whitespace, u.wsAfter, c, p), u.inputs && e(u.inputs[0], c, p);
256
- else if (d === C.Postfix) {
257
- u.inputs?.[0] && e(u.inputs[0], c, p), a(C.Whitespace, u.wsBefore, c, p);
258
- const t = o(u, c, p), n = l[l.length - 2];
259
- "#" === u.value && void 0 !== t.text && !u.wsBefore && s.has(n) && (n.text = (n.text ?? "") + t.text, t.text = ""), a(C.Whitespace, u.wsAfter, 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);
260
260
  } else {
261
- a(C.Whitespace, u.wsBefore, c, p);
261
+ a(T.Whitespace, u.wsBefore, c, p);
262
262
  const f = u.inputs;
263
263
  switch (d) {
264
- case C.Function: {
264
+ case T.Function: {
265
265
  const t = String(u.value), n = {
266
- type: C.Function,
266
+ type: T.Function,
267
267
  value: t,
268
268
  text: u.image ?? t,
269
269
  evalIndex: u.evalIndex
270
270
  };
271
- c && (n.context = c), l.push(n);
272
- const i = {
271
+ c && (n.context = c), i.push(n);
272
+ const l = {
273
273
  name: t,
274
274
  argIndex: -1,
275
275
  type: u.binder?.kind ?? "function"
276
276
  };
277
- if (c?.bound && (i.bound = c.bound), a(C.Paren, "(", i, u.evalIndex), f) {
278
- const t = f.length, n = u.binder?.kind, l = "lambda" === n ? 1 : "let" === n ? 2 : 0;
279
- let s = i.bound;
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;
280
280
  for (let o = 0; o < t; o++) {
281
- const u = l && o >= l ? f[o - l] : void 0;
281
+ const u = i && o >= i ? f[o - i] : void 0;
282
282
  if (u?.binding?.declaration) {
283
- const e = u.value.nameId, t = "let" === n ? bt(f[o - 1]) : void 0;
284
- s = It(s, t ? {
283
+ const e = u.value.nameId, t = "let" === n ? Rt(f[o - 1]) : void 0;
284
+ s = xt(s, t ? {
285
285
  name: e,
286
286
  params: t
287
287
  } : { name: e });
288
288
  }
289
289
  const c = {
290
- ...i,
290
+ ...l,
291
291
  argIndex: o
292
292
  };
293
- s && (c.bound = s), e(f[o], c, p), o < t - 1 && a(C.Separator, ",", c, p, r.separatorFunction);
293
+ s && (c.bound = s), e(f[o], c, p), o < t - 1 && a(T.Separator, ",", c, p, r.separatorFunction);
294
294
  }
295
295
  }
296
- u.error || a(C.Paren, ")", i, u.evalIndex);
296
+ u.error || a(T.Paren, ")", l, u.evalIndex);
297
297
  break;
298
298
  }
299
- case C.Call: {
300
- const t = i(u), s = l.length;
301
- if (t && e(t, c, p), t?.type === C.Named) for (let e = s; e < l.length; e++) {
302
- const t = l[e];
303
- t.type !== C.Whitespace && (t.evalIndex = u.evalIndex, t.type === C.Named && (t.type = C.Function, t.value = t.value.name));
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));
304
304
  }
305
305
  const o = {
306
- name: t?.type === C.Named ? t.value.nameId : "",
306
+ name: n?.type === T.Named ? n.value.nameId : "",
307
307
  argIndex: -1,
308
308
  type: "function"
309
309
  };
310
- c?.bound && (o.bound = c.bound), a(C.Paren, "(", o, u.evalIndex);
311
- const f = n(u), d = f.length;
310
+ c?.bound && (o.bound = c.bound), a(T.Paren, "(", o, u.evalIndex);
311
+ const f = l(u), d = f.length;
312
312
  for (let t = 0; t < d; t++) {
313
313
  const n = {
314
314
  ...o,
315
315
  argIndex: t
316
316
  };
317
- e(f[t], n, p), t < d - 1 && a(C.Separator, ",", n, p, r.separatorFunction);
317
+ e(f[t], n, p), t < d - 1 && a(T.Separator, ",", n, p, r.separatorFunction);
318
318
  }
319
- u.error || a(C.Paren, ")", o, u.evalIndex);
319
+ u.error || a(T.Paren, ")", o, u.evalIndex);
320
320
  break;
321
321
  }
322
- case C.Cell:
322
+ case T.Cell:
323
323
  o(u, c, p);
324
324
  break;
325
- case C.Paren:
325
+ case T.Paren:
326
326
  a(d, "(", c, p), g(f, c, p), u.error || a(d, ")", c, p);
327
327
  break;
328
- case C.TableReference: {
329
- const n = u.value?.tableId ?? "", r = {
330
- name: n,
328
+ case T.TableReference: {
329
+ const t = u.value?.tableId ?? "", r = {
330
+ name: t,
331
331
  argIndex: -1,
332
332
  type: "table"
333
- }, i = l.length, o = u.image;
333
+ }, l = i.length, o = u.image;
334
334
  let d, g = !1;
335
- if (n && o) {
335
+ if (t && o) {
336
336
  let e = 0;
337
337
  if (91 === o.charCodeAt(0)) {
338
338
  const t = o.indexOf("]");
339
339
  -1 !== t && 33 === o.charCodeAt(t + 1) && (e = t + 2);
340
340
  }
341
- const n = o.indexOf("[", e);
342
- if (g = 0 === n && null != f, n > 0) d = o.slice(0, n);
341
+ const t = o.indexOf("[", e);
342
+ if (g = 0 === t && null != f, t > 0) d = o.slice(0, t);
343
343
  else if (!f) {
344
344
  const e = o.lastIndexOf("!");
345
- d = t || -1 === e ? o : o.slice(e + 1);
345
+ d = n || -1 === e ? o : o.slice(e + 1);
346
346
  }
347
347
  }
348
- if (!n || g && t || a(C.TableReference, n, c, p, d), f && a(C.Paren, "[", r, p), f) {
348
+ if (!t || g && n || a(T.TableReference, t, c, p, d), f && a(T.Paren, "[", r, p), f) {
349
349
  const t = f.length;
350
350
  for (let n = 0; n < t; n++) {
351
351
  const i = {
352
352
  ...r,
353
353
  argIndex: n
354
354
  };
355
- e(f[n], i, p), n < t - 1 && a(C.Separator, ",", i, p);
355
+ e(f[n], i, p), n < t - 1 && a(T.Separator, ",", i, p);
356
356
  }
357
357
  }
358
- f && !u.error && a(C.Paren, "]", r, p);
358
+ f && !u.error && a(T.Paren, "]", r, p);
359
359
  const v = u.referenceIndex;
360
- for (let e = i; e < l.length; e++) void 0 !== v && (l[e].referenceIndex = v), s.add(l[e]);
360
+ for (let e = l; e < i.length; e++) void 0 !== v && (i[e].referenceIndex = v), s.add(i[e]);
361
361
  break;
362
362
  }
363
- case C.TableSpecifier:
364
- case C.TableColumn: {
363
+ case T.TableSpecifier:
364
+ case T.TableColumn: {
365
365
  const e = u.image, t = null != e && e.startsWith("[") && e.endsWith("]");
366
- t && a(C.Paren, "[", c, p);
366
+ t && a(T.Paren, "[", c, p);
367
367
  const n = {
368
368
  table: "table" === c?.type ? c.name : "",
369
369
  name: u.value
@@ -372,61 +372,61 @@ function ge(e, t = !1, r = N) {
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), l.push(r), t && a(C.Paren, "]", c, p);
375
+ void 0 !== p && (r.evalIndex = p), c && (r.context = c), i.push(r), t && a(T.Paren, "]", c, p);
376
376
  break;
377
377
  }
378
- case C.List:
378
+ case T.List:
379
379
  g(f, c, p);
380
380
  break;
381
- case C.Named: {
381
+ case T.Named: {
382
382
  const e = o(u, c, p), t = u.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 = C.Parameter, u.binding.declaration && (e.value.declaration = !0)), delete e.referenceIndex;
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;
387
387
  break;
388
388
  }
389
389
  default: void 0 !== u.value && o(u, c, p), f && f.forEach((t) => e(t, c, p));
390
390
  }
391
- a(C.Whitespace, u.wsAfter, c, p);
391
+ a(T.Whitespace, u.wsAfter, c, p);
392
392
  }
393
393
  })(e);
394
394
  const u = /* @__PURE__ */ new Map();
395
- for (const e of l) if (e.type === C.Cell && void 0 !== e.referenceIndex) {
395
+ for (const e of i) if (e.type === T.Cell && void 0 !== e.referenceIndex) {
396
396
  const t = u.get(e.referenceIndex);
397
397
  t ? t.push(e) : u.set(e.referenceIndex, [e]);
398
398
  }
399
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
400
  const c = /* @__PURE__ */ new Map();
401
- for (const e of l) if (void 0 !== e.referenceIndex && void 0 !== e.evalIndex) {
401
+ for (const e of i) if (void 0 !== e.referenceIndex && void 0 !== e.evalIndex) {
402
402
  const t = c.get(e.referenceIndex);
403
403
  (void 0 === t || e.evalIndex < t) && c.set(e.referenceIndex, e.evalIndex);
404
404
  }
405
405
  if (c.size > 0) {
406
- for (const e of l) if (void 0 !== e.referenceIndex) {
406
+ for (const e of i) if (void 0 !== e.referenceIndex) {
407
407
  const t = c.get(e.referenceIndex);
408
408
  void 0 !== t && (e.evalIndex = t);
409
409
  }
410
410
  }
411
- return l;
411
+ return i;
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 === C.Cell || l === C.Named || l === C.Error) {
418
- const e = l === C.Cell ? i.value?.scope : (C.Named, i.value?.scope ?? void 0), r = l === C.Error ? void 0 !== i.text && d(i.text) : i.text?.includes("!") ?? !1;
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;
419
419
  if (e && void 0 !== i.text && !r) {
420
- const r = t?.resolve(x.Sheet, e)?.toString() ?? e;
421
- n += m(r) + "!" + i.text;
420
+ const r = t?.resolve(b.Sheet, e)?.toString() ?? e;
421
+ n += y(r) + "!" + i.text;
422
422
  continue;
423
423
  }
424
- if (l === C.Named) {
424
+ if (l === T.Named) {
425
425
  n += i.text ?? i.value?.name ?? "";
426
426
  continue;
427
427
  }
428
428
  }
429
- if (l === C.Parameter) {
429
+ if (l === T.Parameter) {
430
430
  n += i.text ?? i.value?.name ?? "";
431
431
  continue;
432
432
  }
@@ -437,40 +437,40 @@ function ve(e, t) {
437
437
  }
438
438
  function he(e, t) {
439
439
  let n;
440
- if (y(e, (e) => {
440
+ if (f(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 === C.Whitespace && r.shift(), r.length > 1 && r[r.length - 1].type === C.Whitespace && r.pop(), r;
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;
445
445
  }
446
446
  function me(e) {
447
- return y(e, (e) => {
448
- if (e.type !== C.TableReference) return;
447
+ return f(e, (e) => {
448
+ if (e.type !== T.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
452
  let r = !1, i = !1, l = !1, s = !1, o = null, a = null, u = !1;
453
453
  const c = (e) => {
454
- e?.type === C.TableColumn && (o = e.value, a = e.value);
454
+ e?.type === T.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 === C.TableSpecifier) {
458
+ if (t === T.TableSpecifier) {
459
459
  const t = e.value.toUpperCase().trim();
460
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 === C.TableColumn) c(e);
462
- else if (t === C.Infix && ":" === e.value) {
461
+ } else if (t === T.TableColumn) c(e);
462
+ else if (t === T.Infix && ":" === e.value) {
463
463
  const t = e.inputs?.[0], n = e.inputs?.[1];
464
- t?.type === C.TableColumn && (o = t.value), n?.type === C.TableColumn && (a = n.value);
465
- } else if (t === C.Prefix && "@" === e.value) {
464
+ t?.type === T.TableColumn && (o = t.value), n?.type === T.TableColumn && (a = n.value);
465
+ } else if (t === T.Prefix && "@" === e.value) {
466
466
  u = !0;
467
467
  const t = e.inputs?.[0];
468
- t?.type === C.Infix && ":" === t.value ? (t.inputs?.[0]?.type === C.TableColumn && (o = t.inputs[0].value), t.inputs?.[1]?.type === C.TableColumn && (a = t.inputs[1].value)) : c(t);
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);
469
469
  }
470
470
  }
471
471
  return {
472
472
  tableId: t,
473
- spec: b(i, l, r, s),
473
+ spec: w(i, l, r, s),
474
474
  columnFromId: o,
475
475
  columnToId: a,
476
476
  isThisRow: u
@@ -483,19 +483,19 @@ function me(e) {
483
483
  });
484
484
  }
485
485
  function ye(e) {
486
- return y(e, (e) => {
487
- if (e.type !== C.TableReference) return;
486
+ return f(e, (e) => {
487
+ if (e.type !== T.TableReference) return;
488
488
  const t = e.inputs;
489
489
  if (!t) return;
490
- if (-1 === t.findIndex((e) => e.type === C.TableSpecifier && "#THIS ROW" === e.value.toUpperCase().trim())) return;
490
+ if (-1 === t.findIndex((e) => e.type === T.TableSpecifier && "#THIS ROW" === e.value.toUpperCase().trim())) return;
491
491
  const n = [];
492
- let r;
492
+ let i;
493
493
  for (const e of t) {
494
- if (e.type === C.TableSpecifier && "#THIS ROW" === e.value.toUpperCase().trim()) continue;
495
- e.type !== C.TableColumn && (e.type !== C.Infix || ":" !== e.value) || r ? n.push(e) : r = e;
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;
496
496
  }
497
- if (!r) return n.push({
498
- type: C.Prefix,
497
+ if (!i) return n.push({
498
+ type: T.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 i = r.image ?? r.value, l = i.startsWith("[") && i.endsWith("]") ? {
507
- ...r,
508
- image: i.slice(1, -1)
509
- } : r;
510
- return n.push(v("@", l, !0)), {
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)), {
511
511
  ...e,
512
512
  inputs: n
513
513
  };
514
514
  });
515
515
  }
516
516
  function Ie(e) {
517
- return y(e, (e) => {
518
- if (e.type !== C.TableReference) return;
517
+ return f(e, (e) => {
518
+ if (e.type !== T.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 y(e, (e) => {
529
- if (e.type !== C.TableReference || !e.inputs) return;
528
+ return f(e, (e) => {
529
+ if (e.type !== T.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 !== C.TableSpecifier) return 4;
539
+ if (e?.type !== T.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 y(e, (e) => {
550
- if (e.type !== C.TableReference) return;
549
+ return f(e, (e) => {
550
+ if (e.type !== T.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 y(e, (e) => {
568
- if (e.type !== C.Named || e.binding) return;
567
+ return f(e, (e) => {
568
+ if (e.type !== T.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 y(e, (e, r, i) => {
576
+ return f(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 === C.Named || l === C.Error || l === C.TableReference) return;
581
- if (pe(i, C.TableReference)) return;
580
+ if (l === T.Named || l === T.Error || l === T.TableReference) return;
581
+ if (pe(i, T.TableReference)) return;
582
582
  const s = function(e) {
583
583
  let t = e;
584
584
  for (; t;) {
@@ -591,66 +591,69 @@ 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 === C.Paren || i.isReference) {
594
+ if (i.type === T.Paren || i.isReference) {
595
595
  r = i;
596
596
  continue;
597
597
  }
598
- if (i.type !== C.Function) return !0;
598
+ if (i.type !== T.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;
602
- return "p" !== (s >= 0 ? Oe(l.getDeclaration().getParameters(), s) : null)?.getRangeType();
602
+ return "p" !== (s >= 0 ? Ve(l.getDeclaration().getParameters(), s) : null)?.getRangeType();
603
603
  }
604
604
  return !0;
605
605
  }(e, i, t) && (n === V.EmptyArray && (n = []), n.includes(s) || n.push(s));
606
606
  }), n.length > 1 && n.sort((e, t) => e - t), n;
607
607
  }
608
- var Ae = /* @__PURE__ */ new Set(["SUBTOTAL", "AGGREGATE"]);
609
- function Se(e, t) {
608
+ var Ae = /* @__PURE__ */ new Set(["SUBTOTAL", "AGGREGATE"]), Se = /* @__PURE__ */ new Set(["GETPIVOTDATA"]);
609
+ function we(e, t) {
610
+ return Ce(e, t, Ae);
611
+ }
612
+ function Ce(e, t, n) {
610
613
  if (!e || !t) return !1;
611
- let n = !1;
612
- return y(e, (e) => {
613
- if (n || e.type !== C.Function) return;
614
- const r = t(e.value)?.getName();
615
- r && Ae.has(r.toUpperCase()) && (n = !0);
616
- }), n;
614
+ let r = !1;
615
+ return f(e, (e) => {
616
+ if (r || e.type !== T.Function) return;
617
+ const i = t(e.value)?.getName();
618
+ i && n.has(i.toUpperCase()) && (r = !0);
619
+ }), r;
617
620
  }
618
- function we(e, t) {
621
+ function Ne(e, t) {
619
622
  if (!e || !t) return !1;
620
623
  let n = !1;
621
- return y(e, (e) => {
622
- n || e.type !== C.Function || "TABLE" === t(e.value)?.getName().toUpperCase() && (n = !0);
624
+ return f(e, (e) => {
625
+ n || e.type !== T.Function || "TABLE" === t(e.value)?.getName().toUpperCase() && (n = !0);
623
626
  }), n;
624
627
  }
625
- function Ce(e, t) {
628
+ function Fe(e, t) {
626
629
  if (!e || !t) return !1;
627
630
  let n = !1;
628
- return y(e, (e) => {
629
- n || e.type !== C.Function || !0 === t(e.value)?.getDeclaration().getReturnType()?.isVolatile() && (n = !0);
631
+ return f(e, (e) => {
632
+ n || e.type !== T.Function || !0 === t(e.value)?.getDeclaration().getReturnType()?.isVolatile() && (n = !0);
630
633
  }), n;
631
634
  }
632
- var Ne = Object.freeze({
635
+ var Pe = Object.freeze({
633
636
  value: !1,
634
637
  array: !1
635
- }), Fe = (e, t) => {
638
+ }), Le = (e, t) => {
636
639
  const n = function(e, t) {
637
- if (!e || !t) return Ne;
640
+ if (!e || !t) return Pe;
638
641
  let n = !1, r = !1;
639
- return y(e, (e) => {
642
+ return f(e, (e) => {
640
643
  if (n) return;
641
644
  const i = e.type;
642
- if (i === C.Named) return void (void 0 === e.binding && (n = !0));
643
- if (i === C.Prefix) return void ("@" === e.value && (n = !0));
644
- if (i === C.Call) return void (n = !0);
645
- if (i !== C.Function) return;
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;
646
649
  if (void 0 !== e.binder) return;
647
650
  const l = t(e.value);
648
651
  if (!l) return void (n = !0);
649
652
  if (r || !0 !== e.implicitIntersect) return;
650
653
  const s = l.getDeclaration().getParameters(), o = e.inputs;
651
654
  if (o) for (let e = 0; e < o.length; e++) {
652
- const n = Oe(s, e);
653
- if (null !== n && n.isValueOrRange() && Me(o[e], t)) return void (r = !0);
655
+ const n = Ve(s, e);
656
+ if (null !== n && n.isValueOrRange() && Ue(o[e], t)) return void (r = !0);
654
657
  }
655
658
  }), {
656
659
  value: !n && !r,
@@ -661,48 +664,48 @@ var Ne = Object.freeze({
661
664
  isBlankCacheable: n.value,
662
665
  isBlankCacheableArray: n.array
663
666
  };
664
- }, Pe = (e, t) => {
667
+ }, ke = (e, t) => {
665
668
  const n = e.length;
666
669
  if (0 === n) return null;
667
670
  if (t < n - 1) return e[t];
668
671
  const r = e[n - 1], i = r.getRepeatingTypes();
669
672
  return i && 0 !== i.length ? i[(t - (n - 1)) % i.length] : t < n ? e[t] : r.isRest() ? r : null;
670
673
  };
671
- function Le(e) {
674
+ function $e(e) {
672
675
  if (!e) return V.EmptyArray;
673
- let n = V.EmptyArray;
676
+ let t = V.EmptyArray;
674
677
  const r = (e) => {
675
- e && (n === V.EmptyArray && (n = []), n.includes(e) || n.push(e));
678
+ e && (t === V.EmptyArray && (t = []), t.includes(e) || t.push(e));
676
679
  }, i = (e) => {
677
- "string" == typeof e && r(t(e)?.bookId);
680
+ "string" == typeof e && r(n(e)?.bookId);
678
681
  };
679
- return y(e, (e) => {
680
- if (e.type === C.Named) {
682
+ return f(e, (e) => {
683
+ if (e.type === T.Named) {
681
684
  if (e.binding) return;
682
685
  const t = e.value;
683
686
  r(t.nameId), i(t.scope);
684
- } else if (e.type === C.TableReference) {
687
+ } else if (e.type === T.TableReference) {
685
688
  const t = e.value;
686
689
  r("string" == typeof t ? t : t?.tableId);
687
- } else if (e.type === C.Cell) {
690
+ } else if (e.type === T.Cell) {
688
691
  const t = e.value?.scope;
689
- i(t), f(t) && r(t);
690
- } else e.type === C.Error && i(e.value?.scope);
691
- }), n;
692
+ i(t), c(t) && r(t);
693
+ } else e.type === T.Error && i(e.value?.scope);
694
+ }), t;
692
695
  }
693
- var ke = (e, t) => {
696
+ var Oe = (e, t) => {
694
697
  if (!0 === e.lazyArg) return !0;
695
698
  if ("lambda" !== t?.binder?.kind) return !1;
696
699
  const n = t.inputs;
697
700
  return n[n.length - 1] === e;
698
- }, $e = /* @__PURE__ */ new Set([
701
+ }, Be = /* @__PURE__ */ new Set([
699
702
  "IF",
700
703
  "IFS",
701
704
  "SWITCH",
702
705
  "CHOOSE",
703
706
  "IFERROR",
704
707
  "IFNA"
705
- ]), Oe = (e, t) => {
708
+ ]), Ve = (e, t) => {
706
709
  const n = e.length;
707
710
  if (0 === n) return null;
708
711
  if (t < n) return e[t];
@@ -710,24 +713,24 @@ var ke = (e, t) => {
710
713
  if (!r.isRest()) return null;
711
714
  const i = r.getRepeatingTypes();
712
715
  return i && 0 !== i.length ? i[(t - (n - 1)) % i.length] : r;
713
- }, Be = (e) => null !== e.getScalarType() && null === e.getRangeType() && null === e.getLambda() && !e.isValueOrRange(), Ve = (e, t, n) => !(e.isRest() || !Be(e) || !Me(t, n)) && !(e.isNoLift() && ze(t, n)), ze = (e, t) => {
716
+ }, ze = (e) => null !== e.getScalarType() && null === e.getRangeType() && null === e.getLambda() && !e.isValueOrRange(), De = (e, t, n) => !(e.isRest() || !ze(e) || !Ue(t, n)) && !(e.isNoLift() && Me(t, n)), Me = (e, t) => {
714
717
  if (!e) return !1;
715
718
  const n = e.inputs;
716
719
  switch (e.type) {
717
- case C.Cell:
718
- case C.Named:
719
- case C.TableReference: return !0;
720
- case C.Infix:
721
- case C.Prefix:
722
- case C.Postfix: return !0 === e.isReference && "@" !== e.value;
723
- case C.Paren:
724
- case C.List: return !!n && 1 === n.length && ze(n[0], t);
725
- case C.Function: {
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: {
726
729
  if (void 0 !== e.binder) return !1;
727
730
  const r = String(e.value).toUpperCase();
728
- if ($e.has(r)) {
731
+ if (Be.has(r)) {
729
732
  if (!n) return !1;
730
- for (let e = 0; e < n.length; e++) if (ze(n[e], t)) return !0;
733
+ for (let e = 0; e < n.length; e++) if (Me(n[e], t)) return !0;
731
734
  return !1;
732
735
  }
733
736
  const i = t?.(e.value);
@@ -735,54 +738,54 @@ var ke = (e, t) => {
735
738
  }
736
739
  default: return !1;
737
740
  }
738
- }, De = (e, t) => {
741
+ }, We = (e, t) => {
739
742
  if (!e) return !1;
740
- for (let n = 0; n < e.length; n++) if (Me(e[n], t)) return !0;
743
+ for (let n = 0; n < e.length; n++) if (Ue(e[n], t)) return !0;
741
744
  return !1;
742
745
  };
743
- function Me(e, t) {
746
+ function Ue(e, t) {
744
747
  if (!e) return !1;
745
748
  if (void 0 !== e.arrayValued) return e.arrayValued;
746
749
  let n;
747
750
  const r = e.type, i = e.inputs;
748
751
  switch (r) {
749
- case C.Array:
752
+ case T.Array:
750
753
  n = !0;
751
754
  break;
752
- case C.Cell: {
755
+ case T.Cell: {
753
756
  const t = e.value;
754
757
  n = t.rowIndex === Number.MIN_SAFE_INTEGER || t.colIndex === Number.MIN_SAFE_INTEGER;
755
758
  break;
756
759
  }
757
- case C.Named:
758
- case C.Call:
759
- case C.TableReference:
760
+ case T.Named:
761
+ case T.Call:
762
+ case T.TableReference:
760
763
  n = !0;
761
764
  break;
762
- case C.Infix:
763
- case C.Prefix:
764
- case C.Postfix:
765
- n = e.isReference ? "@" !== e.value : De(i, t);
765
+ case T.Infix:
766
+ case T.Prefix:
767
+ case T.Postfix:
768
+ n = e.isReference ? "@" !== e.value : We(i, t);
766
769
  break;
767
- case C.Paren:
768
- case C.List:
769
- n = !i || 1 !== i.length || Me(i[0], t);
770
+ case T.Paren:
771
+ case T.List:
772
+ n = !i || 1 !== i.length || Ue(i[0], t);
770
773
  break;
771
- case C.Function: {
774
+ case T.Function: {
772
775
  const r = e.binder;
773
776
  if (void 0 !== r) {
774
- n = "lambda" === r.kind || !!i && Me(i[i.length - 1], t);
777
+ n = "lambda" === r.kind || !!i && Ue(i[i.length - 1], t);
775
778
  break;
776
779
  }
777
780
  const l = String(e.value).toUpperCase();
778
- if ($e.has(l)) {
779
- n = De(i, t);
781
+ if (Be.has(l)) {
782
+ n = We(i, t);
780
783
  break;
781
784
  }
782
785
  if ("INDEX" === l) {
783
786
  if (n = !1, i) for (let e = 1; e < i.length; e++) {
784
787
  const r = i[e];
785
- if (!r || r.type === C.Empty || r.isLiteral && 0 === r.value || Me(r, t)) {
788
+ if (!r || r.type === T.Empty || r.isLiteral && 0 === r.value || Ue(r, t)) {
786
789
  n = !0;
787
790
  break;
788
791
  }
@@ -802,7 +805,7 @@ function Me(e, t) {
802
805
  }
803
806
  return e.arrayValued = n, n;
804
807
  }
805
- function We(e, t) {
808
+ function _e(e, t) {
806
809
  if (void 0 !== e.firstCell) return;
807
810
  const n = (e, r) => {
808
811
  if (!e) return;
@@ -810,17 +813,17 @@ function We(e, t) {
810
813
  const i = e.inputs;
811
814
  if (!i) return;
812
815
  const l = e.type;
813
- if (l === C.Infix || l === C.Prefix || l === C.Postfix) {
816
+ if (l === T.Infix || l === T.Prefix || l === T.Postfix) {
814
817
  const t = r && !e.isReference;
815
818
  for (let e = 0; e < i.length; e++) n(i[e], t);
816
819
  return;
817
820
  }
818
- if (l === C.Paren || l === C.List) {
821
+ if (l === T.Paren || l === T.List) {
819
822
  const e = r && 1 === i.length;
820
823
  for (let t = 0; t < i.length; t++) n(i[t], e);
821
824
  return;
822
825
  }
823
- if (l === C.Function) {
826
+ if (l === T.Function) {
824
827
  const l = e.binder;
825
828
  if (void 0 !== l) {
826
829
  const e = i.length - 1;
@@ -829,8 +832,8 @@ function We(e, t) {
829
832
  }
830
833
  const s = r ? t?.(e.value)?.getDeclaration().getParameters() : null;
831
834
  for (let e = 0; e < i.length; e++) {
832
- const t = s ? Oe(s, e) : null;
833
- n(i[e], null !== t && (Be(t) || Ge(t)));
835
+ const t = s ? Ve(s, e) : null;
836
+ n(i[e], null !== t && (ze(t) || Xe(t)));
834
837
  }
835
838
  return;
836
839
  }
@@ -838,36 +841,36 @@ function We(e, t) {
838
841
  };
839
842
  n(e, !0);
840
843
  }
841
- var Ue = /* @__PURE__ */ new Set([
844
+ var je = /* @__PURE__ */ new Set([
842
845
  "=",
843
846
  "<>",
844
847
  "<",
845
848
  ">",
846
849
  "<=",
847
850
  ">="
848
- ]), _e = /* @__PURE__ */ new Set(["ROW", "COLUMN"]);
849
- function je(t, n) {
850
- if (!t || !n) return null;
851
- const r = (e) => n(e.value)?.getName().toUpperCase() ?? null;
852
- let i = !1;
853
- if (y(t, (e) => {
854
- (e.hasLazyArgs || e.type === C.Call || void 0 !== e.binder) && (i = !0);
855
- }), i) return null;
856
- const l = (e) => e.type === C.Number, s = (e) => e.type === C.Number || e.type === C.String || e.type === C.Boolean, o = (e) => {
851
+ ]), Ge = /* @__PURE__ */ new Set(["ROW", "COLUMN"]);
852
+ function He(e, t) {
853
+ if (!e || !t) return null;
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) => {
857
860
  if (!e) return !1;
858
861
  const t = e.inputs;
859
862
  switch (e.type) {
860
- case C.Paren: return 1 === t?.length && o(t[0]);
861
- case C.Prefix: return ("-" === e.value || "+" === e.value) && o(t?.[0]);
862
- case C.Infix: {
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
866
  if ("+" !== e.value && "-" !== e.value && "*" !== e.value) return !1;
864
867
  const [n, r] = t ?? [];
865
868
  return !(!n || !r) && (o(n) && (o(r) || l(r)) || l(n) && o(r));
866
869
  }
867
- case C.Function: {
868
- const n = r(e);
869
- if (null !== n && _e.has(n)) return !t || 0 === t.length || 1 === t.length && t[0]?.type === C.Cell;
870
- if ("MOD" === n && 2 === t?.length) {
870
+ case T.Function: {
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;
873
+ if ("MOD" === r && 2 === t?.length) {
871
874
  const e = t[1];
872
875
  return o(t[0]) && l(e) && 0 !== e.value;
873
876
  }
@@ -879,23 +882,23 @@ function je(t, n) {
879
882
  if (!e) return !1;
880
883
  const t = e.inputs;
881
884
  switch (e.type) {
882
- case C.Paren: return 1 === t?.length && a(t[0]);
883
- case C.Infix: {
884
- if (!Ue.has(e.value)) return !1;
885
+ case T.Paren: return 1 === t?.length && a(t[0]);
886
+ case T.Infix: {
887
+ if (!je.has(e.value)) return !1;
885
888
  const [n, r] = t ?? [];
886
889
  return !(!n || !r) && (o(n) && (o(r) || s(r)) || s(n) && o(r));
887
890
  }
888
- case C.Function: {
889
- const n = r(e);
891
+ case T.Function: {
892
+ const r = n(e);
890
893
  if (!t || 0 === t.length) return !1;
891
- if ("ISODD" === n || "ISEVEN" === n) return 1 === t.length && o(t[0]);
892
- if ("NOT" === n) return 1 === t.length && a(t[0]);
893
- if ("AND" === n || "OR" === n || "XOR" === n) {
894
+ if ("ISODD" === r || "ISEVEN" === r) return 1 === t.length && o(t[0]);
895
+ if ("NOT" === r) return 1 === t.length && a(t[0]);
896
+ if ("AND" === r || "OR" === r || "XOR" === r) {
894
897
  let e = !1;
895
898
  for (let n = 0; n < t.length; n++) {
896
899
  const r = t[n];
897
900
  if (!r) return !1;
898
- if (r.type !== C.Boolean) {
901
+ if (r.type !== T.Boolean) {
899
902
  if (!a(r)) return !1;
900
903
  e = !0;
901
904
  }
@@ -912,23 +915,23 @@ function je(t, n) {
912
915
  const t = e.inputs;
913
916
  if (t) for (let e = 0; e < t.length; e++) c(t[e]);
914
917
  };
915
- c(t);
916
- const f = u.length;
917
- if (0 === f || f > 4) return null;
918
- const p = [];
919
- for (let n = 0; n < 1 << f; n++) {
920
- const r = (t) => {
921
- const i = u.indexOf(t);
922
- if (-1 !== i) return e(n & 1 << i ? "TRUE" : "FALSE");
923
- const l = { ...t };
924
- return delete l.evalIndex, delete l.firstCell, delete l.inLazy, delete l.lazyArg, delete l.hasLazyArgs, delete l.deferred, t.inputs && (l.inputs = t.inputs.map((e) => e ? r(e) : e)), l;
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++) {
923
+ const n = (e) => {
924
+ const r = u.indexOf(e);
925
+ if (-1 !== r) return i(t & 1 << r ? "TRUE" : "FALSE");
926
+ const l = { ...e };
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;
925
928
  };
926
- p.push(r(t));
929
+ d.push(n(e));
927
930
  }
928
- return p;
931
+ return d;
929
932
  }
930
- var Ge = (e) => "*" === e.getRangeType() && null === e.getLambda() && e.getArrayDepth() <= (e.isRest() ? 1 : 0);
931
- function He(e, t, n, r = !1, i = null, l = null) {
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) {
932
935
  let s, o, a = n;
933
936
  a = me(a), r || (a = ye(a), a = Re(a), a = Ie(a), a = be(a)), [s, o] = function(e) {
934
937
  const t = /* @__PURE__ */ new Map();
@@ -945,66 +948,66 @@ function He(e, t, n, r = !1, i = null, l = null) {
945
948
  n && n.inputs && (e.inputs = n.inputs.map((e) => t.get(e) ?? e));
946
949
  }), [t.get(e), n];
947
950
  }(a);
948
- const u = w(o), f = [], d = [], g = new de();
949
- let v, h = !1;
951
+ const u = N(o), c = [], d = [], v = new de();
952
+ let m, y = !1;
950
953
  (function(e, t) {
951
954
  if (!e || !t) return;
952
955
  const n = (e) => {
953
956
  if (!e) return;
954
- e.inLazy = !0, e.type === C.Named && (e.deferredResolve = !0);
957
+ e.inLazy = !0, e.type === T.Named && (e.deferredResolve = !0);
955
958
  const t = e.inputs;
956
959
  if (t) for (let e = 0; e < t.length; e++) n(t[e]);
957
960
  };
958
- y(e, (e) => {
959
- if (e.type !== C.Function) return;
961
+ f(e, (e) => {
962
+ if (e.type !== T.Function) return;
960
963
  if (void 0 !== e.binder) return;
961
964
  const r = e.inputs;
962
965
  if (!r || 0 === r.length) return;
963
966
  const i = t(e.value)?.getDeclaration().getParameters();
964
967
  if (i) for (let t = 0; t < r.length; t++) {
965
968
  const l = r[t];
966
- l && l.type !== C.Empty && Pe(i, t)?.isLazy() && (l.lazyArg = !0, e.hasLazyArgs = !0, n(l));
969
+ l && l.type !== T.Empty && ke(i, t)?.isLazy() && (l.lazyArg = !0, e.hasLazyArgs = !0, n(l));
967
970
  }
968
971
  });
969
972
  })(s, l);
970
- const m = (e) => {
971
- void 0 === v && (v = /* @__PURE__ */ new Map());
972
- let t = v.get(e);
973
- return void 0 === t && v.set(e, t = []), t;
974
- }, I = (e, t) => {
975
- void 0 === e ? f.push(t) : m(e).push(t);
976
- }, b = (e) => {
977
- e?.type !== C.Infix || "+" !== e.value && "-" !== e.value || (e.snapsCancellation = !0);
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);
978
981
  };
979
- s = y(s, (t, n, r) => {
982
+ s = f(s, (t, n, r) => {
980
983
  const i = t.type, l = t.evalIndex;
981
- if (u[l] = null, i === C.TableColumn || i === C.TableSpecifier || t.isReference && pe(r, C.TableReference)) return;
982
- if (h = h || !Ye(t), t.binding?.declaration) return d[t.binding.slot] = -1, void (u[l] = void 0);
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);
983
986
  const s = ((e, t, n) => {
984
- if (ke(e, t)) return e;
985
- for (let e = n.length - 1; e >= 0; e--) if (ke(n[e], n[e - 1])) return n[e];
987
+ if (Oe(e, t)) return e;
988
+ for (let e = n.length - 1; e >= 0; e--) if (Oe(n[e], n[e - 1])) return n[e];
986
989
  })(t, n, r);
987
- s === t && m(t), void 0 !== s && i === C.Named && (t.deferredResolve = !0);
990
+ s === t && I(t), void 0 !== s && i === T.Named && (t.deferredResolve = !0);
988
991
  const o = t.binder;
989
992
  if (o && "let" === o.kind) {
990
993
  const e = t.inputs, n = e?.length ?? 0;
991
994
  let r = 0;
992
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);
993
996
  }
994
- if ((t.isReference || n && n.isReference) && (g.processNode(t, n), t.isReference)) {
995
- if (i === C.Named) return void (void 0 !== s && I(s, t));
996
- if (i === C.Cell || i === C.TableReference || i === C.Error) return;
997
- if (i === C.Infix || i === C.Prefix || i === C.Postfix || i === C.List) return void I(s, t);
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);
998
1001
  }
999
- if (t.isLiteral) if (i !== C.Array) u[l] = t.value;
1002
+ if (t.isLiteral) if (i !== T.Array) u[l] = t.value;
1000
1003
  else {
1001
- const n = t.value, r = n.length, i = w(r);
1004
+ const n = t.value, r = n.length, i = N(r);
1002
1005
  for (let e = 0; e < r; e++) {
1003
- const t = n[e].value, r = t.length, l = w(r);
1006
+ const t = n[e].value, r = t.length, l = N(r);
1004
1007
  for (let e = 0; e < r; e++) {
1005
1008
  const n = t[e];
1006
1009
  let r = null;
1007
- if (n && (r = n.type === C.Error ? p(n.value) : n.value, n.type === C.Prefix)) {
1010
+ if (n && (r = n.type === T.Error ? g(n.value) : n.value, n.type === T.Prefix)) {
1008
1011
  const e = n.value;
1009
1012
  r = n.inputs[0].value, "-" === e && (r = -r);
1010
1013
  }
@@ -1012,18 +1015,18 @@ function He(e, t, n, r = !1, i = null, l = null) {
1012
1015
  }
1013
1016
  i[e] = l;
1014
1017
  }
1015
- const s = A(i);
1016
- u[l] = new E(e, s.values, s.coords, void 0, s.isLiteral);
1018
+ const s = E(i);
1019
+ u[l] = new R(e, s.values, s.coords, void 0, s.isLiteral);
1017
1020
  }
1018
1021
  else {
1019
- if (i !== C.Empty) return "lambda" === t.binder?.kind && b(t.inputs[t.inputs.length - 1]), I(s, t), t;
1022
+ if (i !== T.Empty) return "lambda" === t.binder?.kind && x(t.inputs[t.inputs.length - 1]), b(s, t), t;
1020
1023
  u[l] = void 0;
1021
1024
  }
1022
- }), b(s), v?.forEach((e, t) => {
1025
+ }), x(s), m?.forEach((e, t) => {
1023
1026
  t.deferred = e;
1024
1027
  });
1025
- const x = w(g.cells.size);
1026
- g.cells.forEach((e, t) => {
1028
+ const A = N(v.cells.size);
1029
+ v.cells.forEach((e, t) => {
1027
1030
  const n = t.value, r = n.colIndex, i = n.rowIndex, l = n.$colIndex, s = n.$rowIndex, o = {
1028
1031
  colStart: r,
1029
1032
  rowStart: i,
@@ -1034,47 +1037,47 @@ function He(e, t, n, r = !1, i = null, l = null) {
1034
1037
  $colEnd: l,
1035
1038
  $rowEnd: s
1036
1039
  };
1037
- 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), x[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), A[e] = o;
1038
1041
  });
1039
- const R = x.length, T = w(R);
1040
- for (let e = 0; e < R; e++) T[e] = {
1042
+ const S = A.length, w = N(S);
1043
+ for (let e = 0; e < S; e++) w[e] = {
1041
1044
  colStart: 0,
1042
1045
  rowStart: 0,
1043
1046
  colEnd: 0,
1044
1047
  rowEnd: 0,
1045
1048
  scope: null
1046
1049
  };
1047
- const S = w(g.references.size);
1048
- g.references.forEach((e) => {
1049
- S[e.index] = e;
1050
+ const C = N(v.references.size);
1051
+ v.references.forEach((e) => {
1052
+ C[e.index] = e;
1050
1053
  });
1051
1054
  const F = [];
1052
- g.rootReferences.forEach((e) => {
1055
+ v.rootReferences.forEach((e) => {
1053
1056
  F.push(e.index);
1054
1057
  }), function(e, t, n = !1) {
1055
1058
  if (n) {
1056
1059
  const t = (e) => {
1057
1060
  if (!e) return;
1058
1061
  const n = e.type;
1059
- n !== C.Function && n !== C.Call || (e.implicitIntersect = !0);
1062
+ n !== T.Function && n !== T.Call || (e.implicitIntersect = !0);
1060
1063
  const r = e.inputs;
1061
1064
  if (r) for (let e = 0; e < r.length; e++) t(r[e]);
1062
1065
  };
1063
1066
  t(e);
1064
1067
  return;
1065
1068
  }
1066
- const r = (e) => Me(e, t), i = (e, n) => {
1069
+ const r = (e) => Ue(e, t), i = (e, n) => {
1067
1070
  if (!e) return;
1068
1071
  const l = e.type;
1069
- l !== C.Function && l !== C.Call || (e.implicitIntersect = n);
1072
+ l !== T.Function && l !== T.Call || (e.implicitIntersect = n);
1070
1073
  const s = e.inputs;
1071
1074
  if (s) {
1072
- if (l === C.Infix || l === C.Prefix || l === C.Postfix) {
1075
+ if (l === T.Infix || l === T.Prefix || l === T.Postfix) {
1073
1076
  const t = !e.isReference;
1074
1077
  for (let e = 0; e < s.length; e++) i(s[e], (!t || !r(s[e])) && n);
1075
1078
  return;
1076
1079
  }
1077
- if (l === C.Function) {
1080
+ if (l === T.Function) {
1078
1081
  const r = e.binder;
1079
1082
  if (void 0 !== r) {
1080
1083
  const e = "lambda" !== r.kind && n;
@@ -1086,8 +1089,8 @@ function He(e, t, n, r = !1, i = null, l = null) {
1086
1089
  if (l) for (let e = 0; e < s.length && !o; e++) {
1087
1090
  const n = s[e];
1088
1091
  if (!n) continue;
1089
- const r = Oe(l, e);
1090
- r && Ve(r, n, t) && (o = !0);
1092
+ const r = Ve(l, e);
1093
+ r && De(r, n, t) && (o = !0);
1091
1094
  }
1092
1095
  o && (e.implicitIntersect = !1);
1093
1096
  for (let e = 0; e < s.length; e++) i(s[e], !o && n);
@@ -1102,49 +1105,50 @@ function He(e, t, n, r = !1, i = null, l = null) {
1102
1105
  const t = e.length;
1103
1106
  for (let n = 0; n < t; n++) {
1104
1107
  const t = e[n], r = t.type;
1105
- if (r === C.Infix) {
1108
+ if (r === T.Infix) {
1106
1109
  if (!0 === t.snapsCancellation) {
1107
1110
  t.fn = ue[t.value];
1108
1111
  continue;
1109
1112
  }
1110
1113
  t.fn = ae[t.value];
1111
- } else if (r === C.Prefix) t.fn = ce[t.value];
1112
- else if (r === C.Postfix) t.fn = fe[t.value];
1114
+ } else if (r === T.Prefix) t.fn = ce[t.value];
1115
+ else if (r === T.Postfix) t.fn = fe[t.value];
1113
1116
  }
1114
1117
  };
1115
1118
  let k;
1116
- L(f), v?.forEach(L);
1117
- const $ = r ? c(P(e.getLocale()).decimal) : N, O = {
1119
+ L(c), m?.forEach(L);
1120
+ const $ = r ? h(P(e.getLocale()).decimal) : p, O = {
1118
1121
  runtime: e,
1119
1122
  symbols: t,
1120
1123
  getFunction: l,
1121
1124
  ast: s,
1122
1125
  evaluations: u,
1123
- executions: f,
1126
+ executions: c,
1124
1127
  bindings: d,
1125
- referencesAbsolute: T,
1126
- referencesExecute: S,
1127
- referencesRelative: x,
1128
+ referencesAbsolute: w,
1129
+ referencesExecute: C,
1130
+ referencesRelative: A,
1128
1131
  referencesRoot: F,
1129
- referenceIndices: g.referenceIndices,
1132
+ referenceIndices: v.referenceIndices,
1130
1133
  formatReferenceIndices: Te(s, l),
1131
1134
  getTokens: () => k ??= ge(s, r, $),
1132
1135
  namedIds: Ee(s),
1133
- symbolIds: Le(s),
1134
- hasTotals: Se(s, l),
1135
- hasDataTable: we(s, l),
1136
- hasVolatile: Ce(s, l),
1137
- ...Fe(s, l),
1138
- isReferenceOnly: !h,
1136
+ symbolIds: $e(s),
1137
+ hasTotals: we(s, l),
1138
+ hasPivotData: Ce(s, l, Se),
1139
+ hasDataTable: Ne(s, l),
1140
+ hasVolatile: Fe(s, l),
1141
+ ...Le(s, l),
1142
+ isReferenceOnly: !y,
1139
1143
  error: i,
1140
1144
  transform: (n) => {
1141
- let o = y(s, n);
1142
- return o === s ? O : He(e, t, o, r, i, l);
1145
+ let o = f(s, n);
1146
+ return o === s ? O : Ke(e, t, o, r, i, l);
1143
1147
  }
1144
1148
  };
1145
1149
  return O;
1146
1150
  }
1147
- function Xe(e) {
1151
+ function Ze(e) {
1148
1152
  let t = -1, n = -1;
1149
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 = {
1150
1154
  line: t,
@@ -1175,29 +1179,29 @@ Object.freeze([
1175
1179
  ">="
1176
1180
  ]
1177
1181
  ]);
1178
- var Ze = Object.freeze([
1182
+ var qe = Object.freeze([
1179
1183
  ":",
1180
1184
  ".:.",
1181
1185
  ".:",
1182
1186
  ":."
1183
- ]), Ke = Object.freeze([
1187
+ ]), Qe = Object.freeze([
1184
1188
  ":",
1185
1189
  " ",
1186
1190
  ".:.",
1187
1191
  ".:",
1188
1192
  ":."
1189
- ]), qe = Object.freeze(["@"]), Je = Object.freeze(["#"]), Qe = Object.freeze(Ke.concat(Je)), Ye = (Object.freeze(Ke.concat(qe).concat(Je)), (e) => {
1193
+ ]), Je = Object.freeze(["@"]), Ye = Object.freeze(["#"]), et = Object.freeze(Qe.concat(Ye)), tt = (Object.freeze(Qe.concat(Je).concat(Ye)), (e) => {
1190
1194
  if (!e) return !1;
1191
1195
  const t = e.type;
1192
- if (t === C.Cell) return !0;
1193
- if (t === C.TableReference) return !0;
1194
- if (t === C.Infix) {
1195
- if (!Ke.includes(e.value)) return !1;
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
1200
  const t = e.inputs, n = t[0], r = t[1];
1197
- return Ye(n) && Ye(r);
1201
+ return tt(n) && tt(r);
1198
1202
  }
1199
- return t === C.List && (e.inputs?.every(Ye) ?? !1);
1200
- }), et = (e) => !!e && (!(e.type !== C.Infix || !Qe.includes(e.value)) || !(e.type !== C.Postfix || !Je.includes(e.value)) || e.type === C.Array || e.type === C.TableReference), tt = Object.freeze([
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([
1201
1205
  "+",
1202
1206
  "-",
1203
1207
  "*",
@@ -1210,18 +1214,18 @@ var Ze = Object.freeze([
1210
1214
  "<",
1211
1215
  ">=",
1212
1216
  "<="
1213
- ]), nt = Object.freeze(["-", "+"]), rt = (e, t) => {
1217
+ ]), it = Object.freeze(["-", "+"]), lt = (e, t) => {
1214
1218
  if (!e) return !1;
1215
1219
  const n = e.type;
1216
- if (e.isLiteral) return n !== C.Error;
1217
- if (n === C.Paren || n === C.List) {
1220
+ if (e.isLiteral) return n !== T.Error;
1221
+ if (n === T.Paren || n === T.List) {
1218
1222
  const n = e.inputs;
1219
- return !(!n || 0 === n.length) && n.every((e) => rt(e, t));
1223
+ return !(!n || 0 === n.length) && n.every((e) => lt(e, t));
1220
1224
  }
1221
- if (n === C.Infix) return tt.includes(e.value);
1222
- if (n === C.Prefix) return nt.includes(e.value);
1223
- if (n === C.Postfix) return "%" === e.value;
1224
- if (n === C.Function) {
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
1229
  if (!t) return !1;
1226
1230
  const n = t(e.value);
1227
1231
  if (!n) return !1;
@@ -1229,37 +1233,37 @@ var Ze = Object.freeze([
1229
1233
  return "p" !== i && (null !== i || null === r.getLambda() && null != r.getScalarType());
1230
1234
  }
1231
1235
  return !1;
1232
- }, it = (e, t) => {
1236
+ }, st = (e, t) => {
1233
1237
  if (!e) return null;
1234
1238
  let n = null;
1235
1239
  const r = (e) => {
1236
1240
  if (n || !e) return;
1237
- if (e.type === C.Infix && " " === e.value) {
1241
+ if (e.type === T.Infix && " " === e.value) {
1238
1242
  const r = e.inputs, i = r?.[0], l = r?.[1];
1239
- if (rt(i, t)) return void (n = i);
1240
- if (rt(l, t)) return void (n = l);
1243
+ if (lt(i, t)) return void (n = i);
1244
+ if (lt(l, t)) return void (n = l);
1241
1245
  }
1242
1246
  const i = e.inputs;
1243
1247
  if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1244
1248
  };
1245
1249
  return r(e), n;
1246
- }, lt = (e, t) => {
1250
+ }, ot = (e, t) => {
1247
1251
  if (!e) return null;
1248
1252
  let n = null;
1249
1253
  const r = (e) => {
1250
1254
  if (n || !e) return;
1251
- if (e.type === C.Postfix && "#" === e.value) {
1255
+ if (e.type === T.Postfix && "#" === e.value) {
1252
1256
  const r = e.inputs?.[0];
1253
- if (r && rt(r, t)) return void (n = r);
1257
+ if (r && lt(r, t)) return void (n = r);
1254
1258
  }
1255
1259
  const i = e.inputs;
1256
1260
  if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1257
1261
  };
1258
1262
  return r(e), n;
1259
- }, st = (e) => {
1263
+ }, at = (e) => {
1260
1264
  for (let t = 0; t < e.length; t++) if (e[t].getRepeatingTypes()) return t;
1261
1265
  return -1;
1262
- }, ot = (e, t, n) => {
1266
+ }, ut = (e, t, n) => {
1263
1267
  const r = e[t].getRepeatingTypes(), i = r.length, l = t, s = e.length - t - 1;
1264
1268
  let o = s;
1265
1269
  for (; o > 0 && e[t + o].isOptional();) o--;
@@ -1284,12 +1288,12 @@ var Ze = Object.freeze([
1284
1288
  };
1285
1289
  }
1286
1290
  return null;
1287
- }, at = (e) => {
1291
+ }, ct = (e) => {
1288
1292
  if (!e) return null;
1289
1293
  let t = null;
1290
1294
  const n = (e) => {
1291
1295
  if (t || !e) return;
1292
- if (e.type === C.Array && Array.isArray(e.value)) {
1296
+ if (e.type === T.Array && Array.isArray(e.value)) {
1293
1297
  const n = e.value, r = (n[0]?.value)?.length ?? 0;
1294
1298
  for (let e = 1; e < n.length && !t; e++) {
1295
1299
  const i = (n[e]?.value)?.length ?? 0;
@@ -1300,19 +1304,19 @@ var Ze = Object.freeze([
1300
1304
  if (r) for (let e = 0; e < r.length && !t; e++) n(r[e]);
1301
1305
  };
1302
1306
  return n(e), t;
1303
- }, ut = (e, t) => {
1307
+ }, ft = (e, t) => {
1304
1308
  if (!e || !t) return null;
1305
1309
  let n = null;
1306
1310
  const r = (e) => {
1307
1311
  if (n || !e) return;
1308
- if (e.type === C.Function) {
1312
+ if (e.type === T.Function) {
1309
1313
  const r = e.value, i = t(r);
1310
1314
  if (i) {
1311
1315
  const t = i.getDeclaration(), l = t.getParameters(), s = e.inputs?.length ?? 0, o = t.getMaxArguments();
1312
1316
  if (s > o) return void (n = `Too many arguments for ${r}. The most it accepts is ${o}, but got ${s}.`);
1313
- const a = l.length > 0 ? st(l) : -1, u = l.length > 0 && l[l.length - 1].isRest();
1317
+ const a = l.length > 0 ? at(l) : -1, u = l.length > 0 && l[l.length - 1].isRest();
1314
1318
  if (a >= 0) {
1315
- if (!ot(l, a, s)) {
1319
+ if (!ut(l, a, s)) {
1316
1320
  const e = l[a].getRepeatingTypes().length, t = l.length - 1;
1317
1321
  n = 1 === e ? `Too few arguments for ${r}. Expected at least ${t + 1}, but got ${s}.` : `Wrong number of arguments for ${r}. Expected ${t} plus a multiple of ${e}, but got ${s}.`;
1318
1322
  }
@@ -1327,24 +1331,24 @@ var Ze = Object.freeze([
1327
1331
  if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1328
1332
  };
1329
1333
  return r(e), n;
1330
- }, ct = (e, t) => {
1334
+ }, pt = (e, t) => {
1331
1335
  if (!e || !t) return null;
1332
1336
  let n = null;
1333
1337
  const r = (e) => {
1334
1338
  if (n || !e) return;
1335
- if (e.type === C.Function) {
1339
+ if (e.type === T.Function) {
1336
1340
  const r = t(e.value);
1337
1341
  if (r) {
1338
1342
  const i = r.getDeclaration().getParameters(), l = e.inputs;
1339
1343
  if (i.length > 0 && l) {
1340
1344
  const e = ((e, t) => {
1341
- const n = new Array(t), r = e.length, i = r > 0 ? st(e) : -1;
1345
+ const n = new Array(t), r = e.length, i = r > 0 ? at(e) : -1;
1342
1346
  if (i < 0) {
1343
1347
  const i = r > 0 ? e[r - 1] : null, l = !!i && i.isRest();
1344
1348
  for (let s = 0; s < t; s++) n[s] = s < r ? e[s] : l ? i : null;
1345
1349
  return n;
1346
1350
  }
1347
- const l = e[i].getRepeatingTypes(), s = l.length, o = i, a = ot(e, i, t), u = a ? a.suffix : r - i - 1, c = Math.max(0, t - o - u);
1351
+ const l = e[i].getRepeatingTypes(), s = l.length, o = i, a = ut(e, i, t), u = a ? a.suffix : r - i - 1, c = Math.max(0, t - o - u);
1348
1352
  for (let a = 0; a < t; a++) if (a < o) n[a] = e[a];
1349
1353
  else if (a < o + c) n[a] = l[(a - o) % s];
1350
1354
  else {
@@ -1355,7 +1359,7 @@ var Ze = Object.freeze([
1355
1359
  })(i, l.length);
1356
1360
  for (let r = 0; r < l.length && !n; r++) {
1357
1361
  const i = e[r];
1358
- i && "p" === i.getRangeType() && rt(l[r], t) && (n = l[r]);
1362
+ i && "p" === i.getRangeType() && lt(l[r], t) && (n = l[r]);
1359
1363
  }
1360
1364
  }
1361
1365
  }
@@ -1364,42 +1368,42 @@ var Ze = Object.freeze([
1364
1368
  if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1365
1369
  };
1366
1370
  return r(e), n;
1367
- }, ft = (e, t) => {
1371
+ }, dt = (e, t) => {
1368
1372
  if (!e) return null;
1369
1373
  let n = null;
1370
1374
  const r = (e) => {
1371
1375
  if (n || !e) return;
1372
- if (e.type === C.Call) {
1376
+ if (e.type === T.Call) {
1373
1377
  const r = e.inputs?.[0];
1374
- if (r && rt(r, t)) return void (n = "This expression always produces a value, so it cannot be called as a function.");
1378
+ if (r && lt(r, t)) return void (n = "This expression always produces a value, so it cannot be called as a function.");
1375
1379
  }
1376
1380
  const i = e.inputs;
1377
1381
  if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1378
1382
  };
1379
1383
  return r(e), n;
1380
- }, pt = (e, t) => {
1381
- if (e.type !== C.Function) return;
1384
+ }, gt = (e, t) => {
1385
+ if (e.type !== T.Function) return;
1382
1386
  const n = e.value;
1383
1387
  if ("string" != typeof n) return;
1384
1388
  const r = (t?.(n)?.getName() ?? n).toUpperCase();
1385
1389
  return "LET" === r ? "let" : "LAMBDA" === r ? "lambda" : void 0;
1386
- }, dt = (e) => {
1387
- if (e?.type !== C.Named) return;
1390
+ }, vt = (e) => {
1391
+ if (e?.type !== T.Named) return;
1388
1392
  const t = e.value;
1389
1393
  return t?.nameId && !t.scope && !0 !== t.optional ? t.nameId : void 0;
1390
- }, gt = /^[A-Za-z_\\][A-Za-z0-9_\\]*$/, vt = /* @__PURE__ */ new Set(["TRUE", "FALSE"]), ht = (e) => {
1391
- if (e?.type === C.Named) {
1394
+ }, ht = /^[A-Za-z_\\][A-Za-z0-9_\\]*$/, mt = /* @__PURE__ */ new Set(["TRUE", "FALSE"]), yt = (e) => {
1395
+ if (e?.type === T.Named) {
1392
1396
  const t = e.value;
1393
1397
  if (!0 !== t?.optional || !t.nameId || t.scope) return;
1394
1398
  return t.nameId;
1395
1399
  }
1396
- if (e?.type !== C.TableReference) return;
1400
+ if (e?.type !== T.TableReference) return;
1397
1401
  const t = e.value;
1398
1402
  let n;
1399
1403
  if (null === t || "string" == typeof t) {
1400
1404
  if (t) return;
1401
1405
  const r = e.inputs;
1402
- if (!r || 1 !== r.length || r[0]?.type !== C.TableColumn) return;
1406
+ if (!r || 1 !== r.length || r[0]?.type !== T.TableColumn) return;
1403
1407
  const i = r[0].value;
1404
1408
  if ("string" != typeof i) return;
1405
1409
  n = i;
@@ -1409,29 +1413,29 @@ var Ze = Object.freeze([
1409
1413
  if (!e.columnFromId || e.columnFromId !== e.columnToId) return;
1410
1414
  n = e.columnFromId;
1411
1415
  }
1412
- return gt.test(n) && !vt.has(n.toUpperCase()) && e.image === `[${n}]` ? n : void 0;
1413
- }, mt = (e) => {
1414
- const t = o(e.image ?? e.value);
1416
+ return ht.test(n) && !mt.has(n.toUpperCase()) && e.image === `[${n}]` ? n : void 0;
1417
+ }, It = (e) => {
1418
+ const t = a(e.image ?? e.value);
1415
1419
  t.image = e.image ?? e.value, t.wsBefore = e.wsBefore;
1416
1420
  const n = {
1417
- type: C.Call,
1421
+ type: T.Call,
1418
1422
  value: null,
1419
1423
  inputs: [t, ...e.inputs ?? []],
1420
1424
  wsAfter: e.wsAfter
1421
1425
  };
1422
1426
  return e.error && (n.error = e.error), n;
1423
1427
  };
1424
- function yt(e, t) {
1425
- return e && t ? y(e, (e) => {
1426
- if (e.type === C.Function && "string" == typeof e.value && !t(e.value)) return mt(e);
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);
1427
1431
  }) : e;
1428
1432
  }
1429
- function It(e, t) {
1433
+ function xt(e, t) {
1430
1434
  const n = t.name.toUpperCase(), r = e ? e.filter((e) => e.name.toUpperCase() !== n) : [];
1431
1435
  return r.push(t), r;
1432
1436
  }
1433
- function bt(e) {
1434
- if (e?.type !== C.Function || "lambda" !== e.binder?.kind) return;
1437
+ function Rt(e) {
1438
+ if (e?.type !== T.Function || "lambda" !== e.binder?.kind) return;
1435
1439
  const t = e.inputs ?? [], n = [];
1436
1440
  for (let e = 0; e < t.length - 1; e++) {
1437
1441
  const r = t[e];
@@ -1444,19 +1448,19 @@ function bt(e) {
1444
1448
  }
1445
1449
  return n;
1446
1450
  }
1447
- var xt = /* @__PURE__ */ new Set([
1451
+ var Et = /* @__PURE__ */ new Set([
1448
1452
  "IF",
1449
1453
  "IFERROR",
1450
1454
  "IFNA"
1451
1455
  ]);
1452
- function Rt(e, t) {
1453
- if (!e || e.type !== C.Function || "string" != typeof e.value) return e;
1456
+ function Tt(e, t) {
1457
+ if (!e || e.type !== T.Function || "string" != typeof e.value) return e;
1454
1458
  const n = (t?.(e.value)?.getName() ?? e.value).toUpperCase();
1455
- if (!xt.has(n)) return e;
1459
+ if (!Et.has(n)) return e;
1456
1460
  const r = e.inputs;
1457
1461
  let i;
1458
1462
  if (r) for (let e = 0; e < r.length; e++) {
1459
- const n = Rt(r[e], t);
1463
+ const n = Tt(r[e], t);
1460
1464
  n !== r[e] && ((i ??= [...r])[e] = n);
1461
1465
  }
1462
1466
  return {
@@ -1465,7 +1469,7 @@ function Rt(e, t) {
1465
1469
  passOmitted: !0
1466
1470
  };
1467
1471
  }
1468
- function Et(e, t = null) {
1472
+ function At(e, t = null) {
1469
1473
  if (!e) return e;
1470
1474
  const n = [];
1471
1475
  let r = 0;
@@ -1485,15 +1489,15 @@ function Et(e, t = null) {
1485
1489
  } : e;
1486
1490
  }, l = (e) => {
1487
1491
  if (!e) return e;
1488
- const s = pt(e, t);
1492
+ const s = gt(e, t);
1489
1493
  if (s) return ((e, s) => {
1490
1494
  const o = e.inputs, a = o?.length ?? 0;
1491
1495
  if (!o || a < 1) return i(e);
1492
1496
  const u = n.length, c = [], f = [...o], p = (e, t = !1) => {
1493
1497
  const i = f[e];
1494
- let l = dt(i), s = !1;
1498
+ let l = vt(i), s = !1;
1495
1499
  if (void 0 === l && t) {
1496
- if (l = ht(i), void 0 === l) return;
1500
+ if (l = yt(i), void 0 === l) return;
1497
1501
  s = !0;
1498
1502
  } else if (void 0 === l) return;
1499
1503
  const o = r++;
@@ -1503,7 +1507,7 @@ function Et(e, t = null) {
1503
1507
  name: l
1504
1508
  }), c.push(o), f[e] = s ? {
1505
1509
  ...i,
1506
- type: C.Named,
1510
+ type: T.Named,
1507
1511
  value: {
1508
1512
  nameId: l,
1509
1513
  scope: null
@@ -1528,7 +1532,7 @@ function Et(e, t = null) {
1528
1532
  for (let e = 0; e < a - 1; e++) p(e, !0);
1529
1533
  f[a - 1] && (f[a - 1] = l(f[a - 1]));
1530
1534
  } else {
1531
- for (let e = 0; e + 1 < a; e += 2) f[e + 1] && (f[e + 1] = Rt(l(f[e + 1]), t)), p(e);
1535
+ for (let e = 0; e + 1 < a; e += 2) f[e + 1] && (f[e + 1] = Tt(l(f[e + 1]), t)), p(e);
1532
1536
  a % 2 == 1 && f[a - 1] && (f[a - 1] = l(f[a - 1]));
1533
1537
  }
1534
1538
  for (; n.length > u;) n.pop();
@@ -1541,22 +1545,22 @@ function Et(e, t = null) {
1541
1545
  }
1542
1546
  };
1543
1547
  })(e, s);
1544
- if (e.type === C.Function && "string" == typeof e.value) {
1548
+ if (e.type === T.Function && "string" == typeof e.value) {
1545
1549
  const r = e.value.toUpperCase();
1546
- if (n.some((e) => e.key === r) && !t?.(e.value)) return i(mt(e));
1550
+ if (n.some((e) => e.key === r) && !t?.(e.value)) return i(It(e));
1547
1551
  }
1548
1552
  if (n.length > 0 && e.isReference && ":" === e.value && 2 === e.inputs?.length) {
1549
1553
  const [t, r] = e.inputs;
1550
- if (Tt(t) && Tt(r)) {
1554
+ if (St(t) && St(r)) {
1551
1555
  const l = t.image.toUpperCase(), s = r.image.toUpperCase();
1552
1556
  if (n.some((e) => e.key === l || e.key === s)) return i({
1553
1557
  ...e,
1554
- inputs: [At(t), At(r)]
1558
+ inputs: [wt(t), wt(r)]
1555
1559
  });
1556
1560
  }
1557
1561
  }
1558
- if (e.type === C.Named) {
1559
- const t = dt(e);
1562
+ if (e.type === T.Named) {
1563
+ const t = vt(e);
1560
1564
  if (void 0 !== t) {
1561
1565
  const r = t.toUpperCase();
1562
1566
  for (let i = n.length - 1; i >= 0; i--) {
@@ -1575,7 +1579,7 @@ function Et(e, t = null) {
1575
1579
  return e;
1576
1580
  }
1577
1581
  const o = i(e);
1578
- if (o.type === C.Function && "string" == typeof o.value && "ISOMITTED" === (t?.(o.value)?.getName() ?? o.value).toUpperCase()) {
1582
+ if (o.type === T.Function && "string" == typeof o.value && "ISOMITTED" === (t?.(o.value)?.getName() ?? o.value).toUpperCase()) {
1579
1583
  const e = o.inputs;
1580
1584
  if (e) {
1581
1585
  let n;
@@ -1588,7 +1592,7 @@ function Et(e, t = null) {
1588
1592
  };
1589
1593
  continue;
1590
1594
  }
1591
- const l = Rt(i, t);
1595
+ const l = Tt(i, t);
1592
1596
  l !== i && ((n ??= [...e])[r] = l);
1593
1597
  }
1594
1598
  if (n) return {
@@ -1601,54 +1605,54 @@ function Et(e, t = null) {
1601
1605
  };
1602
1606
  return l(e);
1603
1607
  }
1604
- var Tt = (e) => {
1605
- if (e?.type !== C.Cell || void 0 === e.image) return !1;
1608
+ var St = (e) => {
1609
+ if (e?.type !== T.Cell || void 0 === e.image) return !1;
1606
1610
  const t = e.value;
1607
1611
  return t.rowIndex === Number.MIN_SAFE_INTEGER && !0 !== t.$colIndex && !t.scope;
1608
- }, At = (e) => {
1609
- const t = o(e.image);
1610
- return F(t, e), t;
1611
- }, St = (e) => e?.type === C.Cell, wt = (e, t = null) => {
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) => {
1612
1616
  if (!e) return e;
1613
1617
  let n = !1;
1614
1618
  const r = (e) => {
1615
1619
  if (n || !e) return;
1616
- const i = pt(e, t), l = e.inputs;
1620
+ const i = gt(e, t), l = e.inputs;
1617
1621
  if (i && l) {
1618
1622
  const e = "let" === i ? 2 : 1;
1619
- for (let t = 0; t < l.length - 1; t += e) if (St(l[t])) return void (n = !0);
1623
+ for (let t = 0; t < l.length - 1; t += e) if (Ct(l[t])) return void (n = !0);
1620
1624
  }
1621
1625
  if (l) for (let e = 0; e < l.length && !n; e++) r(l[e]);
1622
1626
  };
1623
1627
  if (r(e), !n) return e;
1624
1628
  let i = null;
1625
- const l = y(e, (e) => {
1626
- if (e?.type !== C.Cell) return;
1629
+ const l = f(e, (e) => {
1630
+ if (e?.type !== T.Cell) return;
1627
1631
  const t = e.value, n = e.image;
1628
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 '$'.`);
1629
1633
  if (void 0 === n) return;
1630
- const r = o(n);
1631
- F(r, e);
1634
+ const r = a(n);
1635
+ I(r, e);
1632
1636
  const l = t?.scope;
1633
1637
  return l && (r.value.scope = l, r.value.scopeImage = t.scopeImage), r;
1634
1638
  });
1635
1639
  return i ?? l;
1636
- }, Ct = (e, t) => {
1640
+ }, Ft = (e, t) => {
1637
1641
  if (!e) return null;
1638
1642
  let n = null;
1639
1643
  const r = (e) => {
1640
1644
  if (n || !e) return;
1641
- const i = pt(e, t);
1645
+ const i = gt(e, t);
1642
1646
  i && ((e, t) => {
1643
1647
  const r = "let" === t ? "LET" : "LAMBDA", i = e.inputs, l = i?.length ?? 0;
1644
1648
  if (!i || l < 2) return;
1645
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}.`);
1646
- if ("lambda" === t && i[l - 1]?.type === C.Empty) return void (n = "LAMBDA has no calculation: the last argument is empty.");
1650
+ if ("lambda" === t && i[l - 1]?.type === T.Empty) return void (n = "LAMBDA has no calculation: the last argument is empty.");
1647
1651
  const s = /* @__PURE__ */ new Set(), o = "let" === t ? 2 : 1;
1648
1652
  let a = !1;
1649
1653
  for (let e = 0; e < l - 1; e += o) {
1650
- let l = dt(i[e]);
1651
- if (void 0 === l && "lambda" === t) l = ht(i[e]), void 0 !== l && (a = !0);
1654
+ let l = vt(i[e]);
1655
+ if (void 0 === l && "lambda" === t) l = yt(i[e]), void 0 !== l && (a = !0);
1652
1656
  else if (void 0 !== l && a) return void (n = `Required name '${l}' cannot follow an optional name in ${r}.`);
1653
1657
  if (void 0 === l) return void (n = `Expected a name in ${r} argument ${e + 1}; a name cannot be the output of a formula.`);
1654
1658
  if (l.includes(".")) return void (n = `Expected a name in ${r} argument ${e + 1}; a name cannot contain '.'.`);
@@ -1662,109 +1666,109 @@ var Tt = (e) => {
1662
1666
  };
1663
1667
  return r(e), n;
1664
1668
  };
1665
- function Nt(e, t, n, r, i) {
1669
+ function Pt(e, t, n, r, i) {
1666
1670
  const l = r;
1667
- let o;
1668
- const a = () => (void 0 === o && (o = i && n ? t.bind(x.Table, "", { at: {
1671
+ let s;
1672
+ const a = () => (void 0 === s && (s = i && n ? t.bind(b.Table, "", { at: {
1669
1673
  scope: n,
1670
1674
  rowIndex: i.rowIndex,
1671
1675
  colIndex: i.colIndex
1672
- } }) : null), o);
1673
- return y(e, (e, r, i = []) => {
1674
- let o;
1676
+ } }) : null), s);
1677
+ return f(e, (e, r, i = []) => {
1678
+ let s;
1675
1679
  const u = e.type;
1676
- if (u === C.Cell) {
1680
+ if (u === T.Cell) {
1677
1681
  const n = e.value;
1678
1682
  if (n?.scope) {
1679
- const r = t.bind(x.Sheet, n.scope, l);
1680
- null !== r && (o || (o = { ...e }), o.value = {
1683
+ const r = t.bind(b.Sheet, n.scope, l);
1684
+ null !== r && (s || (s = { ...e }), s.value = {
1681
1685
  ...n,
1682
1686
  scope: r
1683
1687
  });
1684
1688
  }
1685
- } else if (u === C.Named) {
1689
+ } else if (u === T.Named) {
1686
1690
  const r = e.value;
1687
1691
  if (r && !e.binding) {
1688
1692
  const i = function(e, t, n, r) {
1689
1693
  if (t.scope) {
1690
- const e = n.bind(x.Sheet, t.scope, r);
1691
- if (null === e || s(e)) return;
1694
+ const e = n.bind(b.Sheet, t.scope, r);
1695
+ if (null === e || o(e)) return;
1692
1696
  }
1693
- const i = n.bind(x.Table, t.nameId, { existing: !0 });
1697
+ const i = n.bind(b.Table, t.nameId, { existing: !0 });
1694
1698
  if (null === i) return;
1695
1699
  const l = {
1696
- type: C.TableReference,
1700
+ type: T.TableReference,
1697
1701
  value: i,
1698
1702
  inputs: null,
1699
1703
  isReference: !0
1700
1704
  };
1701
- F(l, e);
1702
- const o = t.scopeImage;
1703
- return "string" == typeof o && void 0 !== e.image && (l.image = o + e.image), l;
1705
+ I(l, e);
1706
+ const s = t.scopeImage;
1707
+ return "string" == typeof s && void 0 !== e.image && (l.image = s + e.image), l;
1704
1708
  }(e, r, t, l);
1705
1709
  if (i) return i;
1706
- const a = r.scope ? t.bind(x.Sheet, r.scope, l) : null, u = (null !== a ? s(a) ? a : t.resolve(x.Sheet, a)?.toString() ?? r.scope : r.scope) ?? n, c = t.bind(x.NamedFormula, r.nameId, u ? { scope: u } : void 0);
1707
- null === c && null === a || (o || (o = { ...e }), o.value = {
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 = {
1708
1712
  ...r,
1709
1713
  nameId: c ?? r.nameId,
1710
1714
  ...null !== a ? { scope: a } : void 0
1711
1715
  });
1712
1716
  }
1713
- } else if (u === C.Error) {
1717
+ } else if (u === T.Error) {
1714
1718
  const n = e.value;
1715
1719
  if (n?.scope) {
1716
- const r = t.bind(x.Sheet, n.scope, l);
1717
- null !== r && (o || (o = { ...e }), o.value = {
1720
+ const r = t.bind(b.Sheet, n.scope, l);
1721
+ null !== r && (s || (s = { ...e }), s.value = {
1718
1722
  ...n,
1719
1723
  scope: r
1720
1724
  });
1721
1725
  }
1722
- } else if (u === C.TableReference) {
1726
+ } else if (u === T.TableReference) {
1723
1727
  const n = e.value;
1724
1728
  if (n) {
1725
- const r = t.bind(x.Table, n);
1726
- o || (o = { ...e }), null !== r && (o.value = r);
1729
+ const r = t.bind(b.Table, n);
1730
+ s || (s = { ...e }), null !== r && (s.value = r);
1727
1731
  } else if ("string" == typeof n) {
1728
1732
  const n = a();
1729
- if (null !== n && Ft(e, t)) return {
1733
+ if (null !== n && Lt(e, t)) return {
1730
1734
  ...e,
1731
1735
  value: n
1732
1736
  };
1733
1737
  }
1734
- } else if (u === C.TableColumn) {
1738
+ } else if (u === T.TableColumn) {
1735
1739
  const n = e.value;
1736
1740
  if (n) {
1737
- const r = pe(i, C.TableReference), l = r?.value || (r ? a() ?? void 0 : void 0), s = t.bind(x.TableColumn, n, l ? { tableName: l } : void 0);
1738
- o || (o = { ...e }), null !== s && (o.value = s);
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);
1739
1743
  }
1740
- } else if (u === C.Function) {
1744
+ } else if (u === T.Function) {
1741
1745
  const n = e.value;
1742
1746
  if (n) {
1743
- const r = t.bind(x.Function, n);
1744
- o || (o = { ...e }), null !== r && (o.value = r);
1747
+ const r = t.bind(b.Function, n);
1748
+ s || (s = { ...e }), null !== r && (s.value = r);
1745
1749
  }
1746
1750
  }
1747
- return o;
1751
+ return s;
1748
1752
  });
1749
1753
  }
1750
- function Ft(e, t) {
1754
+ function Lt(e, t) {
1751
1755
  let n = !0;
1752
1756
  const r = e.inputs;
1753
1757
  if (!r) return !0;
1754
- for (let e = 0; e < r.length && n; e++) y(r[e], (e) => {
1755
- e.type === C.TableColumn && null === t.resolve(x.TableColumn, e.value) && (n = !1);
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);
1756
1760
  });
1757
1761
  return n;
1758
1762
  }
1759
- function Pt(e, t) {
1763
+ function kt(e, t) {
1760
1764
  let n = null;
1761
- return y(e, (e) => {
1762
- if (n || e.type !== C.TableReference) return;
1765
+ return f(e, (e) => {
1766
+ if (n || e.type !== T.TableReference) return;
1763
1767
  if ("" === e.value) return void (n = "A structured reference without a table name must be in a table that has its columns.");
1764
1768
  const r = e.value;
1765
1769
  if (!t || "string" != typeof r) return;
1766
- const i = t.resolve(x.Table, r)?.toString() ?? r;
1767
- null === t.bind(x.Table, i, { existing: !0 }) ? n = `There is no table named '${i}'.` : Ft(e, t) || (n = "The table has no such column.");
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.");
1768
1772
  }), n;
1769
1773
  }
1770
- export { ce as A, Re as C, ve as D, yt as E, ae as O, Ze as S, ye as T, et as _, He as a, je as b, ft as c, it as d, Pt as f, he as g, ge as h, Ie as i, ue as j, fe as k, at as l, Xe as m, It as n, ut as o, ct as p, Et as r, Ct as s, We as t, lt as u, Nt as v, wt 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, 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 };