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

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 (474) hide show
  1. package/browser/cjs/{C5rQELB0TUeXY6VM.cjs → 3a3qEmdJWFXfGW0q.cjs} +1 -1
  2. package/browser/cjs/9rXsWW4SnEpudhfh.cjs +1 -0
  3. package/browser/cjs/{DiZDRPIgbO3sQ8Vb.cjs → 9vk-L6rRvx20jeQj.cjs} +1 -1
  4. package/browser/cjs/{DxQkFYAFNZubVdn22.cjs → B0FCH1gFfg2bQiPi2.cjs} +1 -1
  5. package/browser/cjs/B3WkiDqFBfA_xxJL2.cjs +1 -0
  6. package/browser/cjs/B4ANcw0mAmhe2Aeb2.cjs +1 -0
  7. package/browser/cjs/B6IXpae7f0J8Ocq62.cjs +1 -0
  8. package/browser/cjs/B6vy56yEA1I3B74O2.cjs +1 -0
  9. package/browser/cjs/B7QDcu7uACQA1y3h.cjs +1 -0
  10. package/browser/cjs/BF8ZxFWyAAnbe4mz.cjs +5 -0
  11. package/browser/cjs/BLAG3kDSthU0SH-E.cjs +2 -0
  12. package/browser/cjs/BPWKnUtyoTrtW567.cjs +1 -0
  13. package/browser/cjs/BQWmn92gYmxC8eWt.cjs +1 -0
  14. package/browser/cjs/BcROQ4pvVajDQ1em.cjs +1 -0
  15. package/browser/cjs/BdJvn1vLXMZvE-8h.cjs +4 -0
  16. package/browser/cjs/BhcbKFKbSWEavYJm.cjs +7 -0
  17. package/browser/cjs/Bncc0oXhFMdj_HuR2.cjs +1 -0
  18. package/browser/cjs/Bo7EQ8niKmwtAwo_2.cjs +1 -0
  19. package/browser/cjs/Bqup1MCJFqTZbLDd2.cjs +1 -0
  20. package/browser/cjs/BsJHSGeWLskirGXg.cjs +14 -0
  21. package/browser/cjs/Bsl_clm06l5cwpML.cjs +32 -0
  22. package/browser/cjs/BvVzIzXLyLxpBcia2.cjs +3 -0
  23. package/browser/cjs/BylqpwnwQYDHIWjX.cjs +5 -0
  24. package/browser/cjs/C-xC6h1TOBr5ZDSe2.cjs +1 -0
  25. package/browser/cjs/{CRx1WvmgBjT8WVyB2.cjs → C0g87ndP2zMUbX6f.cjs} +1 -1
  26. package/browser/cjs/{BziOCn_XEGT4ynN5.cjs → C19UoK2TTtKU_faS.cjs} +1 -1
  27. package/browser/cjs/C1tOH7BEpO_ANMsa.cjs +1 -0
  28. package/browser/cjs/C4cZxb9nRtzTCA40.cjs +1 -0
  29. package/browser/cjs/C9q3zr8iCIoYDrdA.cjs +1 -0
  30. package/browser/cjs/CA_ZsYjkTHSpGK0j.cjs +41 -0
  31. package/browser/cjs/{lEQC21-Sk4lwHy2r2.cjs → CFxueP0tbpmvY1Ip2.cjs} +1 -1
  32. package/browser/cjs/CH7BUjrXIKDIE7XE.cjs +93 -0
  33. package/browser/cjs/CKEselBM-qmMpQBW2.cjs +2 -0
  34. package/browser/cjs/CRcv32tHTbGSGtkh2.cjs +1 -0
  35. package/browser/cjs/{_H5j4dU7HOBYTawU.cjs → CTDN-AYeejrfopDC.cjs} +1 -1
  36. package/browser/cjs/CVHc_cJddJk7J3Zt2.cjs +1 -0
  37. package/browser/cjs/CX7VUEYca9dtWS0N.cjs +1 -0
  38. package/browser/cjs/{BEJFcqVMDMKOvs11.cjs → C_T-ehCAzjaVRmTk.cjs} +1 -1
  39. package/browser/cjs/CaJGoNwTL6pAJ6a42.cjs +1 -0
  40. package/browser/cjs/CfXcRa4RlFmqU0Op2.cjs +1 -0
  41. package/browser/cjs/ClVLjLIRgWqX3Q-F.cjs +1 -0
  42. package/browser/cjs/Co31kjvOPAAYbeF-.cjs +1 -0
  43. package/browser/cjs/CoCKYtBIVeDXxSIq2.cjs +1 -0
  44. package/browser/cjs/CqPb6CbrHTRnbSKa2.cjs +8 -0
  45. package/browser/cjs/CtsduUtTrkcWM02v.cjs +3747 -0
  46. package/browser/cjs/D-N5oLosHPjoj-oG.cjs +1 -0
  47. package/browser/cjs/D2ZPx3v4EVejvhR2.cjs +54 -0
  48. package/browser/cjs/D5Gp16-G3pjMtypl2.cjs +1 -0
  49. package/browser/cjs/D8tkBbkGH5cZzIJP2.cjs +1 -0
  50. package/browser/cjs/DA0nGLC0bEkOhh7G2.cjs +1 -0
  51. package/browser/cjs/DCRe7NqRclU-Jr7p.cjs +1 -0
  52. package/browser/cjs/{EeOVMRq7TuptFKTc2.cjs → DF4l8xrxkcLkgExp2.cjs} +1 -1
  53. package/browser/cjs/{aYuNpndpwcZG5eik2.cjs → DHL7SVvz96-5zSWE2.cjs} +2 -2
  54. package/browser/cjs/DHMQnssVXWjGBSs-.cjs +3 -0
  55. package/browser/cjs/{DsIHLUKUrSrYhFHl.cjs → DIdPQwECld6gubdK2.cjs} +1 -1
  56. package/browser/cjs/DLtFM988NCD-jeBV.cjs +8 -0
  57. package/browser/cjs/DNnMGL1ff8hutxSd.cjs +1 -0
  58. package/browser/cjs/DP1pufP3NJFoDa-g.cjs +3 -0
  59. package/browser/cjs/{CnZfa45XxA-9Jhmp.cjs → DRmo6uoGoqtiVff82.cjs} +1 -1
  60. package/browser/cjs/DSXLVieENYN9qXYl2.cjs +1 -0
  61. package/browser/cjs/{bGMaev70Zd_NXqLM2.cjs → DTZiRVEB3kVK7eK-2.cjs} +1 -1
  62. package/browser/cjs/DU2HMmI1EeHBTvuG.cjs +1 -0
  63. package/browser/cjs/DWzkpizTIJkaqf4J2.cjs +1 -0
  64. package/browser/cjs/DZBKNR9xUMTHWS_D.cjs +1 -0
  65. package/browser/cjs/{B9EI7wviSkHS9ZkH.cjs → D_IilnLuy_hDaBmI.cjs} +1 -1
  66. package/browser/cjs/{a0Z-SXs_N71CtqYb2.cjs → Dg3GaW0QWwnlqetX2.cjs} +1 -1
  67. package/browser/cjs/Dg5fR9uTvYHyxOX62.cjs +22 -0
  68. package/browser/cjs/{Ci8Uu7_b4lwwRLAD2.cjs → Dk1WS0vM-LQJx_EO2.cjs} +1 -1
  69. package/browser/cjs/DpFg69dDCPoOK2BY2.cjs +1 -0
  70. package/browser/cjs/{Cm21F18ga8TluA9h.cjs → DsqHxG-lGZxL1XgQ.cjs} +1 -1
  71. package/browser/cjs/DtlC63s51_88j6AY2.cjs +1 -0
  72. package/browser/cjs/{Du4jBiFxRIF1OjD4.cjs → Dtxj9JR14A-uliu5.cjs} +1 -1
  73. package/browser/cjs/{CpJJh4UnFl1_qFui.cjs → Dx7GQ4ALtNG3kshu.cjs} +1 -1
  74. package/browser/cjs/{DG-AY_xO8RKHtEBE.cjs → Dy50BSaRMmRISD2Y.cjs} +1 -2
  75. package/browser/cjs/GPlG4lbMP89VDHYJ.cjs +126 -0
  76. package/browser/cjs/LD1P-jAXleebK12X.cjs +7 -0
  77. package/browser/cjs/PmwvZPFhqmL4DO582.cjs +1 -0
  78. package/browser/cjs/SATfdSwNygvlOSKC2.cjs +1 -0
  79. package/browser/cjs/TZQc-szdIVnHDH6F.cjs +11 -0
  80. package/browser/cjs/{hzUo76TXMOBqsI3U2.cjs → VgwyOcXDHhEp_NvH2.cjs} +1 -1
  81. package/browser/cjs/XRCcogT-Iqd3Wv6R2.cjs +1 -0
  82. package/browser/cjs/a4xpA8d_d22-GKos.cjs +1 -0
  83. package/browser/cjs/aBulzIf4cHnL7sbw.cjs +1 -0
  84. package/browser/cjs/cexWxRluo6g-NG_u.cjs +1 -0
  85. package/browser/cjs/iYn00uzmSLl2T0oN2.cjs +1 -0
  86. package/browser/cjs/ibvsavYh4kU-xxL8.cjs +1 -0
  87. package/browser/cjs/index.cjs +2 -2
  88. package/browser/cjs/{DIbdDzNf_3S2RYZN.cjs → p3PYFz7cN2z4XQoU.cjs} +1 -1
  89. package/browser/cjs/{D19RglhKiroWfpQn2.cjs → xTT7lHV4HUjeNdMs2.cjs} +1 -1
  90. package/browser/esm/{Cc5IufffX4N-8QpE.mjs → 04mVsW7CTmUlxnOa.mjs} +3 -3
  91. package/browser/esm/0YKBRd7eLIUmcKns.mjs +35 -0
  92. package/browser/esm/13CH9sjvoEqt6nbt2.mjs +37 -0
  93. package/browser/esm/7lIMFL11BRZrMXdc2.mjs +19 -0
  94. package/browser/esm/9CP_UyAqmAHE7-mv.mjs +267 -0
  95. package/{cdn/assets/Bv_96nwOEMHN9Sa0.js → browser/esm/AAHsV9V95k39t9SD.mjs} +27 -29
  96. package/browser/esm/{CsufM5aF6VTLKDWM.mjs → B-Zf8W3s_WXgYxhN.mjs} +12 -12
  97. package/browser/esm/{D3G3tI3DVCUF3Gdk.mjs → B0FNPu0uhX_WW-aJ.mjs} +1 -1
  98. package/{cdn/assets/Chq4BwbjH0sbIkJN2.js → browser/esm/B0aCnXuYD0ZopZdA.mjs} +28 -13
  99. package/browser/esm/B2nEJHcip8raAhdc.mjs +3342 -0
  100. package/browser/esm/B2vjec5TDs2ZJ1eI2.mjs +33 -0
  101. package/browser/esm/{D_t53-8k73CNpV-p.mjs → B50P0gSziuG68Umu.mjs} +88 -72
  102. package/browser/esm/BA6JMESdvw_1-mFg2.mjs +238 -0
  103. package/{cdn/assets/DQ4o4dG7gWbL1X8F.js → browser/esm/BBaNqp1ZjuO25FQg2.mjs} +2 -2
  104. package/browser/esm/BBzzLAeBBFbVvgph2.mjs +8 -0
  105. package/browser/esm/{7rixDGGrR72lXkMV.mjs → BCQgeu38866r56Dh.mjs} +97 -54
  106. package/{cdn/assets/DQ-0yyFAwoWtxmhV2.js → browser/esm/BDZAVKSYpcOp9Dve2.mjs} +1 -1
  107. package/browser/esm/BEWsOD2JQ8dwQCEm2.mjs +427 -0
  108. package/browser/esm/{CG5v2hAwGR5Ptufn.mjs → BEYY8z4FusH7S5K-.mjs} +1 -1
  109. package/browser/esm/{R5bs6kCQSZmsCXz-.mjs → BF842ZtkvebA1LgR.mjs} +1 -1
  110. package/browser/esm/{oYdWyqsKo9ejAdVm.mjs → BG_hG8jUkf0aMzGK.mjs} +2 -2
  111. package/browser/esm/{BLcn1kGRsjURZSzk.mjs → BG_hG8jUkf0aMzGK2.mjs} +2 -2
  112. package/{cdn/assets/8f9hCbpXTTYEgG31.js → browser/esm/BIab7njjwaSXjSEP2.mjs} +2 -2
  113. package/browser/esm/BJJBFdJaP2dMlug92.mjs +280 -0
  114. package/{cdn/assets/EwzqnZl1lTr56hH-.js → browser/esm/BM343UBJqjbDokO62.mjs} +1 -1
  115. package/browser/esm/{vcRSnmAqjwKglEkY.mjs → BOhfbmK18Xj1P7-i.mjs} +2 -2
  116. package/browser/esm/{Blc1T4zLkp8bRC_n2.mjs → BPt7dDNLBsKrZgzO2.mjs} +22 -22
  117. package/browser/esm/{CQM87ZBN7Yzn4Yxr.mjs → BTNqElWtYkKW47Vg.mjs} +3 -3
  118. package/{cdn/assets/CpnA5TZRkPDt4HnM2.js → browser/esm/BVOTzF7NFvB20R7D.mjs} +2 -2
  119. package/browser/esm/BVtQCzVeMOJZq64r2.mjs +394 -0
  120. package/browser/esm/BZZ2IOkVKppFWNLE.mjs +27 -0
  121. package/browser/esm/{BqTFwWLbXXJ0Fu-X2.mjs → B_49GiUSgx96vBvq2.mjs} +2 -2
  122. package/browser/esm/{CpjX81WsWJbXMUoT.mjs → BauR0SATr44ggHRU.mjs} +1712 -941
  123. package/browser/esm/Bc8-re9biUn57kdl.mjs +87777 -0
  124. package/browser/esm/{DFdU1DsC1lXOrejZ.mjs → BcHN_VMA7bLNKKMO.mjs} +1817 -1740
  125. package/browser/esm/{CJPemkFUzhcAD_qR.mjs → Bcjus_Q6f72kE1MK.mjs} +1 -1
  126. package/browser/esm/{Dc0BDcQUGy_WIVFa.mjs → Be2-C5U5LlfLTmyo2.mjs} +1 -1
  127. package/browser/esm/Be7--zCnU6JvLkK1.mjs +637 -0
  128. package/{cdn/assets/CAPgMrAKg07EREFD2.js → browser/esm/Bfq8Gdqf3I7y_Hju.mjs} +1 -1
  129. package/browser/esm/BhGgNWNVYntkJYgU.mjs +155 -0
  130. package/browser/esm/{DXWmgQSeh0_HDxZj.mjs → BiArrlzwKsOlSm00.mjs} +4 -4
  131. package/browser/esm/{Dnx3_xXfRlD6ECfZ2.mjs → Bl5xLu1ou-9zMIBZ2.mjs} +5 -5
  132. package/browser/esm/{DuPdSe-EXFTx9dsc2.mjs → BnFriW2cIcOJkXU42.mjs} +16 -16
  133. package/browser/esm/{8V-VceXEjpADM8qK2.mjs → Bokc-Wu4XBPWKmdt.mjs} +1 -1
  134. package/browser/esm/BuSBBEiK_3KnBr632.mjs +514 -0
  135. package/browser/esm/{DW72HwfnJtQxzoGa.mjs → Bvy9LWN5UHwJXV9i2.mjs} +2 -2
  136. package/{cdn/assets/BMRav2VAqEzDSp3r.js → browser/esm/C04uI3XsvTc6Cc7w2.mjs} +37 -3
  137. package/{cdn/assets/iXWgTu3qpYZHcx1J.js → browser/esm/C1EvC_qPiGiVMrkF.mjs} +963 -946
  138. package/{cdn/assets/Clfp7SznkOrJoQvL.js → browser/esm/C1doaJjkCzQlB_3u2.mjs} +3 -3
  139. package/browser/esm/{BjTf3XA9Swj0ngpH.mjs → C3M_lKSZ_Fq1SQOn.mjs} +2 -2
  140. package/browser/esm/C3qSUuVA-FII3rMU2.mjs +298 -0
  141. package/browser/esm/{1guzFZp1LHz_FwfL.mjs → C6X4CmElTpPxrad6.mjs} +1 -1
  142. package/{cdn/assets/DOsbSsKsexrBoeXa2.js → browser/esm/CA4eJpge9meoO0rj2.mjs} +17 -18
  143. package/browser/esm/CAVONPXgoytyiNK-.mjs +25 -0
  144. package/browser/esm/{CR3jgkduTLczbMjH2.mjs → CPgOplnn6NuHwsZ_.mjs} +1 -1
  145. package/{cdn/assets/B5ZqqASTcBEV5L9K.js → browser/esm/CQBSLdAdR53c7BVh2.mjs} +1 -1
  146. package/{cdn/assets/C1ZePT2B182vSnxW.js → browser/esm/CThP3jXwDzLlUOeI.mjs} +1 -1
  147. package/browser/esm/CTzKk6VuZTohsOIF2.mjs +58 -0
  148. package/{cdn/assets/DRc_Wi5c7WdKHTVN.js → browser/esm/CU1_-PzBC9cDsm5t2.mjs} +6 -6
  149. package/browser/esm/{DZbR5R1fNikjgqYb.mjs → CULlzRLL3s2Dikjg.mjs} +1 -1
  150. package/browser/esm/CUMu_1tXFa0LPKGV.mjs +3324 -0
  151. package/browser/esm/{CH0of3GZTzHviuQV.mjs → CUYBRp4sHMdGwkLT.mjs} +1 -1
  152. package/browser/esm/CYU_-DiQXjh1SEU1.mjs +3343 -0
  153. package/{cdn/assets/BKEzd89UphJ8q1pp2.js → browser/esm/CaTmLXIsIxaOrLcZ.mjs} +504 -405
  154. package/browser/esm/CcK4ACF7d5ogFpAS.mjs +91 -0
  155. package/{cdn/assets/CtXoSHbCUKMY-tSJ2.js → browser/esm/CjFOk9mcZqAngWD2.mjs} +48 -2
  156. package/browser/esm/{CdMv3f8Gyxh8q2RR2.mjs → CmSATmXaMlqwTjAe2.mjs} +1 -1
  157. package/{cdn/assets/COA_SZY2x8q6t4BD.js → browser/esm/CnvlkxK0pS02Z3gZ.mjs} +7 -6
  158. package/browser/esm/{9_bymSfTn_rR_v6W.mjs → Cvw3poNlUmn3qAh0.mjs} +6 -6
  159. package/browser/esm/{47Yv4X226-93If7L.mjs → CwDjNuGkKnVtfJo-.mjs} +1 -1
  160. package/{cdn/assets/BHBJtVTiQByD_y9j2.js → browser/esm/D-egzesxukW7Z_e3.mjs} +2 -2
  161. package/{cdn/assets/hFSDx-LnUOObv-6h.js → browser/esm/D13sLQRMMKrDHepu.mjs} +2 -2
  162. package/{cdn/assets/CGqvy5LwQ4z9J2oD.js → browser/esm/D1bACCJy4F8kANLy.mjs} +1 -1
  163. package/browser/esm/{CfvrjQGuf7vXiQCB.mjs → D5Pa9lfPfAcCGj_N.mjs} +1 -1
  164. package/browser/esm/{DzDwSOBdJh_lx_NM.mjs → DBTB0moKfwOu0F47.mjs} +241 -241
  165. package/browser/esm/{3y_bCend8tkaewDG2.mjs → DHzdEqMCGL_JPh9w2.mjs} +19 -27
  166. package/browser/esm/{fJ1McMt7xzRA_lUX.mjs → DMMtONCySdMHoaMU.mjs} +15 -15
  167. package/browser/esm/{BHmYoIIbNW3GdcqV2.mjs → DTfDzhFtORWkuoRv.mjs} +1 -1
  168. package/browser/esm/{BD7RxHQgrqy_4tb5.mjs → DYyxB53T5uaoyInL2.mjs} +2 -2
  169. package/browser/esm/DZLyXICwEHYRnCuO.mjs +758 -0
  170. package/browser/esm/{D6SKy2BtcWkhfiA02.mjs → DbVSG7Uf7YDQbmc32.mjs} +2 -5
  171. package/browser/esm/Dd80tsdITZsotoCX2.mjs +47 -0
  172. package/browser/esm/{CZWIS7FuqNjbheSw.mjs → DeSDYBzD8e5XXnvq.mjs} +40 -40
  173. package/browser/esm/DeeFxCkhXDF0p1nl.mjs +87 -0
  174. package/{cdn/assets/Cbw0JeJURvQyxIoa.js → browser/esm/DgH-AoqKDdIWg0J8.mjs} +1 -1
  175. package/browser/esm/{qG5zdZZAe6mQIJo32.mjs → DjNR_ZGCbg-xia152.mjs} +5 -5
  176. package/browser/esm/DkuK8fY8vrl7aZpf2.mjs +115 -0
  177. package/browser/esm/{DMX-ZlC_ljcf7oUN.mjs → DmPq6SwNcX1qXKct.mjs} +1 -1
  178. package/{cdn/assets/BDkVAo0CDCTE04ZJ.js → browser/esm/Dn8Z0WK2Hwi8MRnQ.mjs} +1 -1
  179. package/{cdn/assets/BCZjYGV8AqIZghBH.js → browser/esm/DoCYcvHzw3S0MDCW.mjs} +69 -4
  180. package/browser/esm/{BCkXtOM3yKocv7L-2.mjs → DtQu3vHaJfA5KM2H2.mjs} +1 -1
  181. package/browser/esm/{DtXC6uPF2LLktqFE.mjs → DtqMTXq5u5DmS5S1.mjs} +2 -2
  182. package/browser/esm/{CEN8dYSpN2oew8HH.mjs → DuijhgjRhgWB9sCY.mjs} +504 -331
  183. package/browser/esm/{B1NoGosH2YQh01g7.mjs → DyPe20tPiPVm1PLe.mjs} +6 -6
  184. package/{cdn/assets/CopfZ7Y1Zn_PDNXK.js → browser/esm/Dz713G5R9JayR5v1.mjs} +16 -11
  185. package/browser/esm/{NekeSGoazNCraGNC2.mjs → GDYIOITizuJ9xSUf2.mjs} +15 -15
  186. package/{cdn/assets/BykiUmcpDgSRNQI1.js → browser/esm/LfHB39-nf7mi9XC72.mjs} +1 -1
  187. package/browser/esm/{C6CK_4GD9IpxKglV2.mjs → LgoljOEffsYkpZZJ2.mjs} +2452 -2961
  188. package/browser/esm/QNvOHujamKYSXWWA2.mjs +32 -0
  189. package/browser/esm/{D4VqLbEWag8lTWzC2.mjs → R2c8rUTz1GjCQEp-2.mjs} +121 -94
  190. package/browser/esm/S2_pz0y2RTJFpXkS.mjs +15 -0
  191. package/browser/esm/{Gy0CHZTvn4hY-rkx2.mjs → V-oO_EfTyth0iptZ2.mjs} +1 -1
  192. package/browser/esm/XB269tVMhdRHj10G.mjs +674 -0
  193. package/browser/esm/{DVZ_UnchuMRveDG32.mjs → YC83lJ3yRZP57lBl2.mjs} +42 -4
  194. package/browser/esm/{DTaVECXVrgvC48BE.mjs → ZJ32DJlBpN_9fAph.mjs} +3 -3
  195. package/browser/esm/{DMLwXmjo28k_iNEU.mjs → apjOZ6N9KbmyErGz.mjs} +1867 -1402
  196. package/browser/esm/b49cTAZ6BWPQgfYu.mjs +159 -0
  197. package/{cdn/assets/DIQf1pX-j-dWQu_e.js → browser/esm/bvuPDJZmI2O5oihy2.mjs} +139 -138
  198. package/browser/esm/{DBL3Qp5jyPrFg7KI2.mjs → eTXmezPFvAwM_L-D2.mjs} +1 -1
  199. package/{cdn/assets/BVjXdv_wkL1x_8ZJ2.js → browser/esm/ep-IjWXOPg2b-REP2.mjs} +1 -1
  200. package/browser/esm/{Be4QC65cR8N84rTn.mjs → f9r0yTaD2YChFtEg2.mjs} +1 -1
  201. package/browser/esm/fJ0eqh3Ja3O0z1QL.mjs +149 -0
  202. package/browser/esm/{BceIETi6JJRW6Ss62.mjs → gAriGKwELet15RCY2.mjs} +13 -13
  203. package/browser/esm/gCeoOjDjiVaX8dtF2.mjs +119 -0
  204. package/browser/esm/iYNN3Px9AekrMEfu2.mjs +117 -0
  205. package/browser/esm/index.mjs +6 -6
  206. package/browser/esm/{-vgNEEXiEad4bltZ.mjs → j-9DpYsIlTN1mwql.mjs} +16021 -16672
  207. package/browser/esm/{BOl4FzJRD7MplCU72.mjs → jQ5c7MGwQOZq4s5w.mjs} +1 -1
  208. package/browser/esm/kcfC6hY47HklE6Om.mjs +225 -0
  209. package/{cdn/assets/DrUEYcXg6N2D2s1Z.js → browser/esm/lHpMVBxqkkCYD6d12.mjs} +51 -11
  210. package/{cdn/assets/D9-wpGVbTS9rRpxx.js → browser/esm/nBZATD4yR1W5D4Fi.mjs} +1 -1
  211. package/browser/esm/{B4vYIE3kSPTxCgpf2.mjs → rxlYDHBsenoxRx-K2.mjs} +6 -6
  212. package/browser/esm/sfOREE_huDAOcfYs.mjs +15495 -0
  213. package/browser/esm/{BPv6Pw1hW-sV5Fya.mjs → txVgXcuMeWVNWHnZ.mjs} +1 -1
  214. package/{cdn/assets/DvlpP6sUZ9Qzl9s22.js → browser/esm/xzoxSwyGoZdH-ysh.mjs} +193 -172
  215. package/browser/esm/{BVRzmIk5PujkT_Ap.mjs → yFldtlfN_ASKyMll.mjs} +563 -534
  216. package/browser/esm/yVLsr0rcaOFel2nS2.mjs +32 -0
  217. package/cdn/assets/13CH9sjvoEqt6nbt.js +37 -0
  218. package/cdn/assets/{CHttngK66Ido5dWW.js → 2QsTDWiE6SMelbNU2.js} +7 -7
  219. package/cdn/assets/588lLflWQypQVzce.js +27 -0
  220. package/cdn/assets/7lIMFL11BRZrMXdc.js +19 -0
  221. package/{browser/esm/Bv_96nwOEMHN9Sa02.mjs → cdn/assets/AAHsV9V95k39t9SD.js} +27 -29
  222. package/cdn/assets/{D3G3tI3DVCUF3Gdk2.js → B0FNPu0uhX_WW-aJ2.js} +1 -1
  223. package/cdn/assets/B2vjec5TDs2ZJ1eI.js +33 -0
  224. package/cdn/assets/{D_t53-8k73CNpV-p2.js → B50P0gSziuG68Umu2.js} +88 -72
  225. package/cdn/assets/{BhDLR-jtbOOG-tl12.js → B66--qmqjDI4V95v2.js} +25 -25
  226. package/cdn/assets/{C8mUyjJ26jsHGl_D.js → B9hBziUoXFzKPWF02.js} +7 -7
  227. package/cdn/assets/{BixsQGDDf3Iv_PtW2.js → B9oLwnLz9m-TWSPJ2.js} +1867 -1402
  228. package/cdn/assets/{DW7JlG-SQEdLYNar2.js → BB6k7f_6TCVysy8a.js} +41 -3
  229. package/{browser/esm/DQ4o4dG7gWbL1X8F2.mjs → cdn/assets/BBaNqp1ZjuO25FQg.js} +2 -2
  230. package/{browser/esm/DQ-0yyFAwoWtxmhV2.mjs → cdn/assets/BDZAVKSYpcOp9Dve.js} +1 -1
  231. package/cdn/assets/{CG5v2hAwGR5Ptufn2.js → BEYY8z4FusH7S5K-2.js} +1 -1
  232. package/cdn/assets/{R5bs6kCQSZmsCXz-2.js → BF842ZtkvebA1LgR2.js} +1 -1
  233. package/{browser/esm/8f9hCbpXTTYEgG312.mjs → cdn/assets/BIab7njjwaSXjSEP.js} +2 -2
  234. package/cdn/assets/BKouftCLbhExXXXU.js +264 -0
  235. package/{browser/esm/EwzqnZl1lTr56hH-2.mjs → cdn/assets/BM343UBJqjbDokO6.js} +1 -1
  236. package/cdn/assets/{DLEdaT0MmrOxMa2h2.js → BNm-ZCOBoBRceGXA2.js} +59 -59
  237. package/cdn/assets/{vcRSnmAqjwKglEkY2.js → BOhfbmK18Xj1P7-i2.js} +2 -2
  238. package/{browser/esm/BqwvP0318zI2izeL2.mjs → cdn/assets/BPOi08RtEmQdlbtS2.js} +27 -26
  239. package/cdn/assets/{gspQcUnmlRIwG609.js → BSixIKI7PxSqiUGB2.js} +5 -5
  240. package/{browser/esm/RW23HF8taEtW8q9D.mjs → cdn/assets/BT3KOuPzJsNUvy4B.js} +2 -2
  241. package/cdn/assets/BTB79KyzSZf-h-lm2.js +226 -0
  242. package/{browser/esm/CPUlpDM6aAzZzCat2.mjs → cdn/assets/BWtyERLPrUmI8Qbi2.js} +140 -137
  243. package/cdn/assets/{BqTFwWLbXXJ0Fu-X.js → B_49GiUSgx96vBvq.js} +2 -2
  244. package/cdn/assets/B_UEqzmXZIhHAEyS.js +280 -0
  245. package/cdn/assets/B_sKE05xgjFFafjm.js +15496 -0
  246. package/{browser/esm/B0HA_dHcr0kKfudQ.mjs → cdn/assets/BaEH7HZAJkFGHtNj2.js} +203 -180
  247. package/cdn/assets/{CJPemkFUzhcAD_qR.js → Bcjus_Q6f72kE1MK.js} +1 -1
  248. package/cdn/assets/{DbEGszSW_J_k96KJ.js → BdCn57ENgiC2kOsF.js} +2 -2
  249. package/cdn/assets/{Dc0BDcQUGy_WIVFa.js → Be2-C5U5LlfLTmyo.js} +1 -1
  250. package/cdn/assets/Be_TDLQucHiVwNvT.js +268 -0
  251. package/{browser/esm/CAPgMrAKg07EREFD.mjs → cdn/assets/Bfq8Gdqf3I7y_Hju2.js} +1 -1
  252. package/cdn/assets/Bi9IWSBo7DDXROTC.js +8 -0
  253. package/cdn/assets/{Dnx3_xXfRlD6ECfZ.js → Bl5xLu1ou-9zMIBZ.js} +5 -5
  254. package/cdn/assets/{8V-VceXEjpADM8qK.js → Bokc-Wu4XBPWKmdt.js} +1 -1
  255. package/cdn/assets/{DJwQ9abZkyFO9Doy.js → Bqe5WbSIlCRYLcqT.js} +4 -4
  256. package/cdn/assets/{j8nXVEYbO2kPuEYQ.js → BsGz_0JrhSfOZ24Q.js} +3 -3
  257. package/cdn/assets/BsHFBjNwTzc_CKLq2.js +87777 -0
  258. package/cdn/assets/{BJEpPEyFWtLzMIq-2.js → BuyRy9BcgPYo8l8W.js} +1801 -1030
  259. package/cdn/assets/{DVS_5oDniuAFH3vT2.js → ByHzW_x0qXsBJMwv2.js} +2429 -2938
  260. package/{browser/esm/BMRav2VAqEzDSp3r2.mjs → cdn/assets/C04uI3XsvTc6Cc7w.js} +37 -3
  261. package/{browser/esm/Clfp7SznkOrJoQvL.mjs → cdn/assets/C1doaJjkCzQlB_3u.js} +3 -3
  262. package/cdn/assets/C2JMpa_lWCs9k2ZI.js +3324 -0
  263. package/cdn/assets/{Ce5A_D4YBgi_s2KF.js → C2X9NooB33IkSomz.js} +13 -13
  264. package/cdn/assets/{CBuvbUg67ah_3BOZ.js → C3KIo0iwLXhIIMG8.js} +2 -2
  265. package/cdn/assets/{1guzFZp1LHz_FwfL2.js → C6X4CmElTpPxrad6.js} +1 -1
  266. package/cdn/assets/C6X4CmElTpPxrad62.js +24 -0
  267. package/{browser/esm/CU1d8OvDv5TU6fSd.mjs → cdn/assets/C7ZHXwoL2A_nxZjl.js} +484 -385
  268. package/cdn/assets/CA9oxppuFcYDyylE.js +149 -0
  269. package/cdn/assets/{B55nrhIK6gAAu4ZA.js → CAOPlenSF-pjVfqt2.js} +2 -2
  270. package/cdn/assets/CAVONPXgoytyiNK-.js +25 -0
  271. package/{browser/esm/B4iT_CduJeJunwBc.mjs → cdn/assets/CBQrIDBtf5Ibwi96.js} +28 -13
  272. package/cdn/assets/{DvItgGbf8IOWPyxd.js → CCTYceFrydwG3Vyt2.js} +10681 -11332
  273. package/cdn/assets/CDijenaMI_dBIGU-.js +3344 -0
  274. package/cdn/assets/{DCnA2-zB7W_QB-tD2.js → COk-0FZl3cv__3yY2.js} +565 -536
  275. package/cdn/assets/{c6VvwMHfXubjjtyj.js → CP0M0z_IaCwCMGNS.js} +16 -16
  276. package/cdn/assets/{CR3jgkduTLczbMjH.js → CPgOplnn6NuHwsZ_2.js} +1 -1
  277. package/cdn/assets/{-2S675KWulPRlVNb2.js → CPjsJ0CY-AurDJgm2.js} +14 -14
  278. package/{browser/esm/B5ZqqASTcBEV5L9K2.mjs → cdn/assets/CQBSLdAdR53c7BVh.js} +1 -1
  279. package/{browser/esm/C1ZePT2B182vSnxW2.mjs → cdn/assets/CThP3jXwDzLlUOeI2.js} +1 -1
  280. package/cdn/assets/CTzKk6VuZTohsOIF.js +58 -0
  281. package/{browser/esm/DRc_Wi5c7WdKHTVN2.mjs → cdn/assets/CU1_-PzBC9cDsm5t.js} +6 -6
  282. package/cdn/assets/{DZbR5R1fNikjgqYb.js → CULlzRLL3s2Dikjg.js} +1 -1
  283. package/cdn/assets/{CT3G9YRPVfKtHWwf2.js → CUTnOs5iWyc3J2cN2.js} +16 -16
  284. package/cdn/assets/CUYBRp4sHMdGwkLT2.js +24 -0
  285. package/cdn/assets/CUrzB9ponX7LAYXR.js +35 -0
  286. package/{browser/esm/Bl6bX86tSq8hfyb2.mjs → cdn/assets/CWOPhBfYI6R0kz-p.js} +965 -944
  287. package/cdn/assets/CZ3JFujrzd0iX0zL2.js +428 -0
  288. package/cdn/assets/{2CuCH0wi9XPgVzE42.js → CheDxDxt7x0CPz9P.js} +11 -9
  289. package/{browser/esm/CtXoSHbCUKMY-tSJ.mjs → cdn/assets/CjFOk9mcZqAngWD22.js} +48 -2
  290. package/cdn/assets/{CdMv3f8Gyxh8q2RR.js → CmSATmXaMlqwTjAe.js} +1 -1
  291. package/{browser/esm/COA_SZY2x8q6t4BD.mjs → cdn/assets/CnvlkxK0pS02Z3gZ.js} +7 -6
  292. package/cdn/assets/{DKeLjEJPO9nT3bpr.js → CqI09iUEId8rHfJ9.js} +242 -242
  293. package/cdn/assets/{47Yv4X226-93If7L2.js → CwDjNuGkKnVtfJo-2.js} +1 -1
  294. package/cdn/assets/CzEHYpK2SYTRpxDm2.js +239 -0
  295. package/{browser/esm/BHBJtVTiQByD_y9j.mjs → cdn/assets/D-egzesxukW7Z_e32.js} +2 -2
  296. package/{browser/esm/hFSDx-LnUOObv-6h2.mjs → cdn/assets/D13sLQRMMKrDHepu2.js} +2 -2
  297. package/{browser/esm/CGqvy5LwQ4z9J2oD2.mjs → cdn/assets/D1bACCJy4F8kANLy2.js} +1 -1
  298. package/cdn/assets/{CfvrjQGuf7vXiQCB2.js → D5Pa9lfPfAcCGj_N2.js} +1 -1
  299. package/{browser/esm/Dg5wjQp0fArKXlM3.mjs → cdn/assets/D6Uwvg4vo1g0pWZa.js} +16 -11
  300. package/cdn/assets/{D1MA2ed2cLMt7hV9.js → DI4QTfUQPCjSn0kl.js} +41 -41
  301. package/cdn/assets/DIlrvTRlRll76TiE2.js +496 -0
  302. package/cdn/assets/DJBTmv-rddT91Z-N2.js +156 -0
  303. package/cdn/assets/{D-fJXasEYyfRUcj2.js → DPN0a43QHMUmHgo5.js} +3 -3
  304. package/cdn/assets/{BHmYoIIbNW3GdcqV.js → DTfDzhFtORWkuoRv2.js} +1 -1
  305. package/cdn/assets/DYCh_5thAx4qo1ns2.js +3342 -0
  306. package/cdn/assets/{D6SKy2BtcWkhfiA0.js → DbVSG7Uf7YDQbmc3.js} +2 -5
  307. package/cdn/assets/Dd80tsdITZsotoCX.js +47 -0
  308. package/cdn/assets/Dg26zVdGlO10MX0h2.js +159 -0
  309. package/{browser/esm/Cbw0JeJURvQyxIoa.mjs → cdn/assets/DgH-AoqKDdIWg0J8.js} +1 -1
  310. package/cdn/assets/{qG5zdZZAe6mQIJo3.js → DjNR_ZGCbg-xia15.js} +5 -5
  311. package/cdn/assets/{tVOVNvOs6ro8FXqa2.js → Dlq2nAMNpWkqjt9Y.js} +16 -16
  312. package/cdn/assets/DmQ4uKOlhrcJfgk82.js +118 -0
  313. package/cdn/assets/{DaBczM5xU9ev5_or.js → DmRqcUu6qCPcOxgW.js} +2 -2
  314. package/{browser/esm/BDkVAo0CDCTE04ZJ2.mjs → cdn/assets/Dn8Z0WK2Hwi8MRnQ2.js} +1 -1
  315. package/cdn/assets/{DnzDlqizzNkbhJP7.js → DoBxkE57H5PfH7Or.js} +2 -2
  316. package/{browser/esm/BCZjYGV8AqIZghBH.mjs → cdn/assets/DoCYcvHzw3S0MDCW.js} +69 -4
  317. package/cdn/assets/{BCkXtOM3yKocv7L-.js → DtQu3vHaJfA5KM2H.js} +1 -1
  318. package/cdn/assets/{CEN8dYSpN2oew8HH2.js → DuijhgjRhgWB9sCY2.js} +504 -331
  319. package/cdn/assets/DvfekR32WVFv_WrS.js +394 -0
  320. package/cdn/assets/Dz0_oXqVesISvhbJ.js +87 -0
  321. package/cdn/assets/{EjOJX5m8OEL-IjPB.js → I2Cn0c2NkX845WIx.js} +7 -7
  322. package/cdn/assets/Ifw8W-tqHjQnCWZO2.js +299 -0
  323. package/{browser/esm/BykiUmcpDgSRNQI12.mjs → cdn/assets/LfHB39-nf7mi9XC7.js} +1 -1
  324. package/cdn/assets/{CF8m5SqeMaRkGIYM.js → N5PCgig3g9yqotn9.js} +2 -2
  325. package/cdn/assets/QNvOHujamKYSXWWA.js +32 -0
  326. package/cdn/assets/{BzUU8y1IFjREzgog2.js → QT-5i27zeGPhkyui2.js} +20 -28
  327. package/cdn/assets/S2_pz0y2RTJFpXkS2.js +15 -0
  328. package/cdn/assets/{BNybEGR813e3aNIv.js → UNtnFd2ssTtnrqRp.js} +1820 -1743
  329. package/cdn/assets/{Gy0CHZTvn4hY-rkx.js → V-oO_EfTyth0iptZ.js} +1 -1
  330. package/cdn/assets/VEJV_bhNDNNyZAIA2.js +116 -0
  331. package/cdn/assets/WFkg-W8MQ-V6F1Fu.js +758 -0
  332. package/cdn/assets/{DZDynaLqNeVaDoiH2.js → XFQGB8ADW__0ZBoF2.js} +9 -9
  333. package/cdn/assets/{C_Io1QC4CeLGRBrz.js → _gPnIgVx33slqynA.js} +2 -2
  334. package/cdn/assets/b-o8RUlQpF1RaDgI.js +675 -0
  335. package/cdn/assets/{DBL3Qp5jyPrFg7KI.js → eTXmezPFvAwM_L-D.js} +1 -1
  336. package/{browser/esm/BVjXdv_wkL1x_8ZJ2.mjs → cdn/assets/ep-IjWXOPg2b-REP2.js} +1 -1
  337. package/cdn/assets/{mtrwY1hjJeYlmzC-.js → erwt6xEgCY7lDQWp.js} +3 -3
  338. package/cdn/assets/f1iQWnLWVpKZ34XR2.js +91 -0
  339. package/cdn/assets/{Be4QC65cR8N84rTn2.js → f9r0yTaD2YChFtEg.js} +1 -1
  340. package/cdn/assets/gCeoOjDjiVaX8dtF.js +119 -0
  341. package/cdn/assets/{UYgwKnPX3US3Cj2k2.js → gJT4n5za0DqWXFK12.js} +75 -48
  342. package/cdn/assets/{BOl4FzJRD7MplCU7.js → jQ5c7MGwQOZq4s5w2.js} +1 -1
  343. package/{browser/esm/DrUEYcXg6N2D2s1Z2.mjs → cdn/assets/lHpMVBxqkkCYD6d1.js} +51 -11
  344. package/{browser/esm/D9-wpGVbTS9rRpxx.mjs → cdn/assets/nBZATD4yR1W5D4Fi.js} +1 -1
  345. package/cdn/assets/{BPv6Pw1hW-sV5Fya.js → txVgXcuMeWVNWHnZ.js} +1 -1
  346. package/cdn/assets/yVLsr0rcaOFel2nS.js +32 -0
  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/DDOO4tcrO4OfMUDe.mjs +0 -25
  426. package/browser/esm/DDUYQ8FPeh1TJU24.mjs +0 -538
  427. package/browser/esm/DVJd6McdAG5udItH.mjs +0 -27
  428. package/browser/esm/DVQNQmjI2PKkwiOw2.mjs +0 -514
  429. package/browser/esm/D_zNx76HGunFi7xJ.mjs +0 -509
  430. package/browser/esm/DfRGH6mEtIVDWEYN2.mjs +0 -304
  431. package/browser/esm/DnuaqN0xfgqzl8qG.mjs +0 -2687
  432. package/browser/esm/nguMxPB9LKexKBRX.mjs +0 -219
  433. package/browser/esm/qzhFT2j-mpQEQnKs.mjs +0 -16386
  434. package/cdn/assets/2UHIeioUPXrwtZy-2.js +0 -83
  435. package/cdn/assets/BAhvL7M7ZcgZ8eDc2.js +0 -48
  436. package/cdn/assets/BM7OqAUEUk-up7_82.js +0 -134
  437. package/cdn/assets/BNuoKAzs4zkxSocG2.js +0 -44
  438. package/cdn/assets/BU6uQhQhpaLElTT82.js +0 -225
  439. package/cdn/assets/BVgTMDEoPgsWFmku.js +0 -510
  440. package/cdn/assets/BWlMK76Aj2d4ygsH.js +0 -538
  441. package/cdn/assets/BZsx0QHg1RZlM9ZN2.js +0 -15
  442. package/cdn/assets/Bl6C6xWT8E6b7OwJ2.js +0 -239
  443. package/cdn/assets/CGyydD3tRb0ik50l.js +0 -20
  444. package/cdn/assets/CH0of3GZTzHviuQV.js +0 -24
  445. package/cdn/assets/CH0of3GZTzHviuQV2.js +0 -24
  446. package/cdn/assets/CpYlf4dXa_V2v-iS2.js +0 -3188
  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/{507hQYooKKjnRzsZ2.cjs → 507hQYooKKjnRzsZ.cjs} +0 -0
  465. /package/browser/cjs/{BWDfauDHqB6U_2ka2.cjs → BWDfauDHqB6U_2ka.cjs} +0 -0
  466. /package/browser/cjs/{CV4KQsHluMqo1I2Q.cjs → CV4KQsHluMqo1I2Q2.cjs} +0 -0
  467. /package/browser/cjs/{CXlzsh_WHCOsErJ12.cjs → CXlzsh_WHCOsErJ1.cjs} +0 -0
  468. /package/browser/cjs/{DDnGLOLTqLFsdUDS2.cjs → DDnGLOLTqLFsdUDS.cjs} +0 -0
  469. /package/browser/cjs/{DG2kqsWRUtVugjay2.cjs → DG2kqsWRUtVugjay.cjs} +0 -0
  470. /package/browser/cjs/{DM7-R_ltoLbA9jde2.cjs → DM7-R_ltoLbA9jde.cjs} +0 -0
  471. /package/browser/cjs/{Dx79LP1-YCQg8B87.cjs → Dx79LP1-YCQg8B872.cjs} +0 -0
  472. /package/browser/cjs/{JfM6P_qoQQTWakZf.cjs → JfM6P_qoQQTWakZf2.cjs} +0 -0
  473. /package/browser/cjs/{CbLXP9WY38wTcGn5.cjs → NcNz8RfT5V889CMT2.cjs} +0 -0
  474. /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 { r as e } from "./CH0of3GZTzHviuQV2.js";
