@sheetxl/sdk 0.8.0-beta.14 → 0.8.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/LICENSE.md +8 -7
  2. package/browser/esm/4MbBwfmW2hDXk9_w.mjs +165 -0
  3. package/browser/esm/{ChYgQL-8qIDFmX31.mjs → 9YWdxmSjzLN4j_ts.mjs} +22 -22
  4. package/browser/esm/B6BdiHigbUdbZp3J.mjs +686 -0
  5. package/browser/esm/{CImFKFaYToUH-bSE.mjs → BF_QwkZ_hs2rFoTT.mjs} +3 -3
  6. package/browser/esm/{DBvu0tdSf-5vol4e.mjs → BMo2_9Ul36IwRm3S.mjs} +3 -3
  7. package/browser/esm/{B1aH_qa-czVyEVHd.mjs → BWY1qiidTUBVPJoD.mjs} +506 -502
  8. package/browser/esm/{BSXQAXwZdJKYTO4P.mjs → Bf80epSsm_RyAOb9.mjs} +29 -29
  9. package/browser/esm/{D_XMi4_5iO2rkET5.mjs → BfoE6Dn_GQCIkQD3.mjs} +2 -2
  10. package/browser/esm/{Dhw5XEJYFrkYjdU2.mjs → BlMYYQZP-QM-iBHz.mjs} +23 -22
  11. package/browser/esm/{MuNBN02MyZ558c_K.mjs → BqT-ASHP0NVSUUnY.mjs} +1528 -1433
  12. package/browser/esm/{DnR0xY7_iE3TmMcg.mjs → BtNuoQIrrHw_jnbJ.mjs} +4 -4
  13. package/browser/esm/BxFzcCYhvo9NXFjC.mjs +527 -0
  14. package/browser/esm/{DonQz2Tc3k9lNT8E.mjs → BxYuRTSF9ykc-Tpz.mjs} +3 -3
  15. package/browser/esm/{aRXqxIzjuSLwawMh.mjs → C2PvZwqK-uvsugVS.mjs} +2 -2
  16. package/browser/esm/C3JOjQwdG9kAig7i.mjs +2017 -0
  17. package/browser/esm/{SwLp-iElwDjfcJtv.mjs → C5x0EzqElYGTiTQc.mjs} +2 -2
  18. package/browser/esm/{AXlD9K1gCwPU4gCO.mjs → CMChv-fCFh68VQQt.mjs} +588 -587
  19. package/browser/esm/{BpwULQPKbb4R9Jew.mjs → CRbQATfI0yZxe1kX.mjs} +3 -3
  20. package/browser/esm/{CM_X1zZYzEUPaNJL.mjs → CUu3zeHqcwMRYiov.mjs} +2 -2
  21. package/{node/esm/b3XnssSr9lmvAC2N.mjs → browser/esm/C_jLGkFemj55_BP3.mjs} +3 -3
  22. package/browser/esm/{CtC__ALh4I8PKIln.mjs → CkZoDPUCK5jMUaeJ.mjs} +26955 -22064
  23. package/browser/esm/{DvvqmUQ9Z0NFm1-4.mjs → D-iHJ3q4nwOLcn1D.mjs} +2 -2
  24. package/browser/esm/{qCqzZW74-fhaIG2V.mjs → D807piM0VSokWz-L.mjs} +2 -2
  25. package/browser/esm/{BLYl-afJe_3std8i.mjs → DW3oQ39IF0bsc_lm.mjs} +2 -2
  26. package/browser/esm/{Ln4gsmhqH1LyoANj.mjs → DcB52JPBPmkc3l1m.mjs} +4 -4
  27. package/browser/esm/{DIfAk63CvaOZ3QKi.mjs → DlVnybrgwZWxWN3_.mjs} +10 -10
  28. package/browser/esm/{Dh84MDs-OhdCPCIg.mjs → DvVhatd0J1ch3OCO.mjs} +22 -22
  29. package/browser/esm/{BWoz4kQdA5KKJfl6.mjs → Dx9Fya60meMpuHqm.mjs} +2 -2
  30. package/browser/esm/{r_EZapMBdyS4gUd-.mjs → HV0FkJ6k3Ils318J.mjs} +78 -78
  31. package/browser/esm/{C7hpfT-sX2lyLS-D.mjs → JV9Szh5qTssjxJoE.mjs} +2 -2
  32. package/browser/esm/{CPIWV3Enlh_BF2TY.mjs → KpuD1kEcWB7cT0VM.mjs} +3 -3
  33. package/browser/esm/{3t4S9eda2I6jFad0.mjs → U4FL-QeC0bRUhTEo.mjs} +2 -2
  34. package/browser/esm/{D39XcmtPXVtMN4yF.mjs → WLlpmgLN5OVLoLrC.mjs} +3 -3
  35. package/browser/esm/{Cy8uYCggktF83278.mjs → WR146UAqrsUsL39e.mjs} +2 -2
  36. package/browser/esm/{BPPMKyMn65i1a1mE.mjs → WcHfawW2lkTHtWUd.mjs} +51 -49
  37. package/browser/esm/{Bdcd3QOzsc0aVMjN.mjs → Zp5-cTJ0Llb6EfGi.mjs} +4 -4
  38. package/browser/esm/{oSCy1X5CJ1iYtGDp.mjs → ad9PX897hYE4Srkc.mjs} +3 -3
  39. package/browser/esm/{UMQTbO0zNmBpzW1V.mjs → d_t-7d5BD1AdHg3u.mjs} +404 -404
  40. package/browser/esm/{BVqIknGhQCLUB_7Q.mjs → dwGdnbV-CykjNrlm.mjs} +2 -2
  41. package/browser/esm/{DiXeQjc0WJGLSVEo.mjs → e69NcYnKMLnAmqyA.mjs} +2 -2
  42. package/browser/esm/index.mjs +886 -578
  43. package/browser/esm/{yuF8SbWfjBfrxcq5.mjs → r-o0UCm7KtluNmyK.mjs} +3 -3
  44. package/licenses/dependencies.txt +69 -69
  45. package/node/esm/{BEBt5fo__rvT2q_u.mjs → 446KYBjJQa8g-8Gg.mjs} +52 -50
  46. package/node/esm/{BELc5aQ_pFPgbiso.mjs → 5OfKfTRX2_y2NwpU.mjs} +2 -2
  47. package/node/esm/{C-5JLSNof0FhkuFd.mjs → A3PEHO1HJvkHfb5n.mjs} +2 -2
  48. package/node/esm/{YpOpRyciqQLIY1-G.mjs → B4WUGzJBkQu7BXRm.mjs} +2 -2
  49. package/node/esm/{I-FZojIFWluC6X-j.mjs → BH8J6vKSO5zI_TWo.mjs} +2 -2
  50. package/node/esm/BLmdKnkLwkb3wWe6.mjs +2040 -0
  51. package/node/esm/{BuyAYLI4s33-vmgG.mjs → BZSxu_ZqX8-Uczzn.mjs} +2 -2
  52. package/node/esm/{DiCMnYA2bttmrX3q.mjs → BfPBiAgVmWhuFgFP.mjs} +3 -3
  53. package/node/esm/{BSVttk12GXNfKZ9k.mjs → Bknw7zWZhl2-w1pi.mjs} +3 -3
  54. package/node/esm/{uLrulyR7IXq0SF4j.mjs → BvIPsPiHhMclZ1kH.mjs} +22 -22
  55. package/node/esm/{clgEkmEwfB28nkz2.mjs → By2TFKOjA1HekZap.mjs} +4 -4
  56. package/node/esm/{BXg-D8Rc_iyB8p7X.mjs → BywIhvYkWk2o7MSW.mjs} +2 -2
  57. package/node/esm/{pF2vCOTmrxPAB41Q.mjs → C3zyhnMwQ2hRQBz7.mjs} +31 -30
  58. package/node/esm/{BCjHRVU8tC5lYypg.mjs → C884edhUf9yMqpPp.mjs} +2 -2
  59. package/node/esm/{B6jhx5pHPs2W5GE7.mjs → CDHY-0OyQ9348Brb.mjs} +189 -189
  60. package/node/esm/{xRGObcoaGDnAZFnj.mjs → CERNLhFrAwtu_p-q.mjs} +2 -2
  61. package/node/esm/{DbPUG2DcQ3T_QhcJ.mjs → CFkX_Cn6avQqQiVC.mjs} +78 -78
  62. package/node/esm/CJDV8P3hI8lu--3Z.mjs +530 -0
  63. package/node/esm/{Cyeq1rDslIqF1LKz.mjs → CKwiipdPJGzAiPjg.mjs} +2 -2
  64. package/node/esm/{BLPrFp_jKGYgWPX1.mjs → CLtUMJfKsy4SevWE.mjs} +3 -3
  65. package/node/esm/{DLdXl0O0TXuyqLU4.mjs → CVPieTgKCwkL21nD.mjs} +28573 -23108
  66. package/node/esm/{Dlk2ZYExFgQ0xE2H.mjs → C_fYuynP2a_70WdL.mjs} +2 -2
  67. package/{browser/esm/BEDfJP2tcuRy2Y2E.mjs → node/esm/CgdNA3B_GFG_yJiN.mjs} +3 -3
  68. package/node/esm/Cs3ibv6YHCDwLRlk.mjs +115 -0
  69. package/node/esm/{DeFE8QfuCeGw-mvd.mjs → Cxak8i2NidZ4Uv6v.mjs} +487 -483
  70. package/node/esm/{NA-8urR7T1NCwrgD.mjs → D88A3UpCyGRjcX3U.mjs} +3 -3
  71. package/node/esm/{99miMotf3dOuG5Jk.mjs → DBIUe2BC9xU7qMHR.mjs} +3 -3
  72. package/node/esm/{BEdxa3I4VOiCsvy7.mjs → DELfV5HQZo1mInBd.mjs} +4 -4
  73. package/node/esm/{BfEdeOg4iYXaYTlh.mjs → DOt3t-13tsnM7Fj6.mjs} +2 -2
  74. package/node/esm/{B3hBxzqJ2_hUylNr.mjs → DfWc3nW_Z_qqc_Wf.mjs} +1762 -1674
  75. package/node/esm/DgnwKbUEyQN5_gWT.mjs +169 -0
  76. package/node/esm/{Ccocd9DTvOnlOE9D.mjs → Dhv9JymnXqcF54oo.mjs} +2 -2
  77. package/node/esm/{Lj98EH6coGdKUzuS.mjs → DvtyKKzOnoOM80NB.mjs} +22 -22
  78. package/node/esm/{Crn6dnSQQRCQAnQ-.mjs → KDGrIa9R5XzWfjM2.mjs} +2 -2
  79. package/node/esm/{D30rC6AWaGGf3CaC.mjs → RTwm9ge1KoPdlBNt.mjs} +2 -2
  80. package/node/esm/{CdSTmD2ZvG9NesNR.mjs → _RIAmJI98l6bIFfZ.mjs} +2 -2
  81. package/node/esm/{CI8UIWR01z9QDlzH.mjs → bIGdvfpnijWeCac6.mjs} +1005 -1004
  82. package/node/esm/index.mjs +913 -598
  83. package/node/esm/kaiXmn0AA5WDsLPo.mjs +199 -0
  84. package/node/esm/{B5VmOC0jO9Zbh9Mq.mjs → mTIhoz1gEcaEm7s1.mjs} +3 -3
  85. package/package.json +7 -7
  86. package/resources/locales/de/model.msg.json +82 -1
  87. package/resources/locales/en/model.msg.json +80 -1
  88. package/types/scripting-api.json +9967 -9497
  89. package/types/scripting-enums.json +27 -0
  90. package/types/scripting.d.ts +2282 -166
  91. package/types/src/.generated/wasm/sdk.d.ts +332 -0
  92. package/types/src/calculation/Calculation.d.ts +8 -0
  93. package/types/src/calculation/ICalculation.d.ts +51 -0
  94. package/types/src/calculation/compiler/Types.d.ts +5 -0
  95. package/types/src/calculation/executor/CalcExecutorUtils.d.ts +1 -1
  96. package/types/src/calculation/formula/FormulaBlock.d.ts +2 -0
  97. package/types/src/calculation/formula/IFormulaBlock.d.ts +18 -0
  98. package/types/src/calculation/grid/CalcGrid.d.ts +5 -1
  99. package/types/src/calculation/grid/CalcGridBackend.d.ts +36 -1
  100. package/types/src/calculation/grid/CalcGridProxy.d.ts +2 -0
  101. package/types/src/calculation/grid/CalcGridUtils.d.ts +4 -2
  102. package/types/src/calculation/grid/FormulaHost.d.ts +3 -1
  103. package/types/src/calculation/grid/ICalcGrid.d.ts +88 -0
  104. package/types/src/calculation/grid/_CalcRequest.d.ts +9 -0
  105. package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +2 -0
  106. package/types/src/calculation/spatial/SpillEntry.d.ts +55 -4
  107. package/types/src/calculation/state/CalcNode.d.ts +6 -3
  108. package/types/src/calculation/state/CalculationContext.d.ts +4 -2
  109. package/types/src/calculation/state/_PivotView.d.ts +22 -0
  110. package/types/src/cell/ICell.d.ts +1 -21
  111. package/types/src/cellRange/ICellRange.d.ts +18 -2
  112. package/types/src/collections/MixedTypedArrayList.d.ts +16 -2
  113. package/types/src/condition/BuiltInOperators/AbstractOperator.d.ts +10 -0
  114. package/types/src/condition/BuiltInOperators/GreaterThanEqualToOperator.d.ts +3 -0
  115. package/types/src/condition/BuiltInOperators/GreaterThanOperator.d.ts +3 -0
  116. package/types/src/condition/BuiltInOperators/LessThanEqualToOperator.d.ts +3 -0
  117. package/types/src/condition/BuiltInOperators/LessThanOperator.d.ts +3 -0
  118. package/types/src/condition/BuiltInOperators/MatchesOperator.d.ts +10 -0
  119. package/types/src/condition/BuiltInOperators/TimePeriodOperator.d.ts +2 -0
  120. package/types/src/condition/BuiltInOperators/index.d.ts +2 -0
  121. package/types/src/condition/Condition.d.ts +1 -0
  122. package/types/src/condition/ICondition.d.ts +15 -0
  123. package/types/src/condition/_ConditionUtils.d.ts +14 -0
  124. package/types/src/conditionalFormat/ConditionalFormat.d.ts +2 -1
  125. package/types/src/conditionalFormat/IConditionalFormat.d.ts +4 -3
  126. package/types/src/license/LicenseDetails.d.ts +27 -0
  127. package/types/src/license/LicenseManager.d.ts +24 -7
  128. package/types/src/license/_Utils.d.ts +34 -3
  129. package/types/src/license/index.d.ts +1 -0
  130. package/types/src/license/runtime.browser.d.ts +32 -4
  131. package/types/src/license/runtime.node.d.ts +8 -5
  132. package/types/src/license/summary.d.ts +18 -0
  133. package/types/src/pivot/IPivotTable.d.ts +1549 -13
  134. package/types/src/pivot/IPivotTableCollection.d.ts +70 -4
  135. package/types/src/pivot/PivotCache.d.ts +95 -11
  136. package/types/src/pivot/PivotDataField.d.ts +73 -0
  137. package/types/src/pivot/PivotField.d.ts +142 -0
  138. package/types/src/pivot/PivotTable.d.ts +548 -14
  139. package/types/src/pivot/PivotTableCollection.d.ts +18 -3
  140. package/types/src/pivot/_PivotAreas.d.ts +48 -0
  141. package/types/src/pivot/_PivotControls.d.ts +140 -0
  142. package/types/src/pivot/_PivotEngine.d.ts +9 -0
  143. package/types/src/pivot/_PivotGroups.d.ts +25 -0
  144. package/types/src/pivot/_PivotItems.d.ts +167 -0
  145. package/types/src/pivot/_PivotStructure.d.ts +237 -0
  146. package/types/src/pivot/_PivotStylePreview.d.ts +21 -0
  147. package/types/src/pivot/_PivotUtils.d.ts +37 -0
  148. package/types/src/pivot/engine/PivotAdd.d.ts +37 -0
  149. package/types/src/pivot/engine/PivotData.d.ts +65 -0
  150. package/types/src/pivot/engine/PivotEdit.d.ts +45 -0
  151. package/types/src/pivot/engine/PivotFilters.d.ts +50 -0
  152. package/types/src/pivot/engine/PivotFormulas.d.ts +72 -0
  153. package/types/src/pivot/engine/PivotLayout.d.ts +133 -0
  154. package/types/src/pivot/engine/PivotMove.d.ts +24 -0
  155. package/types/src/pivot/engine/PivotRefresh.d.ts +87 -0
  156. package/types/src/pivot/engine/PivotSort.d.ts +26 -0
  157. package/types/src/pivot/engine/PivotViewBuilder.d.ts +22 -0
  158. package/types/src/pivot/engine/index.d.ts +15 -0
  159. package/types/src/pivot/index.d.ts +4 -0
  160. package/types/src/pivot/kernel/KernelPivot.d.ts +63 -0
  161. package/types/src/pivot/kernel/_KernelLeaves.d.ts +100 -0
  162. package/types/src/pivot/kernel/_PivotAxisTree.d.ts +71 -0
  163. package/types/src/primitives/Range.d.ts +12 -1
  164. package/types/src/sheet/IWorksheet.d.ts +35 -0
  165. package/types/src/sheet/SheetCell.d.ts +21 -14
  166. package/types/src/sheet/SheetRange.d.ts +3 -0
  167. package/types/src/sheet/Worksheet.d.ts +175 -7
  168. package/types/src/sheet/_PivotFootprint.d.ts +42 -0
  169. package/types/src/sheet/_SheetAutoFitUtils.d.ts +12 -1
  170. package/types/src/sheet/_SheetMutations.d.ts +47 -0
  171. package/types/src/sheet/_SheetStateTypes.d.ts +11 -0
  172. package/types/src/sheet/style/SheetCellStyle.d.ts +6 -0
  173. package/types/src/sheet/style/SheetPivotStyle.d.ts +83 -0
  174. package/types/src/sheet/style/_IndentUnit.d.ts +14 -0
  175. package/types/src/sheetHeader/SheetCellHeader.d.ts +1 -1
  176. package/types/src/slicer/ISlicer.d.ts +114 -34
  177. package/types/src/slicer/ITimeline.d.ts +61 -0
  178. package/types/src/slicer/Slicer.d.ts +76 -3
  179. package/types/src/slicer/_PivotSlicer.d.ts +51 -0
  180. package/types/src/slicer/index.d.ts +1 -0
  181. package/types/src/table/AnchoredTable.d.ts +11 -1
  182. package/types/src/table/ITable.d.ts +5 -6
  183. package/types/src/table/ITableStyle.d.ts +50 -34
  184. package/types/src/table/_BuiltInPivotStyles.d.ts +8 -0
  185. package/types/src/table/_BuiltInTableStyles.d.ts +0 -1
  186. package/types/src/type/ITypes.d.ts +5 -1
  187. package/types/src/workbook/IWorkbook.d.ts +8 -2
  188. package/types/src/workbook/Workbook.d.ts +72 -6
  189. package/browser/esm/D2NFcBM4xsv0JJ1q.mjs +0 -184
  190. package/browser/esm/DnqwX3-2NfGBaXXl.mjs +0 -357
  191. package/node/esm/C3S4hF1vn0NyJPPd.mjs +0 -199
  192. package/node/esm/CPsGyt3vnOdLTShj.mjs +0 -360
  193. package/node/esm/D4Y1WJgjiFEgbWrW.mjs +0 -115
  194. package/types/src/pivot/_PivotXml.d.ts +0 -24
  195. package/types/src/primitives/Grouping.d.ts +0 -65
@@ -1,18 +1,18 @@
1
1
  /**
2
- * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.14
2
+ * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.16
3
3
  *
4
4
  * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
5
+ * License: SheetXL EULA — https://www.sheetxl.com/eula
6
6
  */
7
- import { a as e, l as t, o as s, t as r, u as i } from "./I-FZojIFWluC6X-j.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 "./DLdXl0O0TXuyqLU4.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 "./CI8UIWR01z9QDlzH.mjs";
10
- import { n as ss, t as rs } from "./BEdxa3I4VOiCsvy7.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";
7
+ import { a as e, l as t, o as s, t as r, u as i } from "./BH8J6vKSO5zI_TWo.mjs";
8
+ import { $i as o, $n as n, $t as a, A as l, Aa as h, Ai as c, At as u, Bi as d, Bt as g, C as m, Ca as f, Ci as _, D as p, Da as w, Di as y, Dt as S, E as b, Ei as k, Er as C, Et as v, F as I, Fi as R, Ft as N, Gn as O, Gt as x, Hn as E, Ht as V, I as L, Ii as A, It as T, Jt as P, L as F, Li as B, Lt as W, M, Ma as D, Mi as j, Na as H, Ni as z, O as $, Oa as U, Oi as J, Ot as q, Pi as K, Pt as G, Qt as Z, R as X, Ri as Y, S as Q, Sa as ee, Si as te, T as se, Ta as re, Ti as ie, Tr as oe, Tt as ne, Ut as ae, Vi as le, Vn as he, Vt as ce, Wn as ue, Wt as de, Xn as ge, Xt as me, Ya as fe, Yi as _e, Yn as pe, Yt as we, Zi as ye, Zn as Se, Zt as be, _a as ke, _r as Ce, a as ve, aa as Ie, ao as Re, b as Ne, ba as Oe, co as xe, da as Ee, do as Ve, ea as Le, en as Ae, eo as Te, er as Pe, fa as Fe, fo as Be, ga as We, gi as Me, ha as De, hi as je, ho as He, i as ze, ia as $e, io as Ue, j as Je, ja as qe, ji as Ke, k as Ge, ka as Ze, ki as Xe, kt as Ye, lo as Qe, ma as et, mi as tt, mo as st, mr as rt, no as it, nr as ot, on as nt, oo as at, pa as lt, po as ht, pr as ct, qi as ut, qt as dt, r as gt, ra as mt, ro as ft, sn as _t, so as pt, tn as wt, tr as yt, ua as St, uo as bt, v as kt, va as Ct, w as vt, wi as It, wt as Rt, x as Nt, xa as Ot, xi as xt, xr as Et, y as Vt, ya as Lt, zi as At, zt as Tt } from "./CVPieTgKCwkL21nD.mjs";
9
+ import { $t as Pt, A as Ft, B as Bt, Dt as Wt, Et as Mt, H as Dt, K as jt, O as Ht, Qt as zt, R as $t, U as Ut, V as Jt, W as qt, Xt as Kt, Zt as Gt, an as Zt, at as Xt, ct as Yt, dt as Qt, ft as es, k as ts, lt as ss, mt as rs, on as is, pt as os, sn as ns, st as as, ut as ls, z as hs } from "./bIGdvfpnijWeCac6.mjs";
10
+ import { n as cs, t as us } from "./DELfV5HQZo1mInBd.mjs";
11
+ import { FormulaError as ds, ScalarType as gs } from "@sheetxl/primitives";
12
+ import { BufferUtils as ms, CommonUtils as fs, CoordUtils as _s, DefaultLanguagePackService as ps, ExpectedError as ws, ImageUtils as ys, InvalidPasswordError as Ss, MimeType as bs, Notifier as ks, NullNotAllowedError as Cs, OutOfBoundsError as vs, PasswordRequiredError as Is, ProtectedError as Rs, UndoManager as Ns, messageKey as Os, t as xs } from "@sheetxl/utils";
13
13
  export * from "@sheetxl/primitives";
14
14
  export * from "@sheetxl/utils";
