@sheetxl/studio-vanilla 0.8.0-beta.1 → 0.8.0-beta.3

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 (478) hide show
  1. package/browser/cjs/00npLPxW7DhY7cIJ.cjs +5 -0
  2. package/browser/cjs/1gbSV4OYBoEWTygY2.cjs +1 -0
  3. package/browser/cjs/7SCJ4vwRZW4B71kq.cjs +8 -0
  4. package/browser/cjs/9LTjOB1_w-bikScD.cjs +1 -0
  5. package/browser/cjs/AVUt0iNPhRf4R5xb.cjs +1 -0
  6. package/browser/cjs/{aYuNpndpwcZG5eik2.cjs → B2fdTYeKGNugWRgn2.cjs} +2 -2
  7. package/browser/cjs/B4ANcw0mAmhe2Aeb2.cjs +1 -0
  8. package/browser/cjs/B6IXpae7f0J8Ocq62.cjs +1 -0
  9. package/browser/cjs/B6vy56yEA1I3B74O.cjs +1 -0
  10. package/browser/cjs/B7QDcu7uACQA1y3h.cjs +1 -0
  11. package/browser/cjs/B7oyN0rn95Kyes8D2.cjs +1 -0
  12. package/browser/cjs/BArvhvpcrQEcbcyY.cjs +1 -0
  13. package/browser/cjs/{Ci8Uu7_b4lwwRLAD2.cjs → BC3OSmoFNyA52TRp2.cjs} +1 -1
  14. package/browser/cjs/{_H5j4dU7HOBYTawU.cjs → BDmBYZigchoACsQx.cjs} +1 -1
  15. package/browser/cjs/BFmgMQoM5sQsWIxf2.cjs +1 -0
  16. package/browser/cjs/BIN8L9V0hoUwMh64.cjs +1 -0
  17. package/browser/cjs/BPWKnUtyoTrtW567.cjs +1 -0
  18. package/browser/cjs/BcROQ4pvVajDQ1em.cjs +1 -0
  19. package/browser/cjs/BjjAQLiorKWXy3g5.cjs +4 -0
  20. package/browser/cjs/Bncc0oXhFMdj_HuR2.cjs +1 -0
  21. package/browser/cjs/BoRfsJCaLzUHQseD.cjs +1 -0
  22. package/browser/cjs/BqQgEaUREvuFHYoW.cjs +1 -0
  23. package/browser/cjs/{Cm21F18ga8TluA9h.cjs → BtAs67e7WBCglqc5.cjs} +1 -1
  24. package/browser/cjs/BxFSy-hOEbyllj-r2.cjs +22 -0
  25. package/browser/cjs/{CRx1WvmgBjT8WVyB2.cjs → C0g87ndP2zMUbX6f2.cjs} +1 -1
  26. package/browser/cjs/C0xAhPzztP9a24zR.cjs +5 -0
  27. package/browser/cjs/C2SohnuJK8Urc7Fx2.cjs +2 -0
  28. package/browser/cjs/C3scwi-q2KqEM39H.cjs +126 -0
  29. package/browser/cjs/C4cZxb9nRtzTCA402.cjs +1 -0
  30. package/browser/cjs/C9q3zr8iCIoYDrdA2.cjs +1 -0
  31. package/browser/cjs/CBLwtHFYNB1BTpSS.cjs +1 -0
  32. package/browser/cjs/{lEQC21-Sk4lwHy2r2.cjs → CFxueP0tbpmvY1Ip2.cjs} +1 -1
  33. package/browser/cjs/CGtG2pvGgTAnImBg2.cjs +8 -0
  34. package/browser/cjs/CH0vbLpwoyU7oOFk.cjs +11 -0
  35. package/browser/cjs/CKtdmbeMjJ2udO8s.cjs +1 -0
  36. package/browser/cjs/CQ-W9AUNHdts8pmY.cjs +1 -0
  37. package/browser/cjs/CQ5x8oFPDaU6OCJf.cjs +3 -0
  38. package/browser/cjs/CRcv32tHTbGSGtkh2.cjs +1 -0
  39. package/browser/cjs/{DsIHLUKUrSrYhFHl.cjs → CTObzk4r7C71x9Ep2.cjs} +1 -1
  40. package/browser/cjs/CUyKbhM67853Rnt22.cjs +1 -0
  41. package/browser/cjs/CVHRh1RGDSgqfAm4.cjs +2 -0
  42. package/browser/cjs/CVHc_cJddJk7J3Zt.cjs +1 -0
  43. package/browser/cjs/CaJGoNwTL6pAJ6a42.cjs +1 -0
  44. package/browser/cjs/{bGMaev70Zd_NXqLM2.cjs → CcqhH_Ign02tLFbU2.cjs} +1 -1
  45. package/browser/cjs/CdsreHc3A0wBhEy9.cjs +14 -0
  46. package/browser/cjs/CfXcRa4RlFmqU0Op.cjs +1 -0
  47. package/browser/cjs/CgyU8XPzm6O1a93m.cjs +41 -0
  48. package/browser/cjs/CzGNIWwu8KL3tcCO2.cjs +1 -0
  49. package/browser/cjs/D-8QQWC-67PplJdV2.cjs +1 -0
  50. package/browser/cjs/D6XEHfNbKx-9qZye.cjs +32 -0
  51. package/browser/cjs/{a0Z-SXs_N71CtqYb2.cjs → D6YaqporVrSewZpm2.cjs} +1 -1
  52. package/browser/cjs/D6m2M4H6JZaYZ4El2.cjs +1 -0
  53. package/browser/cjs/{DIbdDzNf_3S2RYZN.cjs → D9SdUvJVa64UoGj9.cjs} +1 -1
  54. package/browser/cjs/DCVnwgmc5HuYp_iv2.cjs +1 -0
  55. package/browser/cjs/{EeOVMRq7TuptFKTc2.cjs → DF4l8xrxkcLkgExp.cjs} +1 -1
  56. package/browser/cjs/DNnMGL1ff8hutxSd.cjs +1 -0
  57. package/browser/cjs/{D19RglhKiroWfpQn2.cjs → DOEhH2HGT1Zv0irr2.cjs} +1 -1
  58. package/browser/cjs/DQOt8XSpXyhsrF9N.cjs +93 -0
  59. package/browser/cjs/{CnZfa45XxA-9Jhmp.cjs → DRmo6uoGoqtiVff82.cjs} +1 -1
  60. package/browser/cjs/DSXLVieENYN9qXYl.cjs +1 -0
  61. package/browser/cjs/{BEJFcqVMDMKOvs11.cjs → DUXRl3eYfSwbhAfx.cjs} +1 -1
  62. package/browser/cjs/{B9EI7wviSkHS9ZkH.cjs → DWdUSWl4MXn2-MLU.cjs} +1 -1
  63. package/browser/cjs/DWyoF5GqKXce_GmT2.cjs +3 -0
  64. package/browser/cjs/Df3jw0eHS0X-qFvT.cjs +1 -0
  65. package/browser/cjs/{DiZDRPIgbO3sQ8Vb.cjs → Doiqeo4Qlie45lbl.cjs} +1 -1
  66. package/browser/cjs/Dp2fPEReFhDsI01j.cjs +3 -0
  67. package/browser/cjs/DpFg69dDCPoOK2BY2.cjs +1 -0
  68. package/browser/cjs/{Du4jBiFxRIF1OjD4.cjs → Dtxj9JR14A-uliu52.cjs} +1 -1
  69. package/browser/cjs/{CpJJh4UnFl1_qFui.cjs → Dx7GQ4ALtNG3kshu.cjs} +1 -1
  70. package/browser/cjs/{DG-AY_xO8RKHtEBE.cjs → Dy50BSaRMmRISD2Y.cjs} +1 -2
  71. package/browser/cjs/LD1P-jAXleebK12X.cjs +7 -0
  72. package/browser/cjs/P0AUOlaMi9tyE0vN.cjs +3747 -0
  73. package/browser/cjs/PmwvZPFhqmL4DO58.cjs +1 -0
  74. package/browser/cjs/Qp04O3ALK3M9d3At.cjs +54 -0
  75. package/browser/cjs/SATfdSwNygvlOSKC2.cjs +1 -0
  76. package/browser/cjs/XRCcogT-Iqd3Wv6R2.cjs +1 -0
  77. package/browser/cjs/{BziOCn_XEGT4ynN5.cjs → Z_6RasaVpnIv1MHk.cjs} +1 -1
  78. package/browser/cjs/Zz5dLT_2gLI18Jmx.cjs +7 -0
  79. package/browser/cjs/a4xpA8d_d22-GKos.cjs +1 -0
  80. package/browser/cjs/cexWxRluo6g-NG_u.cjs +1 -0
  81. package/browser/cjs/{C5rQELB0TUeXY6VM.cjs → ge8Wd-0WC6oMuJZR.cjs} +1 -1
  82. package/browser/cjs/iYn00uzmSLl2T0oN2.cjs +1 -0
  83. package/browser/cjs/index.cjs +2 -2
  84. package/browser/cjs/kj_kwD7S9uUbhKiz2.cjs +1 -0
  85. package/browser/cjs/qA_ElZ6f49Un56OC.cjs +1 -0
  86. package/browser/cjs/s2c8Pr4obSACz8Lu2.cjs +1 -0
  87. package/browser/cjs/{hzUo76TXMOBqsI3U2.cjs → uAWsHfi-JD_ZQIT82.cjs} +1 -1
  88. package/browser/cjs/uRXkwHKoe-2HtXuR.cjs +1 -0
  89. package/browser/cjs/{DxQkFYAFNZubVdn22.cjs → y4KFnuCKf8r5oFal2.cjs} +1 -1
  90. package/browser/esm/{CZWIS7FuqNjbheSw.mjs → 2eBMkUK0-HxaCmDY.mjs} +40 -40
  91. package/browser/esm/{DzDwSOBdJh_lx_NM.mjs → 53nnk5W22gJW7Ddx.mjs} +241 -241
  92. package/{cdn/assets/BCZjYGV8AqIZghBH.js → browser/esm/5SHS088DeaZ82qmD2.mjs} +69 -4
  93. package/browser/esm/{B4vYIE3kSPTxCgpf2.mjs → 5shGy9JSRzvoIfDE2.mjs} +6 -6
  94. package/browser/esm/{-vgNEEXiEad4bltZ.mjs → 74Ynqpv5NPbb_8vB.mjs} +15762 -16413
  95. package/browser/esm/B-VKr_KwiWjDeAP5.mjs +3343 -0
  96. package/{cdn/assets/BDkVAo0CDCTE04ZJ.js → browser/esm/B08GCyGdLNiXtb_R.mjs} +1 -1
  97. package/browser/esm/{3y_bCend8tkaewDG2.mjs → B0F5gtNQjANAfRw32.mjs} +19 -27
  98. package/browser/esm/B0gZ5e38MXWbEDS_.mjs +25 -0
  99. package/browser/esm/{D3G3tI3DVCUF3Gdk.mjs → B45vVm2Ma1i2b6_F.mjs} +1 -1
  100. package/browser/esm/B5z-uoALcLY2ABTo.mjs +27 -0
  101. package/{cdn/assets/Bv_96nwOEMHN9Sa0.js → browser/esm/B72sK2NRGAke-aCk2.mjs} +27 -29
  102. package/{cdn/assets/DQ4o4dG7gWbL1X8F.js → browser/esm/B8q1hrKv7LAL4xmM2.mjs} +2 -2
  103. package/{cdn/assets/DIQf1pX-j-dWQu_e.js → browser/esm/BCQJVniXgm81YQ0v2.mjs} +141 -140
  104. package/browser/esm/{CR3jgkduTLczbMjH2.mjs → BCcbek_TFOdgqxXq.mjs} +1 -1
  105. package/browser/esm/{1guzFZp1LHz_FwfL.mjs → BEb3QhWwGW8rErZy.mjs} +1 -1
  106. package/browser/esm/{CU1d8OvDv5TU6fSd.mjs → BGRNyE5ar4c3ggrS.mjs} +465 -366
  107. package/browser/esm/{fJ1McMt7xzRA_lUX.mjs → BHIVjD6BdBS3BAWp.mjs} +15 -15
  108. package/browser/esm/BH_qL-oGqwG-7JKF.mjs +87746 -0
  109. package/browser/esm/BJ26E2DhS1Jz4nUY2.mjs +514 -0
  110. package/browser/esm/BJVcTpMN-u5XhMVE2.mjs +47 -0
  111. package/browser/esm/BNgf4HZDOKYBkvL3.mjs +15495 -0
  112. package/browser/esm/BOMJTicRKnx01hw-.mjs +155 -0
  113. package/browser/esm/{8V-VceXEjpADM8qK2.mjs → BPZxx-OH0wACHLsN2.mjs} +1 -1
  114. package/browser/esm/BQIRHi8T3P5MZtan.mjs +15 -0
  115. package/browser/esm/{Dc0BDcQUGy_WIVFa.mjs → BQhVWbI9uag9iRfX2.mjs} +1 -1
  116. package/{cdn/assets/D_t53-8k73CNpV-p2.js → browser/esm/BSWXx2rKOMPxLLs8.mjs} +88 -72
  117. package/browser/esm/{CJPemkFUzhcAD_qR.mjs → BUjTEjAeByh6MKpn.mjs} +1 -1
  118. package/{cdn/assets/B5ZqqASTcBEV5L9K.js → browser/esm/BUokT-PbfvYzD63f2.mjs} +1 -1
  119. package/browser/esm/BYAZ3XZq8XXkOulw.mjs +758 -0
  120. package/browser/esm/BYPIn5AkddMzMcsa2.mjs +117 -0
  121. package/browser/esm/{CH0of3GZTzHviuQV.mjs → BcPnGFFKCddWgOch.mjs} +1 -1
  122. package/browser/esm/{BCkXtOM3yKocv7L-2.mjs → BgwzL8v2pmR5HJXW.mjs} +1 -1
  123. package/browser/esm/BiomOxscV1M0Uw2n.mjs +37 -0
  124. package/browser/esm/{DTaVECXVrgvC48BE.mjs → Bj42pxe5AuY4bF2e.mjs} +3 -3
  125. package/browser/esm/{DBL3Qp5jyPrFg7KI2.mjs → BmC-_QeQ-53oyorq2.mjs} +1 -1
  126. package/browser/esm/{DW72HwfnJtQxzoGa.mjs → BnHE1Z6WkOfTWheU2.mjs} +2 -2
  127. package/{cdn/assets/BHBJtVTiQByD_y9j2.js → browser/esm/BoWCDK44X4tp02_4.mjs} +2 -2
  128. package/browser/esm/{DVZ_UnchuMRveDG32.mjs → Bq7qy-C7tVkiIaDE2.mjs} +42 -4
  129. package/browser/esm/{Cc5IufffX4N-8QpE.mjs → BrzXFBoYDjcG3ct8.mjs} +3 -3
  130. package/browser/esm/{BOl4FzJRD7MplCU72.mjs → BsY_DyFxoqjRHTv02.mjs} +1 -1
  131. package/{cdn/assets/COA_SZY2x8q6t4BD.js → browser/esm/Bsfof8nD-exhrNwn.mjs} +7 -6
  132. package/browser/esm/BtC6lEbd98TeKGsX2.mjs +298 -0
  133. package/browser/esm/BuoHLVUSwf-mq0hg2.mjs +32 -0
  134. package/browser/esm/{R5bs6kCQSZmsCXz-.mjs → BwbR2Dao5LgLYQgV.mjs} +1 -1
  135. package/browser/esm/ByQakLd0YFwc0Lgl.mjs +91 -0
  136. package/browser/esm/{DuPdSe-EXFTx9dsc2.mjs → C-97pwItkHA3s5rD2.mjs} +16 -16
  137. package/browser/esm/{DMLwXmjo28k_iNEU.mjs → C02og4vKxq9qpIUA.mjs} +1866 -1401
  138. package/{cdn/assets/BykiUmcpDgSRNQI1.js → browser/esm/C0HHZ3XLqp0LgRuW.mjs} +1 -1
  139. package/browser/esm/C213T1hhBphljJTF2.mjs +19 -0
  140. package/browser/esm/{Dnx3_xXfRlD6ECfZ2.mjs → C3A-yJ12PN-CPPnI2.mjs} +5 -5
  141. package/browser/esm/{DQ-0yyFAwoWtxmhV2.mjs → C5Oex2msskTvaCQ92.mjs} +1 -1
  142. package/{cdn/assets/8f9hCbpXTTYEgG31.js → browser/esm/C5u9ds7LUh9JJEbW2.mjs} +2 -2
  143. package/browser/esm/{BVRzmIk5PujkT_Ap.mjs → C6D3gk0GBvvDjawh.mjs} +563 -534
  144. package/browser/esm/{BHmYoIIbNW3GdcqV2.mjs → C7b3GyO7FCiMLeyn.mjs} +1 -1
  145. package/browser/esm/{BqTFwWLbXXJ0Fu-X2.mjs → C8qOmdaHh4WQkzEy.mjs} +2 -2
  146. package/browser/esm/CD44l4eg_lxr7kgn2.mjs +115 -0
  147. package/{cdn/assets/iXWgTu3qpYZHcx1J.js → browser/esm/CDxmuF7Iay8T4cnU.mjs} +963 -946
  148. package/browser/esm/CS38A8yr4eKvdDZm.mjs +159 -0
  149. package/browser/esm/CSu0Md4a1JIZrirV.mjs +3324 -0
  150. package/{cdn/assets/BMRav2VAqEzDSp3r.js → browser/esm/CU1J-I76aVm-KPP6.mjs} +37 -3
  151. package/{cdn/assets/D9-wpGVbTS9rRpxx.js → browser/esm/CVbPAnmNN3TxMkq4.mjs} +1 -1
  152. package/browser/esm/{qG5zdZZAe6mQIJo32.mjs → CXvcyGN4L9iDr1LK2.mjs} +5 -5
  153. package/{cdn/assets/CopfZ7Y1Zn_PDNXK.js → browser/esm/CZN6c8yBDjLVTVpH.mjs} +16 -11
  154. package/{cdn/assets/DOsbSsKsexrBoeXa2.js → browser/esm/C__tNzwz0i7bQrSu2.mjs} +17 -18
  155. package/browser/esm/CcPFyWALYlJWf17T2.mjs +58 -0
  156. package/browser/esm/{47Yv4X226-93If7L.mjs → CcuNkPxT6rqElgbZ2.mjs} +1 -1
  157. package/{cdn/assets/C1ZePT2B182vSnxW.js → browser/esm/Cjbksosgv7NZFNE0.mjs} +1 -1
  158. package/browser/esm/{BD7RxHQgrqy_4tb5.mjs → CjxOVBbWLFeUZza82.mjs} +2 -2
  159. package/browser/esm/CksEMRqAqI-_nekb.mjs +149 -0
  160. package/{cdn/assets/DZDynaLqNeVaDoiH2.js → browser/esm/CnB5AuoIz-49NXD_.mjs} +3 -3
  161. package/{cdn/assets/DRc_Wi5c7WdKHTVN.js → browser/esm/Co06Uf-tv1IuVQhe.mjs} +6 -6
  162. package/browser/esm/{D6SKy2BtcWkhfiA02.mjs → CpzLNwtfx0Zd0OZ0.mjs} +2 -5
  163. package/{cdn/assets/Cbw0JeJURvQyxIoa.js → browser/esm/CwRAK6IVjIYuwofE.mjs} +1 -1
  164. package/{cdn/assets/CtXoSHbCUKMY-tSJ2.js → browser/esm/CyS1VLOdAweeZsMV.mjs} +48 -2
  165. package/browser/esm/CyomJv3_vWy4trRe2.mjs +33 -0
  166. package/browser/esm/{Be4QC65cR8N84rTn.mjs → D-1WiFWkKNPWXppx2.mjs} +1 -1
  167. package/browser/esm/D16eCDM3k1_Fk-MN.mjs +225 -0
  168. package/browser/esm/{DZbR5R1fNikjgqYb.mjs → D3Qv3--VfvVHImXW.mjs} +1 -1
  169. package/{cdn/assets/BJEpPEyFWtLzMIq-2.js → browser/esm/D5j8qMZCamJQ82pi.mjs} +1809 -1038
  170. package/{cdn/assets/CdMv3f8Gyxh8q2RR.js → browser/esm/D718rIGL3d_m1mjm2.mjs} +1 -1
  171. package/browser/esm/{BPv6Pw1hW-sV5Fya.mjs → DAhlDEV6ehTRvrj72.mjs} +1 -1
  172. package/browser/esm/{CEN8dYSpN2oew8HH.mjs → DB_I2ygTnDxYiYyc.mjs} +526 -350
  173. package/browser/esm/{D4VqLbEWag8lTWzC2.mjs → DGde1GUi2j-ZUPJW2.mjs} +121 -94
  174. package/browser/esm/DJUnZsVsvwRT_Onq2.mjs +8 -0
  175. package/browser/esm/{DXWmgQSeh0_HDxZj.mjs → DLgM7RXEEfx33zms.mjs} +4 -4
  176. package/browser/esm/DNxL1aQIN6J2PLV7.mjs +35 -0
  177. package/browser/esm/{BjTf3XA9Swj0ngpH.mjs → DRRx9F2h6V-Q957j.mjs} +2 -2
  178. package/{cdn/assets/hFSDx-LnUOObv-6h.js → browser/esm/DZGMsbIACs9TKYrM2.mjs} +2 -2
  179. package/browser/esm/{DFdU1DsC1lXOrejZ.mjs → Dcpd3kkjvidrDQuN.mjs} +1814 -1737
  180. package/browser/esm/{7rixDGGrR72lXkMV.mjs → DevyWm6bXV7lW2dr.mjs} +97 -54
  181. package/browser/esm/{Gy0CHZTvn4hY-rkx2.mjs → DfIwClWz03Qw38-O.mjs} +1 -1
  182. package/{cdn/assets/CAPgMrAKg07EREFD2.js → browser/esm/Dg7wE0RZdHeJv537.mjs} +1 -1
  183. package/browser/esm/Dj_S0P34nk_fjFoh2.mjs +427 -0
  184. package/browser/esm/DjyzSKZNfvxPmFqi.mjs +3342 -0
  185. package/browser/esm/{9_bymSfTn_rR_v6W.mjs → DlHJ7zkV6AMCtYPP.mjs} +6 -6
  186. package/browser/esm/{B1NoGosH2YQh01g7.mjs → DnLi57ylUOd3DUek.mjs} +6 -6
  187. package/{cdn/assets/BVjXdv_wkL1x_8ZJ2.js → browser/esm/DoAKAH3cmECZGboo2.mjs} +1 -1
  188. package/browser/esm/Dok4MRpMgkcsNzp4.mjs +589 -0
  189. package/browser/esm/{Blc1T4zLkp8bRC_n2.mjs → DpORFFFF3LUx_zsT2.mjs} +22 -22
  190. package/{cdn/assets/DvlpP6sUZ9Qzl9s22.js → browser/esm/Ds5mE3-q83ZhE-2T.mjs} +193 -172
  191. package/browser/esm/Du5dlbWtpboIrJk-2.mjs +394 -0
  192. package/{cdn/assets/Chq4BwbjH0sbIkJN2.js → browser/esm/DuMveAGZv1j1YAwO.mjs} +28 -13
  193. package/browser/esm/{C6CK_4GD9IpxKglV2.mjs → GETgdmj9xZWcFrIC2.mjs} +2391 -2900
  194. package/browser/esm/GJUYPKfNptRZyU9r.mjs +267 -0
  195. package/browser/esm/{vcRSnmAqjwKglEkY.mjs → JDCQtP0lkncrmnpC2.mjs} +2 -2
  196. package/browser/esm/{BceIETi6JJRW6Ss62.mjs → OsRyVy3M_rNtmU472.mjs} +13 -13
  197. package/{cdn/assets/DrUEYcXg6N2D2s1Z.js → browser/esm/OtaDVRqZVyi7IBBa.mjs} +51 -11
  198. package/browser/esm/OyyHiDjohIf4lZX62.mjs +119 -0
  199. package/browser/esm/QEPUcBp4VkPz75h8.mjs +637 -0
  200. package/{cdn/assets/CpnA5TZRkPDt4HnM2.js → browser/esm/R0Xd51SJLUebJwYv.mjs} +2 -2
  201. package/browser/esm/{DMX-ZlC_ljcf7oUN.mjs → S4MMwlNd4kcK3RDU.mjs} +1 -1
  202. package/browser/esm/{CsufM5aF6VTLKDWM.mjs → VaST17rbOSkMsGyn.mjs} +12 -12
  203. package/browser/esm/{DtXC6uPF2LLktqFE.mjs → WfqSQXib2MuH663g.mjs} +2 -2
  204. package/browser/esm/{CG5v2hAwGR5Ptufn.mjs → XuGWliVSRCNi5it12.mjs} +1 -1
  205. package/browser/esm/Z83G4i9Tvq4z2kCB.mjs +87 -0
  206. package/browser/esm/_cZz4ZhEEr54LYNe2.mjs +32 -0
  207. package/browser/esm/{NekeSGoazNCraGNC2.mjs → cDMkMgN5tB-wni7c2.mjs} +15 -15
  208. package/{cdn/assets/Clfp7SznkOrJoQvL.js → browser/esm/efVOgresgMXMdh7J2.mjs} +3 -3
  209. package/{cdn/assets/CGqvy5LwQ4z9J2oD.js → browser/esm/gXemYPUoPvaUd055.mjs} +1 -1
  210. package/browser/esm/index.mjs +6 -6
  211. package/browser/esm/kef_IwcJES4VXcNa2.mjs +238 -0
  212. package/browser/esm/{oYdWyqsKo9ejAdVm.mjs → lfNgkSweNYs6v7g2.mjs} +2 -2
  213. package/browser/esm/{BLcn1kGRsjURZSzk.mjs → lfNgkSweNYs6v7g22.mjs} +2 -2
  214. package/{cdn/assets/EwzqnZl1lTr56hH-.js → browser/esm/mbUWaIl3SJkdbWx02.mjs} +1 -1
  215. package/browser/esm/vDg2R-517z6mPR3B2.mjs +280 -0
  216. package/browser/esm/{CfvrjQGuf7vXiQCB.mjs → vP8Rb-lgzeerBAx4.mjs} +1 -1
  217. package/cdn/assets/0uSu6ChH_CTmXM2q2.js +226 -0
  218. package/{browser/esm/BCZjYGV8AqIZghBH.mjs → cdn/assets/5SHS088DeaZ82qmD.js} +69 -4
  219. package/cdn/assets/8rILuc7bVIGEeb97.js +394 -0
  220. package/cdn/assets/9ra2y9Srlg_Pw7Q32.js +590 -0
  221. package/cdn/assets/B-ylRvlizyArIFrd.js +15496 -0
  222. package/{browser/esm/BDkVAo0CDCTE04ZJ2.mjs → cdn/assets/B08GCyGdLNiXtb_R2.js} +1 -1
  223. package/cdn/assets/B0gZ5e38MXWbEDS_.js +25 -0
  224. package/cdn/assets/{C8mUyjJ26jsHGl_D.js → B15uSTYXbbRVKP0X2.js} +7 -7
  225. package/cdn/assets/{BixsQGDDf3Iv_PtW2.js → B1Lxf24mP-fwn03r2.js} +1866 -1401
  226. package/cdn/assets/{D3G3tI3DVCUF3Gdk2.js → B45vVm2Ma1i2b6_F.js} +1 -1
  227. package/cdn/assets/B63SfOuKJt36aTr_.js +8 -0
  228. package/cdn/assets/B69EK_yDF3V8Rq2r2.js +299 -0
  229. package/{browser/esm/Bv_96nwOEMHN9Sa02.mjs → cdn/assets/B72sK2NRGAke-aCk.js} +27 -29
  230. package/cdn/assets/{DW7JlG-SQEdLYNar2.js → B7SJVFUHxy16UJRA.js} +41 -3
  231. package/{browser/esm/DQ4o4dG7gWbL1X8F2.mjs → cdn/assets/B8q1hrKv7LAL4xmM.js} +2 -2
  232. package/cdn/assets/{DVS_5oDniuAFH3vT2.js → BAbRLjxqebqVPyto2.js} +2451 -2960
  233. package/cdn/assets/BCOGONuWSq4hgADu.js +4426 -0
  234. package/cdn/assets/{CR3jgkduTLczbMjH.js → BCcbek_TFOdgqxXq2.js} +1 -1
  235. package/cdn/assets/{1guzFZp1LHz_FwfL2.js → BEb3QhWwGW8rErZy2.js} +1 -1
  236. package/cdn/assets/BHpE1nCbJEbRdzIG2.js +118 -0
  237. package/cdn/assets/BJVcTpMN-u5XhMVE.js +47 -0
  238. package/cdn/assets/{B55nrhIK6gAAu4ZA.js → BLpNuslYLGia3h9t2.js} +2 -2
  239. package/cdn/assets/{8V-VceXEjpADM8qK.js → BPZxx-OH0wACHLsN.js} +1 -1
  240. package/cdn/assets/BQIRHi8T3P5MZtan2.js +15 -0
  241. package/cdn/assets/{Dc0BDcQUGy_WIVFa.js → BQhVWbI9uag9iRfX.js} +1 -1
  242. package/{browser/esm/D_t53-8k73CNpV-p.mjs → cdn/assets/BSWXx2rKOMPxLLs82.js} +88 -72
  243. package/cdn/assets/{CBuvbUg67ah_3BOZ.js → BUeKY15yUtNX2nYg.js} +2 -2
  244. package/cdn/assets/{CJPemkFUzhcAD_qR.js → BUjTEjAeByh6MKpn.js} +1 -1
  245. package/{browser/esm/B5ZqqASTcBEV5L9K2.mjs → cdn/assets/BUokT-PbfvYzD63f.js} +1 -1
  246. package/cdn/assets/BWbSIhQVBaXJNFgl.js +3324 -0
  247. package/cdn/assets/{tVOVNvOs6ro8FXqa2.js → BZDRat2zTkUEg9cR.js} +16 -16
  248. package/cdn/assets/{c6VvwMHfXubjjtyj.js → BeFqINcF0gIgBnB1.js} +16 -16
  249. package/cdn/assets/{DJwQ9abZkyFO9Doy.js → Beyy1fJJeov2iYL4.js} +4 -4
  250. package/cdn/assets/{BCkXtOM3yKocv7L-.js → BgwzL8v2pmR5HJXW2.js} +1 -1
  251. package/cdn/assets/BiomOxscV1M0Uw2n.js +37 -0
  252. package/cdn/assets/{DBL3Qp5jyPrFg7KI.js → BmC-_QeQ-53oyorq.js} +1 -1
  253. package/{browser/esm/BHBJtVTiQByD_y9j.mjs → cdn/assets/BoWCDK44X4tp02_42.js} +2 -2
  254. package/cdn/assets/{BOl4FzJRD7MplCU7.js → BsY_DyFxoqjRHTv0.js} +1 -1
  255. package/{browser/esm/COA_SZY2x8q6t4BD.mjs → cdn/assets/Bsfof8nD-exhrNwn.js} +7 -6
  256. package/cdn/assets/{BzUU8y1IFjREzgog2.js → BsiuCRJjX2LRrDF22.js} +20 -28
  257. package/cdn/assets/BuPGWNRZMMyn4fm8.js +268 -0
  258. package/cdn/assets/Bub12rk6wWVZVNx62.js +496 -0
  259. package/cdn/assets/BuoHLVUSwf-mq0hg.js +32 -0
  260. package/cdn/assets/{DbEGszSW_J_k96KJ.js → ButSau4Lf36Oe3GD.js} +2 -2
  261. package/cdn/assets/{R5bs6kCQSZmsCXz-2.js → BwbR2Dao5LgLYQgV2.js} +1 -1
  262. package/{browser/esm/B0HA_dHcr0kKfudQ.mjs → cdn/assets/C-F-eIvIRbCAMD662.js} +194 -171
  263. package/cdn/assets/{BhDLR-jtbOOG-tl12.js → C-KWjRT0CUb-bkvj2.js} +8 -8
  264. package/{browser/esm/BykiUmcpDgSRNQI12.mjs → cdn/assets/C0HHZ3XLqp0LgRuW2.js} +1 -1
  265. package/cdn/assets/C213T1hhBphljJTF.js +19 -0
  266. package/cdn/assets/{Dnx3_xXfRlD6ECfZ.js → C3A-yJ12PN-CPPnI.js} +5 -5
  267. package/cdn/assets/C4vZWmW5DZLQTTAx.js +758 -0
  268. package/cdn/assets/{DQ-0yyFAwoWtxmhV2.js → C5Oex2msskTvaCQ9.js} +1 -1
  269. package/{browser/esm/8f9hCbpXTTYEgG312.mjs → cdn/assets/C5u9ds7LUh9JJEbW.js} +2 -2
  270. package/cdn/assets/{BHmYoIIbNW3GdcqV.js → C7b3GyO7FCiMLeyn2.js} +1 -1
  271. package/cdn/assets/C8W7e-O1V1Mo2HOp.js +35 -0
  272. package/cdn/assets/{BqTFwWLbXXJ0Fu-X.js → C8qOmdaHh4WQkzEy.js} +2 -2
  273. package/cdn/assets/{Ce5A_D4YBgi_s2KF.js → CEyEKBYpjE5GGcmE.js} +13 -13
  274. package/{browser/esm/Dg5wjQp0fArKXlM3.mjs → cdn/assets/CJoCbCtXkTbj6-nC.js} +16 -11
  275. package/cdn/assets/{j8nXVEYbO2kPuEYQ.js → CLEhV4ZVh2Jf4WLI.js} +3 -3
  276. package/{browser/esm/BMRav2VAqEzDSp3r2.mjs → cdn/assets/CU1J-I76aVm-KPP6.js} +37 -3
  277. package/{browser/esm/D9-wpGVbTS9rRpxx.mjs → cdn/assets/CVbPAnmNN3TxMkq4.js} +1 -1
  278. package/cdn/assets/{2CuCH0wi9XPgVzE42.js → CWIp4JC2SCM6lg-s.js} +11 -9
  279. package/cdn/assets/{BKEzd89UphJ8q1pp2.js → CXKguOBpJrsoXPTQ.js} +485 -386
  280. package/cdn/assets/CXgMJ_MuMQRu0isj2.js +159 -0
  281. package/cdn/assets/{qG5zdZZAe6mQIJo3.js → CXvcyGN4L9iDr1LK.js} +5 -5
  282. package/cdn/assets/{DnzDlqizzNkbhJP7.js → CYFmWcVbnUCDPJ8m.js} +2 -2
  283. package/cdn/assets/{CF8m5SqeMaRkGIYM.js → C_W3L9-im26Qc-Ub.js} +2 -2
  284. package/cdn/assets/Cb7x4GW2rRvj_q2Z.js +87 -0
  285. package/cdn/assets/CcOMQhQN8PPKQulw2.js +428 -0
  286. package/cdn/assets/CcPFyWALYlJWf17T.js +58 -0
  287. package/{browser/esm/Bl6bX86tSq8hfyb2.mjs → cdn/assets/CcXDdl0SsmyEFtmU.js} +965 -944
  288. package/cdn/assets/{47Yv4X226-93If7L2.js → CcuNkPxT6rqElgbZ.js} +1 -1
  289. package/cdn/assets/CdDTtABobc5txUF6.js +149 -0
  290. package/cdn/assets/CdTHBpWoW1Fu4Dg_.js +27 -0
  291. package/cdn/assets/{CT3G9YRPVfKtHWwf2.js → Cdm7E0sw56lpdqRU2.js} +17 -17
  292. package/cdn/assets/{mtrwY1hjJeYlmzC-.js → Cf-bndowUtxZ6tmG.js} +3 -3
  293. package/cdn/assets/{DaBczM5xU9ev5_or.js → CiTCEuoCSDCy9khR.js} +2 -2
  294. package/{browser/esm/C1ZePT2B182vSnxW2.mjs → cdn/assets/Cjbksosgv7NZFNE02.js} +1 -1
  295. package/cdn/assets/{DvItgGbf8IOWPyxd.js → CmRLwDXiK3woZrVI.js} +15461 -16112
  296. package/{browser/esm/DRc_Wi5c7WdKHTVN2.mjs → cdn/assets/Co06Uf-tv1IuVQhe.js} +6 -6
  297. package/cdn/assets/Cpkl0peJbfEXl6ta2.js +239 -0
  298. package/cdn/assets/{D6SKy2BtcWkhfiA0.js → CpzLNwtfx0Zd0OZ02.js} +2 -5
  299. package/cdn/assets/{CpYlf4dXa_V2v-iS2.js → CukMw9Sc4iO21aRQ2.js} +1109 -955
  300. package/cdn/assets/{EjOJX5m8OEL-IjPB.js → CwGEi_5ErUTrkWRj.js} +7 -7
  301. package/{browser/esm/Cbw0JeJURvQyxIoa.mjs → cdn/assets/CwRAK6IVjIYuwofE2.js} +1 -1
  302. package/cdn/assets/{-2S675KWulPRlVNb2.js → Cx1HsOCOdZoKJDEN2.js} +14 -14
  303. package/{browser/esm/BqwvP0318zI2izeL2.mjs → cdn/assets/Cy6Cst4s2vE_WWKK2.js} +27 -26
  304. package/{browser/esm/CtXoSHbCUKMY-tSJ.mjs → cdn/assets/CyS1VLOdAweeZsMV2.js} +48 -2
  305. package/cdn/assets/CyomJv3_vWy4trRe.js +33 -0
  306. package/cdn/assets/{Be4QC65cR8N84rTn2.js → D-1WiFWkKNPWXppx.js} +1 -1
  307. package/cdn/assets/{DZbR5R1fNikjgqYb.js → D3Qv3--VfvVHImXW.js} +1 -1
  308. package/cdn/assets/D6B6VvRh1cfT2e-M2.js +116 -0
  309. package/{browser/esm/CdMv3f8Gyxh8q2RR2.mjs → cdn/assets/D718rIGL3d_m1mjm.js} +1 -1
  310. package/cdn/assets/D7WMzCfJnKIfTbdg.js +280 -0
  311. package/cdn/assets/{C_Io1QC4CeLGRBrz.js → D8sc6gCXnfpn7W79.js} +2 -2
  312. package/cdn/assets/DA4QV7VUyNUEfx1k2.js +156 -0
  313. package/cdn/assets/{BPv6Pw1hW-sV5Fya.js → DAhlDEV6ehTRvrj7.js} +1 -1
  314. package/cdn/assets/{gspQcUnmlRIwG609.js → DBKHpCvbeQU-Y4eS2.js} +5 -5
  315. package/cdn/assets/{CEN8dYSpN2oew8HH2.js → DB_I2ygTnDxYiYyc2.js} +526 -350
  316. package/cdn/assets/{DLEdaT0MmrOxMa2h2.js → DKwpjlUd2pFOI9yp2.js} +64 -64
  317. package/cdn/assets/{BNybEGR813e3aNIv.js → DW3_Jr-4VdZZqNEg.js} +1817 -1740
  318. package/{browser/esm/hFSDx-LnUOObv-6h2.mjs → cdn/assets/DZGMsbIACs9TKYrM.js} +2 -2
  319. package/cdn/assets/{Gy0CHZTvn4hY-rkx.js → DfIwClWz03Qw38-O2.js} +1 -1
  320. package/{browser/esm/CAPgMrAKg07EREFD.mjs → cdn/assets/Dg7wE0RZdHeJv5372.js} +1 -1
  321. package/{browser/esm/BVjXdv_wkL1x_8ZJ2.mjs → cdn/assets/DoAKAH3cmECZGboo2.js} +1 -1
  322. package/cdn/assets/FAaqx6EbN4JxNuNL2.js +87746 -0
  323. package/{browser/esm/CPUlpDM6aAzZzCat2.mjs → cdn/assets/FHIg3Yb5Rn05W1F22.js} +142 -139
  324. package/{browser/esm/CQM87ZBN7Yzn4Yxr.mjs → cdn/assets/FbLFNYdTqRtQ7QiS.js} +9 -9
  325. package/cdn/assets/{vcRSnmAqjwKglEkY2.js → JDCQtP0lkncrmnpC.js} +2 -2
  326. package/cdn/assets/{D-fJXasEYyfRUcj2.js → KOiR-1SNAX7AiEes.js} +3 -3
  327. package/cdn/assets/KS5XJUWdKvEezJfs2.js +264 -0
  328. package/{browser/esm/B4iT_CduJeJunwBc.mjs → cdn/assets/OTQWLENoZ1cSiDQb2.js} +28 -13
  329. package/{browser/esm/DrUEYcXg6N2D2s1Z2.mjs → cdn/assets/OtaDVRqZVyi7IBBa2.js} +51 -11
  330. package/cdn/assets/OyyHiDjohIf4lZX6.js +119 -0
  331. package/cdn/assets/{DKeLjEJPO9nT3bpr.js → PLFw1pLjdLQLrlB0.js} +242 -242
  332. package/cdn/assets/S4MMwlNd4kcK3RDU.js +24 -0
  333. package/cdn/assets/S4MMwlNd4kcK3RDU2.js +24 -0
  334. package/cdn/assets/{CG5v2hAwGR5Ptufn2.js → XuGWliVSRCNi5it1.js} +1 -1
  335. package/cdn/assets/_cZz4ZhEEr54LYNe.js +32 -0
  336. package/cdn/assets/{DCnA2-zB7W_QB-tD2.js → bQ6G23JQrt4l2Ls92.js} +566 -537
  337. package/{browser/esm/Clfp7SznkOrJoQvL.mjs → cdn/assets/efVOgresgMXMdh7J.js} +3 -3
  338. package/{browser/esm/CGqvy5LwQ4z9J2oD2.mjs → cdn/assets/gXemYPUoPvaUd055.js} +1 -1
  339. package/cdn/assets/{UYgwKnPX3US3Cj2k2.js → hHkEq7qn0rj2XKD82.js} +75 -48
  340. package/cdn/assets/{D1MA2ed2cLMt7hV9.js → hqW1sMr576y2S1qX.js} +41 -41
  341. package/cdn/assets/mI8tvfP8ed2Zerre.js +3344 -0
  342. package/{browser/esm/EwzqnZl1lTr56hH-2.mjs → cdn/assets/mbUWaIl3SJkdbWx0.js} +1 -1
  343. package/{browser/esm/RW23HF8taEtW8q9D.mjs → cdn/assets/n_NkstgVVwl2iAnp.js} +2 -2
  344. package/cdn/assets/ryzcqI-93l1HBuTe2.js +91 -0
  345. package/cdn/assets/{CfvrjQGuf7vXiQCB2.js → vP8Rb-lgzeerBAx42.js} +1 -1
  346. package/cdn/assets/{CHttngK66Ido5dWW.js → w65zHFqjAp_NlbXg2.js} +7 -7
  347. package/cdn/index.js +2 -2
  348. package/package.json +3 -3
  349. package/browser/cjs/2zXD3NPfuQT2KSZq.cjs +0 -7
  350. package/browser/cjs/49_x589Na12sizKK.cjs +0 -1
  351. package/browser/cjs/B19QM3SGmPKKwD_o.cjs +0 -1
  352. package/browser/cjs/B4JJfKSI4ppwU8552.cjs +0 -1
  353. package/browser/cjs/B5YBx0GqLor3i0O1.cjs +0 -1
  354. package/browser/cjs/BC2gCQkR1iykfAuC.cjs +0 -1
  355. package/browser/cjs/BEVqcFGFU6Ri9y8T.cjs +0 -5
  356. package/browser/cjs/BEzaum_kgG4yAOx0.cjs +0 -1
  357. package/browser/cjs/BF-38Z7Z0FZOPl192.cjs +0 -1
  358. package/browser/cjs/BIQZDBQfv3Qm5iC8.cjs +0 -4
  359. package/browser/cjs/BSCgCfORdZz1Ii5S.cjs +0 -2
  360. package/browser/cjs/BZr-IqNS1skh1hr6.cjs +0 -21
  361. package/browser/cjs/BfzzZ9IR27ZPzj-8.cjs +0 -3
  362. package/browser/cjs/Bgke3PtMSF2Iaen4.cjs +0 -1
  363. package/browser/cjs/BnccBYHCCq9TGFx4.cjs +0 -8
  364. package/browser/cjs/BwLx9ix5Sq7suAYP2.cjs +0 -1
  365. package/browser/cjs/C-HOJozu5NgCil1q.cjs +0 -1
  366. package/browser/cjs/C2oTW2DjZypuqq7x.cjs +0 -1
  367. package/browser/cjs/C6yxQPAEgcGWAhYR.cjs +0 -33
  368. package/browser/cjs/C9C-pr-T_ThweQX92.cjs +0 -1
  369. package/browser/cjs/CPgCih_KEqnUZ9Rv.cjs +0 -3
  370. package/browser/cjs/CSNCOmYEOR-iTJ7K.cjs +0 -5
  371. package/browser/cjs/C_7w8EJZpHw8ueuq.cjs +0 -1
  372. package/browser/cjs/C_IEgjM-hSJCv6Gm.cjs +0 -1
  373. package/browser/cjs/CcneNtiqtKppCa-p.cjs +0 -57
  374. package/browser/cjs/CeF0DZ-k4DB8M47I.cjs +0 -1
  375. package/browser/cjs/Clu7XiAsCB48GDXN2.cjs +0 -1
  376. package/browser/cjs/CojEXZgX08waZOoq.cjs +0 -1
  377. package/browser/cjs/CrDTTLE9EvaGDSD4.cjs +0 -88
  378. package/browser/cjs/Cty5pi0fwToP1GWe.cjs +0 -7
  379. package/browser/cjs/CvV18ZJgssoHMkdf2.cjs +0 -2
  380. package/browser/cjs/Cy-4IMt-AbR-ifP3.cjs +0 -126
  381. package/browser/cjs/CyGzzWYDy-IniKCq2.cjs +0 -7
  382. package/browser/cjs/CzgwTfy2072Dmt5u.cjs +0 -1
  383. package/browser/cjs/DCIlWcGDrp-5PDoA.cjs +0 -1
  384. package/browser/cjs/DFHxNnJ-lHtv0hIq.cjs +0 -1
  385. package/browser/cjs/DH3WXPfGHwWJW0nH.cjs +0 -1
  386. package/browser/cjs/DNCC-QNp2I7saV-I.cjs +0 -1
  387. package/browser/cjs/DNy-UU3NKNqQQngF.cjs +0 -1
  388. package/browser/cjs/DPjEO7dwhCFd8DHR2.cjs +0 -2
  389. package/browser/cjs/DfMJOaJ0GcUiSn4Q.cjs +0 -1
  390. package/browser/cjs/DsFZgtSQpC75d1M02.cjs +0 -1
  391. package/browser/cjs/DvSvfeo9V0Abfd3q2.cjs +0 -1
  392. package/browser/cjs/E-IqDztfMb_xdszH.cjs +0 -1
  393. package/browser/cjs/ElcoSB--cCpS6i7R2.cjs +0 -1
  394. package/browser/cjs/KNCocKN9uPR0tvUS.cjs +0 -1
  395. package/browser/cjs/Kr8f1inOTt-MICaP2.cjs +0 -1
  396. package/browser/cjs/Kvn916ebqGc4t6hv2.cjs +0 -1
  397. package/browser/cjs/PM3PrEWG3WHKxaDx.cjs +0 -1
  398. package/browser/cjs/YG320hBA20Dl3HoU2.cjs +0 -1
  399. package/browser/cjs/bIaGoYEDSBCrAaB6.cjs +0 -1
  400. package/browser/cjs/fqTQ_p3ehzUvc1tF2.cjs +0 -1
  401. package/browser/cjs/h3dw1jAp2J5Pu4p32.cjs +0 -1
  402. package/browser/cjs/i2VboqjlOcozI9MQ.cjs +0 -12
  403. package/browser/cjs/jev6VGWTdgEgm4Yk2.cjs +0 -1
  404. package/browser/cjs/ppSJKdLn646BZOzg.cjs +0 -1
  405. package/browser/cjs/xBcvszV6x7ys-m532.cjs +0 -1
  406. package/browser/esm/At60x9FEPePwPP_J.mjs +0 -51151
  407. package/browser/esm/B4h6iO7hQ9lCR7kj.mjs +0 -11273
  408. package/browser/esm/BBtOlJMVlsWorNJH.mjs +0 -824
  409. package/browser/esm/BQDXkeSabbxB5DUB2.mjs +0 -47
  410. package/browser/esm/BUCKq_2lHPd1ndvw.mjs +0 -149
  411. package/browser/esm/BX4f6i2WMBMKFVCq.mjs +0 -99
  412. package/browser/esm/BZsx0QHg1RZlM9ZN.mjs +0 -15
  413. package/browser/esm/BhxX7CZWSOlV2Dsz.mjs +0 -224
  414. package/browser/esm/BhzLZRz2N8RxjQ_U.mjs +0 -34
  415. package/browser/esm/BkSb_vyWe-AhyEDa.mjs +0 -4423
  416. package/browser/esm/Bp9qFBIcpIGXvMgo.mjs +0 -134
  417. package/browser/esm/C0rS1uBqfsj-gPR8.mjs +0 -152
  418. package/browser/esm/CGGJWgWSPZ0aP_C3.mjs +0 -87
  419. package/browser/esm/CGyydD3tRb0ik50l2.mjs +0 -20
  420. package/browser/esm/CY1zykikO58_ADk8.mjs +0 -3188
  421. package/browser/esm/Cb-FUOYcyRSkHG6u2.mjs +0 -238
  422. package/browser/esm/Cd8HXAJlflkkTXxc.mjs +0 -53
  423. package/browser/esm/CfuhUkrvOq11d9FR.mjs +0 -44
  424. package/browser/esm/Ckl3FLCOeqw7yhkP2.mjs +0 -82
  425. package/browser/esm/CpjX81WsWJbXMUoT.mjs +0 -3655
  426. package/browser/esm/DDOO4tcrO4OfMUDe.mjs +0 -25
  427. package/browser/esm/DDUYQ8FPeh1TJU24.mjs +0 -538
  428. package/browser/esm/DVJd6McdAG5udItH.mjs +0 -27
  429. package/browser/esm/DVQNQmjI2PKkwiOw2.mjs +0 -514
  430. package/browser/esm/D_zNx76HGunFi7xJ.mjs +0 -509
  431. package/browser/esm/DfRGH6mEtIVDWEYN2.mjs +0 -304
  432. package/browser/esm/DnuaqN0xfgqzl8qG.mjs +0 -2687
  433. package/browser/esm/nguMxPB9LKexKBRX.mjs +0 -219
  434. package/browser/esm/qzhFT2j-mpQEQnKs.mjs +0 -16386
  435. package/cdn/assets/2UHIeioUPXrwtZy-2.js +0 -83
  436. package/cdn/assets/BAhvL7M7ZcgZ8eDc2.js +0 -48
  437. package/cdn/assets/BM7OqAUEUk-up7_82.js +0 -134
  438. package/cdn/assets/BNuoKAzs4zkxSocG2.js +0 -44
  439. package/cdn/assets/BU6uQhQhpaLElTT82.js +0 -225
  440. package/cdn/assets/BVgTMDEoPgsWFmku.js +0 -510
  441. package/cdn/assets/BWlMK76Aj2d4ygsH.js +0 -538
  442. package/cdn/assets/BZsx0QHg1RZlM9ZN2.js +0 -15
  443. package/cdn/assets/Bl6C6xWT8E6b7OwJ2.js +0 -239
  444. package/cdn/assets/CGyydD3tRb0ik50l.js +0 -20
  445. package/cdn/assets/CH0of3GZTzHviuQV.js +0 -24
  446. package/cdn/assets/CH0of3GZTzHviuQV2.js +0 -24
  447. package/cdn/assets/Crkvq5j5KIa6eTLI2.js +0 -51151
  448. package/cdn/assets/Cv-KXN9kl0UeMezQ.js +0 -824
  449. package/cdn/assets/CvtkpvGzCHhNuwTm.js +0 -16386
  450. package/cdn/assets/D9gETGi23d14kT7u2.js +0 -99
  451. package/cdn/assets/D9joTG0Z2zdWHAEa2.js +0 -4423
  452. package/cdn/assets/DC9obE_EVmxtvXCf.js +0 -11275
  453. package/cdn/assets/DDNivpFWzQ3AIJia.js +0 -2687
  454. package/cdn/assets/DDOO4tcrO4OfMUDe.js +0 -25
  455. package/cdn/assets/DEUY_zuVwmptMX4l.js +0 -150
  456. package/cdn/assets/DTCtbG90ip7Z7LaG.js +0 -220
  457. package/cdn/assets/D_HeH7AJqWoxehn52.js +0 -53
  458. package/cdn/assets/DfRGH6mEtIVDWEYN.js +0 -304
  459. package/cdn/assets/WLUhtyUNK5QJ7Pff.js +0 -34
  460. package/cdn/assets/c7aIqKLOO4pvUsV12.js +0 -220
  461. package/cdn/assets/mtI43hWjdp4E3Z_-.js +0 -152
  462. package/cdn/assets/nmR_PgTW7GrlbHHZ.js +0 -27
  463. package/cdn/assets/vTCuFafvRlSaT9wy.js +0 -87
  464. /package/browser/cjs/{1XrWGMP3GmsQOMIX2.cjs → 1XrWGMP3GmsQOMIX.cjs} +0 -0
  465. /package/browser/cjs/{4nReftSsKWmnRdtf2.cjs → 4nReftSsKWmnRdtf.cjs} +0 -0
  466. /package/browser/cjs/{507hQYooKKjnRzsZ2.cjs → 507hQYooKKjnRzsZ.cjs} +0 -0
  467. /package/browser/cjs/{BAxVLKkxFgI6cXnR.cjs → BAxVLKkxFgI6cXnR2.cjs} +0 -0
  468. /package/browser/cjs/{C2uDl8VIJqh58YF_.cjs → C2uDl8VIJqh58YF_2.cjs} +0 -0
  469. /package/browser/cjs/{CV4KQsHluMqo1I2Q.cjs → CV4KQsHluMqo1I2Q2.cjs} +0 -0
  470. /package/browser/cjs/{CXlzsh_WHCOsErJ12.cjs → CXlzsh_WHCOsErJ1.cjs} +0 -0
  471. /package/browser/cjs/{D8-KovdJ0LjxqCe2.cjs → D8-KovdJ0LjxqCe22.cjs} +0 -0
  472. /package/browser/cjs/{DDnGLOLTqLFsdUDS2.cjs → DDnGLOLTqLFsdUDS.cjs} +0 -0
  473. /package/browser/cjs/{DM7-R_ltoLbA9jde2.cjs → DM7-R_ltoLbA9jde.cjs} +0 -0
  474. /package/browser/cjs/{DNKyaSruDogoBd2H2.cjs → DNKyaSruDogoBd2H.cjs} +0 -0
  475. /package/browser/cjs/{Dx79LP1-YCQg8B87.cjs → Dx79LP1-YCQg8B872.cjs} +0 -0
  476. /package/browser/cjs/{JfM6P_qoQQTWakZf.cjs → JfM6P_qoQQTWakZf2.cjs} +0 -0
  477. /package/browser/cjs/{CbLXP9WY38wTcGn5.cjs → NcNz8RfT5V889CMT2.cjs} +0 -0
  478. /package/browser/cjs/{z_rZE1OHFPpdGBh42.cjs → z_rZE1OHFPpdGBh4.cjs} +0 -0
