@sheetxl/mcp 0.8.0-beta.24 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{Cf0zmfQYfJ7zM0Ya.js → 0WuReGsjIpidu0Cr.js} +1 -1
- package/assets/{B6caaQsfOpFEgYQ4.js → 13QanvzRbNib7VHR.js} +1 -1
- package/assets/{DGI_8HyNF0eAv0P5.js → 2c1OYsVAy_w-ex-F.js} +1 -1
- package/assets/{B-t1q2NS61c2B8E4.js → 8114GVvAL1oaiJLV.js} +1 -1
- package/assets/{B16G2473LTkZP6Mq.js → 8hLtXHueDl7B_SEn.js} +1417 -1356
- package/assets/{DRzZ4bEyLRGVOLzV.js → 8mWHFnE0j-CaNsxr.js} +1 -1
- package/assets/{DaF9L7No8h8a-cqb.js → B-b7HyruDF2gdj3R.js} +2 -2
- package/assets/{CmkgQ5-IG0BSCM3R.js → B3J6davzttys1e7l.js} +3 -3
- package/assets/{doqBmhonQlHp-1Ud.js → B3lrS_GHkG6Mw5pN.js} +1 -1
- package/assets/{CnI4Nli8vtWdFKvf.js → B5rrqMYFybo3oW9k.js} +21 -21
- package/assets/{D6d1DKL15m52ZCuC.js → BB39UJoWw8tjThqY.js} +1 -1
- package/assets/{DtVSjxL6N_7WyM8Z.js → BBF_CDIKB2NIXiHg.js} +1 -1
- package/assets/{DE7G34oYbvrfXbJ7.js → BBLuTiY3V4MpFphK.js} +294 -294
- package/assets/{DM-yGHahbfA_uarn.js → BBZUslaSLC0vlZEb.js} +1 -1
- package/assets/{sJVPCrgeh0U6LbAK.js → BCdXK-2-AE6FAdRs.js} +1 -1
- package/assets/{CUYQlZz5zWsUdmRy.js → BF0C-5gSMHWBXI_k.js} +1 -1
- package/assets/{Xccc6oxtlSvJUDsC.js → BKGTzaNNBlRh7ua3.js} +1 -1
- package/assets/BOa1dD_9H3g65WbP.js +14 -0
- package/assets/{C-nA4SXN5hWHaxV6.js → BPlrBhzIqyWK19E2.js} +526 -526
- package/assets/{xD41vsQY6h60lCqz.js → BR4Wpxs0eSlaoLOl.js} +8 -8
- package/assets/{CSXmTA6w6Pnbtqvb.js → BTB4fa2DU21pP7At.js} +1 -1
- package/assets/{bv3fZLUPzd14I58C.js → BTamKr78GfsihW1a.js} +485 -485
- package/assets/{BPNLZ07Bu_B8Yhf1.js → BVfjBXAMgo4u8Y72.js} +1 -1
- package/assets/{TZnuVwhVjkOBax9F.js → BaZAIwIrqn1x69WH.js} +2 -2
- package/assets/{b8yACuWy67eIj_j2.js → Ban4yk1SYcz9Cs7n.js} +1 -1
- package/assets/{Ds4TB1hn56-RK6_f.js → BfB7Vq09p5uO-L88.js} +1 -1
- package/assets/{DOSWSyKkK4eSi4PD.js → BfEmSaLbKgcjIIpn.js} +2 -2
- package/assets/{DkQ4kxEKhKYQgfjK.js → Bfpf9b1s1bWyBXIw.js} +1 -1
- package/assets/{BrYc6PLonux_gI6b.js → BgHOi7rAHLhztiz-.js} +215 -215
- package/assets/{3VycPrqi6qgLOgGY.js → BgN67gyTyx_xz2Ny.js} +6 -6
- package/assets/{yz2PTfYm_8EGJPM5.js → BhxIJ8xdUxyMPJ_m.js} +1 -1
- package/assets/{Jy-_0a72nn5Iv1NK.js → BlMUrEA8V2S2KH0D.js} +1 -1
- package/assets/{CM-q_J5aF6YXmjeu.js → BloJ-e8xad1b_H7X.js} +3 -3
- package/assets/{C6PNMev7cs5JLgwy.js → Bm-wDNSoT-3JD2bJ.js} +1 -1
- package/assets/{BaYk1vO2hP2S3_1w.js → BoE9cj92LVH2LLy0.js} +2 -2
- package/assets/{g2Nu44uuSJFMzxEV.js → BqH4txhrgR2S-2ji.js} +2 -2
- package/assets/{DPYFRLJbHGlrcrJq.js → BrHXHm2FNXsL53bo.js} +2 -2
- package/assets/{CnKX5SPVE2iuSK42.js → BuFb0lPxYlHccrD9.js} +1 -1
- package/assets/{BkekCZ17YTtd07_C.js → ByGn4tk2SE1MH_sZ.js} +2 -2
- package/assets/{Cxzowsi6ASdZtzeI.js → C1IE0F-y65XqEYRl.js} +1 -1
- package/assets/{7vPlH3_rhJxmmBvG.js → C1JeIUEWW-RL1Rnu.js} +1 -1
- package/assets/{a2e_g9YI3J-lUD7-.js → C2sDVxKGBNlTFg6y.js} +1 -1
- package/assets/{D_tdoUtUe7cApQJn.js → C30apcFVvDHn2M4R.js} +4 -4
- package/assets/{TdDTOcC1TYhk6UuR.js → C3c2PUtIo-aWbjw4.js} +1 -1
- package/assets/{suLYEZBtGUhSYeB7.js → C4C3Ot0xeo1O0wm5.js} +1 -1
- package/assets/{By1QPrSxtnRiJu0R.js → C8zzCf71C976X7SG.js} +2 -2
- package/assets/{BxwB3iTNSE1TgHkb.js → CCS6r_ru_-bq12nu.js} +1 -1
- package/assets/{DNSWaXblwhTtI3w7.js → CDDtXZTG6nNFBQZP.js} +1 -1
- package/assets/{DL8pez0eKo8arYPj.js → CEa6wNiDRZrans9S.js} +3 -3
- package/assets/{Daaro0HbHkKXkBP-.js → CF1fqmS030ry2XQ0.js} +2 -2
- package/assets/{P6V3JAiRpC3BWceC.js → CFqF3aUKvOGFOK9O.js} +1 -1
- package/assets/{BH7ctzMzOYVTGxzA.js → CI8Pu3ko8VzQYdRD.js} +1 -1
- package/assets/{9GnbVPKozgrJpeLW.js → CICMJpasl9o4FaZi.js} +1 -1
- package/assets/{CIw6ZC3K9x-ccacl.js → CJcyMzG19TOjqNHS.js} +1 -1
- package/assets/{2YT_wstXIH6UIigi.js → CJoREr6-3iOl7iU_.js} +1 -1
- package/assets/{B4uS01J0mrSJSftQ.js → CMd7aLIwOA7bxcZm.js} +88 -88
- package/assets/{CpvJUGg9ckuCIpIS.js → CNikOloX_losH8Nz.js} +1 -1
- package/assets/{C0uu0vLKQh0S508B.js → CRZMD-wS-944FnD_.js} +40 -40
- package/assets/{CJ2hV-9ipqOEkLSG.js → CRlLpD9cfhJ9Ov9L.js} +1 -1
- package/assets/{DwNcvKM47ZHfvQM6.js → CS07BBUu6ZtXk4TZ.js} +1 -1
- package/assets/{DyiH3LlinD-38bG7.js → CX-LNahzNZRc78er.js} +1 -1
- package/assets/{DuEtCJEnG_GnJzTX.js → CY3Lmr-fgs6NqXRp.js} +1 -1
- package/assets/{KMzONx2Ps841nJHj.js → CbkCnjWs7Fpj5iQY.js} +8 -8
- package/assets/{Dlqk7XqKnAZ8Pcj3.js → CdbucPAmUkkc5pcM.js} +155 -156
- package/assets/{DRq6lQLndj73WT35.js → CfBJzpZuy1o216iZ.js} +1 -1
- package/assets/{Dk9zYXO3VoBhTdex.js → CoSNTR-pg7BZAU7o.js} +1 -1
- package/assets/{CFWwwr74qRKOBrg9.js → CpoqmW4E7rFdkRpf.js} +1 -1
- package/assets/{BAVltO4Xf7lC0Xr6.js → Cs1df4D35bBjqyvX.js} +1 -1
- package/assets/{DIgPlkEabQdKNUQn.js → CsPyLus3kh4QnahD.js} +1 -1
- package/assets/{DXCTHw-ZutNIuo_2.js → Cwe_kiigxAfceEK9.js} +1 -1
- package/assets/{CzRvg04_TIbwBH5C.js → CwzSgovxnBMrgLmJ.js} +3 -3
- package/assets/{BnNB_ejvNaLu6B3o.js → D31pY9r4JAFWw3E4.js} +1 -1
- package/assets/DCWHNfq5qCxvALwe.js +199 -0
- package/assets/{DGOgx3-IyO8bjF_t.js → DF9WfdyjHuCpsEXh.js} +63 -63
- package/assets/{LM2rVDHdB0jVUFcT.js → DOIpXsEXCaI-8VwJ.js} +1 -1
- package/assets/{76dPHG5RYA7MUV_g.js → DOXj80NXiglJXsMZ.js} +3 -3
- package/assets/{CR1aLf7CWEfPTO9a.js → DQ2vEDfVfsIGSmId.js} +1 -1
- package/assets/{Dhy6iU_09lrQnOAV.js → DQtnL5nOzSzVJhit.js} +61 -61
- package/assets/{CCF6CwJ6cbeLRl23.js → DRcmbp80jMRjxelW.js} +1 -1
- package/assets/{CFNtPYPfDPH-3BXK.js → DRy0AcTiSKQY3bih.js} +1 -1
- package/assets/{tWO-mE87mAuj1qih.js → DWr6GqsnMpLwSUno.js} +2 -2
- package/assets/{ByYJTTTUuu67hDF-.js → DXrX5tIZ1J5BhpFk.js} +4 -4
- package/assets/{CmwNIrRssYuLN2fn.js → DZxHk5oKIVvu3iJR.js} +458 -458
- package/assets/{CbJWbjmv4bz4ppIZ.js → Da0CtWhc7saaOdER.js} +318 -318
- package/assets/{mZt9BTEejCJZ4YK4.js → Dbi1_JHT_4u0nhwc.js} +1 -1
- package/assets/{C9iFJ52KwQTePQ81.js → Dcw7GSCgw_dgsum7.js} +11490 -11497
- package/assets/{fEfisM0E2fUYKIyU.js → DfuY8GdoSk8LxDFW.js} +5 -5
- package/assets/{CT4czEKWIj1GeQN8.js → DlARYdaCOVKiQzMH.js} +1 -1
- package/assets/{BJwiwzwx4Bl5L4Vq.js → DngX5ZuqqFGTp44B.js} +1 -1
- package/assets/{DFVQIZ2zZyAphhCF.js → DpwdC4SN_VYB9_ho.js} +1 -1
- package/assets/{CIY_RiLu1_FmRLAA.js → Dst0tyK__q2Q_AKk.js} +1 -1
- package/assets/{BrJd9jVVv9SQzZol.js → DvHZEP1wpb6549uf.js} +423 -423
- package/assets/{DMDTS0LH9Ke9t-3z.js → DzYvbv5u7E2H7IoB.js} +12 -7
- package/assets/{BjyXkr-CzV8mVx0t.js → G489eYf-lt3D1riX.js} +1 -1
- package/assets/{CKD460cQOgwF6uSV.js → L42Y17f0HUEpfS6U.js} +1 -1
- package/assets/{flby0g5gyZ9P2Wu2.js → O3m_QwxIRXMPFTB8.js} +1 -1
- package/assets/{7IzItpr7MkdnaAwh.js → P3Or6rEY-fHmQZbH.js} +69 -69
- package/assets/{DaHD9SY75O8wDy3p.js → PAzPVx_0jajb_7cO.js} +2 -2
- package/assets/{DJfpKncnYnrr28G0.js → PvRzzufo1V8BuC-I.js} +1 -1
- package/assets/{CFT_tDogP98gTbh7.js → Sm1ouHLiXlCuQVKV.js} +79 -79
- package/assets/{D-vo2bQyAmStQmD9.js → WC-THJfezYSFdiMF.js} +1 -1
- package/assets/{DczQhB3mRSUw6GCf.js → YK80feN98r6GVZv5.js} +1 -1
- package/assets/{DPLTGglaPovTg9e5.js → cl0C9YlF3Ds-lHps.js} +1 -1
- package/assets/{BXWGS09xFG81nnIT.js → eExV3IoVMxYkv5GO.js} +1 -1
- package/assets/{qc7rA-Z3a4rkVQPx.js → g3TrQtFS0qJZeshT.js} +215 -215
- package/assets/{B8bEJ65vQRqsfBlS.js → gf6l-4XXMXtq8hpJ.js} +5 -5
- package/assets/{CEk658HeLJk2cAjM.js → hiKRbrdbpmJglbWC.js} +3 -3
- package/assets/{D8k9de_hen-KqBWe.js → j4zqu8S2Be_yum7W.js} +1 -1
- package/assets/{Ch9w7xFxVMrvGuC_.js → jNZ7exipVCGRPbzr.js} +1 -1
- package/assets/{MosMza0-rXD8uHX_.js → kThU6e6dkzEoaK6n.js} +2 -2
- package/assets/{DJGYlGr2Zj7SkYqc.js → knMcDWv3xN7yJBTT.js} +1 -1
- package/assets/{BJqo8c5bFKjnq69G.js → ov7L79VlksT4fw7T.js} +11 -11
- package/assets/{BifwlrCmEVtjh_1U.js → pLM8Pxl1CscUdvMh.js} +1 -1
- package/assets/{NAWWzA_hk4wYtsPP.js → pfa2CH5NQuzku6FP.js} +2 -2
- package/assets/{B-5mBXpY9i6-eCrZ.js → q6advQx4x6PXvl0i.js} +35 -35
- package/assets/{BWLavTnANLUerdS0.js → qVBjd-c5B8neljc0.js} +2 -2
- package/assets/{DqSBb1HmgeU7eg_i.js → rlgXnCh6A88ozBRz.js} +110 -110
- package/assets/{DUbIxDAzW1dzrtdI.js → rzi2XAwlfy8BsGEa.js} +1 -1
- package/assets/{B7lATTNffVTrDsKE.js → xGASRbzSVVKfEAh-.js} +2 -2
- package/assets/{BkHeIMSE7-LehRCs.js → ybnQoU8_KttlHjiy.js} +1 -1
- package/index.js +145 -145
- package/lib.js +1 -1
- package/licenses/dependencies.txt +45 -45
- package/package.json +2 -2
- package/screenshot-page/assets/-HdF7KAN8PKqrASL.js +1 -0
- package/screenshot-page/assets/{C_YKEkTsGB_5gFNg.js → 0P0DnZolMnjPhiea.js} +2 -2
- package/screenshot-page/assets/{FcTM4SB17cEX1M3X.js → 5Y11BWntgqmzo9dz.js} +1 -1
- package/screenshot-page/assets/{Cx9eq2x1gIXGki3Q.js → B-E9Dzx1wh9RA2yC.js} +1 -1
- package/screenshot-page/assets/{CXwbGzavyvYgDbWU.js → B0CDAMDdxSN4en9k.js} +1 -1
- package/screenshot-page/assets/B39YZkEvc1U8ZQ8H.js +2 -0
- package/screenshot-page/assets/B8Dy_WA9RlWuvMqF.js +4 -0
- package/screenshot-page/assets/BAzHRU12l2vyyXq-.js +39 -0
- package/screenshot-page/assets/{DR-og7vslxlOZd8j.js → BGIujWi3UayyIWlg.js} +1 -1
- package/screenshot-page/assets/BNjmzbnQlBmX-HPQ.js +1 -0
- package/screenshot-page/assets/{B-0-chiwq4MIUQy9.js → BOF6KOmT8mH_NQnA.js} +1 -1
- package/screenshot-page/assets/{DcrVJCyDwGKeil2U.js → BQTLEc84Eql61S2m.js} +1 -1
- package/screenshot-page/assets/{clrFU8i-0wNkmbs7.js → BfkbiKKbYlPpRZqZ.js} +1 -1
- package/screenshot-page/assets/{DGkaCFHx4PsOJkFu.js → BhHceo22V3IBfap0.js} +1 -1
- package/screenshot-page/assets/{Cx1kZ2u_8JFV2Q8D.js → BiRVjUOUI8Qv0CE1.js} +1 -1
- package/screenshot-page/assets/{D6EXAYU-ZH8hjx_7.js → Bne-AygyF1USkPAy.js} +2 -2
- package/screenshot-page/assets/{Dkf51CnZh2zPEGMd.js → BpJaTpbR_CQzXj9M.js} +1 -1
- package/screenshot-page/assets/{B7pXfEVkcbaMBMhc.js → BrEXXxB9tAI5mmZP.js} +1 -1
- package/screenshot-page/assets/{CwCu_r0BW41uLt3P.js → Bt7fKk5ZupUuo_xD.js} +2 -2
- package/screenshot-page/assets/BwYQTcPRDDYIeAA5.js +586 -0
- package/screenshot-page/assets/ByyC3p23DsLAbUpr.js +1 -0
- package/screenshot-page/assets/{D7Yt7xmUlA6-Lq0Q.js → BzI5CCx73aXausKb.js} +9 -9
- package/screenshot-page/assets/{DM6hr-bvWV50-Oex.js → C-2hBFk27roWkIrQ.js} +2 -2
- package/screenshot-page/assets/{BTJ1NNUzHotNDiDe.js → CAKBmg6tXRtjEWgb.js} +2 -2
- package/screenshot-page/assets/CALWodHqzUTIv9le.js +5 -0
- package/screenshot-page/assets/{BcZPWw18bdj_ZvA9.js → CGNsyKbDXXz9qMa2.js} +1 -1
- package/screenshot-page/assets/CGZYePkVGI5DPBBY.js +1 -0
- package/screenshot-page/assets/{Bfq6-treWd_rRiWl.js → CJAgr6wyQGYAd3ZV.js} +1 -1
- package/screenshot-page/assets/{BKwDvElKinpn1IK0.js → CL_hAngRQwm_KGdR.js} +1 -1
- package/screenshot-page/assets/COL9dj40ytErlGak.js +2 -0
- package/screenshot-page/assets/CWA4xGjOeBuxJOzW.js +3 -0
- package/screenshot-page/assets/{r2HZG9_SMzF3__ID.js → CX-ITg5RXdV2cefd.js} +6 -6
- package/screenshot-page/assets/{C7mXat-6esc1AmRD.js → CXeDqC02BZcixiHS.js} +2 -2
- package/screenshot-page/assets/{Pt9ne0xkE2icD3Ih.js → CZaKvnrRdlLj1_X8.js} +1 -1
- package/screenshot-page/assets/{a3fvt1Klg1uGE7p6.js → Cg9eIWL8fPmeZFHG.js} +7 -7
- package/screenshot-page/assets/{DyxJBLjUkeDuu96F.js → CltB1nb5HHSmYrNG.js} +1 -1
- package/screenshot-page/assets/{FqdZRM336KMEcsbU.js → Cq1EzIAt4dHBkzfP.js} +1 -1
- package/screenshot-page/assets/{D6Yv5cc1JE7DGd6j.js → CqBSIwwGzWl8mrBe.js} +1 -1
- package/screenshot-page/assets/D2TibFqUBAPLcu_2.js +1 -0
- package/screenshot-page/assets/{ChSvXfVMLxZsP9zG.js → D4RZZdlItfrgQHcE.js} +1 -1
- package/screenshot-page/assets/{J73KTOmdZGNmnq-z.js → D72Rp__0TEqJ972a.js} +1 -1
- package/screenshot-page/assets/D8EmNst-H2v0eWcf.js +1 -0
- package/screenshot-page/assets/{Tj3B5At0OAN3tDza.js → DACqwpSwlZka3b7s.js} +1 -1
- package/screenshot-page/assets/DEy3e1rY-XMdI309.js +1 -0
- package/screenshot-page/assets/{CI3Z1f4amZ9G2rPD.js → DJebrQ5mu8uxpX3b.js} +1 -1
- package/screenshot-page/assets/{DynKB5GH-vfFMJEy.js → DOsZiE9rOdS_Mm2Q.js} +1 -1
- package/screenshot-page/assets/{CSFFMEKyxEFaykqL.js → DTAKTGn53yF_B621.js} +1 -1
- package/screenshot-page/assets/{D6Ciix7JAZtdKqmj.js → DYYzsN95gWMsxOaj.js} +1 -1
- package/screenshot-page/assets/{DOVt9zHz7FQ2KUQM.js → Da_VIghRFdNrmfZT.js} +1 -1
- package/screenshot-page/assets/DaqAdr-mtpVZMOS8.js +2 -0
- package/screenshot-page/assets/{0UZBKpOOsp7P-DkP.js → DdmX3djBOA6UCZtf.js} +2 -2
- package/screenshot-page/assets/{DEpn6VGd30cHEJOS.js → DfQS5zAy3pN31xNb.js} +1 -1
- package/screenshot-page/assets/DhnaoxNYwMobAVP6.js +1 -0
- package/screenshot-page/assets/{B-8IMo2f1yGNXOyz.js → GxbRmvyoKhHl0ZYY.js} +13 -8
- package/screenshot-page/assets/{zvxBjll3jnL0-vNn.js → Np3jWxG724t5hLHZ.js} +2 -2
- package/screenshot-page/assets/{Bg9UyX4yrB2mSdJt.js → QVGvXAvlw1c8vZjy.js} +12 -12
- package/screenshot-page/assets/{BbT5KRhoeAKLzy54.js → d8BvDCByceUNvHp7.js} +2 -2
- package/screenshot-page/assets/eR9_DaySoB72PvMo.js +1 -0
- package/screenshot-page/assets/{CtiTwHzd_ZSzd3W2.js → hB5riGkPy0wXVIig.js} +1 -1
- package/screenshot-page/assets/hHvAGynpTvAb97GX.js +1 -0
- package/screenshot-page/assets/jFfcyGJ9xruiOUyS.js +1 -0
- package/screenshot-page/assets/{DmDFKv_3APEWI-IY.js → jKvAZg0Tp701aw1o.js} +2 -2
- package/screenshot-page/assets/{DACSL7FA_J91Z_H7.js → jteb4n23QwBT9m_4.js} +1 -1
- package/screenshot-page/assets/mzrDp0emvkWnkXBt.js +1 -0
- package/screenshot-page/index.html +15 -15
- package/types/scripting-api.json +1 -1
- package/types/scripting.d.ts +2 -2
- package/assets/6CBUVbF01Bedq0e2.js +0 -199
- package/assets/Dfv_T_PQVL0O3lu5.js +0 -14
- package/screenshot-page/assets/BDRMUi2BsnBqytIq.js +0 -2
- package/screenshot-page/assets/BEjJHVSbtlsNtoq7.js +0 -3
- package/screenshot-page/assets/BIuMiduMHSsTGacU.js +0 -2
- package/screenshot-page/assets/BPMQ22uISGOm3ymr.js +0 -1
- package/screenshot-page/assets/Bxq4FCQhyPbVhhaR.js +0 -2
- package/screenshot-page/assets/CNB6WmYfGVZjlCKV.js +0 -5
- package/screenshot-page/assets/CXeJV1BW2CVemhPE.js +0 -1
- package/screenshot-page/assets/CkxmJxdtjBIxYoMq.js +0 -1
- package/screenshot-page/assets/D43IayseD2Cy8OZo.js +0 -4
- package/screenshot-page/assets/D8KyhLvfyjLZW92H.js +0 -39
- package/screenshot-page/assets/DBxAatsD6aWk7Zb6.js +0 -586
- package/screenshot-page/assets/DMhOGCTy8V0N14gY.js +0 -1
- package/screenshot-page/assets/DSTlKGmqncM7XHeW.js +0 -1
- package/screenshot-page/assets/Dh14XQinAphjZOKC.js +0 -1
- package/screenshot-page/assets/Dt8JxbBBr2TeDflQ.js +0 -1
- package/screenshot-page/assets/Dxi-bXNjS-CpC5Qr.js +0 -1
- package/screenshot-page/assets/Oay0yGsGYgJDzy8r.js +0 -1
- package/screenshot-page/assets/QZg76Jflu3Q808W3.js +0 -1
- package/screenshot-page/assets/WTrYzPnMQhYDILMR.js +0 -1
- package/screenshot-page/assets/qFyplGXRu7IepHio.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Z as e,u as t,y as n}from"./ChSvXfVMLxZsP9zG.js";import{a as r}from"./DcrVJCyDwGKeil2U.js";import{Fn as i,Sa as a,Yt as o,_r as s,ai as c,b as l,ea as u,ft as d,ht as f,q as p,vi as m,yn as h}from"./DBxAatsD6aWk7Zb6.js";var g=`SlicerStyleLight1`,_=`ascending`,v=`showItemsWithDataAtTop`,y=e(`op.setSlicerCaption`),b=e(`op.setSlicerStyle`),x=e(`op.setSlicerLayout`),S=e(`op.setSlicerSort`),C=e(`op.selectSlicerItems`),w=i.BuiltInSelectorNames.Display,T=Object.freeze({selector:w,scope:`column`}),E=Object.freeze({transactional:!1}),D=class extends r{constructor(e){let t=f(e.json?.source)?.column??e.json?.pivot?.sourceName??``,n=e.name;!n&&e.getMovable&&(n=t||null),super({...e,name:n}),this._formula=null,this._wired=null,this._binding=null,this._lossPending=!1,this._pivotTables=null,this._pivotBinding=null,this._columnName=t;let r=e.json;r&&this._updateState({data:{...r}}),r?.source&&this._addWatch(r.source,e=>{this._formula=e.formula,this._wired??=e.formula.getExpression(),this._checkSource(!1)})}getType(){return`slicer`}getTypeDescription(){return`Slicer`}getDefaultAnchorType(){return d.Type.Absolute}getSourceName(){return this._data()?.pivot?.sourceName??this._getColumnName()}getTable(){return this._data()?.pivot?this._getPivotTables()?.[0]??null:this._resolve()?.table??null}getColumn(){return this._resolve()?.column??null}getPivotTables(){return this._getPivotTables()??A}getPivotField(){let e=this._getPivotTables()?.[0];if(!e)return null;let t=m(e._getCache(),this.getSourceName());return t<0?null:e.getFields()[t]??null}_getSource(){let e=this._data()?.source??``,t=this._formula?.getExpression()??null;return t===null||t===this._wired?e:t}setName(e){let r=this._getWorkbook();if(r&&l(r,e,this)!==e)throw new t(n(`error.slicer.nameTaken`,{name:e}));return super.setName(e)}getCaption(){return this._data()?.caption??this._getColumnName()}setCaption(e,t){return this._set({caption:e??void 0},y,t)}isShowCaption(){return!0!==this._data()?.hiddenCaption}setShowCaption(e,t){return this._set({hiddenCaption:!e||void 0},y,t)}getCacheName(){return this._data()?.cacheName||(p(this._getWorkbook()).get(this)??h(this._getColumnName()))}getStyle(){return this._data()?.style??g}setStyle(e,t){return this._set({style:e&&e!==g?e:void 0},b,t)}getSortOrder(){return this._data()?.sortOrder??_}setSortOrder(e,r){if(e===`dataSource`&&this._data()?.pivot)throw new t(n(`error.slicer.pivotSortOrder`));return this._set({sortOrder:e===_?void 0:e},S,r)}getCrossFilter(){return this._data()?.crossFilter??v}setCrossFilter(e,t){return this._set({crossFilter:e===v?void 0:e},S,t)}getColumnCount(){return this._data()?.columnCount??1}setColumnCount(e,t){let n=Math.max(1,Math.trunc(e));return this._set({columnCount:n===1?void 0:n},x,t)}getRowHeight(){return this._data()?.rowHeight??27}setRowHeight(e,t){let n=Math.max(1,e);return this._set({rowHeight:n===27?void 0:n},x,t)}isLockedPosition(){return!0===this._data()?.lockedPosition}setLockedPosition(e,t){return this._set({lockedPosition:e||void 0},x,t)}isFilterCleared(){if(this.isITimeline){let e=this._timelineField();return!e?.table._getModel()?.filters?.some(t=>t.field===e.field&&t.dataField===void 0)}return this._data()?.pivot?this._getPivotItems()?.items.every(e=>e.isSelected)??!0:!this.getColumn()?.getFilter()?.getCondition()}async getItems(){let e=this._data()?.pivot;if(e?.timeline)return O;if(e){let t=this.getCrossFilter();return(this._getPivotItems()?.items??k).flatMap(n=>{if(t===`none`&&!n.hasData||e.tabular?.hideMissing&&n.missing)return[];let{id:r,missing:i,...a}=n;return[a]})}let t=this.getColumn()?.getFilter();if(!t)return O;let r=await t.getItems(T),a=t.getCondition(),o=a?function(e,t){let n=e.toJSON();if(n.operator!==i.BuiltInOperatorNames.InSet)return()=>!1;let r=n.param??{},a=new Set,o=r.items??[];for(let e=0;e<o.length;e++)o[e]!==null&&a.add(String(o[e]).toLowerCase());let s=r.dateGroups??[],c=t.dates?.[t.dates.length-1]??null;return e=>{if(e<0)return!0===r.blank;if(a.has(t.items[e].text.toLowerCase()))return!0;if(!c||s.length===0)return!1;let n=null;for(let t=0;t<c.runs.length&&!n;t++){let r=c.runs[t];r.min<=e&&e<=r.max&&(n=r.value??null)}if(!n)return!1;for(let e=0;e<s.length;e++)if(N(s[e],n))return!0;return!1}}(a,r):null,c=[];for(let e=0;e<r.items.length;e++){let t=r.items[e],n=!0===t.passesOthers;c.push({item:{key:t.text,name:t.text,value:t.value,hasData:n,isSelected:!o||(n?t.checked:o(e))},firstRow:t.firstRow})}let l=this.getSortOrder();if(l===`dataSource`)c.sort((e,t)=>e.firstRow-t.firstRow);else{let e=t.getRange().getWorksheet().getRuntime().getLocaleProfile(),n=l===`descending`?-1:1;c.sort((t,r)=>n*(s.compare(t.item.value,r.item.value,e)||s.compare(t.item.key,r.item.key,e)))}let u=null;if(r.hasBlanks){let e=!0===r.blanksPassOthers;u={key:j,name:n(`slicer.blankItem`),value:null,hasData:e,isSelected:!o||(e?r.blanksChecked:o(-1))}}let d=[],f=this.getCrossFilter();if(f===`showItemsWithNoData`){for(let e=0;e<c.length;e++)d.push(c[e].item);return u&&d.push(u),d}for(let e=0;e<c.length;e++)c[e].item.hasData&&d.push(c[e].item);if(u?.hasData&&d.push(u),f===`none`)return d;for(let e=0;e<c.length;e++)c[e].item.hasData||d.push(c[e].item);return u&&!u.hasData&&d.push(u),d}async getItem(e){let t=await this.getItems();for(let n=0;n<t.length;n++)if(t[n].key===e)return t[n];return null}async selectItems(e,t){if(this.isITimeline)return this;if(this._data()?.pivot){let n=this._getPivotItems()?.items;if(!n)return this;let r=new Set(e),i=new Set(n.flatMap(e=>r.has(e.key)?[e.id]:[]));return await this._showPivotItems(i.size===0||i.size===n.length?null:i,t),this}let n=this.getColumn()?.getFilter();if(!n)return this;if(!e||e.length===0)return this.clearFilters(t);let r=await n.getItems(T),a=new Set(e),o=r.dates?.[r.dates.length-1]??null,s=o&&o.runs.length>0?o.runs[o.runs.length-1].max:-1,c=[],l=[],u=!0,d=0;for(let e=0;e<r.items.length;e++){if(!a.has(r.items[e].text)){u=!1;continue}if(e>s){c.push(r.items[e].text);continue}for(;o.runs[d].max<e;)d++;let t=o.runs[d].value;t&&l[l.length-1]!==t&&l.push(t)}let f=r.hasBlanks&&a.has(j);if(r.hasBlanks&&!f&&(u=!1),u&&!r.truncated)return this.clearFilters(t);let p={items:c};return l.length>0&&(p.dateGroups=l),f&&(p.blank=!0),await n.setCondition({selector:w,operator:i.BuiltInOperatorNames.InSet,param:p},!1,{description:C,...t}),this}async clearFilters(e){return this.isITimeline?this.setDateRange(null,e):this._data()?.pivot?(await this._showPivotItems(null,e),this):(await this.getColumn()?.getFilter()?.delete(e),this)}addListeners(e,t){let n=super.addListeners(e,t);if(this._data()?.pivot)return this._bindPivot(),n;if(!this._binding){let e=this._resolve();e&&this._bind(e)}return n}toJSON(e){let t=this._data();if(!t)return null;if(t.pivot){let e=this._getPivotTables();if(!e)return t;let n={...t.pivot,tables:e.map(e=>({sheet:e.getWorksheet().getName(),name:e.getName()}))};return n.tabular&&e.length>0&&(n.cacheId=e[0].getCacheId()),{...t,pivot:n}}let n=this._getSource();return n?{...t,source:n}:t}get isISlicer(){return!0}get isITimeline(){return this._data()?.pivot?.timeline!==void 0}getDateRange(){let e=this._timelineField(),t=e?.table._getModel();return t?u(t,e.field):null}async setDateRange(e,t){let n=this.isITimeline?this._getPivotTables()??[]:[],r=this._getWorkbook();if(!r||n.length===0)return this;let i=this.getSourceName();return await r.doBatch(async()=>{for(let t of n){let n=m(t._getCache(),i);n>=0&&await t._setDateRange(n,i,e)}},{description:C,...t}),this}_getTimelineState(){let e=this._data()?.pivot;if(!e?.timeline||!e.tabular)return null;let t=this._timelineField();if(t){let e=t.table._getModel(),n=t.table._getCache();return{cacheId:t.table.getCacheId(),range:e?u(e,t.field):null,filtered:!!e?.filters?.some(e=>e.field===t.field&&e.dataField===void 0),dates:a(n,t.field)}}if(e.cacheId===void 0)return null;let n=this._getWorkbook()?._getPivotCache?.(e.cacheId)?.toJSON()??null,r=m(n,e.sourceName);return{cacheId:e.cacheId,range:null,filtered:!1,dates:n&&r>=0?a(n,r):null}}_timelineField(){if(!this.isITimeline)return null;let e=this._getPivotTables()?.[0],t=e?m(e._getCache(),this.getSourceName()):-1;return t>=0?{table:e,field:t}:null}get[Symbol.toStringTag](){return`[Slicer]`}toString(){return this.getTypeDescription()}_attach(){this._checkSource(!0)}_getPivotTables(){if(!this._data()?.pivot)return null;if(!this._pivotTables){let e=this._getWorkbook();if(!e)return null;this._holdPivotTables((t,n)=>e.getWorksheets().getByName(t)?.getPivotTables().getByName(n)??null)}return this._pivotTables.filter(e=>!e.isDeleted())}_holdPivotTables(e){let t=this._data()?.pivot;if(!t)return;let n=[];for(let r=0;r<t.tables.length;r++){let i=e(t.tables[r].sheet,t.tables[r].name);i&&!n.includes(i)&&n.push(i)}this._pivotTables=n}_getPivotItems(){let e=this._data()?.pivot;if(!e?.tabular||e.timeline)return null;let t=this._getPivotTables()?.[0],n=t?t.getCacheId():e.cacheId;if(n===void 0)return null;let r=this._getWorkbook(),i=t?t._getModel():{},a=t?t._getCache():r?._getPivotCache?.(n)?.toJSON()??null,o=m(a,e.sourceName),s=(t?.getWorksheet()??this.getMovable()?.getRange().getWorksheet())?.getRuntime();return!i||!a||o<0||!s?null:{cacheId:n,items:c(i,a,o,this.getSortOrder(),this.getCrossFilter(),s.getLocaleProfile())}}async _showPivotItems(e,t){let n=this._getPivotTables()??[],r=this._getWorkbook();if(!r||n.length===0)return;let i=this.getSourceName();await r.doBatch(async()=>{for(let t of n){let n=m(t._getCache(),i);n>=0&&await t._showSlicerItems(n,e)}},{description:C,...t})}_bindPivot(){let e=this._getPivotTables()??[],t=this._pivotBinding;if(t&&t.tables.length===e.length&&t.tables.every((t,n)=>t===e[n]))return;this._unbindPivot();let n=()=>{this._notify(`onSelectionChange`),this._notify(`onItemsChange`)};this._pivotBinding={tables:[...e],removes:e.map(e=>e.addListeners({onAnyChange:n,onDelete:n},E))}}_unbindPivot(){let e=this._pivotBinding;if(e){this._pivotBinding=null;for(let t of e.removes)t()}}_data(){return this._getState()?.data??null}_getWorkbook(){try{return this.getMovable()?.getRange().getWorksheet().getWorkbook()??null}catch{return null}}_resolve(){if(this._closed)return null;let e=f(this._getSource());if(!e)return null;let t=o(this._getWorkbook(),e.table),n=t?.getColumnByName(e.column)??null;return n?(this._columnName=n.getName(),{table:t,column:n}):null}_getColumnName(){return this._resolve()?.column.getName()??this._columnName}_checkSource(e){if(this._closed||this.isDeleted()||this._data()?.pivot)return;let t=this._resolve();if(t)return void this._bind(t);let n=this._getTransactions();n.isRestoring()||(n.isOpenTransaction()?this.delete():e&&!this._lossPending&&(this._lossPending=!0,queueMicrotask(()=>{if(this._lossPending=!1,this._closed||this.isDeleted()||n.isOpenTransaction()||n.isRestoring())return;let e=this._resolve();e?this._bind(e):n.amend(n.getCurrentCommit(!1).getId(),()=>{this.delete()})})))}_bind(e){let t=e.table;if(this._binding?.table!==t){this._unbind();let e=()=>{this._checkSource(!0)};this._binding={table:t,removeTable:t.addListeners({onFilterChange:()=>{this._notify(`onSelectionChange`)},onAnyChange:()=>{this._checkSource(!0),this._bindRange(!0)},onAnchorCoordsChange:()=>{this._bindRange(!0)},onDelete:e},E),coords:null,removeRange:null}}this._bindRange(!1)}_bindRange(e){let t=this._binding;if(!t||this._closed)return;let n=this.getColumn()?.getFilter()?.getRange()??null,r=n?n.getCoords():null;(r&&t.coords?r.rowStart!==t.coords.rowStart||r.rowEnd!==t.coords.rowEnd||r.colStart!==t.coords.colStart||r.colEnd!==t.coords.colEnd:r!==t.coords)&&(t.removeRange?.(),t.removeRange=n?.addListener(()=>{this._notify(`onItemsChange`)},{ignoreAddressChanges:!0,...E})??null,t.coords=r,e&&this._notify(`onItemsChange`))}_unbind(){let e=this._binding;e&&(this._binding=null,e.removeTable(),e.removeRange?.())}_notify(e){this._closed||this.isDeleted()||(this._emitter.notify(e),this._emitter.notify(`onAnyChange`))}_set(e,t,n){this._protectionCheck(t);let r=this._data();if(!r)return this;let i={...r,...e};for(let t in e)i[t]===void 0&&delete i[t];return this._updateState({data:i},{...n,description:t},[`onAnyChange`]),this}_processDelete(){this._unbind(),this._unbindPivot();let e=this._data()?.pivot?.tabular?this._getPivotTables()??[]:[];super._processDelete();for(let t of e)t._relayForSlicers?.()}_processRestoreOrRevert(e,t){if(super._processRestoreOrRevert(e,t),this.isDeleted())return void this._unbind();let n=this._resolve();n&&this._bind(n)}close(){this._unbind(),this._unbindPivot(),super.close()}},O=Object.freeze([]),k=Object.freeze([]),A=Object.freeze([]),j=``,M=[`year`,`month`,`day`,`hour`,`minute`,`second`];function N(e,t){for(let n=0;n<M.length;n++){let r=M[n];if(e[r]!==t[r])return!1;if(r===e.group)return!0}return!0}export{D as Slicer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as e}from"./ChSvXfVMLxZsP9zG.js";import{A as t,Q as n,T as r,ht as i,kt as a,q as o,t as s}from"./BDRMUi2BsnBqytIq.js";import{c,i as l}from"./CQukCzhuewMuFOlO.js";import{Ca as u,Fn as d,Jt as f,Kr as p,O as m}from"./DBxAatsD6aWk7Zb6.js";import{$n as h,An as g,At as ee,Bt as te,D as _,Er as ne,Fn as v,Ft as re,Hr as ie,Nr as ae,Pr as oe,Pt as y,Q as b,Qn as x,R as se,S as ce,Un as le,Vr as S,Xn as C,Zt as w,_ as ue,_r as de,ar as T,at as E,b as D,c as fe,en as pe,ft as O,ht as me,j as k,k as he,mn as ge,on as A,or as _e,q as j,qt as M,rt as N,tn as P,wn as F,wr as I,zr as L}from"./D8KyhLvfyjLZW92H.js";import{a as ve,c as ye,o as be,s as R,t as xe}from"./DynKB5GH-vfFMJEy.js";import"./BEjJHVSbtlsNtoq7.js";var Se=class{constructor(e){this.list=e}get length(){return this.list.length}item(e){return this.list[e]}forEach(e,t){let n=this.list,r=n.length;for(let t=0;t<r;t++)e(n[t],t,this)}entries(){return this.list.entries()}keys(){return this.list.keys()}values(){return this.list.values()}[Symbol.iterator](){return this.list.values()}},Ce=e=>!0===e||e===`1`||e===`on`||e===`true`||!1!==e&&e!==`0`&&e!==`off`&&e!==`false`&&null,we=e=>{let t=parseInt(e);return isNaN(t)?null:t},Te=e=>{let t=parseFloat(e);return isNaN(t)?null:t},Ee=new Map,z=class{constructor(t,n,r,i,a,o=null,s=e.EmptyObject){this._fileLocation=``;let c=(e,t,n)=>s?.getRef?.(e,t,n,s?.parsedRefs),l=e=>s?.getRefs?.(e,s?.parsedRefs);this._parent=t,this.sharedShared=n,this.currentPath=r,this.elemRoot=i,this.jsonRoot=a,t?(this._fileLocation=t._fileLocation,this._getRef=t._getRef,this._getRefs=t._getRefs,this._serializeElement=t._serializeElement,this._readEmbeddedPart=t._readEmbeddedPart):(o&&(this._fileLocation=o),s?.getRef&&(this._getRef=c),s?.getRefs&&(this._getRefs=l),this._onWarning=s?.onWarning,this._addPerson=s?.addPerson,this._serializeElement=s?.serializeElement,this._readEmbeddedPart=s?.readEmbeddedPart)}getRef(e,t=!1){return this._getRef?.(e,this._fileLocation,t)??null}readEmbeddedPart(e){return this._readEmbeddedPart?.(e,this._fileLocation)??null}getRelationships(){return this._getRefs?.(this._fileLocation)??Ee}getPath(){return this.currentPath}getFileLocation(){return this._fileLocation}getElemRoot(){return this.elemRoot}getJsonRoot(){return this.jsonRoot}warn(e,t){this._raiseWarning(e,this.getFileLocation(),t?.onceKey)}_raiseWarning(e,t,n){this._onWarning?this._onWarning(e,t,n):this._parent?this._parent._raiseWarning(e,t,n):console.warn(e)}serializeElement(e){return this._serializeElement?.(e)??null}addPerson(e){return typeof e==`string`&&(e={displayName:e}),this._addPerson?this._addPerson(e):this._parent?this._parent?._addPerson?.(e)??null:null}getVisitorParamsState(){return this.sharedShared.getVisitorParamsState()}evaluate(e,t){if(!e)return t;let n=[t],r=e.split(`/`),i=r.length;for(let e=0;e<i;e++){let t=r[e];if(t===``||t===`.`)continue;let a=[],o=(t===`*`||t===`**`)&&e!==i-1;for(let i of n)if(i){if(o){let t=r[e+1];t&&t!==``&&t!==`.`&&(this._findDescendants(i,t,a),e++)}else if(t===`*`||t===`**`){if(!i.childNodes)continue;let e=i.childNodes,t=e.length;for(let n=0;n<t;n++){let t=e[n];t.nodeType===1&&a.push(t)}}else{if(!i.childNodes)continue;let e=i.childNodes,n=e.length;for(let r=0;r<n;r++){let n=e[r];if(n.nodeType!==1)continue;let i=n;this._matchesElementName(i,t)&&a.push(i)}}}if(n=a,n.length===0)return null}return n.length===1?n[0]:n.length===0?null:new Se(n)}_matchesElementName(e,t){return t.includes(`:`)?(e.tagName||e.nodeName)===t:e.localName===t}_findDescendants(e,t,n){if(!e||!e.childNodes)return;let r=e.childNodes,i=r.length;for(let e=0;e<i;e++){let i=r[e];if(i.nodeType!==1)continue;let a=i;this._matchesElementName(a,t)&&n.push(a),this._findDescendants(a,t,n)}}getFromPath(t,n){return e.getFromPath(t,n)}setToPath(t,n,r){return e.setToPath(t,n,r)}getValAttrAsString(e,t){let n=this.evaluate(e,t);return n&&n.hasAttribute(`val`)?n.getAttribute(`val`)??null:null}getValAttrAsBoolean(e,t,n=!1){let r=this.evaluate(e,t);if(!r)return null;let i=r.hasAttribute(`val`)?r.getAttribute(`val`):void 0;return i==null?n:i===`1`||i===`on`||i===`true`||i!==`0`&&i!==`off`&&i!==`false`&&n}getValAttrAsInteger(e,t){let n=this.evaluate(e,t);return n&&n.hasAttribute(`val`)?parseInt(n.getAttribute(`val`))??null:null}getValAttrAsFloat(e,t){let n=this.evaluate(e,t);return n&&n.hasAttribute(`val`)?parseFloat(n.getAttribute(`val`))??null:null}get BOOLEAN_COPY(){return Ce}get INT_COPY(){return we}get FLOAT_COPY(){return Te}copyFromAttribute(e,t,n,r=t,i=null){if(!e||!n||!e.hasAttribute(t))return;let a=e.getAttribute(t);if(i){if(Array.isArray(i)){let e=i.length;for(let t=0;t<e;t++)if(a==null||(a=i[t](a),a==null))return}else if(a==null||(a=i(a),a==null))return}this.setToPath(n,r,a)}},B=(e,t)=>{let n=[],r=e.childNodes,i=r.length;for(let e=0;e<i;e++){let i=r.item(e);i.nodeType===1&&i.localName===t&&n.push(i)}return n},De=[[`fillRef`,`fill`],[`lnRef`,`stroke`],[`effectRef`,`effect`]],V=(e,t)=>{let n=new O,r={};for(let[i,a]of De){let o=e.evaluate(i,t);if(!o)continue;let s={index:parseInt(o.getAttribute(`idx`)??`0`,10)||0},c=n.processAdjColor(e,o);c&&(s.color=c),r[a]=s}let i=e.evaluate(`fontRef`,t);if(i){let t={index:i.getAttribute(`idx`)??`none`},a=n.processAdjColor(e,i);a&&(t.color=a),r.font=t}return r},H=class{visit(e,t,n){if(!t)return;let r=e.evaluate(`*/cNvPr`,t);return r.item&&(r=r.item(0)),r&&(e.copyFromAttribute(r,`name`,n),e.copyFromAttribute(r,`descr`,n,`description`),e.copyFromAttribute(r,`hidden`,n,`hidden`,e.BOOLEAN_COPY),this.readNonVisualDetails(e,r,n),e.copyFromAttribute(r,`id`,n)),n}readNonVisualDetails(e,t,n){t.hasAttribute(`title`)&&(n.title=t.getAttribute(`title`));let r=e.evaluate(`hlinkClick`,t);r&&(n.hyperlink=j(e,r));let i=e.evaluate(`hlinkHover`,t);i&&(n.hoverHyperlink=j(e,i));let a=e.evaluate(`extLst`,t),o=a?e.serializeElement(a):null;o&&(n.extLst={...n.extLst,nonVisual:o})}setContent(e,t){let n=e;n.name!==void 0&&(t.name=n.name,delete n.name),n.description!==void 0&&(t.description=n.description,delete n.description);for(let e of[`title`,`hyperlink`,`hoverHyperlink`,`extLst`])n[e]!==void 0&&(t.json&&(t.json[e]=n[e]),delete n[e]);e.content=t}isGroupContent(e){return Array.isArray(e?.members)}readMemberHeader(e,t,n){let r={},i={anchor:void 0,content:{type:n,json:r}},a=e.evaluate(`*/cNvPr`,t);if(a?.item&&(a=a.item(0)),a){let n=a.getAttribute(`name`);n!==null&&(i.content.name=n);let o=a.getAttribute(`descr`);o&&(i.content.description=o),e.copyFromAttribute(a,`hidden`,i,`hidden`,e.BOOLEAN_COPY),this.readNonVisualDetails(e,a,r);let s=this.readSourceId(e,t);s!==void 0&&(r.sourceId=s)}return{movable:i,content:r}}readStyleRefs(e,t,r){let i=e.evaluate(`style`,t);if(!i)return void(r.style=null);let a=V(e,i),o=n.withoutDefaultStyleRefs({...r,style:a});o&&(r.style=o)}readLocks(e){let t=e?.attributes;if(!t||t.length===0)return;let n={};for(let e=0;e<t.length;e++){let r=t.item(e);r.name.startsWith(`xmlns`)||(n[r.localName??r.name]=A(r.value))}return Object.keys(n).length>0?n:void 0}readSourceId(e,t){let n=e.evaluate(`*/cNvPr`,t);n?.item&&(n=n.item(0));let r=n?.getAttribute?.(`id`),i=r?parseInt(r,10):void 0;return i===void 0||isNaN(i)?void 0:i}},Oe=[[`spDef`,`shape`],[`lnDef`,`line`],[`txDef`,`text`]],U=(e,t)=>{let n=t.getAttribute(`dxfId`);if(n===null)return;let r=parseInt(n);return e.getVisitorParamsState().get(`dxfs`)?.get(r)||(e.warn(`A color filter or sort names a format that does not exist (dxfId '${n}').`),{})},W=e=>e===`1`||e===`true`,G=class{visit(e,t,n){}processDataBarColor(e,t,n,r,i=`auto`){if(!t)return;let a=_(e=>t.getAttribute(e),i);return a&&(n[r]=a),n}processFonts(e,t,n){if(!t)return;let r=t.childNodes,i=0,a=r.length;for(let t=0;t<a;t++){let a=r.item(t);if(a.nodeType===1&&a.localName===`font`){let t={};this.processFont(e,a,t),n[i++]=t}}return n}processFont(e,n,r){e.getValAttrAsBoolean(`b`,n,!0)&&(r.weight=700),e.getValAttrAsBoolean(`i`,n,!0)&&(r.style=t.Style.Italic),e.getValAttrAsBoolean(`strike`,n,!0)&&(r.strike=k(!0));let i=e.evaluate(`u`,n);if(i){let e=i.getAttribute(`val`);r.underline=S(e)}let a=E(e.evaluate(`vertAlign`,n)?.getAttribute(`val`));a!==void 0&&(r.baseline=a),oe(e,n,r,`sz`,`size`);let o=e.evaluate(`color`,n);this.processDataBarColor(e,o,r,`color`),r.color||=`auto`,I(e,n,r,`name`,`family`),I(e,n,r,`rFont`,`family`);let s=e.evaluate(`family`,n);if(s){let e=s.getAttribute(`val`);if(e)switch(e){case`1`:r.fallbacks=[`serif`];break;case`2`:r.fallbacks=[`sans-serif`];break;case`3`:r.fallbacks=[`monospace`];break;case`4`:r.fallbacks=[`cursive`];break;case`5`:r.fallbacks=[`fantasy`]}}v(r,e.evaluate(`scheme`,n)?.getAttribute(`val`)),L(e,n,r,`shadow`,`shadow`,!0),L(e,n,r,`outline`,`outline`,!0);for(let t of[`condense`,`extend`]){let i=b(t,!!e.getValAttrAsBoolean(t,n,!0));i!==void 0&&(r.letterSpacing=i)}return P(e,n,r,`charset`,`charset`),r}processFills(e,t,n){if(!t)return;let r=t.childNodes,i=0,a=r.length;for(let t=0;t<a;t++){let a=r.item(t);a.nodeType===1&&a.localName===`fill`&&this.processFill(e,a,n,i++)}return n}processFill(e,t,n,r){let i={type:o.Type.None},a=t.childNodes,s=!1,c=a.length;for(let t=0;!s&&t<c;t++){let n=a.item(t);n.nodeType===1&&(n.localName===`gradientFill`?(this.processGradientFill(e,n,i),s=!0):n.localName===`patternFill`&&(this.processPatternFill(e,n,i),s=!0))}return n[r]=i,n}processGradientFill(e,t,n){if(!t)return;n.type=o.Type.Gradient;let r=[];n.stops=r;let i=t.getAttribute(`type`);i&&(n.gradientType=i);let a=t.hasAttribute(`degree`)?parseFloat(t.getAttribute(`degree`)):0;(a+90)%360!=0&&(n.angle=(a+90)%360),(t.hasAttribute(`left`)||t.hasAttribute(`top`)||t.hasAttribute(`right`)||t.hasAttribute(`bottom`))&&(n.focus={left:K(t.getAttribute(`left`)),top:K(t.getAttribute(`top`)),right:K(t.getAttribute(`right`)),bottom:K(t.getAttribute(`bottom`))});let s=t.childNodes,c=s.length;for(let t=0;t<c;t++){let n=s.item(t);if(n.nodeType===1&&n.localName===`stop`){let t={};r.push(t),t.offset=parseFloat(n.getAttribute(`position`)??``);let i=e.evaluate(`color`,n);this.processDataBarColor(e,i,t,`color`)}}return n}processPatternFill(e,t,n){if(!t)return;let r=e.getVisitorParamsState().get(`processingDXFs`),i=t.getAttribute(`patternType`)||(r?o.BuiltInSheetPattern.Solid:o.BuiltInSheetPattern.None);if(i===o.BuiltInSheetPattern.None)return{none:!0};n.type=o.Type.Pattern,i&&(n.patternType=i);let a=`foreground`,s=`background`,c=n.patternType===o.BuiltInSheetPattern.Solid&&r,l=c?`dk1`:`lt1`,u=c?`lt1`:`dk1`;if(c){let e=a;a=s,s=e}let d=e.evaluate(`fgColor`,t);this.processDataBarColor(e,d,n,a,l);let f=e.evaluate(`bgColor`,t);return this.processDataBarColor(e,f,n,s,u),c&&(n.foreground||=`lt1`,n.background||=`dk1`),n}processBorders(e,t,n,r){if(!t)return;let i=t.childNodes,a=0,o=i.length;for(let t=0;t<o;t++){let o=i.item(t);o.nodeType===1&&o.localName===`border`&&this.processBorder(e,o,n,a++,r)}return n}processBorder(e,t,n,r,i){if(!t)return;let o={};this.processBorderStroke(e,t,o,a.Edge.Left),this.processBorderStroke(e,t,o,a.Edge.Right),i?(o.right||o.left)&&(o.vertical=o.right?{...o.right}:{...o.left}):this.processBorderStroke(e,t,o,a.Edge.Vertical),this.processBorderStroke(e,t,o,a.Edge.Top),this.processBorderStroke(e,t,o,a.Edge.Bottom),i?(o.bottom||o.top)&&(o.horizontal=o.bottom?{...o.bottom}:{...o.top}):this.processBorderStroke(e,t,o,a.Edge.Horizontal);let s=this.processBorderStroke(e,t,{},`diagonal`);return s&&(W(t.getAttribute(`diagonalUp`))&&(o.diagonalUp={...s}),W(t.getAttribute(`diagonalDown`))&&(o.diagonalDown={...s})),n[r]=o,n}processBorderStroke(e,t,n,r){if(!t)return;let i=e.evaluate(r,t);if(!i)return;let o={};i.hasAttribute(`style`)?o.style=i.getAttribute(`style`):e.getVisitorParamsState().get(`processingDXFs`)&&(o.style=a.StrokeStyle.None);let s=e.evaluate(`color`,i);return s&&this.processDataBarColor(e,s,o,`color`),Object.keys(o).length>0?n[r]=o:null}},K=e=>{if(!e)return 0;let t=parseFloat(e);return isNaN(t)?0:t},q=(e,t)=>{if(!e||e.nodeType!==1)return null;let n=e.childNodes;for(let e=0;e<n.length;e++){let r=n.item(e);if(r.nodeType===1&&r.localName===t)return r}return null},ke=new Set(Object.values(m.ElementType).filter(e=>e!==m.ElementType.WholeTable&&e!==m.ElementType.HeaderRow)),Ae={auto:`auto`,autoNoTable:`automaticExceptTables`,manual:`manual`},J=[`tableId`,`columnId`,`cacheName`,`cachePath`,`sourceName`,`sortOrder`,`customListSort`,`crossFilter`,`pivotTables`,`pivotCacheId`,`pivotBody`,`tabular`,`pivotData`,`showMissing`],je=new Set([`name`,`xr10:uid`,`cache`,`caption`]),Y=(e,t)=>{let n=e.content,r=n?.json;if(r){if(n.type===`shape`||n.type===`picture`){let{rotation:n,flipH:i,flipV:a,bounds:o}=r;delete r.rotation,delete r.flipH,delete r.flipV,delete r.bounds,n!==void 0&&n!==0&&(e.rotation=n),i&&(e.flipH=!0),a&&(e.flipV=!0),t&&o&&(e.anchor={tl:{x:o.x,y:o.y},br:{x:o.width,y:o.height}})}if(n.type===`group`)for(let e of r.members??[])Y(e,!0)}},X=class extends H{visit(e,t,n){if(t)return this.visitShape(e,t,n,`sp`,`nvSpPr/cNvSpPr/spLocks`)}visitShape(e,t,n,i,a){let o=h[i];if(this.isGroupContent(n)){if(e.getPath().includes(`Fallback`))return{};let{movable:s,content:c}=this.readMemberHeader(e,t,`shape`);o!==r.Type.Shape&&(c.type=o),this.readShapeDetails(e,t,i,a,c),this.readStyleRefs(e,t,c);let l=e.evaluate(a,t);l?.hasAttribute?.(`noChangeAspect`)&&(s.lockAspect=l.getAttribute(`noChangeAspect`)===`1`);let u=this.readTwinOf(e,t);return u!==void 0&&Object.assign(c,{twinOf:u}),n.members.push(s),c}if(e.getPath().includes(`Fallback`)&&n.content){let i=n.content.json;if(n.content.type===`shape`&&i&&(i.type??r.Type.Shape)===o){let n=e.evaluate(`txBody`,t),r=n?new x().readTextBody(e,n):null;r&&me(r)!==``&&(i.text=r)}return{}}n=super.visit(e,t,n);let s=e.evaluate(a,t);s?.hasAttribute?.(`noChangeAspect`)&&(n.lockAspect=s.getAttribute(`noChangeAspect`)===`1`);let c=o===r.Type.Shape?{}:{type:o},l=this.readSourceId(e,t);l!==void 0&&(c.sourceId=l),this.readShapeDetails(e,t,i,a,c),this.readStyleRefs(e,t,c);let u=this.readTwinOf(e,t);return u!==void 0&&Object.assign(c,{twinOf:u}),this.setContent(n,{type:`shape`,json:c}),c}readTwinOf(e,t){let n=e.evaluate(`*/cNvPr/extLst/ext/compatExt`,t);n?.item&&(n=n.item(0));let r=/^_x0000_s(\d+)$/.exec(n?.getAttribute?.(`spid`)??``);return r?parseInt(r[1],10):void 0}readShapeDetails(e,t,n,r,i){let a=t.getAttribute(`macro`);a&&(i.macro=a);let o=t.getAttribute(`textlink`);o&&(i.textLink=o),t.hasAttribute(`fLocksText`)&&(i.locksText=A(t.getAttribute(`fLocksText`))),t.hasAttribute(`fPublished`)&&(i.published=A(t.getAttribute(`fPublished`)));let s=r.slice(0,r.lastIndexOf(`/`)),c=e.evaluate(s,t);c?.getAttribute?.(`txBox`)===`1`&&(i.textBox=!0);let l=this.readLocks(e.evaluate(r,t));if(l&&(i.locks=l),n===`cxnSp`&&c){let t=t=>{let n=e.evaluate(t,c);if(n?.getAttribute)return{id:parseInt(n.getAttribute(`id`)??`0`,10)||0,index:parseInt(n.getAttribute(`idx`)??`0`,10)||0}},n=t(`stCxn`),r=t(`endCxn`);(n||r)&&(i.connectorEnds={},n&&(i.connectorEnds.start=n),r&&(i.connectorEnds.end=r))}}},Me=/^<a:extLst(?:\s+xmlns:a="[^"]*")?><a:ext uri="\{28A0092B-C50C-407E-A947-70E740481C1C\}"><a14:useLocalDpi(?:\s+xmlns:a14="[^"]*")?\s+val="0"\s*\/><\/a:ext><\/a:extLst>$/,Z=(e,t,n,r)=>{let i=e.evaluate(n,t),a=e.evaluate(r,t);return i||a?{x:w(i?.getAttribute(`x`)??null)??0,y:w(i?.getAttribute(`y`)??null)??0,width:w(a?.getAttribute(`cx`)??null)??0,height:w(a?.getAttribute(`cy`)??null)??0}:null},Ne={Checkbox:`checkbox`},Q=e=>{let t=e.getAttribute(`val`);return t!==`0`&&t!==`false`},Pe={1:`serif`,2:`sans-serif`,3:`monospace`,4:`cursive`,5:`fantasy`};function Fe(e){let n={},r=e.childNodes;for(let e=0;e<r.length;e++){let i=r.item(e);if(i.nodeType===1)switch(i.localName){case`b`:n.weight=Q(i)?700:400;break;case`i`:n.style=Q(i)?t.Style.Italic:t.Style.Normal;break;case`strike`:n.strike=k(Q(i));break;case`outline`:n.outline=Q(i);break;case`shadow`:n.shadow=Q(i);break;case`condense`:case`extend`:{let e=b(i.localName,Q(i));e!==void 0&&(n.letterSpacing=e);break}case`u`:n.underline=S(i.getAttribute(`val`));break;case`vertAlign`:{let e=E(i.getAttribute(`val`));e!==void 0&&(n.baseline=e);break}case`sz`:{let e=parseFloat(i.getAttribute(`val`)??``);isNaN(e)||(n.size=e);break}case`rFont`:{let e=i.getAttribute(`val`);e&&(n.family=e);break}case`family`:{let e=Pe[i.getAttribute(`val`)??``];e&&(n.fallbacks=[e]);break}case`charset`:{let e=parseInt(i.getAttribute(`val`)??``,10);isNaN(e)||(n.charset=e);break}case`scheme`:v(n,i.getAttribute(`val`));break;case`color`:{let e=i.getAttribute(`rgb`);if(e&&!i.hasAttribute(`theme`)){n.color=`#`+(e.length===8?e.substring(2):e).toUpperCase();break}let t=_(e=>i.getAttribute(e));t&&(n.color=t);break}}}return Object.keys(n).length>0?n:null}var $={RelsVisitor:class{visit(e,t,n){if(!t)return;let r=t.childNodes,i=r.length;for(let t=0;t<i;t++){let i=r.item(t);i.nodeType===1&&i.localName===`Relationship`&&this.processRelationship(e,i,n)}return n}processRelationship(e,t,n){let r={};e.copyFromAttribute(t,`Target`,r,`target`),e.copyFromAttribute(t,`Type`,r,`type`),e.copyFromAttribute(t,`TargetMode`,r,`targetMode`),n[t.getAttribute(`Id`)]=r}},CorePropertiesVisitor:class{visit(e,t,n){let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);if(n.nodeType!==1)continue;let a=this.processProperty(e,n);a&&r.push(a)}return r.length>0&&(n.properties=r),r}processProperty(e,t){if(t)return t.getAttribute(`xsi:type`),{key:t.localName,value:t.textContent||``}}},AppPropertiesVisitor:class{visit(e,t,n){let r=t.childNodes,i=r.length;for(let e=0;e<i;e++)if(r.item(e).localName===`property`)return this.visitCustom(t,n);let a=[];for(let t=0;t<i;t++){let n=r.item(t);if(n.nodeType!==1)continue;let i=this.processProperty(e,n);i&&a.push(i)}return a.length>0&&(n.properties=a),a}visitCustom(e,t){let n=[],r=e.childNodes,i=r.length;for(let e=0;e<i;e++){let t=r.item(e);if(t.nodeType!==1||t.localName!==`property`)continue;let i=t.getAttribute(`name`);if(!i)continue;let a=null;for(let e=0;e<t.childNodes.length&&!a;e++){let n=t.childNodes.item(e);n.nodeType===1&&(a=n)}let o={key:i,kind:a?.localName??null,value:a?.textContent??``},s=t.getAttribute(`linkTarget`);s&&(o.linkTarget=s),n.push(o)}return n.length>0&&(t.custom=n),n}processProperty(e,t){if(t)return{key:t.localName,value:t.textContent||``}}},ShapePropertiesVisitor:y,TextPropertiesVisitor:_e,ShapeTextVisitor:x,ThemeVisitor:class{visit(e,t,n){n.name=t.getAttribute(`name`),n.objectDefaults={};let r=B(t,`custClrLst`)[0];if(r){let t=new O,i=[];for(let n of B(r,`custClr`)){let r=t.processAdjColor(e,n);if(!r)continue;let a={color:r},o=n.getAttribute(`name`);o&&(a.name=o),i.push(a)}i.length&&(n.customColors=i)}for(let e of B(t,`extLst`))for(let t of B(e,`ext`)){if(t.getAttribute(`uri`)!==`{05A4C25C-085E-4340-85A3-A5531E510DB2}`)continue;let e=B(t,`themeFamily`)[0],r=e?.getAttribute(`id`);if(!r)continue;let i={name:e.getAttribute(`name`)??``,id:r},a=e.getAttribute(`vid`);a&&(i.vid=a),n.family=i}return n}},ClrSchemeVisitor:class extends O{visit(e,t,n){let r={};r.name=t.getAttribute(`name`);let i=t.childNodes,a=i.length;for(let n=0;n<a;n++){let a=i.item(n);if(a.nodeType===1){let n=a.localName,i=e.evaluate(n,t);r[n]=this.processAdjColor(e,i)}}return Object.keys(r).length>0&&(n.colors=r),r}},FontSchemeVisitor:class{visit(e,t,n){let r={};r.name=t.getAttribute(`name`);let i=this.processFontCollection(e,e.evaluate(`majorFont`,t));i&&(r.major=i);let a=this.processFontCollection(e,e.evaluate(`minorFont`,t));return a&&(r.minor=a),n.fonts=r,r}processFontCollection(e,t){if(!t)return;let n={},r=e.evaluate(`latin`,t),i=r?.getAttribute(`typeface`);i&&(n.latin=i);let a=r?.getAttribute(`panose`);a&&(n.panose=a);let o=e.evaluate(`ea`,t)?.getAttribute(`typeface`);o&&(n.eastAsian=o);let s=e.evaluate(`cs`,t)?.getAttribute(`typeface`),c;s&&(n.complexScript=s);let l=t.childNodes,u=l.length;for(let e=0;e<u;e++){let t=l.item(e);if(t.nodeType!==1||t.localName!==`font`)continue;let n=t.getAttribute(`script`);n&&((c??={})[n]=t.getAttribute(`typeface`)??``)}return c&&(n.scripts=c),n}},ObjectDefaultsVisitor:class{visit(e,t,n){let r={};for(let[n,i]of Oe){let a=e.evaluate(n,t);a&&(r[i]=this.processDefault(e,a))}return n.objectDefaults=r,{}}processDefault(e,t){let n={},r=e.evaluate(`spPr`,t);r&&new y().visit(e,r,n);let i=new x().readTextBody(e,t);(i.body||i.listStyle)&&(n.text=i);let a=e.evaluate(`style`,t);return a&&(n.style=V(e,a)),n}},FmtSchemeVisitor:class extends O{visit(e,t,n){let r=this.parseFillList(e,t,`fillStyleLst`),i=this.parseLnList(e,t,`lnStyleLst`),a=this.parseEffectStyleList(e,t,`effectStyleLst`),o=this.parseFillList(e,t,`bgFillStyleLst`);if(r&&(n.fillStyleLst=r),i&&(n.lnStyleLst=i),a&&(n.effectStyleLst=a),o&&(n.bgFillStyleLst=o),r&&i&&a&&o)return;let s=e.serializeElement(t);s&&(n.formatSchemeXml=s)}parseFillList(e,t,n){let r=e.evaluate(n,t);if(!r)return;let i=[],a=r.childNodes,o=a.length;for(let t=0;t<o;t++){let n=a.item(t);if(n.nodeType!==1)continue;let r=this.parseFillListItem(e,n);if(r===void 0)return;i.push(r)}return i}parseFillListItem(e,t){switch(t.localName){case`noFill`:return{type:o.Type.None};case`solidFill`:{let n=this.processAdjColor(e,t);return n?{type:o.Type.Solid,color:n}:void 0}case`gradFill`:return this.processGradFill(e,t);case`pattFill`:return this.processPatternFill(e,t);default:return}}parseLnList(e,t,n){let r=e.evaluate(n,t);if(!r)return;let i=[],a=r.childNodes,o=a.length;for(let t=0;t<o;t++){let n=a.item(t);n.nodeType===1&&i.push(this.parseLn(e,n))}return i}parseEffectStyleList(e,t,n){let r=e.evaluate(n,t);if(!r)return;let i=[],a=r.childNodes,o=a.length;for(let t=0;t<o;t++){let n=a.item(t);if(n.nodeType!==1)continue;if(e.evaluate(`scene3d`,n)||e.evaluate(`sp3d`,n))return;let r=this.getEffects(e,n);if(r===void 0)return;i.push(r??[])}return i}},AutoFilterVisitor:class{visit(e,t,n){if(!t)return;let r={},i=[];return this.processFilterColumns(e,t,i,n),i.length>0&&(r.conditions=i),Object.keys(r).length>0&&(n.filter=r),n}processColorFilter(e,t){let n={},r={operator:d.BuiltInOperatorNames.Color,param:n};e.copyFromAttribute(t,`cellColor`,n,`cellColor`,e.BOOLEAN_COPY);let i=U(e,t);return i&&(n.style=i),r}processCustomFilter(e,t){return pe({operator:t.getAttribute(`operator`),val:t.getAttribute(`val`)},t=>e.warn(t))}processCustomFilters(e,t){let n=t.getAttribute(`and`),r=n===`and`||n===`1`;t.getAttribute(`val`);let i=[],a={operator:r?d.BuiltInOperatorNames.And:d.BuiltInOperatorNames.Or,param:i},o=t.childNodes,s=o.length;for(let t=0;t<s;t++){let n=o.item(t);if(n.nodeType!==1)continue;let r=null;n.localName===`customFilter`&&(r=this.processCustomFilter(e,n)),r&&i.push(r)}return i.length===1?i[0]:ae(a)}processDynamicFilter(e,t){return ge(t.getAttribute(`type`),t.getAttribute(`val`),t.getAttribute(`maxVal`))}processDateGroupItem(e,t){let n={};return e.copyFromAttribute(t,`dateTimeGrouping`,n,`group`),e.copyFromAttribute(t,`day`,n,`day`,e.INT_COPY),e.copyFromAttribute(t,`hour`,n,`hour`,e.INT_COPY),e.copyFromAttribute(t,`minute`,n,`minute`,e.INT_COPY),e.copyFromAttribute(t,`month`,n,`month`,e.INT_COPY),e.copyFromAttribute(t,`second`,n,`second`,e.INT_COPY),e.copyFromAttribute(t,`year`,n,`year`,e.INT_COPY),n}processFilterItem(e,t){if(t.hasAttribute(`val`))return t.getAttribute(`val`)}processFilters(e,t){let n={},r={operator:d.BuiltInOperatorNames.InSet,param:n};r.selector=d.BuiltInSelectorNames.Display,e.copyFromAttribute(t,`blank`,n,`blank`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`calendarType`,n,`calendarType`);let i=[],a=[],o=t.childNodes,s=o.length;for(let t=0;t<s;t++){let n=o.item(t);if(n.nodeType===1){if(n.localName===`dateGroupItem`){let t=this.processDateGroupItem(e,n);t&&i.push(t)}else if(n.localName===`filter`){let t=this.processFilterItem(e,n);t!==void 0&&a.push(t)}}}return i.length>0&&(n.dateGroups=i),a.length>0&&(n.items=a),r}processIcon(e,t){let n={},r={operator:d.BuiltInOperatorNames.Icon,param:n};return e.copyFromAttribute(t,`iconId`,n,`iconId`,e.INT_COPY),e.copyFromAttribute(t,`iconSet`,n),r}processTop10(e,t){let n={},r={operator:d.BuiltInOperatorNames.TopN,param:n};return e.copyFromAttribute(t,`filterVal`,n,`filterVal`,e.FLOAT_COPY),e.copyFromAttribute(t,`percent`,n,`percent`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`top`,n,`top`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`val`,n,`limit`,e.FLOAT_COPY),r}processFilterColumnExt(e,t){let n=t.childNodes;for(let t=0;t<n.length;t++){let r=n.item(t);if(r.nodeType!==1||r.localName!==`ext`||g(r.getAttribute(`uri`))!==g(`{1AD28BCE-077C-4C59-8B6E-1921CE8616D4}`))continue;let i=r.childNodes;for(let t=0;t<i.length;t++){let n=i.item(t);if(n.nodeType!==1||n.localName!==`filterColumn`)continue;let r=n.childNodes;for(let t=0;t<r.length;t++){let n=r.item(t);if(n.nodeType===1&&n.localName===`filters`)return this.processFilters(e,n)}}}}processFilterCriteria(e,t){if(!t)return;let n=t.childNodes,r,i=n.length;for(let t=0;t<i;t++){let i=n.item(t);i.nodeType===1&&(i.localName===`colorFilter`?r=this.processColorFilter(e,i):i.localName===`customFilters`?r=this.processCustomFilters(e,i):i.localName===`dynamicFilter`?r=this.processDynamicFilter(e,i):i.localName===`filters`?r=this.processFilters(e,i):i.localName===`iconFilter`?r=this.processIcon(e,i):i.localName===`top10`?r=this.processTop10(e,i):i.localName===`extLst`&&(r=this.processFilterColumnExt(e,i)??r))}return r}processFilterColumn(e,t,n){if(!t)return null;if(!t.hasAttribute(`colId`))return;let r=parseInt(t.getAttribute(`colId`)),i=!1;if(t.hasAttribute(`hiddenButton`)&&(i=A(t.getAttribute(`hiddenButton`))),i&&n){let e=n.hiddenButtons;e||(e=[],n.hiddenButtons=e),e.push(r)}let a=!1;if(t.hasAttribute(`showButton`)&&(a=A(t.getAttribute(`showButton`))),a&&n){let e=n.showButtons;!0!==e&&(e||(e=[],n.showButtons=e),e[r]=!0)}let o=this.processFilterCriteria(e,t);return o?(o.index=r,o):null}processFilterColumns(e,t,n,r){if(!t)return;let i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let a=i.item(t);if(a.nodeType===1&&a.localName===`filterColumn`){let t=this.processFilterColumn(e,a,r);t&&n.push(t)}}return n}},SortStateVisitor:class{visit(e,t,n){if(!t)return;let r=t.getAttribute(`ref`),i={};t.hasAttribute(`caseSensitive`)&&(i.collatorOptions=A(t.getAttribute(`caseSensitive`))?p.CaseSensitiveOptions:p.CaseInsensitiveOptions);let a=t.getAttribute(`sortMethod`);a!=null&&a!==`none`&&(a===`stroke`?i.collatorOptions={...i.collatorOptions,collation:`stroke`}:a===`pinYin`&&(i.collatorOptions={...i.collatorOptions,collation:`pinyin`}));let o={};t.hasAttribute(`columnSort`)&&A(t.getAttribute(`columnSort`))&&(o.axis=c.Axis.Column);let s=u.fastStringToRange(r),l=[],d=[];this.processSortConditions(e,t,l,s,i,d),l.length>0&&(o.sorts=l);let f=e.getVisitorParamsState().get(`ref`);if(f&&r){let e=u.fastStringToRange(f);o.extent={range:ee(e,s),sorts:d.map(t=>ue(e,s,t))}}return Object.keys(l).length>0&&(n.sort=o),o}processSortCondition(e,t,n,r,i){if(!t)return null;let a={};if(!t.hasAttribute(`ref`))return void e.warn(`A sort condition has no ref; it was dropped.`,{onceKey:`xlsx.sheet.sort.noRef`});if(t.hasAttribute(`ref`)){let e=t.getAttribute(`ref`),r=u.fastStringToRange(e);a.index=n?r.colStart-n.colStart:r.colStart,i?.push(r)}let o={...r};a.criteria=o,o.reverse=!1,t.hasAttribute(`descending`)&&(o.reverse=A(t.getAttribute(`descending`)));let s=ce(t.getAttribute(`sortBy`));s&&(o.sortOn=s);let c=U(e,t);return c&&(o.style=c),e.copyFromAttribute(t,`iconSet`,o),e.copyFromAttribute(t,`customList`,o),a}processSortConditions(e,t,n,r,i,a){if(!t)return;let o=t.childNodes,s=o.length;for(let t=0;t<s;t++){let s=o.item(t);if(s.nodeType===1&&s.localName===`sortCondition`){let t=this.processSortCondition(e,s,r,i,a);t&&n.push(t)}}}},SheetStyleVisitor:class extends G{visit(e,t,n){this.processNumFmts(e,e.evaluate(`numFmts`,t),null),e.getVisitorParamsState().set(`colorsToProcess`,new Set);let r={fills:{},fonts:{},borders:{}},i=e.evaluate(`fonts`,t);this.processFonts(e,i,r.fonts);let s=r.fonts[this.normalFontId(e,t)],c={declared:[`1`,`true`].includes(i?.getAttribute(`x14ac:knownFonts`)??``),normalIsThemeFont:fe(s?.family),faces:T(Object.values(r.fonts).map(e=>({...e,family:N(e?.family,e?.fallbacks,null,!1).name})))};e.getVisitorParamsState().set(le,c),s&&e.getVisitorParamsState().set(`defaultFont`,s),this.processFills(e,e.evaluate(`fills`,t),r.fills),this.processBorders(e,e.evaluate(`borders`,t),r.borders,!0),r.fills[0]={type:o.Type.None},r.fills[1]={type:o.Type.Pattern,patternType:o.BuiltInSheetPattern.Gray125},r.borders[0]={bottom:{style:a.StrokeStyle.None},left:{style:a.StrokeStyle.None},right:{style:a.StrokeStyle.None},top:{style:a.StrokeStyle.None}};let l=[];this.processXFs(e,e.evaluate(`cellStyleXfs`,t),l,r,null,!1);let u=new Map;if(l.length>0){let r=[];this.processCellStyles(e,e.evaluate(`cellStyles`,t),r,l,u),n.named=r}let d=[];this.processXFs(e,e.evaluate(`cellXfs`,t),d,r,u),Object.keys(d).length>0&&(n.direct=d);let f=this.collectHiddenXfs(e.evaluate(`cellXfs`,t));f.size>0&&e.getVisitorParamsState().set(`hiddenXfs`,f);let p=this.collectPivotButtonXfs(e.evaluate(`cellXfs`,t));p.size>0&&e.getVisitorParamsState().set(`pivotButtonXfs`,p);let m=this.collectXfComplements(e.evaluate(`cellXfs`,t));m.size>0&&e.getVisitorParamsState().set(`xfComplements`,m);let h=[];return this.processDXFs(e,e.evaluate(`dxfs`,t),h),this.processTableStyles(e,e.evaluate(`tableStyles`,t),n,h),this.processSlicerStyles(e,e.evaluate(`extLst`,t),n),this.processIndexColors(e,e.evaluate(`colors/indexedColors`,t),n),this.processMruColors(e,e.evaluate(`colors/mruColors`,t),n),n}normalFontId(e,t){let n=e.evaluate(`cellStyles`,t)?.childNodes,r=0;for(let e=0;e<(n?.length??0);e++){let t=n.item(e);if(t.nodeType===1&&t.getAttribute(`builtinId`)===`0`){r=parseInt(t.getAttribute(`xfId`)??`0`,10)||0;break}}let i=e.evaluate(`cellStyleXfs`,t)?.childNodes,a=0;for(let e=0;e<(i?.length??0);e++){let t=i.item(e);if(t.nodeType===1&&a++===r)return parseInt(t.getAttribute(`fontId`)??`0`,10)||0}return 0}processIndexColors(e,t,n){if(!t)return;let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);if(n.nodeType===1&&n.localName===`rgbColor`){let t={color:null};this.processDataBarColor(e,n,t,`color`),t.color&&r.push(t.color)}}n.indexedColors=r}processMruColors(e,t,n){if(!t)return;let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);if(n.nodeType===1&&n.localName===`color`){let t={color:null};this.processDataBarColor(e,n,t,`color`),t.color&&r.push(t.color)}}r.length>0&&(n.mruColors=r)}processNumFmts(e,t,n){if(!t)return;let r=new Map;if(e.getVisitorParamsState().set(`numFmts`,r),!t)return;let i=t.childNodes,a=i.length;for(let e=0;e<a;e++){let t=i.item(e);if(t.nodeType===1&&t.localName===`numFmt`){let e=t.getAttribute(`numFmtId`),n=t.getAttribute(`formatCode`);if(e&&n){let t=n;r.set(parseInt(e),t)}}}}processXFs(e,t,n,r,i=null,a=!0){if(!t)return;let o=t.childNodes,s=o.length;for(let t=0;t<s;t++){let s=o.item(t);if(s.nodeType===1&&s.localName===`xf`){let t={};this.processXF(e,s,t,r,i,a),n.push(t)}}}processXF(e,t,n,r,i,a){if(!t)return;let o=t.getAttribute(`xfId`);if(o&&i){let e=i.get(parseInt(o));e&&e!==s.BuiltInName.Normal&&(n.named=e)}let c=e=>!(!a&&t.hasAttribute(e))||A(t.getAttribute(e)),l=e=>!a||t.hasAttribute(e)&&A(t.getAttribute(e)),u=a?`0`:void 0;if(c(`applyFont`)){let e=t.getAttribute(`fontId`)??u;if(e!==void 0&&(e!==`0`||l(`applyFont`))){let t=r.fonts[e];t!==void 0&&(n.font=t)}}if(c(`applyFill`)){let e=t.getAttribute(`fillId`)??u;if(e!==void 0&&(e!==`0`||l(`applyFill`))){let t=r.fills[e];t!==void 0&&Object.keys(t).length>0&&(n.fill=t)}}if(c(`applyBorder`)){let e=t.getAttribute(`borderId`)??u;if(e!==void 0&&(e!==`0`||l(`applyBorder`))){let t=r.borders[e];t!==void 0&&(n.borders=t)}}if(c(`applyNumberFormat`)){let r=t.getAttribute(`numFmtId`)??u;if(r!==void 0&&(r!==`0`||l(`applyNumberFormat`))){let t=parseInt(r),i,a=e.getVisitorParamsState();if(a){let e=a.get(`numFmts`);e&&(i=e.get(t)),n.numberFormat=i??t}else e.warn(`Number formats were unavailable; a cell format was not read.`,{onceKey:`xlsx.style.numberFormat.state`})}}if(c(`applyAlignment`)){let r=e.evaluate(`alignment`,t);(r||l(`applyAlignment`))&&this.processAlignment(e,r,n)}if(c(`applyProtection`)){let r=e.evaluate(`protection`,t);(r||l(`applyProtection`))&&this.processProtection(e,r,n)}let d=A(t.getAttribute(`quotePrefix`)??``);d&&(n.quotePrefix=d)}processAlignment(e,t,n){let r={};if(r.horizontal=t?.hasAttribute(`horizontal`)?t.getAttribute(`horizontal`):i.HorizontalAlignment.General,r.vertical=t?.hasAttribute(`vertical`)?t.getAttribute(`vertical`):i.VerticalAlignment.Bottom,r.indent=t?.hasAttribute(`indent`)?parseInt(t.getAttribute(`indent`)):0,r.relativeIndent=t?.hasAttribute(`relativeIndent`)?parseInt(t.getAttribute(`relativeIndent`)):0,r.overflow=A(t?.getAttribute(`wrapText`)??``)?i.Overflow.Wrap:i.Overflow.Visible,A(t?.getAttribute(`shrinkToFit`)??``)&&(r.overflow=i.Overflow.Shrink),t?.hasAttribute(`textRotation`)){let e=parseFloat(t.getAttribute(`textRotation`));e>0&&e<=90?e=360-e:e>90&&e<=180?e-=90:e===255&&(e=0,r.stacked=!0),r.rotation=e}else r.rotation=0;t?.hasAttribute(`justifyLastLine`)&&(r.justifyLastLine=A(t.getAttribute(`justifyLastLine`)));let a=t?.getAttribute(`readingOrder`);return a&&(a===`0`?r.readingDirection=i.ReadingDirection.Auto:a===`1`?r.readingDirection=i.ReadingDirection.LeftToRight:a===`2`?r.readingDirection=i.ReadingDirection.RightToLeft:e.warn(`Invalid readingOrder '${a}'; the direction was left automatic.`,{onceKey:`xlsx.style.readingOrder`})),Object.keys(r).length>0&&(n.alignment=r),n}collectHiddenXfs(e){let t=new Set;if(!e)return t;let n=e.childNodes,r=0;for(let e=0;e<n.length;e++){let i=n.item(e);if(i.nodeType!==1||i.localName!==`xf`)continue;let a=i.childNodes;for(let e=0;e<a.length;e++){let n=a.item(e);n.nodeType===1&&n.localName===`protection`&&A(n.getAttribute(`hidden`)??``)&&t.add(r)}r++}return t}collectPivotButtonXfs(e){let t=new Set;if(!e)return t;let n=e.childNodes,r=0;for(let e=0;e<n.length;e++){let i=n.item(e);i.nodeType===1&&i.localName===`xf`&&(A(i.getAttribute(`pivotButton`)??``)&&t.add(r),r++)}return t}collectXfComplements(e){let t=new Map;if(!e)return t;let n=e.childNodes,r=0;for(let e=0;e<n.length;e++){let i=n.item(e);if(i.nodeType!==1||i.localName!==`xf`)continue;let a=q(i,`extLst`);if(a){let e=a.childNodes;for(let n=0;n<e.length;n++){let i=q(e.item(n),`xfComplement`),a=parseInt(i?.getAttribute(`i`)??``,10);isNaN(a)||t.set(r,a)}}r++}return t}processProtection(e,t,n){if(!t)return;let r=t.getAttribute(`locked`);return n.protection={alwaysUnlocked:!!r&&!A(r)},n}processDXF(e,t,n){if(!t)return;let r=t.childNodes,i=r.length;for(let t=0;t<i;t++){let i=r.item(t);if(i.nodeType===1&&i.localName===`font`){let t={};this.processFont(e,i,t),n.font=t}else if(i.nodeType===1&&i.localName===`fill`){let t=[];this.processFill(e,i,t,0),t.length>0&&t[0]&&(n.fill=t[0])}else if(i.nodeType===1&&i.localName===`border`){let t=[];this.processBorder(e,i,t,0,!1),t.length>0&&t[0]&&(n.borders=t[0])}else if(i.nodeType===1&&i.localName===`numFmt`){let e=i.getAttribute(`formatCode`);if(e)n.numberFormat=e;else{let e=i.getAttribute(`numFmtId`);e&&(n.numberFormat=Number(e))}}else i.nodeType===1&&i.localName===`alignment`&&this.processAlignment(e,i,n)}}processDXFs(e,t,n){if(!t)return;e.getVisitorParamsState().set(`processingDXFs`,!0);let r=new Map;e.getVisitorParamsState().set(`dxfs`,r);let i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let a=i.item(t);if(a.nodeType===1&&a.localName===`dxf`){let t={};this.processDXF(e,a,t);let i=n.length;r.set(i,t),n.push(t)}}e.getVisitorParamsState().delete(`processingDXFs`)}processSlicerStyles(e,t,n){if(!t)return;let r=null,i=null,a=t.childNodes;for(let e=0;e<a.length;e++){let t=a.item(e);if(t.nodeType!==1||t.localName!==`ext`)continue;let n=t.childNodes;for(let e=0;e<n.length;e++){let t=n.item(e);t.nodeType===1&&(t.localName===`dxfs`?r=t:t.localName===`slicerStyles`&&(i=t))}}if(!i)return;let o=[];if(r){e.getVisitorParamsState().set(`processingDXFs`,!0);let t=r.childNodes;for(let n=0;n<t.length;n++){let r=t.item(n);if(r.nodeType!==1||r.localName!==`dxf`)continue;let i={};this.processDXF(e,r,i),o.push(i)}e.getVisitorParamsState().delete(`processingDXFs`)}let s={},c=i.getAttribute(`defaultSlicerStyle`);c&&c!==`SlicerStyleLight1`&&(s.defaultSlicerStyle=c);let l=n.tables?.styles,u=i.childNodes;for(let t=0;t<u.length;t++){let n=u.item(t);if(n.nodeType!==1||n.localName!==`slicerStyle`)continue;let r=n.getAttribute(`name`);if(!r)continue;let i={},a=l?.[r];a&&!1===a.table&&!a.pivot&&(a.wholeTable&&(i.wholeTable=a.wholeTable),a.headerRow&&(i.headerRow=a.headerRow),delete l[r]);let c=e.evaluate(`slicerStyleElements`,n)?.childNodes,d=c?.length??0;for(let t=0;t<d;t++){let n=c.item(t);if(n.nodeType!==1||n.localName!==`slicerStyleElement`)continue;let r=n.getAttribute(`type`);if(!r||!ke.has(r))continue;let a=n.getAttribute(`dxfId`),s=a==null?void 0:o[parseInt(a)];s?i[r]=s:e.warn(`A slicer style names a format that does not exist (dxfId '${a}').`,{onceKey:`xlsx.style.slicerStyle.dxf`})}(s.styles??={})[r]=i}l&&Object.keys(l).length===0&&(delete n.tables.styles,Object.keys(n.tables).length===0&&delete n.tables),Object.keys(s).length>0&&(n.slicers=s)}processTableStyle(e,t,n,r,i=!1){let a=t.getAttribute(`name`),o={name:a};t.hasAttribute(`table`)&&(o.table=A(t.getAttribute(`table`))),o.pivot=!t.hasAttribute(`pivot`)||A(t.getAttribute(`pivot`)),i&&!o.pivot&&r.unshift(null);let s=t.childNodes,c=s.length;for(let t=0;t<c;t++){let n=s.item(t);if(n.nodeType===1&&n.localName===`tableStyleElement`){let t=n.getAttribute(`type`),i=n.getAttribute(`dxfId`),a=i==null?void 0:r?.[i];a||=(e.warn(`A table style names a format that does not exist (dxfId '${i}').`,{onceKey:`xlsx.style.tableStyle.dxf`}),{}),o[t]=a;let s=null;n.hasAttribute(`size`)&&(s=parseInt(n.getAttribute(`size`))),s&&!isNaN(s)&&(a.size=s)}}delete o.name,n[a]=o}processTableStyles(e,t,n,r,i){if(!t)return;let a={},o=t.getAttribute(`defaultTableStyle`);o&&(a.defaultTableStyle=o);let s=t.getAttribute(`defaultPivotStyle`);s&&(a.defaultPivotStyle=s);let c=t.childNodes,l={},u=c.length;for(let t=0;t<u;t++){let n=c.item(t);n.nodeType===1&&n.localName===`tableStyle`&&this.processTableStyle(e,n,l,r,i)}return Object.keys(l).length>0&&(a.styles=l),Object.keys(a).length>0&&(n.tables=a),n}processCellStyles(e,t,n,r,i){if(!t)return;let a=t.childNodes,o=a.length;for(let e=0;e<o;e++){let t=a.item(e);if(t.nodeType===1&&t.localName===`cellStyle`){let e=parseInt(t.getAttribute(`xfId`)??``),a=t.getAttribute(`name`),o=t.getAttribute(`builtinId`),c=a;if(o!==null){let e=s.builtInNameFromId(parseInt(o));e!==void 0&&(c=e)}if(i.set(e,c),!r[e])continue;let l={name:c,style:r[e]};t.getAttribute(`hidden`)&&(l.hidden=A(t.getAttribute(`hidden`))),t.getAttribute(`iLevel`)&&(l.iLevel=parseInt(t.getAttribute(`iLevel`))),o!==null&&A(t.getAttribute(`customBuiltin`)??`0`)&&(l.customized=!0),n.push(l)}}}afterVisit(e,t,n){}},WorkbookVisitor:class extends G{visit(e,t,n){return this.processSheetRefs(e,e.evaluate(`sheets`,t),n),this.processExternalReferences(e,e.evaluate(`externalReferences`,t),n),this.processBookViews(e,e.evaluate(`bookViews`,t),n),this.processDefinedNames(e,e.evaluate(`definedNames`,t),n),this.processCalcPr(e,e.evaluate(`calcPr`,t),n),this.processPivotCaches(e,e.evaluate(`pivotCaches`,t),n),this.processWorkbookProtection(e,e.evaluate(`workbookProtection`,t),n),this.processWorkbookPr(e,e.evaluate(`workbookPr`,t),n),n}processPassword(e,t,n,r=`workbook`,i=`password`){if(!t)return;let a={};e.copyFromAttribute(t,`${r}AlgorithmName`,a,`algorithm`),e.copyFromAttribute(t,`${r}HashValue`,a,`hash`),e.copyFromAttribute(t,`${r}SaltValue`,a,`salt`),e.copyFromAttribute(t,`${r}SpinCount`,a,`spinCount`,e.INT_COPY),e.copyFromAttribute(t,`${r}Password`,a,`legacyHash`),Object.keys(a).length>0&&(n[i]=a)}processWorkbookProtection(e,t,n){if(!t)return;let r={};this.processPassword(e,t,r,`workbook`,`password`),this.processPassword(e,t,r,`revisions`,`revisionsPassword`);for(let e of se)r[e.key]=re(e,t.getAttribute(e.attribute));return n.protection=r,n}processCalcPr(e,t,n){if(!t)return;let r={};e.copyFromAttribute(t,`calcMode`,r,`calcMode`,e=>Ae[e]??null),e.copyFromAttribute(t,`fullCalcOnLoad`,r,`fullCalcOnLoad`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`calcOnSave`,r,`calcOnSave`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`calcCompleted`,r,`calcCompleted`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`fullPrecision`,r,`fullPrecision`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`forceFullCalc`,r,`forceFullCalc`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`concurrentCalc`,r,`concurrentCalc`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`concurrentManualCount`,r,`concurrentManualCount`,e.INT_COPY),e.copyFromAttribute(t,`refMode`,r,`refMode`),e.copyFromAttribute(t,`iterate`,r,`iterate`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`iterateCount`,r,`maxIteration`,e.INT_COPY),e.copyFromAttribute(t,`iterateDelta`,r,`maxIterateChange`,e.FLOAT_COPY);let i=t.getAttribute(`calcId`);i!==null&&e.getVisitorParamsState().set(`calcId`,i),n.calc=r}processSheetRefs(e,t,n){if(!t)return;let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);n.nodeType===1&&n.localName===`sheet`&&this.processSheetRef(e,n,r)}n.sheets=r}processSheetRef(e,t,n){let r={};e.copyFromAttribute(t,`name`,r,`name`),e.copyFromAttribute(t,`state`,r,`visibility`),e.copyFromAttribute(t,`sheetId`,r,`sheetId`,e.INT_COPY);let i=t.getAttribute(`r:id`),a=i?ie(e.getRelationships().get(i)?.type):null;if(a){let t=e.readEmbeddedPart(i);if(t?.xml){let e={part:t},i=te(t.xml),o=i?_(e=>i.get(e)):void 0;o&&(e.tabColor=o),r.kind=a,r.sheet=e,n.push(r);return}e.warn(`The ${a} sheet '${r.name}' could not be read and was loaded as an empty worksheet.`),n.push(r);return}let o=i?e.getRef(i):null;o&&(r.sheet=o),n.push(r)}processExternalReferences(e,t,n){if(!t)return;let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);if(n.nodeType===1&&n.localName===`externalReference`){let t=n.getAttribute(`r:id`),i=t?e.getRef(t):null;r.push(i??null)}}r.length>0&&(n.externalBooks=r)}processPivotCaches(e,t,n){if(!t)return;let r=[],i=e.evaluate(`workbookPr`,t.parentNode)?.getAttribute?.(`date1904`),a=i===`1`||i===`true`,o=C(e.getVisitorParamsState().get(`numFmts`),void 0),s=t.childNodes,c=s.length;for(let t=0;t<c;t++){let n=s.item(t);if(n.nodeType!==1||n.localName!==`pivotCache`)continue;let i=parseInt(n.getAttribute(`cacheId`)??``,10),c=n.getAttribute(`r:id`);if(isNaN(i)||!c)continue;let l=e.readEmbeddedPart(c);if(!l)continue;let u=R(l,a,e=>o.numberFormat(e)),d=!u&&l.xml?ne(l.xml,o):void 0,f=!u&&l.xml?be(l.xml):void 0;r.push({cacheId:i,part:l,...d?{partFormats:d}:{},...f?{source:f}:{},...u})}r.length>0&&(n.pivotCaches=r)}processBookViews(e,t,n){if(!t)return;let r=t.childNodes,i=0,a=r.length;for(let t=0;i<1&&t<a;t++){let a=r.item(t);a.nodeType===1&&a.localName===`workbookView`&&(this.processWorkbookView(e,a,n),i++)}}processWorkbookView(e,t,n){if(!t)return;let r={},i=[`xWindow`,`yWindow`,`windowWidth`,`windowHeight`].map(e=>parseInt(t.getAttribute(e)??``,10));if(i.some(e=>Number.isFinite(e))){let[e,t,n,a]=i.map(e=>Number.isFinite(e)?e:0);r.windowBounds={left:e,top:t,width:n,height:a}}e.copyFromAttribute(t,`activeTab`,r,`activeSheetId`,[e.INT_COPY,e=>e]),t.hasAttribute(`activeTab`)||(r.activeSheetId=0),e.copyFromAttribute(t,`showHorizontalScroll`,r,`showHorizontalScrollbar`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`showVerticalScroll`,r,`showVerticalScrollbar`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`showSheetTabs`,r,`showTabs`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`tabRatio`,r,`tabRatio`,[e.FLOAT_COPY,e=>e]),e.copyFromAttribute(t,`firstSheet`,r,`firstTab`,[e.INT_COPY,e=>e]),e.copyFromAttribute(t,`minimized`,r,`minimized`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`autoFilterDateGrouping`,r,`autoFilterDateGrouping`,e.BOOLEAN_COPY);let a=t.getAttribute(`visibility`);a!==`hidden`&&a!==`veryHidden`||(r.visibility=a),Object.keys(r).length>0&&(n.view=r)}processDefineName(e,t,n,r){if(!t)return;let i={},a=t.firstChild;if(a&&a.nodeType===3&&(i.ref=a.textContent),e.copyFromAttribute(t,`name`,i),e.copyFromAttribute(t,`comment`,i),e.copyFromAttribute(t,`hidden`,i,`hidden`,e.BOOLEAN_COPY),t.hasAttribute(`localSheetId`)){let n=t.getAttribute(`localSheetId`);if(!r[n]?.name)return void e.warn(`Defined name '${t.getAttribute(`name`)}' references a sheet with localSheetId '${n}' which does not exist.`);i.scope=r[n].name}let o={};for(let n of ve)e.copyFromAttribute(t,n,o);for(let e of ye){let n=t.getAttribute(e);n!==`1`&&n!==`true`||(o[e]=!0)}e.copyFromAttribute(t,`functionGroupId`,o,`functionGroupId`,e.INT_COPY),Object.keys(o).length>0&&(i.fileAttributes=o),Object.keys(i).length>0&&n.push(i)}processDefinedNames(e,t,n){if(!t)return;let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let a=i.item(t);a.nodeType===1&&a.localName===`definedName`&&this.processDefineName(e,a,r,n.sheets)}r.length>0&&(n.names=r)}processWorkbookPr(e,t,n){if(!t)return;e.copyFromAttribute(t,`date1904`,n,`date1904`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`codeName`,n,`codeName`),e.copyFromAttribute(t,`updateLinks`,n,`updateLinks`);let r=t.getAttribute(`hidePivotFieldList`);r!==`1`&&r!==`true`||(n.hiddenPivotFieldList=!0)}afterVisit(e,t,n){}},TableVisitor:class{visit(e,t,n){let r={};return e.copyFromAttribute(t,`ref`,n,`r`),e.getVisitorParamsState().set(`ref`,n.r),n.v=r,e.copyFromAttribute(t,`name`,r),e.copyFromAttribute(t,`displayName`,r,`name`),e.copyFromAttribute(t,`headerRowCount`,r,`headerRowCount`,e.INT_COPY),e.copyFromAttribute(t,`totalsRowCount`,r,`totalsRowCount`,e.INT_COPY),this.processTableColumns(e,t,r),this.processTableStyleInfo(e,t,r),e.copyFromAttribute(t,`id`,r),e.copyFromAttribute(t,`comment`,r,`description`),e.copyFromAttribute(t,`connectionId`,r,`connectionId`,e.INT_COPY),e.copyFromAttribute(t,`tableType`,r),e.copyFromAttribute(t,`published`,r,`published`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`insertRow`,r,`insertRow`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`insertRowShift`,r,`insertRowShift`,e.BOOLEAN_COPY),r.totalsRowShown=t.getAttribute(`totalsRowShown`)!==`0`,r}afterVisit(e,t,n){let r=n.v;if(e.evaluate(`autoFilter`,t)){if(Array.isArray(r.hiddenButtons)){let e=r.hiddenButtons.length;e===0?r.hiddenButtons=!1:e===r.columns?.length&&(r.hiddenButtons=!0)}}else r.hiddenButtons=!0,r.showButtons=!1;return r}processTableStyleInfo(e,t,n){if(!t)return;let r=t.childNodes,i={},a=r.length;for(let t=0;t<a;t++){let n=r.item(t);n.nodeType===1&&n.localName===`tableStyleInfo`&&(e.copyFromAttribute(n,`name`,i),e.copyFromAttribute(n,`showColumnStripes`,i,`showColumnStripes`,e.BOOLEAN_COPY),e.copyFromAttribute(n,`showFirstColumn`,i,`showFirstColumn`,e.BOOLEAN_COPY),e.copyFromAttribute(n,`showLastColumn`,i,`showLastColumn`,e.BOOLEAN_COPY),e.copyFromAttribute(n,`showRowStripes`,i,`showRowStripes`,e.BOOLEAN_COPY))}Object.keys(i).length>0&&(n.style=i)}processTableColumn(e,t,n){if(!t)return null;let r=t.childNodes,i=r.length;for(let t=0;t<i;t++){let i=r.item(t);if(i.nodeType===1&&i.localName===`tableColumn`){let t={};e.copyFromAttribute(i,`name`,t),e.copyFromAttribute(i,`id`,t),e.copyFromAttribute(i,`uniqueName`,t),e.copyFromAttribute(i,`queryTableFieldId`,t),e.copyFromAttribute(i,`totalsRowLabel`,t);let r=i.getAttribute(`totalsRowFunction`);if(r!==null){if(r===`custom`){let n=e.evaluate(`totalsRowFormula`,i);n&&(t.totalsRowFormula=n.textContent)}else t.totalsRowFormula=r}e.copyFromAttribute(i,`totalsRowLabel`,t);let a=e.evaluate(`calculatedColumnFormula`,i);a?.textContent&&(t.calculatedColumnFormula=a.textContent),n.push(t)}}return n}processTableColumns(e,t,n){let r=t.childNodes,i=[],a=r.length;for(let t=0;t<a;t++){let n=r.item(t);n.nodeType===1&&n.localName===`tableColumns`&&this.processTableColumn(e,n,i)}i.length>0&&(n.columns=i)}},TableX14Visitor:class{visit(e,t,n){let r=e.getVisitorParamsState().get(`ref`);if(r){let n=e.getVisitorParamsState().get(`descriptions`);n&&(n.add(r,t.getAttribute(`altText`)),n.add(r,t.getAttribute(`altTextSummary`)))}return e.copyFromAttribute(t,`altText`,n),e.copyFromAttribute(t,`altTextSummary`,n),n}},ExternalLinkVisitor:class{visit(e,t,n){let r=t.childNodes,i=r.length,a=null;for(let e=0;e<i;e++){let t=r.item(e);if(t.nodeType===1){t.localName===`externalBook`&&(a=t);break}}if(!a)return n;t.getAttribute(`mc:Ignorable`)&&(n.mceIgnorable=!0);let o=a.getAttribute(`r:id`);o&&(n.__bookRelId=o);let s=this._findAbsoluteUrlRelId(a);return s&&(n.__absoluteUrlRelId=s),n.sheetNames=[],this.processSheetNames(e,a,n),this.processDefinedNames(e,a,n),this.processSheetDataSet(e,a,n),n}processSheetNames(e,t,n){let r=this._findChild(t,`sheetNames`);if(!r)return;let i=r.childNodes,a=i.length;for(let e=0;e<a;e++){let t=i.item(e);t.nodeType===1&&t.localName===`sheetName`&&n.sheetNames.push(t.getAttribute(`val`)??``)}}processDefinedNames(e,t,n){let r=this._findChild(t,`definedNames`);if(!r)return;let i=[],a=r.childNodes,o=a.length;for(let e=0;e<o;e++){let t=a.item(e);if(t.nodeType!==1||t.localName!==`definedName`)continue;let n=t.getAttribute(`name`);if(!n)continue;let r={name:n,refersTo:t.getAttribute(`refersTo`)??``},o=t.getAttribute(`sheetId`);o!==null&&(r.sheetIndex=parseInt(o,10)),i.push(r)}i.length>0&&(n.definedNames=i)}processSheetDataSet(e,t,n){let r=this._findChild(t,`sheetDataSet`);if(!r)return;let i=[],a=r.childNodes,o=a.length;for(let t=0;t<o;t++){let n=a.item(t);if(n.nodeType!==1||n.localName!==`sheetData`)continue;let r=n.getAttribute(`sheetId`);if(r===null)continue;let o=this.processSheetData(e,n);o.sheetIndex=parseInt(r,10),n.getAttribute(`refreshError`)===`1`&&(o.refreshError=!0),i.push(o)}i.length>0&&(n.sheetDataSet=i)}processSheetData(e,t){let n=new f.Builder,r=t.childNodes,i=r.length;for(let e=0;e<i;e++){let t=r.item(e);if(t.nodeType!==1||t.localName!==`row`)continue;let i=t.childNodes,a=i.length;for(let e=0;e<a;e++){let t=i.item(e);if(t.nodeType!==1||t.localName!==`cell`)continue;let r=t.getAttribute(`r`);if(!r)continue;let a=u.fastStringToCell(r);if(a?.rowIndex===void 0||a?.colIndex===void 0)continue;let o=this._readCellValue(t);o!==void 0&&n.pushAt(a.rowIndex,a.colIndex,o)}}return{sheetIndex:-1,data:n.build()?.tuples??[]}}_readCellValue(e){let t=this._findChild(e,`v`)?.textContent?.trim();if(t!==void 0&&t!==``)switch(e.getAttribute(`t`)){case null:case`n`:return parseFloat(t);case`b`:return t===`1`||t===`true`;case`str`:default:return t;case`e`:{let e=l.getBuiltInByLabel(t);return e?{t:`e`,v:e.getCode()}:t}}}_findChild(e,t){let n=e.childNodes,r=n.length;for(let e=0;e<r;e++){let r=n.item(e);if(r.nodeType===1&&r.localName===t)return r}return null}_findAbsoluteUrlRelId(e){let t=this._findChild(e,`alternateUrls`);return t?this._findChild(t,`absoluteUrl`)?.getAttribute(`r:id`)??null:null}},SlicerCacheDefinitionVisitor:class{visit(e,t,n){e.copyFromAttribute(t,`name`,n,`cacheName`),e.copyFromAttribute(t,`sourceName`,n);let r=e.evaluate(`*/tableSlicerCache`,t);return r?(e.copyFromAttribute(r,`tableId`,n),e.copyFromAttribute(r,`column`,n,`columnId`),e.copyFromAttribute(r,`sortOrder`,n),e.copyFromAttribute(r,`customListSort`,n,`customListSort`,e.BOOLEAN_COPY),e.copyFromAttribute(r,`crossFilter`,n),n):(this.processPivot(e,t,n),n)}processPivot(e,t,n){let r=[],i=``,a=t.childNodes;for(let t=0;t<a.length;t++){let o=a.item(t);if(o.nodeType!==1)continue;if(o.localName===`pivotTables`){let e=o.childNodes;for(let t=0;t<e.length;t++){let n=e.item(t);n.nodeType===1&&n.localName===`pivotTable`&&r.push({tabId:n.getAttribute(`tabId`)??``,name:n.getAttribute(`name`)??``})}continue}let s=o.getAttribute(`pivotCacheId`);if(s&&(n.pivotCacheId=s),o.localName===`state`||o.localName===`timelinePivotFilter`){n.tabular=!0,n.pivotData=(n.pivotData??``)+(e.serializeElement(o)??``);continue}if(o.localName===`data`){let t=null,r=o.childNodes;for(let e=0;e<r.length;e++){let i=r.item(e);if(i.nodeType!==1)continue;let a=i.getAttribute(`pivotCacheId`);a&&(n.pivotCacheId=a),i.localName===`tabular`&&(t=i)}if(t){n.tabular=!0,e.copyFromAttribute(t,`sortOrder`,n),e.copyFromAttribute(t,`customListSort`,n,`customListSort`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`crossFilter`,n),e.copyFromAttribute(t,`showMissing`,n,`showMissing`,e.BOOLEAN_COPY),n.pivotData=e.serializeElement(o)??void 0;continue}}let c=e.serializeElement(o);if(c===null)return;i+=c}n.pivotTables=r,n.pivotBody=i}},SlicersVisitor:class{visit(e,t,n){let r=n.slicers;r||(r={},n.slicers=r);let i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);n.nodeType===1&&n.localName===`slicer`&&this.processSlicer(e,n,r)}return r}processSlicer(e,t,n){if(!t)return;let r={};n[t.getAttribute(`name`)]=r,e.copyFromAttribute(t,`xr10:uid`,r,`uid`);let i=t.getAttribute(`cache`),a=e.getVisitorParamsState().get(`slicerCaches`),o=i?a?.get(i):void 0;if(o)for(let e=0;e<J.length;e++){let t=J[e];o[t]!==void 0&&(r[t]=o[t])}e.copyFromAttribute(t,`caption`,r),e.copyFromAttribute(t,`startItem`,r,`startItem`,e.INT_COPY),e.copyFromAttribute(t,`columnCount`,r,`columnCount`,e.INT_COPY),e.copyFromAttribute(t,`showCaption`,r,`showCaption`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`level`,r,`level`,e.INT_COPY),e.copyFromAttribute(t,`style`,r),e.copyFromAttribute(t,`lockedPosition`,r,`lockedPosition`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`rowHeight`,r,`rowHeight`,e.INT_COPY)}},TimelinesVisitor:class{visit(e,t,n){let r=n.slicers;r||(r={},n.slicers=r);let i=t.childNodes;for(let t=0;t<i.length;t++){let n=i.item(t);n.nodeType===1&&n.localName===`timeline`&&this.processTimeline(e,n,r)}return r}processTimeline(e,t,n){let r={};n[t.getAttribute(`name`)]=r,e.copyFromAttribute(t,`xr10:uid`,r,`uid`);let i=t.getAttribute(`cache`),a=e.getVisitorParamsState().get(`slicerCaches`),o=i?a?.get(i):void 0;if(o)for(let e=0;e<J.length;e++){let t=J[e];o[t]!==void 0&&(r[t]=o[t])}e.copyFromAttribute(t,`caption`,r);let s={};for(let e=0;e<t.attributes.length;e++){let n=t.attributes.item(e);je.has(n.name)||n.name.startsWith(`xmlns`)||(s[n.name]=n.value)}r.timelineAttributes=s;let c=``,l=t.childNodes;for(let t=0;t<l.length;t++){let n=l.item(t);n.nodeType===1&&(c+=e.serializeElement(n)??``)}r.timelineBody=c}},FormControlPrVisitor:class{visit(e,t,n){let r={},i=t.attributes;for(let e=0;e<i.length;e++){let t=i.item(e),n=t.name;n===`xmlns`||n.startsWith(`xmlns:`)||(r[n]=t.value)}let a=[],o,s=t.childNodes;for(let t=0;t<s.length;t++){let n=s.item(t);if(n.nodeType===1){if(n.localName===`itemLst`){let e=n.childNodes;for(let t=0;t<e.length;t++){let n=e.item(t);n.nodeType===1&&n.localName===`item`&&a.push(n.getAttribute(`val`)??``)}}else n.localName===`extLst`&&(o=e.serializeElement(n)??void 0)}}let c=he(r,a,o);return n.formControl=c,c}},DrawingVisitor:class{visit(e,t,n){return n}afterVisit(e,t,n){for(let e of n?.movables??[])Y(e,!1)}},DrawingAnchorVisitor:class{visit(e,t,n){if(!t)return;let r={};e.copyFromAttribute(t,`editAs`,r,`anchorType`),r.anchor={},t.localName===`absoluteAnchor`?(r.anchorType=`absolute`,this.processAbsoluteCoord(e,e.evaluate(`pos`,t),r.anchor,`from`,`x`,`y`),this.processAbsoluteCoord(e,e.evaluate(`ext`,t),r.anchor,`to`,`cx`,`cy`)):t.localName===`oneCellAnchor`?(this.processOffsetCoord(e,e.evaluate(`from`,t),r.anchor,`from`),this.processAbsoluteCoord(e,e.evaluate(`ext`,t),r.anchor,`to`,`cx`,`cy`)):(this.processOffsetCoord(e,e.evaluate(`from`,t),r.anchor,`from`),this.processOffsetCoord(e,e.evaluate(`to`,t),r.anchor,`to`));let i=e.evaluate(`clientData`,t),a=e=>{let t=i?.getAttribute(e);return t===`0`||t===`false`};return a(`fPrintsWithSheet`)&&(r.noPrint=!0),a(`fLocksWithSheet`)&&(r.unlocked=!0),n.movables||=[],n.movables.push(r),r}processAbsoluteCoord(e,t,n,r,i,a){if(!t)return;let o={x:0,y:0};return o.x=w(t.getAttribute(i)),o.y=w(t.getAttribute(a)),r===`from`?n.tl=o:n.br=o,n}processOffsetCoord(e,t,n,r){if(!t)return;let i={c:0,r:0,x:0,y:0};return e.evaluate(`col`,t)&&(i.c=parseInt(e.evaluate(`col`,t).textContent)),e.evaluate(`row`,t)&&(i.r=parseInt(e.evaluate(`row`,t).textContent)),e.evaluate(`colOff`,t)&&(i.x=w(e.evaluate(`colOff`,t).textContent)),e.evaluate(`rowOff`,t)&&(i.y=w(e.evaluate(`rowOff`,t).textContent)),r===`from`?n.tl=i:n.br=i,n}},DrawingGraphicFrameVisitor:class extends H{visit(e,t,n){if(!t)return;if(this.isGroupContent(n)){if(e.getPath().includes(`Fallback`))return{};let{movable:r}=this.readMemberHeader(e,t,`graphicFrame`),i=e.evaluate(`xfrm`,t);if(i){M(i,r);let t=e.evaluate(`off`,i),n=e.evaluate(`ext`,i);r.anchor={tl:{x:w(t?.getAttribute(`x`)??null)??0,y:w(t?.getAttribute(`y`)??null)??0},br:{x:w(n?.getAttribute(`cx`)??null)??0,y:w(n?.getAttribute(`cy`)??null)??0}}}let a=this.readGraphic(e,t),o=a.type===`chart`?{...r.content.json,...a.json}:a.json;return r.content={...r.content,type:a.type,json:o},n.members.push(r),a.json}n=super.visit(e,t,n);let r=e.evaluate(`nvGraphicFramePr/cNvGraphicFramePr`,t);if(r){let t=e.evaluate(`graphicFrameLocks`,r);t&&t.hasAttribute(`noChangeAspect`)&&(n.lockAspect=t.getAttribute(`noChangeAspect`)===`1`)}let i=this.readGraphic(e,t);return this.setContent(n,i),i}readGraphic(e,t){let n=e.evaluate(`graphic/graphicData`,t),r={type:`graphicFrame`,json:{}};if(!n)return r;let i=n.childNodes,a=i.length;for(let n=0;n<a;n++){let a=i.item(n);if(a.nodeType===1)try{let n=a.localName;n===`chart`?n=`chart`:n!==`slicer`&&n!==`timeslicer`||(n=`slicer`),r.type=n;let i=a.getAttribute(`r:id`);if(n===`chart`&&i){let n=this.readSourceId(e,t),a=e.readEmbeddedPart(i)??void 0,o;try{let t=a?.xml?xe(a.xml):null;o=t?.model,t?.lossy&&e.warn(`A chart states something its model does not; it is saved as it was until it is changed.`,{onceKey:`xlsx.chart.lossy`})}catch(t){e.warn(`A chart could not be read into the chart model; it is kept as its markup: ${t?.message??t}`,{onceKey:`xlsx.chart.model`})}r.json={sourceId:n,part:a,model:o}}else if(n===`slicer`){let n=this.readSourceId(e,t);n!==void 0&&(r.json={sourceId:n})}else i&&(r.json=e.getRef(i))}catch(t){e.warn(`Unable to read a graphic frame: ${t?.message??t}`,{onceKey:`xlsx.drawing.graphicFrame`})}}return r}},DrawingSpVisitor:X,DrawingPicVisitor:class extends H{visit(e,t,n){if(!t)return;if(this.isGroupContent(n)){if(e.getPath().includes(`Fallback`))return{};let{movable:r,content:i}=this.readMemberHeader(e,t,`picture`),a=this.readImage(e,t);return a?(this.readPictureDetails(e,t,a,r,i),n.members.push(r),i):{}}let r=super.visit(e,t,n),i=this.readImage(e,t);if(i===null)return;let a={},o=this.readSourceId(e,t);return o!==void 0&&(a.sourceId=o),this.readPictureDetails(e,t,i,r,a),this.setContent(r,{type:`picture`,json:a}),a}readPictureDetails(e,t,n,r,i){n?.resId!==void 0&&(i.resId=n.resId),n?.image&&(i.image=n.image);let a=t.getAttribute(`macro`);a&&(i.macro=a),t.hasAttribute(`fPublished`)&&(i.published=A(t.getAttribute(`fPublished`)));let o=e.evaluate(`nvPicPr/cNvPicPr`,t);if(o?.getAttribute){o.getAttribute(`preferRelativeResize`)===`0`&&(i.noRelativeResize=!0);let t=this.readLocks(e.evaluate(`picLocks`,o));t&&(i.locks=t),r.lockAspect=t?.noChangeAspect??!1}}readImage(e,t){let n=e.evaluate(`blipFill`,t),r=n?e.evaluate(`blip`,n):null;if(!r)return;if(!(r.getAttribute(`r:embed`)??r.getAttribute(`embed`)??r.getAttribute(`r:link`)??r.getAttribute(`link`)))return e.warn(`A picture names no image; it was not imported.`,{onceKey:`xlsx.drawing.picture.noRel`}),null;let{type:i,resId:a,...o}=new O().processImageFill(e,n);return!o.tile&&o.stretch&&Object.keys(o.stretch).length===0&&delete o.stretch,o.extLst&&Me.test(o.extLst)&&delete o.extLst,{resId:a,image:Object.keys(o).length>0?o:void 0}}},DrawingGrpSpVisitor:class extends H{constructor(...e){super(...e),this._fills=new O}visit(e,t,n){if(!t)return;let r=this.isGroupContent(n),i,a;if(r){if(e.getPath().includes(`Fallback`))return{};let r=this.readMemberHeader(e,t,`group`);i=r.movable,a=r.content,n.members.push(i)}else{if(e.getPath().includes(`Fallback`)&&n.content)return{};i=super.visit(e,t,n),a={};let r=this.readSourceId(e,t);r!==void 0&&(a.sourceId=r),this.setContent(i,{type:`group`,json:a})}a.members=[];let o=e.evaluate(`nvGrpSpPr/cNvGrpSpPr/grpSpLocks`,t);o?.hasAttribute?.(`noChangeAspect`)&&(i.lockAspect=o.getAttribute(`noChangeAspect`)===`1`);let s=this.readLocks(o);s&&(a.locks=s);let c=e.evaluate(`grpSpPr`,t);if(c){let t=e.evaluate(`xfrm`,c);if(t){M(t,i),t.getAttribute(`flipH`)===`1`&&(i.flipH=!0),t.getAttribute(`flipV`)===`1`&&(i.flipV=!0);let n=Z(e,t,`off`,`ext`),o=Z(e,t,`chOff`,`chExt`)??n;o&&(a.childBounds=o),r&&n&&(i.anchor={tl:{x:n.x,y:n.y},br:{x:n.width,y:n.height}})}let n=this._fills.getFill(e,c);n&&Object.keys(n).length>0&&(a.fill=n);let o=this._fills.getEffects(e,c);o&&(a.effects=o);let s=e.evaluate(`scene3d`,c),l=s?e.serializeElement(s):null;l&&(a.scene3d=l);let u=e.evaluate(`extLst`,c),d=u?e.serializeElement(u):null;d&&(a.extLst={...a.extLst,properties:d})}return a}},DrawingCxnSpVisitor:class extends X{visit(e,t,n){if(t)return this.visitShape(e,t,n,`cxnSp`,`nvCxnSpPr/cNvCxnSpPr/cxnSpLocks`)}},MetadataVisitor:class{visit(e,t,n){let r=[],i=new Map,a={cells:[],values:[]},o=t.childNodes;for(let e=0;e<o.length;e++){let t=o.item(e);if(t.nodeType===1)switch(t.localName){case`metadataTypes`:this._parseMetadataTypes(t,r,i);break;case`futureMetadata`:this._attachFutureMetadata(t,i);break;case`cellMetadata`:this._resolveBlocks(t,r,a.cells);break;case`valueMetadata`:this._resolveBlocks(t,r,a.values)}}return n.metadata=a,a}_parseMetadataTypes(e,t,n){let r=e.childNodes;for(let e=0;e<r.length;e++){let i=r.item(e);if(i.nodeType===1&&i.localName===`metadataType`){let e=this._parseMetadataType(i);t.push(e),n.set(e.name,e)}}}_parseMetadataType(e){let t={name:e.getAttribute(`name`)??``,_blocks:[]},n=e.getAttribute(`minSupportedVersion`);n!=null&&(t.minSupportedVersion=Number(n));for(let n of[`copy`,`pasteAll`,`pasteValues`,`merge`,`splitFirst`,`splitAll`,`rowColShift`,`clearFormats`,`clearComments`,`assign`,`coerce`,`cellMeta`,`adjust`,`trans`,`delete`,`edit`])e.getAttribute(n)===`1`&&(t[n]=!0);return t}_attachFutureMetadata(e,t){let n=e.getAttribute(`name`)??``,r=t.get(n);if(!r)return;let i=e.childNodes;for(let e=0;e<i.length;e++){let t=i.item(e);t.nodeType===1&&t.localName===`bk`&&r._blocks.push(this._parseFutureBlock(t))}}_parseFutureBlock(e){let t={},n=e.childNodes;for(let e=0;e<n.length;e++){let r=n.item(e);if(r.nodeType!==1||r.localName!==`extLst`)continue;let i=r.childNodes;for(let e=0;e<i.length;e++){let n=i.item(e);if(n.nodeType!==1||n.localName!==`ext`)continue;let r=n.childNodes;for(let e=0;e<r.length;e++){let n=r.item(e);n.nodeType===1&&(n.localName===`dynamicArrayProperties`?(t.fDynamic=n.getAttribute(`fDynamic`)===`1`,t.fCollapsed=n.getAttribute(`fCollapsed`)===`1`):n.localName===`rvb`&&(t.richValueIndex=Number(n.getAttribute(`i`)??`0`)))}}}return t}_resolveBlocks(e,t,n){let r=e.childNodes;for(let e=0;e<r.length;e++){let i=r.item(e);i.nodeType===1&&i.localName===`bk`&&n.push(this._resolveBlock(i,t))}}_resolveBlock(e,t){let n=new Map,r=e.childNodes;for(let e=0;e<r.length;e++){let i=r.item(e);if(i.nodeType!==1||i.localName!==`rc`)continue;let a=Number(i.getAttribute(`t`)),o=Number(i.getAttribute(`v`)),s=t[a-1];if(!s)continue;let{_blocks:c,...l}=s,u={...l};for(let e of Object.keys(u))u[e]===void 0&&delete u[e];let d=c[o];d&&(d.fDynamic!==void 0&&(u.fDynamic=d.fDynamic,u.fCollapsed=d.fCollapsed??!1),d.richValueIndex!==void 0&&(u.richValueIndex=d.richValueIndex)),n.set(s.name,u)}return n}},FeaturePropertyBagVisitor:class{visit(e,t,n){let r=[],i=t.childNodes;for(let e=0;e<i.length;e++){let t=i.item(e);t.nodeType===1&&t.localName===`bag`&&r.push(this._readBag(t))}let a=[],o=r.find(e=>e.type===`XFComplements`)?.arrays.get(`MappedFeaturePropertyBags`)??[];for(let t=0;t<o.length;t++){let n=r[o[t]]?.ids.get(`XFControls`),i=n===void 0?void 0:r[n]?.ids.get(`CellControl`),s=i===void 0?void 0:r[i]?.type,c=s?Ne[s]:void 0;c||e.warn(`A cell format's feature '${s??`unknown`}' is not read; its cells keep their values.`),a.push(c?{type:c}:null)}let s={controls:a};return n.featurePropertyBag=s,s}_readBag(e){let t={type:e.getAttribute(`type`)??``,ids:new Map,arrays:new Map},n=e.childNodes;for(let e=0;e<n.length;e++){let r=n.item(e);if(r.nodeType!==1)continue;let i=r.getAttribute(`k`)??``;if(r.localName===`bagId`){let e=parseInt(r.textContent??``,10);isNaN(e)||t.ids.set(i,e)}else if(r.localName===`a`){let e=[],n=r.childNodes;for(let t=0;t<n.length;t++){let r=n.item(t);if(r.nodeType!==1||r.localName!==`bagId`)continue;let i=parseInt(r.textContent??``,10);isNaN(i)||e.push(i)}t.arrays.set(i,e)}}return t}},CommentsVisitor:class{visit(e,t,n){if(!t)return;let r=[];this.processAuthors(e,e.evaluate(`authors`,t),r),r.length>0&&(n.authors=r);let i=[];return n.comments=i,i}processAuthors(e,t,n){if(!t)return;let r=t.childNodes,i=r.length;for(let e=0;e<i;e++){let t=r.item(e);if(t.nodeType===1&&t.localName===`author`){let e=t.firstChild;e&&e.nodeType===3&&n.push(e.textContent)}}}},CommentVisitor:class{visit(e,t,n){if(!t)return;let r=t.getAttribute(`ref`);if(!r)return;let i={content:``};if(t.hasAttribute(`authorId`)){let e=parseInt(t.getAttribute(`authorId`),10);isNaN(e)||(i.authorId=e)}return i.content=function(e){if(!e)return``;let t=[],n=!0,r=e.childNodes;for(let e=0;e<r.length;e++){let i=r.item(e);if(i.nodeType===1){if(i.localName===`t`)t.push({text:i.textContent??``});else if(i.localName===`r`){let e={text:``},r=i.childNodes;for(let t=0;t<r.length;t++){let n=r.item(t);if(n.nodeType===1){if(n.localName===`t`)e.text+=n.textContent??``;else if(n.localName===`rPr`){let t=Fe(n);t&&(e.font=t)}}}e.font&&(n=!1),t.push(e)}}}return t.length===0?e.textContent??``:n?t.map(e=>e.text).join(``):{runs:t}}(e.evaluate(`text`,t)),n.push({r,v:i}),i}},ThreadedCommentsVisitor:class{visit(e,t,n){if(!t)return;let r=[];return n.comments=r,r}},ThreadedCommentVisitor:class{visit(e,t,n){if(!t)return;let r={};e.copyFromAttribute(t,`id`,r,`id`,D);let i=t.getAttribute(`ref`);e.copyFromAttribute(t,`personId`,r,`personId`,D),e.copyFromAttribute(t,`parentId`,r,`parentId`,D);let a=t.getAttribute(`dT`);a&&(r.dt=function(e){let t=/^(.*T\d{2}:\d{2}:\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:?\d{2})?$/i.exec(e.trim());if(!t)return e;let[,n,r,i]=t;return`${n}${r?`.${(r+`00`).substring(0,3)}`:``}${i??`Z`}`}(a)),t.hasAttribute(`done`)&&(r.done=A(t.getAttribute(`done`)));let o=function(e){let t,n=e.childNodes;for(let e=0;e<n.length;e++){let r=n.item(e);if(r.nodeType!==1||r.localName!==`mentions`)continue;let i=r.childNodes;for(let e=0;e<i.length;e++){let n=i.item(e);if(n.nodeType!==1||n.localName!==`mention`)continue;let r=n.getAttribute(`mentionId`),a=n.getAttribute(`mentionpersonId`);if(!r||!a)continue;let o={id:D(r),personId:D(a)},s=parseInt(n.getAttribute(`startIndex`)??``,10);isNaN(s)||(o.startIndex=s);let c=parseInt(n.getAttribute(`length`)??``,10);isNaN(c)||(o.length=c),(t??=[]).push(o)}}return t}(t);return o&&(r.mentions=o),n.push({r:i,v:r}),r}},PersonListVisitor:class{visit(e,t,n){let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);if(n.nodeType===1&&n.localName===`person`){let t={};e.copyFromAttribute(n,`id`,t,`id`,D),e.copyFromAttribute(n,`displayName`,t),e.copyFromAttribute(n,`userId`,t,`userId`,D),e.copyFromAttribute(n,`providerId`,t),r.push(t)}}return r.length>0&&(n.persons=r),r}}},Ie=class{constructor(e,t){this.path=e,this.visitor=t}},Le=class{constructor(){this.visitorsByXmlTagName=new Map,this.scopedVisitorsByXmlTagName=new Map,this.visitorParamsState=null,this.registerVisitor(`Relationships`,new $.RelsVisitor),this.registerVisitor(`cp:coreProperties`,new $.CorePropertiesVisitor),this.registerVisitor(`Properties`,new $.AppPropertiesVisitor),this.registerVisitor(`spPr`,new $.ShapePropertiesVisitor),this.registerVisitor(`txBody`,new $.ShapeTextVisitor),this.registerVisitor(`txPr`,new $.TextPropertiesVisitor),this.registerVisitor(`a:theme`,new $.ThemeVisitor),this.registerVisitor(`a:theme`,new $.ClrSchemeVisitor,`themeElements/clrScheme`),this.registerVisitor(`a:theme`,new $.FontSchemeVisitor,`themeElements/fontScheme`),this.registerVisitor(`a:theme`,new $.FmtSchemeVisitor,`themeElements/fmtScheme`),this.registerVisitor(`a:theme`,new $.ObjectDefaultsVisitor,`objectDefaults`),this.registerVisitor(`autoFilter`,new $.AutoFilterVisitor),this.registerVisitor(`sortState`,new $.SortStateVisitor),this.registerVisitor(`s:workbook`,new $.WorkbookVisitor),this.registerVisitor(`styleSheet`,new $.SheetStyleVisitor),this.registerVisitor(`x14:table`,new $.TableX14Visitor),this.registerVisitor(`table`,new $.TableVisitor),this.registerVisitor(`externalLink`,new $.ExternalLinkVisitor),this.registerVisitor(`wsDr`,new $.DrawingVisitor),this.registerVisitor(`twoCellAnchor`,new $.DrawingAnchorVisitor),this.registerVisitor(`oneCellAnchor`,new $.DrawingAnchorVisitor),this.registerVisitor(`absoluteAnchor`,new $.DrawingAnchorVisitor),this.registerVisitor(`graphicFrame`,new $.DrawingGraphicFrameVisitor),this.registerVisitor(`sp`,new $.DrawingSpVisitor),this.registerVisitor(`grpSp`,new $.DrawingGrpSpVisitor),this.registerVisitor(`cxnSp`,new $.DrawingCxnSpVisitor),this.registerVisitor(`pic`,new $.DrawingPicVisitor),this.registerVisitor(`metadata`,new $.MetadataVisitor),this.registerVisitor(`FeaturePropertyBags`,new $.FeaturePropertyBagVisitor),this.registerVisitor(`comments`,new $.CommentsVisitor),this.registerVisitor(`comment`,new $.CommentVisitor),this.registerVisitor(`ThreadedComments`,new $.ThreadedCommentsVisitor),this.registerVisitor(`threadedComment`,new $.ThreadedCommentVisitor),this.registerVisitor(`threadedComment`,new $.TextPropertiesVisitor(`content`),`text`),this.registerVisitor(`personList`,new $.PersonListVisitor),this.registerVisitor(`slicerCacheDefinition`,new $.SlicerCacheDefinitionVisitor),this.registerVisitor(`slicers`,new $.SlicersVisitor),this.registerVisitor(`timelineCacheDefinition`,new $.SlicerCacheDefinitionVisitor),this.registerVisitor(`timelines`,new $.TimelinesVisitor),this.registerVisitor(`formControlPr`,new $.FormControlPrVisitor)}registerVisitor(e,t,n=null){e.indexOf(`:`)===-1&&(e=`*:`+e);let r=e.split(`:`),i=r.length>1?r[1]:r[0];if(!n)return this.visitorsByXmlTagName.set(i,t),void this.visitorsByXmlTagName.set(e,t);let a=this.scopedVisitorsByXmlTagName.get(i);a||(a=[],this.scopedVisitorsByXmlTagName.set(i,a),this.scopedVisitorsByXmlTagName.set(e,a)),a.push(new Ie(n,t))}parseDxf(t,n=``,r=e.EmptyObject){this.visitorParamsState||=new Map;let i=this.visitorParamsState,a=i.get(`processingDXFs`);i.set(`processingDXFs`,!0);try{let e=new z(null,this,`/dxf`,t,{},n,r),i={};return new $.SheetStyleVisitor().processDXF(e,t,i),i}finally{a===void 0?i.delete(`processingDXFs`):i.set(`processingDXFs`,a)}}getVisitorParamsState(){return this.visitorParamsState}transform(t,n,r=e.EmptyObject){let i=t.documentElement;this.visitorParamsState&&!r?.paramMap||(this.visitorParamsState=r?.paramMap??new Map);let a={},o=this.visitorsByXmlTagName.get(i.nodeName);if(o||=this.visitorsByXmlTagName.get(i.localName),!o)throw Error(`A visitor for the root element: '${i.nodeName}' or '${i.localName}' must be registered.`);let s=`/`+i.localName,c=new z(null,this,s,i,a,n,r),l=[];this._doWalk(o,c,l,i,a,n,r);let u=l.length;for(let e=0;e<u;e++){let t=l[e];try{t.visitor?.afterVisit?.(t.context,t.elemParent,t.jsonParent)}catch(e){t.context.warn(`Unable to finish reading '${t.context.getPath()}': ${e?.message??e}`,{onceKey:`xlsx.transform.afterVisit`})}}return a}_walkScoped(e,t,n,r,i,a,o){let s=this.scopedVisitorsByXmlTagName.get(e),c=s?s.length:0;for(let l=0;l<c;l++){let c=s[l],u=null;try{u=t.evaluate(c.path,r)}catch{t.warn(`Invalid path '${c.path}' for '${e}'.`,{onceKey:`xlsx.transform.invalidPath`})}if(!u)continue;let d=e=>{let s=e.localName,l=e.parentNode;for(;l&&l!==r;)s=l.localName+`/`+s,l=l.parentNode;let u=t.getPath()+`/`+s;if(c.visitor){let r=new z(t,this,u,t.getElemRoot(),t.getJsonRoot(),a,o);this._doWalk(c.visitor,r,n,e,i,a,o)}};if(u.length>0){let e=u,t=e.length;for(let n=0;n<t;n++)d(e.item(n))}else d(u)}}_doWalk(e,t,n,r,i,a,o){let s=null;e&&(n.push({visitor:e,context:t,elemParent:r,jsonParent:i}),s=e.visit(t,r,i)),s||=i;let c=r.localName;this._walkScoped(c,t,n,r,s,a,o);let l=this.visitorsByXmlTagName,u=t.getElemRoot(),d=t.getJsonRoot(),f=r.childNodes,p=f.length;for(let e=0;e<p;e++){let r=f.item(e);if(r.nodeType!==1)continue;let c=r,p=c.nodeName,m=l.get(p);m||=(p=c.localName,l.get(p));let h=t.getPath()+`/`+p,g=new z(t,this,h,u,d,a,o);this._doWalk(m,g,n,c,s??i,a,o)}return s}};export{Le as DOMTransformer,z as ExecutionContext,de as NumberUtils,F as VisitorUtils};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./qFyplGXRu7IepHio.js","./CnXLpFE_vFrJ5Jbf.js","./Cx1kZ2u_8JFV2Q8D.js","./ChSvXfVMLxZsP9zG.js","./HclGiUj8dZXDFmoM.js","./CQukCzhuewMuFOlO.js","./zvxBjll3jnL0-vNn.js","./CnPgk3HcIziOcskY.js","./3Ls_kOvlQseMV8Q0.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./HclGiUj8dZXDFmoM.js";import{C as t,F as n,I as r,O as i,Z as a,_ as o,d as s,f as c,g as l,k as u,m as d,o as f,r as p,t as m,u as h,w as g,y as _}from"./ChSvXfVMLxZsP9zG.js";import{t as v}from"./3Ls_kOvlQseMV8Q0.js";import{c as y,i as b,s as x}from"./DcrVJCyDwGKeil2U.js";import{A as S,G as C,K as w,Kt as T,M as ee,Ot as te,St as ne,Ut as re,Xt as E,et as ie,f as ae,ht as D,m as oe,q as se,rn as ce,rt as le,t as ue,xt as O,y as de}from"./BDRMUi2BsnBqytIq.js";import{i as k,t as A}from"./CQukCzhuewMuFOlO.js";import{Ai as fe,Ar as j,Br as pe,Bt as me,Cr as he,Et as M,Fa as ge,Gn as _e,Hi as ve,Hn as ye,I as be,Ii as N,J as xe,Jr as Se,Lr as Ce,M as we,Ma as Te,N as Ee,Nn as P,Nr as De,Or as Oe,Ot as ke,Pi as Ae,R as je,Ri as Me,Rn as Ne,Rt as Pe,Sn as Fe,Tn as Ie,Tr as Le,U as Re,Ui as ze,Vi as Be,Vn as Ve,W as He,Wt as Ue,Xn as We,Xt as F,Yi as Ge,Zi as Ke,_ as qe,a as Je,aa as Ye,d as Xe,fa as Ze,g as Qe,gi as $e,hn as et,ia as tt,ii as nt,ir as rt,jr as I,k as L,l as R,lt as it,ma as at,mi as ot,mn as st,nn as ct,o as lt,ot as z,pa as ut,pi as B,qt as dt,st as V,ui as ft,va as pt,wn as mt}from"./DBxAatsD6aWk7Zb6.js";var ht,gt=class extends u{constructor(e,t=50){super(t),this._transactions=e,this._floorId=e?e.getCurrentCommit(!1).getId():null,this._removeListener=e?.addListener({onCommitChange:()=>this._notifyOnStackChange()})}_undoCommits(e=this.maxStack){let t=this._transactions;if(!t)return[];let n=t.getLog(t.getCurrentCommit(!1).getId(),2**53-1),r=[];for(let t=0;t<n.length&&r.length<e;t++){let e=n[t];if(e.getId()===this._floorId||t===n.length-1)break;e.getDescription()&&r.push(e)}return r}_redoCommits(e=this.maxStack){let t=this._transactions;if(!t)return[];let n=t.getCurrentCommit(!1).getId(),r=t.getTipCommit().getId();if(r===n)return[];let i=t.getLog(r,2**53-1),a=[],o=!1;for(let e of i){if(e.getId()===n){o=!0;break}a.push(e)}if(!o)return[];a.reverse();let s=[];for(let t of a)if(t.getDescription()&&s.push(t),s.length>=e)break;return s}undo(e=1){let t=this._transactions;if(!t)return;let n=!1;try{for(let r=0;r<e;r++){let[e]=this._undoCommits(1);if(!e)break;t.revert(e.getId()),n=!0}}finally{n&&this._notifyOnStackChange()}}redo(e=1){let t=this._transactions;if(!t)return;let n=!1;try{for(let r=0;r<e;r++){let[e]=this._redoCommits(1);if(!e){r===0&&this._repeatOperation?.repeat();break}t.restore(e.getId()),n=!0}}finally{n&&this._notifyOnStackChange()}}hasUndo(){return this._undoCommits(1).length>0}hasRedo(){return this._redoCommits(1).length>0||this._repeatOperation!==null}getTopUndoDescription(){return this._undoCommits(1)[0]?.getDescription()??null}getTopRedoDescription(){return this._repeatOperation===null?this._redoCommits(1)[0]?.getDescription()??null:this._repeatOperation.description}getUndoDescriptions(){return this._undoCommits().map(e=>e.getDescription())}getRedoDescriptions(){let e=this._redoCommits().map(e=>e.getDescription());return e.length===0&&this._repeatOperation!==null&&e.push(this._repeatOperation.description),Object.freeze(e)}getUndoEntries(){return this._undoCommits().map(vt)}getRedoEntries(){let e=this._redoCommits().map(vt);return e.length===0&&this._repeatOperation!==null&&e.push({description:this._repeatOperation.description,author:null,meta:_t}),Object.freeze(e)}addUndoOperation(){throw Error(`TransactionUndoManager derives its stack from the commit log; commit a described transaction instead.`)}clear(e=!0){this._transactions&&(this._floorId=this._transactions.getCurrentCommit(!1).getId()),super.clear(e)}close(){this._removeListener?.()}},_t=Object.freeze({}),vt=e=>({description:e.getDescription(),author:e.getAuthor(),meta:e.getMeta()??_t});ht||={};var yt,H=class e{constructor(t,n={}){this._password=null,this._emitter=new b(this),this._path=t??null,this._name=n.name??null,this._format=n.format??null,this._size=n.size??null,this._lastModified=n.lastModified??null,this._canWrite=n.canWrite??e._defaultCanWrite(this._path),this._encryption=n.encryption??null}static _defaultCanWrite(e){return!!e&&!/^(https?:|data:|blob:)/i.test(e)}_cleanPath(){return this._path?this._path.split(/[?#]/)[0]:null}getName(){if(this._name!==null&&this._name!==void 0)return this._name;let e=this._cleanPath();return e&&N(e)||null}getPath(){return this._path}getFormat(){return this._format?this._format:this.getExtension()}getExtension(){let e=this._cleanPath();if(!e)return null;let t=B(e);return t?t.toLowerCase():null}getEncryption(){return this._encryption}isEncrypted(){return this._encryption!==null||this._password!==null}setPassword(e){this._password!==(e??null)&&(this._password=e??null,this._password===null&&(this._encryption=null),this._emitter.notify(`onChange`))}getPassword(){return this._password}getSize(){return this._size}getLastModified(){return this._lastModified}canWrite(){return this._canWrite}setName(e){this.update({name:e})}update(e){let t=!1;return e.lastModified!==void 0&&e.lastModified!==this._lastModified&&(this._lastModified=e.lastModified,t=!0),e.name!==void 0&&e.name!==this._name&&(this._name=e.name,t=!0),e.format!==void 0&&e.format!==this._format&&(this._format=e.format,t=!0),e.size!==void 0&&e.size!==this._size&&(this._size=e.size,t=!0),e.canWrite!==void 0&&e.canWrite!==this._canWrite&&(this._canWrite=e.canWrite,t=!0),e.encryption!==void 0&&e.encryption!==this._encryption&&(this._encryption=e.encryption,t=!0),t&&this._emitter.notify(`onChange`),this}addListeners(e,t){return this._emitter.addListeners(e,t)}get[Symbol.toStringTag](){return`[Origin]`}toString(){let e=this._cleanPath(),t=e?e.split(/[/\\]/).pop()||e:this._name??`(unbound)`,n=this._size;if(n==null)return t;if(n<1024)return`${t} ${n}B`;let r=Math.floor(Math.log(n)/Math.log(1024)),i=[`B`,`KB`,`MB`,`GB`,`TB`];return`${t} ${(n/1024**r).toFixed(2)}${i[Math.min(r,i.length-1)]}`}},U=new WeakMap,W=new Set,bt=e=>U.get(e)??null,xt=()=>Array.from(W,e=>e.getOrigin()),St=class e{constructor(t){this._released=!1,e._assertFree(t),this._emitter=new b(this),this._origin=t,U.set(t,this),W.add(this)}getOrigin(){return this._origin}setOrigin(t){t!==this._origin&&(e._assertFree(t),this._released||(U.delete(this._origin),U.set(t,this)),this._origin=t,this._emitter.notify(`onOriginChange`))}release(){this._released||(this._released=!0,U.get(this._origin)===this&&U.delete(this._origin),W.delete(this))}addListeners(e,t){return this._emitter.addListeners(e,t)}static _assertFree(e){if(U.has(e))throw Error(`This origin already backs an open workbook; an origin backs one workbook at a time.`)}},Ct=class{constructor(){this._defaultStringSourceType=`filepath`}async read(e){let t=e.options??{},r=e.source;if(typeof r==`function`&&(r=r()),r&&typeof r==`object`&&typeof r.then==`function`&&(r=await Promise.resolve(r)),r==null&&(r=await this.resolveSource(e),r==null))return null;let i=r,a=await this.fileFromHandle(r);a&&(r=a);let o=t.format,s=this._detectSourceType(r);if(!s)throw Error(`Unable to detect source type from provided input.`);let c,l,u=!1;if(s===`filepath`){let e=typeof r==`string`&&r.startsWith(`file://`)?r.slice(7):r;r=await this.filePathToFile(e),s=`file`,u=!0}switch(s){case`file`:{let e=r,n=e?.name,i=n?`${N(n)}`:``;c=await e.arrayBuffer(),l={format:o,ext:B(n),name:i,absolutePath:n,size:e.size,lastModified:e.lastModified,canWrite:!t.asCopy&&(!!a||u&&this._canWriteLocalPath())};break}case`blob`:{let e=r;c=await e.arrayBuffer(),l={format:o,size:e.size};break}case`base64`:{let e;if(r&&typeof r==`object`&&`base64`in r)e=r.base64;else if(typeof r==`string`&&r.startsWith(`data:`)){let[,t]=r.split(`,`);e=t}else e=r;c=n.base64ToArrayBuffer(e),l={format:o,size:e.length};break}case`fetch`:{let e,t,n;if(typeof r==`string`)e=r;else{if(!r||typeof r!=`object`||!(`input`in r))throw Error(`Invalid fetch source provided.`);{let i=r;e=i.input,t=i.init,n=i.timeout}}let i=n||3e4,a=new AbortController,s=setTimeout(()=>a.abort(),i),u=typeof e==`string`?e:e.toString(),d=B(u);try{let n=await fetch(e,{...t,signal:a.signal});if(clearTimeout(s),!n.ok)throw Error(`Failed to fetch: ${n.status} ${n.statusText}`);let r=await n.arrayBuffer();if(!r)throw Error(`Unable to fetched content: ${u}`);c=r,l={format:o,ext:d,name:N(u,!0),absolutePath:u}}catch(e){throw clearTimeout(s),e.name===`AbortError`?Error(`Fetch timeout after ${i}ms: ${u}`):e}break}case`buffer`:c=r,l={format:o};break;case`stream`:{let e=r.getReader(),t=[],n=0;try{for(;;){let{done:r,value:i}=await e.read();if(r)break;t.push(i),n+=i.length}}finally{e.releaseLock()}let i=new ArrayBuffer(n),a=new Uint8Array(i),s=0;for(let e of t)a.set(e,s),s+=e.length;c=i,l={format:o};break}default:throw Error(`Unsupported source type: ${s}`)}l.canWrite&&await this.findOpenOrigin(i,l)&&(l.canWrite=!1);let d=await e.decode(c,{sourceType:s,...l});return d?(await this.onWorkbookRead(d,i),d):null}async findOpenOrigin(e,t){return t.absolutePath?this.findOpenPath(t.absolutePath):null}findOpenPath(e,t){return xt().find(n=>{if(n===t||!n.canWrite())return!1;let r=n.getPath();return!!r&&this.isSamePath(r,e)})??null}isSamePath(e,t){return e===t}async fileFromHandle(e){return null}async resolveSource(e){return null}async onWorkbookRead(e,t){}_canWriteLocalPath(){return!1}_detectSourceType(e){if(e&&typeof e==`object`&&`base64`in e)return`base64`;if(e&&typeof e==`object`&&`input`in e)return`fetch`;if(typeof e==`string`){if(e.startsWith(`data:`))return`base64`;if(e.startsWith(`http://`)||e.startsWith(`https://`))return`fetch`;if(e.startsWith(`file://`))return`filepath`;let t=this._defaultStringSourceType;return e.startsWith(`./`)||e.startsWith(`../`)||e.startsWith(`/`)||/^[a-zA-Z]:[/\\]/.test(e),t}if(typeof File<`u`&&e instanceof File)return`file`;if(typeof Blob<`u`&&e instanceof Blob)return`blob`;let t=e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`,r=ArrayBuffer.isView(e),i=n.isNodeBuffer(e);return t||r||i?`buffer`:typeof ReadableStream<`u`&&e instanceof ReadableStream||Object.prototype.toString.call(e)===`[object ReadableStream]`||e&&typeof e.getReader==`function`&&e.locked!==void 0?`stream`:null}},wt=class extends Ct{constructor(e,t){super(),this._getWriteFormats=e,this._getReadFormats=t,this._defaultStringSourceType=`fetch`,this._handleCache=new WeakMap}async fileFromHandle(e){return G(e)?e.getFile():null}async resolveSource(){let e=await this._getReadFormats?.()??[];if(typeof globalThis.showOpenFilePicker==`function`)try{let t=function(e){let t=Tt(e);if(t.length<=1)return t;let n=new Set,r={};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));return[{description:`All Supported`,accept:r},...t]}(e),[n]=await globalThis.showOpenFilePicker(t.length?{types:t}:void 0);return n}catch(e){if(e?.name===`AbortError`)return null;throw e}let n=e.flatMap(e=>e.exts.map(e=>`.`+e)).join(`, `);return t.openFileDialog(n)}async findOpenOrigin(e){return G(e)?this._findOpenHandle(e):null}async _findOpenHandle(e,t){for(let n of xt()){if(n===t||!n.canWrite())continue;let r=this._handleCache.get(n);if(r&&typeof r.isSameEntry==`function`&&await r.isSameEntry(e))return n}return null}async onWorkbookRead(e,t){if(!G(t))return;let n=e.getOrigin?.();n?.canWrite()&&this._handleCache.set(n,t)}async filePathToFile(e){throw Error(`Cannot read local file path '${e}' in browser environment. Use a file input element or fetch for remote URLs.`)}async write(e){let{origin:t,suggestedName:n,format:r,encode:i,prompt:a,formatNamed:o}=e,s=[r,...(o?[]:await this._getWriteFormats()).filter(e=>e.key!==r.key)],c=typeof globalThis.showSaveFilePicker==`function`,l=!a&&t.canWrite()?this._handleCache.get(t):void 0;if(c)try{if(l){let e=await async function(e){try{if(typeof e.queryPermission!=`function`)return`granted`;let t={mode:`readwrite`};return await e.queryPermission(t)===`granted`||await e.requestPermission(t)===`granted`?`granted`:`denied`}catch{return`unavailable`}}(l);if(e===`denied`)return null;e!==`granted`&&(l=void 0)}let a=!!l;if(!a){l=await globalThis.showSaveFilePicker({suggestedName:n,types:Tt(s)});let t=await this._findOpenHandle(l,e.workbook?.getOrigin?.());if(t)throw new h(_(`error.io.openElsewhere`,{name:t.getName()??l.name??``}))}let o=function(e,t,n){let r=(e,t)=>e.exts.some(e=>e.toLowerCase()===t),i=K(e);if(r(t,i))return t;let a=e.lastIndexOf(`.`);return r(t,K((a>=0?e.slice(0,a):e).replace(/\s*\(\d+\)$/,``)))?t:n.find(e=>r(e,i))??t}(l.name??n,r,s),c=a?t:new H(l.name??n,{format:o.key,canWrite:!0}),u=await i(o.key,c);if(!u)return null;let d=new Blob([Et(u)],{type:o.mimeType||`application/octet-stream`}),f=await l.createWritable();if(await f.write(d),await f.close(),this._handleCache.set(c,l),c instanceof H){let e=await Promise.resolve(l.getFile?.()).then(e=>e?.lastModified??null,()=>null);c.update({size:d.size,lastModified:e})}return c}catch(e){if(e?.name===`AbortError`)return null;if(e instanceof h)throw e}let u=t.getPath(),d=u?u.split(/[/\\]/).pop():null,f=d&&r.exts.some(e=>e.toLowerCase()===K(d))?d:n,p=u!==f||t.canWrite()?new H(f,{format:r.key,canWrite:!1}):t,m=await i(r.key,p);if(!m)return null;let g=new Blob([Et(m)],{type:r.mimeType||`application/octet-stream`});return function(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.style.display=`none`,r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}(g,f),p instanceof H&&p.update({size:g.size}),p}};function Tt(e){return e.map(e=>{let t=e.mimeType&&e.mimeType.includes(`/`)?e.mimeType:`application/octet-stream`;return{description:e.description??e.key,accept:{[t]:e.exts.map(e=>`.`+e)}}})}function G(e){return!!e&&e.kind===`file`&&typeof e.getFile==`function`}function Et(e){if(typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}return e}function K(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t+1).toLowerCase():``}(yt||={}).SortOn={Value:`value`,FillColor:`fillColor`,FontColor:`fontColor`,Icon:`icon`};var Dt={TopLeft:`tl`,Top:`t`,TopRight:`tr`,Left:`l`,Center:`ctr`,Right:`r`,BottomLeft:`bl`,Bottom:`b`,BottomRight:`br`},q=ue.BuiltInName;q.Normal,a(`style.builtin.normal`),q.Comma,a(`style.builtin.comma`),q.Currency,a(`style.builtin.currency`),q.Percent,a(`style.builtin.percent`),q.Comma0,a(`style.builtin.comma0`),q.Currency0,a(`style.builtin.currency0`),q.Hyperlink,a(`style.builtin.hyperlink`),q.FollowedHyperlink,a(`style.builtin.followedHyperlink`),q.Note,a(`style.builtin.note`),q.WarningText,a(`style.builtin.warningText`),q.Title,a(`style.builtin.title`),q.Input,a(`style.builtin.input`),q.Output,a(`style.builtin.output`),q.Calculation,a(`style.builtin.calculation`),q.CheckCell,a(`style.builtin.checkCell`),q.LinkedCell,a(`style.builtin.linkedCell`),q.Total,a(`style.builtin.total`),q.Good,a(`style.builtin.good`),q.Bad,a(`style.builtin.bad`),q.Neutral,a(`style.builtin.neutral`),q.ExplanatoryText,a(`style.builtin.explanatoryText`),a(`style.builtin.heading`),a(`style.builtin.accent`),a(`style.builtin.accentTint`);var Ot,kt,At,jt,Mt=(e,t,n,r,i)=>{let a=JSON.parse(JSON.stringify(e.definition));a.adjs||=[];let o=``,s=0,c=0;t>0?(c=t,s=100-t,o=_(`op.lighterPercent`,{percent:t})):t<0&&(s=100+t,o=_(`op.darkerPercent`,{percent:-t})),s&&a.adjs.push({[de.AdjustmentType.LumMod]:s}),c&&a.adjs.push({[de.AdjustmentType.LumOff]:c});let l=new T({val:a.val,adjs:a.adjs},n),u=l.toString();r?.set(u,l);let d=l.toRGBA().toString();return i?.set(d,l),{description:e.description+`, `+o,definition:a}};function Nt(e,t,n,r){let i=[];for(let a=0;a<e.length;a++){let o=[];i.push(o);let s=i=>{for(let s=0;s<i.length;s++)o.push(Mt(e[a],i[s],t,n,r))},c=new T({val:e[a].definition.val,adjs:e[a].definition.adjs},t).toHSLA().lum;s(c===0?[50,35,25,15,5]:c===100?[-5,-15,-25,-35,-50]:c<=20?[90,75,50,25,10]:c>=80?[-10,-25,-50,-75,-90]:[80,60,40,-25,-50])}return i}(Ot||={}).buildPalette=Nt,kt||={},At||={},jt||={};var Pt;function Ft(e){return tt.peek()?.readFormulaLiteral(e)}function It(e,t){let n=Lt(e),r=Lt(t);return n===r?e===t?0:typeof e==`number`&&typeof t==`number`?e<t?-1:1:typeof e==`string`&&typeof t==`string`?e<t?-1:+(e>t):typeof e==`boolean`?e?1:-1:k.isError(e)&&k.isError(t)?e.getCode()-t.getCode():0:n-r}function Lt(e){if(e===null)return 0;switch(typeof e){case`number`:return 1;case`string`:return 2;case`boolean`:return 3;default:return k.isError(e)?4:5}}(function(e){function t(e){return tt.peek()?.getFunctionDeclaration(e)??null}e.get=t,e.has=function(e){return t(e)!==null}})(Pt||={});var Rt=class{constructor(e){this._children=e}getCoords(){let e=this._children,t=null;for(let n=0;n<e.length;n++){let r=e[n].getCoords();r&&(t=t?{rowStart:Math.min(t.rowStart,r.rowStart),colStart:Math.min(t.colStart,r.colStart),rowEnd:Math.max(t.rowEnd,r.rowEnd),colEnd:Math.max(t.colEnd,r.colEnd)}:r)}return t}getSize(){let e=this._children,t=e.length,n=0;for(let r=0;r<t;r++)n+=e[r].getSize();return n}getCount(){let e=this._children,t=e.length,n=0;for(let r=0;r<t;r++)n+=e[r].getCount();return n}getAggregates(e){if(e)return this._mergeAggregates(e);let t=this._aggregates;return t||(t=this._mergeAggregates(),this._aggregates=t),t}getSnappedSum(e){let t=e??this.getAggregates().sum??0,n=this._children;for(let e=n.length-1;e>=0;e--)if(n[e].getAggregates().numericalCount>0)return n[e].getSnappedSum(t);return t}getSortedNumbers(){let e=this._sortedNumbers;if(!e){let t=this._children,n=t.length,r=[];for(let e=0;e<n;e++){let n=t[e].getSortedNumbers().getValues();n.length>0&&r.push(n)}e=new ke(function(e){let t=e.length;if(t===0)return zt;if(t===1)return e[0];let n=e[0];for(let r=1;r<t;r++)n=Bt(n,e[r]);return Object.freeze(n)}(r)),this._sortedNumbers=e}return e}getRanked(e){return Xe(this._children,e,It)[Symbol.iterator]()}getFrequencies(e){if(e)return this._mergeFrequencies(e);let t=this._frequencies;return t||(t=this._mergeFrequencies(),this._frequencies=t),t}_mergeFrequencies(e){let t=e?.keyFn??he,n=e?.limit,r=new Map,i=this._children,a=i.length,o=0,s=0,c=!1;for(let l=0;l<a;l++){let a=i[l].getFrequencies(e);o+=a.getVisitedCount(),s+=a.getTotalCount(),c||=a.isTruncated();let u=a.getValueCounts(),d=u.next();for(;!d.done;){let[e,i]=d.value,a=t(e),o=r.get(a);o?o.count+=i:n===void 0||r.size<n?r.set(a,{value:e,count:i}):c=!0,d=u.next()}}return Oe.fromGroups(r,t,e,It,o,s,c)}getTypedCounts(e){let t=this._typedCounts;if(!t){let e={[A.Number]:0,[A.String]:0,[A.Boolean]:0,[A.Error]:0,[A.RichData]:0,[A.Null]:0},n=this._children,r=n.length;for(let t=0;t<r;t++){let r=n[t].getTypedCounts();e[A.Number]+=r[A.Number]??0,e[A.String]+=r[A.String]??0,e[A.Boolean]+=r[A.Boolean]??0,e[A.Error]+=r[A.Error]??0,e[A.RichData]+=r[A.RichData]??0,e[A.Null]+=r[A.Null]??0}t=Object.freeze(e),this._typedCounts=t}if(e===void 0)return t;let n={},r=e.length;for(let i=0;i<r;i++)n[e[i]]=t[e[i]]??0;return n}get isIRangeStats(){return!0}_mergeAggregates(e){let t=this._children,n=t.length,r={count:0,min:void 0,max:void 0,numericalCount:0,sum:0,sumSq:0,typed:{[A.Number]:0,[A.String]:0,[A.Boolean]:0,[A.Error]:0,[A.RichData]:0,[A.Null]:0}};for(let i=0;i<n;i++){let n=t[i].getAggregates(e);r.count+=n.count;let a=n.numericalCount;a<=0||(r.numericalCount+=a,r.sum+=n.sum,r.sumSq+=n.varP*a+n.sum*n.sum/a,(r.min===void 0||n.min<r.min)&&(r.min=n.min),(r.max===void 0||n.max>r.max)&&(r.max=n.max))}return Ke(r)}},zt=Object.freeze([]);function Bt(e,t){let n=e.length,r=t.length,i=Array(n+r),a=0,o=0,s=0;for(;a<n&&o<r;)i[s++]=e[a]<=t[o]?e[a++]:t[o++];for(;a<n;)i[s++]=e[a++];for(;o<r;)i[s++]=t[o++];return i}var J,Y=class e{constructor(e,t){this._source=null,this._fresh=new WeakSet,this._unwatch=null,this.cacheId=e,this._store=t,this._fresh.add(t.get())}static dataOf(t,n){let r=e.modelOf(t);return{part:P.fromJSON(t.part,n),model:r,partFormats:!r&&t.partFormats?t.partFormats:null,source:!r&&t.source?t.source:null}}static modelOf(e){if(!e.fields)return null;let{cacheId:t,part:n,partFormats:r,...i}=e;return i}get part(){return this._store.get().part}get _model(){return this._store.get().model}_getData(){return this._store.get()}_replace(e){let t={part:null,model:e,partFormats:null,source:null};this._store.set(t),this._fresh.add(t)}_restate(e){let t=this._fresh.has(this._store.get()),n={part:null,model:e,partFormats:null,source:null};this._store.set(n),t&&this._fresh.add(n)}_hold(e,t){if(this._source)return;let{ref:n,sheet:r,name:i}=this._sourceAsRead()??{},a=null,o=null;if(n&&r&&!n.includes(`#REF!`)?(a=e(r),o=`${Ue(r)}!${Fe(n)}`):!i||n||r?i&&r&&!n&&(a=e(r),o=`${Ue(r)}!${i}`):(a=t(i),o=`${i}[#All]`),!a||!o)return;let s={formula:null,wired:null,last:null};this._source=s,a(o,e=>{s.formula=e.formula;let t=e.formula.getExpression();s.wired??=t,e.formula.hasRefError()||(s.last=t)})}_sourceAsRead(){let e=this._model?.source??this._store.get().source;return e?{ref:e.ref??null,sheet:e.sheet??null,name:e.name??null}:null}_watchSource(e,t,n){if(this._unwatch)return;let{ref:r,sheet:i,name:a}=this._sourceAsRead()??{},o=null,s=null;if(r&&i&&!r.includes(`#REF!`)?s=e(i,r):a&&!r&&(o=i?null:t(a),s=o?.getRange()??n(a,i??null)),!s||s.isInvalid())return;let c=e=>`${e.getRowCount()}x${e.getColumnCount()}`,l=c(s),u=[],d=()=>{this._fresh=new WeakSet},f=e=>{let t=l;return l=c(e),l!==t};u.push(s.addListener(e=>{if(e.getTrigger()===`data`)return void(e.getCommit()!==null&&d());let t=e.getSource();(t.isInvalid()||f(t))&&d()},{transactional:!1})),o&&u.push(s.getWorksheet().addListeners({onTablesChange:()=>{!o.isDeleted()&&f(o.getRange())&&d()}})),this._unwatch=()=>{this._unwatch=null;for(let e of u)e()}}_isStale(){return!this._fresh.has(this._store.get())}_moved(){let e=this._source;if(!e?.formula)return null;let t=e.formula.hasRefError()?e.last:e.formula.getExpression();if(t===null||t===e.wired)return null;let n=this._sourceAsRead();if(n?.name&&n.sheet){let e=F(t)?.sheet;return e?{sheet:e}:null}let r=/^(.+)\[#All\]$/.exec(t)?.[1];if(r)return{name:r};let i=F(t);return i?{name:null,ref:Re(i.reference),sheet:i.sheet}:{ref:Re(t)}}_getSource(){let e=this._sourceAsRead();if(!e)return null;let t={};e.ref&&(t.ref=e.ref),e.sheet&&(t.sheet=e.sheet),e.name&&(t.name=e.name);let n=this._moved();if(n)for(let e of[`ref`,`sheet`,`name`]){let r=n[e];r===null?delete t[e]:r!==void 0&&(t[e]=r)}return t}toJSON(e){let t={cacheId:this.cacheId},n=P.toJSON(this.part,e);if(n){t.part=n;let e=this._store.get().partFormats;e&&(t.partFormats=e)}let r=this._model;r&&Object.assign(t,r);let i=this._getSource();return i&&(t.source=i),t}},Vt=class{constructor(e,t){this._deleted=!1,this._json={...e},this._deleteFromCollection=t??null}getId(){return this._json.id}getDisplayName(){return this._json.displayName}getUserId(){return this._json.userId??null}getProviderId(){return this._json.providerId??null}delete(){this._deleted||(this._deleted=!0,this._deleteFromCollection?.(this))}isDeleted(){return this._deleted}toJSON(){return{...this._json}}get[Symbol.toStringTag](){return`[Person]`}toString(){return`Person:${this.getDisplayName()}`}get isIPerson(){return!0}},Ht=class extends ye{constructor(e){super(),this._byId=new Map,this._byDisplayName=new Map,this._items=null,this._current=null,e&&this.fromJSON(e)}_getItems(){return this._items??=Array.from(this._byId.values())}getCount(){return this._byId.size}add(e){let t=typeof e==`string`?{displayName:e}:e,n=t.id;if(n){let e=this._byId.get(n);if(e)return e}let i=t.displayName??``;if(!n){let e=this._byDisplayName.get(i);if(e)return e}let a=new Vt({...t,displayName:i,id:n??r.uuidV4().toUpperCase()},e=>this._remove(e));return this._byId.set(a.getId(),a),i&&!this._byDisplayName.has(i)&&this._byDisplayName.set(i,a),this._items=null,this._notifyCollectionChange(),a}getById(e){return typeof e==`string`?this._byId.get(e)??null:null}getByDisplayName(e){return typeof e==`string`?this._byDisplayName.get(e)??null:null}getCurrent(){return this._current??=this.add(`Author`)}setCurrent(e){if(e!==null){if(typeof e==`object`&&e.isIPerson){let t=e;this._current=this.getById(t.getId())??this.add(t.toJSON());return}this._current=this.add(e)}else this._current=null}_remove(e){this._byId.get(e.getId())===e&&(this._byId.delete(e.getId()),this._byDisplayName.get(e.getDisplayName())===e&&this._byDisplayName.delete(e.getDisplayName()),this._current===e&&(this._current=null),this._items=null,this._notifyCollectionChange())}toJSON(){return this._byId.size===0?null:this._getItems().map(e=>e.toJSON())}fromJSON(e){if(!e)return;let t=e.length;for(let n=0;n<t;n++){let t=e[n];t&&typeof t.id==`string`&&this.add(t)}}get isIPersonCollection(){return!0}},Ut=(e,t)=>{let n=[0];for(let t=0;t<e.length;t++)e[t]===`
|
|
3
|
-
`&&n.push(t+1);let r=t.map(e=>` ${(e=>{let t=0,r=n.length-1;for(;t<r;){let i=t+r+1>>1;n[i]<=e?t=i:r=i-1}return`${t+1}:${e-n[t]+1}`})(e.start)} ${e.code}: ${e.message}`),i=t.length;return`Script has ${i} compile error${i===1?``:`s`}:\n${r.join(`
|
|
4
|
-
`)}`},Wt=class{constructor(e){this._options=e,this._emitter=new b(this),this._initState()}_initState(){}getModules(){return this._modules}_builtInNames(){try{let e=this._options.getBuiltInFunctions?.();if(!e)return r.EmptyArray;let t=[];for(let n of e.getItems({includeHidden:!0}))n.isBuiltIn()&&t.push(n.getName());return t}catch{return r.EmptyArray}}async createModule(t){let n=await(await e(async()=>{let{ScriptCompiler:e}=await import(`./qFyplGXRu7IepHio.js`);return{ScriptCompiler:e}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ScriptCompiler.compile({builtInNames:this._builtInNames(),minify:!0,...t});return n.module?await j(Ne.DEFAULT_MODULE,n.module,t?.declarationsOnly??!1,n.diagnostics):null}addModule(e,t,n){this._modules.add(e,t,n)}async addModuleFromJSON(e,t,n){let r=await j(e,t);return this.addModule(e,r,n),r}async executeMacro(e,t,n){await z.assertUsable(`scripts`);let r=this._modules.getItems({name:t}),i=r.length;for(let t=0;t<i;t++){let i=r[t].getFunctions().getByName(e);if(i)return i.execute(this._options.workbook,{applyResult:!0,...n})}throw Error(`No macro ${e} found.`)}async run(e,t){try{await z.assertUsable(`scripts`);let n=typeof e==`string`?await this.createModule({source:e}):await j(Ne.DEFAULT_MODULE,e),r=typeof e==`string`?e:e?.source??``;return await this._runModule(n,r,t)}catch(e){return{ok:!1,error:e}}}async _runModule(e,t,n){let r=this._options?.workbook;if(!e)return{ok:!1,error:Error(`The script did not compile to a module.`)};let i=e.getDiagnostics(),a=i.filter(e=>e.severity===`error`);if(a.length>0){let e=Error(Ut(t,a));return e.diagnostics=a,{ok:!1,error:e,diagnostics:i}}let o=e.getFunctions(),s=o.getItems({type:`autoRun`,includeHidden:!0})[0]??o.getItems({type:`macro`,includeHidden:!0})[0]??null;if(!s)return{ok:!1,error:Error("The script has no runnable entry. Export a default function taking the script context, e.g. `export default function run(ctx: IScript.ScriptContext) { ... }` (the workbook is `ctx.wb`; a macro may instead take its target first, e.g. `(sheet: IWorksheet, ctx)`).")};let c=await s.execute(r,n);return{ok:!0,result:c?.results,commitId:c?.commitId,diagnostics:i}}_searchable(e){let t=this._modules;return t&&t.getCount()!==0?(e?t.getItems({name:e}):t.getItems()).map(e=>e.getFunctions()):r.EmptyArray}async searchFunctions(e){await this._emitter.notify(`onBeforeSearch`,{async:!0});let t=this._searchable(e?.moduleName);if(t.length===0)return r.EmptyArray;if(t.length===1)return t[0].search(e);let n=e?.limit,i=n===void 0?e:{...e,limit:void 0},a,o=new Set;for(let e=0;e<t.length;e++){let n=await t[e].search(i);if(n.length!==0){a||=[];for(let e=0;e<n.length;e++){let t=n[e],r=t.getName().toUpperCase();o.has(r)||(o.add(r),a.push(t))}}}if(!a||a.length===0)return r.EmptyArray;let s=e?.text?e.text.trim().toUpperCase():null;return s?pe(a,s):a.sort((e,t)=>{let n=e.getName().toUpperCase(),r=t.getName().toUpperCase();return n<r?-1:+(n>r)}),n!==void 0&&a.length>n?a.slice(0,n):a}async start(){return this._startPromise||(this._startPromise=this._doStart(),this._startPromise.catch(()=>{this._startPromise=void 0})),this._startPromise}_load(){return this._loadPromise||(this._loadPromise=this._doLoad(),this._loadPromise.catch(()=>{this._loadPromise=void 0})),this._loadPromise}async _doStart(){await this._load();let e=this._options?.workbook,t=this._modules.getItems(),n=t.length;for(let r=0;r<n;r++){let n=t[r];try{let t=n.getFunctions().getItems({type:`autoRun`,includeHidden:!0}),r=t.length;for(let n=0;n<r;n++)await t[n].execute(e)}catch(e){m.error(`Error executing autoRun script:`,e)}}}async _doLoad(){let e=this._options?.workbook,t=this._options?.json,n={};if(t){let r=Object.keys(t);for(let i=0;i<r.length;i++){let a=r[i],o=t[a];try{n[a]=await j(a,o,!1,[],o?.scope===`workbook`?e:null)}catch(e){m.error(`Could not load script '${a}'; it will be unavailable.`,e)}}}let r=this,i=new xe({transactions:this._options?.transactions,initial:n,isReadOnly:()=>r.isReadOnly(),onRemove:(e,t)=>{r._options?.onRemove?.(e,t)},onAdd:(e,t)=>{r._emitter.notify(`onChange`),r._options?.onAdd?.(e,t)}});this._modules=i}addListeners(e,t){return this._emitter.addListeners(e,t)}isReadOnly(){return this._options.workbook?._isStructureProtected?.()??!1}toJSON(){this._emitter.notify(`onBeforeSave`);let e=this._modules;if(!e)throw Error(`Scripts is initializing.`);return e.toJSON()}get isIScript(){return!0}},Gt=/^([a-z][a-z0-9+.-]*):/i,Kt=e=>{let t=e.toLowerCase();return t.endsWith(`:`)?t:t+`:`},qt=async(e,t)=>{try{return await globalThis.fetch(e,t)}catch(n){throw n instanceof TypeError&&await(async(e,t)=>{let n=globalThis.location;if(!n||t?.method&&t.method.toUpperCase()!==`GET`)return!1;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3);try{return new URL(e,n.href).origin!==n.origin&&(await globalThis.fetch(e,{mode:`no-cors`,credentials:`omit`,signal:r.signal}),!0)}catch{return!1}finally{clearTimeout(i),r.abort()}})(e,t)?new k.Blocked(`This site is restricted: it doesn't allow web apps to read its data, so the browser blocked the request for security.`,{cause:n}):n}},Jt=class{constructor(){this._handlers=new Map([[`http:`,qt],[`https:`,qt]])}fetch(e,t){let n=Gt.exec(e)?.[1],r=this._handlers.get(n?Kt(n):`https:`);if(!r)return Promise.reject(TypeError(`No fetcher serves '${n}:'.`));try{return r(e,t)}catch(e){return Promise.reject(e)}}register(e,t){let n=Kt(e),r=this._handlers.get(n);return this._handlers.set(n,t),()=>{this._handlers.get(n)===t&&(r?this._handlers.set(n,r):this._handlers.delete(n))}}get isIFetcher(){return!0}},Yt=new Set([101,103,204,205,304]),X=e=>new Response(Yt.has(e.status)?null:e.body,{status:e.status,statusText:e.statusText,headers:e.headers}),Xt=class{constructor(e,t){this._kept=new Map,this._cached=new Map,this._inFlight=new Map,this._resources=e,this._fetcher=t}getFetcher(){return this._fetcher}async fetch(e,t){if((e=>!e||(!e.method||e.method.toUpperCase()===`GET`)&&!e.body)(t)&&t?.cache!==`reload`){let n=this._kept.get(e)??this._findHeld(e);if(n&&!n.isClosed())return this._fromKept(n);let r=this._cached.get(e);if(r)return X(r);let i=this._inFlight.get(e);return i||(i=this._request(e,{...t,signal:void 0}).finally(()=>{this._inFlight.delete(e)}),this._inFlight.set(e,i)),X(await((e,t)=>t?t.aborted?Promise.reject(t.reason):new Promise((n,r)=>{let i=()=>r(t.reason);t.addEventListener(`abort`,i,{once:!0}),e.then(n,r).finally(()=>t.removeEventListener(`abort`,i))}):e)(i,t?.signal))}return X(await this._request(e,t))}adopt(e){for(let t of e){let e=t.getFetchedFrom();e&&!t.isClosed()&&this.keep(e,t)}}keep(e,t){let n=this._kept.get(e);n!==t&&(t.addReference(this),this._kept.set(e,t),n&&!n.isClosed()&&n.deleteReference(this))}_findHeld(e){for(let t of this._resources.getItems())if(t.getFetchedFrom()===e&&!t.isClosed())return this.keep(e,t),t;return null}async _fromKept(e){let[t,n]=await Promise.all([e.toBuffer(),e.getType()]);return X({status:200,statusText:`OK`,headers:n?[[`content-type`,n.mime]]:[],body:t})}async _request(e,t){let n=await this._fetcher.fetch(e,t),r=Yt.has(n.status)?null:await n.arrayBuffer(),i=[];n.headers.forEach((e,t)=>{i.push([t,e])});let a={status:n.status,statusText:n.statusText,headers:i,body:r};if(n.ok&&r&&r.byteLength>0){let t=await new be({source:{buffer:r}}).getType();t?.mime.startsWith(`image/`)?(a.headers=i.filter(([e])=>e.toLowerCase()!==`content-type`),a.headers.push([`content-type`,t.mime])):this._cached.set(e,a)}return a}},Zt=class{constructor(e,t,n,r){this._mergedReading=[],this._colsReading=[],this._rowsReading=[],this._styles=n,this._topLeft=t??o.EmptyCell,this._sheet=new M({runtime:e,styles:this._styles,calcOnLoad:`none`,container:{getName:()=>r,getIndex:()=>1}}),this._builder=this._sheet.getEntireRange().createSparseBuilder()}applyCSSStyle(e,t){let n=!1;e.style||(e.style={},n=!0);let r=e.style,i={...t};if(t.msoIgnore){let e=t.msoIgnore.split(`,`),n=Object.keys(i);for(let t=0;t<n.length;t++){let r=n[t];e.includes(r)&&delete i[r]}}let a=ce(i.fontFamily);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;let o=w(i.textDecoration);r.font.underline=o.underline,r.font.strike=o.strike?S.StrikeStyle.Single:S.StrikeStyle.None,i.textUnderlineStyle&&(r.font.underline=oe(i.textUnderlineStyle)),r.alignment={},i?.textAlign&&(r.alignment.horizontal=re(i.textAlign)),i?.textAlign&&!r.alignment.horizontal&&i?.textAlign!==`general`&&(i.textAlign===`center-across`?r.alignment.horizontal=D.HorizontalAlignment.CenterContinuous:i.textAlign===`fill`?r.alignment.horizontal=D.HorizontalAlignment.Fill:i.textAlign===`121`||i.textAlign===`010`?(r.alignment.horizontal=D.HorizontalAlignment.Distributed,r.alignment.justifyLastLine=i.textAlign===`121`):console.warn(`unknown text-align`,i.textAlign)),i.verticalAlign&&(i.verticalAlign.toLowerCase()===`super`?r.font.baseline=C.Baseline.Superscript:i.verticalAlign.toLowerCase()===`sub`?r.font.baseline=C.Baseline.Subscript:r.alignment.vertical=ie(i.verticalAlign),r.alignment.vertical||(i.verticalAlign===`121`?r.alignment.vertical=D.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`?D.Overflow.Visible:D.Overflow.Wrap),i.msoTextControl===`shrinktofit`&&(r.alignment.overflow=D.Overflow.Shrink);let s=null;if(i.background?s=i.background:i.backgroundColor&&(s=i.backgroundColor),s&&(r.fill={color:s}),i.msoPattern){let e=ne(i.msoPattern);e&&(e.patternType===se.BuiltInSheetPattern.Solid?r.fill={color:e.foreground}:e.patternType!==se.BuiltInSheetPattern.None&&(s&&(e.background=s),r.fill=e))}i.layoutFlow===`vertical`||i.layoutFlow===`vertical-ideographic`?r.alignment.stacked=!0:i.msoRotate!==void 0&&(r.alignment.rotation=le(i.msoRotate));let c=(e,t)=>{e&&(r.borders||={},r.borders[e]=t)};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);let l=r.numberFormat;i.msoNumberFormat&&(l=te(i.msoNumberFormat),l.includes(`\\`)?l=null:l===`Fixed`?l=E.Styles.lookupStyle(r.numberFormat).formatType===E.Type.Number?null:E.Type.Number:l===`Percent`&&(l=E.Styles.lookupStyle(r.numberFormat).formatType===E.Type.Percentage?null:E.Type.Percentage)),l&&(r.numberFormat=l),e.style=this._styles.normalize(r),n&&Object.keys(e.style).length===0&&delete e.style}onCell(e,t,n,r,i){let a=r(i),s={value:t===void 0?n??``:t};if(typeof s.value==`string`&&s.value.length===0&&(s.value=void 0),a&&this.applyCSSStyle(s,a),typeof s.value==`string`&&/^#+$/.test(s.value)){let e=s.style?.numberFormat;e&&(ae(e)||ee(e))&&(s.value=k.BuiltIn.Num)}if(i?.tagName.toUpperCase()===`TD`){let e=s.style,t=e?.font??{};(i.querySelectorAll(`s`).length>0||i.querySelectorAll(`strike`).length>0)&&(t.strike=S.StrikeStyle.Single),i.querySelectorAll(`sub`).length>0&&(t.baseline=C.Baseline.Subscript),i.querySelectorAll(`sup`).length>0&&(t.baseline=C.Baseline.Superscript),(i.querySelectorAll(`b`).length>0||i.querySelectorAll(`strong`).length>0)&&(t.weight=700),i.querySelectorAll(`i`).length>0&&(t.style=S.Style.Italic),i.querySelectorAll(`u`).length>0&&(t.underline=S.UnderlineStyle.Single),Object.keys(t).length>0&&(e||(e={},s.style=e),e.font||(e.font=t));let n=i.querySelectorAll(`a`);if(n.length>0){let e=n[0].getAttribute(`href`);e&&(s.hyperlink=e)}}if(!o.isSingleCell(e)){let t={rowStart:this._topLeft.rowIndex+e.rowStart,colStart:this._topLeft.colIndex+e.colStart,rowEnd:this._topLeft.rowIndex+e.rowEnd,colEnd:this._topLeft.colIndex+e.colEnd};this._mergedReading.push(t)}if(s.value===void 0&&!s.style&&Object.keys(s).length<=1)return;let c=this._builder,l=this._topLeft;if(c.pushAt(l.rowIndex+e.rowStart,l.colIndex+e.colStart,s),!o.isSingleCell(e)&&a.msoIgnore){if(a.msoIgnore.includes(`colspan`)){let t={};a&&this.applyCSSStyle(t,a);let n=e.colEnd-e.colStart,r=l.rowIndex+e.rowStart;for(let i=1;i<=n;i++)c.pushAt(r,l.colIndex+e.colStart+i,t);e={...e,colEnd:e.colStart}}a.msoIgnore.includes(`rowspan`)&&(e={...e,rowEnd:e.rowStart})}}onNoTable(e,t,n){this.onCell({rowStart:this._topLeft.rowIndex,colStart:this._topLeft.colIndex,rowEnd:this._topLeft.rowIndex,colEnd:this._topLeft.colIndex},e,null,t,n)}onRowStart(e,t,n,r){let i=n(r);if(i.msoHeightSource!==`userset`||!r)return;let a=r.getAttribute(`height`)??i.height,o=null;if(a&&(o=O(a,this._styles.getNormal().getFont().getSize(),`px`)),o===null)for(let e=0;e<r.cells.length;e++){let t=r.cells[e],i=t.getAttribute(`height`)??n(t).height,a=O(i,this._styles.getNormal().getFont().getSize(),`px`);a!==null&&(o=Math.max(a,o??0))}o!==null&&this._rowsReading.push({address:{min:this._topLeft.rowIndex+e,max:this._topLeft.rowIndex+e+t-1},update:{size:o*S.getDeviceScale()}})}onColumn(e,t,n,r){let i=n(r);if(i.msoWidthSource!==`userset`||!r)return;let a=r.getAttribute(`width`)??i.width,o=null;a&&(o=O(a,this._styles.getNormal().getFont().getSize(),`px`)),o!==null&&this._colsReading.push({address:{min:this._topLeft.colIndex+e,max:this._topLeft.colIndex+e+t-1},update:{size:o*S.getDeviceScale()}})}onDone(){this._colsReading.length>0&&this._sheet.getColumnHeaders().updateHeaderPairs(this._colsReading),this._rowsReading.length>0&&this._sheet.getRowHeaders().updateHeaderPairs(this._rowsReading),this._sheet.doBatch(()=>{this._builder.apply()}),this._mergedReading.length>0&&this._sheet.getRanges(this._mergedReading).merge()}sheet(){return this._sheet}},Qt=class{constructor(e){if(!e)throw new s(`snapshot is required.`);this._snapshot=e}getItemType(){return`range`}getItem(){return this._snapshot}editMode(){return this._snapshot?.getMarkOptions().editMode??null}isCut(){return this._snapshot?.getMarkOptions().isCut??!1}getName(){return this._snapshot.getName()}toText(){return this._snapshot.toText()}toHtml(){return this._snapshot.toHtml()}toImage(){return this._snapshot.toImage()}get isClipboardItem(){return!0}},$t=class{constructor(e,t,n,r,i){if(this._parsed=void 0,this._runtime=e,!t)throw new s(`nativeItems are required.`);this._topLeft=n??o.EmptyCell,this._native=t,this._markOptions=Object.freeze(r??{}),this._styles=i}getItemType(){return`range`}isCut(){return!1}toText(){return this._native?.text}toHtml(){return this._native?.html?.documentElement.outerHTML||null}toImage(){return this._native?.image}getItem(){let e=this._parsed;if(e===void 0)throw Error(`Must call 'parse()' before getItem().`);if(e===null)return null;if(this._snapshot)return this._snapshot;let t=this;return this._snapshot={prepare:(n,r)=>e.prepare?.(n,{...t._markOptions,...r}),copyTo:(n,r)=>e.copyTo(n,{...t._markOptions,...r}),getMarkOptions:()=>t._markOptions,getName:()=>e?.getName()??`Clipboard Data`,getCoords:()=>e?.getCoords?.()??null,toText:()=>t.toText(),toHtml:()=>t.toHtml(),toImage:()=>t.toImage(),getSource:()=>e?.getSource?.()??null,isISnapshot:!0},this._snapshot}async parse(){let e,t=this._native?.text,n=this._native.html;if(n===null&&t&&t.includes(`<table`))try{let e=new DOMParser().parseFromString(t,p.Html),r=e.querySelector(`parsererror`);if(r)throw new h(`Unable to parse: `+r);n=e,t=null}catch{console.warn(`Discovered text as html table but could could not parse.`)}try{let r=new Zt(this._runtime,this._topLeft,this._styles,n?`HTML`:`Text`),i=await Promise.resolve(t?ze(t):[[]]),a;if(De(n,i,r)?(e=r.sheet(),a=e.getUsedRange()):n=null,a){let t=a.getSnapshot();return this._parsed={prepare:(e,n)=>t.prepare?.(e,n),copyTo:(e,n)=>t.copyTo(e,n),getCoords:()=>a.getCoords(),getSource:()=>e,getName:()=>e.getName()},!0}}catch(e){throw e}if(!t&&!n&&this._native.image){let e=await this._native.image.arrayBuffer(),t=i.getPngStatedSize(e),n=null;return this._parsed={async prepare(r){let i=r.getWorksheet();n={sheet:i,options:await i.getMovables()._preparePicture({source:{buffer:e}},{type:`picture`,description:a(`op.copyImageFromClipboard`),autoSelect:!0,...t&&{bounds:t}})}},copyTo(e,t){let r=e.getWorksheet();if(n?.sheet!==r)throw Error(`The image was not prepared for this sheet.`);return r.getMovables()._insertNow(n.options),null},getName:()=>`Image`},!0}return this._parsed=null,!1}get isClipboardItem(){return!0}},en=class{constructor(e){this._closed=!1,this._kind=e.kind,this._id=e.id,this._part=e.part,this._styles=e.styles,this._tabColor=e.tabColor?this._styles.parseColor(e.tabColor):null,this._transactions=e.transactions,this._workbook=e.workbook??null,this._container=e.container,this._emitter=new b(this,this._transactions)}getKind(){return this._kind}getId(){return this._id}getName(){return this._container.getName()}setName(e,t){return this._assertOpen(),this._container.setName(e,t),this}getVisibility(){return this._closed?R.Visibility.VeryHidden:this._container.getVisibility()}setVisibility(e=!0,t){let n;return this._assertOpen(),n=!0===e?R.Visibility.Visible:!1===e?R.Visibility.Hidden:e,this._container.setVisibility(n,t),this}getIndex(){return this._container.getIndex()}setIndex(e,t){return this._assertOpen(),this._container.setIndex(e,t),this}getTabColor(){return this._tabColor}setTabColor(e){return this._assertOpen(),this._tabColor=typeof e==`string`?this._styles.parseColor(e):e??null,this._notify(`onTabColorChange`),this}getWorkbook(){return this._workbook}async select(e){return await this._container.requestSelect(e),this}delete(){if(this._closed)return;let e=this._transactions.beginCommit({description:_(`op.deleteSheet`,{name:this.getName()})});try{try{this._notify(`onBeforeDelete`)}catch(e){throw e instanceof Error?e:new h(e?.message??_(`error.sheet.modelDelete`))}this._notify(`onDelete`),e.commit()}catch(t){throw e.rollback(),t}}isDeleted(){return!this._container.isAttached()}addListeners(e,t){return this._emitter.addListeners(e,t)}close(){this._closed||=(this._notify(`onClose`),this._emitter.close(),!0)}isClosed(){return this._closed}_getPart(){return this._part}_notify(e){this._emitter.notify(e)}_assertOpen(){if(this._closed)throw Error(_(`error.sheet.modelClosed`))}get[Symbol.toStringTag](){return`[OpaqueSheet]`}toString(){return`[${this.getName()??`(untitled)`}]`}get isISheet(){return!0}get isIOpaqueSheet(){return!0}};(J||={}).Visibility={Visible:`visible`,Hidden:`hidden`,VeryHidden:`veryHidden`};var Z,tn={showFormulaBar:!0,showTabs:!0,tabRatio:600,showHorizontalScrollbar:!0,showVerticalScrollbar:!0,showStatusBar:!0,activeSheetId:0,firstTab:0,windowBounds:null,minimized:!1,visibility:J.Visibility.Visible,autoFilterDateGrouping:!0},nn=class{constructor(e){this._id=r.uuidV4(),this._emitter=new b(this),this._state={...tn},e?.json&&this._fromJSON(e?.json)}getId(){return this._id}isShowFormulaBar(){return this._state.showFormulaBar}setShowFormulaBar(e){return this._state.showFormulaBar=e,this._emitter.notify(`onViewChange`),this}isShowTabs(){return this._state.showTabs}setShowTabs(e){return this._state.showTabs=e,this._emitter.notify(`onViewChange`),this}getTabRatio(){return this._state.tabRatio}setTabRatio(e){return this._state.tabRatio=e,this._emitter.notify(`onViewChange`),this}isShowHorizontalScrollbar(){return this._state.showHorizontalScrollbar}setShowHorizontalScrollbar(e){return this._state.showHorizontalScrollbar=e,this._emitter.notify(`onViewChange`),this}isShowVerticalScrollbar(){return this._state.showVerticalScrollbar}setShowVerticalScrollbar(e){return this._state.showVerticalScrollbar=e,this._emitter.notify(`onViewChange`),this}isShowStatusBar(){return this._state.showStatusBar}setShowStatusBar(e){return this._state.showStatusBar=e,this._emitter.notify(`onViewChange`),this}getActiveSheetId(){return this._state.activeSheetId}setActiveSheetId(e){let t=this._state,n=t.activeSheetId;return t.activeSheetId=e,n!==e&&this._emitter.notify(`onViewChange`),this}getFirstTab(){return this._state.firstTab}setFirstTab(e){return this._set(`firstTab`,Math.max(0,Math.trunc(e)))}getWindowBounds(){return this._state.windowBounds}setWindowBounds(e){return this._set(`windowBounds`,e?Object.freeze({...e}):null)}isMinimized(){return this._state.minimized}setMinimized(e){return this._set(`minimized`,e)}getVisibility(){return this._state.visibility}setVisibility(e){return this._set(`visibility`,e)}isAutoFilterDateGrouping(){return this._state.autoFilterDateGrouping}setAutoFilterDateGrouping(e){return this._set(`autoFilterDateGrouping`,e)}_set(e,t){return this._state[e]===t||(this._state[e]=t,this._emitter.notify(`onViewChange`)),this}addListeners(e,t){return this._emitter.addListeners(e,t)}toJSON(){let e={},t=Object.keys(this._state),n=t.length;for(let r=0;r<n;r++){let n=t[r],i=this._state[n];i!=null&&i!==tn[n]&&(e[n]=i)}return Object.keys(e).length===0&&(e=null),e}_fromJSON(e,t=!0){let n=e||{};this.update(n,t)}update(e,t=!0){this._state={...tn,...this._state,...e},t&&this._emitter.notify(`onViewChange`)}get[Symbol.toStringTag](){return`[WorkbookView]`}toString(){let e=this.toJSON();return e?JSON.stringify(e):`DefaultWorkbookView`}get isIWorkbookView(){return!0}},rn=Object.freeze({structure:!1,windows:!1,revision:!0,password:null,revisionsPassword:null}),an=class extends Ye{isWindowsAllowed(){return this._isPropertyAllowed(`windows`)}isRevisionAllowed(){return this.isLocked()&&this._properties?.revision===void 0?!this._isReadOnly:this._isPropertyAllowed(`revision`)}isStructureAllowed(){return this._isPropertyAllowed(`structure`)}_getAllowedKey(){return`workbook`}_fromJSON(e){this._properties=e}_toJSON(e){let t=this._properties;if(t){let n=Object.keys(t),r=n.length;for(let i=0;i<r;i++){let r=n[i],a=t[r];a!=null&&a!==rn[r]&&(e[r]=a)}}return super._toJSON(e)}get[Symbol.toStringTag](){return`[WorkbookProtection]`}get isIWorkbookProtection(){return!0}};(Z||={}).Type={Number:`number`,Boolean:`boolean`,Date:`date`,String:`string`,Float:`float`};var on=e=>{if(typeof e==`string`)return{type:Z.Type.String,value:e};if(typeof e==`boolean`)return{type:Z.Type.Boolean,value:e};if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`A custom property value must be a finite number.`);return{type:Number.isInteger(e)&&e>=-2147483648&&e<=2147483647?Z.Type.Number:Z.Type.Float,value:e}}if(e instanceof Date){if(isNaN(e.getTime()))throw Error(`A custom property value must be a valid date.`);return{type:Z.Type.Date,value:e.toISOString()}}throw Error(`A custom property value must be a string, number, boolean or Date.`)},sn=class{constructor(e,t){this._json=e,this._owner=t}getKey(){return this._json.key}getType(){return this._json.type}getLinkTarget(){return this._json.linkTarget??null}getValue(){let{type:e,value:t}=this._json;return e===Z.Type.Date?new Date(t):t}setValue(e){this._owner._assertCustomEditable(this),this._json={...this._json,...on(e)}}delete(){this._owner._removeCustom(this)}toJSON(){return{...this._json}}},cn=class{constructor(e){this._json={},this._custom=[],this._assertOpen=e}_text(e){return this._json[e]??null}_setText(e,t){return this._assertOpen(),t==null||t===``?delete this._json[e]:this._json[e]=t,this}getAuthor(){return this._text(`author`)}setAuthor(e){return this._setText(`author`,e)}getCategory(){return this._text(`category`)}setCategory(e){return this._setText(`category`,e)}getComments(){return this._text(`comments`)}setComments(e){return this._setText(`comments`,e)}getCompany(){return this._text(`company`)}setCompany(e){return this._setText(`company`,e)}getContentStatus(){return this._text(`contentStatus`)}setContentStatus(e){return this._setText(`contentStatus`,e)}getCreationDate(){let e=this._json.creationDate;if(!e)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}getKeywords(){return this._text(`keywords`)}setKeywords(e){return this._setText(`keywords`,e)}getLastAuthor(){return this._json.lastAuthor??null}getManager(){return this._text(`manager`)}setManager(e){return this._setText(`manager`,e)}getRevisionNumber(){return this._json.revisionNumber??null}setRevisionNumber(e){return this._assertOpen(),e!=null&&Number.isFinite(e)?this._json.revisionNumber=e:delete this._json.revisionNumber,this}getSubject(){return this._text(`subject`)}setSubject(e){return this._setText(`subject`,e)}getTitle(){return this._text(`title`)}setTitle(e){return this._setText(`title`,e)}getCustom(){return this._custom.slice()}getCustomProperty(e){let t=e.toLowerCase();return this._custom.find(e=>e.getKey().toLowerCase()===t)}addCustomProperty(e,t){if(this._assertOpen(),typeof e!=`string`||e===``)throw Error(`A custom property needs a name.`);let n=this.getCustomProperty(e);if(n)return n.setValue(t),n;let r=new sn({key:e,...on(t)},this);return this._custom.push(r),r}deleteAllCustomProperties(){this._assertOpen(),this._custom=[]}_assertCustomEditable(e){if(this._assertOpen(),!this._custom.includes(e))throw Error(`The custom property has been deleted.`)}_removeCustom(e){this._assertCustomEditable(e),this._custom=this._custom.filter(t=>t!==e)}fromJSON(e){let{custom:t,...n}=e??{};this._json=n,this._custom=(t??[]).map(e=>new sn({...e},this))}toJSON(){let e={...this._json};return this._custom.length>0&&(e.custom=this._custom.map(e=>e.toJSON())),e}};function ln(e){return _(`error.workbook.invalidSheetKey`,{key:e})}function un(e){return _(`error.workbook.sheetNameNotFound`,{sheetName:e})}function dn(e,t){return _(t===`chart`?`error.workbook.sheetIsChart`:t===`macro`?`error.workbook.sheetIsMacro`:`error.workbook.sheetIsDialog`,{sheetName:e})}function fn(e,t){return t===`chart`?_(`error.workbook.selectedIsChart`,{sheetName:e}):t===`macro`?_(`error.workbook.selectedIsMacro`,{sheetName:e}):t===`dialog`?_(`error.workbook.selectedIsDialog`,{sheetName:e}):_(`error.workbook.noWorksheet`)}var pn=class extends ye{constructor(e,t,n,r){super(),this._add=e,this._get=t,this._addListeners=n,this._getSelected=r}getActive(){return this._getSelected()}getAt(e){return this.getItems()[e]??null}getByIndex(e){return this.getItems()[e]??null}getAll(){return this.getItems()}add(e){return this._add(e)}_getItems(e){return this._get(e?.name,e?.visibility)}getByName(e){return this._get(e)?.[0]??null}addListeners(e,t){return this._addListeners(e,t)}get isIWorksheetCollection(){return!0}},mn=new RegExp(/[\\/\\*?:[\]]+/),hn=new RegExp(/\(((\d+)(?!.*\d))\)$/,`g`);function gn(e){let t=_(a(`workbook.defaultSheetName`),{n:e+1});return t===`workbook.defaultSheetName`?`Sheet${e+1}`:t}function _n(e,t){return{...ct,getWorksheet:()=>null,toString:()=>V(e,t)}}function vn(e,t=!1){if(!e)throw Error(_(`error.workbook.sheetNameBlank`));if(mn.test(e)){if(!t)throw Error(function(e){return e?_(`error.workbook.sheetNameInvalidCharsNamed`,{sheetName:e}):_(`error.workbook.sheetNameInvalidChars`)}(e));e=e.replace(mn,``)}if(e.length===0)throw Error(_(`error.workbook.sheetNameBlank`));let n=e.length;if(n>31){if(!t)throw Error(_(`error.workbook.sheetNameTooLong`));e=e.substring(0,31)}if(e.charAt(0)===`'`||e.charAt(n-1)===`'`){if(!t)throw Error(_(`error.workbook.sheetNameQuotes`));e=e.replace(/^'|'$/g,``)}return e}var yn=`workbook.activeSheet`,bn=class e extends ve{constructor(e,t,n,r){super(e,t,r),this._workbook=n}getSource(){return this._workbook}_createRanges(t,n){let r=this._options;return n&&(r={...this._options,getOptions:I(this._options?.getOptions,n)}),new e(t,this._internal,this._workbook,r)}_createRange(e,t){let n=e?{...e}:null,r=this._workbook,i=n?r._getSheetRef(n.scope,R.Visibility.VeryHidden):null;if(i&&!i.sheet.isIWorksheet)throw new h(dn(i.name,i.sheet.getKind()));if(!i){let e=r._anchorWorksheet();return delete n?.scope,_n(n,n?{scope:We,...e.getEntireRange().getCoords()}:null)}let a=this._options;return t&&(a={...this._options,getOptions:I(this._options.getOptions,t)}),new xn(e,L(i.sheet),this._workbook,a)}async select(e){let t=[],n=null,r=this.getCoords();for(let e=0;e<r.length;e++){let i=r[e];i&&(n||=i.scope,i&&i.scope===n&&t.push(i))}n||=this._workbook.getWorksheet().getName();let i=this._workbook.getWorksheets().getByName(n);if(!i)return;let a=await i.getRanges(t).select(e),o=this._workbook._rangesAddressToCoords(a.getCoords());return this._createRanges(o)}addListener(e,t){if(!this.getCoords())return()=>{};let n=this._workbook._sheetToWBEvent(e);return super.addListener(n,t)}get[Symbol.toStringTag](){return`[WorkbookRanges]`}getAddress(e){let t=this._internal.getSheet(),n=t.getEntireRange().getCoords();return lt(this.getCoords(),{...n,scope:t.getName()},V,it,e)}toString(){return this.getAddress()}},xn=class e extends _e{constructor(e,t,n,r){super(e,t,r),this._workbook=n}_createRanges(e,t){let n=this._options;return t&&(n={...this._options,getOptions:I(this._options?.getOptions,t)}),new bn(e,this._internal,this._workbook,n)}_createRange(t,n){let r=this._internal;if(!t)return Se(r.getSheet(),r.getSheet().getEntireCoords());if(r.validateCoords(t),r.getSheet().isClosed())return Se(null,r.getSheet().getEntireCoords(),t);let i=this._options;return n&&(i={...this._options,getOptions:I(this._options?.getOptions,n)}),new e(t,this._internal,this._workbook,i)}addListener(e,t){if(!this.getCoords())return()=>{};let n=this._workbook._sheetToWBEvent(e);return super.addListener(n,t)}get[Symbol.toStringTag](){return`[WorkbookRange]`}getAddress(e){let t=this._internal.getSheet(),n=t?.getEntireRange().getCoords()??null;return V(this.getCoords(),{...n,scope:t.getName()})}toString(){return this.getAddress()}},Sn=e=>!!e&&typeof e==`object`&&typeof e.getOrigin==`function`,Cn=class{constructor(t){this._isLoadingSheets=!1,this._lastTransactionUUID=null,this._starting=null,this._closed=!1,this._listenerOriginProvider=null,this._listenerOrigin=null,this._lastOriginName=null,this._initializing=!0,this._pivotCaches=[],this._pivotTableCollection=new Me(()=>{let e=[];for(let t of this.getWorksheets().getItems({visibility:R.Visibility.VeryHidden}))e.push(...t.getPivotTables());return e},(e,t)=>this.doBatch(e,t)),this._people=new Ht,this._commentCollection=new st(null,(e,t,n)=>{let r=[];for(let i of this.getWorksheets().getItems({visibility:R.Visibility.VeryHidden}))r.push(...i.getComments().getItems(e?{address:e,ignoreHidden:t,fullyContained:n}:{ignoreHidden:t,fullyContained:n}));return r},(e,t)=>this.addListeners({onSheetsChange:e.onCollectionChange?()=>{e.onCollectionChange(this._commentCollection)}:void 0},t)),this._isDate1904=!1,this._codeName=null,this._updateLinks=null,this._hiddenPivotFieldList=!1,this._documentProperties=new cn(()=>{if(this._closed)throw Error(_(`error.workbook.modelClosed`))}),this._locale=null,this._localeOverrides=null,this._startModules=new WeakSet;let n=typeof t==`string`?{origin:t}:{...t},i=n.origin;this._ownOriginProvider=!Sn(i),this._originProvider=Sn(i)?i:new St(typeof i==`string`?new H(null,{name:i}):i??new H(null)),delete n.origin,this._bindOrigin(this._originProvider.getOrigin()),this._listenerOriginProvider=this._originProvider.addListeners({onOriginChange:()=>this._onOriginChange()});let o=n.json;delete n.json,this._transactions=n.transactions??new x,this._id=this._transactions.create(),this._ownTransactions=!n.transactions,this._emitter=new b(this,this._transactions),this._runtime=n.runtime??new Je(`Workbook Runtime`,{isDate1904:()=>this._isDate1904,getNow:()=>this._transactions.getCurrentCommit().getTimestamp(),getLocale:()=>this._locale??me()??mt(),getLocaleOverrides:()=>this._localeOverrides}),this._listenerLanguage=g.addChangeListener(()=>{this._closed||this._notifyAllChange()});let s=this,c=this._beginCommit({description:a(o?`op.openWorkbook`:`op.newWorkbook`)});try{this._strings=n.strings??new qe,this._ownStrings=!n.strings,this._richValues=n.richData??new Ge,this._resources=n.resources??new Te,this._ownResources=!n.resources,this._fetch=new Xt(this._resources,n.fetcher??new Jt),this._createSheetName=n.createSheetNameCallback??gn;let t=n.createWorksheetCallback;t||=e=>new M(e),this._sheetOnNameChange=new Map,this._sheetOnVisibilityChange=new Map,this._sheetOnIndexChange=new Map,this._createSheet=(e,n,r,i,a,o,c)=>{let l=null,u={runtime:s._runtime,readonly:s._options.readonly??!1,disableLoadAutoFit:s._options.disableLoadAutoFit??!1,opener:s._options.opener,transactions:s._transactions,styles:s._styles,strings:s._strings,richData:s._richValues,resources:s._resources,names:s._names,workbook:s,calculation:s._calculation,resolveRange:e=>s._options.resolveRange?.(e)??s.getRange(e),container:{beforeFromJSON:t=>{l=t,s._addSheetRef({name:n,id:e,visibility:r??R.Visibility.Visible,sheetId:a,sheet:t},i)},getName:()=>{let e=s._getSheetRef(l);return e?e.name:n},setName:(e,t)=>{s._getSheetRef(l)&&s._setSheetName(l,e,t)},setNameChangeCallback:t=>{s._sheetOnNameChange.set(e,t)},getVisibility:()=>{let e=s._getSheetRef(l);return e?e.visibility:R.Visibility.Visible},setVisibility:(e,t)=>{s._setSheetVisibility(l,e,t)},setVisibilityCallback:t=>{s._sheetOnVisibilityChange.set(e,t)},duplicate:()=>s._duplicateSheet(l),getIndex:()=>{let e=s._getSheetRef(l);return e?s._getOffsetForId(e.id,s._getSheetRefs(R.Visibility.VeryHidden)):i},setIndex:(e,t)=>{let n=s._getSheetRef(l,R.Visibility.VeryHidden);return!!n&&(s._moveSheet(n,e,t),!0)},setIndexCallback:t=>{s._sheetOnIndexChange.set(e,t)},requestSelect:()=>s._requestSelect(l)}};return o&&(u.json=o),c!==void 0&&(u.uid=()=>c),l=t(u,n,i,r),l},this._namedTableSource=new Ce({getSheets:()=>s._sheets?s.getWorksheets().getItems({visibility:R.Visibility.VeryHidden}):r.EmptyArray,addSheetsListener:(e,t)=>s.addListeners({onSheetsChange:e},t)}),this._names=n.names??new et({addressToRanges:e=>s.getRanges(e),getCurrentScope:()=>s.getSelectedWorksheet()?.getName()??null,isReadOnly:()=>(s._options.readonly??!1)||s._isStructureProtected(),transactions:s._transactions,getSources:()=>s._calculation?[s._calculation.getNamedFormulas(),s._namedTableSource]:r.EmptyArray}),this._ownNames=!n.names,this._calculation=n.calculation??new ot({runtime:s._runtime,functions:n.functions,json:o?.calc,isNamesReadOnly:()=>s._isStructureProtected(),getActiveCell:()=>{let e=s.getSelectedWorksheet(),t=e?.getSelectedRange()?.getCoords();return e&&t?{rowIndex:t.rowStart,colIndex:t.colStart,scope:e.getId()}:null},getRange:s.getRange.bind(s),getRanges:s.getRanges.bind(s),createGraphRanges:(e,t)=>s._createGraphRanges(e,t),getSheetIndex:e=>{if(e===void 0){let e=s.getSelectedSheet();return e?this._getSheetRefs(R.Visibility.VeryHidden).findIndex(t=>t.sheet===e):-1}let t=this._getSheetRefs(R.Visibility.VeryHidden);e=e.toLowerCase();let n=t.length;for(let r=0;r<n;r++)if(t[r].name.toLowerCase()===e)return r;try{wn.address=e;let t=this._names.getItems(wn);if(!t||t.length===0)return-1;let n=t[0].getRanges?.()?.getCoords()?.[0]?.scope;if(!n)return-1;let r=this._getSheetRefs(R.Visibility.VeryHidden);n=n.toLowerCase();let i=r.length;for(let e=0;e<i;e++)if(r[e].name.toLowerCase()===n)return e}catch{return-1}return-1},getSheetCount:()=>s._getSheetRefs(R.Visibility.VeryHidden).length,externalBooks:o?.externalBooks,externalBookResolver:n.externalBookResolver,namedCollection:s._names,strings:s._strings,get resources(){return s._resources},fetch:(e,t)=>s._fetch.fetch(e,t),parseText:(t,n)=>(async(t,n,r)=>{let i=await e(()=>import(`./CnPgk3HcIziOcskY.js`).then(e=>v(e.default,1)),__vite__mapDeps([7,8]),import.meta.url),a=(i.default??i).parse(n,{delimiter:r?.delimiter??`,`,skipEmptyLines:!1}).data,o=a.length,s=a[o-1];s&&s.length===1&&s[0]===``&&o--;let c=0;for(let e=0;e<o;e++)a[e].length>c&&(c=a[e].length);let l=Array(o);for(let e=0;e<o;e++){let n=a[e],r=Array(c);for(let e=0;e<c;e++){let i=n[e];r[e]=i===void 0||i===``?null:He(t,i).value}l[e]=r}return l})(s._runtime,t,n),startFunctions:()=>s._startFunctions(),transactions:s._transactions,names:o?.names}),this._ownCalculation=!n.calculation,this._scripts=this._createScripts(o?.modules),this._ownNames=!n.names,this._options=Object.freeze({...n});let i=o?.sheets?.length?o.sheets.map(e=>e.name):[this._createSheetName(0)],a=i.map(e=>e+`-`+r.uuidV4()),l=e=>{let t=o?.sheets?.[e]?.kind;return!!t&&t!==R.Kind.Worksheet};this._calculation._setSheets(i.map((e,t)=>l(t)?[a[t],e,!0]:[a[t],e]));let u=n.calcOnLoad??`auto`,d=!1,f=(async()=>{try{if(this._ownCalculation&&u!==`none`&&(u===`full`||u===`auto`&&!0===o?.calc?.fullCalcOnLoad?await this._calculation._calculateForLoad():await this._calculation.start(),this._closed||(await this._refreshPivotCachesOnLoad(),this._closed)))return;await this._scripts.start()}finally{d=!0,this._starting=null}})();d||(this._starting=f),this._starting?.catch(()=>{}),o?this._fromJSON(o,a):(this._initState(),this._addSheet(!1,i[0],null,a[0])),this._sheets=new pn(e=>s._addSheetOptions(e),(e,t)=>{if(e){let n=this._getSheetRef(e,t);return n&&Q(n)?[n.sheet]:r.EmptyArray}return this._getWorksheets(t)},(e,t)=>{let n=e.onCollectionChange,r=e.onInvalidated;return s._emitter.addListeners({onSheetsChange:n?()=>{n(s._sheets)}:void 0,onInvalidated:r?()=>{r(s._sheets)}:void 0},t)},()=>s.getSelectedWorksheet()),this._ownCalculation&&(n.calcOnLoad??`auto`)!==`none`&&(this._calculation.hydrateNames(),this._holdPivotCaches()),this._emitter.notify(`onLoad`),this._ownTransactions?c.amend():c.commit()}catch(e){throw c.rollback(),e}this._initializing=!1}_initState(){let e=this._getSheetRefs();for(let t=(e?e.length:0)-1;t>=0;t--);let t=this._options;this._isDate1904=t.runtime?.isDate1904()??!1,this._locale=null,this._localeOverrides=null,this._theme=t.theme??new we().getDefaultTheme(),this._styles=t?.styles??new je(this._theme),this._ownStyles=!t.styles,this._styles.getTheme()||this._styles.setTheme(this.getTheme()),this._activeSheetOffset=0,this.setView(new nn),this._listenerProtection?.(),this._protection=new an(void 0,this._options.readonly??!1),this._listenerProtection=this._protection.addListeners({onChange:e=>{n._emitter.notify(`onProtectionChange`)}});let n=this;this._transactionsRemoveListener=this._transactions.addStateListener(this._id,{async onAfterStateChange(e,t,r,i,a){let o=n._view,s=a?.[yn],c=r?s?.before:s?.after,l=s?.viewId===o.getId()&&c!=null,u=l?c:o.getActiveSheetId(),d=l&&t.getId()===n._lastTransactionUUID?n._getSheetRef({id:u}):null;d?await d.sheet.select():n._resyncActiveSheet(u,e),n._lastTransactionUUID=t.getId(),(r||i)&&n._emitter.notify(`onSheetsChange`),n._emitter.notify(`onSelectedSheetChange`),n._emitter.notify(`onViewChange`)},onRestoreOrRevert(){n._ownCalculation,n._emitter.notify(`onInvalidated`)}});let r=this._getState();r?.listenersSheets&&(r?.listenersSheets.forEach(e=>{e()}),r?.listenersSheets.clear()),this._updateState({sheetRefsAll:[],sheetRefsVisibleAndHidden:[],sheetRefsVisible:[],refsById:new Map,sheetsById:new Map,refsByLowerCaseName:new Map,sheetsByLowerCaseName:new Map,refsByInstance:new Map,lastId:-1,sheetsCreated:new Set,listenersSheets:new Map,pivotCacheData:new Map})}getId(){return this._id}getVersionId(){return this._transactions.getVersionId(this._id)}getName(){return this._closed?null:this._origin.getName()}getOrigin(){return this._originProvider.getOrigin()}_onOriginChange(){if(this._closed)return;let e=this._originProvider.getOrigin();if(e===this._origin)return;this._listenerOrigin?.();let t=this._lastOriginName;this._bindOrigin(e),this._emitter.notify(`onOriginChange`),this._lastOriginName!==t&&this._emitter.notify(`onNameChange`)}_bindOrigin(e){this._origin=e,this._lastOriginName=e.getName(),this._listenerOrigin=e.addListeners({onChange:()=>{if(this._closed)return;let t=e.getName();t!==this._lastOriginName&&(this._lastOriginName=t,this._emitter.notify(`onNameChange`))}})}getView(){return this._view}setView(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!e)throw new h(_(`error.sheet.emptyView`));this._listenerWorkbookView?.();let t=this,n=-1;return this._listenerWorkbookView=e.addListeners({onViewChange:e=>{let r=t._getState(),i=this._view.getActiveSheetId(),a=r.sheetRefsVisible,o=this._getOffsetForId(i,a);this._activeSheetOffset=o,t._emitter.notify(`onViewChange`),n!==i&&(t._emitter.notify(`onSelectionChange`),t._emitter.notify(`onSelectedSheetChange`)),n=i}}),this._view=e,t._emitter.notify(`onViewChange`),this}getRuntime(){return this._runtime}setDate1904(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));return this._isDate1904===e||(this._isDate1904=e,this._emitter.notify(`onRegionalChange`)),this}getLocale(){return this._runtime.getLocale()}getPinnedLocale(){return this._locale}setLocale(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(e)try{new Intl.Locale(e)}catch{throw Error(_(`error.workbook.invalidLocale`,{locale:e}))}return this._locale===e||(this._locale=e,this._emitter.notify(`onRegionalChange`)),this}getLocaleOverrides(){return this._localeOverrides}setLocaleOverrides(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=e&&Object.keys(e).length>0?e:null;return this._localeOverrides=t,this._emitter.notify(`onRegionalChange`),this}getStyles(){return this._styles}getResources(){return this._resources}getFetcher(){return this._fetch.getFetcher()}fetch(e,t){return this._fetch.fetch(e,t)}getTransactions(){return this._transactions}getChanges(e){let t=this._transactions,[n,r]=t.getLog(e??t.getCurrentCommit(!1).getId(),2),i=[],a=this.getWorksheets().getItems({visibility:R.Visibility.VeryHidden});for(let e=0;e<a.length;e++){let t=a[e];t instanceof M&&i.push(...t._changeEventsOf(n,r??null))}return i}getStrings(){return this._strings}getExternalBooks(){return this._calculation.getExternalBooks()}getUpdateLinks(){return this._updateLinks}setUpdateLinks(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));return this._updateLinks=e,this}getPivotTables(){return this._pivotTableCollection}getComments(){return this._commentCollection}getPeople(){return this._people}getTheme(){return this._theme}setTheme(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!e)throw new h(_(`error.workbook.notSetValue`));let t=this._theme;return this._theme=e,this.getStyles().setTheme(e),this._emitter.notify(`onThemeChange`),t}getSelectedSheetIndex(){return this._activeSheetOffset}getSelectedSheet(){let e=this._getSheetRef(this.getSelectedSheetIndex());return e?e.sheet:null}getSelectedWorksheet(){let e=this._getSheetRef(this.getSelectedSheetIndex());return e&&Q(e)?e.sheet:null}getActiveSheet(){return this.getSelectedWorksheet()}getActiveWorksheet(){return this.getSelectedWorksheet()}getSheets(e){let t=this._getSheetRefs(e?.visibility??R.Visibility.Visible),n=Array(t.length);for(let e=0;e<t.length;e++)n[e]=t[e].sheet;return n}getSheet(e){if(e===void 0)return this.getSelectedSheet();if(!e)throw Error(_(`error.workbook.sheetNameNotProvided`));let t=this._getSheetRef(e);if(!t)throw new d(un(e));return t.sheet}getWorksheet(e,t=R.Visibility.Visible){if(typeof e==`number`)return this.getWorksheetAt(e,t);if(e===void 0)return this._requireSelectedWorksheet();if(!e)throw Error(_(`error.workbook.sheetNameNotProvided`));let n=this._getSheetRef(e,t);if(!n)throw new d(un(e));if(!Q(n))throw new d(dn(n.name,n.sheet.getKind()));return n.sheet}getWorksheetAt(e,t=R.Visibility.Visible){let n=this._getWorksheets(t)[e];if(!n)throw new d(function(e){return _(`error.workbook.sheetIndexNotFound`,{index:e})}(e));return n}_requireSelectedWorksheet(){let e=this.getSelectedWorksheet();if(e)return e;let t=this.getSelectedSheet();throw new h(fn(t?.getName()??``,t?.getKind()??R.Kind.Worksheet))}_anchorWorksheet(){return this.getSelectedWorksheet()||(this._getWorksheets(R.Visibility.VeryHidden)[0]??null)}getWorksheets(){return this._sheets}addWorksheet(e){return this.getWorksheets().add(e)}_getWorksheets(e=R.Visibility.Visible){let t=this._getSheetRefs(e),n=[],r=t.length;for(let e=0;e<r;e++){let r=t[e];Q(r)&&n.push(r.sheet)}return n}_getSheetRefs(e=R.Visibility.Visible){let t=this._getState();return t?e===R.Visibility.Visible?t.sheetRefsVisible:e===R.Visibility.Hidden?t.sheetRefsVisibleAndHidden:e===R.Visibility.VeryHidden?t.sheetRefsAll:r.EmptyArray:[]}_getSheetRef(e,t=R.Visibility.Visible){let n=null;return typeof e==`number`?this._getSheetRefs(t)[e]:(typeof e==`string`?n=this._getState().refsByLowerCaseName.get(e.toLowerCase()):!0===e?.isISheet?n=this._getState().refsByInstance.get(e):e?.id!==void 0&&(n=this._getState().refsById.get(e.id)),n)}_validateNewSheetName(e,t=!0){if(e==null)return e;if(vn(e),t&&this._getState().sheetsByLowerCaseName.has(e.toLowerCase()))throw new h(_(`error.workbook.nameTaken`));return e.substring(0,31)}findValidSheetName(e){e&&=vn(e,!0);try{return function(e,t){try{if(t(e))return e}catch{}let n,r,i=hn.exec(e);for(i===null?(n=e+` `,r=1):(n=e.substring(0,i.index),r=parseFloat(i[1]));r<256;){r++;let e=`(`+r+`)`,i=n.substring(0,31-e.length)+e;try{if(t(i))return i}catch{}}throw Error(e+` is not a valid sheet name`)}(e,e=>this._validateNewSheetName(e))}catch{return this._nextSheetName()}}isValidSheetNameCharacter(e){return!mn.test(e)}_isStructureProtected(){return!this._initializing&&!this.getProtection().isStructureAllowed()}_addSheetOptions(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let t,n=null;t=typeof e==`string`?{name:e}:typeof e==`number`?{index:e}:e,t={...t,description:t?.description??a(`op.addSheet`)};let r=this.beginCommit(t);try{let e=t?.autoSelect??!1;n=this._addSheet(!0,t.name,t.index??null);let i=this.getView().getActiveSheetId();if(e&&this._recordActiveSheet(r,i,this._getSheetRef(n).id),r.commit({description:_(`op.addSheetNamed`,{name:n.getName()})}),!1!==e){let t=typeof e==`boolean`?void 0:e;n.select(t)}}catch(e){throw r.rollback(),e}return n}_nextSheetName(e=null){let t=e?e.toLowerCase():null,n=this._getState(),r=n.sheetsByLowerCaseName;if(e&&r.has(t))throw new h(function(e){return _(`error.workbook.nameDuplicate`,{sheetName:e})}(e));t=(e=this._validateNewSheetName(e))?e.toLowerCase():null;let i=n.lastId+1;for(;!e;){let t=this._createSheetName(i),n=t.toLowerCase();r.has(n)?i++:e=t}return this._updateState({lastId:i}),e}_addSheet(e,t=null,n=null,r){t=this._nextSheetName(t);let i=this._getState(),a=this._createSheet(i.lastId,t,R.Visibility.Visible,n,void 0,null,r);if(!a)throw new h(_(`error.workbook.sheetNameBlank`));return e&&(this._tellSheets(),this._emitter.notify(`onSheetsChange`)),a}_createOpaqueSheet(e,t,n,i,a,o,s,c,l){let u=this,d=null;return d=new en({kind:o,id:l??t+`-`+r.uuidV4(),part:s,tabColor:c,styles:this._styles,transactions:this._transactions,workbook:this,container:{getName:()=>u._getSheetRef(d)?.name??t,setName:(e,t)=>{u._setSheetName(d,e,t)},getVisibility:()=>u._getSheetRef(d,R.Visibility.VeryHidden)?.visibility??R.Visibility.Visible,setVisibility:(e,t)=>{u._setSheetVisibility(d,e,t)},getIndex:()=>{let e=u._getSheetRef(d,R.Visibility.VeryHidden);return e?u._getOffsetForId(e.id,u._getSheetRefs(R.Visibility.VeryHidden)):-1},setIndex:(e,t)=>{let n=u._getSheetRef(d,R.Visibility.VeryHidden);n&&u._moveSheet(n,e,t)},requestSelect:()=>u._requestSelect(d),isAttached:()=>!!u._getSheetRef(d,R.Visibility.VeryHidden)}}),this._sheetOnNameChange.set(e,()=>d._notify(`onNameChange`)),this._sheetOnVisibilityChange.set(e,()=>d._notify(`onVisibilityChange`)),this._sheetOnIndexChange.set(e,()=>d._notify(`onIndexChange`)),this._addSheetRef({name:t,id:e,visibility:n??R.Visibility.Visible,sheetId:a,sheet:d},i),d}async _requestSelect(e){let t=this._transactions.getPendingTransaction(),n=t?this.getView().getActiveSheetId():null;return this._setSelectedSheet(e),t?(this._recordActiveSheet(t,n,this.getView().getActiveSheetId()),this.getSelectedSheet()===e):(await this._emitter.notify(`onRequestSelect`,{source:this,params:e,async:!0}),this.getSelectedSheet()===e)}_updateSheetRefStates(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this._initializing&&!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let t=e,n=[],r=[],i=t.length;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]);this._updateState({sheetRefsAll:t,sheetRefsVisible:n,sheetRefsVisibleAndHidden:r})}_tellSheets(){if(this._isLoadingSheets)return;let e=this._getState().sheetRefsAll;this._calculation._setSheets(e.map(e=>Q(e)?[e.sheet.getId(),e.name]:[e.sheet.getId(),e.name,!0]))}_addSheetRef(e,t=null){let n=this._getState(),r=n.sheetRefsAll,i=Math.max(0,Math.min(r.length,t??r.length)),a=[...r.slice(0,i),e,...r.slice(i)];this._updateSheetRefStates(a);let o=e.sheet,s=e.name.toLowerCase(),c=new Map(n.refsById);c.set(e.id,e);let l=new Map(n.refsByLowerCaseName);l.set(s,e);let u=new Map(n.refsByInstance);u.set(o,e);let d=new Map(n.sheetsById);d.set(e.id,o);let f=new Map(n.sheetsByLowerCaseName);f.set(s,o);let p=this,m=n.listenersSheets;if(o!==void 0){let t=o.addListeners({onBeforeDelete:e=>{p._validateDeleteSheet(e)},onDelete(e){let t=p._getSheetRef(e,R.Visibility.VeryHidden);if(!t)return;let n=p._beginCommit({description:_(`op.deleteSheet`,{name:t.name})});try{let r=p._getState(),i=r.sheetRefsAll,a=p._getOffsetForId(t.id,i),s=[...i];s.splice(a,1),p._updateSheetRefStates(s);let c=new Map(r.refsById);c.delete(t.id);let l=new Map(r.sheetsById);l.delete(t.id);let u=t.name.toLowerCase(),d=new Map(r.refsByLowerCaseName);d.delete(u);let f=new Map(r.sheetsByLowerCaseName);f.delete(u);let m=new Map(r.refsByInstance);m.delete(e),r.listenersSheets.get(t.id)();let h=new Map(r.listenersSheets);h.delete(t.id),p._adjustRemoveSelectionIfRequired(a,t.id),p._adjustSheetNamesIfRequired(),p._sheetOnNameChange.delete(t.id),p._sheetOnVisibilityChange.delete(t.id),p._sheetOnIndexChange.delete(t.id),p._tellSheets(),p._emitter.notify(`onSheetsChange`);let g=new Set(r.sheetsCreated);g.has(o)&&g.delete(o),p._updateState({refsById:c,sheetsById:l,refsByLowerCaseName:d,sheetsByLowerCaseName:f,refsByInstance:m,sheetsCreated:g,listenersSheets:h}),n.commit()}catch(e){throw n.rollback(),e}}},{transactional:!0}),r=Q(e)?e.sheet.addListeners({onSelectionChange:e=>{p.getView().getActiveSheetId()===p._getSheetRef(e)?.id&&p._emitter.notify(`onSelectionChange`,{source:p,params:e})}},{transactional:!1}):null;m=new Map(n.listenersSheets),m.set(e.id,()=>{t(),r?.()})}let h=n.lastId;h!==-1&&(h=Math.max(h,e.id)),this._updateState({lastId:h}),this._updateState({refsById:c,refsByLowerCaseName:l,refsByInstance:u,sheetsById:d,sheetsByLowerCaseName:f,listenersSheets:m}),this._adjustSheetNamesIfRequired();let g=new Set(this._getState().sheetsCreated);return g.add(e.sheet),this._updateState({sheetsCreated:g}),this._tellSheets(),e}_recordActiveSheet(e,t,n){let r=this.getView().getId();e.setIntent(yn,e=>({viewId:r,before:e?.before??t,after:n}))}_resyncActiveSheet(e,t){let n=t?.sheetRefsVisible;if(!n?.length)return;let r=-1,i=n.length;for(let t=0;t<i;t++)if(n[t].id===e){r=t;break}r===-1&&(r=Math.min(Math.max(this._activeSheetOffset,0),i-1));let a=n[r].id;this._view.getActiveSheetId()===a?this._activeSheetOffset=r:this._view.setActiveSheetId(a)}_adjustRemoveSelectionIfRequired(e,t){if(this._view.getActiveSheetId()===t){let t,n=this._getState().sheetRefsVisible;t=e<n.length?n[e].id:n[e-1].id,this._view.setActiveSheetId(t)}}_adjustSheetNamesIfRequired(){let e=this._getState(),t=e.lastId;if(t===-1)return;let n=this._view.getActiveSheetId();n??=(this._view.setActiveSheetId(t),t);let r=e.refsById.get(n);r||(this._view.setActiveSheetId(t),r=e.refsById.get(t),n=t),r.visibility===R.Visibility.Visible&&(this._activeSheetOffset=this._getOffsetForId(n,e.sheetRefsVisible))}_validateDeleteSheet(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let t=this._getSheetRef(e);if(!t)throw new h(function(e){return _(`error.workbook.deleteKey`,{key:e})}(e));let n=this._getState().sheetRefsVisible;if(n.length===1&&n[0].id===t.id)throw new h(_(`error.workbook.sheetOne`))}_getOffsetForId(e,t){let n=t.length;for(let r=0;r<n;r++)if(t[r].id===e)return r;throw new h(_(`error.workbook.noVisibleRefs`))}find(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=this._getWorksheets();if(t.length===0)return{next:()=>rt};if(t.length===1)return t[0].find(e);typeof e==`string`&&(e={text:e});let n=!e?.reverse,r=e?.disableWrap??!1,i=this._worksheetOffsetFrom(this.getSelectedSheetIndex(),t),a=i,s=t[a],c=!1;e={...e,disableWrap:!0};let l,u=s.find(e),d=u.next(),f=!1;if(e?.from){let t=this._rangesAddressToCoords(e?.from);l={colIndex:t[0].colStart,rowIndex:t[0].rowStart}}let p=o.createCellComparator(e?.axis,e?.reverse);delete(e={...e}).from;let m=()=>{if(!f&&d.done&&(c&&a===i?f=!0:n?(a++,a>t.length-1&&(a=0,c=!0)):(a--,a<0&&(a=t.length-1,c=!0)),r&&c&&(f=!0),f||l||!c||a!==i||(f=!0),!f)){s=t[a],u=s.find(e);let n=d;return d=u.next(),n}if(!f&&c&&a===i&&(d.done||!l||!d.done&&p(d.value.getCoords(),l)>=0)&&(f=!0),f){let e=d;return d=rt,e}let o=d;return d=u.next(),o};return{next:()=>{let e=m();for(;!f&&e.done;)e=m();return e}}}replace(e,t,n){let r=0,i=null,o=typeof t==`function`,s=n?.maxCount??2**53-1,c=!n?.maxCount,l=``,u=typeof t==`string`?Be(t):null,d=n?.description??a(`op.replace`),f=this._transactions.beginCommit({description:d});try{let d=null,p=null,m=e.next();for(;!m.done&&r<s;){let a=m.value,s=a.getWorksheet();s!==d&&(d=s,p!==null&&p.apply(),p=d.getEntireRange().createSparseBuilder({axis:n?.axis,allowUnorderedWrites:!0}));let c=o?t(a):t;c!==void 0&&c!==a&&(p.push(a,c),r++,i=a),m=e.next()}p?.apply(),r===1&&s===1&&i&&(l=i.getAddress()),r===0?f.rollback():f.commit({description:n?.description??(c?u===null?a(`op.replaceAll`):_(`op.replaceAllWith`,{value:u}):l?u===null?_(`op.replaceAt`,{address:l}):_(`op.replaceAtWith`,{address:l,value:u}):u===null?a(`op.replace`):_(`op.replaceWith`,{value:u}))})}catch(e){throw f.rollback(),e}return{count:r,last:i}}_nextSheetIndex(e,t=this._getSheetRefs()){let n=t.length;return n===1?0:(e===void 0&&(e=this.getSelectedSheetIndex()),(e=Math.max(0,Math.min(e,n-1)))>=n-1?0:e+1)}_prevSheetIndex(e,t=this._getSheetRefs()){let n=t.length;return n===1?0:(e===void 0&&(e=this.getSelectedSheetIndex()),(e=Math.max(0,Math.min(e,n-1)))<=0?n-1:e-1)}_worksheetOffsetFrom(e,t){let n=this._getSheetRefs(),r=n.length;for(let i=0;i<r;i++){let a=n[(e+i)%r];if(!Q(a))continue;let o=t.indexOf(a.sheet);if(o!==-1)return o}return 0}getNextSheet(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=this._getSheetRefs();return t[this._nextSheetIndex(e,t)]?.sheet??null}getPreviousSheet(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=this._getSheetRefs();return t[this._prevSheetIndex(e,t)]?.sheet??null}async _duplicateSheet(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let t=this._getSheetRefs(),n=this.getSelectedSheetIndex(),r=null;if(e){if(r=this._getSheetRef(e),!r)throw new h(ln(r))}else r=t[n];if(!r)return null;if(!Q(r))throw new h((i=r.name,_(`error.workbook.sheetNotDuplicable`,{sheetName:i})));var i;let a=r.sheet,o=t.indexOf(r),s=this._strings.beginPersist(),l=this.getResources().beginPersist(),u=this.getStyles().beginPersist(),d=this._richValues.beginPersist(),f=null,p=this.beginCommit(_(`op.duplicateNamed`,{name:a.getName()}));try{let e=this._getState().refsByInstance.get(a),n=await a.toJSON(),r=t.length+1,i=this.findValidSheetName(e.name),s=this._createSheet(r,i,e.visibility,o,void 0,n);this._tellSheets(),this._emitter.notify(`onSheetsChange`),f=s,p.commit()}catch(e){throw p.rollback(),e}finally{d.endPersist(),u.endPersist(),l.endPersist(),s.endPersist()}return f}_createRange(e,t){let n=e?{...e}:null,r=n?this._getSheetRef(n.scope,R.Visibility.VeryHidden):null;if(r&&!Q(r))throw new h(dn(r.name,r.sheet.getKind()));if(!r){let e=this._anchorWorksheet();return e?(delete n?.scope,_n(n,n?{scope:We,...e.getEntireRange().getCoords()}:null)):void console.warn(_(`error.workbook.noVisibleRefs`))}let i=r.sheet,a=null;return t&&(a={getOptions:t}),new xn(e,L(i),this,a)}_createRanges(e,t){let n=this._anchorWorksheet();if(!n)throw new h(fn(``,R.Kind.Worksheet));let r=null;return t&&(r={getOptions:t}),new bn(e,L(n),this,r)}getRange(e,t){if(e===void 0)return this.getSelectedRange(t);typeof e==`number`&&(e=Ae(arguments),t=void 0);try{let n=this._rangesAddressToCoords(e);if(n.length!==1)throw new h(_(`error.address.singleRangeOnlyAlt`));return this._createRange(n[0],t)}catch(t){throw t instanceof d?new d(t.message):new h(t.message??pt(e))}}getCell(e){if(e===void 0)return this.getSelectedCell();let t=this.getRange(e);if(t.size>1)throw new h(_(`error.address.singleCellOnly`));return t.getCell()}getRanges(e,t){let n=this._rangesAddressToCoords(e);if(n.length===0)throw new h(pt(e));return this._createRanges(n,t)}_createGraphRanges(e,t){let n=[],r=this.getCalculation()?.getNamedFormulas()??null;for(let e=0;e<t.length;e++){let i=t[e],a=i.sheetName?this._getSheetRef(i.sheetName,R.Visibility.VeryHidden):null,o=a&&Q(a)?a.sheet:this._anchorWorksheet();o&&n.push(new ut(i,r,L(o),null))}for(let t=0;t<e.length;t++)n.push(e[t]);let i=this._anchorWorksheet();return n.length!==0&&i?new bn(n,L(i),this,null):null}getAnomalies(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=nt(e),n=this._getWorksheets(R.Visibility.VeryHidden).map(e=>{let t=L(e);return{bounds:t.getSheet().getEntireCoords(),internal:t,qualified:!0}});return new Le(n,()=>(this.getSelectedWorksheet()??this._getWorksheets(R.Visibility.VeryHidden)[0]).getEntireRange(),t)}getStats(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=this._getWorksheets(R.Visibility.VeryHidden),n=t.length;if(n===1)return t[0].getStats(e);let r=Array(n);for(let i=0;i<n;i++)r[i]=t[i].getStats(e);return new Rt(r)}_activeRangeCoords(){let e=this._requireSelectedWorksheet(),t=e.getSelection().getRanges().getCoords(),n=e.getName(),r=t.length,i=Array(r);for(let e=0;e<r;e++){let r=t[e];i[e]={colStart:r.colStart,colEnd:r.colEnd,rowStart:r.rowStart,rowEnd:r.rowEnd,scope:n}}return i}getSelectedRange(e){return this.getRange(this._activeRangeCoords()[0],e)}getSelectedRanges(e){return this.getRanges(this._activeRangeCoords(),e)}getSelectedCell(){return this._requireSelectedWorksheet().getSelectedCell()}_rangesAddressToCoords(e,t=!0,n=R.Visibility.Hidden){if(!e)throw new h(_(`error.address.noAddress`));let r=this.getSelectedWorksheet(),i={...(r??this._anchorWorksheet())?.getEntireRange().getCoords()},a=r?.getName();if(a&&(i.scope=a),typeof e==`string`){let t=e.trim().toLowerCase();if(t===`r`||t===`c`){let n=this.getSelectedCell().getCoords(),r={};t===`r`?r.rowStart=r.rowEnd=n.rowIndex:r.colStart=r.colEnd=n.colIndex,e=r}}let o=this,s=$e(e,i,Ie,e=>{if(!t)return null;if(typeof e==`string`){let t=fe(e,{getTable:e=>ft(o.getNames().getByName(e)),getAnchor:()=>r?{sheet:r,coords:r.getSelectedCell().getCoords()}:null});if(t)return[t];let n=o.getNames().getByName(e)?.getRanges?.();if(n)return n.getCoords()}throw new h(`Invalid sheet reference '${e}'.`)}),c=s.length;for(let e=0;e<c;e++)this._validateCoords(s[e],n);return s}_validateCoords(e,t=R.Visibility.Visible,n=_(`error.sheet.oobRange`)){if(e===null)return;let r=this.getWorksheet(e.scope??void 0,t).getEntireRange().getCoords();if(!o.isRangeWithinRange(e,r))throw new d(n);if(e.rowEnd<e.rowStart||e.colEnd<e.colStart)throw new h(_(`error.address.invalidRangeInverted`))}_updateSheetRef(e,t){let n=this._getState(),r=[...n.sheetRefsAll];r[this._getOffsetForId(e.id,n.sheetRefsAll)]=t,this._updateSheetRefStates(r);let i=new Map(n.refsById);i.set(e.id,t);let a=e.name.toLowerCase(),o=t.name.toLowerCase(),s=new Map(n.refsByLowerCaseName);s.delete(a),s.set(o,t);let c=new Map(n.sheetsByLowerCaseName),l=c.get(a);c.delete(a),c.set(o,l);let u=new Map(n.refsByInstance);return u.set(l,t),this._updateState({refsById:i,refsByLowerCaseName:s,sheetsByLowerCaseName:c,refsByInstance:u}),this._tellSheets(),t}_setSheetName(e,t,n){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let r=this._getSheetRef(e);if(!r)throw new h(ln(e));if(t===r.name)return r.sheet;if((t=this._validateNewSheetName(t))==null)throw new h(_(`error.workbook.sheetNameNotProvided`));let i=Object.freeze({...r,name:t}),o=null,s=this.beginCommit(a(`op.renameSheet`));try{let e=this._updateSheetRef(r,i);this._adjustSheetNamesIfRequired(),this._sheetOnNameChange.forEach((e,t)=>{r.id===t&&e()}),this._emitter.notify(`onSheetsChange`),r.id===this.getView().getActiveSheetId()&&this._emitter.notify(`onSelectionChange`),o=e.sheet,s.commit(n)}catch(e){throw s.rollback(),e}return o}_setSheetVisibility(e,t=R.Visibility.Visible,n){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let r=this._getSheetRef(e,R.Visibility.VeryHidden);if(!r)return null;if(t===r.visibility)return;let i=null,o=``;t===R.Visibility.Visible?o=a(`op.unhideSheet`):t===R.Visibility.Hidden?o=a(`op.hideSheet`):t===R.Visibility.VeryHidden&&(o=a(`op.veryHideSheet`));let s=this.beginCommit(o);try{let e=this._getState().sheetRefsVisible;if(t!==R.Visibility.Visible&&e.length===1&&e[0].id===r.id)throw new h(_(`error.workbook.sheetOne`));let a={...r,visibility:t},o=-1;t!==R.Visibility.Visible&&(o=this._getOffsetForId(r.id,e)),i=this._updateSheetRef(r,a).sheet,t!==R.Visibility.Visible&&this._adjustRemoveSelectionIfRequired(o,r.id),this._adjustSheetNamesIfRequired(),s.commit(n)}catch(e){throw s.rollback(),e}return this._sheetOnVisibilityChange.forEach((e,t)=>{r.id===t&&e()}),this._emitter.notify(`onSheetsChange`),i}_moveSheet(e,t,n){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let r=null,i=this.beginCommit(_(`op.moveSheetNamed`,{name:e.name}));try{let a=this._getState(),o=a.sheetRefsVisible;if(t<0||t>o.length-1)throw new h(`Invalid to index: ${t}`);let s=this.getView().getActiveSheetId(),c=a.sheetRefsAll,l=this._getOffsetForId(e.id,c),u=this._getOffsetForId(o[t].id,c);if(l===u)return;let d=c[l],f=[...c];f.splice(l,1),f.splice(u,0,d),this._updateSheetRefStates(f),this._calculation._replaceSheetSpans?.(c.map(e=>e.sheet.getId()),f.map(e=>e.sheet.getId()),d.sheet.getId()),this._adjustSheetNamesIfRequired(),this._sheetOnIndexChange.forEach((e,t)=>{t>=l&&t<=u&&e()}),this._tellSheets(),this._emitter.notify(`onSheetsChange`),r=d.sheet,this._recordActiveSheet(i,s,this.getView().getActiveSheetId()),i.commit(n)}catch(e){throw i.rollback(),e}return r}_setSelectedSheet(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=this._getSheetRef(e);if(!t)throw new h(ln(e));let n=null;return t.visibility!==R.Visibility.Visible&&this._setSheetVisibility(t,R.Visibility.Visible),this._view.setActiveSheetId(t.id),n=t.sheet,n}getProtection(){return this._protection}getProperties(){return this._documentProperties}getCodeName(){return this._codeName}getNames(){return this._names}getCalculation(){return this._calculation}getFonts(){return dt.getShared()}createFormula(e,t,n){return this.getCalculation().createFormula(e,t,n)}evaluate(e,t){return this.getCalculation().evaluate(e,t)}async whenCalculationReady(){let e=this._starting;return e?e.then(()=>this.getCalculation().ready()):this.getCalculation().ready()}whenFontsReady(){return this.getFonts().whenReady()}async whenReady(){await Promise.all([this.whenCalculationReady(),this.whenFontsReady()])}getScripts(){return this._scripts||=this._createScripts(),this._scripts}getModules(){return this.getScripts().getModules()}_notifyAllChange(){this._emitter.notify(`onSheetsChange`),this._emitter.notify(`onSelectedSheetChange`),this._emitter.notify(`onViewChange`)}addListeners(e,t){return this._emitter.addListeners(e,t)}_sheetToWBEvent(e){let t=this,n=e=>{if(e.isInvalid())return e;let n=e.getWorksheet().getName();if(e.isICellRanges){let r=e.getCoords().map(e=>e.scope?e:{...e,scope:n});return t.getRanges(r)}let r=e.getCoords();return t.getRange(r.scope?r:{...r,scope:n})};return t=>{e({getSource:()=>n(t.getSource()),getRanges:()=>{let e=t.getRanges();return e?n(e):null},getPreviousAddress:()=>t.getPreviousAddress(),getEdits:()=>t.getEdits(),getTrigger:()=>t.getTrigger(),isUndo:()=>t.isUndo(),getCommit:()=>t.getCommit(),toString:()=>`WorkbookRangeEvent: ('${t.getTrigger()}', ${n(t.getSource()).toString()})`,getTimeStamp:()=>t.getTimeStamp()})}}_holdPivotCaches(){let e=this._pivotCaches;if(e.length===0)return;let t=e=>{let t=this._getSheetRef(e),n=t&&Q(t)?t.sheet:null;return n?n._contentAddWatch(()=>null):null},n=e=>{for(let t of this._getSheetRefs(R.Visibility.VeryHidden)){if(!Q(t))continue;let n=t.sheet;if(n.getTables().getByName(e))return n._contentAddWatch(()=>null)}return null},r=(e,t)=>{let n=this._getSheetRef(e);return n&&Q(n)?n.sheet.getRange(t):null},i=e=>{for(let t of this._getSheetRefs(R.Visibility.VeryHidden)){if(!Q(t))continue;let n=t.sheet.getTables().getByName(e);if(n)return n}return null},a=(e,t)=>{let n=this._pivotSourceNamed(e,t)?.getValue(),i=typeof n==`string`?F(n):null;return i&&/^\$?[A-Za-z]+\$?\d+(?::\$?[A-Za-z]+\$?\d+)?$/.test(i.reference)?r(i.sheet,i.reference.replaceAll(`$`,``)):null};for(let o=0;o<e.length;o++)this._getState().pivotCacheData.has(e[o].cacheId)&&(e[o]._hold(t,n),e[o]._watchSource(r,i,a))}_pivotCacheStore(e){return{get:()=>this._getState().pivotCacheData.get(e),set:t=>{this._updateState(n=>({...n,pivotCacheData:new Map(n.pivotCacheData).set(e,t)}),a(`op.refreshPivotTable`))}}}_getPivotCache(e){return this._getState().pivotCacheData.has(e)?this._pivotCaches.find(t=>t.cacheId===e)??null:null}_pivotSourceOf(e,t){if(e.isITable)return{name:e.getName()};let n=null;if(typeof e==`string`){for(let t of this._getSheetRefs(R.Visibility.VeryHidden))if(Q(t)&&t.sheet.getTables().getByName(e))return{name:e};if(this.getNames().getByName(e))return{name:e};if(t.getNames().getByName(e)?.getScope())return{name:e,sheet:t.getName()};let r=F(e),i=r?this._getSheetRef(r.sheet):null;if(r&&(!i||!Q(i)))return null;try{n=r?i.sheet.getRange(r.reference):t.getRange(e)}catch(e){if(!(e instanceof h))throw e;return null}}else n=e.isICellRange?e:t.getRange(e);if(!n||n.isInvalid())return null;let{rowStart:r,colStart:i,rowEnd:a,colEnd:o}=n.getCoords();return{ref:Qe({rowStart:r,colStart:i,rowEnd:a,colEnd:o}),sheet:n.getWorksheet().getName()}}_findPivotCache(e){let t=(e,t)=>(e??``).toLocaleLowerCase()===(t??``).toLocaleLowerCase();return this._pivotCaches.find(n=>{if(!this._getPivotCache(n.cacheId)||!n._getData().model||n._isStale())return!1;let r=n._getSource();return!!r&&t(r.ref,e.ref)&&t(r.sheet,e.sheet)&&t(r.name,e.name)})??null}_addPivotCache(e){let t=this._pivotCaches.reduce((e,t)=>Math.max(e,t.cacheId),-1)+1,n=this._pivotCacheStore(t);n.set({part:null,model:e,partFormats:null,source:null});let r=new Y(t,n);return this._pivotCaches.push(r),this._holdPivotCaches(),r}async _refreshPivotCaches(e,t){let n=[];for(let t of this._getSheetRefs(R.Visibility.VeryHidden))if(Q(t))for(let r of t.sheet.getPivotTables().getItems())e.has(r.getCacheId())&&n.push(r);for(let e of n)e._assertRefreshAllowed();for(let r of e){let e=this._getPivotCache(r),i=e?await this._pivotSourceRangeOf(e._getSource()):null;if(!e||!i)throw new h(_(`error.pivotTable.refreshSourceUnsupported`));if(i.getRowCount()<2)throw new h(_(`error.pivotTable.refreshSourceTooSmall`));i.getWorksheet()._cellBuffer?.release();let a=e.toJSON();if(!a.fields)throw new h(_(`error.pivotTable.refreshSourceUnsupported`));let{model:o,remap:s}=t.refreshPivotCache(a,t.readPivotSource(i),e._getSource()??void 0,this._isDate1904);e._replace(o);for(let e of n)e.getCacheId()===r&&e._remapCache(s,t)}for(let e of n)await e._prepareRelayout(t);for(let e of n)e._refresh(t)}async _refreshPivotCachesOnLoad(){let e=this._pivotCaches.filter(e=>!!e._getData().model?.refreshOnLoad);if(e.length===0)return;let t=await at.load();for(let n of e){if(this._closed)return;try{await this._transactions.doBatch(()=>this._refreshPivotCaches(new Set([n.cacheId]),t))}catch(e){if(!(e instanceof h||e instanceof c))throw e}}}async _pivotSourceRangeOf(e){if(!e)return null;if(e.ref){if(!e.sheet||e.ref.includes(`#REF!`))return null;let t=this._getSheetRef(e.sheet);return t&&Q(t)?t.sheet.getRange(e.ref):null}if(!e.name)return null;if(!e.sheet)for(let t of this._getSheetRefs(R.Visibility.VeryHidden)){if(!Q(t))continue;let n=t.sheet.getTables().getByName(e.name);if(!n||n.isDeleted())continue;let{rowEnd:r}=n.getDataRange().getCoords();return t.sheet.getRange({...n.getRange().getCoords(),rowEnd:r})}let t=await this._pivotSourceNamed(e.name,e.sheet??null)?.evaluate(),n=t?.isIReferenceRange?t.getCoords():null;if(!n?.scope)return null;let r=this._getSheetRef(n.scope);return r&&Q(r)?r.sheet.getRange(n):null}_pivotSourceNamed(e,t){if(!t)return this.getNames().getByName(e);let n=this._getSheetRef(t);if(!n||!Q(n))return null;let r=n.sheet.getNames().getByName(e);return r?.getScope()?r:null}_holdPivotSlicers(){let e=(e,t)=>{let n=this._getSheetRef(e);return(n&&Q(n)?n.sheet:null)?.getPivotTables().getByName(t)??null};for(let t of this._getSheetRefs(R.Visibility.VeryHidden)){if(!Q(t))continue;let n=t.sheet.getMovables().getItems();for(let t=0;t<n.length;t++){let r=n[t].getContent();r.isISlicer&&r._holdPivotTables(e)}}}_fromJSON(e,t){if(this._emitter.notify(`onBeforeLoad`,{params:e}),this._initState(),!e.sheets||e.sheets.length===0)throw new h(_(`error.workbook.sheetOne`));e.theme&&(this._theme=new Ze(e.theme),this._styles.setTheme(this._theme));let n=this._strings.beginPersist(),r=this._resources.beginPersist(),i=this._styles.beginPersist(),a=this._richValues.beginPersist();try{n.fromJSON(e.strings),r.fromJSON(e.resources),this._fetch.adopt(this._resources.getItems()),i.fromJSON(e.styles),a.fromJSON(e.richData,{resources:this._resources,strings:this._strings,fromResourceId:e=>r.fromResourceId(e)??null},e.richTypes),e.date1904&&(this._isDate1904=!0),this._codeName=e.codeName??null,this._updateLinks=e.updateLinks??null,this._hiddenPivotFieldList=!0===e.hiddenPivotFieldList,this._documentProperties.fromJSON(e.properties),e.locale&&(this._locale=e.locale),e.localeOverrides&&(this._localeOverrides=e.localeOverrides),e.view||={};let o=[],s=new Map,c=e.pivotCaches;if(c){let e=r.fromResourceId.bind(r);for(let t=0;t<c.length;t++){let n=c[t];n&&typeof n.cacheId==`number`&&!s.has(n.cacheId)&&s.set(n.cacheId,Y.dataOf(n,e))}}this._updateState({pivotCacheData:s});for(let e of s.keys())o.push(new Y(e,this._pivotCacheStore(e)));this._pivotCaches=o,this._people.fromJSON(e.people);let l=e.sheets,u=l.length,d=e.view.activeSheetId??null;d!==null&&(d=Math.min(Math.max(0,d),u-1));let f=null,p=null;this._isLoadingSheets=!0;for(let e=0;e<u;e++){let n=l[e],i=n.visibility||R.Visibility.Visible,a=e;p=a,i===R.Visibility.Visible?f===null&&(f=a):d!==null&&d===a&&(d=null);try{let o=n.kind??R.Kind.Worksheet;if(o!==R.Kind.Worksheet){let s=n.sheet,c=P.fromJSON(s?.part,r.fromResourceId.bind(r));if(!c)throw new h(_(`error.workbook.sheetPartMissing`,{sheetName:n.name}));this._createOpaqueSheet(a,n.name,i,e,n.sheetId,o,c,s?.tabColor??null,t?.[e])}else this._createSheet(a,n.name,i,e,n.sheetId,n.sheet,t?.[e])}catch(e){throw this._isLoadingSheets=!1,e}}this._isLoadingSheets=!1,this._tellSheets(),this._holdPivotCaches(),this._holdPivotSlicers();for(let e of this._getSheetRefs(R.Visibility.VeryHidden))Q(e)&&e.sheet._tellPivots();this._updateState({lastId:p}),e.view.activeSheetId=d??f,this.setView(new nn({json:e.view})),this._adjustSheetNamesIfRequired(),this._listenerProtection?.();let m=this;this._protection=new an(e?.protection,this._options?.readonly),this._listenerProtection=this._protection.addListeners({onChange:e=>{m._emitter.notify(`onProtectionChange`,{source:e})}}),this._emitter.notify(`onLoad`)}finally{a.endPersist(),i.endPersist(),r.endPersist(),n.endPersist()}}async _startFunctions(){let e=this._scripts;if(!e)return r.EmptyArray;await e._load();let t=[];for(let n of e.getModules().getItems())this._startModules.add(n),t.push(...n.getFunctions().getItems({type:`formula`,includeHidden:!0}));return t}_createScripts(e){let t=this;return new Wt({transactions:this._transactions,json:e,workbook:t,getBuiltInFunctions:()=>t._calculation?.getFunctions(),onAdd:(e,n)=>{let r=t._calculation;r.getStatus()!==Pe.Status.Off&&r.start().then(async()=>{if(t._startModules.has(n))return;let e=n.getFunctions().getItems({type:`formula`,includeHidden:!0}),r=e.length;for(let t=0;t<r;t++){let n=e[t];try{await this._calculation.getFunctions().add(n)}catch(e){m.error(e?.message??String(e),e)}}}).catch(()=>{})},onRemove:(e,t)=>{}})}async toJSON(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));await Promise.resolve(this._starting);let t=this.getCalculation();t.getStatus()!==Pe.Status.Off&&(await t.ready(),await t._whenRequestsSettled?.()),await this._emitter.notify(`onBeforeSave`,{async:!0});let n={sheets:[]},r=e?.ignoreStyles??!1;if(!r){let e=this._theme.toJSON();(e?Object.keys(e).length:0)>0&&(n.theme=e)}if(this._scripts){let e=this._scripts.toJSON();e&&Object.keys(e).length>0&&(n.modules=e)}this._isDate1904&&(n.date1904=!0),this._codeName&&(n.codeName=this._codeName),this._updateLinks&&(n.updateLinks=this._updateLinks),this._hiddenPivotFieldList&&(n.hiddenPivotFieldList=!0);let i=this._documentProperties.toJSON();Object.keys(i).length>0&&(n.properties=i),this._locale&&(n.locale=this._locale),this._localeOverrides&&(n.localeOverrides=this._localeOverrides);let a=e?.resources??`embed`,o=a===`ignore`,s=this._strings.beginPersist(),c=o?null:this._resources.beginPersist(),l=this._styles.beginPersist(),u=this._richValues.beginPersist();try{let t=this._getSheetRef(this.getSelectedSheetIndex()).id,i=t,d=null,f=this._getState(),p=f.sheetRefsAll,m=f.sheetsById,h=p.length;for(let r=0;r<h;r++){let a=p[r],o=r+1,s,l=m.get(a.id);if(Q(a))s={name:a.name,sheet:await a.sheet.toJSON(e)};else{let e=l,t=c?c.toResourceId.bind(c):()=>null,n={part:P.toJSON(e._getPart(),t)},r=e.getTabColor();r&&(n.tabColor=r.toString()),s={name:a.name,kind:e.getKind(),sheet:n}}a.sheetId!==void 0&&(s.sheetId=a.sheetId),a.visibility===R.Visibility.Visible?d===null&&(d=o):s.visibility=a.visibility,a.id===t&&(i=o),n.sheets.push(s)}if(!r){let e=l.toJSON();e&&Object.keys(e).length>0&&(n.styles=e)}let g=this.getProtection().toJSON();g&&(n.protection=g);let _=this._calculation.toJSON();Object.keys(_).length>0&&(n.calc=_);let v=await s.toJSONAsync();v&&v.length>0&&(n.strings=v);let y=await u.toJSONAsync(c?c.toResourceId.bind(c):void 0);if(y.length>0){n.richData=y;let e=u.toKindsJSON();e.length>0&&(n.richTypes=e)}let b=this._calculation.getExternalBooks().toJSON();b&&(n.externalBooks=b);let x=this._pivotCaches;if(x.length>0){let e=c?c.toResourceId.bind(c):()=>null,t=new Set;for(let e of this.getPivotTables())t.add(e.getCacheId());let r=ge(this);for(let e=0;e<r.length;e++){let n=r[e].toJSON()?.pivot?.cacheId;n!==void 0&&t.add(n)}let i=[];for(let n=0;n<x.length;n++)t.has(x[n].cacheId)&&i.push(x[n].toJSON(e));i.length>0&&(n.pivotCaches=i)}let S=this._people.toJSON();if(S&&(n.people=S),!o){let e=await c.toJSONAsync(typeof a==`function`?a:void 0);e&&e.length>0&&(n.resources=e)}let C=this._calculation.getNamedFormulas().toJSON();C&&C.length>0&&(n.names=C);let w=this._view.toJSON();w&&(i===d?delete w.activeSheetId:w.activeSheetId=i,Object.keys(w).length>0&&(n.view=w))}finally{u.endPersist(),l.endPersist(),o||c.endPersist(),s.endPersist()}return this._emitter.notify(`onSave`,{params:n}),n}isClosed(){return this._closed}close(){if(this._closed)return;this._emitter.notify(`onClose`);let e=this._getState();e.listenersSheets.forEach(e=>{e()}),e.listenersSheets.clear();let t=e.sheetRefsAll;for(let e=t.length-1;e>=0;e--)try{t[e].sheet.close()}catch(e){console.warn(`error on close`,e)}this._ownResources,this._ownNames&&this._names.close(),this._ownCalculation&&this._calculation.close(),this._ownStyles,this._transactionsRemoveListener?.(),this._listenerLanguage?.(),this._listenerOrigin?.(),this._listenerOriginProvider?.(),this._ownOriginProvider&&this._originProvider instanceof St&&this._originProvider.release(),this._closed=!0}beginCommit(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));return this._beginCommit(typeof e==`string`?{description:e}:e)}doBatch(e,t){let n=this;t=typeof t==`string`?{description:t}:{description:a(`op.updateWorkbook`),...t};let r=y.bind(this._transactions,this,e);return this._transactions.doBatch(r.callback,{...t,onChildCommit:r.onChildCommit},(e,t)=>{r.close(),e.getDepth()===0&&(n._lastTransactionUUID=e.getId())})}_beginCommit(e){let t=this;return this._transactions.beginCommit(typeof e==`string`?{description:e}:e,e=>{e.getDepth()===0&&(t._lastTransactionUUID=e.getId())})}_getState(){return this._transactions.getState(this._id)}_updateState(e,t=a(`op.updateWorkbook`),n){if(!e)return;let r=this._beginCommit(t);try{r.updateState(this._id,e),r.commit(n)}catch(e){throw r.rollback(),e}}get options(){return this._options}get[Symbol.toStringTag](){return`[Workbook]`}toString(){return`[${this.getName()??`(untitled)`}]`}get isIWorkbook(){return!0}},wn={address:null},Q=e=>e.sheet.getKind()===R.Kind.Worksheet,Tn=class{constructor(){this._readFormats=[],this._writeFormats=[],this._encryptions=[]}async registerReadFormat(e){this._readFormats=await this._registerFormatType(e,this._readFormats)}async registerWriteFormat(e){this._writeFormats=await this._registerFormatType(e,this._writeFormats)}async registerEncryption(e){if(!e)throw Error(`encryption must be provided.`);if(!e.key)throw Error(`encryption.key must be provided.`);let t=e.key.toLowerCase(),n=this._encryptions.findIndex(e=>e.key.toLowerCase()===t);if(n!==-1){let t=[...this._encryptions];t[n]=e,this._encryptions=Object.freeze(t)}else this._encryptions=Object.freeze([...this._encryptions,e])}async getEncryption(e){return this.peekEncryption(e)}peekEncryption(e){if(!e)return this._encryptions[0]??null;let t=e.toLowerCase();return this._encryptions.find(e=>e.key.toLowerCase()===t)??null}async detectEncryption(e){for(let t of this._encryptions)if(await t.detect(e))return t;return null}async getReadFormats(e){return e?this._filterFormats(e,this._readFormats):[...this._readFormats]}async getWriteFormats(e){return this._writeFormats?e?this._filterFormats(e,this._writeFormats):[...this._writeFormats]:[]}async _registerFormatType(e,t){return this._registerFormatTypeSync(e,t)}_registerFormatTypeSync(e,t){if(!e)throw Error(`format must be provided.`);if(!e.key)throw Error(`format.key must be provided.`);let n=e.key.toLowerCase(),r=t.findIndex(e=>e.key.toLowerCase()===n);if(r!==-1){let n=[...t];return n[r]=e,Object.freeze(n)}return Object.freeze([...t,e])}_filterFormats(e,t,n){if(!e||Object.keys(e).length===0){if(!n)return[...t];e={ext:n}}let r=e.search?.toLocaleLowerCase();return t.filter(t=>{if(r){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);if(!(e||n||i||a||o))return!1}let i=e.ext||n;if(i){let e=i.toLocaleLowerCase();if(!t.exts.some(t=>t.toLocaleLowerCase()===e))return!1}if(e.mimeType&&t.mimeType!==e.mimeType||e.key&&t.key.toLocaleLowerCase()!==e.key.toLocaleLowerCase())return!1;if(e.tags){let n=t.tags||[];if(!(typeof e.tags==`string`?[e.tags]:e.tags).every(e=>n.includes(e)))return!1}return!0})}},$=new WeakMap,En=e=>!!e&&typeof e==`object`&&typeof e.getPath==`function`&&typeof e.canWrite==`function`,Dn=new class{constructor(){this._setInstalled=new WeakSet,this._backingStore=null,this._emitter=new b(this),this._registry=new Tn,this._defaultStore=new wt(()=>this.getWriteFormats(),()=>this.getReadFormats())}getBackingStore(){return this._backingStore??this._defaultStore}setBackingStore(e){this._backingStore=e??null}canWrite(){return typeof this.getBackingStore().write==`function`}canRead(){return typeof this.getBackingStore().read==`function`}async install(e){this._setInstalled.has(e)||(await e.register(this._registry),this._setInstalled.add(e))}addListeners(e,t){return this._emitter.addListeners(e,t)}addCommitListener(e){return this._emitter.addListeners({onWrite:(t,n)=>{n.save&&e.onCommit?.({store:n.workbook.getTransactions(),commitId:n.commitId})}})}async getReadFormats(e){return this._registry.getReadFormats(e)}async getWriteFormats(e){return this._registry.getWriteFormats(e)}getOrigin(e){return new H(e)}async read(e){let t=null;if(typeof e==`string`)e={source:e};else if(En(e)){let n=e.getPath();if(!n)throw Error(`Cannot read from an unbound origin (no path).`);bt(e)?e={source:n,asCopy:!0}:(t=e,e={source:n})}let n=e??{},{source:r=null,...i}=n,a=this.getBackingStore();return(a.read?a:this._defaultStore).read({source:r,options:i,decode:(e,r)=>this._decodeBuffer(e,r,n,t)})}async _decodeBuffer(e,t={},n,r=null){let i=t.format,a=t.ext;if(!i&&!a)throw Error(`Either format or file extension must be provided to determine read type.`);let o=(await this._registry.getReadFormats(i?{search:i}:{ext:a}))[0];if(!o)throw new h(_(`error.io.readFormatUnavailable`,{format:i??a}));let s=n?.typedCreateWorkbookOptions,c=s?Object.keys(s).find(e=>e.toLowerCase()===o.key.toLowerCase()):void 0,l={...n,...c===void 0?void 0:s[c]};delete l.typedCreateWorkbookOptions,delete l.source,delete l.asCopy;let u=r??new H(t.absolutePath??null,{name:t.name??null,format:o.key,size:t.size??null,lastModified:t.lastModified??null,canWrite:t.canWrite??!1});r instanceof H&&r.update({format:o.key,size:t.size??null,lastModified:t.lastModified??null}),l.createWorkbookOptions={...l.createWorkbookOptions||{},origin:u},l.readonly!==void 0&&(l.createWorkbookOptions={readonly:l.readonly,...l.createWorkbookOptions},delete l.readonly),l.calcOnly&&(l.createWorkbookOptions={disableLoadAutoFit:!0,...l.createWorkbookOptions});let d=await this._decrypt(e,u,l);if(d===null)return null;e=d.bytes;let f=l?.progress?.onStart?.bind(l.progress);f&&await Promise.resolve(f(u,t.size));try{let t=await this._readArrayBuffer(e,o,l);return d.password!==null&&u.setPassword(d.password),l?.progress?.onComplete?.(u),this._emitter.notify(`onRead`,{params:{workbook:t,origin:u},transactional:!1}),t}catch(e){throw l?.progress?.onError?.(e),l?.progress?.onComplete?.(null),e}}async _decrypt(e,t,n){let r=await this._registry.detectEncryption(e);if(t instanceof H&&t.update({encryption:r?r.key:null}),!r)return{bytes:e,password:null};let i=null,a=async t=>{try{return i=await r.decode(e,t),!0}catch(e){if(!(e instanceof f))throw e;return!1}};if(n?.password&&await a(n.password))return{bytes:i,password:n.password};if(!n?.onPassword){let e=t.getName();throw new l(e?_(`error.io.passwordRequired`,{name:e}):_(`error.io.passwordRequiredUnnamed`))}let o=await Promise.resolve(n.onPassword({origin:t,encryption:r.key,validate:a}));if(o==null)return null;if(i!==null||await a(o))return{bytes:i,password:o};throw new f(_(`error.io.passwordIncorrect`))}async writeArrayBuffer(e,t){if(!t?.format)throw Error(`A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).`);let n=(await this._registry.getWriteFormats({search:t.format}))[0];if(!n)throw new h(_(`error.io.writeFormatUnavailable`,{format:t.format}));return this._writeArrayBuffer(e,n,t)}async write(e,t,n){return typeof t==`string`||En(t)?this._write(e,t,!1,n):this._write(e,e?.getOrigin?.(),!0,t??n)}async writeAs(e,t,n){if(!t)throw Error(`A target must be provided for writeAs (use write(workbook) for a plain save).`);return this._write(e,t,!0,n)}async _write(e,t,n,r){if(!e)throw Error(`Workbook must be provided.`);if(!e.isIWorkbook)throw Error(`Invalid workbook model provided. Must be an instance of IWorkbook.`);let i=typeof t==`string`?this.getOrigin(t):t,a=i.getFormat(),o;if((r?.format||a)&&(o=(await this._registry.getWriteFormats({search:r?.format??a??void 0}))[0]),o||i.getPath()&&i.canWrite()&&i.getExtension()||(o=(await this._registry.getWriteFormats({ext:`sxl`}))[0]??(await this._registry.getWriteFormats())[0]),!o)throw new h(_(`error.io.writeFormatUnresolved`));let s=i.getExtension();if(r?.format&&s&&i.getPath()&&i.canWrite()&&!o.exts.includes(s)){let e=(await this._registry.getWriteFormats({ext:s}))[0];if(e&&e.key!==o.key){let e=i.getPath().split(/[/\\]/).pop();throw new h(_(`error.io.writeFormatMismatch`,{format:r.format,file:e}))}}if(typeof t==`string`){let e=i.getPath();i=new H(B(e)?e:`${e}.${o.exts[0]}`,{format:o.key})}let c=i.getEncryption(),u=e.getOrigin?.(),d=(i instanceof H?i.getPassword():null)??(u instanceof H?u.getPassword():null),f=i.isEncrypted()||(u?.isEncrypted()??!1),p=r?.password===void 0?d??(f?void 0:null):r.password,m=null;if(p===void 0){if(f){let e=i.getName();throw new l(e?_(`error.io.passwordRequiredSave`,{name:e}):_(`error.io.passwordRequiredSaveUnnamed`))}}else if(p!==null&&(m=await this._registry.getEncryption(c),!m))throw new h(_(`error.io.encryptionUnavailable`));let g=`${i.getName()??_(`workbook.defaultName`)}.${o.exts[0]}`,v=r?.progress,y=!i.getPath()||!i.canWrite()||!!r?.prompt,b=!1,x=this,S=null,C=[],w={workbook:e,format:o,formatNamed:!!r?.format,origin:i,suggestedName:g,prompt:r?.prompt,async encode(t,a){let s=a??i;await(async e=>{b||(b=!0,v?.onStart&&await Promise.resolve(v.onStart(e)))})(s),S=e.getTransactions?.()?.getCurrentCommit()??S;let c=t?(await x._registry.getWriteFormats({search:t}))[0]??o:o,l=[],u=((e,t)=>({onStart:e?.onStart?(t,n)=>e.onStart(t,n):void 0,onProgress:e?.onProgress?(t,n)=>e.onProgress(t,n):void 0,onError:e?.onError?t=>e.onError(t):void 0,onComplete:e?.onComplete?t=>e.onComplete(t):void 0,onWarning:(n,r)=>{t.push({message:n??``,context:r}),e?.onWarning?.(n,r)}}))(v,l),d=await x._writeArrayBuffer(e,c,{...r,progress:u}),f=$.get(s);if(l.some(e=>!f?.has(e.message))&&r?.onWarnings){let t=await Promise.resolve(r.onWarnings({workbook:e,origin:s,warnings:l,save:n,canCancel:!y}));if(!y&&!1===t)return null}return C=l,m?m.encode(d,p):d}},T=null;try{let t=this.getBackingStore();if(!t.write)throw Error(`The active backing store is read-only (no write implementation).`);if(T=await t.write(w),T){if(p!==void 0&&T instanceof H&&(T.setPassword(p),T.update({encryption:m?m.key:null})),C.length){let e=$.get(T)??new Set;for(let t of C)e.add(t.message);$.set(T,e)}n&&T!==e.getOrigin()&&bt(e.getOrigin())?.setOrigin(T);let t=S??e.getTransactions?.()?.getCurrentCommit()??null;this._emitter.notify(`onWrite`,{params:{workbook:e,origin:T,commitId:t?.getId()??null,save:n},transactional:!1})}v?.onComplete&&await Promise.resolve(v.onComplete(T))}catch(e){let t=e instanceof Error?e:Error(String(e));throw v?.onError&&await Promise.resolve(v.onError(t)),v?.onComplete&&await Promise.resolve(v.onComplete(null)),t instanceof h?t:Error(_(`error.io.writeFailed`,{reason:t.message}),{cause:e})}return T}_stripExtension(e){let t=B(e);return t?e.slice(0,e.length-t.length-1):e}_baseName(e){if(!e)return null;let t=e.split(/[?#]/)[0],n=t.split(/[/\\]/).pop()??t;return this._stripExtension(n)||null}async _writeArrayBuffer(e,t,n){if(!t)throw Error(`A write format must be provided.`);let r=t.handler;if(!r)throw Error(`Unable to resolve a write handler for '${t.key}'.`);return Ve(t.key)||await z.assertUsable(`exports`,0),r(e,{...n,format:t.key})}async _readArrayBuffer(e,t,n){if(!e)throw Error(`ArrayBuffer must be specified.`);if(!t)throw Error(`format must be specified.`);if(e.byteLength===0)return new Cn(n?.createWorkbookOptions);let r=t.handler;if(!r)throw Error(`Unable to resolve a read handler for '${t.key}'.`);let i;try{i=await r(e,n)}catch(e){throw e instanceof h?e:new h(_(`error.io.readFailed`,{format:t.description??t.key,reason:e?.message??String(e)}),{cause:e})}return await Ee(),i}get isIWorkbookIO(){return!0}},On=[`.woff2`,`.woff`,`.ttf`,`.otf`,`.ttc`,`.otc`].map(e=>({suffix:e,place:(e,t)=>t?`${t}/${e}`:e})),kn={suffix:`.metrics.json`,async extract(e){let t=await e.readJson();return t?.format===`sheetxl-font-metrics/1`?{family:t.family,weight:t.weight,italic:t.italic}:null},place:(e,t)=>t?`${t}/${e}`:e};[kn.place,kn.place,...On];var An;An||={};var jn,Mn,Nn;jn||={},(Mn||={}).Type={Button:`button`,CheckBox:`checkBox`,OptionButton:`optionButton`,ListBox:`listBox`,DropDown:`dropDown`,ScrollBar:`scrollBar`,Spinner:`spinner`,GroupBox:`groupBox`,Label:`label`,EditBox:`editBox`,Dialog:`dialog`,Unknown:`formControl`},(Nn||={}).DropStyle={Combo:`combo`,ComboEdit:`comboEdit`,Simple:`simple`};export{Ht as a,yt as c,Dt as d,Dn as f,Qt as i,Cn as l,H as n,$t as o,Pt as p,gt as r,Z as s,Ft as t,J as u};
|