@sheetxl/studio-vanilla 0.8.0-beta.10 → 0.8.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (484) hide show
  1. package/browser/esm/-uhPvS_bULnsjqVB.mjs +42 -0
  2. package/{cdn/assets/CBdNC7BOfc5TewHU.js → browser/esm/0YsENrFzj1ssAX9X.mjs} +1 -1
  3. package/browser/esm/{UTZcodQydbuMfCOS.mjs → 1wWPvtsW8DO6CafH.mjs} +1 -1
  4. package/{cdn/assets/BWo1N4YbK_zGU0nu.js → browser/esm/2FB6h8pTc_l_B6QZ.mjs} +1 -1
  5. package/browser/esm/{ClJvUf8aR8vNC_3Z.mjs → 30UYToote05ZLTtr.mjs} +3 -3
  6. package/browser/esm/{CnWNviK4qlX2GVl6.mjs → 41b1AdCV6QfkOX6l.mjs} +12 -13
  7. package/browser/esm/{BBjgqNlHm-ssbSAG.mjs → 4HrBEVQGdmXVxVf1.mjs} +1 -1
  8. package/browser/esm/{pKc_RPdZPLAgvNDh.mjs → 7eHYbjATYWtDW-AI.mjs} +2 -2
  9. package/browser/esm/{DNCqTF9EbT-U1TdV.mjs → A3koQh6ZccdaHPzY.mjs} +3 -3
  10. package/browser/esm/{BThOwSja2ra4xejQ.mjs → B1mhVM8eRIyuL-VB.mjs} +1587 -1456
  11. package/browser/esm/{rY-dC3WB558TIbum.mjs → B34vCv1wwb2Fh4ml.mjs} +4 -4
  12. package/browser/esm/{_MPToH4oMe4rhTdZ.mjs → B4UdS-Kh0oOnw3V5.mjs} +3 -3
  13. package/browser/esm/{CCd192S7yVpc6iOe.mjs → B5sj4wVSU_Gnsoij.mjs} +17 -16
  14. package/{cdn/assets/BAH_cWcQEIBKWnl6.js → browser/esm/B8-nLKLPjZ7pIJdE.mjs} +48 -37
  15. package/browser/esm/{BVJUL2HhoedhbwVy.mjs → B8yozzawr3e-MiZS.mjs} +12 -11
  16. package/browser/esm/BCB8nt_33nVNFVTT.mjs +199 -0
  17. package/browser/esm/BFHtja51jzj6fA8G.mjs +193 -0
  18. package/browser/esm/{C5EKgE9Owsc_juw-.mjs → BFNrFZtdVve-yU4e.mjs} +1 -1
  19. package/browser/esm/{ZbGPiRN9j0629JJQ.mjs → BFlPNsdaR2vXjM1-.mjs} +2 -2
  20. package/browser/esm/{PtGiIWFBYP-ujLmf.mjs → BFp4JZFwKkq3wPHv.mjs} +1 -1
  21. package/browser/esm/{kVBPUUnVyZfb8pf3.mjs → BGr-y2dCzvyaUCy_.mjs} +41 -41
  22. package/{cdn/assets/_t0Mx-mUFVtmVNkU.js → browser/esm/BHy_akSib7chMKWg.mjs} +1 -1
  23. package/browser/esm/BIX8xNwuEM4TocmY.mjs +131 -0
  24. package/browser/esm/{ByUcqyCNfqi5Mm7w.mjs → BJjL3rPHHyI2VT5N.mjs} +1 -1
  25. package/browser/esm/{sDVzjXC1mS5rucF5.mjs → BKXXOCxg9jVDeZfx.mjs} +639 -758
  26. package/browser/esm/{DxwprgjYhcmfDbXH.mjs → BNXqFlCmhhuJanX6.mjs} +19 -19
  27. package/browser/esm/BPNL7vh8nmg0q7RW.mjs +281 -0
  28. package/browser/esm/BSdjvRtT06k7pqHv.mjs +422 -0
  29. package/browser/esm/{FO1Jezau486fH4kN.mjs → BSzeqNbK-wYbCwiv.mjs} +1 -1
  30. package/browser/esm/{DLhK_oSGg71ry6-m.mjs → BVHz28PPZYw-4V5f.mjs} +45 -45
  31. package/{cdn/assets/CwqRA5h1u92Cyit-.js → browser/esm/BVV0zPpEupxaFfVv.mjs} +2 -2
  32. package/browser/esm/{DG3BfxRsbjey-B7E.mjs → BXiTuaDcF2kDzTB0.mjs} +2 -2
  33. package/browser/esm/{B7iV5qzlmJlM2nQv.mjs → BZWVm5Tz9V78n97U.mjs} +2 -2
  34. package/browser/esm/{BMlPFJ1glExv-70Z.mjs → BZbqsj8CH_yl3myW.mjs} +1 -1
  35. package/browser/esm/{x6GcENwqoUVbd60j.mjs → B_oYpGQQp9ELbGXT.mjs} +1 -1
  36. package/browser/esm/BdK6G62ymmr00Ghb.mjs +104 -0
  37. package/browser/esm/Bdqs1vuxUIzfBU03.mjs +101 -0
  38. package/browser/esm/{vGKTE7yjY8y-XnsW.mjs → Bfefutdeq9eAruVm.mjs} +2 -2
  39. package/browser/esm/{Dwxz0s23ra1tRtsH.mjs → BikqeuAc1ownJULP.mjs} +3 -2
  40. package/{cdn/assets/BSCja5yvevmKZPBB.js → browser/esm/Bj-ggr3Qgt0J39xx.mjs} +1 -1
  41. package/browser/esm/Bkg2ukKnA4m4qbgG.mjs +181 -0
  42. package/browser/esm/BmmbYyO6_Vr_L5NJ.mjs +9990 -0
  43. package/browser/esm/{CaS8_J5HfBRk5_Nw.mjs → Bn-CqbXsrYIajb_W.mjs} +33 -33
  44. package/{cdn/assets/DxcRLd7wmBGDgJsA.js → browser/esm/BoFEETlY0hZb0PRp.mjs} +1 -1
  45. package/browser/esm/{D2aQPiGg0ZoMYzuf.mjs → BoYTs2k2yWAKW5LM.mjs} +5 -5
  46. package/browser/esm/BqPEItNoP2iZ2lkz.mjs +163 -0
  47. package/browser/esm/Bs9KvD8n3018Rkew.mjs +281 -0
  48. package/browser/esm/Bsy5EeZ_mwI_CkSO.mjs +86 -0
  49. package/browser/esm/{_zRV52yhE4gPf3XI.mjs → BuQYmB0EDLYZ7vEk.mjs} +46 -46
  50. package/{cdn/assets/gpQ4FdJMbIScKnS_.js → browser/esm/BukdAMyKW6rq3Unk.mjs} +8 -8
  51. package/browser/esm/BvcoyRz135FDHoTf.mjs +392 -0
  52. package/browser/esm/{BRfat1fV3oGLwvin.mjs → Bw4fe7a608CgkbOH.mjs} +13 -13
  53. package/browser/esm/{Dy44qJVkwNseMG-3.mjs → BxE8BJ1tb5HybBNO.mjs} +1 -1
  54. package/{cdn/assets/DfESVLC8CAi8m8A7.js → browser/esm/BxIfM-Ty_Y8PvQFM.mjs} +1 -1
  55. package/{cdn/assets/DWgp4t9N9u0eWthH.js → browser/esm/ByREbsIyjgFePvoo.mjs} +1 -1
  56. package/browser/esm/{ZxsFYopF0_WWqw4Q.mjs → Bz4k83C83NmszjPX.mjs} +1 -1
  57. package/browser/esm/C07dijMoobBfewot.mjs +298 -0
  58. package/browser/esm/{Bi5-feQLtwpV6Ai8.mjs → C1KeUfpnO7aNynxZ.mjs} +5 -5
  59. package/browser/esm/{DAprxR00V9qvNLL2.mjs → C1utJcalKxjNT3Gr.mjs} +1944 -1812
  60. package/browser/esm/{djM9mJznx8GzVq51.mjs → C6SaFrr0KAAAdu5x.mjs} +14 -14
  61. package/browser/esm/{CSEMxasVyGCekxKf.mjs → C6axT8aFQqaiuRgS.mjs} +1 -1
  62. package/browser/esm/{BeMLfv6hWo15VCIL.mjs → C8daZgnuV1jUOiO9.mjs} +52 -52
  63. package/browser/esm/{BaEZmurTZnX_yfKD.mjs → CADJznHV1GZ-1Cy0.mjs} +341 -386
  64. package/browser/esm/{BlPn_DXaEXOPxMxC.mjs → CAFDldpwa2ZDlh3u.mjs} +1 -1
  65. package/browser/esm/CAIREtREYTvydXO6.mjs +30 -0
  66. package/browser/esm/{mZ92wNrHVpYdli1U.mjs → CAQSV7_d1zCSeBZC.mjs} +20 -20
  67. package/browser/esm/CASTsylgIqgqFwk2.mjs +1443 -0
  68. package/browser/esm/{DoS1sE431fEhdOQb.mjs → CCdxM0LTBnAIrkEU.mjs} +4 -4
  69. package/browser/esm/CDreRSyWs9eXZR9O.mjs +23468 -0
  70. package/browser/esm/CE8E_UvKufBd3-Vt.mjs +569 -0
  71. package/browser/esm/CEIE_OT8nrKGkqjg.mjs +1390 -0
  72. package/browser/esm/CEvmiZ2C2QopD1yx.mjs +322 -0
  73. package/browser/esm/{CDsuiN--qdALFyql.mjs → CFqf8Tjk5MUKtniB.mjs} +2 -2
  74. package/{cdn/assets/CTdFZ_I-41Vr6Dy4.js → browser/esm/CGXU95J36TlX8lDH.mjs} +1 -1
  75. package/browser/esm/{SNze-adFJwKuGSQW.mjs → CHSMmjtqQs2IqcYo.mjs} +1 -1
  76. package/browser/esm/{DjdkGy-EI1kSo226.mjs → CImdnjQtd2Yn7uXl.mjs} +1 -1
  77. package/browser/esm/{aUREGNA8H7p4BpMK.mjs → CL0vZohrUAp3Bhj3.mjs} +3 -3
  78. package/{cdn/assets/B0Wjc3lwtjKMwnvn.js → browser/esm/CLUYMovkh-bwvZJ0.mjs} +1 -1
  79. package/browser/esm/CLrTsOW_jOs09qSP.mjs +86 -0
  80. package/browser/esm/CNcLDXQDQECQxvtA.mjs +141 -0
  81. package/browser/esm/{sxxbiJiCMOW2Eivd.mjs → COPR5sXYEAeM73Ep.mjs} +8518 -6392
  82. package/browser/esm/COh0UZopdYUbHVON.mjs +1648 -0
  83. package/{cdn/assets/J3hutJxqQiHENpIe.js → browser/esm/CPhsbNkI0TuotSlv.mjs} +123 -120
  84. package/browser/esm/{cwuYkcKwsKkPe3gG.mjs → CQFPbvY6xwLpTjbF.mjs} +2 -2
  85. package/{cdn/assets/BwOxnbR61WFJwy0A.js → browser/esm/CRDxpPkzVM-9K8qp.mjs} +1 -1
  86. package/browser/esm/{LAbUYeLiPG8z9cmA.mjs → CS6fe9pkg0OdRzns.mjs} +48 -48
  87. package/browser/esm/{CvWGtHslTdesJik-.mjs → CSyQPhbn_NN6at59.mjs} +10 -9
  88. package/browser/esm/{DAE3Kv0Vs0VuBecT.mjs → CUXpeET-vxHGYwKn.mjs} +1 -1
  89. package/{cdn/assets/VCiu_neIjCTg2NUa.js → browser/esm/CW9UkULY0jchroYa.mjs} +486 -487
  90. package/{cdn/assets/BPrHgyAsm2Htx15h.js → browser/esm/CWOJrduWjvqg69sM.mjs} +1 -1
  91. package/browser/esm/CX1VWdQjKSXDMfs9.mjs +1240 -0
  92. package/browser/esm/{DGcvio2uhlrsE3ZY.mjs → CZP3O5VDZVpsmWVP.mjs} +10 -10
  93. package/browser/esm/{By3a43qwWICwXRmw.mjs → CdDn85jCBS6ljPJV.mjs} +3162 -2130
  94. package/browser/esm/{DLqc11Pf8vaE4Q5B.mjs → Cf_c9xyOrFxlsKq6.mjs} +1 -1
  95. package/browser/esm/{f1OJemsiZnbwnds-.mjs → CfgJaRI3Iz3K-TwG.mjs} +15 -15
  96. package/browser/esm/{BAdRecWK1maKGOZd.mjs → ChSr970S44fUscYr.mjs} +1 -1
  97. package/browser/esm/{B00ixdmb8-O5ijEp.mjs → CiGcHB-RQCGm-yoH.mjs} +1 -1
  98. package/browser/esm/CiL1ItKLy_bO7Vxj.mjs +1552 -0
  99. package/browser/esm/{CMxbiQ5J79M3n1tk.mjs → Cif0315haNLmyMj-.mjs} +723 -373
  100. package/browser/esm/Cjb4nzJvvuN1770o.mjs +9632 -0
  101. package/browser/esm/{DrI_S0A9TQvriTua.mjs → Cjj81VfZROKYtV3v.mjs} +1 -1
  102. package/browser/esm/{CTI-mCJbJzitJZwj.mjs → Ck-YCK18HOJsHw_I.mjs} +1 -1
  103. package/browser/esm/Cl8aWyu9oSfXhYSR.mjs +323 -0
  104. package/browser/esm/{px-aQ8dMjiWag_pV.mjs → ClFYlhnkBAxJCKn6.mjs} +1 -1
  105. package/browser/esm/{ErIXJFPDFXwGEL8V.mjs → ClQWS65BOnsz_YeL.mjs} +2 -2
  106. package/browser/esm/{BxhKgo_rPQ2d12HT.mjs → ClhxJ7aAVlYxWbAt.mjs} +4 -4
  107. package/{cdn/assets/CVcCUfSRsiZ1-6hs.js → browser/esm/CnROzMriBlKuLOfF.mjs} +1 -1
  108. package/browser/esm/{DeUXRggj8Oz9ru_i.mjs → CnzNEpCntiBfW9x5.mjs} +1 -1
  109. package/browser/esm/{ycmpAs4kQfeh78Pa.mjs → CoqGjnCpY3LxqR0v.mjs} +1 -1
  110. package/browser/esm/Cq8VN3vpOLOO-bA5.mjs +160 -0
  111. package/browser/esm/{CVxlfyE-gnJM8hOz.mjs → CrIHwDDOUDcx5WSM.mjs} +18 -18
  112. package/browser/esm/CtYy8KL3L1_bf81k.mjs +8416 -0
  113. package/browser/esm/CupZAF0s99q3CQd5.mjs +200 -0
  114. package/browser/esm/{qYca4mdySLkACfo1.mjs → CutcHdJ4BMcr7Yev.mjs} +1 -1
  115. package/browser/esm/{BCWTI3jdTPG37r8W.mjs → CuuWjNFFRxXfbQnD.mjs} +3 -3
  116. package/{cdn/assets/DVpi1vC8ixXvUQG_.js → browser/esm/Cxk1E_D7BKR7Crmt.mjs} +1 -1
  117. package/browser/esm/{DQEjvIGMgEkiaP6J.mjs → CyTOT4NnE9dWtJIT.mjs} +1 -1
  118. package/{cdn/assets/BNsqqoZY7a4N1wWC.js → browser/esm/D1-rdRh8N55p4-Be.mjs} +328 -110
  119. package/browser/esm/{C4VT6lNbpaDXCpBb.mjs → D29bSsh1Lz8891Rs.mjs} +2 -2
  120. package/browser/esm/{DnyZmrwPxShyeUjm.mjs → D3wUli_CzQR9jT6L.mjs} +118 -269
  121. package/browser/esm/{DSviq1TNoiIAGW7W.mjs → D5kDtvIsPIJuJZSx.mjs} +1 -1
  122. package/browser/esm/D5znyg42EULLErlX.mjs +89 -0
  123. package/browser/esm/{ByqhqEMBLrnkaPKE.mjs → D7cf_Sx-iAIIVwe-.mjs} +31 -29
  124. package/browser/esm/{DaMKWQQTgIF08cT7.mjs → D8hdsSDxM_AQvffB.mjs} +21 -21
  125. package/browser/esm/D9ukH57ON841L8l9.mjs +232 -0
  126. package/browser/esm/DAAcSj6LxLO-O2io.mjs +195 -0
  127. package/browser/esm/{rkTVQiYG3wd8oPom.mjs → DAOjpr33PSwrKpc0.mjs} +3 -3
  128. package/browser/esm/{Dme0qpRinBnhzp53.mjs → DDw_9YBEaF76ezn9.mjs} +163 -162
  129. package/{cdn/assets/lqknEt3DTma5Juxs.js → browser/esm/DEtgba3E0qoHN6kX.mjs} +1 -1
  130. package/{cdn/assets/BhkeuRcx8RlLCQ5E.js → browser/esm/DEvc6BS99hZ9e4Nf.mjs} +1 -1
  131. package/browser/esm/{DqBj-9o7UdXu4qhb.mjs → DFbfNcr6j1gD5R0e.mjs} +1 -1
  132. package/browser/esm/DGmXLEMWMnQeqrl0.mjs +1723 -0
  133. package/browser/esm/{Cpza4AeltEVHASij.mjs → DHDlrgx5YyzbhqKA.mjs} +3 -3
  134. package/browser/esm/DIk6ek73xbGQ4xfD.mjs +7 -0
  135. package/browser/esm/{CtZPEkaldpJpoGtW.mjs → DJpfJorMrLhI9gOT.mjs} +1311 -1305
  136. package/browser/esm/{Dv8aQFTTaQBJKDDk.mjs → DLMAXayirBhfpTF4.mjs} +1 -1
  137. package/browser/esm/{CHMqT9DzYKTxPfP6.mjs → DLmLaWoLePonCiIs.mjs} +1 -1
  138. package/{cdn/assets/DQIRFXG4MveFkK3I.js → browser/esm/DN3iFnh1WSc7HR3p.mjs} +1 -1
  139. package/{cdn/assets/DXo8mR6t5HGsmTcu.js → browser/esm/DOJmeQHkbmz7giHc.mjs} +1 -1
  140. package/browser/esm/DP2a0oPlz27NpeSK.mjs +5117 -0
  141. package/browser/esm/DPfiS_S7rRs2M9Cu.mjs +7 -0
  142. package/browser/esm/DQ82Eg2cUZQyNA4P.mjs +521 -0
  143. package/browser/esm/{BN2d5U1nw7pRtOrn.mjs → DQM2LZ7Kj3QqfQQQ.mjs} +1 -1
  144. package/browser/esm/DSGiFB7hgRaKj-cD.mjs +7 -0
  145. package/browser/esm/{Db6Tvr45TS9J5Qsb.mjs → DTMNj2-Tz6uVTsgT.mjs} +34 -32
  146. package/browser/esm/{CWJzHmEgahdOfNjH.mjs → DTOHItHWueMl2jTm.mjs} +1 -1
  147. package/browser/esm/{D7DWH3-5fBNx8jtc.mjs → DTqURSvX1bHPWFue.mjs} +2 -2
  148. package/{cdn/assets/W1d6GQyySAHrtjEu.js → browser/esm/DWiPD9nqIDk253BM.mjs} +1804 -1016
  149. package/browser/esm/DXdI4tKe6B5dN40W.mjs +3106 -0
  150. package/browser/esm/DXou7Fhas1K3cubZ.mjs +7 -0
  151. package/{cdn/assets/BoFx07POTorOb5g-.js → browser/esm/Dac2pa3EUXg26xcV.mjs} +2534 -1724
  152. package/browser/esm/DasqwTiX41sYA-Z5.mjs +496 -0
  153. package/browser/esm/{DTn9oYyiIYgyijAk.mjs → Dbp-4nVzRBTazDLP.mjs} +42 -41
  154. package/browser/esm/DcEZ6cwiDjpacXxO.mjs +86 -0
  155. package/browser/esm/{CZOJogyZqMfUxcXj.mjs → DccxaAgL5rauj9rq.mjs} +1 -1
  156. package/{cdn/assets/C3r_9RqlWrEmlXZ1.js → browser/esm/DchNCIMGQQc9yEcv.mjs} +1 -1
  157. package/browser/esm/{CqoHxlGpZ3yzPj5V.mjs → Df7AbwG1nXGuHhch.mjs} +12 -12
  158. package/browser/esm/DhmmOd1KzvzI8TQB.mjs +12820 -0
  159. package/browser/esm/DmdChrGkm5oufbRE.mjs +57594 -0
  160. package/browser/esm/{B3Ii8x6RquHW1jMc.mjs → DmhXiZKFYiX4Qwqd.mjs} +10 -10
  161. package/browser/esm/DmxkMii2he30NfJu.mjs +8315 -0
  162. package/browser/esm/{DGuynZFJ9tqziqQs.mjs → DnFo-URDJaN2rhB9.mjs} +15 -15
  163. package/browser/esm/Do8jxgfFz8I1GsZA.mjs +89 -0
  164. package/browser/esm/DonP1tI3OXvxTqS_.mjs +213 -0
  165. package/browser/esm/Dr4kKrXEju3xH3h6.mjs +367 -0
  166. package/{cdn/assets/BsTFy_iJXJYmaO3Z.js → browser/esm/Du726HNvoVYMKBbH.mjs} +136 -144
  167. package/{cdn/assets/DONxZZT2Iwu7psS5.js → browser/esm/DuWZI1YgqBc4D0Wk.mjs} +6 -5
  168. package/browser/esm/DwhJsbgOZVQE9ZPT.mjs +210 -0
  169. package/browser/esm/Dx5lr1OiCVdVCwxl.mjs +9 -0
  170. package/browser/esm/DxVYvgAm5kxHC0F6.mjs +310 -0
  171. package/{cdn/assets/anQDUZhHMDPi1eha.js → browser/esm/DyHtw6zo0efVZUoT.mjs} +168 -162
  172. package/browser/esm/DyanYbYqqcmiADCL.mjs +1298 -0
  173. package/browser/esm/{CQuv-nk5jtXUfu7C.mjs → FvGpi7liPpu6KLv8.mjs} +2 -2
  174. package/browser/esm/HI2Ksbl0-etNK-w-.mjs +36 -0
  175. package/{cdn/assets/CQOyeq_-pg3CM-uA.js → browser/esm/Hl08NtZ1eAIRJ5OF.mjs} +1 -1
  176. package/browser/esm/{-LoBx7J6imeqaxCq.mjs → IHk5INXMVCzM8mcG.mjs} +81 -81
  177. package/browser/esm/{D0r2MPlWLnStWJNW.mjs → IogRavGG6hfOXNQU.mjs} +127 -117
  178. package/browser/esm/{CRAzVh3CaAa16avf.mjs → JvhO1o6YbI5ppwQ0.mjs} +47 -46
  179. package/browser/esm/{BtGmrIqU9W1L8zfZ.mjs → K83ea52GGB2voaRd.mjs} +1 -1
  180. package/{cdn/assets/H-JnJQMcZQbpvjdb.js → browser/esm/KHZcJAKLztwlFOCX.mjs} +1 -1
  181. package/browser/esm/{DJqj66SnUcx0QmSN.mjs → MH5L1dIGBq_LYgJQ.mjs} +1 -1
  182. package/browser/esm/Ovh5ic9JtH6cyxub.mjs +256 -0
  183. package/browser/esm/Ow0yLNSbuT3WBj7H.mjs +262 -0
  184. package/browser/esm/{BsUrrzAgfyAdcCJW.mjs → PRhdAO5xkLnZQvlu.mjs} +2 -2
  185. package/{cdn/assets/RfHd1JATBlcsfLPv.js → browser/esm/QPsDtDrq66DM_Jgr.mjs} +1 -1
  186. package/browser/esm/RDCRv0dAc6JkDyGp.mjs +2265 -0
  187. package/browser/esm/S_MFnyIZkCY_IGVg.mjs +95 -0
  188. package/browser/esm/T-NlR9otpSbQQkLg.mjs +1702 -0
  189. package/browser/esm/{C-0viTjg1dT2F-sk.mjs → TMjhDpsh4dAyEK9h.mjs} +2 -2
  190. package/{cdn/assets/Dc2ZwgbIEgYWwAsF.js → browser/esm/Yqn8laB5RV0kueLN.mjs} +1 -1
  191. package/{cdn/assets/DjtXfgbmXjUAoG0y.js → browser/esm/ZO6hi53k1jfq_DU2.mjs} +1 -1
  192. package/{cdn/assets/J9i3r1fU0H10b2hX.js → browser/esm/ZbJ95fcT_MlmJnVS.mjs} +1 -1
  193. package/{cdn/assets/i0P63Wd0RRlgJotb.js → browser/esm/_7u2a1HvX3quwuxr.mjs} +1 -1
  194. package/browser/esm/{DvWCBuY0jAL-RmJV.mjs → _9nyq5XWoIo-JhAp.mjs} +626 -595
  195. package/browser/esm/_LInZdm_bLSAlTs_.mjs +6149 -0
  196. package/browser/esm/{DRm1R4uVOkaMfXNI.mjs → acJyiuSRKv5sM-Ti.mjs} +13 -7
  197. package/browser/esm/bruq8xlrMhamz8NL.mjs +390 -0
  198. package/browser/esm/dt7TM5WM9kIfxkSp.mjs +3853 -0
  199. package/browser/esm/{CfltjY8hY-RPwwpd.mjs → ed053aDmYbCrCagn.mjs} +7 -7
  200. package/browser/esm/{CxCipDFamYSOctBo.mjs → gjyNCBbdz-gEETZG.mjs} +47 -45
  201. package/browser/esm/index.mjs +49 -645
  202. package/browser/esm/{D-KZpU6HMaP4VUva.mjs → k_OJDj5JL9UFeBxP.mjs} +45 -45
  203. package/browser/esm/k_pfnr7cFrRmfgMa.mjs +12 -0
  204. package/browser/esm/{Cy00y9b9j17Txyv1.mjs → luSDFTDDahiW2BkV.mjs} +1 -1
  205. package/browser/esm/m57Z_Zg2K9WPtv--.mjs +60 -0
  206. package/browser/esm/{C9NyIoUahFiyRCxP.mjs → mmNCqaa6lU6cygSY.mjs} +1 -1
  207. package/browser/esm/{iC69oOND5T8khIWf.mjs → n2-EbZF2IGbi-IOd.mjs} +6 -6
  208. package/browser/esm/n3-ex6JlSC4JH_g3.mjs +780 -0
  209. package/{cdn/assets/CFvKDDbrL3wpXnQH.js → browser/esm/sSoL-JlTRttZ1-fW.mjs} +1 -1
  210. package/browser/esm/{VwGokBaawZfZiV2X.mjs → wA7bEwDV1UUss-PV.mjs} +1 -1
  211. package/browser/esm/{DSf-Db1h8rlW2A6n.mjs → wSauAivL_wCxM6Ga.mjs} +5 -5
  212. package/{cdn/assets/pc49xtHdprXZLW2X.js → browser/esm/xZUqtJfNziRMVyQ7.mjs} +1 -1
  213. package/browser/esm/{DNaPo7BQu6hr1fWq.mjs → ypqwC2WOP09mA_DM.mjs} +1 -1
  214. package/cdn/assets/-ONZeuKryrnW6SqH.js +7 -0
  215. package/cdn/assets/-uhPvS_bULnsjqVB.js +42 -0
  216. package/cdn/assets/02n1f3j11O2nHvBs.js +12820 -0
  217. package/{browser/esm/CBdNC7BOfc5TewHU.mjs → cdn/assets/0YsENrFzj1ssAX9X.js} +1 -1
  218. package/cdn/assets/1FbtXPZOekXDPfdd.js +8 -0
  219. package/cdn/assets/{UTZcodQydbuMfCOS.js → 1wWPvtsW8DO6CafH.js} +1 -1
  220. package/{browser/esm/BWo1N4YbK_zGU0nu.mjs → cdn/assets/2FB6h8pTc_l_B6QZ.js} +1 -1
  221. package/cdn/assets/4F0v3wQNJ-MSB1Z9.js +220 -0
  222. package/cdn/assets/{BBjgqNlHm-ssbSAG.js → 4HrBEVQGdmXVxVf1.js} +1 -1
  223. package/cdn/assets/4uQOx5zyAS8XS4V9.js +570 -0
  224. package/cdn/assets/5rqFRBFU7lnnjNt9.js +201 -0
  225. package/cdn/assets/6b6s5IgeVwRY9P2V.js +367 -0
  226. package/cdn/assets/8xJqIpI3i63EGuLs.js +522 -0
  227. package/cdn/assets/9p5WDkFicYKTatuq.js +7 -0
  228. package/cdn/assets/B-TEQ5laJQKfikUa.js +193 -0
  229. package/cdn/assets/B2OGndaMH7WCvuMK.js +96 -0
  230. package/cdn/assets/{wM7DzeOpoEGBVDBe.js → B3AsVCTRSPU1ivoY.js} +2 -2
  231. package/cdn/assets/B3BU0-K9s4221y_E.js +199 -0
  232. package/cdn/assets/{BzbP4jaN13wC9aSi.js → B5znT6l0E-uRlPxA.js} +37 -37
  233. package/cdn/assets/{CMVTwWHsRgyfSEDM.js → B6OFPBPyKNkonkt9.js} +67 -65
  234. package/cdn/assets/B6bTGjqGJ3hSb6pB.js +8 -0
  235. package/cdn/assets/B6h2EKukHEqfcsPq.js +324 -0
  236. package/{browser/esm/BAH_cWcQEIBKWnl6.mjs → cdn/assets/B8-nLKLPjZ7pIJdE.js} +48 -37
  237. package/cdn/assets/BAhj7LTdgVDdLIKM.js +19 -0
  238. package/cdn/assets/{C7fu6LrSMBlHqwUy.js → BDihhtyza6JVj9NA.js} +4 -4
  239. package/cdn/assets/{C5EKgE9Owsc_juw-.js → BFNrFZtdVve-yU4e.js} +1 -1
  240. package/cdn/assets/{PtGiIWFBYP-ujLmf.js → BFp4JZFwKkq3wPHv.js} +1 -1
  241. package/{browser/esm/_t0Mx-mUFVtmVNkU.mjs → cdn/assets/BHy_akSib7chMKWg.js} +1 -1
  242. package/cdn/assets/{ByUcqyCNfqi5Mm7w.js → BJjL3rPHHyI2VT5N.js} +1 -1
  243. package/cdn/assets/BKjJbAprthCpiw7j.js +161 -0
  244. package/cdn/assets/BOHADYkBeL7j5Ho7.js +73 -0
  245. package/cdn/assets/BQn64Kmc0TqWvQiu.js +23468 -0
  246. package/cdn/assets/BSW3wcvLJdkMerg-.js +106 -0
  247. package/cdn/assets/{FO1Jezau486fH4kN.js → BSzeqNbK-wYbCwiv.js} +1 -1
  248. package/cdn/assets/BT_kLzJXjQJNGh3-.js +100 -0
  249. package/{browser/esm/D-55MlIn7Wo_hdjI.mjs → cdn/assets/BXGRt1EwLc3igx5S.js} +328 -110
  250. package/cdn/assets/{BMlPFJ1glExv-70Z.js → BZbqsj8CH_yl3myW.js} +1 -1
  251. package/cdn/assets/{x6GcENwqoUVbd60j.js → B_oYpGQQp9ELbGXT.js} +1 -1
  252. package/cdn/assets/Be4tcI4SKU9TMyEs.js +393 -0
  253. package/cdn/assets/BikqeuAc1ownJULP.js +8 -0
  254. package/{browser/esm/BSCja5yvevmKZPBB.mjs → cdn/assets/Bj-ggr3Qgt0J39xx.js} +1 -1
  255. package/cdn/assets/{BpZ7P0CO148rR4zW.js → BjtBV7ztQseHdo8M.js} +20 -20
  256. package/cdn/assets/BlTY4-ozlyDyATkO.js +298 -0
  257. package/cdn/assets/BnQT4TCx14FYGPY3.js +9990 -0
  258. package/cdn/assets/{DZRm4H75lnEtOG8e.js → Bnj3M_FtbBvXs6S0.js} +48 -46
  259. package/{browser/esm/DxcRLd7wmBGDgJsA.mjs → cdn/assets/BoFEETlY0hZb0PRp.js} +1 -1
  260. package/cdn/assets/BpAcFe7In_tm1ABk.js +89 -0
  261. package/cdn/assets/{CFBgmXap8kmumhoz.js → Bq7qR2iV54cQ01_R.js} +127 -117
  262. package/{browser/esm/D2coM-dNrlLpnUu5.mjs → cdn/assets/BqM-W_oFdjeyu8N4.js} +670 -669
  263. package/cdn/assets/Bqig7R2_wU0MB4ED.js +90 -0
  264. package/cdn/assets/{DHH_uKVzQ_kRYO2N.js → BsqHMd3dlKhcIxe_.js} +18 -18
  265. package/cdn/assets/{CakrxSS_RXtKmcUX.js → BtkcL_9ZfETfOGfP.js} +98 -97
  266. package/cdn/assets/{ENtt4kmaU9mJfVEp.js → Bu13LK_GiwLEhVKN.js} +10 -10
  267. package/cdn/assets/{Dy44qJVkwNseMG-3.js → BxE8BJ1tb5HybBNO.js} +1 -1
  268. package/{browser/esm/DfESVLC8CAi8m8A7.mjs → cdn/assets/BxIfM-Ty_Y8PvQFM.js} +1 -1
  269. package/{browser/esm/DWgp4t9N9u0eWthH.mjs → cdn/assets/ByREbsIyjgFePvoo.js} +1 -1
  270. package/cdn/assets/{ZxsFYopF0_WWqw4Q.js → Bz4k83C83NmszjPX.js} +1 -1
  271. package/cdn/assets/{De2z8LdHaWRFiR5T.js → BzBqhomOXJGtdxGv.js} +2 -2
  272. package/cdn/assets/C-U3gssGyd3ntzi3.js +8 -0
  273. package/cdn/assets/C-XZlxDIT5yzdwLJ.js +1724 -0
  274. package/cdn/assets/C0gMuR6xw09uB9Y1.js +46 -0
  275. package/cdn/assets/{w5IQWbJETgHhqMsY.js → C3Qtch7pRtEQgfRY.js} +33 -33
  276. package/cdn/assets/C3xbTjAw1VI9Lxza.js +516 -0
  277. package/{browser/esm/8-jmVNNbOHuXFdVQ.mjs → cdn/assets/C4ou3rMjNo5m8Y1t.js} +123 -120
  278. package/cdn/assets/C5rqIz-t0kclqYgG.js +86 -0
  279. package/cdn/assets/{CSEMxasVyGCekxKf.js → C6axT8aFQqaiuRgS.js} +1 -1
  280. package/cdn/assets/{0vqRTRN0wEzWao1c.js → C6xvp_PZBhXeoGRc.js} +84 -83
  281. package/cdn/assets/C9KQwh85fRQ8P7ia.js +7 -0
  282. package/cdn/assets/C9pNgF73kPC5SCj_.js +8416 -0
  283. package/cdn/assets/{BlPn_DXaEXOPxMxC.js → CAFDldpwa2ZDlh3u.js} +1 -1
  284. package/cdn/assets/CAIREtREYTvydXO6.js +30 -0
  285. package/cdn/assets/{DYvBgX17ZerZSHEJ.js → CB-MJyGrzQbmJE0g.js} +31 -31
  286. package/cdn/assets/{CIyaijfp6itgRpFM.js → CCos0hQMhVcaGwU0.js} +2 -2
  287. package/cdn/assets/CE-_DaE-8Sg4AM0v.js +183 -0
  288. package/cdn/assets/CFJ9wCSJYOoE1Lrz.js +1241 -0
  289. package/cdn/assets/CFJvtyImIjxJOno7.js +5117 -0
  290. package/{browser/esm/CTdFZ_I-41Vr6Dy4.mjs → cdn/assets/CGXU95J36TlX8lDH.js} +1 -1
  291. package/cdn/assets/CH9Ow0HqnUv_0K73.js +521 -0
  292. package/cdn/assets/{SNze-adFJwKuGSQW.js → CHSMmjtqQs2IqcYo.js} +1 -1
  293. package/cdn/assets/{DjdkGy-EI1kSo226.js → CImdnjQtd2Yn7uXl.js} +1 -1
  294. package/cdn/assets/{BvlfKrfrDhE9Jw4d.js → CIvOEYio4yfOR385.js} +2 -2
  295. package/{browser/esm/B0Wjc3lwtjKMwnvn.mjs → cdn/assets/CLUYMovkh-bwvZJ0.js} +1 -1
  296. package/cdn/assets/{BI6afPOpgNYkzIWv.js → CN4pF75weR3buzng.js} +2110 -1978
  297. package/cdn/assets/CNs9_C1xX4prXnCq.js +7 -0
  298. package/cdn/assets/CNx0AfRRVuznb3yg.js +1649 -0
  299. package/cdn/assets/{BeQ95CzwR65il0CK.js → CPGIT9PYUuWdSglk.js} +2 -3
  300. package/{browser/esm/BwOxnbR61WFJwy0A.mjs → cdn/assets/CRDxpPkzVM-9K8qp.js} +1 -1
  301. package/cdn/assets/CTmLSM7UhiKOIhgu.js +17 -0
  302. package/cdn/assets/{DAE3Kv0Vs0VuBecT.js → CUXpeET-vxHGYwKn.js} +1 -1
  303. package/cdn/assets/{DQjxp9lDP9DzP8ah.js → CVfeHUreAF1C9r7W.js} +45 -45
  304. package/{browser/esm/BPrHgyAsm2Htx15h.mjs → cdn/assets/CWOJrduWjvqg69sM.js} +1 -1
  305. package/cdn/assets/CX8Y07KdGzyOeCSo.js +1702 -0
  306. package/cdn/assets/CZG3fjfebhJvUipF.js +57594 -0
  307. package/{browser/esm/DEvZj68igS7Q8SZE.mjs → cdn/assets/CaQrZOnzyAelKzTt.js} +136 -144
  308. package/cdn/assets/CaayvSy_I7jjv7au.js +2230 -0
  309. package/cdn/assets/{aHTKr1ijZ6bRi3Zg.js → CbwxkvJm8JO4Ke8x.js} +4 -4
  310. package/cdn/assets/{B27vTQlxbHhSQJx8.js → Cc-jOsunTu0-Mla_.js} +8607 -6480
  311. package/cdn/assets/CcP8kT3MgwQ3vUnF.js +1299 -0
  312. package/cdn/assets/{CsrTRThObSryov1b.js → CcqUWXYGGj-psA9H.js} +2 -2
  313. package/cdn/assets/Cd2x-3RBbJNq0TuA.js +323 -0
  314. package/cdn/assets/{dn69mDhY7Xcc91kF.js → CeiY_ZCBlUsmH2rY.js} +20 -20
  315. package/cdn/assets/{ZSYS1J3uR7UQuHwZ.js → CgATW0IINhudprWa.js} +10 -10
  316. package/cdn/assets/CgovQHyOZcnsM53I.js +233 -0
  317. package/cdn/assets/{BAdRecWK1maKGOZd.js → ChSr970S44fUscYr.js} +1 -1
  318. package/cdn/assets/{B00ixdmb8-O5ijEp.js → CiGcHB-RQCGm-yoH.js} +1 -1
  319. package/cdn/assets/{CMxbiQ5J79M3n1tk.js → Cif0315haNLmyMj-.js} +723 -373
  320. package/cdn/assets/{DrI_S0A9TQvriTua.js → Cjj81VfZROKYtV3v.js} +1 -1
  321. package/cdn/assets/{CTI-mCJbJzitJZwj.js → Ck-YCK18HOJsHw_I.js} +1 -1
  322. package/cdn/assets/{px-aQ8dMjiWag_pV.js → ClFYlhnkBAxJCKn6.js} +1 -1
  323. package/cdn/assets/{Bsn-tUx172sEG2kR.js → CnOJpT4PcPuybSUB.js} +20 -20
  324. package/{browser/esm/CVcCUfSRsiZ1-6hs.mjs → cdn/assets/CnROzMriBlKuLOfF.js} +1 -1
  325. package/cdn/assets/{DeUXRggj8Oz9ru_i.js → CnzNEpCntiBfW9x5.js} +1 -1
  326. package/cdn/assets/{ycmpAs4kQfeh78Pa.js → CoqGjnCpY3LxqR0v.js} +1 -1
  327. package/cdn/assets/CqP5OkILMJUsRGxp.js +3853 -0
  328. package/cdn/assets/{BB4MW8sSYEXjPvvf.js → CtDb6Ft4ZQbglyKk.js} +5 -5
  329. package/cdn/assets/{qYca4mdySLkACfo1.js → CutcHdJ4BMcr7Yev.js} +1 -1
  330. package/cdn/assets/CwPsCkeHan5zXDyX.js +237 -0
  331. package/cdn/assets/{ChAKLV5zrGAHAof2.js → CxRXaI0C0QO5eGia.js} +50 -48
  332. package/{browser/esm/DVpi1vC8ixXvUQG_.mjs → cdn/assets/Cxk1E_D7BKR7Crmt.js} +1 -1
  333. package/cdn/assets/{DQEjvIGMgEkiaP6J.js → CyTOT4NnE9dWtJIT.js} +1 -1
  334. package/cdn/assets/{D-bNmX0QsA8SuT0m.js → D1zBLjB3GS_6EGzy.js} +33 -33
  335. package/cdn/assets/D2fdIQmCPlCrPRXy.js +781 -0
  336. package/cdn/assets/D3CTFn_17sHwswO5.js +182 -0
  337. package/cdn/assets/D4AbJuK7-E0JtxAo.js +257 -0
  338. package/cdn/assets/D4DsR2aIqjajGOKK.js +263 -0
  339. package/cdn/assets/D4jpK0BUd-tNqESg.js +7 -0
  340. package/cdn/assets/{DSviq1TNoiIAGW7W.js → D5kDtvIsPIJuJZSx.js} +1 -1
  341. package/cdn/assets/{DSXJHEORGmMQX_Mb.js → D6fWK15zTZFsgt1T.js} +12 -12
  342. package/cdn/assets/{D8DghdqjOtBzO2Wx.js → D7C_fe_jEfPhZh6v.js} +4 -4
  343. package/cdn/assets/{DicTo_3G-KZyWDiE.js → D7fpa_b5jL9kNuLc.js} +300 -345
  344. package/cdn/assets/{7i4WSxDsu2ApJJ2_.js → D9FLXw0Q3bpjVuQZ.js} +3 -3
  345. package/cdn/assets/DAlTqWR4DtigzJIp.js +86 -0
  346. package/cdn/assets/{Ba8taVvLslFcKS72.js → DBPCyXdxHLluh0T4.js} +27 -26
  347. package/cdn/assets/{Cv5PLuhEmh5IDHjb.js → DC0uSA4tHtqtV6Qf.js} +12 -12
  348. package/{browser/esm/lqknEt3DTma5Juxs.mjs → cdn/assets/DEtgba3E0qoHN6kX.js} +1 -1
  349. package/{browser/esm/BhkeuRcx8RlLCQ5E.mjs → cdn/assets/DEvc6BS99hZ9e4Nf.js} +1 -1
  350. package/cdn/assets/{DqBj-9o7UdXu4qhb.js → DFbfNcr6j1gD5R0e.js} +1 -1
  351. package/cdn/assets/{D-yz3V2UC54rwctD.js → DI0oF6zUpOe1dvtl.js} +2 -2
  352. package/cdn/assets/DKFKYAh8TvZ6nbQP.js +9633 -0
  353. package/cdn/assets/DKr4Z7Jlm9q1oByS.js +311 -0
  354. package/cdn/assets/DLGHrXPNZh3ZMjhS.js +196 -0
  355. package/cdn/assets/DLIywttw-YbpYzR9.js +1552 -0
  356. package/cdn/assets/{Dv8aQFTTaQBJKDDk.js → DLMAXayirBhfpTF4.js} +1 -1
  357. package/cdn/assets/DLb7DkSaAdwiJNw-.js +9 -0
  358. package/cdn/assets/{C9NyIoUahFiyRCxP.js → DLmLaWoLePonCiIs.js} +1 -1
  359. package/{browser/esm/DQIRFXG4MveFkK3I.mjs → cdn/assets/DN3iFnh1WSc7HR3p.js} +1 -1
  360. package/{browser/esm/DXo8mR6t5HGsmTcu.mjs → cdn/assets/DOJmeQHkbmz7giHc.js} +1 -1
  361. package/cdn/assets/{BN2d5U1nw7pRtOrn.js → DQM2LZ7Kj3QqfQQQ.js} +1 -1
  362. package/cdn/assets/DQwz3i9TNDHAmLmN.js +132 -0
  363. package/cdn/assets/{CWJzHmEgahdOfNjH.js → DTOHItHWueMl2jTm.js} +1 -1
  364. package/cdn/assets/{CCvBdPu7W2ZF6A9J.js → DTRBOYo39pUPMTpT.js} +9 -9
  365. package/{browser/esm/ztqpWR65YYMZ3EPk.mjs → cdn/assets/DVyIyNBrlUT9W9cY.js} +175 -167
  366. package/cdn/assets/{mK8HcIZyXkOTvL6E.js → DWcAYH0eBaOj-dU4.js} +7 -7
  367. package/cdn/assets/{CbTN0q6XnYGJqyEp.js → DX-iRDnwn8uZZIqp.js} +1372 -1366
  368. package/cdn/assets/DYeaE2TSAJ9-suNW.js +282 -0
  369. package/cdn/assets/{Bgbi7BFR3rN5qj51.js → DZiWWhATAOxJQZ_N.js} +22 -22
  370. package/cdn/assets/{CZOJogyZqMfUxcXj.js → DccxaAgL5rauj9rq.js} +1 -1
  371. package/{browser/esm/C3r_9RqlWrEmlXZ1.mjs → cdn/assets/DchNCIMGQQc9yEcv.js} +1 -1
  372. package/cdn/assets/{hg8WYI0Yy4WPPPoP.js → DdWtfDWDB6Yst5LZ.js} +11 -11
  373. package/cdn/assets/Dg-qsGzlATZbZ35c.js +164 -0
  374. package/cdn/assets/{BelX6bvQPsGuo-x3.js → DhUBLuQYjgwdF5EH.js} +2 -2
  375. package/cdn/assets/DiOOfu_7X2Cpk8QF.js +391 -0
  376. package/cdn/assets/{B3NWCYKXucbHhOix.js → DkZqI9EyJ9BaBNL_.js} +26 -26
  377. package/cdn/assets/{AjMG7Fb9r4Fk7Hsf.js → Dki3Mapev78nd9Kc.js} +18 -17
  378. package/{browser/esm/DlOVZD0OiAjouS6-.mjs → cdn/assets/DlbmuJxdMXIYpB6E.js} +1804 -1016
  379. package/cdn/assets/DqELE8YlqkR-PGLI.js +142 -0
  380. package/{browser/esm/M7RYrx20B_Yl_euJ.mjs → cdn/assets/Drbnn1LTgJDjS6Ha.js} +8 -8
  381. package/cdn/assets/Drfd0-JZwPXCnj5c.js +1391 -0
  382. package/cdn/assets/DsJVOPJWQSCx_2gE.js +8315 -0
  383. package/cdn/assets/DvcqASECnv0ZHrzg.js +214 -0
  384. package/cdn/assets/DwFQgKd9J_B2KTpR.js +240 -0
  385. package/cdn/assets/DwhJsbgOZVQE9ZPT.js +210 -0
  386. package/cdn/assets/DxJKKoj07ez4Cc1M.js +639 -0
  387. package/cdn/assets/{G5z0uVlyF6CLw_PA.js → DzdTkjOza0KfOVpJ.js} +2 -2
  388. package/cdn/assets/Dzno9raiwXxce_BQ.js +1306 -0
  389. package/cdn/assets/{DckmFyHxGX4Y1gOq.js → EQ9ocVP26wjlV0h8.js} +18 -17
  390. package/cdn/assets/{DxisV9_27l_WU-nk.js → FTUIrcTvIeHG6nzk.js} +5 -5
  391. package/cdn/assets/FfjEOAnadcVqxSUP.js +2265 -0
  392. package/cdn/assets/HEszSqNhIYK5QTuZ.js +61 -0
  393. package/cdn/assets/HI2Ksbl0-etNK-w-.js +36 -0
  394. package/{browser/esm/CQOyeq_-pg3CM-uA.mjs → cdn/assets/Hl08NtZ1eAIRJ5OF.js} +1 -1
  395. package/cdn/assets/IrI1Fo83qAWTNhz5.js +6149 -0
  396. package/cdn/assets/{CDAYVaQYywqaxg4O.js → JQaNzWKHZyWyQOJ0.js} +2 -2
  397. package/cdn/assets/{BtGmrIqU9W1L8zfZ.js → K83ea52GGB2voaRd.js} +1 -1
  398. package/{browser/esm/H-JnJQMcZQbpvjdb.mjs → cdn/assets/KHZcJAKLztwlFOCX.js} +1 -1
  399. package/cdn/assets/{DJqj66SnUcx0QmSN.js → MH5L1dIGBq_LYgJQ.js} +1 -1
  400. package/{browser/esm/BtdRr6IbtO6Gypsk.mjs → cdn/assets/MuXX7448MHFePqr9.js} +6 -5
  401. package/cdn/assets/{C0CeCYdLWLjySEFe.js → NV0lQG1Z_LlIL1xk.js} +15 -15
  402. package/cdn/assets/{Cw7AJWd0S2sjRmr6.js → OABpLvY7siKUyNIa.js} +1602 -1471
  403. package/cdn/assets/OSXSr855wNqulmp_.js +423 -0
  404. package/{browser/esm/RfHd1JATBlcsfLPv.mjs → cdn/assets/QPsDtDrq66DM_Jgr.js} +1 -1
  405. package/cdn/assets/{C32co-XulWTkEKrW.js → RaTCqgWoqpOqPZQk.js} +2 -2
  406. package/cdn/assets/{C-0viTjg1dT2F-sk.js → TMjhDpsh4dAyEK9h.js} +2 -2
  407. package/cdn/assets/TONCxYiGe47Rjhga.js +86 -0
  408. package/{browser/esm/CWoPWWRwMgkGPFFP.mjs → cdn/assets/TVEs01pqc117KeGZ.js} +2534 -1724
  409. package/cdn/assets/{BIsbcP5RXRU2XPfx.js → UXg8wCm37AcKqC56.js} +2 -2
  410. package/{browser/esm/Dc2ZwgbIEgYWwAsF.mjs → cdn/assets/Yqn8laB5RV0kueLN.js} +1 -1
  411. package/cdn/assets/{CSIZpJClc66_20kP.js → Z1o8piRdmQD2oQWI.js} +118 -269
  412. package/{browser/esm/DjtXfgbmXjUAoG0y.mjs → cdn/assets/ZO6hi53k1jfq_DU2.js} +1 -1
  413. package/{browser/esm/J9i3r1fU0H10b2hX.mjs → cdn/assets/ZbJ95fcT_MlmJnVS.js} +1 -1
  414. package/{browser/esm/i0P63Wd0RRlgJotb.mjs → cdn/assets/_7u2a1HvX3quwuxr.js} +1 -1
  415. package/cdn/assets/{DRm1R4uVOkaMfXNI.js → acJyiuSRKv5sM-Ti.js} +13 -7
  416. package/cdn/assets/bmjrEH7i8TNBt6SP.js +281 -0
  417. package/cdn/assets/c2U2dLzVvNTpyyqC.js +497 -0
  418. package/cdn/assets/gKmKdkfbYQQWehPu.js +3108 -0
  419. package/cdn/assets/{D32D_biNXRCZ24vG.js → iROLGMv0365VtzWw.js} +46 -46
  420. package/cdn/assets/k_pfnr7cFrRmfgMa.js +12 -0
  421. package/cdn/assets/{Cy00y9b9j17Txyv1.js → luSDFTDDahiW2BkV.js} +1 -1
  422. package/cdn/assets/{CHMqT9DzYKTxPfP6.js → mmNCqaa6lU6cygSY.js} +1 -1
  423. package/cdn/assets/{D_pMOq6FdH4RSBLc.js → nQBuuL7ZHzDHpWHk.js} +754 -723
  424. package/cdn/assets/oQqrFmjkSYpR-YkT.js +8 -0
  425. package/cdn/assets/{Dp-GJXOMz_b8qAxD.js → qdrySZxuftgjgcvV.js} +2 -2
  426. package/cdn/assets/{C6INLvBy8kdzFpsX.js → sLmN3zWQq7lARToC.js} +639 -758
  427. package/{browser/esm/CFvKDDbrL3wpXnQH.mjs → cdn/assets/sSoL-JlTRttZ1-fW.js} +1 -1
  428. package/cdn/assets/v7jTlODG1H-cGQs0.js +278 -0
  429. package/cdn/assets/{VwGokBaawZfZiV2X.js → wA7bEwDV1UUss-PV.js} +1 -1
  430. package/cdn/assets/{Cfg4Dtndwurxv9LM.js → wK0g9YTrJa8xbPXn.js} +8 -8
  431. package/cdn/assets/wQOPOdvl3X5fq9Sd.js +104 -0
  432. package/{browser/esm/pc49xtHdprXZLW2X.mjs → cdn/assets/xZUqtJfNziRMVyQ7.js} +1 -1
  433. package/cdn/assets/{BuYS_ZjSlcvWZ1JC.js → yeI_qudcEuAsSDGK.js} +3162 -2130
  434. package/cdn/assets/{DNaPo7BQu6hr1fWq.js → ypqwC2WOP09mA_DM.js} +1 -1
  435. package/cdn/index.js +27 -17
  436. package/package.json +3 -3
  437. package/types/src/sheetxl.d.ts +1 -0
  438. package/browser/esm/BNIInlJQbJjH8B6G.mjs +0 -84250
  439. package/browser/esm/B_HB4y7AA88Z775Z.mjs +0 -91
  440. package/browser/esm/CdeXXPCp5cCYvGyD.mjs +0 -14
  441. package/browser/esm/Chr_TXM-48IsK8Va.mjs +0 -155
  442. package/browser/esm/Clx8vvGDOTWK_M2l.mjs +0 -484
  443. package/browser/esm/Cw-4uoMuq_m7ziA3.mjs +0 -36
  444. package/browser/esm/D-9f1NKcpuYSgond.mjs +0 -412
  445. package/browser/esm/D7CGuQcwpkiuesEI.mjs +0 -229
  446. package/browser/esm/D7kkzIFPqKBK94kO.mjs +0 -17952
  447. package/browser/esm/D88StfSjZJi5E8Xb.mjs +0 -5153
  448. package/browser/esm/D8exjrado9TJrBp-.mjs +0 -1946
  449. package/browser/esm/DGCOPbZbEmt0x9z0.mjs +0 -155
  450. package/browser/esm/DZRmBfjn2TgOTu5e.mjs +0 -3604
  451. package/browser/esm/D_7BWdsu8yejhUxy.mjs +0 -2353
  452. package/browser/esm/D_thhK0vSez8Yfle.mjs +0 -798
  453. package/browser/esm/Dv2z0548SZRGTN3l.mjs +0 -149
  454. package/browser/esm/DyeY6XwMQ_XNUHiW.mjs +0 -89
  455. package/browser/esm/FjNOhkR7-JAIaRP6.mjs +0 -19
  456. package/browser/esm/RLU85PsAYtKPUf6N.mjs +0 -71
  457. package/browser/esm/WMYR09ZOR8JbZEnx.mjs +0 -4748
  458. package/browser/esm/r2Az2Yc4_qj2-sn0.mjs +0 -398
  459. package/cdn/assets/514mXPTuNvdNgw35.js +0 -412
  460. package/cdn/assets/7Sg0ht_ZCMJkPurt.js +0 -516
  461. package/cdn/assets/B_3Musz0q2MSZ5H-.js +0 -799
  462. package/cdn/assets/BgyY4zVPZSXljoCZ.js +0 -14
  463. package/cdn/assets/BlIZ30huelIxNo6S.js +0 -91
  464. package/cdn/assets/BxqXOiOyI_XiOmvN.js +0 -156
  465. package/cdn/assets/CEYyp6Qrr_IopxpL.js +0 -22597
  466. package/cdn/assets/CILUMtSddGz7WXEv.js +0 -240
  467. package/cdn/assets/CL6Tgu_rUO6G-fyq.js +0 -2352
  468. package/cdn/assets/COMOqucXq7X1vi0P.js +0 -230
  469. package/cdn/assets/CRXSrbGNABtzf532.js +0 -399
  470. package/cdn/assets/CTvPIYWTcjwlJeEA.js +0 -237
  471. package/cdn/assets/CU5cKipVT1X8Xz7F.js +0 -156
  472. package/cdn/assets/Cw-4uoMuq_m7ziA3.js +0 -36
  473. package/cdn/assets/DCnWyVXikb_8Dat3.js +0 -61
  474. package/cdn/assets/DHugYwX4_ZyqGn-C.js +0 -1947
  475. package/cdn/assets/DOHh3pUXxMM09UY5.js +0 -3604
  476. package/cdn/assets/DlpgIJxNq2V4gdDq.js +0 -74
  477. package/cdn/assets/DuAbY54w5gJpQgss.js +0 -84250
  478. package/cdn/assets/DviEoeWW0EvDg1hr.js +0 -149
  479. package/cdn/assets/FjNOhkR7-JAIaRP6.js +0 -19
  480. package/cdn/assets/PzWqv-oXxEuzKdaT.js +0 -484
  481. package/cdn/assets/QJ4AkDD269D1MzmI.js +0 -89
  482. package/cdn/assets/fm3mUdTDo-STB36M.js +0 -4749
  483. package/cdn/assets/lWY3TbG2NDscy9He.js +0 -72
  484. package/cdn/assets/xlXDq-qoj7eOE6_T.js +0 -5153