15
- var ks, Cs = class extends ys {
15
+ var Es, Vs = class extends Ns {
16
16
  constructor(e, t = 50) {
17
17
  super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
18
18
  }
@@ -99,14 +99,14 @@ var ks, Cs = class extends ys {
99
99
  return 0 === e.length && null !== this._repeatOperation && e.push(this._repeatOperation.description), Object.freeze(e);
100
100
  }
101
101
  getUndoEntries() {
102
- return this._undoCommits().map(Is);
102
+ return this._undoCommits().map(As);
103
103
  }
104
104
  getRedoEntries() {
105
- const e = this._redoCommits().map(Is);
105
+ const e = this._redoCommits().map(As);
106
106
  return 0 === e.length && null !== this._repeatOperation && e.push({
107
107
  description: this._repeatOperation.description,
108
108
  author: null,
109
- meta: vs
109
+ meta: Ls
110
110
  }), Object.freeze(e);
111
111
  }
112
112
  addUndoOperation() {
@@ -118,11 +118,11 @@ var ks, Cs = class extends ys {
118
118
  close() {
119
119
  this._removeListener?.();
120
120
  }
121
- }, vs = Object.freeze({}), Is = (e) => ({
121
+ }, Ls = Object.freeze({}), As = (e) => ({
122
122
  description: e.getDescription(),
123
123
  author: e.getAuthor(),
124
- meta: e.getMeta() ?? vs
125
- }), Ns = class {
124
+ meta: e.getMeta() ?? Ls
125
+ }), Ts = class {
126
126
  constructor(t, s) {
127
127
  this._dirty = !1, this._store = t, this._savedCommitId = t.getCurrentCommit()?.getId() ?? null, this._emitter = new e(this);
128
128
  const r = this;
@@ -160,8 +160,8 @@ var ks, Cs = class extends ys {
160
160
  this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
161
161
  }
162
162
  };
163
- ks || (ks = {});
164
- var Os, Rs = class t {
163
+ Es || (Es = {});
164
+ var Ps, Fs = class t {
165
165
  constructor(s, r = {}) {
166
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;
167
167
  }
@@ -174,7 +174,7 @@ var Os, Rs = class t {
174
174
  getName() {
175
175
  if (null !== this._name && void 0 !== this._name) return this._name;
176
176
  const e = this._cleanPath();
177
- return e && We(e) || null;
177
+ return e && Ve(e) || null;
178
178
  }
179
179
  getPath() {
180
180
  return this._path;
@@ -185,7 +185,7 @@ var Os, Rs = class t {
185
185
  getExtension() {
186
186
  const e = this._cleanPath();
187
187
  if (!e) return null;
188
- const t = ke(e);
188
+ const t = Be(e);
189
189
  return t ? t.toLowerCase() : null;
190
190
  }
191
191
  getEncryption() {
@@ -235,26 +235,26 @@ var Os, Rs = class t {
235
235
  ];
236
236
  return `${t} ${(s / Math.pow(1024, r)).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
237
237
  }
238
- }, xs = /* @__PURE__ */ new WeakMap(), Es = /* @__PURE__ */ new Set(), Ls = (e) => xs.get(e) ?? null, As = class t {
238
+ }, Bs = /* @__PURE__ */ new WeakMap(), Ws = /* @__PURE__ */ new Set(), Ms = (e) => Bs.get(e) ?? null, Ds = class t {
239
239
  constructor(s) {
240
- this._released = !1, t._assertFree(s), this._emitter = new e(this), this._origin = s, xs.set(s, this), Es.add(this);
240
+ this._released = !1, t._assertFree(s), this._emitter = new e(this), this._origin = s, Bs.set(s, this), Ws.add(this);
241
241
  }
242
242
  getOrigin() {
243
243
  return this._origin;
244
244
  }
245
245
  setOrigin(e) {
246
- e !== this._origin && (t._assertFree(e), this._released || (xs.delete(this._origin), xs.set(e, this)), this._origin = e, this._emitter.notify("onOriginChange"));
246
+ e !== this._origin && (t._assertFree(e), this._released || (Bs.delete(this._origin), Bs.set(e, this)), this._origin = e, this._emitter.notify("onOriginChange"));
247
247
  }
248
248
  release() {
249
- this._released || (this._released = !0, xs.get(this._origin) === this && xs.delete(this._origin), Es.delete(this));
249
+ this._released || (this._released = !0, Bs.get(this._origin) === this && Bs.delete(this._origin), Ws.delete(this));
250
250
  }
251
251
  addListeners(e, t) {
252
252
  return this._emitter.addListeners(e, t);
253
253
  }
254
254
  static _assertFree(e) {
255
- if (xs.has(e)) throw new Error("This origin already backs an open workbook; an origin backs one workbook at a time.");
255
+ if (Bs.has(e)) throw new Error("This origin already backs an open workbook; an origin backs one workbook at a time.");
256
256
  }
257
- }, Vs = class {
257
+ }, js = class {
258
258
  constructor() {
259
259
  this._defaultStringSourceType = "filepath";
260
260
  }
@@ -274,10 +274,10 @@ var Os, Rs = class t {
274
274
  }
275
275
  switch (n) {
276
276
  case "file": {
277
- const e = s, r = e?.name, n = r ? `${We(r)}` : "";
277
+ const e = s, r = e?.name, n = r ? `${Ve(r)}` : "";
278
278
  a = await e.arrayBuffer(), l = {
279
279
  format: o,
280
- ext: ke(r),
280
+ ext: Be(r),
281
281
  name: n,
282
282
  absolutePath: r,
283
283
  size: e.size,
@@ -301,7 +301,7 @@ var Os, Rs = class t {
301
301
  const [, t] = s.split(",");
302
302
  e = t;
303
303
  } else e = s;
304
- a = ns.base64ToArrayBuffer(e), l = {
304
+ a = ms.base64ToArrayBuffer(e), l = {
305
305
  format: o,
306
306
  size: e.length
307
307
  };
@@ -317,7 +317,7 @@ var Os, Rs = class t {
317
317
  e = i.input, t = i.init, r = i.timeout;
318
318
  }
319
319
  }
320
- const i = r || 3e4, n = new AbortController(), h = setTimeout(() => n.abort(), i), c = "string" == typeof e ? e : e.toString(), u = ke(c);
320
+ const i = r || 3e4, n = new AbortController(), h = setTimeout(() => n.abort(), i), c = "string" == typeof e ? e : e.toString(), u = Be(c);
321
321
  try {
322
322
  const s = await fetch(e, {
323
323
  ...t,
@@ -329,7 +329,7 @@ var Os, Rs = class t {
329
329
  a = r, l = {
330
330
  format: o,
331
331
  ext: u,
332
- name: We(c, !0),
332
+ name: Ve(c, !0),
333
333
  absolutePath: c
334
334
  };
335
335
  } catch (e) {
@@ -372,7 +372,7 @@ var Os, Rs = class t {
372
372
  return t.absolutePath ? this.findOpenPath(t.absolutePath) : null;
373
373
  }
374
374
  findOpenPath(e, t) {
375
- return Array.from(Es, (e) => e.getOrigin()).find((s) => {
375
+ return Array.from(Ws, (e) => e.getOrigin()).find((s) => {
376
376
  if (s === t || !s.canWrite()) return !1;
377
377
  const r = s.getPath();
378
378
  return !!r && this.isSamePath(r, e);
@@ -403,10 +403,10 @@ var Os, Rs = class t {
403
403
  }
404
404
  if ("undefined" != typeof File && e instanceof File) return "file";
405
405
  if ("undefined" != typeof Blob && e instanceof Blob) return "blob";
406
- const t = e instanceof ArrayBuffer || "[object ArrayBuffer]" === Object.prototype.toString.call(e), s = ArrayBuffer.isView(e), r = ns.isNodeBuffer(e);
406
+ const t = e instanceof ArrayBuffer || "[object ArrayBuffer]" === Object.prototype.toString.call(e), s = ArrayBuffer.isView(e), r = ms.isNodeBuffer(e);
407
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;
408
408
  }
409
- }, Ts = class extends Vs {
409
+ }, Hs = class extends js {
410
410
  constructor(e, t) {
411
411
  super();
412
412
  }
@@ -446,8 +446,8 @@ var Os, Rs = class t {
446
446
  ), r = e.origin.getPath(), i = !(!r || !e.origin.canWrite()), o = i ? r : e.origin.getName() ? e.suggestedName : null;
447
447
  if (!o) throw new Error("No file name provided to write to.");
448
448
  const n = s.resolve(o.replace(/\\/g, "/")), a = this.findOpenPath(n, e.workbook?.getOrigin?.());
449
- if (a) throw new cs(Ss("error.io.openElsewhere", { name: a.getName() ?? n }));
450
- const l = i ? e.origin : new Rs(n, {
449
+ if (a) throw new ws(xs("error.io.openElsewhere", { name: a.getName() ?? n }));
450
+ const l = i ? e.origin : new Fs(n, {
451
451
  format: e.format.key,
452
452
  canWrite: !0
453
453
  }), h = await e.encode(e.format.key, l);
@@ -463,7 +463,7 @@ var Os, Rs = class t {
463
463
  } catch (e) {
464
464
  throw new Error(`Failed to write file '${n}': ${e.message}`);
465
465
  }
466
- if (l instanceof Rs) {
466
+ if (l instanceof Fs) {
467
467
  const e = await t.stat(n).catch(() => null);
468
468
  l.update({
469
469
  size: c.byteLength,
@@ -473,13 +473,13 @@ var Os, Rs = class t {
473
473
  return l;
474
474
  }
475
475
  };
476
- (Os || (Os = {})).SortOn = {
476
+ (Ps || (Ps = {})).SortOn = {
477
477
  Value: "value",
478
478
  FillColor: "fillColor",
479
479
  FontColor: "fontColor",
480
480
  Icon: "icon"
481
481
  };
482
- var Ps = {
482
+ var zs = {
483
483
  TopLeft: "tl",
484
484
  Top: "t",
485
485
  TopRight: "tr",
@@ -489,53 +489,53 @@ var Ps = {
489
489
  BottomLeft: "bl",
490
490
  Bottom: "b",
491
491
  BottomRight: "br"
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];
492
+ }, $s = as.BuiltInName, Us = {
493
+ [$s.Normal]: Os("style.builtin.normal"),
494
+ [$s.Comma]: Os("style.builtin.comma"),
495
+ [$s.Currency]: Os("style.builtin.currency"),
496
+ [$s.Percent]: Os("style.builtin.percent"),
497
+ [$s.Comma0]: Os("style.builtin.comma0"),
498
+ [$s.Currency0]: Os("style.builtin.currency0"),
499
+ [$s.Hyperlink]: Os("style.builtin.hyperlink"),
500
+ [$s.FollowedHyperlink]: Os("style.builtin.followedHyperlink"),
501
+ [$s.Note]: Os("style.builtin.note"),
502
+ [$s.WarningText]: Os("style.builtin.warningText"),
503
+ [$s.Title]: Os("style.builtin.title"),
504
+ [$s.Input]: Os("style.builtin.input"),
505
+ [$s.Output]: Os("style.builtin.output"),
506
+ [$s.Calculation]: Os("style.builtin.calculation"),
507
+ [$s.CheckCell]: Os("style.builtin.checkCell"),
508
+ [$s.LinkedCell]: Os("style.builtin.linkedCell"),
509
+ [$s.Total]: Os("style.builtin.total"),
510
+ [$s.Good]: Os("style.builtin.good"),
511
+ [$s.Bad]: Os("style.builtin.bad"),
512
+ [$s.Neutral]: Os("style.builtin.neutral"),
513
+ [$s.ExplanatoryText]: Os("style.builtin.explanatoryText")
514
+ }, Js = Os("style.builtin.heading"), qs = Os("style.builtin.accent"), Ks = Os("style.builtin.accentTint"), Gs = /^Heading ([1-4])$/, Zs = /^Accent([1-6])$/, Xs = /^(20|40|60)% - Accent([1-6])$/;
515
+ function Ys(e) {
516
+ const t = Us[e];
517
517
  if (t) return { key: t };
518
- let s = Ds.exec(e);
518
+ let s = Gs.exec(e);
519
519
  return s ? {
520
- key: Bs,
520
+ key: Js,
521
521
  params: { n: +s[1] }
522
- } : (s = zs.exec(e), s ? {
523
- key: js,
522
+ } : (s = Zs.exec(e), s ? {
523
+ key: qs,
524
524
  params: { n: +s[1] }
525
- } : (s = Hs.exec(e), s ? {
526
- key: Ms,
525
+ } : (s = Xs.exec(e), s ? {
526
+ key: Ks,
527
527
  params: {
528
528
  pct: +s[1],
529
529
  n: +s[2]
530
530
  }
531
531
  } : null));
532
532
  }
533
- var Js, qs, $s, Ks, Gs = (e, t, s, r, i) => {
533
+ var Qs, er, tr, sr, rr = (e, t, s, r, i) => {
534
534
  const o = JSON.parse(JSON.stringify(e.definition));
535
535
  o.adjs || (o.adjs = []);
536
536
  let n = "", a = 0, l = 0;
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({
537
+ t > 0 ? (l = t, a = 100 - t, n = xs("op.lighterPercent", { percent: t })) : t < 0 && (a = 100 + t, n = xs("op.darkerPercent", { percent: -t })), a && o.adjs.push({ [os.AdjustmentType.LumMod]: a }), l && o.adjs.push({ [os.AdjustmentType.LumOff]: l });
538
+ const h = new Qt({
539
539
  val: o.val,
540
540
  adjs: o.adjs
541
541
  }, s), c = h.toString();
@@ -546,15 +546,15 @@ var Js, qs, $s, Ks, Gs = (e, t, s, r, i) => {
546
546
  definition: o
547
547
  };
548
548
  };
549
- function Xs(e, t, s, r) {
549
+ function ir(e, t, s, r) {
550
550
  let i = [];
551
551
  for (let o = 0; o < e.length; o++) {
552
552
  let n = [];
553
553
  i.push(n);
554
554
  const a = (i) => {
555
- for (let a = 0; a < i.length; a++) n.push(Gs(e[o], i[a], t, s, r));
555
+ for (let a = 0; a < i.length; a++) n.push(rr(e[o], i[a], t, s, r));
556
556
  };
557
- let l = new zt({
557
+ let l = new Qt({
558
558
  val: e[o].definition.val,
559
559
  adjs: e[o].definition.adjs
560
560
  }, t).toHSLA().lum;
@@ -592,45 +592,45 @@ function Xs(e, t, s, r) {
592
592
  }
593
593
  return i;
594
594
  }
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("./Lj98EH6coGdKUzuS.mjs").then(({ initializeFunctions: e }) => {
595
+ (Qs || (Qs = {})).buildPalette = ir, er || (er = {}), tr || (tr = {}), sr || (sr = {});
596
+ var or, nr = null;
597
+ function ar() {
598
+ if (!nr) {
599
+ const e = import("./DvtyKKzOnoOM80NB.mjs").then(({ initializeFunctions: e }) => {
600
600
  const t = e(() => null);
601
601
  return Object.freeze(Array.from(t.keys()));
602
602
  });
603
603
  e.catch(() => {
604
- Zs = null;
605
- }), Zs = e;
604
+ nr = null;
605
+ }), nr = e;
606
606
  }
607
- return Zs;
607
+ return nr;
608
608
  }
609
- function er(e) {
610
- return Z.peek()?.readFormulaLiteral(e);
609
+ function lr(e) {
610
+ return C.peek()?.readFormulaLiteral(e);
611
611
  }
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;
612
+ function hr(e, t) {
613
+ const s = cr(e), r = cr(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 : ds.isError(e) && ds.isError(t) ? e.getCode() - t.getCode() : 0;
615
615
  }
616
- function sr(e) {
616
+ function cr(e) {
617
617
  if (null === e) return 0;
618
618
  switch (typeof e) {
619
619
  case "number": return 1;
620
620
  case "string": return 2;
621
621
  case "boolean": return 3;
622
- default: return is.isError(e) ? 4 : 5;
622
+ default: return ds.isError(e) ? 4 : 5;
623
623
  }
624
624
  }
625
625
  (function(e) {
626
626
  function t(e) {
627
- return Z.peek()?.getFunctionDeclaration(e) ?? null;
627
+ return C.peek()?.getFunctionDeclaration(e) ?? null;
628
628
  }
629
629
  e.get = t, e.has = function(e) {
630
630
  return null !== t(e);
631
631
  };
632
- })(Ys || (Ys = {}));
633
- var rr = class {
632
+ })(or || (or = {}));
633
+ var ur = class {
634
634
  constructor(e) {
635
635
  this._children = e;
636
636
  }
@@ -678,19 +678,19 @@ var rr = class {
678
678
  const s = t[e].getSortedNumbers().getValues();
679
679
  s.length > 0 && r.push(s);
680
680
  }
681
- e = new it(function(e) {
681
+ e = new gt(function(e) {
682
682
  const t = e.length;
683
- if (0 === t) return ir;
683
+ if (0 === t) return dr;
684
684
  if (1 === t) return e[0];
685
685
  let s = e[0];
686
- for (let r = 1; r < t; r++) s = or(s, e[r]);
686
+ for (let r = 1; r < t; r++) s = gr(s, e[r]);
687
687
  return Object.freeze(s);
688
688
  }(r)), this._sortedNumbers = e;
689
689
  }
690
690
  return e;
691
691
  }
692
692
  getRanked(e) {
693
- return je(this._children, e, tr)[Symbol.iterator]();
693
+ return ze(this._children, e, hr)[Symbol.iterator]();
694
694
  }
695
695
  getFrequencies(e) {
696
696
  if (e) return this._mergeFrequencies(e);
@@ -698,7 +698,7 @@ var rr = class {
698
698
  return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
699
699
  }
700
700
  _mergeFrequencies(e) {
701
- const t = e?.keyFn ?? pt, s = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, o = i.length;
701
+ const t = e?.keyFn ?? Me, s = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, o = i.length;
702
702
  let n = 0, a = 0, l = !1;
703
703
  for (let h = 0; h < o; h++) {
704
704
  const o = i[h].getFrequencies(e);
@@ -713,22 +713,22 @@ var rr = class {
713
713
  }) : l = !0, u = c.next();
714
714
  }
715
715
  }
716
- return _.fromGroups(r, t, e, tr, n, a, l);
716
+ return je.fromGroups(r, t, e, hr, n, a, l);
717
717
  }
718
718
  getTypedCounts(e) {
719
719
  let t = this._typedCounts;
720
720
  if (!t) {
721
721
  const e = {
722
- [os.Number]: 0,
723
- [os.String]: 0,
724
- [os.Boolean]: 0,
725
- [os.Error]: 0,
726
- [os.RichData]: 0,
727
- [os.Null]: 0
722
+ [gs.Number]: 0,
723
+ [gs.String]: 0,
724
+ [gs.Boolean]: 0,
725
+ [gs.Error]: 0,
726
+ [gs.RichData]: 0,
727
+ [gs.Null]: 0
728
728
  }, s = this._children, r = s.length;
729
729
  for (let t = 0; t < r; t++) {
730
730
  const r = s[t].getTypedCounts();
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;
731
+ e[gs.Number] += r[gs.Number] ?? 0, e[gs.String] += r[gs.String] ?? 0, e[gs.Boolean] += r[gs.Boolean] ?? 0, e[gs.Error] += r[gs.Error] ?? 0, e[gs.RichData] += r[gs.RichData] ?? 0, e[gs.Null] += r[gs.Null] ?? 0;
732
732
  }
733
733
  t = Object.freeze(e), this._typedCounts = t;
734
734
  }
@@ -749,12 +749,12 @@ var rr = class {
749
749
  sum: 0,
750
750
  sumSq: 0,
751
751
  typed: {
752
- [os.Number]: 0,
753
- [os.String]: 0,
754
- [os.Boolean]: 0,
755
- [os.Error]: 0,
756
- [os.RichData]: 0,
757
- [os.Null]: 0
752
+ [gs.Number]: 0,
753
+ [gs.String]: 0,
754
+ [gs.Boolean]: 0,
755
+ [gs.Error]: 0,
756
+ [gs.RichData]: 0,
757
+ [gs.Null]: 0
758
758
  }
759
759
  };
760
760
  for (let i = 0; i < s; i++) {
@@ -763,10 +763,10 @@ var rr = class {
763
763
  const o = s.numericalCount;
764
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));
765
765
  }
766
- return Ce(r);
766
+ return ve(r);
767
767
  }
768
- }, ir = Object.freeze([]);
769
- function or(e, t) {
768
+ }, dr = Object.freeze([]);
769
+ function gr(e, t) {
770
770
  const s = e.length, r = t.length, i = new Array(s + r);
771
771
  let o = 0, n = 0, a = 0;
772
772
  for (; o < s && n < r;) i[a++] = e[o] <= t[n] ? e[o++] : t[n++];
@@ -774,45 +774,150 @@ function or(e, t) {
774
774
  for (; n < r;) i[a++] = t[n++];
775
775
  return i;
776
776
  }
777
- var nr, ar = class {
777
+ var mr, fr = class e {
778
778
  constructor(e, t) {
779
- this._source = null, this.cacheId = e, this.part = t;
780
- }
781
- _hold(e) {
782
- const t = this.part?.xml;
783
- if (!t || this._source) return;
784
- const s = o(t, "worksheetSource", "ref"), r = o(t, "worksheetSource", "sheet");
785
- if (!s || !r || s.includes("#REF!")) return;
786
- const i = e(r);
787
- if (!i) return;
788
- const n = {
779
+ this._source = null, this._fresh = /* @__PURE__ */ new WeakSet(), this._unwatch = null, this.cacheId = e, this._store = t, this._fresh.add(t.get());
780
+ }
781
+ static dataOf(t, s) {
782
+ const r = e.modelOf(t);
783
+ return {
784
+ part: nt.fromJSON(t.part, s),
785
+ model: r,
786
+ partFormats: !r && t.partFormats ? t.partFormats : null,
787
+ source: !r && t.source ? t.source : null
788
+ };
789
+ }
790
+ static modelOf(e) {
791
+ if (!e.fields) return null;
792
+ const { cacheId: t, part: s, partFormats: r, ...i } = e;
793
+ return i;
794
+ }
795
+ get part() {
796
+ return this._store.get().part;
797
+ }
798
+ get _model() {
799
+ return this._store.get().model;
800
+ }
801
+ _getData() {
802
+ return this._store.get();
803
+ }
804
+ _replace(e) {
805
+ const t = {
806
+ part: null,
807
+ model: e,
808
+ partFormats: null,
809
+ source: null
810
+ };
811
+ this._store.set(t), this._fresh.add(t);
812
+ }
813
+ _restate(e) {
814
+ const t = this._fresh.has(this._store.get()), s = {
815
+ part: null,
816
+ model: e,
817
+ partFormats: null,
818
+ source: null
819
+ };
820
+ this._store.set(s), t && this._fresh.add(s);
821
+ }
822
+ _hold(e, t) {
823
+ if (this._source) return;
824
+ const { ref: s, sheet: r, name: i } = this._sourceAsRead() ?? {};
825
+ let o = null, n = null;
826
+ if (s && r && !s.includes("#REF!") ? (o = e(r), n = `${$e(r)}!${E(s)}`) : !i || s || r ? i && r && !s && (o = e(r), n = `${$e(r)}!${i}`) : (o = t(i), n = `${i}[#All]`), !o || !n) return;
827
+ const a = {
789
828
  formula: null,
790
829
  wired: null,
791
830
  last: null
792
831
  };
793
- this._source = n, i(`${Pe(r)}!${te(s)}`, (e) => {
794
- n.formula = e.formula;
832
+ this._source = a, o(n, (e) => {
833
+ a.formula = e.formula;
795
834
  const t = e.formula.getExpression();
796
- n.wired ??= t, e.formula.hasRefError() || (n.last = t);
835
+ a.wired ??= t, e.formula.hasRefError() || (a.last = t);
797
836
  });
798
837
  }
799
- getXML() {
800
- const e = this.part?.xml ?? null, t = this._source;
801
- if (!e || !t?.formula) return e;
802
- const s = t.formula.hasRefError() ? t.last : t.formula.getExpression();
803
- if (null === s || s === t.wired) return e;
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));
838
+ _sourceAsRead() {
839
+ const e = this._model?.source ?? this._store.get().source;
840
+ return e ? {
841
+ ref: e.ref ?? null,
842
+ sheet: e.sheet ?? null,
843
+ name: e.name ?? null
844
+ } : null;
845
+ }
846
+ _watchSource(e, t, s) {
847
+ if (this._unwatch) return;
848
+ const { ref: r, sheet: i, name: o } = this._sourceAsRead() ?? {};
849
+ let n = null, a = null;
850
+ if (r && i && !r.includes("#REF!") ? a = e(i, r) : o && !r && (n = i ? null : t(o), a = n?.getRange() ?? s(o, i ?? null)), !a || a.isInvalid()) return;
851
+ const l = (e) => `${e.getRowCount()}x${e.getColumnCount()}`;
852
+ let h = l(a);
853
+ const c = [], u = () => {
854
+ this._fresh = /* @__PURE__ */ new WeakSet();
855
+ }, d = (e) => {
856
+ const t = h;
857
+ return h = l(e), h !== t;
858
+ };
859
+ c.push(a.addListener((e) => {
860
+ if ("data" === e.getTrigger()) return void (null !== e.getCommit() && u());
861
+ const t = e.getSource();
862
+ (t.isInvalid() || d(t)) && u();
863
+ }, { transactional: !1 })), n && c.push(a.getWorksheet().addListeners({ onTablesChange: () => {
864
+ !n.isDeleted() && d(n.getRange()) && u();
865
+ } })), this._unwatch = () => {
866
+ this._unwatch = null;
867
+ for (const e of c) e();
868
+ };
869
+ }
870
+ _isStale() {
871
+ return !this._fresh.has(this._store.get());
872
+ }
873
+ _moved() {
874
+ const e = this._source;
875
+ if (!e?.formula) return null;
876
+ const t = e.formula.hasRefError() ? e.last : e.formula.getExpression();
877
+ if (null === t || t === e.wired) return null;
878
+ const s = this._sourceAsRead();
879
+ if (s?.name && s.sheet) {
880
+ const e = p(t)?.sheet;
881
+ return e ? { sheet: e } : null;
882
+ }
883
+ const r = /^(.+)\[#All\]$/.exec(t)?.[1];
884
+ if (r) return { name: r };
885
+ const i = p(t);
886
+ return i ? {
887
+ name: null,
888
+ ref: ue(i.reference),
889
+ sheet: i.sheet
890
+ } : { ref: ue(t) };
891
+ }
892
+ _getSource() {
893
+ const e = this._sourceAsRead();
894
+ if (!e) return null;
895
+ const t = {};
896
+ e.ref && (t.ref = e.ref), e.sheet && (t.sheet = e.sheet), e.name && (t.name = e.name);
897
+ const s = this._moved();
898
+ if (s) for (const e of [
899
+ "ref",
900
+ "sheet",
901
+ "name"
902
+ ]) {
903
+ const r = s[e];
904
+ null === r ? delete t[e] : void 0 !== r && (t[e] = r);
905
+ }
906
+ return t;
806
907
  }
807
908
  toJSON(e) {
808
- const t = { cacheId: this.cacheId }, s = Ze.toJSON(this.part, e);
909
+ const t = { cacheId: this.cacheId }, s = nt.toJSON(this.part, e);
809
910
  if (s) {
810
- const e = this.getXML();
811
- null !== e && (s.xml = e), t.part = s;
911
+ t.part = s;
912
+ const e = this._store.get().partFormats;
913
+ e && (t.partFormats = e);
812
914
  }
813
- return t;
915
+ const r = this._model;
916
+ r && Object.assign(t, r);
917
+ const i = this._getSource();
918
+ return i && (t.source = i), t;
814
919
  }
815
- }, lr = class {
920
+ }, _r = class {
816
921
  constructor(e, t) {
817
922
  this._deleted = !1, this._json = { ...e }, this._deleteFromCollection = t ?? null;
818
923
  }
@@ -846,7 +951,7 @@ var nr, ar = class {
846
951
  get isIPerson() {
847
952
  return !0;
848
953
  }
849
- }, hr = class extends Ne {
954
+ }, pr = class extends He {
850
955
  constructor(e) {
851
956
  super(), this._byId = /* @__PURE__ */ new Map(), this._byDisplayName = /* @__PURE__ */ new Map(), this._items = null, this._current = null, e && this.fromJSON(e);
852
957
  }
@@ -867,10 +972,10 @@ var nr, ar = class {
867
972
  const e = this._byDisplayName.get(r);
868
973
  if (e) return e;
869
974
  }
870
- const i = new lr({
975
+ const i = new _r({
871
976
  ...t,
872
977
  displayName: r,
873
- id: s ?? as.uuidV4().toUpperCase()
978
+ id: s ?? fs.uuidV4().toUpperCase()
874
979
  }, (e) => this._remove(e));
875
980
  return this._byId.set(i.getId(), i), r && !this._byDisplayName.has(r) && this._byDisplayName.set(r, i), this._items = null, this._notifyCollectionChange(), i;
876
981
  }
@@ -910,7 +1015,7 @@ var nr, ar = class {
910
1015
  get isIPersonCollection() {
911
1016
  return !0;
912
1017
  }
913
- }, cr = (e, t) => {
1018
+ }, wr = (e, t) => {
914
1019
  const s = [0];
915
1020
  for (let t = 0; t < e.length; t++) "\n" === e[t] && s.push(t + 1);
916
1021
  const r = t.map((e) => ` ${((e) => {
@@ -922,7 +1027,7 @@ var nr, ar = class {
922
1027
  return `${t + 1}:${e - s[t] + 1}`;
923
1028
  })(e.start)} ${e.code}: ${e.message}`), i = t.length;
924
1029
  return `Script has ${i} compile error${1 === i ? "" : "s"}:\n${r.join("\n")}`;
925
- }, ur = class {
1030
+ }, yr = class {
926
1031
  constructor(t) {
927
1032
  this._options = t, this._emitter = new e(this), this._initState();
928
1033
  }
@@ -933,12 +1038,12 @@ var nr, ar = class {
933
1038
  _builtInNames() {
934
1039
  try {
935
1040
  const e = this._options.getBuiltInFunctions?.();
936
- if (!e) return as.EmptyArray;
1041
+ if (!e) return fs.EmptyArray;
937
1042
  const t = [];
938
1043
  for (const s of e.getItems({ includeHidden: !0 })) s.isBuiltIn() && t.push(s.getName());
939
1044
  return t;
940
1045
  } catch {
941
- return as.EmptyArray;
1046
+ return fs.EmptyArray;
942
1047
  }
943
1048
  }
944
1049
  async createModule(e) {
@@ -947,16 +1052,17 @@ var nr, ar = class {
947
1052
  minify: !0,
948
1053
  ...e
949
1054
  });
950
- return t.module ? await Ke(Fe.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
1055
+ return t.module ? await Se(Pe.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
951
1056
  }
952
1057
  addModule(e, t, s) {
953
1058
  this._modules.add(e, t, s);
954
1059
  }
955
1060
  async addModuleFromJSON(e, t, s) {
956
- const r = await Ke(e, t);
1061
+ const r = await Se(e, t);
957
1062
  return this.addModule(e, r, s), r;
958
1063
  }
959
- executeMacro(e, t, s) {
1064
+ async executeMacro(e, t, s) {
1065
+ await Re.assertUsable("scripts");
960
1066
  const r = this._modules.getItems({ name: t }), i = r.length;
961
1067
  for (let t = 0; t < i; t++) {
962
1068
  const i = r[t].getFunctions().getByName(e);
@@ -969,7 +1075,8 @@ var nr, ar = class {
969
1075
  }
970
1076
  async run(e, t) {
971
1077
  try {
972
- const s = "string" == typeof e ? await this.createModule({ source: e }) : await Ke(Fe.DEFAULT_MODULE, e), r = "string" == typeof e ? e : e?.source ?? "";
1078
+ await Re.assertUsable("scripts");
1079
+ const s = "string" == typeof e ? await this.createModule({ source: e }) : await Se(Pe.DEFAULT_MODULE, e), r = "string" == typeof e ? e : e?.source ?? "";
973
1080
  return await this._runModule(s, r, t);
974
1081
  } catch (e) {
975
1082
  return {
@@ -986,7 +1093,7 @@ var nr, ar = class {
986
1093
  };
987
1094
  const i = e.getDiagnostics(), o = i.filter((e) => "error" === e.severity);
988
1095
  if (o.length > 0) {
989
- const e = new Error(cr(t, o));
1096
+ const e = new Error(wr(t, o));
990
1097
  return e.diagnostics = o, {
991
1098
  ok: !1,
992
1099
  error: e,
@@ -1014,12 +1121,12 @@ var nr, ar = class {
1014
1121
  }
1015
1122
  _searchable(e) {
1016
1123
  const t = this._modules;
1017
- return t && 0 !== t.getCount() ? (e ? t.getItems({ name: e }) : t.getItems()).map((e) => e.getFunctions()) : as.EmptyArray;
1124
+ return t && 0 !== t.getCount() ? (e ? t.getItems({ name: e }) : t.getItems()).map((e) => e.getFunctions()) : fs.EmptyArray;
1018
1125
  }
1019
1126
  async searchFunctions(e) {
1020
1127
  await this._emitter.notify("onBeforeSearch", { async: !0 });
1021
1128
  const t = this._searchable(e?.moduleName);
1022
- if (0 === t.length) return as.EmptyArray;
1129
+ if (0 === t.length) return fs.EmptyArray;
1023
1130
  if (1 === t.length) return t[0].search(e);
1024
1131
  const s = e?.limit, r = void 0 === s ? e : {
1025
1132
  ...e,
@@ -1037,9 +1144,9 @@ var nr, ar = class {
1037
1144
  }
1038
1145
  }
1039
1146
  }
1040
- if (!i || 0 === i.length) return as.EmptyArray;
1041
- const n = e?.text ? e.text.trim().toUpperCase() : null;
1042
- return n ? Ae(i, n) : i.sort((e, t) => {
1147
+ if (!i || 0 === i.length) return fs.EmptyArray;
1148
+ const a = e?.text ? e.text.trim().toUpperCase() : null;
1149
+ return a ? n(i, a) : i.sort((e, t) => {
1043
1150
  const s = e.getName().toUpperCase(), r = t.getName().toUpperCase();
1044
1151
  return s < r ? -1 : s > r ? 1 : 0;
1045
1152
  }), void 0 !== s && i.length > s ? i.slice(0, s) : i;
@@ -1066,7 +1173,7 @@ var nr, ar = class {
1066
1173
  }), r = t.length;
1067
1174
  for (let s = 0; s < r; s++) await t[s].execute(e);
1068
1175
  } catch (e) {
1069
- ms.error("Error executing autoRun script:", e);
1176
+ ks.error("Error executing autoRun script:", e);
1070
1177
  }
1071
1178
  }
1072
1179
  }
@@ -1078,13 +1185,13 @@ var nr, ar = class {
1078
1185
  for (let i = 0; i < r.length; i++) {
1079
1186
  const o = r[i], n = t[o];
1080
1187
  try {
1081
- s[o] = await Ke(o, n, !1, [], "workbook" === n?.scope ? e : null);
1188
+ s[o] = await Se(o, n, !1, [], "workbook" === n?.scope ? e : null);
1082
1189
  } catch (e) {
1083
- ms.error(`Could not load script '${o}'; it will be unavailable.`, e);
1190
+ ks.error(`Could not load script '${o}'; it will be unavailable.`, e);
1084
1191
  }
1085
1192
  }
1086
1193
  }
1087
- const r = this, i = new ce({
1194
+ const r = this, i = new ct({
1088
1195
  transactions: this._options?.transactions,
1089
1196
  initial: s,
1090
1197
  isReadOnly: () => r.isReadOnly(),
@@ -1112,10 +1219,10 @@ var nr, ar = class {
1112
1219
  get isIScript() {
1113
1220
  return !0;
1114
1221
  }
1115
- }, dr = /^([a-z][a-z0-9+.-]*):/i, gr = (e) => {
1222
+ }, Sr = /^([a-z][a-z0-9+.-]*):/i, br = (e) => {
1116
1223
  const t = e.toLowerCase();
1117
1224
  return t.endsWith(":") ? t : t + ":";
1118
- }, mr = async (e, t) => {
1225
+ }, kr = async (e, t) => {
1119
1226
  try {
1120
1227
  return await globalThis.fetch(e, t);
1121
1228
  } catch (s) {
@@ -1134,15 +1241,15 @@ var nr, ar = class {
1134
1241
  } finally {
1135
1242
  clearTimeout(i), r.abort();
1136
1243
  }
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 });
1244
+ })(e, t)) throw new ds.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
1245
  throw s;
1139
1246
  }
1140
- }, _r = class {
1247
+ }, Cr = class {
1141
1248
  constructor() {
1142
- this._handlers = /* @__PURE__ */ new Map([["http:", mr], ["https:", mr]]);
1249
+ this._handlers = /* @__PURE__ */ new Map([["http:", kr], ["https:", kr]]);
1143
1250
  }
1144
1251
  fetch(e, t) {
1145
- const s = dr.exec(e)?.[1], r = this._handlers.get(s ? gr(s) : "https:");
1252
+ const s = Sr.exec(e)?.[1], r = this._handlers.get(s ? br(s) : "https:");
1146
1253
  if (!r) return Promise.reject(/* @__PURE__ */ new TypeError(`No fetcher serves '${s}:'.`));
1147
1254
  try {
1148
1255
  return r(e, t);
@@ -1151,7 +1258,7 @@ var nr, ar = class {
1151
1258
  }
1152
1259
  }
1153
1260
  register(e, t) {
1154
- const s = gr(e), r = this._handlers.get(s);
1261
+ const s = br(e), r = this._handlers.get(s);
1155
1262
  return this._handlers.set(s, t), () => {
1156
1263
  this._handlers.get(s) === t && (r ? this._handlers.set(s, r) : this._handlers.delete(s));
1157
1264
  };
@@ -1159,17 +1266,17 @@ var nr, ar = class {
1159
1266
  get isIFetcher() {
1160
1267
  return !0;
1161
1268
  }
1162
- }, fr = /* @__PURE__ */ new Set([
1269
+ }, vr = /* @__PURE__ */ new Set([
1163
1270
  101,
1164
1271
  103,
1165
1272
  204,
1166
1273
  205,
1167
1274
  304
1168
- ]), pr = (e) => new Response(fr.has(e.status) ? null : e.body, {
1275
+ ]), Ir = (e) => new Response(vr.has(e.status) ? null : e.body, {
1169
1276
  status: e.status,
1170
1277
  statusText: e.statusText,
1171
1278
  headers: e.headers
1172
- }), wr = class {
1279
+ }), Rr = class {
1173
1280
  constructor(e, t) {
1174
1281
  this._kept = /* @__PURE__ */ new Map(), this._cached = /* @__PURE__ */ new Map(), this._inFlight = /* @__PURE__ */ new Map(), this._resources = e, this._fetcher = t;
1175
1282
  }
@@ -1181,19 +1288,19 @@ var nr, ar = class {
1181
1288
  const s = this._kept.get(e) ?? this._findHeld(e);
1182
1289
  if (s && !s.isClosed()) return this._fromKept(s);
1183
1290
  const r = this._cached.get(e);
1184
- if (r) return pr(r);
1291
+ if (r) return Ir(r);
1185
1292
  let i = this._inFlight.get(e);
1186
1293
  return i || (i = this._request(e, {
1187
1294
  ...t,
1188
1295
  signal: void 0
1189
1296
  }).finally(() => {
1190
1297
  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) => {
1298
+ }), this._inFlight.set(e, i)), Ir(await ((e, t) => t ? t.aborted ? Promise.reject(t.reason) : new Promise((s, r) => {
1192
1299
  const i = () => r(t.reason);
1193
1300
  t.addEventListener("abort", i, { once: !0 }), e.then(s, r).finally(() => t.removeEventListener("abort", i));
1194
1301
  }) : e)(i, t?.signal));
1195
1302
  }
1196
- return pr(await this._request(e, t));
1303
+ return Ir(await this._request(e, t));
1197
1304
  }
1198
1305
  adopt(e) {
1199
1306
  for (const t of e) {
@@ -1211,7 +1318,7 @@ var nr, ar = class {
1211
1318
  }
1212
1319
  async _fromKept(e) {
1213
1320
  const [t, s] = await Promise.all([e.toBuffer(), e.getType()]);
1214
- return pr({
1321
+ return Ir({
1215
1322
  status: 200,
1216
1323
  statusText: "OK",
1217
1324
  headers: s ? [["content-type", s.mime]] : [],
@@ -1219,7 +1326,7 @@ var nr, ar = class {
1219
1326
  });
1220
1327
  }
1221
1328
  async _request(e, t) {
1222
- const s = await this._fetcher.fetch(e, t), r = fr.has(s.status) ? null : await s.arrayBuffer(), i = [];
1329
+ const s = await this._fetcher.fetch(e, t), r = vr.has(s.status) ? null : await s.arrayBuffer(), i = [];
1223
1330
  s.headers.forEach((e, t) => {
1224
1331
  i.push([t, e]);
1225
1332
  });
@@ -1230,14 +1337,14 @@ var nr, ar = class {
1230
1337
  body: r
1231
1338
  };
1232
1339
  if (s.ok && r && r.byteLength > 0) {
1233
- const t = await new I({ source: { buffer: r } }).getType();
1340
+ const t = await new y({ source: { buffer: r } }).getType();
1234
1341
  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
1342
  }
1236
1343
  return o;
1237
1344
  }
1238
- }, yr = class {
1345
+ }, Nr = class {
1239
1346
  constructor(e, t, s, r) {
1240
- this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = s, this._topLeft = t ?? ls.EmptyCell, this._sheet = new le({
1347
+ this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = s, this._topLeft = t ?? _s.EmptyCell, this._sheet = new se({
1241
1348
  runtime: e,
1242
1349
  styles: this._styles,
1243
1350
  calcOnLoad: "none",
@@ -1259,40 +1366,40 @@ var nr, ar = class {
1259
1366
  e.includes(r) && delete i[r];
1260
1367
  }
1261
1368
  }
1262
- const o = Pt(i.fontFamily);
1369
+ const o = Ut(i.fontFamily);
1263
1370
  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;
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);
1371
+ const n = Bt(i.textDecoration);
1372
+ r.font.underline = n.underline, r.font.strike = n.strike ? Pt.StrikeStyle.Single : Pt.StrikeStyle.None, i.textUnderlineStyle && (r.font.underline = Jt(i.textUnderlineStyle)), r.alignment = {}, i?.textAlign && (r.alignment.horizontal = hs(i.textAlign)), i?.textAlign && !r.alignment.horizontal && "general" !== i?.textAlign && ("center-across" === i.textAlign ? r.alignment.horizontal = ns.HorizontalAlignment.CenterContinuous : "fill" === i.textAlign ? r.alignment.horizontal = ns.HorizontalAlignment.Fill : "121" === i.textAlign || "010" === i.textAlign ? (r.alignment.horizontal = ns.HorizontalAlignment.Distributed, r.alignment.justifyLastLine = "121" === i.textAlign) : console.warn("unknown text-align", i.textAlign)), i.verticalAlign && ("super" === i.verticalAlign.toLowerCase() ? r.font.baseline = zt.Baseline.Superscript : "sub" === i.verticalAlign.toLowerCase() ? r.font.baseline = zt.Baseline.Subscript : r.alignment.vertical = Dt(i.verticalAlign), r.alignment.vertical || ("121" === i.verticalAlign ? r.alignment.vertical = ns.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 ? ns.Overflow.Visible : ns.Overflow.Wrap), "shrinktofit" === i.msoTextControl && (r.alignment.overflow = ns.Overflow.Shrink);
1266
1373
  let a = null;
1267
1374
  if (i.background ? a = i.background : i.backgroundColor && (a = i.backgroundColor), a && (r.fill = { color: a }), i.msoPattern) {
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));
1375
+ let e = jt(i.msoPattern);
1376
+ e && (e.patternType === ls.BuiltInSheetPattern.Solid ? r.fill = { color: e.foreground } : e.patternType !== ls.BuiltInSheetPattern.None && (a && (e.background = a), r.fill = e));
1270
1377
  }
1271
- "vertical" === i.layoutFlow || "vertical-ideographic" === i.layoutFlow ? r.alignment.stacked = !0 : void 0 !== i.msoRotate && (r.alignment.rotation = Vt(i.msoRotate));
1378
+ "vertical" === i.layoutFlow || "vertical-ideographic" === i.layoutFlow ? r.alignment.stacked = !0 : void 0 !== i.msoRotate && (r.alignment.rotation = $t(i.msoRotate));
1272
1379
  const l = (e, t) => {
1273
1380
  e && (r.borders || (r.borders = {}), r.borders[e] = t);
1274
1381
  };
1275
1382
  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);
1276
1383
  let h = r.numberFormat;
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;
1384
+ i.msoNumberFormat && (h = Xt(i.msoNumberFormat), h.includes("\\") ? h = null : "Fixed" === h ? h = rs.Styles.lookupStyle(r.numberFormat).formatType === rs.Type.Number ? null : rs.Type.Number : "Percent" === h && (h = rs.Styles.lookupStyle(r.numberFormat).formatType === rs.Type.Percentage ? null : rs.Type.Percentage)), h && (r.numberFormat = h), e.style = this._styles.normalize(r), s && 0 === Object.keys(e.style).length && delete e.style;
1278
1385
  }
1279
1386
  onCell(e, t, s, r, i) {
1280
1387
  const o = r(i);
1281
1388
  let n = { value: void 0 !== t ? t : s ?? "" };
1282
1389
  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)) {
1283
1390
  const e = n.style?.numberFormat;
1284
- e && (es(e) || Tt(e)) && (n.value = is.BuiltIn.Num);
1391
+ e && (Mt(e) || Wt(e)) && (n.value = ds.BuiltIn.Num);
1285
1392
  }
1286
1393
  if ("TD" === i?.tagName.toUpperCase()) {
1287
1394
  let e = n.style, t = e?.font ?? {};
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));
1395
+ (i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = Pt.StrikeStyle.Single), i.querySelectorAll("sub").length > 0 && (t.baseline = zt.Baseline.Subscript), i.querySelectorAll("sup").length > 0 && (t.baseline = zt.Baseline.Superscript), (i.querySelectorAll("b").length > 0 || i.querySelectorAll("strong").length > 0) && (t.weight = 700), i.querySelectorAll("i").length > 0 && (t.style = Pt.Style.Italic), i.querySelectorAll("u").length > 0 && (t.underline = Pt.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, n.style = e), e.font || (e.font = t));
1289
1396
  const s = i.querySelectorAll("a");
1290
1397
  if (s.length > 0) {
1291
1398
  const e = s[0].getAttribute("href");
1292
1399
  e && (n.hyperlink = e);
1293
1400
  }
1294
1401
  }
1295
- if (!ls.isSingleCell(e)) {
1402
+ if (!_s.isSingleCell(e)) {
1296
1403
  const t = {
1297
1404
  rowStart: this._topLeft.rowIndex + e.rowStart,
1298
1405
  colStart: this._topLeft.colIndex + e.colStart,
@@ -1303,7 +1410,7 @@ var nr, ar = class {
1303
1410
  }
1304
1411
  if (void 0 === n.value && !n.style && Object.keys(n).length <= 1) return;
1305
1412
  const a = this._builder, l = this._topLeft;
1306
- if (a.pushAt(l.rowIndex + e.rowStart, l.colIndex + e.colStart, n), !ls.isSingleCell(e) && o.msoIgnore) {
1413
+ if (a.pushAt(l.rowIndex + e.rowStart, l.colIndex + e.colStart, n), !_s.isSingleCell(e) && o.msoIgnore) {
1307
1414
  if (o.msoIgnore.includes("colspan")) {
1308
1415
  const t = {};
1309
1416
  o && this.applyCSSStyle(t, o);
@@ -1333,9 +1440,9 @@ var nr, ar = class {
1333
1440
  if ("userset" !== i.msoHeightSource) return;
1334
1441
  if (!r) return;
1335
1442
  let o = r.getAttribute("height") ?? i.height, n = null;
1336
- if (o && (n = Wt(o, this._styles.getNormal().getFont().getSize(), "px")), null === n) for (let e = 0; e < r.cells.length; e++) {
1443
+ if (o && (n = qt(o, this._styles.getNormal().getFont().getSize(), "px")), null === n) for (let e = 0; e < r.cells.length; e++) {
1337
1444
  const t = r.cells[e], i = t.getAttribute("height") ?? s(t).height;
1338
- let o = Wt(i, this._styles.getNormal().getFont().getSize(), "px");
1445
+ let o = qt(i, this._styles.getNormal().getFont().getSize(), "px");
1339
1446
  null !== o && (n = Math.max(o, n ?? 0));
1340
1447
  }
1341
1448
  null !== n && this._rowsReading.push({
@@ -1343,7 +1450,7 @@ var nr, ar = class {
1343
1450
  min: this._topLeft.rowIndex + e,
1344
1451
  max: this._topLeft.rowIndex + e + t - 1
1345
1452
  },
1346
- update: { size: n * Bt.getDeviceScale() }
1453
+ update: { size: n * Pt.getDeviceScale() }
1347
1454
  });
1348
1455
  }
1349
1456
  onColumn(e, t, s, r) {
@@ -1351,12 +1458,12 @@ var nr, ar = class {
1351
1458
  if ("userset" !== i.msoWidthSource) return;
1352
1459
  if (!r) return;
1353
1460
  let o = r.getAttribute("width") ?? i.width, n = null;
1354
- o && (n = Wt(o, this._styles.getNormal().getFont().getSize(), "px")), null !== n && this._colsReading.push({
1461
+ o && (n = qt(o, this._styles.getNormal().getFont().getSize(), "px")), null !== n && this._colsReading.push({
1355
1462
  address: {
1356
1463
  min: this._topLeft.colIndex + e,
1357
1464
  max: this._topLeft.colIndex + e + t - 1
1358
1465
  },
1359
- update: { size: n * Bt.getDeviceScale() }
1466
+ update: { size: n * Pt.getDeviceScale() }
1360
1467
  });
1361
1468
  }
1362
1469
  onDone() {
@@ -1367,9 +1474,9 @@ var nr, ar = class {
1367
1474
  sheet() {
1368
1475
  return this._sheet;
1369
1476
  }
1370
- }, br = class {
1477
+ }, Or = class {
1371
1478
  constructor(e) {
1372
- if (!e) throw new _s("snapshot is required.");
1479
+ if (!e) throw new Cs("snapshot is required.");
1373
1480
  this._snapshot = e;
1374
1481
  }
1375
1482
  getItemType() {
@@ -1399,10 +1506,10 @@ var nr, ar = class {
1399
1506
  get isClipboardItem() {
1400
1507
  return !0;
1401
1508
  }
1402
- }, Sr = class {
1509
+ }, xr = class {
1403
1510
  constructor(e, t, s, r, i) {
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;
1511
+ if (this._parsed = void 0, this._runtime = e, !t) throw new Cs("nativeItems are required.");
1512
+ this._topLeft = s ?? _s.EmptyCell, this._native = t, this._markOptions = Object.freeze(r ?? {}), this._styles = i;
1406
1513
  }
1407
1514
  getItemType() {
1408
1515
  return "range";
@@ -1447,14 +1554,14 @@ var nr, ar = class {
1447
1554
  async parse() {
1448
1555
  let e, t = this._native?.text, s = this._native.html;
1449
1556
  if (null === s && t && t.includes("<table")) try {
1450
- const e = new DOMParser().parseFromString(t, gs.Html), r = e.querySelector("parsererror");
1451
- if (r) throw new cs("Unable to parse: " + r);
1557
+ const e = new DOMParser().parseFromString(t, bs.Html), r = e.querySelector("parsererror");
1558
+ if (r) throw new ws("Unable to parse: " + r);
1452
1559
  s = e, t = null;
1453
1560
  } catch (e) {
1454
1561
  console.warn("Discovered text as html table but could could not parse.");
1455
1562
  }
1456
1563
  try {
1457
- const r = new yr(this._runtime, this._topLeft, this._styles, s ? "HTML" : "Text"), i = await Promise.resolve(t ? B(t) : [[]]);
1564
+ const r = new Nr(this._runtime, this._topLeft, this._styles, s ? "HTML" : "Text"), i = await Promise.resolve(t ? F(t) : [[]]);
1458
1565
  let o;
1459
1566
  if (L(s, i, r) ? (e = r.sheet(), o = e.getUsedRange()) : s = null, o) {
1460
1567
  const t = o.getSnapshot();
@@ -1470,7 +1577,7 @@ var nr, ar = class {
1470
1577
  throw e;
1471
1578
  }
1472
1579
  if (!t && !s && this._native.image) {
1473
- const e = await this._native.image.arrayBuffer(), t = us.getPngStatedSize(e);
1580
+ const e = await this._native.image.arrayBuffer(), t = ys.getPngStatedSize(e);
1474
1581
  let s = null;
1475
1582
  return this._parsed = {
1476
1583
  async prepare(r) {
@@ -1479,7 +1586,7 @@ var nr, ar = class {
1479
1586
  sheet: i,
1480
1587
  options: await i.getMovables()._preparePicture({ source: { buffer: e } }, {
1481
1588
  type: "picture",
1482
- description: bs("op.copyImageFromClipboard"),
1589
+ description: Os("op.copyImageFromClipboard"),
1483
1590
  autoSelect: !0,
1484
1591
  ...t && { bounds: t }
1485
1592
  })
@@ -1498,7 +1605,7 @@ var nr, ar = class {
1498
1605
  get isClipboardItem() {
1499
1606
  return !0;
1500
1607
  }
1501
- }, kr = class {
1608
+ }, Er = class {
1502
1609
  constructor(t) {
1503
1610
  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);
1504
1611
  }
@@ -1515,11 +1622,11 @@ var nr, ar = class {
1515
1622
  return this._assertOpen(), this._container.setName(e, t), this;
1516
1623
  }
1517
1624
  getVisibility() {
1518
- return this._closed ? mt.Visibility.VeryHidden : this._container.getVisibility();
1625
+ return this._closed ? St.Visibility.VeryHidden : this._container.getVisibility();
1519
1626
  }
1520
1627
  setVisibility(e = !0, t) {
1521
1628
  let s;
1522
- return this._assertOpen(), s = !0 === e ? mt.Visibility.Visible : !1 === e ? mt.Visibility.Hidden : e, this._container.setVisibility(s, t), this;
1629
+ return this._assertOpen(), s = !0 === e ? St.Visibility.Visible : !1 === e ? St.Visibility.Hidden : e, this._container.setVisibility(s, t), this;
1523
1630
  }
1524
1631
  getIndex() {
1525
1632
  return this._container.getIndex();
@@ -1541,12 +1648,12 @@ var nr, ar = class {
1541
1648
  }
1542
1649
  delete() {
1543
1650
  if (this._closed) return;
1544
- const e = this._transactions.beginCommit({ description: Ss("op.deleteSheet", { name: this.getName() }) });
1651
+ const e = this._transactions.beginCommit({ description: xs("op.deleteSheet", { name: this.getName() }) });
1545
1652
  try {
1546
1653
  try {
1547
1654
  this._notify("onBeforeDelete");
1548
1655
  } catch (e) {
1549
- throw e instanceof Error ? e : new cs(e?.message ?? Ss("error.sheet.modelDelete"));
1656
+ throw e instanceof Error ? e : new ws(e?.message ?? xs("error.sheet.modelDelete"));
1550
1657
  }
1551
1658
  this._notify("onDelete"), e.commit();
1552
1659
  } catch (t) {
@@ -1572,7 +1679,7 @@ var nr, ar = class {
1572
1679
  this._emitter.notify(e);
1573
1680
  }
1574
1681
  _assertOpen() {
1575
- if (this._closed) throw new Error(Ss("error.sheet.modelClosed"));
1682
+ if (this._closed) throw new Error(xs("error.sheet.modelClosed"));
1576
1683
  }
1577
1684
  get [Symbol.toStringTag]() {
1578
1685
  return "[OpaqueSheet]";
@@ -1587,12 +1694,12 @@ var nr, ar = class {
1587
1694
  return !0;
1588
1695
  }
1589
1696
  };
1590
- (nr || (nr = {})).Visibility = {
1697
+ (mr || (mr = {})).Visibility = {
1591
1698
  Visible: "visible",
1592
1699
  Hidden: "hidden",
1593
1700
  VeryHidden: "veryHidden"
1594
1701
  };
1595
- var Cr, vr = {
1702
+ var Vr, Lr = {
1596
1703
  showFormulaBar: !0,
1597
1704
  showTabs: !0,
1598
1705
  tabRatio: 600,
@@ -1603,11 +1710,11 @@ var Cr, vr = {
1603
1710
  firstTab: 0,
1604
1711
  windowBounds: null,
1605
1712
  minimized: !1,
1606
- visibility: nr.Visibility.Visible,
1713
+ visibility: mr.Visibility.Visible,
1607
1714
  autoFilterDateGrouping: !0
1608
- }, Ir = class {
1715
+ }, Ar = class {
1609
1716
  constructor(t) {
1610
- this._id = as.uuidV4(), this._emitter = new e(this), this._state = { ...vr }, t?.json && this._fromJSON(t?.json);
1717
+ this._id = fs.uuidV4(), this._emitter = new e(this), this._state = { ...Lr }, t?.json && this._fromJSON(t?.json);
1611
1718
  }
1612
1719
  getId() {
1613
1720
  return this._id;
@@ -1696,7 +1803,7 @@ var Cr, vr = {
1696
1803
  const t = Object.keys(this._state), s = t.length;
1697
1804
  for (let r = 0; r < s; r++) {
1698
1805
  const s = t[r], i = this._state[s];
1699
- null != i && i !== vr[s] && (e[s] = i);
1806
+ null != i && i !== Lr[s] && (e[s] = i);
1700
1807
  }
1701
1808
  return 0 === Object.keys(e).length && (e = null), e;
1702
1809
  }
@@ -1706,7 +1813,7 @@ var Cr, vr = {
1706
1813
  }
1707
1814
  update(e, t = !0) {
1708
1815
  this._state = {
1709
- ...vr,
1816
+ ...Lr,
1710
1817
  ...this._state,
1711
1818
  ...e
1712
1819
  }, t && this._emitter.notify("onViewChange");
@@ -1721,13 +1828,13 @@ var Cr, vr = {
1721
1828
  get isIWorkbookView() {
1722
1829
  return !0;
1723
1830
  }
1724
- }, Nr = Object.freeze({
1831
+ }, Tr = Object.freeze({
1725
1832
  structure: !1,
1726
1833
  windows: !1,
1727
1834
  revision: !0,
1728
1835
  password: null,
1729
1836
  revisionsPassword: null
1730
- }), Or = class extends ie {
1837
+ }), Pr = class extends Xe {
1731
1838
  isWindowsAllowed() {
1732
1839
  return this._isPropertyAllowed("windows");
1733
1840
  }
@@ -1749,7 +1856,7 @@ var Cr, vr = {
1749
1856
  const s = Object.keys(t), r = s.length;
1750
1857
  for (let i = 0; i < r; i++) {
1751
1858
  const r = s[i], o = t[r];
1752
- null != o && o !== Nr[r] && (e[r] = o);
1859
+ null != o && o !== Tr[r] && (e[r] = o);
1753
1860
  }
1754
1861
  }
1755
1862
  return super._toJSON(e);
@@ -1761,38 +1868,38 @@ var Cr, vr = {
1761
1868
  return !0;
1762
1869
  }
1763
1870
  };
1764
- (Cr || (Cr = {})).Type = {
1871
+ (Vr || (Vr = {})).Type = {
1765
1872
  Number: "number",
1766
1873
  Boolean: "boolean",
1767
1874
  Date: "date",
1768
1875
  String: "string",
1769
1876
  Float: "float"
1770
1877
  };
1771
- var Rr = (e) => {
1878
+ var Fr = (e) => {
1772
1879
  if ("string" == typeof e) return {
1773
- type: Cr.Type.String,
1880
+ type: Vr.Type.String,
1774
1881
  value: e
1775
1882
  };
1776
1883
  if ("boolean" == typeof e) return {
1777
- type: Cr.Type.Boolean,
1884
+ type: Vr.Type.Boolean,
1778
1885
  value: e
1779
1886
  };
1780
1887
  if ("number" == typeof e) {
1781
1888
  if (!Number.isFinite(e)) throw new Error("A custom property value must be a finite number.");
1782
1889
  return {
1783
- type: Number.isInteger(e) && e >= -2147483648 && e <= 2147483647 ? Cr.Type.Number : Cr.Type.Float,
1890
+ type: Number.isInteger(e) && e >= -2147483648 && e <= 2147483647 ? Vr.Type.Number : Vr.Type.Float,
1784
1891
  value: e
1785
1892
  };
1786
1893
  }
1787
1894
  if (e instanceof Date) {
1788
1895
  if (isNaN(e.getTime())) throw new Error("A custom property value must be a valid date.");
1789
1896
  return {
1790
- type: Cr.Type.Date,
1897
+ type: Vr.Type.Date,
1791
1898
  value: e.toISOString()
1792
1899
  };
1793
1900
  }
1794
1901
  throw new Error("A custom property value must be a string, number, boolean or Date.");
1795
- }, xr = class {
1902
+ }, Br = class {
1796
1903
  constructor(e, t) {
1797
1904
  this._json = e, this._owner = t;
1798
1905
  }
@@ -1807,12 +1914,12 @@ var Rr = (e) => {
1807
1914
  }
1808
1915
  getValue() {
1809
1916
  const { type: e, value: t } = this._json;
1810
- return e === Cr.Type.Date ? new Date(t) : t;
1917
+ return e === Vr.Type.Date ? new Date(t) : t;
1811
1918
  }
1812
1919
  setValue(e) {
1813
1920
  this._owner._assertCustomEditable(this), this._json = {
1814
1921
  ...this._json,
1815
- ...Rr(e)
1922
+ ...Fr(e)
1816
1923
  };
1817
1924
  }
1818
1925
  delete() {
@@ -1821,7 +1928,7 @@ var Rr = (e) => {
1821
1928
  toJSON() {
1822
1929
  return { ...this._json };
1823
1930
  }
1824
- }, Er = class {
1931
+ }, Wr = class {
1825
1932
  constructor(e) {
1826
1933
  this._json = {}, this._custom = [], this._assertOpen = e;
1827
1934
  }
@@ -1911,9 +2018,9 @@ var Rr = (e) => {
1911
2018
  if (this._assertOpen(), "string" != typeof e || "" === e) throw new Error("A custom property needs a name.");
1912
2019
  const s = this.getCustomProperty(e);
1913
2020
  if (s) return s.setValue(t), s;
1914
- const r = new xr({
2021
+ const r = new Br({
1915
2022
  key: e,
1916
- ...Rr(t)
2023
+ ...Fr(t)
1917
2024
  }, this);
1918
2025
  return this._custom.push(r), r;
1919
2026
  }
@@ -1928,26 +2035,26 @@ var Rr = (e) => {
1928
2035
  }
1929
2036
  fromJSON(e) {
1930
2037
  const { custom: t, ...s } = e ?? {};
1931
- this._json = s, this._custom = (t ?? []).map((e) => new xr({ ...e }, this));
2038
+ this._json = s, this._custom = (t ?? []).map((e) => new Br({ ...e }, this));
1932
2039
  }
1933
2040
  toJSON() {
1934
2041
  const e = { ...this._json };
1935
2042
  return this._custom.length > 0 && (e.custom = this._custom.map((e) => e.toJSON())), e;
1936
2043
  }
1937
2044
  };
1938
- function Lr(e) {
1939
- return Ss("error.workbook.invalidSheetKey", { key: e });
2045
+ function Mr(e) {
2046
+ return xs("error.workbook.invalidSheetKey", { key: e });
1940
2047
  }
1941
- function Ar(e) {
1942
- return Ss("error.workbook.sheetNameNotFound", { sheetName: e });
2048
+ function Dr(e) {
2049
+ return xs("error.workbook.sheetNameNotFound", { sheetName: e });
1943
2050
  }
1944
- function Vr(e, t) {
1945
- return Ss("chart" === t ? "error.workbook.sheetIsChart" : "macro" === t ? "error.workbook.sheetIsMacro" : "error.workbook.sheetIsDialog", { sheetName: e });
2051
+ function jr(e, t) {
2052
+ return xs("chart" === t ? "error.workbook.sheetIsChart" : "macro" === t ? "error.workbook.sheetIsMacro" : "error.workbook.sheetIsDialog", { sheetName: e });
1946
2053
  }
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");
2054
+ function Hr(e, t) {
2055
+ return "chart" === t ? xs("error.workbook.selectedIsChart", { sheetName: e }) : "macro" === t ? xs("error.workbook.selectedIsMacro", { sheetName: e }) : "dialog" === t ? xs("error.workbook.selectedIsDialog", { sheetName: e }) : xs("error.workbook.noWorksheet");
1949
2056
  }
1950
- var Pr = class extends Ne {
2057
+ var zr = class extends He {
1951
2058
  constructor(e, t, s, r) {
1952
2059
  super(), this._add = e, this._get = t, this._addListeners = s, this._getSelected = r;
1953
2060
  }
@@ -1978,39 +2085,39 @@ var Pr = class extends Ne {
1978
2085
  get isIWorksheetCollection() {
1979
2086
  return !0;
1980
2087
  }
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 });
2088
+ }, $r = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), Ur = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
2089
+ function Jr(e) {
2090
+ const t = xs(Os("workbook.defaultSheetName"), { n: e + 1 });
1984
2091
  return "workbook.defaultSheetName" === t ? `Sheet${e + 1}` : t;
1985
2092
  }
1986
- function jr(e, t) {
2093
+ function qr(e, t) {
1987
2094
  return {
1988
- ...oe,
2095
+ ...Q,
1989
2096
  getWorksheet: () => null,
1990
- toString: () => ot(e, t)
2097
+ toString: () => _e(e, t)
1991
2098
  };
1992
2099
  }
1993
- function Mr(e, t = !1) {
1994
- if (!e) throw new Error(Ss("error.workbook.sheetNameBlank"));
1995
- if (Fr.test(e)) {
2100
+ function Kr(e, t = !1) {
2101
+ if (!e) throw new Error(xs("error.workbook.sheetNameBlank"));
2102
+ if ($r.test(e)) {
1996
2103
  if (!t) throw new Error(function(e) {
1997
- return e ? Ss("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : Ss("error.workbook.sheetNameInvalidChars");
2104
+ return e ? xs("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : xs("error.workbook.sheetNameInvalidChars");
1998
2105
  }(e));
1999
- e = e.replace(Fr, "");
2106
+ e = e.replace($r, "");
2000
2107
  }
2001
- if (0 === e.length) throw new Error(Ss("error.workbook.sheetNameBlank"));
2108
+ if (0 === e.length) throw new Error(xs("error.workbook.sheetNameBlank"));
2002
2109
  const s = e.length;
2003
2110
  if (s > 31) {
2004
- if (!t) throw new Error(Ss("error.workbook.sheetNameTooLong"));
2111
+ if (!t) throw new Error(xs("error.workbook.sheetNameTooLong"));
2005
2112
  e = e.substring(0, 31);
2006
2113
  }
2007
2114
  if ("'" === e.charAt(0) || "'" === e.charAt(s - 1)) {
2008
- if (!t) throw new Error(Ss("error.workbook.sheetNameQuotes"));
2115
+ if (!t) throw new Error(xs("error.workbook.sheetNameQuotes"));
2009
2116
  e = e.replace(/^'|'$/g, "");
2010
2117
  }
2011
2118
  return e;
2012
2119
  }
2013
- var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2120
+ var Gr = "workbook.activeSheet", Zr = class e extends vt {
2014
2121
  constructor(e, t, s, r) {
2015
2122
  super(e, t, r), this._workbook = s;
2016
2123
  }
@@ -2021,24 +2128,24 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2021
2128
  let r = this._options;
2022
2129
  return s && (r = {
2023
2130
  ...this._options,
2024
- getOptions: yt(this._options?.getOptions, s)
2131
+ getOptions: Nt(this._options?.getOptions, s)
2025
2132
  }), new e(t, this._internal, this._workbook, r);
2026
2133
  }
2027
2134
  _createRange(e, t) {
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()));
2135
+ const s = e ? { ...e } : null, r = this._workbook, i = s ? r._getSheetRef(s.scope, St.Visibility.VeryHidden) : null;
2136
+ if (i && !i.sheet.isIWorksheet) throw new ws(jr(i.name, i.sheet.getKind()));
2030
2137
  if (!i) {
2031
2138
  const e = r._anchorWorksheet();
2032
- return delete s?.scope, jr(s, s ? {
2033
- scope: ye,
2139
+ return delete s?.scope, qr(s, s ? {
2140
+ scope: le,
2034
2141
  ...e.getEntireRange().getCoords()
2035
2142
  } : null);
2036
2143
  }
2037
2144
  let o = this._options;
2038
2145
  return t && (o = {
2039
2146
  ...this._options,
2040
- getOptions: yt(this._options.getOptions, t)
2041
- }), new Ur(e, Ie(i.sheet), this._workbook, o);
2147
+ getOptions: Nt(this._options.getOptions, t)
2148
+ }), new Xr(e, Ne(i.sheet), this._workbook, o);
2042
2149
  }
2043
2150
  async select(e) {
2044
2151
  const t = [];
@@ -2064,15 +2171,15 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2064
2171
  }
2065
2172
  getAddress(e) {
2066
2173
  const t = this._internal.getSheet(), s = t.getEntireRange().getCoords();
2067
- return ht(this.getCoords(), {
2174
+ return ut(this.getCoords(), {
2068
2175
  ...s,
2069
2176
  scope: t.getName()
2070
- }, ot, Le, e);
2177
+ }, _e, mt, e);
2071
2178
  }
2072
2179
  toString() {
2073
2180
  return this.getAddress();
2074
2181
  }
2075
- }, Ur = class e extends N {
2182
+ }, Xr = class e extends N {
2076
2183
  constructor(e, t, s, r) {
2077
2184
  super(e, t, r), this._workbook = s;
2078
2185
  }
@@ -2080,17 +2187,17 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2080
2187
  let s = this._options;
2081
2188
  return t && (s = {
2082
2189
  ...this._options,
2083
- getOptions: yt(this._options?.getOptions, t)
2084
- }), new Hr(e, this._internal, this._workbook, s);
2190
+ getOptions: Nt(this._options?.getOptions, t)
2191
+ }), new Zr(e, this._internal, this._workbook, s);
2085
2192
  }
2086
2193
  _createRange(t, s) {
2087
2194
  const r = this._internal;
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);
2195
+ if (!t) return Vt(r.getSheet(), r.getSheet().getEntireCoords());
2196
+ if (r.validateCoords(t), r.getSheet().isClosed()) return Vt(null, r.getSheet().getEntireCoords(), t);
2090
2197
  let i = this._options;
2091
2198
  return s && (i = {
2092
2199
  ...this._options,
2093
- getOptions: yt(this._options?.getOptions, s)
2200
+ getOptions: Nt(this._options?.getOptions, s)
2094
2201
  }), new e(t, this._internal, this._workbook, i);
2095
2202
  }
2096
2203
  addListener(e, t) {
@@ -2103,7 +2210,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2103
2210
  }
2104
2211
  getAddress(e) {
2105
2212
  const t = this._internal.getSheet(), s = t?.getEntireRange().getCoords() ?? null;
2106
- return ot(this.getCoords(), {
2213
+ return _e(this.getCoords(), {
2107
2214
  ...s,
2108
2215
  scope: t.getName()
2109
2216
  });
@@ -2111,15 +2218,15 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2111
2218
  toString() {
2112
2219
  return this.getAddress();
2113
2220
  }
2114
- }, Jr = (e) => !!e && "object" == typeof e && "function" == typeof e.getOrigin, qr = class {
2221
+ }, Yr = (e) => !!e && "object" == typeof e && "function" == typeof e.getOrigin, Qr = class {
2115
2222
  constructor(t) {
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(() => {
2223
+ 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 be(() => {
2117
2224
  const e = [];
2118
- for (const t of this.getWorksheets()) e.push(...t.getPivotTables());
2225
+ for (const t of this.getWorksheets().getItems({ visibility: St.Visibility.VeryHidden })) e.push(...t.getPivotTables());
2119
2226
  return e;
2120
- }), this._people = new hr(), this._commentCollection = new d(null, (e, t, s) => {
2227
+ }, (e, t) => this.doBatch(e, t)), this._people = new pr(), this._commentCollection = new g(null, (e, t, s) => {
2121
2228
  const r = [];
2122
- for (const i of this.getWorksheets()) r.push(...i.getComments().getItems(e ? {
2229
+ for (const i of this.getWorksheets().getItems({ visibility: St.Visibility.VeryHidden })) r.push(...i.getComments().getItems(e ? {
2123
2230
  address: e,
2124
2231
  ignoreHidden: t,
2125
2232
  fullyContained: s
@@ -2130,25 +2237,25 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2130
2237
  return r;
2131
2238
  }, (e, t) => this.addListeners({ onSheetsChange: e.onCollectionChange ? () => {
2132
2239
  e.onCollectionChange(this._commentCollection);
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"));
2240
+ } : void 0 }, t)), this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._hiddenPivotFieldList = !1, this._documentProperties = new Wr(() => {
2241
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2135
2242
  }), this._locale = null, this._localeOverrides = null, this._startModules = /* @__PURE__ */ new WeakSet();
2136
2243
  const s = "string" == typeof t ? { origin: t } : { ...t }, r = s.origin;
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() });
2244
+ this._ownOriginProvider = !Yr(r), this._originProvider = Yr(r) ? r : new Ds("string" == typeof r ? new Fs(null, { name: r }) : r ?? new Fs(null)), delete s.origin, this._bindOrigin(this._originProvider.getOrigin()), this._listenerOriginProvider = this._originProvider.addListeners({ onOriginChange: () => this._onOriginChange() });
2138
2245
  const o = s.json;
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", {
2246
+ 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 it("Workbook Runtime", {
2140
2247
  isDate1904: () => this._isDate1904,
2141
2248
  getNow: () => this._transactions.getCurrentCommit().getTimestamp(),
2142
- getLocale: () => this._locale ?? Ee() ?? ut(),
2249
+ getLocale: () => this._locale ?? Ue() ?? ft(),
2143
2250
  getLocaleOverrides: () => this._localeOverrides
2144
- }), this._listenerLanguage = hs.addChangeListener(() => {
2251
+ }), this._listenerLanguage = ps.addChangeListener(() => {
2145
2252
  this._closed || this._notifyAllChange();
2146
2253
  });
2147
- const n = this, a = this._beginCommit({ description: bs(o ? "op.openWorkbook" : "op.newWorkbook") });
2254
+ const n = this, a = this._beginCommit({ description: Os(o ? "op.openWorkbook" : "op.newWorkbook") });
2148
2255
  try {
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;
2256
+ this._strings = s.strings ?? new ie(), this._ownStrings = !s.strings, this._richValues = s.richData ?? new dt(), this._resources = s.resources ?? new k(), this._ownResources = !s.resources, this._fetch = new Rr(this._resources, s.fetcher ?? new Cr()), this._createSheetName = s.createSheetNameCallback ?? Jr;
2150
2257
  let e = s.createWorksheetCallback;
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) => {
2258
+ e || (e = (e) => new se(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) => {
2152
2259
  let h = null;
2153
2260
  const c = {
2154
2261
  runtime: n._runtime,
@@ -2169,7 +2276,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2169
2276
  h = e, n._addSheetRef({
2170
2277
  name: s,
2171
2278
  id: t,
2172
- visibility: r ?? mt.Visibility.Visible,
2279
+ visibility: r ?? St.Visibility.Visible,
2173
2280
  sheetId: o,
2174
2281
  sheet: e
2175
2282
  }, i);
@@ -2186,7 +2293,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2186
2293
  },
2187
2294
  getVisibility: () => {
2188
2295
  const e = n._getSheetRef(h);
2189
- return e ? e.visibility : mt.Visibility.Visible;
2296
+ return e ? e.visibility : St.Visibility.Visible;
2190
2297
  },
2191
2298
  setVisibility: (e, t) => {
2192
2299
  n._setSheetVisibility(h, e, t);
@@ -2197,10 +2304,10 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2197
2304
  duplicate: () => n._duplicateSheet(h),
2198
2305
  getIndex: () => {
2199
2306
  const e = n._getSheetRef(h);
2200
- return e ? n._getOffsetForId(e.id, n._getSheetRefs(mt.Visibility.VeryHidden)) : i;
2307
+ return e ? n._getOffsetForId(e.id, n._getSheetRefs(St.Visibility.VeryHidden)) : i;
2201
2308
  },
2202
2309
  setIndex: (e, t) => {
2203
- const s = n._getSheetRef(h, mt.Visibility.VeryHidden);
2310
+ const s = n._getSheetRef(h, St.Visibility.VeryHidden);
2204
2311
  return !!s && (n._moveSheet(s, e, t), !0);
2205
2312
  },
2206
2313
  setIndexCallback: (e) => {
@@ -2210,16 +2317,16 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2210
2317
  }
2211
2318
  };
2212
2319
  return a && (c.json = a), void 0 !== l && (c.uid = () => l), h = e(c, s, i, r), h;
2213
- }, this._namedTableSource = new ze({
2214
- getSheets: () => n._sheets ? n.getWorksheets().getItems() : as.EmptyArray,
2320
+ }, this._namedTableSource = new _({
2321
+ getSheets: () => n._sheets ? n.getWorksheets().getItems({ visibility: St.Visibility.VeryHidden }) : fs.EmptyArray,
2215
2322
  addSheetsListener: (e, t) => n.addListeners({ onSheetsChange: e }, t)
2216
- }), this._names = s.names ?? new nt({
2323
+ }), this._names = s.names ?? new O({
2217
2324
  addressToRanges: (e) => n.getRanges(e),
2218
2325
  getCurrentScope: () => n.getSelectedWorksheet()?.getName() ?? null,
2219
2326
  isReadOnly: () => (n._options.readonly ?? !1) || n._isStructureProtected(),
2220
2327
  transactions: n._transactions,
2221
- getSources: () => n._calculation ? [n._calculation.getNamedFormulas(), n._namedTableSource] : as.EmptyArray
2222
- }), this._ownNames = !s.names, this._calculation = s.calculation ?? new K({
2328
+ getSources: () => n._calculation ? [n._calculation.getNamedFormulas(), n._namedTableSource] : fs.EmptyArray
2329
+ }), this._ownNames = !s.names, this._calculation = s.calculation ?? new $({
2223
2330
  runtime: n._runtime,
2224
2331
  functions: s.functions,
2225
2332
  json: o?.calc,
@@ -2238,19 +2345,19 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2238
2345
  getSheetIndex: (e) => {
2239
2346
  if (void 0 === e) {
2240
2347
  const e = n.getSelectedSheet();
2241
- return e ? this._getSheetRefs(mt.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
2348
+ return e ? this._getSheetRefs(St.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
2242
2349
  }
2243
- const t = this._getSheetRefs(mt.Visibility.VeryHidden);
2350
+ const t = this._getSheetRefs(St.Visibility.VeryHidden);
2244
2351
  e = e.toLowerCase();
2245
2352
  const s = t.length;
2246
2353
  for (let r = 0; r < s; r++) if (t[r].name.toLowerCase() === e) return r;
2247
2354
  try {
2248
- $r.address = e;
2249
- const t = this._names.getItems($r);
2355
+ ei.address = e;
2356
+ const t = this._names.getItems(ei);
2250
2357
  if (!t || 0 === t.length) return -1;
2251
2358
  let s = (t[0].getRanges?.()?.getCoords()?.[0])?.scope;
2252
2359
  if (!s) return -1;
2253
- const r = this._getSheetRefs(mt.Visibility.VeryHidden);
2360
+ const r = this._getSheetRefs(St.Visibility.VeryHidden);
2254
2361
  s = s.toLowerCase();
2255
2362
  const i = r.length;
2256
2363
  for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === s) return e;
@@ -2259,7 +2366,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2259
2366
  }
2260
2367
  return -1;
2261
2368
  },
2262
- getSheetCount: () => n._getSheetRefs(mt.Visibility.VeryHidden).length,
2369
+ getSheetCount: () => n._getSheetRefs(St.Visibility.VeryHidden).length,
2263
2370
  externalBooks: o?.externalBooks,
2264
2371
  externalBookResolver: s.externalBookResolver,
2265
2372
  namedCollection: n._names,
@@ -2283,7 +2390,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2283
2390
  const s = i[t], r = new Array(a);
2284
2391
  for (let t = 0; t < a; t++) {
2285
2392
  const i = s[t];
2286
- r[t] = void 0 === i || "" === i ? null : dt(e, i).value;
2393
+ r[t] = void 0 === i || "" === i ? null : kt(e, i).value;
2287
2394
  }
2288
2395
  l[t] = r;
2289
2396
  }
@@ -2293,9 +2400,9 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2293
2400
  transactions: n._transactions,
2294
2401
  names: o?.names
2295
2402
  }), this._ownCalculation = !s.calculation, this._scripts = this._createScripts(o?.modules), this._ownNames = !s.names, this._options = Object.freeze({ ...s });
2296
- const t = o?.sheets?.length ? o.sheets.map((e) => e.name) : [this._createSheetName(0)], r = t.map((e) => e + "-" + as.uuidV4()), i = (e) => {
2403
+ const t = o?.sheets?.length ? o.sheets.map((e) => e.name) : [this._createSheetName(0)], r = t.map((e) => e + "-" + fs.uuidV4()), i = (e) => {
2297
2404
  const t = o?.sheets?.[e]?.kind;
2298
- return !!t && t !== mt.Kind.Worksheet;
2405
+ return !!t && t !== St.Kind.Worksheet;
2299
2406
  };
2300
2407
  this._calculation._setSheets(t.map((e, t) => i(t) ? [
2301
2408
  r[t],
@@ -2306,16 +2413,19 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2306
2413
  let h = !1;
2307
2414
  const c = (async () => {
2308
2415
  try {
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;
2416
+ if (this._ownCalculation && "none" !== l) {
2417
+ if ("full" === l || "auto" === l && !0 === o?.calc?.fullCalcOnLoad ? await this._calculation._calculateForLoad() : await this._calculation.start(), this._closed) return;
2418
+ if (await this._refreshPivotCachesOnLoad(), this._closed) return;
2419
+ }
2310
2420
  await this._scripts.start();
2311
2421
  } finally {
2312
2422
  h = !0, this._starting = null;
2313
2423
  }
2314
2424
  })();
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) => {
2425
+ 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 zr((e) => n._addSheetOptions(e), (e, t) => {
2316
2426
  if (e) {
2317
2427
  const s = this._getSheetRef(e, t);
2318
- return s && Kr(s) ? [s.sheet] : as.EmptyArray;
2428
+ return s && ti(s) ? [s.sheet] : fs.EmptyArray;
2319
2429
  }
2320
2430
  return this._getWorksheets(t);
2321
2431
  }, (e, t) => {
@@ -2328,7 +2438,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2328
2438
  r(n._sheets);
2329
2439
  } : void 0
2330
2440
  }, t);
2331
- }, () => n.getSelectedWorksheet()), this._ownCalculation && "none" !== (s.calcOnLoad ?? "auto") && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), this._ownTransactions ? a.amend() : a.commit();
2441
+ }, () => n.getSelectedWorksheet()), this._ownCalculation && "none" !== (s.calcOnLoad ?? "auto") && (this._calculation.hydrateNames(), this._holdPivotCaches()), this._emitter.notify("onLoad"), this._ownTransactions ? a.amend() : a.commit();
2332
2442
  } catch (e) {
2333
2443
  throw a.rollback(), e;
2334
2444
  }
@@ -2338,13 +2448,13 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2338
2448
  let e = this._getSheetRefs();
2339
2449
  for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
2340
2450
  const t = this._options;
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) => {
2451
+ this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new At().getDefaultTheme(), this._styles = t?.styles ?? new Ke(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new Ar()), this._listenerProtection?.(), this._protection = new Pr(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
2342
2452
  s._emitter.notify("onProtectionChange");
2343
2453
  } });
2344
2454
  const s = this;
2345
2455
  this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
2346
2456
  async onAfterStateChange(e, t, r, i, 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;
2457
+ const n = s._view, a = o?.[Gr], 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;
2348
2458
  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");
2349
2459
  },
2350
2460
  onRestoreOrRevert() {
@@ -2365,7 +2475,8 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2365
2475
  refsByInstance: /* @__PURE__ */ new Map(),
2366
2476
  lastId: -1,
2367
2477
  sheetsCreated: /* @__PURE__ */ new Set(),
2368
- listenersSheets: /* @__PURE__ */ new Map()
2478
+ listenersSheets: /* @__PURE__ */ new Map(),
2479
+ pivotCacheData: /* @__PURE__ */ new Map()
2369
2480
  });
2370
2481
  }
2371
2482
  getId() {
@@ -2399,8 +2510,8 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2399
2510
  return this._view;
2400
2511
  }
2401
2512
  setView(e) {
2402
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
2403
- if (!e) throw new cs(Ss("error.sheet.emptyView"));
2513
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2514
+ if (!e) throw new ws(xs("error.sheet.emptyView"));
2404
2515
  this._listenerWorkbookView?.();
2405
2516
  const t = this;
2406
2517
  let s = -1;
@@ -2413,7 +2524,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2413
2524
  return this._runtime;
2414
2525
  }
2415
2526
  setDate1904(e) {
2416
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
2527
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2417
2528
  return this._isDate1904 === e || (this._isDate1904 = e, this._emitter.notify("onRegionalChange")), this;
2418
2529
  }
2419
2530
  getLocale() {
@@ -2423,11 +2534,11 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2423
2534
  return this._locale;
2424
2535
  }
2425
2536
  setLocale(e) {
2426
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
2537
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2427
2538
  if (e) try {
2428
2539
  new Intl.Locale(e);
2429
2540
  } catch {
2430
- throw new Error(Ss("error.workbook.invalidLocale", { locale: e }));
2541
+ throw new Error(xs("error.workbook.invalidLocale", { locale: e }));
2431
2542
  }
2432
2543
  return this._locale === e || (this._locale = e, this._emitter.notify("onRegionalChange")), this;
2433
2544
  }
@@ -2435,7 +2546,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2435
2546
  return this._localeOverrides;
2436
2547
  }
2437
2548
  setLocaleOverrides(e) {
2438
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
2549
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2439
2550
  const t = e && Object.keys(e).length > 0 ? e : null;
2440
2551
  return this._localeOverrides = t, this._emitter.notify("onRegionalChange"), this;
2441
2552
  }
@@ -2455,10 +2566,10 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2455
2566
  return this._transactions;
2456
2567
  }
2457
2568
  getChanges(e) {
2458
- const t = this._transactions, [s, r] = t.getLog(e ?? t.getCurrentCommit(!1).getId(), 2), i = [], o = this.getWorksheets().getItems({ visibility: mt.Visibility.VeryHidden });
2569
+ const t = this._transactions, [s, r] = t.getLog(e ?? t.getCurrentCommit(!1).getId(), 2), i = [], o = this.getWorksheets().getItems({ visibility: St.Visibility.VeryHidden });
2459
2570
  for (let e = 0; e < o.length; e++) {
2460
2571
  const t = o[e];
2461
- t instanceof le && i.push(...t._changeEventsOf(s, r ?? null));
2572
+ t instanceof se && i.push(...t._changeEventsOf(s, r ?? null));
2462
2573
  }
2463
2574
  return i;
2464
2575
  }
@@ -2472,7 +2583,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2472
2583
  return this._updateLinks;
2473
2584
  }
2474
2585
  setUpdateLinks(e) {
2475
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
2586
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2476
2587
  return this._updateLinks = e, this;
2477
2588
  }
2478
2589
  getPivotTables() {
@@ -2488,8 +2599,8 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2488
2599
  return this._theme;
2489
2600
  }
2490
2601
  setTheme(e) {
2491
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
2492
- if (!e) throw new cs(Ss("error.workbook.notSetValue"));
2602
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2603
+ if (!e) throw new ws(xs("error.workbook.notSetValue"));
2493
2604
  const t = this._theme;
2494
2605
  return this._theme = e, this.getStyles().setTheme(e), this._emitter.notify("onThemeChange"), t;
2495
2606
  }
@@ -2502,7 +2613,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2502
2613
  }
2503
2614
  getSelectedWorksheet() {
2504
2615
  const e = this._getSheetRef(this.getSelectedSheetIndex());
2505
- return e && Kr(e) ? e.sheet : null;
2616
+ return e && ti(e) ? e.sheet : null;
2506
2617
  }
2507
2618
  getActiveSheet() {
2508
2619
  return this.getSelectedWorksheet();
@@ -2511,30 +2622,30 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2511
2622
  return this.getSelectedWorksheet();
2512
2623
  }
2513
2624
  getSheets(e) {
2514
- const t = this._getSheetRefs(e?.visibility ?? mt.Visibility.Visible), s = new Array(t.length);
2625
+ const t = this._getSheetRefs(e?.visibility ?? St.Visibility.Visible), s = new Array(t.length);
2515
2626
  for (let e = 0; e < t.length; e++) s[e] = t[e].sheet;
2516
2627
  return s;
2517
2628
  }
2518
2629
  getSheet(e) {
2519
2630
  if (void 0 === e) return this.getSelectedSheet();
2520
- if (!e) throw new Error(Ss("error.workbook.sheetNameNotProvided"));
2631
+ if (!e) throw new Error(xs("error.workbook.sheetNameNotProvided"));
2521
2632
  const t = this._getSheetRef(e);
2522
- if (!t) throw new fs(Ar(e));
2633
+ if (!t) throw new vs(Dr(e));
2523
2634
  return t.sheet;
2524
2635
  }
2525
- getWorksheet(e, t = mt.Visibility.Visible) {
2636
+ getWorksheet(e, t = St.Visibility.Visible) {
2526
2637
  if ("number" == typeof e) return this.getWorksheetAt(e, t);
2527
2638
  if (void 0 === e) return this._requireSelectedWorksheet();
2528
- if (!e) throw new Error(Ss("error.workbook.sheetNameNotProvided"));
2639
+ if (!e) throw new Error(xs("error.workbook.sheetNameNotProvided"));
2529
2640
  const s = this._getSheetRef(e, t);
2530
- if (!s) throw new fs(Ar(e));
2531
- if (!Kr(s)) throw new fs(Vr(s.name, s.sheet.getKind()));
2641
+ if (!s) throw new vs(Dr(e));
2642
+ if (!ti(s)) throw new vs(jr(s.name, s.sheet.getKind()));
2532
2643
  return s.sheet;
2533
2644
  }
2534
- getWorksheetAt(e, t = mt.Visibility.Visible) {
2645
+ getWorksheetAt(e, t = St.Visibility.Visible) {
2535
2646
  const s = this._getWorksheets(t)[e];
2536
- if (!s) throw new fs(function(e) {
2537
- return Ss("error.workbook.sheetIndexNotFound", { index: e });
2647
+ if (!s) throw new vs(function(e) {
2648
+ return xs("error.workbook.sheetIndexNotFound", { index: e });
2538
2649
  }(e));
2539
2650
  return s;
2540
2651
  }
@@ -2542,10 +2653,10 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2542
2653
  const e = this.getSelectedWorksheet();
2543
2654
  if (e) return e;
2544
2655
  const t = this.getSelectedSheet();
2545
- throw new cs(Tr(t?.getName() ?? "", t?.getKind() ?? mt.Kind.Worksheet));
2656
+ throw new ws(Hr(t?.getName() ?? "", t?.getKind() ?? St.Kind.Worksheet));
2546
2657
  }
2547
2658
  _anchorWorksheet() {
2548
- return this.getSelectedWorksheet() || (this._getWorksheets(mt.Visibility.VeryHidden)[0] ?? null);
2659
+ return this.getSelectedWorksheet() || (this._getWorksheets(St.Visibility.VeryHidden)[0] ?? null);
2549
2660
  }
2550
2661
  getWorksheets() {
2551
2662
  return this._sheets;
@@ -2553,35 +2664,35 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2553
2664
  addWorksheet(e) {
2554
2665
  return this.getWorksheets().add(e);
2555
2666
  }
2556
- _getWorksheets(e = mt.Visibility.Visible) {
2667
+ _getWorksheets(e = St.Visibility.Visible) {
2557
2668
  const t = this._getSheetRefs(e), s = [], r = t.length;
2558
2669
  for (let e = 0; e < r; e++) {
2559
2670
  const r = t[e];
2560
- Kr(r) && s.push(r.sheet);
2671
+ ti(r) && s.push(r.sheet);
2561
2672
  }
2562
2673
  return s;
2563
2674
  }
2564
- _getSheetRefs(e = mt.Visibility.Visible) {
2675
+ _getSheetRefs(e = St.Visibility.Visible) {
2565
2676
  const t = this._getState();
2566
- return t ? e === mt.Visibility.Visible ? t.sheetRefsVisible : e === mt.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === mt.Visibility.VeryHidden ? t.sheetRefsAll : as.EmptyArray : [];
2677
+ return t ? e === St.Visibility.Visible ? t.sheetRefsVisible : e === St.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === St.Visibility.VeryHidden ? t.sheetRefsAll : fs.EmptyArray : [];
2567
2678
  }
2568
- _getSheetRef(e, t = mt.Visibility.Visible) {
2679
+ _getSheetRef(e, t = St.Visibility.Visible) {
2569
2680
  let s = null;
2570
2681
  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);
2571
2682
  }
2572
2683
  _validateNewSheetName(e, t = !0) {
2573
2684
  if (null == e) return e;
2574
- if (Mr(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new cs(Ss("error.workbook.nameTaken"));
2685
+ if (Kr(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new ws(xs("error.workbook.nameTaken"));
2575
2686
  return e.substring(0, 31);
2576
2687
  }
2577
2688
  findValidSheetName(e) {
2578
- e && (e = Mr(e, !0));
2689
+ e && (e = Kr(e, !0));
2579
2690
  try {
2580
2691
  return function(e, t) {
2581
2692
  try {
2582
2693
  if (t(e)) return e;
2583
2694
  } catch (e) {}
2584
- let s, r, i = Wr.exec(e);
2695
+ let s, r, i = Ur.exec(e);
2585
2696
  for (null !== i ? (s = e.substring(0, i.index), r = parseFloat(i[1])) : (s = e + " ", r = 1); r < 256;) {
2586
2697
  r++;
2587
2698
  const e = "(" + r + ")", i = s.substring(0, 31 - e.length) + e;
@@ -2596,25 +2707,25 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2596
2707
  }
2597
2708
  }
2598
2709
  isValidSheetNameCharacter(e) {
2599
- return !Fr.test(e);
2710
+ return !$r.test(e);
2600
2711
  }
2601
2712
  _isStructureProtected() {
2602
2713
  return !this._initializing && !this.getProtection().isStructureAllowed();
2603
2714
  }
2604
2715
  _addSheetOptions(e) {
2605
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
2606
- if (!this.getProtection().isStructureAllowed()) throw new ws(Ss("error.workbook.protection"));
2716
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2717
+ if (!this.getProtection().isStructureAllowed()) throw new Rs(xs("error.workbook.protection"));
2607
2718
  let t, s = null;
2608
2719
  t = "string" == typeof e ? { name: e } : "number" == typeof e ? { index: e } : e, t = {
2609
2720
  ...t,
2610
- description: t?.description ?? bs("op.addSheet")
2721
+ description: t?.description ?? Os("op.addSheet")
2611
2722
  };
2612
2723
  const r = this.beginCommit(t);
2613
2724
  try {
2614
2725
  const e = t?.autoSelect ?? !1;
2615
2726
  s = this._addSheet(!0, t.name, t.index ?? null);
2616
2727
  const i = this.getView().getActiveSheetId();
2617
- if (e && this._recordActiveSheet(r, i, this._getSheetRef(s).id), r.commit({ description: Ss("op.addSheetNamed", { name: s.getName() }) }), !1 !== e) {
2728
+ if (e && this._recordActiveSheet(r, i, this._getSheetRef(s).id), r.commit({ description: xs("op.addSheetNamed", { name: s.getName() }) }), !1 !== e) {
2618
2729
  const t = "boolean" == typeof e ? void 0 : e;
2619
2730
  s.select(t);
2620
2731
  }
@@ -2626,8 +2737,8 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2626
2737
  _nextSheetName(e = null) {
2627
2738
  let t = e ? e.toLowerCase() : null;
2628
2739
  const s = this._getState(), r = s.sheetsByLowerCaseName;
2629
- if (e && r.has(t)) throw new cs(function(e) {
2630
- return Ss("error.workbook.nameDuplicate", { sheetName: e });
2740
+ if (e && r.has(t)) throw new ws(function(e) {
2741
+ return xs("error.workbook.nameDuplicate", { sheetName: e });
2631
2742
  }(e));
2632
2743
  t = (e = this._validateNewSheetName(e)) ? e.toLowerCase() : null;
2633
2744
  let i = s.lastId + 1;
@@ -2639,16 +2750,16 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2639
2750
  }
2640
2751
  _addSheet(e, t = null, s = null, r) {
2641
2752
  t = this._nextSheetName(t);
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"));
2753
+ const i = this._getState(), o = this._createSheet(i.lastId, t, St.Visibility.Visible, s, void 0, null, r);
2754
+ if (!o) throw new ws(xs("error.workbook.sheetNameBlank"));
2644
2755
  return e && (this._tellSheets(), this._emitter.notify("onSheetsChange")), o;
2645
2756
  }
2646
2757
  _createOpaqueSheet(e, t, s, r, i, o, n, a, l) {
2647
2758
  const h = this;
2648
2759
  let c = null;
2649
- return c = new kr({
2760
+ return c = new Er({
2650
2761
  kind: o,
2651
- id: l ?? t + "-" + as.uuidV4(),
2762
+ id: l ?? t + "-" + fs.uuidV4(),
2652
2763
  part: n,
2653
2764
  tabColor: a,
2654
2765
  styles: this._styles,
@@ -2659,25 +2770,25 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2659
2770
  setName: (e, t) => {
2660
2771
  h._setSheetName(c, e, t);
2661
2772
  },
2662
- getVisibility: () => h._getSheetRef(c, mt.Visibility.VeryHidden)?.visibility ?? mt.Visibility.Visible,
2773
+ getVisibility: () => h._getSheetRef(c, St.Visibility.VeryHidden)?.visibility ?? St.Visibility.Visible,
2663
2774
  setVisibility: (e, t) => {
2664
2775
  h._setSheetVisibility(c, e, t);
2665
2776
  },
2666
2777
  getIndex: () => {
2667
- const e = h._getSheetRef(c, mt.Visibility.VeryHidden);
2668
- return e ? h._getOffsetForId(e.id, h._getSheetRefs(mt.Visibility.VeryHidden)) : -1;
2778
+ const e = h._getSheetRef(c, St.Visibility.VeryHidden);
2779
+ return e ? h._getOffsetForId(e.id, h._getSheetRefs(St.Visibility.VeryHidden)) : -1;
2669
2780
  },
2670
2781
  setIndex: (e, t) => {
2671
- const s = h._getSheetRef(c, mt.Visibility.VeryHidden);
2782
+ const s = h._getSheetRef(c, St.Visibility.VeryHidden);
2672
2783
  s && h._moveSheet(s, e, t);
2673
2784
  },
2674
2785
  requestSelect: () => h._requestSelect(c),
2675
- isAttached: () => !!h._getSheetRef(c, mt.Visibility.VeryHidden)
2786
+ isAttached: () => !!h._getSheetRef(c, St.Visibility.VeryHidden)
2676
2787
  }
2677
2788
  }), this._sheetOnNameChange.set(e, () => c._notify("onNameChange")), this._sheetOnVisibilityChange.set(e, () => c._notify("onVisibilityChange")), this._sheetOnIndexChange.set(e, () => c._notify("onIndexChange")), this._addSheetRef({
2678
2789
  name: t,
2679
2790
  id: e,
2680
- visibility: s ?? mt.Visibility.Visible,
2791
+ visibility: s ?? St.Visibility.Visible,
2681
2792
  sheetId: i,
2682
2793
  sheet: c
2683
2794
  }, r), c;
@@ -2690,10 +2801,10 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2690
2801
  }), this.getSelectedSheet() === e;
2691
2802
  }
2692
2803
  _updateSheetRefStates(e) {
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"));
2804
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2805
+ if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new Rs(xs("error.workbook.protection"));
2695
2806
  const t = e, s = [], r = [], i = t.length;
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]);
2807
+ for (let e = 0; e < i; e++) t[e].visibility === St.Visibility.Visible ? (s.push(t[e]), r.push(t[e])) : t[e].visibility === St.Visibility.Hidden && r.push(t[e]);
2697
2808
  this._updateState({
2698
2809
  sheetRefsAll: t,
2699
2810
  sheetRefsVisible: s,
@@ -2703,7 +2814,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2703
2814
  _tellSheets() {
2704
2815
  if (this._isLoadingSheets) return;
2705
2816
  const e = this._getState().sheetRefsAll;
2706
- this._calculation._setSheets(e.map((e) => Kr(e) ? [e.sheet.getId(), e.name] : [
2817
+ this._calculation._setSheets(e.map((e) => ti(e) ? [e.sheet.getId(), e.name] : [
2707
2818
  e.sheet.getId(),
2708
2819
  e.name,
2709
2820
  !0
@@ -2735,9 +2846,9 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2735
2846
  g._validateDeleteSheet(e);
2736
2847
  },
2737
2848
  onDelete(e) {
2738
- let t = g._getSheetRef(e, mt.Visibility.VeryHidden);
2849
+ let t = g._getSheetRef(e, St.Visibility.VeryHidden);
2739
2850
  if (!t) return;
2740
- const s = g._beginCommit({ description: Ss("op.deleteSheet", { name: t.name }) });
2851
+ const s = g._beginCommit({ description: xs("op.deleteSheet", { name: t.name }) });
2741
2852
  try {
2742
2853
  const r = g._getState(), i = r.sheetRefsAll, o = g._getOffsetForId(t.id, i);
2743
2854
  let a = [...i];
@@ -2752,23 +2863,23 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2752
2863
  d.delete(c);
2753
2864
  const m = new Map(r.refsByInstance);
2754
2865
  m.delete(e), r.listenersSheets.get(t.id)();
2755
- const _ = new Map(r.listenersSheets);
2756
- _.delete(t.id), g._adjustRemoveSelectionIfRequired(o, t.id), g._adjustSheetNamesIfRequired(), g._sheetOnNameChange.delete(t.id), g._sheetOnVisibilityChange.delete(t.id), g._sheetOnIndexChange.delete(t.id), g._tellSheets(), g._emitter.notify("onSheetsChange");
2757
- const f = new Set(r.sheetsCreated);
2758
- f.has(n) && f.delete(n), g._updateState({
2866
+ const f = new Map(r.listenersSheets);
2867
+ f.delete(t.id), g._adjustRemoveSelectionIfRequired(o, t.id), g._adjustSheetNamesIfRequired(), g._sheetOnNameChange.delete(t.id), g._sheetOnVisibilityChange.delete(t.id), g._sheetOnIndexChange.delete(t.id), g._tellSheets(), g._emitter.notify("onSheetsChange");
2868
+ const _ = new Set(r.sheetsCreated);
2869
+ _.has(n) && _.delete(n), g._updateState({
2759
2870
  refsById: l,
2760
2871
  sheetsById: h,
2761
2872
  refsByLowerCaseName: u,
2762
2873
  sheetsByLowerCaseName: d,
2763
2874
  refsByInstance: m,
2764
- sheetsCreated: f,
2765
- listenersSheets: _
2875
+ sheetsCreated: _,
2876
+ listenersSheets: f
2766
2877
  }), s.commit();
2767
2878
  } catch (e) {
2768
2879
  throw s.rollback(), e;
2769
2880
  }
2770
2881
  }
2771
- }, { transactional: !0 }), r = Kr(e) ? e.sheet.addListeners({ onSelectionChange: (e) => {
2882
+ }, { transactional: !0 }), r = ti(e) ? e.sheet.addListeners({ onSelectionChange: (e) => {
2772
2883
  g.getView().getActiveSheetId() === g._getSheetRef(e)?.id && g._emitter.notify("onSelectionChange", {
2773
2884
  source: g,
2774
2885
  params: e
@@ -2778,8 +2889,8 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2778
2889
  };
2779
2890
  m = new Map(s.listenersSheets), m.set(e.id, i);
2780
2891
  }
2781
- let _ = s.lastId;
2782
- -1 !== _ && (_ = Math.max(_, e.id)), this._updateState({ lastId: _ }), this._updateState({
2892
+ let f = s.lastId;
2893
+ -1 !== f && (f = Math.max(f, e.id)), this._updateState({ lastId: f }), this._updateState({
2783
2894
  refsById: l,
2784
2895
  refsByLowerCaseName: h,
2785
2896
  refsByInstance: c,
@@ -2787,12 +2898,12 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2787
2898
  sheetsByLowerCaseName: d,
2788
2899
  listenersSheets: m
2789
2900
  }), this._adjustSheetNamesIfRequired();
2790
- const f = new Set(this._getState().sheetsCreated);
2791
- return f.add(e.sheet), this._updateState({ sheetsCreated: f }), this._tellSheets(), e;
2901
+ const _ = new Set(this._getState().sheetsCreated);
2902
+ return _.add(e.sheet), this._updateState({ sheetsCreated: _ }), this._tellSheets(), e;
2792
2903
  }
2793
2904
  _recordActiveSheet(e, t, s) {
2794
2905
  const r = this.getView().getId();
2795
- e.setIntent(zr, (e) => ({
2906
+ e.setIntent(Gr, (e) => ({
2796
2907
  viewId: r,
2797
2908
  before: e?.before ?? t,
2798
2909
  after: s
@@ -2824,27 +2935,27 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2824
2935
  let s = this._view.getActiveSheetId();
2825
2936
  null == s && (this._view.setActiveSheetId(t), s = t);
2826
2937
  let r = e.refsById.get(s);
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));
2938
+ r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), s = t), r.visibility === St.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(s, e.sheetRefsVisible));
2828
2939
  }
2829
2940
  _validateDeleteSheet(e) {
2830
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
2831
- if (!this.getProtection().isStructureAllowed()) throw new ws(Ss("error.workbook.protection"));
2941
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2942
+ if (!this.getProtection().isStructureAllowed()) throw new Rs(xs("error.workbook.protection"));
2832
2943
  let t = this._getSheetRef(e);
2833
- if (!t) throw new cs(function(e) {
2834
- return Ss("error.workbook.deleteKey", { key: e });
2944
+ if (!t) throw new ws(function(e) {
2945
+ return xs("error.workbook.deleteKey", { key: e });
2835
2946
  }(e));
2836
2947
  const s = this._getState().sheetRefsVisible;
2837
- if (1 === s.length && s[0].id === t.id) throw new cs(Ss("error.workbook.sheetOne"));
2948
+ if (1 === s.length && s[0].id === t.id) throw new ws(xs("error.workbook.sheetOne"));
2838
2949
  }
2839
2950
  _getOffsetForId(e, t) {
2840
2951
  const s = t.length;
2841
2952
  for (let r = 0; r < s; r++) if (t[r].id === e) return r;
2842
- throw new cs(Ss("error.workbook.noVisibleRefs"));
2953
+ throw new ws(xs("error.workbook.noVisibleRefs"));
2843
2954
  }
2844
2955
  find(e) {
2845
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
2956
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2846
2957
  const t = this._getWorksheets();
2847
- if (0 === t.length) return { next: () => at };
2958
+ if (0 === t.length) return { next: () => Te };
2848
2959
  if (1 === t.length) return t[0].find(e);
2849
2960
  "string" == typeof e && (e = { text: e });
2850
2961
  const s = !e?.reverse;
@@ -2863,7 +2974,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2863
2974
  rowIndex: t[0].rowStart
2864
2975
  };
2865
2976
  }
2866
- const d = ls.createCellComparator(e?.axis, e?.reverse);
2977
+ const d = _s.createCellComparator(e?.axis, e?.reverse);
2867
2978
  delete (e = { ...e }).from;
2868
2979
  const g = () => {
2869
2980
  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)) {
@@ -2873,7 +2984,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2873
2984
  }
2874
2985
  if (!u && a && o === i && (c.done || !l || !c.done && d(c.value.getCoords(), l) >= 0) && (u = !0), u) {
2875
2986
  const e = c;
2876
- return c = at, e;
2987
+ return c = Te, e;
2877
2988
  }
2878
2989
  const g = c;
2879
2990
  return c = h.next(), g;
@@ -2888,8 +2999,8 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2888
2999
  let r = 0, i = null;
2889
3000
  const o = "function" == typeof t, n = s?.maxCount ?? Number.MAX_SAFE_INTEGER, a = !s?.maxCount;
2890
3001
  let l = "";
2891
- const h = "string" == typeof t ? Be(t) : null;
2892
- let c = s?.description ?? bs("op.replace");
3002
+ const h = "string" == typeof t ? bt(t) : null;
3003
+ let c = s?.description ?? Os("op.replace");
2893
3004
  const u = this._transactions.beginCommit({ description: c });
2894
3005
  try {
2895
3006
  let c = null, d = null, g = e.next();
@@ -2902,10 +3013,10 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2902
3013
  const l = o ? t(n) : t;
2903
3014
  void 0 !== l && l !== n && (d.push(n, l), r++, i = n), g = e.next();
2904
3015
  }
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", {
3016
+ d?.apply(), 1 === r && 1 === n && i && (l = i.getAddress()), 0 === r ? u.rollback() : u.commit({ description: s?.description ?? (a ? null !== h ? xs("op.replaceAllWith", { value: h }) : Os("op.replaceAll") : l ? null !== h ? xs("op.replaceAtWith", {
2906
3017
  address: l,
2907
3018
  value: h
2908
- }) : Ss("op.replaceAt", { address: l }) : null !== h ? Ss("op.replaceWith", { value: h }) : bs("op.replace")) });
3019
+ }) : xs("op.replaceAt", { address: l }) : null !== h ? xs("op.replaceWith", { value: h }) : Os("op.replace")) });
2909
3020
  } catch (e) {
2910
3021
  throw u.rollback(), e;
2911
3022
  }
@@ -2926,118 +3037,118 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
2926
3037
  const s = this._getSheetRefs(), r = s.length;
2927
3038
  for (let i = 0; i < r; i++) {
2928
3039
  const o = s[(e + i) % r];
2929
- if (!Kr(o)) continue;
3040
+ if (!ti(o)) continue;
2930
3041
  const n = t.indexOf(o.sheet);
2931
3042
  if (-1 !== n) return n;
2932
3043
  }
2933
3044
  return 0;
2934
3045
  }
2935
3046
  getNextSheet(e) {
2936
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
3047
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2937
3048
  const t = this._getSheetRefs();
2938
3049
  return t[this._nextSheetIndex(e, t)]?.sheet ?? null;
2939
3050
  }
2940
3051
  getPreviousSheet(e) {
2941
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
3052
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
2942
3053
  const t = this._getSheetRefs();
2943
3054
  return t[this._prevSheetIndex(e, t)]?.sheet ?? null;
2944
3055
  }
2945
3056
  async _duplicateSheet(e) {
2946
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
2947
- if (!this.getProtection().isStructureAllowed()) throw new ws(Ss("error.workbook.protection"));
3057
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
3058
+ if (!this.getProtection().isStructureAllowed()) throw new Rs(xs("error.workbook.protection"));
2948
3059
  const t = this._getSheetRefs(), s = this.getSelectedSheetIndex();
2949
3060
  let r = null;
2950
3061
  if (e) {
2951
- if (r = this._getSheetRef(e), !r) throw new cs(Lr(r));
3062
+ if (r = this._getSheetRef(e), !r) throw new ws(Mr(r));
2952
3063
  } else r = t[s];
2953
3064
  if (!r) return null;
2954
- if (!Kr(r)) throw new cs((i = r.name, Ss("error.workbook.sheetNotDuplicable", { sheetName: i })));
3065
+ if (!ti(r)) throw new ws((i = r.name, xs("error.workbook.sheetNotDuplicable", { sheetName: i })));
2955
3066
  var i;
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() }));
3067
+ const o = r.sheet, n = t.indexOf(r), a = this._strings.beginPersist(), l = this.getResources().beginPersist(), h = this.getStyles().beginPersist(), c = this._richValues.beginPersist();
3068
+ let u = null;
3069
+ const d = this.beginCommit(xs("op.duplicateNamed", { name: o.getName() }));
2959
3070
  try {
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);
2961
- this._tellSheets(), this._emitter.notify("onSheetsChange"), c = a, u.commit();
3071
+ const e = this._getState().refsByInstance.get(o), s = await o.toJSON(), r = t.length + 1, i = this.findValidSheetName(e.name), a = this._createSheet(r, i, e.visibility, n, void 0, s);
3072
+ this._tellSheets(), this._emitter.notify("onSheetsChange"), u = a, d.commit();
2962
3073
  } catch (e) {
2963
- throw u.rollback(), e;
3074
+ throw d.rollback(), e;
2964
3075
  } finally {
2965
- h.endPersist(), l.endPersist(), a.endPersist(), n.endPersist();
3076
+ c.endPersist(), h.endPersist(), l.endPersist(), a.endPersist();
2966
3077
  }
2967
- return c;
3078
+ return u;
2968
3079
  }
2969
3080
  _createRange(e, t) {
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()));
3081
+ const s = e ? { ...e } : null, r = s ? this._getSheetRef(s.scope, St.Visibility.VeryHidden) : null;
3082
+ if (r && !ti(r)) throw new ws(jr(r.name, r.sheet.getKind()));
2972
3083
  if (!r) {
2973
3084
  const e = this._anchorWorksheet();
2974
- return e ? (delete s?.scope, jr(s, s ? {
2975
- scope: ye,
3085
+ return e ? (delete s?.scope, qr(s, s ? {
3086
+ scope: le,
2976
3087
  ...e.getEntireRange().getCoords()
2977
- } : null)) : void console.warn(Ss("error.workbook.noVisibleRefs"));
3088
+ } : null)) : void console.warn(xs("error.workbook.noVisibleRefs"));
2978
3089
  }
2979
3090
  const i = r.sheet;
2980
3091
  let o = null;
2981
- return t && (o = { getOptions: t }), new Ur(e, Ie(i), this, o);
3092
+ return t && (o = { getOptions: t }), new Xr(e, Ne(i), this, o);
2982
3093
  }
2983
3094
  _createRanges(e, t) {
2984
3095
  const s = this._anchorWorksheet();
2985
- if (!s) throw new cs(Tr("", mt.Kind.Worksheet));
3096
+ if (!s) throw new ws(Hr("", St.Kind.Worksheet));
2986
3097
  let r = null;
2987
- return t && (r = { getOptions: t }), new Hr(e, Ie(s), this, r);
3098
+ return t && (r = { getOptions: t }), new Zr(e, Ne(s), this, r);
2988
3099
  }
2989
3100
  getRange(e, t) {
2990
3101
  if (void 0 === e) return this.getSelectedRange(t);
2991
- "number" == typeof e && (e = ve(arguments), t = void 0);
3102
+ "number" == typeof e && (e = ye(arguments), t = void 0);
2992
3103
  try {
2993
3104
  const s = this._rangesAddressToCoords(e);
2994
- if (1 !== s.length) throw new cs(Ss("error.address.singleRangeOnlyAlt"));
3105
+ if (1 !== s.length) throw new ws(xs("error.address.singleRangeOnlyAlt"));
2995
3106
  return this._createRange(s[0], t);
2996
3107
  } catch (t) {
2997
- if (t instanceof fs) throw new fs(t.message);
2998
- throw new cs(t.message ?? M(e));
3108
+ if (t instanceof vs) throw new vs(t.message);
3109
+ throw new ws(t.message ?? J(e));
2999
3110
  }
3000
3111
  }
3001
3112
  getCell(e) {
3002
3113
  if (void 0 === e) return this.getSelectedCell();
3003
3114
  const t = this.getRange(e);
3004
- if (t.size > 1) throw new cs(Ss("error.address.singleCellOnly"));
3115
+ if (t.size > 1) throw new ws(xs("error.address.singleCellOnly"));
3005
3116
  return t.getCell();
3006
3117
  }
3007
3118
  getRanges(e, t) {
3008
3119
  const s = this._rangesAddressToCoords(e);
3009
- if (0 === s.length) throw new cs(M(e));
3120
+ if (0 === s.length) throw new ws(J(e));
3010
3121
  return this._createRanges(s, t);
3011
3122
  }
3012
3123
  _createGraphRanges(e, t) {
3013
3124
  const s = [], r = this.getCalculation()?.getNamedFormulas() ?? null;
3014
3125
  for (let e = 0; e < t.length; e++) {
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));
3126
+ const i = t[e], o = i.sheetName ? this._getSheetRef(i.sheetName, St.Visibility.VeryHidden) : null, n = o && ti(o) ? o.sheet : this._anchorWorksheet();
3127
+ n && s.push(new G(i, r, Ne(n), null));
3017
3128
  }
3018
3129
  for (let t = 0; t < e.length; t++) s.push(e[t]);
3019
3130
  const i = this._anchorWorksheet();
3020
- return 0 !== s.length && i ? new Hr(s, Ie(i), this, null) : null;
3131
+ return 0 !== s.length && i ? new Zr(s, Ne(i), this, null) : null;
3021
3132
  }
3022
3133
  getAnomalies(e) {
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);
3134
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
3135
+ const t = W(e), s = this._getWorksheets(St.Visibility.VeryHidden).map((e) => {
3136
+ const t = Ne(e);
3026
3137
  return {
3027
3138
  bounds: t.getSheet().getEntireCoords(),
3028
3139
  internal: t,
3029
3140
  qualified: !0
3030
3141
  };
3031
3142
  });
3032
- return new T(s, () => (this.getSelectedWorksheet() ?? this._getWorksheets(mt.Visibility.VeryHidden)[0]).getEntireRange(), t);
3143
+ return new T(s, () => (this.getSelectedWorksheet() ?? this._getWorksheets(St.Visibility.VeryHidden)[0]).getEntireRange(), t);
3033
3144
  }
3034
3145
  getStats(e) {
3035
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
3036
- const t = this._getWorksheets(mt.Visibility.VeryHidden), s = t.length;
3146
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
3147
+ const t = this._getWorksheets(St.Visibility.VeryHidden), s = t.length;
3037
3148
  if (1 === s) return t[0].getStats(e);
3038
3149
  const r = new Array(s);
3039
3150
  for (let i = 0; i < s; i++) r[i] = t[i].getStats(e);
3040
- return new rr(r);
3151
+ return new ur(r);
3041
3152
  }
3042
3153
  _activeRangeCoords() {
3043
3154
  const e = this._requireSelectedWorksheet(), t = e.getSelection().getRanges().getCoords(), s = e.getName(), r = t.length, i = new Array(r);
@@ -3062,8 +3173,8 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3062
3173
  getSelectedCell() {
3063
3174
  return this._requireSelectedWorksheet().getSelectedCell();
3064
3175
  }
3065
- _rangesAddressToCoords(e, t = !0, s = mt.Visibility.Hidden) {
3066
- if (!e) throw new cs(Ss("error.address.noAddress"));
3176
+ _rangesAddressToCoords(e, t = !0, s = St.Visibility.Hidden) {
3177
+ if (!e) throw new ws(xs("error.address.noAddress"));
3067
3178
  const r = this.getSelectedWorksheet(), i = { ...(r ?? this._anchorWorksheet())?.getEntireRange().getCoords() }, o = r?.getName();
3068
3179
  if (o && (i.scope = o), "string" == typeof e) {
3069
3180
  const t = e.trim().toLowerCase();
@@ -3072,11 +3183,11 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3072
3183
  "r" === t ? r.rowStart = r.rowEnd = s.rowIndex : r.colStart = r.colEnd = s.colIndex, e = r;
3073
3184
  }
3074
3185
  }
3075
- const n = this, a = Re(e, i, et, (e) => {
3186
+ const n = this, a = Le(e, i, Ie, (e) => {
3076
3187
  if (!t) return null;
3077
3188
  if ("string" == typeof e) {
3078
- const t = z(e, {
3079
- getTable: (e) => Me(n.getNames().getByName(e)),
3189
+ const t = M(e, {
3190
+ getTable: (e) => Je(n.getNames().getByName(e)),
3080
3191
  getAnchor: () => r ? {
3081
3192
  sheet: r,
3082
3193
  coords: r.getSelectedCell().getCoords()
@@ -3086,16 +3197,16 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3086
3197
  const s = n.getNames().getByName(e)?.getRanges?.();
3087
3198
  if (s) return s.getCoords();
3088
3199
  }
3089
- throw new cs(`Invalid sheet reference '${e}'.`);
3200
+ throw new ws(`Invalid sheet reference '${e}'.`);
3090
3201
  }), l = a.length;
3091
3202
  for (let e = 0; e < l; e++) this._validateCoords(a[e], s);
3092
3203
  return a;
3093
3204
  }
3094
- _validateCoords(e, t = mt.Visibility.Visible, s = Ss("error.sheet.oobRange")) {
3205
+ _validateCoords(e, t = St.Visibility.Visible, s = xs("error.sheet.oobRange")) {
3095
3206
  if (null === e) return;
3096
3207
  const r = this.getWorksheet(e.scope ?? void 0, t).getEntireRange().getCoords();
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"));
3208
+ if (!_s.isRangeWithinRange(e, r)) throw new vs(s);
3209
+ if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new ws(xs("error.address.invalidRangeInverted"));
3099
3210
  }
3100
3211
  _updateSheetRef(e, t) {
3101
3212
  const s = this._getState();
@@ -3117,18 +3228,18 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3117
3228
  }), this._tellSheets(), t;
3118
3229
  }
3119
3230
  _setSheetName(e, t, s) {
3120
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
3121
- if (!this.getProtection().isStructureAllowed()) throw new ws(Ss("error.workbook.protection"));
3231
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
3232
+ if (!this.getProtection().isStructureAllowed()) throw new Rs(xs("error.workbook.protection"));
3122
3233
  const r = this._getSheetRef(e);
3123
- if (!r) throw new cs(Lr(e));
3234
+ if (!r) throw new ws(Mr(e));
3124
3235
  if (t === r.name) return r.sheet;
3125
- if (null == (t = this._validateNewSheetName(t))) throw new cs(Ss("error.workbook.sheetNameNotProvided"));
3236
+ if (null == (t = this._validateNewSheetName(t))) throw new ws(xs("error.workbook.sheetNameNotProvided"));
3126
3237
  const i = Object.freeze({
3127
3238
  ...r,
3128
3239
  name: t
3129
3240
  });
3130
3241
  let o = null;
3131
- const n = this.beginCommit(bs("op.renameSheet"));
3242
+ const n = this.beginCommit(Os("op.renameSheet"));
3132
3243
  try {
3133
3244
  const e = this._updateSheetRef(r, i);
3134
3245
  this._adjustSheetNamesIfRequired(), this._sheetOnNameChange.forEach((e, t) => {
@@ -3139,24 +3250,24 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3139
3250
  }
3140
3251
  return o;
3141
3252
  }
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);
3253
+ _setSheetVisibility(e, t = St.Visibility.Visible, s) {
3254
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
3255
+ if (!this.getProtection().isStructureAllowed()) throw new Rs(xs("error.workbook.protection"));
3256
+ const r = this._getSheetRef(e, St.Visibility.VeryHidden);
3146
3257
  if (!r) return null;
3147
3258
  if (t === r.visibility) return;
3148
3259
  let i = null, o = "";
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"));
3260
+ t === St.Visibility.Visible ? o = Os("op.unhideSheet") : t === St.Visibility.Hidden ? o = Os("op.hideSheet") : t === St.Visibility.VeryHidden && (o = Os("op.veryHideSheet"));
3150
3261
  const n = this.beginCommit(o);
3151
3262
  try {
3152
3263
  const e = this._getState().sheetRefsVisible;
3153
- if (t !== mt.Visibility.Visible && 1 === e.length && e[0].id === r.id) throw new cs(Ss("error.workbook.sheetOne"));
3264
+ if (t !== St.Visibility.Visible && 1 === e.length && e[0].id === r.id) throw new ws(xs("error.workbook.sheetOne"));
3154
3265
  const o = {
3155
3266
  ...r,
3156
3267
  visibility: t
3157
3268
  };
3158
3269
  let a = -1;
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);
3270
+ t !== St.Visibility.Visible && (a = this._getOffsetForId(r.id, e)), i = this._updateSheetRef(r, o).sheet, t !== St.Visibility.Visible && this._adjustRemoveSelectionIfRequired(a, r.id), this._adjustSheetNamesIfRequired(), n.commit(s);
3160
3271
  } catch (e) {
3161
3272
  throw n.rollback(), e;
3162
3273
  }
@@ -3165,13 +3276,13 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3165
3276
  }), this._emitter.notify("onSheetsChange"), i;
3166
3277
  }
3167
3278
  _moveSheet(e, t, s) {
3168
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
3169
- if (!this.getProtection().isStructureAllowed()) throw new ws(Ss("error.workbook.protection"));
3279
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
3280
+ if (!this.getProtection().isStructureAllowed()) throw new Rs(xs("error.workbook.protection"));
3170
3281
  let r = null;
3171
- const i = this.beginCommit(Ss("op.moveSheetNamed", { name: e.name }));
3282
+ const i = this.beginCommit(xs("op.moveSheetNamed", { name: e.name }));
3172
3283
  try {
3173
3284
  const o = this._getState(), n = o.sheetRefsVisible;
3174
- if (t < 0 || t > n.length - 1) throw new cs(`Invalid to index: ${t}`);
3285
+ if (t < 0 || t > n.length - 1) throw new ws(`Invalid to index: ${t}`);
3175
3286
  const a = this.getView().getActiveSheetId(), l = o.sheetRefsAll, h = this._getOffsetForId(e.id, l), c = this._getOffsetForId(n[t].id, l);
3176
3287
  if (h === c) return;
3177
3288
  const u = l[h];
@@ -3185,11 +3296,11 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3185
3296
  return r;
3186
3297
  }
3187
3298
  _setSelectedSheet(e) {
3188
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
3299
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
3189
3300
  const t = this._getSheetRef(e);
3190
- if (!t) throw new cs(Lr(e));
3301
+ if (!t) throw new ws(Mr(e));
3191
3302
  let s = null;
3192
- return t.visibility !== mt.Visibility.Visible && this._setSheetVisibility(t, mt.Visibility.Visible), this._view.setActiveSheetId(t.id), s = t.sheet, s;
3303
+ return t.visibility !== St.Visibility.Visible && this._setSheetVisibility(t, St.Visibility.Visible), this._view.setActiveSheetId(t.id), s = t.sheet, s;
3193
3304
  }
3194
3305
  getProtection() {
3195
3306
  return this._protection;
@@ -3207,7 +3318,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3207
3318
  return this._calculation;
3208
3319
  }
3209
3320
  getFonts() {
3210
- return J.getShared();
3321
+ return re.getShared();
3211
3322
  }
3212
3323
  createFormula(e, t, s) {
3213
3324
  return this.getCalculation().createFormula(e, t, s);
@@ -3274,53 +3385,216 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3274
3385
  const e = this._pivotCaches;
3275
3386
  if (0 === e.length) return;
3276
3387
  const t = (e) => {
3277
- const t = this._getSheetRef(e), s = t && Kr(t) ? t.sheet : null;
3388
+ const t = this._getSheetRef(e), s = t && ti(t) ? t.sheet : null;
3278
3389
  return s ? s._contentAddWatch(() => null) : null;
3390
+ }, s = (e) => {
3391
+ for (const t of this._getSheetRefs(St.Visibility.VeryHidden)) {
3392
+ if (!ti(t)) continue;
3393
+ const s = t.sheet;
3394
+ if (s.getTables().getByName(e)) return s._contentAddWatch(() => null);
3395
+ }
3396
+ return null;
3397
+ }, r = (e, t) => {
3398
+ const s = this._getSheetRef(e);
3399
+ return s && ti(s) ? s.sheet.getRange(t) : null;
3400
+ }, i = (e) => {
3401
+ for (const t of this._getSheetRefs(St.Visibility.VeryHidden)) {
3402
+ if (!ti(t)) continue;
3403
+ const s = t.sheet.getTables().getByName(e);
3404
+ if (s) return s;
3405
+ }
3406
+ return null;
3407
+ }, o = (e, t) => {
3408
+ const s = this._pivotSourceNamed(e, t)?.getValue(), i = "string" == typeof s ? p(s) : null;
3409
+ return i && /^\$?[A-Za-z]+\$?\d+(?::\$?[A-Za-z]+\$?\d+)?$/.test(i.reference) ? r(i.sheet, i.reference.replaceAll("$", "")) : null;
3410
+ };
3411
+ for (let n = 0; n < e.length; n++) this._getState().pivotCacheData.has(e[n].cacheId) && (e[n]._hold(t, s), e[n]._watchSource(r, i, o));
3412
+ }
3413
+ _pivotCacheStore(e) {
3414
+ return {
3415
+ get: () => this._getState().pivotCacheData.get(e),
3416
+ set: (t) => {
3417
+ this._updateState((s) => ({
3418
+ ...s,
3419
+ pivotCacheData: new Map(s.pivotCacheData).set(e, t)
3420
+ }), Os("op.refreshPivotTable"));
3421
+ }
3422
+ };
3423
+ }
3424
+ _getPivotCache(e) {
3425
+ return this._getState().pivotCacheData.has(e) ? this._pivotCaches.find((t) => t.cacheId === e) ?? null : null;
3426
+ }
3427
+ _pivotSourceOf(e, t) {
3428
+ if (e.isITable) return { name: e.getName() };
3429
+ let s = null;
3430
+ if ("string" == typeof e) {
3431
+ for (const t of this._getSheetRefs(St.Visibility.VeryHidden)) if (ti(t) && t.sheet.getTables().getByName(e)) return { name: e };
3432
+ if (this.getNames().getByName(e)) return { name: e };
3433
+ if (t.getNames().getByName(e)?.getScope()) return {
3434
+ name: e,
3435
+ sheet: t.getName()
3436
+ };
3437
+ const r = p(e), i = r ? this._getSheetRef(r.sheet) : null;
3438
+ if (r && (!i || !ti(i))) return null;
3439
+ try {
3440
+ s = r ? i.sheet.getRange(r.reference) : t.getRange(e);
3441
+ } catch (e) {
3442
+ if (!(e instanceof ws)) throw e;
3443
+ return null;
3444
+ }
3445
+ } else s = e.isICellRange ? e : t.getRange(e);
3446
+ if (!s || s.isInvalid()) return null;
3447
+ const { rowStart: r, colStart: i, rowEnd: n, colEnd: a } = s.getCoords();
3448
+ return {
3449
+ ref: o({
3450
+ rowStart: r,
3451
+ colStart: i,
3452
+ rowEnd: n,
3453
+ colEnd: a
3454
+ }),
3455
+ sheet: s.getWorksheet().getName()
3279
3456
  };
3280
- for (let s = 0; s < e.length; s++) e[s]._hold(t);
3457
+ }
3458
+ _findPivotCache(e) {
3459
+ const t = (e, t) => (e ?? "").toLocaleLowerCase() === (t ?? "").toLocaleLowerCase();
3460
+ return this._pivotCaches.find((s) => {
3461
+ if (!this._getPivotCache(s.cacheId) || !s._getData().model || s._isStale()) return !1;
3462
+ const r = s._getSource();
3463
+ return !!r && t(r.ref, e.ref) && t(r.sheet, e.sheet) && t(r.name, e.name);
3464
+ }) ?? null;
3465
+ }
3466
+ _addPivotCache(e) {
3467
+ const t = this._pivotCaches.reduce((e, t) => Math.max(e, t.cacheId), -1) + 1, s = this._pivotCacheStore(t);
3468
+ s.set({
3469
+ part: null,
3470
+ model: e,
3471
+ partFormats: null,
3472
+ source: null
3473
+ });
3474
+ const r = new fr(t, s);
3475
+ return this._pivotCaches.push(r), this._holdPivotCaches(), r;
3476
+ }
3477
+ async _refreshPivotCaches(e, t) {
3478
+ const s = [];
3479
+ for (const t of this._getSheetRefs(St.Visibility.VeryHidden)) if (ti(t)) for (const r of t.sheet.getPivotTables().getItems()) e.has(r.getCacheId()) && s.push(r);
3480
+ for (const e of s) e._assertRefreshAllowed();
3481
+ for (const r of e) {
3482
+ const e = this._getPivotCache(r), i = e ? await this._pivotSourceRangeOf(e._getSource()) : null;
3483
+ if (!e || !i) throw new ws(xs("error.pivotTable.refreshSourceUnsupported"));
3484
+ if (i.getRowCount() < 2) throw new ws(xs("error.pivotTable.refreshSourceTooSmall"));
3485
+ i.getWorksheet()._cellBuffer?.release();
3486
+ const o = e.toJSON();
3487
+ if (!o.fields) throw new ws(xs("error.pivotTable.refreshSourceUnsupported"));
3488
+ const { model: n, remap: a } = t.refreshPivotCache(o, t.readPivotSource(i), e._getSource() ?? void 0, this._isDate1904);
3489
+ e._replace(n);
3490
+ for (const e of s) e.getCacheId() === r && e._remapCache(a, t);
3491
+ }
3492
+ for (const e of s) await e._prepareRelayout(t);
3493
+ for (const e of s) e._refresh(t);
3494
+ }
3495
+ async _refreshPivotCachesOnLoad() {
3496
+ const e = this._pivotCaches.filter((e) => !!e._getData().model?.refreshOnLoad);
3497
+ if (0 === e.length) return;
3498
+ const t = await wt.load();
3499
+ for (const s of e) {
3500
+ if (this._closed) return;
3501
+ try {
3502
+ await this._transactions.doBatch(() => this._refreshPivotCaches(/* @__PURE__ */ new Set([s.cacheId]), t));
3503
+ } catch (e) {
3504
+ if (!(e instanceof ws || e instanceof Rs)) throw e;
3505
+ }
3506
+ }
3507
+ }
3508
+ async _pivotSourceRangeOf(e) {
3509
+ if (!e) return null;
3510
+ if (e.ref) {
3511
+ if (!e.sheet || e.ref.includes("#REF!")) return null;
3512
+ const t = this._getSheetRef(e.sheet);
3513
+ return t && ti(t) ? t.sheet.getRange(e.ref) : null;
3514
+ }
3515
+ if (!e.name) return null;
3516
+ if (!e.sheet) for (const t of this._getSheetRefs(St.Visibility.VeryHidden)) {
3517
+ if (!ti(t)) continue;
3518
+ const s = t.sheet.getTables().getByName(e.name);
3519
+ if (!s || s.isDeleted()) continue;
3520
+ const { rowEnd: r } = s.getDataRange().getCoords();
3521
+ return t.sheet.getRange({
3522
+ ...s.getRange().getCoords(),
3523
+ rowEnd: r
3524
+ });
3525
+ }
3526
+ const t = await this._pivotSourceNamed(e.name, e.sheet ?? null)?.evaluate(), s = t?.isIReferenceRange ? t.getCoords() : null;
3527
+ if (!s?.scope) return null;
3528
+ const r = this._getSheetRef(s.scope);
3529
+ return r && ti(r) ? r.sheet.getRange(s) : null;
3530
+ }
3531
+ _pivotSourceNamed(e, t) {
3532
+ if (!t) return this.getNames().getByName(e);
3533
+ const s = this._getSheetRef(t);
3534
+ if (!s || !ti(s)) return null;
3535
+ const r = s.sheet.getNames().getByName(e);
3536
+ return r?.getScope() ? r : null;
3537
+ }
3538
+ _holdPivotSlicers() {
3539
+ const e = (e, t) => {
3540
+ const s = this._getSheetRef(e);
3541
+ return (s && ti(s) ? s.sheet : null)?.getPivotTables().getByName(t) ?? null;
3542
+ };
3543
+ for (const t of this._getSheetRefs(St.Visibility.VeryHidden)) {
3544
+ if (!ti(t)) continue;
3545
+ const s = t.sheet.getMovables().getItems();
3546
+ for (let t = 0; t < s.length; t++) {
3547
+ const r = s[t].getContent();
3548
+ r.isISlicer && r._holdPivotTables(e);
3549
+ }
3550
+ }
3281
3551
  }
3282
3552
  _fromJSON(e, t) {
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));
3553
+ if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || 0 === e.sheets.length) throw new ws(xs("error.workbook.sheetOne"));
3554
+ e.theme && (this._theme = new Y(e.theme), this._styles.setTheme(this._theme));
3285
3555
  const s = this._strings.beginPersist(), r = this._resources.beginPersist(), i = this._styles.beginPersist(), o = this._richValues.beginPersist();
3286
3556
  try {
3287
3557
  s.fromJSON(e.strings), r.fromJSON(e.resources), this._fetch.adopt(this._resources.getItems()), i.fromJSON(e.styles), o.fromJSON(e.richData, {
3288
3558
  resources: this._resources,
3289
3559
  strings: this._strings,
3290
3560
  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) {
3561
+ }, e.richTypes), e.date1904 && (this._isDate1904 = !0), this._codeName = e.codeName ?? null, this._updateLinks = e.updateLinks ?? null, this._hiddenPivotFieldList = !0 === e.hiddenPivotFieldList, this._documentProperties.fromJSON(e.properties), e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view || (e.view = {});
3562
+ const n = [], a = /* @__PURE__ */ new Map(), l = e.pivotCaches;
3563
+ if (l) {
3294
3564
  const e = r.fromResourceId.bind(r);
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)));
3565
+ for (let t = 0; t < l.length; t++) {
3566
+ const s = l[t];
3567
+ s && "number" == typeof s.cacheId && !a.has(s.cacheId) && a.set(s.cacheId, fr.dataOf(s, e));
3298
3568
  }
3299
3569
  }
3570
+ this._updateState({ pivotCacheData: a });
3571
+ for (const e of a.keys()) n.push(new fr(e, this._pivotCacheStore(e)));
3300
3572
  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;
3573
+ const h = e.sheets, c = h.length;
3574
+ let u = e.view.activeSheetId ?? null;
3575
+ null !== u && (u = Math.min(Math.max(0, u), c - 1));
3576
+ let d = null, g = null;
3305
3577
  this._isLoadingSheets = !0;
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);
3578
+ for (let e = 0; e < c; e++) {
3579
+ const s = h[e], i = s.visibility || St.Visibility.Visible, o = e;
3580
+ g = o, i === St.Visibility.Visible ? null === d && (d = o) : null !== u && u === o && (u = null);
3309
3581
  try {
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 }));
3582
+ const n = s.kind ?? St.Kind.Worksheet;
3583
+ if (n !== St.Kind.Worksheet) {
3584
+ const a = s.sheet, l = nt.fromJSON(a?.part, r.fromResourceId.bind(r));
3585
+ if (!l) throw new ws(xs("error.workbook.sheetPartMissing", { sheetName: s.name }));
3314
3586
  this._createOpaqueSheet(o, s.name, i, e, s.sheetId, n, l, a?.tabColor ?? null, t?.[e]);
3315
3587
  } else this._createSheet(o, s.name, i, e, s.sheetId, s.sheet, t?.[e]);
3316
3588
  } catch (e) {
3317
3589
  throw this._isLoadingSheets = !1, e;
3318
3590
  }
3319
3591
  }
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 });
3592
+ this._isLoadingSheets = !1, this._tellSheets(), this._holdPivotCaches(), this._holdPivotSlicers();
3593
+ for (const e of this._getSheetRefs(St.Visibility.VeryHidden)) ti(e) && e.sheet._tellPivots();
3594
+ this._updateState({ lastId: g }), e.view.activeSheetId = u ?? d, this.setView(new Ar({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
3595
+ const m = this;
3596
+ this._protection = new Pr(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
3597
+ m._emitter.notify("onProtectionChange", { source: e });
3324
3598
  } }), this._emitter.notify("onLoad");
3325
3599
  } finally {
3326
3600
  o.endPersist(), i.endPersist(), r.endPersist(), s.endPersist();
@@ -3328,7 +3602,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3328
3602
  }
3329
3603
  async _startFunctions() {
3330
3604
  const e = this._scripts;
3331
- if (!e) return as.EmptyArray;
3605
+ if (!e) return fs.EmptyArray;
3332
3606
  await e._load();
3333
3607
  const t = [];
3334
3608
  for (const s of e.getModules().getItems()) this._startModules.add(s), t.push(...s.getFunctions().getItems({
@@ -3339,14 +3613,14 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3339
3613
  }
3340
3614
  _createScripts(e) {
3341
3615
  const t = this;
3342
- return new ur({
3616
+ return new yr({
3343
3617
  transactions: this._transactions,
3344
3618
  json: e,
3345
3619
  workbook: t,
3346
3620
  getBuiltInFunctions: () => t._calculation?.getFunctions(),
3347
3621
  onAdd: (e, s) => {
3348
3622
  const r = t._calculation;
3349
- r.getStatus() !== ae.Status.Off && r.start().then(async () => {
3623
+ r.getStatus() !== tt.Status.Off && r.start().then(async () => {
3350
3624
  if (t._startModules.has(s)) return;
3351
3625
  const e = s.getFunctions().getItems({
3352
3626
  type: "formula",
@@ -3357,7 +3631,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3357
3631
  try {
3358
3632
  await this._calculation.getFunctions().add(s);
3359
3633
  } catch (e) {
3360
- ms.error(e?.message ?? String(e), e);
3634
+ ks.error(e?.message ?? String(e), e);
3361
3635
  }
3362
3636
  }
3363
3637
  }).catch(() => {});
@@ -3366,10 +3640,10 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3366
3640
  });
3367
3641
  }
3368
3642
  async toJSON(e) {
3369
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
3643
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
3370
3644
  await Promise.resolve(this._starting);
3371
3645
  const t = this.getCalculation();
3372
- t.getStatus() !== ae.Status.Off && (await t.ready(), await t._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
3646
+ t.getStatus() !== tt.Status.Off && (await t.ready(), await t._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
3373
3647
  const s = { sheets: [] }, r = e?.ignoreStyles ?? !1;
3374
3648
  if (!r) {
3375
3649
  const e = this._theme.toJSON();
@@ -3379,38 +3653,38 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3379
3653
  const e = this._scripts.toJSON();
3380
3654
  e && Object.keys(e).length > 0 && (s.modules = e);
3381
3655
  }
3382
- this._isDate1904 && (s.date1904 = !0), this._codeName && (s.codeName = this._codeName), this._updateLinks && (s.updateLinks = this._updateLinks);
3656
+ this._isDate1904 && (s.date1904 = !0), this._codeName && (s.codeName = this._codeName), this._updateLinks && (s.updateLinks = this._updateLinks), this._hiddenPivotFieldList && (s.hiddenPivotFieldList = !0);
3383
3657
  const i = this._documentProperties.toJSON();
3384
3658
  Object.keys(i).length > 0 && (s.properties = i), this._locale && (s.locale = this._locale), this._localeOverrides && (s.localeOverrides = this._localeOverrides);
3385
3659
  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();
3386
3660
  try {
3387
3661
  const t = this._getSheetRef(this.getSelectedSheetIndex()).id;
3388
3662
  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++) {
3663
+ const d = this._getState(), g = d.sheetRefsAll, m = d.sheetsById, f = g.length;
3664
+ for (let r = 0; r < f; r++) {
3391
3665
  const o = g[r], n = r + 1;
3392
3666
  let a;
3393
3667
  const h = m.get(o.id);
3394
- if (Kr(o)) a = {
3668
+ if (ti(o)) a = {
3395
3669
  name: o.name,
3396
3670
  sheet: await o.sheet.toJSON(e)
3397
3671
  };
3398
3672
  else {
3399
- const e = h, t = l ? l.toResourceId.bind(l) : () => null, s = { part: Ze.toJSON(e._getPart(), t) }, r = e.getTabColor();
3673
+ const e = h, t = l ? l.toResourceId.bind(l) : () => null, s = { part: nt.toJSON(e._getPart(), t) }, r = e.getTabColor();
3400
3674
  r && (s.tabColor = r.toString()), a = {
3401
3675
  name: o.name,
3402
3676
  kind: e.getKind(),
3403
3677
  sheet: s
3404
3678
  };
3405
3679
  }
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);
3680
+ void 0 !== o.sheetId && (a.sheetId = o.sheetId), o.visibility === St.Visibility.Visible ? null === u && (u = n) : a.visibility = o.visibility, o.id === t && (i = n), s.sheets.push(a);
3407
3681
  }
3408
3682
  if (!r) {
3409
3683
  const e = h.toJSON();
3410
3684
  e && Object.keys(e).length > 0 && (s.styles = e);
3411
3685
  }
3412
- const f = this.getProtection().toJSON();
3413
- f && (s.protection = f);
3686
+ const _ = this.getProtection().toJSON();
3687
+ _ && (s.protection = _);
3414
3688
  const p = this._calculation.toJSON();
3415
3689
  Object.keys(p).length > 0 && (s.calc = p);
3416
3690
  const w = await a.toJSONAsync();
@@ -3421,15 +3695,20 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3421
3695
  const e = c.toKindsJSON();
3422
3696
  e.length > 0 && (s.richTypes = e);
3423
3697
  }
3424
- const b = this._calculation.getExternalBooks().toJSON();
3425
- b && (s.externalBooks = b);
3426
- const S = this._pivotCaches;
3427
- if (S.length > 0) {
3698
+ const S = this._calculation.getExternalBooks().toJSON();
3699
+ S && (s.externalBooks = S);
3700
+ const b = this._pivotCaches;
3701
+ if (b.length > 0) {
3428
3702
  const e = l ? l.toResourceId.bind(l) : () => null, t = /* @__PURE__ */ new Set();
3429
3703
  for (const e of this.getPivotTables()) t.add(e.getCacheId());
3430
- const r = [];
3431
- for (let s = 0; s < S.length; s++) t.has(S[s].cacheId) && r.push(S[s].toJSON(e));
3432
- r.length > 0 && (s.pivotCaches = r);
3704
+ const r = Ce(this);
3705
+ for (let e = 0; e < r.length; e++) {
3706
+ const s = r[e].toJSON()?.pivot?.cacheId;
3707
+ void 0 !== s && t.add(s);
3708
+ }
3709
+ const i = [];
3710
+ for (let s = 0; s < b.length; s++) t.has(b[s].cacheId) && i.push(b[s].toJSON(e));
3711
+ i.length > 0 && (s.pivotCaches = i);
3433
3712
  }
3434
3713
  const k = this._people.toJSON();
3435
3714
  if (k && (s.people = k), !n) {
@@ -3461,16 +3740,16 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3461
3740
  } catch (e) {
3462
3741
  console.warn("error on close", e);
3463
3742
  }
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;
3743
+ 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 Ds && this._originProvider.release(), this._closed = !0;
3465
3744
  }
3466
3745
  beginCommit(e) {
3467
- if (this._closed) throw new Error(Ss("error.workbook.modelClosed"));
3746
+ if (this._closed) throw new Error(xs("error.workbook.modelClosed"));
3468
3747
  return this._beginCommit("string" == typeof e ? { description: e } : e);
3469
3748
  }
3470
3749
  doBatch(e, t) {
3471
3750
  const r = this;
3472
3751
  t = "string" == typeof t ? { description: t } : {
3473
- description: bs("op.updateWorkbook"),
3752
+ description: Os("op.updateWorkbook"),
3474
3753
  ...t
3475
3754
  };
3476
3755
  const i = s.bind(this._transactions, this, e);
@@ -3490,7 +3769,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3490
3769
  _getState() {
3491
3770
  return this._transactions.getState(this._id);
3492
3771
  }
3493
- _updateState(e, t = bs("op.updateWorkbook"), s) {
3772
+ _updateState(e, t = Os("op.updateWorkbook"), s) {
3494
3773
  if (!e) return;
3495
3774
  const r = this._beginCommit(t);
3496
3775
  try {
@@ -3511,7 +3790,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3511
3790
  get isIWorkbook() {
3512
3791
  return !0;
3513
3792
  }
3514
- }, $r = { address: null }, Kr = (e) => e.sheet.getKind() === mt.Kind.Worksheet, Gr = class {
3793
+ }, ei = { address: null }, ti = (e) => e.sheet.getKind() === St.Kind.Worksheet, si = class {
3515
3794
  constructor() {
3516
3795
  this._readFormats = [], this._writeFormats = [], this._encryptions = [];
3517
3796
  }
@@ -3588,9 +3867,9 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3588
3867
  return !0;
3589
3868
  });
3590
3869
  }
3591
- }, Xr = /* @__PURE__ */ new WeakMap(), Yr = (e) => !!e && "object" == typeof e && "function" == typeof e.getPath && "function" == typeof e.canWrite, Zr = class {
3870
+ }, ri = /* @__PURE__ */ new WeakMap(), ii = (e) => !!e && "object" == typeof e && "function" == typeof e.getPath && "function" == typeof e.canWrite, oi = class {
3592
3871
  constructor() {
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());
3872
+ this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new e(this), this._registry = new si(), this._defaultStore = new Hs(() => this.getWriteFormats(), () => this.getReadFormats());
3594
3873
  }
3595
3874
  getBackingStore() {
3596
3875
  return this._backingStore ?? this._defaultStore;
@@ -3625,15 +3904,15 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3625
3904
  return this._registry.getWriteFormats(e);
3626
3905
  }
3627
3906
  getOrigin(e) {
3628
- return new Rs(e);
3907
+ return new Fs(e);
3629
3908
  }
3630
3909
  async read(e) {
3631
3910
  let t = null;
3632
3911
  if ("string" == typeof e) e = { source: e };
3633
- else if (Yr(e)) {
3912
+ else if (ii(e)) {
3634
3913
  const s = e.getPath();
3635
3914
  if (!s) throw new Error("Cannot read from an unbound origin (no path).");
3636
- Ls(e) ? e = {
3915
+ Ms(e) ? e = {
3637
3916
  source: s,
3638
3917
  asCopy: !0
3639
3918
  } : (t = e, e = { source: s });
@@ -3648,25 +3927,22 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3648
3927
  async _decodeBuffer(e, t = {}, s, r = null) {
3649
3928
  const i = t.format, o = t.ext;
3650
3929
  if (!i && !o) throw new Error("Either format or file extension must be provided to determine read type.");
3651
- const n = (await this._registry.getReadFormats({
3652
- search: i,
3653
- ext: o
3654
- }))[0];
3655
- if (!n) throw new cs(Ss("error.io.readFormatUnavailable", { format: i ?? o }));
3930
+ const n = (await this._registry.getReadFormats(i ? { search: i } : { ext: o }))[0];
3931
+ if (!n) throw new ws(xs("error.io.readFormatUnavailable", { format: i ?? o }));
3656
3932
  const a = s?.typedCreateWorkbookOptions, l = a ? Object.keys(a).find((e) => e.toLowerCase() === n.key.toLowerCase()) : void 0;
3657
3933
  let h = {
3658
3934
  ...s,
3659
3935
  ...void 0 !== l ? a[l] : void 0
3660
3936
  };
3661
3937
  delete h.typedCreateWorkbookOptions, delete h.source, delete h.asCopy;
3662
- const c = r ?? new Rs(t.absolutePath ?? null, {
3938
+ const c = r ?? new Fs(t.absolutePath ?? null, {
3663
3939
  name: t.name ?? null,
3664
3940
  format: n.key,
3665
3941
  size: t.size ?? null,
3666
3942
  lastModified: t.lastModified ?? null,
3667
3943
  canWrite: t.canWrite ?? !1
3668
3944
  });
3669
- r instanceof Rs && r.update({
3945
+ r instanceof Fs && r.update({
3670
3946
  format: n.key,
3671
3947
  size: t.size ?? null,
3672
3948
  lastModified: t.lastModified ?? null
@@ -3700,7 +3976,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3700
3976
  }
3701
3977
  async _decrypt(e, t, s) {
3702
3978
  const r = await this._registry.detectEncryption(e);
3703
- if (t instanceof Rs && t.update({ encryption: r ? r.key : null }), !r) return {
3979
+ if (t instanceof Fs && t.update({ encryption: r ? r.key : null }), !r) return {
3704
3980
  bytes: e,
3705
3981
  password: null
3706
3982
  };
@@ -3709,7 +3985,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3709
3985
  try {
3710
3986
  return i = await r.decode(e, t), !0;
3711
3987
  } catch (e) {
3712
- if (!(e instanceof ds)) throw e;
3988
+ if (!(e instanceof Ss)) throw e;
3713
3989
  return !1;
3714
3990
  }
3715
3991
  };
@@ -3719,7 +3995,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3719
3995
  };
3720
3996
  if (!s?.onPassword) {
3721
3997
  const e = t.getName();
3722
- throw new ps(e ? Ss("error.io.passwordRequired", { name: e }) : Ss("error.io.passwordRequiredUnnamed"));
3998
+ throw new Is(e ? xs("error.io.passwordRequired", { name: e }) : xs("error.io.passwordRequiredUnnamed"));
3723
3999
  }
3724
4000
  const n = await Promise.resolve(s.onPassword({
3725
4001
  origin: t,
@@ -3735,16 +4011,16 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3735
4011
  bytes: i,
3736
4012
  password: n
3737
4013
  };
3738
- throw new ds(Ss("error.io.passwordIncorrect"));
4014
+ throw new Ss(xs("error.io.passwordIncorrect"));
3739
4015
  }
3740
4016
  async writeArrayBuffer(e, t) {
3741
4017
  if (!t?.format) throw new Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
3742
4018
  const s = (await this._registry.getWriteFormats({ search: t.format }))[0];
3743
- if (!s) throw new cs(Ss("error.io.writeFormatUnavailable", { format: t.format }));
4019
+ if (!s) throw new ws(xs("error.io.writeFormatUnavailable", { format: t.format }));
3744
4020
  return this._writeArrayBuffer(e, s, t);
3745
4021
  }
3746
4022
  async write(e, t, s) {
3747
- return "string" == typeof t || Yr(t) ? this._write(e, t, !1, s) : this._write(e, e?.getOrigin?.(), !0, t ?? s);
4023
+ return "string" == typeof t || ii(t) ? this._write(e, t, !1, s) : this._write(e, e?.getOrigin?.(), !0, t ?? s);
3748
4024
  }
3749
4025
  async writeAs(e, t, s) {
3750
4026
  if (!t) throw new Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
@@ -3756,13 +4032,13 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3756
4032
  let i = "string" == typeof t ? this.getOrigin(t) : t;
3757
4033
  const o = i.getFormat();
3758
4034
  let n;
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"));
4035
+ 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 ws(xs("error.io.writeFormatUnresolved"));
3760
4036
  const a = i.getExtension();
3761
4037
  if (r?.format && a && i.getPath() && i.canWrite() && !n.exts.includes(a)) {
3762
4038
  const e = (await this._registry.getWriteFormats({ ext: a }))[0];
3763
4039
  if (e && e.key !== n.key) {
3764
4040
  const e = i.getPath().split(/[/\\]/).pop();
3765
- throw new cs(Ss("error.io.writeFormatMismatch", {
4041
+ throw new ws(xs("error.io.writeFormatMismatch", {
3766
4042
  format: r.format,
3767
4043
  file: e
3768
4044
  }));
@@ -3770,21 +4046,21 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3770
4046
  }
3771
4047
  if ("string" == typeof t) {
3772
4048
  const e = i.getPath();
3773
- i = new Rs(ke(e) ? e : `${e}.${n.exts[0]}`, { format: n.key });
4049
+ i = new Fs(Be(e) ? e : `${e}.${n.exts[0]}`, { format: n.key });
3774
4050
  }
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);
4051
+ const l = i.getEncryption(), h = e.getOrigin?.(), c = (i instanceof Fs ? i.getPassword() : null) ?? (h instanceof Fs ? h.getPassword() : null), u = i.isEncrypted() || (h?.isEncrypted() ?? !1), d = void 0 !== r?.password ? r.password : c ?? (u ? void 0 : null);
3776
4052
  let g = null;
3777
4053
  if (void 0 === d) {
3778
4054
  if (u) {
3779
4055
  const e = i.getName();
3780
- throw new ps(e ? Ss("error.io.passwordRequiredSave", { name: e }) : Ss("error.io.passwordRequiredSaveUnnamed"));
4056
+ throw new Is(e ? xs("error.io.passwordRequiredSave", { name: e }) : xs("error.io.passwordRequiredSaveUnnamed"));
3781
4057
  }
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;
4058
+ } else if (null !== d && (g = await this._registry.getEncryption(l), !g)) throw new ws(xs("error.io.encryptionUnavailable"));
4059
+ const m = `${i.getName() ?? xs("workbook.defaultName")}.${n.exts[0]}`, f = r?.progress, _ = !i.getPath() || !i.canWrite() || !!r?.prompt;
3784
4060
  let p = !1;
3785
4061
  const w = this;
3786
- let y = null, b = [];
3787
- const S = {
4062
+ let y = null, S = [];
4063
+ const b = {
3788
4064
  workbook: e,
3789
4065
  format: n,
3790
4066
  origin: i,
@@ -3793,7 +4069,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3793
4069
  async encode(t, o) {
3794
4070
  const a = o ?? i;
3795
4071
  await (async (e) => {
3796
- p || (p = !0, _?.onStart && await Promise.resolve(_.onStart(e)));
4072
+ p || (p = !0, f?.onStart && await Promise.resolve(f.onStart(e)));
3797
4073
  })(a), y = e.getTransactions?.()?.getCurrentCommit() ?? y;
3798
4074
  const l = t ? (await w._registry.getWriteFormats({ search: t }))[0] ?? n : n, h = [], c = ((e, t) => ({
3799
4075
  onStart: e?.onStart ? (t, s) => e.onStart(t, s) : void 0,
@@ -3806,34 +4082,34 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3806
4082
  context: r
3807
4083
  }), e?.onWarning?.(s, r);
3808
4084
  }
3809
- }))(_, h), u = await w._writeArrayBuffer(e, l, {
4085
+ }))(f, h), u = await w._writeArrayBuffer(e, l, {
3810
4086
  ...r,
3811
4087
  progress: c
3812
- }), m = Xr.get(a);
4088
+ }), m = ri.get(a);
3813
4089
  if (h.some((e) => !m?.has(e.message)) && r?.onWarnings) {
3814
4090
  const t = await Promise.resolve(r.onWarnings({
3815
4091
  workbook: e,
3816
4092
  origin: a,
3817
4093
  warnings: h,
3818
4094
  save: s,
3819
- canCancel: !f
4095
+ canCancel: !_
3820
4096
  }));
3821
- if (!f && !1 === t) return null;
4097
+ if (!_ && !1 === t) return null;
3822
4098
  }
3823
- return b = h, g ? g.encode(u, d) : u;
4099
+ return S = h, g ? g.encode(u, d) : u;
3824
4100
  }
3825
4101
  };
3826
4102
  let k = null;
3827
4103
  try {
3828
4104
  const t = this.getBackingStore();
3829
4105
  if (!t.write) throw new Error("The active backing store is read-only (no write implementation).");
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);
4106
+ if (k = await t.write(b), k) {
4107
+ if (void 0 !== d && k instanceof Fs && (k.setPassword(d), k.update({ encryption: g ? g.key : null })), S.length) {
4108
+ const e = ri.get(k) ?? /* @__PURE__ */ new Set();
4109
+ for (const t of S) e.add(t.message);
4110
+ ri.set(k, e);
3835
4111
  }
3836
- s && k !== e.getOrigin() && Ls(e.getOrigin())?.setOrigin(k);
4112
+ s && k !== e.getOrigin() && Ms(e.getOrigin())?.setOrigin(k);
3837
4113
  const t = y ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
3838
4114
  this._emitter.notify("onWrite", {
3839
4115
  params: {
@@ -3845,16 +4121,16 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3845
4121
  transactional: !1
3846
4122
  });
3847
4123
  }
3848
- _?.onComplete && await Promise.resolve(_.onComplete(k));
4124
+ f?.onComplete && await Promise.resolve(f.onComplete(k));
3849
4125
  } catch (e) {
3850
4126
  const t = e instanceof Error ? e : new Error(String(e));
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 });
4127
+ if (f?.onError && await Promise.resolve(f.onError(t)), f?.onComplete && await Promise.resolve(f.onComplete(null)), t instanceof ws) throw t;
4128
+ throw new Error(xs("error.io.writeFailed", { reason: t.message }), { cause: e });
3853
4129
  }
3854
4130
  return k;
3855
4131
  }
3856
4132
  _stripExtension(e) {
3857
- const t = ke(e);
4133
+ const t = Be(e);
3858
4134
  return t ? e.slice(0, e.length - t.length - 1) : e;
3859
4135
  }
3860
4136
  _baseName(e) {
@@ -3866,7 +4142,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3866
4142
  if (!t) throw new Error("A write format must be provided.");
3867
4143
  const r = t.handler;
3868
4144
  if (!r) throw new Error(`Unable to resolve a write handler for '${t.key}'.`);
3869
- return r(e, {
4145
+ return at(t.key) || await Re.assertUsable("exports", 0), r(e, {
3870
4146
  ...s,
3871
4147
  format: t.key
3872
4148
  });
@@ -3874,25 +4150,25 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3874
4150
  async _readArrayBuffer(e, t, s) {
3875
4151
  if (!e) throw new Error("ArrayBuffer must be specified.");
3876
4152
  if (!t) throw new Error("format must be specified.");
3877
- if (0 === e.byteLength) return new qr(s?.createWorkbookOptions);
4153
+ if (0 === e.byteLength) return new Qr(s?.createWorkbookOptions);
3878
4154
  const r = t.handler;
3879
4155
  if (!r) throw new Error(`Unable to resolve a read handler for '${t.key}'.`);
3880
4156
  let i;
3881
4157
  try {
3882
4158
  i = await r(e, s);
3883
4159
  } catch (e) {
3884
- if (e instanceof cs) throw e;
3885
- throw new cs(Ss("error.io.readFailed", {
4160
+ if (e instanceof ws) throw e;
4161
+ throw new ws(xs("error.io.readFailed", {
3886
4162
  format: t.description ?? t.key,
3887
4163
  reason: e?.message ?? String(e)
3888
4164
  }), { cause: e });
3889
4165
  }
3890
- return await lt(), i;
4166
+ return await pe(), i;
3891
4167
  }
3892
4168
  get isIWorkbookIO() {
3893
4169
  return !0;
3894
4170
  }
3895
- }, Qr = new Zr(), ei = class {
4171
+ }, ni = new oi(), ai = class {
3896
4172
  constructor() {
3897
4173
  this._buffer = null, this._formatKey = null;
3898
4174
  }
@@ -3906,7 +4182,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3906
4182
  async read(e) {
3907
4183
  return this._buffer ? e.decode(this._buffer, { format: this._formatKey ?? void 0 }) : null;
3908
4184
  }
3909
- }, ti = "locales", si = "fonts", ri = {
4185
+ }, li = "locales", hi = "fonts", ci = {
3910
4186
  suffix: ".msg.json",
3911
4187
  async extract(e) {
3912
4188
  const t = e.relPath.split("/");
@@ -3916,7 +4192,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3916
4192
  } : null;
3917
4193
  },
3918
4194
  place: (e, t) => t ? `${t}/${e}` : null
3919
- }, ii = [
4195
+ }, ui = [
3920
4196
  ".woff2",
3921
4197
  ".woff",
3922
4198
  ".ttf",
@@ -3926,7 +4202,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3926
4202
  ].map((e) => ({
3927
4203
  suffix: e,
3928
4204
  place: (e, t) => t ? `${t}/${e}` : e
3929
- })), oi = {
4205
+ })), di = {
3930
4206
  suffix: ".metrics.json",
3931
4207
  async extract(e) {
3932
4208
  const t = await e.readJson();
@@ -3937,13 +4213,13 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3937
4213
  } : null;
3938
4214
  },
3939
4215
  place: (e, t) => t ? `${t}/${e}` : e
3940
- }, ni = [{
3941
- kind: ti,
3942
- files: [ri]
4216
+ }, gi = [{
4217
+ kind: li,
4218
+ files: [ci]
3943
4219
  }, {
3944
- kind: si,
4220
+ kind: hi,
3945
4221
  files: [
3946
- oi,
4222
+ di,
3947
4223
  {
3948
4224
  suffix: ".hinted.json",
3949
4225
  async extract(e) {
@@ -3955,7 +4231,7 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3955
4231
  hinted: !0
3956
4232
  } : null;
3957
4233
  },
3958
- place: oi.place
4234
+ place: di.place
3959
4235
  },
3960
4236
  {
3961
4237
  suffix: ".rows.json",
@@ -3968,40 +4244,79 @@ var Dr, zr = "workbook.activeSheet", Hr = class e extends _t {
3968
4244
  rows: !0
3969
4245
  } : null;
3970
4246
  },
3971
- place: oi.place
4247
+ place: di.place
3972
4248
  },
3973
- ...ii
4249
+ ...ui
3974
4250
  ]
3975
4251
  }];
3976
- async function ai(e, t) {
3977
- const { Chart: s } = await import("./DbPUG2DcQ3T_QhcJ.mjs");
4252
+ async function mi(e, t) {
4253
+ const { Chart: s } = await import("./CFkX_Cn6avQqQiVC.mjs");
3978
4254
  return new s({
3979
4255
  json: e,
3980
4256
  getStyles: t?.getStyles
3981
4257
  });
3982
4258
  }
3983
- Dr || (Dr = {});
3984
- var li = null;
3985
- function hi() {
3986
- if (!li) {
3987
- const e = import("./xRGObcoaGDnAZFnj.mjs").then((e) => e.loadScriptingDeclarations());
4259
+ var fi, _i = {
4260
+ showRowHeaders: !0,
4261
+ showColumnHeaders: !0,
4262
+ showRowStripes: !1,
4263
+ showColumnStripes: !1,
4264
+ showLastColumn: !0
4265
+ }, pi = class extends _t {
4266
+ constructor(e, t, s, r) {
4267
+ super(e, t?.getProperties() ?? { name: "" }, {
4268
+ rowStart: 0,
4269
+ colStart: 0,
4270
+ rowEnd: r - 1,
4271
+ colEnd: 4
4272
+ }), this._options = s, this._rows = r;
4273
+ }
4274
+ _isSubheading(e) {
4275
+ return e > 0 && e < this._rows - 1 && (e - 1) % 3 == 0;
4276
+ }
4277
+ _coveringAt(e, t) {
4278
+ if (e < 0 || e >= this._rows || t < 0 || t >= 5) return [];
4279
+ const { showRowHeaders: s, showColumnHeaders: r, showRowStripes: i, showColumnStripes: o, showLastColumn: n } = this._options, a = ["wholeTable"];
4280
+ return o && a.push(t % 2 == 0 ? "firstColumnStripe" : "secondColumnStripe"), i && a.push(e % 2 == 0 ? "firstRowStripe" : "secondRowStripe"), 0 === e ? (0 === t && s && a.push("firstColumn"), r && a.push("headerRow"), 0 === t && s && r && a.push("firstHeaderCell")) : (0 === t && s && a.push("firstColumn"), this._isSubheading(e) && s && a.push("firstRowSubheading")), 4 === t && n && a.push("lastColumn"), e === this._rows - 1 && a.push("totalRow"), a;
4281
+ }
4282
+ _bandOf(e, t, s) {
4283
+ return "firstRowSubheading" === s ? `${e}` : "";
4284
+ }
4285
+ }, wi = (e, t, s, r = 5) => {
4286
+ const i = Math.max(3, Math.floor(r)), o = new pi(e, t, s ?? _i, i);
4287
+ return {
4288
+ rows: i,
4289
+ columns: 5,
4290
+ getStyleAt: (t, s) => c(void 0, e, o, {
4291
+ rowStart: t,
4292
+ colStart: s,
4293
+ rowEnd: t,
4294
+ colEnd: s
4295
+ })
4296
+ };
4297
+ };
4298
+ fi || (fi = {});
4299
+ var yi = null;
4300
+ function Si() {
4301
+ if (!yi) {
4302
+ const e = import("./CERNLhFrAwtu_p-q.mjs").then((e) => e.loadScriptingDeclarations());
3988
4303
  e.catch(() => {
3989
- li = null;
3990
- }), li = e;
4304
+ yi = null;
4305
+ }), yi = e;
3991
4306
  }
3992
- return li;
4307
+ return yi;
3993
4308
  }
3994
- var ci, ui, di, gi = null;
3995
- function mi() {
3996
- if (!gi) {
3997
- const e = import("./xRGObcoaGDnAZFnj.mjs").then((e) => e.loadScriptingApi()).then((e) => JSON.parse(e));
4309
+ var bi, ki, Ci, vi = null;
4310
+ function Ii() {
4311
+ if (!vi) {
4312
+ const e = import("./CERNLhFrAwtu_p-q.mjs").then((e) => e.loadScriptingApi()).then((e) => JSON.parse(e));
3998
4313
  e.catch(() => {
3999
- gi = null;
4000
- }), gi = e;
4314
+ vi = null;
4315
+ }), vi = e;
4001
4316
  }
4002
- return gi;
4317
+ return vi;
4003
4318
  }
4004
- ci || (ci = {}), (ui || (ui = {})).Type = {
4319
+ bi || (bi = {}), (ki || (ki = {})).Type = {
4005
4320
  Button: "button",
4006
4321
  CheckBox: "checkBox",
4007
4322
  OptionButton: "optionButton",
@@ -4014,12 +4329,12 @@ ci || (ci = {}), (ui || (ui = {})).Type = {
4014
4329
  EditBox: "editBox",
4015
4330
  Dialog: "dialog",
4016
4331
  Unknown: "formControl"
4017
- }, (di || (di = {})).DropStyle = {
4332
+ }, (Ci || (Ci = {})).DropStyle = {
4018
4333
  Combo: "combo",
4019
4334
  ComboEdit: "comboEdit",
4020
4335
  Simple: "simple"
4021
4336
  };
4022
- var _i = class extends S {
4337
+ var Ri = class extends rt {
4023
4338
  constructor(e) {
4024
4339
  super(e);
4025
4340
  }
@@ -4032,8 +4347,8 @@ var _i = class extends S {
4032
4347
  colEnd: (e?.size?.width ?? 5) - 1,
4033
4348
  rowEnd: (e?.size?.height ?? 5) - 1
4034
4349
  },
4035
- getRanges: (e) => new g(null)
4350
+ getRanges: (e) => new m(null)
4036
4351
  }, super._initializeOptions(e);
4037
4352
  }
4038
- }, fi = "0.8.0-beta.14", pi = "2026-11-04T17:50:22.886Z";
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 };
4353
+ }, Ni = "0.8.0-beta.16", Oi = "2026-11-05T02:02:09.588Z";
4354
+ export { He as AbstractCollection, r as AbstractMovableContent, x as AddressUtils, ai as ArrayBackingStore, I as AutoFill, Oi as BUILD_DATE, ce as CellControlRegistry, ke as CellImage, Ct as CellImageKind, l as ChartElementSelection, us as ChartKinds, V as CheckboxKind, Qt as Color, Et as Condition, Ee as DateUtils, oi as DefaultWorkbookIO, Rt as EXTERNAL_LINK_PATH_REL_TYPE, xr as ExternalRangeClipboardItem, hi as FONTS_KIND, Cr as Fetcher, Gt as FontUtils, oe as FormulaText, or as FunctionDeclarations, X as GeomUtils, Lt as Hyperlink, Oe as HyperlinkKind, It as IAnchored, Kt as IBorders, tt as ICalculation, me as ICell, sr as ICellHeaderRange, te as ICellRange, tr as ICellRanges, as as ICellStyle, os as IColor, xt as ICondition, de as IConditionalFormat, Vr as ICustomProperty, ae as IDataValidation, Ci as IDropDown, Yt as IEffect, ls as IFill, Pt as IFont, re as IFontCollection, zt as IFontStyle, ki as IFormControl, Ft as IGeometry, bi as IMovable, Ge as IPageLayout, fi as IPicture, he as IPivotTable, er as IResource, f as IRichDataKind, Pe as IScript, ts as IShape, St as ISheet, j as ISlicerStyle, Ps as ISort, ss as IStroke, B as ITable, A as ITableStyle, ht as IText, ns as ITextFrame, Qs as ITheme, d as IThemeCollection, Es as IWorkbookIO, mr as IWorkbookView, Tt as IWorksheetView, li as LOCALES_KIND, Re as LicenseManager, ge as MovableContentRegistry, R as NamedStyleCollection, rs as NumberFormat, cs as PaintUtils, pr as PersonCollection, Or as RangeClipboardItem, zs as RectAlignment, st as Registry, y as Resource, k as ResourceCollection, De as RichArray, We as RichArrayKind, dt as RichDataCollection, lt as RichDataRegistry, et as RichRecord, Ot as RichText, ee as RichTextKind, gi as SHEETXL_RESOURCE_KINDS, es as SYSTEM_COLOR_CSS_PREFIX, Ht as ShapeStyleUtils, w as SimpleFontFace, z as SlicerStyleCollection, Fe as Sort, ie as StringCollection, Ke as StyleCollection, Ri as Table, K as TableStyleCollection, xe as TextRotation, pt as TextStacked, Qe as TextUtils, Y as Theme, At as ThemeCollection, t as TransactionConflictError, Ts as TransactionSaveStateManager, i as TransactionStore, Vs as TransactionUndoManager, fe as Tuple, Ni as VERSION, Qr as Workbook, ni as WorkbookIO, Fs as WorkbookOrigin, Ar as WorkbookView, se as Worksheet, Ys as builtInStyleNameDisplay, b as createCellRangeCounts, mi as createChart, ne as externalBookClosedName, v as externalBookFileName, S as externalBookLocation, q as externalBookOpenName, P as findLabel, ar as getBuiltInFunctionNames, Ze as getLanguagePack, Zt as getLocaleProfile, yt as getScriptRuntime, Ii as getScriptingApi, Si as getScriptingDeclarations, h as localizeBoolean, qe as localizeErrorLabel, is as makeLocaleProfile, we as normalizeLabel, D as parseBooleanLocal, H as parseErrorLocal, Ye as parseExternalScope, lr as parseFormulaLiteral, Z as pivotBoxOf, a as pivotCellFormatsOf, Ae as pivotControlsIn, wi as pivotStylePreviewOf, U as registerSdkLocales, u as sourceEntryFromPath, ot as withScriptRuntime };