@sheetxl/sdk 0.8.0-beta.10 → 0.8.0-beta.12

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 (522) hide show
  1. package/README.md +1 -1
  2. package/browser/esm/{CYyv6uGjo10ig5FP.mjs → -Jx-jNHmtIQQfLvK.mjs} +1 -1
  3. package/browser/esm/{CdLZWVcH8cncBUPJ.mjs → 2WuhYrIpYmOR5H73.mjs} +110 -261
  4. package/browser/esm/{Cqr3knDsBvoVZ6MN.mjs → 2mIwPy2D2JUX-9wx.mjs} +2 -2
  5. package/browser/esm/B3wf5vZCsWfWsDbj.mjs +12 -0
  6. package/browser/esm/{BzLfNyc6OOShIErH.mjs → BIHrHjRGWVlJglcp.mjs} +2 -2
  7. package/browser/esm/{C9B0djuUarfNdoj0.mjs → BTFBedJMRWGvZyCE.mjs} +1 -1
  8. package/browser/esm/{Btg43M1Bf-ENDreu.mjs → BdCJNawfifyPupCP.mjs} +1 -1
  9. package/browser/esm/{ClB5ix51roQOpZEr.mjs → Bg5Di9GLNAkbqQ1P.mjs} +2877 -2067
  10. package/browser/esm/BnC4-27Igwb8oDf2.mjs +1552 -0
  11. package/browser/esm/{DhKkrCVASZ6Isvz6.mjs → Bt8_m94tBdks209L.mjs} +1 -1
  12. package/browser/esm/{zqJOaweiXE9D8RY1.mjs → BudSIfXBAsTxvu-K.mjs} +31835 -40812
  13. package/browser/esm/C9u8FUewte5ugUjH.mjs +5132 -0
  14. package/browser/esm/{Di58Ji1n--3Mgc_2.mjs → CBYMTDzMf1Vh7pkw.mjs} +1 -1
  15. package/browser/esm/CNdjyofiRu6CYOrr.mjs +12835 -0
  16. package/browser/esm/{Dtoyt8q5RyGAlxCp.mjs → CRkYR-siY2C994KV.mjs} +1 -1
  17. package/browser/esm/CTe2qfmIUEad6FJv.mjs +199 -0
  18. package/browser/esm/CUzYuYTTGsChC_kZ.mjs +8422 -0
  19. package/browser/esm/CdEO8CEee6lEhabA.mjs +117 -0
  20. package/browser/esm/CfRqiPDg6RBTg1EN.mjs +367 -0
  21. package/browser/esm/CndRBvVfQUJIYRRj.mjs +193 -0
  22. package/browser/esm/{Y79I7Sm8kjaYexhf.mjs → CwOPLXU3-9ZHGyOT.mjs} +1 -1
  23. package/browser/esm/{CjsUGJEQSbGjnH6R.mjs → Cxjxk0ncRKx80I-w.mjs} +1 -1
  24. package/browser/esm/D2RZh0O9neOsyLAE.mjs +281 -0
  25. package/browser/esm/{De175LygU7ot4nQm.mjs → D64dM68B1pKYFzdP.mjs} +2 -2
  26. package/browser/esm/{o8MFgcVXns987D6_.mjs → D9xNz46kAfXMZzp4.mjs} +6 -6
  27. package/browser/esm/{BcHmrKHwMMOlzc9_.mjs → DK899HhWX1HINMC1.mjs} +55 -55
  28. package/browser/esm/DPhGQLNGmDZwODwJ.mjs +395 -0
  29. package/browser/esm/DVroRnhi-5IDXNgM.mjs +210 -0
  30. package/browser/esm/{Bk7xxbdDpa7-sIwd.mjs → DZiivy0NmO1Vnyzk.mjs} +2 -2
  31. package/browser/esm/{CZ5oa92wZEAXebgk.mjs → DgrAuRD2qr2DvFeJ.mjs} +78 -68
  32. package/browser/esm/{D4uVlrG0xEFctsSM.mjs → DobHLF6VjHr7Xi40.mjs} +285 -67
  33. package/browser/esm/{CSx9ed1JOs7K5BXO.mjs → DwZCT7DZiiXoTweg.mjs} +2 -2
  34. package/browser/esm/DwwR3O2sEZApPSTF.mjs +86 -0
  35. package/browser/esm/Tah7cnFb_HNZdLtj.mjs +128 -0
  36. package/browser/esm/{BEAY9XgKNx-bakXW.mjs → fXWUMDhZ5yMSO629.mjs} +1 -1
  37. package/browser/esm/{BqskM7wA8oPfFQue.mjs → hCQJcmIzPDxDEv2q.mjs} +2 -2
  38. package/browser/esm/index.mjs +1294 -1008
  39. package/browser/esm/{Cgd5BnM3hg9RyUel.mjs → qO-ujUrgq6H3TQix.mjs} +1 -1
  40. package/browser/esm/w6Jea0TiclPrYZ2M.mjs +1703 -0
  41. package/browser/esm/yuhcOYw6SHQ-RCm3.mjs +114 -0
  42. package/licenses/dependencies.txt +75 -75
  43. package/node/esm/-TA0MneBDKdGhsib.mjs +8668 -0
  44. package/node/esm/B-HUPAcqvK0eeeCz.mjs +134 -0
  45. package/node/esm/BL2iiEoqxDEV2Xrg.mjs +8320 -0
  46. package/node/esm/{C6ZXsNyLXI6zA63X.mjs → BNXLOEddJ6O9gYws.mjs} +9 -9
  47. package/node/esm/{BH1v-E4Ro3bR7Znw.mjs → BSvOluusoDM4z_dx.mjs} +151 -302
  48. package/node/esm/{CD9wbvufChVYYkrI.mjs → BskP3b8vUoIOGLY6.mjs} +2 -2
  49. package/node/esm/{CnSQ7MTXAUAyBOoS.mjs → Btw4148Ot8ifhNc1.mjs} +285 -64
  50. package/node/esm/{B6D7sSetrcOWLsKj.mjs → C14-R6tifRh7pc0p.mjs} +1 -1
  51. package/node/esm/C99zzq8DImQXi4BQ.mjs +133 -0
  52. package/node/esm/{BtuY37FumvLE7EBo.mjs → CBuEu5Jk-LfaDy-H.mjs} +176 -166
  53. package/node/esm/{DdFgXl-Ux2cMBTs_.mjs → CG-qBU5BAaVz7e-P.mjs} +1 -1
  54. package/node/esm/CPI58duc0j0a-HpJ.mjs +115 -0
  55. package/node/esm/CRt3vXe6YmXzqk3H.mjs +406 -0
  56. package/node/esm/{CUUoseJmFsCf82bb.mjs → C_aL7CGS1lrNn1Ng.mjs} +1 -1
  57. package/node/esm/{D7MfcID2Wf6l6VpC.mjs → C_xf5Bz30VqiJjXn.mjs} +1 -1
  58. package/node/esm/CiIymQN6aJCul62g.mjs +610 -0
  59. package/node/esm/{B9ljpEIZg6wOTzRE.mjs → Ci_zLYmCD7e-C79O.mjs} +1 -1
  60. package/node/esm/{Bqd62L8KFgdS0Vou.mjs → CkRYLed8Mmn3giNg.mjs} +2 -2
  61. package/node/esm/D3ptRKzASqBut1DE.mjs +117 -0
  62. package/node/esm/{DefYISWfdZJFx57m.mjs → D4ROK9UwDpS6jO3Z.mjs} +1 -1
  63. package/node/esm/D8hO07ToAibIuniw.mjs +13014 -0
  64. package/node/esm/{Bh4dv6tMjXX3X4nI.mjs → DUTmDHbFbhLDT4F3.mjs} +1 -1
  65. package/node/esm/{DCplLG93GfTs1vNw.mjs → DV5CU37aEbFbWFL0.mjs} +1 -1
  66. package/node/esm/{CUQi5ZtMO02nhG0W.mjs → DdoiuKg9BKubtF1V.mjs} +1 -1
  67. package/node/esm/DggQ23jKMpwhENfa.mjs +372 -0
  68. package/node/esm/DhS6yWjrrSNIJMsn.mjs +1033 -0
  69. package/node/esm/{DMD12JUh7HJw2-jl.mjs → DhTya_mhmN53vskv.mjs} +1 -1
  70. package/node/esm/Dn1M7YWi25DeeYUb.mjs +210 -0
  71. package/node/esm/DrCf6ITcBhVOFpRj.mjs +86 -0
  72. package/node/esm/{BN9j8V9gCExMjVtJ.mjs → DxazKtROyaI51dWl.mjs} +1 -1
  73. package/node/esm/{MiU4rDOiocmJ-9Ry.mjs → Q_S1g46ZOTrdhTae.mjs} +1 -1
  74. package/node/esm/Vocy-I9dKzZMr0Ct.mjs +59323 -0
  75. package/node/esm/ZXPFcsT2zrALCZux.mjs +289 -0
  76. package/node/esm/eimUGjiIP-b8HiM6.mjs +199 -0
  77. package/node/esm/icn2nX5Z8e_3mNAv.mjs +12 -0
  78. package/node/esm/index.mjs +2808 -65678
  79. package/node/esm/lGJ42sHqg5if2bba.mjs +1770 -0
  80. package/node/esm/{Bsx9uijd4X_SKV3L.mjs → pYtP7wPyS96NQyXS.mjs} +51 -51
  81. package/package.json +6 -7
  82. package/resources/contents.json +120 -0
  83. package/resources/fonts/arial-bold-italic.hinted.json +125 -0
  84. package/resources/fonts/arial-bold-italic.metrics.json +13 -13
  85. package/resources/fonts/arial-bold-italic.rows.json +9 -0
  86. package/resources/fonts/arial-bold.hinted.json +125 -0
  87. package/resources/fonts/arial-bold.metrics.json +12 -12
  88. package/resources/fonts/arial-bold.rows.json +9 -0
  89. package/resources/fonts/arial-italic.hinted.json +125 -0
  90. package/resources/fonts/arial-italic.metrics.json +13 -13
  91. package/resources/fonts/arial-italic.rows.json +9 -0
  92. package/resources/fonts/arial-regular.hinted.json +125 -0
  93. package/resources/fonts/arial-regular.metrics.json +12 -12
  94. package/resources/fonts/arial-regular.rows.json +9 -0
  95. package/resources/fonts/calibri-bold-italic.hinted.json +122 -0
  96. package/resources/fonts/calibri-bold-italic.metrics.json +2 -2
  97. package/resources/fonts/calibri-bold-italic.rows.json +9 -0
  98. package/resources/fonts/calibri-bold.hinted.json +122 -0
  99. package/resources/fonts/calibri-bold.metrics.json +1 -1
  100. package/resources/fonts/calibri-bold.rows.json +9 -0
  101. package/resources/fonts/calibri-italic.hinted.json +121 -0
  102. package/resources/fonts/calibri-italic.metrics.json +2 -2
  103. package/resources/fonts/calibri-italic.rows.json +9 -0
  104. package/resources/fonts/calibri-regular.hinted.json +121 -0
  105. package/resources/fonts/calibri-regular.metrics.json +1 -1
  106. package/resources/fonts/calibri-regular.rows.json +9 -0
  107. package/resources/fonts/cambria-bold-italic.hinted.json +105 -0
  108. package/resources/fonts/cambria-bold-italic.metrics.json +26 -26
  109. package/resources/fonts/cambria-bold-italic.rows.json +9 -0
  110. package/resources/fonts/cambria-bold.hinted.json +108 -0
  111. package/resources/fonts/cambria-bold.metrics.json +19 -19
  112. package/resources/fonts/cambria-bold.rows.json +9 -0
  113. package/resources/fonts/cambria-italic.hinted.json +102 -0
  114. package/resources/fonts/cambria-italic.metrics.json +23 -23
  115. package/resources/fonts/cambria-italic.rows.json +9 -0
  116. package/resources/fonts/cambria-regular.hinted.json +110 -0
  117. package/resources/fonts/cambria-regular.metrics.json +18 -18
  118. package/resources/fonts/cambria-regular.rows.json +9 -0
  119. package/resources/fonts/contents.json +280 -0
  120. package/resources/fonts/courier-new-bold-italic.hinted.json +11 -0
  121. package/resources/fonts/courier-new-bold-italic.metrics.json +12 -12
  122. package/resources/fonts/courier-new-bold-italic.rows.json +9 -0
  123. package/resources/fonts/courier-new-bold.hinted.json +11 -0
  124. package/resources/fonts/courier-new-bold.metrics.json +12 -12
  125. package/resources/fonts/courier-new-bold.rows.json +9 -0
  126. package/resources/fonts/courier-new-italic.hinted.json +11 -0
  127. package/resources/fonts/courier-new-italic.metrics.json +12 -12
  128. package/resources/fonts/courier-new-italic.rows.json +9 -0
  129. package/resources/fonts/courier-new-regular.hinted.json +11 -0
  130. package/resources/fonts/courier-new-regular.metrics.json +12 -12
  131. package/resources/fonts/courier-new-regular.rows.json +9 -0
  132. package/resources/fonts/times-new-roman-bold-italic.hinted.json +125 -0
  133. package/resources/fonts/times-new-roman-bold-italic.metrics.json +15 -15
  134. package/resources/fonts/times-new-roman-bold-italic.rows.json +9 -0
  135. package/resources/fonts/times-new-roman-bold.hinted.json +125 -0
  136. package/resources/fonts/times-new-roman-bold.metrics.json +12 -12
  137. package/resources/fonts/times-new-roman-bold.rows.json +9 -0
  138. package/resources/fonts/times-new-roman-italic.hinted.json +125 -0
  139. package/resources/fonts/times-new-roman-italic.metrics.json +16 -16
  140. package/resources/fonts/times-new-roman-italic.rows.json +9 -0
  141. package/resources/fonts/times-new-roman-regular.hinted.json +125 -0
  142. package/resources/fonts/times-new-roman-regular.metrics.json +16 -16
  143. package/resources/fonts/times-new-roman-regular.rows.json +9 -0
  144. package/resources/locales/de/model.msg.json +93 -9
  145. package/resources/locales/en/model.msg.json +95 -10
  146. package/types/scripting-api.json +10809 -8021
  147. package/types/scripting-enums.json +201 -44
  148. package/types/scripting.d.ts +17030 -8666
  149. package/types/src/.generated/wasm/fonts.d.ts +161 -0
  150. package/types/src/.generated/wasm/fonts_bg.inline.d.ts +3 -0
  151. package/types/src/.generated/wasm/sdk.d.ts +122 -0
  152. package/types/src/.generated/wasm/sdk_bg.inline.d.ts +3 -0
  153. package/types/src/address/AddressUtils.d.ts +10 -1
  154. package/types/src/address/_StructuredAddress.d.ts +58 -0
  155. package/types/src/anomalies/_Anomalies.d.ts +109 -0
  156. package/types/src/anomalies/_FocusTable.d.ts +11 -0
  157. package/types/src/anomalies/_FormulaChecks.d.ts +133 -0
  158. package/types/src/anomalies/_LabelChecks.d.ts +21 -0
  159. package/types/src/anomalies/_LiteralChecks.d.ts +35 -0
  160. package/types/src/anomalies/_SeriesChecks.d.ts +13 -0
  161. package/types/src/border/IBorders.d.ts +16 -0
  162. package/types/src/calculation/Calculation.d.ts +139 -371
  163. package/types/src/calculation/ExternalBookBindings.d.ts +2 -3
  164. package/types/src/calculation/FormulaLiterals.d.ts +2 -1
  165. package/types/src/calculation/FormulaText.d.ts +18 -2
  166. package/types/src/calculation/ICalculation.d.ts +133 -18
  167. package/types/src/calculation/INamedFormulasCollection.d.ts +4 -0
  168. package/types/src/calculation/NamedFormulaCollection.d.ts +293 -22
  169. package/types/src/calculation/_CloneBoundary.d.ts +1 -1
  170. package/types/src/calculation/_FormulaToolkit.d.ts +9 -0
  171. package/types/src/calculation/_TableExtent.d.ts +60 -0
  172. package/types/src/calculation/compiler/ASTTypes.d.ts +6 -2
  173. package/types/src/calculation/compiler/CompilerUtils.d.ts +17 -0
  174. package/types/src/calculation/compiler/ParserUtils.d.ts +16 -0
  175. package/types/src/calculation/compiler/Types.d.ts +9 -1
  176. package/types/src/calculation/engine/CalcBackend.d.ts +953 -0
  177. package/types/src/calculation/engine/index.d.ts +10 -0
  178. package/types/src/calculation/executor/CalcExecutor.d.ts +94 -24
  179. package/types/src/calculation/executor/CalcExecutorUtils.d.ts +23 -1
  180. package/types/src/calculation/executor/_WhatIf.d.ts +50 -0
  181. package/types/src/calculation/formula/Formula.d.ts +9 -0
  182. package/types/src/calculation/formula/FormulaBlock.d.ts +10 -3
  183. package/types/src/calculation/formula/IFormulaBlock.d.ts +21 -0
  184. package/types/src/calculation/formula/LambdaValue.d.ts +5 -3
  185. package/types/src/calculation/functions/FunctionDeclarations.d.ts +5 -1
  186. package/types/src/calculation/functions/_DataTableFunction.d.ts +14 -0
  187. package/types/src/calculation/functions/expandDeclaration.d.ts +15 -0
  188. package/types/src/calculation/functions/initializeFunctions.d.ts +0 -12
  189. package/types/src/calculation/grid/CalcGrid.d.ts +44 -10
  190. package/types/src/calculation/grid/CalcGridBackend.d.ts +35 -27
  191. package/types/src/calculation/grid/CalcGridProxy.d.ts +2 -2
  192. package/types/src/calculation/grid/CalcGridUtils.d.ts +12 -3
  193. package/types/src/calculation/grid/FormulaHost.d.ts +51 -6
  194. package/types/src/calculation/grid/ICalcGrid.d.ts +48 -15
  195. package/types/src/calculation/grid/_CalcRequest.d.ts +28 -6
  196. package/types/src/calculation/grid/_CellValueRun.d.ts +21 -0
  197. package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +29 -2
  198. package/types/src/calculation/spatial/SpillEntry.d.ts +16 -2
  199. package/types/src/calculation/state/CalcNode.d.ts +0 -1
  200. package/types/src/calculation/state/CalcScope.d.ts +44 -6
  201. package/types/src/calculation/state/CalcState.d.ts +36 -4
  202. package/types/src/calculation/state/CalculationContext.d.ts +30 -3
  203. package/types/src/calculation/state/DeferredCalls.d.ts +260 -0
  204. package/types/src/calculation/state/IContextContainer.d.ts +32 -0
  205. package/types/src/calculation/state/_PendingOverlayGrid.d.ts +6 -0
  206. package/types/src/calculation/state/_WhatIfLayer.d.ts +91 -0
  207. package/types/src/calculation/toolkit/FormulaLiteralReader.d.ts +4 -0
  208. package/types/src/calculation/toolkit/FormulaTextParser.d.ts +10 -0
  209. package/types/src/calculation/toolkit/FunctionDeclarationTable.d.ts +4 -0
  210. package/types/src/calculation/toolkit/index.d.ts +12 -0
  211. package/types/src/cell/ICell.d.ts +302 -34
  212. package/types/src/cell/ICellHeader.d.ts +7 -6
  213. package/types/src/cell/ICellProtection.d.ts +1 -1
  214. package/types/src/cellControl/CellControl.d.ts +67 -0
  215. package/types/src/cellControl/CellControlCollection.d.ts +29 -0
  216. package/types/src/cellControl/CellControlRegistry.d.ts +47 -0
  217. package/types/src/cellControl/ICellControl.d.ts +99 -0
  218. package/types/src/cellControl/ICellControlCollection.d.ts +67 -0
  219. package/types/src/cellControl/index.d.ts +4 -0
  220. package/types/src/cellRange/ICellHeaderRange.d.ts +6 -9
  221. package/types/src/cellRange/ICellHeaderRanges.d.ts +5 -0
  222. package/types/src/cellRange/ICellRange.d.ts +525 -110
  223. package/types/src/cellRange/ICellRanges.d.ts +12 -6
  224. package/types/src/chart/Chart.d.ts +217 -15
  225. package/types/src/chart/ChartCollection.d.ts +7 -2
  226. package/types/src/chart/IChart.d.ts +1921 -35
  227. package/types/src/chart/IChartCollection.d.ts +27 -2
  228. package/types/src/chart/_ChartParts.d.ts +1066 -0
  229. package/types/src/chart/_ChartSource.d.ts +47 -0
  230. package/types/src/chart/createChart.d.ts +26 -0
  231. package/types/src/chart/index.d.ts +4 -0
  232. package/types/src/chart/kinds/ChartKind.d.ts +252 -0
  233. package/types/src/chart/kinds/_Area.d.ts +3 -0
  234. package/types/src/chart/kinds/_Bar.d.ts +4 -0
  235. package/types/src/chart/kinds/_BoxWhisker.d.ts +4 -0
  236. package/types/src/chart/kinds/_Bubble.d.ts +3 -0
  237. package/types/src/chart/kinds/_Funnel.d.ts +4 -0
  238. package/types/src/chart/kinds/_Hierarchy.d.ts +31 -0
  239. package/types/src/chart/kinds/_Histogram.d.ts +4 -0
  240. package/types/src/chart/kinds/_HitKinds.d.ts +23 -0
  241. package/types/src/chart/kinds/_Line.d.ts +4 -0
  242. package/types/src/chart/kinds/_OfPie.d.ts +4 -0
  243. package/types/src/chart/kinds/_Pie.d.ts +4 -0
  244. package/types/src/chart/kinds/_Placeholder.d.ts +6 -0
  245. package/types/src/chart/kinds/_Radar.d.ts +4 -0
  246. package/types/src/chart/kinds/_Scatter.d.ts +8 -0
  247. package/types/src/chart/kinds/_Sunburst.d.ts +4 -0
  248. package/types/src/chart/kinds/_Surface.d.ts +4 -0
  249. package/types/src/chart/kinds/_Treemap.d.ts +4 -0
  250. package/types/src/chart/kinds/_Waterfall.d.ts +18 -0
  251. package/types/src/chart/kinds/_builtIns.d.ts +11 -0
  252. package/types/src/chart/layout/ChartLayout.d.ts +829 -0
  253. package/types/src/chart/layout/TextMeasurer.d.ts +38 -0
  254. package/types/src/chart/layout/_HitGeometry.d.ts +50 -0
  255. package/types/src/chart/layout/_HitTest.d.ts +36 -0
  256. package/types/src/chart/layout/_Layout.d.ts +25 -0
  257. package/types/src/chart/layout/_LayoutUtils.d.ts +97 -0
  258. package/types/src/chart/math/BoxStats.d.ts +35 -0
  259. package/types/src/chart/math/DateUnitCalcs.d.ts +80 -0
  260. package/types/src/chart/math/DisplayUnits.d.ts +53 -0
  261. package/types/src/chart/math/Histogram.d.ts +48 -0
  262. package/types/src/chart/math/OrdUnitCalcs.d.ts +166 -0
  263. package/types/src/chart/math/Treemap.d.ts +28 -0
  264. package/types/src/chart/math/Trendlines.d.ts +71 -0
  265. package/types/src/chart/math/UnitCalcs.d.ts +98 -0
  266. package/types/src/chart/model/ChartModel.d.ts +681 -0
  267. package/types/src/chart/model/_ChartType.d.ts +14 -0
  268. package/types/src/chart/model/_Edits.d.ts +489 -0
  269. package/types/src/chart/model/_Grouping.d.ts +83 -0
  270. package/types/src/chart/model/_Inference.d.ts +52 -0
  271. package/types/src/chart/model/_ModelFacts.d.ts +112 -0
  272. package/types/src/chart/model/_NewChart.d.ts +208 -0
  273. package/types/src/chart/model/_OfPie.d.ts +18 -0
  274. package/types/src/chart/resolve/_LegacyStyles.d.ts +48 -0
  275. package/types/src/chart/resolve/_Resolve.d.ts +61 -0
  276. package/types/src/chart/resolve/_ResolvedChart.d.ts +447 -0
  277. package/types/src/collections/ISparseGrid.d.ts +11 -2
  278. package/types/src/collections/MixedTypedArrayList.d.ts +8 -2
  279. package/types/src/collections/RTree.d.ts +116 -36
  280. package/types/src/collections/SparseGrid.d.ts +9 -11
  281. package/types/src/collections/SpatialMap.d.ts +2 -8
  282. package/types/src/collections/SpatialMap3D.d.ts +2 -0
  283. package/types/src/collections/index.d.ts +1 -1
  284. package/types/src/comment/Comment.d.ts +32 -9
  285. package/types/src/comment/IComment.d.ts +41 -4
  286. package/types/src/comment/_NoteBox.d.ts +19 -2
  287. package/types/src/condition/AnchoredConditional.d.ts +30 -4
  288. package/types/src/condition/ICondition.d.ts +3 -2
  289. package/types/src/conditionalFormat/ConditionalFormat.d.ts +9 -3
  290. package/types/src/conditionalFormat/IConditionalFormat.d.ts +4 -3
  291. package/types/src/dataValidation/DataValidation.d.ts +1 -1
  292. package/types/src/dataValidation/DataValidationCollection.d.ts +4 -1
  293. package/types/src/dataValidation/IDataValidation.d.ts +1 -1
  294. package/types/src/dataValidation/IDataValidationCollection.d.ts +24 -0
  295. package/types/src/documentProperties/DocumentProperties.d.ts +66 -0
  296. package/types/src/documentProperties/ICustomProperty.d.ts +69 -0
  297. package/types/src/documentProperties/IDocumentProperties.d.ts +110 -0
  298. package/types/src/documentProperties/index.d.ts +3 -0
  299. package/types/src/externalBook/IExternalBook.d.ts +3 -4
  300. package/types/src/fetch/Fetcher.d.ts +15 -0
  301. package/types/src/fetch/IFetcher.d.ts +47 -0
  302. package/types/src/fetch/_WorkbookFetch.d.ts +43 -0
  303. package/types/src/fetch/index.d.ts +3 -0
  304. package/types/src/fill/IFill.d.ts +7 -0
  305. package/types/src/fill/IFillable.d.ts +47 -0
  306. package/types/src/fill/IStroke.d.ts +15 -1
  307. package/types/src/fill/PaintUtils.d.ts +24 -0
  308. package/types/src/fill/index.d.ts +2 -0
  309. package/types/src/font/AdvanceBuilder.d.ts +34 -0
  310. package/types/src/font/AdvanceTable.d.ts +128 -14
  311. package/types/src/font/CanvasAdvanceBuilder.d.ts +54 -0
  312. package/types/src/font/FontCapture.d.ts +4 -0
  313. package/types/src/font/FontCollection.d.ts +53 -2
  314. package/types/src/font/FontPlatform.d.ts +20 -0
  315. package/types/src/font/FontUtils.d.ts +5 -0
  316. package/types/src/font/IFont.d.ts +191 -61
  317. package/types/src/font/IFontCollection.d.ts +20 -14
  318. package/types/src/font/IFontStyle.d.ts +207 -0
  319. package/types/src/font/TableFileAdvanceBuilder.d.ts +9 -0
  320. package/types/src/font/_FontUtils.d.ts +11 -4
  321. package/types/src/font/_FontsVersion.d.ts +7 -0
  322. package/types/src/font/index.d.ts +1 -3
  323. package/types/src/font/platform.browser.d.ts +15 -0
  324. package/types/src/font/platform.node.d.ts +5 -0
  325. package/types/src/group/Group.d.ts +5 -0
  326. package/types/src/group/GroupMovableCollection.d.ts +4 -0
  327. package/types/src/history/IHistory.d.ts +19 -2
  328. package/types/src/hyperlink/IHyperlink.d.ts +17 -1
  329. package/types/src/hyperlink/_Hyperlink.d.ts +4 -1
  330. package/types/src/index.d.ts +4 -0
  331. package/types/src/license/LicenseManager.d.ts +21 -0
  332. package/types/src/license/_Utils.d.ts +18 -1
  333. package/types/src/license/runtime.browser.d.ts +5 -0
  334. package/types/src/license/runtime.node.d.ts +10 -0
  335. package/types/src/listener/IListener.d.ts +14 -2
  336. package/types/src/listener/ListenerEmitter.d.ts +11 -3
  337. package/types/src/movable/IMovable.d.ts +28 -15
  338. package/types/src/movable/IMovableCollection.d.ts +1 -1
  339. package/types/src/movable/Movable.d.ts +12 -1
  340. package/types/src/movable/MovableCollection.d.ts +7 -3
  341. package/types/src/movable/_InsertableCollection.d.ts +16 -5
  342. package/types/src/named/INamed.d.ts +30 -0
  343. package/types/src/named/INamedCollection.d.ts +38 -2
  344. package/types/src/named/NamedCollection.d.ts +34 -4
  345. package/types/src/numFmt/NumberFormatParser.d.ts +5 -0
  346. package/types/src/outline/IOutline.d.ts +1 -1
  347. package/types/src/outline/Outline.d.ts +2 -2
  348. package/types/src/picture/IPicture.d.ts +98 -1
  349. package/types/src/picture/Picture.d.ts +15 -7
  350. package/types/src/pivot/IPivotTable.d.ts +2 -2
  351. package/types/src/pivot/PivotTable.d.ts +5 -5
  352. package/types/src/primitives/AsyncValue.d.ts +58 -0
  353. package/types/src/primitives/ReferenceRange.d.ts +2 -2
  354. package/types/src/print/IPageLayout.d.ts +635 -0
  355. package/types/src/print/PageLayout.d.ts +258 -0
  356. package/types/src/print/index.d.ts +1 -1
  357. package/types/src/protectedRange/IProtectedRange.d.ts +2 -2
  358. package/types/src/protection/IProtection.d.ts +6 -0
  359. package/types/src/protection/PasswordHasher.d.ts +13 -0
  360. package/types/src/resource/IResource.d.ts +9 -0
  361. package/types/src/resource/IResourceCollection.d.ts +4 -0
  362. package/types/src/resource/Resource.d.ts +2 -0
  363. package/types/src/resource/_AddResource.d.ts +13 -0
  364. package/types/src/richData/CellImage.d.ts +95 -0
  365. package/types/src/richData/Hyperlink.d.ts +49 -0
  366. package/types/src/richData/IRichDataCollection.d.ts +76 -0
  367. package/types/src/richData/IRichDataKind.d.ts +66 -0
  368. package/types/src/richData/RichArray.d.ts +42 -0
  369. package/types/src/richData/RichDataCollection.d.ts +23 -0
  370. package/types/src/richData/RichDataRegistry.d.ts +89 -0
  371. package/types/src/richData/RichDataValues.d.ts +20 -0
  372. package/types/src/richData/RichRecord.d.ts +68 -0
  373. package/types/src/richData/RichText.d.ts +59 -0
  374. package/types/src/richData/index.d.ts +9 -0
  375. package/types/src/scripting/FunctionArguments.d.ts +17 -1
  376. package/types/src/scripting/FunctionCollection.d.ts +8 -0
  377. package/types/src/scripting/IModule.d.ts +3 -3
  378. package/types/src/scripting/IScript.d.ts +2 -2
  379. package/types/src/scripting/ITypedFunction.d.ts +1 -1
  380. package/types/src/scripting/Scripts.d.ts +10 -0
  381. package/types/src/scripting/TypedFunction.d.ts +2 -0
  382. package/types/src/scripting/declarations.d.ts +3 -0
  383. package/types/src/selection/ChartElementSelection.d.ts +39 -0
  384. package/types/src/selection/IChartElementSelection.d.ts +103 -0
  385. package/types/src/selection/IItemSelection.d.ts +131 -0
  386. package/types/src/selection/IMovableSelection.d.ts +6 -34
  387. package/types/src/selection/IRangeSelection.d.ts +4 -4
  388. package/types/src/selection/ItemSelection.d.ts +49 -0
  389. package/types/src/selection/MovableSelection.d.ts +11 -30
  390. package/types/src/selection/RangeSelection.d.ts +4 -4
  391. package/types/src/selection/index.d.ts +3 -0
  392. package/types/src/shape/IShape.d.ts +2 -1
  393. package/types/src/shape/IShapeStyle.d.ts +5 -31
  394. package/types/src/shape/ITextBoxStyle.d.ts +85 -0
  395. package/types/src/shape/ShapeStyleUtils.d.ts +13 -1
  396. package/types/src/shape/_Connectors.d.ts +9 -9
  397. package/types/src/shape/_ShapeStyle.d.ts +9 -0
  398. package/types/src/shape/index.d.ts +1 -0
  399. package/types/src/sheet/CellRegion.d.ts +37 -3
  400. package/types/src/sheet/ICellContainerOptions.d.ts +6 -0
  401. package/types/src/sheet/IOpaqueSheet.d.ts +46 -0
  402. package/types/src/sheet/ISheet.d.ts +81 -1078
  403. package/types/src/sheet/IWorksheet.d.ts +1521 -0
  404. package/types/src/sheet/{ISheetCollection.d.ts → IWorksheetCollection.d.ts} +37 -12
  405. package/types/src/sheet/NamedCellRange.d.ts +2 -2
  406. package/types/src/sheet/NamedRange.d.ts +2 -2
  407. package/types/src/sheet/OpaqueSheet.d.ts +114 -0
  408. package/types/src/sheet/SheetCell.d.ts +40 -27
  409. package/types/src/sheet/SheetRange.d.ts +50 -13
  410. package/types/src/sheet/SheetRanges.d.ts +14 -12
  411. package/types/src/sheet/{Sheet.d.ts → Worksheet.d.ts} +591 -171
  412. package/types/src/sheet/WorksheetCollection.d.ts +39 -0
  413. package/types/src/sheet/_CellBuffer.d.ts +11 -1
  414. package/types/src/sheet/_CopyUtils.d.ts +13 -6
  415. package/types/src/sheet/_IgnoredErrors.d.ts +46 -0
  416. package/types/src/sheet/_InvalidSheetRange.d.ts +3 -2
  417. package/types/src/sheet/_Kinds.d.ts +34 -0
  418. package/types/src/sheet/_Labels.d.ts +38 -0
  419. package/types/src/sheet/_ListenerAnchor.d.ts +7 -1
  420. package/types/src/sheet/_RangeStateSweep.d.ts +2 -3
  421. package/types/src/sheet/_ScalarListFactory.d.ts +55 -7
  422. package/types/src/sheet/_SheetAutoFillUtils.d.ts +3 -3
  423. package/types/src/sheet/_SheetAutoFitUtils.d.ts +3 -3
  424. package/types/src/sheet/_SheetChangeEvent.d.ts +72 -0
  425. package/types/src/sheet/_SheetCoords.d.ts +3 -3
  426. package/types/src/sheet/_SheetEvents.d.ts +1 -1
  427. package/types/src/sheet/_SheetFilterUtils.d.ts +6 -6
  428. package/types/src/sheet/_SheetIntents.d.ts +32 -14
  429. package/types/src/sheet/_SheetMessages.d.ts +1 -1
  430. package/types/src/sheet/_SheetMutations.d.ts +11 -9
  431. package/types/src/sheet/_SheetSortUtils.d.ts +2 -2
  432. package/types/src/sheet/_SheetStateReader.d.ts +18 -0
  433. package/types/src/sheet/_SheetStateTypes.d.ts +80 -9
  434. package/types/src/sheet/_SheetUtils.d.ts +20 -19
  435. package/types/src/sheet/_WatchAnchor.d.ts +15 -2
  436. package/types/src/sheet/clipboard/RangeClipboardItems.d.ts +4 -4
  437. package/types/src/sheet/clipboard/SheetHTMLTableParser.d.ts +3 -3
  438. package/types/src/sheet/clipboard/SheetHTMLTableWriter.d.ts +3 -3
  439. package/types/src/sheet/index.d.ts +5 -2
  440. package/types/src/sheet/style/SheetCellStyle.d.ts +67 -86
  441. package/types/src/sheet/style/SheetDirectStyle.d.ts +3 -3
  442. package/types/src/sheet/style/SheetNamedStyle.d.ts +2 -0
  443. package/types/src/sheet/style/_DigitWidth.d.ts +7 -0
  444. package/types/src/sheet/style/_Resolvers.d.ts +3 -2
  445. package/types/src/sheet/style/_StyleUtils.d.ts +7 -43
  446. package/types/src/sheetHeader/ISheetHeader.d.ts +2 -2
  447. package/types/src/sheetHeader/SheetCellHeader.d.ts +2 -0
  448. package/types/src/sheetHeader/SheetCellHeaderRange.d.ts +2 -0
  449. package/types/src/sheetHeader/SheetCellHeaderRanges.d.ts +2 -0
  450. package/types/src/sheetHeader/SheetHeader.d.ts +7 -6
  451. package/types/src/sheetHeader/_HeaderUtils.d.ts +2 -3
  452. package/types/src/sheetProtection/{ISheetProtection.d.ts → IWorksheetProtection.d.ts} +28 -28
  453. package/types/src/sheetProtection/WorksheetProtection.d.ts +51 -0
  454. package/types/src/sheetProtection/index.d.ts +1 -1
  455. package/types/src/sheetView/{ISheetView.d.ts → IWorksheetView.d.ts} +168 -61
  456. package/types/src/sheetView/WorksheetView.d.ts +139 -0
  457. package/types/src/sheetView/_SheetViewUtils.d.ts +5 -3
  458. package/types/src/sheetView/index.d.ts +1 -1
  459. package/types/src/slicer/ISlicer.d.ts +2 -2
  460. package/types/src/sort/ISort.d.ts +35 -5
  461. package/types/src/style/ICellStyle.d.ts +56 -44
  462. package/types/src/style/_BuiltInStyleDefs.d.ts +4 -3
  463. package/types/src/table/AnchoredTable.d.ts +23 -7
  464. package/types/src/table/AutoTable.d.ts +1 -1
  465. package/types/src/table/ITable.d.ts +32 -19
  466. package/types/src/table/_NamedTable.d.ts +3 -3
  467. package/types/src/table/_NamedTableSource.d.ts +2 -2
  468. package/types/src/text/IText.d.ts +4 -51
  469. package/types/src/text/TextEngine.d.ts +34 -0
  470. package/types/src/text/TextFrame.d.ts +4 -2
  471. package/types/src/text/TextRun.d.ts +3 -2
  472. package/types/src/text/TextWrapper.d.ts +32 -26
  473. package/types/src/text/_TextUtils.d.ts +5 -5
  474. package/types/src/text/_TextWrapperFallback.d.ts +49 -0
  475. package/types/src/text/impl/TabStrategy.d.ts +3 -1
  476. package/types/src/text/richtext/IRichText.d.ts +16 -2
  477. package/types/src/text/richtext/index.d.ts +0 -1
  478. package/types/src/theme/ITheme.d.ts +108 -7
  479. package/types/src/theme/ThemeCollection.d.ts +5 -0
  480. package/types/src/theme/_OfficeFontScheme.d.ts +8 -0
  481. package/types/src/transaction/ITransaction.d.ts +20 -1
  482. package/types/src/transaction/Transaction.d.ts +8 -1
  483. package/types/src/transaction/_BatchHandle.d.ts +118 -0
  484. package/types/src/type/AbstractCollection.d.ts +4 -13
  485. package/types/src/type/ICollection.d.ts +17 -4
  486. package/types/src/type/IProperties.d.ts +1 -1
  487. package/types/src/utils/_CSSUtils.d.ts +1 -1
  488. package/types/src/wasm/_fontsWasm.d.ts +7 -0
  489. package/types/src/wasm/_sdkWasm.d.ts +1 -1
  490. package/types/src/wasm/fontsWasm.d.ts +32 -0
  491. package/types/src/wasm/index.d.ts +1 -0
  492. package/types/src/wasm/loader.browser.d.ts +9 -0
  493. package/types/src/wasm/loader.node.d.ts +9 -0
  494. package/types/src/wasm/sdkWasm.d.ts +6 -3
  495. package/types/src/workbook/IWorkbook.d.ts +269 -39
  496. package/types/src/workbook/Workbook.d.ts +102 -25
  497. package/types/src/workbook/WorkbookRange.d.ts +2 -2
  498. package/types/src/workbook/WorkbookRanges.d.ts +3 -3
  499. package/types/src/workbook/_WorkbookIntents.d.ts +2 -2
  500. package/types/src/workbook/_WorkbookMessages.d.ts +5 -0
  501. package/types/src/workbookView/IWorkbookView.d.ts +82 -0
  502. package/types/src/workbookView/WorkbookView.d.ts +21 -0
  503. package/browser/esm/BbSmt62FpFIpoVzu.mjs +0 -392
  504. package/browser/esm/BgcZ-CoTbMfmyDJL.mjs +0 -412
  505. package/browser/esm/DOMHmhYzPcLVcpAW.mjs +0 -7
  506. package/browser/esm/DUvUK61b2_4pf4tG.mjs +0 -484
  507. package/node/esm/CCouEwT37f08qO3V.mjs +0 -7
  508. package/node/esm/CImNvdz1iP-lUlro.mjs +0 -610
  509. package/node/esm/CT0CN82y0_Qgoryk.mjs +0 -7568
  510. package/node/esm/DHUADiCmxNQS1ARz.mjs +0 -417
  511. package/node/esm/Ds0d8zXzmgOu3MGx.mjs +0 -403
  512. package/types/src/chart/_ChartXml.d.ts +0 -70
  513. package/types/src/collections/OverlappingRangeIterator.d.ts +0 -87
  514. package/types/src/collections/_RangeSweep.d.ts +0 -97
  515. package/types/src/font/CanvasFontMeasurer.d.ts +0 -25
  516. package/types/src/font/FontKitFontMeasurer.d.ts +0 -11
  517. package/types/src/font/SimpleFontMeasurer.d.ts +0 -4
  518. package/types/src/print/IPrint.d.ts +0 -212
  519. package/types/src/sheet/SheetCollection.d.ts +0 -29
  520. package/types/src/sheetProtection/SheetProtection.d.ts +0 -51
  521. package/types/src/sheetView/SheetView.d.ts +0 -122
  522. package/types/src/text/richtext/IStyledFont.d.ts +0 -330