@@ -0,0 +1,3853 @@
1
+ /**
2
+ * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.8.0-beta.12
3
+ *
4
+ * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
+ * License: The license can be found at https://www.sheetxl.com/license.
6
+ */
7
+ import { B as e, C as t, G as n, M as r, O as i, U as a, a as o, g as s, k as c, l, m as u, n as d, r as f, v as p, x as m, z as h } from "./Cif0315haNLmyMj-.js";
8
+ import { c as g, i as _, s as v } from "./BXGRt1EwLc3igx5S.js";
9
+ import { $t as y, Bt as b, K as x, Lt as S, Pt as C, U as w, Ut as T, Vt as ee, at as te, ct as ne, d as E, g as re, nt as ie, o as ae, st as oe, t as se, x as ce, yt as D, zt as le } from "./TVEs01pqc117KeGZ.js";
10
+ import { a as O, n as k } from "./B8-nLKLPjZ7pIJdE.js";
11
+ import { $r as A, Ai as ue, Bi as de, Bt as fe, C as j, Ci as pe, Cn as me, Cr as he, Dr as ge, Er as _e, Ft as ve, Ii as ye, Ir as be, J as M, Jr as xe, K as Se, Kn as Ce, L as we, Mi as Te, Mt as Ee, Oi as De, On as Oe, Pt as ke, R as N, Rr as Ae, St as je, T as P, Ti as F, Ur as Me, Ut as Ne, W as Pe, Wi as Fe, Wr as Ie, Xr as Le, Xt as Re, Y as I, Yn as L, _ as ze, _n as Be, _r as Ve, ar as He, b as Ue, c as We, ct as Ge, er as Ke, gr as qe, hn as Je, ir as Ye, mn as Xe, on as Ze, ot as Qe, pn as $e, qt as et, r as tt, ri as nt, sn as rt, ui as R, un as it, ur as at, wn as ot, xi as st, xn as z, yn as ct, zi as lt, zt as ut } from "./CZG3fjfebhJvUipF.js";
12
+ var dt, ft, pt = class extends r {
13
+ constructor(e, t = 50) {
14
+ super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
15
+ }
16
+ _undoCommits(e = this.maxStack) {
17
+ let t = this._transactions;
18
+ if (!t) return [];
19
+ let n = t.getLog(t.getCurrentCommit(!1).getId(), 2 ** 53 - 1), r = [];
20
+ for (let t = 0; t < n.length && r.length < e; t++) {
21
+ let e = n[t];
22
+ if (e.getId() === this._floorId || t === n.length - 1) break;
23
+ e.getDescription() && r.push(e);
24
+ }
25
+ return r;
26
+ }
27
+ _redoCommits(e = this.maxStack) {
28
+ let t = this._transactions;
29
+ if (!t) return [];
30
+ let n = t.getCurrentCommit(!1).getId(), r = t.getTipCommit().getId();
31
+ if (r === n) return [];
32
+ let i = t.getLog(r, 2 ** 53 - 1), a = [], o = !1;
33
+ for (let e of i) {
34
+ if (e.getId() === n) {
35
+ o = !0;
36
+ break;
37
+ }
38
+ a.push(e);
39
+ }
40
+ if (!o) return [];
41
+ a.reverse();
42
+ let s = [];
43
+ for (let t of a) if (t.getDescription() && s.push(t), s.length >= e) break;
44
+ return s;
45
+ }
46
+ undo(e = 1) {
47
+ let t = this._transactions;
48
+ if (!t) return;
49
+ let n = !1;
50
+ try {
51
+ for (let r = 0; r < e; r++) {
52
+ let [e] = this._undoCommits(1);
53
+ if (!e) break;
54
+ t.revert(e.getId()), n = !0;
55
+ }
56
+ } finally {
57
+ n && this._notifyOnStackChange();
58
+ }
59
+ }
60
+ redo(e = 1) {
61
+ let t = this._transactions;
62
+ if (!t) return;
63
+ let n = !1;
64
+ try {
65
+ for (let r = 0; r < e; r++) {
66
+ let [e] = this._redoCommits(1);
67
+ if (!e) {
68
+ r === 0 && this._repeatOperation?.repeat();
69
+ break;
70
+ }
71
+ t.restore(e.getId()), n = !0;
72
+ }
73
+ } finally {
74
+ n && this._notifyOnStackChange();
75
+ }
76
+ }
77
+ hasUndo() {
78
+ return this._undoCommits(1).length > 0;
79
+ }
80
+ hasRedo() {
81
+ return this._redoCommits(1).length > 0 || this._repeatOperation !== null;
82
+ }
83
+ getTopUndoDescription() {
84
+ return this._undoCommits(1)[0]?.getDescription() ?? null;
85
+ }
86
+ getTopRedoDescription() {
87
+ return this._repeatOperation === null ? this._redoCommits(1)[0]?.getDescription() ?? null : this._repeatOperation.description;
88
+ }
89
+ getUndoDescriptions() {
90
+ return this._undoCommits().map((e) => e.getDescription());
91
+ }
92
+ getRedoDescriptions() {
93
+ let e = this._redoCommits().map((e) => e.getDescription());
94
+ return e.length === 0 && this._repeatOperation !== null && e.push(this._repeatOperation.description), Object.freeze(e);
95
+ }
96
+ getUndoEntries() {
97
+ return this._undoCommits().map(ht);
98
+ }
99
+ getRedoEntries() {
100
+ let e = this._redoCommits().map(ht);
101
+ return e.length === 0 && this._repeatOperation !== null && e.push({
102
+ description: this._repeatOperation.description,
103
+ author: null,
104
+ meta: mt
105
+ }), Object.freeze(e);
106
+ }
107
+ addUndoOperation() {
108
+ throw Error("TransactionUndoManager derives its stack from the commit log; commit a described transaction instead.");
109
+ }
110
+ clear(e = !0) {
111
+ this._transactions && (this._floorId = this._transactions.getCurrentCommit(!1).getId()), super.clear(e);
112
+ }
113
+ close() {
114
+ this._removeListener?.();
115
+ }
116
+ }, mt = Object.freeze({}), ht = (e) => ({
117
+ description: e.getDescription(),
118
+ author: e.getAuthor(),
119
+ meta: e.getMeta() ?? mt
120
+ }), gt = class {
121
+ constructor(e, t) {
122
+ this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new _(this);
123
+ let n = this;
124
+ this._removeStoreListener = e.addListener({
125
+ onCommitEnd() {
126
+ n._recompute();
127
+ },
128
+ onCommitChange() {
129
+ n._recompute();
130
+ }
131
+ }), this._removeCommitListener = t?.addCommitListener({ onCommit(e) {
132
+ e.store === n._store && n.markSaved(e.commitId);
133
+ } });
134
+ }
135
+ getStore() {
136
+ return this._store;
137
+ }
138
+ isDirty() {
139
+ return (this._store.getCurrentCommit()?.getId() ?? null) !== this._savedCommitId;
140
+ }
141
+ getSavedCommitId() {
142
+ return this._savedCommitId;
143
+ }
144
+ markSaved(e = this._store.getCurrentCommit()?.getId() ?? null) {
145
+ e !== this._savedCommitId && (this._savedCommitId = e ?? null, this._recompute());
146
+ }
147
+ addListeners(e, t) {
148
+ return this._emitter.addListeners(e, t);
149
+ }
150
+ _recompute() {
151
+ let e = this.isDirty();
152
+ e !== this._dirty && (this._dirty = e, this._emitter.notify(e ? "onDirty" : "onClean", { transactional: !1 }));
153
+ }
154
+ close() {
155
+ this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
156
+ }
157
+ };
158
+ dt ||= {};
159
+ var B = class e {
160
+ constructor(t, n = {}) {
161
+ this._password = null, this._emitter = new _(this), this._path = t ?? null, this._name = n.name ?? null, this._format = n.format ?? null, this._size = n.size ?? null, this._lastModified = n.lastModified ?? null, this._canWrite = n.canWrite ?? e._defaultCanWrite(this._path), this._encryption = n.encryption ?? null;
162
+ }
163
+ static _defaultCanWrite(e) {
164
+ return !!e && !/^(https?:|data:|blob:)/i.test(e);
165
+ }
166
+ _cleanPath() {
167
+ return this._path ? this._path.split(/[?#]/)[0] : null;
168
+ }
169
+ getName() {
170
+ if (this._name !== null && this._name !== void 0) return this._name;
171
+ let e = this._cleanPath();
172
+ return e && M(e) || null;
173
+ }
174
+ getPath() {
175
+ return this._path;
176
+ }
177
+ getFormat() {
178
+ return this._format ? this._format : this.getExtension();
179
+ }
180
+ getExtension() {
181
+ let e = this._cleanPath();
182
+ if (!e) return null;
183
+ let t = A(e);
184
+ return t ? t.toLowerCase() : null;
185
+ }
186
+ getEncryption() {
187
+ return this._encryption;
188
+ }
189
+ isEncrypted() {
190
+ return this._encryption !== null || this._password !== null;
191
+ }
192
+ setPassword(e) {
193
+ this._password !== (e ?? null) && (this._password = e ?? null, this._password === null && (this._encryption = null), this._emitter.notify("onChange"));
194
+ }
195
+ getPassword() {
196
+ return this._password;
197
+ }
198
+ getSize() {
199
+ return this._size;
200
+ }
201
+ getLastModified() {
202
+ return this._lastModified;
203
+ }
204
+ canWrite() {
205
+ return this._canWrite;
206
+ }
207
+ setName(e) {
208
+ this.update({ name: e });
209
+ }
210
+ update(e) {
211
+ let t = !1;
212
+ return e.lastModified !== void 0 && e.lastModified !== this._lastModified && (this._lastModified = e.lastModified, t = !0), e.name !== void 0 && e.name !== this._name && (this._name = e.name, t = !0), e.format !== void 0 && e.format !== this._format && (this._format = e.format, t = !0), e.size !== void 0 && e.size !== this._size && (this._size = e.size, t = !0), e.canWrite !== void 0 && e.canWrite !== this._canWrite && (this._canWrite = e.canWrite, t = !0), e.encryption !== void 0 && e.encryption !== this._encryption && (this._encryption = e.encryption, t = !0), t && this._emitter.notify("onChange"), this;
213
+ }
214
+ addListeners(e, t) {
215
+ return this._emitter.addListeners(e, t);
216
+ }
217
+ get [Symbol.toStringTag]() {
218
+ return "[Origin]";
219
+ }
220
+ toString() {
221
+ let e = this._cleanPath(), t = e ? e.split(/[/\\]/).pop() || e : this._name ?? "(unbound)", n = this._size;
222
+ if (n == null) return t;
223
+ if (n < 1024) return `${t} ${n}B`;
224
+ let r = Math.floor(Math.log(n) / Math.log(1024)), i = [
225
+ "B",
226
+ "KB",
227
+ "MB",
228
+ "GB",
229
+ "TB"
230
+ ];
231
+ return `${t} ${(n / 1024 ** r).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
232
+ }
233
+ }, V = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new Set(), _t = (e) => V.get(e) ?? null, vt = () => Array.from(H, (e) => e.getOrigin()), yt = class e {
234
+ constructor(t) {
235
+ this._released = !1, e._assertFree(t), this._emitter = new _(this), this._origin = t, V.set(t, this), H.add(this);
236
+ }
237
+ getOrigin() {
238
+ return this._origin;
239
+ }
240
+ setOrigin(t) {
241
+ t !== this._origin && (e._assertFree(t), this._released || (V.delete(this._origin), V.set(t, this)), this._origin = t, this._emitter.notify("onOriginChange"));
242
+ }
243
+ release() {
244
+ this._released || (this._released = !0, V.get(this._origin) === this && V.delete(this._origin), H.delete(this));
245
+ }
246
+ addListeners(e, t) {
247
+ return this._emitter.addListeners(e, t);
248
+ }
249
+ static _assertFree(e) {
250
+ if (V.has(e)) throw Error("This origin already backs an open workbook; an origin backs one workbook at a time.");
251
+ }
252
+ }, bt = class {
253
+ constructor() {
254
+ this._defaultStringSourceType = "filepath";
255
+ }
256
+ async read(e) {
257
+ let t = e.options ?? {}, n = e.source;
258
+ if (typeof n == "function" && (n = n()), n && typeof n == "object" && typeof n.then == "function" && (n = await Promise.resolve(n)), n == null && (n = await this.resolveSource(e), n == null)) return null;
259
+ let r = n, i = await this.fileFromHandle(n);
260
+ i && (n = i);
261
+ let o = t.format, s = this._detectSourceType(n);
262
+ if (!s) throw Error("Unable to detect source type from provided input.");
263
+ let c, l, u = !1;
264
+ if (s === "filepath") {
265
+ let e = typeof n == "string" && n.startsWith("file://") ? n.slice(7) : n;
266
+ n = await this.filePathToFile(e), s = "file", u = !0;
267
+ }
268
+ switch (s) {
269
+ case "file": {
270
+ let e = n, r = e?.name, a = r ? `${M(r)}` : "";
271
+ c = await e.arrayBuffer(), l = {
272
+ format: o,
273
+ ext: A(r),
274
+ name: a,
275
+ absolutePath: r,
276
+ size: e.size,
277
+ lastModified: e.lastModified,
278
+ canWrite: !t.asCopy && (!!i || u && this._canWriteLocalPath())
279
+ };
280
+ break;
281
+ }
282
+ case "blob": {
283
+ let e = n;
284
+ c = await e.arrayBuffer(), l = {
285
+ format: o,
286
+ size: e.size
287
+ };
288
+ break;
289
+ }
290
+ case "base64": {
291
+ let e;
292
+ if (n && typeof n == "object" && "base64" in n) e = n.base64;
293
+ else if (typeof n == "string" && n.startsWith("data:")) {
294
+ let [, t] = n.split(",");
295
+ e = t;
296
+ } else e = n;
297
+ c = a.base64ToArrayBuffer(e), l = {
298
+ format: o,
299
+ size: e.length
300
+ };
301
+ break;
302
+ }
303
+ case "fetch": {
304
+ let e, t, r;
305
+ if (typeof n == "string") e = n;
306
+ else {
307
+ if (!n || typeof n != "object" || !("input" in n)) throw Error("Invalid fetch source provided.");
308
+ {
309
+ let i = n;
310
+ e = i.input, t = i.init, r = i.timeout;
311
+ }
312
+ }
313
+ let i = r || 3e4, a = new AbortController(), s = setTimeout(() => a.abort(), i), u = typeof e == "string" ? e : e.toString(), d = A(u);
314
+ try {
315
+ let n = await fetch(e, {
316
+ ...t,
317
+ signal: a.signal
318
+ });
319
+ if (clearTimeout(s), !n.ok) throw Error(`Failed to fetch: ${n.status} ${n.statusText}`);
320
+ let r = await n.arrayBuffer();
321
+ if (!r) throw Error(`Unable to fetched content: ${u}`);
322
+ c = r, l = {
323
+ format: o,
324
+ ext: d,
325
+ name: M(u, !0),
326
+ absolutePath: u
327
+ };
328
+ } catch (e) {
329
+ throw clearTimeout(s), e.name === "AbortError" ? Error(`Fetch timeout after ${i}ms: ${u}`) : e;
330
+ }
331
+ break;
332
+ }
333
+ case "buffer":
334
+ c = n, l = { format: o };
335
+ break;
336
+ case "stream": {
337
+ let e = n.getReader(), t = [], r = 0;
338
+ try {
339
+ for (;;) {
340
+ let { done: n, value: i } = await e.read();
341
+ if (n) break;
342
+ t.push(i), r += i.length;
343
+ }
344
+ } finally {
345
+ e.releaseLock();
346
+ }
347
+ let i = new ArrayBuffer(r), a = new Uint8Array(i), s = 0;
348
+ for (let e of t) a.set(e, s), s += e.length;
349
+ c = i, l = { format: o };
350
+ break;
351
+ }
352
+ default: throw Error(`Unsupported source type: ${s}`);
353
+ }
354
+ l.canWrite && await this.findOpenOrigin(r, l) && (l.canWrite = !1);
355
+ let d = await e.decode(c, {
356
+ sourceType: s,
357
+ ...l
358
+ });
359
+ return d ? (await this.onWorkbookRead(d, r), d) : null;
360
+ }
361
+ async findOpenOrigin(e, t) {
362
+ return t.absolutePath ? this.findOpenPath(t.absolutePath) : null;
363
+ }
364
+ findOpenPath(e, t) {
365
+ return vt().find((n) => {
366
+ if (n === t || !n.canWrite()) return !1;
367
+ let r = n.getPath();
368
+ return !!r && this.isSamePath(r, e);
369
+ }) ?? null;
370
+ }
371
+ isSamePath(e, t) {
372
+ return e === t;
373
+ }
374
+ async fileFromHandle(e) {
375
+ return null;
376
+ }
377
+ async resolveSource(e) {
378
+ return null;
379
+ }
380
+ async onWorkbookRead(e, t) {}
381
+ _canWriteLocalPath() {
382
+ return !1;
383
+ }
384
+ _detectSourceType(e) {
385
+ if (e && typeof e == "object" && "base64" in e) return "base64";
386
+ if (e && typeof e == "object" && "input" in e) return "fetch";
387
+ if (typeof e == "string") {
388
+ if (e.startsWith("data:")) return "base64";
389
+ if (e.startsWith("http://") || e.startsWith("https://")) return "fetch";
390
+ if (e.startsWith("file://")) return "filepath";
391
+ let t = this._defaultStringSourceType;
392
+ return e.startsWith("./") || e.startsWith("../") || e.startsWith("/") || /^[a-zA-Z]:[/\\]/.test(e), t;
393
+ }
394
+ if (typeof File < "u" && e instanceof File) return "file";
395
+ if (typeof Blob < "u" && e instanceof Blob) return "blob";
396
+ let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r = a.isNodeBuffer(e);
397
+ return t || n || r ? "buffer" : typeof ReadableStream < "u" && e instanceof ReadableStream || Object.prototype.toString.call(e) === "[object ReadableStream]" || e && typeof e.getReader == "function" && e.locked !== void 0 ? "stream" : null;
398
+ }
399
+ }, xt = class extends bt {
400
+ constructor(e, t) {
401
+ super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap();
402
+ }
403
+ async fileFromHandle(e) {
404
+ return U(e) ? e.getFile() : null;
405
+ }
406
+ async resolveSource() {
407
+ let e = await this._getReadFormats?.() ?? [];
408
+ if (typeof globalThis.showOpenFilePicker == "function") try {
409
+ let t = function(e) {
410
+ let t = St(e);
411
+ if (t.length <= 1) return t;
412
+ let n = /* @__PURE__ */ new Set(), r = {};
413
+ for (let e of t) for (let [t, i] of Object.entries(e.accept)) for (let e of i) n.has(e) || (n.add(e), (r[t] ??= []).push(e));
414
+ return [{
415
+ description: "All Supported",
416
+ accept: r
417
+ }, ...t];
418
+ }(e), [n] = await globalThis.showOpenFilePicker(t.length ? { types: t } : void 0);
419
+ return n;
420
+ } catch (e) {
421
+ if (e?.name === "AbortError") return null;
422
+ throw e;
423
+ }
424
+ let t = e.flatMap((e) => e.exts.map((e) => "." + e)).join(", ");
425
+ return i.openFileDialog(t);
426
+ }
427
+ async findOpenOrigin(e) {
428
+ return U(e) ? this._findOpenHandle(e) : null;
429
+ }
430
+ async _findOpenHandle(e, t) {
431
+ for (let n of vt()) {
432
+ if (n === t || !n.canWrite()) continue;
433
+ let r = this._handleCache.get(n);
434
+ if (r && typeof r.isSameEntry == "function" && await r.isSameEntry(e)) return n;
435
+ }
436
+ return null;
437
+ }
438
+ async onWorkbookRead(e, t) {
439
+ if (!U(t)) return;
440
+ let n = e.getOrigin?.();
441
+ n?.canWrite() && this._handleCache.set(n, t);
442
+ }
443
+ async filePathToFile(e) {
444
+ throw Error(`Cannot read local file path '${e}' in browser environment. Use a file input element or fetch for remote URLs.`);
445
+ }
446
+ async write(e) {
447
+ let { origin: t, suggestedName: n, format: r, encode: i, prompt: a } = e, o = [r, ...(await this._getWriteFormats()).filter((e) => e.key !== r.key)], c = typeof globalThis.showSaveFilePicker == "function", u = !a && t.canWrite() ? this._handleCache.get(t) : void 0;
448
+ if (c) try {
449
+ if (u) {
450
+ let e = await async function(e) {
451
+ try {
452
+ if (typeof e.queryPermission != "function") return "granted";
453
+ let t = { mode: "readwrite" };
454
+ return await e.queryPermission(t) === "granted" || await e.requestPermission(t) === "granted" ? "granted" : "denied";
455
+ } catch {
456
+ return "unavailable";
457
+ }
458
+ }(u);
459
+ if (e === "denied") return null;
460
+ e !== "granted" && (u = void 0);
461
+ }
462
+ let a = !!u;
463
+ if (!a) {
464
+ u = await globalThis.showSaveFilePicker({
465
+ suggestedName: n,
466
+ types: St(o)
467
+ });
468
+ let t = await this._findOpenHandle(u, e.workbook?.getOrigin?.());
469
+ if (t) throw new s(l("error.io.openElsewhere", { name: t.getName() ?? u.name ?? "" }));
470
+ }
471
+ let c = wt(u.name ?? n), d = o.find((e) => e.exts.some((e) => e.toLowerCase() === c)) ?? r, f = a ? t : new B(u.name ?? n, {
472
+ format: d.key,
473
+ canWrite: !0
474
+ }), p = await i(d.key, f);
475
+ if (!p) return null;
476
+ let m = new Blob([Ct(p)], { type: d.mimeType || "application/octet-stream" }), h = await u.createWritable();
477
+ if (await h.write(m), await h.close(), this._handleCache.set(f, u), f instanceof B) {
478
+ let e = await Promise.resolve(u.getFile?.()).then((e) => e?.lastModified ?? null, () => null);
479
+ f.update({
480
+ size: m.size,
481
+ lastModified: e
482
+ });
483
+ }
484
+ return f;
485
+ } catch (e) {
486
+ if (e?.name === "AbortError") return null;
487
+ if (e instanceof s) throw e;
488
+ }
489
+ let d = t.getPath(), f = d ? d.split(/[/\\]/).pop() : null, p = f && r.exts.some((e) => e.toLowerCase() === wt(f)) ? f : n, m = d !== p || t.canWrite() ? new B(p, {
490
+ format: r.key,
491
+ canWrite: !1
492
+ }) : t, h = await i(r.key, m);
493
+ if (!h) return null;
494
+ let g = new Blob([Ct(h)], { type: r.mimeType || "application/octet-stream" });
495
+ return function(e, t) {
496
+ let n = URL.createObjectURL(e), r = document.createElement("a");
497
+ r.style.display = "none", r.href = n, r.download = t, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
498
+ }(g, p), m instanceof B && m.update({ size: g.size }), m;
499
+ }
500
+ };
501
+ function St(e) {
502
+ return e.map((e) => {
503
+ let t = e.mimeType && e.mimeType.includes("/") ? e.mimeType : "application/octet-stream";
504
+ return {
505
+ description: e.description ?? e.key,
506
+ accept: { [t]: e.exts.map((e) => "." + e) }
507
+ };
508
+ });
509
+ }
510
+ function U(e) {
511
+ return !!e && e.kind === "file" && typeof e.getFile == "function";
512
+ }
513
+ function Ct(e) {
514
+ if (typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) {
515
+ let t = new ArrayBuffer(e.byteLength);
516
+ return new Uint8Array(t).set(new Uint8Array(e)), t;
517
+ }
518
+ return e;
519
+ }
520
+ function wt(e) {
521
+ let t = e.lastIndexOf(".");
522
+ return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
523
+ }
524
+ (ft ||= {}).SortOn = {
525
+ Value: "value",
526
+ FillColor: "fillColor",
527
+ FontColor: "fontColor",
528
+ Icon: "icon"
529
+ };
530
+ var Tt, Et, Dt, Ot, kt = {
531
+ TopLeft: "tl",
532
+ Top: "t",
533
+ TopRight: "tr",
534
+ Left: "l",
535
+ Center: "ctr",
536
+ Right: "r",
537
+ BottomLeft: "bl",
538
+ Bottom: "b",
539
+ BottomRight: "br"
540
+ }, W = re.BuiltInName, At = {
541
+ [W.Normal]: u("style.builtin.normal"),
542
+ [W.Comma]: u("style.builtin.comma"),
543
+ [W.Currency]: u("style.builtin.currency"),
544
+ [W.Percent]: u("style.builtin.percent"),
545
+ [W.Comma0]: u("style.builtin.comma0"),
546
+ [W.Currency0]: u("style.builtin.currency0"),
547
+ [W.Hyperlink]: u("style.builtin.hyperlink"),
548
+ [W.FollowedHyperlink]: u("style.builtin.followedHyperlink"),
549
+ [W.Note]: u("style.builtin.note"),
550
+ [W.WarningText]: u("style.builtin.warningText"),
551
+ [W.Title]: u("style.builtin.title"),
552
+ [W.Input]: u("style.builtin.input"),
553
+ [W.Output]: u("style.builtin.output"),
554
+ [W.Calculation]: u("style.builtin.calculation"),
555
+ [W.CheckCell]: u("style.builtin.checkCell"),
556
+ [W.LinkedCell]: u("style.builtin.linkedCell"),
557
+ [W.Total]: u("style.builtin.total"),
558
+ [W.Good]: u("style.builtin.good"),
559
+ [W.Bad]: u("style.builtin.bad"),
560
+ [W.Neutral]: u("style.builtin.neutral"),
561
+ [W.ExplanatoryText]: u("style.builtin.explanatoryText")
562
+ }, jt = u("style.builtin.heading"), Mt = u("style.builtin.accent"), Nt = u("style.builtin.accentTint"), Pt = /^Heading ([1-4])$/, Ft = /^Accent([1-6])$/, It = /^(20|40|60)% - Accent([1-6])$/;
563
+ function Lt(e) {
564
+ let t = At[e];
565
+ if (t) return { key: t };
566
+ let n = Pt.exec(e);
567
+ return n ? {
568
+ key: jt,
569
+ params: { n: +n[1] }
570
+ } : (n = Ft.exec(e), n ? {
571
+ key: Mt,
572
+ params: { n: +n[1] }
573
+ } : (n = It.exec(e), n ? {
574
+ key: Nt,
575
+ params: {
576
+ pct: +n[1],
577
+ n: +n[2]
578
+ }
579
+ } : null));
580
+ }
581
+ var Rt, zt = (e, t, n, r, i) => {
582
+ let a = JSON.parse(JSON.stringify(e.definition));
583
+ a.adjs ||= [];
584
+ let o = "", s = 0, c = 0;
585
+ t > 0 ? (c = t, s = 100 - t, o = l("op.lighterPercent", { percent: t })) : t < 0 && (s = 100 + t, o = l("op.darkerPercent", { percent: -t })), s && a.adjs.push({ [ce.AdjustmentType.LumMod]: s }), c && a.adjs.push({ [ce.AdjustmentType.LumOff]: c });
586
+ let u = new se({
587
+ val: a.val,
588
+ adjs: a.adjs
589
+ }, n), d = u.toString();
590
+ r?.set(d, u);
591
+ let f = u.toRGBA().toString();
592
+ return i?.set(f, u), {
593
+ description: e.description + ", " + o,
594
+ definition: a
595
+ };
596
+ };
597
+ function Bt(e) {
598
+ return Be.peek()?.readFormulaLiteral(e);
599
+ }
600
+ function Vt(e, t) {
601
+ let n = Ht(e), r = Ht(t);
602
+ return n === r ? e === t ? 0 : typeof e == "number" && typeof t == "number" ? e < t ? -1 : 1 : typeof e == "string" && typeof t == "string" ? e < t ? -1 : +(e > t) : typeof e == "boolean" ? e ? 1 : -1 : O.isError(e) && O.isError(t) ? e.getCode() - t.getCode() : 0 : n - r;
603
+ }
604
+ function Ht(e) {
605
+ if (e === null) return 0;
606
+ switch (typeof e) {
607
+ case "number": return 1;
608
+ case "string": return 2;
609
+ case "boolean": return 3;
610
+ default: return O.isError(e) ? 4 : 5;
611
+ }
612
+ }
613
+ (Tt ||= {}).buildPalette = function(e, t, n, r) {
614
+ let i = [];
615
+ for (let a = 0; a < e.length; a++) {
616
+ let o = [];
617
+ i.push(o);
618
+ let s = (i) => {
619
+ for (let s = 0; s < i.length; s++) o.push(zt(e[a], i[s], t, n, r));
620
+ }, c = new se({
621
+ val: e[a].definition.val,
622
+ adjs: e[a].definition.adjs
623
+ }, t).toHSLA().lum;
624
+ s(c === 0 ? [
625
+ 50,
626
+ 35,
627
+ 25,
628
+ 15,
629
+ 5
630
+ ] : c === 100 ? [
631
+ -5,
632
+ -15,
633
+ -25,
634
+ -35,
635
+ -50
636
+ ] : c <= 20 ? [
637
+ 90,
638
+ 75,
639
+ 50,
640
+ 25,
641
+ 10
642
+ ] : c >= 80 ? [
643
+ -10,
644
+ -25,
645
+ -50,
646
+ -75,
647
+ -90
648
+ ] : [
649
+ 80,
650
+ 60,
651
+ 40,
652
+ -25,
653
+ -50
654
+ ]);
655
+ }
656
+ return i;
657
+ }, Et ||= {}, Dt ||= {}, Ot ||= {}, function(e) {
658
+ function t(e) {
659
+ return Be.peek()?.getFunctionDeclaration(e) ?? null;
660
+ }
661
+ e.get = t, e.has = function(e) {
662
+ return t(e) !== null;
663
+ };
664
+ }(Rt ||= {});
665
+ var G, Ut = class {
666
+ constructor(e) {
667
+ this._children = e;
668
+ }
669
+ getCoords() {
670
+ let e = this._children, t = null;
671
+ for (let n = 0; n < e.length; n++) {
672
+ let r = e[n].getCoords();
673
+ r && (t = t ? {
674
+ rowStart: Math.min(t.rowStart, r.rowStart),
675
+ colStart: Math.min(t.colStart, r.colStart),
676
+ rowEnd: Math.max(t.rowEnd, r.rowEnd),
677
+ colEnd: Math.max(t.colEnd, r.colEnd)
678
+ } : r);
679
+ }
680
+ return t;
681
+ }
682
+ getSize() {
683
+ let e = this._children, t = e.length, n = 0;
684
+ for (let r = 0; r < t; r++) n += e[r].getSize();
685
+ return n;
686
+ }
687
+ getCount() {
688
+ let e = this._children, t = e.length, n = 0;
689
+ for (let r = 0; r < t; r++) n += e[r].getCount();
690
+ return n;
691
+ }
692
+ getAggregates(e) {
693
+ if (e) return this._mergeAggregates(e);
694
+ let t = this._aggregates;
695
+ return t || (t = this._mergeAggregates(), this._aggregates = t), t;
696
+ }
697
+ getSnappedSum(e) {
698
+ let t = e ?? this.getAggregates().sum ?? 0, n = this._children;
699
+ for (let e = n.length - 1; e >= 0; e--) if (n[e].getAggregates().numericalCount > 0) return n[e].getSnappedSum(t);
700
+ return t;
701
+ }
702
+ getSortedNumbers() {
703
+ let e = this._sortedNumbers;
704
+ if (!e) {
705
+ let t = this._children, n = t.length, r = [];
706
+ for (let e = 0; e < n; e++) {
707
+ let n = t[e].getSortedNumbers().getValues();
708
+ n.length > 0 && r.push(n);
709
+ }
710
+ e = new st(function(e) {
711
+ let t = e.length;
712
+ if (t === 0) return Wt;
713
+ if (t === 1) return e[0];
714
+ let n = e[0];
715
+ for (let r = 1; r < t; r++) n = Gt(n, e[r]);
716
+ return Object.freeze(n);
717
+ }(r)), this._sortedNumbers = e;
718
+ }
719
+ return e;
720
+ }
721
+ getRanked(e) {
722
+ return Ye(this._children, e, Vt)[Symbol.iterator]();
723
+ }
724
+ getFrequencies(e) {
725
+ if (e) return this._mergeFrequencies(e);
726
+ let t = this._frequencies;
727
+ return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
728
+ }
729
+ _mergeFrequencies(e) {
730
+ let t = e?.keyFn ?? it, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
731
+ for (let l = 0; l < a; l++) {
732
+ let a = i[l].getFrequencies(e);
733
+ o += a.getVisitedCount(), s += a.getTotalCount(), c ||= a.isTruncated();
734
+ let u = a.getValueCounts(), d = u.next();
735
+ for (; !d.done;) {
736
+ let [e, i] = d.value, a = t(e), o = r.get(a);
737
+ o ? o.count += i : n === void 0 || r.size < n ? r.set(a, {
738
+ value: e,
739
+ count: i
740
+ }) : c = !0, d = u.next();
741
+ }
742
+ }
743
+ return Se.fromGroups(r, t, e, Vt, o, s, c);
744
+ }
745
+ getTypedCounts(e) {
746
+ let t = this._typedCounts;
747
+ if (!t) {
748
+ let e = {
749
+ [k.Number]: 0,
750
+ [k.String]: 0,
751
+ [k.Boolean]: 0,
752
+ [k.Error]: 0,
753
+ [k.RichData]: 0,
754
+ [k.Null]: 0
755
+ }, n = this._children, r = n.length;
756
+ for (let t = 0; t < r; t++) {
757
+ let r = n[t].getTypedCounts();
758
+ e[k.Number] += r[k.Number] ?? 0, e[k.String] += r[k.String] ?? 0, e[k.Boolean] += r[k.Boolean] ?? 0, e[k.Error] += r[k.Error] ?? 0, e[k.RichData] += r[k.RichData] ?? 0, e[k.Null] += r[k.Null] ?? 0;
759
+ }
760
+ t = Object.freeze(e), this._typedCounts = t;
761
+ }
762
+ if (e === void 0) return t;
763
+ let n = {}, r = e.length;
764
+ for (let i = 0; i < r; i++) n[e[i]] = t[e[i]] ?? 0;
765
+ return n;
766
+ }
767
+ get isIRangeStats() {
768
+ return !0;
769
+ }
770
+ _mergeAggregates(e) {
771
+ let t = this._children, n = t.length, r = {
772
+ count: 0,
773
+ min: void 0,
774
+ max: void 0,
775
+ numericalCount: 0,
776
+ sum: 0,
777
+ sumSq: 0,
778
+ typed: {
779
+ [k.Number]: 0,
780
+ [k.String]: 0,
781
+ [k.Boolean]: 0,
782
+ [k.Error]: 0,
783
+ [k.RichData]: 0,
784
+ [k.Null]: 0
785
+ }
786
+ };
787
+ for (let i = 0; i < n; i++) {
788
+ let n = t[i].getAggregates(e);
789
+ r.count += n.count;
790
+ let a = n.numericalCount;
791
+ a <= 0 || (r.numericalCount += a, r.sum += n.sum, r.sumSq += n.varP * a + n.sum * n.sum / a, (r.min === void 0 || n.min < r.min) && (r.min = n.min), (r.max === void 0 || n.max > r.max) && (r.max = n.max));
792
+ }
793
+ return rt(r);
794
+ }
795
+ }, Wt = Object.freeze([]);
796
+ function Gt(e, t) {
797
+ let n = e.length, r = t.length, i = Array(n + r), a = 0, o = 0, s = 0;
798
+ for (; a < n && o < r;) i[s++] = e[a] <= t[o] ? e[a++] : t[o++];
799
+ for (; a < n;) i[s++] = e[a++];
800
+ for (; o < r;) i[s++] = t[o++];
801
+ return i;
802
+ }
803
+ var K, Kt = class {
804
+ constructor(e, t) {
805
+ this._source = null, this.cacheId = e, this.part = t;
806
+ }
807
+ _hold(e) {
808
+ let t = this.part?.xml;
809
+ if (!t || this._source) return;
810
+ let n = fe(t, "worksheetSource", "ref"), r = fe(t, "worksheetSource", "sheet");
811
+ if (!n || !r || n.includes("#REF!")) return;
812
+ let i = e(r);
813
+ if (!i) return;
814
+ let a = {
815
+ formula: null,
816
+ wired: null,
817
+ last: null
818
+ };
819
+ this._source = a, i(`${at(r)}!${ye(n)}`, (e) => {
820
+ a.formula = e.formula;
821
+ let t = e.formula.getExpression();
822
+ a.wired ??= t, e.formula.hasRefError() || (a.last = t);
823
+ });
824
+ }
825
+ getXML() {
826
+ let e = this.part?.xml ?? null, t = this._source;
827
+ if (!e || !t?.formula) return e;
828
+ let n = t.formula.hasRefError() ? t.last : t.formula.getExpression();
829
+ if (n === null || n === t.wired) return e;
830
+ let r = Me(n);
831
+ return r ? P(P(e, "worksheetSource", "ref", ve(r.reference)), "worksheetSource", "sheet", r.sheet) : P(e, "worksheetSource", "ref", ve(n));
832
+ }
833
+ toJSON(e) {
834
+ let t = { cacheId: this.cacheId }, n = R.toJSON(this.part, e);
835
+ if (n) {
836
+ let e = this.getXML();
837
+ e !== null && (n.xml = e), t.part = n;
838
+ }
839
+ return t;
840
+ }
841
+ }, qt = class {
842
+ constructor(e, t) {
843
+ this._deleted = !1, this._json = { ...e }, this._deleteFromCollection = t ?? null;
844
+ }
845
+ getId() {
846
+ return this._json.id;
847
+ }
848
+ getDisplayName() {
849
+ return this._json.displayName;
850
+ }
851
+ getUserId() {
852
+ return this._json.userId ?? null;
853
+ }
854
+ getProviderId() {
855
+ return this._json.providerId ?? null;
856
+ }
857
+ delete() {
858
+ this._deleted || (this._deleted = !0, this._deleteFromCollection?.(this));
859
+ }
860
+ isDeleted() {
861
+ return this._deleted;
862
+ }
863
+ toJSON() {
864
+ return { ...this._json };
865
+ }
866
+ get [Symbol.toStringTag]() {
867
+ return "[Person]";
868
+ }
869
+ toString() {
870
+ return `Person:${this.getDisplayName()}`;
871
+ }
872
+ get isIPerson() {
873
+ return !0;
874
+ }
875
+ }, Jt = class extends we {
876
+ constructor(e) {
877
+ super(), this._byId = /* @__PURE__ */ new Map(), this._byDisplayName = /* @__PURE__ */ new Map(), this._items = null, this._current = null, e && this.fromJSON(e);
878
+ }
879
+ _getItems() {
880
+ return this._items ??= Array.from(this._byId.values());
881
+ }
882
+ getCount() {
883
+ return this._byId.size;
884
+ }
885
+ add(e) {
886
+ let t = typeof e == "string" ? { displayName: e } : e, r = t.id;
887
+ if (r) {
888
+ let e = this._byId.get(r);
889
+ if (e) return e;
890
+ }
891
+ let i = t.displayName ?? "";
892
+ if (!r) {
893
+ let e = this._byDisplayName.get(i);
894
+ if (e) return e;
895
+ }
896
+ let a = new qt({
897
+ ...t,
898
+ displayName: i,
899
+ id: r ?? n.uuidV4().toUpperCase()
900
+ }, (e) => this._remove(e));
901
+ return this._byId.set(a.getId(), a), i && !this._byDisplayName.has(i) && this._byDisplayName.set(i, a), this._items = null, this._notifyCollectionChange(), a;
902
+ }
903
+ getById(e) {
904
+ return typeof e == "string" ? this._byId.get(e) ?? null : null;
905
+ }
906
+ getByDisplayName(e) {
907
+ return typeof e == "string" ? this._byDisplayName.get(e) ?? null : null;
908
+ }
909
+ getCurrent() {
910
+ return this._current ??= this.add("Author");
911
+ }
912
+ setCurrent(e) {
913
+ if (e !== null) {
914
+ if (typeof e == "object" && e.isIPerson) {
915
+ let t = e;
916
+ this._current = this.getById(t.getId()) ?? this.add(t.toJSON());
917
+ return;
918
+ }
919
+ this._current = this.add(e);
920
+ } else this._current = null;
921
+ }
922
+ _remove(e) {
923
+ this._byId.get(e.getId()) === e && (this._byId.delete(e.getId()), this._byDisplayName.get(e.getDisplayName()) === e && this._byDisplayName.delete(e.getDisplayName()), this._current === e && (this._current = null), this._items = null, this._notifyCollectionChange());
924
+ }
925
+ toJSON() {
926
+ return this._byId.size === 0 ? null : this._getItems().map((e) => e.toJSON());
927
+ }
928
+ fromJSON(e) {
929
+ if (!e) return;
930
+ let t = e.length;
931
+ for (let n = 0; n < t; n++) {
932
+ let t = e[n];
933
+ t && typeof t.id == "string" && this.add(t);
934
+ }
935
+ }
936
+ get isIPersonCollection() {
937
+ return !0;
938
+ }
939
+ }, Yt = class {
940
+ constructor(e) {
941
+ this._options = e, this._emitter = new _(this), this._initState();
942
+ }
943
+ _initState() {}
944
+ getModules() {
945
+ return this._modules;
946
+ }
947
+ _builtInNames() {
948
+ try {
949
+ let e = this._options.getBuiltInFunctions?.();
950
+ if (!e) return n.EmptyArray;
951
+ let t = [];
952
+ for (let n of e.getItems({ includeHidden: !0 })) n.isBuiltIn() && t.push(n.getName());
953
+ return t;
954
+ } catch {
955
+ return n.EmptyArray;
956
+ }
957
+ }
958
+ async createModule(e) {
959
+ let t = await (await import("./DLb7DkSaAdwiJNw-.js")).ScriptCompiler.compile({
960
+ builtInNames: this._builtInNames(),
961
+ minify: !0,
962
+ ...e
963
+ });
964
+ return t.module ? await N(ue.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
965
+ }
966
+ addModule(e, t, n) {
967
+ this._modules.add(e, t, n);
968
+ }
969
+ async addModuleFromJSON(e, t, n) {
970
+ let r = await N(e, t);
971
+ return this.addModule(e, r, n), r;
972
+ }
973
+ executeMacro(e, t, n) {
974
+ let r = this._modules.getItems({ name: t }), i = r.length;
975
+ for (let t = 0; t < i; t++) {
976
+ let i = r[t].getFunctions().getByName(e);
977
+ if (i) return i.execute(this._options.workbook, {
978
+ applyResult: !0,
979
+ ...n
980
+ });
981
+ }
982
+ throw Error(`No macro ${e} found.`);
983
+ }
984
+ async run(e, t) {
985
+ try {
986
+ let n = typeof e == "string" ? await this.createModule({ source: e }) : await N(ue.DEFAULT_MODULE, e), r = typeof e == "string" ? e : e?.source ?? "";
987
+ return await this._runModule(n, r, t);
988
+ } catch (e) {
989
+ return {
990
+ ok: !1,
991
+ error: e
992
+ };
993
+ }
994
+ }
995
+ async _runModule(e, t, n) {
996
+ let r = this._options?.workbook;
997
+ if (!e) return {
998
+ ok: !1,
999
+ error: Error("The script did not compile to a module.")
1000
+ };
1001
+ let i = e.getDiagnostics(), a = i.filter((e) => e.severity === "error");
1002
+ if (a.length > 0) {
1003
+ let e = Error(((e, t) => {
1004
+ let n = [0];
1005
+ for (let t = 0; t < e.length; t++) e[t] === "\n" && n.push(t + 1);
1006
+ let r = t.map((e) => ` ${((e) => {
1007
+ let t = 0, r = n.length - 1;
1008
+ for (; t < r;) {
1009
+ let i = t + r + 1 >> 1;
1010
+ n[i] <= e ? t = i : r = i - 1;
1011
+ }
1012
+ return `${t + 1}:${e - n[t] + 1}`;
1013
+ })(e.start)} ${e.code}: ${e.message}`), i = t.length;
1014
+ return `Script has ${i} compile error${i === 1 ? "" : "s"}:\n${r.join("\n")}`;
1015
+ })(t, a));
1016
+ return e.diagnostics = a, {
1017
+ ok: !1,
1018
+ error: e,
1019
+ diagnostics: i
1020
+ };
1021
+ }
1022
+ let o = e.getFunctions(), s = o.getItems({
1023
+ type: "autoRun",
1024
+ includeHidden: !0
1025
+ })[0] ?? o.getItems({
1026
+ type: "macro",
1027
+ includeHidden: !0
1028
+ })[0] ?? null;
1029
+ if (!s) return {
1030
+ ok: !1,
1031
+ error: Error("The script has no runnable entry. Export a default function taking the script context, e.g. `export default function run(ctx: IScript.ScriptContext) { ... }` (the workbook is `ctx.wb`; a macro may instead take its target first, e.g. `(sheet: IWorksheet, ctx)`).")
1032
+ };
1033
+ let c = await s.execute(r, n);
1034
+ return {
1035
+ ok: !0,
1036
+ result: c?.results,
1037
+ commitId: c?.commitId,
1038
+ diagnostics: i
1039
+ };
1040
+ }
1041
+ _searchable(e) {
1042
+ let t = this._modules;
1043
+ return t && t.getCount() !== 0 ? (e ? t.getItems({ name: e }) : t.getItems()).map((e) => e.getFunctions()) : n.EmptyArray;
1044
+ }
1045
+ async searchFunctions(e) {
1046
+ await this._emitter.notify("onBeforeSearch", { async: !0 });
1047
+ let t = this._searchable(e?.moduleName);
1048
+ if (t.length === 0) return n.EmptyArray;
1049
+ if (t.length === 1) return t[0].search(e);
1050
+ let r, i = e?.limit, a = i === void 0 ? e : {
1051
+ ...e,
1052
+ limit: void 0
1053
+ }, o = /* @__PURE__ */ new Set();
1054
+ for (let e = 0; e < t.length; e++) {
1055
+ let n = await t[e].search(a);
1056
+ if (n.length !== 0) {
1057
+ r ||= [];
1058
+ for (let e = 0; e < n.length; e++) {
1059
+ let t = n[e], i = t.getName().toUpperCase();
1060
+ o.has(i) || (o.add(i), r.push(t));
1061
+ }
1062
+ }
1063
+ }
1064
+ if (!r || r.length === 0) return n.EmptyArray;
1065
+ let s = e?.text ? e.text.trim().toUpperCase() : null;
1066
+ return s ? Ve(r, s) : r.sort((e, t) => {
1067
+ let n = e.getName().toUpperCase(), r = t.getName().toUpperCase();
1068
+ return n < r ? -1 : +(n > r);
1069
+ }), i !== void 0 && r.length > i ? r.slice(0, i) : r;
1070
+ }
1071
+ async start() {
1072
+ return this._startPromise || (this._startPromise = this._doStart(), this._startPromise.catch(() => {
1073
+ this._startPromise = void 0;
1074
+ })), this._startPromise;
1075
+ }
1076
+ _load() {
1077
+ return this._loadPromise || (this._loadPromise = this._doLoad(), this._loadPromise.catch(() => {
1078
+ this._loadPromise = void 0;
1079
+ })), this._loadPromise;
1080
+ }
1081
+ async _doStart() {
1082
+ await this._load();
1083
+ let e = this._options?.workbook, t = this._modules.getItems(), n = t.length;
1084
+ for (let r = 0; r < n; r++) {
1085
+ let n = t[r];
1086
+ try {
1087
+ let t = n.getFunctions().getItems({
1088
+ type: "autoRun",
1089
+ includeHidden: !0
1090
+ }), r = t.length;
1091
+ for (let n = 0; n < r; n++) await t[n].execute(e);
1092
+ } catch (e) {
1093
+ f.error("Error executing autoRun script:", e);
1094
+ }
1095
+ }
1096
+ }
1097
+ async _doLoad() {
1098
+ let e = this._options?.workbook, t = this._options?.json, n = {};
1099
+ if (t) {
1100
+ let r = Object.keys(t);
1101
+ for (let i = 0; i < r.length; i++) {
1102
+ let a = r[i], o = t[a];
1103
+ try {
1104
+ n[a] = await N(a, o, !1, [], o?.scope === "workbook" ? e : null);
1105
+ } catch (e) {
1106
+ f.error(`Could not load script '${a}'; it will be unavailable.`, e);
1107
+ }
1108
+ }
1109
+ }
1110
+ let r = this, i = new He({
1111
+ transactions: this._options?.transactions,
1112
+ initial: n,
1113
+ isReadOnly: () => r.isReadOnly(),
1114
+ onRemove: (e, t) => {
1115
+ r._options?.onRemove?.(e, t);
1116
+ },
1117
+ onAdd: (e, t) => {
1118
+ r._emitter.notify("onChange"), r._options?.onAdd?.(e, t);
1119
+ }
1120
+ });
1121
+ this._modules = i;
1122
+ }
1123
+ addListeners(e, t) {
1124
+ return this._emitter.addListeners(e, t);
1125
+ }
1126
+ isReadOnly() {
1127
+ return this._options.workbook?._isStructureProtected?.() ?? !1;
1128
+ }
1129
+ toJSON() {
1130
+ this._emitter.notify("onBeforeSave");
1131
+ let e = this._modules;
1132
+ if (!e) throw Error("Scripts is initializing.");
1133
+ return e.toJSON();
1134
+ }
1135
+ get isIScript() {
1136
+ return !0;
1137
+ }
1138
+ }, Xt = /^([a-z][a-z0-9+.-]*):/i, Zt = (e) => {
1139
+ let t = e.toLowerCase();
1140
+ return t.endsWith(":") ? t : t + ":";
1141
+ }, Qt = (e, t) => globalThis.fetch(e, t), $t = class {
1142
+ constructor() {
1143
+ this._handlers = /* @__PURE__ */ new Map([["http:", Qt], ["https:", Qt]]);
1144
+ }
1145
+ fetch(e, t) {
1146
+ let n = Xt.exec(e)?.[1], r = this._handlers.get(n ? Zt(n) : "https:");
1147
+ if (!r) return Promise.reject(TypeError(`No fetcher serves '${n}:'.`));
1148
+ try {
1149
+ return r(e, t);
1150
+ } catch (e) {
1151
+ return Promise.reject(e);
1152
+ }
1153
+ }
1154
+ register(e, t) {
1155
+ let n = Zt(e), r = this._handlers.get(n);
1156
+ return this._handlers.set(n, t), () => {
1157
+ this._handlers.get(n) === t && (r ? this._handlers.set(n, r) : this._handlers.delete(n));
1158
+ };
1159
+ }
1160
+ get isIFetcher() {
1161
+ return !0;
1162
+ }
1163
+ }, en = /* @__PURE__ */ new Set([
1164
+ 101,
1165
+ 103,
1166
+ 204,
1167
+ 205,
1168
+ 304
1169
+ ]), q = (e) => new Response(en.has(e.status) ? null : e.body, {
1170
+ status: e.status,
1171
+ statusText: e.statusText,
1172
+ headers: e.headers
1173
+ }), tn = class {
1174
+ constructor(e, t) {
1175
+ this._kept = /* @__PURE__ */ new Map(), this._cached = /* @__PURE__ */ new Map(), this._inFlight = /* @__PURE__ */ new Map(), this._resources = e, this._fetcher = t;
1176
+ }
1177
+ getFetcher() {
1178
+ return this._fetcher;
1179
+ }
1180
+ async fetch(e, t) {
1181
+ if (((e) => !e || (!e.method || e.method.toUpperCase() === "GET") && !e.body)(t) && t?.cache !== "reload") {
1182
+ let n = this._kept.get(e) ?? this._findHeld(e);
1183
+ if (n && !n.isClosed()) return this._fromKept(n);
1184
+ let r = this._cached.get(e);
1185
+ if (r) return q(r);
1186
+ let i = this._inFlight.get(e);
1187
+ return i || (i = this._request(e, {
1188
+ ...t,
1189
+ signal: void 0
1190
+ }).finally(() => {
1191
+ this._inFlight.delete(e);
1192
+ }), this._inFlight.set(e, i)), q(await ((e, t) => t ? t.aborted ? Promise.reject(t.reason) : new Promise((n, r) => {
1193
+ let i = () => r(t.reason);
1194
+ t.addEventListener("abort", i, { once: !0 }), e.then(n, r).finally(() => t.removeEventListener("abort", i));
1195
+ }) : e)(i, t?.signal));
1196
+ }
1197
+ return q(await this._request(e, t));
1198
+ }
1199
+ adopt(e) {
1200
+ for (let t of e) {
1201
+ let e = t.getFetchedFrom();
1202
+ e && !t.isClosed() && this.keep(e, t);
1203
+ }
1204
+ }
1205
+ keep(e, t) {
1206
+ let n = this._kept.get(e);
1207
+ n !== t && (t.addReference(this), this._kept.set(e, t), n && !n.isClosed() && n.deleteReference(this));
1208
+ }
1209
+ _findHeld(e) {
1210
+ for (let t of this._resources.getItems()) if (t.getFetchedFrom() === e && !t.isClosed()) return this.keep(e, t), t;
1211
+ return null;
1212
+ }
1213
+ async _fromKept(e) {
1214
+ let [t, n] = await Promise.all([e.toBuffer(), e.getType()]);
1215
+ return q({
1216
+ status: 200,
1217
+ statusText: "OK",
1218
+ headers: n ? [["content-type", n.mime]] : [],
1219
+ body: t
1220
+ });
1221
+ }
1222
+ async _request(e, t) {
1223
+ let n = await this._fetcher.fetch(e, t), r = en.has(n.status) ? null : await n.arrayBuffer(), i = [];
1224
+ n.headers.forEach((e, t) => {
1225
+ i.push([t, e]);
1226
+ });
1227
+ let a = {
1228
+ status: n.status,
1229
+ statusText: n.statusText,
1230
+ headers: i,
1231
+ body: r
1232
+ };
1233
+ if (n.ok && r && r.byteLength > 0) {
1234
+ let t = await new be({ source: { buffer: r } }).getType();
1235
+ t?.mime.startsWith("image/") ? (a.headers = i.filter(([e]) => e.toLowerCase() !== "content-type"), a.headers.push(["content-type", t.mime])) : this._cached.set(e, a);
1236
+ }
1237
+ return a;
1238
+ }
1239
+ }, nn = class {
1240
+ constructor(e, n, r, i) {
1241
+ this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = r, this._topLeft = n ?? t.EmptyCell, this._sheet = new F({
1242
+ runtime: e,
1243
+ styles: this._styles,
1244
+ calcOnLoad: "none",
1245
+ container: {
1246
+ getName: () => i,
1247
+ getIndex: () => 1
1248
+ }
1249
+ }), this._builder = this._sheet.getEntireRange().createSparseBuilder();
1250
+ }
1251
+ applyCSSStyle(e, t) {
1252
+ let n = !1;
1253
+ e.style || (e.style = {}, n = !0);
1254
+ let r = e.style, i = { ...t };
1255
+ if (t.msoIgnore) {
1256
+ let e = t.msoIgnore.split(","), n = Object.keys(i);
1257
+ for (let t = 0; t < n.length; t++) {
1258
+ let r = n[t];
1259
+ e.includes(r) && delete i[r];
1260
+ }
1261
+ }
1262
+ let a = le(i.fontFamily);
1263
+ r.font = {}, a && (r.font.family = a.family, r.font.fallbacks = a.fallbacks, r.font.size = a.size), r.font.size = i.fontSize, r.font.weight = i.fontWeight, r.font.style = i.fontStyle, r.font.color = i.color;
1264
+ let o = ie(i.textDecoration);
1265
+ r.font.underline = o.underline, r.font.strike = o.strike ? E.StrikeStyle.Single : E.StrikeStyle.None, i.textUnderlineStyle && (r.font.underline = ee(i.textUnderlineStyle)), r.alignment = {}, i?.textAlign && (r.alignment.horizontal = y(i.textAlign)), i?.textAlign && !r.alignment.horizontal && i?.textAlign !== "general" && (i.textAlign === "center-across" ? r.alignment.horizontal = C.HorizontalAlignment.CenterContinuous : i.textAlign === "fill" ? r.alignment.horizontal = C.HorizontalAlignment.Fill : i.textAlign === "121" || i.textAlign === "010" ? (r.alignment.horizontal = C.HorizontalAlignment.Distributed, r.alignment.justifyLastLine = i.textAlign === "121") : console.warn("unknown text-align", i.textAlign)), i.verticalAlign && (i.verticalAlign.toLowerCase() === "super" ? r.font.baseline = b.Baseline.Superscript : i.verticalAlign.toLowerCase() === "sub" ? r.font.baseline = b.Baseline.Subscript : r.alignment.vertical = x(i.verticalAlign), r.alignment.vertical || (i.verticalAlign === "121" ? r.alignment.vertical = C.VerticalAlignment.Distributed : console.warn("unknown vertical-align", i.verticalAlign))), i.msoCharIndentCount && (r.alignment.indent = i.msoCharIndentCount), i.whiteSpace && (r.alignment.overflow = i.whiteSpace === "no-wrap" || i.whiteSpace === "nowrap" ? C.Overflow.Visible : C.Overflow.Wrap), i.msoTextControl === "shrinktofit" && (r.alignment.overflow = C.Overflow.Shrink);
1266
+ let s = null;
1267
+ if (i.background ? s = i.background : i.backgroundColor && (s = i.backgroundColor), s && (r.fill = { color: s }), i.msoPattern) {
1268
+ let e = ne(i.msoPattern);
1269
+ e && (e.patternType === w.BuiltInSheetPattern.Solid ? r.fill = { color: e.foreground } : e.patternType !== w.BuiltInSheetPattern.None && (s && (e.background = s), r.fill = e));
1270
+ }
1271
+ i.layoutFlow === "vertical" || i.layoutFlow === "vertical-ideographic" ? r.alignment.stacked = !0 : i.msoRotate !== void 0 && (r.alignment.rotation = oe(i.msoRotate));
1272
+ let c = (e, t) => {
1273
+ e && (r.borders ||= {}, r.borders[e] = t);
1274
+ };
1275
+ i.border && i.border !== "none" && (c("top", i.border), c("left", i.border), c("right", i.border), c("bottom", i.border)), i.borderTop && c("top", i.borderTop), i.borderLeft && c("left", i.borderLeft), i.borderRight && c("right", i.borderRight), i.borderBottom && c("bottom", i.borderBottom), i.msoDiagonalUp && c("diagonalUp", i.msoDiagonalUp), i.msoDiagonalDown && c("diagonalDown", i.msoDiagonalDown);
1276
+ let l = r.numberFormat;
1277
+ i.msoNumberFormat && (l = ae(i.msoNumberFormat), l.includes("\\") ? l = null : l === "Fixed" ? l = S.Styles.lookupStyle(r.numberFormat).formatType === S.Type.Number ? null : S.Type.Number : l === "Percent" && (l = S.Styles.lookupStyle(r.numberFormat).formatType === S.Type.Percentage ? null : S.Type.Percentage)), l && (r.numberFormat = l), e.style = this._styles.normalize(r), n && Object.keys(e.style).length === 0 && delete e.style;
1278
+ }
1279
+ onCell(e, n, r, i, a) {
1280
+ let o = i(a), s = { value: n === void 0 ? r ?? "" : n };
1281
+ if (typeof s.value == "string" && s.value.length === 0 && (s.value = void 0), o && this.applyCSSStyle(s, o), typeof s.value == "string" && /^#+$/.test(s.value)) {
1282
+ let e = s.style?.numberFormat;
1283
+ e && (te(e) || T(e)) && (s.value = O.BuiltIn.Num);
1284
+ }
1285
+ if (a?.tagName.toUpperCase() === "TD") {
1286
+ let e = s.style, t = e?.font ?? {};
1287
+ (a.querySelectorAll("s").length > 0 || a.querySelectorAll("strike").length > 0) && (t.strike = E.StrikeStyle.Single), a.querySelectorAll("sub").length > 0 && (t.baseline = b.Baseline.Subscript), a.querySelectorAll("sup").length > 0 && (t.baseline = b.Baseline.Superscript), (a.querySelectorAll("b").length > 0 || a.querySelectorAll("strong").length > 0) && (t.weight = 700), a.querySelectorAll("i").length > 0 && (t.style = E.Style.Italic), a.querySelectorAll("u").length > 0 && (t.underline = E.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, s.style = e), e.font || (e.font = t));
1288
+ let n = a.querySelectorAll("a");
1289
+ if (n.length > 0) {
1290
+ let e = n[0].getAttribute("href");
1291
+ e && (s.hyperlink = e);
1292
+ }
1293
+ }
1294
+ if (!t.isSingleCell(e)) {
1295
+ let t = {
1296
+ rowStart: this._topLeft.rowIndex + e.rowStart,
1297
+ colStart: this._topLeft.colIndex + e.colStart,
1298
+ rowEnd: this._topLeft.rowIndex + e.rowEnd,
1299
+ colEnd: this._topLeft.colIndex + e.colEnd
1300
+ };
1301
+ this._mergedReading.push(t);
1302
+ }
1303
+ if (s.value === void 0 && !s.style && Object.keys(s).length <= 1) return;
1304
+ let c = this._builder, l = this._topLeft;
1305
+ if (c.pushAt(l.rowIndex + e.rowStart, l.colIndex + e.colStart, s), !t.isSingleCell(e) && o.msoIgnore) {
1306
+ if (o.msoIgnore.includes("colspan")) {
1307
+ let t = {};
1308
+ o && this.applyCSSStyle(t, o);
1309
+ let n = e.colEnd - e.colStart, r = l.rowIndex + e.rowStart;
1310
+ for (let i = 1; i <= n; i++) c.pushAt(r, l.colIndex + e.colStart + i, t);
1311
+ e = {
1312
+ ...e,
1313
+ colEnd: e.colStart
1314
+ };
1315
+ }
1316
+ o.msoIgnore.includes("rowspan") && (e = {
1317
+ ...e,
1318
+ rowEnd: e.rowStart
1319
+ });
1320
+ }
1321
+ }
1322
+ onNoTable(e, t, n) {
1323
+ this.onCell({
1324
+ rowStart: this._topLeft.rowIndex,
1325
+ colStart: this._topLeft.colIndex,
1326
+ rowEnd: this._topLeft.rowIndex,
1327
+ colEnd: this._topLeft.colIndex
1328
+ }, e, null, t, n);
1329
+ }
1330
+ onRowStart(e, t, n, r) {
1331
+ let i = n(r);
1332
+ if (i.msoHeightSource !== "userset" || !r) return;
1333
+ let a = r.getAttribute("height") ?? i.height, o = null;
1334
+ if (a && (o = D(a, this._styles.getNormal().getFont().getSize(), "px")), o === null) for (let e = 0; e < r.cells.length; e++) {
1335
+ let t = r.cells[e], i = t.getAttribute("height") ?? n(t).height, a = D(i, this._styles.getNormal().getFont().getSize(), "px");
1336
+ a !== null && (o = Math.max(a, o ?? 0));
1337
+ }
1338
+ o !== null && this._rowsReading.push({
1339
+ address: {
1340
+ min: this._topLeft.rowIndex + e,
1341
+ max: this._topLeft.rowIndex + e + t - 1
1342
+ },
1343
+ update: { size: o * E.getDeviceScale() }
1344
+ });
1345
+ }
1346
+ onColumn(e, t, n, r) {
1347
+ let i = n(r);
1348
+ if (i.msoWidthSource !== "userset" || !r) return;
1349
+ let a = r.getAttribute("width") ?? i.width, o = null;
1350
+ a && (o = D(a, this._styles.getNormal().getFont().getSize(), "px")), o !== null && this._colsReading.push({
1351
+ address: {
1352
+ min: this._topLeft.colIndex + e,
1353
+ max: this._topLeft.colIndex + e + t - 1
1354
+ },
1355
+ update: { size: o * E.getDeviceScale() }
1356
+ });
1357
+ }
1358
+ onDone() {
1359
+ this._colsReading.length > 0 && this._sheet.getColumnHeaders().updateHeaderPairs(this._colsReading), this._rowsReading.length > 0 && this._sheet.getRowHeaders().updateHeaderPairs(this._rowsReading), this._sheet.doBatch(() => {
1360
+ this._builder.apply();
1361
+ }), this._mergedReading.length > 0 && this._sheet.getRanges(this._mergedReading).merge();
1362
+ }
1363
+ sheet() {
1364
+ return this._sheet;
1365
+ }
1366
+ }, rn = class {
1367
+ constructor(e) {
1368
+ if (!e) throw new m("snapshot is required.");
1369
+ this._snapshot = e;
1370
+ }
1371
+ getItemType() {
1372
+ return "range";
1373
+ }
1374
+ getItem() {
1375
+ return this._snapshot;
1376
+ }
1377
+ editMode() {
1378
+ return this._snapshot?.getMarkOptions().editMode ?? null;
1379
+ }
1380
+ isCut() {
1381
+ return this._snapshot?.getMarkOptions().isCut ?? !1;
1382
+ }
1383
+ getName() {
1384
+ return this._snapshot.getName();
1385
+ }
1386
+ toText() {
1387
+ return this._snapshot.toText();
1388
+ }
1389
+ toHtml() {
1390
+ return this._snapshot.toHtml();
1391
+ }
1392
+ toImage() {
1393
+ return this._snapshot.toImage();
1394
+ }
1395
+ get isClipboardItem() {
1396
+ return !0;
1397
+ }
1398
+ }, an = class {
1399
+ constructor(e, n, r, i, a) {
1400
+ if (this._parsed = void 0, this._runtime = e, !n) throw new m("nativeItems are required.");
1401
+ this._topLeft = r ?? t.EmptyCell, this._native = n, this._markOptions = Object.freeze(i ?? {}), this._styles = a;
1402
+ }
1403
+ getItemType() {
1404
+ return "range";
1405
+ }
1406
+ isCut() {
1407
+ return !1;
1408
+ }
1409
+ toText() {
1410
+ return this._native?.text;
1411
+ }
1412
+ toHtml() {
1413
+ return this._native?.html?.documentElement.outerHTML || null;
1414
+ }
1415
+ toImage() {
1416
+ return this._native?.image;
1417
+ }
1418
+ getItem() {
1419
+ let e = this._parsed;
1420
+ if (e === void 0) throw Error("Must call 'parse()' before getItem().");
1421
+ if (e === null) return null;
1422
+ if (this._snapshot) return this._snapshot;
1423
+ let t = this;
1424
+ return this._snapshot = {
1425
+ prepare: (n, r) => e.prepare?.(n, {
1426
+ ...t._markOptions,
1427
+ ...r
1428
+ }),
1429
+ copyTo: (n, r) => e.copyTo(n, {
1430
+ ...t._markOptions,
1431
+ ...r
1432
+ }),
1433
+ getMarkOptions: () => t._markOptions,
1434
+ getName: () => e?.getName() ?? "Clipboard Data",
1435
+ getCoords: () => e?.getCoords?.() ?? null,
1436
+ toText: () => t.toText(),
1437
+ toHtml: () => t.toHtml(),
1438
+ toImage: () => t.toImage(),
1439
+ getSource: () => e?.getSource?.() ?? null,
1440
+ isISnapshot: !0
1441
+ }, this._snapshot;
1442
+ }
1443
+ async parse() {
1444
+ let e, t = this._native?.text, n = this._native.html;
1445
+ if (n === null && t && t.includes("<table")) try {
1446
+ let e = new DOMParser().parseFromString(t, o.Html), r = e.querySelector("parsererror");
1447
+ if (r) throw new s("Unable to parse: " + r);
1448
+ n = e, t = null;
1449
+ } catch {
1450
+ console.warn("Discovered text as html table but could could not parse.");
1451
+ }
1452
+ try {
1453
+ let r, i = new nn(this._runtime, this._topLeft, this._styles, n ? "HTML" : "Text"), a = await Promise.resolve(t ? tt(t) : [[]]);
1454
+ if (Ae(n, a, i) ? (e = i.sheet(), r = e.getUsedRange()) : n = null, r) {
1455
+ let t = r.getSnapshot();
1456
+ return this._parsed = {
1457
+ prepare: (e, n) => t.prepare?.(e, n),
1458
+ copyTo: (e, n) => t.copyTo(e, n),
1459
+ getCoords: () => r.getCoords(),
1460
+ getSource: () => e,
1461
+ getName: () => e.getName()
1462
+ }, !0;
1463
+ }
1464
+ } catch (e) {
1465
+ throw e;
1466
+ }
1467
+ if (!t && !n && this._native.image) {
1468
+ let e = await this._native.image.arrayBuffer(), t = null;
1469
+ return this._parsed = {
1470
+ async prepare(n) {
1471
+ let r = n.getWorksheet();
1472
+ t = {
1473
+ sheet: r,
1474
+ options: await r.getMovables()._preparePicture({ source: { buffer: e } }, {
1475
+ type: "picture",
1476
+ description: u("op.copyImageFromClipboard"),
1477
+ autoSelect: !0
1478
+ })
1479
+ };
1480
+ },
1481
+ copyTo(e, n) {
1482
+ let r = e.getWorksheet();
1483
+ if (t?.sheet !== r) throw Error("The image was not prepared for this sheet.");
1484
+ return r.getMovables()._insertNow(t.options), null;
1485
+ },
1486
+ getName: () => "Image"
1487
+ }, !0;
1488
+ }
1489
+ return this._parsed = null, !1;
1490
+ }
1491
+ get isClipboardItem() {
1492
+ return !0;
1493
+ }
1494
+ }, on = class {
1495
+ constructor(e) {
1496
+ this._closed = !1, this._kind = e.kind, this._id = e.id, this._part = e.part, this._styles = e.styles, this._tabColor = e.tabColor ? this._styles.parseColor(e.tabColor) : null, this._transactions = e.transactions, this._workbook = e.workbook ?? null, this._container = e.container, this._emitter = new _(this, this._transactions);
1497
+ }
1498
+ getKind() {
1499
+ return this._kind;
1500
+ }
1501
+ getId() {
1502
+ return this._id;
1503
+ }
1504
+ getName() {
1505
+ return this._container.getName();
1506
+ }
1507
+ setName(e, t) {
1508
+ return this._assertOpen(), this._container.setName(e, t), this;
1509
+ }
1510
+ getVisibility() {
1511
+ return this._closed ? j.Visibility.VeryHidden : this._container.getVisibility();
1512
+ }
1513
+ setVisibility(e = !0, t) {
1514
+ let n;
1515
+ return this._assertOpen(), n = !0 === e ? j.Visibility.Visible : !1 === e ? j.Visibility.Hidden : e, this._container.setVisibility(n, t), this;
1516
+ }
1517
+ getIndex() {
1518
+ return this._container.getIndex();
1519
+ }
1520
+ setIndex(e, t) {
1521
+ return this._assertOpen(), this._container.setIndex(e, t), this;
1522
+ }
1523
+ getTabColor() {
1524
+ return this._tabColor;
1525
+ }
1526
+ setTabColor(e) {
1527
+ return this._assertOpen(), this._tabColor = typeof e == "string" ? this._styles.parseColor(e) : e ?? null, this._notify("onTabColorChange"), this;
1528
+ }
1529
+ getWorkbook() {
1530
+ return this._workbook;
1531
+ }
1532
+ async select(e) {
1533
+ return await this._container.requestSelect(e), this;
1534
+ }
1535
+ delete() {
1536
+ if (this._closed) return;
1537
+ let e = this._transactions.beginCommit({ description: l("op.deleteSheet", { name: this.getName() }) });
1538
+ try {
1539
+ try {
1540
+ this._notify("onBeforeDelete");
1541
+ } catch (e) {
1542
+ throw e instanceof Error ? e : new s(e?.message ?? l("error.sheet.modelDelete"));
1543
+ }
1544
+ this._notify("onDelete"), e.commit();
1545
+ } catch (t) {
1546
+ throw e.rollback(), t;
1547
+ }
1548
+ }
1549
+ isDeleted() {
1550
+ return !this._container.isAttached();
1551
+ }
1552
+ addListeners(e, t) {
1553
+ return this._emitter.addListeners(e, t);
1554
+ }
1555
+ close() {
1556
+ this._closed ||= (this._notify("onClose"), this._emitter.close(), !0);
1557
+ }
1558
+ isClosed() {
1559
+ return this._closed;
1560
+ }
1561
+ _getPart() {
1562
+ return this._part;
1563
+ }
1564
+ _notify(e) {
1565
+ this._emitter.notify(e);
1566
+ }
1567
+ _assertOpen() {
1568
+ if (this._closed) throw Error(l("error.sheet.modelClosed"));
1569
+ }
1570
+ get [Symbol.toStringTag]() {
1571
+ return "[OpaqueSheet]";
1572
+ }
1573
+ toString() {
1574
+ return `[${this.getName() ?? "(untitled)"}]`;
1575
+ }
1576
+ get isISheet() {
1577
+ return !0;
1578
+ }
1579
+ get isIOpaqueSheet() {
1580
+ return !0;
1581
+ }
1582
+ };
1583
+ (G ||= {}).Visibility = {
1584
+ Visible: "visible",
1585
+ Hidden: "hidden",
1586
+ VeryHidden: "veryHidden"
1587
+ };
1588
+ var J = {
1589
+ showFormulaBar: !0,
1590
+ showTabs: !0,
1591
+ tabRatio: 600,
1592
+ showHorizontalScrollbar: !0,
1593
+ showVerticalScrollbar: !0,
1594
+ showStatusBar: !0,
1595
+ activeSheetId: 0,
1596
+ firstTab: 0,
1597
+ windowBounds: null,
1598
+ minimized: !1,
1599
+ visibility: G.Visibility.Visible,
1600
+ autoFilterDateGrouping: !0
1601
+ }, sn = class {
1602
+ constructor(e) {
1603
+ this._id = n.uuidV4(), this._emitter = new _(this), this._state = { ...J }, e?.json && this._fromJSON(e?.json);
1604
+ }
1605
+ getId() {
1606
+ return this._id;
1607
+ }
1608
+ isShowFormulaBar() {
1609
+ return this._state.showFormulaBar;
1610
+ }
1611
+ setShowFormulaBar(e) {
1612
+ return this._state.showFormulaBar = e, this._emitter.notify("onViewChange"), this;
1613
+ }
1614
+ isShowTabs() {
1615
+ return this._state.showTabs;
1616
+ }
1617
+ setShowTabs(e) {
1618
+ return this._state.showTabs = e, this._emitter.notify("onViewChange"), this;
1619
+ }
1620
+ getTabRatio() {
1621
+ return this._state.tabRatio;
1622
+ }
1623
+ setTabRatio(e) {
1624
+ return this._state.tabRatio = e, this._emitter.notify("onViewChange"), this;
1625
+ }
1626
+ isShowHorizontalScrollbar() {
1627
+ return this._state.showHorizontalScrollbar;
1628
+ }
1629
+ setShowHorizontalScrollbar(e) {
1630
+ return this._state.showHorizontalScrollbar = e, this._emitter.notify("onViewChange"), this;
1631
+ }
1632
+ isShowVerticalScrollbar() {
1633
+ return this._state.showVerticalScrollbar;
1634
+ }
1635
+ setShowVerticalScrollbar(e) {
1636
+ return this._state.showVerticalScrollbar = e, this._emitter.notify("onViewChange"), this;
1637
+ }
1638
+ isShowStatusBar() {
1639
+ return this._state.showStatusBar;
1640
+ }
1641
+ setShowStatusBar(e) {
1642
+ return this._state.showStatusBar = e, this._emitter.notify("onViewChange"), this;
1643
+ }
1644
+ getActiveSheetId() {
1645
+ return this._state.activeSheetId;
1646
+ }
1647
+ setActiveSheetId(e) {
1648
+ let t = this._state, n = t.activeSheetId;
1649
+ return t.activeSheetId = e, n !== e && this._emitter.notify("onViewChange"), this;
1650
+ }
1651
+ getFirstTab() {
1652
+ return this._state.firstTab;
1653
+ }
1654
+ setFirstTab(e) {
1655
+ return this._set("firstTab", Math.max(0, Math.trunc(e)));
1656
+ }
1657
+ getWindowBounds() {
1658
+ return this._state.windowBounds;
1659
+ }
1660
+ setWindowBounds(e) {
1661
+ return this._set("windowBounds", e ? Object.freeze({ ...e }) : null);
1662
+ }
1663
+ isMinimized() {
1664
+ return this._state.minimized;
1665
+ }
1666
+ setMinimized(e) {
1667
+ return this._set("minimized", e);
1668
+ }
1669
+ getVisibility() {
1670
+ return this._state.visibility;
1671
+ }
1672
+ setVisibility(e) {
1673
+ return this._set("visibility", e);
1674
+ }
1675
+ isAutoFilterDateGrouping() {
1676
+ return this._state.autoFilterDateGrouping;
1677
+ }
1678
+ setAutoFilterDateGrouping(e) {
1679
+ return this._set("autoFilterDateGrouping", e);
1680
+ }
1681
+ _set(e, t) {
1682
+ return this._state[e] === t || (this._state[e] = t, this._emitter.notify("onViewChange")), this;
1683
+ }
1684
+ addListeners(e, t) {
1685
+ return this._emitter.addListeners(e, t);
1686
+ }
1687
+ toJSON() {
1688
+ let e = {}, t = Object.keys(this._state), n = t.length;
1689
+ for (let r = 0; r < n; r++) {
1690
+ let n = t[r], i = this._state[n];
1691
+ i != null && i !== J[n] && (e[n] = i);
1692
+ }
1693
+ return Object.keys(e).length === 0 && (e = null), e;
1694
+ }
1695
+ _fromJSON(e, t = !0) {
1696
+ let n = e || {};
1697
+ this.update(n, t);
1698
+ }
1699
+ update(e, t = !0) {
1700
+ this._state = {
1701
+ ...J,
1702
+ ...this._state,
1703
+ ...e
1704
+ }, t && this._emitter.notify("onViewChange");
1705
+ }
1706
+ get [Symbol.toStringTag]() {
1707
+ return "[WorkbookView]";
1708
+ }
1709
+ toString() {
1710
+ let e = this.toJSON();
1711
+ return e ? JSON.stringify(e) : "DefaultWorkbookView";
1712
+ }
1713
+ get isIWorkbookView() {
1714
+ return !0;
1715
+ }
1716
+ }, cn = Object.freeze({
1717
+ structure: !1,
1718
+ windows: !1,
1719
+ revision: !0,
1720
+ password: null,
1721
+ revisionsPassword: null
1722
+ }), ln = class extends De {
1723
+ isWindowsAllowed() {
1724
+ return this._isPropertyAllowed("windows");
1725
+ }
1726
+ isRevisionAllowed() {
1727
+ return this.isLocked() && this._properties?.revision === void 0 ? !this._isReadOnly : this._isPropertyAllowed("revision");
1728
+ }
1729
+ isStructureAllowed() {
1730
+ return this._isPropertyAllowed("structure");
1731
+ }
1732
+ _getAllowedKey() {
1733
+ return "workbook";
1734
+ }
1735
+ _fromJSON(e) {
1736
+ this._properties = e;
1737
+ }
1738
+ _toJSON(e) {
1739
+ let t = this._properties;
1740
+ if (t) {
1741
+ let n = Object.keys(t), r = n.length;
1742
+ for (let i = 0; i < r; i++) {
1743
+ let r = n[i], a = t[r];
1744
+ a != null && a !== cn[r] && (e[r] = a);
1745
+ }
1746
+ }
1747
+ return super._toJSON(e);
1748
+ }
1749
+ get [Symbol.toStringTag]() {
1750
+ return "[WorkbookProtection]";
1751
+ }
1752
+ get isIWorkbookProtection() {
1753
+ return !0;
1754
+ }
1755
+ };
1756
+ (K ||= {}).Type = {
1757
+ Number: "number",
1758
+ Boolean: "boolean",
1759
+ Date: "date",
1760
+ String: "string",
1761
+ Float: "float"
1762
+ };
1763
+ var un = (e) => {
1764
+ if (typeof e == "string") return {
1765
+ type: K.Type.String,
1766
+ value: e
1767
+ };
1768
+ if (typeof e == "boolean") return {
1769
+ type: K.Type.Boolean,
1770
+ value: e
1771
+ };
1772
+ if (typeof e == "number") {
1773
+ if (!Number.isFinite(e)) throw Error("A custom property value must be a finite number.");
1774
+ return {
1775
+ type: Number.isInteger(e) && e >= -2147483648 && e <= 2147483647 ? K.Type.Number : K.Type.Float,
1776
+ value: e
1777
+ };
1778
+ }
1779
+ if (e instanceof Date) {
1780
+ if (isNaN(e.getTime())) throw Error("A custom property value must be a valid date.");
1781
+ return {
1782
+ type: K.Type.Date,
1783
+ value: e.toISOString()
1784
+ };
1785
+ }
1786
+ throw Error("A custom property value must be a string, number, boolean or Date.");
1787
+ }, dn = class {
1788
+ constructor(e, t) {
1789
+ this._json = e, this._owner = t;
1790
+ }
1791
+ getKey() {
1792
+ return this._json.key;
1793
+ }
1794
+ getType() {
1795
+ return this._json.type;
1796
+ }
1797
+ getLinkTarget() {
1798
+ return this._json.linkTarget ?? null;
1799
+ }
1800
+ getValue() {
1801
+ let { type: e, value: t } = this._json;
1802
+ return e === K.Type.Date ? new Date(t) : t;
1803
+ }
1804
+ setValue(e) {
1805
+ this._owner._assertCustomEditable(this), this._json = {
1806
+ ...this._json,
1807
+ ...un(e)
1808
+ };
1809
+ }
1810
+ delete() {
1811
+ this._owner._removeCustom(this);
1812
+ }
1813
+ toJSON() {
1814
+ return { ...this._json };
1815
+ }
1816
+ }, fn = class {
1817
+ constructor(e) {
1818
+ this._json = {}, this._custom = [], this._assertOpen = e;
1819
+ }
1820
+ _text(e) {
1821
+ return this._json[e] ?? null;
1822
+ }
1823
+ _setText(e, t) {
1824
+ return this._assertOpen(), t == null || t === "" ? delete this._json[e] : this._json[e] = t, this;
1825
+ }
1826
+ getAuthor() {
1827
+ return this._text("author");
1828
+ }
1829
+ setAuthor(e) {
1830
+ return this._setText("author", e);
1831
+ }
1832
+ getCategory() {
1833
+ return this._text("category");
1834
+ }
1835
+ setCategory(e) {
1836
+ return this._setText("category", e);
1837
+ }
1838
+ getComments() {
1839
+ return this._text("comments");
1840
+ }
1841
+ setComments(e) {
1842
+ return this._setText("comments", e);
1843
+ }
1844
+ getCompany() {
1845
+ return this._text("company");
1846
+ }
1847
+ setCompany(e) {
1848
+ return this._setText("company", e);
1849
+ }
1850
+ getContentStatus() {
1851
+ return this._text("contentStatus");
1852
+ }
1853
+ setContentStatus(e) {
1854
+ return this._setText("contentStatus", e);
1855
+ }
1856
+ getCreationDate() {
1857
+ let e = this._json.creationDate;
1858
+ if (!e) return null;
1859
+ let t = new Date(e);
1860
+ return isNaN(t.getTime()) ? null : t;
1861
+ }
1862
+ getKeywords() {
1863
+ return this._text("keywords");
1864
+ }
1865
+ setKeywords(e) {
1866
+ return this._setText("keywords", e);
1867
+ }
1868
+ getLastAuthor() {
1869
+ return this._json.lastAuthor ?? null;
1870
+ }
1871
+ getManager() {
1872
+ return this._text("manager");
1873
+ }
1874
+ setManager(e) {
1875
+ return this._setText("manager", e);
1876
+ }
1877
+ getRevisionNumber() {
1878
+ return this._json.revisionNumber ?? null;
1879
+ }
1880
+ setRevisionNumber(e) {
1881
+ return this._assertOpen(), e != null && Number.isFinite(e) ? this._json.revisionNumber = e : delete this._json.revisionNumber, this;
1882
+ }
1883
+ getSubject() {
1884
+ return this._text("subject");
1885
+ }
1886
+ setSubject(e) {
1887
+ return this._setText("subject", e);
1888
+ }
1889
+ getTitle() {
1890
+ return this._text("title");
1891
+ }
1892
+ setTitle(e) {
1893
+ return this._setText("title", e);
1894
+ }
1895
+ getCustom() {
1896
+ return this._custom.slice();
1897
+ }
1898
+ getCustomProperty(e) {
1899
+ let t = e.toLowerCase();
1900
+ return this._custom.find((e) => e.getKey().toLowerCase() === t);
1901
+ }
1902
+ addCustomProperty(e, t) {
1903
+ if (this._assertOpen(), typeof e != "string" || e === "") throw Error("A custom property needs a name.");
1904
+ let n = this.getCustomProperty(e);
1905
+ if (n) return n.setValue(t), n;
1906
+ let r = new dn({
1907
+ key: e,
1908
+ ...un(t)
1909
+ }, this);
1910
+ return this._custom.push(r), r;
1911
+ }
1912
+ deleteAllCustomProperties() {
1913
+ this._assertOpen(), this._custom = [];
1914
+ }
1915
+ _assertCustomEditable(e) {
1916
+ if (this._assertOpen(), !this._custom.includes(e)) throw Error("The custom property has been deleted.");
1917
+ }
1918
+ _removeCustom(e) {
1919
+ this._assertCustomEditable(e), this._custom = this._custom.filter((t) => t !== e);
1920
+ }
1921
+ fromJSON(e) {
1922
+ let { custom: t, ...n } = e ?? {};
1923
+ this._json = n, this._custom = (t ?? []).map((e) => new dn({ ...e }, this));
1924
+ }
1925
+ toJSON() {
1926
+ let e = { ...this._json };
1927
+ return this._custom.length > 0 && (e.custom = this._custom.map((e) => e.toJSON())), e;
1928
+ }
1929
+ };
1930
+ function Y(e) {
1931
+ return l("error.workbook.invalidSheetKey", { key: e });
1932
+ }
1933
+ function pn(e) {
1934
+ return l("error.workbook.sheetNameNotFound", { sheetName: e });
1935
+ }
1936
+ function X(e, t) {
1937
+ return l(t === "chart" ? "error.workbook.sheetIsChart" : t === "macro" ? "error.workbook.sheetIsMacro" : "error.workbook.sheetIsDialog", { sheetName: e });
1938
+ }
1939
+ function mn(e, t) {
1940
+ return t === "chart" ? l("error.workbook.selectedIsChart", { sheetName: e }) : t === "macro" ? l("error.workbook.selectedIsMacro", { sheetName: e }) : t === "dialog" ? l("error.workbook.selectedIsDialog", { sheetName: e }) : l("error.workbook.noWorksheet");
1941
+ }
1942
+ var hn, gn = class extends we {
1943
+ constructor(e, t, n, r) {
1944
+ super(), this._add = e, this._get = t, this._addListeners = n, this._getSelected = r;
1945
+ }
1946
+ getActive() {
1947
+ return this._getSelected();
1948
+ }
1949
+ getAt(e) {
1950
+ return this.getItems()[e] ?? null;
1951
+ }
1952
+ getByIndex(e) {
1953
+ return this.getItems()[e] ?? null;
1954
+ }
1955
+ getAll() {
1956
+ return this.getItems();
1957
+ }
1958
+ add(e) {
1959
+ return this._add(e);
1960
+ }
1961
+ _getItems(e) {
1962
+ return this._get(e?.name, e?.visibility);
1963
+ }
1964
+ getByName(e) {
1965
+ return this._get(e)?.[0] ?? null;
1966
+ }
1967
+ addListeners(e, t) {
1968
+ return this._addListeners(e, t);
1969
+ }
1970
+ get isIWorksheetCollection() {
1971
+ return !0;
1972
+ }
1973
+ }, Z = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), _n = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
1974
+ function vn(e) {
1975
+ let t = l(u("workbook.defaultSheetName"), { n: e + 1 });
1976
+ return t === "workbook.defaultSheetName" ? `Sheet${e + 1}` : t;
1977
+ }
1978
+ function yn(e, t) {
1979
+ return {
1980
+ ...Ce,
1981
+ getWorksheet: () => null,
1982
+ toString: () => L(e, t)
1983
+ };
1984
+ }
1985
+ function bn(e, t = !1) {
1986
+ if (!e) throw Error(l("error.workbook.sheetNameBlank"));
1987
+ if (Z.test(e)) {
1988
+ if (!t) throw Error(function(e) {
1989
+ return e ? l("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : l("error.workbook.sheetNameInvalidChars");
1990
+ }(e));
1991
+ e = e.replace(Z, "");
1992
+ }
1993
+ if (e.length === 0) throw Error(l("error.workbook.sheetNameBlank"));
1994
+ let n = e.length;
1995
+ if (n > 31) {
1996
+ if (!t) throw Error(l("error.workbook.sheetNameTooLong"));
1997
+ e = e.substring(0, 31);
1998
+ }
1999
+ if (e.charAt(0) === "'" || e.charAt(n - 1) === "'") {
2000
+ if (!t) throw Error(l("error.workbook.sheetNameQuotes"));
2001
+ e = e.replace(/^'|'$/g, "");
2002
+ }
2003
+ return e;
2004
+ }
2005
+ var xn, Sn, Cn, wn = "workbook.activeSheet", Q = class e extends Je {
2006
+ constructor(e, t, n, r) {
2007
+ super(e, t, r), this._workbook = n;
2008
+ }
2009
+ getSource() {
2010
+ return this._workbook;
2011
+ }
2012
+ _createRanges(t, n) {
2013
+ let r = this._options;
2014
+ return n && (r = {
2015
+ ...this._options,
2016
+ getOptions: I(this._options?.getOptions, n)
2017
+ }), new e(t, this._internal, this._workbook, r);
2018
+ }
2019
+ _createRange(e, t) {
2020
+ let n = e ? { ...e } : null, r = this._workbook, i = n ? r._getSheetRef(n.scope, j.Visibility.VeryHidden) : null;
2021
+ if (i && !i.sheet.isIWorksheet) throw new s(X(i.name, i.sheet.getKind()));
2022
+ if (!i) {
2023
+ let e = r._anchorWorksheet();
2024
+ return delete n?.scope, yn(n, n ? {
2025
+ scope: Ne,
2026
+ ...e.getEntireRange().getCoords()
2027
+ } : null);
2028
+ }
2029
+ let a = this._options;
2030
+ return t && (a = {
2031
+ ...this._options,
2032
+ getOptions: I(this._options.getOptions, t)
2033
+ }), new Tn(e, z(i.sheet), this._workbook, a);
2034
+ }
2035
+ async select(e) {
2036
+ let t = [], n = null, r = this.getCoords();
2037
+ for (let e = 0; e < r.length; e++) {
2038
+ let i = r[e];
2039
+ i && (n ||= i.scope, i && i.scope === n && t.push(i));
2040
+ }
2041
+ n ||= this._workbook.getWorksheet().getName();
2042
+ let i = this._workbook.getWorksheets().getByName(n);
2043
+ if (!i) return;
2044
+ let a = await i.getRanges(t).select(e), o = this._workbook._rangesAddressToCoords(a.getCoords());
2045
+ return this._createRanges(o);
2046
+ }
2047
+ addListener(e, t) {
2048
+ if (!this.getCoords()) return () => {};
2049
+ let n = this._workbook._sheetToWBEvent(e);
2050
+ return super.addListener(n, t);
2051
+ }
2052
+ get [Symbol.toStringTag]() {
2053
+ return "[WorkbookRanges]";
2054
+ }
2055
+ getAddress(e) {
2056
+ let t = this._internal.getSheet(), n = t.getEntireRange().getCoords();
2057
+ return lt(this.getCoords(), {
2058
+ ...n,
2059
+ scope: t.getName()
2060
+ }, L, nt, e);
2061
+ }
2062
+ toString() {
2063
+ return this.getAddress();
2064
+ }
2065
+ }, Tn = class e extends ut {
2066
+ constructor(e, t, n, r) {
2067
+ super(e, t, r), this._workbook = n;
2068
+ }
2069
+ _createRanges(e, t) {
2070
+ let n = this._options;
2071
+ return t && (n = {
2072
+ ...this._options,
2073
+ getOptions: I(this._options?.getOptions, t)
2074
+ }), new Q(e, this._internal, this._workbook, n);
2075
+ }
2076
+ _createRange(t, n) {
2077
+ let r = this._internal;
2078
+ if (!t) return Te(r.getSheet(), r.getSheet().getEntireCoords());
2079
+ if (r.validateCoords(t), r.getSheet().isClosed()) return Te(null, r.getSheet().getEntireCoords(), t);
2080
+ let i = this._options;
2081
+ return n && (i = {
2082
+ ...this._options,
2083
+ getOptions: I(this._options?.getOptions, n)
2084
+ }), new e(t, this._internal, this._workbook, i);
2085
+ }
2086
+ addListener(e, t) {
2087
+ if (!this.getCoords()) return () => {};
2088
+ let n = this._workbook._sheetToWBEvent(e);
2089
+ return super.addListener(n, t);
2090
+ }
2091
+ get [Symbol.toStringTag]() {
2092
+ return "[WorkbookRange]";
2093
+ }
2094
+ getAddress(e) {
2095
+ let t = this._internal.getSheet(), n = t?.getEntireRange().getCoords() ?? null;
2096
+ return L(this.getCoords(), {
2097
+ ...n,
2098
+ scope: t.getName()
2099
+ });
2100
+ }
2101
+ toString() {
2102
+ return this.getAddress();
2103
+ }
2104
+ }, En = (e) => !!e && typeof e == "object" && typeof e.getOrigin == "function", Dn = class {
2105
+ constructor(e) {
2106
+ 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 ge(() => {
2107
+ let e = [];
2108
+ for (let t of this.getWorksheets()) e.push(...t.getPivotTables());
2109
+ return e;
2110
+ }), this._people = new Jt(), this._commentCollection = new Xe(null, (e, t, n) => {
2111
+ let r = [];
2112
+ for (let i of this.getWorksheets()) r.push(...i.getComments().getItems(e ? {
2113
+ address: e,
2114
+ ignoreHidden: t,
2115
+ fullyContained: n
2116
+ } : {
2117
+ ignoreHidden: t,
2118
+ fullyContained: n
2119
+ }));
2120
+ return r;
2121
+ }, (e, t) => this.addListeners({ onSheetsChange: e.onCollectionChange ? () => {
2122
+ e.onCollectionChange(this._commentCollection);
2123
+ } : void 0 }, t)), this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._documentProperties = new fn(() => {
2124
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2125
+ }), this._locale = null, this._localeOverrides = null, this._startModules = /* @__PURE__ */ new WeakSet();
2126
+ let t = typeof e == "string" ? { origin: e } : { ...e }, r = t.origin;
2127
+ this._ownOriginProvider = !En(r), this._originProvider = En(r) ? r : new yt(typeof r == "string" ? new B(null, { name: r }) : r ?? new B(null)), delete t.origin, this._bindOrigin(this._originProvider.getOrigin()), this._listenerOriginProvider = this._originProvider.addListeners({ onOriginChange: () => this._onOriginChange() });
2128
+ let i = t.json;
2129
+ delete t.json, this._transactions = t.transactions ?? new v(), this._id = this._transactions.create(), this._ownTransactions = !t.transactions, this._emitter = new _(this, this._transactions), this._runtime = t.runtime ?? new Ge("Workbook Runtime", {
2130
+ isDate1904: () => this._isDate1904,
2131
+ getNow: () => this._transactions.getCurrentCommit().getTimestamp(),
2132
+ getLocale: () => this._locale ?? qe() ?? he(),
2133
+ getLocaleOverrides: () => this._localeOverrides
2134
+ }), this._listenerLanguage = c.addChangeListener(() => {
2135
+ this._closed || this._notifyAllChange();
2136
+ });
2137
+ let a = this, o = this._beginCommit({ description: u(i ? "op.openWorkbook" : "op.newWorkbook") });
2138
+ try {
2139
+ this._strings = t.strings ?? new de(), this._ownStrings = !t.strings, this._richValues = t.richData ?? new Oe(), this._resources = t.resources ?? new pe(), this._ownResources = !t.resources, this._fetch = new tn(this._resources, t.fetcher ?? new $t()), this._createSheetName = t.createSheetNameCallback ?? vn;
2140
+ let e = t.createWorksheetCallback;
2141
+ e ||= (e) => new F(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, i, o, s, c) => {
2142
+ let l = null, u = {
2143
+ runtime: a._runtime,
2144
+ readonly: a._options.readonly ?? !1,
2145
+ disableLoadAutoFit: a._options.disableLoadAutoFit ?? !1,
2146
+ opener: a._options.opener,
2147
+ transactions: a._transactions,
2148
+ styles: a._styles,
2149
+ strings: a._strings,
2150
+ richData: a._richValues,
2151
+ resources: a._resources,
2152
+ names: a._names,
2153
+ workbook: a,
2154
+ calculation: a._calculation,
2155
+ resolveRange: (e) => a._options.resolveRange?.(e) ?? a.getRange(e),
2156
+ container: {
2157
+ beforeFromJSON: (e) => {
2158
+ l = e, a._addSheetRef({
2159
+ name: n,
2160
+ id: t,
2161
+ visibility: r ?? j.Visibility.Visible,
2162
+ sheetId: o,
2163
+ sheet: e
2164
+ }, i);
2165
+ },
2166
+ getName: () => {
2167
+ let e = a._getSheetRef(l);
2168
+ return e ? e.name : n;
2169
+ },
2170
+ setName: (e, t) => {
2171
+ a._getSheetRef(l) && a._setSheetName(l, e, t);
2172
+ },
2173
+ setNameChangeCallback: (e) => {
2174
+ a._sheetOnNameChange.set(t, e);
2175
+ },
2176
+ getVisibility: () => {
2177
+ let e = a._getSheetRef(l);
2178
+ return e ? e.visibility : j.Visibility.Visible;
2179
+ },
2180
+ setVisibility: (e, t) => {
2181
+ a._setSheetVisibility(l, e, t);
2182
+ },
2183
+ setVisibilityCallback: (e) => {
2184
+ a._sheetOnVisibilityChange.set(t, e);
2185
+ },
2186
+ duplicate: () => a._duplicateSheet(l),
2187
+ getIndex: () => {
2188
+ let e = a._getSheetRef(l);
2189
+ return e ? a._getOffsetForId(e.id, a._getSheetRefs(j.Visibility.VeryHidden)) : i;
2190
+ },
2191
+ setIndex: (e, t) => {
2192
+ let n = a._getSheetRef(l, j.Visibility.VeryHidden);
2193
+ return !!n && (a._moveSheet(n, e, t), !0);
2194
+ },
2195
+ setIndexCallback: (e) => {
2196
+ a._sheetOnIndexChange.set(t, e);
2197
+ },
2198
+ requestSelect: () => a._requestSelect(l)
2199
+ }
2200
+ };
2201
+ return s && (u.json = s), c !== void 0 && (u.uid = () => c), l = e(u, n, i, r), l;
2202
+ }, this._namedTableSource = new Qe({
2203
+ getSheets: () => a._sheets ? a.getWorksheets().getItems() : n.EmptyArray,
2204
+ addSheetsListener: (e, t) => a.addListeners({ onSheetsChange: e }, t)
2205
+ }), this._names = t.names ?? new me({
2206
+ addressToRanges: (e) => a.getRanges(e),
2207
+ getCurrentScope: () => a.getSelectedWorksheet()?.getName() ?? null,
2208
+ isReadOnly: () => (a._options.readonly ?? !1) || a._isStructureProtected(),
2209
+ transactions: a._transactions,
2210
+ getSources: () => a._calculation ? [a._calculation.getNamedFormulas(), a._namedTableSource] : n.EmptyArray
2211
+ }), this._ownNames = !t.names, this._calculation = t.calculation ?? new je({
2212
+ runtime: a._runtime,
2213
+ functions: t.functions,
2214
+ json: i?.calc,
2215
+ isNamesReadOnly: () => a._isStructureProtected(),
2216
+ getActiveCell: () => {
2217
+ let e = a.getSelectedWorksheet(), t = e?.getSelectedRange()?.getCoords();
2218
+ return e && t ? {
2219
+ rowIndex: t.rowStart,
2220
+ colIndex: t.colStart,
2221
+ scope: e.getId()
2222
+ } : null;
2223
+ },
2224
+ getRange: a.getRange.bind(a),
2225
+ getRanges: a.getRanges.bind(a),
2226
+ createGraphRanges: (e, t) => a._createGraphRanges(e, t),
2227
+ getSheetIndex: (e) => {
2228
+ if (e === void 0) {
2229
+ let e = a.getSelectedSheet();
2230
+ return e ? this._getSheetRefs(j.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
2231
+ }
2232
+ let t = this._getSheetRefs(j.Visibility.VeryHidden);
2233
+ e = e.toLowerCase();
2234
+ let n = t.length;
2235
+ for (let r = 0; r < n; r++) if (t[r].name.toLowerCase() === e) return r;
2236
+ try {
2237
+ On.address = e;
2238
+ let t = this._names.getItems(On);
2239
+ if (!t || t.length === 0) return -1;
2240
+ let n = t[0].getRanges?.()?.getCoords()?.[0]?.scope;
2241
+ if (!n) return -1;
2242
+ let r = this._getSheetRefs(j.Visibility.VeryHidden);
2243
+ n = n.toLowerCase();
2244
+ let i = r.length;
2245
+ for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === n) return e;
2246
+ } catch {
2247
+ return -1;
2248
+ }
2249
+ return -1;
2250
+ },
2251
+ getSheetCount: () => a._getSheetRefs(j.Visibility.VeryHidden).length,
2252
+ externalBooks: i?.externalBooks,
2253
+ externalBookResolver: t.externalBookResolver,
2254
+ namedCollection: a._names,
2255
+ strings: a._strings,
2256
+ get resources() {
2257
+ return a._resources;
2258
+ },
2259
+ fetch: (e, t) => a._fetch.fetch(e, t),
2260
+ startFunctions: () => a._startFunctions(),
2261
+ transactions: a._transactions,
2262
+ names: i?.names
2263
+ }), this._ownCalculation = !t.calculation, this._scripts = this._createScripts(i?.modules), this._ownNames = !t.names, this._options = Object.freeze({ ...t });
2264
+ let r = i?.sheets?.length ? i.sheets.map((e) => e.name) : [this._createSheetName(0)], s = r.map((e) => e + "-" + n.uuidV4()), c = (e) => {
2265
+ let t = i?.sheets?.[e]?.kind;
2266
+ return !!t && t !== j.Kind.Worksheet;
2267
+ };
2268
+ this._calculation._setSheets(r.map((e, t) => c(t) ? [
2269
+ s[t],
2270
+ e,
2271
+ !0
2272
+ ] : [s[t], e]));
2273
+ let l = t.calcOnLoad ?? "auto", u = !1, d = (async () => {
2274
+ try {
2275
+ if (this._ownCalculation && l !== "none" && (l === "full" || l === "auto" && !0 === i?.calc?.fullCalcOnLoad ? await this._calculation.calculate({ full: !0 }) : await this._calculation.start(), this._closed)) return;
2276
+ await this._scripts.start();
2277
+ } finally {
2278
+ u = !0, this._starting = null;
2279
+ }
2280
+ })();
2281
+ u || (this._starting = d), this._starting?.catch(() => {}), i ? this._fromJSON(i, s) : (this._initState(), this._addSheet(!1, r[0], null, s[0])), this._sheets = new gn((e) => a._addSheetOptions(e), (e, t) => {
2282
+ if (e) {
2283
+ let r = this._getSheetRef(e, t);
2284
+ return r && $(r) ? [r.sheet] : n.EmptyArray;
2285
+ }
2286
+ return this._getWorksheets(t);
2287
+ }, (e, t) => {
2288
+ let n = e.onCollectionChange, r = e.onInvalidated;
2289
+ return a._emitter.addListeners({
2290
+ onSheetsChange: n ? () => {
2291
+ n(a._sheets);
2292
+ } : void 0,
2293
+ onInvalidated: r ? () => {
2294
+ r(a._sheets);
2295
+ } : void 0
2296
+ }, t);
2297
+ }, () => a.getSelectedWorksheet()), this._ownCalculation && (t.calcOnLoad ?? "auto") !== "none" && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), this._ownTransactions ? o.amend() : o.commit();
2298
+ } catch (e) {
2299
+ throw o.rollback(), e;
2300
+ }
2301
+ this._initializing = !1;
2302
+ }
2303
+ _initState() {
2304
+ let e = this._getSheetRefs();
2305
+ for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
2306
+ let t = this._options;
2307
+ this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new et().getDefaultTheme(), this._styles = t?.styles ?? new Re(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new sn()), this._listenerProtection?.(), this._protection = new ln(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
2308
+ n._emitter.notify("onProtectionChange");
2309
+ } });
2310
+ let n = this;
2311
+ this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
2312
+ async onAfterStateChange(e, t, r, i, a) {
2313
+ let o = n._view, s = a?.[wn], c = r ? s?.before : s?.after, l = s?.viewId === o.getId() && c != null, u = l ? c : o.getActiveSheetId(), d = l && t.getId() === n._lastTransactionUUID ? n._getSheetRef({ id: u }) : null;
2314
+ d ? await d.sheet.select() : n._resyncActiveSheet(u, e), n._lastTransactionUUID = t.getId(), (r || i) && n._emitter.notify("onSheetsChange"), n._emitter.notify("onSelectedSheetChange"), n._emitter.notify("onViewChange");
2315
+ },
2316
+ onRestoreOrRevert() {
2317
+ n._ownCalculation, n._emitter.notify("onInvalidated");
2318
+ }
2319
+ });
2320
+ let r = this._getState();
2321
+ r?.listenersSheets && (r?.listenersSheets.forEach((e) => {
2322
+ e();
2323
+ }), r?.listenersSheets.clear()), this._updateState({
2324
+ sheetRefsAll: [],
2325
+ sheetRefsVisibleAndHidden: [],
2326
+ sheetRefsVisible: [],
2327
+ refsById: /* @__PURE__ */ new Map(),
2328
+ sheetsById: /* @__PURE__ */ new Map(),
2329
+ refsByLowerCaseName: /* @__PURE__ */ new Map(),
2330
+ sheetsByLowerCaseName: /* @__PURE__ */ new Map(),
2331
+ refsByInstance: /* @__PURE__ */ new Map(),
2332
+ lastId: -1,
2333
+ sheetsCreated: /* @__PURE__ */ new Set(),
2334
+ listenersSheets: /* @__PURE__ */ new Map()
2335
+ });
2336
+ }
2337
+ getId() {
2338
+ return this._id;
2339
+ }
2340
+ getVersionId() {
2341
+ return this._transactions.getVersionId(this._id);
2342
+ }
2343
+ getName() {
2344
+ return this._closed ? null : this._origin.getName();
2345
+ }
2346
+ getOrigin() {
2347
+ return this._originProvider.getOrigin();
2348
+ }
2349
+ _onOriginChange() {
2350
+ if (this._closed) return;
2351
+ let e = this._originProvider.getOrigin();
2352
+ if (e === this._origin) return;
2353
+ this._listenerOrigin?.();
2354
+ let t = this._lastOriginName;
2355
+ this._bindOrigin(e), this._emitter.notify("onOriginChange"), this._lastOriginName !== t && this._emitter.notify("onNameChange");
2356
+ }
2357
+ _bindOrigin(e) {
2358
+ this._origin = e, this._lastOriginName = e.getName(), this._listenerOrigin = e.addListeners({ onChange: () => {
2359
+ if (this._closed) return;
2360
+ let t = e.getName();
2361
+ t !== this._lastOriginName && (this._lastOriginName = t, this._emitter.notify("onNameChange"));
2362
+ } });
2363
+ }
2364
+ getView() {
2365
+ return this._view;
2366
+ }
2367
+ setView(e) {
2368
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2369
+ if (!e) throw new s(l("error.sheet.emptyView"));
2370
+ this._listenerWorkbookView?.();
2371
+ let t = this, n = -1;
2372
+ return this._listenerWorkbookView = e.addListeners({ onViewChange: (e) => {
2373
+ let r = t._getState(), i = this._view.getActiveSheetId(), a = r.sheetRefsVisible, o = this._getOffsetForId(i, a);
2374
+ this._activeSheetOffset = o, t._emitter.notify("onViewChange"), n !== i && (t._emitter.notify("onSelectionChange"), t._emitter.notify("onSelectedSheetChange")), n = i;
2375
+ } }), this._view = e, t._emitter.notify("onViewChange"), this;
2376
+ }
2377
+ getRuntime() {
2378
+ return this._runtime;
2379
+ }
2380
+ setDate1904(e) {
2381
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2382
+ return this._isDate1904 === e || (this._isDate1904 = e, this._emitter.notify("onRegionalChange")), this;
2383
+ }
2384
+ getLocale() {
2385
+ return this._runtime.getLocale();
2386
+ }
2387
+ getPinnedLocale() {
2388
+ return this._locale;
2389
+ }
2390
+ setLocale(e) {
2391
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2392
+ if (e) try {
2393
+ new Intl.Locale(e);
2394
+ } catch {
2395
+ throw Error(l("error.workbook.invalidLocale", { locale: e }));
2396
+ }
2397
+ return this._locale === e || (this._locale = e, this._emitter.notify("onRegionalChange")), this;
2398
+ }
2399
+ getLocaleOverrides() {
2400
+ return this._localeOverrides;
2401
+ }
2402
+ setLocaleOverrides(e) {
2403
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2404
+ let t = e && Object.keys(e).length > 0 ? e : null;
2405
+ return this._localeOverrides = t, this._emitter.notify("onRegionalChange"), this;
2406
+ }
2407
+ getStyles() {
2408
+ return this._styles;
2409
+ }
2410
+ getResources() {
2411
+ return this._resources;
2412
+ }
2413
+ getFetcher() {
2414
+ return this._fetch.getFetcher();
2415
+ }
2416
+ fetch(e, t) {
2417
+ return this._fetch.fetch(e, t);
2418
+ }
2419
+ getTransactions() {
2420
+ return this._transactions;
2421
+ }
2422
+ getChanges(e) {
2423
+ let t = this._transactions, [n, r] = t.getLog(e ?? t.getCurrentCommit(!1).getId(), 2), i = [], a = this.getWorksheets().getItems({ visibility: j.Visibility.VeryHidden });
2424
+ for (let e = 0; e < a.length; e++) {
2425
+ let t = a[e];
2426
+ t instanceof F && i.push(...t._changeEventsOf(n, r ?? null));
2427
+ }
2428
+ return i;
2429
+ }
2430
+ getStrings() {
2431
+ return this._strings;
2432
+ }
2433
+ getExternalBooks() {
2434
+ return this._calculation.getExternalBooks();
2435
+ }
2436
+ getUpdateLinks() {
2437
+ return this._updateLinks;
2438
+ }
2439
+ setUpdateLinks(e) {
2440
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2441
+ return this._updateLinks = e, this;
2442
+ }
2443
+ getPivotTables() {
2444
+ return this._pivotTableCollection;
2445
+ }
2446
+ getComments() {
2447
+ return this._commentCollection;
2448
+ }
2449
+ getPeople() {
2450
+ return this._people;
2451
+ }
2452
+ getTheme() {
2453
+ return this._theme;
2454
+ }
2455
+ setTheme(e) {
2456
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2457
+ if (!e) throw new s(l("error.workbook.notSetValue"));
2458
+ let t = this._theme;
2459
+ return this._theme = e, this.getStyles().setTheme(e), this._emitter.notify("onThemeChange"), t;
2460
+ }
2461
+ getSelectedSheetIndex() {
2462
+ return this._activeSheetOffset;
2463
+ }
2464
+ getSelectedSheet() {
2465
+ let e = this._getSheetRef(this.getSelectedSheetIndex());
2466
+ return e ? e.sheet : null;
2467
+ }
2468
+ getSelectedWorksheet() {
2469
+ let e = this._getSheetRef(this.getSelectedSheetIndex());
2470
+ return e && $(e) ? e.sheet : null;
2471
+ }
2472
+ getActiveSheet() {
2473
+ return this.getSelectedWorksheet();
2474
+ }
2475
+ getActiveWorksheet() {
2476
+ return this.getSelectedWorksheet();
2477
+ }
2478
+ getSheets(e) {
2479
+ let t = this._getSheetRefs(e?.visibility ?? j.Visibility.Visible), n = Array(t.length);
2480
+ for (let e = 0; e < t.length; e++) n[e] = t[e].sheet;
2481
+ return n;
2482
+ }
2483
+ getSheet(e) {
2484
+ if (e === void 0) return this.getSelectedSheet();
2485
+ if (!e) throw Error(l("error.workbook.sheetNameNotProvided"));
2486
+ let t = this._getSheetRef(e);
2487
+ if (!t) throw new d(pn(e));
2488
+ return t.sheet;
2489
+ }
2490
+ getWorksheet(e, t = j.Visibility.Visible) {
2491
+ if (typeof e == "number") return this.getWorksheetAt(e, t);
2492
+ if (e === void 0) return this._requireSelectedWorksheet();
2493
+ if (!e) throw Error(l("error.workbook.sheetNameNotProvided"));
2494
+ let n = this._getSheetRef(e, t);
2495
+ if (!n) throw new d(pn(e));
2496
+ if (!$(n)) throw new d(X(n.name, n.sheet.getKind()));
2497
+ return n.sheet;
2498
+ }
2499
+ getWorksheetAt(e, t = j.Visibility.Visible) {
2500
+ let n = this._getWorksheets(t)[e];
2501
+ if (!n) throw new d(function(e) {
2502
+ return l("error.workbook.sheetIndexNotFound", { index: e });
2503
+ }(e));
2504
+ return n;
2505
+ }
2506
+ _requireSelectedWorksheet() {
2507
+ let e = this.getSelectedWorksheet();
2508
+ if (e) return e;
2509
+ let t = this.getSelectedSheet();
2510
+ throw new s(mn(t?.getName() ?? "", t?.getKind() ?? j.Kind.Worksheet));
2511
+ }
2512
+ _anchorWorksheet() {
2513
+ return this.getSelectedWorksheet() || (this._getWorksheets(j.Visibility.VeryHidden)[0] ?? null);
2514
+ }
2515
+ getWorksheets() {
2516
+ return this._sheets;
2517
+ }
2518
+ addWorksheet(e) {
2519
+ return this.getWorksheets().add(e);
2520
+ }
2521
+ _getWorksheets(e = j.Visibility.Visible) {
2522
+ let t = this._getSheetRefs(e), n = [], r = t.length;
2523
+ for (let e = 0; e < r; e++) {
2524
+ let r = t[e];
2525
+ $(r) && n.push(r.sheet);
2526
+ }
2527
+ return n;
2528
+ }
2529
+ _getSheetRefs(e = j.Visibility.Visible) {
2530
+ let t = this._getState();
2531
+ return t ? e === j.Visibility.Visible ? t.sheetRefsVisible : e === j.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === j.Visibility.VeryHidden ? t.sheetRefsAll : n.EmptyArray : [];
2532
+ }
2533
+ _getSheetRef(e, t = j.Visibility.Visible) {
2534
+ let n = null;
2535
+ return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : !0 === e?.isISheet ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
2536
+ }
2537
+ _validateNewSheetName(e, t = !0) {
2538
+ if (e == null) return e;
2539
+ if (bn(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new s(l("error.workbook.nameTaken"));
2540
+ return e.substring(0, 31);
2541
+ }
2542
+ findValidSheetName(e) {
2543
+ e &&= bn(e, !0);
2544
+ try {
2545
+ return function(e, t) {
2546
+ try {
2547
+ if (t(e)) return e;
2548
+ } catch {}
2549
+ let n, r, i = _n.exec(e);
2550
+ for (i === null ? (n = e + " ", r = 1) : (n = e.substring(0, i.index), r = parseFloat(i[1])); r < 256;) {
2551
+ r++;
2552
+ let e = "(" + r + ")", i = n.substring(0, 31 - e.length) + e;
2553
+ try {
2554
+ if (t(i)) return i;
2555
+ } catch {}
2556
+ }
2557
+ throw Error(e + " is not a valid sheet name");
2558
+ }(e, (e) => this._validateNewSheetName(e));
2559
+ } catch {
2560
+ return this._nextSheetName();
2561
+ }
2562
+ }
2563
+ isValidSheetNameCharacter(e) {
2564
+ return !Z.test(e);
2565
+ }
2566
+ _isStructureProtected() {
2567
+ return !this._initializing && !this.getProtection().isStructureAllowed();
2568
+ }
2569
+ _addSheetOptions(t) {
2570
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2571
+ if (!this.getProtection().isStructureAllowed()) throw new e(l("error.workbook.protection"));
2572
+ let n, r = null;
2573
+ n = typeof t == "string" ? { name: t } : typeof t == "number" ? { index: t } : t, n = {
2574
+ ...n,
2575
+ description: n?.description ?? u("op.addSheet")
2576
+ };
2577
+ let i = this.beginCommit(n);
2578
+ try {
2579
+ let e = n?.autoSelect ?? !1;
2580
+ r = this._addSheet(!0, n.name, n.index ?? null);
2581
+ let t = this.getView().getActiveSheetId();
2582
+ if (e && this._recordActiveSheet(i, t, this._getSheetRef(r).id), i.commit({ description: l("op.addSheetNamed", { name: r.getName() }) }), !1 !== e) {
2583
+ let t = typeof e == "boolean" ? void 0 : e;
2584
+ r.select(t);
2585
+ }
2586
+ } catch (e) {
2587
+ throw i.rollback(), e;
2588
+ }
2589
+ return r;
2590
+ }
2591
+ _nextSheetName(e = null) {
2592
+ let t = e ? e.toLowerCase() : null, n = this._getState(), r = n.sheetsByLowerCaseName;
2593
+ if (e && r.has(t)) throw new s(function(e) {
2594
+ return l("error.workbook.nameDuplicate", { sheetName: e });
2595
+ }(e));
2596
+ t = (e = this._validateNewSheetName(e)) ? e.toLowerCase() : null;
2597
+ let i = n.lastId + 1;
2598
+ for (; !e;) {
2599
+ let t = this._createSheetName(i), n = t.toLowerCase();
2600
+ r.has(n) ? i++ : e = t;
2601
+ }
2602
+ return this._updateState({ lastId: i }), e;
2603
+ }
2604
+ _addSheet(e, t = null, n = null, r) {
2605
+ t = this._nextSheetName(t);
2606
+ let i = this._getState(), a = this._createSheet(i.lastId, t, j.Visibility.Visible, n, void 0, null, r);
2607
+ if (!a) throw new s(l("error.workbook.sheetNameBlank"));
2608
+ return e && (this._tellSheets(), this._emitter.notify("onSheetsChange")), a;
2609
+ }
2610
+ _createOpaqueSheet(e, t, r, i, a, o, s, c, l) {
2611
+ let u = this, d = null;
2612
+ return d = new on({
2613
+ kind: o,
2614
+ id: l ?? t + "-" + n.uuidV4(),
2615
+ part: s,
2616
+ tabColor: c,
2617
+ styles: this._styles,
2618
+ transactions: this._transactions,
2619
+ workbook: this,
2620
+ container: {
2621
+ getName: () => u._getSheetRef(d)?.name ?? t,
2622
+ setName: (e, t) => {
2623
+ u._setSheetName(d, e, t);
2624
+ },
2625
+ getVisibility: () => u._getSheetRef(d, j.Visibility.VeryHidden)?.visibility ?? j.Visibility.Visible,
2626
+ setVisibility: (e, t) => {
2627
+ u._setSheetVisibility(d, e, t);
2628
+ },
2629
+ getIndex: () => {
2630
+ let e = u._getSheetRef(d, j.Visibility.VeryHidden);
2631
+ return e ? u._getOffsetForId(e.id, u._getSheetRefs(j.Visibility.VeryHidden)) : -1;
2632
+ },
2633
+ setIndex: (e, t) => {
2634
+ let n = u._getSheetRef(d, j.Visibility.VeryHidden);
2635
+ n && u._moveSheet(n, e, t);
2636
+ },
2637
+ requestSelect: () => u._requestSelect(d),
2638
+ isAttached: () => !!u._getSheetRef(d, j.Visibility.VeryHidden)
2639
+ }
2640
+ }), this._sheetOnNameChange.set(e, () => d._notify("onNameChange")), this._sheetOnVisibilityChange.set(e, () => d._notify("onVisibilityChange")), this._sheetOnIndexChange.set(e, () => d._notify("onIndexChange")), this._addSheetRef({
2641
+ name: t,
2642
+ id: e,
2643
+ visibility: r ?? j.Visibility.Visible,
2644
+ sheetId: a,
2645
+ sheet: d
2646
+ }, i), d;
2647
+ }
2648
+ async _requestSelect(e) {
2649
+ return this._setSelectedSheet(e), await this._emitter.notify("onRequestSelect", {
2650
+ source: this,
2651
+ params: e,
2652
+ async: !0
2653
+ }), this.getSelectedSheet() === e;
2654
+ }
2655
+ _updateSheetRefStates(t) {
2656
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2657
+ if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new e(l("error.workbook.protection"));
2658
+ let n = t, r = [], i = [], a = n.length;
2659
+ for (let e = 0; e < a; e++) n[e].visibility === j.Visibility.Visible ? (r.push(n[e]), i.push(n[e])) : n[e].visibility === j.Visibility.Hidden && i.push(n[e]);
2660
+ this._updateState({
2661
+ sheetRefsAll: n,
2662
+ sheetRefsVisible: r,
2663
+ sheetRefsVisibleAndHidden: i
2664
+ });
2665
+ }
2666
+ _tellSheets() {
2667
+ if (this._isLoadingSheets) return;
2668
+ let e = this._getState().sheetRefsAll;
2669
+ this._calculation._setSheets(e.map((e) => $(e) ? [e.sheet.getId(), e.name] : [
2670
+ e.sheet.getId(),
2671
+ e.name,
2672
+ !0
2673
+ ]));
2674
+ }
2675
+ _addSheetRef(e, t = null) {
2676
+ let n = this._getState(), r = n.sheetRefsAll, i = Math.max(0, Math.min(r.length, t ?? r.length)), a = [
2677
+ ...r.slice(0, i),
2678
+ e,
2679
+ ...r.slice(i)
2680
+ ];
2681
+ this._updateSheetRefStates(a);
2682
+ let o = e.sheet, s = e.name.toLowerCase(), c = new Map(n.refsById);
2683
+ c.set(e.id, e);
2684
+ let u = new Map(n.refsByLowerCaseName);
2685
+ u.set(s, e);
2686
+ let d = new Map(n.refsByInstance);
2687
+ d.set(o, e);
2688
+ let f = new Map(n.sheetsById);
2689
+ f.set(e.id, o);
2690
+ let p = new Map(n.sheetsByLowerCaseName);
2691
+ p.set(s, o);
2692
+ let m = this, h = n.listenersSheets;
2693
+ if (o !== void 0) {
2694
+ let t = o.addListeners({
2695
+ onBeforeDelete: (e) => {
2696
+ m._validateDeleteSheet(e);
2697
+ },
2698
+ onDelete(e) {
2699
+ let t = m._getSheetRef(e, j.Visibility.VeryHidden);
2700
+ if (!t) return;
2701
+ let n = m._beginCommit({ description: l("op.deleteSheet", { name: t.name }) });
2702
+ try {
2703
+ let r = m._getState(), i = r.sheetRefsAll, a = m._getOffsetForId(t.id, i), s = [...i];
2704
+ s.splice(a, 1), m._updateSheetRefStates(s);
2705
+ let c = new Map(r.refsById);
2706
+ c.delete(t.id);
2707
+ let l = new Map(r.sheetsById);
2708
+ l.delete(t.id);
2709
+ let u = t.name.toLowerCase(), d = new Map(r.refsByLowerCaseName);
2710
+ d.delete(u);
2711
+ let f = new Map(r.sheetsByLowerCaseName);
2712
+ f.delete(u);
2713
+ let p = new Map(r.refsByInstance);
2714
+ p.delete(e), r.listenersSheets.get(t.id)();
2715
+ let h = new Map(r.listenersSheets);
2716
+ h.delete(t.id), m._adjustRemoveSelectionIfRequired(a, t.id), m._adjustSheetNamesIfRequired(), m._sheetOnNameChange.delete(t.id), m._sheetOnVisibilityChange.delete(t.id), m._sheetOnIndexChange.delete(t.id), m._tellSheets(), m._emitter.notify("onSheetsChange");
2717
+ let g = new Set(r.sheetsCreated);
2718
+ g.has(o) && g.delete(o), m._updateState({
2719
+ refsById: c,
2720
+ sheetsById: l,
2721
+ refsByLowerCaseName: d,
2722
+ sheetsByLowerCaseName: f,
2723
+ refsByInstance: p,
2724
+ sheetsCreated: g,
2725
+ listenersSheets: h
2726
+ }), n.commit();
2727
+ } catch (e) {
2728
+ throw n.rollback(), e;
2729
+ }
2730
+ }
2731
+ }, { transactional: !0 }), r = $(e) ? e.sheet.addListeners({ onSelectionChange: (e) => {
2732
+ m.getView().getActiveSheetId() === m._getSheetRef(e)?.id && m._emitter.notify("onSelectionChange", {
2733
+ source: m,
2734
+ params: e
2735
+ });
2736
+ } }, { transactional: !1 }) : null;
2737
+ h = new Map(n.listenersSheets), h.set(e.id, () => {
2738
+ t(), r?.();
2739
+ });
2740
+ }
2741
+ let g = n.lastId;
2742
+ g !== -1 && (g = Math.max(g, e.id)), this._updateState({ lastId: g }), this._updateState({
2743
+ refsById: c,
2744
+ refsByLowerCaseName: u,
2745
+ refsByInstance: d,
2746
+ sheetsById: f,
2747
+ sheetsByLowerCaseName: p,
2748
+ listenersSheets: h
2749
+ }), this._adjustSheetNamesIfRequired();
2750
+ let _ = new Set(this._getState().sheetsCreated);
2751
+ return _.add(e.sheet), this._updateState({ sheetsCreated: _ }), this._tellSheets(), e;
2752
+ }
2753
+ _recordActiveSheet(e, t, n) {
2754
+ let r = this.getView().getId();
2755
+ e.setIntent(wn, (e) => ({
2756
+ viewId: r,
2757
+ before: e?.before ?? t,
2758
+ after: n
2759
+ }));
2760
+ }
2761
+ _resyncActiveSheet(e, t) {
2762
+ let n = t?.sheetRefsVisible;
2763
+ if (!n?.length) return;
2764
+ let r = -1, i = n.length;
2765
+ for (let t = 0; t < i; t++) if (n[t].id === e) {
2766
+ r = t;
2767
+ break;
2768
+ }
2769
+ r === -1 && (r = Math.min(Math.max(this._activeSheetOffset, 0), i - 1));
2770
+ let a = n[r].id;
2771
+ this._view.getActiveSheetId() === a ? this._activeSheetOffset = r : this._view.setActiveSheetId(a);
2772
+ }
2773
+ _adjustRemoveSelectionIfRequired(e, t) {
2774
+ if (this._view.getActiveSheetId() === t) {
2775
+ let t, n = this._getState().sheetRefsVisible;
2776
+ t = e < n.length ? n[e].id : n[e - 1].id, this._view.setActiveSheetId(t);
2777
+ }
2778
+ }
2779
+ _adjustSheetNamesIfRequired() {
2780
+ let e = this._getState(), t = e.lastId;
2781
+ if (t === -1) return;
2782
+ let n = this._view.getActiveSheetId();
2783
+ n ??= (this._view.setActiveSheetId(t), t);
2784
+ let r = e.refsById.get(n);
2785
+ r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility === j.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(n, e.sheetRefsVisible));
2786
+ }
2787
+ _validateDeleteSheet(t) {
2788
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2789
+ if (!this.getProtection().isStructureAllowed()) throw new e(l("error.workbook.protection"));
2790
+ let n = this._getSheetRef(t);
2791
+ if (!n) throw new s(function(e) {
2792
+ return l("error.workbook.deleteKey", { key: e });
2793
+ }(t));
2794
+ let r = this._getState().sheetRefsVisible;
2795
+ if (r.length === 1 && r[0].id === n.id) throw new s(l("error.workbook.sheetOne"));
2796
+ }
2797
+ _getOffsetForId(e, t) {
2798
+ let n = t.length;
2799
+ for (let r = 0; r < n; r++) if (t[r].id === e) return r;
2800
+ throw new s(l("error.workbook.noVisibleRefs"));
2801
+ }
2802
+ find(e) {
2803
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2804
+ let n = this._getWorksheets();
2805
+ if (n.length === 0) return { next: () => xe };
2806
+ if (n.length === 1) return n[0].find(e);
2807
+ typeof e == "string" && (e = { text: e });
2808
+ let r = !e?.reverse, i = e?.disableWrap ?? !1, a = this._worksheetOffsetFrom(this.getSelectedSheetIndex(), n), o = a, s = n[o], c = !1;
2809
+ e = {
2810
+ ...e,
2811
+ disableWrap: !0
2812
+ };
2813
+ let u, d = s.find(e), f = d.next(), p = !1;
2814
+ if (e?.from) {
2815
+ let t = this._rangesAddressToCoords(e?.from);
2816
+ u = {
2817
+ colIndex: t[0].colStart,
2818
+ rowIndex: t[0].rowStart
2819
+ };
2820
+ }
2821
+ let m = t.createCellComparator(e?.axis, e?.reverse);
2822
+ delete (e = { ...e }).from;
2823
+ let h = () => {
2824
+ if (!p && f.done && (c && o === a ? p = !0 : r ? (o++, o > n.length - 1 && (o = 0, c = !0)) : (o--, o < 0 && (o = n.length - 1, c = !0)), i && c && (p = !0), p || u || !c || o !== a || (p = !0), !p)) {
2825
+ s = n[o], d = s.find(e);
2826
+ let t = f;
2827
+ return f = d.next(), t;
2828
+ }
2829
+ if (!p && c && o === a && (f.done || !u || !f.done && m(f.value.getCoords(), u) >= 0) && (p = !0), p) {
2830
+ let e = f;
2831
+ return f = xe, e;
2832
+ }
2833
+ let t = f;
2834
+ return f = d.next(), t;
2835
+ };
2836
+ return { next: () => {
2837
+ let e = h();
2838
+ for (; !p && e.done;) e = h();
2839
+ return e;
2840
+ } };
2841
+ }
2842
+ replace(e, t, n) {
2843
+ let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", d = typeof t == "string" ? ct(t) : null, f = n?.description ?? u("op.replace"), p = this._transactions.beginCommit({ description: f });
2844
+ try {
2845
+ let f = null, m = null, h = e.next();
2846
+ for (; !h.done && r < o;) {
2847
+ let o = h.value, s = o.getWorksheet();
2848
+ s !== f && (f = s, m !== null && m.apply(), m = f.getEntireRange().createSparseBuilder({
2849
+ axis: n?.axis,
2850
+ allowUnorderedWrites: !0
2851
+ }));
2852
+ let c = a ? t(o) : t;
2853
+ c !== void 0 && c !== o && (m.push(o, c), r++, i = o), h = e.next();
2854
+ }
2855
+ m?.apply(), r === 1 && o === 1 && i && (c = i.getAddress()), r === 0 ? p.rollback() : p.commit({ description: n?.description ?? (s ? d === null ? u("op.replaceAll") : l("op.replaceAllWith", { value: d }) : c ? d === null ? l("op.replaceAt", { address: c }) : l("op.replaceAtWith", {
2856
+ address: c,
2857
+ value: d
2858
+ }) : d === null ? u("op.replace") : l("op.replaceWith", { value: d })) });
2859
+ } catch (e) {
2860
+ throw p.rollback(), e;
2861
+ }
2862
+ return {
2863
+ count: r,
2864
+ last: i
2865
+ };
2866
+ }
2867
+ _nextSheetIndex(e, t = this._getSheetRefs()) {
2868
+ let n = t.length;
2869
+ return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) >= n - 1 ? 0 : e + 1);
2870
+ }
2871
+ _prevSheetIndex(e, t = this._getSheetRefs()) {
2872
+ let n = t.length;
2873
+ return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) <= 0 ? n - 1 : e - 1);
2874
+ }
2875
+ _worksheetOffsetFrom(e, t) {
2876
+ let n = this._getSheetRefs(), r = n.length;
2877
+ for (let i = 0; i < r; i++) {
2878
+ let a = n[(e + i) % r];
2879
+ if (!$(a)) continue;
2880
+ let o = t.indexOf(a.sheet);
2881
+ if (o !== -1) return o;
2882
+ }
2883
+ return 0;
2884
+ }
2885
+ getNextSheet(e) {
2886
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2887
+ let t = this._getSheetRefs();
2888
+ return t[this._nextSheetIndex(e, t)]?.sheet ?? null;
2889
+ }
2890
+ getPreviousSheet(e) {
2891
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2892
+ let t = this._getSheetRefs();
2893
+ return t[this._prevSheetIndex(e, t)]?.sheet ?? null;
2894
+ }
2895
+ async _duplicateSheet(t) {
2896
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2897
+ if (!this.getProtection().isStructureAllowed()) throw new e(l("error.workbook.protection"));
2898
+ let n = this._getSheetRefs(), r = this.getSelectedSheetIndex(), i = null;
2899
+ if (t) {
2900
+ if (i = this._getSheetRef(t), !i) throw new s(Y(i));
2901
+ } else i = n[r];
2902
+ if (!i) return null;
2903
+ if (!$(i)) throw new s((a = i.name, l("error.workbook.sheetNotDuplicable", { sheetName: a })));
2904
+ var a;
2905
+ let o = i.sheet, c = this._strings.beginPersist(), u = this.getResources().beginPersist(), d = this.getStyles().beginPersist(), f = this._richValues.beginPersist(), p = null, m = this.beginCommit(l("op.duplicateNamed", { name: o.getName() }));
2906
+ try {
2907
+ let e = this._getState().refsByInstance.get(o), t = await o.toJSON(), i = n.length + 1, a = this.findValidSheetName(e.name), s = this._createSheet(i, a, e.visibility, r, void 0, t);
2908
+ this._tellSheets(), this._emitter.notify("onSheetsChange"), p = s, m.commit();
2909
+ } catch (e) {
2910
+ throw m.rollback(), e;
2911
+ } finally {
2912
+ f.endPersist(), d.endPersist(), u.endPersist(), c.endPersist();
2913
+ }
2914
+ return p;
2915
+ }
2916
+ _createRange(e, t) {
2917
+ let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope, j.Visibility.VeryHidden) : null;
2918
+ if (r && !$(r)) throw new s(X(r.name, r.sheet.getKind()));
2919
+ if (!r) {
2920
+ let e = this._anchorWorksheet();
2921
+ return e ? (delete n?.scope, yn(n, n ? {
2922
+ scope: Ne,
2923
+ ...e.getEntireRange().getCoords()
2924
+ } : null)) : void console.warn(l("error.workbook.noVisibleRefs"));
2925
+ }
2926
+ let i = r.sheet, a = null;
2927
+ return t && (a = { getOptions: t }), new Tn(e, z(i), this, a);
2928
+ }
2929
+ _createRanges(e, t) {
2930
+ let n = this._anchorWorksheet();
2931
+ if (!n) throw new s(mn("", j.Kind.Worksheet));
2932
+ let r = null;
2933
+ return t && (r = { getOptions: t }), new Q(e, z(n), this, r);
2934
+ }
2935
+ getRange(e, t) {
2936
+ if (e === void 0) return this.getSelectedRange(t);
2937
+ try {
2938
+ let n = this._rangesAddressToCoords(e);
2939
+ if (n.length !== 1) throw new s(l("error.address.singleRangeOnlyAlt"));
2940
+ return this._createRange(n[0], t);
2941
+ } catch (t) {
2942
+ throw t instanceof d ? new d(t.message) : new s(t.message ?? Ue(e));
2943
+ }
2944
+ }
2945
+ getCell(e) {
2946
+ if (e === void 0) return this.getSelectedCell();
2947
+ let t = this.getRange(e);
2948
+ if (t.size > 1) throw new s(l("error.address.singleCellOnly"));
2949
+ return t.getCell();
2950
+ }
2951
+ getRanges(e, t) {
2952
+ let n = this._rangesAddressToCoords(e);
2953
+ if (n.length === 0) throw new s(Ue(e));
2954
+ return this._createRanges(n, t);
2955
+ }
2956
+ _createGraphRanges(e, t) {
2957
+ let n = [], r = this.getCalculation()?.getNamedFormulas() ?? null;
2958
+ for (let e = 0; e < t.length; e++) {
2959
+ let i = t[e], a = i.sheetName ? this._getSheetRef(i.sheetName, j.Visibility.VeryHidden) : null, o = a && $(a) ? a.sheet : this._anchorWorksheet();
2960
+ o && n.push(new _e(i, r, z(o), null));
2961
+ }
2962
+ for (let t = 0; t < e.length; t++) n.push(e[t]);
2963
+ let i = this._anchorWorksheet();
2964
+ return n.length !== 0 && i ? new Q(n, z(i), this, null) : null;
2965
+ }
2966
+ getAnomalies(e) {
2967
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2968
+ let t = ke(e), n = this._getWorksheets(j.Visibility.VeryHidden).map((e) => {
2969
+ let t = z(e);
2970
+ return {
2971
+ bounds: t.getSheet().getEntireCoords(),
2972
+ internal: t,
2973
+ qualified: !0
2974
+ };
2975
+ });
2976
+ return new ze(n, () => (this.getSelectedWorksheet() ?? this._getWorksheets(j.Visibility.VeryHidden)[0]).getEntireRange(), t);
2977
+ }
2978
+ getStats(e) {
2979
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
2980
+ let t = this._getWorksheets(j.Visibility.VeryHidden), n = t.length;
2981
+ if (n === 1) return t[0].getStats(e);
2982
+ let r = Array(n);
2983
+ for (let i = 0; i < n; i++) r[i] = t[i].getStats(e);
2984
+ return new Ut(r);
2985
+ }
2986
+ _activeRangeCoords() {
2987
+ let e = this._requireSelectedWorksheet(), t = e.getSelection().getRanges().getCoords(), n = e.getName(), r = t.length, i = Array(r);
2988
+ for (let e = 0; e < r; e++) {
2989
+ let r = t[e];
2990
+ i[e] = {
2991
+ colStart: r.colStart,
2992
+ colEnd: r.colEnd,
2993
+ rowStart: r.rowStart,
2994
+ rowEnd: r.rowEnd,
2995
+ scope: n
2996
+ };
2997
+ }
2998
+ return i;
2999
+ }
3000
+ getSelectedRange(e) {
3001
+ return this.getRange(this._activeRangeCoords()[0], e);
3002
+ }
3003
+ getSelectedRanges(e) {
3004
+ return this.getRanges(this._activeRangeCoords(), e);
3005
+ }
3006
+ getSelectedCell() {
3007
+ return this._requireSelectedWorksheet().getSelectedCell();
3008
+ }
3009
+ _rangesAddressToCoords(e, t = !0, n = j.Visibility.Hidden) {
3010
+ if (!e) throw new s(l("error.address.noAddress"));
3011
+ let r = this.getSelectedWorksheet(), i = { ...(r ?? this._anchorWorksheet())?.getEntireRange().getCoords() }, a = r?.getName();
3012
+ if (a && (i.scope = a), typeof e == "string") {
3013
+ let t = e.trim().toLowerCase();
3014
+ if (t === "r" || t === "c") {
3015
+ let n = this.getSelectedCell().getCoords(), r = {};
3016
+ t === "r" ? r.rowStart = r.rowEnd = n.rowIndex : r.colStart = r.colEnd = n.colIndex, e = r;
3017
+ }
3018
+ }
3019
+ let o = this, c = Ee(e, i, Ke, (e) => {
3020
+ if (!t) return null;
3021
+ if (typeof e == "string") {
3022
+ let t = Ze(e, {
3023
+ getTable: (e) => Pe(o.getNames().getByName(e)),
3024
+ getAnchor: () => r ? {
3025
+ sheet: r,
3026
+ coords: r.getSelectedCell().getCoords()
3027
+ } : null
3028
+ });
3029
+ if (t) return [t];
3030
+ let n = o.getNames().getByName(e)?.getRanges?.();
3031
+ if (n) return n.getCoords();
3032
+ }
3033
+ throw new s(`Invalid sheet reference '${e}'.`);
3034
+ }), u = c.length;
3035
+ for (let e = 0; e < u; e++) this._validateCoords(c[e], n);
3036
+ return c;
3037
+ }
3038
+ _validateCoords(e, n = j.Visibility.Visible, r = l("error.sheet.oobRange")) {
3039
+ if (e === null) return;
3040
+ let i = this.getWorksheet(e.scope ?? void 0, n).getEntireRange().getCoords();
3041
+ if (!t.isRangeWithinRange(e, i)) throw new d(r);
3042
+ if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new s(l("error.address.invalidRangeInverted"));
3043
+ }
3044
+ _updateSheetRef(e, t) {
3045
+ let n = this._getState(), r = [...n.sheetRefsAll];
3046
+ r[this._getOffsetForId(e.id, n.sheetRefsAll)] = t, this._updateSheetRefStates(r);
3047
+ let i = new Map(n.refsById);
3048
+ i.set(e.id, t);
3049
+ let a = e.name.toLowerCase(), o = t.name.toLowerCase(), s = new Map(n.refsByLowerCaseName);
3050
+ s.delete(a), s.set(o, t);
3051
+ let c = new Map(n.sheetsByLowerCaseName), l = c.get(a);
3052
+ c.delete(a), c.set(o, l);
3053
+ let u = new Map(n.refsByInstance);
3054
+ return u.set(l, t), this._updateState({
3055
+ refsById: i,
3056
+ refsByLowerCaseName: s,
3057
+ sheetsByLowerCaseName: c,
3058
+ refsByInstance: u
3059
+ }), this._tellSheets(), t;
3060
+ }
3061
+ _setSheetName(t, n, r) {
3062
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
3063
+ if (!this.getProtection().isStructureAllowed()) throw new e(l("error.workbook.protection"));
3064
+ let i = this._getSheetRef(t);
3065
+ if (!i) throw new s(Y(t));
3066
+ if (n === i.name) return i.sheet;
3067
+ if ((n = this._validateNewSheetName(n)) == null) throw new s(l("error.workbook.sheetNameNotProvided"));
3068
+ let a = Object.freeze({
3069
+ ...i,
3070
+ name: n
3071
+ }), o = null, c = this.beginCommit(u("op.renameSheet"));
3072
+ try {
3073
+ let e = this._updateSheetRef(i, a);
3074
+ this._adjustSheetNamesIfRequired(), this._sheetOnNameChange.forEach((e, t) => {
3075
+ i.id === t && e();
3076
+ }), this._emitter.notify("onSheetsChange"), i.id === this.getView().getActiveSheetId() && this._emitter.notify("onSelectionChange"), o = e.sheet, c.commit(r);
3077
+ } catch (e) {
3078
+ throw c.rollback(), e;
3079
+ }
3080
+ return o;
3081
+ }
3082
+ _setSheetVisibility(t, n = j.Visibility.Visible, r) {
3083
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
3084
+ if (!this.getProtection().isStructureAllowed()) throw new e(l("error.workbook.protection"));
3085
+ let i = this._getSheetRef(t, j.Visibility.VeryHidden);
3086
+ if (!i) return null;
3087
+ if (n === i.visibility) return;
3088
+ let a = null, o = "";
3089
+ n === j.Visibility.Visible ? o = u("op.unhideSheet") : n === j.Visibility.Hidden ? o = u("op.hideSheet") : n === j.Visibility.VeryHidden && (o = u("op.veryHideSheet"));
3090
+ let c = this.beginCommit(o);
3091
+ try {
3092
+ let e = this._getState().sheetRefsVisible;
3093
+ if (n !== j.Visibility.Visible && e.length === 1 && e[0].id === i.id) throw new s(l("error.workbook.sheetOne"));
3094
+ let t = {
3095
+ ...i,
3096
+ visibility: n
3097
+ }, o = -1;
3098
+ n !== j.Visibility.Visible && (o = this._getOffsetForId(i.id, e)), a = this._updateSheetRef(i, t).sheet, n !== j.Visibility.Visible && this._adjustRemoveSelectionIfRequired(o, i.id), this._adjustSheetNamesIfRequired(), c.commit(r);
3099
+ } catch (e) {
3100
+ throw c.rollback(), e;
3101
+ }
3102
+ return this._sheetOnVisibilityChange.forEach((e, t) => {
3103
+ i.id === t && e();
3104
+ }), this._emitter.notify("onSheetsChange"), a;
3105
+ }
3106
+ _moveSheet(t, n, r) {
3107
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
3108
+ if (!this.getProtection().isStructureAllowed()) throw new e(l("error.workbook.protection"));
3109
+ let i = null, a = this.beginCommit(l("op.moveSheetNamed", { name: t.name }));
3110
+ try {
3111
+ let e = this._getState(), o = e.sheetRefsVisible;
3112
+ if (n < 0 || n > o.length - 1) throw new s(`Invalid to index: ${n}`);
3113
+ let c = this.getView().getActiveSheetId(), l = e.sheetRefsAll, u = this._getOffsetForId(t.id, l), d = this._getOffsetForId(o[n].id, l);
3114
+ if (u === d) return;
3115
+ let f = l[u], p = [...l];
3116
+ p.splice(u, 1), p.splice(d, 0, f), this._updateSheetRefStates(p), this._calculation._replaceSheetSpans?.(l.map((e) => e.sheet.getId()), p.map((e) => e.sheet.getId()), f.sheet.getId()), this._adjustSheetNamesIfRequired(), this._sheetOnIndexChange.forEach((e, t) => {
3117
+ t >= u && t <= d && e();
3118
+ }), this._tellSheets(), this._emitter.notify("onSheetsChange"), i = f.sheet, this._recordActiveSheet(a, c, this.getView().getActiveSheetId()), a.commit(r);
3119
+ } catch (e) {
3120
+ throw a.rollback(), e;
3121
+ }
3122
+ return i;
3123
+ }
3124
+ _setSelectedSheet(e) {
3125
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
3126
+ let t = this._getSheetRef(e);
3127
+ if (!t) throw new s(Y(e));
3128
+ let n = null;
3129
+ return t.visibility !== j.Visibility.Visible && this._setSheetVisibility(t, j.Visibility.Visible), this._view.setActiveSheetId(t.id), n = t.sheet, n;
3130
+ }
3131
+ getProtection() {
3132
+ return this._protection;
3133
+ }
3134
+ getProperties() {
3135
+ return this._documentProperties;
3136
+ }
3137
+ getCodeName() {
3138
+ return this._codeName;
3139
+ }
3140
+ getNames() {
3141
+ return this._names;
3142
+ }
3143
+ getCalculation() {
3144
+ return this._calculation;
3145
+ }
3146
+ getFonts() {
3147
+ return ot.getShared();
3148
+ }
3149
+ createFormula(e, t, n) {
3150
+ return this.getCalculation().createFormula(e, t, n);
3151
+ }
3152
+ evaluate(e, t) {
3153
+ return this.getCalculation().evaluate(e, t);
3154
+ }
3155
+ async whenCalculationReady() {
3156
+ let e = this._starting;
3157
+ return e ? e.then(() => this.getCalculation().ready()) : this.getCalculation().ready();
3158
+ }
3159
+ whenFontsReady() {
3160
+ return this.getFonts().whenReady();
3161
+ }
3162
+ async whenReady() {
3163
+ await Promise.all([this.whenCalculationReady(), this.whenFontsReady()]);
3164
+ }
3165
+ getScripts() {
3166
+ return this._scripts ||= this._createScripts(), this._scripts;
3167
+ }
3168
+ getModules() {
3169
+ return this.getScripts().getModules();
3170
+ }
3171
+ _notifyAllChange() {
3172
+ this._emitter.notify("onSheetsChange"), this._emitter.notify("onSelectedSheetChange"), this._emitter.notify("onViewChange");
3173
+ }
3174
+ addListeners(e, t) {
3175
+ return this._emitter.addListeners(e, t);
3176
+ }
3177
+ _sheetToWBEvent(e) {
3178
+ let t = this, n = (e) => {
3179
+ if (e.isInvalid()) return e;
3180
+ let n = e.getWorksheet().getName();
3181
+ if (e.isICellRanges) {
3182
+ let r = e.getCoords().map((e) => e.scope ? e : {
3183
+ ...e,
3184
+ scope: n
3185
+ });
3186
+ return t.getRanges(r);
3187
+ }
3188
+ let r = e.getCoords();
3189
+ return t.getRange(r.scope ? r : {
3190
+ ...r,
3191
+ scope: n
3192
+ });
3193
+ };
3194
+ return (t) => {
3195
+ e({
3196
+ getSource: () => n(t.getSource()),
3197
+ getRanges: () => {
3198
+ let e = t.getRanges();
3199
+ return e ? n(e) : null;
3200
+ },
3201
+ getPreviousAddress: () => t.getPreviousAddress(),
3202
+ getTrigger: () => t.getTrigger(),
3203
+ isUndo: () => t.isUndo(),
3204
+ getCommit: () => t.getCommit(),
3205
+ toString: () => `WorkbookRangeEvent: ('${t.getTrigger()}', ${n(t.getSource()).toString()})`,
3206
+ getTimeStamp: () => t.getTimeStamp()
3207
+ });
3208
+ };
3209
+ }
3210
+ _holdPivotCaches() {
3211
+ let e = this._pivotCaches;
3212
+ if (e.length === 0) return;
3213
+ let t = (e) => {
3214
+ let t = this._getSheetRef(e), n = t && $(t) ? t.sheet : null;
3215
+ return n ? n._contentAddWatch(() => null) : null;
3216
+ };
3217
+ for (let n = 0; n < e.length; n++) e[n]._hold(t);
3218
+ }
3219
+ _fromJSON(e, t) {
3220
+ if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new s(l("error.workbook.sheetOne"));
3221
+ e.theme && (this._theme = new Fe(e.theme), this._styles.setTheme(this._theme));
3222
+ let n = this._strings.beginPersist(), r = this._resources.beginPersist(), i = this._styles.beginPersist(), a = this._richValues.beginPersist();
3223
+ try {
3224
+ n.fromJSON(e.strings), r.fromJSON(e.resources), this._fetch.adopt(this._resources.getItems()), i.fromJSON(e.styles), a.fromJSON(e.richData, {
3225
+ resources: this._resources,
3226
+ strings: this._strings,
3227
+ fromResourceId: (e) => r.fromResourceId(e) ?? null
3228
+ }, 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 ||= {};
3229
+ let o = [], c = e.pivotCaches;
3230
+ if (c) {
3231
+ let e = r.fromResourceId.bind(r);
3232
+ for (let t = 0; t < c.length; t++) {
3233
+ let n = c[t];
3234
+ n && typeof n.cacheId == "number" && o.push(new Kt(n.cacheId, R.fromJSON(n.part, e)));
3235
+ }
3236
+ }
3237
+ this._pivotCaches = o, this._people.fromJSON(e.people);
3238
+ let u = e.sheets, d = u.length, f = e.view.activeSheetId ?? null;
3239
+ f !== null && (f = Math.min(Math.max(0, f), d - 1));
3240
+ let p = null, m = null;
3241
+ this._isLoadingSheets = !0;
3242
+ for (let e = 0; e < d; e++) {
3243
+ let n = u[e], i = n.visibility || j.Visibility.Visible, a = e;
3244
+ m = a, i === j.Visibility.Visible ? p === null && (p = a) : f !== null && f === a && (f = null);
3245
+ try {
3246
+ let o = n.kind ?? j.Kind.Worksheet;
3247
+ if (o !== j.Kind.Worksheet) {
3248
+ let c = n.sheet, u = R.fromJSON(c?.part, r.fromResourceId.bind(r));
3249
+ if (!u) throw new s(l("error.workbook.sheetPartMissing", { sheetName: n.name }));
3250
+ this._createOpaqueSheet(a, n.name, i, e, n.sheetId, o, u, c?.tabColor ?? null, t?.[e]);
3251
+ } else this._createSheet(a, n.name, i, e, n.sheetId, n.sheet, t?.[e]);
3252
+ } catch (e) {
3253
+ throw this._isLoadingSheets = !1, e;
3254
+ }
3255
+ }
3256
+ this._isLoadingSheets = !1, this._tellSheets(), this._holdPivotCaches(), this._updateState({ lastId: m }), e.view.activeSheetId = f ?? p, this.setView(new sn({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
3257
+ let h = this;
3258
+ this._protection = new ln(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
3259
+ h._emitter.notify("onProtectionChange", { source: e });
3260
+ } }), this._emitter.notify("onLoad");
3261
+ } finally {
3262
+ a.endPersist(), i.endPersist(), r.endPersist(), n.endPersist();
3263
+ }
3264
+ }
3265
+ async _startFunctions() {
3266
+ let e = this._scripts;
3267
+ if (!e) return n.EmptyArray;
3268
+ await e._load();
3269
+ let t = [];
3270
+ for (let n of e.getModules().getItems()) this._startModules.add(n), t.push(...n.getFunctions().getItems({
3271
+ type: "formula",
3272
+ includeHidden: !0
3273
+ }));
3274
+ return t;
3275
+ }
3276
+ _createScripts(e) {
3277
+ let t = this;
3278
+ return new Yt({
3279
+ transactions: this._transactions,
3280
+ json: e,
3281
+ workbook: t,
3282
+ getBuiltInFunctions: () => t._calculation?.getFunctions(),
3283
+ onAdd: (e, n) => {
3284
+ let r = t._calculation;
3285
+ r.getStatus() !== $e.Status.Off && r.start().then(async () => {
3286
+ if (t._startModules.has(n)) return;
3287
+ let e = n.getFunctions().getItems({
3288
+ type: "formula",
3289
+ includeHidden: !0
3290
+ }), r = e.length;
3291
+ for (let t = 0; t < r; t++) {
3292
+ let n = e[t];
3293
+ try {
3294
+ await this._calculation.getFunctions().add(n);
3295
+ } catch (e) {
3296
+ f.error(e?.message ?? String(e), e);
3297
+ }
3298
+ }
3299
+ }).catch(() => {});
3300
+ },
3301
+ onRemove: (e, t) => {}
3302
+ });
3303
+ }
3304
+ async toJSON(e) {
3305
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
3306
+ await Promise.resolve(this._starting);
3307
+ let t = this.getCalculation();
3308
+ t.getStatus() !== $e.Status.Off && (await t.ready(), await t._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
3309
+ let n = { sheets: [] }, r = e?.ignoreStyles ?? !1;
3310
+ if (!r) {
3311
+ let e = this._theme.toJSON();
3312
+ (e ? Object.keys(e).length : 0) > 0 && (n.theme = e);
3313
+ }
3314
+ if (this._scripts) {
3315
+ let e = this._scripts.toJSON();
3316
+ e && Object.keys(e).length > 0 && (n.modules = e);
3317
+ }
3318
+ this._isDate1904 && (n.date1904 = !0), this._codeName && (n.codeName = this._codeName), this._updateLinks && (n.updateLinks = this._updateLinks);
3319
+ let i = this._documentProperties.toJSON();
3320
+ Object.keys(i).length > 0 && (n.properties = i), this._locale && (n.locale = this._locale), this._localeOverrides && (n.localeOverrides = this._localeOverrides);
3321
+ let a = e?.resources ?? "embed", o = a === "ignore", s = this._strings.beginPersist(), c = o ? null : this._resources.beginPersist(), u = this._styles.beginPersist(), d = this._richValues.beginPersist();
3322
+ try {
3323
+ let t = this._getSheetRef(this.getSelectedSheetIndex()).id, i = t, l = null, f = this._getState(), p = f.sheetRefsAll, m = f.sheetsById, h = p.length;
3324
+ for (let r = 0; r < h; r++) {
3325
+ let a, o = p[r], s = r + 1, u = m.get(o.id);
3326
+ if ($(o)) a = {
3327
+ name: o.name,
3328
+ sheet: await o.sheet.toJSON(e)
3329
+ };
3330
+ else {
3331
+ let e = u, t = c ? c.toResourceId.bind(c) : () => null, n = { part: R.toJSON(e._getPart(), t) }, r = e.getTabColor();
3332
+ r && (n.tabColor = r.toString()), a = {
3333
+ name: o.name,
3334
+ kind: e.getKind(),
3335
+ sheet: n
3336
+ };
3337
+ }
3338
+ o.sheetId !== void 0 && (a.sheetId = o.sheetId), o.visibility === j.Visibility.Visible ? l === null && (l = s) : a.visibility = o.visibility, o.id === t && (i = s), n.sheets.push(a);
3339
+ }
3340
+ if (!r) {
3341
+ let e = u.toJSON();
3342
+ e && Object.keys(e).length > 0 && (n.styles = e);
3343
+ }
3344
+ let g = this.getProtection().toJSON();
3345
+ g && (n.protection = g);
3346
+ let _ = this._calculation.toJSON();
3347
+ Object.keys(_).length > 0 && (n.calc = _);
3348
+ let v = await s.toJSONAsync();
3349
+ v && v.length > 0 && (n.strings = v);
3350
+ let y = await d.toJSONAsync(c ? c.toResourceId.bind(c) : void 0);
3351
+ if (y.length > 0) {
3352
+ n.richData = y;
3353
+ let e = d.toKindsJSON();
3354
+ e.length > 0 && (n.richTypes = e);
3355
+ }
3356
+ let b = this._calculation.getExternalBooks().toJSON();
3357
+ b && (n.externalBooks = b);
3358
+ let x = this._pivotCaches;
3359
+ if (x.length > 0) {
3360
+ let e = c ? c.toResourceId.bind(c) : () => null, t = /* @__PURE__ */ new Set();
3361
+ for (let e of this.getPivotTables()) t.add(e.getCacheId());
3362
+ let r = [];
3363
+ for (let n = 0; n < x.length; n++) t.has(x[n].cacheId) && r.push(x[n].toJSON(e));
3364
+ r.length > 0 && (n.pivotCaches = r);
3365
+ }
3366
+ let S = this._people.toJSON();
3367
+ if (S && (n.people = S), !o) {
3368
+ let e = await c.toJSONAsync(typeof a == "function" ? a : void 0);
3369
+ e && e.length > 0 && (n.resources = e);
3370
+ }
3371
+ let C = this._calculation.getNamedFormulas().toJSON();
3372
+ C && C.length > 0 && (n.names = C);
3373
+ let w = this._view.toJSON();
3374
+ w && (i === l ? delete w.activeSheetId : w.activeSheetId = i, Object.keys(w).length > 0 && (n.view = w));
3375
+ } finally {
3376
+ d.endPersist(), u.endPersist(), o || c.endPersist(), s.endPersist();
3377
+ }
3378
+ return this._emitter.notify("onSave", { params: n }), n;
3379
+ }
3380
+ isClosed() {
3381
+ return this._closed;
3382
+ }
3383
+ close() {
3384
+ if (this._closed) return;
3385
+ this._emitter.notify("onClose");
3386
+ let e = this._getState();
3387
+ e.listenersSheets.forEach((e) => {
3388
+ e();
3389
+ }), e.listenersSheets.clear();
3390
+ let t = e.sheetRefsAll;
3391
+ for (let e = t.length - 1; e >= 0; e--) try {
3392
+ t[e].sheet.close();
3393
+ } catch (e) {
3394
+ console.warn("error on close", e);
3395
+ }
3396
+ 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 yt && this._originProvider.release(), this._closed = !0;
3397
+ }
3398
+ beginCommit(e) {
3399
+ if (this._closed) throw Error(l("error.workbook.modelClosed"));
3400
+ return this._beginCommit(typeof e == "string" ? { description: e } : e);
3401
+ }
3402
+ doBatch(e, t) {
3403
+ let n = this;
3404
+ t = typeof t == "string" ? { description: t } : {
3405
+ description: u("op.updateWorkbook"),
3406
+ ...t
3407
+ };
3408
+ let r = g.bind(this._transactions, this, e);
3409
+ return this._transactions.doBatch(r.callback, {
3410
+ ...t,
3411
+ onChildCommit: r.onChildCommit
3412
+ }, (e, t) => {
3413
+ r.close(), e.getDepth() === 0 && (n._lastTransactionUUID = e.getId());
3414
+ });
3415
+ }
3416
+ _beginCommit(e) {
3417
+ let t = this;
3418
+ return this._transactions.beginCommit(typeof e == "string" ? { description: e } : e, (e) => {
3419
+ e.getDepth() === 0 && (t._lastTransactionUUID = e.getId());
3420
+ });
3421
+ }
3422
+ _getState() {
3423
+ return this._transactions.getState(this._id);
3424
+ }
3425
+ _updateState(e, t = u("op.updateWorkbook"), n) {
3426
+ if (!e) return;
3427
+ let r = this._beginCommit(t);
3428
+ try {
3429
+ r.updateState(this._id, e), r.commit(n);
3430
+ } catch (e) {
3431
+ throw r.rollback(), e;
3432
+ }
3433
+ }
3434
+ get options() {
3435
+ return this._options;
3436
+ }
3437
+ get [Symbol.toStringTag]() {
3438
+ return "[Workbook]";
3439
+ }
3440
+ toString() {
3441
+ return `[${this.getName() ?? "(untitled)"}]`;
3442
+ }
3443
+ get isIWorkbook() {
3444
+ return !0;
3445
+ }
3446
+ }, On = { address: null }, $ = (e) => e.sheet.getKind() === j.Kind.Worksheet, kn = class {
3447
+ constructor() {
3448
+ this._readFormats = [], this._writeFormats = [], this._encryptions = [];
3449
+ }
3450
+ async registerReadFormat(e) {
3451
+ this._readFormats = await this._registerFormatType(e, this._readFormats);
3452
+ }
3453
+ async registerWriteFormat(e) {
3454
+ this._writeFormats = await this._registerFormatType(e, this._writeFormats);
3455
+ }
3456
+ async registerEncryption(e) {
3457
+ if (!e) throw Error("encryption must be provided.");
3458
+ if (!e.key) throw Error("encryption.key must be provided.");
3459
+ let t = e.key.toLowerCase(), n = this._encryptions.findIndex((e) => e.key.toLowerCase() === t);
3460
+ if (n !== -1) {
3461
+ let t = [...this._encryptions];
3462
+ t[n] = e, this._encryptions = Object.freeze(t);
3463
+ } else this._encryptions = Object.freeze([...this._encryptions, e]);
3464
+ }
3465
+ async getEncryption(e) {
3466
+ return this.peekEncryption(e);
3467
+ }
3468
+ peekEncryption(e) {
3469
+ if (!e) return this._encryptions[0] ?? null;
3470
+ let t = e.toLowerCase();
3471
+ return this._encryptions.find((e) => e.key.toLowerCase() === t) ?? null;
3472
+ }
3473
+ async detectEncryption(e) {
3474
+ for (let t of this._encryptions) if (await t.detect(e)) return t;
3475
+ return null;
3476
+ }
3477
+ async getReadFormats(e) {
3478
+ return e ? this._filterFormats(e, this._readFormats) : [...this._readFormats];
3479
+ }
3480
+ async getWriteFormats(e) {
3481
+ return this._writeFormats ? e ? this._filterFormats(e, this._writeFormats) : [...this._writeFormats] : [];
3482
+ }
3483
+ async _registerFormatType(e, t) {
3484
+ return this._registerFormatTypeSync(e, t);
3485
+ }
3486
+ _registerFormatTypeSync(e, t) {
3487
+ if (!e) throw Error("format must be provided.");
3488
+ if (!e.key) throw Error("format.key must be provided.");
3489
+ let n = e.key.toLowerCase(), r = t.findIndex((e) => e.key.toLowerCase() === n);
3490
+ if (r !== -1) {
3491
+ let n = [...t];
3492
+ return n[r] = e, Object.freeze(n);
3493
+ }
3494
+ return Object.freeze([...t, e]);
3495
+ }
3496
+ _filterFormats(e, t, n) {
3497
+ if (!e || Object.keys(e).length === 0) {
3498
+ if (!n) return [...t];
3499
+ e = { ext: n };
3500
+ }
3501
+ let r = e.search?.toLocaleLowerCase();
3502
+ return t.filter((t) => {
3503
+ if (r) {
3504
+ let e = t.key.toLocaleLowerCase().includes(r), n = !!t.exts && t.exts.some((e) => e.toLocaleLowerCase().includes(r)), i = !!t.mimeType && t.mimeType.toLocaleLowerCase().includes(r), a = !!t.tags && t.tags.some((e) => e.toLocaleLowerCase().includes(r)), o = !!t.description && t.description.toLocaleLowerCase().includes(r);
3505
+ if (!(e || n || i || a || o)) return !1;
3506
+ }
3507
+ let i = e.ext || n;
3508
+ if (i) {
3509
+ let e = i.toLocaleLowerCase();
3510
+ if (!t.exts.some((t) => t.toLocaleLowerCase() === e)) return !1;
3511
+ }
3512
+ if (e.mimeType && t.mimeType !== e.mimeType || e.key && t.key.toLocaleLowerCase() !== e.key.toLocaleLowerCase()) return !1;
3513
+ if (e.tags) {
3514
+ let n = t.tags || [];
3515
+ if (!(typeof e.tags == "string" ? [e.tags] : e.tags).every((e) => n.includes(e))) return !1;
3516
+ }
3517
+ return !0;
3518
+ });
3519
+ }
3520
+ }, An = /* @__PURE__ */ new WeakMap(), jn = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", Mn = new class {
3521
+ constructor() {
3522
+ this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new _(this), this._registry = new kn(), this._defaultStore = new xt(() => this.getWriteFormats(), () => this.getReadFormats());
3523
+ }
3524
+ getBackingStore() {
3525
+ return this._backingStore ?? this._defaultStore;
3526
+ }
3527
+ setBackingStore(e) {
3528
+ this._backingStore = e ?? null;
3529
+ }
3530
+ canWrite() {
3531
+ return typeof this.getBackingStore().write == "function";
3532
+ }
3533
+ canRead() {
3534
+ return typeof this.getBackingStore().read == "function";
3535
+ }
3536
+ async install(e) {
3537
+ this._setInstalled.has(e) || (await e.register(this._registry), this._setInstalled.add(e));
3538
+ }
3539
+ addListeners(e, t) {
3540
+ return this._emitter.addListeners(e, t);
3541
+ }
3542
+ addCommitListener(e) {
3543
+ return this._emitter.addListeners({ onWrite: (t, n) => {
3544
+ n.save && e.onCommit?.({
3545
+ store: n.workbook.getTransactions(),
3546
+ commitId: n.commitId
3547
+ });
3548
+ } });
3549
+ }
3550
+ async getReadFormats(e) {
3551
+ return this._registry.getReadFormats(e);
3552
+ }
3553
+ async getWriteFormats(e) {
3554
+ return this._registry.getWriteFormats(e);
3555
+ }
3556
+ getOrigin(e) {
3557
+ return new B(e);
3558
+ }
3559
+ async read(e) {
3560
+ let t = null;
3561
+ if (typeof e == "string") e = { source: e };
3562
+ else if (jn(e)) {
3563
+ let n = e.getPath();
3564
+ if (!n) throw Error("Cannot read from an unbound origin (no path).");
3565
+ _t(e) ? e = {
3566
+ source: n,
3567
+ asCopy: !0
3568
+ } : (t = e, e = { source: n });
3569
+ }
3570
+ let n = e ?? {}, { source: r = null, ...i } = n, a = this.getBackingStore();
3571
+ return (a.read ? a : this._defaultStore).read({
3572
+ source: r,
3573
+ options: i,
3574
+ decode: (e, r) => this._decodeBuffer(e, r, n, t)
3575
+ });
3576
+ }
3577
+ async _decodeBuffer(e, t = {}, n, r = null) {
3578
+ let i = t.format, a = t.ext;
3579
+ if (!i && !a) throw Error("Either format or file extension must be provided to determine read type.");
3580
+ let o = (await this._registry.getReadFormats({
3581
+ search: i,
3582
+ ext: a
3583
+ }))[0];
3584
+ if (!o) throw new s(l("error.io.readFormatUnavailable", { format: i ?? a }));
3585
+ let c = n?.typedCreateWorkbookOptions, u = c ? Object.keys(c).find((e) => e.toLowerCase() === o.key.toLowerCase()) : void 0, d = {
3586
+ ...n,
3587
+ ...u === void 0 ? void 0 : c[u]
3588
+ };
3589
+ delete d.typedCreateWorkbookOptions, delete d.source, delete d.asCopy;
3590
+ let f = r ?? new B(t.absolutePath ?? null, {
3591
+ name: t.name ?? null,
3592
+ format: o.key,
3593
+ size: t.size ?? null,
3594
+ lastModified: t.lastModified ?? null,
3595
+ canWrite: t.canWrite ?? !1
3596
+ });
3597
+ r instanceof B && r.update({
3598
+ format: o.key,
3599
+ size: t.size ?? null,
3600
+ lastModified: t.lastModified ?? null
3601
+ }), d.createWorkbookOptions = {
3602
+ ...d.createWorkbookOptions || {},
3603
+ origin: f
3604
+ }, d.readonly !== void 0 && (d.createWorkbookOptions = {
3605
+ readonly: d.readonly,
3606
+ ...d.createWorkbookOptions
3607
+ }, delete d.readonly), d.calcOnly && (d.createWorkbookOptions = {
3608
+ disableLoadAutoFit: !0,
3609
+ ...d.createWorkbookOptions
3610
+ });
3611
+ let p = await this._decrypt(e, f, d);
3612
+ if (p === null) return null;
3613
+ e = p.bytes;
3614
+ let m = d?.progress?.onStart?.bind(d.progress);
3615
+ m && await Promise.resolve(m(f, t.size));
3616
+ try {
3617
+ let t = await this._readArrayBuffer(e, o, d);
3618
+ return p.password !== null && f.setPassword(p.password), d?.progress?.onComplete?.(f), this._emitter.notify("onRead", {
3619
+ params: {
3620
+ workbook: t,
3621
+ origin: f
3622
+ },
3623
+ transactional: !1
3624
+ }), t;
3625
+ } catch (e) {
3626
+ throw d?.progress?.onError?.(e), d?.progress?.onComplete?.(null), e;
3627
+ }
3628
+ }
3629
+ async _decrypt(e, t, n) {
3630
+ let r = await this._registry.detectEncryption(e);
3631
+ if (t instanceof B && t.update({ encryption: r ? r.key : null }), !r) return {
3632
+ bytes: e,
3633
+ password: null
3634
+ };
3635
+ let i = null, a = async (t) => {
3636
+ try {
3637
+ return i = await r.decode(e, t), !0;
3638
+ } catch (e) {
3639
+ if (!(e instanceof p)) throw e;
3640
+ return !1;
3641
+ }
3642
+ };
3643
+ if (n?.password && await a(n.password)) return {
3644
+ bytes: i,
3645
+ password: n.password
3646
+ };
3647
+ if (!n?.onPassword) {
3648
+ let e = t.getName();
3649
+ throw new h(e ? l("error.io.passwordRequired", { name: e }) : l("error.io.passwordRequiredUnnamed"));
3650
+ }
3651
+ let o = await Promise.resolve(n.onPassword({
3652
+ origin: t,
3653
+ encryption: r.key,
3654
+ validate: a
3655
+ }));
3656
+ if (o == null) return null;
3657
+ if (i !== null || await a(o)) return {
3658
+ bytes: i,
3659
+ password: o
3660
+ };
3661
+ throw new p(l("error.io.passwordIncorrect"));
3662
+ }
3663
+ async writeArrayBuffer(e, t) {
3664
+ if (!t?.format) throw Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
3665
+ let n = (await this._registry.getWriteFormats({ search: t.format }))[0];
3666
+ if (!n) throw new s(l("error.io.writeFormatUnavailable", { format: t.format }));
3667
+ return this._writeArrayBuffer(e, n, t);
3668
+ }
3669
+ async write(e, t, n) {
3670
+ return typeof t == "string" || jn(t) ? this._write(e, t, !1, n) : this._write(e, e?.getOrigin?.(), !0, t ?? n);
3671
+ }
3672
+ async writeAs(e, t, n) {
3673
+ if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
3674
+ return this._write(e, t, !0, n);
3675
+ }
3676
+ async _write(e, t, n, r) {
3677
+ if (!e) throw Error("Workbook must be provided.");
3678
+ if (!e.isIWorkbook) throw Error("Invalid workbook model provided. Must be an instance of IWorkbook.");
3679
+ let i, a = typeof t == "string" ? this.getOrigin(t) : t, o = a.getFormat();
3680
+ if ((r?.format || o) && (i = (await this._registry.getWriteFormats({ search: r?.format ?? o ?? void 0 }))[0]), i || a.getPath() && a.canWrite() && a.getExtension() || (i = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !i) throw new s(l("error.io.writeFormatUnresolved"));
3681
+ let c = a.getExtension();
3682
+ if (r?.format && c && a.getPath() && a.canWrite() && !i.exts.includes(c)) {
3683
+ let e = (await this._registry.getWriteFormats({ ext: c }))[0];
3684
+ if (e && e.key !== i.key) {
3685
+ let e = a.getPath().split(/[/\\]/).pop();
3686
+ throw new s(l("error.io.writeFormatMismatch", {
3687
+ format: r.format,
3688
+ file: e
3689
+ }));
3690
+ }
3691
+ }
3692
+ if (typeof t == "string") {
3693
+ let e = a.getPath();
3694
+ a = new B(A(e) ? e : `${e}.${i.exts[0]}`, { format: i.key });
3695
+ }
3696
+ let u = a.getEncryption(), d = e.getOrigin?.(), f = (a instanceof B ? a.getPassword() : null) ?? (d instanceof B ? d.getPassword() : null), p = a.isEncrypted() || (d?.isEncrypted() ?? !1), m = r?.password === void 0 ? f ?? (p ? void 0 : null) : r.password, g = null;
3697
+ if (m === void 0) {
3698
+ if (p) {
3699
+ let e = a.getName();
3700
+ throw new h(e ? l("error.io.passwordRequiredSave", { name: e }) : l("error.io.passwordRequiredSaveUnnamed"));
3701
+ }
3702
+ } else if (m !== null && (g = await this._registry.getEncryption(u), !g)) throw new s(l("error.io.encryptionUnavailable"));
3703
+ let _ = `${a.getName() ?? l("workbook.defaultName")}.${i.exts[0]}`, v = r?.progress, y = !a.getPath() || !a.canWrite() || !!r?.prompt, b = !1, x = this, S = null, C = [], w = {
3704
+ workbook: e,
3705
+ format: i,
3706
+ origin: a,
3707
+ suggestedName: _,
3708
+ prompt: r?.prompt,
3709
+ async encode(t, o) {
3710
+ let s = o ?? a;
3711
+ await (async (e) => {
3712
+ b || (b = !0, v?.onStart && await Promise.resolve(v.onStart(e)));
3713
+ })(s), S = e.getTransactions?.()?.getCurrentCommit() ?? S;
3714
+ let c = t ? (await x._registry.getWriteFormats({ search: t }))[0] ?? i : i, l = [], u = ((e, t) => ({
3715
+ onStart: e?.onStart ? (t, n) => e.onStart(t, n) : void 0,
3716
+ onProgress: e?.onProgress ? (t, n) => e.onProgress(t, n) : void 0,
3717
+ onError: e?.onError ? (t) => e.onError(t) : void 0,
3718
+ onComplete: e?.onComplete ? (t) => e.onComplete(t) : void 0,
3719
+ onWarning: (n, r) => {
3720
+ t.push({
3721
+ message: n ?? "",
3722
+ context: r
3723
+ }), e?.onWarning?.(n, r);
3724
+ }
3725
+ }))(v, l), d = await x._writeArrayBuffer(e, c, {
3726
+ ...r,
3727
+ progress: u
3728
+ }), f = An.get(s);
3729
+ if (l.some((e) => !f?.has(e.message)) && r?.onWarnings) {
3730
+ let t = await Promise.resolve(r.onWarnings({
3731
+ workbook: e,
3732
+ origin: s,
3733
+ warnings: l,
3734
+ save: n,
3735
+ canCancel: !y
3736
+ }));
3737
+ if (!y && !1 === t) return null;
3738
+ }
3739
+ return C = l, g ? g.encode(d, m) : d;
3740
+ }
3741
+ }, T = null;
3742
+ try {
3743
+ let t = this.getBackingStore();
3744
+ if (!t.write) throw Error("The active backing store is read-only (no write implementation).");
3745
+ if (T = await t.write(w), T) {
3746
+ if (m !== void 0 && T instanceof B && (T.setPassword(m), T.update({ encryption: g ? g.key : null })), C.length) {
3747
+ let e = An.get(T) ?? /* @__PURE__ */ new Set();
3748
+ for (let t of C) e.add(t.message);
3749
+ An.set(T, e);
3750
+ }
3751
+ n && T !== e.getOrigin() && _t(e.getOrigin())?.setOrigin(T);
3752
+ let t = S ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
3753
+ this._emitter.notify("onWrite", {
3754
+ params: {
3755
+ workbook: e,
3756
+ origin: T,
3757
+ commitId: t?.getId() ?? null,
3758
+ save: n
3759
+ },
3760
+ transactional: !1
3761
+ });
3762
+ }
3763
+ v?.onComplete && await Promise.resolve(v.onComplete(T));
3764
+ } catch (e) {
3765
+ let t = e instanceof Error ? e : Error(String(e));
3766
+ throw v?.onError && await Promise.resolve(v.onError(t)), v?.onComplete && await Promise.resolve(v.onComplete(null)), t instanceof s ? t : Error(l("error.io.writeFailed", { reason: t.message }), { cause: e });
3767
+ }
3768
+ return T;
3769
+ }
3770
+ _stripExtension(e) {
3771
+ let t = A(e);
3772
+ return t ? e.slice(0, e.length - t.length - 1) : e;
3773
+ }
3774
+ _baseName(e) {
3775
+ if (!e) return null;
3776
+ let t = e.split(/[?#]/)[0], n = t.split(/[/\\]/).pop() ?? t;
3777
+ return this._stripExtension(n) || null;
3778
+ }
3779
+ async _writeArrayBuffer(e, t, n) {
3780
+ if (!t) throw Error("A write format must be provided.");
3781
+ let r = t.handler;
3782
+ if (!r) throw Error(`Unable to resolve a write handler for '${t.key}'.`);
3783
+ return r(e, {
3784
+ ...n,
3785
+ format: t.key
3786
+ });
3787
+ }
3788
+ async _readArrayBuffer(e, t, n) {
3789
+ if (!e) throw Error("ArrayBuffer must be specified.");
3790
+ if (!t) throw Error("format must be specified.");
3791
+ if (e.byteLength === 0) return new Dn(n?.createWorkbookOptions);
3792
+ let r, i = t.handler;
3793
+ if (!i) throw Error(`Unable to resolve a read handler for '${t.key}'.`);
3794
+ try {
3795
+ r = await i(e, n);
3796
+ } catch (e) {
3797
+ throw e instanceof s ? e : new s(l("error.io.readFailed", {
3798
+ format: t.description ?? t.key,
3799
+ reason: e?.message ?? String(e)
3800
+ }), { cause: e });
3801
+ }
3802
+ return await We(), r;
3803
+ }
3804
+ get isIWorkbookIO() {
3805
+ return !0;
3806
+ }
3807
+ }();
3808
+ [
3809
+ ".woff2",
3810
+ ".woff",
3811
+ ".ttf",
3812
+ ".otf",
3813
+ ".ttc",
3814
+ ".otc"
3815
+ ].map((e) => ({
3816
+ suffix: e,
3817
+ place: (e, t) => t ? `${t}/${e}` : e
3818
+ })), hn ||= {}, xn ||= {}, (Sn ||= {}).Type = {
3819
+ Button: "button",
3820
+ CheckBox: "checkBox",
3821
+ OptionButton: "optionButton",
3822
+ ListBox: "listBox",
3823
+ DropDown: "dropDown",
3824
+ ScrollBar: "scrollBar",
3825
+ Spinner: "spinner",
3826
+ GroupBox: "groupBox",
3827
+ Label: "label",
3828
+ EditBox: "editBox",
3829
+ Dialog: "dialog",
3830
+ Unknown: "formControl"
3831
+ }, (Cn ||= {}).DropStyle = {
3832
+ Combo: "combo",
3833
+ ComboEdit: "comboEdit",
3834
+ Simple: "simple"
3835
+ };
3836
+ var Nn = class extends Le {
3837
+ constructor(e) {
3838
+ super(e);
3839
+ }
3840
+ _initializeOptions(e) {
3841
+ return e = {
3842
+ ...e,
3843
+ coords: {
3844
+ colStart: 0,
3845
+ rowStart: 0,
3846
+ colEnd: (e?.size?.width ?? 5) - 1,
3847
+ rowEnd: (e?.size?.height ?? 5) - 1
3848
+ },
3849
+ getRanges: (e) => new Ie(null)
3850
+ }, super._initializeOptions(e);
3851
+ }
3852
+ }, Pn = "0.8.0-beta.12";
3853
+ export { Jt as _, rn as a, Mn as c, G as d, pt as f, Tt as g, Rt as h, kt as i, Pn as l, Bt as m, ft as n, gt as o, an as p, B as r, K as s, Dn as t, Lt as u, Nn as v };