8
- import { o as t, t as n } from "./D_t53-8k73CNpV-p2.js";
9
- import { A as r, C as i, F as a, O as o, P as s, T as c, V as l, _ as u, d, l as f, m as p, r as m, s as h, t as g, v as _ } from "./CEN8dYSpN2oew8HH2.js";
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 "./Crkvq5j5KIa6eTLI2.js";
11
- import { r as We } from "./D9joTG0Z2zdWHAEa2.js";
12
- var Ge;
13
- Ge ||= {};
14
- var Ke = class extends p {
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 ?? {}, n = e.source;
221
- if (typeof n == "function" && (n = n()), n && typeof n == "object" && typeof n.then == "function" && (n = await Promise.resolve(n)), n == null && (n = await this.resolveSource(e), n == null)) return null;
222
- let r = t.format, i = this._detectSourceType(n);
223
- if (!i) throw Error("Unable to detect source type from provided input.");
224
- let o, s, c = !1;
225
- if (i === "filepath") {
226
- let e = typeof n == "string" && n.startsWith("file://") ? n.slice(7) : n;
227
- n = await this.filePathToFile(e), i = "file", c = !0;
228
- }
229
- switch (i) {
230
- case "file": {
231
- let e = n, t = e?.name, i = t ? `${N(t)}` : "";
232
- o = await e.arrayBuffer(), s = {
233
- format: r,
234
- ext: D(t),
235
- name: i,
236
- absolutePath: t,
237
- size: e.size,
238
- canWrite: c && this._canWriteLocalPath()
239
- };
240
- break;
241
- }
242
- case "blob": {
243
- let e = n;
244
- o = await e.arrayBuffer(), s = {
245
- format: r,
246
- size: e.size
247
- };
248
- break;
249
- }
250
- case "base64": {
251
- let e;
252
- if (n && typeof n == "object" && "base64" in n) e = n.base64;
253
- else if (typeof n == "string" && n.startsWith("data:")) {
254
- let [, t] = n.split(",");
255
- e = t;
256
- } else e = n;
257
- o = a.base64ToArrayBuffer(e), s = {
258
- format: r,
259
- size: e.length
260
- };
261
- break;
262
- }
263
- case "fetch": {
264
- let e, t, i;
265
- if (typeof n == "string") e = n;
266
- else {
267
- if (!n || typeof n != "object" || !("input" in n)) throw Error("Invalid fetch source provided.");
268
- {
269
- let r = n;
270
- e = r.input, t = r.init, i = r.timeout;
271
- }
272
- }
273
- let a = i || 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 i = await n.arrayBuffer();
281
- if (!i) throw Error(`Unable to fetched content: ${u}`);
282
- o = i, s = {
283
- format: r,
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 = n, s = { format: r };
295
- break;
296
- case "stream": {
297
- let e = n.getReader(), t = [], i = 0;
298
- try {
299
- for (;;) {
300
- let { done: n, value: r } = await e.read();
301
- if (n) break;
302
- t.push(r), i += r.length;
303
- }
304
- } finally {
305
- e.releaseLock();
306
- }
307
- let a = new ArrayBuffer(i), c = new Uint8Array(a), l = 0;
308
- for (let e of t) c.set(e, l), l += e.length;
309
- o = a, s = { format: r };
310
- break;
311
- }
312
- default: throw Error(`Unsupported source type: ${i}`);
313
- }
314
- let l = await e.decode(o, {
315
- sourceType: i,
316
- ...s
317
- });
318
- return l ? (await this.onWorkbookRead(l, n), 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]", n = ArrayBuffer.isView(e), r = a.isNodeBuffer(e);
340
- return t || n || r ? "buffer" : typeof ReadableStream < "u" && e instanceof ReadableStream || Object.prototype.toString.call(e) === "[object ReadableStream]" || e && typeof e.getReader == "function" && e.locked !== void 0 ? "stream" : null;
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 g.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 = e({
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 = e({
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(e, t = !0, n = st) {
566
- if (!n || n.length === 0) return e;
567
- if (e === void 0) return n[0];
568
- if (t && e >= n[n.length - 1] || !t && e <= n[0]) return e;
569
- let i = r.findEqualOrGreater(n, e);
570
- return t ? (n[i] === e && (i += 1), n[i] || --i, n[i]) : (--i, n[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]: _("style.builtin.normal"),
622
- [J.Comma]: _("style.builtin.comma"),
623
- [J.Currency]: _("style.builtin.currency"),
624
- [J.Percent]: _("style.builtin.percent"),
625
- [J.Comma0]: _("style.builtin.comma0"),
626
- [J.Currency0]: _("style.builtin.currency0"),
627
- [J.Hyperlink]: _("style.builtin.hyperlink"),
628
- [J.FollowedHyperlink]: _("style.builtin.followedHyperlink"),
629
- [J.Note]: _("style.builtin.note"),
630
- [J.WarningText]: _("style.builtin.warningText"),
631
- [J.Title]: _("style.builtin.title"),
632
- [J.Input]: _("style.builtin.input"),
633
- [J.Output]: _("style.builtin.output"),
634
- [J.Calculation]: _("style.builtin.calculation"),
635
- [J.CheckCell]: _("style.builtin.checkCell"),
636
- [J.LinkedCell]: _("style.builtin.linkedCell"),
637
- [J.Total]: _("style.builtin.total"),
638
- [J.Good]: _("style.builtin.good"),
639
- [J.Bad]: _("style.builtin.bad"),
640
- [J.Neutral]: _("style.builtin.neutral"),
641
- [J.ExplanatoryText]: _("style.builtin.explanatoryText")
642
- }, mt = _("style.builtin.heading"), ht = _("style.builtin.accent"), gt = _("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 = "", s = 0, c = 0;
665
- t > 0 ? (c = t, s = 100 - t, o = u("op.lighterPercent", { percent: t })) : t < 0 && (s = 100 + t, o = u("op.darkerPercent", { percent: -t })), s && a.adjs.push({ [S.AdjustmentType.LumMod]: s }), c && a.adjs.push({ [S.AdjustmentType.LumOff]: c });
666
- let l = new ge({
667
- val: a.val,
668
- adjs: a.adjs
669
- }, n), d = l.toString();
670
- r?.set(d, l);
671
- let f = l.toRGBA().toString();
672
- return i?.set(f, l), {
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, n) {
713
- let r = wt(e), i = wt(n);
714
- return r === i ? e === n ? 0 : typeof e == "number" && typeof n == "number" ? e < n ? -1 : 1 : typeof e == "string" && typeof n == "string" ? e < n ? -1 : +(e > n) : typeof e == "boolean" ? e ? 1 : -1 : t.isError(e) && t.isError(n) ? e.getCode() - n.getCode() : 0 : r - i;
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 t.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
- [n.Number]: 0,
842
- [n.String]: 0,
843
- [n.Boolean]: 0,
844
- [n.Error]: 0,
845
- [n.RichData]: 0,
846
- [n.Null]: 0
847
- }, r = this._children, i = r.length;
848
- for (let t = 0; t < i; t++) {
849
- let i = r[t].getTypedCounts();
850
- e[n.Number] += i[n.Number] ?? 0, e[n.String] += i[n.String] ?? 0, e[n.Boolean] += i[n.Boolean] ?? 0, e[n.Error] += i[n.Error] ?? 0, e[n.RichData] += i[n.RichData] ?? 0, e[n.Null] += i[n.Null] ?? 0;
851
- }
852
- t = Object.freeze(e), this._typedCounts = t;
853
- }
854
- if (e === void 0) return t;
855
- let r = {}, i = e.length;
856
- for (let n = 0; n < i; n++) r[e[n]] = t[e[n]] ?? 0;
857
- return r;
858
- }
859
- get isIRangeStats() {
860
- return !0;
861
- }
862
- _mergeAggregates(e) {
863
- let t = this._children, r = t.length, i = {
864
- count: 0,
865
- min: void 0,
866
- max: void 0,
867
- numericalCount: 0,
868
- sum: 0,
869
- sumSq: 0,
870
- typed: {
871
- [n.Number]: 0,
872
- [n.String]: 0,
873
- [n.Boolean]: 0,
874
- [n.Error]: 0,
875
- [n.RichData]: 0,
876
- [n.Null]: 0
877
- }
878
- };
879
- for (let n = 0; n < r; n++) {
880
- let r = t[n].getAggregates(e);
881
- i.count += r.count;
882
- let a = r.numericalCount;
883
- a <= 0 || (i.numericalCount += a, i.sum += r.sum, i.sumSq += r.varP * a + r.sum * r.sum / a, (i.min === void 0 || r.min < i.min) && (i.min = r.min), (i.max === void 0 || r.max > i.max) && (i.max = r.max));
884
- }
885
- return Le(i);
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
- }, _("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 }, _(o ? "op.saveScripts" : "op.addScript"))) : (delete s[e], r._options.onRemove?.(e, null), this._updateState({ modules: s }, _("op.removeScript"))), r._emitter.notify("onCollectionChange");
963
- }
964
- *[Symbol.iterator]() {
965
- yield* this.getItems();
966
- }
967
- getItems(e) {
968
- let t = this._getState();
969
- if (!t) return r.EmptyArray;
970
- let n = t.modules, i = Object.keys(n), a = i.length;
971
- if (a === 0) return r.EmptyArray;
972
- let o = [], s = e?.name ? e.name.toUpperCase() : null;
973
- for (let e = 0; e < a; e++) {
974
- let t = i[e], r = n[t], a = !0;
975
- s && s !== t.toUpperCase() && (a = !1), a && o.push(r);
976
- }
977
- return o ?? r.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(u("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 = _("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 }, _("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 e = this._getState();
1030
- if (!e) return r.EmptyArray;
1031
- let t = e.modules, n = Object.keys(t), i = n.length, a = {};
1032
- for (let e = 0; e < i; e++) {
1033
- let r = n[e];
1034
- a[r] = t[r].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 e = this._options.getBuiltInFunctions?.();
1058
- if (!e) return r.EmptyArray;
1059
- let t = [];
1060
- for (let n of e.getItems()) n.isBuiltIn() && t.push(n.getName());
1061
- return t;
1062
- } catch {
1063
- return r.EmptyArray;
1064
- }
1065
- }
1066
- async createModule(e) {
1067
- let t = await (await import("./BNuoKAzs4zkxSocG2.js").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(e) {
1156
- await this._emitter.notify("onBeforeSearch", { async: !0 });
1157
- let t = await this._searchable(e);
1158
- if (t.length === 0) return r.EmptyArray;
1159
- let n, i = e?.limit, a = i === void 0 ? e : {
1160
- ...e,
1161
- limit: void 0
1162
- }, o = /* @__PURE__ */ new Set();
1163
- for (let e = 0; e < t.length; e++) {
1164
- let r = await t[e].search(a);
1165
- if (r.length !== 0) {
1166
- n ||= [];
1167
- for (let e = 0; e < r.length; e++) {
1168
- let t = r[e], i = t.getName().toUpperCase();
1169
- o.has(i) || (o.add(i), n.push(t));
1170
- }
1171
- }
1172
- }
1173
- if (!n || n.length === 0) return r.EmptyArray;
1174
- let s = e?.text ? e.text.trim().toUpperCase() : null;
1175
- return s && t.length > 1 && He(n, s), i !== void 0 && n.length > i ? n.slice(0, i) : n;
1176
- }
1177
- async getFunctionCategories(e) {
1178
- await this._emitter.notify("onBeforeSearch", { async: !0 });
1179
- let t = await this._searchable(e);
1180
- if (t.length === 0) return r.EmptyArray;
1181
- if (t.length === 1) return t[0].getCategories(e);
1182
- let n = e?.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 n of await t[0].getCategories(e)) i.set(n.name.toUpperCase(), {
1190
- name: n.name,
1191
- count: n.count
1192
- });
1193
- for (let r = 1; r < t.length; r++) {
1194
- let i = await t[r].search(e?.type ? { type: e.type } : void 0);
1195
- for (let e = 0; e < i.length; e++) {
1196
- let o = i[e], s = o.getName().toUpperCase(), c = !1;
1197
- for (let e = 0; e < r && !c; e++) c = !!t[e].getByName(s);
1198
- if (c) continue;
1199
- let l = await o.getDescriptor().catch(() => null);
1200
- !n && 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 e = this._options?.workbook, t = this._options?.json, n = {};
1213
- if (t) {
1214
- let e = Object.keys(t);
1215
- for (let r = 0; r < e.length; r++) {
1216
- let i = e[r], a = t[i];
1217
- try {
1218
- n[i] = await L(i, a);
1219
- } catch (e) {
1220
- l.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: n,
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 o = a.getItems();
1236
- if (o.length === 0) return Promise.resolve(r.EmptyArray);
1237
- let s = o.length;
1238
- for (let t = 0; t < s; t++) {
1239
- let n = o[t];
1240
- try {
1241
- let t = await n.getFunctions().search({ type: "autoRun" }), r = t.length;
1242
- for (let n = 0; n < r; n++) await t[n].execute(e);
1243
- } catch (e) {
1244
- l.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 ?? f.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 (!f.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), !f.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 o("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, r, i) {
1416
- if (this._parsed = void 0, this._runtime = e, !t) throw new o("nativeItems are required.");
1417
- this._topLeft = n ?? f.EmptyCell, this._native = t, this._markOptions = Object.freeze(r ?? {}), this._styles = i;
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, m.Html), r = e.querySelector("parsererror");
1459
- if (r) throw new h("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: _("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 u("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 = u(_("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(u("error.workbook.sheetNameBlank"));
1653
- if (Z.test(e)) {
1654
- if (!t) throw Error(function(e) {
1655
- return e ? u("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : u("error.workbook.sheetNameInvalidChars");
1656
- }(e));
1657
- e = e.replace(Z, "");
1658
- }
1659
- if (e.length === 0) throw Error(u("error.workbook.sheetNameBlank"));
1660
- let n = e.length;
1661
- if (n > 31) {
1662
- if (!t) throw Error(u("error.workbook.sheetNameTooLong"));
1663
- e = e.substring(0, 31);
1664
- }
1665
- if (e.charAt(0) === "'" || e.charAt(n - 1) === "'") {
1666
- if (!t) throw Error(u("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(e) {
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 t = typeof e == "string" ? { origin: e } : { ...e }, n = t.origin;
1773
- this._origin = typeof n == "string" ? new z(null, { name: n }) : n ?? new z(null), delete t.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 = t.json;
1779
- delete t.json, this._transactions = t.transactions ?? new fe(), this._id = this._transactions.create(), this._ownTransactions = !t.transactions, this._emitter = new x(this, this._transactions), this._runtime = t.runtime ?? new xe("Workbook Runtime", {
1780
- isDate1904: () => this._isDate1904,
1781
- getLocale: () => this._locale ?? ie() ?? de(),
1782
- getLocaleOverrides: () => this._localeOverrides
1783
- }), this._listenerLanguage = d.addChangeListener(() => {
1784
- this._locale !== null || this._closed || this._notifyAllChange();
1785
- });
1786
- let a = this, o = this._beginCommit({ description: _(i ? "op.openWorkbook" : "op.newWorkbook") });
1787
- try {
1788
- this._strings = t.strings ?? new ae(), this._ownStrings = !t.strings, this._externalBooks = new kt({ json: i?.externalBooks }), this._resources = t.resources ?? new b(), this._ownResources = !t.resources, this._createSheetName = t.createSheetNameCallback ?? Ht;
1789
- let e = t.createSheetCallback;
1790
- e ||= (e) => new E(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, 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: (e) => {
1807
- s = e, a._addSheetRef({
1808
- name: n,
1809
- id: t,
1810
- visibility: r ?? R.Visibility.Visible,
1811
- sheet: e
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: (e) => {
1822
- a._sheetOnNameChange.set(t, e);
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: (e) => {
1832
- a._sheetOnVisibilityChange.set(t, e);
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: (e) => {
1844
- a._sheetOnIndexChange.set(t, e);
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 = e(c, n, i, r), s;
1854
- }, this._namedTableSource = new Ee({
1855
- getSheets: () => a._sheets ? a.getSheets().getItems() : r.EmptyArray,
1856
- addSheetsListener: (e, t) => a.addListeners({ onSheetsChange: e }, t)
1857
- }), this._names = t.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] : r.EmptyArray
1863
- }), this._ownNames = !t.names, this._calculation = t.calculation ?? new re({
1864
- runtime: a._runtime,
1865
- functions: t.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: t.formulaTransform
1920
- }), this._ownCalculation = !t.calculation, this._scripts = this._createScripts(), this._ownNames = !t.names, this._options = Object.freeze({ ...t });
1921
- let n = async () => {
1922
- this._ownCalculation && await this._calculation.start(), await this._scripts.start(), this._starting = null;
1923
- };
1924
- this._starting = n(), this._starting?.catch(() => {}), i ? this._fromJSON(i) : (this._initState(), this._addSheet(!1)), this._sheets = new Bt((e) => a._addSheetOptions(e), (e, t) => {
1925
- if (e) {
1926
- let n = this._getSheetRef(e, t);
1927
- return n ? [n.sheet] : r.EmptyArray;
1928
- }
1929
- return this._getSheets(t);
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(u("error.workbook.modelClosed"));
1995
- if (!e) throw new h(u("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(u("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(u("error.workbook.modelClosed"));
2018
- if (e) try {
2019
- new Intl.Locale(e);
2020
- } catch {
2021
- throw Error(u("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(u("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(u("error.workbook.modelClosed"));
2053
- if (!e) throw new h(u("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, t = R.Visibility.Visible) {
2065
- if (e === void 0) return this.getSelectedSheet();
2066
- if (!e) throw Error(u("error.workbook.sheetNameNotProvided"));
2067
- let n = this._getSheetRef(e, t);
2068
- if (!n) throw new i(u("error.workbook.sheetNameNotFound", { sheetName: e }));
2069
- return n.sheet;
2070
- }
2071
- getSheetAt(e, t = R.Visibility.Visible) {
2072
- let n = this._getSheetRef(e, t);
2073
- if (!n) throw new i(function(e) {
2074
- return u("error.workbook.sheetIndexNotFound", { index: e });
2075
- }(e));
2076
- return n.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(e = R.Visibility.Visible) {
2090
- let t = this._getState();
2091
- return t ? e === R.Visibility.Visible ? t.sheetRefsVisible : e === R.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === R.Visibility.VeryHidden ? t.sheetRefsAll : r.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 h(u("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(u("error.workbook.modelClosed"));
2128
- if (!this.getProtection().isStructureAllowed()) throw new h(u("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 ?? _("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: u("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 h(function(e) {
2165
- return u("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 h(u("error.workbook.sheetNameBlank"));
2179
- return e && this._emitter.notify("onSheetsChange"), i;
2180
- }
2181
- _updateSheetRefStates(e) {
2182
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2183
- if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new h(u("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, s = e.name.toLowerCase(), c = new Map(n.refsById);
2200
- c.set(e.id, e);
2201
- let l = new Map(n.refsByLowerCaseName);
2202
- l.set(s, 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(s, 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: u("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: c,
2261
- refsByLowerCaseName: l,
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(u("error.workbook.modelClosed"));
2286
- if (!this.getProtection().isStructureAllowed()) throw new h(u("error.workbook.protection"));
2287
- let t = this._getSheetRef(e);
2288
- if (!t) throw new h(function(e) {
2289
- return u("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 h(u("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 h(u("error.workbook.noVisibleRefs"));
2298
- }
2299
- find(e) {
2300
- if (this._closed) throw Error(u("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], s = !1;
2305
- e = {
2306
- ...e,
2307
- disableWrap: !0
2308
- };
2309
- let c, l = o.find(e), d = l.next(), p = !1;
2310
- if (e?.from) {
2311
- let t = this._rangesAddressToCoords(e?.from);
2312
- c = {
2313
- colIndex: t[0].colStart,
2314
- rowIndex: t[0].rowStart
2315
- };
2316
- }
2317
- let m = f.createCellComparator(e?.axis, e?.reverse);
2318
- delete (e = { ...e }).from;
2319
- let h = () => {
2320
- if (!p && d.done && (s && a === i ? p = !0 : n ? (a++, a > t.length - 1 && (a = 0, s = !0)) : (a--, a < 0 && (a = t.length - 1, s = !0)), r && s && (p = !0), p || c || !s || a !== i || (p = !0), !p)) {
2321
- o = t[a], l = o.find(e);
2322
- let n = d;
2323
- return d = l.next(), n;
2324
- }
2325
- if (!p && s && a === i && (d.done || !c || !d.done && m(d.value.getCoords(), c) >= 0) && (p = !0), p) {
2326
- let e = d;
2327
- return d = ye, e;
2328
- }
2329
- let u = d;
2330
- return d = l.next(), u;
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, s = !n?.maxCount, c = "", l = typeof t == "string" ? Be(t) : null, d = n?.description ?? _("op.replace"), f = this._transactions.beginCommit({ description: d });
2340
- try {
2341
- let d = null, p = null, m = e.next();
2342
- for (; !m.done && r < o;) {
2343
- let o = m.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), m = e.next();
2350
- }
2351
- p?.apply(), r === 1 && o === 1 && i && (c = i.getAddress()), r === 0 ? f.rollback() : f.commit({
2352
- description: n?.description ?? (s ? l === null ? _("op.replaceAll") : u("op.replaceAllWith", { value: l }) : c ? l === null ? u("op.replaceAt", { address: c }) : u("op.replaceAtWith", {
2353
- address: c,
2354
- value: l
2355
- }) : l === null ? _("op.replace") : u("op.replaceWith", { value: l })),
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(u("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(u("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(u("error.workbook.modelClosed"));
2386
- if (!this.getProtection().isStructureAllowed()) throw new h(u("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 h(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(), s = this.getStyles().beginPersist(), c = null, l = this.beginCommit(u("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"), c = s, l.commit();
2396
- } catch (e) {
2397
- throw l.rollback(), e;
2398
- } finally {
2399
- s.endPersist(), o.endPersist(), a.endPersist();
2400
- }
2401
- return c;
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(u("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, t) {
2420
- if (e === void 0) return this.getSelectedRange(t);
2421
- try {
2422
- let n = this._rangesAddressToCoords(e);
2423
- if (n.length !== 1) throw new h(u("error.address.singleRangeOnlyAlt"));
2424
- return this._createRange(n[0], t);
2425
- } catch (t) {
2426
- throw t instanceof i ? new i(t.message) : new h(t.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 h(u("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 h(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(u("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 h(u("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, s = 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 h(`Invalid sheet reference '${e}'.`);
2497
- }), c = s.length;
2498
- for (let e = 0; e < c; e++) this._validateCoords(s[e], n);
2499
- return s;
2500
- }
2501
- _validateCoords(e, t = R.Visibility.Visible, n = u("error.sheet.oobRange")) {
2502
- if (e === null) return;
2503
- let r = this.getSheet(e.scope, t).getEntireRange().getCoords();
2504
- if (!f.isRangeWithinRange(e, r)) throw new i(n);
2505
- if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new h(u("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(u("error.workbook.modelClosed"));
2526
- if (!this.getProtection().isStructureAllowed()) throw new h(u("error.workbook.protection"));
2527
- let r = this._getSheetRef(e);
2528
- if (!r) throw new h(X(e));
2529
- if (t === r.name) return r.sheet;
2530
- if ((t = this._validateNewSheetName(t)) == null) throw new h(u("error.workbook.sheetNameNotProvided"));
2531
- let i = Object.freeze({
2532
- ...r,
2533
- name: t
2534
- }), a = null, o = this.beginCommit(_("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(u("error.workbook.modelClosed"));
2547
- if (!this.getProtection().isStructureAllowed()) throw new h(u("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 = _("op.unhideSheet") : t === R.Visibility.Hidden ? a = _("op.hideSheet") : t === R.Visibility.VeryHidden && (a = _("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 h(u("error.workbook.sheetOne"));
2557
- let a = {
2558
- ...r,
2559
- visibility: t
2560
- }, s = -1;
2561
- t !== R.Visibility.Visible && (s = this._getOffsetForId(r.id, e)), i = this._updateSheetRef(r, a).sheet, t !== R.Visibility.Visible && this._adjustRemoveSelectionIfRequired(s, 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(u("error.workbook.modelClosed"));
2571
- if (!this.getProtection().isStructureAllowed()) throw new h(u("error.workbook.protection"));
2572
- let r = null, i = this.beginCommit(u("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 h(`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], f = [...c];
2582
- f.splice(l, 1), f.splice(u, 0, d), this._updateSheetRefStates(f), 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(u("error.workbook.modelClosed"));
2599
- let t = this._getSheetRef(e);
2600
- if (!t) throw new h(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 h(u("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
- l.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(u("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(u("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: _("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 = _("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 h(u("error.io.readFormatUnavailable", { format: i ?? a }));
2960
- let s = n?.typedCreateWorkbookOptions, c = s ? Object.keys(s).find((e) => e.toLowerCase() === o.key.toLowerCase()) : void 0, l = {
2961
- ...n,
2962
- ...c === void 0 ? void 0 : s[c]
2963
- };
2964
- delete l.typedCreateWorkbookOptions, delete l.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
- }), l.createWorkbookOptions = {
2975
- ...l.createWorkbookOptions || {},
2976
- origin: d
2977
- }, l.readonly !== void 0 && (l.createWorkbookOptions = {
2978
- readonly: l.readonly,
2979
- ...l.createWorkbookOptions
2980
- }, delete l.readonly), l.calcOnly && (l.createWorkbookOptions = {
2981
- disableLoadAutoFit: !0,
2982
- ...l.createWorkbookOptions
2983
- });
2984
- let f = await this._decrypt(e, d, l);
2985
- if (f === null) return null;
2986
- e = f.bytes;
2987
- let p = l?.progress?.onStart?.bind(l.progress);
2988
- p && await Promise.resolve(p(d, t.size));
2989
- try {
2990
- let t = await this._readArrayBuffer(e, o, l);
2991
- return f.password !== null && d.setPassword(f.password), l?.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 l?.progress?.onError?.(e), l?.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 i = null, a = async (t) => {
3009
- try {
3010
- return i = await r.decode(e, t), !0;
3011
- } catch (e) {
3012
- if (!(e instanceof s)) throw e;
3013
- return !1;
3014
- }
3015
- };
3016
- if (n?.password && await a(n.password)) return {
3017
- bytes: i,
3018
- password: n.password
3019
- };
3020
- if (!n?.onPassword) {
3021
- let e = t.getName();
3022
- throw new c(e ? u("error.io.passwordRequired", { name: e }) : u("error.io.passwordRequiredUnnamed"));
3023
- }
3024
- let o = await Promise.resolve(n.onPassword({
3025
- origin: t,
3026
- encryption: r.key,
3027
- validate: a
3028
- }));
3029
- if (o == null) return null;
3030
- if (i !== null || await a(o)) return {
3031
- bytes: i,
3032
- password: o
3033
- };
3034
- throw new s(u("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 h(u("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 a, o = !i, s = i ?? e.getOrigin(), l = s.getFormat();
3048
- if ((r?.format || l) && (a = (await this._registry.getWriteFormats({ search: r?.format ?? l ?? void 0 }))[0]), a || s.getPath() && s.canWrite() && s.getExtension() || (a = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !a) throw new h(u("error.io.writeFormatUnresolved"));
3049
- if (i && typeof t == "string") {
3050
- let e = i.getPath();
3051
- e && !D(e) && i.update?.({ path: `${e}.${a.exts[0]}` });
3052
- }
3053
- let d = s.getEncryption(), f = e.getOrigin?.(), p = (s instanceof z ? s.getPassword() : null) ?? (f instanceof z ? f.getPassword() : null), m = s.isEncrypted() || (f?.isEncrypted() ?? !1), g = r?.password === void 0 ? p ?? (m ? void 0 : null) : r.password, _ = null;
3054
- if (g === void 0) {
3055
- if (m) {
3056
- let e = s.getName();
3057
- throw new c(e ? u("error.io.passwordRequiredSave", { name: e }) : u("error.io.passwordRequiredSaveUnnamed"));
3058
- }
3059
- } else if (g !== null && (_ = await this._registry.getEncryption(d), !_)) throw new h(u("error.io.encryptionUnavailable"));
3060
- let v = `${s.getName() ?? u("workbook.defaultName")}.${a.exts[0]}`, y = r?.progress, b = !1, x = this, S = null, C = {
3061
- workbook: e,
3062
- format: a,
3063
- origin: s,
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(s)));
3069
- })(), S = e.getTransactions?.()?.getCurrentCommit() ?? S;
3070
- let n = t ? (await x._registry.getWriteFormats({ search: t }))[0] ?? a : a, 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: o
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 h ? t : Error(u("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 h ? e : new h(u("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 = e({ 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 };