@@ -0,0 +1,1770 @@
1
+ /**
2
+ * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.12
3
+ *
4
+ * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
+ * License: The license can be found at https://www.sheetxl.com/license.
6
+ */
7
+ import { $n as e, At as t, Fn as n, Ii as r, Ln as i, Rn as l, St as s, Xn as o, _ as a, ai as u, br as c, cr as f, di as p, f as d, gi as g, h as v, hr as h, mr as m, n as y, p as I, s as b, sr as x, u as R, ur as E, ut as T, vr as A, xn as S, xt as w, yr as C, yt as N, zn as F } from "./Vocy-I9dKzZMr0Ct.mjs";
8
+ import { Qt as P } from "./BL2iiEoqxDEV2Xrg.mjs";
9
+ import { FormulaError as L, Scalar as k, ScalarType as $, ValueKind as O, isLazyValue as B } from "@sheetxl/primitives";
10
+ import { CommonUtils as V } from "@sheetxl/utils";
11
+ var z = (e, t) => e + t, D = (e, t) => e - t, M = (e, t) => T(e + t, e), W = (e, t) => T(e - t, e), U = (e, t) => d(e * t), _ = (e, t) => 0 === t ? L.BuiltIn.Div0 : d(e / t), j = (e, t) => {
12
+ if (0 === e) {
13
+ if (t < 0) return L.BuiltIn.Div0;
14
+ if (0 === t) return NaN;
15
+ }
16
+ if (e < 0) {
17
+ if (Number.isInteger(t) && Math.abs(t) <= 4294967294) return d(e ** t);
18
+ const n = Number((1 / t).toPrecision(15));
19
+ return Number.isInteger(n) && 1 === Math.abs(n % 2) ? d(-((-e) ** t)) : NaN;
20
+ }
21
+ return d(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;
27
+ return i.length > k.MAX_TEXT_LENGTH ? i.slice(0, k.MAX_TEXT_LENGTH) : i;
28
+ }, H = (e, t = null, n = null) => 0 === e.compare(t, n), X = (e, t = null, n = null) => 0 !== e.compare(t, n), K = (e, t = null, n = null) => e.compare(t, n) > 0, Z = (e, t = null, n = null) => e.compare(t, n) >= 0, q = (e, t = null, n = null) => e.compare(t, n) < 0, Q = (e, t = null, n = null) => e.compare(t, n) <= 0, J = {
29
+ type: $.Number,
30
+ coerce: [$.Boolean, $.String],
31
+ onError: "value",
32
+ misalignValue: L.BuiltIn.NA
33
+ }, Y = {
34
+ type: $.String,
35
+ coerce: [$.Boolean, $.Number],
36
+ onError: "value",
37
+ misalignValue: L.BuiltIn.NA
38
+ }, ee = {
39
+ onError: "value",
40
+ misalignValue: L.BuiltIn.NA
41
+ }, te = (e) => null !== e && "object" == typeof e && !0 === e.isIReferenceRange && 1 === e.size ? e.getValueAt(0, 0) ?? null : e, ne = (e, t, n, r) => {
42
+ if (null !== t && void 0 !== t.colStart && (t = e.getValueAt(t.rowStart, t.colStart, t.scope)) && L.isError(t)) return t;
43
+ if (null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && L.isError(n)) return n;
44
+ if (t = te(t), n = te(n), "number" == typeof t && "number" == typeof n) return r(t, n);
45
+ let i, l;
46
+ if (t?.isIRange ? i = t : n?.isIRange && (l = n), !i && !l) {
47
+ const i = e.getRuntime();
48
+ return t = b(i, t, a(t, !0), $.Number, !0), n = b(i, n, a(n, !0), $.Number, !0), t && L.isError(t) ? t : n && L.isError(n) ? n : r(t, n);
49
+ }
50
+ const s = !i, o = s ? t : n;
51
+ return (i ?? l).broadcast(o, (t, n) => t && L.isError(t) ? t : n && L.isError(n) ? n : v(s ? r(n, t) : r(t, n), e), J).fillEmpty(0);
52
+ }, re = (e, t, n, r) => {
53
+ if (S(t) || S(n)) return L.BuiltIn.Value;
54
+ if (B(t) || B(n)) return L.BuiltIn.Value;
55
+ if (null !== t && void 0 !== t.colStart && (t = e.getValueAt(t.rowStart, t.colStart, t.scope)) && L.isError(t)) return t;
56
+ if (null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && L.isError(n)) return n;
57
+ let i, l;
58
+ t = te(t), n = te(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
+ }, ie = (e) => {
62
+ if (!0 !== e?.isIRichData) return e;
63
+ const t = e.toPrimitive?.();
64
+ return null == t ? e : t;
65
+ }, le = (e, t, n) => {
66
+ if (null == n && (n = 0), null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && L.isError(n)) return n;
67
+ n = te(n);
68
+ let r, i = 1;
69
+ if ("+" === t) return n;
70
+ if ("-" !== t) throw new L.Value(`Unrecognized prefix: ${t}`);
71
+ if (i = -i, n?.isIRange && (r = n), !r) {
72
+ const t = e.getRuntime();
73
+ return "number" != typeof (n = b(t, n, a(n, !0), $.Number, !0)) ? L.BuiltIn.Value : n * i;
74
+ }
75
+ return r.broadcast(i, (e, t) => e && L.isError(e) ? e : t && L.isError(t) ? t : U(e, t), J);
76
+ }, se = (e) => e.getCode() <= L.Code.NA ? e : L.BuiltIn.Value, oe = (e, t, n, r, i) => {
77
+ if (L.isError(t)) return se(t);
78
+ if (n && L.isError(n)) return se(n);
79
+ if (!t) return L.BuiltIn.Ref;
80
+ if (t.isIReferenceRange && n && !n.isIReferenceRange ? n = e.getReference(n) : n && n.isIReferenceRange && t && !t.isIReferenceRange && (t = e.getReference(t)), t.isIReferenceRange && (t = t.getCoords()), void 0 === t.colStart) return L.BuiltIn.Value;
81
+ if (n.isIReferenceRange && (n = n.getCoords()), void 0 === n.colStart) return L.BuiltIn.Value;
82
+ const l = t.scope ? "either" !== i || n.scope ? null : t : n;
83
+ if (l?.scope) {
84
+ const t = e.getReference(l);
85
+ if (L.isError(t)) return t;
86
+ if (e.getSheetIndex() !== e.getSheetIndex(t)) return L.BuiltIn.Value;
87
+ }
88
+ const s = r(t, n);
89
+ return L.isError(s) ? s : s ? e.getReference(s) : L.BuiltIn.Null;
90
+ }, ae = {
91
+ "+": (e, t, n) => ne(e, t, n, z),
92
+ "-": (e, t, n) => ne(e, t, n, D),
93
+ "*": (e, t, n) => ne(e, t, n, U),
94
+ "/": (e, t, n) => ne(e, t, n, _),
95
+ "^": (e, t, n) => ne(e, t, n, j),
96
+ " ": (e, t, n, r) => oe(e, t, n, u, "either"),
97
+ ":": (e, t, n, r) => oe(e, t, n, g, "start"),
98
+ ".:.": (e, t, n, r) => {
99
+ const i = oe(e, t, n, g, "start");
100
+ return e.getFunction("TRIMRANGE").execute(i, 3, 3);
101
+ },
102
+ ".:": (e, t, n, r) => {
103
+ const i = oe(e, t, n, g, "start");
104
+ return e.getFunction("TRIMRANGE").execute(i, 1, 1);
105
+ },
106
+ ":.": (e, t, n, r) => {
107
+ const i = oe(e, t, n, g, "start");
108
+ return e.getFunction("TRIMRANGE").execute(i, 2, 2);
109
+ },
110
+ "&": (e, t, n) => ((e, t, n, r) => {
111
+ if (null !== t && void 0 !== t.colStart && (t = e.getValueAt(t.rowStart, t.colStart, t.scope)) && L.isError(t)) return t;
112
+ if (null !== n && void 0 !== n.colStart && (n = e.getValueAt(n.rowStart, n.colStart, n.scope)) && L.isError(n)) return n;
113
+ if (t = te(t), n = te(n), "string" == typeof t && "string" == typeof n) return r(t, n);
114
+ let i, l;
115
+ if (t?.isIRange ? i = t : n?.isIRange && (l = n), !i && !l) {
116
+ const i = e.getRuntime();
117
+ return t = b(i, t, a(t, !0), $.String, !1), n = b(i, n, a(n, !0), $.String, !1), L.isError(t) ? t : L.isError(n) ? n : r(t, n);
118
+ }
119
+ const s = !i, o = s ? t : n;
120
+ return (i ?? l).broadcast(o, (e, t) => e && L.isError(e) ? e : t && L.isError(t) ? t : s ? r(t, e) : r(e, t), Y);
121
+ })(e, t, n, G),
122
+ "=": (e, t, n) => re(e, t, n, H),
123
+ "<>": (e, t, n) => re(e, t, n, X),
124
+ ">": (e, t, n) => re(e, t, n, K),
125
+ "<": (e, t, n) => re(e, t, n, q),
126
+ ">=": (e, t, n) => re(e, t, n, Z),
127
+ "<=": (e, t, n) => re(e, t, n, Q)
128
+ }, ue = {
129
+ "+": (e, t, n) => ne(e, t, n, M),
130
+ "-": (e, t, n) => ne(e, t, n, W)
131
+ }, ce = {
132
+ "-": (e, t) => le(e, "-", t),
133
+ "+": (e, t) => le(e, "+", t),
134
+ "@": (e, t) => {
135
+ if (!t || !t.isIRange) return t;
136
+ const n = t;
137
+ if (!t.isIReferenceRange) return n.getValueAt(0, 0);
138
+ const r = t.getCoords(), i = n.getRowCount(), l = n.getColumnCount(), s = e.getRow() - r.rowStart, o = e.getColumn() - r.colStart, a = s >= 0 && s < i, u = o >= 0 && o < l;
139
+ return a && u ? n.getValueAt(s, o) : a && 1 === l ? n.getValueAt(s, 0) : u && 1 === i ? n.getValueAt(0, o) : 1 === i && 1 === l ? n.getValueAt(0, 0) : L.BuiltIn.Value;
140
+ }
141
+ }, fe = {
142
+ "%": (e, t) => ne(e, t, 100, _),
143
+ "#": (e, t) => {
144
+ if (L.isError(t)) return se(t);
145
+ if (!t) return L.BuiltIn.Ref;
146
+ if (t.isIReferenceRange && (t = t.getCoords()), void 0 === t.colStart) return L.BuiltIn.Value;
147
+ if (t.rowStart !== t.rowEnd || t.colStart !== t.colEnd) return L.BuiltIn.Ref;
148
+ return e.getSpillAt(t.rowStart, t.colStart, t.scope) || L.BuiltIn.Ref;
149
+ }
150
+ };
151
+ function pe(e, t) {
152
+ for (let n = e.length - 1; n >= 0; n--) if (e[n].type === t) return e[n];
153
+ }
154
+ var de = class {
155
+ constructor() {
156
+ this.referenceIndices = [], this.rootReferences = /* @__PURE__ */ new Set(), this.cells = /* @__PURE__ */ new Map(), this.references = /* @__PURE__ */ new Map(), this.names = /* @__PURE__ */ new Map();
157
+ }
158
+ processNode(e, t) {
159
+ const n = e.type;
160
+ if (e.isReference) {
161
+ const t = {
162
+ node: e,
163
+ index: this.references.size,
164
+ op: null,
165
+ value: null,
166
+ inputs: null
167
+ };
168
+ if (this.references.set(e, t), n === c.Cell) {
169
+ const n = e.value;
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
+ return;
172
+ }
173
+ if (n === c.Infix || n === c.Prefix || n === c.Postfix || n === c.List) {
174
+ const n = e.inputs || [], r = n.length, i = e.value;
175
+ t.op = i;
176
+ const l = R(r);
177
+ t.inputs = l;
178
+ for (let e = 0; e < r; e++) {
179
+ const r = n[e], i = this.references.get(r);
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
+ }
182
+ if (this.rootReferences.add(t), Ke.includes(i)) {
183
+ const r = n[0], i = !!r && r.type === c.Cell, l = n[1], s = !!l && l.type === c.Cell;
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
+ } else "#" === i && n[0] && (e.referenceIndex = n[0].referenceIndex);
186
+ return;
187
+ }
188
+ if (n === c.Error || n === c.Named) {
189
+ const r = n === c.Named ? e.value.nameId : x(e.value);
190
+ let i = this.names.get(r);
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
+ return;
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);
195
+ } else if (t && t.isReference) {
196
+ const t = {
197
+ node: e,
198
+ index: this.references.size,
199
+ op: c.Function,
200
+ value: e.value,
201
+ inputs: null
202
+ };
203
+ this.references.set(e, t);
204
+ }
205
+ }
206
+ };
207
+ function ge(e, t = !1, r = A) {
208
+ const l = [], s = /* @__PURE__ */ new Set(), o = (e, n, r) => {
209
+ const i = {
210
+ type: e.type,
211
+ value: e.type === c.Error ? f(e.value) : e.value
212
+ };
213
+ void 0 !== e.image && (i.text = ((e) => {
214
+ const n = t ? e.value?.scopeImage : void 0;
215
+ return "string" == typeof n ? n : "";
216
+ })(e) + e.image);
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) => {
220
+ if (null == t) return;
221
+ if (l.length > 1 && e === c.Whitespace && l[l.length - 1].type === c.Whitespace) return;
222
+ const s = {
223
+ type: e,
224
+ value: t,
225
+ text: i ?? t
226
+ };
227
+ void 0 !== r && (s.evalIndex = r), n && (s.context = n), l.push(s);
228
+ };
229
+ (function e(u, f, p) {
230
+ const d = u.evalIndex ?? p ?? 0, g = u.type, v = (t, n, i) => {
231
+ if (!t) return;
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);
234
+ };
235
+ if (u.isLiteral) {
236
+ if (a(c.Whitespace, u.wsBefore, f, d), g === c.Array) {
237
+ a(c.Type, "{", f, d);
238
+ const t = u.value, n = t.length;
239
+ for (let i = 0; i < n; i++) {
240
+ const l = t[i], s = l.value, o = s.length;
241
+ for (let t = 0; t < o; t++) {
242
+ const n = s[t];
243
+ a(c.Whitespace, n.wsBefore, f, d), e(n, f, d), a(c.Whitespace, n.wsAfter, f, d), t < o - 1 && a(c.Separator, ",", f, d, r.separatorColumn);
244
+ }
245
+ i < n - 1 && (a(c.Whitespace, l.wsBefore, f, d), a(c.Separator, ";", f, d, r.separatorRow), a(c.Whitespace, l.wsAfter, f, d));
246
+ }
247
+ u.error || a(c.Type, "}", f, d);
248
+ } else g === c.String ? (u = {
249
+ type: g,
250
+ value: "\"" + `${u.value}`.replace(/"/g, "\"\"") + "\"",
251
+ image: u.image
252
+ }, o(u, f, d)) : o(u, f, d);
253
+ a(c.Whitespace, u.wsAfter, f, d);
254
+ } else if (g === c.Infix) e(u.inputs[0], f, d), a(c.Whitespace, u.wsBefore, f, d), o(u, f, d), a(c.Whitespace, u.wsAfter, f, d), e(u.inputs[1], f, d);
255
+ else if (g === c.Prefix) a(c.Whitespace, u.wsBefore, f, d), o(u, f, d), a(c.Whitespace, u.wsAfter, f, d), u.inputs && e(u.inputs[0], f, d);
256
+ else if (g === c.Postfix) {
257
+ u.inputs?.[0] && e(u.inputs[0], f, d), a(c.Whitespace, u.wsBefore, f, d);
258
+ const t = o(u, f, d), 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, f, d);
260
+ } else {
261
+ a(c.Whitespace, u.wsBefore, f, d);
262
+ const p = u.inputs;
263
+ switch (g) {
264
+ case c.Function: {
265
+ const t = String(u.value), n = {
266
+ type: c.Function,
267
+ value: t,
268
+ text: u.image ?? t,
269
+ evalIndex: u.evalIndex
270
+ };
271
+ f && (n.context = f), l.push(n);
272
+ const i = {
273
+ name: t,
274
+ argIndex: -1,
275
+ type: u.binder?.kind ?? "function"
276
+ };
277
+ if (f?.bound && (i.bound = f.bound), a(c.Paren, "(", i, u.evalIndex), p) {
278
+ const t = p.length, n = u.binder?.kind, l = "lambda" === n ? 1 : "let" === n ? 2 : 0;
279
+ let s = i.bound;
280
+ for (let o = 0; o < t; o++) {
281
+ const u = l && o >= l ? p[o - l] : void 0;
282
+ if (u?.binding?.declaration) {
283
+ const e = u.value.nameId, t = "let" === n ? bt(p[o - 1]) : void 0;
284
+ s = It(s, t ? {
285
+ name: e,
286
+ params: t
287
+ } : { name: e });
288
+ }
289
+ const f = {
290
+ ...i,
291
+ argIndex: o
292
+ };
293
+ s && (f.bound = s), e(p[o], f, d), o < t - 1 && a(c.Separator, ",", f, d, r.separatorFunction);
294
+ }
295
+ }
296
+ u.error || a(c.Paren, ")", i, u.evalIndex);
297
+ break;
298
+ }
299
+ case c.Call: {
300
+ const t = i(u), s = l.length;
301
+ if (t && e(t, f, d), 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));
304
+ }
305
+ const o = {
306
+ name: t?.type === c.Named ? t.value.nameId : "",
307
+ argIndex: -1,
308
+ type: "function"
309
+ };
310
+ f?.bound && (o.bound = f.bound), a(c.Paren, "(", o, u.evalIndex);
311
+ const p = n(u), g = p.length;
312
+ for (let t = 0; t < g; t++) {
313
+ const n = {
314
+ ...o,
315
+ argIndex: t
316
+ };
317
+ e(p[t], n, d), t < g - 1 && a(c.Separator, ",", n, d, r.separatorFunction);
318
+ }
319
+ u.error || a(c.Paren, ")", o, u.evalIndex);
320
+ break;
321
+ }
322
+ case c.Cell:
323
+ o(u, f, d);
324
+ break;
325
+ case c.Paren:
326
+ a(g, "(", f, d), v(p, f, d), u.error || a(g, ")", f, d);
327
+ break;
328
+ case c.TableReference: {
329
+ const n = u.value?.tableId ?? "", r = {
330
+ name: n,
331
+ argIndex: -1,
332
+ type: "table"
333
+ }, i = l.length, o = u.image;
334
+ let g, v = !1;
335
+ if (n && o) {
336
+ let e = 0;
337
+ if (91 === o.charCodeAt(0)) {
338
+ const t = o.indexOf("]");
339
+ -1 !== t && 33 === o.charCodeAt(t + 1) && (e = t + 2);
340
+ }
341
+ const n = o.indexOf("[", e);
342
+ if (v = 0 === n && null != p, n > 0) g = o.slice(0, n);
343
+ else if (!p) {
344
+ const e = o.lastIndexOf("!");
345
+ g = t || -1 === e ? o : o.slice(e + 1);
346
+ }
347
+ }
348
+ if (!n || v && t || a(c.TableReference, n, f, d, g), p && a(c.Paren, "[", r, d), p) {
349
+ const t = p.length;
350
+ for (let n = 0; n < t; n++) {
351
+ const i = {
352
+ ...r,
353
+ argIndex: n
354
+ };
355
+ e(p[n], i, d), n < t - 1 && a(c.Separator, ",", i, d);
356
+ }
357
+ }
358
+ p && !u.error && a(c.Paren, "]", r, d);
359
+ const h = u.referenceIndex;
360
+ for (let e = i; e < l.length; e++) void 0 !== h && (l[e].referenceIndex = h), s.add(l[e]);
361
+ break;
362
+ }
363
+ case c.TableSpecifier:
364
+ case c.TableColumn: {
365
+ const e = u.image, t = null != e && e.startsWith("[") && e.endsWith("]");
366
+ t && a(c.Paren, "[", f, d);
367
+ const n = {
368
+ table: "table" === f?.type ? f.name : "",
369
+ name: u.value
370
+ }, r = {
371
+ type: g,
372
+ value: n,
373
+ text: t ? e.slice(1, -1) : e ?? n.name
374
+ };
375
+ void 0 !== d && (r.evalIndex = d), f && (r.context = f), l.push(r), t && a(c.Paren, "]", f, d);
376
+ break;
377
+ }
378
+ case c.List:
379
+ v(p, f, d);
380
+ break;
381
+ case c.Named: {
382
+ const e = o(u, f, d), t = u.value;
383
+ e.value = t.scope ? {
384
+ name: t.nameId,
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;
387
+ break;
388
+ }
389
+ default: void 0 !== u.value && o(u, f, d), p && p.forEach((t) => e(t, f, d));
390
+ }
391
+ a(c.Whitespace, u.wsAfter, f, d);
392
+ }
393
+ })(e);
394
+ const u = /* @__PURE__ */ new Map();
395
+ for (const e of l) if (e.type === c.Cell && void 0 !== e.referenceIndex) {
396
+ const t = u.get(e.referenceIndex);
397
+ t ? t.push(e) : u.set(e.referenceIndex, [e]);
398
+ }
399
+ for (const e of u.values()) 1 === e.length ? e[0].refSide = "self" : (e[0].refSide = "left", e[e.length - 1].refSide = "right");
400
+ const p = /* @__PURE__ */ new Map();
401
+ for (const e of l) if (void 0 !== e.referenceIndex && void 0 !== e.evalIndex) {
402
+ const t = p.get(e.referenceIndex);
403
+ (void 0 === t || e.evalIndex < t) && p.set(e.referenceIndex, e.evalIndex);
404
+ }
405
+ if (p.size > 0) {
406
+ for (const e of l) if (void 0 !== e.referenceIndex) {
407
+ const t = p.get(e.referenceIndex);
408
+ void 0 !== t && (e.evalIndex = t);
409
+ }
410
+ }
411
+ return l;
412
+ }
413
+ function ve(e, n) {
414
+ let r = "";
415
+ for (let i = 0; i < e.length; i++) {
416
+ const l = e[i], s = l.type;
417
+ if (s === c.Cell || s === c.Named || s === c.Error) {
418
+ const e = s === c.Cell ? l.value?.scope : (c.Named, l.value?.scope ?? void 0), i = s === c.Error ? void 0 !== l.text && E(l.text) : l.text?.includes("!") ?? !1;
419
+ if (e && void 0 !== l.text && !i) {
420
+ const i = n?.resolve(t.Sheet, e)?.toString() ?? e;
421
+ r += p(i) + "!" + l.text;
422
+ continue;
423
+ }
424
+ if (s === c.Named) {
425
+ r += l.text ?? l.value?.name ?? "";
426
+ continue;
427
+ }
428
+ }
429
+ if (s === c.Parameter) {
430
+ r += l.text ?? l.value?.name ?? "";
431
+ continue;
432
+ }
433
+ const o = l.text ?? l.value;
434
+ "string" == typeof o && (r += o);
435
+ }
436
+ return r;
437
+ }
438
+ function he(e, t) {
439
+ let n;
440
+ if (h(e, (e) => {
441
+ e.evalIndex === t && (n = e);
442
+ }), !n) return [];
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;
445
+ }
446
+ function me(e) {
447
+ return h(e, (e) => {
448
+ if (e.type !== c.TableReference) return;
449
+ const t = function(e) {
450
+ if (null !== e.value && "object" == typeof e.value) return e.value;
451
+ const t = e.value, n = e.inputs;
452
+ let r = !1, i = !1, l = !1, s = !1, o = null, a = null, u = !1;
453
+ const f = (e) => {
454
+ e?.type === c.TableColumn && (o = e.value, a = e.value);
455
+ };
456
+ if (n) for (const e of n) {
457
+ const t = e.type;
458
+ if (t === c.TableSpecifier) {
459
+ const t = e.value.toUpperCase().trim();
460
+ "#ALL" === t ? i = !0 : "#HEADERS" === t ? l = !0 : "#TOTALS" === t ? s = !0 : "#DATA" === t ? r = !0 : "@" !== t && "#THIS ROW" !== t || (u = !0);
461
+ } else if (t === c.TableColumn) f(e);
462
+ else if (t === c.Infix && ":" === e.value) {
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) {
466
+ u = !0;
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)) : f(t);
469
+ }
470
+ }
471
+ return {
472
+ tableId: t,
473
+ spec: m(i, l, r, s),
474
+ columnFromId: o,
475
+ columnToId: a,
476
+ isThisRow: u
477
+ };
478
+ }(e);
479
+ return {
480
+ ...e,
481
+ value: t
482
+ };
483
+ });
484
+ }
485
+ function ye(t) {
486
+ return h(t, (t) => {
487
+ if (t.type !== c.TableReference) return;
488
+ const n = t.inputs;
489
+ if (!n) return;
490
+ if (-1 === n.findIndex((e) => e.type === c.TableSpecifier && "#THIS ROW" === e.value.toUpperCase().trim())) return;
491
+ const r = [];
492
+ let i;
493
+ for (const e of n) {
494
+ if (e.type === c.TableSpecifier && "#THIS ROW" === e.value.toUpperCase().trim()) continue;
495
+ e.type !== c.TableColumn && (e.type !== c.Infix || ":" !== e.value) || i ? r.push(e) : i = e;
496
+ }
497
+ if (!i) return r.push({
498
+ type: c.Prefix,
499
+ value: "@",
500
+ inputs: null,
501
+ isReference: !0
502
+ }), {
503
+ ...t,
504
+ inputs: r
505
+ };
506
+ const l = i.image ?? i.value, s = l.startsWith("[") && l.endsWith("]") ? {
507
+ ...i,
508
+ image: l.slice(1, -1)
509
+ } : i;
510
+ return r.push(e("@", s, !0)), {
511
+ ...t,
512
+ inputs: r
513
+ };
514
+ });
515
+ }
516
+ function Ie(e) {
517
+ return h(e, (e) => {
518
+ if (e.type !== c.TableReference) return;
519
+ if (0 !== e.inputs?.length || e.error) return;
520
+ const t = e.value;
521
+ return ("string" == typeof t ? t : t?.tableId) ? {
522
+ ...e,
523
+ inputs: null
524
+ } : void 0;
525
+ });
526
+ }
527
+ function be(e) {
528
+ return h(e, (e) => {
529
+ if (e.type !== c.TableReference || !e.inputs) return;
530
+ const t = e.value, n = "string" == typeof t ? t : t?.tableId, r = e.image;
531
+ if (!n || 91 !== r?.charCodeAt(0)) return;
532
+ const i = r.indexOf("]");
533
+ if (-1 !== i && 33 === r.charCodeAt(i + 1)) return;
534
+ const l = { ...e };
535
+ return delete l.image, l;
536
+ });
537
+ }
538
+ var xe = (e) => {
539
+ if (e?.type !== c.TableSpecifier) return 4;
540
+ switch (e.value.toUpperCase().trim()) {
541
+ case "#ALL": return 0;
542
+ case "#HEADERS": return 1;
543
+ case "#DATA": return 2;
544
+ case "#TOTALS": return 3;
545
+ default: return 4;
546
+ }
547
+ };
548
+ function Re(e) {
549
+ return h(e, (e) => {
550
+ if (e.type !== c.TableReference) return;
551
+ const t = e.inputs;
552
+ if (!t || t.length < 2) return;
553
+ const n = t.map((e, t) => ({
554
+ input: e,
555
+ index: t,
556
+ rank: xe(e)
557
+ })).sort((e, t) => e.rank - t.rank || e.index - t.index).map((e) => e.input);
558
+ return n.every((e, n) => e === t[n]) ? void 0 : {
559
+ ...e,
560
+ inputs: n
561
+ };
562
+ });
563
+ }
564
+ function Ee(e) {
565
+ if (!e) return V.EmptyArray;
566
+ let t = V.EmptyArray;
567
+ return h(e, (e) => {
568
+ if (e.type !== c.Named || e.binding) return;
569
+ const n = e.value.nameId;
570
+ n && (t === V.EmptyArray && (t = []), t.includes(n) || t.push(n));
571
+ }), t;
572
+ }
573
+ function Te(e, t) {
574
+ if (!e) return V.EmptyArray;
575
+ let n = V.EmptyArray;
576
+ return h(e, (e, r, i) => {
577
+ if (!e.isReference) return;
578
+ if (r?.isReference) return;
579
+ const l = e.type;
580
+ if (l === c.Named || l === c.Error || l === c.TableReference) return;
581
+ if (pe(i, c.TableReference)) return;
582
+ const s = function(e) {
583
+ let t = e;
584
+ for (; t;) {
585
+ if (void 0 !== t.referenceIndex) return t.referenceIndex;
586
+ if (!t.isReference) return;
587
+ t = t.inputs?.[0];
588
+ }
589
+ }(e);
590
+ void 0 !== s && function(e, t, n) {
591
+ let r = e;
592
+ for (let e = t.length - 1; e >= 0; e--) {
593
+ const i = t[e];
594
+ if (i.type === c.Paren || i.isReference) {
595
+ r = i;
596
+ continue;
597
+ }
598
+ if (i.type !== c.Function) return !0;
599
+ const l = n?.(String(i.value));
600
+ if (!l) return !0;
601
+ const s = i.inputs ? i.inputs.indexOf(r) : -1;
602
+ return "p" !== (s >= 0 ? Oe(l.getDeclaration().getParameters(), s) : null)?.getRangeType();
603
+ }
604
+ return !0;
605
+ }(e, i, t) && (n === V.EmptyArray && (n = []), n.includes(s) || n.push(s));
606
+ }), n.length > 1 && n.sort((e, t) => e - t), n;
607
+ }
608
+ var Ae = /* @__PURE__ */ new Set(["SUBTOTAL", "AGGREGATE"]);
609
+ function Se(e, t) {
610
+ if (!e || !t) return !1;
611
+ let n = !1;
612
+ return h(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;
617
+ }
618
+ function we(e, t) {
619
+ if (!e || !t) return !1;
620
+ let n = !1;
621
+ return h(e, (e) => {
622
+ n || e.type !== c.Function || "TABLE" === t(e.value)?.getName().toUpperCase() && (n = !0);
623
+ }), n;
624
+ }
625
+ function Ce(e, t) {
626
+ if (!e || !t) return !1;
627
+ let n = !1;
628
+ return h(e, (e) => {
629
+ n || e.type !== c.Function || !0 === t(e.value)?.getDeclaration().getReturnType()?.isVolatile() && (n = !0);
630
+ }), n;
631
+ }
632
+ var Ne = Object.freeze({
633
+ value: !1,
634
+ array: !1
635
+ }), Fe = (e, t) => {
636
+ const n = function(e, t) {
637
+ if (!e || !t) return Ne;
638
+ let n = !1, r = !1;
639
+ return h(e, (e) => {
640
+ if (n) return;
641
+ 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;
646
+ if (void 0 !== e.binder) return;
647
+ const l = t(e.value);
648
+ if (!l) return void (n = !0);
649
+ if (r || !0 !== e.implicitIntersect) return;
650
+ const s = l.getDeclaration().getParameters(), o = e.inputs;
651
+ 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);
654
+ }
655
+ }), {
656
+ value: !n && !r,
657
+ array: !n
658
+ };
659
+ }(e, t);
660
+ return {
661
+ isBlankCacheable: n.value,
662
+ isBlankCacheableArray: n.array
663
+ };
664
+ }, Pe = (e, t) => {
665
+ const n = e.length;
666
+ if (0 === n) return null;
667
+ if (t < n - 1) return e[t];
668
+ const r = e[n - 1], i = r.getRepeatingTypes();
669
+ return i && 0 !== i.length ? i[(t - (n - 1)) % i.length] : t < n ? e[t] : r.isRest() ? r : null;
670
+ };
671
+ function Le(e) {
672
+ if (!e) return V.EmptyArray;
673
+ let t = V.EmptyArray;
674
+ const n = (e) => {
675
+ e && (t === V.EmptyArray && (t = []), t.includes(e) || t.push(e));
676
+ }, r = (e) => {
677
+ "string" == typeof e && n(s(e)?.bookId);
678
+ };
679
+ return h(e, (e) => {
680
+ if (e.type === c.Named) {
681
+ if (e.binding) return;
682
+ const t = e.value;
683
+ n(t.nameId), r(t.scope);
684
+ } else if (e.type === c.TableReference) {
685
+ const t = e.value;
686
+ n("string" == typeof t ? t : t?.tableId);
687
+ } else if (e.type === c.Cell) {
688
+ const t = e.value?.scope;
689
+ r(t), N(t) && n(t);
690
+ } else e.type === c.Error && r(e.value?.scope);
691
+ }), t;
692
+ }
693
+ var ke = (e, t) => {
694
+ if (!0 === e.lazyArg) return !0;
695
+ if ("lambda" !== t?.binder?.kind) return !1;
696
+ const n = t.inputs;
697
+ return n[n.length - 1] === e;
698
+ }, $e = /* @__PURE__ */ new Set([
699
+ "IF",
700
+ "IFS",
701
+ "SWITCH",
702
+ "CHOOSE",
703
+ "IFERROR",
704
+ "IFNA"
705
+ ]), Oe = (e, t) => {
706
+ const n = e.length;
707
+ if (0 === n) return null;
708
+ if (t < n) return e[t];
709
+ const r = e[n - 1];
710
+ if (!r.isRest()) return null;
711
+ const i = r.getRepeatingTypes();
712
+ 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) => {
714
+ if (!e) return !1;
715
+ const n = e.inputs;
716
+ 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: {
726
+ if (void 0 !== e.binder) return !1;
727
+ const r = String(e.value).toUpperCase();
728
+ if ($e.has(r)) {
729
+ if (!n) return !1;
730
+ for (let e = 0; e < n.length; e++) if (ze(n[e], t)) return !0;
731
+ return !1;
732
+ }
733
+ const i = t?.(e.value);
734
+ return !!i && i.getDeclaration().getReturnType().getKind() === O.Reference;
735
+ }
736
+ default: return !1;
737
+ }
738
+ }, De = (e, t) => {
739
+ if (!e) return !1;
740
+ for (let n = 0; n < e.length; n++) if (Me(e[n], t)) return !0;
741
+ return !1;
742
+ };
743
+ function Me(e, t) {
744
+ if (!e) return !1;
745
+ if (void 0 !== e.arrayValued) return e.arrayValued;
746
+ let n;
747
+ const r = e.type, i = e.inputs;
748
+ switch (r) {
749
+ case c.Array:
750
+ n = !0;
751
+ break;
752
+ case c.Cell: {
753
+ const t = e.value;
754
+ n = t.rowIndex === Number.MIN_SAFE_INTEGER || t.colIndex === Number.MIN_SAFE_INTEGER;
755
+ break;
756
+ }
757
+ case c.Named:
758
+ case c.Call:
759
+ case c.TableReference:
760
+ n = !0;
761
+ break;
762
+ case c.Infix:
763
+ case c.Prefix:
764
+ case c.Postfix:
765
+ n = e.isReference ? "@" !== e.value : De(i, t);
766
+ break;
767
+ case c.Paren:
768
+ case c.List:
769
+ n = !i || 1 !== i.length || Me(i[0], t);
770
+ break;
771
+ case c.Function: {
772
+ const r = e.binder;
773
+ if (void 0 !== r) {
774
+ n = "lambda" === r.kind || !!i && Me(i[i.length - 1], t);
775
+ break;
776
+ }
777
+ const l = String(e.value).toUpperCase();
778
+ if ($e.has(l)) {
779
+ n = De(i, t);
780
+ break;
781
+ }
782
+ if ("INDEX" === l) {
783
+ if (n = !1, i) for (let e = 1; e < i.length; e++) {
784
+ const r = i[e];
785
+ if (!r || r.type === c.Empty || r.isLiteral && 0 === r.value || Me(r, t)) {
786
+ n = !0;
787
+ break;
788
+ }
789
+ }
790
+ break;
791
+ }
792
+ const s = t?.(e.value);
793
+ if (!s) {
794
+ n = !0;
795
+ break;
796
+ }
797
+ const o = s.getDeclaration().getReturnType(), a = o.getKind();
798
+ n = a === O.Array || a === O.Reference || null === a && null !== o.getRangeType();
799
+ break;
800
+ }
801
+ default: n = !1;
802
+ }
803
+ return e.arrayValued = n, n;
804
+ }
805
+ function We(e, t) {
806
+ if (void 0 !== e.firstCell) return;
807
+ const n = (e, r) => {
808
+ if (!e) return;
809
+ e.firstCell = r;
810
+ const i = e.inputs;
811
+ if (!i) return;
812
+ const l = e.type;
813
+ if (l === c.Infix || l === c.Prefix || l === c.Postfix) {
814
+ const t = r && !e.isReference;
815
+ for (let e = 0; e < i.length; e++) n(i[e], t);
816
+ return;
817
+ }
818
+ if (l === c.Paren || l === c.List) {
819
+ const e = r && 1 === i.length;
820
+ for (let t = 0; t < i.length; t++) n(i[t], e);
821
+ return;
822
+ }
823
+ if (l === c.Function) {
824
+ const l = e.binder;
825
+ if (void 0 !== l) {
826
+ const e = i.length - 1;
827
+ for (let t = 0; t < i.length; t++) n(i[t], r && "let" === l.kind && t === e);
828
+ return;
829
+ }
830
+ const s = r ? t?.(e.value)?.getDeclaration().getParameters() : null;
831
+ 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)));
834
+ }
835
+ return;
836
+ }
837
+ for (let e = 0; e < i.length; e++) n(i[e], !1);
838
+ };
839
+ n(e, !0);
840
+ }
841
+ var Ue = /* @__PURE__ */ new Set([
842
+ "=",
843
+ "<>",
844
+ "<",
845
+ ">",
846
+ "<=",
847
+ ">="
848
+ ]), _e = /* @__PURE__ */ new Set(["ROW", "COLUMN"]);
849
+ function je(e, t) {
850
+ if (!e || !t) return null;
851
+ const n = (e) => t(e.value)?.getName().toUpperCase() ?? null;
852
+ let r = !1;
853
+ if (h(e, (e) => {
854
+ (e.hasLazyArgs || e.type === c.Call || void 0 !== e.binder) && (r = !0);
855
+ }), r) return null;
856
+ const i = (e) => e.type === c.Number, l = (e) => e.type === c.Number || e.type === c.String || e.type === c.Boolean, s = (e) => {
857
+ if (!e) return !1;
858
+ const t = e.inputs;
859
+ switch (e.type) {
860
+ case c.Paren: return 1 === t?.length && s(t[0]);
861
+ case c.Prefix: return ("-" === e.value || "+" === e.value) && s(t?.[0]);
862
+ case c.Infix: {
863
+ if ("+" !== e.value && "-" !== e.value && "*" !== e.value) return !1;
864
+ const [n, r] = t ?? [];
865
+ return !(!n || !r) && (s(n) && (s(r) || i(r)) || i(n) && s(r));
866
+ }
867
+ case c.Function: {
868
+ const r = n(e);
869
+ if (null !== r && _e.has(r)) return !t || 0 === t.length || 1 === t.length && t[0]?.type === c.Cell;
870
+ if ("MOD" === r && 2 === t?.length) {
871
+ const e = t[1];
872
+ return s(t[0]) && i(e) && 0 !== e.value;
873
+ }
874
+ return !1;
875
+ }
876
+ }
877
+ return !1;
878
+ }, o = (e) => {
879
+ if (!e) return !1;
880
+ const t = e.inputs;
881
+ switch (e.type) {
882
+ case c.Paren: return 1 === t?.length && o(t[0]);
883
+ case c.Infix: {
884
+ if (!Ue.has(e.value)) return !1;
885
+ const [n, r] = t ?? [];
886
+ return !(!n || !r) && (s(n) && (s(r) || l(r)) || l(n) && s(r));
887
+ }
888
+ case c.Function: {
889
+ const r = n(e);
890
+ if (!t || 0 === t.length) return !1;
891
+ if ("ISODD" === r || "ISEVEN" === r) return 1 === t.length && s(t[0]);
892
+ if ("NOT" === r) return 1 === t.length && o(t[0]);
893
+ if ("AND" === r || "OR" === r || "XOR" === r) {
894
+ let e = !1;
895
+ for (let n = 0; n < t.length; n++) {
896
+ const r = t[n];
897
+ if (!r) return !1;
898
+ if (r.type !== c.Boolean) {
899
+ if (!o(r)) return !1;
900
+ e = !0;
901
+ }
902
+ }
903
+ return e;
904
+ }
905
+ return !1;
906
+ }
907
+ }
908
+ return !1;
909
+ }, a = [], u = (e) => {
910
+ if (!e) return;
911
+ if (o(e)) return void a.push(e);
912
+ const t = e.inputs;
913
+ if (t) for (let e = 0; e < t.length; e++) u(t[e]);
914
+ };
915
+ u(e);
916
+ const f = a.length;
917
+ if (0 === f || f > 4) return null;
918
+ const p = [];
919
+ for (let t = 0; t < 1 << f; t++) {
920
+ const n = (e) => {
921
+ const r = a.indexOf(e);
922
+ if (-1 !== r) return F(t & 1 << r ? "TRUE" : "FALSE");
923
+ const i = { ...e };
924
+ return delete i.evalIndex, delete i.firstCell, delete i.inLazy, delete i.lazyArg, delete i.hasLazyArgs, delete i.deferred, e.inputs && (i.inputs = e.inputs.map((e) => e ? n(e) : e)), i;
925
+ };
926
+ p.push(n(e));
927
+ }
928
+ return p;
929
+ }
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) {
932
+ let s, o, a = n;
933
+ a = me(a), r || (a = ye(a), a = Re(a), a = Ie(a), a = be(a)), [s, o] = function(e) {
934
+ const t = /* @__PURE__ */ new Map();
935
+ let n = 0;
936
+ const r = [e];
937
+ for (; r.length > 0;) {
938
+ const e = r.shift();
939
+ if (t.set(e, {
940
+ ...e,
941
+ evalIndex: n++
942
+ }), e && e.inputs) for (const t of e.inputs) r.push(t);
943
+ }
944
+ return t.forEach((e, n) => {
945
+ n && n.inputs && (e.inputs = n.inputs.map((e) => t.get(e) ?? e));
946
+ }), [t.get(e), n];
947
+ }(a);
948
+ const u = R(o), f = [], p = [], d = new de();
949
+ let g, v = !1;
950
+ (function(e, t) {
951
+ if (!e || !t) return;
952
+ const n = (e) => {
953
+ if (!e) return;
954
+ e.inLazy = !0, e.type === c.Named && (e.deferredResolve = !0);
955
+ const t = e.inputs;
956
+ if (t) for (let e = 0; e < t.length; e++) n(t[e]);
957
+ };
958
+ h(e, (e) => {
959
+ if (e.type !== c.Function) return;
960
+ if (void 0 !== e.binder) return;
961
+ const r = e.inputs;
962
+ if (!r || 0 === r.length) return;
963
+ const i = t(e.value)?.getDeclaration().getParameters();
964
+ if (i) for (let t = 0; t < r.length; t++) {
965
+ const l = r[t];
966
+ l && l.type !== c.Empty && Pe(i, t)?.isLazy() && (l.lazyArg = !0, e.hasLazyArgs = !0, n(l));
967
+ }
968
+ });
969
+ })(s, l);
970
+ const m = (e) => {
971
+ void 0 === g && (g = /* @__PURE__ */ new Map());
972
+ let t = g.get(e);
973
+ return void 0 === t && g.set(e, t = []), t;
974
+ }, b = (e, t) => {
975
+ void 0 === e ? f.push(t) : m(e).push(t);
976
+ }, E = (e) => {
977
+ e?.type !== c.Infix || "+" !== e.value && "-" !== e.value || (e.snapsCancellation = !0);
978
+ };
979
+ s = h(s, (t, n, r) => {
980
+ 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 (v = v || !Ye(t), t.binding?.declaration) return p[t.binding.slot] = -1, void (u[l] = void 0);
983
+ 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];
986
+ })(t, n, r);
987
+ s === t && m(t), void 0 !== s && i === c.Named && (t.deferredResolve = !0);
988
+ const o = t.binder;
989
+ if (o && "let" === o.kind) {
990
+ const e = t.inputs, n = e?.length ?? 0;
991
+ let r = 0;
992
+ for (let t = 0; t + 1 < n && r < o.slots.length; t += 2) e[t]?.binding?.declaration && (p[o.slots[r++]] = e[t + 1]?.evalIndex ?? -1);
993
+ }
994
+ if ((t.isReference || n && n.isReference) && (d.processNode(t, n), t.isReference)) {
995
+ if (i === c.Named) return void (void 0 !== s && b(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 b(s, t);
998
+ }
999
+ if (t.isLiteral) if (i !== c.Array) u[l] = t.value;
1000
+ else {
1001
+ const n = t.value, r = n.length, i = R(r);
1002
+ for (let e = 0; e < r; e++) {
1003
+ const t = n[e].value, r = t.length, l = R(r);
1004
+ for (let e = 0; e < r; e++) {
1005
+ const n = t[e];
1006
+ let r = null;
1007
+ if (n && (r = n.type === c.Error ? x(n.value) : n.value, n.type === c.Prefix)) {
1008
+ const e = n.value;
1009
+ r = n.inputs[0].value, "-" === e && (r = -r);
1010
+ }
1011
+ l[e] = r;
1012
+ }
1013
+ i[e] = l;
1014
+ }
1015
+ const s = I(i);
1016
+ u[l] = new y(e, s.values, s.coords, void 0, s.isLiteral);
1017
+ }
1018
+ else {
1019
+ if (i !== c.Empty) return "lambda" === t.binder?.kind && E(t.inputs[t.inputs.length - 1]), b(s, t), t;
1020
+ u[l] = void 0;
1021
+ }
1022
+ }), E(s), g?.forEach((e, t) => {
1023
+ t.deferred = e;
1024
+ });
1025
+ const T = R(d.cells.size);
1026
+ d.cells.forEach((e, t) => {
1027
+ const n = t.value, r = n.colIndex, i = n.rowIndex, l = n.$colIndex, s = n.$rowIndex, o = {
1028
+ colStart: r,
1029
+ rowStart: i,
1030
+ colEnd: r,
1031
+ rowEnd: i,
1032
+ $colStart: l,
1033
+ $rowStart: s,
1034
+ $colEnd: l,
1035
+ $rowEnd: s
1036
+ };
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), T[e] = o;
1038
+ });
1039
+ const S = T.length, w = R(S);
1040
+ for (let e = 0; e < S; e++) w[e] = {
1041
+ colStart: 0,
1042
+ rowStart: 0,
1043
+ colEnd: 0,
1044
+ rowEnd: 0,
1045
+ scope: null
1046
+ };
1047
+ const N = R(d.references.size);
1048
+ d.references.forEach((e) => {
1049
+ N[e.index] = e;
1050
+ });
1051
+ const F = [];
1052
+ d.rootReferences.forEach((e) => {
1053
+ F.push(e.index);
1054
+ }), function(e, t, n = !1) {
1055
+ if (n) {
1056
+ const t = (e) => {
1057
+ if (!e) return;
1058
+ const n = e.type;
1059
+ n !== c.Function && n !== c.Call || (e.implicitIntersect = !0);
1060
+ const r = e.inputs;
1061
+ if (r) for (let e = 0; e < r.length; e++) t(r[e]);
1062
+ };
1063
+ t(e);
1064
+ return;
1065
+ }
1066
+ const r = (e) => Me(e, t), i = (e, n) => {
1067
+ if (!e) return;
1068
+ const l = e.type;
1069
+ l !== c.Function && l !== c.Call || (e.implicitIntersect = n);
1070
+ const s = e.inputs;
1071
+ if (s) {
1072
+ if (l === c.Infix || l === c.Prefix || l === c.Postfix) {
1073
+ const t = !e.isReference;
1074
+ for (let e = 0; e < s.length; e++) i(s[e], (!t || !r(s[e])) && n);
1075
+ return;
1076
+ }
1077
+ if (l === c.Function) {
1078
+ const r = e.binder;
1079
+ if (void 0 !== r) {
1080
+ const e = "lambda" !== r.kind && n;
1081
+ for (let t = 0; t < s.length; t++) i(s[t], e);
1082
+ return;
1083
+ }
1084
+ const l = t?.(e.value)?.getDeclaration().getParameters();
1085
+ let o = !1;
1086
+ if (l) for (let e = 0; e < s.length && !o; e++) {
1087
+ const n = s[e];
1088
+ if (!n) continue;
1089
+ const r = Oe(l, e);
1090
+ r && Ve(r, n, t) && (o = !0);
1091
+ }
1092
+ o && (e.implicitIntersect = !1);
1093
+ for (let e = 0; e < s.length; e++) i(s[e], !o && n);
1094
+ return;
1095
+ }
1096
+ for (let e = 0; e < s.length; e++) i(s[e], n);
1097
+ }
1098
+ };
1099
+ i(e, !r(e));
1100
+ }(s, l, !0 === n.legacyIntersect);
1101
+ const L = (e) => {
1102
+ const t = e.length;
1103
+ for (let n = 0; n < t; n++) {
1104
+ const t = e[n], r = t.type;
1105
+ if (r === c.Infix) {
1106
+ if (!0 === t.snapsCancellation) {
1107
+ t.fn = ue[t.value];
1108
+ continue;
1109
+ }
1110
+ 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];
1113
+ }
1114
+ };
1115
+ let k;
1116
+ L(f), g?.forEach(L);
1117
+ const $ = r ? C(P(e.getLocale()).decimal) : A, O = {
1118
+ runtime: e,
1119
+ symbols: t,
1120
+ getFunction: l,
1121
+ ast: s,
1122
+ evaluations: u,
1123
+ executions: f,
1124
+ bindings: p,
1125
+ referencesAbsolute: w,
1126
+ referencesExecute: N,
1127
+ referencesRelative: T,
1128
+ referencesRoot: F,
1129
+ referenceIndices: d.referenceIndices,
1130
+ formatReferenceIndices: Te(s, l),
1131
+ getTokens: () => k ??= ge(s, r, $),
1132
+ 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: !v,
1139
+ error: i,
1140
+ transform: (n) => {
1141
+ let o = h(s, n);
1142
+ return o === s ? O : He(e, t, o, r, i, l);
1143
+ }
1144
+ };
1145
+ return O;
1146
+ }
1147
+ function Xe(e) {
1148
+ let t = -1, n = -1;
1149
+ 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
+ line: t,
1151
+ column: n
1152
+ }, new L.Parse(e.message, {
1153
+ line: t,
1154
+ column: n,
1155
+ cause: e
1156
+ })) : new L.Parse(e.message, { cause: e });
1157
+ }
1158
+ Object.freeze([
1159
+ [
1160
+ ":",
1161
+ ".:.",
1162
+ ".:",
1163
+ ":."
1164
+ ],
1165
+ ["^"],
1166
+ ["*", "/"],
1167
+ ["+", "-"],
1168
+ ["&"],
1169
+ [
1170
+ "<",
1171
+ ">",
1172
+ "=",
1173
+ "<>",
1174
+ "<=",
1175
+ ">="
1176
+ ]
1177
+ ]);
1178
+ var Ke = Object.freeze([
1179
+ ":",
1180
+ ".:.",
1181
+ ".:",
1182
+ ":."
1183
+ ]), Ze = Object.freeze([
1184
+ ":",
1185
+ " ",
1186
+ ".:.",
1187
+ ".:",
1188
+ ":."
1189
+ ]), qe = Object.freeze(["@"]), Qe = Object.freeze(["#"]), Je = Object.freeze(Ze.concat(Qe)), Ye = (Object.freeze(Ze.concat(qe).concat(Qe)), (e) => {
1190
+ if (!e) return !1;
1191
+ 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 (!Ze.includes(e.value)) return !1;
1196
+ const t = e.inputs, n = t[0], r = t[1];
1197
+ return Ye(n) && Ye(r);
1198
+ }
1199
+ return t === c.List && (e.inputs?.every(Ye) ?? !1);
1200
+ }), et = (e) => !!e && (!(e.type !== c.Infix || !Je.includes(e.value)) || !(e.type !== c.Postfix || !Qe.includes(e.value)) || e.type === c.Array || e.type === c.TableReference), tt = Object.freeze([
1201
+ "+",
1202
+ "-",
1203
+ "*",
1204
+ "/",
1205
+ "^",
1206
+ "&",
1207
+ "=",
1208
+ "<>",
1209
+ ">",
1210
+ "<",
1211
+ ">=",
1212
+ "<="
1213
+ ]), nt = Object.freeze(["-", "+"]), rt = (e, t) => {
1214
+ if (!e) return !1;
1215
+ const n = e.type;
1216
+ if (e.isLiteral) return n !== c.Error;
1217
+ if (n === c.Paren || n === c.List) {
1218
+ const n = e.inputs;
1219
+ return !(!n || 0 === n.length) && n.every((e) => rt(e, t));
1220
+ }
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 (!t) return !1;
1226
+ const n = t(e.value);
1227
+ if (!n) return !1;
1228
+ const r = n.getDeclaration().getReturnType(), i = r.getRangeType();
1229
+ return "p" !== i && (null !== i || null === r.getLambda() && null != r.getScalarType());
1230
+ }
1231
+ return !1;
1232
+ }, it = (e, t) => {
1233
+ if (!e) return null;
1234
+ let n = null;
1235
+ const r = (e) => {
1236
+ if (n || !e) return;
1237
+ if (e.type === c.Infix && " " === e.value) {
1238
+ 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);
1241
+ }
1242
+ const i = e.inputs;
1243
+ if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1244
+ };
1245
+ return r(e), n;
1246
+ }, lt = (e, t) => {
1247
+ if (!e) return null;
1248
+ let n = null;
1249
+ const r = (e) => {
1250
+ if (n || !e) return;
1251
+ if (e.type === c.Postfix && "#" === e.value) {
1252
+ const r = e.inputs?.[0];
1253
+ if (r && rt(r, t)) return void (n = r);
1254
+ }
1255
+ const i = e.inputs;
1256
+ if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1257
+ };
1258
+ return r(e), n;
1259
+ }, st = (e) => {
1260
+ for (let t = 0; t < e.length; t++) if (e[t].getRepeatingTypes()) return t;
1261
+ return -1;
1262
+ }, ot = (e, t, n) => {
1263
+ const r = e[t].getRepeatingTypes(), i = r.length, l = t, s = e.length - t - 1;
1264
+ let o = s;
1265
+ for (; o > 0 && e[t + o].isOptional();) o--;
1266
+ const a = e[t].isOptional() ? 0 : 1, u = r[i - 1].isOptional();
1267
+ for (let e = o; e <= s; e++) {
1268
+ const t = n - l - e;
1269
+ if (t >= 0 && t % i === 0 && t / i >= a) return {
1270
+ n: t / i,
1271
+ short: !1,
1272
+ variable: t,
1273
+ period: i,
1274
+ prefix: l,
1275
+ suffix: e
1276
+ };
1277
+ if (u && t === i - 1) return {
1278
+ n: 1,
1279
+ short: !0,
1280
+ variable: t,
1281
+ period: i,
1282
+ prefix: l,
1283
+ suffix: e
1284
+ };
1285
+ }
1286
+ return null;
1287
+ }, at = (e) => {
1288
+ if (!e) return null;
1289
+ let t = null;
1290
+ const n = (e) => {
1291
+ if (t || !e) return;
1292
+ if (e.type === c.Array && Array.isArray(e.value)) {
1293
+ const n = e.value, r = (n[0]?.value)?.length ?? 0;
1294
+ for (let e = 1; e < n.length && !t; e++) {
1295
+ const i = (n[e]?.value)?.length ?? 0;
1296
+ i !== r && (t = `Array rows must all be the same length — row ${e + 1} has ${i} value${1 === i ? "" : "s"}, but row 1 has ${r}.`);
1297
+ }
1298
+ }
1299
+ const r = e.inputs;
1300
+ if (r) for (let e = 0; e < r.length && !t; e++) n(r[e]);
1301
+ };
1302
+ return n(e), t;
1303
+ }, ut = (e, t) => {
1304
+ if (!e || !t) return null;
1305
+ let n = null;
1306
+ const r = (e) => {
1307
+ if (n || !e) return;
1308
+ if (e.type === c.Function) {
1309
+ const r = e.value, i = t(r);
1310
+ if (i) {
1311
+ const t = i.getDeclaration(), l = t.getParameters(), s = e.inputs?.length ?? 0, o = t.getMaxArguments();
1312
+ 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();
1314
+ if (a >= 0) {
1315
+ if (!ot(l, a, s)) {
1316
+ const e = l[a].getRepeatingTypes().length, t = l.length - 1;
1317
+ 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
+ }
1319
+ } else if (!u && s > l.length) n = `Too many arguments for ${r}. Expected ${l.length}, but got ${s}.`;
1320
+ else for (let e = s; e < l.length && !n; e++) {
1321
+ const t = l[e];
1322
+ t.isOptional() || t.isRest() || (n = `Parameter ${t.getName()} is missing for ${r}.`);
1323
+ }
1324
+ }
1325
+ }
1326
+ const i = e.inputs;
1327
+ if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1328
+ };
1329
+ return r(e), n;
1330
+ }, ct = (e, t) => {
1331
+ if (!e || !t) return null;
1332
+ let n = null;
1333
+ const r = (e) => {
1334
+ if (n || !e) return;
1335
+ if (e.type === c.Function) {
1336
+ const r = t(e.value);
1337
+ if (r) {
1338
+ const i = r.getDeclaration().getParameters(), l = e.inputs;
1339
+ if (i.length > 0 && l) {
1340
+ const e = ((e, t) => {
1341
+ const n = new Array(t), r = e.length, i = r > 0 ? st(e) : -1;
1342
+ if (i < 0) {
1343
+ const i = r > 0 ? e[r - 1] : null, l = !!i && i.isRest();
1344
+ for (let s = 0; s < t; s++) n[s] = s < r ? e[s] : l ? i : null;
1345
+ return n;
1346
+ }
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);
1348
+ for (let a = 0; a < t; a++) if (a < o) n[a] = e[a];
1349
+ else if (a < o + c) n[a] = l[(a - o) % s];
1350
+ else {
1351
+ const t = i + 1 + (a - o - c);
1352
+ n[a] = t < r ? e[t] : null;
1353
+ }
1354
+ return n;
1355
+ })(i, l.length);
1356
+ for (let r = 0; r < l.length && !n; r++) {
1357
+ const i = e[r];
1358
+ i && "p" === i.getRangeType() && rt(l[r], t) && (n = l[r]);
1359
+ }
1360
+ }
1361
+ }
1362
+ }
1363
+ const i = e.inputs;
1364
+ if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1365
+ };
1366
+ return r(e), n;
1367
+ }, ft = (e, t) => {
1368
+ if (!e) return null;
1369
+ let n = null;
1370
+ const r = (e) => {
1371
+ if (n || !e) return;
1372
+ if (e.type === c.Call) {
1373
+ 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.");
1375
+ }
1376
+ const i = e.inputs;
1377
+ if (i) for (let e = 0; e < i.length && !n; e++) r(i[e]);
1378
+ };
1379
+ return r(e), n;
1380
+ }, pt = (e, t) => {
1381
+ if (e.type !== c.Function) return;
1382
+ const n = e.value;
1383
+ if ("string" != typeof n) return;
1384
+ const r = (t?.(n)?.getName() ?? n).toUpperCase();
1385
+ return "LET" === r ? "let" : "LAMBDA" === r ? "lambda" : void 0;
1386
+ }, dt = (e) => {
1387
+ if (e?.type !== c.Named) return;
1388
+ const t = e.value;
1389
+ 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) {
1392
+ const t = e.value;
1393
+ if (!0 !== t?.optional || !t.nameId || t.scope) return;
1394
+ return t.nameId;
1395
+ }
1396
+ if (e?.type !== c.TableReference) return;
1397
+ const t = e.value;
1398
+ let n;
1399
+ if (null === t || "string" == typeof t) {
1400
+ if (t) return;
1401
+ const r = e.inputs;
1402
+ if (!r || 1 !== r.length || r[0]?.type !== c.TableColumn) return;
1403
+ const i = r[0].value;
1404
+ if ("string" != typeof i) return;
1405
+ n = i;
1406
+ } else {
1407
+ const e = t;
1408
+ if (!e || "" !== e.tableId || 0 !== e.spec || !0 === e.isThisRow) return;
1409
+ if (!e.columnFromId || e.columnFromId !== e.columnToId) return;
1410
+ n = e.columnFromId;
1411
+ }
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);
1415
+ t.image = e.image ?? e.value, t.wsBefore = e.wsBefore;
1416
+ const n = {
1417
+ type: c.Call,
1418
+ value: null,
1419
+ inputs: [t, ...e.inputs ?? []],
1420
+ wsAfter: e.wsAfter
1421
+ };
1422
+ return e.error && (n.error = e.error), n;
1423
+ };
1424
+ function yt(e, t) {
1425
+ return e && t ? h(e, (e) => {
1426
+ if (e.type === c.Function && "string" == typeof e.value && !t(e.value)) return mt(e);
1427
+ }) : e;
1428
+ }
1429
+ function It(e, t) {
1430
+ const n = t.name.toUpperCase(), r = e ? e.filter((e) => e.name.toUpperCase() !== n) : [];
1431
+ return r.push(t), r;
1432
+ }
1433
+ function bt(e) {
1434
+ if (e?.type !== c.Function || "lambda" !== e.binder?.kind) return;
1435
+ const t = e.inputs ?? [], n = [];
1436
+ for (let e = 0; e < t.length - 1; e++) {
1437
+ const r = t[e];
1438
+ if (!r?.binding?.declaration) return;
1439
+ const i = r.value.nameId;
1440
+ n.push(r.binding.optional ? {
1441
+ name: i,
1442
+ optional: !0
1443
+ } : { name: i });
1444
+ }
1445
+ return n;
1446
+ }
1447
+ var xt = /* @__PURE__ */ new Set([
1448
+ "IF",
1449
+ "IFERROR",
1450
+ "IFNA"
1451
+ ]);
1452
+ function Rt(e, t) {
1453
+ if (!e || e.type !== c.Function || "string" != typeof e.value) return e;
1454
+ const n = (t?.(e.value)?.getName() ?? e.value).toUpperCase();
1455
+ if (!xt.has(n)) return e;
1456
+ const r = e.inputs;
1457
+ let i;
1458
+ if (r) for (let e = 0; e < r.length; e++) {
1459
+ const n = Rt(r[e], t);
1460
+ n !== r[e] && ((i ??= [...r])[e] = n);
1461
+ }
1462
+ return {
1463
+ ...e,
1464
+ inputs: i ?? r,
1465
+ passOmitted: !0
1466
+ };
1467
+ }
1468
+ function Et(e, t = null) {
1469
+ if (!e) return e;
1470
+ const n = [];
1471
+ let r = 0;
1472
+ const i = (e) => {
1473
+ const t = e.inputs;
1474
+ if (!t) return e;
1475
+ let n;
1476
+ for (let e = 0; e < t.length; e++) {
1477
+ const r = t[e];
1478
+ if (!r) continue;
1479
+ const i = l(r);
1480
+ i !== r && (n || (n = [...t]), n[e] = i);
1481
+ }
1482
+ return n ? {
1483
+ ...e,
1484
+ inputs: n
1485
+ } : e;
1486
+ }, l = (e) => {
1487
+ if (!e) return e;
1488
+ const s = pt(e, t);
1489
+ if (s) return ((e, s) => {
1490
+ const o = e.inputs, a = o?.length ?? 0;
1491
+ if (!o || a < 1) return i(e);
1492
+ const u = n.length, f = [], p = [...o], d = (e, t = !1) => {
1493
+ const i = p[e];
1494
+ let l = dt(i), s = !1;
1495
+ if (void 0 === l && t) {
1496
+ if (l = ht(i), void 0 === l) return;
1497
+ s = !0;
1498
+ } else if (void 0 === l) return;
1499
+ const o = r++;
1500
+ n.push({
1501
+ key: l.toUpperCase(),
1502
+ slot: o,
1503
+ name: l
1504
+ }), f.push(o), p[e] = s ? {
1505
+ ...i,
1506
+ type: c.Named,
1507
+ value: {
1508
+ nameId: l,
1509
+ scope: null
1510
+ },
1511
+ inputs: null,
1512
+ binding: {
1513
+ slot: o,
1514
+ declaration: !0,
1515
+ optional: !0
1516
+ },
1517
+ isReference: !1
1518
+ } : {
1519
+ ...i,
1520
+ binding: {
1521
+ slot: o,
1522
+ declaration: !0
1523
+ },
1524
+ isReference: !1
1525
+ };
1526
+ };
1527
+ if ("lambda" === s) {
1528
+ for (let e = 0; e < a - 1; e++) d(e, !0);
1529
+ p[a - 1] && (p[a - 1] = l(p[a - 1]));
1530
+ } else {
1531
+ for (let e = 0; e + 1 < a; e += 2) p[e + 1] && (p[e + 1] = Rt(l(p[e + 1]), t)), d(e);
1532
+ a % 2 == 1 && p[a - 1] && (p[a - 1] = l(p[a - 1]));
1533
+ }
1534
+ for (; n.length > u;) n.pop();
1535
+ return {
1536
+ ...e,
1537
+ inputs: p,
1538
+ binder: {
1539
+ kind: s,
1540
+ slots: f
1541
+ }
1542
+ };
1543
+ })(e, s);
1544
+ if (e.type === c.Function && "string" == typeof e.value) {
1545
+ const r = e.value.toUpperCase();
1546
+ if (n.some((e) => e.key === r) && !t?.(e.value)) return i(mt(e));
1547
+ }
1548
+ if (n.length > 0 && e.isReference && ":" === e.value && 2 === e.inputs?.length) {
1549
+ const [t, r] = e.inputs;
1550
+ if (Tt(t) && Tt(r)) {
1551
+ const l = t.image.toUpperCase(), s = r.image.toUpperCase();
1552
+ if (n.some((e) => e.key === l || e.key === s)) return i({
1553
+ ...e,
1554
+ inputs: [At(t), At(r)]
1555
+ });
1556
+ }
1557
+ }
1558
+ if (e.type === c.Named) {
1559
+ const t = dt(e);
1560
+ if (void 0 !== t) {
1561
+ const r = t.toUpperCase();
1562
+ for (let i = n.length - 1; i >= 0; i--) {
1563
+ if (n[i].key !== r) continue;
1564
+ const l = {
1565
+ ...e,
1566
+ binding: { slot: n[i].slot },
1567
+ isReference: !1
1568
+ };
1569
+ return t !== n[i].name && (l.value = {
1570
+ ...e.value,
1571
+ nameId: n[i].name
1572
+ }), l;
1573
+ }
1574
+ }
1575
+ return e;
1576
+ }
1577
+ const o = i(e);
1578
+ if (o.type === c.Function && "string" == typeof o.value && "ISOMITTED" === (t?.(o.value)?.getName() ?? o.value).toUpperCase()) {
1579
+ const e = o.inputs;
1580
+ if (e) {
1581
+ let n;
1582
+ for (let r = 0; r < e.length; r++) {
1583
+ const i = e[r];
1584
+ if (i?.binding && !i.binding.declaration && !0 !== i.rawFrameRead) {
1585
+ (n ??= [...e])[r] = {
1586
+ ...i,
1587
+ rawFrameRead: !0
1588
+ };
1589
+ continue;
1590
+ }
1591
+ const l = Rt(i, t);
1592
+ l !== i && ((n ??= [...e])[r] = l);
1593
+ }
1594
+ if (n) return {
1595
+ ...o,
1596
+ inputs: n
1597
+ };
1598
+ }
1599
+ }
1600
+ return o;
1601
+ };
1602
+ return l(e);
1603
+ }
1604
+ var Tt = (e) => {
1605
+ if (e?.type !== c.Cell || void 0 === e.image) return !1;
1606
+ const t = e.value;
1607
+ return t.rowIndex === Number.MIN_SAFE_INTEGER && !0 !== t.$colIndex && !t.scope;
1608
+ }, At = (e) => {
1609
+ const t = o(e.image);
1610
+ return l(t, e), t;
1611
+ }, St = (e) => e?.type === c.Cell, wt = (e, t = null) => {
1612
+ if (!e) return e;
1613
+ let n = !1;
1614
+ const r = (e) => {
1615
+ if (n || !e) return;
1616
+ const i = pt(e, t), l = e.inputs;
1617
+ if (i && l) {
1618
+ 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);
1620
+ }
1621
+ if (l) for (let e = 0; e < l.length && !n; e++) r(l[e]);
1622
+ };
1623
+ if (r(e), !n) return e;
1624
+ let i = null;
1625
+ const s = h(e, (e) => {
1626
+ if (e?.type !== c.Cell) return;
1627
+ const t = e.value, n = e.image;
1628
+ 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
+ if (void 0 === n) return;
1630
+ const r = o(n);
1631
+ l(r, e);
1632
+ const s = t?.scope;
1633
+ return s && (r.value.scope = s, r.value.scopeImage = t.scopeImage), r;
1634
+ });
1635
+ return i ?? s;
1636
+ }, Ct = (e, t) => {
1637
+ if (!e) return null;
1638
+ let n = null;
1639
+ const r = (e) => {
1640
+ if (n || !e) return;
1641
+ const i = pt(e, t);
1642
+ i && ((e, t) => {
1643
+ const r = "let" === t ? "LET" : "LAMBDA", i = e.inputs, l = i?.length ?? 0;
1644
+ if (!i || l < 2) return;
1645
+ 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.");
1647
+ const s = /* @__PURE__ */ new Set(), o = "let" === t ? 2 : 1;
1648
+ let a = !1;
1649
+ 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);
1652
+ else if (void 0 !== l && a) return void (n = `Required name '${l}' cannot follow an optional name in ${r}.`);
1653
+ 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
+ if (l.includes(".")) return void (n = `Expected a name in ${r} argument ${e + 1}; a name cannot contain '.'.`);
1655
+ const o = l.toUpperCase();
1656
+ if (s.has(o)) return void (n = `Duplicate name '${l}' in ${r}.`);
1657
+ s.add(o);
1658
+ }
1659
+ })(e, i);
1660
+ const l = e.inputs;
1661
+ if (l) for (let e = 0; e < l.length && !n; e++) r(l[e]);
1662
+ };
1663
+ return r(e), n;
1664
+ };
1665
+ function Nt(e, n, r, i, s) {
1666
+ const o = i;
1667
+ let a;
1668
+ const u = () => (void 0 === a && (a = s && r ? n.bind(t.Table, "", { at: {
1669
+ scope: r,
1670
+ rowIndex: s.rowIndex,
1671
+ colIndex: s.colIndex
1672
+ } }) : null), a);
1673
+ return h(e, (e, i, s = []) => {
1674
+ let a;
1675
+ const f = e.type;
1676
+ if (f === c.Cell) {
1677
+ const r = e.value;
1678
+ if (r?.scope) {
1679
+ const i = n.bind(t.Sheet, r.scope, o);
1680
+ null !== i && (a || (a = { ...e }), a.value = {
1681
+ ...r,
1682
+ scope: i
1683
+ });
1684
+ }
1685
+ } else if (f === c.Named) {
1686
+ const i = e.value;
1687
+ if (i && !e.binding) {
1688
+ const s = function(e, n, r, i) {
1689
+ if (n.scope) {
1690
+ const e = r.bind(t.Sheet, n.scope, i);
1691
+ if (null === e || w(e)) return;
1692
+ }
1693
+ const s = r.bind(t.Table, n.nameId, { existing: !0 });
1694
+ if (null === s) return;
1695
+ const o = {
1696
+ type: c.TableReference,
1697
+ value: s,
1698
+ inputs: null,
1699
+ isReference: !0
1700
+ };
1701
+ l(o, e);
1702
+ const a = n.scopeImage;
1703
+ return "string" == typeof a && void 0 !== e.image && (o.image = a + e.image), o;
1704
+ }(e, i, n, o);
1705
+ if (s) return s;
1706
+ const u = i.scope ? n.bind(t.Sheet, i.scope, o) : null, f = (null !== u ? w(u) ? u : n.resolve(t.Sheet, u)?.toString() ?? i.scope : i.scope) ?? r, p = n.bind(t.NamedFormula, i.nameId, f ? { scope: f } : void 0);
1707
+ null === p && null === u || (a || (a = { ...e }), a.value = {
1708
+ ...i,
1709
+ nameId: p ?? i.nameId,
1710
+ ...null !== u ? { scope: u } : void 0
1711
+ });
1712
+ }
1713
+ } else if (f === c.Error) {
1714
+ const r = e.value;
1715
+ if (r?.scope) {
1716
+ const i = n.bind(t.Sheet, r.scope, o);
1717
+ null !== i && (a || (a = { ...e }), a.value = {
1718
+ ...r,
1719
+ scope: i
1720
+ });
1721
+ }
1722
+ } else if (f === c.TableReference) {
1723
+ const r = e.value;
1724
+ if (r) {
1725
+ const i = n.bind(t.Table, r);
1726
+ a || (a = { ...e }), null !== i && (a.value = i);
1727
+ } else if ("string" == typeof r) {
1728
+ const t = u();
1729
+ if (null !== t && Ft(e, n)) return {
1730
+ ...e,
1731
+ value: t
1732
+ };
1733
+ }
1734
+ } else if (f === c.TableColumn) {
1735
+ const r = e.value;
1736
+ if (r) {
1737
+ const i = pe(s, c.TableReference), l = i?.value || (i ? u() ?? void 0 : void 0), o = n.bind(t.TableColumn, r, l ? { tableName: l } : void 0);
1738
+ a || (a = { ...e }), null !== o && (a.value = o);
1739
+ }
1740
+ } else if (f === c.Function) {
1741
+ const r = e.value;
1742
+ if (r) {
1743
+ const i = n.bind(t.Function, r);
1744
+ a || (a = { ...e }), null !== i && (a.value = i);
1745
+ }
1746
+ }
1747
+ return a;
1748
+ });
1749
+ }
1750
+ function Ft(e, n) {
1751
+ let r = !0;
1752
+ const i = e.inputs;
1753
+ if (!i) return !0;
1754
+ for (let e = 0; e < i.length && r; e++) h(i[e], (e) => {
1755
+ e.type === c.TableColumn && null === n.resolve(t.TableColumn, e.value) && (r = !1);
1756
+ });
1757
+ return r;
1758
+ }
1759
+ function Pt(e, n) {
1760
+ let r = null;
1761
+ return h(e, (e) => {
1762
+ if (r || e.type !== c.TableReference) return;
1763
+ if ("" === e.value) return void (r = "A structured reference without a table name must be in a table that has its columns.");
1764
+ const i = e.value;
1765
+ if (!n || "string" != typeof i) return;
1766
+ const l = n.resolve(t.Table, i)?.toString() ?? i;
1767
+ null === n.bind(t.Table, l, { existing: !0 }) ? r = `There is no table named '${l}'.` : Ft(e, n) || (r = "The table has no such column.");
1768
+ }), r;
1769
+ }
1770
+ export { ce as A, Re as C, ve as D, yt as E, ae as O, Ke 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 };