@cj-tech-master/excelts 9.2.1 → 9.3.0

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 (383) hide show
  1. package/README.md +25 -2
  2. package/README_zh.md +29 -6
  3. package/dist/browser/index.browser.d.ts +1 -1
  4. package/dist/browser/index.browser.js +4 -0
  5. package/dist/browser/index.d.ts +1 -1
  6. package/dist/browser/index.js +4 -0
  7. package/dist/browser/modules/excel/cell.d.ts +17 -3
  8. package/dist/browser/modules/excel/cell.js +170 -22
  9. package/dist/browser/modules/excel/defined-names.d.ts +96 -1
  10. package/dist/browser/modules/excel/defined-names.js +411 -21
  11. package/dist/browser/modules/excel/image.d.ts +11 -0
  12. package/dist/browser/modules/excel/image.js +24 -1
  13. package/dist/browser/modules/excel/stream/workbook-reader.browser.d.ts +9 -3
  14. package/dist/browser/modules/excel/stream/workbook-reader.browser.js +14 -0
  15. package/dist/browser/modules/excel/stream/workbook-reader.d.ts +2 -1
  16. package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +39 -5
  17. package/dist/browser/modules/excel/stream/workbook-writer.browser.js +48 -1
  18. package/dist/browser/modules/excel/stream/workbook-writer.d.ts +3 -2
  19. package/dist/browser/modules/excel/stream/worksheet-reader.js +17 -1
  20. package/dist/browser/modules/excel/stream/worksheet-writer.d.ts +39 -6
  21. package/dist/browser/modules/excel/stream/worksheet-writer.js +45 -5
  22. package/dist/browser/modules/excel/table.js +15 -2
  23. package/dist/browser/modules/excel/types.d.ts +133 -2
  24. package/dist/browser/modules/excel/utils/col-cache.d.ts +1 -0
  25. package/dist/browser/modules/excel/utils/col-cache.js +15 -0
  26. package/dist/browser/modules/excel/utils/drawing-utils.d.ts +3 -3
  27. package/dist/browser/modules/excel/utils/drawing-utils.js +4 -0
  28. package/dist/browser/modules/excel/utils/external-link-formula.d.ts +76 -0
  29. package/dist/browser/modules/excel/utils/external-link-formula.js +208 -0
  30. package/dist/browser/modules/excel/utils/iterate-stream.d.ts +9 -3
  31. package/dist/browser/modules/excel/utils/iterate-stream.js +3 -1
  32. package/dist/browser/modules/excel/utils/ooxml-paths.d.ts +19 -0
  33. package/dist/browser/modules/excel/utils/ooxml-paths.js +37 -2
  34. package/dist/browser/modules/excel/utils/shared-strings.d.ts +8 -3
  35. package/dist/browser/modules/excel/utils/shared-strings.js +21 -2
  36. package/dist/browser/modules/excel/utils/workbook-protection.d.ts +30 -0
  37. package/dist/browser/modules/excel/utils/workbook-protection.js +30 -0
  38. package/dist/browser/modules/excel/workbook.browser.d.ts +257 -6
  39. package/dist/browser/modules/excel/workbook.browser.js +318 -34
  40. package/dist/browser/modules/excel/workbook.d.ts +1 -1
  41. package/dist/browser/modules/excel/worksheet.d.ts +3 -1
  42. package/dist/browser/modules/excel/worksheet.js +21 -2
  43. package/dist/browser/modules/excel/xlsx/rel-type.d.ts +15 -0
  44. package/dist/browser/modules/excel/xlsx/rel-type.js +16 -1
  45. package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +6 -5
  46. package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.js +21 -86
  47. package/dist/browser/modules/excel/xlsx/xform/book/external-link-xform.d.ts +84 -0
  48. package/dist/browser/modules/excel/xlsx/xform/book/external-link-xform.js +330 -0
  49. package/dist/browser/modules/excel/xlsx/xform/book/external-reference-xform.d.ts +17 -0
  50. package/dist/browser/modules/excel/xlsx/xform/book/external-reference-xform.js +24 -0
  51. package/dist/browser/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.d.ts +3 -0
  52. package/dist/browser/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.js +11 -2
  53. package/dist/browser/modules/excel/xlsx/xform/book/workbook-protection-xform.d.ts +20 -0
  54. package/dist/browser/modules/excel/xlsx/xform/book/workbook-protection-xform.js +66 -0
  55. package/dist/browser/modules/excel/xlsx/xform/book/workbook-xform.js +38 -5
  56. package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +19 -1
  57. package/dist/browser/modules/excel/xlsx/xform/core/metadata-xform.d.ts +56 -0
  58. package/dist/browser/modules/excel/xlsx/xform/core/metadata-xform.js +158 -0
  59. package/dist/browser/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.d.ts +26 -0
  60. package/dist/browser/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +105 -0
  61. package/dist/browser/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +3 -0
  62. package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.js +10 -2
  63. package/dist/browser/modules/excel/xlsx/xform/sheet/cell-xform.d.ts +1 -1
  64. package/dist/browser/modules/excel/xlsx/xform/sheet/cell-xform.js +166 -8
  65. package/dist/browser/modules/excel/xlsx/xform/sheet/data-validations-xform.js +1 -1
  66. package/dist/browser/modules/excel/xlsx/xform/sheet/ignored-errors-xform.d.ts +21 -0
  67. package/dist/browser/modules/excel/xlsx/xform/sheet/ignored-errors-xform.js +80 -0
  68. package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +9 -4
  69. package/dist/browser/modules/excel/xlsx/xform/style/border-xform.js +4 -1
  70. package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +172 -13
  71. package/dist/browser/modules/excel/xlsx/xlsx.browser.js +410 -20
  72. package/dist/browser/modules/excel/xlsx/xlsx.d.ts +7 -4
  73. package/dist/browser/modules/excel/xlsx/xlsx.js +4 -5
  74. package/dist/browser/modules/formula/compile/address-utils.d.ts +62 -0
  75. package/dist/browser/modules/formula/compile/address-utils.js +83 -0
  76. package/dist/browser/modules/formula/compile/binder.d.ts +42 -0
  77. package/dist/browser/modules/formula/compile/binder.js +487 -0
  78. package/dist/browser/modules/formula/compile/bound-ast.d.ts +230 -0
  79. package/dist/browser/modules/formula/compile/bound-ast.js +80 -0
  80. package/dist/browser/modules/formula/compile/compiled-formula.d.ts +137 -0
  81. package/dist/browser/modules/formula/compile/compiled-formula.js +383 -0
  82. package/dist/browser/modules/formula/compile/dependency-analysis.d.ts +93 -0
  83. package/dist/browser/modules/formula/compile/dependency-analysis.js +432 -0
  84. package/dist/browser/modules/formula/compile/structured-ref-utils.d.ts +93 -0
  85. package/dist/browser/modules/formula/compile/structured-ref-utils.js +136 -0
  86. package/dist/browser/modules/formula/default-syntax-probe.d.ts +79 -0
  87. package/dist/browser/modules/formula/default-syntax-probe.js +83 -0
  88. package/dist/browser/modules/formula/functions/_date-context.d.ts +4 -0
  89. package/dist/browser/modules/formula/functions/_date-context.js +29 -0
  90. package/dist/browser/modules/formula/functions/_shared.d.ts +121 -0
  91. package/dist/browser/modules/formula/functions/_shared.js +381 -0
  92. package/dist/browser/modules/formula/functions/conditional.d.ts +27 -0
  93. package/dist/browser/modules/formula/functions/conditional.js +343 -0
  94. package/dist/browser/modules/formula/functions/database.d.ts +37 -0
  95. package/dist/browser/modules/formula/functions/database.js +274 -0
  96. package/dist/browser/modules/formula/functions/date.d.ts +61 -0
  97. package/dist/browser/modules/formula/functions/date.js +855 -0
  98. package/dist/browser/modules/formula/functions/dynamic-array.d.ts +23 -0
  99. package/dist/browser/modules/formula/functions/dynamic-array.js +860 -0
  100. package/dist/browser/modules/formula/functions/engineering.d.ts +57 -0
  101. package/dist/browser/modules/formula/functions/engineering.js +1128 -0
  102. package/dist/browser/modules/formula/functions/financial.d.ts +202 -0
  103. package/dist/browser/modules/formula/functions/financial.js +2296 -0
  104. package/dist/browser/modules/formula/functions/lookup.d.ts +18 -0
  105. package/dist/browser/modules/formula/functions/lookup.js +886 -0
  106. package/dist/browser/modules/formula/functions/math.d.ts +114 -0
  107. package/dist/browser/modules/formula/functions/math.js +1406 -0
  108. package/dist/browser/modules/formula/functions/statistical.d.ts +193 -0
  109. package/dist/browser/modules/formula/functions/statistical.js +3390 -0
  110. package/dist/browser/modules/formula/functions/text.d.ts +86 -0
  111. package/dist/browser/modules/formula/functions/text.js +1845 -0
  112. package/dist/browser/modules/formula/host-registry.d.ts +53 -0
  113. package/dist/browser/modules/formula/host-registry.js +69 -0
  114. package/dist/browser/modules/formula/index.d.ts +39 -0
  115. package/dist/browser/modules/formula/index.js +49 -0
  116. package/dist/browser/modules/formula/install.d.ts +62 -0
  117. package/dist/browser/modules/formula/install.js +88 -0
  118. package/dist/browser/modules/formula/integration/apply-writeback-plan.d.ts +26 -0
  119. package/dist/browser/modules/formula/integration/apply-writeback-plan.js +210 -0
  120. package/dist/browser/modules/formula/integration/calculate-formulas-impl.d.ts +30 -0
  121. package/dist/browser/modules/formula/integration/calculate-formulas-impl.js +616 -0
  122. package/dist/browser/modules/formula/integration/calculate-formulas.d.ts +67 -0
  123. package/dist/browser/modules/formula/integration/calculate-formulas.js +68 -0
  124. package/dist/browser/modules/formula/integration/formula-instance.d.ts +64 -0
  125. package/dist/browser/modules/formula/integration/formula-instance.js +79 -0
  126. package/dist/browser/modules/formula/integration/workbook-adapter.d.ts +26 -0
  127. package/dist/browser/modules/formula/integration/workbook-adapter.js +324 -0
  128. package/dist/browser/modules/formula/integration/workbook-snapshot.d.ts +267 -0
  129. package/dist/browser/modules/formula/integration/workbook-snapshot.js +77 -0
  130. package/dist/browser/modules/formula/materialize/build-writeback-plan.d.ts +34 -0
  131. package/dist/browser/modules/formula/materialize/build-writeback-plan.js +473 -0
  132. package/dist/browser/modules/formula/materialize/spill-engine.d.ts +9 -0
  133. package/dist/browser/modules/formula/materialize/spill-engine.js +38 -0
  134. package/dist/browser/modules/formula/materialize/types.d.ts +179 -0
  135. package/dist/browser/modules/formula/materialize/types.js +29 -0
  136. package/dist/browser/modules/formula/materialize/writeback-plan.d.ts +167 -0
  137. package/dist/browser/modules/formula/materialize/writeback-plan.js +27 -0
  138. package/dist/browser/modules/formula/runtime/evaluator.d.ts +151 -0
  139. package/dist/browser/modules/formula/runtime/evaluator.js +2291 -0
  140. package/dist/browser/modules/formula/runtime/function-registry.d.ts +47 -0
  141. package/dist/browser/modules/formula/runtime/function-registry.js +840 -0
  142. package/dist/browser/modules/formula/runtime/values.d.ts +211 -0
  143. package/dist/browser/modules/formula/runtime/values.js +385 -0
  144. package/dist/browser/modules/formula/syntax/ast.d.ts +129 -0
  145. package/dist/browser/modules/formula/syntax/ast.js +28 -0
  146. package/dist/browser/modules/formula/syntax/parser.d.ts +18 -0
  147. package/dist/browser/modules/formula/syntax/parser.js +439 -0
  148. package/dist/browser/modules/formula/syntax/token-types.d.ts +153 -0
  149. package/dist/browser/modules/formula/syntax/token-types.js +59 -0
  150. package/dist/browser/modules/formula/syntax/tokenizer.d.ts +10 -0
  151. package/dist/browser/modules/formula/syntax/tokenizer.js +1074 -0
  152. package/dist/browser/modules/pdf/excel-bridge.js +9 -0
  153. package/dist/cjs/index.js +4 -0
  154. package/dist/cjs/modules/excel/cell.js +170 -22
  155. package/dist/cjs/modules/excel/defined-names.js +411 -21
  156. package/dist/cjs/modules/excel/image.js +24 -1
  157. package/dist/cjs/modules/excel/stream/workbook-reader.browser.js +14 -0
  158. package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +48 -1
  159. package/dist/cjs/modules/excel/stream/worksheet-reader.js +17 -1
  160. package/dist/cjs/modules/excel/stream/worksheet-writer.js +45 -5
  161. package/dist/cjs/modules/excel/table.js +15 -2
  162. package/dist/cjs/modules/excel/utils/col-cache.js +15 -0
  163. package/dist/cjs/modules/excel/utils/drawing-utils.js +4 -0
  164. package/dist/cjs/modules/excel/utils/external-link-formula.js +212 -0
  165. package/dist/cjs/modules/excel/utils/iterate-stream.js +3 -1
  166. package/dist/cjs/modules/excel/utils/ooxml-paths.js +42 -2
  167. package/dist/cjs/modules/excel/utils/shared-strings.js +21 -2
  168. package/dist/cjs/modules/excel/utils/workbook-protection.js +33 -0
  169. package/dist/cjs/modules/excel/workbook.browser.js +318 -34
  170. package/dist/cjs/modules/excel/worksheet.js +20 -1
  171. package/dist/cjs/modules/excel/xlsx/rel-type.js +16 -1
  172. package/dist/cjs/modules/excel/xlsx/xform/book/defined-name-xform.js +21 -86
  173. package/dist/cjs/modules/excel/xlsx/xform/book/external-link-xform.js +333 -0
  174. package/dist/cjs/modules/excel/xlsx/xform/book/external-reference-xform.js +27 -0
  175. package/dist/cjs/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.js +11 -2
  176. package/dist/cjs/modules/excel/xlsx/xform/book/workbook-protection-xform.js +69 -0
  177. package/dist/cjs/modules/excel/xlsx/xform/book/workbook-xform.js +38 -5
  178. package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +18 -0
  179. package/dist/cjs/modules/excel/xlsx/xform/core/metadata-xform.js +161 -0
  180. package/dist/cjs/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +108 -0
  181. package/dist/cjs/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +3 -0
  182. package/dist/cjs/modules/excel/xlsx/xform/drawing/drawing-xform.js +10 -2
  183. package/dist/cjs/modules/excel/xlsx/xform/sheet/cell-xform.js +166 -8
  184. package/dist/cjs/modules/excel/xlsx/xform/sheet/data-validations-xform.js +1 -1
  185. package/dist/cjs/modules/excel/xlsx/xform/sheet/ignored-errors-xform.js +83 -0
  186. package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +9 -4
  187. package/dist/cjs/modules/excel/xlsx/xform/style/border-xform.js +4 -1
  188. package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +408 -18
  189. package/dist/cjs/modules/excel/xlsx/xlsx.js +4 -5
  190. package/dist/cjs/modules/formula/compile/address-utils.js +89 -0
  191. package/dist/cjs/modules/formula/compile/binder.js +489 -0
  192. package/dist/cjs/modules/formula/compile/bound-ast.js +68 -0
  193. package/dist/cjs/modules/formula/compile/compiled-formula.js +387 -0
  194. package/dist/cjs/modules/formula/compile/dependency-analysis.js +437 -0
  195. package/dist/cjs/modules/formula/compile/structured-ref-utils.js +141 -0
  196. package/dist/cjs/modules/formula/default-syntax-probe.js +87 -0
  197. package/dist/cjs/modules/formula/functions/_date-context.js +33 -0
  198. package/dist/cjs/modules/formula/functions/_shared.js +396 -0
  199. package/dist/cjs/modules/formula/functions/conditional.js +354 -0
  200. package/dist/cjs/modules/formula/functions/database.js +288 -0
  201. package/dist/cjs/modules/formula/functions/date.js +883 -0
  202. package/dist/cjs/modules/formula/functions/dynamic-array.js +881 -0
  203. package/dist/cjs/modules/formula/functions/engineering.js +1183 -0
  204. package/dist/cjs/modules/formula/functions/financial.js +2348 -0
  205. package/dist/cjs/modules/formula/functions/lookup.js +902 -0
  206. package/dist/cjs/modules/formula/functions/math.js +1487 -0
  207. package/dist/cjs/modules/formula/functions/statistical.js +3488 -0
  208. package/dist/cjs/modules/formula/functions/text.js +1889 -0
  209. package/dist/cjs/modules/formula/host-registry.js +75 -0
  210. package/dist/cjs/modules/formula/index.js +58 -0
  211. package/dist/cjs/modules/formula/install.js +93 -0
  212. package/dist/cjs/modules/formula/integration/apply-writeback-plan.js +213 -0
  213. package/dist/cjs/modules/formula/integration/calculate-formulas-impl.js +619 -0
  214. package/dist/cjs/modules/formula/integration/calculate-formulas.js +71 -0
  215. package/dist/cjs/modules/formula/integration/formula-instance.js +82 -0
  216. package/dist/cjs/modules/formula/integration/workbook-adapter.js +327 -0
  217. package/dist/cjs/modules/formula/integration/workbook-snapshot.js +84 -0
  218. package/dist/cjs/modules/formula/materialize/build-writeback-plan.js +475 -0
  219. package/dist/cjs/modules/formula/materialize/spill-engine.js +42 -0
  220. package/dist/cjs/modules/formula/materialize/types.js +32 -0
  221. package/dist/cjs/modules/formula/materialize/writeback-plan.js +28 -0
  222. package/dist/cjs/modules/formula/runtime/evaluator.js +2298 -0
  223. package/dist/cjs/modules/formula/runtime/function-registry.js +846 -0
  224. package/dist/cjs/modules/formula/runtime/values.js +385 -0
  225. package/dist/cjs/modules/formula/syntax/ast.js +8 -0
  226. package/dist/cjs/modules/formula/syntax/parser.js +440 -0
  227. package/dist/cjs/modules/formula/syntax/token-types.js +32 -0
  228. package/dist/cjs/modules/formula/syntax/tokenizer.js +1076 -0
  229. package/dist/cjs/modules/pdf/excel-bridge.js +9 -0
  230. package/dist/esm/index.browser.js +4 -0
  231. package/dist/esm/index.js +4 -0
  232. package/dist/esm/modules/excel/cell.js +170 -22
  233. package/dist/esm/modules/excel/defined-names.js +411 -21
  234. package/dist/esm/modules/excel/image.js +24 -1
  235. package/dist/esm/modules/excel/stream/workbook-reader.browser.js +14 -0
  236. package/dist/esm/modules/excel/stream/workbook-writer.browser.js +48 -1
  237. package/dist/esm/modules/excel/stream/worksheet-reader.js +17 -1
  238. package/dist/esm/modules/excel/stream/worksheet-writer.js +45 -5
  239. package/dist/esm/modules/excel/table.js +15 -2
  240. package/dist/esm/modules/excel/utils/col-cache.js +15 -0
  241. package/dist/esm/modules/excel/utils/drawing-utils.js +4 -0
  242. package/dist/esm/modules/excel/utils/external-link-formula.js +208 -0
  243. package/dist/esm/modules/excel/utils/iterate-stream.js +3 -1
  244. package/dist/esm/modules/excel/utils/ooxml-paths.js +37 -2
  245. package/dist/esm/modules/excel/utils/shared-strings.js +21 -2
  246. package/dist/esm/modules/excel/utils/workbook-protection.js +30 -0
  247. package/dist/esm/modules/excel/workbook.browser.js +318 -34
  248. package/dist/esm/modules/excel/worksheet.js +21 -2
  249. package/dist/esm/modules/excel/xlsx/rel-type.js +16 -1
  250. package/dist/esm/modules/excel/xlsx/xform/book/defined-name-xform.js +21 -86
  251. package/dist/esm/modules/excel/xlsx/xform/book/external-link-xform.js +330 -0
  252. package/dist/esm/modules/excel/xlsx/xform/book/external-reference-xform.js +24 -0
  253. package/dist/esm/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.js +11 -2
  254. package/dist/esm/modules/excel/xlsx/xform/book/workbook-protection-xform.js +66 -0
  255. package/dist/esm/modules/excel/xlsx/xform/book/workbook-xform.js +38 -5
  256. package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +19 -1
  257. package/dist/esm/modules/excel/xlsx/xform/core/metadata-xform.js +158 -0
  258. package/dist/esm/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +105 -0
  259. package/dist/esm/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +3 -0
  260. package/dist/esm/modules/excel/xlsx/xform/drawing/drawing-xform.js +10 -2
  261. package/dist/esm/modules/excel/xlsx/xform/sheet/cell-xform.js +166 -8
  262. package/dist/esm/modules/excel/xlsx/xform/sheet/data-validations-xform.js +1 -1
  263. package/dist/esm/modules/excel/xlsx/xform/sheet/ignored-errors-xform.js +80 -0
  264. package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +9 -4
  265. package/dist/esm/modules/excel/xlsx/xform/style/border-xform.js +4 -1
  266. package/dist/esm/modules/excel/xlsx/xlsx.browser.js +410 -20
  267. package/dist/esm/modules/excel/xlsx/xlsx.js +4 -5
  268. package/dist/esm/modules/formula/compile/address-utils.js +83 -0
  269. package/dist/esm/modules/formula/compile/binder.js +487 -0
  270. package/dist/esm/modules/formula/compile/bound-ast.js +80 -0
  271. package/dist/esm/modules/formula/compile/compiled-formula.js +383 -0
  272. package/dist/esm/modules/formula/compile/dependency-analysis.js +432 -0
  273. package/dist/esm/modules/formula/compile/structured-ref-utils.js +136 -0
  274. package/dist/esm/modules/formula/default-syntax-probe.js +83 -0
  275. package/dist/esm/modules/formula/functions/_date-context.js +29 -0
  276. package/dist/esm/modules/formula/functions/_shared.js +381 -0
  277. package/dist/esm/modules/formula/functions/conditional.js +343 -0
  278. package/dist/esm/modules/formula/functions/database.js +274 -0
  279. package/dist/esm/modules/formula/functions/date.js +855 -0
  280. package/dist/esm/modules/formula/functions/dynamic-array.js +860 -0
  281. package/dist/esm/modules/formula/functions/engineering.js +1128 -0
  282. package/dist/esm/modules/formula/functions/financial.js +2296 -0
  283. package/dist/esm/modules/formula/functions/lookup.js +886 -0
  284. package/dist/esm/modules/formula/functions/math.js +1406 -0
  285. package/dist/esm/modules/formula/functions/statistical.js +3390 -0
  286. package/dist/esm/modules/formula/functions/text.js +1845 -0
  287. package/dist/esm/modules/formula/host-registry.js +69 -0
  288. package/dist/esm/modules/formula/index.js +49 -0
  289. package/dist/esm/modules/formula/install.js +88 -0
  290. package/dist/esm/modules/formula/integration/apply-writeback-plan.js +210 -0
  291. package/dist/esm/modules/formula/integration/calculate-formulas-impl.js +616 -0
  292. package/dist/esm/modules/formula/integration/calculate-formulas.js +68 -0
  293. package/dist/esm/modules/formula/integration/formula-instance.js +79 -0
  294. package/dist/esm/modules/formula/integration/workbook-adapter.js +324 -0
  295. package/dist/esm/modules/formula/integration/workbook-snapshot.js +77 -0
  296. package/dist/esm/modules/formula/materialize/build-writeback-plan.js +473 -0
  297. package/dist/esm/modules/formula/materialize/spill-engine.js +38 -0
  298. package/dist/esm/modules/formula/materialize/types.js +29 -0
  299. package/dist/esm/modules/formula/materialize/writeback-plan.js +27 -0
  300. package/dist/esm/modules/formula/runtime/evaluator.js +2291 -0
  301. package/dist/esm/modules/formula/runtime/function-registry.js +840 -0
  302. package/dist/esm/modules/formula/runtime/values.js +385 -0
  303. package/dist/esm/modules/formula/syntax/ast.js +28 -0
  304. package/dist/esm/modules/formula/syntax/parser.js +439 -0
  305. package/dist/esm/modules/formula/syntax/token-types.js +59 -0
  306. package/dist/esm/modules/formula/syntax/tokenizer.js +1074 -0
  307. package/dist/esm/modules/pdf/excel-bridge.js +9 -0
  308. package/dist/iife/excelts.iife.js +2302 -373
  309. package/dist/iife/excelts.iife.js.map +1 -1
  310. package/dist/iife/excelts.iife.min.js +34 -34
  311. package/dist/types/index.browser.d.ts +1 -1
  312. package/dist/types/index.d.ts +1 -1
  313. package/dist/types/modules/excel/cell.d.ts +17 -3
  314. package/dist/types/modules/excel/defined-names.d.ts +96 -1
  315. package/dist/types/modules/excel/image.d.ts +11 -0
  316. package/dist/types/modules/excel/stream/workbook-reader.browser.d.ts +9 -3
  317. package/dist/types/modules/excel/stream/workbook-reader.d.ts +2 -1
  318. package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +39 -5
  319. package/dist/types/modules/excel/stream/workbook-writer.d.ts +3 -2
  320. package/dist/types/modules/excel/stream/worksheet-writer.d.ts +39 -6
  321. package/dist/types/modules/excel/types.d.ts +133 -2
  322. package/dist/types/modules/excel/utils/col-cache.d.ts +1 -0
  323. package/dist/types/modules/excel/utils/drawing-utils.d.ts +3 -3
  324. package/dist/types/modules/excel/utils/external-link-formula.d.ts +76 -0
  325. package/dist/types/modules/excel/utils/iterate-stream.d.ts +9 -3
  326. package/dist/types/modules/excel/utils/ooxml-paths.d.ts +19 -0
  327. package/dist/types/modules/excel/utils/shared-strings.d.ts +8 -3
  328. package/dist/types/modules/excel/utils/workbook-protection.d.ts +30 -0
  329. package/dist/types/modules/excel/workbook.browser.d.ts +257 -6
  330. package/dist/types/modules/excel/workbook.d.ts +1 -1
  331. package/dist/types/modules/excel/worksheet.d.ts +3 -1
  332. package/dist/types/modules/excel/xlsx/rel-type.d.ts +15 -0
  333. package/dist/types/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +6 -5
  334. package/dist/types/modules/excel/xlsx/xform/book/external-link-xform.d.ts +84 -0
  335. package/dist/types/modules/excel/xlsx/xform/book/external-reference-xform.d.ts +17 -0
  336. package/dist/types/modules/excel/xlsx/xform/book/workbook-calc-properties-xform.d.ts +3 -0
  337. package/dist/types/modules/excel/xlsx/xform/book/workbook-protection-xform.d.ts +20 -0
  338. package/dist/types/modules/excel/xlsx/xform/core/metadata-xform.d.ts +56 -0
  339. package/dist/types/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.d.ts +26 -0
  340. package/dist/types/modules/excel/xlsx/xform/sheet/cell-xform.d.ts +1 -1
  341. package/dist/types/modules/excel/xlsx/xform/sheet/ignored-errors-xform.d.ts +21 -0
  342. package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +172 -13
  343. package/dist/types/modules/excel/xlsx/xlsx.d.ts +7 -4
  344. package/dist/types/modules/formula/compile/address-utils.d.ts +62 -0
  345. package/dist/types/modules/formula/compile/binder.d.ts +42 -0
  346. package/dist/types/modules/formula/compile/bound-ast.d.ts +230 -0
  347. package/dist/types/modules/formula/compile/compiled-formula.d.ts +137 -0
  348. package/dist/types/modules/formula/compile/dependency-analysis.d.ts +93 -0
  349. package/dist/types/modules/formula/compile/structured-ref-utils.d.ts +93 -0
  350. package/dist/types/modules/formula/default-syntax-probe.d.ts +79 -0
  351. package/dist/types/modules/formula/functions/_date-context.d.ts +4 -0
  352. package/dist/types/modules/formula/functions/_shared.d.ts +121 -0
  353. package/dist/types/modules/formula/functions/conditional.d.ts +27 -0
  354. package/dist/types/modules/formula/functions/database.d.ts +37 -0
  355. package/dist/types/modules/formula/functions/date.d.ts +61 -0
  356. package/dist/types/modules/formula/functions/dynamic-array.d.ts +23 -0
  357. package/dist/types/modules/formula/functions/engineering.d.ts +57 -0
  358. package/dist/types/modules/formula/functions/financial.d.ts +202 -0
  359. package/dist/types/modules/formula/functions/lookup.d.ts +18 -0
  360. package/dist/types/modules/formula/functions/math.d.ts +114 -0
  361. package/dist/types/modules/formula/functions/statistical.d.ts +193 -0
  362. package/dist/types/modules/formula/functions/text.d.ts +86 -0
  363. package/dist/types/modules/formula/host-registry.d.ts +53 -0
  364. package/dist/types/modules/formula/index.d.ts +39 -0
  365. package/dist/types/modules/formula/install.d.ts +62 -0
  366. package/dist/types/modules/formula/integration/apply-writeback-plan.d.ts +26 -0
  367. package/dist/types/modules/formula/integration/calculate-formulas-impl.d.ts +30 -0
  368. package/dist/types/modules/formula/integration/calculate-formulas.d.ts +67 -0
  369. package/dist/types/modules/formula/integration/formula-instance.d.ts +64 -0
  370. package/dist/types/modules/formula/integration/workbook-adapter.d.ts +26 -0
  371. package/dist/types/modules/formula/integration/workbook-snapshot.d.ts +267 -0
  372. package/dist/types/modules/formula/materialize/build-writeback-plan.d.ts +34 -0
  373. package/dist/types/modules/formula/materialize/spill-engine.d.ts +9 -0
  374. package/dist/types/modules/formula/materialize/types.d.ts +179 -0
  375. package/dist/types/modules/formula/materialize/writeback-plan.d.ts +167 -0
  376. package/dist/types/modules/formula/runtime/evaluator.d.ts +151 -0
  377. package/dist/types/modules/formula/runtime/function-registry.d.ts +47 -0
  378. package/dist/types/modules/formula/runtime/values.d.ts +211 -0
  379. package/dist/types/modules/formula/syntax/ast.d.ts +129 -0
  380. package/dist/types/modules/formula/syntax/parser.d.ts +18 -0
  381. package/dist/types/modules/formula/syntax/token-types.d.ts +153 -0
  382. package/dist/types/modules/formula/syntax/tokenizer.d.ts +10 -0
  383. package/package.json +28 -28
