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