@@ -1,3188 +0,0 @@
1
- /**
2
- * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.8.0-beta.1
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 { A as e, C as t, F as n, O as r, P as i, T as a, V as o, _ as s, d as c, l, m as u, r as d, s as f, t as p, v as m } from "./CEN8dYSpN2oew8HH.mjs";
8
- import { r as h } from "./CH0of3GZTzHviuQV.mjs";
9
- import { o as g, t as _ } from "./D_t53-8k73CNpV-p.mjs";
10
- import { $ as v, $t as y, A as b, At as x, C as S, Ct as C, Dt as w, Et as T, F as ee, Ft as te, Gt as ne, Ht as re, J as ie, K as ae, L as oe, Lt as se, Mt as E, Nt as D, O, Pt as ce, Q as k, Qt as le, R as ue, Rt as A, St as de, Tt as fe, Ut as pe, V as j, W as me, X as he, Y as ge, Yt as _e, Z as M, Zt as ve, _t as N, at as ye, bt as be, c as xe, ct as Se, dn as P, dt as Ce, f as F, fn as I, gt as we, h as Te, i as Ee, in as L, k as De, ln as Oe, lt as ke, mt as Ae, n as je, nt as Me, on as Ne, ot as Pe, pn as Fe, rn as Ie, sn as Le, ut as Re, vt as ze, w as R, xt as Be, y as Ve, yt as He, zt as Ue } from "./At60x9FEPePwPP_J.mjs";
11
- import { r as We } from "./BkSb_vyWe-AhyEDa.mjs";
12
- var Ge;
13
- Ge ||= {};
14
- var Ke = class extends u {
15
- constructor(e, t = 50) {
16
- super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
17
- }
18
- _undoCommits(e = this.maxStack) {
19
- let t = this._transactions;
20
- if (!t) return [];
21
- let n = t.getLog(t.getCurrentCommit(!1).getId(), 2 ** 53 - 1), r = [];
22
- for (let t = 0; t < n.length && r.length < e; t++) {
23
- let e = n[t];
24
- if (e.getId() === this._floorId || t === n.length - 1) break;
25
- e.getDescription() && r.push(e);
26
- }
27
- return r;
28
- }
29
- _redoCommits(e = this.maxStack) {
30
- let t = this._transactions;
31
- if (!t) return [];
32
- let n = t.getCurrentCommit(!1).getId(), r = t.getTipCommit().getId();
33
- if (r === n) return [];
34
- let i = t.getLog(r, 2 ** 53 - 1), a = [], o = !1;
35
- for (let e of i) {
36
- if (e.getId() === n) {
37
- o = !0;
38
- break;
39
- }
40
- a.push(e);
41
- }
42
- if (!o) return [];
43
- a.reverse();
44
- let s = [];
45
- for (let t of a) if (t.getDescription() && s.push(t), s.length >= e) break;
46
- return s;
47
- }
48
- undo(e = 1) {
49
- let t = this._transactions;
50
- if (!t) return;
51
- let n = !1;
52
- try {
53
- for (let r = 0; r < e; r++) {
54
- let [e] = this._undoCommits(1);
55
- if (!e) break;
56
- t.revert(e.getId()), n = !0;
57
- }
58
- } finally {
59
- n && this._notifyOnStackChange();
60
- }
61
- }
62
- redo(e = 1) {
63
- let t = this._transactions;
64
- if (!t) return;
65
- let n = !1;
66
- try {
67
- for (let r = 0; r < e; r++) {
68
- let [e] = this._redoCommits(1);
69
- if (!e) {
70
- r === 0 && this._repeatOperation?.repeat();
71
- break;
72
- }
73
- t.restore(e.getId()), n = !0;
74
- }
75
- } finally {
76
- n && this._notifyOnStackChange();
77
- }
78
- }
79
- hasUndo() {
80
- return this._undoCommits(1).length > 0;
81
- }
82
- hasRedo() {
83
- return this._redoCommits(1).length > 0 || this._repeatOperation !== null;
84
- }
85
- getTopUndoDescription() {
86
- return this._undoCommits(1)[0]?.getDescription() ?? null;
87
- }
88
- getTopRedoDescription() {
89
- return this._repeatOperation === null ? this._redoCommits(1)[0]?.getDescription() ?? null : this._repeatOperation.description;
90
- }
91
- getUndoDescriptions() {
92
- return this._undoCommits().map((e) => e.getDescription());
93
- }
94
- getRedoDescriptions() {
95
- let e = this._redoCommits().map((e) => e.getDescription());
96
- return e.length === 0 && this._repeatOperation !== null && e.push(this._repeatOperation.description), Object.freeze(e);
97
- }
98
- addUndoOperation() {
99
- throw Error("TransactionUndoManager derives its stack from the commit log; commit a described transaction instead.");
100
- }
101
- clear(e = !0) {
102
- this._transactions && (this._floorId = this._transactions.getCurrentCommit(!1).getId()), super.clear(e);
103
- }
104
- close() {
105
- this._removeListener?.();
106
- }
107
- }, qe = class {
108
- constructor(e, t) {
109
- this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new x(this);
110
- let n = this;
111
- this._removeStoreListener = e.addListener({
112
- onCommitEnd() {
113
- n._recompute();
114
- },
115
- onCommitChange() {
116
- n._recompute();
117
- }
118
- }), this._removeCommitListener = t?.addCommitListener({ onCommit(e) {
119
- e.store === n._store && n.markSaved(e.commitId);
120
- } });
121
- }
122
- getStore() {
123
- return this._store;
124
- }
125
- isDirty() {
126
- return (this._store.getCurrentCommit()?.getId() ?? null) !== this._savedCommitId;
127
- }
128
- getSavedCommitId() {
129
- return this._savedCommitId;
130
- }
131
- markSaved(e = this._store.getCurrentCommit()?.getId() ?? null) {
132
- e !== this._savedCommitId && (this._savedCommitId = e ?? null, this._recompute());
133
- }
134
- addListeners(e, t) {
135
- return this._emitter.addListeners(e, t);
136
- }
137
- _recompute() {
138
- let e = this.isDirty();
139
- e !== this._dirty && (this._dirty = e, this._emitter.notify(e ? "onDirty" : "onClean", { transactional: !1 }));
140
- }
141
- close() {
142
- this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
143
- }
144
- }, z = class e {
145
- constructor(t, n = {}) {
146
- this._password = null, this._emitter = new x(this), this._path = t ?? null, this._name = n.name ?? null, this._format = n.format ?? null, this._size = n.size ?? null, this._canWrite = n.canWrite ?? e._defaultCanWrite(this._path), this._encryption = n.encryption ?? null;
147
- }
148
- static _defaultCanWrite(e) {
149
- return !!e && !/^(https?:|data:|blob:)/i.test(e);
150
- }
151
- _cleanPath() {
152
- return this._path ? this._path.split(/[?#]/)[0] : null;
153
- }
154
- getName() {
155
- if (this._name !== null && this._name !== void 0) return this._name;
156
- let e = this._cleanPath();
157
- return e && N(e) || null;
158
- }
159
- getPath() {
160
- return this._path;
161
- }
162
- getFormat() {
163
- return this._format ? this._format : this.getExtension();
164
- }
165
- getExtension() {
166
- let e = this._cleanPath();
167
- if (!e) return null;
168
- let t = D(e);
169
- return t ? t.toLowerCase() : null;
170
- }
171
- getEncryption() {
172
- return this._encryption;
173
- }
174
- isEncrypted() {
175
- return this._encryption !== null || this._password !== null;
176
- }
177
- setPassword(e) {
178
- this._password !== (e ?? null) && (this._password = e ?? null, this._password === null && (this._encryption = null), this._emitter.notify("onChange"));
179
- }
180
- getPassword() {
181
- return this._password;
182
- }
183
- getSize() {
184
- return this._size;
185
- }
186
- canWrite() {
187
- return this._canWrite;
188
- }
189
- setName(e) {
190
- this.update({ name: e });
191
- }
192
- update(e) {
193
- let t = !1;
194
- return e.path !== void 0 && e.path !== this._path && (this._path = e.path, 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;
195
- }
196
- addListeners(e, t) {
197
- return this._emitter.addListeners(e, t);
198
- }
199
- get [Symbol.toStringTag]() {
200
- return "[Origin]";
201
- }
202
- toString() {
203
- let e = this._cleanPath(), t = e ? e.split(/[/\\]/).pop() || e : this._name ?? "(unbound)", n = this._size;
204
- if (n == null) return t;
205
- if (n < 1024) return `${t} ${n}B`;
206
- let r = Math.floor(Math.log(n) / Math.log(1024)), i = [
207
- "B",
208
- "KB",
209
- "MB",
210
- "GB",
211
- "TB"
212
- ];
213
- return `${t} ${(n / 1024 ** r).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
214
- }
215
- }, Je = class {
216
- constructor() {
217
- this._defaultStringSourceType = "filepath";
218
- }
219
- async read(e) {
220
- let t = e.options ?? {}, r = e.source;
221
- if (typeof r == "function" && (r = r()), r && typeof r == "object" && typeof r.then == "function" && (r = await Promise.resolve(r)), r == null && (r = await this.resolveSource(e), r == null)) return null;
222
- let i = t.format, a = this._detectSourceType(r);
223
- if (!a) throw Error("Unable to detect source type from provided input.");
224
- let o, s, c = !1;
225
- if (a === "filepath") {
226
- let e = typeof r == "string" && r.startsWith("file://") ? r.slice(7) : r;
227
- r = await this.filePathToFile(e), a = "file", c = !0;
228
- }
229
- switch (a) {
230
- case "file": {
231
- let e = r, t = e?.name, n = t ? `${N(t)}` : "";
232
- o = await e.arrayBuffer(), s = {
233
- format: i,
234
- ext: D(t),
235
- name: n,
236
- absolutePath: t,
237
- size: e.size,
238
- canWrite: c && this._canWriteLocalPath()
239
- };
240
- break;
241
- }
242
- case "blob": {
243
- let e = r;
244
- o = await e.arrayBuffer(), s = {
245
- format: i,
246
- size: e.size
247
- };
248
- break;
249
- }
250
- case "base64": {
251
- let e;
252
- if (r && typeof r == "object" && "base64" in r) e = r.base64;
253
- else if (typeof r == "string" && r.startsWith("data:")) {
254
- let [, t] = r.split(",");
255
- e = t;
256
- } else e = r;
257
- o = n.base64ToArrayBuffer(e), s = {
258
- format: i,
259
- size: e.length
260
- };
261
- break;
262
- }
263
- case "fetch": {
264
- let e, t, n;
265
- if (typeof r == "string") e = r;
266
- else {
267
- if (!r || typeof r != "object" || !("input" in r)) throw Error("Invalid fetch source provided.");
268
- {
269
- let i = r;
270
- e = i.input, t = i.init, n = i.timeout;
271
- }
272
- }
273
- let a = n || 3e4, c = new AbortController(), l = setTimeout(() => c.abort(), a), u = typeof e == "string" ? e : e.toString(), d = D(u);
274
- try {
275
- let n = await fetch(e, {
276
- ...t,
277
- signal: c.signal
278
- });
279
- if (clearTimeout(l), !n.ok) throw Error(`Failed to fetch: ${n.status} ${n.statusText}`);
280
- let r = await n.arrayBuffer();
281
- if (!r) throw Error(`Unable to fetched content: ${u}`);
282
- o = r, s = {
283
- format: i,
284
- ext: d,
285
- name: N(u, !0),
286
- absolutePath: u
287
- };
288
- } catch (e) {
289
- throw clearTimeout(l), e.name === "AbortError" ? Error(`Fetch timeout after ${a}ms: ${u}`) : e;
290
- }
291
- break;
292
- }
293
- case "buffer":
294
- o = r, s = { format: i };
295
- break;
296
- case "stream": {
297
- let e = r.getReader(), t = [], n = 0;
298
- try {
299
- for (;;) {
300
- let { done: r, value: i } = await e.read();
301
- if (r) break;
302
- t.push(i), n += i.length;
303
- }
304
- } finally {
305
- e.releaseLock();
306
- }
307
- let a = new ArrayBuffer(n), c = new Uint8Array(a), l = 0;
308
- for (let e of t) c.set(e, l), l += e.length;
309
- o = a, s = { format: i };
310
- break;
311
- }
312
- default: throw Error(`Unsupported source type: ${a}`);
313
- }
314
- let l = await e.decode(o, {
315
- sourceType: a,
316
- ...s
317
- });
318
- return l ? (await this.onWorkbookRead(l, r), l) : null;
319
- }
320
- async resolveSource(e) {
321
- return null;
322
- }
323
- async onWorkbookRead(e, t) {}
324
- _canWriteLocalPath() {
325
- return !1;
326
- }
327
- _detectSourceType(e) {
328
- if (e && typeof e == "object" && "base64" in e) return "base64";
329
- if (e && typeof e == "object" && "input" in e) return "fetch";
330
- if (typeof e == "string") {
331
- if (e.startsWith("data:")) return "base64";
332
- if (e.startsWith("http://") || e.startsWith("https://")) return "fetch";
333
- if (e.startsWith("file://")) return "filepath";
334
- let t = this._defaultStringSourceType;
335
- return e.startsWith("./") || e.startsWith("../") || e.startsWith("/") || /^[a-zA-Z]:[/\\]/.test(e), t;
336
- }
337
- if (typeof File < "u" && e instanceof File) return "file";
338
- if (typeof Blob < "u" && e instanceof Blob) return "blob";
339
- let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", r = ArrayBuffer.isView(e), i = n.isNodeBuffer(e);
340
- return t || r || i ? "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;
341
- }
342
- }, Ye = class extends Je {
343
- constructor(e, t) {
344
- super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap(), this._pendingOpenHandle = null;
345
- }
346
- async read(e) {
347
- let t = e.source;
348
- return t && t.kind === "file" && typeof t.getFile == "function" ? (this._pendingOpenHandle = t, super.read({
349
- ...e,
350
- source: await t.getFile()
351
- })) : super.read(e);
352
- }
353
- async resolveSource() {
354
- let e = await this._getReadFormats?.() ?? [];
355
- if (typeof globalThis.showOpenFilePicker == "function") try {
356
- let t = function(e) {
357
- let t = Xe(e);
358
- if (t.length <= 1) return t;
359
- let n = /* @__PURE__ */ new Set(), r = {};
360
- 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));
361
- return [{
362
- description: "All Supported",
363
- accept: r
364
- }, ...t];
365
- }(e), [n] = await globalThis.showOpenFilePicker(t.length ? { types: t } : void 0);
366
- return this._pendingOpenHandle = n, await n.getFile();
367
- } catch (e) {
368
- if (e?.name === "AbortError") return null;
369
- throw e;
370
- }
371
- let t = e.flatMap((e) => e.exts.map((e) => "." + e)).join(", ");
372
- return p.openFileDialog(t);
373
- }
374
- async onWorkbookRead(e) {
375
- if (this._pendingOpenHandle) {
376
- let t = e.getOrigin?.();
377
- t && (this._handleCache.set(t, this._pendingOpenHandle), t instanceof z && t.update({ canWrite: !0 })), this._pendingOpenHandle = null;
378
- }
379
- }
380
- async filePathToFile(e) {
381
- throw Error(`Cannot read local file path '${e}' in browser environment. Use a file input element or fetch for remote URLs.`);
382
- }
383
- async write(e) {
384
- let { origin: t, suggestedName: n, format: r, encode: i, prompt: a } = e, o = [r, ...(await this._getWriteFormats()).filter((e) => e.key !== r.key)], s = typeof globalThis.showSaveFilePicker == "function", c = !a && t.canWrite() ? this._handleCache.get(t) : void 0;
385
- if (c?.name) {
386
- let e = t.getPath()?.split(/[/\\]/).pop();
387
- e && c.name !== e && (c = void 0);
388
- }
389
- let l = !!c;
390
- if (s) try {
391
- if (c) {
392
- let e = await async function(e) {
393
- try {
394
- if (typeof e.queryPermission != "function") return "granted";
395
- let t = { mode: "readwrite" };
396
- return await e.queryPermission(t) === "granted" || await e.requestPermission(t) === "granted" ? "granted" : "denied";
397
- } catch {
398
- return "unavailable";
399
- }
400
- }(c);
401
- if (e === "denied") return null;
402
- e !== "granted" && (c = void 0);
403
- }
404
- c ||= await globalThis.showSaveFilePicker({
405
- suggestedName: n,
406
- types: Xe(o)
407
- });
408
- let e = Qe(c.name ?? n), a = o.find((t) => t.exts.some((t) => t.toLowerCase() === e)) ?? r, s = await i(a.key), u = new Blob([Ze(s)], { type: a.mimeType || "application/octet-stream" }), d = await c.createWritable();
409
- return await d.write(u), await d.close(), this._handleCache.set(t, c), t instanceof z && t.update({
410
- size: u.size,
411
- ...l ? null : {
412
- path: c.name ?? n,
413
- name: null,
414
- format: a.key,
415
- canWrite: !0
416
- }
417
- }), t;
418
- } catch (e) {
419
- if (e?.name === "AbortError") return null;
420
- }
421
- let u = await i(r.key), d = new Blob([Ze(u)], { type: r.mimeType || "application/octet-stream" }), f = t.getPath(), p = f ? f.split(/[/\\]/).pop() : null, m = p && Qe(p) ? p : n;
422
- return function(e, t) {
423
- let n = URL.createObjectURL(e), r = document.createElement("a");
424
- r.style.display = "none", r.href = n, r.download = t, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
425
- }(d, m), t instanceof z && t.update({
426
- size: d.size,
427
- ...t.getPath() === m ? null : {
428
- path: m,
429
- name: null,
430
- format: r.key,
431
- canWrite: !1
432
- }
433
- }), t;
434
- }
435
- };
436
- function Xe(e) {
437
- return e.map((e) => {
438
- let t = e.mimeType && e.mimeType.includes("/") ? e.mimeType : "application/octet-stream";
439
- return {
440
- description: e.description ?? e.key,
441
- accept: { [t]: e.exts.map((e) => "." + e) }
442
- };
443
- });
444
- }
445
- function Ze(e) {
446
- if (typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) {
447
- let t = new ArrayBuffer(e.byteLength);
448
- return new Uint8Array(t).set(new Uint8Array(e)), t;
449
- }
450
- return e;
451
- }
452
- function Qe(e) {
453
- let t = e.lastIndexOf(".");
454
- return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
455
- }
456
- var $e = class {
457
- constructor(e) {
458
- this._private = { input: e }, typeof e == "string" ? this._private.name = e : Object.assign(this._private, e);
459
- }
460
- toJSON() {
461
- return this._private.input;
462
- }
463
- getFamily() {
464
- return this._private.name;
465
- }
466
- getPitch() {
467
- return this._private.pitch;
468
- }
469
- getPanose() {
470
- return this._private.panose;
471
- }
472
- toString() {
473
- return typeof this._private.input == "string" ? this._private.input : JSON.stringify(this._private.input);
474
- }
475
- get isIFont() {
476
- return !0;
477
- }
478
- }, et = h({
479
- findBestMatch: () => at,
480
- getFontList: () => it,
481
- setFontList: () => H
482
- }), tt = [
483
- "Arial",
484
- "Arial Black",
485
- "Brush Script MT",
486
- "Calibri",
487
- "Comic Sans MS",
488
- "Courier New",
489
- "Garamond",
490
- "Georgia",
491
- "Impact",
492
- "Luminari",
493
- "Palatino Linotype",
494
- "Tahoma",
495
- "Times New Roman",
496
- "Trebuchet MS",
497
- "Verdana"
498
- ], B = /* @__PURE__ */ new Map();
499
- B.set(k.GenericName.Serif, ["Tahoma"]), B.set(k.GenericName.SanSerif, ["Calibri"]), B.set(k.GenericName.MonoSpace, ["Courier New"]), B.set(k.GenericName.Cursive, ["Comic Sans MS"]), B.set(k.GenericName.Fantasy, ["Luminari"]), B.set(k.GenericName.UISystem, ["Arial"]), B.set(k.GenericName.UISerif, ["Tahoma"]), B.set(k.GenericName.UISanSerif, ["Arial"]), B.set(k.GenericName.UIMonoSpace, ["Courier New"]), B.set(k.GenericName.UIRounded, ["Arial"]), B.set(k.GenericName.Math, []), B.set(k.GenericName.Emoji, []), B.set(k.GenericName.Fangsong, []);
500
- var V = /* @__PURE__ */ new Map(), nt = [];
501
- H(tt);
502
- var rt = eval;
503
- function H(e) {
504
- e || H(tt);
505
- let t = [];
506
- for (let n = 0; n < e.length; n++) {
507
- let r = e[n];
508
- typeof r == "string" && (r = new $e(r));
509
- let i = !0;
510
- try {
511
- i = rt(`document.fonts.check('12px ${r.getFamily()}')`);
512
- } catch {}
513
- let a = {
514
- fontRef: r,
515
- loaded: i
516
- };
517
- t.push(a), V.set(r.getFamily(), a);
518
- }
519
- nt = Object.freeze(t);
520
- }
521
- function it() {
522
- return nt;
523
- }
524
- var U, W, G, K, q = /* @__PURE__ */ new Map();
525
- function at(e, t) {
526
- let n = q.get(e);
527
- if (n) return n.fontRef === null ? null : n;
528
- let r = [e];
529
- t?.fallbacks && (r = r.concat(t.fallbacks));
530
- let i = null;
531
- for (let e = 0; !i && e < r.length; e++) {
532
- let t = r[e];
533
- if (i = V.get(t), !i) {
534
- let e = B.get(t);
535
- if (e) for (let t = 0; !i && t < e.length; t++) i = V.get(e[t]);
536
- }
537
- }
538
- return i ? q.set(e, i) : q.set(e, {
539
- fontRef: null,
540
- loaded: !1
541
- }), i;
542
- }
543
- var ot = h({
544
- DefaultFontSizes: () => st,
545
- findNextFontSize: () => ct
546
- }), st = Object.freeze([
547
- 8,
548
- 9,
549
- 10,
550
- 11,
551
- 12,
552
- 14,
553
- 16,
554
- 18,
555
- 20,
556
- 22,
557
- 24,
558
- 26,
559
- 28,
560
- 30,
561
- 36,
562
- 48,
563
- 72
564
- ]);
565
- function ct(t, n = !0, r = st) {
566
- if (!r || r.length === 0) return t;
567
- if (t === void 0) return r[0];
568
- if (n && t >= r[r.length - 1] || !n && t <= r[0]) return t;
569
- let i = e.findEqualOrGreater(r, t);
570
- return n ? (r[i] === t && (i += 1), r[i] || --i, r[i]) : (--i, r[i]);
571
- }
572
- (U ||= {}).SortOn = {
573
- Value: "value",
574
- FillColor: "fillColor",
575
- FontColor: "fontColor",
576
- Icon: "icon"
577
- }, (G = W ||= {}).Compound = {
578
- Single: "sng",
579
- Double: "dbl",
580
- ThickThin: "thickThin",
581
- ThinThick: "thinThick",
582
- Triple: "tri"
583
- }, G.Align = {
584
- Center: "ctr",
585
- Inset: "in",
586
- Outset: "outset"
587
- }, G.LineCap = {
588
- Butt: "butt",
589
- Round: "round",
590
- Square: "square"
591
- }, G.LineJoin = {
592
- Bevel: "bevel",
593
- Miter: "miter",
594
- Round: "round"
595
- }, G.PresetMarkerShape = {
596
- Single: "none",
597
- Double: "double",
598
- ThickThin: "thickThin",
599
- ThinThick: "thickThin"
600
- }, G.StrokeStyle = {
601
- None: "none",
602
- Dashed: "dashed",
603
- Dotted: "dotted",
604
- LargeDash: "lgDash",
605
- LargeDashDot: "lgDashDot",
606
- LargeDashDotDot: "lgDashDotDot",
607
- Solid: "solid",
608
- SysDash: "sysDash",
609
- SysDashDot: "sysDashDot",
610
- SysDashDotDot: "sysDashDotDot",
611
- SysDot: "sysDot"
612
- }, (K ||= {}).Type = {
613
- OuterShadow: "outerShadow",
614
- InnerShadow: "innerShadow",
615
- PresetShadow: "presetShadow",
616
- Glow: "glow",
617
- SoftEdge: "softEdge",
618
- Reflection: "reflection"
619
- };
620
- var lt, ut, dt, ft, J = Se.BuiltInName, pt = {
621
- [J.Normal]: m("style.builtin.normal"),
622
- [J.Comma]: m("style.builtin.comma"),
623
- [J.Currency]: m("style.builtin.currency"),
624
- [J.Percent]: m("style.builtin.percent"),
625
- [J.Comma0]: m("style.builtin.comma0"),
626
- [J.Currency0]: m("style.builtin.currency0"),
627
- [J.Hyperlink]: m("style.builtin.hyperlink"),
628
- [J.FollowedHyperlink]: m("style.builtin.followedHyperlink"),
629
- [J.Note]: m("style.builtin.note"),
630
- [J.WarningText]: m("style.builtin.warningText"),
631
- [J.Title]: m("style.builtin.title"),
632
- [J.Input]: m("style.builtin.input"),
633
- [J.Output]: m("style.builtin.output"),
634
- [J.Calculation]: m("style.builtin.calculation"),
635
- [J.CheckCell]: m("style.builtin.checkCell"),
636
- [J.LinkedCell]: m("style.builtin.linkedCell"),
637
- [J.Total]: m("style.builtin.total"),
638
- [J.Good]: m("style.builtin.good"),
639
- [J.Bad]: m("style.builtin.bad"),
640
- [J.Neutral]: m("style.builtin.neutral"),
641
- [J.ExplanatoryText]: m("style.builtin.explanatoryText")
642
- }, mt = m("style.builtin.heading"), ht = m("style.builtin.accent"), gt = m("style.builtin.accentTint"), _t = /^Heading ([1-4])$/, vt = /^Accent([1-6])$/, yt = /^(20|40|60)% - Accent([1-6])$/;
643
- function bt(e) {
644
- let t = pt[e];
645
- if (t) return { key: t };
646
- let n = _t.exec(e);
647
- return n ? {
648
- key: mt,
649
- params: { n: +n[1] }
650
- } : (n = vt.exec(e), n ? {
651
- key: ht,
652
- params: { n: +n[1] }
653
- } : (n = yt.exec(e), n ? {
654
- key: gt,
655
- params: {
656
- pct: +n[1],
657
- n: +n[2]
658
- }
659
- } : null));
660
- }
661
- var xt = (e, t, n, r, i) => {
662
- let a = JSON.parse(JSON.stringify(e.definition));
663
- a.adjs ||= [];
664
- let o = "", c = 0, l = 0;
665
- t > 0 ? (l = t, c = 100 - t, o = s("op.lighterPercent", { percent: t })) : t < 0 && (c = 100 + t, o = s("op.darkerPercent", { percent: -t })), c && a.adjs.push({ [S.AdjustmentType.LumMod]: c }), l && a.adjs.push({ [S.AdjustmentType.LumOff]: l });
666
- let u = new ge({
667
- val: a.val,
668
- adjs: a.adjs
669
- }, n), d = u.toString();
670
- r?.set(d, u);
671
- let f = u.toRGBA().toString();
672
- return i?.set(f, u), {
673
- description: e.description + ", " + o,
674
- definition: a
675
- };
676
- };
677
- function St(e) {
678
- let t, n = e.trim();
679
- if (!n) return;
680
- try {
681
- let e = We.shared().tokenize(n, !1);
682
- if (e.errors.length > 0) return;
683
- t = e.tokens;
684
- } catch {
685
- return;
686
- }
687
- let r = 0, i = 0;
688
- if (t.length === 2) {
689
- let e = t[0].tokenType?.name;
690
- e === "MinOp" ? (r = -1, i = 1) : e === "PlusOp" && (r = 1, i = 1);
691
- }
692
- if (t.length - i !== 1) return;
693
- let a = t[i], o = a.image;
694
- try {
695
- switch (a.tokenType?.name) {
696
- case "NumberToken":
697
- case "ScientificDigit":
698
- case "DigitToken": {
699
- let e = De(o).value;
700
- return r === 0 ? e : r * e;
701
- }
702
- case "StringToken": return r === 0 ? _e(o).value : void 0;
703
- case "BooleanToken": return r === 0 ? ke(o).value : void 0;
704
- case "LiteralError":
705
- case "RefError": return r === 0 ? Ae(o).value : void 0;
706
- default: return;
707
- }
708
- } catch {
709
- return;
710
- }
711
- }
712
- function Ct(e, t) {
713
- let n = wt(e), r = wt(t);
714
- 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 : g.isError(e) && g.isError(t) ? e.getCode() - t.getCode() : 0 : n - r;
715
- }
716
- function wt(e) {
717
- if (e === null) return 0;
718
- switch (typeof e) {
719
- case "number": return 1;
720
- case "string": return 2;
721
- case "boolean": return 3;
722
- default: return g.isError(e) ? 4 : 5;
723
- }
724
- }
725
- (lt ||= {}).buildPalette = function(e, t, n, r) {
726
- let i = [];
727
- for (let a = 0; a < e.length; a++) {
728
- let o = [];
729
- i.push(o);
730
- let s = (i) => {
731
- for (let s = 0; s < i.length; s++) o.push(xt(e[a], i[s], t, n, r));
732
- }, c = new ge({
733
- val: e[a].definition.val,
734
- adjs: e[a].definition.adjs
735
- }, t).toHSLA().lum;
736
- s(c === 0 ? [
737
- 50,
738
- 35,
739
- 25,
740
- 15,
741
- 5
742
- ] : c === 100 ? [
743
- -5,
744
- -15,
745
- -25,
746
- -35,
747
- -50
748
- ] : c <= 20 ? [
749
- 90,
750
- 75,
751
- 50,
752
- 25,
753
- 10
754
- ] : c >= 80 ? [
755
- -10,
756
- -25,
757
- -50,
758
- -75,
759
- -90
760
- ] : [
761
- 80,
762
- 60,
763
- 40,
764
- -25,
765
- -50
766
- ]);
767
- }
768
- return i;
769
- }, ut ||= {}, dt ||= {}, ft ||= {};
770
- var Tt = class {
771
- constructor(e) {
772
- this._children = e;
773
- }
774
- getSize() {
775
- let e = this._children, t = e.length, n = 0;
776
- for (let r = 0; r < t; r++) n += e[r].getSize();
777
- return n;
778
- }
779
- getCount() {
780
- let e = this._children, t = e.length, n = 0;
781
- for (let r = 0; r < t; r++) n += e[r].getCount();
782
- return n;
783
- }
784
- getAggregates(e) {
785
- if (e) return this._mergeAggregates(e);
786
- let t = this._aggregates;
787
- return t || (t = this._mergeAggregates(), this._aggregates = t), t;
788
- }
789
- getSnappedSum(e) {
790
- let t = e ?? this.getAggregates().sum ?? 0, n = this._children;
791
- for (let e = n.length - 1; e >= 0; e--) if (n[e].getAggregates().numericalCount > 0) return n[e].getSnappedSum(t);
792
- return t;
793
- }
794
- getSortedNumbers() {
795
- let e = this._sortedNumbers;
796
- if (!e) {
797
- let t = this._children, n = t.length, r = [];
798
- for (let e = 0; e < n; e++) {
799
- let n = t[e].getSortedNumbers().getValues();
800
- n.length > 0 && r.push(n);
801
- }
802
- e = new oe(function(e) {
803
- let t = e.length;
804
- if (t === 0) return Et;
805
- if (t === 1) return e[0];
806
- let n = e[0];
807
- for (let r = 1; r < t; r++) n = Dt(n, e[r]);
808
- return Object.freeze(n);
809
- }(r)), this._sortedNumbers = e;
810
- }
811
- return e;
812
- }
813
- getRanked(e) {
814
- return Ue(this._children, e, Ct)[Symbol.iterator]();
815
- }
816
- getFrequencies(e) {
817
- if (e) return this._mergeFrequencies(e);
818
- let t = this._frequencies;
819
- return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
820
- }
821
- _mergeFrequencies(e) {
822
- let t = e?.keyFn ?? le, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
823
- for (let l = 0; l < a; l++) {
824
- let a = i[l].getFrequencies(e);
825
- o += a.getVisitedCount(), s += a.getTotalCount(), c ||= a.isTruncated();
826
- let u = a.getValueCounts(), d = u.next();
827
- for (; !d.done;) {
828
- let [e, i] = d.value, a = t(e), o = r.get(a);
829
- o ? o.count += i : n === void 0 || r.size < n ? r.set(a, {
830
- value: e,
831
- count: i
832
- }) : c = !0, d = u.next();
833
- }
834
- }
835
- return ne.fromGroups(r, t, e, Ct, o, s, c);
836
- }
837
- getTypedCounts(e) {
838
- let t = this._typedCounts;
839
- if (!t) {
840
- let e = {
841
- [_.Number]: 0,
842
- [_.String]: 0,
843
- [_.Boolean]: 0,
844
- [_.Error]: 0,
845
- [_.RichData]: 0,
846
- [_.Null]: 0
847
- }, n = this._children, r = n.length;
848
- for (let t = 0; t < r; t++) {
849
- let r = n[t].getTypedCounts();
850
- e[_.Number] += r[_.Number] ?? 0, e[_.String] += r[_.String] ?? 0, e[_.Boolean] += r[_.Boolean] ?? 0, e[_.Error] += r[_.Error] ?? 0, e[_.RichData] += r[_.RichData] ?? 0, e[_.Null] += r[_.Null] ?? 0;
851
- }
852
- t = Object.freeze(e), this._typedCounts = t;
853
- }
854
- if (e === void 0) return t;
855
- let n = {}, r = e.length;
856
- for (let i = 0; i < r; i++) n[e[i]] = t[e[i]] ?? 0;
857
- return n;
858
- }
859
- get isIRangeStats() {
860
- return !0;
861
- }
862
- _mergeAggregates(e) {
863
- let t = this._children, n = t.length, r = {
864
- count: 0,
865
- min: void 0,
866
- max: void 0,
867
- numericalCount: 0,
868
- sum: 0,
869
- sumSq: 0,
870
- typed: {
871
- [_.Number]: 0,
872
- [_.String]: 0,
873
- [_.Boolean]: 0,
874
- [_.Error]: 0,
875
- [_.RichData]: 0,
876
- [_.Null]: 0
877
- }
878
- };
879
- for (let i = 0; i < n; i++) {
880
- let n = t[i].getAggregates(e);
881
- r.count += n.count;
882
- let a = n.numericalCount;
883
- 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));
884
- }
885
- return Le(r);
886
- }
887
- }, Et = Object.freeze([]);
888
- function Dt(e, t) {
889
- let n = e.length, r = t.length, i = Array(n + r), a = 0, o = 0, s = 0;
890
- for (; a < n && o < r;) i[s++] = e[a] <= t[o] ? e[a++] : t[o++];
891
- for (; a < n;) i[s++] = e[a++];
892
- for (; o < r;) i[s++] = t[o++];
893
- return i;
894
- }
895
- var Ot = class {
896
- constructor(e) {
897
- this.isIExternalBook = !0, this._json = e;
898
- }
899
- getIdentity() {
900
- return this._json.identity;
901
- }
902
- getSheetNames() {
903
- return this._json.sheetNames;
904
- }
905
- getDefinedNames() {
906
- return this._json.definedNames ?? [];
907
- }
908
- getSheetData(e) {
909
- return this._json.sheetDataSet?.find((t) => t.sheetIndex === e) ?? null;
910
- }
911
- toJSON() {
912
- return this._json;
913
- }
914
- }, kt = class {
915
- constructor(e) {
916
- this.isIExternalBookCollection = !0, this._items = (e?.json ?? []).map((e) => e ? new Ot(e) : null);
917
- }
918
- [Symbol.iterator]() {
919
- return this.getItems()[Symbol.iterator]();
920
- }
921
- getItems() {
922
- let e = [], t = this._items.length;
923
- for (let n = 0; n < t; n++) {
924
- let t = this._items[n];
925
- t && e.push(t);
926
- }
927
- return e;
928
- }
929
- getCount() {
930
- return this.getItems().length;
931
- }
932
- getByIndex(e) {
933
- return this._items[e - 1] ?? null;
934
- }
935
- toJSON() {
936
- return this._items.length === 0 ? null : this._items.map((e) => e?.toJSON() ?? null);
937
- }
938
- }, At = class {
939
- constructor(e) {
940
- this._closed = !1, this._options = { ...e };
941
- let t = this;
942
- this._transactions = this._options.transactions ?? new fe({ transient: !0 }), this._stateId = this._transactions.create(), this._transactionsRemoveListener = this._transactions.addStateListener(this._stateId, { onAfterStateChange(e, n, r) {
943
- t._emitter.notify("onCollectionChange");
944
- } }), this._emitter = new x(this, this._transactions), this._initState(e?.initial);
945
- }
946
- add(e, t, n) {
947
- let r = this;
948
- t && t.addListeners({ onDelete: (t) => {
949
- r._updateState((t) => {
950
- if (!t.modules[e]) return;
951
- let n = t.modules[e];
952
- if (n) {
953
- let i = { ...t };
954
- return r._options.onRemove?.(e, n), r._emitter.notify("onCollectionChange"), delete i.modules[e], i;
955
- }
956
- return t;
957
- }, m("op.deleteModule"));
958
- } }, { once: !0 });
959
- let i = this._getState()?.modules, a = i?.[e], o = n?.replace ?? !1;
960
- if (a && !o) throw Error(`Already existing '${e}'`);
961
- let s = { ...i };
962
- t ? (s[e] = t, r._options.onAdd?.(e, t), this._updateState({ modules: s }, m(o ? "op.saveScripts" : "op.addScript"))) : (delete s[e], r._options.onRemove?.(e, null), this._updateState({ modules: s }, m("op.removeScript"))), r._emitter.notify("onCollectionChange");
963
- }
964
- *[Symbol.iterator]() {
965
- yield* this.getItems();
966
- }
967
- getItems(t) {
968
- let n = this._getState();
969
- if (!n) return e.EmptyArray;
970
- let r = n.modules, i = Object.keys(r), a = i.length;
971
- if (a === 0) return e.EmptyArray;
972
- let o = [], s = t?.name ? t.name.toUpperCase() : null;
973
- for (let e = 0; e < a; e++) {
974
- let t = i[e], n = r[t], a = !0;
975
- s && s !== t.toUpperCase() && (a = !1), a && o.push(n);
976
- }
977
- return o ?? e.EmptyArray;
978
- }
979
- getByName(e) {
980
- if (!e) return null;
981
- let t = this._getState();
982
- if (!t) return null;
983
- let n = e.toUpperCase(), r = t.modules, i = Object.keys(r), a = i.length;
984
- for (let e = 0; e < a; e++) {
985
- let t = i[e];
986
- if (n === t.toUpperCase()) return r[t];
987
- }
988
- return null;
989
- }
990
- getCount() {
991
- let e = this._getState();
992
- return e ? Object.keys(e.modules).length : 0;
993
- }
994
- beginCommit(e) {
995
- return this._beginCommit(e);
996
- }
997
- _getState() {
998
- if (this._closed) throw Error(s("error.model.modelClosed"));
999
- return this._transactions.getState(this._stateId);
1000
- }
1001
- _beginCommit(e) {
1002
- return this._transactions.beginCommit(typeof e == "string" ? { description: e } : e);
1003
- }
1004
- _updateState(e, t = m("op.update"), n) {
1005
- if (!e) return;
1006
- let r = this._beginCommit(t);
1007
- try {
1008
- r.updateState(this._stateId, e), r.commit(n);
1009
- } catch (e) {
1010
- throw r.rollback(), e;
1011
- }
1012
- }
1013
- _initState(e) {
1014
- let t = e ?? {};
1015
- this._updateState({ modules: t }, m("op.initialize"), { forceAmend: !0 });
1016
- let n = this._options.onAdd;
1017
- if (n) {
1018
- let e = Object.keys(t), r = e.length;
1019
- for (let i = 0; i < r; i++) {
1020
- let r = e[i];
1021
- n(r, t[r]);
1022
- }
1023
- }
1024
- }
1025
- addListeners(e, t) {
1026
- return this._emitter.addListeners(e, t);
1027
- }
1028
- toJSON() {
1029
- let t = this._getState();
1030
- if (!t) return e.EmptyArray;
1031
- let n = t.modules, r = Object.keys(n), i = r.length, a = {};
1032
- for (let e = 0; e < i; e++) {
1033
- let t = r[e];
1034
- a[t] = n[t].toJSON();
1035
- }
1036
- return a;
1037
- }
1038
- isClosed() {
1039
- return this._closed;
1040
- }
1041
- close() {
1042
- this._closed || (this._emitter.notify("onClose"), this._closed = !0, this._transactionsRemoveListener?.());
1043
- }
1044
- get isFunctionCollection() {
1045
- return !0;
1046
- }
1047
- }, jt = class {
1048
- constructor(e) {
1049
- this._options = e, this._emitter = new x(this), this._initState();
1050
- }
1051
- _initState() {}
1052
- getModules() {
1053
- return this._modules;
1054
- }
1055
- _builtInNames() {
1056
- try {
1057
- let t = this._options.getBuiltInFunctions?.();
1058
- if (!t) return e.EmptyArray;
1059
- let n = [];
1060
- for (let e of t.getItems()) e.isBuiltIn() && n.push(e.getName());
1061
- return n;
1062
- } catch {
1063
- return e.EmptyArray;
1064
- }
1065
- }
1066
- async createModule(e) {
1067
- let t = await (await import("./CfuhUkrvOq11d9FR.mjs").then((e) => e.t)).ScriptCompiler.compile({
1068
- builtInNames: this._builtInNames(),
1069
- ...e
1070
- });
1071
- return t.module ? await L("scripts", t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
1072
- }
1073
- addModule(e, t, n) {
1074
- this._modules.add(e, t, n);
1075
- }
1076
- async addModuleFromJSON(e, t, n) {
1077
- let r = await L(e, t);
1078
- return this.addModule(e, r, n), r;
1079
- }
1080
- executeMacro(e, t, n) {
1081
- let r = this._modules.getItems({ name: t }), i = r.length;
1082
- for (let t = 0; t < i; t++) {
1083
- let i = r[t].getFunctions().getByName(e);
1084
- if (i) return i.execute(this._options.workbook, {
1085
- applyResult: !0,
1086
- ...n
1087
- });
1088
- }
1089
- throw Error(`No macro ${e} found.`);
1090
- }
1091
- async run(e, t) {
1092
- try {
1093
- let n = typeof e == "string" ? await this.createModule({ source: e }) : await L("scripts", e), r = typeof e == "string" ? e : e?.source ?? "";
1094
- return await this._runModule(n, r, t);
1095
- } catch (e) {
1096
- return {
1097
- ok: !1,
1098
- error: e
1099
- };
1100
- }
1101
- }
1102
- async _runModule(e, t, n) {
1103
- let r = this._options?.workbook;
1104
- if (!e) return {
1105
- ok: !1,
1106
- error: Error("The script did not compile to a module.")
1107
- };
1108
- let i = e.getDiagnostics(), a = i.filter((e) => e.severity === "error");
1109
- if (a.length > 0) {
1110
- let e = Error(((e, t) => {
1111
- let n = [0];
1112
- for (let t = 0; t < e.length; t++) e[t] === "\n" && n.push(t + 1);
1113
- let r = t.map((e) => ` ${((e) => {
1114
- let t = 0, r = n.length - 1;
1115
- for (; t < r;) {
1116
- let i = t + r + 1 >> 1;
1117
- n[i] <= e ? t = i : r = i - 1;
1118
- }
1119
- return `${t + 1}:${e - n[t] + 1}`;
1120
- })(e.start)} ${e.code}: ${e.message}`), i = t.length;
1121
- return `Script has ${i} compile error${i === 1 ? "" : "s"}:\n${r.join("\n")}`;
1122
- })(t, a));
1123
- return e.diagnostics = a, {
1124
- ok: !1,
1125
- error: e,
1126
- diagnostics: i
1127
- };
1128
- }
1129
- let o = e.getFunctions(), s = (await o.search({ type: "autoRun" }))[0] ?? (await o.search({ type: "macro" }))[0] ?? null;
1130
- if (!s) return {
1131
- ok: !1,
1132
- 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: ISheet, ctx)`).")
1133
- };
1134
- let c = await s.execute(r, n);
1135
- return {
1136
- ok: !0,
1137
- result: c?.results,
1138
- commitId: c?.commitId,
1139
- diagnostics: i
1140
- };
1141
- }
1142
- async _searchable(e) {
1143
- let t = [];
1144
- if (e?.includeBuiltIn) {
1145
- await this._options.workbook?.getCalculation()?.start();
1146
- let e = this._options.getBuiltInFunctions?.();
1147
- e && t.push(e);
1148
- }
1149
- let n = this._modules;
1150
- if (!n || n.getCount() === 0) return t;
1151
- let r = e?.moduleName, i = r ? n.getItems({ name: r }) : n.getItems(), a = i.length;
1152
- for (let e = 0; e < a; e++) t.push(i[e].getFunctions());
1153
- return t;
1154
- }
1155
- async searchFunctions(t) {
1156
- await this._emitter.notify("onBeforeSearch", { async: !0 });
1157
- let n = await this._searchable(t);
1158
- if (n.length === 0) return e.EmptyArray;
1159
- let r, i = t?.limit, a = i === void 0 ? t : {
1160
- ...t,
1161
- limit: void 0
1162
- }, o = /* @__PURE__ */ new Set();
1163
- for (let e = 0; e < n.length; e++) {
1164
- let t = await n[e].search(a);
1165
- if (t.length !== 0) {
1166
- r ||= [];
1167
- for (let e = 0; e < t.length; e++) {
1168
- let n = t[e], i = n.getName().toUpperCase();
1169
- o.has(i) || (o.add(i), r.push(n));
1170
- }
1171
- }
1172
- }
1173
- if (!r || r.length === 0) return e.EmptyArray;
1174
- let s = t?.text ? t.text.trim().toUpperCase() : null;
1175
- return s && n.length > 1 && He(r, s), i !== void 0 && r.length > i ? r.slice(0, i) : r;
1176
- }
1177
- async getFunctionCategories(t) {
1178
- await this._emitter.notify("onBeforeSearch", { async: !0 });
1179
- let n = await this._searchable(t);
1180
- if (n.length === 0) return e.EmptyArray;
1181
- if (n.length === 1) return n[0].getCategories(t);
1182
- let r = t?.includeDeprecated ?? !1, i = /* @__PURE__ */ new Map(), a = (e) => {
1183
- let t = e.toUpperCase(), n = i.get(t);
1184
- n ? n.count++ : i.set(t, {
1185
- name: e,
1186
- count: 1
1187
- });
1188
- };
1189
- for (let e of await n[0].getCategories(t)) i.set(e.name.toUpperCase(), {
1190
- name: e.name,
1191
- count: e.count
1192
- });
1193
- for (let e = 1; e < n.length; e++) {
1194
- let i = await n[e].search(t?.type ? { type: t.type } : void 0);
1195
- for (let t = 0; t < i.length; t++) {
1196
- let o = i[t], s = o.getName().toUpperCase(), c = !1;
1197
- for (let t = 0; t < e && !c; t++) c = !!n[t].getByName(s);
1198
- if (c) continue;
1199
- let l = await o.getDescriptor().catch(() => null);
1200
- !r && l?.isDeprecated() || a(l?.getCategory() ?? "Uncategorized");
1201
- }
1202
- }
1203
- let o = Array.from(i.values());
1204
- return o.sort((e, t) => e.name.localeCompare(t.name)), o;
1205
- }
1206
- async start() {
1207
- if (!this._modules) return this._startPromise || (this._startPromise = this._doStart(), this._startPromise.catch(() => {
1208
- this._startPromise = void 0;
1209
- })), this._startPromise;
1210
- }
1211
- async _doStart() {
1212
- let t = this._options?.workbook, n = this._options?.json, r = {};
1213
- if (n) {
1214
- let e = Object.keys(n);
1215
- for (let t = 0; t < e.length; t++) {
1216
- let i = e[t], a = n[i];
1217
- try {
1218
- r[i] = await L(i, a);
1219
- } catch (e) {
1220
- o.error(`Could not load script '${i}'; it will be unavailable.`, e);
1221
- }
1222
- }
1223
- }
1224
- let i = this, a = new At({
1225
- transactions: this._options?.transactions,
1226
- initial: r,
1227
- onRemove: (e, t) => {
1228
- i._options?.onRemove?.(e, t);
1229
- },
1230
- onAdd: (e, t) => {
1231
- i._emitter.notify("onChange"), i._options?.onAdd?.(e, t);
1232
- }
1233
- });
1234
- this._modules = a;
1235
- let s = a.getItems();
1236
- if (s.length === 0) return Promise.resolve(e.EmptyArray);
1237
- let c = s.length;
1238
- for (let e = 0; e < c; e++) {
1239
- let n = s[e];
1240
- try {
1241
- let e = await n.getFunctions().search({ type: "autoRun" }), r = e.length;
1242
- for (let n = 0; n < r; n++) await e[n].execute(t);
1243
- } catch (e) {
1244
- o.error("Error executing autoRun script:", e);
1245
- }
1246
- }
1247
- }
1248
- addListeners(e, t) {
1249
- return this._emitter.addListeners(e, t);
1250
- }
1251
- isReadOnly() {
1252
- return !1 === this._options.workbook?.getProtection().isStructureAllowed();
1253
- }
1254
- toJSON() {
1255
- this._emitter.notify("onBeforeSave");
1256
- let e = this._modules;
1257
- if (!e) throw Error("Scripts is initializing.");
1258
- return e.toJSON();
1259
- }
1260
- }, Mt = class {
1261
- constructor(e, t, n, r) {
1262
- this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? l.EmptyCell, this._sheet = new E({
1263
- runtime: e,
1264
- styles: this._styles,
1265
- container: {
1266
- getName: () => r,
1267
- getIndex: () => 1
1268
- }
1269
- }), this._builder = this._sheet.getEntireRange().createSparseBuilder();
1270
- }
1271
- applyCSSStyle(e, t) {
1272
- let n = !1;
1273
- e.style || (e.style = {}, n = !0);
1274
- let r = e.style, i = { ...t };
1275
- if (t.msoIgnore) {
1276
- let e = t.msoIgnore.split(","), n = Object.keys(i);
1277
- for (let t = 0; t < n.length; t++) {
1278
- let r = n[t];
1279
- e.includes(r) && delete i[r];
1280
- }
1281
- }
1282
- let a = ze(i.fontFamily);
1283
- 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;
1284
- let o = Ie(i.textDecoration);
1285
- r.font.underline = o.underline, r.font.strike = o.strike, i.textUnderlineStyle && (r.font.underline = w(i.textUnderlineStyle)), r.alignment = {}, i?.textAlign && (r.alignment.horizontal = ue(i.textAlign)), i?.textAlign && !r.alignment.horizontal && i?.textAlign !== "general" && (i.textAlign === "center-across" ? r.alignment.horizontal = I.HorizontalAlignment.CenterContinuous : i.textAlign === "fill" ? r.alignment.horizontal = I.HorizontalAlignment.Fill : i.textAlign === "121" || i.textAlign === "010" ? (r.alignment.horizontal = I.HorizontalAlignment.Distributed, r.alignment.justifyLastLine = i.textAlign === "121") : console.warn("unknown text-align", i.textAlign)), i.verticalAlign && (i.verticalAlign.toLowerCase() === "super" ? r.font.verticalAlign = k.VerticalAlignment.Super : i.verticalAlign.toLowerCase() === "sup" ? r.font.verticalAlign = k.VerticalAlignment.Sub : r.alignment.vertical = Ve(i.verticalAlign), r.alignment.vertical || (i.verticalAlign === "121" ? r.alignment.vertical = I.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" ? I.Overflow.Visible : I.Overflow.Wrap), i.msoTextControl === "shrinktofit" && (r.alignment.overflow = I.Overflow.Shrink);
1286
- let s = null;
1287
- if (i.background ? s = i.background : i.backgroundColor && (s = i.backgroundColor), s && (r.fill = { color: s }), i.msoPattern) {
1288
- let e = ve(i.msoPattern);
1289
- e && (e.patternType === Ce.BuiltInSheetPattern.Solid ? r.fill = { color: e.foreground } : e.patternType !== Ce.BuiltInSheetPattern.None && (s && (e.background = s), r.fill = e));
1290
- }
1291
- i.msoRotate !== void 0 && (r.alignment.rotation = se(i.msoRotate));
1292
- let c = (e, t) => {
1293
- e && (r.border ||= {}, r.border[e] = t);
1294
- };
1295
- 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);
1296
- let l = r.numberFormat;
1297
- i.msoNumberFormat && (l = ce(i.msoNumberFormat), l.includes("\\") ? l = null : l === "Fixed" ? l = O.Styles.lookupStyle(r.numberFormat).formatType === O.Type.Number ? null : O.Type.Number : l === "Percent" && (l = O.Styles.lookupStyle(r.numberFormat).formatType === O.Type.Percentage ? null : O.Type.Percentage)), l && (r.numberFormat = l), e.style = this._styles.normalize(r), n && Object.keys(e.style).length === 0 && delete e.style;
1298
- }
1299
- onCell(e, t, n, r, i) {
1300
- let a = r(i), o = { value: t === void 0 ? n ?? "" : t };
1301
- if (typeof o.value == "string" && o.value.length === 0 && (o.value = void 0), a && this.applyCSSStyle(o, a), i?.tagName.toUpperCase() === "TD") {
1302
- let e = o.style, t = e?.font ?? {};
1303
- (i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = !0), i.querySelectorAll("sub").length > 0 && (t.verticalAlign = k.VerticalAlignment.Sub), i.querySelectorAll("sup").length > 0 && (t.verticalAlign = k.VerticalAlignment.Super), (i.querySelectorAll("b").length > 0 || i.querySelectorAll("strong").length > 0) && (t.weight = 700), i.querySelectorAll("i").length > 0 && (t.style = k.Style.Italic), i.querySelectorAll("u").length > 0 && (t.underline = k.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, o.style = e), e.font ||= t);
1304
- let n = i.querySelectorAll("a");
1305
- if (n.length > 0) {
1306
- let e = n[0].getAttribute("href");
1307
- e && (o.hyperlink = e);
1308
- }
1309
- }
1310
- if (!l.isSingleCell(e)) {
1311
- let t = {
1312
- rowStart: this._topLeft.rowIndex + e.rowStart,
1313
- colStart: this._topLeft.colIndex + e.colStart,
1314
- rowEnd: this._topLeft.rowIndex + e.rowEnd,
1315
- colEnd: this._topLeft.colIndex + e.colEnd
1316
- };
1317
- this._mergedReading.push(t);
1318
- }
1319
- if (o.value === void 0 && !o.style && Object.keys(o).length <= 1) return;
1320
- let s = this._builder, c = this._topLeft;
1321
- if (s.pushAt(c.rowIndex + e.rowStart, c.colIndex + e.colStart, o), !l.isSingleCell(e) && a.msoIgnore) {
1322
- if (a.msoIgnore.includes("colspan")) {
1323
- let t = {};
1324
- a && this.applyCSSStyle(t, a);
1325
- let n = e.colEnd - e.colStart, r = c.rowIndex + e.rowStart;
1326
- for (let i = 1; i <= n; i++) s.pushAt(r, c.colIndex + e.colStart + i, t);
1327
- e = {
1328
- ...e,
1329
- colEnd: e.colStart
1330
- };
1331
- }
1332
- a.msoIgnore.includes("rowspan") && (e = {
1333
- ...e,
1334
- rowEnd: e.rowStart
1335
- });
1336
- }
1337
- }
1338
- onNoTable(e, t, n) {
1339
- this.onCell({
1340
- rowStart: this._topLeft.rowIndex,
1341
- colStart: this._topLeft.colIndex,
1342
- rowEnd: this._topLeft.rowIndex,
1343
- colEnd: this._topLeft.colIndex
1344
- }, e, null, t, n);
1345
- }
1346
- onRowStart(e, t, n, r) {
1347
- let i = n(r);
1348
- if (i.msoHeightSource !== "userset" || !r) return;
1349
- let a = r.getAttribute("height") ?? i.height, o = null;
1350
- if (a && (o = j(a, this._styles.getNormal().getFont().getSize(), "px")), o === null) for (let e = 0; e < r.cells.length; e++) {
1351
- let t = r.cells[e], i = j(t.getAttribute("height") ?? n(t).height, this._styles.getNormal().getFont().getSize(), "px");
1352
- i !== null && (o = Math.max(i, o ?? 0));
1353
- }
1354
- o !== null && this._rowsReading.push({
1355
- address: {
1356
- min: this._topLeft.rowIndex + e,
1357
- max: this._topLeft.rowIndex + e + t - 1
1358
- },
1359
- update: { size: o * k.getDeviceScale() }
1360
- });
1361
- }
1362
- onColumn(e, t, n, r) {
1363
- let i = n(r);
1364
- if (i.msoWidthSource !== "userset" || !r) return;
1365
- let a = r.getAttribute("width") ?? i.width, o = null;
1366
- a && (o = j(a, this._styles.getNormal().getFont().getSize(), "px")), o !== null && this._colsReading.push({
1367
- address: {
1368
- min: this._topLeft.colIndex + e,
1369
- max: this._topLeft.colIndex + e + t - 1
1370
- },
1371
- update: { size: o * k.getDeviceScale() }
1372
- });
1373
- }
1374
- onDone() {
1375
- this._colsReading.length > 0 && this._sheet.getColumnHeaders().updateHeaderPairs(this._colsReading), this._rowsReading.length > 0 && this._sheet.getRowHeaders().updateHeaderPairs(this._rowsReading), this._sheet.doBatch(() => {
1376
- this._builder.apply();
1377
- }), this._mergedReading.length > 0 && this._sheet.getRanges(this._mergedReading).merge();
1378
- }
1379
- sheet() {
1380
- return this._sheet;
1381
- }
1382
- }, Nt = class {
1383
- constructor(e) {
1384
- if (!e) throw new r("snapshot is required.");
1385
- this._snapshot = e;
1386
- }
1387
- getItemType() {
1388
- return "range";
1389
- }
1390
- getItem() {
1391
- return this._snapshot;
1392
- }
1393
- editMode() {
1394
- return this._snapshot?.getMarkOptions().editMode ?? null;
1395
- }
1396
- isCut() {
1397
- return this._snapshot?.getMarkOptions().isCut ?? !1;
1398
- }
1399
- getName() {
1400
- return this._snapshot.getName();
1401
- }
1402
- toText() {
1403
- return this._snapshot.toText();
1404
- }
1405
- toHtml() {
1406
- return this._snapshot.toHtml();
1407
- }
1408
- toImage() {
1409
- return this._snapshot.toImage();
1410
- }
1411
- get isClipboardItem() {
1412
- return !0;
1413
- }
1414
- }, Pt = class {
1415
- constructor(e, t, n, i, a) {
1416
- if (this._parsed = void 0, this._runtime = e, !t) throw new r("nativeItems are required.");
1417
- this._topLeft = n ?? l.EmptyCell, this._native = t, this._markOptions = Object.freeze(i ?? {}), this._styles = a;
1418
- }
1419
- getItemType() {
1420
- return "range";
1421
- }
1422
- isCut() {
1423
- return !1;
1424
- }
1425
- toText() {
1426
- return this._native?.text;
1427
- }
1428
- toHtml() {
1429
- return this._native?.html?.documentElement.outerHTML || null;
1430
- }
1431
- toImage() {
1432
- return this._native?.image;
1433
- }
1434
- getItem() {
1435
- let e = this._parsed;
1436
- if (e === void 0) throw Error("Must call 'parse()' before getItem().");
1437
- if (e === null) return null;
1438
- if (this._snapshot) return this._snapshot;
1439
- let t = this;
1440
- return this._snapshot = {
1441
- copyTo: (n, r) => e.copyTo(n, {
1442
- ...t._markOptions,
1443
- ...r
1444
- }),
1445
- getMarkOptions: () => t._markOptions,
1446
- getName: () => e?.getName() ?? "Clipboard Data",
1447
- getCoords: () => e?.getCoords?.() ?? null,
1448
- toText: () => t.toText(),
1449
- toHtml: () => t.toHtml(),
1450
- toImage: () => t.toImage(),
1451
- getSource: () => e?.getSource?.() ?? null,
1452
- isISnapshot: !0
1453
- }, this._snapshot;
1454
- }
1455
- async parse() {
1456
- let e, t = this._native?.text, n = this._native.html;
1457
- if (n === null && t && t.includes("<table")) try {
1458
- let e = new DOMParser().parseFromString(t, d.Html), r = e.querySelector("parsererror");
1459
- if (r) throw new f("Unable to parse: " + r);
1460
- n = e, t = null;
1461
- } catch {
1462
- console.warn("Discovered text as html table but could could not parse.");
1463
- }
1464
- try {
1465
- let r = new Mt(this._runtime, this._topLeft, this._styles, n ? "HTML" : "Text");
1466
- await r.sheet().getCalculation().ready(), await r.sheet().getCalculation().stop();
1467
- let i, a = await Promise.resolve(t ? we(t) : [[]]);
1468
- if (be(n, a, r) ? (e = r.sheet(), i = e.getUsedRange()) : n = null, i) return this._parsed = {
1469
- copyTo: async (e, t) => (await e.copyFrom(i, t))?.getCoords() ?? null,
1470
- getCoords: () => i.getCoords(),
1471
- getSource: () => e,
1472
- getName: () => e.getName()
1473
- }, !0;
1474
- } catch (e) {
1475
- throw e;
1476
- }
1477
- if (!t && !n && this._native.image) {
1478
- let e = this;
1479
- return this._parsed = {
1480
- async copyTo(t, n) {
1481
- let r = t.getSheet(), i = await e._native.image.arrayBuffer(), a = await r.getMovables().addPicture({ source: { buffer: i } }, {
1482
- type: "picture",
1483
- description: m("op.copyImageFromClipboard")
1484
- });
1485
- return r.getView().selectMovables([a]), null;
1486
- },
1487
- getName: () => "Image"
1488
- }, !0;
1489
- }
1490
- return !1;
1491
- }
1492
- get isClipboardItem() {
1493
- return !0;
1494
- }
1495
- }, Y = {
1496
- showFormulaBar: !0,
1497
- showTabs: !0,
1498
- tabRatio: 600,
1499
- showHorizontalScrollbar: !0,
1500
- showVerticalScrollbar: !0,
1501
- showStatusBar: !0,
1502
- activeSheetId: 0
1503
- }, Ft = class {
1504
- constructor(e) {
1505
- this._emitter = new x(this), this._state = { ...Y }, e?.json && this._fromJSON(e?.json);
1506
- }
1507
- isShowFormulaBar() {
1508
- return this._state.showFormulaBar;
1509
- }
1510
- setShowFormulaBar(e) {
1511
- return this._state.showFormulaBar = e, this._emitter.notify("onViewChange"), this;
1512
- }
1513
- isShowTabs() {
1514
- return this._state.showTabs;
1515
- }
1516
- setShowTabs(e) {
1517
- return this._state.showTabs = e, this._emitter.notify("onViewChange"), this;
1518
- }
1519
- getTabRatio() {
1520
- return this._state.tabRatio;
1521
- }
1522
- setTabRatio(e) {
1523
- return this._state.tabRatio = e, this._emitter.notify("onViewChange"), this;
1524
- }
1525
- isShowHorizontalScrollbar() {
1526
- return this._state.showHorizontalScrollbar;
1527
- }
1528
- setShowHorizontalScrollbar(e) {
1529
- return this._state.showHorizontalScrollbar = e, this._emitter.notify("onViewChange"), this;
1530
- }
1531
- isShowVerticalScrollbar() {
1532
- return this._state.showVerticalScrollbar;
1533
- }
1534
- setShowVerticalScrollbar(e) {
1535
- return this._state.showVerticalScrollbar = e, this._emitter.notify("onViewChange"), this;
1536
- }
1537
- isShowStatusBar() {
1538
- return this._state.showStatusBar;
1539
- }
1540
- setShowStatusBar(e) {
1541
- return this._state.showStatusBar = e, this._emitter.notify("onViewChange"), this;
1542
- }
1543
- getActiveSheetId() {
1544
- return this._state.activeSheetId;
1545
- }
1546
- setActiveSheetId(e) {
1547
- let t = this._state, n = t.activeSheetId;
1548
- return t.activeSheetId = e, n !== e && this._emitter.notify("onViewChange"), this;
1549
- }
1550
- addListeners(e, t) {
1551
- return this._emitter.addListeners(e, t);
1552
- }
1553
- toJSON() {
1554
- let e = {}, t = Object.keys(this._state), n = t.length;
1555
- for (let r = 0; r < n; r++) {
1556
- let n = t[r], i = this._state[n];
1557
- i != null && i !== Y[n] && (e[n] = i);
1558
- }
1559
- return Object.keys(e).length === 0 && (e = null), e;
1560
- }
1561
- _fromJSON(e, t = !0) {
1562
- let n = e || {};
1563
- this.update(n, t);
1564
- }
1565
- update(e, t = !0) {
1566
- this._state = {
1567
- ...Y,
1568
- ...this._state,
1569
- ...e
1570
- }, t && this._emitter.notify("onViewChange");
1571
- }
1572
- get [Symbol.toStringTag]() {
1573
- return "[WorkbookView]";
1574
- }
1575
- toString() {
1576
- let e = this.toJSON();
1577
- return e ? JSON.stringify(e) : "DefaultWorkbookView";
1578
- }
1579
- }, It = Object.freeze({
1580
- structure: !1,
1581
- windows: !1,
1582
- revision: !1,
1583
- password: null,
1584
- revisionsPassword: null
1585
- }), Lt = class extends te {
1586
- isWindowsAllowed() {
1587
- return this._isPropertyAllowed("windows");
1588
- }
1589
- isRevisionAllowed() {
1590
- return this._isPropertyAllowed("revision");
1591
- }
1592
- isStructureAllowed() {
1593
- return this._isPropertyAllowed("structure");
1594
- }
1595
- _fromJSON(e) {
1596
- this._properties = e;
1597
- }
1598
- _toJSON(e) {
1599
- let t = this._properties;
1600
- if (t) {
1601
- e = {
1602
- ...e,
1603
- ...t
1604
- };
1605
- let n = Object.keys(t), r = n.length;
1606
- for (let i = 0; i < r; i++) {
1607
- let r = n[i], a = t[r];
1608
- a != null && a !== It[r] && (e[r] = a);
1609
- }
1610
- }
1611
- return super._toJSON(e);
1612
- }
1613
- get [Symbol.toStringTag]() {
1614
- return "[WorkbookProtection]";
1615
- }
1616
- };
1617
- function X(e) {
1618
- return s("error.workbook.invalidSheetKey", { key: e });
1619
- }
1620
- var Rt, zt, Bt = class {
1621
- constructor(e, t) {
1622
- this._add = e, this._get = t;
1623
- }
1624
- add(e) {
1625
- return this._add(e);
1626
- }
1627
- *[Symbol.iterator]() {
1628
- yield* this.getItems();
1629
- }
1630
- getItems(e) {
1631
- return this._get(e?.name, e?.visibility);
1632
- }
1633
- getByName(e) {
1634
- return this._get(e)?.[0] ?? null;
1635
- }
1636
- getCount() {
1637
- return this._get().length;
1638
- }
1639
- }, Z = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), Vt = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
1640
- function Ht(e) {
1641
- let t = s(m("workbook.defaultSheetName"), { n: e + 1 });
1642
- return t === "workbook.defaultSheetName" ? `Sheet${e + 1}` : t;
1643
- }
1644
- function Ut(e, t) {
1645
- return {
1646
- ...je,
1647
- getSheet: () => null,
1648
- toString: () => F(e, t)
1649
- };
1650
- }
1651
- function Wt(e, t = !1) {
1652
- if (!e) throw Error(s("error.workbook.sheetNameBlank"));
1653
- if (Z.test(e)) {
1654
- if (!t) throw Error(function(e) {
1655
- return e ? s("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : s("error.workbook.sheetNameInvalidChars");
1656
- }(e));
1657
- e = e.replace(Z, "");
1658
- }
1659
- if (e.length === 0) throw Error(s("error.workbook.sheetNameBlank"));
1660
- let n = e.length;
1661
- if (n > 31) {
1662
- if (!t) throw Error(s("error.workbook.sheetNameTooLong"));
1663
- e = e.substring(0, 31);
1664
- }
1665
- if (e.charAt(0) === "'" || e.charAt(n - 1) === "'") {
1666
- if (!t) throw Error(s("error.workbook.sheetNameQuotes"));
1667
- e = e.replace(/^'|'$/g, "");
1668
- }
1669
- return e;
1670
- }
1671
- var Gt, Q = class e extends me {
1672
- constructor(e, t, n, r) {
1673
- super(e, t, r), this._workbook = n;
1674
- }
1675
- getSource() {
1676
- return this._workbook;
1677
- }
1678
- _createRanges(t, n) {
1679
- let r = this._options;
1680
- return n && (r = {
1681
- ...this._options,
1682
- getOptions: M(this._options?.getOptions, n)
1683
- }), new e(t, this._internal, this._workbook, r);
1684
- }
1685
- _createRange(e, t) {
1686
- let n = e ? { ...e } : null, r = n ? this._workbook._getSheetRef(n.scope, R.Visibility.VeryHidden) : null;
1687
- if (!r) {
1688
- let e = this._workbook.getSelectedSheet();
1689
- return delete n?.scope, Ut(n, n ? {
1690
- scope: C,
1691
- ...e.getEntireRange().getCoords()
1692
- } : null);
1693
- }
1694
- let i = this._options;
1695
- return t && (i = {
1696
- ...this._options,
1697
- getOptions: M(this._options.getOptions, t)
1698
- }), new Kt(e, A(r.sheet), this._workbook, i);
1699
- }
1700
- async select(e) {
1701
- let t = [], n = null, r = this.getCoords();
1702
- for (let e = 0; e < r.length; e++) {
1703
- let i = r[e];
1704
- i && (n ||= i.scope, i && i.scope === n && t.push(i));
1705
- }
1706
- n ||= this._workbook.getSelectedSheet().getName();
1707
- let i = this._workbook.getSheets().getByName(n);
1708
- if (!i) return;
1709
- let a = await i.getRanges(t).select(e), o = this._workbook._rangesAddressToCoords(a.getCoords());
1710
- return this._createRanges(o);
1711
- }
1712
- addListener(e, t) {
1713
- if (!this.getCoords()) return () => {};
1714
- let n = this._workbook._sheetToWBEvent(e);
1715
- return super.addListener(n, t);
1716
- }
1717
- get [Symbol.toStringTag]() {
1718
- return "[WorkbookRanges]";
1719
- }
1720
- getAddress(e) {
1721
- let t = this._internal.getSheet(), n = t.getEntireRange().getCoords();
1722
- return Me(this.getCoords(), {
1723
- ...n,
1724
- scope: t.getName()
1725
- }, F, ee, e);
1726
- }
1727
- toString() {
1728
- return this.getAddress();
1729
- }
1730
- }, Kt = class e extends Ne {
1731
- constructor(e, t, n, r) {
1732
- super(e, t, r), this._workbook = n;
1733
- }
1734
- _createRanges(e, t) {
1735
- let n = this._options;
1736
- return t && (n = {
1737
- ...this._options,
1738
- getOptions: M(this._options?.getOptions, t)
1739
- }), new Q(e, this._internal, this._workbook, n);
1740
- }
1741
- _createRange(t, n) {
1742
- let r = this._internal;
1743
- if (!t) return T(r.getSheet(), r.getSheet().getEntireCoords());
1744
- if (r.validateCoords(t), r.getSheet().isClosed()) return T(null, r.getSheet().getEntireCoords(), t);
1745
- let i = this._options;
1746
- return n && (i = {
1747
- ...this._options,
1748
- getOptions: M(this._options?.getOptions, n)
1749
- }), new e(t, this._internal, this._workbook, i);
1750
- }
1751
- addListener(e, t) {
1752
- if (!this.getCoords()) return () => {};
1753
- let n = this._workbook._sheetToWBEvent(e);
1754
- return super.addListener(n, t);
1755
- }
1756
- get [Symbol.toStringTag]() {
1757
- return "[WorkbookRange]";
1758
- }
1759
- getAddress(e) {
1760
- let t = this._internal.getSheet(), n = t?.getEntireRange().getCoords() ?? null;
1761
- return F(this.getCoords(), {
1762
- ...n,
1763
- scope: t.getName()
1764
- });
1765
- }
1766
- toString() {
1767
- return this.getAddress();
1768
- }
1769
- }, $ = class {
1770
- constructor(t) {
1771
- this._lastTransactionUUID = null, this._closed = !1, this._listenerOrigin = null, this._lastOriginName = null, this._initializing = !0, this._isDate1904 = !1, this._locale = null, this._localeOverrides = null;
1772
- let n = typeof t == "string" ? { origin: t } : { ...t }, r = n.origin;
1773
- this._origin = typeof r == "string" ? new z(null, { name: r }) : r ?? new z(null), delete n.origin, this._lastOriginName = this._origin.getName(), this._listenerOrigin = this._origin.addListeners({ onChange: () => {
1774
- if (this._closed) return;
1775
- let e = this._origin.getName();
1776
- e !== this._lastOriginName && (this._lastOriginName = e, this._emitter.notify("onNameChange"));
1777
- } });
1778
- let i = n.json;
1779
- delete n.json, this._transactions = n.transactions ?? new fe(), this._id = this._transactions.create(), this._ownTransactions = !n.transactions, this._emitter = new x(this, this._transactions), this._runtime = n.runtime ?? new xe("Workbook Runtime", {
1780
- isDate1904: () => this._isDate1904,
1781
- getLocale: () => this._locale ?? ie() ?? de(),
1782
- getLocaleOverrides: () => this._localeOverrides
1783
- }), this._listenerLanguage = c.addChangeListener(() => {
1784
- this._locale !== null || this._closed || this._notifyAllChange();
1785
- });
1786
- let a = this, o = this._beginCommit({ description: m(i ? "op.openWorkbook" : "op.newWorkbook") });
1787
- try {
1788
- this._strings = n.strings ?? new ae(), this._ownStrings = !n.strings, this._externalBooks = new kt({ json: i?.externalBooks }), this._resources = n.resources ?? new b(), this._ownResources = !n.resources, this._createSheetName = n.createSheetNameCallback ?? Ht;
1789
- let t = n.createSheetCallback;
1790
- t ||= (e) => new E(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (e, n, r, i, o) => {
1791
- let s = null, c = {
1792
- runtime: a._runtime,
1793
- readonly: a._options.readonly ?? !1,
1794
- disableLoadAutoFit: a._options.disableLoadAutoFit ?? !1,
1795
- formulaTransform: a._options.formulaTransform,
1796
- opener: a._options.opener,
1797
- transactions: a._transactions,
1798
- styles: a._styles,
1799
- strings: a._strings,
1800
- resources: a._resources,
1801
- names: a._names,
1802
- workbook: a,
1803
- calculation: a._calculation,
1804
- resolveRange: (e) => a._options.resolveRange?.(e) ?? a.getRange(e),
1805
- container: {
1806
- beforeFromJSON: (t) => {
1807
- s = t, a._addSheetRef({
1808
- name: n,
1809
- id: e,
1810
- visibility: r ?? R.Visibility.Visible,
1811
- sheet: t
1812
- }, i);
1813
- },
1814
- getName: () => {
1815
- let e = a._getSheetRef(s);
1816
- return e ? e.name : n;
1817
- },
1818
- setName: (e, t) => {
1819
- a._getSheetRef(s) && a._setSheetName(s, e, t);
1820
- },
1821
- setNameChangeCallback: (t) => {
1822
- a._sheetOnNameChange.set(e, t);
1823
- },
1824
- getVisibility: () => {
1825
- let e = a._getSheetRef(s);
1826
- return e ? e.visibility : R.Visibility.Visible;
1827
- },
1828
- setVisibility: (e, t) => {
1829
- a._setSheetVisibility(s, e, t);
1830
- },
1831
- setVisibilityCallback: (t) => {
1832
- a._sheetOnVisibilityChange.set(e, t);
1833
- },
1834
- duplicate: () => a._duplicateSheet(s),
1835
- getIndex: () => {
1836
- let e = a._getSheetRef(s);
1837
- return e ? a._getOffsetForId(e.id, a._getSheetRefs(R.Visibility.VeryHidden)) : i;
1838
- },
1839
- setIndex: (e, t) => {
1840
- let n = a._getSheetRef(s, R.Visibility.VeryHidden);
1841
- return !!n && (a._moveSheet(n, e, t), !0);
1842
- },
1843
- setIndexCallback: (t) => {
1844
- a._sheetOnIndexChange.set(e, t);
1845
- },
1846
- requestSelect: async () => (a._setSelectedSheet(s), await this._emitter.notify("onRequestSelect", {
1847
- source: a,
1848
- params: s,
1849
- async: !0
1850
- }), a.getSelectedSheet() === s)
1851
- }
1852
- };
1853
- return o && (c.json = o), s = t(c, n, i, r), s;
1854
- }, this._namedTableSource = new Ee({
1855
- getSheets: () => a._sheets ? a.getSheets().getItems() : e.EmptyArray,
1856
- addSheetsListener: (e, t) => a.addListeners({ onSheetsChange: e }, t)
1857
- }), this._names = n.names ?? new pe({
1858
- addressToRanges: (e) => a.getRanges(e),
1859
- getCurrentScope: () => a.getSelectedSheet().getName(),
1860
- isReadOnly: () => a._options.readonly ?? !1,
1861
- transactions: a._transactions,
1862
- getSources: () => a._calculation ? [a._calculation.getNamedFormulas(), a._namedTableSource] : e.EmptyArray
1863
- }), this._ownNames = !n.names, this._calculation = n.calculation ?? new re({
1864
- runtime: a._runtime,
1865
- functions: n.functions,
1866
- json: i?.calc,
1867
- getActiveCell: () => {
1868
- let e = a.getSelectedSheet(), t = e?.getSelectedRange()?.getCoords();
1869
- return t ? {
1870
- rowIndex: t.rowStart,
1871
- colIndex: t.colStart,
1872
- scope: e.getId()
1873
- } : null;
1874
- },
1875
- getRange: a.getRange.bind(a),
1876
- getRanges: a.getRanges.bind(a),
1877
- createGraphRanges: (e, t) => a._createGraphRanges(e, t),
1878
- getSheetIndex: (e) => {
1879
- if (e === void 0) {
1880
- let e = a.getSelectedSheet();
1881
- return e ? this._getSheetRefs(R.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
1882
- }
1883
- let t = this._getSheetRefs(R.Visibility.VeryHidden);
1884
- e = e.toLowerCase();
1885
- let n = t.length;
1886
- for (let r = 0; r < n; r++) if (t[r].name.toLowerCase() === e) return r;
1887
- try {
1888
- qt.address = e;
1889
- let t = this._names.getItems(qt);
1890
- if (!t || t.length === 0) return -1;
1891
- let n = t[0].getRanges?.()?.getCoords()?.[0]?.scope;
1892
- if (!n) return -1;
1893
- let r = this._getSheetRefs(R.Visibility.VeryHidden);
1894
- n = n.toLowerCase();
1895
- let i = r.length;
1896
- for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === n) return e;
1897
- } catch {
1898
- return -1;
1899
- }
1900
- return -1;
1901
- },
1902
- getSheetCount: () => a.getSheets().getItems({ visibility: R.Visibility.VeryHidden }).length,
1903
- getSheetById: (e) => {
1904
- let t = a.getSheets().getItems({ visibility: R.Visibility.VeryHidden }), n = t.length;
1905
- for (let r = 0; r < n; r++) if (t[r].getId() === e) return t[r];
1906
- return null;
1907
- },
1908
- getSheetByName: (e) => {
1909
- try {
1910
- return a.getSheets().getByName(e) ?? null;
1911
- } catch {
1912
- return null;
1913
- }
1914
- },
1915
- namedCollection: a._names,
1916
- strings: a._strings,
1917
- transactions: a._transactions,
1918
- names: i?.names,
1919
- formulaTransform: n.formulaTransform
1920
- }), this._ownCalculation = !n.calculation, this._scripts = this._createScripts(), this._ownNames = !n.names, this._options = Object.freeze({ ...n });
1921
- let r = async () => {
1922
- this._ownCalculation && await this._calculation.start(), await this._scripts.start(), this._starting = null;
1923
- };
1924
- this._starting = r(), this._starting?.catch(() => {}), i ? this._fromJSON(i) : (this._initState(), this._addSheet(!1)), this._sheets = new Bt((e) => a._addSheetOptions(e), (t, n) => {
1925
- if (t) {
1926
- let r = this._getSheetRef(t, n);
1927
- return r ? [r.sheet] : e.EmptyArray;
1928
- }
1929
- return this._getSheets(n);
1930
- }), this._ownCalculation && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), o.commit({ forceAmend: this._ownTransactions });
1931
- } catch (e) {
1932
- throw o.rollback(), e;
1933
- }
1934
- this._initializing = !1;
1935
- }
1936
- _initState() {
1937
- let e = this._getSheetRefs();
1938
- for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
1939
- let t = this._options;
1940
- this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new Te().getDefaultTheme(), this._styles = t?.styles ?? new Oe(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new Ft()), this._listenerProtection?.(), this._protection = new Lt(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
1941
- n._emitter.notify("onProtectionChange");
1942
- } });
1943
- let n = this;
1944
- this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
1945
- async onAfterStateChange(e, t, r) {
1946
- if (t && t.activeSheetId !== void 0 && t.view === n.getView() && r.getId() === n._lastTransactionUUID && await n._getSheetRef({ id: t.activeSheetId })?.sheet.select(), t && r.getId() !== n._lastTransactionUUID) {
1947
- let r = n.getView().getActiveSheetId();
1948
- t.view === n.getView() && (r = t.activeSheetId);
1949
- let i = 0;
1950
- try {
1951
- i = n._getOffsetForId(r, e.sheetRefsVisible);
1952
- } catch {}
1953
- n._adjustRemoveSelectionIfRequired(i, r);
1954
- }
1955
- n._lastTransactionUUID = r.getId(), n._notifyAllChange();
1956
- },
1957
- onRestoreOrRevert() {
1958
- n._ownCalculation, n._emitter.notify("onInvalidated");
1959
- }
1960
- });
1961
- let r = this._getState();
1962
- r?.listenersSheets && (r?.listenersSheets.forEach((e) => {
1963
- e();
1964
- }), r?.listenersSheets.clear()), this._updateState({
1965
- sheetRefsAll: [],
1966
- sheetRefsVisibleAndHidden: [],
1967
- sheetRefsVisible: [],
1968
- refsById: /* @__PURE__ */ new Map(),
1969
- sheetsById: /* @__PURE__ */ new Map(),
1970
- refsByLowerCaseName: /* @__PURE__ */ new Map(),
1971
- sheetsByLowerCaseName: /* @__PURE__ */ new Map(),
1972
- refsByInstance: /* @__PURE__ */ new Map(),
1973
- lastId: -1,
1974
- sheetsCreated: /* @__PURE__ */ new Set(),
1975
- listenersSheets: /* @__PURE__ */ new Map()
1976
- });
1977
- }
1978
- getId() {
1979
- return this._id;
1980
- }
1981
- getVersionId() {
1982
- return this._transactions.getVersionId(this._id);
1983
- }
1984
- getName() {
1985
- return this._closed ? null : this._origin.getName();
1986
- }
1987
- getOrigin() {
1988
- return this._origin;
1989
- }
1990
- getView() {
1991
- return this._view;
1992
- }
1993
- setView(e) {
1994
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
1995
- if (!e) throw new f(s("error.sheet.emptyView"));
1996
- this._listenerWorkbookView?.();
1997
- let t = this, n = -1;
1998
- return this._listenerWorkbookView = e.addListeners({ onViewChange: (e) => {
1999
- let r = t._getState(), i = this._view.getActiveSheetId(), a = r.sheetRefsVisible, o = this._getOffsetForId(i, a);
2000
- this._activeSheetOffset = o, t._emitter.notify("onViewChange"), n !== i && (t._emitter.notify("onSelectionChange"), t._emitter.notify("onSelectedSheetChange")), n = i;
2001
- } }), this._view = e, t._emitter.notify("onViewChange"), this;
2002
- }
2003
- getRuntime() {
2004
- return this._runtime;
2005
- }
2006
- setDate1904(e) {
2007
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2008
- return this._isDate1904 = e, this._notifyAllChange(), this;
2009
- }
2010
- getLocale() {
2011
- return this._runtime.getLocale();
2012
- }
2013
- getPinnedLocale() {
2014
- return this._locale;
2015
- }
2016
- setLocale(e) {
2017
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2018
- if (e) try {
2019
- new Intl.Locale(e);
2020
- } catch {
2021
- throw Error(s("error.workbook.invalidLocale", { locale: e }));
2022
- }
2023
- return this._locale === e || (this._locale = e, this._notifyAllChange()), this;
2024
- }
2025
- getLocaleOverrides() {
2026
- return this._localeOverrides;
2027
- }
2028
- setLocaleOverrides(e) {
2029
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2030
- let t = e && Object.keys(e).length > 0 ? e : null;
2031
- return this._localeOverrides = t, this._notifyAllChange(), this;
2032
- }
2033
- getStyles() {
2034
- return this._styles;
2035
- }
2036
- getResources() {
2037
- return this._resources;
2038
- }
2039
- getTransactions() {
2040
- return this._transactions;
2041
- }
2042
- getStrings() {
2043
- return this._strings;
2044
- }
2045
- getExternalBooks() {
2046
- return this._externalBooks;
2047
- }
2048
- getTheme() {
2049
- return this._theme;
2050
- }
2051
- setTheme(e) {
2052
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2053
- if (!e) throw new f(s("error.workbook.notSetValue"));
2054
- let t = this._theme;
2055
- return this._theme = e, this.getStyles().setTheme(e), this._emitter.notify("onThemeChange"), t;
2056
- }
2057
- getSelectedSheetIndex() {
2058
- return this._activeSheetOffset;
2059
- }
2060
- getSelectedSheet() {
2061
- let e = this._getSheetRef(this.getSelectedSheetIndex());
2062
- return e ? e?.sheet : null;
2063
- }
2064
- getSheet(e, n = R.Visibility.Visible) {
2065
- if (e === void 0) return this.getSelectedSheet();
2066
- if (!e) throw Error(s("error.workbook.sheetNameNotProvided"));
2067
- let r = this._getSheetRef(e, n);
2068
- if (!r) throw new t(s("error.workbook.sheetNameNotFound", { sheetName: e }));
2069
- return r.sheet;
2070
- }
2071
- getSheetAt(e, n = R.Visibility.Visible) {
2072
- let r = this._getSheetRef(e, n);
2073
- if (!r) throw new t(function(e) {
2074
- return s("error.workbook.sheetIndexNotFound", { index: e });
2075
- }(e));
2076
- return r.sheet;
2077
- }
2078
- getSheets() {
2079
- return this._sheets;
2080
- }
2081
- addSheet(e) {
2082
- return this.getSheets().add(e);
2083
- }
2084
- _getSheets(e = R.Visibility.Visible) {
2085
- let t = this._getSheetRefs(e), n = [], r = t.length;
2086
- for (let e = 0; e < r; e++) n.push(t[e].sheet);
2087
- return n;
2088
- }
2089
- _getSheetRefs(t = R.Visibility.Visible) {
2090
- let n = this._getState();
2091
- return n ? t === R.Visibility.Visible ? n.sheetRefsVisible : t === R.Visibility.Hidden ? n.sheetRefsVisibleAndHidden : t === R.Visibility.VeryHidden ? n.sheetRefsAll : e.EmptyArray : [];
2092
- }
2093
- _getSheetRef(e, t = R.Visibility.Visible) {
2094
- let n = null;
2095
- return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : e instanceof E ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
2096
- }
2097
- _validateNewSheetName(e, t = !0) {
2098
- if (e == null) return e;
2099
- if (Wt(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new f(s("error.workbook.nameTaken"));
2100
- return e.substring(0, 31);
2101
- }
2102
- findValidSheetName(e) {
2103
- e &&= Wt(e, !0);
2104
- try {
2105
- return function(e, t) {
2106
- try {
2107
- if (t(e)) return e;
2108
- } catch {}
2109
- let n, r, i = Vt.exec(e);
2110
- for (i === null ? (n = e + " ", r = 1) : (n = e.substring(0, i.index), r = parseFloat(i[1])); r < 256;) {
2111
- r++;
2112
- let e = "(" + r + ")", i = n.substring(0, 31 - e.length) + e;
2113
- try {
2114
- if (t(i)) return i;
2115
- } catch {}
2116
- }
2117
- throw Error(e + " is not a valid sheet name");
2118
- }(e, (e) => this._validateNewSheetName(e));
2119
- } catch {
2120
- return this._nextSheetName();
2121
- }
2122
- }
2123
- isValidSheetNameCharacter(e) {
2124
- return !Z.test(e);
2125
- }
2126
- _addSheetOptions(e) {
2127
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2128
- if (!this.getProtection().isStructureAllowed()) throw new f(s("error.workbook.protection"));
2129
- let t, n = null;
2130
- t = typeof e == "string" ? { name: e } : typeof e == "number" ? { index: e } : e, t = {
2131
- ...t,
2132
- description: t?.description ?? m("op.addSheet")
2133
- };
2134
- let r = this.beginCommit(t);
2135
- try {
2136
- let e = t?.autoSelect ?? !1;
2137
- n = this._addSheet(!0, t.name, t.index ?? null);
2138
- let i, a, o = this.getView().getActiveSheetId();
2139
- if (!1 !== e) {
2140
- let t = this.getView().getActiveSheetId();
2141
- t = this._getSheetRef(n).id, e && (i = {
2142
- view: this.getView(),
2143
- activeSheetId: o
2144
- }, a = {
2145
- view: this.getView(),
2146
- activeSheetId: t
2147
- });
2148
- }
2149
- if (r.commit({
2150
- description: s("op.addSheetNamed", { name: n.getName() }),
2151
- viewBefore: i,
2152
- viewAfter: a
2153
- }), !1 !== e) {
2154
- let t = typeof e == "boolean" ? void 0 : e;
2155
- n.select(t);
2156
- }
2157
- } catch (e) {
2158
- throw r.rollback(), e;
2159
- }
2160
- return n;
2161
- }
2162
- _nextSheetName(e = null) {
2163
- let t = e ? e.toLowerCase() : null, n = this._getState(), r = n.sheetsByLowerCaseName;
2164
- if (e && r.has(t)) throw new f(function(e) {
2165
- return s("error.workbook.nameDuplicate", { sheetName: e });
2166
- }(e));
2167
- t = (e = this._validateNewSheetName(e)) ? e.toLowerCase() : null;
2168
- let i = n.lastId + 1;
2169
- for (; !e;) {
2170
- let t = this._createSheetName(i), n = t.toLowerCase();
2171
- r.has(n) ? i++ : e = t;
2172
- }
2173
- return this._updateState({ lastId: i }), e;
2174
- }
2175
- _addSheet(e, t = null, n = null) {
2176
- t = this._nextSheetName(t);
2177
- let r = this._getState(), i = this._createSheet(r.lastId, t, R.Visibility.Visible, n, null);
2178
- if (!i) throw new f(s("error.workbook.sheetNameBlank"));
2179
- return e && this._emitter.notify("onSheetsChange"), i;
2180
- }
2181
- _updateSheetRefStates(e) {
2182
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2183
- if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new f(s("error.workbook.protection"));
2184
- let t = e, n = [], r = [], i = t.length;
2185
- for (let e = 0; e < i; e++) t[e].visibility === R.Visibility.Visible ? (n.push(t[e]), r.push(t[e])) : t[e].visibility === R.Visibility.Hidden && r.push(t[e]);
2186
- this._updateState({
2187
- sheetRefsAll: t,
2188
- sheetRefsVisible: n,
2189
- sheetRefsVisibleAndHidden: r
2190
- });
2191
- }
2192
- _addSheetRef(e, t = null) {
2193
- let n = this._getState(), r = n.sheetRefsAll, i = Math.max(0, Math.min(r.length, t ?? r.length)), a = [
2194
- ...r.slice(0, i),
2195
- e,
2196
- ...r.slice(i)
2197
- ];
2198
- this._updateSheetRefStates(a);
2199
- let o = e.sheet, c = e.name.toLowerCase(), l = new Map(n.refsById);
2200
- l.set(e.id, e);
2201
- let u = new Map(n.refsByLowerCaseName);
2202
- u.set(c, e);
2203
- let d = new Map(n.refsByInstance);
2204
- d.set(o, e);
2205
- let f = new Map(n.sheetsById);
2206
- f.set(e.id, o);
2207
- let p = new Map(n.sheetsByLowerCaseName);
2208
- p.set(c, o);
2209
- let m = this, h = n.listenersSheets;
2210
- if (o !== void 0) {
2211
- let t = o.addListeners({
2212
- onBeforeDelete: (e) => {
2213
- m._validateDeleteSheet(e);
2214
- },
2215
- onDelete(e) {
2216
- let t = m._getSheetRef(e, R.Visibility.VeryHidden);
2217
- if (!t) return;
2218
- let n = m._beginCommit({ description: s("op.deleteSheet", { name: t.name }) });
2219
- try {
2220
- let r = m._getState(), i = r.sheetRefsAll, a = m._getOffsetForId(t.id, i), s = [...i];
2221
- s.splice(a, 1), m._updateSheetRefStates(s);
2222
- let c = new Map(r.refsById);
2223
- c.delete(t.id);
2224
- let l = new Map(r.sheetsById);
2225
- l.delete(t.id);
2226
- let u = t.name.toLowerCase(), d = new Map(r.refsByLowerCaseName);
2227
- d.delete(u);
2228
- let f = new Map(r.sheetsByLowerCaseName);
2229
- f.delete(u);
2230
- let p = new Map(r.refsByInstance);
2231
- p.delete(e), r.listenersSheets.get(t.id)();
2232
- let h = new Map(r.listenersSheets);
2233
- 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._emitter.notify("onSheetsChange");
2234
- let g = new Set(r.sheetsCreated);
2235
- g.has(o) && g.delete(o), m._updateState({
2236
- refsById: c,
2237
- sheetsById: l,
2238
- refsByLowerCaseName: d,
2239
- sheetsByLowerCaseName: f,
2240
- refsByInstance: p,
2241
- sheetsCreated: g,
2242
- listenersSheets: h
2243
- }), n.commit();
2244
- } catch (e) {
2245
- throw n.rollback(), e;
2246
- }
2247
- }
2248
- }), r = o.addListeners({ onSelectionChange: (e) => {
2249
- m.getView().getActiveSheetId() === m._getSheetRef(e)?.id && m._emitter.notify("onSelectionChange", {
2250
- source: m,
2251
- params: e
2252
- });
2253
- } }, { transactional: !1 });
2254
- h = new Map(n.listenersSheets), h.set(e.id, () => {
2255
- t(), r();
2256
- });
2257
- }
2258
- let g = n.lastId;
2259
- g !== -1 && (g = Math.max(g, e.id)), this._updateState({ lastId: g }), this._updateState({
2260
- refsById: l,
2261
- refsByLowerCaseName: u,
2262
- refsByInstance: d,
2263
- sheetsById: f,
2264
- sheetsByLowerCaseName: p,
2265
- listenersSheets: h
2266
- }), this._adjustSheetNamesIfRequired();
2267
- let _ = new Set(this._getState().sheetsCreated);
2268
- return _.add(e.sheet), this._updateState({ sheetsCreated: _ }), e;
2269
- }
2270
- _adjustRemoveSelectionIfRequired(e, t) {
2271
- if (this._view.getActiveSheetId() === t) {
2272
- let t, n = this._getState().sheetRefsVisible;
2273
- t = e < n.length ? n[e].id : n[e - 1].id, this._view.setActiveSheetId(t);
2274
- }
2275
- }
2276
- _adjustSheetNamesIfRequired() {
2277
- let e = this._getState(), t = e.lastId;
2278
- if (t === -1) return;
2279
- let n = this._view.getActiveSheetId();
2280
- n ??= (this._view.setActiveSheetId(t), t);
2281
- let r = e.refsById.get(n);
2282
- r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility === R.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(n, e.sheetRefsVisible));
2283
- }
2284
- _validateDeleteSheet(e) {
2285
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2286
- if (!this.getProtection().isStructureAllowed()) throw new f(s("error.workbook.protection"));
2287
- let t = this._getSheetRef(e);
2288
- if (!t) throw new f(function(e) {
2289
- return s("error.workbook.deleteKey", { key: e });
2290
- }(e));
2291
- let n = this._getState().sheetRefsVisible;
2292
- if (n.length === 1 && n[0].id === t.id) throw new f(s("error.workbook.sheetOne"));
2293
- }
2294
- _getOffsetForId(e, t) {
2295
- let n = t.length;
2296
- for (let r = 0; r < n; r++) if (t[r].id === e) return r;
2297
- throw new f(s("error.workbook.noVisibleRefs"));
2298
- }
2299
- find(e) {
2300
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2301
- let t = this._getSheets();
2302
- if (t.length === 1) return t[0].find(e);
2303
- typeof e == "string" && (e = { text: e });
2304
- let n = !e?.reverse, r = e?.disableWrap ?? !1, i = this.getSelectedSheetIndex(), a = i, o = t[a], c = !1;
2305
- e = {
2306
- ...e,
2307
- disableWrap: !0
2308
- };
2309
- let u, d = o.find(e), f = d.next(), p = !1;
2310
- if (e?.from) {
2311
- let t = this._rangesAddressToCoords(e?.from);
2312
- u = {
2313
- colIndex: t[0].colStart,
2314
- rowIndex: t[0].rowStart
2315
- };
2316
- }
2317
- let m = l.createCellComparator(e?.axis, e?.reverse);
2318
- delete (e = { ...e }).from;
2319
- let h = () => {
2320
- if (!p && f.done && (c && a === i ? p = !0 : n ? (a++, a > t.length - 1 && (a = 0, c = !0)) : (a--, a < 0 && (a = t.length - 1, c = !0)), r && c && (p = !0), p || u || !c || a !== i || (p = !0), !p)) {
2321
- o = t[a], d = o.find(e);
2322
- let n = f;
2323
- return f = d.next(), n;
2324
- }
2325
- if (!p && c && a === i && (f.done || !u || !f.done && m(f.value.getCoords(), u) >= 0) && (p = !0), p) {
2326
- let e = f;
2327
- return f = ye, e;
2328
- }
2329
- let s = f;
2330
- return f = d.next(), s;
2331
- };
2332
- return { next: () => {
2333
- let e = h();
2334
- for (; !p && e.done;) e = h();
2335
- return e;
2336
- } };
2337
- }
2338
- replace(e, t, n) {
2339
- let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, c = !n?.maxCount, l = "", u = typeof t == "string" ? Be(t) : null, d = n?.description ?? m("op.replace"), f = this._transactions.beginCommit({ description: d });
2340
- try {
2341
- let d = null, p = null, h = e.next();
2342
- for (; !h.done && r < o;) {
2343
- let o = h.value, s = o.getSheet();
2344
- s !== d && (d = s, p !== null && p.apply(), p = d.getEntireRange().createSparseBuilder({
2345
- axis: n?.axis,
2346
- allowUnorderedWrites: !0
2347
- }));
2348
- let c = a ? t(o) : t;
2349
- c !== void 0 && c !== o && (p.push(o, c), r++, i = o), h = e.next();
2350
- }
2351
- p?.apply(), r === 1 && o === 1 && i && (l = i.getAddress()), r === 0 ? f.rollback() : f.commit({
2352
- description: n?.description ?? (c ? u === null ? m("op.replaceAll") : s("op.replaceAllWith", { value: u }) : l ? u === null ? s("op.replaceAt", { address: l }) : s("op.replaceAtWith", {
2353
- address: l,
2354
- value: u
2355
- }) : u === null ? m("op.replace") : s("op.replaceWith", { value: u })),
2356
- viewAfter: { selection: null }
2357
- });
2358
- } catch (e) {
2359
- throw f.rollback(), e;
2360
- }
2361
- return {
2362
- count: r,
2363
- last: i
2364
- };
2365
- }
2366
- _nextSheetIndex(e, t = this._getSheetRefs()) {
2367
- let n = t.length;
2368
- return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) >= n - 1 ? 0 : e + 1);
2369
- }
2370
- _prevSheetIndex(e, t = this._getSheetRefs()) {
2371
- let n = t.length;
2372
- return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) <= 0 ? n - 1 : e - 1);
2373
- }
2374
- getNextSheet(e) {
2375
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2376
- let t = this._getSheetRefs();
2377
- return t[this._nextSheetIndex(e, t)]?.sheet ?? null;
2378
- }
2379
- getPreviousSheet(e) {
2380
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2381
- let t = this._getSheetRefs();
2382
- return t[this._prevSheetIndex(e, t)]?.sheet ?? null;
2383
- }
2384
- async _duplicateSheet(e) {
2385
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2386
- if (!this.getProtection().isStructureAllowed()) throw new f(s("error.workbook.protection"));
2387
- let t = this._getSheetRefs(), n = this.getSelectedSheetIndex(), r = null;
2388
- if (e) {
2389
- if (r = this._getSheetRef(e), !r) throw new f(X(r));
2390
- } else r = t[n];
2391
- if (!r) return null;
2392
- let i = r.sheet, a = this._strings.beginPersist(), o = this.getResources().beginPersist(), c = this.getStyles().beginPersist(), l = null, u = this.beginCommit(s("op.duplicateNamed", { name: i.getName() }));
2393
- try {
2394
- let e = this._getState().refsByInstance.get(i), r = await i.toJSON(), a = t.length + 1, o = this.findValidSheetName(e.name), s = this._createSheet(a, o, e.visibility, n, r);
2395
- this._emitter.notify("onSheetsChange"), l = s, u.commit();
2396
- } catch (e) {
2397
- throw u.rollback(), e;
2398
- } finally {
2399
- c.endPersist(), o.endPersist(), a.endPersist();
2400
- }
2401
- return l;
2402
- }
2403
- _createRange(e, t) {
2404
- let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope, R.Visibility.VeryHidden) : null;
2405
- if (!r) {
2406
- let e = this.getSelectedSheet();
2407
- return e ? (delete n?.scope, Ut(n, n ? {
2408
- scope: C,
2409
- ...e.getEntireRange().getCoords()
2410
- } : null)) : void console.warn(s("error.workbook.noVisibleRefs"));
2411
- }
2412
- let i = r.sheet, a = null;
2413
- return t && (a = { getOptions: t }), new Kt(e, A(i), this, a);
2414
- }
2415
- _createRanges(e, t) {
2416
- let n = this.getSelectedSheet(), r = null;
2417
- return t && (r = { getOptions: t }), new Q(e, A(n), this, r);
2418
- }
2419
- getRange(e, n) {
2420
- if (e === void 0) return this.getSelectedRange(n);
2421
- try {
2422
- let t = this._rangesAddressToCoords(e);
2423
- if (t.length !== 1) throw new f(s("error.address.singleRangeOnlyAlt"));
2424
- return this._createRange(t[0], n);
2425
- } catch (n) {
2426
- throw n instanceof t ? new t(n.message) : new f(n.message ?? P(e));
2427
- }
2428
- }
2429
- getCell(e) {
2430
- if (e === void 0) return this.getSelectedCell();
2431
- let t = this.getRange(e);
2432
- if (t.size > 1) throw new f(s("error.address.singleCellOnly"));
2433
- return t.getCell();
2434
- }
2435
- getRanges(e, t) {
2436
- let n = this._rangesAddressToCoords(e);
2437
- if (n.length === 0) throw new f(P(e));
2438
- return this._createRanges(n, t);
2439
- }
2440
- _createGraphRanges(e, t) {
2441
- let n = [];
2442
- for (let e = 0; e < t.length; e++) {
2443
- let r = t[e], i = (r.sheetName ? this._getSheetRef(r.sheetName, R.Visibility.VeryHidden) : null)?.sheet ?? this.getSelectedSheet();
2444
- i && n.push(new he(r, A(i), null));
2445
- }
2446
- for (let t = 0; t < e.length; t++) n.push(e[t]);
2447
- return n.length === 0 ? null : new Q(n, A(this.getSelectedSheet()), this, null);
2448
- }
2449
- getStats(e) {
2450
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2451
- let t = this._getSheets(R.Visibility.VeryHidden), n = t.length;
2452
- if (n === 1) return t[0].getStats(e);
2453
- let r = Array(n);
2454
- for (let i = 0; i < n; i++) r[i] = t[i].getStats(e);
2455
- return new Tt(r);
2456
- }
2457
- _activeRangeCoords() {
2458
- let e = this.getSelectedSheet(), t = e.getSelection().getRanges().getCoords(), n = e.getName(), r = t.length, i = Array(r);
2459
- for (let e = 0; e < r; e++) {
2460
- let r = t[e];
2461
- i[e] = {
2462
- colStart: r.colStart,
2463
- colEnd: r.colEnd,
2464
- rowStart: r.rowStart,
2465
- rowEnd: r.rowEnd,
2466
- scope: n
2467
- };
2468
- }
2469
- return i;
2470
- }
2471
- getSelectedRange(e) {
2472
- return this.getRange(this._activeRangeCoords()[0], e);
2473
- }
2474
- getSelectedRanges(e) {
2475
- return this.getRanges(this._activeRangeCoords(), e);
2476
- }
2477
- getSelectedCell() {
2478
- return this.getSelectedSheet().getSelectedCell();
2479
- }
2480
- _rangesAddressToCoords(e, t = !0, n = R.Visibility.Hidden) {
2481
- if (!e) throw new f(s("error.address.noAddress"));
2482
- let r = this.getSelectedSheet(), i = { ...r?.getEntireRange().getCoords() }, a = r?.getName();
2483
- if (a && (i.scope = a), typeof e == "string") {
2484
- let t = e.trim().toLowerCase();
2485
- if (t === "r" || t === "c") {
2486
- let n = this.getSelectedCell().getCoords(), r = {};
2487
- t === "r" ? r.rowStart = r.rowEnd = n.rowIndex : r.colStart = r.colEnd = n.colIndex, e = r;
2488
- }
2489
- }
2490
- let o = this, c = Pe(e, i, Fe, (e) => {
2491
- if (!t) return null;
2492
- if (typeof e == "string") {
2493
- let t = o.getNames().getByName(e)?.getRanges?.();
2494
- if (t) return t.getCoords();
2495
- }
2496
- throw new f(`Invalid sheet reference '${e}'.`);
2497
- }), l = c.length;
2498
- for (let e = 0; e < l; e++) this._validateCoords(c[e], n);
2499
- return c;
2500
- }
2501
- _validateCoords(e, n = R.Visibility.Visible, r = s("error.sheet.oobRange")) {
2502
- if (e === null) return;
2503
- let i = this.getSheet(e.scope, n).getEntireRange().getCoords();
2504
- if (!l.isRangeWithinRange(e, i)) throw new t(r);
2505
- if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new f(s("error.address.invalidRangeInverted"));
2506
- }
2507
- _updateSheetRef(e, t) {
2508
- let n = this._getState(), r = [...n.sheetRefsAll];
2509
- r[this._getOffsetForId(e.id, n.sheetRefsAll)] = t, this._updateSheetRefStates(r);
2510
- let i = new Map(n.refsById);
2511
- i.set(e.id, t);
2512
- let a = e.name.toLowerCase(), o = t.name.toLowerCase(), s = new Map(n.refsByLowerCaseName);
2513
- s.delete(a), s.set(o, t);
2514
- let c = new Map(n.sheetsByLowerCaseName), l = c.get(a);
2515
- c.delete(a), c.set(o, l);
2516
- let u = new Map(n.refsByInstance);
2517
- return u.set(l, t), this._updateState({
2518
- refsById: i,
2519
- refsByLowerCaseName: s,
2520
- sheetsByLowerCaseName: c,
2521
- refsByInstance: u
2522
- }), t;
2523
- }
2524
- _setSheetName(e, t, n) {
2525
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2526
- if (!this.getProtection().isStructureAllowed()) throw new f(s("error.workbook.protection"));
2527
- let r = this._getSheetRef(e);
2528
- if (!r) throw new f(X(e));
2529
- if (t === r.name) return r.sheet;
2530
- if ((t = this._validateNewSheetName(t)) == null) throw new f(s("error.workbook.sheetNameNotProvided"));
2531
- let i = Object.freeze({
2532
- ...r,
2533
- name: t
2534
- }), a = null, o = this.beginCommit(m("op.renameSheet"));
2535
- try {
2536
- let e = this._updateSheetRef(r, i);
2537
- this._adjustSheetNamesIfRequired(), this._sheetOnNameChange.forEach((e, t) => {
2538
- r.id === t && e();
2539
- }), this._emitter.notify("onSheetsChange"), r.id === this.getView().getActiveSheetId() && this._emitter.notify("onSelectionChange"), a = e.sheet, o.commit(n);
2540
- } catch (e) {
2541
- throw o.rollback(), e;
2542
- }
2543
- return a;
2544
- }
2545
- _setSheetVisibility(e, t = R.Visibility.Visible, n) {
2546
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2547
- if (!this.getProtection().isStructureAllowed()) throw new f(s("error.workbook.protection"));
2548
- let r = this._getSheetRef(e, R.Visibility.VeryHidden);
2549
- if (!r) return null;
2550
- if (t === r.visibility) return;
2551
- let i = null, a = "";
2552
- t === R.Visibility.Visible ? a = m("op.unhideSheet") : t === R.Visibility.Hidden ? a = m("op.hideSheet") : t === R.Visibility.VeryHidden && (a = m("op.veryHideSheet"));
2553
- let o = this.beginCommit(a);
2554
- try {
2555
- let e = this._getState().sheetRefsVisible;
2556
- if (t !== R.Visibility.Visible && e.length === 1 && e[0].id === r.id) throw new f(s("error.workbook.sheetOne"));
2557
- let a = {
2558
- ...r,
2559
- visibility: t
2560
- }, c = -1;
2561
- t !== R.Visibility.Visible && (c = this._getOffsetForId(r.id, e)), i = this._updateSheetRef(r, a).sheet, t !== R.Visibility.Visible && this._adjustRemoveSelectionIfRequired(c, r.id), this._adjustSheetNamesIfRequired(), o.commit(n);
2562
- } catch (e) {
2563
- throw o.rollback(), e;
2564
- }
2565
- return this._sheetOnVisibilityChange.forEach((e, t) => {
2566
- r.id === t && e();
2567
- }), this._emitter.notify("onSheetsChange"), i;
2568
- }
2569
- _moveSheet(e, t, n) {
2570
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2571
- if (!this.getProtection().isStructureAllowed()) throw new f(s("error.workbook.protection"));
2572
- let r = null, i = this.beginCommit(s("op.moveSheetNamed", { name: e.name }));
2573
- try {
2574
- let a = this._getState(), o = a.sheetRefsVisible;
2575
- if (t < 0 || t > o.length - 1) throw new f(`Invalid to index: ${t}`);
2576
- let s = {
2577
- view: this.getView(),
2578
- activeSheetId: this.getView().getActiveSheetId()
2579
- }, c = a.sheetRefsAll, l = this._getOffsetForId(e.id, c), u = this._getOffsetForId(o[t].id, c);
2580
- if (l === u) return;
2581
- let d = c[l], p = [...c];
2582
- p.splice(l, 1), p.splice(u, 0, d), this._updateSheetRefStates(p), this._adjustSheetNamesIfRequired(), this._sheetOnIndexChange.forEach((e, t) => {
2583
- t >= l && t <= u && e();
2584
- }), this._emitter.notify("onSheetsChange"), r = d.sheet, i.commit({
2585
- ...n,
2586
- viewBefore: s,
2587
- viewAfter: {
2588
- view: this.getView(),
2589
- activeSheetId: this.getView().getActiveSheetId()
2590
- }
2591
- });
2592
- } catch (e) {
2593
- throw i.rollback(), e;
2594
- }
2595
- return r;
2596
- }
2597
- _setSelectedSheet(e) {
2598
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2599
- let t = this._getSheetRef(e);
2600
- if (!t) throw new f(X(e));
2601
- let n = null;
2602
- return t.visibility !== R.Visibility.Visible && this._setSheetVisibility(t, R.Visibility.Visible), this._view.setActiveSheetId(t.id), n = t.sheet, n;
2603
- }
2604
- getProtection() {
2605
- return this._protection;
2606
- }
2607
- getNames() {
2608
- return this._names;
2609
- }
2610
- getCalculation() {
2611
- return this._calculation;
2612
- }
2613
- createFormula(e, t) {
2614
- return this.getCalculation().createFormula(e, t);
2615
- }
2616
- evaluate(e, t) {
2617
- return this.getCalculation().evaluate(e, t);
2618
- }
2619
- whenCalculationReady() {
2620
- return this.getCalculation().ready();
2621
- }
2622
- getScripts() {
2623
- return this._scripts ||= this._createScripts(), this._scripts;
2624
- }
2625
- _notifyAllChange() {
2626
- this._emitter.notify("onSheetsChange"), this._emitter.notify("onSelectedSheetChange"), this._emitter.notify("onViewChange");
2627
- }
2628
- addListeners(e, t) {
2629
- return this._emitter.addListeners(e, t);
2630
- }
2631
- _sheetToWBEvent(e) {
2632
- let t = this;
2633
- return (n) => {
2634
- let r = () => {
2635
- let e = n.getSource();
2636
- if (e.isICellRanges) {
2637
- let n = [...e.getCoords()], r = n.length;
2638
- for (let t = 0; t < r; t++) {
2639
- let r = n[t];
2640
- !r.scope && e.getSheet().getName() && (n[t] = {
2641
- ...r,
2642
- scope: e.getSheet().getName()
2643
- });
2644
- }
2645
- return t.getRanges(n);
2646
- }
2647
- if (e.isICellRange) {
2648
- let n = e.getCoords(), r = e.getSheet().getName();
2649
- return t.getRange({
2650
- ...n,
2651
- scope: r
2652
- });
2653
- }
2654
- };
2655
- e({
2656
- getSource: r,
2657
- trigger: n.trigger,
2658
- getFrom: () => t.getRanges(n.getFrom()),
2659
- getTo: () => t.getRange(n.getTo()),
2660
- isDataChange: n.isDataChange,
2661
- getTransactionId: n.getTransactionId,
2662
- isUndo: n.isUndo,
2663
- toString: () => `WorkbookRangeEvent: ('${n.trigger}', ${r().toString()})`,
2664
- timeStamp: Date.now()
2665
- });
2666
- };
2667
- }
2668
- _fromJSON(e) {
2669
- if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new f(s("error.workbook.sheetOne"));
2670
- e.theme && (this._theme = new v(e.theme), this._styles.setTheme(this._theme));
2671
- let t = this._strings.beginPersist(), n = this._resources.beginPersist(), r = this._styles.beginPersist();
2672
- try {
2673
- t.fromJSON(e.strings), n.fromJSON(e.resources), r.fromJSON(e.styles), e.date1904 && (this._isDate1904 = !0), e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view ||= {};
2674
- let i = e.sheets, a = i.length, o = e.view.activeSheetId ?? null;
2675
- o !== null && (o = Math.min(Math.max(0, o), a - 1));
2676
- let s = null, c = null, l = -1;
2677
- for (let e = 0; e < a; e++) {
2678
- let t = i[e], n = t.visibility || R.Visibility.Visible, r = e;
2679
- c = r, n === R.Visibility.Visible ? (l++, s === null && (s = r)) : o !== null && o === r && (o = null), this._createSheet(r, t.name, n, l, t.sheet);
2680
- }
2681
- this._updateState({ lastId: c }), e.view.activeSheetId = o ?? s, this.setView(new Ft({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
2682
- let u = this;
2683
- this._protection = new Lt(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
2684
- u._emitter.notify("onProtectionChange", { source: e });
2685
- } }), e.scripts && (this._scripts = this._createScripts(e.scripts)), this._emitter.notify("onLoad");
2686
- } finally {
2687
- r.endPersist(), n.endPersist(), t.endPersist();
2688
- }
2689
- }
2690
- _createScripts(e) {
2691
- let t = this;
2692
- return new jt({
2693
- transactions: this._transactions,
2694
- json: e,
2695
- workbook: t,
2696
- getBuiltInFunctions: () => t._calculation?.getFunctions(),
2697
- onAdd: (e, n) => {
2698
- let r = t._calculation;
2699
- r.getStatus() !== y.Status.Off && r.start().then(async () => {
2700
- let e = n.getFunctions().getItems({ type: "formula" }), t = e.length;
2701
- for (let n = 0; n < t; n++) {
2702
- let t = e[n];
2703
- try {
2704
- await this._calculation.getFunctions().add(t);
2705
- } catch (e) {
2706
- o.error(e?.message ?? String(e), e);
2707
- }
2708
- }
2709
- }).catch(() => {});
2710
- },
2711
- onRemove: (e, t) => {}
2712
- });
2713
- }
2714
- async toJSON(e) {
2715
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2716
- await Promise.resolve(this._starting), await this._emitter.notify("onBeforeSave", { async: !0 });
2717
- let t = { sheets: [] }, n = e?.ignoreStyles ?? !1;
2718
- if (!n) {
2719
- let e = this._theme.toJSON();
2720
- (e ? Object.keys(e).length : 0) > 0 && (t.theme = e);
2721
- }
2722
- if (this._scripts) {
2723
- let e = this._scripts.toJSON();
2724
- e && Object.keys(e).length > 0 && (t.scripts = e);
2725
- }
2726
- this._isDate1904 && (t.date1904 = !0), this._locale && (t.locale = this._locale), this._localeOverrides && (t.localeOverrides = this._localeOverrides);
2727
- let r = e?.ignoreResources ?? !1, i = this._strings.beginPersist(), a = r ? null : this._resources.beginPersist(), o = this._styles.beginPersist();
2728
- try {
2729
- let s = this._getSheetRef(this.getSelectedSheetIndex()).id, c = s, l = null, u = this._getState(), d = u.sheetRefsAll, f = u.sheetsById, p = d.length;
2730
- for (let n = 0; n < p; n++) {
2731
- let r = d[n], i = n + 1, a = await f.get(r.id).toJSON(e), o = {
2732
- name: r.name,
2733
- sheet: a
2734
- };
2735
- r.visibility === R.Visibility.Visible ? l === null && (l = i) : o.visibility = r.visibility, r.id === s && (c = i), t.sheets.push(o);
2736
- }
2737
- if (!n) {
2738
- let e = o.toJSON();
2739
- e && Object.keys(e).length > 0 && (t.styles = e);
2740
- }
2741
- let m = this.getProtection().toJSON();
2742
- m && (t.protection = m);
2743
- let h = this._calculation.toJSON();
2744
- Object.keys(h).length > 0 && (t.calc = h);
2745
- let g = await i.toJSONAsync();
2746
- g && g.length > 0 && (t.strings = g);
2747
- let _ = this._externalBooks.toJSON();
2748
- if (_ && (t.externalBooks = _), !r) {
2749
- let e = await a.toJSONAsync();
2750
- e && e.length > 0 && (t.resources = e);
2751
- }
2752
- let v = this._calculation.getNamedFormulas().toJSON();
2753
- v && v.length > 0 && (t.names = v);
2754
- let y = this._view.toJSON();
2755
- y && (c === l ? delete y.activeSheetId : y.activeSheetId = c, Object.keys(y).length > 0 && (t.view = y));
2756
- } finally {
2757
- o.endPersist(), r || a.endPersist(), i.endPersist();
2758
- }
2759
- return this._emitter.notify("onSave", { params: t }), t;
2760
- }
2761
- isClosed() {
2762
- return this._closed;
2763
- }
2764
- close() {
2765
- if (this._closed) return;
2766
- this._emitter.notify("onClose");
2767
- let e = this._getState();
2768
- e.listenersSheets.forEach((e) => {
2769
- e();
2770
- }), e.listenersSheets.clear();
2771
- let t = e.sheetRefsAll;
2772
- for (let e = t.length - 1; e >= 0; e--) try {
2773
- t[e].sheet.close();
2774
- } catch (e) {
2775
- console.warn("error on close", e);
2776
- }
2777
- this._ownResources, this._ownNames && this._names.close(), this._ownCalculation && this._calculation.close(), this._ownStyles, this._transactionsRemoveListener?.(), this._listenerLanguage?.(), this._listenerOrigin?.(), this._closed = !0;
2778
- }
2779
- beginCommit(e) {
2780
- if (this._closed) throw Error(s("error.workbook.modelClosed"));
2781
- return this._beginCommit(typeof e == "string" ? { description: e } : e);
2782
- }
2783
- doBatch(e, t) {
2784
- let n = this;
2785
- return t = typeof t == "string" ? { description: t } : {
2786
- description: m("op.updateWorkbook"),
2787
- ...t
2788
- }, this._transactions.doBatch(e, t, (e, t) => {
2789
- e.getDepth() === 0 && (n._lastTransactionUUID = e.getId());
2790
- });
2791
- }
2792
- _beginCommit(e) {
2793
- let t = this;
2794
- return this._transactions.beginCommit(typeof e == "string" ? { description: e } : e, (e) => {
2795
- e.getDepth() === 0 && (t._lastTransactionUUID = e.getId());
2796
- });
2797
- }
2798
- _getState() {
2799
- return this._transactions.getState(this._id);
2800
- }
2801
- _updateState(e, t = m("op.updateWorkbook"), n) {
2802
- if (!e) return;
2803
- let r = this._beginCommit(t);
2804
- try {
2805
- r.updateState(this._id, e), r.commit(n);
2806
- } catch (e) {
2807
- throw r.rollback(), e;
2808
- }
2809
- }
2810
- get options() {
2811
- return this._options;
2812
- }
2813
- get [Symbol.toStringTag]() {
2814
- return "[Workbook]";
2815
- }
2816
- toString() {
2817
- return `[${this.getName() ?? "(untitled)"}]`;
2818
- }
2819
- get isIWorkbook() {
2820
- return !0;
2821
- }
2822
- }, qt = { address: null }, Jt = class {
2823
- constructor() {
2824
- this._readFormats = [], this._writeFormats = [], this._encryptions = [];
2825
- }
2826
- async registerReadFormat(e) {
2827
- this._readFormats = await this._registerFormatType(e, this._readFormats);
2828
- }
2829
- async registerWriteFormat(e) {
2830
- this._writeFormats = await this._registerFormatType(e, this._writeFormats);
2831
- }
2832
- async registerEncryption(e) {
2833
- if (!e) throw Error("encryption must be provided.");
2834
- if (!e.key) throw Error("encryption.key must be provided.");
2835
- let t = e.key.toLowerCase(), n = this._encryptions.findIndex((e) => e.key.toLowerCase() === t);
2836
- if (n !== -1) {
2837
- let t = [...this._encryptions];
2838
- t[n] = e, this._encryptions = Object.freeze(t);
2839
- return;
2840
- }
2841
- this._encryptions = Object.freeze([...this._encryptions, e]);
2842
- }
2843
- async getEncryption(e) {
2844
- return this.peekEncryption(e);
2845
- }
2846
- peekEncryption(e) {
2847
- if (!e) return this._encryptions[0] ?? null;
2848
- let t = e.toLowerCase();
2849
- return this._encryptions.find((e) => e.key.toLowerCase() === t) ?? null;
2850
- }
2851
- async detectEncryption(e) {
2852
- for (let t of this._encryptions) if (await t.detect(e)) return t;
2853
- return null;
2854
- }
2855
- async getReadFormats(e) {
2856
- return e ? this._filterFormats(e, this._readFormats) : [...this._readFormats];
2857
- }
2858
- async getWriteFormats(e) {
2859
- return this._writeFormats ? e ? this._filterFormats(e, this._writeFormats) : [...this._writeFormats] : [];
2860
- }
2861
- async _registerFormatType(e, t) {
2862
- return this._registerFormatTypeSync(e, t);
2863
- }
2864
- _registerFormatTypeSync(e, t) {
2865
- if (!e) throw Error("format must be provided.");
2866
- if (!e.key) throw Error("format.key must be provided.");
2867
- let n = e.key.toLowerCase(), r = t.findIndex((e) => e.key.toLowerCase() === n);
2868
- if (r !== -1) {
2869
- let n = [...t];
2870
- return n[r] = e, Object.freeze(n);
2871
- }
2872
- return Object.freeze([...t, e]);
2873
- }
2874
- _filterFormats(e, t, n) {
2875
- if (!e || Object.keys(e).length === 0) {
2876
- if (!n) return [...t];
2877
- e = { ext: n };
2878
- }
2879
- let r = e.search?.toLocaleLowerCase();
2880
- return t.filter((t) => {
2881
- if (r) {
2882
- 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);
2883
- if (!(e || n || i || a || o)) return !1;
2884
- }
2885
- let i = e.ext || n;
2886
- if (i) {
2887
- let e = i.toLocaleLowerCase();
2888
- if (!t.exts.some((t) => t.toLocaleLowerCase() === e)) return !1;
2889
- }
2890
- if (e.mimeType && t.mimeType !== e.mimeType || e.key && t.key.toLocaleLowerCase() !== e.key.toLocaleLowerCase()) return !1;
2891
- if (e.tags) {
2892
- let n = t.tags || [];
2893
- if (!(typeof e.tags == "string" ? [e.tags] : e.tags).every((e) => n.includes(e))) return !1;
2894
- }
2895
- return !0;
2896
- });
2897
- }
2898
- }, Yt = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", Xt = new class {
2899
- constructor() {
2900
- this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new x(this), this._registry = new Jt(), this._defaultStore = new Ye(() => this.getWriteFormats(), () => this.getReadFormats());
2901
- }
2902
- getBackingStore() {
2903
- return this._backingStore ?? this._defaultStore;
2904
- }
2905
- setBackingStore(e) {
2906
- this._backingStore = e ?? null;
2907
- }
2908
- canWrite() {
2909
- return typeof this.getBackingStore().write == "function";
2910
- }
2911
- canRead() {
2912
- return typeof this.getBackingStore().read == "function";
2913
- }
2914
- async install(e) {
2915
- this._setInstalled.has(e) || (await e.register(this._registry), this._setInstalled.add(e));
2916
- }
2917
- addListeners(e, t) {
2918
- return this._emitter.addListeners(e, t);
2919
- }
2920
- addCommitListener(e) {
2921
- return this._emitter.addListeners({ onWrite: (t, n) => {
2922
- n.save && e.onCommit?.({
2923
- store: n.workbook.getTransactions(),
2924
- commitId: n.commitId
2925
- });
2926
- } });
2927
- }
2928
- async getReadFormats(e) {
2929
- return this._registry.getReadFormats(e);
2930
- }
2931
- async getWriteFormats(e) {
2932
- return this._registry.getWriteFormats(e);
2933
- }
2934
- getOrigin(e) {
2935
- return new z(e);
2936
- }
2937
- async read(e) {
2938
- let t = null;
2939
- if (typeof e == "string") e = { source: e };
2940
- else if (Yt(e)) {
2941
- let n = e.getPath();
2942
- if (!n) throw Error("Cannot read from an unbound origin (no path).");
2943
- t = e, e = { source: n };
2944
- }
2945
- let n = e ?? {}, { source: r = null, ...i } = n, a = this.getBackingStore();
2946
- return (a.read ? a : this._defaultStore).read({
2947
- source: r,
2948
- options: i,
2949
- decode: (e, r) => this._decodeBuffer(e, r, n, t)
2950
- });
2951
- }
2952
- async _decodeBuffer(e, t = {}, n, r = null) {
2953
- let i = t.format, a = t.ext;
2954
- if (!i && !a) throw Error("Either format or file extension must be provided to determine read type.");
2955
- let o = (await this._registry.getReadFormats({
2956
- search: i,
2957
- ext: a
2958
- }))[0];
2959
- if (!o) throw new f(s("error.io.readFormatUnavailable", { format: i ?? a }));
2960
- let c = n?.typedCreateWorkbookOptions, l = c ? Object.keys(c).find((e) => e.toLowerCase() === o.key.toLowerCase()) : void 0, u = {
2961
- ...n,
2962
- ...l === void 0 ? void 0 : c[l]
2963
- };
2964
- delete u.typedCreateWorkbookOptions, delete u.source;
2965
- let d = r ?? new z(t.absolutePath ?? null, {
2966
- name: t.name ?? null,
2967
- format: o.key,
2968
- size: t.size ?? null,
2969
- canWrite: t.canWrite ?? !1
2970
- });
2971
- r instanceof z && r.update({
2972
- format: o.key,
2973
- size: t.size ?? null
2974
- }), u.createWorkbookOptions = {
2975
- ...u.createWorkbookOptions || {},
2976
- origin: d
2977
- }, u.readonly !== void 0 && (u.createWorkbookOptions = {
2978
- readonly: u.readonly,
2979
- ...u.createWorkbookOptions
2980
- }, delete u.readonly), u.calcOnly && (u.createWorkbookOptions = {
2981
- disableLoadAutoFit: !0,
2982
- ...u.createWorkbookOptions
2983
- });
2984
- let p = await this._decrypt(e, d, u);
2985
- if (p === null) return null;
2986
- e = p.bytes;
2987
- let m = u?.progress?.onStart?.bind(u.progress);
2988
- m && await Promise.resolve(m(d, t.size));
2989
- try {
2990
- let t = await this._readArrayBuffer(e, o, u);
2991
- return p.password !== null && d.setPassword(p.password), u?.progress?.onComplete?.(d), this._emitter.notify("onRead", {
2992
- params: {
2993
- workbook: t,
2994
- origin: d
2995
- },
2996
- transactional: !1
2997
- }), t;
2998
- } catch (e) {
2999
- throw u?.progress?.onError?.(e), u?.progress?.onComplete?.(null), e;
3000
- }
3001
- }
3002
- async _decrypt(e, t, n) {
3003
- let r = await this._registry.detectEncryption(e);
3004
- if (t instanceof z && t.update({ encryption: r ? r.key : null }), !r) return {
3005
- bytes: e,
3006
- password: null
3007
- };
3008
- let o = null, c = async (t) => {
3009
- try {
3010
- return o = await r.decode(e, t), !0;
3011
- } catch (e) {
3012
- if (!(e instanceof i)) throw e;
3013
- return !1;
3014
- }
3015
- };
3016
- if (n?.password && await c(n.password)) return {
3017
- bytes: o,
3018
- password: n.password
3019
- };
3020
- if (!n?.onPassword) {
3021
- let e = t.getName();
3022
- throw new a(e ? s("error.io.passwordRequired", { name: e }) : s("error.io.passwordRequiredUnnamed"));
3023
- }
3024
- let l = await Promise.resolve(n.onPassword({
3025
- origin: t,
3026
- encryption: r.key,
3027
- validate: c
3028
- }));
3029
- if (l == null) return null;
3030
- if (o !== null || await c(l)) return {
3031
- bytes: o,
3032
- password: l
3033
- };
3034
- throw new i(s("error.io.passwordIncorrect"));
3035
- }
3036
- async writeArrayBuffer(e, t) {
3037
- if (!t?.format) throw Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
3038
- let n = (await this._registry.getWriteFormats({ search: t.format }))[0];
3039
- if (!n) throw new f(s("error.io.writeFormatUnavailable", { format: t.format }));
3040
- return this._writeArrayBuffer(e, n, t);
3041
- }
3042
- async write(e, t, n) {
3043
- if (!e) throw Error("Workbook must be provided.");
3044
- if (!e.isIWorkbook) throw Error("Invalid workbook model provided. Must be an instance of IWorkbook.");
3045
- let r = n, i = null;
3046
- typeof t == "string" ? i = this.getOrigin(t) : Yt(t) ? i = t : t && (r = t);
3047
- let o, c = !i, l = i ?? e.getOrigin(), u = l.getFormat();
3048
- if ((r?.format || u) && (o = (await this._registry.getWriteFormats({ search: r?.format ?? u ?? void 0 }))[0]), o || l.getPath() && l.canWrite() && l.getExtension() || (o = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !o) throw new f(s("error.io.writeFormatUnresolved"));
3049
- if (i && typeof t == "string") {
3050
- let e = i.getPath();
3051
- e && !D(e) && i.update?.({ path: `${e}.${o.exts[0]}` });
3052
- }
3053
- let d = l.getEncryption(), p = e.getOrigin?.(), m = (l instanceof z ? l.getPassword() : null) ?? (p instanceof z ? p.getPassword() : null), h = l.isEncrypted() || (p?.isEncrypted() ?? !1), g = r?.password === void 0 ? m ?? (h ? void 0 : null) : r.password, _ = null;
3054
- if (g === void 0) {
3055
- if (h) {
3056
- let e = l.getName();
3057
- throw new a(e ? s("error.io.passwordRequiredSave", { name: e }) : s("error.io.passwordRequiredSaveUnnamed"));
3058
- }
3059
- } else if (g !== null && (_ = await this._registry.getEncryption(d), !_)) throw new f(s("error.io.encryptionUnavailable"));
3060
- let v = `${l.getName() ?? s("workbook.defaultName")}.${o.exts[0]}`, y = r?.progress, b = !1, x = this, S = null, C = {
3061
- workbook: e,
3062
- format: o,
3063
- origin: l,
3064
- suggestedName: v,
3065
- prompt: r?.prompt,
3066
- async encode(t) {
3067
- await (async () => {
3068
- b || (b = !0, y?.onStart && await Promise.resolve(y.onStart(l)));
3069
- })(), S = e.getTransactions?.()?.getCurrentCommit() ?? S;
3070
- let n = t ? (await x._registry.getWriteFormats({ search: t }))[0] ?? o : o, i = await x._writeArrayBuffer(e, n, r);
3071
- return _ ? _.encode(i, g) : i;
3072
- }
3073
- }, w = null;
3074
- try {
3075
- let t = this.getBackingStore();
3076
- if (!t.write) throw Error("The active backing store is read-only (no write implementation).");
3077
- if (w = await t.write(C), w) {
3078
- g !== void 0 && w instanceof z && (w.setPassword(g), w.update({ encryption: _ ? _.key : null }));
3079
- let t = S ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
3080
- this._emitter.notify("onWrite", {
3081
- params: {
3082
- workbook: e,
3083
- origin: w,
3084
- commitId: t?.getId() ?? null,
3085
- save: c
3086
- },
3087
- transactional: !1
3088
- });
3089
- }
3090
- y?.onComplete && await Promise.resolve(y.onComplete(w));
3091
- } catch (e) {
3092
- let t = e instanceof Error ? e : Error(String(e));
3093
- throw y?.onError && await Promise.resolve(y.onError(t)), y?.onComplete && await Promise.resolve(y.onComplete(null)), t instanceof f ? t : Error(s("error.io.writeFailed", { reason: t.message }), { cause: e });
3094
- }
3095
- return w;
3096
- }
3097
- async writeAs(e, t, n) {
3098
- if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
3099
- let r = e?.getOrigin?.();
3100
- if (!(r instanceof z)) return this.write(e, t, n);
3101
- let i = typeof t == "string" ? t : t.getPath(), a = i && D(i)?.toLowerCase() || null, o = a ? (await this._registry.getWriteFormats({ search: a }))[0]?.key ?? a : null, s = {
3102
- path: r.getPath(),
3103
- name: r.getName(),
3104
- format: r.getFormat(),
3105
- canWrite: r.canWrite()
3106
- };
3107
- r.update({
3108
- path: i,
3109
- name: typeof t == "string" ? null : t.getName(),
3110
- format: o,
3111
- canWrite: i != null
3112
- });
3113
- let c = null;
3114
- try {
3115
- c = await this.write(e, void 0, n);
3116
- } finally {
3117
- c || r.update(s);
3118
- }
3119
- return c;
3120
- }
3121
- _stripExtension(e) {
3122
- let t = D(e);
3123
- return t ? e.slice(0, e.length - t.length - 1) : e;
3124
- }
3125
- _baseName(e) {
3126
- if (!e) return null;
3127
- let t = e.split(/[?#]/)[0], n = t.split(/[/\\]/).pop() ?? t;
3128
- return this._stripExtension(n) || null;
3129
- }
3130
- async _writeArrayBuffer(e, t, n) {
3131
- if (!t) throw Error("A write format must be provided.");
3132
- let r = t.handler;
3133
- if (!r) throw Error(`Unable to resolve a write handler for '${t.key}'.`);
3134
- return r(e, {
3135
- ...n,
3136
- format: t.key
3137
- });
3138
- }
3139
- async _readArrayBuffer(e, t, n) {
3140
- if (!e) throw Error("ArrayBuffer must be specified.");
3141
- if (!t) throw Error("format must be specified.");
3142
- if (e.byteLength === 0) return new $(n?.createWorkbookOptions);
3143
- let r, i = t.handler;
3144
- if (!i) throw Error(`Unable to resolve a read handler for '${t.key}'.`);
3145
- try {
3146
- r = await i(e, n);
3147
- } catch (e) {
3148
- throw e instanceof f ? e : new f(s("error.io.readFailed", {
3149
- format: t.description ?? t.key,
3150
- reason: e?.message ?? String(e)
3151
- }), { cause: e });
3152
- }
3153
- return r;
3154
- }
3155
- }();
3156
- [
3157
- ".woff2",
3158
- ".woff",
3159
- ".ttf",
3160
- ".otf",
3161
- ".ttc"
3162
- ].map((e) => ({
3163
- suffix: e,
3164
- place: (e, t) => t ? `${t}/${e}` : e
3165
- })), Rt ||= {}, zt ||= {};
3166
- var Zt = h({ nowWithPrecision: () => Qt });
3167
- function Qt(e = 6e4) {
3168
- return new Date(Math.floor(Date.now() / e) * e);
3169
- }
3170
- Gt ||= {};
3171
- var $t = class extends Re {
3172
- constructor(e) {
3173
- super(e);
3174
- }
3175
- _initializeOptions(e) {
3176
- return e = {
3177
- ...e,
3178
- coords: {
3179
- colStart: 0,
3180
- rowStart: 0,
3181
- colEnd: (e?.size?.width ?? 5) - 1,
3182
- rowEnd: (e?.size?.height ?? 5) - 1
3183
- },
3184
- getRanges: (e) => null
3185
- }, super._initializeOptions(e);
3186
- }
3187
- };
3188
- export { Ke as _, bt as a, ot as c, lt as d, Pt as f, St as g, et as h, W as i, qe as l, $ as m, U as n, K as o, Nt as p, $t as r, Xt as s, Zt as t, z as u };