@@ -0,0 +1,440 @@
1
+ "use strict";
2
+ /**
3
+ * Formula Parser
4
+ *
5
+ * Converts a token stream into an Abstract Syntax Tree (AST).
6
+ * Implements a Pratt parser (top-down operator precedence) for correct
7
+ * handling of operator precedence and associativity.
8
+ *
9
+ * Excel operator precedence (highest to lowest):
10
+ * 1. Unary + / - / %
11
+ * 2. ^ (exponentiation, right-assoc)
12
+ * 3. * /
13
+ * 4. + -
14
+ * 5. & (concatenation)
15
+ * 6. = <> < > <= >= (comparison)
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.parse = parse;
19
+ // ============================================================================
20
+ // Operator Precedence
21
+ // ============================================================================
22
+ function prefixBindingPower(op) {
23
+ switch (op) {
24
+ case "+":
25
+ case "-":
26
+ // Must be lower than ^ (60/61) so that -2^3 parses as -(2^3), not (-2)^3.
27
+ // Excel: -2^2 = -4, not 4.
28
+ return 55;
29
+ default:
30
+ return 0;
31
+ }
32
+ }
33
+ function infixBindingPower(op) {
34
+ // Returns [left bp, right bp]. Higher = tighter binding.
35
+ // Left < Right for left-associative, Left > Right for right-associative.
36
+ switch (op) {
37
+ case "=":
38
+ case "<>":
39
+ case "<":
40
+ case ">":
41
+ case "<=":
42
+ case ">=":
43
+ return [10, 11];
44
+ case "&":
45
+ return [20, 21];
46
+ case "+":
47
+ case "-":
48
+ return [30, 31];
49
+ case "*":
50
+ case "/":
51
+ return [40, 41];
52
+ case "^":
53
+ return [61, 60]; // right-associative
54
+ // Intersection operator — whitespace between two refs. In Excel
55
+ // precedence this sits between `:` (range, already handled at the
56
+ // tokenizer level) and unary +/-. Left-associative, binds tighter
57
+ // than every arithmetic operator.
58
+ case " ":
59
+ return [80, 81];
60
+ default:
61
+ return [0, 0];
62
+ }
63
+ }
64
+ // ============================================================================
65
+ // Parser
66
+ // ============================================================================
67
+ class Parser {
68
+ constructor(tokens) {
69
+ this.MAX_DEPTH = 256;
70
+ this.tokens = tokens;
71
+ this.pos = 0;
72
+ this.depth = 0;
73
+ }
74
+ enter() {
75
+ if (++this.depth > this.MAX_DEPTH) {
76
+ throw new Error(`Formula nested too deep (> ${this.MAX_DEPTH} levels)`);
77
+ }
78
+ }
79
+ leave() {
80
+ this.depth--;
81
+ }
82
+ peek() {
83
+ return this.tokens[this.pos];
84
+ }
85
+ next() {
86
+ return this.tokens[this.pos++];
87
+ }
88
+ expect(type) {
89
+ const t = this.next();
90
+ if (!t || t.type !== type) {
91
+ throw new Error(`Expected token type ${type}, got ${t?.type ?? "EOF"}`);
92
+ }
93
+ return t;
94
+ }
95
+ // Entry point
96
+ parse() {
97
+ const node = this.parseExpr(0);
98
+ // After parsing a complete expression, every token must have been
99
+ // consumed. Otherwise inputs like "A1:B2:C3" or "1+2 3" would silently
100
+ // produce an AST that drops the trailing tokens.
101
+ if (this.pos !== this.tokens.length) {
102
+ const t = this.tokens[this.pos];
103
+ throw new Error(`Unexpected trailing token at position ${this.pos} (type ${t.type})`);
104
+ }
105
+ return node;
106
+ }
107
+ parseExpr(minBp) {
108
+ this.enter();
109
+ try {
110
+ return this.parseExprInner(minBp);
111
+ }
112
+ finally {
113
+ this.leave();
114
+ }
115
+ }
116
+ parseExprInner(minBp) {
117
+ let left = this.parsePrefix();
118
+ while (true) {
119
+ const t = this.peek();
120
+ if (!t) {
121
+ break;
122
+ }
123
+ // Postfix: %
124
+ if (t.type === 14 /* TokenType.Percent */) {
125
+ this.next();
126
+ left = { type: 11 /* NodeType.Percent */, operand: left };
127
+ continue;
128
+ }
129
+ // Infix operators
130
+ if (t.type === 9 /* TokenType.Operator */) {
131
+ const [lbp, rbp] = infixBindingPower(t.value);
132
+ if (lbp === 0 || lbp < minBp) {
133
+ break;
134
+ }
135
+ this.next();
136
+ const right = this.parseExpr(rbp);
137
+ left = { type: 7 /* NodeType.BinaryOp */, op: t.value, left, right };
138
+ continue;
139
+ }
140
+ // Intersection: whitespace separating two refs. Modelled as a binary
141
+ // operation with op=" ". The evaluator resolves both sides to refs
142
+ // and returns their rectangle intersection (or `#NULL!`).
143
+ if (t.type === 24 /* TokenType.Intersect */) {
144
+ const [lbp, rbp] = infixBindingPower(" ");
145
+ if (lbp < minBp) {
146
+ break;
147
+ }
148
+ this.next();
149
+ const right = this.parseExpr(rbp);
150
+ left = { type: 7 /* NodeType.BinaryOp */, op: " ", left, right };
151
+ continue;
152
+ }
153
+ // Range operator `:` — binds tighter than intersection. Normally
154
+ // `A1:B2` is merged into a single Range token by the tokenizer,
155
+ // but patterns like `B11:INDIRECT("B" & ROW()-1)` where one side
156
+ // is a function call leave the colon as a standalone token. The
157
+ // evaluator then coerces both sides to references and constructs
158
+ // the union rectangle.
159
+ if (t.type === 13 /* TokenType.Colon */) {
160
+ // Right-biased binding power to guarantee higher precedence than
161
+ // every other operator in the table above.
162
+ const lbp = 100;
163
+ const rbp = 101;
164
+ if (lbp < minBp) {
165
+ break;
166
+ }
167
+ this.next();
168
+ const right = this.parseExpr(rbp);
169
+ left = { type: 7 /* NodeType.BinaryOp */, op: ":", left, right };
170
+ continue;
171
+ }
172
+ break;
173
+ }
174
+ return left;
175
+ }
176
+ parsePrefix() {
177
+ this.enter();
178
+ try {
179
+ const result = this.parsePrefixInner();
180
+ // If the SheetRef consumer below set pendingSheet but the prefix that
181
+ // followed wasn't a ref (CellRef / Range / ColRange / RowRange), the
182
+ // sheet qualifier would leak into the next parse and silently attach
183
+ // itself to an unrelated node. Detect it here.
184
+ if (this.pendingSheet !== undefined) {
185
+ const sheet = this.pendingSheet;
186
+ this.pendingSheet = undefined;
187
+ this.pendingEndSheet = undefined;
188
+ throw new Error(`Sheet reference '${sheet}' not followed by a cell or range`);
189
+ }
190
+ return result;
191
+ }
192
+ finally {
193
+ this.leave();
194
+ }
195
+ }
196
+ parsePrefixInner() {
197
+ const t = this.peek();
198
+ if (!t) {
199
+ throw new Error("Unexpected end of formula");
200
+ }
201
+ // SheetRef: consume and set pending sheet for next cell/range
202
+ if (t.type === 7 /* TokenType.SheetRef */) {
203
+ this.next();
204
+ this.pendingSheet = t.sheetName;
205
+ this.pendingEndSheet = t.endSheetName;
206
+ return this.parsePrefix();
207
+ }
208
+ // Unary prefix: + -
209
+ if (t.type === 18 /* TokenType.UnaryPrefix */) {
210
+ this.next();
211
+ const bp = prefixBindingPower(t.value);
212
+ const operand = this.parseExpr(bp);
213
+ return { type: 8 /* NodeType.UnaryOp */, op: t.value, operand };
214
+ }
215
+ // @ implicit intersection prefix (Excel 365)
216
+ if (t.type === 23 /* TokenType.AtSign */) {
217
+ this.next();
218
+ const operand = this.parseExpr(55); // same precedence as unary +/-
219
+ return { type: 8 /* NodeType.UnaryOp */, op: "@", operand };
220
+ }
221
+ // Number literal
222
+ if (t.type === 1 /* TokenType.Number */) {
223
+ this.next();
224
+ const n = parseFloat(t.value);
225
+ // Reject non-finite literals at parse time. `1e400` would otherwise
226
+ // become `Infinity` and flow through arithmetic, requiring every
227
+ // downstream consumer to guard. Surfacing the overflow as a #NUM!
228
+ // error node keeps the engine's invariant that numeric values are
229
+ // always finite.
230
+ if (!Number.isFinite(n)) {
231
+ return { type: 4 /* NodeType.Error */, value: "#NUM!" };
232
+ }
233
+ return { type: 1 /* NodeType.Number */, value: n };
234
+ }
235
+ // String literal
236
+ if (t.type === 2 /* TokenType.String */) {
237
+ this.next();
238
+ return { type: 2 /* NodeType.String */, value: t.value };
239
+ }
240
+ // Boolean literal
241
+ if (t.type === 3 /* TokenType.Boolean */) {
242
+ this.next();
243
+ return { type: 3 /* NodeType.Boolean */, value: t.value === "TRUE" };
244
+ }
245
+ // Error literal
246
+ if (t.type === 4 /* TokenType.Error */) {
247
+ this.next();
248
+ return { type: 4 /* NodeType.Error */, value: t.value };
249
+ }
250
+ // Parenthesized expression
251
+ if (t.type === 10 /* TokenType.OpenParen */) {
252
+ this.next();
253
+ const expr = this.parseExpr(0);
254
+ this.expect(11 /* TokenType.CloseParen */);
255
+ return expr;
256
+ }
257
+ // Array constant: {1,2;3,4}
258
+ if (t.type === 15 /* TokenType.OpenBrace */) {
259
+ return this.parseArrayConstant();
260
+ }
261
+ // Function call: NAME(args)
262
+ if (t.type === 8 /* TokenType.Function */) {
263
+ return this.parseFunctionCall();
264
+ }
265
+ // Cell reference (may become range via tokenizer)
266
+ if (t.type === 5 /* TokenType.CellRef */) {
267
+ this.next();
268
+ const ref = this.parseCellRefFromToken(t);
269
+ const sheet = this.pendingSheet;
270
+ const endSheet = this.pendingEndSheet;
271
+ this.pendingSheet = undefined;
272
+ this.pendingEndSheet = undefined;
273
+ ref.sheet = sheet;
274
+ ref.endSheet = endSheet;
275
+ return ref;
276
+ }
277
+ // Range reference (already parsed by tokenizer as A1:B2)
278
+ if (t.type === 6 /* TokenType.Range */) {
279
+ this.next();
280
+ const sheet = this.pendingSheet;
281
+ const endSheet = this.pendingEndSheet;
282
+ this.pendingSheet = undefined;
283
+ this.pendingEndSheet = undefined;
284
+ return this.parseRangeFromToken(t, sheet, endSheet);
285
+ }
286
+ // Named range / defined name
287
+ if (t.type === 19 /* TokenType.Name */) {
288
+ this.next();
289
+ return { type: 12 /* NodeType.Name */, name: t.value };
290
+ }
291
+ // Whole-column range (e.g. A:B, $C:$D)
292
+ if (t.type === 20 /* TokenType.ColRange */) {
293
+ this.next();
294
+ const sheet = this.pendingSheet;
295
+ const endSheet = this.pendingEndSheet;
296
+ this.pendingSheet = undefined;
297
+ this.pendingEndSheet = undefined;
298
+ const parts = t.value.split(":");
299
+ const startCol = parts[0].replace(/\$/g, "").toUpperCase();
300
+ const endCol = parts[1].replace(/\$/g, "").toUpperCase();
301
+ return { type: 13 /* NodeType.ColRangeRef */, startCol, endCol, sheet, endSheet };
302
+ }
303
+ // Whole-row range (e.g. 1:5, $3:$7)
304
+ if (t.type === 21 /* TokenType.RowRange */) {
305
+ this.next();
306
+ const sheet = this.pendingSheet;
307
+ const endSheet = this.pendingEndSheet;
308
+ this.pendingSheet = undefined;
309
+ this.pendingEndSheet = undefined;
310
+ const parts = t.value.split(":");
311
+ const startRow = parseInt(parts[0].replace(/\$/g, ""), 10);
312
+ const endRow = parseInt(parts[1].replace(/\$/g, ""), 10);
313
+ return { type: 14 /* NodeType.RowRangeRef */, startRow, endRow, sheet, endSheet };
314
+ }
315
+ // Structured reference (e.g. Table1[Column], [@Column])
316
+ if (t.type === 22 /* TokenType.StructuredRef */) {
317
+ this.next();
318
+ return {
319
+ type: 15 /* NodeType.StructuredRef */,
320
+ tableName: t.tableName,
321
+ columns: t.columns,
322
+ specials: t.specials
323
+ };
324
+ }
325
+ throw new Error(`Unexpected token: ${t.type}`);
326
+ }
327
+ parseCellRefFromToken(t) {
328
+ return {
329
+ type: 5 /* NodeType.CellRef */,
330
+ col: t.col,
331
+ row: t.row,
332
+ colAbsolute: t.colAbsolute,
333
+ rowAbsolute: t.rowAbsolute
334
+ };
335
+ }
336
+ parseRangeFromToken(t, sheet, endSheet) {
337
+ // Token value is like "A1:B2" or "$A$1:$B$2"
338
+ const parts = t.value.split(":");
339
+ const startRef = parseCellRefStr(parts[0]);
340
+ const endRef = parseCellRefStr(parts[1]);
341
+ return {
342
+ type: 6 /* NodeType.RangeRef */,
343
+ start: { ...startRef, sheet },
344
+ end: { ...endRef, sheet },
345
+ sheet,
346
+ endSheet
347
+ };
348
+ }
349
+ parseFunctionCall() {
350
+ const nameToken = this.next(); // function name
351
+ this.expect(10 /* TokenType.OpenParen */);
352
+ const args = [];
353
+ if (this.peek()?.type !== 11 /* TokenType.CloseParen */) {
354
+ // First argument: might be missing if comma is next
355
+ if (this.peek()?.type === 12 /* TokenType.Comma */) {
356
+ args.push({ type: 16 /* NodeType.Missing */ });
357
+ }
358
+ else {
359
+ args.push(this.parseExpr(0));
360
+ }
361
+ while (this.peek()?.type === 12 /* TokenType.Comma */) {
362
+ this.next(); // skip comma
363
+ // Next argument: missing if followed by comma or close paren
364
+ if (this.peek()?.type === 12 /* TokenType.Comma */ || this.peek()?.type === 11 /* TokenType.CloseParen */) {
365
+ args.push({ type: 16 /* NodeType.Missing */ });
366
+ }
367
+ else {
368
+ args.push(this.parseExpr(0));
369
+ }
370
+ }
371
+ }
372
+ this.expect(11 /* TokenType.CloseParen */);
373
+ return {
374
+ type: 9 /* NodeType.FunctionCall */,
375
+ name: nameToken.name,
376
+ args
377
+ };
378
+ }
379
+ parseArrayConstant() {
380
+ this.next(); // skip {
381
+ const rows = [];
382
+ let currentRow = [];
383
+ if (this.peek()?.type !== 16 /* TokenType.CloseBrace */) {
384
+ currentRow.push(this.parseExpr(0));
385
+ while (this.peek()) {
386
+ const t = this.peek();
387
+ if (t.type === 12 /* TokenType.Comma */) {
388
+ this.next();
389
+ currentRow.push(this.parseExpr(0));
390
+ }
391
+ else if (t.type === 17 /* TokenType.Semicolon */) {
392
+ this.next();
393
+ rows.push(currentRow);
394
+ currentRow = [];
395
+ currentRow.push(this.parseExpr(0));
396
+ }
397
+ else {
398
+ break;
399
+ }
400
+ }
401
+ }
402
+ rows.push(currentRow);
403
+ this.expect(16 /* TokenType.CloseBrace */);
404
+ return { type: 10 /* NodeType.Array */, rows };
405
+ }
406
+ }
407
+ // Helper to parse a cell reference string like "$A$1" or "B2"
408
+ function parseCellRefStr(s) {
409
+ let i = 0;
410
+ let colAbsolute = false;
411
+ let rowAbsolute = false;
412
+ if (s[i] === "$") {
413
+ colAbsolute = true;
414
+ i++;
415
+ }
416
+ const colStart = i;
417
+ while (i < s.length && ((s[i] >= "A" && s[i] <= "Z") || (s[i] >= "a" && s[i] <= "z"))) {
418
+ i++;
419
+ }
420
+ const col = s.slice(colStart, i).toUpperCase();
421
+ if (i < s.length && s[i] === "$") {
422
+ rowAbsolute = true;
423
+ i++;
424
+ }
425
+ const row = s.slice(i);
426
+ return {
427
+ type: 5 /* NodeType.CellRef */,
428
+ col,
429
+ row,
430
+ colAbsolute,
431
+ rowAbsolute
432
+ };
433
+ }
434
+ // ============================================================================
435
+ // Public API
436
+ // ============================================================================
437
+ function parse(tokens) {
438
+ const parser = new Parser(tokens);
439
+ return parser.parse();
440
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /**
3
+ * Token Types for Formula Tokenizer
4
+ *
5
+ * Defines a proper discriminated union of all token types.
6
+ * Each token variant carries only the data relevant to its type.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.stripFunctionPrefix = stripFunctionPrefix;
10
+ // ============================================================================
11
+ // Discriminated Union
12
+ // ============================================================================
13
+ /**
14
+ * Strip Excel's `_XLFN.` / `_XLFN._XLWS.` function-name prefixes.
15
+ *
16
+ * Excel emits these prefixes for functions introduced after the original
17
+ * XLSX schema was frozen (e.g. `_XLFN.FILTER`, `_XLFN._XLWS.SORT`). The
18
+ * canonical function name is recovered by stripping the prefix.
19
+ *
20
+ * The input may or may not already be uppercased — this helper does not
21
+ * alter case; callers that compare against an uppercase table should
22
+ * uppercase first (or compare case-insensitively).
23
+ */
24
+ function stripFunctionPrefix(name) {
25
+ if (name.startsWith("_XLFN._XLWS.")) {
26
+ return name.slice(12);
27
+ }
28
+ if (name.startsWith("_XLFN.")) {
29
+ return name.slice(6);
30
+ }
31
+ return name;
32
+ }