@sheetxl/sdk 0.8.0-beta.11 → 0.8.0-beta.13
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/THIRD-PARTY-NOTICES.md +172 -0
- package/browser/esm/{BMyDRQ716j79h_bH.mjs → -GEhXGMfNcWmHPby.mjs} +6 -6
- package/browser/esm/{B7aUIvgUjncMMD_i.mjs → 9WXf_BTKjW1cQisZ.mjs} +95 -94
- package/browser/esm/{PcHFjNzQsE54POri.mjs → B2SgIPPBX0wjzuq8.mjs} +1 -1
- package/browser/esm/{DEiPS3Dr-s4fPbVZ.mjs → BC2RwlNwCdRywkoD.mjs} +1 -1
- package/browser/esm/{BpgskG1Er_lGQ_yS.mjs → BEqhm9xAUPiHUCFv.mjs} +1 -1
- package/browser/esm/BHgqi7KNrl7Vjr0W.mjs +348 -0
- package/browser/esm/{BkBhLS0l6z8sxI6D.mjs → BJKH0tDRx2FeSWvt.mjs} +2 -2
- package/browser/esm/{CU3DmJ-YnVVrC1_k.mjs → BTgWtqdQoh2cB6DL.mjs} +1 -1
- package/browser/esm/{Dyq_ivuHvlXLwPCl.mjs → BVshV1iY3bcUH9_E.mjs} +1135 -1129
- package/browser/esm/{BFagR2JeWs74iAG3.mjs → BYQ63XU7JzB4_itX.mjs} +1 -1
- package/browser/esm/{DvAaxH6z_tGvrRzl.mjs → Bax5aOzQkbHKXW_X.mjs} +239 -230
- package/browser/esm/{DLLE0FZNsKxbBzRn.mjs → BiDGKhtzV6yIy66o.mjs} +45 -45
- package/browser/esm/BmYrWK5OmHRtgyqM.mjs +367 -0
- package/browser/esm/{ClPfI4lODvCece29.mjs → BoAlHgjPQ6mxb_oO.mjs} +74 -74
- package/browser/esm/{BoV6zPBnfqCBCqZ7.mjs → C0mjTq8lhrX3HiPa.mjs} +4328 -3166
- package/browser/esm/{nvU0ClAbf0g94YBK.mjs → C5j0IdwtYkWlOftv.mjs} +604 -596
- package/browser/esm/{DWNzqw7DUKwoxjri.mjs → CL84-iL2QeKlLzo5.mjs} +2 -2
- package/browser/esm/{Ctjb0SsxV4K4MMqG.mjs → CLkBe-6n-pStQhnz.mjs} +2 -2
- package/{node/esm/CZICGK_ss0HoGHCP.mjs → browser/esm/CPzfhTPX2Y4dHX2p.mjs} +2 -2
- package/browser/esm/{Dlmig06rIo7cInRk.mjs → CSJuIjYUOE387FIP.mjs} +1 -1
- package/browser/esm/{BjkCiv5Jz6WYKZeu.mjs → Cdw0mGuoV3IU2LhR.mjs} +2 -2
- package/browser/esm/Ced5uyofOWHuL_Jy.mjs +114 -0
- package/browser/esm/{CkxWugaJFjDGZNZ-.mjs → Ci_LJ4S_GvYX0STI.mjs} +1 -1
- package/browser/esm/{zlLuW405RSguy4Kn.mjs → CwygVKP_RXmne5Ot.mjs} +47 -47
- package/browser/esm/{C4MqfLn9Dm-l3OIk.mjs → D-mfK0noQrM2jZLT.mjs} +1 -1
- package/browser/esm/{BnG31I6Oj_HEtSPS.mjs → D9SH_8v3FYCnxOFK.mjs} +1 -1
- package/browser/esm/{BVDiOXGMc5_FMGfy.mjs → DPD8fop6az9HZNiK.mjs} +2 -2
- package/browser/esm/DW-MmlgMH87l-_cw.mjs +302 -0
- package/browser/esm/{CaB7J-xgfKO2uAkG.mjs → DctIlUsO78-OU2ht.mjs} +2 -2
- package/browser/esm/DdcKkVb4jM6Y_epY.mjs +184 -0
- package/browser/esm/{CHU6iu_WGlm7fLET.mjs → DfKzE0IY0TjaEIxG.mjs} +1 -1
- package/browser/esm/{C2VbEI_XVAoseAwa.mjs → DkloMquaR1pbZCER.mjs} +44 -43
- package/browser/esm/{C16ycKja6zG0crV_.mjs → Dz86-De57bv2VYIi.mjs} +19447 -16481
- package/browser/esm/{BtvLTTfSBdAKplVG.mjs → HApSgmV2FXRRwQac.mjs} +1 -1
- package/browser/esm/{CQYjO777cmAznUzK.mjs → IbVAQU4YqtFqLwYk.mjs} +1 -1
- package/browser/esm/index.mjs +823 -644
- package/browser/esm/mHQ95RAfxHzcUN2r.mjs +18 -0
- package/browser/esm/pm00uZZu_H3gxHFx.mjs +117 -0
- package/browser/esm/{CV5EGEjG5_-CPpP0.mjs → quEvwgrEuOb0h3q-.mjs} +1926 -1298
- package/browser/esm/{ClbvFbFzFzXLBKNN.mjs → zZngLMg6mg6nnNGX.mjs} +66 -66
- package/licenses/dependencies.txt +71 -1
- package/node/esm/{BqiexuA89caYnAPz.mjs → -K4Cek-bTUItkB_8.mjs} +1 -1
- package/node/esm/-b8yNV4v9qiq8EMY.mjs +117 -0
- package/node/esm/{D8zEN-6ZdDqDvTxM.mjs → 1V-m67YHbxmg3xk2.mjs} +74 -74
- package/node/esm/{D_t5AUxSm7_icjzq.mjs → 4ROAfJC1mokmqubv.mjs} +1 -1
- package/node/esm/B89et7t3uRmtxk4v.mjs +115 -0
- package/node/esm/BKBkCBNGhMU0nQdY.mjs +372 -0
- package/node/esm/{OVfaSb506tNSIvbv.mjs → BQ2XqExomMceAjfe.mjs} +20822 -18373
- package/node/esm/{2Kihw_-5lVTEnwMa.mjs → Bfg7qjCXCwXbzW3K.mjs} +1 -1
- package/node/esm/{D1TKBVmoKGAXf37B.mjs → BtMeAB_dqJnOfzJM.mjs} +2 -2
- package/node/esm/{D6e2z7eZpxOJXHc7.mjs → Byc_bxU_MdjYtt0x.mjs} +1 -1
- package/node/esm/{CNCNJNg890KdgkWh.mjs → Bzrl292TNCK3Cpid.mjs} +1 -1
- package/node/esm/{De2IONBxQhz-Qbyh.mjs → C0P9zspoypRAj7yv.mjs} +1 -1
- package/node/esm/{CzXT00vrQa1_gvW9.mjs → C9gpMN3galHGZyoK.mjs} +1 -1
- package/node/esm/CKCG2peOkTq0gIIW.mjs +310 -0
- package/node/esm/{DUTskXCXref-IJnI.mjs → CWBS90g3Hz-kQDkY.mjs} +46 -46
- package/node/esm/{BIwObuhTJYf0jpUa.mjs → CoGSVnn-hNMtTEus.mjs} +2 -2
- package/node/esm/{CwePQwTILHHjGDkZ.mjs → CzrLqStvrcPE2-hb.mjs} +194 -185
- package/node/esm/{CCN5vD410obwdz38.mjs → D16EdlZG1hX5WUUK.mjs} +96 -95
- package/node/esm/{CDHdgJXH2vS71WMc.mjs → D1mDga2K5sjs8y07.mjs} +1 -1
- package/node/esm/{cGwrLA1RCE-WhJ7w.mjs → D2jtztjE6c23RKvZ.mjs} +1 -1
- package/node/esm/{Bbf1Pm9Gk7YpLTvg.mjs → D9nRcWsYk3M82iD8.mjs} +1 -1
- package/node/esm/{yavzZOiZW_EjG9lE.mjs → DALYzTxZ9Ur9C69Q.mjs} +1 -1
- package/node/esm/{DkwIPzKc3UwdUIfM.mjs → DF0nL7s01dp7n0Bx.mjs} +10 -10
- package/node/esm/{DNRhGK-8Tr9xcRyc.mjs → DO5ldLqhTvIfPXLW.mjs} +3348 -2610
- package/node/esm/DQz8J8ci7EJdqbuB.mjs +351 -0
- package/node/esm/{BIRq1kT7lLRzns9t.mjs → DR2OQTKqqyIkZnse.mjs} +2 -2
- package/node/esm/{857CIBgQgGpnqrXk.mjs → DSTLPBgpsGW6qP9e.mjs} +73 -73
- package/node/esm/{CGp6VZL-gZa9Uezx.mjs → DiXp7KSOZUSWXaZ5.mjs} +1 -1
- package/node/esm/{CZiqiay42tFTrLI4.mjs → DwvXHsycOQR219c7.mjs} +1 -1
- package/node/esm/{B21JjOLghRoDOrkx.mjs → Hc6B04OyVzHx2F5I.mjs} +38 -37
- package/node/esm/{Ct3h15sCus4Tgt6M.mjs → NkPNHsq2T3DXg76x.mjs} +561 -553
- package/node/esm/{B084DssTcdBheTp_.mjs → Nl_IIkO1jbk0s9i-.mjs} +4552 -3373
- package/node/esm/{D2KBymQJd1XhpeQD.mjs → OQT5lGqq8a4r5xNa.mjs} +1 -1
- package/node/esm/OTaaFGhF-k_iwobp.mjs +18 -0
- package/node/esm/{CdJHUJSBRHZoryPe.mjs → Z1elC_roIu7LhceZ.mjs} +53 -53
- package/{browser/esm/D5np__Jb1euAyaLw.mjs → node/esm/e3F3OVXCxLJrSukW.mjs} +2 -2
- package/node/esm/index.mjs +806 -625
- package/node/esm/{mFiBSM7XgBHV9AY7.mjs → suOBVUz-pca6ilJH.mjs} +1607 -1601
- package/package.json +8 -6
- package/resources/contents.json +108 -0
- package/resources/fonts/aptos-bold-italic.hinted.json +125 -0
- package/resources/fonts/aptos-bold-italic.metrics.json +221 -0
- package/resources/fonts/aptos-bold-italic.rows.json +8 -0
- package/resources/fonts/aptos-bold.hinted.json +125 -0
- package/resources/fonts/aptos-bold.metrics.json +221 -0
- package/resources/fonts/aptos-bold.rows.json +8 -0
- package/resources/fonts/aptos-display-bold-italic.hinted.json +125 -0
- package/resources/fonts/aptos-display-bold-italic.metrics.json +221 -0
- package/resources/fonts/aptos-display-bold-italic.rows.json +8 -0
- package/resources/fonts/aptos-display-bold.hinted.json +125 -0
- package/resources/fonts/aptos-display-bold.metrics.json +221 -0
- package/resources/fonts/aptos-display-bold.rows.json +8 -0
- package/resources/fonts/aptos-display-italic.hinted.json +124 -0
- package/resources/fonts/aptos-display-italic.metrics.json +221 -0
- package/resources/fonts/aptos-display-italic.rows.json +8 -0
- package/resources/fonts/aptos-display-regular.hinted.json +125 -0
- package/resources/fonts/aptos-display-regular.metrics.json +221 -0
- package/resources/fonts/aptos-display-regular.rows.json +8 -0
- package/resources/fonts/aptos-italic.hinted.json +125 -0
- package/resources/fonts/aptos-italic.metrics.json +221 -0
- package/resources/fonts/aptos-italic.rows.json +8 -0
- package/resources/fonts/aptos-narrow-bold-italic.hinted.json +125 -0
- package/resources/fonts/aptos-narrow-bold-italic.metrics.json +221 -0
- package/resources/fonts/aptos-narrow-bold-italic.rows.json +8 -0
- package/resources/fonts/aptos-narrow-bold.hinted.json +125 -0
- package/resources/fonts/aptos-narrow-bold.metrics.json +221 -0
- package/resources/fonts/aptos-narrow-bold.rows.json +8 -0
- package/resources/fonts/aptos-narrow-italic.hinted.json +125 -0
- package/resources/fonts/aptos-narrow-italic.metrics.json +221 -0
- package/resources/fonts/aptos-narrow-italic.rows.json +8 -0
- package/resources/fonts/aptos-narrow-regular.hinted.json +125 -0
- package/resources/fonts/aptos-narrow-regular.metrics.json +221 -0
- package/resources/fonts/aptos-narrow-regular.rows.json +8 -0
- package/resources/fonts/aptos-regular.hinted.json +125 -0
- package/resources/fonts/aptos-regular.metrics.json +221 -0
- package/resources/fonts/aptos-regular.rows.json +8 -0
- package/resources/fonts/arial-bold-italic.rows.json +0 -1
- package/resources/fonts/arial-bold.rows.json +0 -1
- package/resources/fonts/arial-italic.rows.json +0 -1
- package/resources/fonts/arial-regular.rows.json +0 -1
- package/resources/fonts/calibri-bold-italic.rows.json +0 -1
- package/resources/fonts/calibri-bold.rows.json +0 -1
- package/resources/fonts/calibri-italic.rows.json +0 -1
- package/resources/fonts/calibri-regular.rows.json +0 -1
- package/resources/fonts/cambria-bold-italic.rows.json +0 -1
- package/resources/fonts/cambria-bold.rows.json +0 -1
- package/resources/fonts/cambria-italic.rows.json +0 -1
- package/resources/fonts/cambria-regular.rows.json +0 -1
- package/resources/fonts/contents.json +240 -0
- package/resources/fonts/courier-new-bold-italic.rows.json +0 -1
- package/resources/fonts/courier-new-bold.rows.json +0 -1
- package/resources/fonts/courier-new-italic.rows.json +0 -1
- package/resources/fonts/courier-new-regular.rows.json +0 -1
- package/resources/fonts/times-new-roman-bold-italic.rows.json +0 -1
- package/resources/fonts/times-new-roman-bold.rows.json +0 -1
- package/resources/fonts/times-new-roman-italic.rows.json +0 -1
- package/resources/fonts/times-new-roman-regular.rows.json +0 -1
- package/resources/locales/de/model.msg.json +12 -2
- package/resources/locales/en/model.msg.json +13 -2
- package/types/scripting-api.json +10638 -10446
- package/types/scripting-enums.json +20 -1
- package/types/scripting.d.ts +1536 -477
- package/types/src/.generated/wasm/sdk.d.ts +5 -27
- package/types/src/address/AddressUtils.d.ts +8 -0
- package/types/src/address/_SheetNameQuoteChars.d.ts +3 -0
- package/types/src/{sheet → anomalies}/_Anomalies.d.ts +3 -3
- package/types/src/anomalies/_FocusTable.d.ts +5 -0
- package/types/src/{sheet/_AnomalyFormulaChecks.d.ts → anomalies/_FormulaChecks.d.ts} +10 -2
- package/types/src/{sheet/_AnomalyLabelChecks.d.ts → anomalies/_LabelChecks.d.ts} +1 -1
- package/types/src/anomalies/_LiteralChecks.d.ts +35 -0
- package/types/src/anomalies/_SeriesChecks.d.ts +13 -0
- package/types/src/calculation/Calculation.d.ts +61 -98
- package/types/src/calculation/ExternalBookBindings.d.ts +2 -29
- package/types/src/calculation/ICalculation.d.ts +96 -9
- package/types/src/calculation/NamedFormulaCollection.d.ts +110 -10
- package/types/src/calculation/TokenType.d.ts +0 -10
- package/types/src/calculation/_CloneBoundary.d.ts +0 -24
- package/types/src/calculation/_FormulaToolkit.d.ts +0 -5
- package/types/src/calculation/compiler/ASTTypes.d.ts +6 -15
- package/types/src/calculation/compiler/CompilerUtils.d.ts +0 -227
- package/types/src/calculation/compiler/FormulaLexer.d.ts +0 -8
- package/types/src/calculation/compiler/FormulaParser.d.ts +0 -61
- package/types/src/calculation/compiler/ParserUtils.d.ts +0 -24
- package/types/src/calculation/compiler/Types.d.ts +1 -45
- package/types/src/calculation/engine/CalcBackend.d.ts +83 -127
- package/types/src/calculation/engine/index.d.ts +0 -8
- package/types/src/calculation/executor/CalcExecutor.d.ts +50 -116
- package/types/src/calculation/executor/CalcExecutorUtils.d.ts +47 -12
- package/types/src/calculation/executor/CircularReference.d.ts +0 -17
- package/types/src/calculation/executor/_BlockOrder.d.ts +29 -0
- package/types/src/calculation/executor/_WhatIf.d.ts +31 -0
- package/types/src/calculation/formula/FormulaBlock.d.ts +4 -31
- package/types/src/calculation/formula/FormulaRecordView.d.ts +0 -15
- package/types/src/calculation/formula/IFormulaBlock.d.ts +5 -12
- package/types/src/calculation/formula/LambdaValue.d.ts +0 -15
- package/types/src/calculation/formula/TokenUtils.d.ts +1 -8
- package/types/src/calculation/functions/_DataTableFunction.d.ts +14 -0
- package/types/src/calculation/grid/CalcGrid.d.ts +8 -64
- package/types/src/calculation/grid/CalcGridBackend.d.ts +12 -35
- package/types/src/calculation/grid/CalcGridProxy.d.ts +0 -15
- package/types/src/calculation/grid/CalcGridUtils.d.ts +21 -23
- package/types/src/calculation/grid/ICalcGrid.d.ts +28 -109
- package/types/src/calculation/grid/_CalcRequest.d.ts +17 -33
- package/types/src/calculation/spatial/CircularEntry.d.ts +0 -10
- package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +54 -82
- package/types/src/calculation/spatial/SpillEntry.d.ts +20 -3
- package/types/src/calculation/state/CalcNode.d.ts +0 -1
- package/types/src/calculation/state/CalcScope.d.ts +29 -9
- package/types/src/calculation/state/CalcState.d.ts +19 -9
- package/types/src/calculation/state/CalculationContext.d.ts +32 -38
- package/types/src/calculation/state/DeferredCalls.d.ts +207 -0
- package/types/src/calculation/state/IContextContainer.d.ts +19 -55
- package/types/src/calculation/state/_KeepBlanks.d.ts +5 -0
- package/types/src/calculation/state/_PendingOverlayGrid.d.ts +52 -33
- package/types/src/calculation/state/_WhatIfLayer.d.ts +77 -0
- package/types/src/calculation/symbol/ExternalSheetSymbols.d.ts +0 -42
- package/types/src/calculation/symbol/ISymbolRegistry.d.ts +0 -6
- package/types/src/calculation/symbol/SheetSymbolProvider.d.ts +0 -12
- package/types/src/calculation/symbol/SymbolRegistry.d.ts +0 -9
- package/types/src/calculation/toolkit/index.d.ts +0 -8
- package/types/src/cell/ICell.d.ts +59 -54
- package/types/src/cellControl/CellControl.d.ts +67 -0
- package/types/src/cellControl/CellControlCollection.d.ts +29 -0
- package/types/src/cellControl/CellControlRegistry.d.ts +47 -0
- package/types/src/cellControl/ICellControl.d.ts +99 -0
- package/types/src/cellControl/ICellControlCollection.d.ts +67 -0
- package/types/src/cellControl/index.d.ts +4 -0
- package/types/src/cellRange/ICellRange.d.ts +226 -67
- package/types/src/cellRange/ICellRanges.d.ts +4 -3
- package/types/src/chart/Chart.d.ts +0 -16
- package/types/src/chart/_ChartParts.d.ts +0 -39
- package/types/src/chart/_ChartSource.d.ts +0 -14
- package/types/src/chart/createChart.d.ts +1 -1
- package/types/src/chart/kinds/ChartKind.d.ts +4 -4
- package/types/src/chart/kinds/_Placeholder.d.ts +0 -1
- package/types/src/chart/layout/ChartLayout.d.ts +5 -1
- package/types/src/chart/layout/TextMeasurer.d.ts +0 -20
- package/types/src/chart/layout/_LayoutUtils.d.ts +0 -16
- package/types/src/chart/math/BoxStats.d.ts +0 -8
- package/types/src/chart/math/DateUnitCalcs.d.ts +0 -10
- package/types/src/chart/math/Histogram.d.ts +0 -17
- package/types/src/chart/math/OrdUnitCalcs.d.ts +0 -53
- package/types/src/chart/math/Treemap.d.ts +0 -15
- package/types/src/chart/math/Trendlines.d.ts +0 -8
- package/types/src/chart/math/UnitCalcs.d.ts +0 -22
- package/types/src/chart/model/_Edits.d.ts +0 -33
- package/types/src/chart/model/_Grouping.d.ts +0 -25
- package/types/src/chart/model/_Inference.d.ts +0 -18
- package/types/src/chart/model/_NewChart.d.ts +0 -41
- package/types/src/chart/model/_OfPie.d.ts +0 -7
- package/types/src/chart/resolve/_LegacyStyles.d.ts +0 -20
- package/types/src/chart/resolve/_Resolve.d.ts +3 -12
- package/types/src/chart/resolve/_ResolvedChart.d.ts +5 -8
- package/types/src/collections/ISparseGrid.d.ts +11 -2
- package/types/src/collections/MixedTypedArrayList.d.ts +8 -2
- package/types/src/collections/SparseGrid.d.ts +3 -8
- package/types/src/collections/_GridUtils.d.ts +0 -10
- package/types/src/comment/_NoteBox.d.ts +0 -15
- package/types/src/condition/AnchoredConditional.d.ts +3 -25
- package/types/src/condition/BuiltInOperators/AbstractOperator.d.ts +0 -49
- package/types/src/condition/BuiltinSelectors/DisplaySelector.d.ts +0 -10
- package/types/src/condition/ICondition.d.ts +2 -2
- package/types/src/condition/_ConditionUtils.d.ts +0 -38
- package/types/src/externalBook/ExternalBookCollection.d.ts +0 -15
- package/types/src/externalBook/ExternalBookName.d.ts +2 -3
- package/types/src/externalBook/IExternalBook.d.ts +16 -18
- package/types/src/fetch/Fetcher.d.ts +15 -0
- package/types/src/fetch/IFetcher.d.ts +48 -0
- package/types/src/fetch/_WorkbookFetch.d.ts +43 -0
- package/types/src/fetch/index.d.ts +3 -0
- package/types/src/fill/PaintUtils.d.ts +3 -1
- package/types/src/font/AdvanceTable.d.ts +16 -42
- package/types/src/font/IFont.d.ts +32 -9
- package/types/src/font/TableFileAdvanceBuilder.d.ts +6 -3
- package/types/src/font/_FontUtils.d.ts +0 -8
- package/types/src/font/_StandIns.d.ts +33 -0
- package/types/src/hyperlink/IHyperlink.d.ts +10 -0
- package/types/src/hyperlink/_Hyperlink.d.ts +4 -1
- package/types/src/index.d.ts +2 -1
- package/types/src/io/IWorkbookIO.d.ts +3 -3
- package/types/src/io/WorkbookOrigin.d.ts +2 -2
- package/types/src/license/LicenseManager.d.ts +2 -1
- package/types/src/license/_Utils.d.ts +4 -3
- package/types/src/license/details.d.ts +3 -1
- package/types/src/license/keys.d.ts +6 -0
- package/types/src/license/license-key.d.ts +15 -33
- package/types/src/license/token.d.ts +55 -0
- package/types/src/named/INamedCollection.d.ts +36 -0
- package/types/src/named/NamedCollection.d.ts +18 -0
- package/types/src/picture/IPicture.d.ts +45 -0
- package/types/src/picture/Picture.d.ts +12 -0
- package/types/src/pivot/PivotTable.d.ts +0 -7
- package/types/src/primitives/AsyncValue.d.ts +46 -0
- package/types/src/primitives/PrimitiveUtils.d.ts +1 -110
- package/types/src/primitives/Range.d.ts +0 -60
- package/types/src/primitives/ScalarCollation.d.ts +0 -106
- package/types/src/primitives/stats/AggregateStats.d.ts +0 -19
- package/types/src/print/PageLayout.d.ts +0 -6
- package/types/src/reference/ReferenceUtils.d.ts +4 -2
- package/types/src/resource/IResource.d.ts +9 -0
- package/types/src/resource/IResourceCollection.d.ts +4 -0
- package/types/src/resource/Resource.d.ts +2 -0
- package/types/src/resource/_AddResource.d.ts +13 -0
- package/types/src/richData/CellImage.d.ts +95 -0
- package/types/src/richData/Hyperlink.d.ts +49 -0
- package/types/src/richData/IRichDataCollection.d.ts +76 -0
- package/types/src/richData/IRichDataKind.d.ts +55 -11
- package/types/src/richData/RichArray.d.ts +42 -0
- package/types/src/richData/RichDataCollection.d.ts +23 -0
- package/types/src/richData/RichDataRegistry.d.ts +52 -14
- package/types/src/richData/RichDataValues.d.ts +20 -0
- package/types/src/richData/RichRecord.d.ts +68 -0
- package/types/src/richData/RichText.d.ts +5 -5
- package/types/src/richData/index.d.ts +6 -0
- package/types/src/scripting/FunctionArguments.d.ts +17 -1
- package/types/src/scripting/FunctionCollection.d.ts +8 -0
- package/types/src/scripting/Scripts.d.ts +10 -0
- package/types/src/scripting/TypedFunction.d.ts +2 -109
- package/types/src/sheet/ICellContainerOptions.d.ts +6 -0
- package/types/src/sheet/IWorksheet.d.ts +26 -22
- package/types/src/sheet/NamedCellRange.d.ts +0 -21
- package/types/src/sheet/SheetCell.d.ts +25 -3
- package/types/src/sheet/SheetRange.d.ts +8 -2
- package/types/src/sheet/SheetRanges.d.ts +2 -2
- package/types/src/sheet/Worksheet.d.ts +117 -104
- package/types/src/sheet/_DelimitedText.d.ts +13 -0
- package/types/src/sheet/_IgnoredErrors.d.ts +0 -12
- package/types/src/sheet/_ListenerAnchor.d.ts +7 -1
- package/types/src/sheet/_ScalarListFactory.d.ts +46 -17
- package/types/src/sheet/_SheetCoords.d.ts +0 -7
- package/types/src/sheet/_SheetFilterUtils.d.ts +0 -8
- package/types/src/sheet/_SheetMutations.d.ts +4 -1
- package/types/src/sheet/_SheetStateReader.d.ts +0 -10
- package/types/src/sheet/_SheetStateTypes.d.ts +23 -14
- package/types/src/sheet/_SheetUtils.d.ts +1 -1
- package/types/src/sheet/style/_RowLine.d.ts +32 -0
- package/types/src/sheet/style/_StyleUtils.d.ts +6 -14
- package/types/src/sheetView/_SheetViewUtils.d.ts +0 -1
- package/types/src/slicer/_BuiltInSlicerStyles.d.ts +0 -5
- package/types/src/style/ICellStyle.d.ts +4 -0
- package/types/src/table/AnchoredTable.d.ts +0 -147
- package/types/src/text/TextFrame.d.ts +4 -1
- package/types/src/text/TextStacked.d.ts +0 -24
- package/types/src/text/TextWrapper.d.ts +3 -5
- package/types/src/text/_LineBox.d.ts +24 -0
- package/types/src/text/_TextUtils.d.ts +5 -2
- package/types/src/text/_TextWrapperFallback.d.ts +2 -1
- package/types/src/wasm/sdkWasm.d.ts +1 -1
- package/types/src/workbook/IWorkbook.d.ts +40 -1
- package/types/src/workbook/Workbook.d.ts +25 -13
- package/types/src/workbook/WorkbookRanges.d.ts +1 -1
- package/browser/esm/BGOFfpxr2jPIdqmV.mjs +0 -40
- package/browser/esm/BLoUBId2xZpXAK_H.mjs +0 -698
- package/browser/esm/C5E6zSGAALWf61n4.mjs +0 -199
- package/browser/esm/S2dNNx1a5ydRnARM.mjs +0 -367
- package/browser/esm/f1IoRb7tEb0QmCSt.mjs +0 -110
- package/browser/esm/gssVX_FH1XFN-twD.mjs +0 -210
- package/node/esm/BrCKGFRsX_ezFJ4B.mjs +0 -811
- package/node/esm/DOU54VsOjG-m-NyQ.mjs +0 -210
- package/node/esm/Db0v7zXNnyjBIjjI.mjs +0 -372
- package/node/esm/Df1bL6VFvrqIdSLB.mjs +0 -40
- package/node/esm/DrTZbfemSLq2mseG.mjs +0 -111
- package/types/src/dataTable/DataTable.d.ts +0 -67
- package/types/src/dataTable/DataTableCollection.d.ts +0 -19
- package/types/src/dataTable/IDataTable.d.ts +0 -99
- package/types/src/dataTable/IDataTableCollection.d.ts +0 -18
- package/types/src/dataTable/index.d.ts +0 -6
package/node/esm/index.mjs
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
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.13
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
|
-
import { a as e, l as t, o as s, t as r, u as i } from "./
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { n as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { BufferUtils as $t, CommonUtils as Kt, CoordUtils as Gt, DefaultLanguagePackService as Xt, ExpectedError as Zt, InvalidPasswordError as Qt, MimeType as Yt, Notifier as es, NullNotAllowedError as ts, OutOfBoundsError as ss, PasswordRequiredError as rs, ProtectedError as is, UndoManager as os, messageKey as ns, t as as } from "@sheetxl/utils";
|
|
7
|
+
import { a as e, l as t, o as s, t as r, u as i } from "./Bfg7qjCXCwXbzW3K.mjs";
|
|
8
|
+
import { $t as o, A as n, Ai as a, Ar as l, At as h, Bi as c, Br as u, Bt as d, C as g, Ci as m, Cr as _, D as f, Di as p, Dt as w, E as y, Ei as b, En as S, Et as k, F as C, Fi as v, Fr as I, Ft as N, Gr as O, Gt as R, Hr as x, Ht as E, I as L, Ii as A, Ir as V, It as T, Jr as P, Jt as F, Kr as W, L as B, Li as j, Lr as M, Lt as D, M as z, Mn as H, Mr as U, Ni as J, Nn as q, Nr as $, O as K, Oi as G, Ot as X, Pi as Y, Pn as Z, Pr as Q, Pt as ee, Qt as te, R as se, Ri as re, Rr as ie, S as oe, Si as ne, Sr as ae, T as le, Ti as he, Tn as ce, Tt as ue, Ur as de, Ut as ge, Vr as me, Vt as _e, Wr as fe, Wt as pe, Xt as we, Yr as ye, Yt as be, Zt as Se, _a as ke, a as Ce, ai as ve, b as Ie, ba as Ne, bi as Oe, ci as Re, cn as xe, da as Ee, di as Le, dn as Ae, en as Ve, fa as Te, fi as Pe, fn as Fe, ga as We, ha as Be, i as je, j as Me, ji as De, jr as ze, k as He, ki as Ue, kr as Je, kt as qe, la as $e, ln as Ke, ma as Ge, mn as Xe, na as Ye, nn as Ze, pa as Qe, pi as et, pn as tt, qr as st, qt as rt, r as it, ri as ot, rn as nt, sa as at, sn as lt, ti as ht, tn as ct, ua as ut, v as dt, va as gt, vi as mt, w as _t, wi as ft, wr as pt, wt, x as yt, xi as bt, y as St, ya as kt, yi as Ct, zi as vt, zr as It, zt as Nt } from "./BQ2XqExomMceAjfe.mjs";
|
|
9
|
+
import { A as Ot, B as Rt, H as xt, Jt as Et, K as Lt, O as At, R as Vt, Tt, U as Pt, V as Ft, W as Wt, Xt as Bt, Yt as jt, at as Mt, ct as Dt, dt as zt, ft as Ht, in as Ut, k as Jt, lt as qt, mt as $t, nn as Kt, pt as Gt, qt as Xt, rn as Yt, st as Zt, ut as Qt, wt as es, z as ts } from "./DO5ldLqhTvIfPXLW.mjs";
|
|
10
|
+
import { n as ss, t as rs } from "./DF0nL7s01dp7n0Bx.mjs";
|
|
11
|
+
import { FormulaError as is, ScalarType as os } from "@sheetxl/primitives";
|
|
12
|
+
import { BufferUtils as ns, CommonUtils as as, CoordUtils as ls, DefaultLanguagePackService as hs, ExpectedError as cs, ImageUtils as us, InvalidPasswordError as ds, MimeType as gs, Notifier as ms, NullNotAllowedError as _s, OutOfBoundsError as fs, PasswordRequiredError as ps, ProtectedError as ws, UndoManager as ys, messageKey as bs, t as Ss } from "@sheetxl/utils";
|
|
14
13
|
export * from "@sheetxl/primitives";
|
|
15
14
|
export * from "@sheetxl/utils";
|
|
16
|
-
var
|
|
15
|
+
var ks, Cs = class extends ys {
|
|
17
16
|
constructor(e, t = 50) {
|
|
18
17
|
super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
|
|
19
18
|
}
|
|
@@ -100,14 +99,14 @@ var ls, hs = class extends os {
|
|
|
100
99
|
return 0 === e.length && null !== this._repeatOperation && e.push(this._repeatOperation.description), Object.freeze(e);
|
|
101
100
|
}
|
|
102
101
|
getUndoEntries() {
|
|
103
|
-
return this._undoCommits().map(
|
|
102
|
+
return this._undoCommits().map(Is);
|
|
104
103
|
}
|
|
105
104
|
getRedoEntries() {
|
|
106
|
-
const e = this._redoCommits().map(
|
|
105
|
+
const e = this._redoCommits().map(Is);
|
|
107
106
|
return 0 === e.length && null !== this._repeatOperation && e.push({
|
|
108
107
|
description: this._repeatOperation.description,
|
|
109
108
|
author: null,
|
|
110
|
-
meta:
|
|
109
|
+
meta: vs
|
|
111
110
|
}), Object.freeze(e);
|
|
112
111
|
}
|
|
113
112
|
addUndoOperation() {
|
|
@@ -119,11 +118,11 @@ var ls, hs = class extends os {
|
|
|
119
118
|
close() {
|
|
120
119
|
this._removeListener?.();
|
|
121
120
|
}
|
|
122
|
-
},
|
|
121
|
+
}, vs = Object.freeze({}), Is = (e) => ({
|
|
123
122
|
description: e.getDescription(),
|
|
124
123
|
author: e.getAuthor(),
|
|
125
|
-
meta: e.getMeta() ??
|
|
126
|
-
}),
|
|
124
|
+
meta: e.getMeta() ?? vs
|
|
125
|
+
}), Ns = class {
|
|
127
126
|
constructor(t, s) {
|
|
128
127
|
this._dirty = !1, this._store = t, this._savedCommitId = t.getCurrentCommit()?.getId() ?? null, this._emitter = new e(this);
|
|
129
128
|
const r = this;
|
|
@@ -161,8 +160,8 @@ var ls, hs = class extends os {
|
|
|
161
160
|
this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
|
|
162
161
|
}
|
|
163
162
|
};
|
|
164
|
-
|
|
165
|
-
var
|
|
163
|
+
ks || (ks = {});
|
|
164
|
+
var Os, Rs = class t {
|
|
166
165
|
constructor(s, r = {}) {
|
|
167
166
|
this._password = null, this._emitter = new e(this), this._path = s ?? null, this._name = r.name ?? null, this._format = r.format ?? null, this._size = r.size ?? null, this._lastModified = r.lastModified ?? null, this._canWrite = r.canWrite ?? t._defaultCanWrite(this._path), this._encryption = r.encryption ?? null;
|
|
168
167
|
}
|
|
@@ -175,7 +174,7 @@ var gs, ms = class t {
|
|
|
175
174
|
getName() {
|
|
176
175
|
if (null !== this._name && void 0 !== this._name) return this._name;
|
|
177
176
|
const e = this._cleanPath();
|
|
178
|
-
return e &&
|
|
177
|
+
return e && We(e) || null;
|
|
179
178
|
}
|
|
180
179
|
getPath() {
|
|
181
180
|
return this._path;
|
|
@@ -186,7 +185,7 @@ var gs, ms = class t {
|
|
|
186
185
|
getExtension() {
|
|
187
186
|
const e = this._cleanPath();
|
|
188
187
|
if (!e) return null;
|
|
189
|
-
const t =
|
|
188
|
+
const t = ke(e);
|
|
190
189
|
return t ? t.toLowerCase() : null;
|
|
191
190
|
}
|
|
192
191
|
getEncryption() {
|
|
@@ -236,26 +235,26 @@ var gs, ms = class t {
|
|
|
236
235
|
];
|
|
237
236
|
return `${t} ${(s / Math.pow(1024, r)).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
|
|
238
237
|
}
|
|
239
|
-
},
|
|
238
|
+
}, xs = /* @__PURE__ */ new WeakMap(), Es = /* @__PURE__ */ new Set(), Ls = (e) => xs.get(e) ?? null, As = class t {
|
|
240
239
|
constructor(s) {
|
|
241
|
-
this._released = !1, t._assertFree(s), this._emitter = new e(this), this._origin = s,
|
|
240
|
+
this._released = !1, t._assertFree(s), this._emitter = new e(this), this._origin = s, xs.set(s, this), Es.add(this);
|
|
242
241
|
}
|
|
243
242
|
getOrigin() {
|
|
244
243
|
return this._origin;
|
|
245
244
|
}
|
|
246
245
|
setOrigin(e) {
|
|
247
|
-
e !== this._origin && (t._assertFree(e), this._released || (
|
|
246
|
+
e !== this._origin && (t._assertFree(e), this._released || (xs.delete(this._origin), xs.set(e, this)), this._origin = e, this._emitter.notify("onOriginChange"));
|
|
248
247
|
}
|
|
249
248
|
release() {
|
|
250
|
-
this._released || (this._released = !0,
|
|
249
|
+
this._released || (this._released = !0, xs.get(this._origin) === this && xs.delete(this._origin), Es.delete(this));
|
|
251
250
|
}
|
|
252
251
|
addListeners(e, t) {
|
|
253
252
|
return this._emitter.addListeners(e, t);
|
|
254
253
|
}
|
|
255
254
|
static _assertFree(e) {
|
|
256
|
-
if (
|
|
255
|
+
if (xs.has(e)) throw new Error("This origin already backs an open workbook; an origin backs one workbook at a time.");
|
|
257
256
|
}
|
|
258
|
-
},
|
|
257
|
+
}, Vs = class {
|
|
259
258
|
constructor() {
|
|
260
259
|
this._defaultStringSourceType = "filepath";
|
|
261
260
|
}
|
|
@@ -275,10 +274,10 @@ var gs, ms = class t {
|
|
|
275
274
|
}
|
|
276
275
|
switch (n) {
|
|
277
276
|
case "file": {
|
|
278
|
-
const e = s, r = e?.name, n = r ? `${
|
|
277
|
+
const e = s, r = e?.name, n = r ? `${We(r)}` : "";
|
|
279
278
|
a = await e.arrayBuffer(), l = {
|
|
280
279
|
format: o,
|
|
281
|
-
ext:
|
|
280
|
+
ext: ke(r),
|
|
282
281
|
name: n,
|
|
283
282
|
absolutePath: r,
|
|
284
283
|
size: e.size,
|
|
@@ -302,7 +301,7 @@ var gs, ms = class t {
|
|
|
302
301
|
const [, t] = s.split(",");
|
|
303
302
|
e = t;
|
|
304
303
|
} else e = s;
|
|
305
|
-
a =
|
|
304
|
+
a = ns.base64ToArrayBuffer(e), l = {
|
|
306
305
|
format: o,
|
|
307
306
|
size: e.length
|
|
308
307
|
};
|
|
@@ -318,7 +317,7 @@ var gs, ms = class t {
|
|
|
318
317
|
e = i.input, t = i.init, r = i.timeout;
|
|
319
318
|
}
|
|
320
319
|
}
|
|
321
|
-
const i = r || 3e4, n = new AbortController(), h = setTimeout(() => n.abort(), i), c = "string" == typeof e ? e : e.toString(), u =
|
|
320
|
+
const i = r || 3e4, n = new AbortController(), h = setTimeout(() => n.abort(), i), c = "string" == typeof e ? e : e.toString(), u = ke(c);
|
|
322
321
|
try {
|
|
323
322
|
const s = await fetch(e, {
|
|
324
323
|
...t,
|
|
@@ -330,7 +329,7 @@ var gs, ms = class t {
|
|
|
330
329
|
a = r, l = {
|
|
331
330
|
format: o,
|
|
332
331
|
ext: u,
|
|
333
|
-
name:
|
|
332
|
+
name: We(c, !0),
|
|
334
333
|
absolutePath: c
|
|
335
334
|
};
|
|
336
335
|
} catch (e) {
|
|
@@ -373,7 +372,7 @@ var gs, ms = class t {
|
|
|
373
372
|
return t.absolutePath ? this.findOpenPath(t.absolutePath) : null;
|
|
374
373
|
}
|
|
375
374
|
findOpenPath(e, t) {
|
|
376
|
-
return Array.from(
|
|
375
|
+
return Array.from(Es, (e) => e.getOrigin()).find((s) => {
|
|
377
376
|
if (s === t || !s.canWrite()) return !1;
|
|
378
377
|
const r = s.getPath();
|
|
379
378
|
return !!r && this.isSamePath(r, e);
|
|
@@ -404,10 +403,10 @@ var gs, ms = class t {
|
|
|
404
403
|
}
|
|
405
404
|
if ("undefined" != typeof File && e instanceof File) return "file";
|
|
406
405
|
if ("undefined" != typeof Blob && e instanceof Blob) return "blob";
|
|
407
|
-
const t = e instanceof ArrayBuffer || "[object ArrayBuffer]" === Object.prototype.toString.call(e), s = ArrayBuffer.isView(e), r =
|
|
406
|
+
const t = e instanceof ArrayBuffer || "[object ArrayBuffer]" === Object.prototype.toString.call(e), s = ArrayBuffer.isView(e), r = ns.isNodeBuffer(e);
|
|
408
407
|
return t || s || r ? "buffer" : "undefined" != typeof ReadableStream && e instanceof ReadableStream || "[object ReadableStream]" === Object.prototype.toString.call(e) || e && "function" == typeof e.getReader && void 0 !== e.locked ? "stream" : null;
|
|
409
408
|
}
|
|
410
|
-
},
|
|
409
|
+
}, Ts = class extends Vs {
|
|
411
410
|
constructor(e, t) {
|
|
412
411
|
super();
|
|
413
412
|
}
|
|
@@ -447,8 +446,8 @@ var gs, ms = class t {
|
|
|
447
446
|
), r = e.origin.getPath(), i = !(!r || !e.origin.canWrite()), o = i ? r : e.origin.getName() ? e.suggestedName : null;
|
|
448
447
|
if (!o) throw new Error("No file name provided to write to.");
|
|
449
448
|
const n = s.resolve(o.replace(/\\/g, "/")), a = this.findOpenPath(n, e.workbook?.getOrigin?.());
|
|
450
|
-
if (a) throw new
|
|
451
|
-
const l = i ? e.origin : new
|
|
449
|
+
if (a) throw new cs(Ss("error.io.openElsewhere", { name: a.getName() ?? n }));
|
|
450
|
+
const l = i ? e.origin : new Rs(n, {
|
|
452
451
|
format: e.format.key,
|
|
453
452
|
canWrite: !0
|
|
454
453
|
}), h = await e.encode(e.format.key, l);
|
|
@@ -464,7 +463,7 @@ var gs, ms = class t {
|
|
|
464
463
|
} catch (e) {
|
|
465
464
|
throw new Error(`Failed to write file '${n}': ${e.message}`);
|
|
466
465
|
}
|
|
467
|
-
if (l instanceof
|
|
466
|
+
if (l instanceof Rs) {
|
|
468
467
|
const e = await t.stat(n).catch(() => null);
|
|
469
468
|
l.update({
|
|
470
469
|
size: c.byteLength,
|
|
@@ -474,13 +473,13 @@ var gs, ms = class t {
|
|
|
474
473
|
return l;
|
|
475
474
|
}
|
|
476
475
|
};
|
|
477
|
-
(
|
|
476
|
+
(Os || (Os = {})).SortOn = {
|
|
478
477
|
Value: "value",
|
|
479
478
|
FillColor: "fillColor",
|
|
480
479
|
FontColor: "fontColor",
|
|
481
480
|
Icon: "icon"
|
|
482
481
|
};
|
|
483
|
-
var
|
|
482
|
+
var Ps = {
|
|
484
483
|
TopLeft: "tl",
|
|
485
484
|
Top: "t",
|
|
486
485
|
TopRight: "tr",
|
|
@@ -490,53 +489,53 @@ var bs = {
|
|
|
490
489
|
BottomLeft: "bl",
|
|
491
490
|
Bottom: "b",
|
|
492
491
|
BottomRight: "br"
|
|
493
|
-
},
|
|
494
|
-
[
|
|
495
|
-
[
|
|
496
|
-
[
|
|
497
|
-
[
|
|
498
|
-
[
|
|
499
|
-
[
|
|
500
|
-
[
|
|
501
|
-
[
|
|
502
|
-
[
|
|
503
|
-
[
|
|
504
|
-
[
|
|
505
|
-
[
|
|
506
|
-
[
|
|
507
|
-
[
|
|
508
|
-
[
|
|
509
|
-
[
|
|
510
|
-
[
|
|
511
|
-
[
|
|
512
|
-
[
|
|
513
|
-
[
|
|
514
|
-
[
|
|
515
|
-
},
|
|
516
|
-
function
|
|
517
|
-
const t =
|
|
492
|
+
}, Fs = Zt.BuiltInName, Ws = {
|
|
493
|
+
[Fs.Normal]: bs("style.builtin.normal"),
|
|
494
|
+
[Fs.Comma]: bs("style.builtin.comma"),
|
|
495
|
+
[Fs.Currency]: bs("style.builtin.currency"),
|
|
496
|
+
[Fs.Percent]: bs("style.builtin.percent"),
|
|
497
|
+
[Fs.Comma0]: bs("style.builtin.comma0"),
|
|
498
|
+
[Fs.Currency0]: bs("style.builtin.currency0"),
|
|
499
|
+
[Fs.Hyperlink]: bs("style.builtin.hyperlink"),
|
|
500
|
+
[Fs.FollowedHyperlink]: bs("style.builtin.followedHyperlink"),
|
|
501
|
+
[Fs.Note]: bs("style.builtin.note"),
|
|
502
|
+
[Fs.WarningText]: bs("style.builtin.warningText"),
|
|
503
|
+
[Fs.Title]: bs("style.builtin.title"),
|
|
504
|
+
[Fs.Input]: bs("style.builtin.input"),
|
|
505
|
+
[Fs.Output]: bs("style.builtin.output"),
|
|
506
|
+
[Fs.Calculation]: bs("style.builtin.calculation"),
|
|
507
|
+
[Fs.CheckCell]: bs("style.builtin.checkCell"),
|
|
508
|
+
[Fs.LinkedCell]: bs("style.builtin.linkedCell"),
|
|
509
|
+
[Fs.Total]: bs("style.builtin.total"),
|
|
510
|
+
[Fs.Good]: bs("style.builtin.good"),
|
|
511
|
+
[Fs.Bad]: bs("style.builtin.bad"),
|
|
512
|
+
[Fs.Neutral]: bs("style.builtin.neutral"),
|
|
513
|
+
[Fs.ExplanatoryText]: bs("style.builtin.explanatoryText")
|
|
514
|
+
}, Bs = bs("style.builtin.heading"), js = bs("style.builtin.accent"), Ms = bs("style.builtin.accentTint"), Ds = /^Heading ([1-4])$/, zs = /^Accent([1-6])$/, Hs = /^(20|40|60)% - Accent([1-6])$/;
|
|
515
|
+
function Us(e) {
|
|
516
|
+
const t = Ws[e];
|
|
518
517
|
if (t) return { key: t };
|
|
519
|
-
let s =
|
|
518
|
+
let s = Ds.exec(e);
|
|
520
519
|
return s ? {
|
|
521
|
-
key:
|
|
520
|
+
key: Bs,
|
|
522
521
|
params: { n: +s[1] }
|
|
523
|
-
} : (s =
|
|
524
|
-
key:
|
|
522
|
+
} : (s = zs.exec(e), s ? {
|
|
523
|
+
key: js,
|
|
525
524
|
params: { n: +s[1] }
|
|
526
|
-
} : (s =
|
|
527
|
-
key:
|
|
525
|
+
} : (s = Hs.exec(e), s ? {
|
|
526
|
+
key: Ms,
|
|
528
527
|
params: {
|
|
529
528
|
pct: +s[1],
|
|
530
529
|
n: +s[2]
|
|
531
530
|
}
|
|
532
531
|
} : null));
|
|
533
532
|
}
|
|
534
|
-
var
|
|
533
|
+
var Js, qs, $s, Ks, Gs = (e, t, s, r, i) => {
|
|
535
534
|
const o = JSON.parse(JSON.stringify(e.definition));
|
|
536
535
|
o.adjs || (o.adjs = []);
|
|
537
536
|
let n = "", a = 0, l = 0;
|
|
538
|
-
t > 0 ? (l = t, a = 100 - t, n =
|
|
539
|
-
const h = new
|
|
537
|
+
t > 0 ? (l = t, a = 100 - t, n = Ss("op.lighterPercent", { percent: t })) : t < 0 && (a = 100 + t, n = Ss("op.darkerPercent", { percent: -t })), a && o.adjs.push({ [Gt.AdjustmentType.LumMod]: a }), l && o.adjs.push({ [Gt.AdjustmentType.LumOff]: l });
|
|
538
|
+
const h = new zt({
|
|
540
539
|
val: o.val,
|
|
541
540
|
adjs: o.adjs
|
|
542
541
|
}, s), c = h.toString();
|
|
@@ -547,15 +546,15 @@ var As, Ls, Vs, Ts, Ws = (e, t, s, r, i) => {
|
|
|
547
546
|
definition: o
|
|
548
547
|
};
|
|
549
548
|
};
|
|
550
|
-
function
|
|
549
|
+
function Xs(e, t, s, r) {
|
|
551
550
|
let i = [];
|
|
552
551
|
for (let o = 0; o < e.length; o++) {
|
|
553
552
|
let n = [];
|
|
554
553
|
i.push(n);
|
|
555
554
|
const a = (i) => {
|
|
556
|
-
for (let a = 0; a < i.length; a++) n.push(
|
|
555
|
+
for (let a = 0; a < i.length; a++) n.push(Gs(e[o], i[a], t, s, r));
|
|
557
556
|
};
|
|
558
|
-
let l = new
|
|
557
|
+
let l = new zt({
|
|
559
558
|
val: e[o].definition.val,
|
|
560
559
|
adjs: e[o].definition.adjs
|
|
561
560
|
}, t).toHSLA().lum;
|
|
@@ -593,45 +592,45 @@ function Bs(e, t, s, r) {
|
|
|
593
592
|
}
|
|
594
593
|
return i;
|
|
595
594
|
}
|
|
596
|
-
(
|
|
597
|
-
var
|
|
598
|
-
function
|
|
599
|
-
if (!
|
|
600
|
-
const e = import("./
|
|
595
|
+
(Js || (Js = {})).buildPalette = Xs, qs || (qs = {}), $s || ($s = {}), Ks || (Ks = {});
|
|
596
|
+
var Ys, Zs = null;
|
|
597
|
+
function Qs() {
|
|
598
|
+
if (!Zs) {
|
|
599
|
+
const e = import("./CWBS90g3Hz-kQDkY.mjs").then(({ initializeFunctions: e }) => {
|
|
601
600
|
const t = e(() => null);
|
|
602
601
|
return Object.freeze(Array.from(t.keys()));
|
|
603
602
|
});
|
|
604
603
|
e.catch(() => {
|
|
605
|
-
|
|
606
|
-
}),
|
|
604
|
+
Zs = null;
|
|
605
|
+
}), Zs = e;
|
|
607
606
|
}
|
|
608
|
-
return
|
|
607
|
+
return Zs;
|
|
609
608
|
}
|
|
610
|
-
function
|
|
611
|
-
return
|
|
609
|
+
function er(e) {
|
|
610
|
+
return Z.peek()?.readFormulaLiteral(e);
|
|
612
611
|
}
|
|
613
|
-
function
|
|
614
|
-
const s =
|
|
615
|
-
return s !== r ? s - r : e === t ? 0 : "number" == typeof e && "number" == typeof t ? e < t ? -1 : 1 : "string" == typeof e && "string" == typeof t ? e < t ? -1 : e > t ? 1 : 0 : "boolean" == typeof e ? e ? 1 : -1 :
|
|
612
|
+
function tr(e, t) {
|
|
613
|
+
const s = sr(e), r = sr(t);
|
|
614
|
+
return s !== r ? s - r : e === t ? 0 : "number" == typeof e && "number" == typeof t ? e < t ? -1 : 1 : "string" == typeof e && "string" == typeof t ? e < t ? -1 : e > t ? 1 : 0 : "boolean" == typeof e ? e ? 1 : -1 : is.isError(e) && is.isError(t) ? e.getCode() - t.getCode() : 0;
|
|
616
615
|
}
|
|
617
|
-
function
|
|
616
|
+
function sr(e) {
|
|
618
617
|
if (null === e) return 0;
|
|
619
618
|
switch (typeof e) {
|
|
620
619
|
case "number": return 1;
|
|
621
620
|
case "string": return 2;
|
|
622
621
|
case "boolean": return 3;
|
|
623
|
-
default: return
|
|
622
|
+
default: return is.isError(e) ? 4 : 5;
|
|
624
623
|
}
|
|
625
624
|
}
|
|
626
625
|
(function(e) {
|
|
627
626
|
function t(e) {
|
|
628
|
-
return
|
|
627
|
+
return Z.peek()?.getFunctionDeclaration(e) ?? null;
|
|
629
628
|
}
|
|
630
629
|
e.get = t, e.has = function(e) {
|
|
631
630
|
return null !== t(e);
|
|
632
631
|
};
|
|
633
|
-
})(
|
|
634
|
-
var
|
|
632
|
+
})(Ys || (Ys = {}));
|
|
633
|
+
var rr = class {
|
|
635
634
|
constructor(e) {
|
|
636
635
|
this._children = e;
|
|
637
636
|
}
|
|
@@ -679,19 +678,19 @@ var Hs = class {
|
|
|
679
678
|
const s = t[e].getSortedNumbers().getValues();
|
|
680
679
|
s.length > 0 && r.push(s);
|
|
681
680
|
}
|
|
682
|
-
e = new
|
|
681
|
+
e = new it(function(e) {
|
|
683
682
|
const t = e.length;
|
|
684
|
-
if (0 === t) return
|
|
683
|
+
if (0 === t) return ir;
|
|
685
684
|
if (1 === t) return e[0];
|
|
686
685
|
let s = e[0];
|
|
687
|
-
for (let r = 1; r < t; r++) s =
|
|
686
|
+
for (let r = 1; r < t; r++) s = or(s, e[r]);
|
|
688
687
|
return Object.freeze(s);
|
|
689
688
|
}(r)), this._sortedNumbers = e;
|
|
690
689
|
}
|
|
691
690
|
return e;
|
|
692
691
|
}
|
|
693
692
|
getRanked(e) {
|
|
694
|
-
return
|
|
693
|
+
return je(this._children, e, tr)[Symbol.iterator]();
|
|
695
694
|
}
|
|
696
695
|
getFrequencies(e) {
|
|
697
696
|
if (e) return this._mergeFrequencies(e);
|
|
@@ -699,7 +698,7 @@ var Hs = class {
|
|
|
699
698
|
return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
|
|
700
699
|
}
|
|
701
700
|
_mergeFrequencies(e) {
|
|
702
|
-
const t = e?.keyFn ??
|
|
701
|
+
const t = e?.keyFn ?? pt, s = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, o = i.length;
|
|
703
702
|
let n = 0, a = 0, l = !1;
|
|
704
703
|
for (let h = 0; h < o; h++) {
|
|
705
704
|
const o = i[h].getFrequencies(e);
|
|
@@ -714,22 +713,22 @@ var Hs = class {
|
|
|
714
713
|
}) : l = !0, u = c.next();
|
|
715
714
|
}
|
|
716
715
|
}
|
|
717
|
-
return
|
|
716
|
+
return _.fromGroups(r, t, e, tr, n, a, l);
|
|
718
717
|
}
|
|
719
718
|
getTypedCounts(e) {
|
|
720
719
|
let t = this._typedCounts;
|
|
721
720
|
if (!t) {
|
|
722
721
|
const e = {
|
|
723
|
-
[
|
|
724
|
-
[
|
|
725
|
-
[
|
|
726
|
-
[
|
|
727
|
-
[
|
|
728
|
-
[
|
|
722
|
+
[os.Number]: 0,
|
|
723
|
+
[os.String]: 0,
|
|
724
|
+
[os.Boolean]: 0,
|
|
725
|
+
[os.Error]: 0,
|
|
726
|
+
[os.RichData]: 0,
|
|
727
|
+
[os.Null]: 0
|
|
729
728
|
}, s = this._children, r = s.length;
|
|
730
729
|
for (let t = 0; t < r; t++) {
|
|
731
730
|
const r = s[t].getTypedCounts();
|
|
732
|
-
e[
|
|
731
|
+
e[os.Number] += r[os.Number] ?? 0, e[os.String] += r[os.String] ?? 0, e[os.Boolean] += r[os.Boolean] ?? 0, e[os.Error] += r[os.Error] ?? 0, e[os.RichData] += r[os.RichData] ?? 0, e[os.Null] += r[os.Null] ?? 0;
|
|
733
732
|
}
|
|
734
733
|
t = Object.freeze(e), this._typedCounts = t;
|
|
735
734
|
}
|
|
@@ -750,12 +749,12 @@ var Hs = class {
|
|
|
750
749
|
sum: 0,
|
|
751
750
|
sumSq: 0,
|
|
752
751
|
typed: {
|
|
753
|
-
[
|
|
754
|
-
[
|
|
755
|
-
[
|
|
756
|
-
[
|
|
757
|
-
[
|
|
758
|
-
[
|
|
752
|
+
[os.Number]: 0,
|
|
753
|
+
[os.String]: 0,
|
|
754
|
+
[os.Boolean]: 0,
|
|
755
|
+
[os.Error]: 0,
|
|
756
|
+
[os.RichData]: 0,
|
|
757
|
+
[os.Null]: 0
|
|
759
758
|
}
|
|
760
759
|
};
|
|
761
760
|
for (let i = 0; i < s; i++) {
|
|
@@ -764,10 +763,10 @@ var Hs = class {
|
|
|
764
763
|
const o = s.numericalCount;
|
|
765
764
|
o <= 0 || (r.numericalCount += o, r.sum += s.sum, r.sumSq += s.varP * o + s.sum * s.sum / o, (void 0 === r.min || s.min < r.min) && (r.min = s.min), (void 0 === r.max || s.max > r.max) && (r.max = s.max));
|
|
766
765
|
}
|
|
767
|
-
return
|
|
766
|
+
return Ce(r);
|
|
768
767
|
}
|
|
769
|
-
},
|
|
770
|
-
function
|
|
768
|
+
}, ir = Object.freeze([]);
|
|
769
|
+
function or(e, t) {
|
|
771
770
|
const s = e.length, r = t.length, i = new Array(s + r);
|
|
772
771
|
let o = 0, n = 0, a = 0;
|
|
773
772
|
for (; o < s && n < r;) i[a++] = e[o] <= t[n] ? e[o++] : t[n++];
|
|
@@ -775,26 +774,26 @@ function Js(e, t) {
|
|
|
775
774
|
for (; n < r;) i[a++] = t[n++];
|
|
776
775
|
return i;
|
|
777
776
|
}
|
|
778
|
-
var
|
|
777
|
+
var nr, ar = class {
|
|
779
778
|
constructor(e, t) {
|
|
780
779
|
this._source = null, this.cacheId = e, this.part = t;
|
|
781
780
|
}
|
|
782
781
|
_hold(e) {
|
|
783
782
|
const t = this.part?.xml;
|
|
784
783
|
if (!t || this._source) return;
|
|
785
|
-
const s =
|
|
784
|
+
const s = o(t, "worksheetSource", "ref"), r = o(t, "worksheetSource", "sheet");
|
|
786
785
|
if (!s || !r || s.includes("#REF!")) return;
|
|
787
786
|
const i = e(r);
|
|
788
787
|
if (!i) return;
|
|
789
|
-
const
|
|
788
|
+
const n = {
|
|
790
789
|
formula: null,
|
|
791
790
|
wired: null,
|
|
792
791
|
last: null
|
|
793
792
|
};
|
|
794
|
-
this._source =
|
|
795
|
-
|
|
793
|
+
this._source = n, i(`${Pe(r)}!${te(s)}`, (e) => {
|
|
794
|
+
n.formula = e.formula;
|
|
796
795
|
const t = e.formula.getExpression();
|
|
797
|
-
|
|
796
|
+
n.wired ??= t, e.formula.hasRefError() || (n.last = t);
|
|
798
797
|
});
|
|
799
798
|
}
|
|
800
799
|
getXML() {
|
|
@@ -802,18 +801,18 @@ var qs, $s = class {
|
|
|
802
801
|
if (!e || !t?.formula) return e;
|
|
803
802
|
const s = t.formula.hasRefError() ? t.last : t.formula.getExpression();
|
|
804
803
|
if (null === s || s === t.wired) return e;
|
|
805
|
-
const r =
|
|
806
|
-
return r ?
|
|
804
|
+
const r = f(s);
|
|
805
|
+
return r ? ct(ct(e, "worksheetSource", "ref", Ve(r.reference)), "worksheetSource", "sheet", r.sheet) : ct(e, "worksheetSource", "ref", Ve(s));
|
|
807
806
|
}
|
|
808
807
|
toJSON(e) {
|
|
809
|
-
const t = { cacheId: this.cacheId }, s =
|
|
808
|
+
const t = { cacheId: this.cacheId }, s = Ze.toJSON(this.part, e);
|
|
810
809
|
if (s) {
|
|
811
810
|
const e = this.getXML();
|
|
812
811
|
null !== e && (s.xml = e), t.part = s;
|
|
813
812
|
}
|
|
814
813
|
return t;
|
|
815
814
|
}
|
|
816
|
-
},
|
|
815
|
+
}, lr = class {
|
|
817
816
|
constructor(e, t) {
|
|
818
817
|
this._deleted = !1, this._json = { ...e }, this._deleteFromCollection = t ?? null;
|
|
819
818
|
}
|
|
@@ -847,7 +846,7 @@ var qs, $s = class {
|
|
|
847
846
|
get isIPerson() {
|
|
848
847
|
return !0;
|
|
849
848
|
}
|
|
850
|
-
},
|
|
849
|
+
}, hr = class extends Ne {
|
|
851
850
|
constructor(e) {
|
|
852
851
|
super(), this._byId = /* @__PURE__ */ new Map(), this._byDisplayName = /* @__PURE__ */ new Map(), this._items = null, this._current = null, e && this.fromJSON(e);
|
|
853
852
|
}
|
|
@@ -868,10 +867,10 @@ var qs, $s = class {
|
|
|
868
867
|
const e = this._byDisplayName.get(r);
|
|
869
868
|
if (e) return e;
|
|
870
869
|
}
|
|
871
|
-
const i = new
|
|
870
|
+
const i = new lr({
|
|
872
871
|
...t,
|
|
873
872
|
displayName: r,
|
|
874
|
-
id: s ??
|
|
873
|
+
id: s ?? as.uuidV4().toUpperCase()
|
|
875
874
|
}, (e) => this._remove(e));
|
|
876
875
|
return this._byId.set(i.getId(), i), r && !this._byDisplayName.has(r) && this._byDisplayName.set(r, i), this._items = null, this._notifyCollectionChange(), i;
|
|
877
876
|
}
|
|
@@ -911,7 +910,7 @@ var qs, $s = class {
|
|
|
911
910
|
get isIPersonCollection() {
|
|
912
911
|
return !0;
|
|
913
912
|
}
|
|
914
|
-
},
|
|
913
|
+
}, cr = (e, t) => {
|
|
915
914
|
const s = [0];
|
|
916
915
|
for (let t = 0; t < e.length; t++) "\n" === e[t] && s.push(t + 1);
|
|
917
916
|
const r = t.map((e) => ` ${((e) => {
|
|
@@ -923,7 +922,7 @@ var qs, $s = class {
|
|
|
923
922
|
return `${t + 1}:${e - s[t] + 1}`;
|
|
924
923
|
})(e.start)} ${e.code}: ${e.message}`), i = t.length;
|
|
925
924
|
return `Script has ${i} compile error${1 === i ? "" : "s"}:\n${r.join("\n")}`;
|
|
926
|
-
},
|
|
925
|
+
}, ur = class {
|
|
927
926
|
constructor(t) {
|
|
928
927
|
this._options = t, this._emitter = new e(this), this._initState();
|
|
929
928
|
}
|
|
@@ -934,12 +933,12 @@ var qs, $s = class {
|
|
|
934
933
|
_builtInNames() {
|
|
935
934
|
try {
|
|
936
935
|
const e = this._options.getBuiltInFunctions?.();
|
|
937
|
-
if (!e) return
|
|
936
|
+
if (!e) return as.EmptyArray;
|
|
938
937
|
const t = [];
|
|
939
938
|
for (const s of e.getItems({ includeHidden: !0 })) s.isBuiltIn() && t.push(s.getName());
|
|
940
939
|
return t;
|
|
941
940
|
} catch {
|
|
942
|
-
return
|
|
941
|
+
return as.EmptyArray;
|
|
943
942
|
}
|
|
944
943
|
}
|
|
945
944
|
async createModule(e) {
|
|
@@ -948,13 +947,13 @@ var qs, $s = class {
|
|
|
948
947
|
minify: !0,
|
|
949
948
|
...e
|
|
950
949
|
});
|
|
951
|
-
return t.module ? await Fe
|
|
950
|
+
return t.module ? await Ke(Fe.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
|
|
952
951
|
}
|
|
953
952
|
addModule(e, t, s) {
|
|
954
953
|
this._modules.add(e, t, s);
|
|
955
954
|
}
|
|
956
955
|
async addModuleFromJSON(e, t, s) {
|
|
957
|
-
const r = await
|
|
956
|
+
const r = await Ke(e, t);
|
|
958
957
|
return this.addModule(e, r, s), r;
|
|
959
958
|
}
|
|
960
959
|
executeMacro(e, t, s) {
|
|
@@ -970,7 +969,7 @@ var qs, $s = class {
|
|
|
970
969
|
}
|
|
971
970
|
async run(e, t) {
|
|
972
971
|
try {
|
|
973
|
-
const s = "string" == typeof e ? await this.createModule({ source: e }) : await Fe
|
|
972
|
+
const s = "string" == typeof e ? await this.createModule({ source: e }) : await Ke(Fe.DEFAULT_MODULE, e), r = "string" == typeof e ? e : e?.source ?? "";
|
|
974
973
|
return await this._runModule(s, r, t);
|
|
975
974
|
} catch (e) {
|
|
976
975
|
return {
|
|
@@ -987,7 +986,7 @@ var qs, $s = class {
|
|
|
987
986
|
};
|
|
988
987
|
const i = e.getDiagnostics(), o = i.filter((e) => "error" === e.severity);
|
|
989
988
|
if (o.length > 0) {
|
|
990
|
-
const e = new Error(
|
|
989
|
+
const e = new Error(cr(t, o));
|
|
991
990
|
return e.diagnostics = o, {
|
|
992
991
|
ok: !1,
|
|
993
992
|
error: e,
|
|
@@ -1015,12 +1014,12 @@ var qs, $s = class {
|
|
|
1015
1014
|
}
|
|
1016
1015
|
_searchable(e) {
|
|
1017
1016
|
const t = this._modules;
|
|
1018
|
-
return t && 0 !== t.getCount() ? (e ? t.getItems({ name: e }) : t.getItems()).map((e) => e.getFunctions()) :
|
|
1017
|
+
return t && 0 !== t.getCount() ? (e ? t.getItems({ name: e }) : t.getItems()).map((e) => e.getFunctions()) : as.EmptyArray;
|
|
1019
1018
|
}
|
|
1020
1019
|
async searchFunctions(e) {
|
|
1021
1020
|
await this._emitter.notify("onBeforeSearch", { async: !0 });
|
|
1022
1021
|
const t = this._searchable(e?.moduleName);
|
|
1023
|
-
if (0 === t.length) return
|
|
1022
|
+
if (0 === t.length) return as.EmptyArray;
|
|
1024
1023
|
if (1 === t.length) return t[0].search(e);
|
|
1025
1024
|
const s = e?.limit, r = void 0 === s ? e : {
|
|
1026
1025
|
...e,
|
|
@@ -1038,19 +1037,40 @@ var qs, $s = class {
|
|
|
1038
1037
|
}
|
|
1039
1038
|
}
|
|
1040
1039
|
}
|
|
1041
|
-
if (!i || 0 === i.length) return
|
|
1040
|
+
if (!i || 0 === i.length) return as.EmptyArray;
|
|
1042
1041
|
const n = e?.text ? e.text.trim().toUpperCase() : null;
|
|
1043
|
-
return n ?
|
|
1042
|
+
return n ? Ae(i, n) : i.sort((e, t) => {
|
|
1044
1043
|
const s = e.getName().toUpperCase(), r = t.getName().toUpperCase();
|
|
1045
1044
|
return s < r ? -1 : s > r ? 1 : 0;
|
|
1046
1045
|
}), void 0 !== s && i.length > s ? i.slice(0, s) : i;
|
|
1047
1046
|
}
|
|
1048
1047
|
async start() {
|
|
1049
|
-
|
|
1048
|
+
return this._startPromise || (this._startPromise = this._doStart(), this._startPromise.catch(() => {
|
|
1050
1049
|
this._startPromise = void 0;
|
|
1051
1050
|
})), this._startPromise;
|
|
1052
1051
|
}
|
|
1052
|
+
_load() {
|
|
1053
|
+
return this._loadPromise || (this._loadPromise = this._doLoad(), this._loadPromise.catch(() => {
|
|
1054
|
+
this._loadPromise = void 0;
|
|
1055
|
+
})), this._loadPromise;
|
|
1056
|
+
}
|
|
1053
1057
|
async _doStart() {
|
|
1058
|
+
await this._load();
|
|
1059
|
+
const e = this._options?.workbook, t = this._modules.getItems(), s = t.length;
|
|
1060
|
+
for (let r = 0; r < s; r++) {
|
|
1061
|
+
const s = t[r];
|
|
1062
|
+
try {
|
|
1063
|
+
const t = s.getFunctions().getItems({
|
|
1064
|
+
type: "autoRun",
|
|
1065
|
+
includeHidden: !0
|
|
1066
|
+
}), r = t.length;
|
|
1067
|
+
for (let s = 0; s < r; s++) await t[s].execute(e);
|
|
1068
|
+
} catch (e) {
|
|
1069
|
+
ms.error("Error executing autoRun script:", e);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
async _doLoad() {
|
|
1054
1074
|
const e = this._options?.workbook, t = this._options?.json;
|
|
1055
1075
|
let s = {};
|
|
1056
1076
|
if (t) {
|
|
@@ -1058,13 +1078,13 @@ var qs, $s = class {
|
|
|
1058
1078
|
for (let i = 0; i < r.length; i++) {
|
|
1059
1079
|
const o = r[i], n = t[o];
|
|
1060
1080
|
try {
|
|
1061
|
-
s[o] = await
|
|
1081
|
+
s[o] = await Ke(o, n, !1, [], "workbook" === n?.scope ? e : null);
|
|
1062
1082
|
} catch (e) {
|
|
1063
|
-
|
|
1083
|
+
ms.error(`Could not load script '${o}'; it will be unavailable.`, e);
|
|
1064
1084
|
}
|
|
1065
1085
|
}
|
|
1066
1086
|
}
|
|
1067
|
-
const r = this, i = new
|
|
1087
|
+
const r = this, i = new ce({
|
|
1068
1088
|
transactions: this._options?.transactions,
|
|
1069
1089
|
initial: s,
|
|
1070
1090
|
isReadOnly: () => r.isReadOnly(),
|
|
@@ -1076,21 +1096,6 @@ var qs, $s = class {
|
|
|
1076
1096
|
}
|
|
1077
1097
|
});
|
|
1078
1098
|
this._modules = i;
|
|
1079
|
-
const o = i.getItems();
|
|
1080
|
-
if (0 === o.length) return Promise.resolve(Kt.EmptyArray);
|
|
1081
|
-
const n = o.length;
|
|
1082
|
-
for (let t = 0; t < n; t++) {
|
|
1083
|
-
const s = o[t];
|
|
1084
|
-
try {
|
|
1085
|
-
const t = s.getFunctions().getItems({
|
|
1086
|
-
type: "autoRun",
|
|
1087
|
-
includeHidden: !0
|
|
1088
|
-
}), r = t.length;
|
|
1089
|
-
for (let s = 0; s < r; s++) await t[s].execute(e);
|
|
1090
|
-
} catch (e) {
|
|
1091
|
-
es.error("Error executing autoRun script:", e);
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
1099
|
}
|
|
1095
1100
|
addListeners(e, t) {
|
|
1096
1101
|
return this._emitter.addListeners(e, t);
|
|
@@ -1107,9 +1112,132 @@ var qs, $s = class {
|
|
|
1107
1112
|
get isIScript() {
|
|
1108
1113
|
return !0;
|
|
1109
1114
|
}
|
|
1110
|
-
},
|
|
1115
|
+
}, dr = /^([a-z][a-z0-9+.-]*):/i, gr = (e) => {
|
|
1116
|
+
const t = e.toLowerCase();
|
|
1117
|
+
return t.endsWith(":") ? t : t + ":";
|
|
1118
|
+
}, mr = async (e, t) => {
|
|
1119
|
+
try {
|
|
1120
|
+
return await globalThis.fetch(e, t);
|
|
1121
|
+
} catch (s) {
|
|
1122
|
+
if (s instanceof TypeError && await (async (e, t) => {
|
|
1123
|
+
const s = globalThis.location;
|
|
1124
|
+
if (!s || t?.method && "GET" !== t.method.toUpperCase()) return !1;
|
|
1125
|
+
const r = new AbortController(), i = setTimeout(() => r.abort(), 5e3);
|
|
1126
|
+
try {
|
|
1127
|
+
return new URL(e, s.href).origin !== s.origin && (await globalThis.fetch(e, {
|
|
1128
|
+
mode: "no-cors",
|
|
1129
|
+
credentials: "omit",
|
|
1130
|
+
signal: r.signal
|
|
1131
|
+
}), !0);
|
|
1132
|
+
} catch {
|
|
1133
|
+
return !1;
|
|
1134
|
+
} finally {
|
|
1135
|
+
clearTimeout(i), r.abort();
|
|
1136
|
+
}
|
|
1137
|
+
})(e, t)) throw new is.Blocked("This site is restricted: it doesn't allow web apps to read its data, so the browser blocked the request for security.", { cause: s });
|
|
1138
|
+
throw s;
|
|
1139
|
+
}
|
|
1140
|
+
}, _r = class {
|
|
1141
|
+
constructor() {
|
|
1142
|
+
this._handlers = /* @__PURE__ */ new Map([["http:", mr], ["https:", mr]]);
|
|
1143
|
+
}
|
|
1144
|
+
fetch(e, t) {
|
|
1145
|
+
const s = dr.exec(e)?.[1], r = this._handlers.get(s ? gr(s) : "https:");
|
|
1146
|
+
if (!r) return Promise.reject(/* @__PURE__ */ new TypeError(`No fetcher serves '${s}:'.`));
|
|
1147
|
+
try {
|
|
1148
|
+
return r(e, t);
|
|
1149
|
+
} catch (e) {
|
|
1150
|
+
return Promise.reject(e);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
register(e, t) {
|
|
1154
|
+
const s = gr(e), r = this._handlers.get(s);
|
|
1155
|
+
return this._handlers.set(s, t), () => {
|
|
1156
|
+
this._handlers.get(s) === t && (r ? this._handlers.set(s, r) : this._handlers.delete(s));
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
get isIFetcher() {
|
|
1160
|
+
return !0;
|
|
1161
|
+
}
|
|
1162
|
+
}, fr = /* @__PURE__ */ new Set([
|
|
1163
|
+
101,
|
|
1164
|
+
103,
|
|
1165
|
+
204,
|
|
1166
|
+
205,
|
|
1167
|
+
304
|
|
1168
|
+
]), pr = (e) => new Response(fr.has(e.status) ? null : e.body, {
|
|
1169
|
+
status: e.status,
|
|
1170
|
+
statusText: e.statusText,
|
|
1171
|
+
headers: e.headers
|
|
1172
|
+
}), wr = class {
|
|
1173
|
+
constructor(e, t) {
|
|
1174
|
+
this._kept = /* @__PURE__ */ new Map(), this._cached = /* @__PURE__ */ new Map(), this._inFlight = /* @__PURE__ */ new Map(), this._resources = e, this._fetcher = t;
|
|
1175
|
+
}
|
|
1176
|
+
getFetcher() {
|
|
1177
|
+
return this._fetcher;
|
|
1178
|
+
}
|
|
1179
|
+
async fetch(e, t) {
|
|
1180
|
+
if (((e) => !e || (!e.method || "GET" === e.method.toUpperCase()) && !e.body)(t) && "reload" !== t?.cache) {
|
|
1181
|
+
const s = this._kept.get(e) ?? this._findHeld(e);
|
|
1182
|
+
if (s && !s.isClosed()) return this._fromKept(s);
|
|
1183
|
+
const r = this._cached.get(e);
|
|
1184
|
+
if (r) return pr(r);
|
|
1185
|
+
let i = this._inFlight.get(e);
|
|
1186
|
+
return i || (i = this._request(e, {
|
|
1187
|
+
...t,
|
|
1188
|
+
signal: void 0
|
|
1189
|
+
}).finally(() => {
|
|
1190
|
+
this._inFlight.delete(e);
|
|
1191
|
+
}), this._inFlight.set(e, i)), pr(await ((e, t) => t ? t.aborted ? Promise.reject(t.reason) : new Promise((s, r) => {
|
|
1192
|
+
const i = () => r(t.reason);
|
|
1193
|
+
t.addEventListener("abort", i, { once: !0 }), e.then(s, r).finally(() => t.removeEventListener("abort", i));
|
|
1194
|
+
}) : e)(i, t?.signal));
|
|
1195
|
+
}
|
|
1196
|
+
return pr(await this._request(e, t));
|
|
1197
|
+
}
|
|
1198
|
+
adopt(e) {
|
|
1199
|
+
for (const t of e) {
|
|
1200
|
+
const e = t.getFetchedFrom();
|
|
1201
|
+
e && !t.isClosed() && this.keep(e, t);
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
keep(e, t) {
|
|
1205
|
+
const s = this._kept.get(e);
|
|
1206
|
+
s !== t && (t.addReference(this), this._kept.set(e, t), s && !s.isClosed() && s.deleteReference(this));
|
|
1207
|
+
}
|
|
1208
|
+
_findHeld(e) {
|
|
1209
|
+
for (const t of this._resources.getItems()) if (t.getFetchedFrom() === e && !t.isClosed()) return this.keep(e, t), t;
|
|
1210
|
+
return null;
|
|
1211
|
+
}
|
|
1212
|
+
async _fromKept(e) {
|
|
1213
|
+
const [t, s] = await Promise.all([e.toBuffer(), e.getType()]);
|
|
1214
|
+
return pr({
|
|
1215
|
+
status: 200,
|
|
1216
|
+
statusText: "OK",
|
|
1217
|
+
headers: s ? [["content-type", s.mime]] : [],
|
|
1218
|
+
body: t
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
async _request(e, t) {
|
|
1222
|
+
const s = await this._fetcher.fetch(e, t), r = fr.has(s.status) ? null : await s.arrayBuffer(), i = [];
|
|
1223
|
+
s.headers.forEach((e, t) => {
|
|
1224
|
+
i.push([t, e]);
|
|
1225
|
+
});
|
|
1226
|
+
const o = {
|
|
1227
|
+
status: s.status,
|
|
1228
|
+
statusText: s.statusText,
|
|
1229
|
+
headers: i,
|
|
1230
|
+
body: r
|
|
1231
|
+
};
|
|
1232
|
+
if (s.ok && r && r.byteLength > 0) {
|
|
1233
|
+
const t = await new I({ source: { buffer: r } }).getType();
|
|
1234
|
+
t?.mime.startsWith("image/") ? (o.headers = i.filter(([e]) => "content-type" !== e.toLowerCase()), o.headers.push(["content-type", t.mime])) : this._cached.set(e, o);
|
|
1235
|
+
}
|
|
1236
|
+
return o;
|
|
1237
|
+
}
|
|
1238
|
+
}, yr = class {
|
|
1111
1239
|
constructor(e, t, s, r) {
|
|
1112
|
-
this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = s, this._topLeft = t ??
|
|
1240
|
+
this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = s, this._topLeft = t ?? ls.EmptyCell, this._sheet = new le({
|
|
1113
1241
|
runtime: e,
|
|
1114
1242
|
styles: this._styles,
|
|
1115
1243
|
calcOnLoad: "none",
|
|
@@ -1131,40 +1259,40 @@ var qs, $s = class {
|
|
|
1131
1259
|
e.includes(r) && delete i[r];
|
|
1132
1260
|
}
|
|
1133
1261
|
}
|
|
1134
|
-
const o =
|
|
1262
|
+
const o = Pt(i.fontFamily);
|
|
1135
1263
|
r.font = {}, o && (r.font.family = o.family, r.font.fallbacks = o.fallbacks, r.font.size = o.size), r.font.size = i.fontSize, r.font.weight = i.fontWeight, r.font.style = i.fontStyle, r.font.color = i.color;
|
|
1136
|
-
const n =
|
|
1137
|
-
r.font.underline = n.underline, r.font.strike = n.strike ?
|
|
1264
|
+
const n = Rt(i.textDecoration);
|
|
1265
|
+
r.font.underline = n.underline, r.font.strike = n.strike ? Bt.StrikeStyle.Single : Bt.StrikeStyle.None, i.textUnderlineStyle && (r.font.underline = Ft(i.textUnderlineStyle)), r.alignment = {}, i?.textAlign && (r.alignment.horizontal = ts(i.textAlign)), i?.textAlign && !r.alignment.horizontal && "general" !== i?.textAlign && ("center-across" === i.textAlign ? r.alignment.horizontal = Ut.HorizontalAlignment.CenterContinuous : "fill" === i.textAlign ? r.alignment.horizontal = Ut.HorizontalAlignment.Fill : "121" === i.textAlign || "010" === i.textAlign ? (r.alignment.horizontal = Ut.HorizontalAlignment.Distributed, r.alignment.justifyLastLine = "121" === i.textAlign) : console.warn("unknown text-align", i.textAlign)), i.verticalAlign && ("super" === i.verticalAlign.toLowerCase() ? r.font.baseline = jt.Baseline.Superscript : "sub" === i.verticalAlign.toLowerCase() ? r.font.baseline = jt.Baseline.Subscript : r.alignment.vertical = xt(i.verticalAlign), r.alignment.vertical || ("121" === i.verticalAlign ? r.alignment.vertical = Ut.VerticalAlignment.Distributed : console.warn("unknown vertical-align", i.verticalAlign))), i.msoCharIndentCount && (r.alignment.indent = i.msoCharIndentCount), i.whiteSpace && (r.alignment.overflow = "no-wrap" === i.whiteSpace || "nowrap" === i.whiteSpace ? Ut.Overflow.Visible : Ut.Overflow.Wrap), "shrinktofit" === i.msoTextControl && (r.alignment.overflow = Ut.Overflow.Shrink);
|
|
1138
1266
|
let a = null;
|
|
1139
1267
|
if (i.background ? a = i.background : i.backgroundColor && (a = i.backgroundColor), a && (r.fill = { color: a }), i.msoPattern) {
|
|
1140
|
-
let e =
|
|
1141
|
-
e && (e.patternType ===
|
|
1268
|
+
let e = Lt(i.msoPattern);
|
|
1269
|
+
e && (e.patternType === Qt.BuiltInSheetPattern.Solid ? r.fill = { color: e.foreground } : e.patternType !== Qt.BuiltInSheetPattern.None && (a && (e.background = a), r.fill = e));
|
|
1142
1270
|
}
|
|
1143
|
-
"vertical" === i.layoutFlow || "vertical-ideographic" === i.layoutFlow ? r.alignment.stacked = !0 : void 0 !== i.msoRotate && (r.alignment.rotation =
|
|
1271
|
+
"vertical" === i.layoutFlow || "vertical-ideographic" === i.layoutFlow ? r.alignment.stacked = !0 : void 0 !== i.msoRotate && (r.alignment.rotation = Vt(i.msoRotate));
|
|
1144
1272
|
const l = (e, t) => {
|
|
1145
1273
|
e && (r.borders || (r.borders = {}), r.borders[e] = t);
|
|
1146
1274
|
};
|
|
1147
1275
|
i.border && "none" !== i.border && (l("top", i.border), l("left", i.border), l("right", i.border), l("bottom", i.border)), i.borderTop && l("top", i.borderTop), i.borderLeft && l("left", i.borderLeft), i.borderRight && l("right", i.borderRight), i.borderBottom && l("bottom", i.borderBottom), i.msoDiagonalUp && l("diagonalUp", i.msoDiagonalUp), i.msoDiagonalDown && l("diagonalDown", i.msoDiagonalDown);
|
|
1148
1276
|
let h = r.numberFormat;
|
|
1149
|
-
i.msoNumberFormat && (h =
|
|
1277
|
+
i.msoNumberFormat && (h = Mt(i.msoNumberFormat), h.includes("\\") ? h = null : "Fixed" === h ? h = $t.Styles.lookupStyle(r.numberFormat).formatType === $t.Type.Number ? null : $t.Type.Number : "Percent" === h && (h = $t.Styles.lookupStyle(r.numberFormat).formatType === $t.Type.Percentage ? null : $t.Type.Percentage)), h && (r.numberFormat = h), e.style = this._styles.normalize(r), s && 0 === Object.keys(e.style).length && delete e.style;
|
|
1150
1278
|
}
|
|
1151
1279
|
onCell(e, t, s, r, i) {
|
|
1152
1280
|
const o = r(i);
|
|
1153
1281
|
let n = { value: void 0 !== t ? t : s ?? "" };
|
|
1154
1282
|
if ("string" == typeof n.value && 0 === n.value.length && (n.value = void 0), o && this.applyCSSStyle(n, o), "string" == typeof n.value && /^#+$/.test(n.value)) {
|
|
1155
1283
|
const e = n.style?.numberFormat;
|
|
1156
|
-
e && (
|
|
1284
|
+
e && (es(e) || Tt(e)) && (n.value = is.BuiltIn.Num);
|
|
1157
1285
|
}
|
|
1158
1286
|
if ("TD" === i?.tagName.toUpperCase()) {
|
|
1159
1287
|
let e = n.style, t = e?.font ?? {};
|
|
1160
|
-
(i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike =
|
|
1288
|
+
(i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = Bt.StrikeStyle.Single), i.querySelectorAll("sub").length > 0 && (t.baseline = jt.Baseline.Subscript), i.querySelectorAll("sup").length > 0 && (t.baseline = jt.Baseline.Superscript), (i.querySelectorAll("b").length > 0 || i.querySelectorAll("strong").length > 0) && (t.weight = 700), i.querySelectorAll("i").length > 0 && (t.style = Bt.Style.Italic), i.querySelectorAll("u").length > 0 && (t.underline = Bt.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, n.style = e), e.font || (e.font = t));
|
|
1161
1289
|
const s = i.querySelectorAll("a");
|
|
1162
1290
|
if (s.length > 0) {
|
|
1163
1291
|
const e = s[0].getAttribute("href");
|
|
1164
1292
|
e && (n.hyperlink = e);
|
|
1165
1293
|
}
|
|
1166
1294
|
}
|
|
1167
|
-
if (!
|
|
1295
|
+
if (!ls.isSingleCell(e)) {
|
|
1168
1296
|
const t = {
|
|
1169
1297
|
rowStart: this._topLeft.rowIndex + e.rowStart,
|
|
1170
1298
|
colStart: this._topLeft.colIndex + e.colStart,
|
|
@@ -1175,7 +1303,7 @@ var qs, $s = class {
|
|
|
1175
1303
|
}
|
|
1176
1304
|
if (void 0 === n.value && !n.style && Object.keys(n).length <= 1) return;
|
|
1177
1305
|
const a = this._builder, l = this._topLeft;
|
|
1178
|
-
if (a.pushAt(l.rowIndex + e.rowStart, l.colIndex + e.colStart, n), !
|
|
1306
|
+
if (a.pushAt(l.rowIndex + e.rowStart, l.colIndex + e.colStart, n), !ls.isSingleCell(e) && o.msoIgnore) {
|
|
1179
1307
|
if (o.msoIgnore.includes("colspan")) {
|
|
1180
1308
|
const t = {};
|
|
1181
1309
|
o && this.applyCSSStyle(t, o);
|
|
@@ -1205,9 +1333,9 @@ var qs, $s = class {
|
|
|
1205
1333
|
if ("userset" !== i.msoHeightSource) return;
|
|
1206
1334
|
if (!r) return;
|
|
1207
1335
|
let o = r.getAttribute("height") ?? i.height, n = null;
|
|
1208
|
-
if (o && (n =
|
|
1336
|
+
if (o && (n = Wt(o, this._styles.getNormal().getFont().getSize(), "px")), null === n) for (let e = 0; e < r.cells.length; e++) {
|
|
1209
1337
|
const t = r.cells[e], i = t.getAttribute("height") ?? s(t).height;
|
|
1210
|
-
let o =
|
|
1338
|
+
let o = Wt(i, this._styles.getNormal().getFont().getSize(), "px");
|
|
1211
1339
|
null !== o && (n = Math.max(o, n ?? 0));
|
|
1212
1340
|
}
|
|
1213
1341
|
null !== n && this._rowsReading.push({
|
|
@@ -1215,7 +1343,7 @@ var qs, $s = class {
|
|
|
1215
1343
|
min: this._topLeft.rowIndex + e,
|
|
1216
1344
|
max: this._topLeft.rowIndex + e + t - 1
|
|
1217
1345
|
},
|
|
1218
|
-
update: { size: n *
|
|
1346
|
+
update: { size: n * Bt.getDeviceScale() }
|
|
1219
1347
|
});
|
|
1220
1348
|
}
|
|
1221
1349
|
onColumn(e, t, s, r) {
|
|
@@ -1223,12 +1351,12 @@ var qs, $s = class {
|
|
|
1223
1351
|
if ("userset" !== i.msoWidthSource) return;
|
|
1224
1352
|
if (!r) return;
|
|
1225
1353
|
let o = r.getAttribute("width") ?? i.width, n = null;
|
|
1226
|
-
o && (n =
|
|
1354
|
+
o && (n = Wt(o, this._styles.getNormal().getFont().getSize(), "px")), null !== n && this._colsReading.push({
|
|
1227
1355
|
address: {
|
|
1228
1356
|
min: this._topLeft.colIndex + e,
|
|
1229
1357
|
max: this._topLeft.colIndex + e + t - 1
|
|
1230
1358
|
},
|
|
1231
|
-
update: { size: n *
|
|
1359
|
+
update: { size: n * Bt.getDeviceScale() }
|
|
1232
1360
|
});
|
|
1233
1361
|
}
|
|
1234
1362
|
onDone() {
|
|
@@ -1239,9 +1367,9 @@ var qs, $s = class {
|
|
|
1239
1367
|
sheet() {
|
|
1240
1368
|
return this._sheet;
|
|
1241
1369
|
}
|
|
1242
|
-
},
|
|
1370
|
+
}, br = class {
|
|
1243
1371
|
constructor(e) {
|
|
1244
|
-
if (!e) throw new
|
|
1372
|
+
if (!e) throw new _s("snapshot is required.");
|
|
1245
1373
|
this._snapshot = e;
|
|
1246
1374
|
}
|
|
1247
1375
|
getItemType() {
|
|
@@ -1271,10 +1399,10 @@ var qs, $s = class {
|
|
|
1271
1399
|
get isClipboardItem() {
|
|
1272
1400
|
return !0;
|
|
1273
1401
|
}
|
|
1274
|
-
},
|
|
1402
|
+
}, Sr = class {
|
|
1275
1403
|
constructor(e, t, s, r, i) {
|
|
1276
|
-
if (this._parsed = void 0, this._runtime = e, !t) throw new
|
|
1277
|
-
this._topLeft = s ??
|
|
1404
|
+
if (this._parsed = void 0, this._runtime = e, !t) throw new _s("nativeItems are required.");
|
|
1405
|
+
this._topLeft = s ?? ls.EmptyCell, this._native = t, this._markOptions = Object.freeze(r ?? {}), this._styles = i;
|
|
1278
1406
|
}
|
|
1279
1407
|
getItemType() {
|
|
1280
1408
|
return "range";
|
|
@@ -1319,16 +1447,16 @@ var qs, $s = class {
|
|
|
1319
1447
|
async parse() {
|
|
1320
1448
|
let e, t = this._native?.text, s = this._native.html;
|
|
1321
1449
|
if (null === s && t && t.includes("<table")) try {
|
|
1322
|
-
const e = new DOMParser().parseFromString(t,
|
|
1323
|
-
if (r) throw new
|
|
1450
|
+
const e = new DOMParser().parseFromString(t, gs.Html), r = e.querySelector("parsererror");
|
|
1451
|
+
if (r) throw new cs("Unable to parse: " + r);
|
|
1324
1452
|
s = e, t = null;
|
|
1325
1453
|
} catch (e) {
|
|
1326
1454
|
console.warn("Discovered text as html table but could could not parse.");
|
|
1327
1455
|
}
|
|
1328
1456
|
try {
|
|
1329
|
-
const r = new
|
|
1457
|
+
const r = new yr(this._runtime, this._topLeft, this._styles, s ? "HTML" : "Text"), i = await Promise.resolve(t ? B(t) : [[]]);
|
|
1330
1458
|
let o;
|
|
1331
|
-
if (
|
|
1459
|
+
if (L(s, i, r) ? (e = r.sheet(), o = e.getUsedRange()) : s = null, o) {
|
|
1332
1460
|
const t = o.getSnapshot();
|
|
1333
1461
|
return this._parsed = {
|
|
1334
1462
|
prepare: (e, s) => t.prepare?.(e, s),
|
|
@@ -1342,24 +1470,25 @@ var qs, $s = class {
|
|
|
1342
1470
|
throw e;
|
|
1343
1471
|
}
|
|
1344
1472
|
if (!t && !s && this._native.image) {
|
|
1345
|
-
const e = await this._native.image.arrayBuffer();
|
|
1346
|
-
let
|
|
1473
|
+
const e = await this._native.image.arrayBuffer(), t = us.getPngStatedSize(e);
|
|
1474
|
+
let s = null;
|
|
1347
1475
|
return this._parsed = {
|
|
1348
|
-
async prepare(
|
|
1349
|
-
const
|
|
1350
|
-
|
|
1351
|
-
sheet:
|
|
1352
|
-
options: await
|
|
1476
|
+
async prepare(r) {
|
|
1477
|
+
const i = r.getWorksheet();
|
|
1478
|
+
s = {
|
|
1479
|
+
sheet: i,
|
|
1480
|
+
options: await i.getMovables()._preparePicture({ source: { buffer: e } }, {
|
|
1353
1481
|
type: "picture",
|
|
1354
|
-
description:
|
|
1355
|
-
autoSelect: !0
|
|
1482
|
+
description: bs("op.copyImageFromClipboard"),
|
|
1483
|
+
autoSelect: !0,
|
|
1484
|
+
...t && { bounds: t }
|
|
1356
1485
|
})
|
|
1357
1486
|
};
|
|
1358
1487
|
},
|
|
1359
|
-
copyTo(e,
|
|
1488
|
+
copyTo(e, t) {
|
|
1360
1489
|
const r = e.getWorksheet();
|
|
1361
|
-
if (
|
|
1362
|
-
return r.getMovables()._insertNow(
|
|
1490
|
+
if (s?.sheet !== r) throw new Error("The image was not prepared for this sheet.");
|
|
1491
|
+
return r.getMovables()._insertNow(s.options), null;
|
|
1363
1492
|
},
|
|
1364
1493
|
getName: () => "Image"
|
|
1365
1494
|
}, !0;
|
|
@@ -1369,7 +1498,7 @@ var qs, $s = class {
|
|
|
1369
1498
|
get isClipboardItem() {
|
|
1370
1499
|
return !0;
|
|
1371
1500
|
}
|
|
1372
|
-
},
|
|
1501
|
+
}, kr = class {
|
|
1373
1502
|
constructor(t) {
|
|
1374
1503
|
this._closed = !1, this._kind = t.kind, this._id = t.id, this._part = t.part, this._styles = t.styles, this._tabColor = t.tabColor ? this._styles.parseColor(t.tabColor) : null, this._transactions = t.transactions, this._workbook = t.workbook ?? null, this._container = t.container, this._emitter = new e(this, this._transactions);
|
|
1375
1504
|
}
|
|
@@ -1386,11 +1515,11 @@ var qs, $s = class {
|
|
|
1386
1515
|
return this._assertOpen(), this._container.setName(e, t), this;
|
|
1387
1516
|
}
|
|
1388
1517
|
getVisibility() {
|
|
1389
|
-
return this._closed ?
|
|
1518
|
+
return this._closed ? mt.Visibility.VeryHidden : this._container.getVisibility();
|
|
1390
1519
|
}
|
|
1391
1520
|
setVisibility(e = !0, t) {
|
|
1392
1521
|
let s;
|
|
1393
|
-
return this._assertOpen(), s = !0 === e ?
|
|
1522
|
+
return this._assertOpen(), s = !0 === e ? mt.Visibility.Visible : !1 === e ? mt.Visibility.Hidden : e, this._container.setVisibility(s, t), this;
|
|
1394
1523
|
}
|
|
1395
1524
|
getIndex() {
|
|
1396
1525
|
return this._container.getIndex();
|
|
@@ -1412,12 +1541,12 @@ var qs, $s = class {
|
|
|
1412
1541
|
}
|
|
1413
1542
|
delete() {
|
|
1414
1543
|
if (this._closed) return;
|
|
1415
|
-
const e = this._transactions.beginCommit({ description:
|
|
1544
|
+
const e = this._transactions.beginCommit({ description: Ss("op.deleteSheet", { name: this.getName() }) });
|
|
1416
1545
|
try {
|
|
1417
1546
|
try {
|
|
1418
1547
|
this._notify("onBeforeDelete");
|
|
1419
1548
|
} catch (e) {
|
|
1420
|
-
throw e instanceof Error ? e : new
|
|
1549
|
+
throw e instanceof Error ? e : new cs(e?.message ?? Ss("error.sheet.modelDelete"));
|
|
1421
1550
|
}
|
|
1422
1551
|
this._notify("onDelete"), e.commit();
|
|
1423
1552
|
} catch (t) {
|
|
@@ -1443,7 +1572,7 @@ var qs, $s = class {
|
|
|
1443
1572
|
this._emitter.notify(e);
|
|
1444
1573
|
}
|
|
1445
1574
|
_assertOpen() {
|
|
1446
|
-
if (this._closed) throw new Error(
|
|
1575
|
+
if (this._closed) throw new Error(Ss("error.sheet.modelClosed"));
|
|
1447
1576
|
}
|
|
1448
1577
|
get [Symbol.toStringTag]() {
|
|
1449
1578
|
return "[OpaqueSheet]";
|
|
@@ -1458,12 +1587,12 @@ var qs, $s = class {
|
|
|
1458
1587
|
return !0;
|
|
1459
1588
|
}
|
|
1460
1589
|
};
|
|
1461
|
-
(
|
|
1590
|
+
(nr || (nr = {})).Visibility = {
|
|
1462
1591
|
Visible: "visible",
|
|
1463
1592
|
Hidden: "hidden",
|
|
1464
1593
|
VeryHidden: "veryHidden"
|
|
1465
1594
|
};
|
|
1466
|
-
var
|
|
1595
|
+
var Cr, vr = {
|
|
1467
1596
|
showFormulaBar: !0,
|
|
1468
1597
|
showTabs: !0,
|
|
1469
1598
|
tabRatio: 600,
|
|
@@ -1474,11 +1603,11 @@ var sr, rr = {
|
|
|
1474
1603
|
firstTab: 0,
|
|
1475
1604
|
windowBounds: null,
|
|
1476
1605
|
minimized: !1,
|
|
1477
|
-
visibility:
|
|
1606
|
+
visibility: nr.Visibility.Visible,
|
|
1478
1607
|
autoFilterDateGrouping: !0
|
|
1479
|
-
},
|
|
1608
|
+
}, Ir = class {
|
|
1480
1609
|
constructor(t) {
|
|
1481
|
-
this._id =
|
|
1610
|
+
this._id = as.uuidV4(), this._emitter = new e(this), this._state = { ...vr }, t?.json && this._fromJSON(t?.json);
|
|
1482
1611
|
}
|
|
1483
1612
|
getId() {
|
|
1484
1613
|
return this._id;
|
|
@@ -1567,7 +1696,7 @@ var sr, rr = {
|
|
|
1567
1696
|
const t = Object.keys(this._state), s = t.length;
|
|
1568
1697
|
for (let r = 0; r < s; r++) {
|
|
1569
1698
|
const s = t[r], i = this._state[s];
|
|
1570
|
-
null != i && i !==
|
|
1699
|
+
null != i && i !== vr[s] && (e[s] = i);
|
|
1571
1700
|
}
|
|
1572
1701
|
return 0 === Object.keys(e).length && (e = null), e;
|
|
1573
1702
|
}
|
|
@@ -1577,7 +1706,7 @@ var sr, rr = {
|
|
|
1577
1706
|
}
|
|
1578
1707
|
update(e, t = !0) {
|
|
1579
1708
|
this._state = {
|
|
1580
|
-
...
|
|
1709
|
+
...vr,
|
|
1581
1710
|
...this._state,
|
|
1582
1711
|
...e
|
|
1583
1712
|
}, t && this._emitter.notify("onViewChange");
|
|
@@ -1592,13 +1721,13 @@ var sr, rr = {
|
|
|
1592
1721
|
get isIWorkbookView() {
|
|
1593
1722
|
return !0;
|
|
1594
1723
|
}
|
|
1595
|
-
},
|
|
1724
|
+
}, Nr = Object.freeze({
|
|
1596
1725
|
structure: !1,
|
|
1597
1726
|
windows: !1,
|
|
1598
1727
|
revision: !0,
|
|
1599
1728
|
password: null,
|
|
1600
1729
|
revisionsPassword: null
|
|
1601
|
-
}),
|
|
1730
|
+
}), Or = class extends ie {
|
|
1602
1731
|
isWindowsAllowed() {
|
|
1603
1732
|
return this._isPropertyAllowed("windows");
|
|
1604
1733
|
}
|
|
@@ -1620,7 +1749,7 @@ var sr, rr = {
|
|
|
1620
1749
|
const s = Object.keys(t), r = s.length;
|
|
1621
1750
|
for (let i = 0; i < r; i++) {
|
|
1622
1751
|
const r = s[i], o = t[r];
|
|
1623
|
-
null != o && o !==
|
|
1752
|
+
null != o && o !== Nr[r] && (e[r] = o);
|
|
1624
1753
|
}
|
|
1625
1754
|
}
|
|
1626
1755
|
return super._toJSON(e);
|
|
@@ -1632,38 +1761,38 @@ var sr, rr = {
|
|
|
1632
1761
|
return !0;
|
|
1633
1762
|
}
|
|
1634
1763
|
};
|
|
1635
|
-
(
|
|
1764
|
+
(Cr || (Cr = {})).Type = {
|
|
1636
1765
|
Number: "number",
|
|
1637
1766
|
Boolean: "boolean",
|
|
1638
1767
|
Date: "date",
|
|
1639
1768
|
String: "string",
|
|
1640
1769
|
Float: "float"
|
|
1641
1770
|
};
|
|
1642
|
-
var
|
|
1771
|
+
var Rr = (e) => {
|
|
1643
1772
|
if ("string" == typeof e) return {
|
|
1644
|
-
type:
|
|
1773
|
+
type: Cr.Type.String,
|
|
1645
1774
|
value: e
|
|
1646
1775
|
};
|
|
1647
1776
|
if ("boolean" == typeof e) return {
|
|
1648
|
-
type:
|
|
1777
|
+
type: Cr.Type.Boolean,
|
|
1649
1778
|
value: e
|
|
1650
1779
|
};
|
|
1651
1780
|
if ("number" == typeof e) {
|
|
1652
1781
|
if (!Number.isFinite(e)) throw new Error("A custom property value must be a finite number.");
|
|
1653
1782
|
return {
|
|
1654
|
-
type: Number.isInteger(e) && e >= -2147483648 && e <= 2147483647 ?
|
|
1783
|
+
type: Number.isInteger(e) && e >= -2147483648 && e <= 2147483647 ? Cr.Type.Number : Cr.Type.Float,
|
|
1655
1784
|
value: e
|
|
1656
1785
|
};
|
|
1657
1786
|
}
|
|
1658
1787
|
if (e instanceof Date) {
|
|
1659
1788
|
if (isNaN(e.getTime())) throw new Error("A custom property value must be a valid date.");
|
|
1660
1789
|
return {
|
|
1661
|
-
type:
|
|
1790
|
+
type: Cr.Type.Date,
|
|
1662
1791
|
value: e.toISOString()
|
|
1663
1792
|
};
|
|
1664
1793
|
}
|
|
1665
1794
|
throw new Error("A custom property value must be a string, number, boolean or Date.");
|
|
1666
|
-
},
|
|
1795
|
+
}, xr = class {
|
|
1667
1796
|
constructor(e, t) {
|
|
1668
1797
|
this._json = e, this._owner = t;
|
|
1669
1798
|
}
|
|
@@ -1678,12 +1807,12 @@ var ar = (e) => {
|
|
|
1678
1807
|
}
|
|
1679
1808
|
getValue() {
|
|
1680
1809
|
const { type: e, value: t } = this._json;
|
|
1681
|
-
return e ===
|
|
1810
|
+
return e === Cr.Type.Date ? new Date(t) : t;
|
|
1682
1811
|
}
|
|
1683
1812
|
setValue(e) {
|
|
1684
1813
|
this._owner._assertCustomEditable(this), this._json = {
|
|
1685
1814
|
...this._json,
|
|
1686
|
-
...
|
|
1815
|
+
...Rr(e)
|
|
1687
1816
|
};
|
|
1688
1817
|
}
|
|
1689
1818
|
delete() {
|
|
@@ -1692,7 +1821,7 @@ var ar = (e) => {
|
|
|
1692
1821
|
toJSON() {
|
|
1693
1822
|
return { ...this._json };
|
|
1694
1823
|
}
|
|
1695
|
-
},
|
|
1824
|
+
}, Er = class {
|
|
1696
1825
|
constructor(e) {
|
|
1697
1826
|
this._json = {}, this._custom = [], this._assertOpen = e;
|
|
1698
1827
|
}
|
|
@@ -1782,9 +1911,9 @@ var ar = (e) => {
|
|
|
1782
1911
|
if (this._assertOpen(), "string" != typeof e || "" === e) throw new Error("A custom property needs a name.");
|
|
1783
1912
|
const s = this.getCustomProperty(e);
|
|
1784
1913
|
if (s) return s.setValue(t), s;
|
|
1785
|
-
const r = new
|
|
1914
|
+
const r = new xr({
|
|
1786
1915
|
key: e,
|
|
1787
|
-
...
|
|
1916
|
+
...Rr(t)
|
|
1788
1917
|
}, this);
|
|
1789
1918
|
return this._custom.push(r), r;
|
|
1790
1919
|
}
|
|
@@ -1799,26 +1928,26 @@ var ar = (e) => {
|
|
|
1799
1928
|
}
|
|
1800
1929
|
fromJSON(e) {
|
|
1801
1930
|
const { custom: t, ...s } = e ?? {};
|
|
1802
|
-
this._json = s, this._custom = (t ?? []).map((e) => new
|
|
1931
|
+
this._json = s, this._custom = (t ?? []).map((e) => new xr({ ...e }, this));
|
|
1803
1932
|
}
|
|
1804
1933
|
toJSON() {
|
|
1805
1934
|
const e = { ...this._json };
|
|
1806
1935
|
return this._custom.length > 0 && (e.custom = this._custom.map((e) => e.toJSON())), e;
|
|
1807
1936
|
}
|
|
1808
1937
|
};
|
|
1809
|
-
function
|
|
1810
|
-
return
|
|
1938
|
+
function Lr(e) {
|
|
1939
|
+
return Ss("error.workbook.invalidSheetKey", { key: e });
|
|
1811
1940
|
}
|
|
1812
|
-
function
|
|
1813
|
-
return
|
|
1941
|
+
function Ar(e) {
|
|
1942
|
+
return Ss("error.workbook.sheetNameNotFound", { sheetName: e });
|
|
1814
1943
|
}
|
|
1815
|
-
function
|
|
1816
|
-
return
|
|
1944
|
+
function Vr(e, t) {
|
|
1945
|
+
return Ss("chart" === t ? "error.workbook.sheetIsChart" : "macro" === t ? "error.workbook.sheetIsMacro" : "error.workbook.sheetIsDialog", { sheetName: e });
|
|
1817
1946
|
}
|
|
1818
|
-
function
|
|
1819
|
-
return "chart" === t ?
|
|
1947
|
+
function Tr(e, t) {
|
|
1948
|
+
return "chart" === t ? Ss("error.workbook.selectedIsChart", { sheetName: e }) : "macro" === t ? Ss("error.workbook.selectedIsMacro", { sheetName: e }) : "dialog" === t ? Ss("error.workbook.selectedIsDialog", { sheetName: e }) : Ss("error.workbook.noWorksheet");
|
|
1820
1949
|
}
|
|
1821
|
-
var
|
|
1950
|
+
var Pr = class extends Ne {
|
|
1822
1951
|
constructor(e, t, s, r) {
|
|
1823
1952
|
super(), this._add = e, this._get = t, this._addListeners = s, this._getSelected = r;
|
|
1824
1953
|
}
|
|
@@ -1849,39 +1978,39 @@ var mr = class extends ee {
|
|
|
1849
1978
|
get isIWorksheetCollection() {
|
|
1850
1979
|
return !0;
|
|
1851
1980
|
}
|
|
1852
|
-
},
|
|
1853
|
-
function
|
|
1854
|
-
const t =
|
|
1981
|
+
}, Fr = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), Wr = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
|
|
1982
|
+
function Br(e) {
|
|
1983
|
+
const t = Ss(bs("workbook.defaultSheetName"), { n: e + 1 });
|
|
1855
1984
|
return "workbook.defaultSheetName" === t ? `Sheet${e + 1}` : t;
|
|
1856
1985
|
}
|
|
1857
|
-
function
|
|
1986
|
+
function jr(e, t) {
|
|
1858
1987
|
return {
|
|
1859
|
-
...
|
|
1988
|
+
...oe,
|
|
1860
1989
|
getWorksheet: () => null,
|
|
1861
|
-
toString: () =>
|
|
1990
|
+
toString: () => ot(e, t)
|
|
1862
1991
|
};
|
|
1863
1992
|
}
|
|
1864
|
-
function
|
|
1865
|
-
if (!e) throw new Error(
|
|
1866
|
-
if (
|
|
1993
|
+
function Mr(e, t = !1) {
|
|
1994
|
+
if (!e) throw new Error(Ss("error.workbook.sheetNameBlank"));
|
|
1995
|
+
if (Fr.test(e)) {
|
|
1867
1996
|
if (!t) throw new Error(function(e) {
|
|
1868
|
-
return e ?
|
|
1997
|
+
return e ? Ss("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : Ss("error.workbook.sheetNameInvalidChars");
|
|
1869
1998
|
}(e));
|
|
1870
|
-
e = e.replace(
|
|
1999
|
+
e = e.replace(Fr, "");
|
|
1871
2000
|
}
|
|
1872
|
-
if (0 === e.length) throw new Error(
|
|
2001
|
+
if (0 === e.length) throw new Error(Ss("error.workbook.sheetNameBlank"));
|
|
1873
2002
|
const s = e.length;
|
|
1874
2003
|
if (s > 31) {
|
|
1875
|
-
if (!t) throw new Error(
|
|
2004
|
+
if (!t) throw new Error(Ss("error.workbook.sheetNameTooLong"));
|
|
1876
2005
|
e = e.substring(0, 31);
|
|
1877
2006
|
}
|
|
1878
2007
|
if ("'" === e.charAt(0) || "'" === e.charAt(s - 1)) {
|
|
1879
|
-
if (!t) throw new Error(
|
|
2008
|
+
if (!t) throw new Error(Ss("error.workbook.sheetNameQuotes"));
|
|
1880
2009
|
e = e.replace(/^'|'$/g, "");
|
|
1881
2010
|
}
|
|
1882
2011
|
return e;
|
|
1883
2012
|
}
|
|
1884
|
-
var
|
|
2013
|
+
var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
|
|
1885
2014
|
constructor(e, t, s, r) {
|
|
1886
2015
|
super(e, t, r), this._workbook = s;
|
|
1887
2016
|
}
|
|
@@ -1892,24 +2021,24 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
1892
2021
|
let r = this._options;
|
|
1893
2022
|
return s && (r = {
|
|
1894
2023
|
...this._options,
|
|
1895
|
-
getOptions:
|
|
2024
|
+
getOptions: yt(this._options?.getOptions, s)
|
|
1896
2025
|
}), new e(t, this._internal, this._workbook, r);
|
|
1897
2026
|
}
|
|
1898
2027
|
_createRange(e, t) {
|
|
1899
|
-
const s = e ? { ...e } : null, r = this._workbook, i = s ? r._getSheetRef(s.scope,
|
|
1900
|
-
if (i && !i.sheet.isIWorksheet) throw new
|
|
2028
|
+
const s = e ? { ...e } : null, r = this._workbook, i = s ? r._getSheetRef(s.scope, mt.Visibility.VeryHidden) : null;
|
|
2029
|
+
if (i && !i.sheet.isIWorksheet) throw new cs(Vr(i.name, i.sheet.getKind()));
|
|
1901
2030
|
if (!i) {
|
|
1902
2031
|
const e = r._anchorWorksheet();
|
|
1903
|
-
return delete s?.scope,
|
|
1904
|
-
scope:
|
|
2032
|
+
return delete s?.scope, jr(s, s ? {
|
|
2033
|
+
scope: ye,
|
|
1905
2034
|
...e.getEntireRange().getCoords()
|
|
1906
2035
|
} : null);
|
|
1907
2036
|
}
|
|
1908
2037
|
let o = this._options;
|
|
1909
2038
|
return t && (o = {
|
|
1910
2039
|
...this._options,
|
|
1911
|
-
getOptions:
|
|
1912
|
-
}), new
|
|
2040
|
+
getOptions: yt(this._options.getOptions, t)
|
|
2041
|
+
}), new Ur(e, Ie(i.sheet), this._workbook, o);
|
|
1913
2042
|
}
|
|
1914
2043
|
async select(e) {
|
|
1915
2044
|
const t = [];
|
|
@@ -1935,15 +2064,15 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
1935
2064
|
}
|
|
1936
2065
|
getAddress(e) {
|
|
1937
2066
|
const t = this._internal.getSheet(), s = t.getEntireRange().getCoords();
|
|
1938
|
-
return
|
|
2067
|
+
return ht(this.getCoords(), {
|
|
1939
2068
|
...s,
|
|
1940
2069
|
scope: t.getName()
|
|
1941
|
-
},
|
|
2070
|
+
}, ot, Le, e);
|
|
1942
2071
|
}
|
|
1943
2072
|
toString() {
|
|
1944
2073
|
return this.getAddress();
|
|
1945
2074
|
}
|
|
1946
|
-
},
|
|
2075
|
+
}, Ur = class e extends N {
|
|
1947
2076
|
constructor(e, t, s, r) {
|
|
1948
2077
|
super(e, t, r), this._workbook = s;
|
|
1949
2078
|
}
|
|
@@ -1951,17 +2080,17 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
1951
2080
|
let s = this._options;
|
|
1952
2081
|
return t && (s = {
|
|
1953
2082
|
...this._options,
|
|
1954
|
-
getOptions:
|
|
1955
|
-
}), new
|
|
2083
|
+
getOptions: yt(this._options?.getOptions, t)
|
|
2084
|
+
}), new Hr(e, this._internal, this._workbook, s);
|
|
1956
2085
|
}
|
|
1957
2086
|
_createRange(t, s) {
|
|
1958
2087
|
const r = this._internal;
|
|
1959
|
-
if (!t) return
|
|
1960
|
-
if (r.validateCoords(t), r.getSheet().isClosed()) return
|
|
2088
|
+
if (!t) return St(r.getSheet(), r.getSheet().getEntireCoords());
|
|
2089
|
+
if (r.validateCoords(t), r.getSheet().isClosed()) return St(null, r.getSheet().getEntireCoords(), t);
|
|
1961
2090
|
let i = this._options;
|
|
1962
2091
|
return s && (i = {
|
|
1963
2092
|
...this._options,
|
|
1964
|
-
getOptions:
|
|
2093
|
+
getOptions: yt(this._options?.getOptions, s)
|
|
1965
2094
|
}), new e(t, this._internal, this._workbook, i);
|
|
1966
2095
|
}
|
|
1967
2096
|
addListener(e, t) {
|
|
@@ -1974,7 +2103,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
1974
2103
|
}
|
|
1975
2104
|
getAddress(e) {
|
|
1976
2105
|
const t = this._internal.getSheet(), s = t?.getEntireRange().getCoords() ?? null;
|
|
1977
|
-
return
|
|
2106
|
+
return ot(this.getCoords(), {
|
|
1978
2107
|
...s,
|
|
1979
2108
|
scope: t.getName()
|
|
1980
2109
|
});
|
|
@@ -1982,13 +2111,13 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
1982
2111
|
toString() {
|
|
1983
2112
|
return this.getAddress();
|
|
1984
2113
|
}
|
|
1985
|
-
},
|
|
2114
|
+
}, Jr = (e) => !!e && "object" == typeof e && "function" == typeof e.getOrigin, qr = class {
|
|
1986
2115
|
constructor(t) {
|
|
1987
|
-
this._isLoadingSheets = !1, this._lastTransactionUUID = null, this._starting = null, this._closed = !1, this._listenerOriginProvider = null, this._listenerOrigin = null, this._lastOriginName = null, this._initializing = !0, this._pivotCaches = [], this._pivotTableCollection = new
|
|
2116
|
+
this._isLoadingSheets = !1, this._lastTransactionUUID = null, this._starting = null, this._closed = !1, this._listenerOriginProvider = null, this._listenerOrigin = null, this._lastOriginName = null, this._initializing = !0, this._pivotCaches = [], this._pivotTableCollection = new Se(() => {
|
|
1988
2117
|
const e = [];
|
|
1989
2118
|
for (const t of this.getWorksheets()) e.push(...t.getPivotTables());
|
|
1990
2119
|
return e;
|
|
1991
|
-
}), this._people = new
|
|
2120
|
+
}), this._people = new hr(), this._commentCollection = new d(null, (e, t, s) => {
|
|
1992
2121
|
const r = [];
|
|
1993
2122
|
for (const i of this.getWorksheets()) r.push(...i.getComments().getItems(e ? {
|
|
1994
2123
|
address: e,
|
|
@@ -2001,25 +2130,25 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2001
2130
|
return r;
|
|
2002
2131
|
}, (e, t) => this.addListeners({ onSheetsChange: e.onCollectionChange ? () => {
|
|
2003
2132
|
e.onCollectionChange(this._commentCollection);
|
|
2004
|
-
} : void 0 }, t)), this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._documentProperties = new
|
|
2005
|
-
if (this._closed) throw new Error(
|
|
2006
|
-
}), this._locale = null, this._localeOverrides = null;
|
|
2133
|
+
} : void 0 }, t)), this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._documentProperties = new Er(() => {
|
|
2134
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2135
|
+
}), this._locale = null, this._localeOverrides = null, this._startModules = /* @__PURE__ */ new WeakSet();
|
|
2007
2136
|
const s = "string" == typeof t ? { origin: t } : { ...t }, r = s.origin;
|
|
2008
|
-
this._ownOriginProvider = !
|
|
2137
|
+
this._ownOriginProvider = !Jr(r), this._originProvider = Jr(r) ? r : new As("string" == typeof r ? new Rs(null, { name: r }) : r ?? new Rs(null)), delete s.origin, this._bindOrigin(this._originProvider.getOrigin()), this._listenerOriginProvider = this._originProvider.addListeners({ onOriginChange: () => this._onOriginChange() });
|
|
2009
2138
|
const o = s.json;
|
|
2010
|
-
delete s.json, this._transactions = s.transactions ?? new i(), this._id = this._transactions.create(), this._ownTransactions = !s.transactions, this._emitter = new e(this, this._transactions), this._runtime = s.runtime ?? new
|
|
2139
|
+
delete s.json, this._transactions = s.transactions ?? new i(), this._id = this._transactions.create(), this._ownTransactions = !s.transactions, this._emitter = new e(this, this._transactions), this._runtime = s.runtime ?? new $e("Workbook Runtime", {
|
|
2011
2140
|
isDate1904: () => this._isDate1904,
|
|
2012
2141
|
getNow: () => this._transactions.getCurrentCommit().getTimestamp(),
|
|
2013
|
-
getLocale: () => this._locale ??
|
|
2142
|
+
getLocale: () => this._locale ?? Ee() ?? ut(),
|
|
2014
2143
|
getLocaleOverrides: () => this._localeOverrides
|
|
2015
|
-
}), this._listenerLanguage =
|
|
2144
|
+
}), this._listenerLanguage = hs.addChangeListener(() => {
|
|
2016
2145
|
this._closed || this._notifyAllChange();
|
|
2017
2146
|
});
|
|
2018
|
-
const n = this,
|
|
2147
|
+
const n = this, a = this._beginCommit({ description: bs(o ? "op.openWorkbook" : "op.newWorkbook") });
|
|
2019
2148
|
try {
|
|
2020
|
-
this._strings = s.strings ?? new
|
|
2149
|
+
this._strings = s.strings ?? new $(), this._ownStrings = !s.strings, this._richValues = s.richData ?? new rt(), this._resources = s.resources ?? new Q(), this._ownResources = !s.resources, this._fetch = new wr(this._resources, s.fetcher ?? new _r()), this._createSheetName = s.createSheetNameCallback ?? Br;
|
|
2021
2150
|
let e = s.createWorksheetCallback;
|
|
2022
|
-
e || (e = (e) => new
|
|
2151
|
+
e || (e = (e) => new le(e)), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, s, r, i, o, a, l) => {
|
|
2023
2152
|
let h = null;
|
|
2024
2153
|
const c = {
|
|
2025
2154
|
runtime: n._runtime,
|
|
@@ -2029,6 +2158,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2029
2158
|
transactions: n._transactions,
|
|
2030
2159
|
styles: n._styles,
|
|
2031
2160
|
strings: n._strings,
|
|
2161
|
+
richData: n._richValues,
|
|
2032
2162
|
resources: n._resources,
|
|
2033
2163
|
names: n._names,
|
|
2034
2164
|
workbook: n,
|
|
@@ -2039,7 +2169,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2039
2169
|
h = e, n._addSheetRef({
|
|
2040
2170
|
name: s,
|
|
2041
2171
|
id: t,
|
|
2042
|
-
visibility: r ??
|
|
2172
|
+
visibility: r ?? mt.Visibility.Visible,
|
|
2043
2173
|
sheetId: o,
|
|
2044
2174
|
sheet: e
|
|
2045
2175
|
}, i);
|
|
@@ -2056,7 +2186,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2056
2186
|
},
|
|
2057
2187
|
getVisibility: () => {
|
|
2058
2188
|
const e = n._getSheetRef(h);
|
|
2059
|
-
return e ? e.visibility :
|
|
2189
|
+
return e ? e.visibility : mt.Visibility.Visible;
|
|
2060
2190
|
},
|
|
2061
2191
|
setVisibility: (e, t) => {
|
|
2062
2192
|
n._setSheetVisibility(h, e, t);
|
|
@@ -2067,10 +2197,10 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2067
2197
|
duplicate: () => n._duplicateSheet(h),
|
|
2068
2198
|
getIndex: () => {
|
|
2069
2199
|
const e = n._getSheetRef(h);
|
|
2070
|
-
return e ? n._getOffsetForId(e.id, n._getSheetRefs(
|
|
2200
|
+
return e ? n._getOffsetForId(e.id, n._getSheetRefs(mt.Visibility.VeryHidden)) : i;
|
|
2071
2201
|
},
|
|
2072
2202
|
setIndex: (e, t) => {
|
|
2073
|
-
const s = n._getSheetRef(h,
|
|
2203
|
+
const s = n._getSheetRef(h, mt.Visibility.VeryHidden);
|
|
2074
2204
|
return !!s && (n._moveSheet(s, e, t), !0);
|
|
2075
2205
|
},
|
|
2076
2206
|
setIndexCallback: (e) => {
|
|
@@ -2080,16 +2210,16 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2080
2210
|
}
|
|
2081
2211
|
};
|
|
2082
2212
|
return a && (c.json = a), void 0 !== l && (c.uid = () => l), h = e(c, s, i, r), h;
|
|
2083
|
-
}, this._namedTableSource = new
|
|
2084
|
-
getSheets: () => n._sheets ? n.getWorksheets().getItems() :
|
|
2213
|
+
}, this._namedTableSource = new ze({
|
|
2214
|
+
getSheets: () => n._sheets ? n.getWorksheets().getItems() : as.EmptyArray,
|
|
2085
2215
|
addSheetsListener: (e, t) => n.addListeners({ onSheetsChange: e }, t)
|
|
2086
|
-
}), this._names = s.names ?? new
|
|
2216
|
+
}), this._names = s.names ?? new nt({
|
|
2087
2217
|
addressToRanges: (e) => n.getRanges(e),
|
|
2088
2218
|
getCurrentScope: () => n.getSelectedWorksheet()?.getName() ?? null,
|
|
2089
2219
|
isReadOnly: () => (n._options.readonly ?? !1) || n._isStructureProtected(),
|
|
2090
2220
|
transactions: n._transactions,
|
|
2091
|
-
getSources: () => n._calculation ? [n._calculation.getNamedFormulas(), n._namedTableSource] :
|
|
2092
|
-
}), this._ownNames = !s.names, this._calculation = s.calculation ?? new
|
|
2221
|
+
getSources: () => n._calculation ? [n._calculation.getNamedFormulas(), n._namedTableSource] : as.EmptyArray
|
|
2222
|
+
}), this._ownNames = !s.names, this._calculation = s.calculation ?? new K({
|
|
2093
2223
|
runtime: n._runtime,
|
|
2094
2224
|
functions: s.functions,
|
|
2095
2225
|
json: o?.calc,
|
|
@@ -2108,19 +2238,19 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2108
2238
|
getSheetIndex: (e) => {
|
|
2109
2239
|
if (void 0 === e) {
|
|
2110
2240
|
const e = n.getSelectedSheet();
|
|
2111
|
-
return e ? this._getSheetRefs(
|
|
2241
|
+
return e ? this._getSheetRefs(mt.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
|
|
2112
2242
|
}
|
|
2113
|
-
const t = this._getSheetRefs(
|
|
2243
|
+
const t = this._getSheetRefs(mt.Visibility.VeryHidden);
|
|
2114
2244
|
e = e.toLowerCase();
|
|
2115
2245
|
const s = t.length;
|
|
2116
2246
|
for (let r = 0; r < s; r++) if (t[r].name.toLowerCase() === e) return r;
|
|
2117
2247
|
try {
|
|
2118
|
-
|
|
2119
|
-
const t = this._names.getItems(
|
|
2248
|
+
$r.address = e;
|
|
2249
|
+
const t = this._names.getItems($r);
|
|
2120
2250
|
if (!t || 0 === t.length) return -1;
|
|
2121
2251
|
let s = (t[0].getRanges?.()?.getCoords()?.[0])?.scope;
|
|
2122
2252
|
if (!s) return -1;
|
|
2123
|
-
const r = this._getSheetRefs(
|
|
2253
|
+
const r = this._getSheetRefs(mt.Visibility.VeryHidden);
|
|
2124
2254
|
s = s.toLowerCase();
|
|
2125
2255
|
const i = r.length;
|
|
2126
2256
|
for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === s) return e;
|
|
@@ -2129,37 +2259,63 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2129
2259
|
}
|
|
2130
2260
|
return -1;
|
|
2131
2261
|
},
|
|
2132
|
-
getSheetCount: () => n._getSheetRefs(
|
|
2262
|
+
getSheetCount: () => n._getSheetRefs(mt.Visibility.VeryHidden).length,
|
|
2133
2263
|
externalBooks: o?.externalBooks,
|
|
2134
2264
|
externalBookResolver: s.externalBookResolver,
|
|
2135
2265
|
namedCollection: n._names,
|
|
2136
2266
|
strings: n._strings,
|
|
2267
|
+
get resources() {
|
|
2268
|
+
return n._resources;
|
|
2269
|
+
},
|
|
2270
|
+
fetch: (e, t) => n._fetch.fetch(e, t),
|
|
2271
|
+
parseText: (e, t) => (async (e, t, s) => {
|
|
2272
|
+
const r = await import("papaparse"), i = (r.default ?? r).parse(t, {
|
|
2273
|
+
delimiter: s?.delimiter ?? ",",
|
|
2274
|
+
skipEmptyLines: !1
|
|
2275
|
+
}).data;
|
|
2276
|
+
let o = i.length;
|
|
2277
|
+
const n = i[o - 1];
|
|
2278
|
+
n && 1 === n.length && "" === n[0] && o--;
|
|
2279
|
+
let a = 0;
|
|
2280
|
+
for (let e = 0; e < o; e++) i[e].length > a && (a = i[e].length);
|
|
2281
|
+
const l = new Array(o);
|
|
2282
|
+
for (let t = 0; t < o; t++) {
|
|
2283
|
+
const s = i[t], r = new Array(a);
|
|
2284
|
+
for (let t = 0; t < a; t++) {
|
|
2285
|
+
const i = s[t];
|
|
2286
|
+
r[t] = void 0 === i || "" === i ? null : dt(e, i).value;
|
|
2287
|
+
}
|
|
2288
|
+
l[t] = r;
|
|
2289
|
+
}
|
|
2290
|
+
return l;
|
|
2291
|
+
})(n._runtime, e, t),
|
|
2292
|
+
startFunctions: () => n._startFunctions(),
|
|
2137
2293
|
transactions: n._transactions,
|
|
2138
2294
|
names: o?.names
|
|
2139
2295
|
}), this._ownCalculation = !s.calculation, this._scripts = this._createScripts(o?.modules), this._ownNames = !s.names, this._options = Object.freeze({ ...s });
|
|
2140
|
-
const t = o?.sheets?.length ? o.sheets.map((e) => e.name) : [this._createSheetName(0)], r = t.map((e) => e + "-" +
|
|
2296
|
+
const t = o?.sheets?.length ? o.sheets.map((e) => e.name) : [this._createSheetName(0)], r = t.map((e) => e + "-" + as.uuidV4()), i = (e) => {
|
|
2141
2297
|
const t = o?.sheets?.[e]?.kind;
|
|
2142
|
-
return !!t && t !==
|
|
2298
|
+
return !!t && t !== mt.Kind.Worksheet;
|
|
2143
2299
|
};
|
|
2144
2300
|
this._calculation._setSheets(t.map((e, t) => i(t) ? [
|
|
2145
2301
|
r[t],
|
|
2146
2302
|
e,
|
|
2147
2303
|
!0
|
|
2148
2304
|
] : [r[t], e]));
|
|
2149
|
-
const
|
|
2305
|
+
const l = s.calcOnLoad ?? "auto";
|
|
2150
2306
|
let h = !1;
|
|
2151
2307
|
const c = (async () => {
|
|
2152
2308
|
try {
|
|
2153
|
-
if (this._ownCalculation && "none" !==
|
|
2309
|
+
if (this._ownCalculation && "none" !== l && ("full" === l || "auto" === l && !0 === o?.calc?.fullCalcOnLoad ? await this._calculation._calculateForLoad() : await this._calculation.start(), this._closed)) return;
|
|
2154
2310
|
await this._scripts.start();
|
|
2155
2311
|
} finally {
|
|
2156
2312
|
h = !0, this._starting = null;
|
|
2157
2313
|
}
|
|
2158
2314
|
})();
|
|
2159
|
-
h || (this._starting = c), this._starting?.catch(() => {}), o ? this._fromJSON(o, r) : (this._initState(), this._addSheet(!1, t[0], null, r[0])), this._sheets = new
|
|
2315
|
+
h || (this._starting = c), this._starting?.catch(() => {}), o ? this._fromJSON(o, r) : (this._initState(), this._addSheet(!1, t[0], null, r[0])), this._sheets = new Pr((e) => n._addSheetOptions(e), (e, t) => {
|
|
2160
2316
|
if (e) {
|
|
2161
2317
|
const s = this._getSheetRef(e, t);
|
|
2162
|
-
return s &&
|
|
2318
|
+
return s && Kr(s) ? [s.sheet] : as.EmptyArray;
|
|
2163
2319
|
}
|
|
2164
2320
|
return this._getWorksheets(t);
|
|
2165
2321
|
}, (e, t) => {
|
|
@@ -2172,9 +2328,9 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2172
2328
|
r(n._sheets);
|
|
2173
2329
|
} : void 0
|
|
2174
2330
|
}, t);
|
|
2175
|
-
}, () => n.getSelectedWorksheet()), this._ownCalculation && "none" !== (s.calcOnLoad ?? "auto") && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), this._ownTransactions ?
|
|
2331
|
+
}, () => n.getSelectedWorksheet()), this._ownCalculation && "none" !== (s.calcOnLoad ?? "auto") && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), this._ownTransactions ? a.amend() : a.commit();
|
|
2176
2332
|
} catch (e) {
|
|
2177
|
-
throw
|
|
2333
|
+
throw a.rollback(), e;
|
|
2178
2334
|
}
|
|
2179
2335
|
this._initializing = !1;
|
|
2180
2336
|
}
|
|
@@ -2182,13 +2338,13 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2182
2338
|
let e = this._getSheetRefs();
|
|
2183
2339
|
for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
|
|
2184
2340
|
const t = this._options;
|
|
2185
|
-
this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new
|
|
2341
|
+
this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new st().getDefaultTheme(), this._styles = t?.styles ?? new It(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new Ir()), this._listenerProtection?.(), this._protection = new Or(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
|
|
2186
2342
|
s._emitter.notify("onProtectionChange");
|
|
2187
2343
|
} });
|
|
2188
2344
|
const s = this;
|
|
2189
2345
|
this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
|
|
2190
2346
|
async onAfterStateChange(e, t, r, i, o) {
|
|
2191
|
-
const n = s._view, a = o?.[
|
|
2347
|
+
const n = s._view, a = o?.[zr], l = r ? a?.before : a?.after, h = a?.viewId === n.getId() && null != l, c = h ? l : n.getActiveSheetId(), u = h && t.getId() === s._lastTransactionUUID ? s._getSheetRef({ id: c }) : null;
|
|
2192
2348
|
u ? await u.sheet.select() : s._resyncActiveSheet(c, e), s._lastTransactionUUID = t.getId(), (r || i) && s._emitter.notify("onSheetsChange"), s._emitter.notify("onSelectedSheetChange"), s._emitter.notify("onViewChange");
|
|
2193
2349
|
},
|
|
2194
2350
|
onRestoreOrRevert() {
|
|
@@ -2243,8 +2399,8 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2243
2399
|
return this._view;
|
|
2244
2400
|
}
|
|
2245
2401
|
setView(e) {
|
|
2246
|
-
if (this._closed) throw new Error(
|
|
2247
|
-
if (!e) throw new
|
|
2402
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2403
|
+
if (!e) throw new cs(Ss("error.sheet.emptyView"));
|
|
2248
2404
|
this._listenerWorkbookView?.();
|
|
2249
2405
|
const t = this;
|
|
2250
2406
|
let s = -1;
|
|
@@ -2257,7 +2413,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2257
2413
|
return this._runtime;
|
|
2258
2414
|
}
|
|
2259
2415
|
setDate1904(e) {
|
|
2260
|
-
if (this._closed) throw new Error(
|
|
2416
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2261
2417
|
return this._isDate1904 === e || (this._isDate1904 = e, this._emitter.notify("onRegionalChange")), this;
|
|
2262
2418
|
}
|
|
2263
2419
|
getLocale() {
|
|
@@ -2267,11 +2423,11 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2267
2423
|
return this._locale;
|
|
2268
2424
|
}
|
|
2269
2425
|
setLocale(e) {
|
|
2270
|
-
if (this._closed) throw new Error(
|
|
2426
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2271
2427
|
if (e) try {
|
|
2272
2428
|
new Intl.Locale(e);
|
|
2273
2429
|
} catch {
|
|
2274
|
-
throw new Error(
|
|
2430
|
+
throw new Error(Ss("error.workbook.invalidLocale", { locale: e }));
|
|
2275
2431
|
}
|
|
2276
2432
|
return this._locale === e || (this._locale = e, this._emitter.notify("onRegionalChange")), this;
|
|
2277
2433
|
}
|
|
@@ -2279,7 +2435,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2279
2435
|
return this._localeOverrides;
|
|
2280
2436
|
}
|
|
2281
2437
|
setLocaleOverrides(e) {
|
|
2282
|
-
if (this._closed) throw new Error(
|
|
2438
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2283
2439
|
const t = e && Object.keys(e).length > 0 ? e : null;
|
|
2284
2440
|
return this._localeOverrides = t, this._emitter.notify("onRegionalChange"), this;
|
|
2285
2441
|
}
|
|
@@ -2289,14 +2445,20 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2289
2445
|
getResources() {
|
|
2290
2446
|
return this._resources;
|
|
2291
2447
|
}
|
|
2448
|
+
getFetcher() {
|
|
2449
|
+
return this._fetch.getFetcher();
|
|
2450
|
+
}
|
|
2451
|
+
fetch(e, t) {
|
|
2452
|
+
return this._fetch.fetch(e, t);
|
|
2453
|
+
}
|
|
2292
2454
|
getTransactions() {
|
|
2293
2455
|
return this._transactions;
|
|
2294
2456
|
}
|
|
2295
2457
|
getChanges(e) {
|
|
2296
|
-
const t = this._transactions, [s, r] = t.getLog(e ?? t.getCurrentCommit(!1).getId(), 2), i = [], o = this.getWorksheets().getItems({ visibility:
|
|
2458
|
+
const t = this._transactions, [s, r] = t.getLog(e ?? t.getCurrentCommit(!1).getId(), 2), i = [], o = this.getWorksheets().getItems({ visibility: mt.Visibility.VeryHidden });
|
|
2297
2459
|
for (let e = 0; e < o.length; e++) {
|
|
2298
2460
|
const t = o[e];
|
|
2299
|
-
t instanceof
|
|
2461
|
+
t instanceof le && i.push(...t._changeEventsOf(s, r ?? null));
|
|
2300
2462
|
}
|
|
2301
2463
|
return i;
|
|
2302
2464
|
}
|
|
@@ -2310,7 +2472,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2310
2472
|
return this._updateLinks;
|
|
2311
2473
|
}
|
|
2312
2474
|
setUpdateLinks(e) {
|
|
2313
|
-
if (this._closed) throw new Error(
|
|
2475
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2314
2476
|
return this._updateLinks = e, this;
|
|
2315
2477
|
}
|
|
2316
2478
|
getPivotTables() {
|
|
@@ -2326,8 +2488,8 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2326
2488
|
return this._theme;
|
|
2327
2489
|
}
|
|
2328
2490
|
setTheme(e) {
|
|
2329
|
-
if (this._closed) throw new Error(
|
|
2330
|
-
if (!e) throw new
|
|
2491
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2492
|
+
if (!e) throw new cs(Ss("error.workbook.notSetValue"));
|
|
2331
2493
|
const t = this._theme;
|
|
2332
2494
|
return this._theme = e, this.getStyles().setTheme(e), this._emitter.notify("onThemeChange"), t;
|
|
2333
2495
|
}
|
|
@@ -2340,7 +2502,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2340
2502
|
}
|
|
2341
2503
|
getSelectedWorksheet() {
|
|
2342
2504
|
const e = this._getSheetRef(this.getSelectedSheetIndex());
|
|
2343
|
-
return e &&
|
|
2505
|
+
return e && Kr(e) ? e.sheet : null;
|
|
2344
2506
|
}
|
|
2345
2507
|
getActiveSheet() {
|
|
2346
2508
|
return this.getSelectedWorksheet();
|
|
@@ -2349,30 +2511,30 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2349
2511
|
return this.getSelectedWorksheet();
|
|
2350
2512
|
}
|
|
2351
2513
|
getSheets(e) {
|
|
2352
|
-
const t = this._getSheetRefs(e?.visibility ??
|
|
2514
|
+
const t = this._getSheetRefs(e?.visibility ?? mt.Visibility.Visible), s = new Array(t.length);
|
|
2353
2515
|
for (let e = 0; e < t.length; e++) s[e] = t[e].sheet;
|
|
2354
2516
|
return s;
|
|
2355
2517
|
}
|
|
2356
2518
|
getSheet(e) {
|
|
2357
2519
|
if (void 0 === e) return this.getSelectedSheet();
|
|
2358
|
-
if (!e) throw new Error(
|
|
2520
|
+
if (!e) throw new Error(Ss("error.workbook.sheetNameNotProvided"));
|
|
2359
2521
|
const t = this._getSheetRef(e);
|
|
2360
|
-
if (!t) throw new
|
|
2522
|
+
if (!t) throw new fs(Ar(e));
|
|
2361
2523
|
return t.sheet;
|
|
2362
2524
|
}
|
|
2363
|
-
getWorksheet(e, t =
|
|
2525
|
+
getWorksheet(e, t = mt.Visibility.Visible) {
|
|
2364
2526
|
if ("number" == typeof e) return this.getWorksheetAt(e, t);
|
|
2365
2527
|
if (void 0 === e) return this._requireSelectedWorksheet();
|
|
2366
|
-
if (!e) throw new Error(
|
|
2528
|
+
if (!e) throw new Error(Ss("error.workbook.sheetNameNotProvided"));
|
|
2367
2529
|
const s = this._getSheetRef(e, t);
|
|
2368
|
-
if (!s) throw new
|
|
2369
|
-
if (!
|
|
2530
|
+
if (!s) throw new fs(Ar(e));
|
|
2531
|
+
if (!Kr(s)) throw new fs(Vr(s.name, s.sheet.getKind()));
|
|
2370
2532
|
return s.sheet;
|
|
2371
2533
|
}
|
|
2372
|
-
getWorksheetAt(e, t =
|
|
2534
|
+
getWorksheetAt(e, t = mt.Visibility.Visible) {
|
|
2373
2535
|
const s = this._getWorksheets(t)[e];
|
|
2374
|
-
if (!s) throw new
|
|
2375
|
-
return
|
|
2536
|
+
if (!s) throw new fs(function(e) {
|
|
2537
|
+
return Ss("error.workbook.sheetIndexNotFound", { index: e });
|
|
2376
2538
|
}(e));
|
|
2377
2539
|
return s;
|
|
2378
2540
|
}
|
|
@@ -2380,10 +2542,10 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2380
2542
|
const e = this.getSelectedWorksheet();
|
|
2381
2543
|
if (e) return e;
|
|
2382
2544
|
const t = this.getSelectedSheet();
|
|
2383
|
-
throw new
|
|
2545
|
+
throw new cs(Tr(t?.getName() ?? "", t?.getKind() ?? mt.Kind.Worksheet));
|
|
2384
2546
|
}
|
|
2385
2547
|
_anchorWorksheet() {
|
|
2386
|
-
return this.getSelectedWorksheet() || (this._getWorksheets(
|
|
2548
|
+
return this.getSelectedWorksheet() || (this._getWorksheets(mt.Visibility.VeryHidden)[0] ?? null);
|
|
2387
2549
|
}
|
|
2388
2550
|
getWorksheets() {
|
|
2389
2551
|
return this._sheets;
|
|
@@ -2391,35 +2553,35 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2391
2553
|
addWorksheet(e) {
|
|
2392
2554
|
return this.getWorksheets().add(e);
|
|
2393
2555
|
}
|
|
2394
|
-
_getWorksheets(e =
|
|
2556
|
+
_getWorksheets(e = mt.Visibility.Visible) {
|
|
2395
2557
|
const t = this._getSheetRefs(e), s = [], r = t.length;
|
|
2396
2558
|
for (let e = 0; e < r; e++) {
|
|
2397
2559
|
const r = t[e];
|
|
2398
|
-
|
|
2560
|
+
Kr(r) && s.push(r.sheet);
|
|
2399
2561
|
}
|
|
2400
2562
|
return s;
|
|
2401
2563
|
}
|
|
2402
|
-
_getSheetRefs(e =
|
|
2564
|
+
_getSheetRefs(e = mt.Visibility.Visible) {
|
|
2403
2565
|
const t = this._getState();
|
|
2404
|
-
return t ? e ===
|
|
2566
|
+
return t ? e === mt.Visibility.Visible ? t.sheetRefsVisible : e === mt.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === mt.Visibility.VeryHidden ? t.sheetRefsAll : as.EmptyArray : [];
|
|
2405
2567
|
}
|
|
2406
|
-
_getSheetRef(e, t =
|
|
2568
|
+
_getSheetRef(e, t = mt.Visibility.Visible) {
|
|
2407
2569
|
let s = null;
|
|
2408
2570
|
return "number" == typeof e ? this._getSheetRefs(t)[e] : ("string" == typeof e ? s = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : !0 === e?.isISheet ? s = this._getState().refsByInstance.get(e) : void 0 !== e?.id && (s = this._getState().refsById.get(e.id)), s);
|
|
2409
2571
|
}
|
|
2410
2572
|
_validateNewSheetName(e, t = !0) {
|
|
2411
2573
|
if (null == e) return e;
|
|
2412
|
-
if (
|
|
2574
|
+
if (Mr(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new cs(Ss("error.workbook.nameTaken"));
|
|
2413
2575
|
return e.substring(0, 31);
|
|
2414
2576
|
}
|
|
2415
2577
|
findValidSheetName(e) {
|
|
2416
|
-
e && (e =
|
|
2578
|
+
e && (e = Mr(e, !0));
|
|
2417
2579
|
try {
|
|
2418
2580
|
return function(e, t) {
|
|
2419
2581
|
try {
|
|
2420
2582
|
if (t(e)) return e;
|
|
2421
2583
|
} catch (e) {}
|
|
2422
|
-
let s, r, i =
|
|
2584
|
+
let s, r, i = Wr.exec(e);
|
|
2423
2585
|
for (null !== i ? (s = e.substring(0, i.index), r = parseFloat(i[1])) : (s = e + " ", r = 1); r < 256;) {
|
|
2424
2586
|
r++;
|
|
2425
2587
|
const e = "(" + r + ")", i = s.substring(0, 31 - e.length) + e;
|
|
@@ -2434,25 +2596,25 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2434
2596
|
}
|
|
2435
2597
|
}
|
|
2436
2598
|
isValidSheetNameCharacter(e) {
|
|
2437
|
-
return !
|
|
2599
|
+
return !Fr.test(e);
|
|
2438
2600
|
}
|
|
2439
2601
|
_isStructureProtected() {
|
|
2440
2602
|
return !this._initializing && !this.getProtection().isStructureAllowed();
|
|
2441
2603
|
}
|
|
2442
2604
|
_addSheetOptions(e) {
|
|
2443
|
-
if (this._closed) throw new Error(
|
|
2444
|
-
if (!this.getProtection().isStructureAllowed()) throw new
|
|
2605
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2606
|
+
if (!this.getProtection().isStructureAllowed()) throw new ws(Ss("error.workbook.protection"));
|
|
2445
2607
|
let t, s = null;
|
|
2446
2608
|
t = "string" == typeof e ? { name: e } : "number" == typeof e ? { index: e } : e, t = {
|
|
2447
2609
|
...t,
|
|
2448
|
-
description: t?.description ??
|
|
2610
|
+
description: t?.description ?? bs("op.addSheet")
|
|
2449
2611
|
};
|
|
2450
2612
|
const r = this.beginCommit(t);
|
|
2451
2613
|
try {
|
|
2452
2614
|
const e = t?.autoSelect ?? !1;
|
|
2453
2615
|
s = this._addSheet(!0, t.name, t.index ?? null);
|
|
2454
2616
|
const i = this.getView().getActiveSheetId();
|
|
2455
|
-
if (e && this._recordActiveSheet(r, i, this._getSheetRef(s).id), r.commit({ description:
|
|
2617
|
+
if (e && this._recordActiveSheet(r, i, this._getSheetRef(s).id), r.commit({ description: Ss("op.addSheetNamed", { name: s.getName() }) }), !1 !== e) {
|
|
2456
2618
|
const t = "boolean" == typeof e ? void 0 : e;
|
|
2457
2619
|
s.select(t);
|
|
2458
2620
|
}
|
|
@@ -2464,8 +2626,8 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2464
2626
|
_nextSheetName(e = null) {
|
|
2465
2627
|
let t = e ? e.toLowerCase() : null;
|
|
2466
2628
|
const s = this._getState(), r = s.sheetsByLowerCaseName;
|
|
2467
|
-
if (e && r.has(t)) throw new
|
|
2468
|
-
return
|
|
2629
|
+
if (e && r.has(t)) throw new cs(function(e) {
|
|
2630
|
+
return Ss("error.workbook.nameDuplicate", { sheetName: e });
|
|
2469
2631
|
}(e));
|
|
2470
2632
|
t = (e = this._validateNewSheetName(e)) ? e.toLowerCase() : null;
|
|
2471
2633
|
let i = s.lastId + 1;
|
|
@@ -2477,16 +2639,16 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2477
2639
|
}
|
|
2478
2640
|
_addSheet(e, t = null, s = null, r) {
|
|
2479
2641
|
t = this._nextSheetName(t);
|
|
2480
|
-
const i = this._getState(), o = this._createSheet(i.lastId, t,
|
|
2481
|
-
if (!o) throw new
|
|
2642
|
+
const i = this._getState(), o = this._createSheet(i.lastId, t, mt.Visibility.Visible, s, void 0, null, r);
|
|
2643
|
+
if (!o) throw new cs(Ss("error.workbook.sheetNameBlank"));
|
|
2482
2644
|
return e && (this._tellSheets(), this._emitter.notify("onSheetsChange")), o;
|
|
2483
2645
|
}
|
|
2484
2646
|
_createOpaqueSheet(e, t, s, r, i, o, n, a, l) {
|
|
2485
2647
|
const h = this;
|
|
2486
2648
|
let c = null;
|
|
2487
|
-
return c = new
|
|
2649
|
+
return c = new kr({
|
|
2488
2650
|
kind: o,
|
|
2489
|
-
id: l ?? t + "-" +
|
|
2651
|
+
id: l ?? t + "-" + as.uuidV4(),
|
|
2490
2652
|
part: n,
|
|
2491
2653
|
tabColor: a,
|
|
2492
2654
|
styles: this._styles,
|
|
@@ -2497,25 +2659,25 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2497
2659
|
setName: (e, t) => {
|
|
2498
2660
|
h._setSheetName(c, e, t);
|
|
2499
2661
|
},
|
|
2500
|
-
getVisibility: () => h._getSheetRef(c,
|
|
2662
|
+
getVisibility: () => h._getSheetRef(c, mt.Visibility.VeryHidden)?.visibility ?? mt.Visibility.Visible,
|
|
2501
2663
|
setVisibility: (e, t) => {
|
|
2502
2664
|
h._setSheetVisibility(c, e, t);
|
|
2503
2665
|
},
|
|
2504
2666
|
getIndex: () => {
|
|
2505
|
-
const e = h._getSheetRef(c,
|
|
2506
|
-
return e ? h._getOffsetForId(e.id, h._getSheetRefs(
|
|
2667
|
+
const e = h._getSheetRef(c, mt.Visibility.VeryHidden);
|
|
2668
|
+
return e ? h._getOffsetForId(e.id, h._getSheetRefs(mt.Visibility.VeryHidden)) : -1;
|
|
2507
2669
|
},
|
|
2508
2670
|
setIndex: (e, t) => {
|
|
2509
|
-
const s = h._getSheetRef(c,
|
|
2671
|
+
const s = h._getSheetRef(c, mt.Visibility.VeryHidden);
|
|
2510
2672
|
s && h._moveSheet(s, e, t);
|
|
2511
2673
|
},
|
|
2512
2674
|
requestSelect: () => h._requestSelect(c),
|
|
2513
|
-
isAttached: () => !!h._getSheetRef(c,
|
|
2675
|
+
isAttached: () => !!h._getSheetRef(c, mt.Visibility.VeryHidden)
|
|
2514
2676
|
}
|
|
2515
2677
|
}), this._sheetOnNameChange.set(e, () => c._notify("onNameChange")), this._sheetOnVisibilityChange.set(e, () => c._notify("onVisibilityChange")), this._sheetOnIndexChange.set(e, () => c._notify("onIndexChange")), this._addSheetRef({
|
|
2516
2678
|
name: t,
|
|
2517
2679
|
id: e,
|
|
2518
|
-
visibility: s ??
|
|
2680
|
+
visibility: s ?? mt.Visibility.Visible,
|
|
2519
2681
|
sheetId: i,
|
|
2520
2682
|
sheet: c
|
|
2521
2683
|
}, r), c;
|
|
@@ -2528,10 +2690,10 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2528
2690
|
}), this.getSelectedSheet() === e;
|
|
2529
2691
|
}
|
|
2530
2692
|
_updateSheetRefStates(e) {
|
|
2531
|
-
if (this._closed) throw new Error(
|
|
2532
|
-
if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new
|
|
2693
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2694
|
+
if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new ws(Ss("error.workbook.protection"));
|
|
2533
2695
|
const t = e, s = [], r = [], i = t.length;
|
|
2534
|
-
for (let e = 0; e < i; e++) t[e].visibility ===
|
|
2696
|
+
for (let e = 0; e < i; e++) t[e].visibility === mt.Visibility.Visible ? (s.push(t[e]), r.push(t[e])) : t[e].visibility === mt.Visibility.Hidden && r.push(t[e]);
|
|
2535
2697
|
this._updateState({
|
|
2536
2698
|
sheetRefsAll: t,
|
|
2537
2699
|
sheetRefsVisible: s,
|
|
@@ -2541,7 +2703,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2541
2703
|
_tellSheets() {
|
|
2542
2704
|
if (this._isLoadingSheets) return;
|
|
2543
2705
|
const e = this._getState().sheetRefsAll;
|
|
2544
|
-
this._calculation._setSheets(e.map((e) =>
|
|
2706
|
+
this._calculation._setSheets(e.map((e) => Kr(e) ? [e.sheet.getId(), e.name] : [
|
|
2545
2707
|
e.sheet.getId(),
|
|
2546
2708
|
e.name,
|
|
2547
2709
|
!0
|
|
@@ -2573,9 +2735,9 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2573
2735
|
g._validateDeleteSheet(e);
|
|
2574
2736
|
},
|
|
2575
2737
|
onDelete(e) {
|
|
2576
|
-
let t = g._getSheetRef(e,
|
|
2738
|
+
let t = g._getSheetRef(e, mt.Visibility.VeryHidden);
|
|
2577
2739
|
if (!t) return;
|
|
2578
|
-
const s = g._beginCommit({ description:
|
|
2740
|
+
const s = g._beginCommit({ description: Ss("op.deleteSheet", { name: t.name }) });
|
|
2579
2741
|
try {
|
|
2580
2742
|
const r = g._getState(), i = r.sheetRefsAll, o = g._getOffsetForId(t.id, i);
|
|
2581
2743
|
let a = [...i];
|
|
@@ -2606,7 +2768,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2606
2768
|
throw s.rollback(), e;
|
|
2607
2769
|
}
|
|
2608
2770
|
}
|
|
2609
|
-
}, { transactional: !0 }), r =
|
|
2771
|
+
}, { transactional: !0 }), r = Kr(e) ? e.sheet.addListeners({ onSelectionChange: (e) => {
|
|
2610
2772
|
g.getView().getActiveSheetId() === g._getSheetRef(e)?.id && g._emitter.notify("onSelectionChange", {
|
|
2611
2773
|
source: g,
|
|
2612
2774
|
params: e
|
|
@@ -2630,7 +2792,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2630
2792
|
}
|
|
2631
2793
|
_recordActiveSheet(e, t, s) {
|
|
2632
2794
|
const r = this.getView().getId();
|
|
2633
|
-
e.setIntent(
|
|
2795
|
+
e.setIntent(zr, (e) => ({
|
|
2634
2796
|
viewId: r,
|
|
2635
2797
|
before: e?.before ?? t,
|
|
2636
2798
|
after: s
|
|
@@ -2662,27 +2824,27 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2662
2824
|
let s = this._view.getActiveSheetId();
|
|
2663
2825
|
null == s && (this._view.setActiveSheetId(t), s = t);
|
|
2664
2826
|
let r = e.refsById.get(s);
|
|
2665
|
-
r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), s = t), r.visibility ===
|
|
2827
|
+
r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), s = t), r.visibility === mt.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(s, e.sheetRefsVisible));
|
|
2666
2828
|
}
|
|
2667
2829
|
_validateDeleteSheet(e) {
|
|
2668
|
-
if (this._closed) throw new Error(
|
|
2669
|
-
if (!this.getProtection().isStructureAllowed()) throw new
|
|
2830
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2831
|
+
if (!this.getProtection().isStructureAllowed()) throw new ws(Ss("error.workbook.protection"));
|
|
2670
2832
|
let t = this._getSheetRef(e);
|
|
2671
|
-
if (!t) throw new
|
|
2672
|
-
return
|
|
2833
|
+
if (!t) throw new cs(function(e) {
|
|
2834
|
+
return Ss("error.workbook.deleteKey", { key: e });
|
|
2673
2835
|
}(e));
|
|
2674
2836
|
const s = this._getState().sheetRefsVisible;
|
|
2675
|
-
if (1 === s.length && s[0].id === t.id) throw new
|
|
2837
|
+
if (1 === s.length && s[0].id === t.id) throw new cs(Ss("error.workbook.sheetOne"));
|
|
2676
2838
|
}
|
|
2677
2839
|
_getOffsetForId(e, t) {
|
|
2678
2840
|
const s = t.length;
|
|
2679
2841
|
for (let r = 0; r < s; r++) if (t[r].id === e) return r;
|
|
2680
|
-
throw new
|
|
2842
|
+
throw new cs(Ss("error.workbook.noVisibleRefs"));
|
|
2681
2843
|
}
|
|
2682
2844
|
find(e) {
|
|
2683
|
-
if (this._closed) throw new Error(
|
|
2845
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2684
2846
|
const t = this._getWorksheets();
|
|
2685
|
-
if (0 === t.length) return { next: () =>
|
|
2847
|
+
if (0 === t.length) return { next: () => at };
|
|
2686
2848
|
if (1 === t.length) return t[0].find(e);
|
|
2687
2849
|
"string" == typeof e && (e = { text: e });
|
|
2688
2850
|
const s = !e?.reverse;
|
|
@@ -2701,7 +2863,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2701
2863
|
rowIndex: t[0].rowStart
|
|
2702
2864
|
};
|
|
2703
2865
|
}
|
|
2704
|
-
const d =
|
|
2866
|
+
const d = ls.createCellComparator(e?.axis, e?.reverse);
|
|
2705
2867
|
delete (e = { ...e }).from;
|
|
2706
2868
|
const g = () => {
|
|
2707
2869
|
if (!u && c.done && (a && o === i ? u = !0 : s ? (o++, o > t.length - 1 && (o = 0, a = !0)) : (o--, o < 0 && (o = t.length - 1, a = !0)), r && a && (u = !0), u || l || !a || o !== i || (u = !0), !u)) {
|
|
@@ -2711,7 +2873,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2711
2873
|
}
|
|
2712
2874
|
if (!u && a && o === i && (c.done || !l || !c.done && d(c.value.getCoords(), l) >= 0) && (u = !0), u) {
|
|
2713
2875
|
const e = c;
|
|
2714
|
-
return c =
|
|
2876
|
+
return c = at, e;
|
|
2715
2877
|
}
|
|
2716
2878
|
const g = c;
|
|
2717
2879
|
return c = h.next(), g;
|
|
@@ -2726,8 +2888,8 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2726
2888
|
let r = 0, i = null;
|
|
2727
2889
|
const o = "function" == typeof t, n = s?.maxCount ?? Number.MAX_SAFE_INTEGER, a = !s?.maxCount;
|
|
2728
2890
|
let l = "";
|
|
2729
|
-
const h = "string" == typeof t ?
|
|
2730
|
-
let c = s?.description ??
|
|
2891
|
+
const h = "string" == typeof t ? Be(t) : null;
|
|
2892
|
+
let c = s?.description ?? bs("op.replace");
|
|
2731
2893
|
const u = this._transactions.beginCommit({ description: c });
|
|
2732
2894
|
try {
|
|
2733
2895
|
let c = null, d = null, g = e.next();
|
|
@@ -2740,10 +2902,10 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2740
2902
|
const l = o ? t(n) : t;
|
|
2741
2903
|
void 0 !== l && l !== n && (d.push(n, l), r++, i = n), g = e.next();
|
|
2742
2904
|
}
|
|
2743
|
-
d?.apply(), 1 === r && 1 === n && i && (l = i.getAddress()), 0 === r ? u.rollback() : u.commit({ description: s?.description ?? (a ? null !== h ?
|
|
2905
|
+
d?.apply(), 1 === r && 1 === n && i && (l = i.getAddress()), 0 === r ? u.rollback() : u.commit({ description: s?.description ?? (a ? null !== h ? Ss("op.replaceAllWith", { value: h }) : bs("op.replaceAll") : l ? null !== h ? Ss("op.replaceAtWith", {
|
|
2744
2906
|
address: l,
|
|
2745
2907
|
value: h
|
|
2746
|
-
}) :
|
|
2908
|
+
}) : Ss("op.replaceAt", { address: l }) : null !== h ? Ss("op.replaceWith", { value: h }) : bs("op.replace")) });
|
|
2747
2909
|
} catch (e) {
|
|
2748
2910
|
throw u.rollback(), e;
|
|
2749
2911
|
}
|
|
@@ -2764,117 +2926,118 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2764
2926
|
const s = this._getSheetRefs(), r = s.length;
|
|
2765
2927
|
for (let i = 0; i < r; i++) {
|
|
2766
2928
|
const o = s[(e + i) % r];
|
|
2767
|
-
if (!
|
|
2929
|
+
if (!Kr(o)) continue;
|
|
2768
2930
|
const n = t.indexOf(o.sheet);
|
|
2769
2931
|
if (-1 !== n) return n;
|
|
2770
2932
|
}
|
|
2771
2933
|
return 0;
|
|
2772
2934
|
}
|
|
2773
2935
|
getNextSheet(e) {
|
|
2774
|
-
if (this._closed) throw new Error(
|
|
2936
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2775
2937
|
const t = this._getSheetRefs();
|
|
2776
2938
|
return t[this._nextSheetIndex(e, t)]?.sheet ?? null;
|
|
2777
2939
|
}
|
|
2778
2940
|
getPreviousSheet(e) {
|
|
2779
|
-
if (this._closed) throw new Error(
|
|
2941
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2780
2942
|
const t = this._getSheetRefs();
|
|
2781
2943
|
return t[this._prevSheetIndex(e, t)]?.sheet ?? null;
|
|
2782
2944
|
}
|
|
2783
2945
|
async _duplicateSheet(e) {
|
|
2784
|
-
if (this._closed) throw new Error(
|
|
2785
|
-
if (!this.getProtection().isStructureAllowed()) throw new
|
|
2946
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
2947
|
+
if (!this.getProtection().isStructureAllowed()) throw new ws(Ss("error.workbook.protection"));
|
|
2786
2948
|
const t = this._getSheetRefs(), s = this.getSelectedSheetIndex();
|
|
2787
2949
|
let r = null;
|
|
2788
2950
|
if (e) {
|
|
2789
|
-
if (r = this._getSheetRef(e), !r) throw new
|
|
2951
|
+
if (r = this._getSheetRef(e), !r) throw new cs(Lr(r));
|
|
2790
2952
|
} else r = t[s];
|
|
2791
2953
|
if (!r) return null;
|
|
2792
|
-
if (!
|
|
2954
|
+
if (!Kr(r)) throw new cs((i = r.name, Ss("error.workbook.sheetNotDuplicable", { sheetName: i })));
|
|
2793
2955
|
var i;
|
|
2794
|
-
const o = r.sheet, n = this._strings.beginPersist(), a = this.getResources().beginPersist(), l = this.getStyles().beginPersist();
|
|
2795
|
-
let
|
|
2796
|
-
const
|
|
2956
|
+
const o = r.sheet, n = this._strings.beginPersist(), a = this.getResources().beginPersist(), l = this.getStyles().beginPersist(), h = this._richValues.beginPersist();
|
|
2957
|
+
let c = null;
|
|
2958
|
+
const u = this.beginCommit(Ss("op.duplicateNamed", { name: o.getName() }));
|
|
2797
2959
|
try {
|
|
2798
2960
|
const e = this._getState().refsByInstance.get(o), r = await o.toJSON(), i = t.length + 1, n = this.findValidSheetName(e.name), a = this._createSheet(i, n, e.visibility, s, void 0, r);
|
|
2799
|
-
this._tellSheets(), this._emitter.notify("onSheetsChange"),
|
|
2961
|
+
this._tellSheets(), this._emitter.notify("onSheetsChange"), c = a, u.commit();
|
|
2800
2962
|
} catch (e) {
|
|
2801
|
-
throw
|
|
2963
|
+
throw u.rollback(), e;
|
|
2802
2964
|
} finally {
|
|
2803
|
-
l.endPersist(), a.endPersist(), n.endPersist();
|
|
2965
|
+
h.endPersist(), l.endPersist(), a.endPersist(), n.endPersist();
|
|
2804
2966
|
}
|
|
2805
|
-
return
|
|
2967
|
+
return c;
|
|
2806
2968
|
}
|
|
2807
2969
|
_createRange(e, t) {
|
|
2808
|
-
const s = e ? { ...e } : null, r = s ? this._getSheetRef(s.scope,
|
|
2809
|
-
if (r && !
|
|
2970
|
+
const s = e ? { ...e } : null, r = s ? this._getSheetRef(s.scope, mt.Visibility.VeryHidden) : null;
|
|
2971
|
+
if (r && !Kr(r)) throw new cs(Vr(r.name, r.sheet.getKind()));
|
|
2810
2972
|
if (!r) {
|
|
2811
2973
|
const e = this._anchorWorksheet();
|
|
2812
|
-
return e ? (delete s?.scope,
|
|
2813
|
-
scope:
|
|
2974
|
+
return e ? (delete s?.scope, jr(s, s ? {
|
|
2975
|
+
scope: ye,
|
|
2814
2976
|
...e.getEntireRange().getCoords()
|
|
2815
|
-
} : null)) : void console.warn(
|
|
2977
|
+
} : null)) : void console.warn(Ss("error.workbook.noVisibleRefs"));
|
|
2816
2978
|
}
|
|
2817
2979
|
const i = r.sheet;
|
|
2818
2980
|
let o = null;
|
|
2819
|
-
return t && (o = { getOptions: t }), new
|
|
2981
|
+
return t && (o = { getOptions: t }), new Ur(e, Ie(i), this, o);
|
|
2820
2982
|
}
|
|
2821
2983
|
_createRanges(e, t) {
|
|
2822
2984
|
const s = this._anchorWorksheet();
|
|
2823
|
-
if (!s) throw new
|
|
2985
|
+
if (!s) throw new cs(Tr("", mt.Kind.Worksheet));
|
|
2824
2986
|
let r = null;
|
|
2825
|
-
return t && (r = { getOptions: t }), new
|
|
2987
|
+
return t && (r = { getOptions: t }), new Hr(e, Ie(s), this, r);
|
|
2826
2988
|
}
|
|
2827
2989
|
getRange(e, t) {
|
|
2828
2990
|
if (void 0 === e) return this.getSelectedRange(t);
|
|
2991
|
+
"number" == typeof e && (e = ve(arguments), t = void 0);
|
|
2829
2992
|
try {
|
|
2830
2993
|
const s = this._rangesAddressToCoords(e);
|
|
2831
|
-
if (1 !== s.length) throw new
|
|
2994
|
+
if (1 !== s.length) throw new cs(Ss("error.address.singleRangeOnlyAlt"));
|
|
2832
2995
|
return this._createRange(s[0], t);
|
|
2833
2996
|
} catch (t) {
|
|
2834
|
-
if (t instanceof
|
|
2835
|
-
throw new
|
|
2997
|
+
if (t instanceof fs) throw new fs(t.message);
|
|
2998
|
+
throw new cs(t.message ?? M(e));
|
|
2836
2999
|
}
|
|
2837
3000
|
}
|
|
2838
3001
|
getCell(e) {
|
|
2839
3002
|
if (void 0 === e) return this.getSelectedCell();
|
|
2840
3003
|
const t = this.getRange(e);
|
|
2841
|
-
if (t.size > 1) throw new
|
|
3004
|
+
if (t.size > 1) throw new cs(Ss("error.address.singleCellOnly"));
|
|
2842
3005
|
return t.getCell();
|
|
2843
3006
|
}
|
|
2844
3007
|
getRanges(e, t) {
|
|
2845
3008
|
const s = this._rangesAddressToCoords(e);
|
|
2846
|
-
if (0 === s.length) throw new
|
|
3009
|
+
if (0 === s.length) throw new cs(M(e));
|
|
2847
3010
|
return this._createRanges(s, t);
|
|
2848
3011
|
}
|
|
2849
3012
|
_createGraphRanges(e, t) {
|
|
2850
3013
|
const s = [], r = this.getCalculation()?.getNamedFormulas() ?? null;
|
|
2851
3014
|
for (let e = 0; e < t.length; e++) {
|
|
2852
|
-
const i = t[e], o = i.sheetName ? this._getSheetRef(i.sheetName,
|
|
2853
|
-
n && s.push(new
|
|
3015
|
+
const i = t[e], o = i.sheetName ? this._getSheetRef(i.sheetName, mt.Visibility.VeryHidden) : null, n = o && Kr(o) ? o.sheet : this._anchorWorksheet();
|
|
3016
|
+
n && s.push(new ee(i, r, Ie(n), null));
|
|
2854
3017
|
}
|
|
2855
3018
|
for (let t = 0; t < e.length; t++) s.push(e[t]);
|
|
2856
3019
|
const i = this._anchorWorksheet();
|
|
2857
|
-
return 0 !== s.length && i ? new
|
|
3020
|
+
return 0 !== s.length && i ? new Hr(s, Ie(i), this, null) : null;
|
|
2858
3021
|
}
|
|
2859
3022
|
getAnomalies(e) {
|
|
2860
|
-
if (this._closed) throw new Error(
|
|
2861
|
-
const t =
|
|
2862
|
-
const t =
|
|
3023
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
3024
|
+
const t = D(e), s = this._getWorksheets(mt.Visibility.VeryHidden).map((e) => {
|
|
3025
|
+
const t = Ie(e);
|
|
2863
3026
|
return {
|
|
2864
3027
|
bounds: t.getSheet().getEntireCoords(),
|
|
2865
3028
|
internal: t,
|
|
2866
3029
|
qualified: !0
|
|
2867
3030
|
};
|
|
2868
3031
|
});
|
|
2869
|
-
return new
|
|
3032
|
+
return new T(s, () => (this.getSelectedWorksheet() ?? this._getWorksheets(mt.Visibility.VeryHidden)[0]).getEntireRange(), t);
|
|
2870
3033
|
}
|
|
2871
3034
|
getStats(e) {
|
|
2872
|
-
if (this._closed) throw new Error(
|
|
2873
|
-
const t = this._getWorksheets(
|
|
3035
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
3036
|
+
const t = this._getWorksheets(mt.Visibility.VeryHidden), s = t.length;
|
|
2874
3037
|
if (1 === s) return t[0].getStats(e);
|
|
2875
3038
|
const r = new Array(s);
|
|
2876
3039
|
for (let i = 0; i < s; i++) r[i] = t[i].getStats(e);
|
|
2877
|
-
return new
|
|
3040
|
+
return new rr(r);
|
|
2878
3041
|
}
|
|
2879
3042
|
_activeRangeCoords() {
|
|
2880
3043
|
const e = this._requireSelectedWorksheet(), t = e.getSelection().getRanges().getCoords(), s = e.getName(), r = t.length, i = new Array(r);
|
|
@@ -2899,40 +3062,40 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2899
3062
|
getSelectedCell() {
|
|
2900
3063
|
return this._requireSelectedWorksheet().getSelectedCell();
|
|
2901
3064
|
}
|
|
2902
|
-
_rangesAddressToCoords(e, t = !0, s =
|
|
2903
|
-
if (!e) throw new
|
|
2904
|
-
const r = this.getSelectedWorksheet(), i = { ...(r ?? this._anchorWorksheet())?.getEntireRange().getCoords() },
|
|
2905
|
-
if (
|
|
3065
|
+
_rangesAddressToCoords(e, t = !0, s = mt.Visibility.Hidden) {
|
|
3066
|
+
if (!e) throw new cs(Ss("error.address.noAddress"));
|
|
3067
|
+
const r = this.getSelectedWorksheet(), i = { ...(r ?? this._anchorWorksheet())?.getEntireRange().getCoords() }, o = r?.getName();
|
|
3068
|
+
if (o && (i.scope = o), "string" == typeof e) {
|
|
2906
3069
|
const t = e.trim().toLowerCase();
|
|
2907
3070
|
if ("r" === t || "c" === t) {
|
|
2908
3071
|
const s = this.getSelectedCell().getCoords(), r = {};
|
|
2909
3072
|
"r" === t ? r.rowStart = r.rowEnd = s.rowIndex : r.colStart = r.colEnd = s.colIndex, e = r;
|
|
2910
3073
|
}
|
|
2911
3074
|
}
|
|
2912
|
-
const
|
|
3075
|
+
const n = this, a = Re(e, i, et, (e) => {
|
|
2913
3076
|
if (!t) return null;
|
|
2914
3077
|
if ("string" == typeof e) {
|
|
2915
|
-
const t =
|
|
2916
|
-
getTable: (e) =>
|
|
3078
|
+
const t = z(e, {
|
|
3079
|
+
getTable: (e) => Me(n.getNames().getByName(e)),
|
|
2917
3080
|
getAnchor: () => r ? {
|
|
2918
3081
|
sheet: r,
|
|
2919
3082
|
coords: r.getSelectedCell().getCoords()
|
|
2920
3083
|
} : null
|
|
2921
3084
|
});
|
|
2922
3085
|
if (t) return [t];
|
|
2923
|
-
const s =
|
|
3086
|
+
const s = n.getNames().getByName(e)?.getRanges?.();
|
|
2924
3087
|
if (s) return s.getCoords();
|
|
2925
3088
|
}
|
|
2926
|
-
throw new
|
|
2927
|
-
}),
|
|
2928
|
-
for (let e = 0; e <
|
|
2929
|
-
return
|
|
3089
|
+
throw new cs(`Invalid sheet reference '${e}'.`);
|
|
3090
|
+
}), l = a.length;
|
|
3091
|
+
for (let e = 0; e < l; e++) this._validateCoords(a[e], s);
|
|
3092
|
+
return a;
|
|
2930
3093
|
}
|
|
2931
|
-
_validateCoords(e, t =
|
|
3094
|
+
_validateCoords(e, t = mt.Visibility.Visible, s = Ss("error.sheet.oobRange")) {
|
|
2932
3095
|
if (null === e) return;
|
|
2933
3096
|
const r = this.getWorksheet(e.scope ?? void 0, t).getEntireRange().getCoords();
|
|
2934
|
-
if (!
|
|
2935
|
-
if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new
|
|
3097
|
+
if (!ls.isRangeWithinRange(e, r)) throw new fs(s);
|
|
3098
|
+
if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new cs(Ss("error.address.invalidRangeInverted"));
|
|
2936
3099
|
}
|
|
2937
3100
|
_updateSheetRef(e, t) {
|
|
2938
3101
|
const s = this._getState();
|
|
@@ -2954,18 +3117,18 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2954
3117
|
}), this._tellSheets(), t;
|
|
2955
3118
|
}
|
|
2956
3119
|
_setSheetName(e, t, s) {
|
|
2957
|
-
if (this._closed) throw new Error(
|
|
2958
|
-
if (!this.getProtection().isStructureAllowed()) throw new
|
|
3120
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
3121
|
+
if (!this.getProtection().isStructureAllowed()) throw new ws(Ss("error.workbook.protection"));
|
|
2959
3122
|
const r = this._getSheetRef(e);
|
|
2960
|
-
if (!r) throw new
|
|
3123
|
+
if (!r) throw new cs(Lr(e));
|
|
2961
3124
|
if (t === r.name) return r.sheet;
|
|
2962
|
-
if (null == (t = this._validateNewSheetName(t))) throw new
|
|
3125
|
+
if (null == (t = this._validateNewSheetName(t))) throw new cs(Ss("error.workbook.sheetNameNotProvided"));
|
|
2963
3126
|
const i = Object.freeze({
|
|
2964
3127
|
...r,
|
|
2965
3128
|
name: t
|
|
2966
3129
|
});
|
|
2967
3130
|
let o = null;
|
|
2968
|
-
const n = this.beginCommit(
|
|
3131
|
+
const n = this.beginCommit(bs("op.renameSheet"));
|
|
2969
3132
|
try {
|
|
2970
3133
|
const e = this._updateSheetRef(r, i);
|
|
2971
3134
|
this._adjustSheetNamesIfRequired(), this._sheetOnNameChange.forEach((e, t) => {
|
|
@@ -2976,24 +3139,24 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
2976
3139
|
}
|
|
2977
3140
|
return o;
|
|
2978
3141
|
}
|
|
2979
|
-
_setSheetVisibility(e, t =
|
|
2980
|
-
if (this._closed) throw new Error(
|
|
2981
|
-
if (!this.getProtection().isStructureAllowed()) throw new
|
|
2982
|
-
const r = this._getSheetRef(e,
|
|
3142
|
+
_setSheetVisibility(e, t = mt.Visibility.Visible, s) {
|
|
3143
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
3144
|
+
if (!this.getProtection().isStructureAllowed()) throw new ws(Ss("error.workbook.protection"));
|
|
3145
|
+
const r = this._getSheetRef(e, mt.Visibility.VeryHidden);
|
|
2983
3146
|
if (!r) return null;
|
|
2984
3147
|
if (t === r.visibility) return;
|
|
2985
3148
|
let i = null, o = "";
|
|
2986
|
-
t ===
|
|
3149
|
+
t === mt.Visibility.Visible ? o = bs("op.unhideSheet") : t === mt.Visibility.Hidden ? o = bs("op.hideSheet") : t === mt.Visibility.VeryHidden && (o = bs("op.veryHideSheet"));
|
|
2987
3150
|
const n = this.beginCommit(o);
|
|
2988
3151
|
try {
|
|
2989
3152
|
const e = this._getState().sheetRefsVisible;
|
|
2990
|
-
if (t !==
|
|
3153
|
+
if (t !== mt.Visibility.Visible && 1 === e.length && e[0].id === r.id) throw new cs(Ss("error.workbook.sheetOne"));
|
|
2991
3154
|
const o = {
|
|
2992
3155
|
...r,
|
|
2993
3156
|
visibility: t
|
|
2994
3157
|
};
|
|
2995
3158
|
let a = -1;
|
|
2996
|
-
t !==
|
|
3159
|
+
t !== mt.Visibility.Visible && (a = this._getOffsetForId(r.id, e)), i = this._updateSheetRef(r, o).sheet, t !== mt.Visibility.Visible && this._adjustRemoveSelectionIfRequired(a, r.id), this._adjustSheetNamesIfRequired(), n.commit(s);
|
|
2997
3160
|
} catch (e) {
|
|
2998
3161
|
throw n.rollback(), e;
|
|
2999
3162
|
}
|
|
@@ -3002,13 +3165,13 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3002
3165
|
}), this._emitter.notify("onSheetsChange"), i;
|
|
3003
3166
|
}
|
|
3004
3167
|
_moveSheet(e, t, s) {
|
|
3005
|
-
if (this._closed) throw new Error(
|
|
3006
|
-
if (!this.getProtection().isStructureAllowed()) throw new
|
|
3168
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
3169
|
+
if (!this.getProtection().isStructureAllowed()) throw new ws(Ss("error.workbook.protection"));
|
|
3007
3170
|
let r = null;
|
|
3008
|
-
const i = this.beginCommit(
|
|
3171
|
+
const i = this.beginCommit(Ss("op.moveSheetNamed", { name: e.name }));
|
|
3009
3172
|
try {
|
|
3010
3173
|
const o = this._getState(), n = o.sheetRefsVisible;
|
|
3011
|
-
if (t < 0 || t > n.length - 1) throw new
|
|
3174
|
+
if (t < 0 || t > n.length - 1) throw new cs(`Invalid to index: ${t}`);
|
|
3012
3175
|
const a = this.getView().getActiveSheetId(), l = o.sheetRefsAll, h = this._getOffsetForId(e.id, l), c = this._getOffsetForId(n[t].id, l);
|
|
3013
3176
|
if (h === c) return;
|
|
3014
3177
|
const u = l[h];
|
|
@@ -3022,11 +3185,11 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3022
3185
|
return r;
|
|
3023
3186
|
}
|
|
3024
3187
|
_setSelectedSheet(e) {
|
|
3025
|
-
if (this._closed) throw new Error(
|
|
3188
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
3026
3189
|
const t = this._getSheetRef(e);
|
|
3027
|
-
if (!t) throw new
|
|
3190
|
+
if (!t) throw new cs(Lr(e));
|
|
3028
3191
|
let s = null;
|
|
3029
|
-
return t.visibility !==
|
|
3192
|
+
return t.visibility !== mt.Visibility.Visible && this._setSheetVisibility(t, mt.Visibility.Visible), this._view.setActiveSheetId(t.id), s = t.sheet, s;
|
|
3030
3193
|
}
|
|
3031
3194
|
getProtection() {
|
|
3032
3195
|
return this._protection;
|
|
@@ -3044,7 +3207,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3044
3207
|
return this._calculation;
|
|
3045
3208
|
}
|
|
3046
3209
|
getFonts() {
|
|
3047
|
-
return
|
|
3210
|
+
return J.getShared();
|
|
3048
3211
|
}
|
|
3049
3212
|
createFormula(e, t, s) {
|
|
3050
3213
|
return this.getCalculation().createFormula(e, t, s);
|
|
@@ -3075,39 +3238,35 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3075
3238
|
return this._emitter.addListeners(e, t);
|
|
3076
3239
|
}
|
|
3077
3240
|
_sheetToWBEvent(e) {
|
|
3078
|
-
const t = this
|
|
3079
|
-
|
|
3080
|
-
const
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
const s = e.getCoords(), r = e.getWorksheet().getName();
|
|
3096
|
-
return t.getRange({
|
|
3097
|
-
...s,
|
|
3098
|
-
scope: r
|
|
3099
|
-
});
|
|
3100
|
-
}
|
|
3101
|
-
};
|
|
3241
|
+
const t = this, s = (e) => {
|
|
3242
|
+
if (e.isInvalid()) return e;
|
|
3243
|
+
const s = e.getWorksheet().getName();
|
|
3244
|
+
if (e.isICellRanges) {
|
|
3245
|
+
const r = e.getCoords().map((e) => e.scope ? e : {
|
|
3246
|
+
...e,
|
|
3247
|
+
scope: s
|
|
3248
|
+
});
|
|
3249
|
+
return t.getRanges(r);
|
|
3250
|
+
}
|
|
3251
|
+
const r = e.getCoords();
|
|
3252
|
+
return t.getRange(r.scope ? r : {
|
|
3253
|
+
...r,
|
|
3254
|
+
scope: s
|
|
3255
|
+
});
|
|
3256
|
+
};
|
|
3257
|
+
return (t) => {
|
|
3102
3258
|
e({
|
|
3103
|
-
getSource:
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3259
|
+
getSource: () => s(t.getSource()),
|
|
3260
|
+
getRanges: () => {
|
|
3261
|
+
const e = t.getRanges();
|
|
3262
|
+
return e ? s(e) : null;
|
|
3263
|
+
},
|
|
3264
|
+
getPreviousAddress: () => t.getPreviousAddress(),
|
|
3265
|
+
getTrigger: () => t.getTrigger(),
|
|
3266
|
+
isUndo: () => t.isUndo(),
|
|
3267
|
+
getCommit: () => t.getCommit(),
|
|
3268
|
+
toString: () => `WorkbookRangeEvent: ('${t.getTrigger()}', ${s(t.getSource()).toString()})`,
|
|
3269
|
+
getTimeStamp: () => t.getTimeStamp()
|
|
3111
3270
|
});
|
|
3112
3271
|
};
|
|
3113
3272
|
}
|
|
@@ -3115,74 +3274,90 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3115
3274
|
const e = this._pivotCaches;
|
|
3116
3275
|
if (0 === e.length) return;
|
|
3117
3276
|
const t = (e) => {
|
|
3118
|
-
const t = this._getSheetRef(e), s = t &&
|
|
3277
|
+
const t = this._getSheetRef(e), s = t && Kr(t) ? t.sheet : null;
|
|
3119
3278
|
return s ? s._contentAddWatch(() => null) : null;
|
|
3120
3279
|
};
|
|
3121
3280
|
for (let s = 0; s < e.length; s++) e[s]._hold(t);
|
|
3122
3281
|
}
|
|
3123
3282
|
_fromJSON(e, t) {
|
|
3124
|
-
if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || 0 === e.sheets.length) throw new
|
|
3125
|
-
e.theme && (this._theme = new
|
|
3126
|
-
const s = this._strings.beginPersist(), r = this._resources.beginPersist(), i = this._styles.beginPersist();
|
|
3283
|
+
if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || 0 === e.sheets.length) throw new cs(Ss("error.workbook.sheetOne"));
|
|
3284
|
+
e.theme && (this._theme = new W(e.theme), this._styles.setTheme(this._theme));
|
|
3285
|
+
const s = this._strings.beginPersist(), r = this._resources.beginPersist(), i = this._styles.beginPersist(), o = this._richValues.beginPersist();
|
|
3127
3286
|
try {
|
|
3128
|
-
s.fromJSON(e.strings), r.fromJSON(e.resources),
|
|
3129
|
-
|
|
3130
|
-
|
|
3287
|
+
s.fromJSON(e.strings), r.fromJSON(e.resources), this._fetch.adopt(this._resources.getItems()), i.fromJSON(e.styles), o.fromJSON(e.richData, {
|
|
3288
|
+
resources: this._resources,
|
|
3289
|
+
strings: this._strings,
|
|
3290
|
+
fromResourceId: (e) => r.fromResourceId(e) ?? null
|
|
3291
|
+
}, e.richTypes), e.date1904 && (this._isDate1904 = !0), this._codeName = e.codeName ?? null, this._updateLinks = e.updateLinks ?? null, this._documentProperties.fromJSON(e.properties), e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view || (e.view = {});
|
|
3292
|
+
const n = [], a = e.pivotCaches;
|
|
3293
|
+
if (a) {
|
|
3131
3294
|
const e = r.fromResourceId.bind(r);
|
|
3132
|
-
for (let t = 0; t <
|
|
3133
|
-
const s =
|
|
3134
|
-
s && "number" == typeof s.cacheId &&
|
|
3295
|
+
for (let t = 0; t < a.length; t++) {
|
|
3296
|
+
const s = a[t];
|
|
3297
|
+
s && "number" == typeof s.cacheId && n.push(new ar(s.cacheId, Ze.fromJSON(s.part, e)));
|
|
3135
3298
|
}
|
|
3136
3299
|
}
|
|
3137
|
-
this._pivotCaches =
|
|
3138
|
-
const
|
|
3139
|
-
let
|
|
3140
|
-
null !==
|
|
3141
|
-
let
|
|
3300
|
+
this._pivotCaches = n, this._people.fromJSON(e.people);
|
|
3301
|
+
const l = e.sheets, h = l.length;
|
|
3302
|
+
let c = e.view.activeSheetId ?? null;
|
|
3303
|
+
null !== c && (c = Math.min(Math.max(0, c), h - 1));
|
|
3304
|
+
let u = null, d = null;
|
|
3142
3305
|
this._isLoadingSheets = !0;
|
|
3143
|
-
for (let e = 0; e <
|
|
3144
|
-
const s =
|
|
3145
|
-
|
|
3306
|
+
for (let e = 0; e < h; e++) {
|
|
3307
|
+
const s = l[e], i = s.visibility || mt.Visibility.Visible, o = e;
|
|
3308
|
+
d = o, i === mt.Visibility.Visible ? null === u && (u = o) : null !== c && c === o && (c = null);
|
|
3146
3309
|
try {
|
|
3147
|
-
const n = s.kind ??
|
|
3148
|
-
if (n !==
|
|
3149
|
-
const a = s.sheet, l =
|
|
3150
|
-
if (!l) throw new
|
|
3310
|
+
const n = s.kind ?? mt.Kind.Worksheet;
|
|
3311
|
+
if (n !== mt.Kind.Worksheet) {
|
|
3312
|
+
const a = s.sheet, l = Ze.fromJSON(a?.part, r.fromResourceId.bind(r));
|
|
3313
|
+
if (!l) throw new cs(Ss("error.workbook.sheetPartMissing", { sheetName: s.name }));
|
|
3151
3314
|
this._createOpaqueSheet(o, s.name, i, e, s.sheetId, n, l, a?.tabColor ?? null, t?.[e]);
|
|
3152
3315
|
} else this._createSheet(o, s.name, i, e, s.sheetId, s.sheet, t?.[e]);
|
|
3153
3316
|
} catch (e) {
|
|
3154
3317
|
throw this._isLoadingSheets = !1, e;
|
|
3155
3318
|
}
|
|
3156
3319
|
}
|
|
3157
|
-
this._isLoadingSheets = !1, this._tellSheets(), this._holdPivotCaches(), this._updateState({ lastId:
|
|
3158
|
-
const
|
|
3159
|
-
this._protection = new
|
|
3160
|
-
|
|
3320
|
+
this._isLoadingSheets = !1, this._tellSheets(), this._holdPivotCaches(), this._updateState({ lastId: d }), e.view.activeSheetId = c ?? u, this.setView(new Ir({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
|
|
3321
|
+
const g = this;
|
|
3322
|
+
this._protection = new Or(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
|
|
3323
|
+
g._emitter.notify("onProtectionChange", { source: e });
|
|
3161
3324
|
} }), this._emitter.notify("onLoad");
|
|
3162
3325
|
} finally {
|
|
3163
|
-
i.endPersist(), r.endPersist(), s.endPersist();
|
|
3326
|
+
o.endPersist(), i.endPersist(), r.endPersist(), s.endPersist();
|
|
3164
3327
|
}
|
|
3165
3328
|
}
|
|
3329
|
+
async _startFunctions() {
|
|
3330
|
+
const e = this._scripts;
|
|
3331
|
+
if (!e) return as.EmptyArray;
|
|
3332
|
+
await e._load();
|
|
3333
|
+
const t = [];
|
|
3334
|
+
for (const s of e.getModules().getItems()) this._startModules.add(s), t.push(...s.getFunctions().getItems({
|
|
3335
|
+
type: "formula",
|
|
3336
|
+
includeHidden: !0
|
|
3337
|
+
}));
|
|
3338
|
+
return t;
|
|
3339
|
+
}
|
|
3166
3340
|
_createScripts(e) {
|
|
3167
3341
|
const t = this;
|
|
3168
|
-
return new
|
|
3342
|
+
return new ur({
|
|
3169
3343
|
transactions: this._transactions,
|
|
3170
3344
|
json: e,
|
|
3171
3345
|
workbook: t,
|
|
3172
3346
|
getBuiltInFunctions: () => t._calculation?.getFunctions(),
|
|
3173
3347
|
onAdd: (e, s) => {
|
|
3174
3348
|
const r = t._calculation;
|
|
3175
|
-
r.getStatus() !==
|
|
3349
|
+
r.getStatus() !== ae.Status.Off && r.start().then(async () => {
|
|
3350
|
+
if (t._startModules.has(s)) return;
|
|
3176
3351
|
const e = s.getFunctions().getItems({
|
|
3177
3352
|
type: "formula",
|
|
3178
3353
|
includeHidden: !0
|
|
3179
|
-
}),
|
|
3180
|
-
for (let
|
|
3181
|
-
const
|
|
3354
|
+
}), r = e.length;
|
|
3355
|
+
for (let t = 0; t < r; t++) {
|
|
3356
|
+
const s = e[t];
|
|
3182
3357
|
try {
|
|
3183
|
-
await this._calculation.getFunctions().add(
|
|
3358
|
+
await this._calculation.getFunctions().add(s);
|
|
3184
3359
|
} catch (e) {
|
|
3185
|
-
|
|
3360
|
+
ms.error(e?.message ?? String(e), e);
|
|
3186
3361
|
}
|
|
3187
3362
|
}
|
|
3188
3363
|
}).catch(() => {});
|
|
@@ -3191,10 +3366,10 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3191
3366
|
});
|
|
3192
3367
|
}
|
|
3193
3368
|
async toJSON(e) {
|
|
3194
|
-
if (this._closed) throw new Error(
|
|
3369
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
3195
3370
|
await Promise.resolve(this._starting);
|
|
3196
3371
|
const t = this.getCalculation();
|
|
3197
|
-
t.getStatus() !==
|
|
3372
|
+
t.getStatus() !== ae.Status.Off && (await t.ready(), await t._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
|
|
3198
3373
|
const s = { sheets: [] }, r = e?.ignoreStyles ?? !1;
|
|
3199
3374
|
if (!r) {
|
|
3200
3375
|
const e = this._theme.toJSON();
|
|
@@ -3207,60 +3382,66 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3207
3382
|
this._isDate1904 && (s.date1904 = !0), this._codeName && (s.codeName = this._codeName), this._updateLinks && (s.updateLinks = this._updateLinks);
|
|
3208
3383
|
const i = this._documentProperties.toJSON();
|
|
3209
3384
|
Object.keys(i).length > 0 && (s.properties = i), this._locale && (s.locale = this._locale), this._localeOverrides && (s.localeOverrides = this._localeOverrides);
|
|
3210
|
-
const o = e?.resources ?? "embed", n = "ignore" === o, a = this._strings.beginPersist(), l = n ? null : this._resources.beginPersist(), h = this._styles.beginPersist();
|
|
3385
|
+
const o = e?.resources ?? "embed", n = "ignore" === o, a = this._strings.beginPersist(), l = n ? null : this._resources.beginPersist(), h = this._styles.beginPersist(), c = this._richValues.beginPersist();
|
|
3211
3386
|
try {
|
|
3212
3387
|
const t = this._getSheetRef(this.getSelectedSheetIndex()).id;
|
|
3213
|
-
let i = t,
|
|
3214
|
-
const
|
|
3215
|
-
for (let r = 0; r <
|
|
3216
|
-
const o =
|
|
3388
|
+
let i = t, u = null;
|
|
3389
|
+
const d = this._getState(), g = d.sheetRefsAll, m = d.sheetsById, _ = g.length;
|
|
3390
|
+
for (let r = 0; r < _; r++) {
|
|
3391
|
+
const o = g[r], n = r + 1;
|
|
3217
3392
|
let a;
|
|
3218
|
-
const h =
|
|
3219
|
-
if (
|
|
3393
|
+
const h = m.get(o.id);
|
|
3394
|
+
if (Kr(o)) a = {
|
|
3220
3395
|
name: o.name,
|
|
3221
3396
|
sheet: await o.sheet.toJSON(e)
|
|
3222
3397
|
};
|
|
3223
3398
|
else {
|
|
3224
|
-
const e = h, t = l ? l.toResourceId.bind(l) : () => null, s = { part:
|
|
3399
|
+
const e = h, t = l ? l.toResourceId.bind(l) : () => null, s = { part: Ze.toJSON(e._getPart(), t) }, r = e.getTabColor();
|
|
3225
3400
|
r && (s.tabColor = r.toString()), a = {
|
|
3226
3401
|
name: o.name,
|
|
3227
3402
|
kind: e.getKind(),
|
|
3228
3403
|
sheet: s
|
|
3229
3404
|
};
|
|
3230
3405
|
}
|
|
3231
|
-
void 0 !== o.sheetId && (a.sheetId = o.sheetId), o.visibility ===
|
|
3406
|
+
void 0 !== o.sheetId && (a.sheetId = o.sheetId), o.visibility === mt.Visibility.Visible ? null === u && (u = n) : a.visibility = o.visibility, o.id === t && (i = n), s.sheets.push(a);
|
|
3232
3407
|
}
|
|
3233
3408
|
if (!r) {
|
|
3234
3409
|
const e = h.toJSON();
|
|
3235
3410
|
e && Object.keys(e).length > 0 && (s.styles = e);
|
|
3236
3411
|
}
|
|
3237
|
-
const
|
|
3238
|
-
|
|
3239
|
-
const
|
|
3240
|
-
Object.keys(
|
|
3241
|
-
const
|
|
3242
|
-
|
|
3243
|
-
const
|
|
3244
|
-
w && (s.externalBooks = w);
|
|
3245
|
-
const y = this._pivotCaches;
|
|
3412
|
+
const f = this.getProtection().toJSON();
|
|
3413
|
+
f && (s.protection = f);
|
|
3414
|
+
const p = this._calculation.toJSON();
|
|
3415
|
+
Object.keys(p).length > 0 && (s.calc = p);
|
|
3416
|
+
const w = await a.toJSONAsync();
|
|
3417
|
+
w && w.length > 0 && (s.strings = w);
|
|
3418
|
+
const y = await c.toJSONAsync(l ? l.toResourceId.bind(l) : void 0);
|
|
3246
3419
|
if (y.length > 0) {
|
|
3420
|
+
s.richData = y;
|
|
3421
|
+
const e = c.toKindsJSON();
|
|
3422
|
+
e.length > 0 && (s.richTypes = e);
|
|
3423
|
+
}
|
|
3424
|
+
const b = this._calculation.getExternalBooks().toJSON();
|
|
3425
|
+
b && (s.externalBooks = b);
|
|
3426
|
+
const S = this._pivotCaches;
|
|
3427
|
+
if (S.length > 0) {
|
|
3247
3428
|
const e = l ? l.toResourceId.bind(l) : () => null, t = /* @__PURE__ */ new Set();
|
|
3248
3429
|
for (const e of this.getPivotTables()) t.add(e.getCacheId());
|
|
3249
3430
|
const r = [];
|
|
3250
|
-
for (let s = 0; s <
|
|
3431
|
+
for (let s = 0; s < S.length; s++) t.has(S[s].cacheId) && r.push(S[s].toJSON(e));
|
|
3251
3432
|
r.length > 0 && (s.pivotCaches = r);
|
|
3252
3433
|
}
|
|
3253
|
-
const
|
|
3254
|
-
if (
|
|
3434
|
+
const k = this._people.toJSON();
|
|
3435
|
+
if (k && (s.people = k), !n) {
|
|
3255
3436
|
const e = await l.toJSONAsync("function" == typeof o ? o : void 0);
|
|
3256
3437
|
e && e.length > 0 && (s.resources = e);
|
|
3257
3438
|
}
|
|
3258
|
-
const
|
|
3259
|
-
|
|
3260
|
-
const
|
|
3261
|
-
|
|
3439
|
+
const C = this._calculation.getNamedFormulas().toJSON();
|
|
3440
|
+
C && C.length > 0 && (s.names = C);
|
|
3441
|
+
const v = this._view.toJSON();
|
|
3442
|
+
v && (i !== u ? v.activeSheetId = i : delete v.activeSheetId, Object.keys(v).length > 0 && (s.view = v));
|
|
3262
3443
|
} finally {
|
|
3263
|
-
h.endPersist(), n || l.endPersist(), a.endPersist();
|
|
3444
|
+
c.endPersist(), h.endPersist(), n || l.endPersist(), a.endPersist();
|
|
3264
3445
|
}
|
|
3265
3446
|
return this._emitter.notify("onSave", { params: s }), s;
|
|
3266
3447
|
}
|
|
@@ -3280,16 +3461,16 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3280
3461
|
} catch (e) {
|
|
3281
3462
|
console.warn("error on close", e);
|
|
3282
3463
|
}
|
|
3283
|
-
this._ownResources, this._ownNames && this._names.close(), this._ownCalculation && this._calculation.close(), this._ownStyles, this._transactionsRemoveListener?.(), this._listenerLanguage?.(), this._listenerOrigin?.(), this._listenerOriginProvider?.(), this._ownOriginProvider && this._originProvider instanceof
|
|
3464
|
+
this._ownResources, this._ownNames && this._names.close(), this._ownCalculation && this._calculation.close(), this._ownStyles, this._transactionsRemoveListener?.(), this._listenerLanguage?.(), this._listenerOrigin?.(), this._listenerOriginProvider?.(), this._ownOriginProvider && this._originProvider instanceof As && this._originProvider.release(), this._closed = !0;
|
|
3284
3465
|
}
|
|
3285
3466
|
beginCommit(e) {
|
|
3286
|
-
if (this._closed) throw new Error(
|
|
3467
|
+
if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
|
|
3287
3468
|
return this._beginCommit("string" == typeof e ? { description: e } : e);
|
|
3288
3469
|
}
|
|
3289
3470
|
doBatch(e, t) {
|
|
3290
3471
|
const r = this;
|
|
3291
3472
|
t = "string" == typeof t ? { description: t } : {
|
|
3292
|
-
description:
|
|
3473
|
+
description: bs("op.updateWorkbook"),
|
|
3293
3474
|
...t
|
|
3294
3475
|
};
|
|
3295
3476
|
const i = s.bind(this._transactions, this, e);
|
|
@@ -3309,7 +3490,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3309
3490
|
_getState() {
|
|
3310
3491
|
return this._transactions.getState(this._id);
|
|
3311
3492
|
}
|
|
3312
|
-
_updateState(e, t =
|
|
3493
|
+
_updateState(e, t = bs("op.updateWorkbook"), s) {
|
|
3313
3494
|
if (!e) return;
|
|
3314
3495
|
const r = this._beginCommit(t);
|
|
3315
3496
|
try {
|
|
@@ -3330,7 +3511,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3330
3511
|
get isIWorkbook() {
|
|
3331
3512
|
return !0;
|
|
3332
3513
|
}
|
|
3333
|
-
},
|
|
3514
|
+
}, $r = { address: null }, Kr = (e) => e.sheet.getKind() === mt.Kind.Worksheet, Gr = class {
|
|
3334
3515
|
constructor() {
|
|
3335
3516
|
this._readFormats = [], this._writeFormats = [], this._encryptions = [];
|
|
3336
3517
|
}
|
|
@@ -3407,9 +3588,9 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3407
3588
|
return !0;
|
|
3408
3589
|
});
|
|
3409
3590
|
}
|
|
3410
|
-
},
|
|
3591
|
+
}, Xr = /* @__PURE__ */ new WeakMap(), Yr = (e) => !!e && "object" == typeof e && "function" == typeof e.getPath && "function" == typeof e.canWrite, Zr = class {
|
|
3411
3592
|
constructor() {
|
|
3412
|
-
this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new e(this), this._registry = new
|
|
3593
|
+
this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new e(this), this._registry = new Gr(), this._defaultStore = new Ts(() => this.getWriteFormats(), () => this.getReadFormats());
|
|
3413
3594
|
}
|
|
3414
3595
|
getBackingStore() {
|
|
3415
3596
|
return this._backingStore ?? this._defaultStore;
|
|
@@ -3444,15 +3625,15 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3444
3625
|
return this._registry.getWriteFormats(e);
|
|
3445
3626
|
}
|
|
3446
3627
|
getOrigin(e) {
|
|
3447
|
-
return new
|
|
3628
|
+
return new Rs(e);
|
|
3448
3629
|
}
|
|
3449
3630
|
async read(e) {
|
|
3450
3631
|
let t = null;
|
|
3451
3632
|
if ("string" == typeof e) e = { source: e };
|
|
3452
|
-
else if (
|
|
3633
|
+
else if (Yr(e)) {
|
|
3453
3634
|
const s = e.getPath();
|
|
3454
3635
|
if (!s) throw new Error("Cannot read from an unbound origin (no path).");
|
|
3455
|
-
|
|
3636
|
+
Ls(e) ? e = {
|
|
3456
3637
|
source: s,
|
|
3457
3638
|
asCopy: !0
|
|
3458
3639
|
} : (t = e, e = { source: s });
|
|
@@ -3471,21 +3652,21 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3471
3652
|
search: i,
|
|
3472
3653
|
ext: o
|
|
3473
3654
|
}))[0];
|
|
3474
|
-
if (!n) throw new
|
|
3655
|
+
if (!n) throw new cs(Ss("error.io.readFormatUnavailable", { format: i ?? o }));
|
|
3475
3656
|
const a = s?.typedCreateWorkbookOptions, l = a ? Object.keys(a).find((e) => e.toLowerCase() === n.key.toLowerCase()) : void 0;
|
|
3476
3657
|
let h = {
|
|
3477
3658
|
...s,
|
|
3478
3659
|
...void 0 !== l ? a[l] : void 0
|
|
3479
3660
|
};
|
|
3480
3661
|
delete h.typedCreateWorkbookOptions, delete h.source, delete h.asCopy;
|
|
3481
|
-
const c = r ?? new
|
|
3662
|
+
const c = r ?? new Rs(t.absolutePath ?? null, {
|
|
3482
3663
|
name: t.name ?? null,
|
|
3483
3664
|
format: n.key,
|
|
3484
3665
|
size: t.size ?? null,
|
|
3485
3666
|
lastModified: t.lastModified ?? null,
|
|
3486
3667
|
canWrite: t.canWrite ?? !1
|
|
3487
3668
|
});
|
|
3488
|
-
r instanceof
|
|
3669
|
+
r instanceof Rs && r.update({
|
|
3489
3670
|
format: n.key,
|
|
3490
3671
|
size: t.size ?? null,
|
|
3491
3672
|
lastModified: t.lastModified ?? null
|
|
@@ -3519,7 +3700,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3519
3700
|
}
|
|
3520
3701
|
async _decrypt(e, t, s) {
|
|
3521
3702
|
const r = await this._registry.detectEncryption(e);
|
|
3522
|
-
if (t instanceof
|
|
3703
|
+
if (t instanceof Rs && t.update({ encryption: r ? r.key : null }), !r) return {
|
|
3523
3704
|
bytes: e,
|
|
3524
3705
|
password: null
|
|
3525
3706
|
};
|
|
@@ -3528,7 +3709,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3528
3709
|
try {
|
|
3529
3710
|
return i = await r.decode(e, t), !0;
|
|
3530
3711
|
} catch (e) {
|
|
3531
|
-
if (!(e instanceof
|
|
3712
|
+
if (!(e instanceof ds)) throw e;
|
|
3532
3713
|
return !1;
|
|
3533
3714
|
}
|
|
3534
3715
|
};
|
|
@@ -3538,7 +3719,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3538
3719
|
};
|
|
3539
3720
|
if (!s?.onPassword) {
|
|
3540
3721
|
const e = t.getName();
|
|
3541
|
-
throw new
|
|
3722
|
+
throw new ps(e ? Ss("error.io.passwordRequired", { name: e }) : Ss("error.io.passwordRequiredUnnamed"));
|
|
3542
3723
|
}
|
|
3543
3724
|
const n = await Promise.resolve(s.onPassword({
|
|
3544
3725
|
origin: t,
|
|
@@ -3554,16 +3735,16 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3554
3735
|
bytes: i,
|
|
3555
3736
|
password: n
|
|
3556
3737
|
};
|
|
3557
|
-
throw new
|
|
3738
|
+
throw new ds(Ss("error.io.passwordIncorrect"));
|
|
3558
3739
|
}
|
|
3559
3740
|
async writeArrayBuffer(e, t) {
|
|
3560
3741
|
if (!t?.format) throw new Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
|
|
3561
3742
|
const s = (await this._registry.getWriteFormats({ search: t.format }))[0];
|
|
3562
|
-
if (!s) throw new
|
|
3743
|
+
if (!s) throw new cs(Ss("error.io.writeFormatUnavailable", { format: t.format }));
|
|
3563
3744
|
return this._writeArrayBuffer(e, s, t);
|
|
3564
3745
|
}
|
|
3565
3746
|
async write(e, t, s) {
|
|
3566
|
-
return "string" == typeof t ||
|
|
3747
|
+
return "string" == typeof t || Yr(t) ? this._write(e, t, !1, s) : this._write(e, e?.getOrigin?.(), !0, t ?? s);
|
|
3567
3748
|
}
|
|
3568
3749
|
async writeAs(e, t, s) {
|
|
3569
3750
|
if (!t) throw new Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
|
|
@@ -3575,13 +3756,13 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3575
3756
|
let i = "string" == typeof t ? this.getOrigin(t) : t;
|
|
3576
3757
|
const o = i.getFormat();
|
|
3577
3758
|
let n;
|
|
3578
|
-
if ((r?.format || o) && (n = (await this._registry.getWriteFormats({ search: r?.format ?? o ?? void 0 }))[0]), n || i.getPath() && i.canWrite() && i.getExtension() || (n = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !n) throw new
|
|
3759
|
+
if ((r?.format || o) && (n = (await this._registry.getWriteFormats({ search: r?.format ?? o ?? void 0 }))[0]), n || i.getPath() && i.canWrite() && i.getExtension() || (n = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !n) throw new cs(Ss("error.io.writeFormatUnresolved"));
|
|
3579
3760
|
const a = i.getExtension();
|
|
3580
3761
|
if (r?.format && a && i.getPath() && i.canWrite() && !n.exts.includes(a)) {
|
|
3581
3762
|
const e = (await this._registry.getWriteFormats({ ext: a }))[0];
|
|
3582
3763
|
if (e && e.key !== n.key) {
|
|
3583
3764
|
const e = i.getPath().split(/[/\\]/).pop();
|
|
3584
|
-
throw new
|
|
3765
|
+
throw new cs(Ss("error.io.writeFormatMismatch", {
|
|
3585
3766
|
format: r.format,
|
|
3586
3767
|
file: e
|
|
3587
3768
|
}));
|
|
@@ -3589,21 +3770,21 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3589
3770
|
}
|
|
3590
3771
|
if ("string" == typeof t) {
|
|
3591
3772
|
const e = i.getPath();
|
|
3592
|
-
i = new
|
|
3773
|
+
i = new Rs(ke(e) ? e : `${e}.${n.exts[0]}`, { format: n.key });
|
|
3593
3774
|
}
|
|
3594
|
-
const l = i.getEncryption(), h = e.getOrigin?.(), c = (i instanceof
|
|
3775
|
+
const l = i.getEncryption(), h = e.getOrigin?.(), c = (i instanceof Rs ? i.getPassword() : null) ?? (h instanceof Rs ? h.getPassword() : null), u = i.isEncrypted() || (h?.isEncrypted() ?? !1), d = void 0 !== r?.password ? r.password : c ?? (u ? void 0 : null);
|
|
3595
3776
|
let g = null;
|
|
3596
3777
|
if (void 0 === d) {
|
|
3597
3778
|
if (u) {
|
|
3598
3779
|
const e = i.getName();
|
|
3599
|
-
throw new
|
|
3780
|
+
throw new ps(e ? Ss("error.io.passwordRequiredSave", { name: e }) : Ss("error.io.passwordRequiredSaveUnnamed"));
|
|
3600
3781
|
}
|
|
3601
|
-
} else if (null !== d && (g = await this._registry.getEncryption(l), !g)) throw new
|
|
3602
|
-
const m = `${i.getName() ??
|
|
3782
|
+
} else if (null !== d && (g = await this._registry.getEncryption(l), !g)) throw new cs(Ss("error.io.encryptionUnavailable"));
|
|
3783
|
+
const m = `${i.getName() ?? Ss("workbook.defaultName")}.${n.exts[0]}`, _ = r?.progress, f = !i.getPath() || !i.canWrite() || !!r?.prompt;
|
|
3603
3784
|
let p = !1;
|
|
3604
3785
|
const w = this;
|
|
3605
|
-
let y = null,
|
|
3606
|
-
const
|
|
3786
|
+
let y = null, b = [];
|
|
3787
|
+
const S = {
|
|
3607
3788
|
workbook: e,
|
|
3608
3789
|
format: n,
|
|
3609
3790
|
origin: i,
|
|
@@ -3628,7 +3809,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3628
3809
|
}))(_, h), u = await w._writeArrayBuffer(e, l, {
|
|
3629
3810
|
...r,
|
|
3630
3811
|
progress: c
|
|
3631
|
-
}), m =
|
|
3812
|
+
}), m = Xr.get(a);
|
|
3632
3813
|
if (h.some((e) => !m?.has(e.message)) && r?.onWarnings) {
|
|
3633
3814
|
const t = await Promise.resolve(r.onWarnings({
|
|
3634
3815
|
workbook: e,
|
|
@@ -3639,41 +3820,41 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3639
3820
|
}));
|
|
3640
3821
|
if (!f && !1 === t) return null;
|
|
3641
3822
|
}
|
|
3642
|
-
return
|
|
3823
|
+
return b = h, g ? g.encode(u, d) : u;
|
|
3643
3824
|
}
|
|
3644
3825
|
};
|
|
3645
|
-
let
|
|
3826
|
+
let k = null;
|
|
3646
3827
|
try {
|
|
3647
3828
|
const t = this.getBackingStore();
|
|
3648
3829
|
if (!t.write) throw new Error("The active backing store is read-only (no write implementation).");
|
|
3649
|
-
if (
|
|
3650
|
-
if (void 0 !== d &&
|
|
3651
|
-
const e =
|
|
3652
|
-
for (const t of
|
|
3653
|
-
|
|
3830
|
+
if (k = await t.write(S), k) {
|
|
3831
|
+
if (void 0 !== d && k instanceof Rs && (k.setPassword(d), k.update({ encryption: g ? g.key : null })), b.length) {
|
|
3832
|
+
const e = Xr.get(k) ?? /* @__PURE__ */ new Set();
|
|
3833
|
+
for (const t of b) e.add(t.message);
|
|
3834
|
+
Xr.set(k, e);
|
|
3654
3835
|
}
|
|
3655
|
-
s &&
|
|
3836
|
+
s && k !== e.getOrigin() && Ls(e.getOrigin())?.setOrigin(k);
|
|
3656
3837
|
const t = y ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
|
|
3657
3838
|
this._emitter.notify("onWrite", {
|
|
3658
3839
|
params: {
|
|
3659
3840
|
workbook: e,
|
|
3660
|
-
origin:
|
|
3841
|
+
origin: k,
|
|
3661
3842
|
commitId: t?.getId() ?? null,
|
|
3662
3843
|
save: s
|
|
3663
3844
|
},
|
|
3664
3845
|
transactional: !1
|
|
3665
3846
|
});
|
|
3666
3847
|
}
|
|
3667
|
-
_?.onComplete && await Promise.resolve(_.onComplete(
|
|
3848
|
+
_?.onComplete && await Promise.resolve(_.onComplete(k));
|
|
3668
3849
|
} catch (e) {
|
|
3669
3850
|
const t = e instanceof Error ? e : new Error(String(e));
|
|
3670
|
-
if (_?.onError && await Promise.resolve(_.onError(t)), _?.onComplete && await Promise.resolve(_.onComplete(null)), t instanceof
|
|
3671
|
-
throw new Error(
|
|
3851
|
+
if (_?.onError && await Promise.resolve(_.onError(t)), _?.onComplete && await Promise.resolve(_.onComplete(null)), t instanceof cs) throw t;
|
|
3852
|
+
throw new Error(Ss("error.io.writeFailed", { reason: t.message }), { cause: e });
|
|
3672
3853
|
}
|
|
3673
|
-
return
|
|
3854
|
+
return k;
|
|
3674
3855
|
}
|
|
3675
3856
|
_stripExtension(e) {
|
|
3676
|
-
const t =
|
|
3857
|
+
const t = ke(e);
|
|
3677
3858
|
return t ? e.slice(0, e.length - t.length - 1) : e;
|
|
3678
3859
|
}
|
|
3679
3860
|
_baseName(e) {
|
|
@@ -3693,25 +3874,25 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3693
3874
|
async _readArrayBuffer(e, t, s) {
|
|
3694
3875
|
if (!e) throw new Error("ArrayBuffer must be specified.");
|
|
3695
3876
|
if (!t) throw new Error("format must be specified.");
|
|
3696
|
-
if (0 === e.byteLength) return new
|
|
3877
|
+
if (0 === e.byteLength) return new qr(s?.createWorkbookOptions);
|
|
3697
3878
|
const r = t.handler;
|
|
3698
3879
|
if (!r) throw new Error(`Unable to resolve a read handler for '${t.key}'.`);
|
|
3699
3880
|
let i;
|
|
3700
3881
|
try {
|
|
3701
3882
|
i = await r(e, s);
|
|
3702
3883
|
} catch (e) {
|
|
3703
|
-
if (e instanceof
|
|
3704
|
-
throw new
|
|
3884
|
+
if (e instanceof cs) throw e;
|
|
3885
|
+
throw new cs(Ss("error.io.readFailed", {
|
|
3705
3886
|
format: t.description ?? t.key,
|
|
3706
3887
|
reason: e?.message ?? String(e)
|
|
3707
3888
|
}), { cause: e });
|
|
3708
3889
|
}
|
|
3709
|
-
return await
|
|
3890
|
+
return await lt(), i;
|
|
3710
3891
|
}
|
|
3711
3892
|
get isIWorkbookIO() {
|
|
3712
3893
|
return !0;
|
|
3713
3894
|
}
|
|
3714
|
-
},
|
|
3895
|
+
}, Qr = new Zr(), ei = class {
|
|
3715
3896
|
constructor() {
|
|
3716
3897
|
this._buffer = null, this._formatKey = null;
|
|
3717
3898
|
}
|
|
@@ -3725,7 +3906,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3725
3906
|
async read(e) {
|
|
3726
3907
|
return this._buffer ? e.decode(this._buffer, { format: this._formatKey ?? void 0 }) : null;
|
|
3727
3908
|
}
|
|
3728
|
-
},
|
|
3909
|
+
}, ti = "locales", si = "fonts", ri = {
|
|
3729
3910
|
suffix: ".msg.json",
|
|
3730
3911
|
async extract(e) {
|
|
3731
3912
|
const t = e.relPath.split("/");
|
|
@@ -3735,7 +3916,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3735
3916
|
} : null;
|
|
3736
3917
|
},
|
|
3737
3918
|
place: (e, t) => t ? `${t}/${e}` : null
|
|
3738
|
-
},
|
|
3919
|
+
}, ii = [
|
|
3739
3920
|
".woff2",
|
|
3740
3921
|
".woff",
|
|
3741
3922
|
".ttf",
|
|
@@ -3745,7 +3926,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3745
3926
|
].map((e) => ({
|
|
3746
3927
|
suffix: e,
|
|
3747
3928
|
place: (e, t) => t ? `${t}/${e}` : e
|
|
3748
|
-
})),
|
|
3929
|
+
})), oi = {
|
|
3749
3930
|
suffix: ".metrics.json",
|
|
3750
3931
|
async extract(e) {
|
|
3751
3932
|
const t = await e.readJson();
|
|
@@ -3756,13 +3937,13 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3756
3937
|
} : null;
|
|
3757
3938
|
},
|
|
3758
3939
|
place: (e, t) => t ? `${t}/${e}` : e
|
|
3759
|
-
},
|
|
3760
|
-
kind:
|
|
3761
|
-
files: [
|
|
3940
|
+
}, ni = [{
|
|
3941
|
+
kind: ti,
|
|
3942
|
+
files: [ri]
|
|
3762
3943
|
}, {
|
|
3763
|
-
kind:
|
|
3944
|
+
kind: si,
|
|
3764
3945
|
files: [
|
|
3765
|
-
|
|
3946
|
+
oi,
|
|
3766
3947
|
{
|
|
3767
3948
|
suffix: ".hinted.json",
|
|
3768
3949
|
async extract(e) {
|
|
@@ -3774,7 +3955,7 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3774
3955
|
hinted: !0
|
|
3775
3956
|
} : null;
|
|
3776
3957
|
},
|
|
3777
|
-
place:
|
|
3958
|
+
place: oi.place
|
|
3778
3959
|
},
|
|
3779
3960
|
{
|
|
3780
3961
|
suffix: ".rows.json",
|
|
@@ -3787,40 +3968,40 @@ var Sr, br = "workbook.activeSheet", kr = class e extends h {
|
|
|
3787
3968
|
rows: !0
|
|
3788
3969
|
} : null;
|
|
3789
3970
|
},
|
|
3790
|
-
place:
|
|
3971
|
+
place: oi.place
|
|
3791
3972
|
},
|
|
3792
|
-
...
|
|
3973
|
+
...ii
|
|
3793
3974
|
]
|
|
3794
3975
|
}];
|
|
3795
|
-
async function
|
|
3796
|
-
const { Chart: s } = await import("./
|
|
3976
|
+
async function ai(e, t) {
|
|
3977
|
+
const { Chart: s } = await import("./suOBVUz-pca6ilJH.mjs");
|
|
3797
3978
|
return new s({
|
|
3798
3979
|
json: e,
|
|
3799
3980
|
getStyles: t?.getStyles
|
|
3800
3981
|
});
|
|
3801
3982
|
}
|
|
3802
|
-
|
|
3803
|
-
var
|
|
3804
|
-
function
|
|
3805
|
-
if (!
|
|
3806
|
-
const e = import("./
|
|
3983
|
+
Dr || (Dr = {});
|
|
3984
|
+
var li = null;
|
|
3985
|
+
function hi() {
|
|
3986
|
+
if (!li) {
|
|
3987
|
+
const e = import("./C9gpMN3galHGZyoK.mjs").then((e) => e.loadScriptingDeclarations());
|
|
3807
3988
|
e.catch(() => {
|
|
3808
|
-
|
|
3809
|
-
}),
|
|
3989
|
+
li = null;
|
|
3990
|
+
}), li = e;
|
|
3810
3991
|
}
|
|
3811
|
-
return
|
|
3992
|
+
return li;
|
|
3812
3993
|
}
|
|
3813
|
-
var
|
|
3814
|
-
function
|
|
3815
|
-
if (!
|
|
3816
|
-
const e = import("./
|
|
3994
|
+
var ci, ui, di, gi = null;
|
|
3995
|
+
function mi() {
|
|
3996
|
+
if (!gi) {
|
|
3997
|
+
const e = import("./C9gpMN3galHGZyoK.mjs").then((e) => e.loadScriptingApi()).then((e) => JSON.parse(e));
|
|
3817
3998
|
e.catch(() => {
|
|
3818
|
-
|
|
3819
|
-
}),
|
|
3999
|
+
gi = null;
|
|
4000
|
+
}), gi = e;
|
|
3820
4001
|
}
|
|
3821
|
-
return
|
|
4002
|
+
return gi;
|
|
3822
4003
|
}
|
|
3823
|
-
|
|
4004
|
+
ci || (ci = {}), (ui || (ui = {})).Type = {
|
|
3824
4005
|
Button: "button",
|
|
3825
4006
|
CheckBox: "checkBox",
|
|
3826
4007
|
OptionButton: "optionButton",
|
|
@@ -3833,12 +4014,12 @@ Hr || (Hr = {}), (Ur || (Ur = {})).Type = {
|
|
|
3833
4014
|
EditBox: "editBox",
|
|
3834
4015
|
Dialog: "dialog",
|
|
3835
4016
|
Unknown: "formControl"
|
|
3836
|
-
}, (
|
|
4017
|
+
}, (di || (di = {})).DropStyle = {
|
|
3837
4018
|
Combo: "combo",
|
|
3838
4019
|
ComboEdit: "comboEdit",
|
|
3839
4020
|
Simple: "simple"
|
|
3840
4021
|
};
|
|
3841
|
-
var
|
|
4022
|
+
var _i = class extends S {
|
|
3842
4023
|
constructor(e) {
|
|
3843
4024
|
super(e);
|
|
3844
4025
|
}
|
|
@@ -3851,8 +4032,8 @@ var Kr = class extends Se {
|
|
|
3851
4032
|
colEnd: (e?.size?.width ?? 5) - 1,
|
|
3852
4033
|
rowEnd: (e?.size?.height ?? 5) - 1
|
|
3853
4034
|
},
|
|
3854
|
-
getRanges: (e) => new
|
|
4035
|
+
getRanges: (e) => new g(null)
|
|
3855
4036
|
}, super._initializeOptions(e);
|
|
3856
4037
|
}
|
|
3857
|
-
},
|
|
3858
|
-
export {
|
|
4038
|
+
}, fi = "0.8.0-beta.13", pi = "2026-11-04T00:26:27.964Z";
|
|
4039
|
+
export { Ne as AbstractCollection, r as AbstractMovableContent, R as AddressUtils, ei as ArrayBackingStore, C as AutoFill, pi as BUILD_DATE, _e as CellControlRegistry, he as CellImage, b as CellImageKind, n as ChartElementSelection, rs as ChartKinds, E as CheckboxKind, zt as Color, H as Condition, Ct as DateUtils, Zr as DefaultWorkbookIO, wt as EXTERNAL_LINK_PATH_REL_TYPE, Sr as ExternalRangeClipboardItem, si as FONTS_KIND, _r as Fetcher, Et as FontUtils, q as FormulaText, Ys as FunctionDeclarations, se as GeomUtils, p as Hyperlink, G as HyperlinkKind, U as IAnchored, Xt as IBorders, ae as ICalculation, we as ICell, Ks as ICellHeaderRange, l as ICellRange, $s as ICellRanges, Zt as ICellStyle, Gt as IColor, Je as ICondition, pe as IConditionalFormat, Cr as ICustomProperty, ge as IDataValidation, di as IDropDown, Dt as IEffect, Qt as IFill, Bt as IFont, J as IFontCollection, jt as IFontStyle, ui as IFormControl, Ot as IGeometry, ci as IMovable, He as IPageLayout, Dr as IPicture, qs as IResource, De as IRichDataKind, Fe as IScript, Jt as IShape, mt as ISheet, u as ISlicerStyle, Os as ISort, qt as IStroke, O as ITable, fe as ITableStyle, gt as IText, Ut as ITextFrame, Js as ITheme, P as IThemeCollection, ks as IWorkbookIO, nr as IWorkbookView, Nt as IWorksheetView, ti as LOCALES_KIND, V as LicenseManager, xe as MovableContentRegistry, de as NamedStyleCollection, $t as NumberFormat, ss as PaintUtils, hr as PersonCollection, br as RangeClipboardItem, Ps as RectAlignment, kt as Registry, I as Resource, Q as ResourceCollection, m as RichArray, ft as RichArrayKind, rt as RichDataCollection, bt as RichDataRegistry, ne as RichRecord, Ue as RichText, a as RichTextKind, ni as SHEETXL_RESOURCE_KINDS, Ht as SYSTEM_COLOR_CSS_PREFIX, At as ShapeStyleUtils, Y as SimpleFontFace, me as SlicerStyleCollection, Oe as Sort, $ as StringCollection, It as StyleCollection, _i as Table, x as TableStyleCollection, Qe as TextRotation, Te as TextStacked, Ge as TextUtils, W as Theme, st as ThemeCollection, t as TransactionConflictError, Ns as TransactionSaveStateManager, i as TransactionStore, Cs as TransactionUndoManager, Ye as Tuple, fi as VERSION, qr as Workbook, Qr as WorkbookIO, Rs as WorkbookOrigin, Ir as WorkbookView, le as Worksheet, Us as builtInStyleNameDisplay, y as createCellRangeCounts, ai as createChart, ue as externalBookClosedName, k as externalBookFileName, w as externalBookLocation, X as externalBookOpenName, F as findLabel, Qs as getBuiltInFunctionNames, A as getLanguagePack, Kt as getLocaleProfile, tt as getScriptRuntime, mi as getScriptingApi, hi as getScriptingDeclarations, j as localizeBoolean, re as localizeErrorLabel, Yt as makeLocaleProfile, be as normalizeLabel, vt as parseBooleanLocal, c as parseErrorLocal, qe as parseExternalScope, er as parseFormulaLiteral, v as registerSdkLocales, h as sourceEntryFromPath, Xe as withScriptRuntime };
|