@sheetxl/studio-vanilla 0.7.28-beta.1 → 0.7.28-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/{Dbl2A7TmMPREP_KG.cjs → B2cX7nid45K1XRcB.cjs} +1 -1
- package/browser/cjs/{T7_onhE6Jrpob9tI2.cjs → BCax8eUosvZxqJum2.cjs} +1 -1
- package/browser/cjs/{CK2JeifKkJzOm0o92.cjs → BDSt3etlKFP344pX2.cjs} +1 -1
- package/browser/cjs/{DF0hku8nbQSV3M-j2.cjs → BHpypCDUD5cP3vR92.cjs} +1 -1
- package/browser/cjs/{D60W9LgbU6Bi_PzU.cjs → BIcGM64pW8jzwXoR.cjs} +1 -1
- package/browser/cjs/{DW8_bnb11oQKDj662.cjs → BQEk2bmRsrTs-zJu2.cjs} +3 -3
- package/browser/cjs/{Dmi2hSyQu_Js-GEu.cjs → BW4gFAFA5vc1x_8G.cjs} +1 -1
- package/browser/cjs/{DfgKbLE2Zvp8mcF7.cjs → BYp7-QW_AGEONvMr.cjs} +1 -1
- package/browser/cjs/{ByYBv7ERPfiCLOep.cjs → Bq7bgCz2WfVwfQSv.cjs} +2 -2
- package/browser/cjs/{CEKe4OJVmivE8S6J2.cjs → BzvKaJw-3G3FMhao2.cjs} +1 -1
- package/browser/cjs/C1tO7v57UD8xmj2X.cjs +86 -0
- package/browser/cjs/C9K6gYebhUCoGcyy.cjs +5 -0
- package/browser/cjs/{yy-Vk4KWt1Zu2vkd.cjs → CN8lXPB3rJ4Ux6jN.cjs} +1 -1
- package/browser/cjs/{9jOdey6595kpc4f_2.cjs → CObKFza7rEOQcteD2.cjs} +1 -1
- package/browser/cjs/CcBPECGj-X0W9a3_.cjs +3 -0
- package/browser/cjs/{BJcTL0FyQfZaEmdT2.cjs → ChMPHLE_jFKu0JmZ2.cjs} +1 -1
- package/browser/cjs/{DqDDTZZVqW3IbjXy.cjs → CtEazH3mA0Tj8qrG.cjs} +1 -1
- package/browser/cjs/{DzFomdBHjGaNmf9k.cjs → CxY5iqVeCdKKTzDq.cjs} +1 -1
- package/browser/cjs/{BmKOnx8nv-NTlFiI.cjs → D2KFRZ75pzopfyVC.cjs} +1 -1
- package/browser/cjs/{nE4y6hua6AwWSil72.cjs → D6cjnwWR_iUSe1f62.cjs} +1 -1
- package/browser/cjs/D9OGD2b5RCuNVkVt.cjs +1 -0
- package/browser/cjs/DDGqSmEUwpCyj2-T.cjs +12 -0
- package/browser/cjs/{CIPn136n4B06G4iH.cjs → DMJpPocVk36TEmfa.cjs} +1 -1
- package/browser/cjs/{DPhkr2uj1ztiCS7Y.cjs → DP0yIsjVWme5C-UE.cjs} +1 -1
- package/browser/cjs/Dmdcgm3pqGKmXPGb.cjs +33 -0
- package/browser/cjs/{DBIR20dXG4vtH3Kj.cjs → Ds8fgjqVz8xPRHog.cjs} +1 -1
- package/browser/cjs/{DUtS5ZvrQ_7EIazD2.cjs → DuLz-mXv6patMuVn2.cjs} +1 -1
- package/browser/cjs/{7qAC9w7dw4oS0-F3.cjs → Eja0Zsmdah-At3rJ.cjs} +1 -1
- package/browser/cjs/{CxWeFfNAUvhHe9F-.cjs → QH2fF4MqkcvdkNjz.cjs} +2 -2
- package/browser/cjs/{Bizh6EM71ecxo_oY.cjs → Y0B5_Kqc0UL2taRO.cjs} +2 -2
- package/browser/cjs/gOdLq87FmaB-hTTZ.cjs +1 -0
- package/browser/cjs/index.cjs +1 -1
- package/{cdn/assets/DhYuSZrGEgUmal-k2.js → browser/esm/2dJqxS99uENpvAC92.mjs} +1 -1
- package/browser/esm/{qatUNqy1unWjxJRn.mjs → 4-QoxOhoR614u5tO.mjs} +12 -12
- package/{cdn/assets/BgAJsJ2qMSFQT33B.js → browser/esm/53p_EWlOxGgrMq-q.mjs} +254 -254
- package/{cdn/assets/BGQ__v6SnaHlNG-Q2.js → browser/esm/5XtgjihhVCzNqyYJ2.mjs} +1 -1
- package/browser/esm/{oQtJFGKyYOTaSkZn.mjs → B1AbnDun66mq_S2f.mjs} +12 -12
- package/browser/esm/{aq4qmGuAhtzPqF-6.mjs → B3CqIagnCvfOrLBT.mjs} +7 -7
- package/browser/esm/{Cf3oUL1hNajeyVed2.mjs → B4094aQR3Q4KhALV2.mjs} +8 -8
- package/browser/esm/{DSV2cLpO0S6ZhgXx2.mjs → B7kOoeXeYeZqA_mU.mjs} +1 -1
- package/{cdn/assets/hBx61KP4CdznZp-N.js → browser/esm/BC9RLqAWMPRx_1rS.mjs} +1 -1
- package/browser/esm/{Db1UHrYoIsMVbE28.mjs → BDHrIbkTx7Ii0RYb.mjs} +5 -5
- package/browser/esm/{EmSNRoqlc2C8WKZI2.mjs → BEF8kcbXgMjyCP4C2.mjs} +1 -1
- package/browser/esm/{CueJgED9ejHaXzfs2.mjs → BEgQWG98wq54oeau2.mjs} +7 -7
- package/browser/esm/{-T6bQcEJ9HLY7UHV.mjs → BG-wTTfaCHaJMI5b2.mjs} +1 -1
- package/{cdn/assets/CqHkXhh2PbxRyYjJ.js → browser/esm/BG8zQEmkmTTw8LXE2.mjs} +1 -1
- package/browser/esm/{BH8YLTY6BUcMBwtX.mjs → BHmeRWtpqOMknkon.mjs} +1 -1
- package/browser/esm/{CfQJnZ2htSmYPsF3.mjs → BIboUJ6YhTe0O5Ep.mjs} +1 -1
- package/browser/esm/{BQTeVQNim2463X6I.mjs → BKX_mnqOl4t0M7Q-.mjs} +1 -1
- package/browser/esm/{DMcrCWg1n2i_h8d-.mjs → BLq8q4tpQq7lW0jg.mjs} +2 -2
- package/browser/esm/{BvJNXsx20jqbrG3K2.mjs → BM3Fxh1DBzKRDnJ-2.mjs} +1 -1
- package/browser/esm/{DgGD0naBo-36VC2J.mjs → BMlDCj6kw-JTuDJ92.mjs} +1 -1
- package/browser/esm/{_XwhJFKYQwxornq8.mjs → BT1lb0BHqaMUHJEH.mjs} +4 -4
- package/browser/esm/{BgK2h0kYTNVq8lHv.mjs → BTiq0pI-MmNI9sx6.mjs} +3 -3
- package/browser/esm/{BukYUcUVuCJLUCTU.mjs → BV1A7fanbtryQZdr.mjs} +52 -52
- package/{cdn/assets/BT809Dj7TlZHoSyZ.js → browser/esm/BXf0y-wp2FQ5btCG2.mjs} +1 -1
- package/browser/esm/{B181HHVOosiCdcW9.mjs → BamGz0uoayfOfFJD.mjs} +7 -7
- package/{cdn/assets/BFWULyy65RLrorZ7.js → browser/esm/BbRZ0cO4t2haGX-o.mjs} +1 -1
- package/browser/esm/{snzQyFpbHKBoouMl2.mjs → BbgnnZj965cf_RAV2.mjs} +9 -9
- package/{cdn/assets/CNUTA9WVNU3KeDzf2.js → browser/esm/Be2V19M8IxytN_Aa.mjs} +2 -2
- package/browser/esm/{C2HOJ1mltRzbTUl62.mjs → BibrryjUsSysyTSD2.mjs} +11 -11
- package/browser/esm/{DhXISrCGYlstWBHR2.mjs → Bk-F9XzxhuyAOQqK.mjs} +1 -1
- package/browser/esm/{whPiKYlX_LjBPzcR2.mjs → Bk13V_C0eSaqMClU.mjs} +1 -1
- package/browser/esm/{DpBY9n_Yx6svVSLX.mjs → BlC4_SZ2XYvtnkHw.mjs} +6 -6
- package/browser/esm/{C7esccqlKiSdYnvL2.mjs → BmZX5BqczMfR2VlT2.mjs} +1 -1
- package/browser/esm/{DDQ55nRejL3ziHCe2.mjs → Bpp8p7LJo9K-1Tm-.mjs} +1 -1
- package/browser/esm/{DIaucc8UrX6oVZGM.mjs → Bpypf56n7jOOW7Ys.mjs} +9 -9
- package/browser/esm/{lgDQkp3FOzQOe0LY.mjs → Bs6uuY3i689nSdNa.mjs} +3922 -3836
- package/browser/esm/{dzdZI0rQ6gtonL0G2.mjs → BwekjT1bXcBAV6hi2.mjs} +1 -1
- package/browser/esm/{CNqsb1dCdP38edL_.mjs → Bxt5fHMZXudQ1QHA.mjs} +6 -6
- package/browser/esm/{DOQiJP4o3Yv2roFN.mjs → Byl6FdOyv58rFwxZ.mjs} +5 -5
- package/{cdn/assets/BQMwLQz7v1tKKNjw.js → browser/esm/Bynpw8CnO-1JkFdZ2.mjs} +1 -1
- package/{cdn/assets/D2f2lwn364O9E4vh2.js → browser/esm/BzilGTs3oFGxJ5uB.mjs} +2 -2
- package/browser/esm/{CdS03qdFlfnGS4GS2.mjs → C39fSQO6blxFky052.mjs} +7 -7
- package/browser/esm/{Cvv50xExjeFnfiNy.mjs → CC52ynv81P-LwXRT.mjs} +6 -6
- package/browser/esm/{COYX5UfgqbqvXL532.mjs → CCvvNbrMzlFHlAbr2.mjs} +4 -4
- package/{cdn/assets/CkASBS4AqNOy0df52.js → browser/esm/CEWWFcwu4AyqL0cQ.mjs} +202 -197
- package/browser/esm/{CVuIEusZ_eVLJx48.mjs → CEgIZKMC4XoMmPp5.mjs} +3 -3
- package/{cdn/assets/CONqbv4wIi-kv-2L.js → browser/esm/CI8YyVegXUBlHR61.mjs} +1 -1
- package/browser/esm/{DehYydhsh3tj9AnM2.mjs → CI92jUOrJIKUlfGx2.mjs} +130 -130
- package/browser/esm/{CxM2lbNqq--4xN8h.mjs → CKc-IOHYDEuo2FhB.mjs} +5 -5
- package/browser/esm/{Yp8HnZ2LZWDER3Db.mjs → CNZeWICVX0x6E3-Z.mjs} +1 -1
- package/browser/esm/{CBNIXGGRiR3NBppk.mjs → CNgKTif3Jo9FLV7d.mjs} +2 -2
- package/browser/esm/{1KR1J6vxDpw_yLbU2.mjs → CSlBZF1ezptA1LSS2.mjs} +1 -1
- package/browser/esm/{D1a8t7B7xKy_wr9i2.mjs → CUj7kwIeQGAqyb6V.mjs} +1 -1
- package/browser/esm/{CVvr_1-LCX19jk4e.mjs → CVDNfe5yVj7xYGeO.mjs} +2 -2
- package/browser/esm/{CVoRtI07Syww8cUA.mjs → CWQXDC8Qk5PH757v.mjs} +13 -13
- package/browser/esm/{BJ6H2o3H404XGe252.mjs → CX0QhwSYuHoImWlY2.mjs} +1 -1
- package/browser/esm/{C6JzMmLaess-T_-r.mjs → CZy1bU6cVChuZKag.mjs} +89 -89
- package/{cdn/assets/BUqPCIYNlP_6pm4M.js → browser/esm/C_Kd0CPQvZsJLD6b2.mjs} +1 -1
- package/browser/esm/{BVHJ8ud9-agkHUcd2.mjs → CdV0VXnaW6UyTd8E.mjs} +1 -1
- package/browser/esm/{sckQOed44XHUgmEM.mjs → CecKVsBMvvKuk2Og.mjs} +2135 -2065
- package/browser/esm/{Ct164XKB4haoxV99.mjs → Ci7qcrvyeBaD36sR.mjs} +5 -5
- package/browser/esm/{FxykwtLK380Ynhjh.mjs → Cjq-G2Seyww6IMSH.mjs} +1 -1
- package/browser/esm/{DKI0PCE8wcuvwtKy2.mjs → Clu5SMZriAkKa_np2.mjs} +13 -13
- package/browser/esm/{BT5ZFPRdhl589SPM.mjs → CmcKdn-U2ywgYm_9.mjs} +2 -2
- package/browser/esm/{Chxj04DLMGbqyjr22.mjs → CqSxZiLos0nQa69t2.mjs} +5 -5
- package/browser/esm/{gByeADNOXJBuXzPx.mjs → CsK0x9jgM8z_DOl1.mjs} +37 -37
- package/browser/esm/{BhydwJ4RldNTRaas.mjs → CsqtbHllm56zw5xh2.mjs} +1 -1
- package/browser/esm/{k0J0jqbt6JQcSNRf.mjs → CtZ4wSjG6QUWs7Nn.mjs} +6 -6
- package/browser/esm/{BlABxqvzU3ccpiI22.mjs → CtaapT_7WuEvy48w2.mjs} +1 -1
- package/browser/esm/{Dd6FJoDWApFB2CCi2.mjs → CxJliRXAfjf-8FJL2.mjs} +1 -1
- package/browser/esm/{DYhc53MZjX6LHNsG.mjs → D5MuKMXqFbc9B8JP.mjs} +3 -3
- package/browser/esm/{3aV4jURdjixaD7Td.mjs → D7-Zv2k1IJkmQoxc.mjs} +1 -1
- package/browser/esm/{C6l5aRmgsP8d19lu.mjs → D99KkptfLQp60ECI.mjs} +2 -2
- package/{cdn/assets/BCNx4EnDw46A38bE.js → browser/esm/DA0VxVTFcWvrEQEv.mjs} +2 -2
- package/browser/esm/{CLFhHEElqfJHtm21.mjs → DD-_f0jEXDy0dn6z.mjs} +6 -6
- package/{cdn/assets/Sz8Cy_HaoUpTYt0h.js → browser/esm/DDg-fxiIqpuutuyu2.mjs} +1 -1
- package/{cdn/assets/Dy8wseROvsKI36oO.js → browser/esm/DJzMm5FQXuMWHNom2.mjs} +1 -1
- package/browser/esm/{Bk6d2dZzmAPEN5-k2.mjs → DKLwRgsx1WelayB6.mjs} +1 -1
- package/browser/esm/{DX4LgT_oDH8L8ynK.mjs → DNXCAcVGHeeoKPcx2.mjs} +1 -1
- package/browser/esm/{DonDOr6JcdNxotw-.mjs → DSY8maNeFb51KgKe2.mjs} +1 -1
- package/browser/esm/{CNqvhcQrG2-81fOD.mjs → DT8AGfoENVVMPsi3.mjs} +1 -1
- package/browser/esm/{eJXoOdaV3zHUV2do.mjs → DUpHK7eGlzF6E3h5.mjs} +5 -5
- package/browser/esm/{pRwq1uOrNbhmZ0mM2.mjs → DX0xvH5nQ8MjqsA02.mjs} +2 -2
- package/browser/esm/{6Q0Zeea07mEpzLeJ2.mjs → DYaHqG1Xx-r7mlLq.mjs} +1 -1
- package/browser/esm/{BrtMkOA8Tryg59WN.mjs → DZyZNxEMnIWr2n8S.mjs} +3 -3
- package/browser/esm/{BH4J1ujX7bAH0qMe.mjs → DbGc-QtQMWI-VyUe.mjs} +1 -1
- package/{cdn/assets/CDEkMCYntkMJxwBi2.js → browser/esm/DbfFQif7awKrcxxB.mjs} +3 -3
- package/browser/esm/{DFoGNYjZCQlfoclz.mjs → Dcbf_tge-hZbUfUD.mjs} +4 -4
- package/{cdn/assets/D1On-UnlXgc4TMJi2.js → browser/esm/De-RIk_tQ6xW8NH2.mjs} +1 -1
- package/browser/esm/{Cdgq7c9nPgcoTg8v.mjs → DgGF1ZaI3ti0c_Nz.mjs} +1 -1
- package/browser/esm/{CSfpN1f335foeZWr.mjs → DhnxpW56CJ43gVOI.mjs} +1 -1
- package/browser/esm/{B86Q74Vxyg1crDy4.mjs → DjwllBVpUWlaltMT.mjs} +6 -6
- package/browser/esm/{BEvXGI5EzVSXLxga.mjs → DqfIf41HljTIhC84.mjs} +5 -5
- package/browser/esm/{CHbhZ3r3ql2BYXDc2.mjs → Dt8IOrB4ifUVtTff2.mjs} +1 -1
- package/browser/esm/{COyyediFP8-Jte0d.mjs → DwEiTFl_RN5oQzfh.mjs} +7 -7
- package/browser/esm/{DkLusJh15CZ_-XSG2.mjs → HQv1oLV3ax-NKXZG.mjs} +1 -1
- package/browser/esm/{BYzW6nCCA9mf7lE02.mjs → IMAnmKax7yp8adEP2.mjs} +15 -15
- package/{cdn/assets/1Inmee-wv-0FPFfs2.js → browser/esm/Jw068AbKaxWlv8HJ2.mjs} +1 -1
- package/browser/esm/{CssrS9cKuhz46r6y.mjs → MJIl3u3WexRfuRxx.mjs} +4 -4
- package/browser/esm/{DKSKOqX0lMeM6AqD.mjs → MZKwwgG9APikaCAg.mjs} +246 -240
- package/browser/esm/{aMyBfKW2geFo8ZLl.mjs → Nj1DgowT0KN0un7b2.mjs} +1 -1
- package/{cdn/assets/CQ-1iT2BBp1-8btC.js → browser/esm/R3YBWWwMJAzbuwie2.mjs} +1 -1
- package/browser/esm/{C4LCzL4eMbnmxScR.mjs → RFuzM5jhOgjn2C_7.mjs} +2 -2
- package/{cdn/assets/KwAARJU7IGYWDuYf.js → browser/esm/SNsjWQUbxOQzdnCT.mjs} +1 -1
- package/browser/esm/{DjR_YrztipUHz-Pb.mjs → Sm94kpOe8UUYLpaZ.mjs} +3 -3
- package/browser/esm/{C5r3DKfkpQkm-_LU2.mjs → UOfj2s5X9yjL1iLF2.mjs} +8 -8
- package/browser/esm/{Co-Q8GHNdftJgZAY2.mjs → YGKMD1YfDLoo18Sy.mjs} +1 -1
- package/browser/esm/{DUqRWxlJFr43EfUh2.mjs → iKMg-svZQSvoVzqO2.mjs} +1 -1
- package/browser/esm/index.mjs +4 -4
- package/browser/esm/{V7W9wEgRnVm5FcO92.mjs → jvvKubD9MdvZCawH2.mjs} +11 -11
- package/browser/esm/{BhnhFOdBLUIQ-spn.mjs → l9SSIWXeR5tPN95-.mjs} +3 -3
- package/browser/esm/{Ba0-kvrjrj0hGe1K2.mjs → nBRFIzaPeMPPvIMQ2.mjs} +6 -6
- package/browser/esm/{A1VpPEggRj4IfGDD.mjs → rnntZ_PYlojxr5c4.mjs} +523 -524
- package/browser/esm/{7-3GSszGuM6fKYQX2.mjs → sIWoD1UYd1XgTrIs2.mjs} +1 -1
- package/browser/esm/{BPefT37WNgwR2ugY.mjs → swjGzqq7IK8YnHrV.mjs} +2 -2
- package/{cdn/assets/CvRpuDeuhP-pmiUv2.js → browser/esm/uk2_KQhVX77MWa7A2.mjs} +1 -1
- package/browser/esm/{KFUePxyJYgymI0S1.mjs → y07oKUx2vGjEEZ0w.mjs} +1 -1
- package/browser/esm/{ESGNq4ULp2pm2AAl2.mjs → yFD3mg0KbvkE3s1Y2.mjs} +7 -7
- package/browser/esm/{CBNL1frWoMOsUu_T2.mjs → yqwkS9EO5146-Xhf2.mjs} +9 -9
- package/cdn/assets/{BlZs6OBbHaWLHdyw2.js → -OScuzLTidF7HNaK2.js} +14 -14
- package/cdn/assets/{BqujNTf--SuDncdC.js → -wn5AXVsNdciGzNx.js} +1758 -1758
- package/{browser/esm/DhYuSZrGEgUmal-k.mjs → cdn/assets/2dJqxS99uENpvAC9.js} +1 -1
- package/cdn/assets/{Bh64Y2xehO25OC_t.js → 3QC61uhcIBmRDR9w.js} +2565 -2495
- package/cdn/assets/{o5R9zv1BlAEkrwCo2.js → 4Z5QgDDHi93cqy332.js} +28 -28
- package/{browser/esm/BGQ__v6SnaHlNG-Q.mjs → cdn/assets/5XtgjihhVCzNqyYJ.js} +1 -1
- package/cdn/assets/{DI64FmdWeq_LEKJc2.js → B1WYofA6cHbr8sxv2.js} +49 -49
- package/cdn/assets/{CvzRrID9YjfTwDuS2.js → B4aainAlYLn-Q5H62.js} +3 -3
- package/cdn/assets/{2EKKj_VAMBjNhQyV.js → B5G5aOCiy3kn0ADy.js} +2 -2
- package/cdn/assets/{DSV2cLpO0S6ZhgXx.js → B7kOoeXeYeZqA_mU2.js} +1 -1
- package/cdn/assets/{C_4w0ioMakQrO0i0.js → B8kiZt5i9HOHYeAo.js} +3 -3
- package/{browser/esm/hBx61KP4CdznZp-N2.mjs → cdn/assets/BC9RLqAWMPRx_1rS.js} +1 -1
- package/cdn/assets/{DM7EYwNo9Xadex4L.js → BDZq-VDymQAePI7X.js} +2 -2
- package/cdn/assets/{EmSNRoqlc2C8WKZI.js → BEF8kcbXgMjyCP4C.js} +1 -1
- package/cdn/assets/{-T6bQcEJ9HLY7UHV.js → BG-wTTfaCHaJMI5b.js} +1 -1
- package/{browser/esm/CqHkXhh2PbxRyYjJ2.mjs → cdn/assets/BG8zQEmkmTTw8LXE.js} +1 -1
- package/cdn/assets/{DvjL9HtpbeTQiPsP.js → BGlQEwuUWK6Oz7bC.js} +105 -105
- package/cdn/assets/{BH4J1ujX7bAH0qMe2.js → BHmeRWtpqOMknkon.js} +1 -1
- package/cdn/assets/BHmeRWtpqOMknkon2.js +24 -0
- package/cdn/assets/{0p987xGFUx0c99X0.js → BITxO-ILVNOqgbA7.js} +4 -4
- package/cdn/assets/{BQTeVQNim2463X6I2.js → BKX_mnqOl4t0M7Q-2.js} +1 -1
- package/cdn/assets/{BvJNXsx20jqbrG3K.js → BM3Fxh1DBzKRDnJ-.js} +1 -1
- package/cdn/assets/{DgGD0naBo-36VC2J2.js → BMlDCj6kw-JTuDJ9.js} +1 -1
- package/cdn/assets/{CKYDcG1HSXTvQl6K2.js → BNU2ZqxIegIJr-572.js} +7 -7
- package/cdn/assets/{CwfmCx2Ke4_FHoNA2.js → BSUsQ6-YD40bvOdG2.js} +7 -7
- package/cdn/assets/{CDZEsA19vbvMOvWY.js → BV3cgeOVx6QLl85F.js} +6 -6
- package/cdn/assets/{B0LfV8NixGPYcBo92.js → BWcc3hnnAhelxjOr2.js} +10 -10
- package/{browser/esm/BT809Dj7TlZHoSyZ2.mjs → cdn/assets/BXf0y-wp2FQ5btCG.js} +1 -1
- package/cdn/assets/{BrX2wKaY8H8My2Oe2.js → BZbIcyw3tiUx7ztK2.js} +754 -754
- package/{browser/esm/BFWULyy65RLrorZ7.mjs → cdn/assets/BbRZ0cO4t2haGX-o.js} +1 -1
- package/cdn/assets/{BiDbxIo_Dg-LwZSG.js → BdI4wcd4XWPgeQnl.js} +3 -3
- package/cdn/assets/{DydlbsZLg69j6R5g2.js → BhNQRWnlFUA4eX9Z2.js} +4 -4
- package/cdn/assets/{DhXISrCGYlstWBHR.js → Bk-F9XzxhuyAOQqK2.js} +1 -1
- package/cdn/assets/{whPiKYlX_LjBPzcR.js → Bk13V_C0eSaqMClU.js} +1 -1
- package/cdn/assets/{D_rEOwaZCyZlVVgW.js → Bk8tTxRXYv1v5QpX.js} +2 -2
- package/cdn/assets/{C7esccqlKiSdYnvL.js → BmZX5BqczMfR2VlT.js} +1 -1
- package/cdn/assets/{DDQ55nRejL3ziHCe.js → Bpp8p7LJo9K-1Tm-2.js} +1 -1
- package/{browser/esm/DAaOeIPOo0FIBMxD.mjs → cdn/assets/BqA9-X1PlqRSSWll.js} +2 -2
- package/cdn/assets/{n4um87qBckL9pgR9.js → Bt-Xdgz1GdP9i0KH.js} +5 -5
- package/cdn/assets/{BvkiXQcXBMKUOItw.js → Bv8Sjub_HtVCmnyZ.js} +6 -6
- package/cdn/assets/{dzdZI0rQ6gtonL0G.js → BwekjT1bXcBAV6hi.js} +1 -1
- package/{browser/esm/BQMwLQz7v1tKKNjw2.mjs → cdn/assets/Bynpw8CnO-1JkFdZ.js} +1 -1
- package/cdn/assets/{CbLEZjCqlIOy_N9_2.js → BzNZfg3RJdx9PRAg2.js} +9 -9
- package/cdn/assets/{BD5W4MjL2vYljVhR.js → C0ioCmY0K9GI3SiM.js} +7 -7
- package/cdn/assets/{Dz_GMq1kFESpvRRw2.js → C8lUc_Lc03y-Whne2.js} +12 -12
- package/cdn/assets/{BcE0tCVATqH2DBXy.js → CAgzNDmM7lJZAN5m.js} +2 -2
- package/{browser/esm/CONqbv4wIi-kv-2L.mjs → cdn/assets/CI8YyVegXUBlHR61.js} +1 -1
- package/cdn/assets/{68Hv9gRdAVje7VBa2.js → CJMMds78eEvd6ivG2.js} +3 -3
- package/cdn/assets/{CLNQrXyj4goOCX7I2.js → CK4ZQnpkZHN03RHP2.js} +9 -9
- package/cdn/assets/{Yp8HnZ2LZWDER3Db.js → CNZeWICVX0x6E3-Z.js} +1 -1
- package/cdn/assets/{BtlAVeuTyW0FoJO42.js → COaJqYKx8CJ595fz2.js} +4 -4
- package/cdn/assets/{1KR1J6vxDpw_yLbU.js → CSlBZF1ezptA1LSS.js} +1 -1
- package/cdn/assets/{D1a8t7B7xKy_wr9i.js → CUj7kwIeQGAqyb6V.js} +1 -1
- package/cdn/assets/{BJ6H2o3H404XGe25.js → CX0QhwSYuHoImWlY.js} +1 -1
- package/{browser/esm/BUqPCIYNlP_6pm4M.mjs → cdn/assets/C_Kd0CPQvZsJLD6b.js} +1 -1
- package/cdn/assets/{BWZ0ZtidQ4G3pcKO.js → CaLQ8stna0cEenbY.js} +8 -8
- package/cdn/assets/{BGYLyOTa6Y58vnCV.js → Cb1n0HtvwfvZOwZz.js} +8 -8
- package/cdn/assets/{D8NtGU-FHZgnbC0i.js → CcJHQ6UROltFQL2I.js} +2 -2
- package/cdn/assets/{BVHJ8ud9-agkHUcd.js → CdV0VXnaW6UyTd8E.js} +1 -1
- package/cdn/assets/{BdfjaNIltJNsXLvf2.js → CeD6pRhoV1LfiJjD.js} +12 -12
- package/cdn/assets/{BRus7kfM7SjEN70e2.js → ChBa56MbB_cDd9LM2.js} +8 -8
- package/cdn/assets/{DSwGGo-dqmuSJU4c2.js → CjO9u_nQjtCD7xTH2.js} +72 -72
- package/cdn/assets/{FxykwtLK380Ynhjh2.js → Cjq-G2Seyww6IMSH2.js} +1 -1
- package/cdn/assets/{MkMSXY8qQyay8SYA.js → ClHDdBXrC_nobC_N.js} +9 -9
- package/{browser/esm/DHfiSgLq1g6VAhWI.mjs → cdn/assets/ClWQjK8wtCNyfHiY.js} +2 -2
- package/cdn/assets/{BsxzxAPB4jEzEk-H2.js → ClkL86jz-4Gf_Uwg2.js} +10 -10
- package/cdn/assets/{FR8EiuZjHCo_J-S2.js → CsfLKTLGWgDLWY2z.js} +6 -6
- package/cdn/assets/{BhydwJ4RldNTRaas.js → CsqtbHllm56zw5xh.js} +1 -1
- package/cdn/assets/{BlABxqvzU3ccpiI22.js → CtaapT_7WuEvy48w2.js} +1 -1
- package/cdn/assets/{C8V4AJb4DdsmksEn2.js → Cwee8HXWwJj0ASk32.js} +3922 -3836
- package/cdn/assets/{Dd6FJoDWApFB2CCi.js → CxJliRXAfjf-8FJL.js} +1 -1
- package/cdn/assets/{DM43PoUsN4Z2MKGv.js → D-bML_q46je0p2os.js} +8 -8
- package/cdn/assets/{3aV4jURdjixaD7Td.js → D7-Zv2k1IJkmQoxc.js} +1 -1
- package/{browser/esm/LPgfxd0W2GLAgBzu.mjs → cdn/assets/DAN4gSLpoicGd0oX2.js} +3 -3
- package/cdn/assets/{By3qfCkjrY1zpWuS.js → DBDr4dkaPZ8Gd8CD.js} +246 -240
- package/{browser/esm/Sz8Cy_HaoUpTYt0h2.mjs → cdn/assets/DDg-fxiIqpuutuyu.js} +1 -1
- package/cdn/assets/{DMjYAxfgXGEkymiO.js → DHd5k_mCX2iTwwRi.js} +2 -2
- package/{browser/esm/Dy8wseROvsKI36oO2.mjs → cdn/assets/DJzMm5FQXuMWHNom2.js} +1 -1
- package/cdn/assets/{Bk6d2dZzmAPEN5-k.js → DKLwRgsx1WelayB62.js} +1 -1
- package/cdn/assets/{Bvm882bTb1-lNGnV.js → DL_Jd5k5JINA7woQ.js} +6 -6
- package/cdn/assets/{DX4LgT_oDH8L8ynK.js → DNXCAcVGHeeoKPcx.js} +1 -1
- package/cdn/assets/{D76lWYCrAdSMKvm_2.js → DQrSW7F6xwljb9vw2.js} +5 -5
- package/cdn/assets/{ChszL_ibfMtBV0z3.js → DR4uNNkaArYCuvNg.js} +2 -2
- package/cdn/assets/{DonDOr6JcdNxotw-2.js → DSY8maNeFb51KgKe.js} +1 -1
- package/cdn/assets/{CNqvhcQrG2-81fOD.js → DT8AGfoENVVMPsi3.js} +1 -1
- package/cdn/assets/{pRwq1uOrNbhmZ0mM.js → DX0xvH5nQ8MjqsA0.js} +2 -2
- package/cdn/assets/{6Q0Zeea07mEpzLeJ.js → DYaHqG1Xx-r7mlLq2.js} +1 -1
- package/cdn/assets/DbGc-QtQMWI-VyUe2.js +24 -0
- package/{browser/esm/D1On-UnlXgc4TMJi.mjs → cdn/assets/De-RIk_tQ6xW8NH22.js} +1 -1
- package/cdn/assets/{HdeBTuGyZOTOnlxd.js → DfMvz_tU8vJuV2Wl.js} +3 -3
- package/cdn/assets/{Cdgq7c9nPgcoTg8v.js → DgGF1ZaI3ti0c_Nz.js} +1 -1
- package/cdn/assets/{BJ95rY1UBb83xuD52.js → Dhmpgvzx9S-LYXr82.js} +9 -9
- package/cdn/assets/{CSfpN1f335foeZWr2.js → DhnxpW56CJ43gVOI2.js} +1 -1
- package/cdn/assets/{B_bAdpPn5j1VFdEp.js → Dm0riUQ_5Wg9oFgO.js} +7 -7
- package/{browser/esm/DXWY-hAdW5OyWrwd.mjs → cdn/assets/DmfSfK3IDzXPHkJL2.js} +202 -197
- package/cdn/assets/{CHbhZ3r3ql2BYXDc.js → Dt8IOrB4ifUVtTff.js} +1 -1
- package/cdn/assets/{B2bOeapx8xiCLxqL.js → DupOTk4J52hzKr6p.js} +7 -7
- package/cdn/assets/{B17NIGOPfL-7fbgM.js → DyPUmQ-x13kFTQyg.js} +3 -3
- package/{browser/esm/Bm8bttobs_RXO3av.mjs → cdn/assets/F-Y7Aw8fXxuX1LhE2.js} +254 -254
- package/cdn/assets/{DkLusJh15CZ_-XSG.js → HQv1oLV3ax-NKXZG2.js} +1 -1
- package/cdn/assets/{DixF46mCuD3POuzl2.js → HT9FFYzSOuRaDcHS2.js} +6 -6
- package/{browser/esm/1Inmee-wv-0FPFfs.mjs → cdn/assets/Jw068AbKaxWlv8HJ.js} +1 -1
- package/cdn/assets/{aMyBfKW2geFo8ZLl2.js → Nj1DgowT0KN0un7b.js} +1 -1
- package/{browser/esm/CQ-1iT2BBp1-8btC2.mjs → cdn/assets/R3YBWWwMJAzbuwie.js} +1 -1
- package/{browser/esm/KwAARJU7IGYWDuYf.mjs → cdn/assets/SNsjWQUbxOQzdnCT.js} +1 -1
- package/cdn/assets/{385X3fXUstHKtEEF2.js → TO6gumfUOp2BgIlL.js} +7 -7
- package/cdn/assets/{DFDuIPMXHvVuEUbr.js → UtYZqTCpvZMQKdR8.js} +2 -2
- package/cdn/assets/{Co-Q8GHNdftJgZAY.js → YGKMD1YfDLoo18Sy2.js} +1 -1
- package/cdn/assets/{Ay1mO-24lauwvlWS2.js → ZQsrI5kqNG_ZOdZD2.js} +38 -38
- package/cdn/assets/{Be9keF2r4uCzJZJx2.js → _5fYV4ZbX0S6MIpD2.js} +8 -8
- package/cdn/assets/{CW8lbman_jNmJl5d2.js → dywzP082Q24_9Q5U2.js} +8 -8
- package/cdn/assets/{DBYkGTlfV1b47Hy6.js → i6PnYkX2rfHQQEvF.js} +3 -3
- package/cdn/assets/{DUqRWxlJFr43EfUh.js → iKMg-svZQSvoVzqO.js} +1 -1
- package/cdn/assets/{Bh6yJtlVASN4H0732.js → rFTMJ-_CKVUSpQ9x2.js} +13 -13
- package/cdn/assets/{D1zjNJZna0d4gavs2.js → rT3DomLULA1xJhfY2.js} +16 -16
- package/cdn/assets/{Dd_TEe3cUSRc5o_s.js → s2fSOFCKUPsjfoxR.js} +7 -7
- package/cdn/assets/{7-3GSszGuM6fKYQX.js → sIWoD1UYd1XgTrIs.js} +1 -1
- package/{browser/esm/CvRpuDeuhP-pmiUv.mjs → cdn/assets/uk2_KQhVX77MWa7A.js} +1 -1
- package/{browser/esm/B3_8_CGA-MEUvzHP.mjs → cdn/assets/v2SkWlVj3d1y2tfT2.js} +2 -2
- package/cdn/assets/{DnPzMeDwU1jIwV-F2.js → wBchGa30DBwJnPZQ2.js} +3 -3
- package/cdn/assets/{KFUePxyJYgymI0S12.js → y07oKUx2vGjEEZ0w2.js} +1 -1
- package/cdn/assets/{BK7l8_lemkR1wuwy.js → ykS_w8WDHugwGY9S2.js} +8 -8
- package/cdn/index.js +2 -2
- package/package.json +3 -3
- package/browser/cjs/BSh3rXFX2OUJtD5l.cjs +0 -5
- package/browser/cjs/BW48QUIyFJAiIyBv.cjs +0 -1
- package/browser/cjs/Brqufbzvg4y0YTM0.cjs +0 -3
- package/browser/cjs/BvRcbY1-Wkb5Sx-4.cjs +0 -86
- package/browser/cjs/C6_0FaW_bjOw24La.cjs +0 -33
- package/browser/cjs/CraVh3dIK_NDeAvS.cjs +0 -12
- package/browser/cjs/DfkGb1hUnmE0XFjK.cjs +0 -1
- package/cdn/assets/BH8YLTY6BUcMBwtX.js +0 -24
- package/cdn/assets/BH8YLTY6BUcMBwtX2.js +0 -24
- /package/browser/cjs/{1XrWGMP3GmsQOMIX.cjs → 1XrWGMP3GmsQOMIX2.cjs} +0 -0
- /package/browser/cjs/{49_x589Na12sizKK2.cjs → 49_x589Na12sizKK.cjs} +0 -0
- /package/browser/cjs/{507hQYooKKjnRzsZ.cjs → 507hQYooKKjnRzsZ2.cjs} +0 -0
- /package/browser/cjs/{BK0SCfN_VZYqBxoQ.cjs → BK0SCfN_VZYqBxoQ2.cjs} +0 -0
- /package/browser/cjs/{Btc0Nzu40VYOpzLX2.cjs → Btc0Nzu40VYOpzLX.cjs} +0 -0
- /package/browser/cjs/{C2uDl8VIJqh58YF_2.cjs → C2uDl8VIJqh58YF_.cjs} +0 -0
- /package/browser/cjs/{C9C-pr-T_ThweQX92.cjs → C9C-pr-T_ThweQX9.cjs} +0 -0
- /package/browser/cjs/{CRx1WvmgBjT8WVyB2.cjs → CRx1WvmgBjT8WVyB.cjs} +0 -0
- /package/browser/cjs/{CW-b31_-r-_raT8Y2.cjs → CW-b31_-r-_raT8Y.cjs} +0 -0
- /package/browser/cjs/{CXlzsh_WHCOsErJ1.cjs → CXlzsh_WHCOsErJ12.cjs} +0 -0
- /package/browser/cjs/{CnZfa45XxA-9Jhmp.cjs → CnZfa45XxA-9Jhmp2.cjs} +0 -0
- /package/browser/cjs/{CpJJh4UnFl1_qFui.cjs → CpJJh4UnFl1_qFui2.cjs} +0 -0
- /package/browser/cjs/{CrZlUtdX1h2RUnCP.cjs → CrZlUtdX1h2RUnCP2.cjs} +0 -0
- /package/browser/cjs/{DCIlWcGDrp-5PDoA2.cjs → DCIlWcGDrp-5PDoA.cjs} +0 -0
- /package/browser/cjs/{DDnGLOLTqLFsdUDS2.cjs → DDnGLOLTqLFsdUDS.cjs} +0 -0
- /package/browser/cjs/{DG2kqsWRUtVugjay2.cjs → DG2kqsWRUtVugjay.cjs} +0 -0
- /package/browser/cjs/{DNKyaSruDogoBd2H.cjs → DNKyaSruDogoBd2H2.cjs} +0 -0
- /package/browser/cjs/{Du4jBiFxRIF1OjD42.cjs → Du4jBiFxRIF1OjD4.cjs} +0 -0
- /package/browser/cjs/{EeOVMRq7TuptFKTc.cjs → EeOVMRq7TuptFKTc2.cjs} +0 -0
- /package/browser/cjs/{bM25C5avKgBAJVfk.cjs → bM25C5avKgBAJVfk2.cjs} +0 -0
- /package/browser/cjs/{fqTQ_p3ehzUvc1tF.cjs → fqTQ_p3ehzUvc1tF2.cjs} +0 -0
- /package/browser/cjs/{h3dw1jAp2J5Pu4p32.cjs → h3dw1jAp2J5Pu4p3.cjs} +0 -0
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const e=require("./BnccBYHCCq9TGFx4.cjs"),t=require("./CHFOXPbNUaeZbrXn.cjs"),n=require("./DDPxHIqx8aIbqTRE.cjs"),r=require("./CeF0DZ-k4DB8M47I.cjs");var i,a,o,s,c=class{constructor(e){this._items=new Map;let t=this._items;for(let n of Object.values(e))t.set(n.getName().toLowerCase(),n)}register(e){let t=e.getName().toLowerCase();this._items.set(t,e)}get(e){if(e)return this._items.get(e.toLowerCase())}getAll(){return Array.from(this._items.values())}has(e){return!!e&&this._items.has(e.toLowerCase())}},l=(e,t)=>{let n=new Map;return e.forEach((e,r)=>{t.get(r)!==e&&n.set(r,e)}),n},u=!1,d=e=>{if(typeof e!=`string`)throw Error(`A stateId (string) is required. Register with 'ITransaction.IStore.create'.`);return e},f=class extends Error{constructor(e,t,n){super(e===`open`?`Transaction conflict: a transaction is already open (expected commit '${t}').`:`Transaction conflict: expected commit '${t}' but current is '${n}'.`),this.name=`TransactionConflictError`,this.reason=e,this.expectedCommitId=t,this.actualCommitId=n}},p=class{constructor(e){this._record=e}getId(){return this._record.id}getDescription(){return this._record.description}getMeta(){return Object.freeze(this._record.meta)}getAuthor(){return this._record.author}getTimestamp(){return this._record.timestamp}getOperation(){return this._record.operation}},m=class{constructor(e){this._listeners=new Set,this._listenersState=new Map,this._commits=new Map,this._locked=!1,this._pending=null,this._versionCounter=0,this._isSync=e?.sync??u,this._isTransient=e?.transient??!1,this._author=e?.author,this._maxCommits=e?.maxCommits??1e3;let t={id:`0`,description:`initial`,meta:{},author:this._author,timestamp:Date.now(),states:new Map,version:0,previousId:null},n={record:t,commit:new p(t)};this._current=n,this._cacheId=null,this._cacheState=null,this._states=t.states,this._transactionStack=[],this._transactionOpen=!1;let r=new Map;r.set(t.id,n),this._commits=r,this._tipId=t.id}static{this.setDefaultSync=e=>{u=e}}getLog(e,t=100){let n=[],r=e;do{let e=this._commits.get(r);if(!e)throw Error(`Invalid commit id: '${r}'`);if(n.push(e.commit),r=e.record.previousId,!r)return n}while(n.length<t);return n}getCommitCount(){return this._commits.size}isOpenTransaction(){return this._transactionStack.length>0||this._transactionOpen}getPendingView(){let e=this._transactionStack;return e.length>0?e[0].getView():null}create(t){let n=e.A.uuidV4();if(t!==void 0){let e=this.beginCommit();try{e.updateState(n,t),e.commit()}catch(t){throw e.rollback(),t}}return n}getState(e){d(e);let t=this._transactionStack;if(t.length===0){if(this._cacheId===e)return this._cacheState;let t=this._states.get(e);return this._cacheId=e,this._cacheState=t,t}return t[t.length-1].getState(e)}getCurrentCommit(e=!0){return(e?this._pending?.commit:null)??this._current.commit}getTipCommit(){return this._commits.get(this._tipId).commit}getVersionId(e){return d(e),this._states.get(e)?.version??0}restore(e,t){let n,r=this._getCommitContainer(e,t);if(this._current.commit.getId()===r.commit.getId())return r.commit;t?.viewId&&t?.viewId!==`custom`||(n=r.record.viewAfter);let i=l(r.record.states,this._current.record.states);this._notifyStates(`onBeforeCommitStart`,this._current,i,n,!0,!1),this._current=r,this._states=this._current.record.states,this._cacheId=null,this._cacheState=null,this._notifyStates(`onAfterStateChange`,r,i,n,!1,!0,!0),this._notify(`onCommitChange`,r.commit,!0),this._transactionOpen=!0;try{this._notifyStates(`onRestoreOrRevert`,r,r.record.states,n,!1,!0)}finally{this._transactionOpen=!1}return r.commit}revert(e,t){let n,r=this._getCommitContainer(e,t),i=this._commits.get(r.record.previousId);if(!i)throw Error(`Invalid commit id: '${r.record.previousId}'`);t?.viewId&&t?.viewId!==` custom`||(n=r.record.viewBefore??r.record.viewAfter);let a=l(i.record.states,this._current.record.states);this._notifyStates(`onBeforeCommitStart`,this._current,a,n,!0,!1),this._current=i,this._states=this._current.record.states,this._cacheId=null,this._cacheState=null,this._notifyStates(`onAfterStateChange`,i,a,n,!0,!1,!0),this._notify(`onCommitChange`,i.commit,!0),this._transactionOpen=!0;try{this._notifyStates(`onRestoreOrRevert`,i,i.record.states,n,!0,!0)}finally{this._transactionOpen=!1}return i.commit}_getCommitContainer(e,t){let n=this._commits.get(e);if(!n)throw Error(`Invalid commit id: '${e}'`);if(this._isTransient)throw Error(`Cannot revert transient store`);if(t?.force&&this._transactionStack.length>0&&this._transactionStack[0].rollback(),this._transactionStack.length!==0)throw Error(`Open transactions.`);return n}_pruneForwards(e){let t=this._tipId;for(;t&&t!==e;){let e=this._commits.get(t);if(!e)break;this._commits.delete(t),t=e.record.previousId}}_trimOldest(){if(this._commits.size<=this._maxCommits)return;let e=this._commits.get(this._tipId);for(let t=1;t<this._maxCommits&&e;t++){let t=e.record.previousId;e=t?this._commits.get(t):void 0}if(!e)return;let t=e.record.previousId;for(e.record.previousId=null;t;){let e=this._commits.get(t);if(!e)break;this._commits.delete(t),t=e.record.previousId}}beginCommit(t,n){let r=this._transactionStack,i=r.length;typeof t==`string`&&(t={description:t});let a=t?.expectedCommitId;if(a!==void 0){let e=this._current.record.id;if(i>0||this._transactionOpen)throw new f(`open`,a,e);if(e!==a)throw new f(`stale`,a,e)}if(this._locked)throw console.warn(`TransactionStore locked`,r),Error(`TransactionStore is locked by '${r[i-1].getDescription()}`);let o,s=t?.preventFurtherTransactions,c=this,l=(e,t,r)=>{let a=c._transactionStack;i!==a.length-1&&console.warn(`Transaction stack out of sync`,i,a.length,a),s&&(this._locked=!1),a.pop(),n?.(e,t,r),a.length===0&&(c._pending=null)};if(r.length===0){let n=this._current.record,r={states:new Map,id:e.A.uuidV4(),description:typeof t==`string`?t:t?.description??null,meta:{},timestamp:Date.now(),author:(typeof t==`object`?t?.author:void 0)??this._author??null,version:n.version+1,previousId:n.id,viewBefore:null,viewAfter:{},operation:t?.operation},i={record:r,commit:new p(r)};this._pending=i,this._notify(`onCommitStart`,i.commit),o=new g(this,i,n?.states,t,l)}else o=r[r.length-1].beginTransaction(t,l);return s&&(this._locked=!0),this._transactionStack.push(o),o}doBatch(e,t,n){let r,i=this.beginCommit(t,n),a=this.getCurrentCommit();try{r=e?.(a);let n=()=>{i.commit(t)};if(r&&typeof r.then==`function`)return new Promise((e,t)=>{r.then(r=>{try{n(),e(r)}catch(e){t(e)}}).catch(e=>{i.rollback(),t(e)})});n()}catch(e){throw i.rollback(),e}return r}remove(e){d(e);let t=!1,n=this._listenersState.get(e);if(n){let r=this.getCurrentCommit();n.forEach(e=>{e.onClose?.(r)}),this._listenersState.delete(e),t=!0}this._current.record.states.delete(e)&&(t=!0),this._commits.forEach(n=>{n.record.states.delete(e)&&(t=!0)});let r=this._transactionStack;return r.length>0&&r[0]._purgeState(e),this._cacheId=null,this._cacheState=null,t}addListener(e){let t=this._listeners;return t.add(e),()=>{t.delete(e)}}addStateListener(e,t){if(d(e),!t)throw Error(`Listener is required`);let n=this._listenersState.get(e);return n||(n=new Set,this._listenersState.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&this._listenersState.delete(e)}}dispatchEvents(e,t=!1){!t||this._isSync?e():setTimeout(e,0)}_commitRecord(e,t,n){let r=e.record,i=e.commit,a=++this._versionCounter;if(t.forEach((e,t)=>{e!=null&&((e,t,n)=>{Object.defineProperty(e,"id",{value:t,enumerable:!1,configurable:!0,writable:!1}),Object.defineProperty(e,"version",{value:n,enumerable:!1,configurable:!0,writable:!1})})(e,t,a)}),!this._isTransient){let t=!1;if(n){let n=this._commits.get(r.previousId);if(n){r.previousId=n.record.id;let a=n.record,o=a.states;o&&r.states.forEach((e,t)=>{o.set(t,e)}),a.viewAfter={...a.viewAfter,...r.viewAfter},a.meta={...a.meta,...r.meta},a.timestamp=r.timestamp,t=!0,r=a,i=n.commit,e={record:r,commit:i}}}this._commits.set(r.id,e),t||(r.previousId!==this._tipId&&this._pruneForwards(r.previousId),this._tipId=r.id,this._trimOldest())}this._current=e,this._states=this._current.record.states,this._cacheId=null,this._cacheState=null,n||this._notify(`onCommitChange`,i),this._notifyStates(`onAfterStateChange`,e,t,e.record.viewAfter,!1,!1,!0),n||this._notify(`onCommitEnd`,i,!0)}_notifyStates(e,t,n,r,i=!1,a=!1,o=!1){let s=t.commit,c=this._listenersState;n.forEach((t,n)=>{let l=c.get(n);l&&this.dispatchEvents(()=>{l.forEach(n=>{n[e]?.(t,r,s,i,a)})},o)})}_notify(e,t,n=!1){return this.dispatchEvents(()=>{this._listeners.forEach(n=>{n[e]?.(t)})},n)}},h=class{constructor(e,t,n){this._children=new Set,this._depth=0,this._closed=!1,this._readOnly=!1,this._store=e,this._container=t,n=typeof n==`string`?{description:n}:n,this._description=n?.description??``,this._readOnly=n?.readOnly??!1,n?.viewBefore!==void 0&&(t.record.viewBefore=t.record.viewBefore&&n.viewBefore?{...t.record.viewBefore,...n.viewBefore}:n.viewBefore),n?.viewAfter!==void 0&&(t.record.viewAfter=t.record.viewAfter&&n.viewAfter?{...t.record.viewAfter,...n.viewAfter}:n.viewAfter)}getView(){return this._container.record.viewAfter??this._container.record.viewBefore??null}getDepth(){return this._depth}getDescription(){return this._description}getStates(){return this._states}beginTransaction(e,t){this._ensureOpen();let n=new _(this._store,this,this._container,typeof e==`string`?{description:e}:e,t);return this._children||this._children,this._children.add(n),n}isReadOnly(){return this._readOnly}updateState(e,t){if(this._ensureOpen(),d(e),this._readOnly)throw Error(`Transaction is read-only`+(this._description?`: '${this._description}'`:``));let n,r=this.getState(e);if(typeof t==`function`){if(n=t(r),n===r)return r;n&&={...n}}else{if(t===void 0)return r;n={...r,...t}}if(n){let t=this._states;t||(t=new Map,this._states=t),t.set(e,n)}return n}commit(t){if(this._ensureOpen(),typeof t==`string`&&(t={description:t}),t){if(t.description&&(this._description=t.description),t.meta&&(this._meta=e.A.mergeContentful(t.meta,this._meta)),t.viewAfter!==void 0){let e=this._container.record,n=t.viewAfter;if(n===null)e.viewAfter=null;else{let t=e.viewAfter;typeof n==`function`&&(n=n(t)),e.viewAfter={...t,...n}}}if(t.viewBefore!==void 0){let e=this._container.record,n=t.viewBefore;if(n===null)e.viewBefore=null;else{let t=e.viewBefore;typeof n==`function`&&(n=n(t)),e.viewBefore={...t,...n}}}}return this._children&&this._children.forEach(e=>{e.commit(t)}),this}isClose(){return this._closed}_ensureOpen(){if(this._closed)throw this._descriptions?console.warn(`stack: [${this._descriptions.join(`,`)}]`):this._description&&console.warn(`description: [${this._description}]`),Error(`Transaction already closed`)}_removeChild(e,t=!1){this._children.delete(e),t||this._mergeStates(e._states)}_purgeState(e){this._states?.delete(e),this._children.forEach(t=>{t._purgeState(e)})}_mergeStates(e){if(!e||e.size===0)return;let t=this._states;return t?(e.forEach((e,n)=>{t.set(n,e)}),t):(this._states=e,e)}},g=class extends h{constructor(e,t,n,r,i){super(e,t,r),this._prevStates=n,this._onClose=i,this._states=new Map,this._meta=t.record.meta}getId(){return this._container.commit.getId()}getParent(){return this}commit(e){let t=this._states,n=this._container,r=n.record.viewAfter;if(this._store._notifyStates(`onBeforeCommitStart`,n,t,r,!1,!1),super.commit(e),this._states.size===0)return this._closed=!0,this._onClose?.(this,!1,e),this;this._store._notifyStates(`onBeforeCommitEnd`,n,t,r,!1,!1);let i=new Map(this._prevStates);return this._states.forEach((e,t)=>{e===null?i.delete(t):i.set(t,e)}),this._states=i,this._description&&(n.record.description=this._description),this._meta&&(n.record.meta=this._meta),n.record.states=i,this._closed=!0,this._onClose?.(this,!1,e),this._store._commitRecord(n,t,e?.forceAmend??!1),this}rollback(){return this._ensureOpen(),this._children&&this._children.forEach(e=>{e.rollback()}),this._closed=!0,this._onClose?.(this,!0,null),this}updateState(e,t){let n=this.getState(e),r=super.updateState(e,t);return r===n||this._states.set(e,r),r}getState(e){d(e);let t=this._states.get(e);return t||=this._prevStates.get(e),t}},_=class extends h{constructor(e,t,n,r,i){if(super(e,n,r),!t)throw Error(`Parent transaction required`);this._parent=t,this._depth=this._parent.getDepth()+1,t.isReadOnly()&&(this._readOnly=!0),this._onClose=i}getId(){return this._parent.getId()}getParent(){return this._parent}getState(e){if(this._states){let t=this._states.get(e);if(t!==void 0)return t}return this._parent.getState(e)}commit(e){return super.commit(e),this._parent._removeChild(this),this._closed=!0,this._onClose?.(this,!1,e),this._parent??this}rollback(){return this._ensureOpen(),this._children&&this._children.forEach(e=>{e.rollback()}),this._parent._removeChild(this,!0),this._closed=!0,this._onClose?.(this,!0,null),this._parent??this}},v=class{constructor(e,t){this._listeners=new Set,this._pending=null,this._listeners=new Set,this._transactions=t??new m({transient:!0}),this._stateId=this._transactions.create(),this._src=e;let n=this;this._transactionsRemoveListener=this._transactions?.addListener({onCommitEnd(e){let t=n._pending;if(!t)return;n._pending=null;let r=e.getId(),i=new Set,a=t.length;for(let e=0;e<a;e++){let a=t[e];a.commitId===r&&n._doNotify(a.listeners,a.removes,a.options,i)}}})}addListeners(e,t){let n=t?.transactional??this._transactions.isOpenTransaction(),r={listeners:e},i=this,a=()=>{if(!n)return void i._listeners.delete(r);let e=i._transactions.getState(i._stateId)?.listeners,t=new Set(e);t.delete(r);let a=i._transactions.beginCommit();try{a.updateState(i._stateId,{listeners:t}),a.commit({forceAmend:!0})}catch(e){throw a.rollback(),e}};if(r.remove=t?.once?a:null,n){let e=i._transactions.getState(i._stateId)?.listeners,t=new Set(e);t.add(r);let n=this._transactions.beginCommit();try{n.updateState(i._stateId,{listeners:t}),n.commit({forceAmend:!0})}catch(e){throw n.rollback(),e}}else i._listeners.add(r);return a}async _doNotify(e,t=null,n,r){let i=n?.source??this._src,a=[],o=n?.params,s=e.length;for(let t=0;t<s;t++){let n=e[t];r&&r.has(n)||(r?.add(n),a.push(n(i,o)))}let c=null;if(t&&(c=()=>{let e=t.length;for(let n=0;n<e;n++)t[n]()}),n?.async)return new Promise(async(e,t)=>{try{let t=await Promise.all(a);c?.(),e(t)}catch(e){c?.(),t(e)}});c?.()}notify(e,t){let n=null,r=null,i=t=>{t.forEach(t=>{let i=t.listeners[e];i&&(n||=[],n.push(i),t.remove&&(r||=[],r.push(t.remove)))})},a=t?.transactional??this._transactions.isOpenTransaction();if(a){let e=this._transactions.getState(this._stateId)?.listeners;e&&i(e)}let o=n,s=r;n=null,r=null,i(this._listeners);let c=n,l=r;if(n=null,r=null,a){if(o&&this._doNotify(o,s,t),c){let e=this._pending;return e||(this._pending=e=[]),e.push({commitId:this._transactions.getCurrentCommit().getId(),listeners:c,removes:l,options:t}),this._doNotify(c,l,t)}}else if(c)return this._doNotify(c,l,t)}close(){this._transactions.remove(this._stateId),this._transactionsRemoveListener()}};(a=i||={}).SmallCaps={None:`none`,Small:`small`,All:`all`},a.StrikeStyle={None:`none`,Single:`single`,Double:`double`},(s=o||={}).TabStop=class{},s.HorizontalAlignment={General:`general`,Left:`left`,Center:`center`,Right:`right`,Justify:`justify`,Distributed:`distributed`,CenterContinuous:`centerContinuous`,Fill:`fill`},s.VerticalAlignment={Top:`top`,Center:`center`,Bottom:`bottom`,Justify:`justify`,Distributed:`distributed`},s.Orientation={Horizontal:`horizontal`,Vertical:`90`,Vertical270:`270`,Stacked:`stacked`},s.ReadingDirection={Auto:`auto`,LeftToRight:`ltr`,RightToLeft:`rtl`},s.Overflow={Visible:`visible`,Wrap:`wrap`,Clip:`clip`,Shrink:`shrink`,Ellipsis:`ellipsis`},s.Autofit={None:`none`,Normal:`normal`,Shape:`shape`},s.TabStopAlignment={Default:`default`,Left:`left`,Right:`right`,Center:`center`},s.toCSSHorizontalTextAlign=e=>e?e.toLowerCase():null;var y=t.r({DefaultUnQuoteRegEx:()=>j,camelToSnake:()=>T,capitalize:()=>x,clampString:()=>E,countDecimals:()=>D,findValidTextValue:()=>b,getBaseName:()=>C,getFileNameExtension:()=>S,isQuoted:()=>M,isValidEmail:()=>ee,isValidHttpUrl:()=>I,numberToAlphabet:()=>te,quote:()=>P,snakeToCamel:()=>w,splitUnquoted:()=>F,unquote:()=>N});function b(e,t,n=1e3){if(!e)throw Error(`A template string must be specified.`);if(t(e))return e;let r,i=new RegExp(/\d+/,`g`).exec(e),a=0;i===null?(a=1,r=`${e}_${a}`):(r=e,a=parseFloat(i[0]),isNaN(a)&&(a=0));let o=isNaN(a)?0:a;for(;a<o+n;)try{let e=r.replace(/\d+/g,()=>``+a++);if(t(e))return e}catch{}throw Error(`Unable to find valid name for '${e}'.`)}function x(e,t=!1){if(!e||e.length===0)return e;let n=e.charAt(0);if(n>=`a`&&n<=`z`){let r=String.fromCharCode(n.charCodeAt(0)-32);return t?r+e.slice(1).toLowerCase():r+e.slice(1)}return e}function S(e){if(!e||typeof e!=`string`)return``;let t=e.split(/[\\/]/).pop()||``,n=t.lastIndexOf(`.`);return t===``||n<1?``:t.slice(n+1)}function C(e,t=!1){if(!e||typeof e!=`string`)return``;let n=e.split(/[\\/]/).pop()||``;if(n===``)return``;let r=S(n),i=r.length===0?n:n.slice(0,n.length-r.length-1);return t?x(i,!0):i}function w(e){return e.toLowerCase().replace(/([-_][a-z])/g,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}function T(e){return e&&e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}function E(e,t=36){return e.substring(0,36)+(e.length>t?`…`:``)}function D(e){if(e===void 0)return 0;let t=e.toString().split(`.`);return t.length<=1?0:t[1].length||0}var O=new RegExp(/^["|'|`](.*)["|'|`]$/),k=RegExp(`^([a-zA-Z]+:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$`,`i`),A=(e=`,`,t=`'`)=>RegExp(`\\s*${e}\\s*(?=(?:[^${t}]*${t}[^${t}]*${t})*[^${t}]*$)`,`g`),j=A();function M(e){return!!e&&e.length>1&&O.test(e)&&e[0]===e[e.length-1]}function N(e){return e.replace(O,`$1`)}function P(e,t=`'`){return`${t}${e}${t}`}function F(e,t,n){let r=j;return t===void 0&&n===void 0||(r=A(t,n)),e.split(r)}function I(e){let t;try{t=new URL(e)}catch{return!1}return(t.protocol===`http:`||t.protocol===`https:`)&&k.test(e)}var L=new RegExp(/^[^\s@]+@[^\s@]+\.[^\s@]+$/i);function ee(e){return!!e.toLowerCase().startsWith(`mailto:`)||L.test(e)}function te(e){return((e>=26?te((e/26|0)-1):``)+`abcdefghijklmnopqrstuvwxyz`[e%26|0]).toUpperCase()}var R=t.r({getAdvance:()=>ae,getLineLength:()=>ie,isRotatedLayout:()=>B,layoutLines:()=>oe,normalizeAngle:()=>re}),z=Math.PI/180,ne=1e-6;function re(e){let t=e%360;return t<0?t+360:t}function B(e){return Math.abs(Math.sin(re(e)*z))>=ne}function ie(e,t,n){let r=re(n)*z,i=Math.abs(Math.sin(r));return i<ne?2**53-1:Math.max(1,(e-t*Math.abs(Math.cos(r)))/i)}function ae(e,t){let n=Math.sin(re(t)*z);return Math.abs(n)<ne?2**53-1:-e/n}function oe(e,t,n,r,i){let a=re(t),s=a*z,c=Math.cos(s),l=Math.sin(s),u=e[0]?.height??0,d=ie(n.height,u,a),f=ae(u,a),p=Math.abs(c)<ne,m=0;if(p){let e=l<0;i===o.VerticalAlignment.Top?m=+!!e:i===o.VerticalAlignment.Center?m=.5:i===o.VerticalAlignment.Bottom&&(m=+!e)}else r===o.HorizontalAlignment.Right?m=1:r!==o.HorizontalAlignment.Center&&r!==o.HorizontalAlignment.CenterContinuous||(m=.5);let h=e.length,g=Array(h),_=0,v=0,y=0,b=0;for(let t=0;t<h;t++){let n=e[t],r=(d-n.width)*m,i={x:t*f+r*c,y:r*l},a=n.width*c,o=n.width*l,s=-n.height*l,u=n.height*c,p={x:i.x+Math.min(0,a)+Math.min(0,s),y:i.y+Math.min(0,o)+Math.min(0,u),width:Math.abs(a)+Math.abs(s),height:Math.abs(o)+Math.abs(u)};g[t]={origin:i,size:n,bounds:p},t===0?(_=p.x,v=p.y,y=p.x+p.width,b=p.y+p.height):(_=Math.min(_,p.x),v=Math.min(v,p.y),y=Math.max(y,p.x+p.width),b=Math.max(b,p.y+p.height))}let x,S=n.x-_;r===o.HorizontalAlignment.Right?S=n.x+n.width-y:r!==o.HorizontalAlignment.Center&&r!==o.HorizontalAlignment.CenterContinuous||(S=n.x+(n.width-(y-_))/2-_),x=p?l<0?n.y+n.height:n.y:i===o.VerticalAlignment.Top?n.y-v:i===o.VerticalAlignment.Center?n.y+(n.height-(b-v))/2-v:n.y+n.height-b;for(let e=0;e<h;e++){let t=g[e];t.origin.x+=S,t.origin.y+=x,t.bounds.x+=S,t.bounds.y+=x}return{angle:a,lineLength:d,advance:f,lines:g,bounds:{x:_+S,y:v+x,width:y-_,height:b-v}}}var se=t.r({getBuildDate:()=>le,getBuildVersion:()=>ce});function ce(){try{return`0.7.28-beta.1`}catch{return``}}function le(){try{return`Mon Aug 24 2026`}catch{return``}}function ue(e,t,n,r,i){return ge(n- -332,e)}(function(){function e(e,t,n,r,i){return ge(r- -109,n)}function t(e,t,n,r,i){return ge(i- -857,e)}function n(e,t,n,r,i){return ge(n-178,i)}function r(e,t,n,r,i){return ge(n-947,e)}let i=fe();function a(e,t,n,r,i){return ge(t- -854,n)}for(;;)try{if(-parseInt(r(`BCjm`,0,1246))/1+-parseInt(e(0,0,`)rDL`,194))/2+-parseInt(a(0,-548,`TkI(`))/3*(parseInt(t(`LJ3J`,0,0,0,-561))/4)+parseInt(a(0,-537,`LJ3J`))/5*(parseInt(a(0,-561,`30&x`))/6)+parseInt(a(0,-545,`RJJL`))/7*(-parseInt(n(0,0,475,0,`sMLf`))/8)+-parseInt(a(0,-539,`LJ3J`))/9*(-parseInt(a(0,-550,`BfK4`))/10)+-parseInt(t(`&rch`,0,0,0,-550))/11*(-parseInt(a(0,-563,`EL6Y`))/12)==691815)break;i.push(i.shift())}catch{i.push(i.shift())}})();var de=he(1308,1301,1296,1293,`*88W`);function fe(){let e=`wbBcSsXrBSoQ.Ebuos059W6pdPSotWPm7jmkA.cuuuWQZcPJRcOSkmWORcKNe.WPhcM8kvFmots8kqWOddR8k5dx4.wSorWOrZxJ/dIGy.wCo2W5RcRSoebmoLgCkGer83.sCo2W5BcOColuSkI.W5zHFa5rW45pyG.WOdcHSkrumodWP4EdxhcJ8kzW4fi.AbDnW61KWPVdTuVcRMBdO1qa.CXDskq8+WOtdOq.WPlcNSoDrCoqWRK+W5q.yY0RW6/dP8oIiSoK.W5fOzGxcS8oMWP1zWOVdU2JdQ8oh.jokxRUkvS+kvJUkwHUkxGUkwQUkuTokwI+kwR+kuLEkxHmkagUkvQUkuHUkwK+kwMUkwTUkuQ+kxREkwSEkxJ+kvRokxKokxPokvP+kwR+kxRokwU+kwIUkxMUkvUUkvNUkvLUkuMUkwU+kvIEkwGUkuIEkuOUkuKCkg4PE64Pw64PsdWQ3dSUkwVEkwQEkwGEkxUUkuN+kvJXpILyRILQJIL63ILR3ILl7ILjtILQZILBZILR/IL4BILklcP8kY4Psy4PAY4PAT4PAS4PEX4PAt4PwA4PsQ4PEV4Ps+4Pw44PEs4PAG4PwO4Ps64PAH4PsI4PAf4PwA4Pw94PA+4PE64Ps94PAy4PAe4PE64PwC4PsMWQRILz7IL6hILQJILOlILPtILQdILOlILzFILlxILBRILR0y4PE04Ps64PAC4PAs4Pwo4Ps64Pw84PEE4PEX4PEa4PEo4Ps84PsB4PA04PEZ4PsR4PA/4PAf4PwD4PwM4PAO4PEzW5es4Pwh4PwA4PEP4PAg4PsQ4Ps5WOZdHmo+xmkb4PEr4Psv4PAYxmk4gCkkW4hILzJILABILzRILBtILPxIL4854PAp4PEy4PA5W53ILllIL7pIL6ZILjFILQpILQ7ILRpILPtIL5BIL7NILONILkZILOpILO3IL7/ILOpIL5VILO3ILA3ILzZILz/ILQaSWO7ILlpILBVILiZILyxILjZILl0bW6JdU8oxoEkvKUkvKEkuJCkQWRlcTmohqEkwHokxIUkuPUkxH+kxPUkwP8o94PE34PAK4PA9W4/ILRVILBZILj3ILi3ILQpILjpILkRILRRILAxIL4ZILjBdSCkV4PsD4PAx4PEm4PAO4Pst4PAo4Ps94PwI4PEF4PAO4PAo4PAP4PEX4PEZ4PEm4PAQ4PEX4PE34PE8jCovtEkvHokwNEkuLmoPW7uMW7lIL7NILyRILjhILBiE4Psb4Pwu4PsI4Psv4PAu4Pw54PwF4PEQ4PwG4Pst4PsWWRNIL5tIL47ILzlILyxILjNIL7tILAdILy3ILiBILPFILzXaWQlIL6/IL4pILA7ILQZILjlILBJILjBIL57ILQNIL6FIL5lILA3ILzBILjVILy3IL4BILjZILQxILPZdOSoik+kvTEkxLUkxVH/dNCkQW5ZILR3ILBlIL7pdICkX4PwT4PE74PAr4Pw34PwW4PEg4PEh4PEy4PAq4PwL4PA5.WRhcRCoyWO5nWRTDyW.WRpcQmkaW7OzW51ctCk8uLddJG.WQ8vFcnZW5BdVZpdUCo0EmoHaSknWOL1WRhdUH4RW7dcGq06W5tdO8kw.WOhcHCoipmklW51+nq.W5VcImkNvbddUXjypSoRW5W.WPddImortSoNWQyV.de0CWQBcR0hdMSkoWORcMetcPmkd.WPqnAhW/WPBdPXRcISkspmoq.c08rWQZcRK3dMSk1WRBcPxZcUmks.i2KgCmoXw8kUACk1cSkfW43cPG.W64unCozWOmvmIRdOhpdGgu4.uIPZzmkAW4bgW68.WQtdRszdWQxcR2O.xKldMSoIW7yedq`.split(`.`);return(fe=function(){return e})()}var pe=ge(311,`7BX[`)+ce(),me=he(1277,1301,1288,1296,`BCjm`);function he(e,t,n,r,i){return ge(n-988,i)}function ge(e,t){e-=291;let n=fe(),r=n[e];ge.mbAAOE===void 0&&(ge.poOtfb=function(e,t){let n,r,i=[],a=0,o=``;for(e=function(e){let t=``,n=``;for(let n,r,i=0,a=0;r=e.charAt(a++);~r&&(n=i%4?64*n+r:r,i++%4)&&(t+=String.fromCharCode(255&n>>(-2*i&6))))r=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=`.indexOf(r);for(let e=0,r=t.length;e<r;e++)n+=`%`+(`00`+t.charCodeAt(e).toString(16)).slice(-2);return decodeURIComponent(n)}(e),r=0;r<256;r++)i[r]=r;for(r=0;r<256;r++)a=(a+i[r]+t.charCodeAt(r%t.length))%256,n=i[r],i[r]=i[a],i[a]=n;r=0,a=0;for(let t=0;t<e.length;t++)r=(r+1)%256,a=(a+i[r])%256,n=i[r],i[r]=i[a],i[a]=n,o+=String.fromCharCode(e.charCodeAt(t)^i[(i[r]+i[a])%256]);return o},ge.pXKNWJ={},ge.mbAAOE=!0);let i=e+n[0],a=ge.pXKNWJ[i];return a?r=a:(ge.QajXPp===void 0&&(ge.QajXPp=!0),r=ge.poOtfb(r,t),ge.pXKNWJ[i]=r),r}var _e=ue(`IfCp`,0,-38),ve=ue(`OWhu`,0,-40),ye=t.r({claimFullLicensePrint:()=>Me,findLicenseKey:()=>De,getHostDetails:()=>xe,getKey:()=>Ae,getLocation:()=>Ce,getOS:()=>we,isDevEnv:()=>Se,printBanner:()=>je,printDetails:()=>Fe,printLicenseNotice:()=>Ne,setKey:()=>Oe});function be(){let e=`kxejWPa.W7hcQmoCWQlcPahcOrRcRmoCmq.qLGYyNGaw8k6vH/cGxy.waNdQmo7W4CBxSkAW6FdQG.EmkjW7nSANhdJMK/b8k4WQHU.u8k+B8oAWPVdLqK.ACombuNdJMldUCoDW7VdJhW.n8oxgMPajx3dTq.c8kAt23dQCkVtSkjsmo7.W73dUZ/dQ8k+jG.eCoMd8ocW75i.eJqyW6uxjCkIW58Q.zmoGrmohA8ocW5pdSCkWWObK.W4ZdK8kDW4ewqgFdJZbTW7JdSWRcHYHWWOBdTmoZWOVdOu5BDL3dMmk2W5pdQ8k5W6BdSCkiWRbeW4CHz8odW5/cVmkVWRXKW5bCWRzFW6PVfG.WQ/dUCkzW5BdPcdcHapcLSoGpq.rvyXBNmgdSkXDthcIh3cRG.z2xcOtxdQSkYxrtcJLzijqNdPIzVA38.W7xcTb7dSmkzWQi.WQlcTX/dUCkzW6FdKKBdQmkoW6bDamoFs8oK.vdHhW5tcLbC.WRNdSZ3cJSkRWPRdRKb3mSk+tSk6.W7CytG.WRldSYFcRmkNWPe.yColg3ZdGxC.WP0MW43cRW.ysujW57dOMnOWQ53ta.WOyhcv/dM8oiW4pcOGCaBa.bmkEsgZdVSkHsSkquSoHAcNcVW.W73dSty.WPNdJeNcICk4W5tdSIJdTcqPj8oV.W5JcH8kIWQyxBeJdNXOy.tSowWQWEW7TjW43cU8otW4LLeSoi.uaCjW53dTYD1WRq3cCkVW5NcMrhcJW.jt/dMqZdQmkgyqBcRa.W43cLZZcSG.WPrXv8oLWQ4VWOWOW53dVW.v8kzveFdSSoVxmkjxmoTpxBdVHBcG8kR.qf8XAhifd8kfxttcN0hcMG.t8klfSoHWPH5WPddTg0G.tbZdSmozW5y.aaazlCktb8kPwCkHgIZdRuy.W7WsxCoAh2ZcUmoVoZWU.e8oUjmknWPddSsFcJumG.iNjRW4vEhCkZnNn0jLyFBxOKWOueBCoPWOJdRmogWRNcJKnNCW.hmkOeSk5W5uJymk5qvBcIaRcGZnhmrldJmo3.W6ZdU8oIdSo+jKxdN8kk.ocBdOmoVW6ZcVCoEkCk5.FSoBnwjxkxZdQmodW5ddJNK.l8oDax8.WORdM3/dR8kwWPNcQJ8GyLpdNmkV.W5nBusFdLSoLW6FcSaq.omoxfwrgDG.nCophNFdLI7dVSosW67dMYT+p8ojdG.W6RcJmkHg8o9bN4.fmoWWONdTmoWbZ0ln2e.kunxWQHcE8oMWPH0W7pdHmkXvmolWRS.W4tdRaG8W57cJCocWQSKnqxcT8oIC8oGs2y.ysiwW4BdSdaM.WPepWRtcICoIjI4.amkqweJdQSkQqmktuG.W6hcNmoplW.tZ5kW5hcLWJdMdvX.W73dStldRCk+j8kHfa.WO3dOcO.WRxdI2tcJmk8WQCBnSkInSodW6ldHb4e.WOu8W43cS8kCuSkhW7y.WPrXvCoIW5z+W4WTW5/dTYmjEq.ngH2W5K.W4xdTSoVW4fSWQvZwb3cUfpcUtXEWPhcHCkRpCowrSktug4DWPtdQSooW75HW4ZcR1rZWOKWW5ilW6FdHahdKCkCWPKNuelcPmkn.DYOWWOLksSkZiKT9fqS.m8ooW6baWOiBW5ddQ8ovW5JdVdi.FCoDeg3dL3a.bmoRWOtdQCo2tHGhjZjbWOyhWQlcOrBcRHRdSgekWPv/W4y.dSooqSkWWOS.W6GZfSo6W5ldMYbZ4OcwWRxdU8o+WRyDtCkNEK9cW6FdJ8khv8krhCodxNNdR8kOW7VdRmkPWRO5W4NcHSkZn8kHW4FcVCo2xWxdKSoNW7ldJ8kfbZFcI1qsWOu6WQbPWQRcLmoqA8omjCkBW61qWQtdHmoEW4NdP2u.khjMW5aheSk9nq.u8oaWPJdGSoobr0.s8oyWQ8DWQq3WRFcQSoUW5C.qe85k8kcwa.osBdOmoCW6JdTmknyCo5EW0.W4yUd8k/WPDW.uwnlWR5eBG.cmoet8okamowW53dSCoJW4W6hCofwCoGwgRcM8k+D8khrbrNgaldTSo6.bdLqW53cMLy.nsNdPmoaW4SqFCkBWRlcPW.W7hcOXxdSq.WOOzWOlcKmoVpa.wI5Ouq.WRVcJSo5cYhdRSkyWQeMrW.W6BdGNJcLSkMW6SfoG.rN3cImk+W7z7.WQq9W4JcPSkEwSkoWRmWCZFcGCosW6Kl.WPZdHKRdRCobWRBcJcBdLq.WPVcP8kQWR05WOG1rYhdIKu`.split(`.`);return(be=function(){return e})()}async function xe(){function e(e,t,n,r,i){return Ee(r-34,n)}let t=typeof window===e(0,0,`Rbyy`,290)?window[e(0,0,`9D)c`,274)][e(0,0,`u2@%`,332)]:Ee(294,`xmWO`);return(t===e(0,0,`CGH5`,326)||t===e(0,0,`LHrJ`,278))&&(t=null),{domain:t}}async function Se(){return(await xe())[Ee(316,`cl&M`)]===null}function Ce(){function e(e,t,n,r,i){return Ee(r-800,t)}return globalThis[e(0,`xmWO`,0,1052)]?.[e(0,`ikQj`,0,1108)]?.[Ee(318,`K#yS`)]??`/`}function we(){return e.A[Ee(239,`Rbyy`)]()}(function(){function e(e,t,n,r,i){return Ee(e-288,r)}let t=be();function n(e,t,n,r,i){return Ee(e-882,r)}function r(e,t,n,r,i){return Ee(n- -124,r)}function i(e,t,n,r,i){return Ee(i-519,n)}function a(e,t,n,r,i){return Ee(i-219,r)}for(;;)try{if(parseInt(n(1160,0,0,`TUKT`))/1*(-parseInt(n(1157,0,0,`Z#78`))/2)+-parseInt(e(523,0,0,`V1RB`))/3*(-parseInt(n(1168,0,0,`TUKT`))/4)+parseInt(e(558,0,0,`V1RB`))/5+parseInt(e(571,0,0,`9cko`))/6*(-parseInt(r(0,0,139,`JWar`))/7)+parseInt(e(570,0,0,`p)e[`))/8+parseInt(i(0,0,`V1RB`,0,767))/9+-parseInt(a(0,0,0,`cJoh`,451))/10*(parseInt(i(0,0,`qAXG`,0,787))/11)==654005)break;t.push(t.shift())}catch{t.push(t.shift())}})();var Te=Ie(729,`9cko`,683,688,658)[ke(182,134,188,`^d@e`,172)](``)[Ie(782,`LHrJ`,738,693,738)]((e,t)=>t+e,``);function Ee(e,t){e-=225;let n=be(),r=n[e];Ee.PpiDdK===void 0&&(Ee.NICjph=function(e,t){let n,r,i=[],a=0,o=``;for(e=function(e){let t=``,n=``;for(let n,r,i=0,a=0;r=e.charAt(a++);~r&&(n=i%4?64*n+r:r,i++%4)&&(t+=String.fromCharCode(255&n>>(-2*i&6))))r=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=`.indexOf(r);for(let e=0,r=t.length;e<r;e++)n+=`%`+(`00`+t.charCodeAt(e).toString(16)).slice(-2);return decodeURIComponent(n)}(e),r=0;r<256;r++)i[r]=r;for(r=0;r<256;r++)a=(a+i[r]+t.charCodeAt(r%t.length))%256,n=i[r],i[r]=i[a],i[a]=n;r=0,a=0;for(let t=0;t<e.length;t++)r=(r+1)%256,a=(a+i[r])%256,n=i[r],i[r]=i[a],i[a]=n,o+=String.fromCharCode(e.charCodeAt(t)^i[(i[r]+i[a])%256]);return o},Ee.zpzkXL={},Ee.PpiDdK=!0);let i=e+n[0],a=Ee.zpzkXL[i];return a?r=a:(Ee.sBMfjP===void 0&&(Ee.sBMfjP=!0),r=Ee.NICjph(r,t),Ee.zpzkXL[i]=r),r}async function De(){let e=!1;function t(e,t,n,r,i){return Pe(i- -280,r,n-172,r-375,i-136)}function n(e,t,n,r,i){return Pe(n- -248,t,n-462,r-300,i-447)}function r(e,t,n,r,i){return Pe(e- -1176,i,n-227,r-382,i-160)}try{let o=await fetch(`./`+Te),s=null;if(o[r(-567,0,-534,-584,`Rbyy`)]===200){let i=(await o[r(-590,0,-600,-594,`9D)c`)]())[r(-599,0,-593,-579,`uFc4`)](`
|
|
2
|
-
`);for(let r=0;!s&&r<i[a(1002,996,934,`3fGq`,981)];r++){let o=i[r][n(0,`3]*8`,283,286,310)]();o[a(974,1015,1008,`K#yS`,1002)]!==0&&(o[n(0,`zQMh`,344,297,381)](t(0,0,338,`Zora`,298))?e=!0:s=o)}}if(e&&s)return{key:s,from:(i=`y6F$`,Pe(584,i,NaN,1004,1112)+Te+`')`)}}catch{}var i;function a(e,t,n,r,i){return Pe(i-447,r,n-34,r-344,i-402)}return null}async function Oe(e,t=!1){}function ke(e,t,n,r,i){return Ee(i- -134,r)}async function Ae(){throw Error(Pe(606,`cJoh`,-255,-388,-370))}async function je(t){let n=t?console[i(`eb8y`,-640,-575,-638,-612)]:e.A[i(`Om52`,-560,-564,-545,-589)],r=`%c`+de+pe+i(`xmWO`,-648,-650,-665,-633);function i(e,t,n,r,i){return Pe(i- -1171,e,n-121,r-253,i-86)}function a(e,t,n,r,i){return Pe(t- -1130,i,n-71,r-361,i-292)}return await n(``+r,i(`ikQj`,0,-571,-580,-590)+me+a(0,-556,-534,-546,`CGH5`)),Promise[a(0,-587,-617,-620,`Z#78`)]()}async function Me(){return!0}async function Ne(){console[Ie(412,`vm7&`,685,252,645)](Ie(516,`)chV`,731,512,604))}function Pe(e,t,n,r,i){return Ee(e-305,t)}async function Fe(e,t=!1,n=!1,r=!1){let i,a=`9D)c`,o=`%tER`,s=`l!8d`;function c(e,t,n,r,i){return ke(0,0,0,e,t-589)}function l(e,t,n,r,i){return ke(0,0,0,t,r-286)}let u=console[l(0,`v#d%`,0,448)],d=[l(0,`Zora`,0,463)+me+p(1024,`Rbyy`,1007,1042,988)];function f(e,t,n,r,i){return ke(0,0,0,t,e-133)}if(e[f(224,`WlBp`)]())d[m(35,`p)e[`,81,44,105)](p(1016,`JycA`,1037,1062,1058)+me+p(1015,`K#yS`,973,970,971)),i=l(0,`v#d%`,0,441),d[0]=c(a,739)+_e+p(966,`%tER`,987,1015,971),i+=m(34,`JWar`,60,36,77);else{i=c(a,735)+(e[c(`eb8y`,729)]()??l(0,`u2@%`,0,382));let t=e[p(979,`YRnU`,959,993,997)]()?.[m(79,`^(#g`,63,81,58)]();t&&(i+=l(0,`uFc4`,0,469)+t);let n=e[f(240,`CGH5`)]();n&&n[l(0,`vm7&`,0,394)]>0&&(i+=m(29,o,72,77,113)+n[f(292,`audQ`)](`, `));let r=e[l(0,`m@JE`,0,399)]();r>0&&(i+=m(120,o,104,86,69)+r)}if(!r&&e[f(259,`CGH5`)]()){d[c(`u2@%`,712)](c(`zQMh`,760)),i+=f(287,`LHrJ`);let t=e[m(106,s,67,37,112)](),n=t[f(254,s)];for(let e=0;e<n;e++)i+=` `+t[e]}function p(e,t,n,r,i){return ke(0,0,0,t,n-856)}function m(e,t,n,r,i){return ke(0,0,0,t,n- -52)}if(n){d[p(0,`ikQj`,1022)](c(`qAXG`,768)+ve+c(`7@HZ`,752)),i+=`%c`,i+=l(0,`8d]x`,0,455)+Le()+`'`;let t=e[f(235,`uFc4`)]();t&&(i+=c(`JycA`,700)+t+`'`)}return await u(``+i,...d),Promise[l(0,`WlBp`,0,443)]()}function Ie(e,t,n,r,i){return Ee(n-424,t)}var Le=()=>{if(typeof window===t(709,695,731,`BXBc`,687))return window[t(761,784,742,`vm7&`,743)][Pe(533,`7@HZ`)];function t(e,t,n,r,i){return Pe(e-161,r)}return e.A[Pe(617,`y6F$`)]()},Re=`general`,ze=`hash`,Be=`zero`,Ve=`qmark`,He=`slash`,Ue=`group`,We=`scale`,Ge=`comma`,Ke=`break`,qe=`text`,Je=`plus`,Ye=`minus`,Xe=`point`,Ze=`space`,Qe=`percent`,$e=`digit`,et=`calendar`,tt=`error`,nt=`datetime`,rt=`duration`,it=`condition`,at=`dbnum`,ot=`natnum`,st=`locale`,ct=`color`,lt=`modifier`,ut=`ampm`,dt=`escaped`,ft=`string`,pt=`skip`,mt=`fill`,ht=`paren`,gt=`char`,_t=`#000000.#FFFFFF.#FF0000.#00FF00.#0000FF.#FFFF00.#FF00FF.#00FFFF.#800000.#008000.#000080.#808000.#800080.#008080.#C0C0C0.#808080.#9999FF.#993366.#FFFFCC.#CCFFFF.#660066.#FF8080.#0066CC.#CCCCFF.#000080.#FF00FF.#FFFF00.#00FFFF.#800080.#800000.#008080.#0000FF.#00CCFF.#CCFFFF.#CCFFCC.#FFFF99.#99CCFF.#FF99CC.#CC99FF.#FFCC99.#3366FF.#33CCCC.#99CC00.#FFCC00.#FF9900.#FF6600.#666699.#969696.#003366.#339966.#003300.#333300.#993300.#993366.#333399.#333333`.split(`.`),vt=`¤.$.£.¥.֏.؋.৳.฿.៛.₡.₦.₩.₪.₫.€.₭.₮.₱.₲.₴.₸.₹.₺.₼.₽.₾.₿`.split(`.`),yt=RegExp(`[`+vt.join(``)+`]`),bt=Object.freeze({1078:`af`,1052:`sq`,1118:`am`,5121:`ar_DZ`,15361:`ar_BH`,3073:`ar_EG`,2049:`ar_IQ`,11265:`ar_JO`,13313:`ar_KW`,12289:`ar_LB`,4097:`ar_LY`,6145:`ar_MA`,8193:`ar_OM`,16385:`ar_QA`,1025:`ar_SA`,10241:`ar_SY`,7169:`ar_TN`,14337:`ar_AE`,9217:`ar_YE`,1067:`hy`,1101:`as`,2092:`az_AZ`,1068:`az_AZ`,1069:`eu`,1059:`be`,2117:`bn`,1093:`bn_IN`,5146:`bs`,1026:`bg`,1109:`my`,1027:`ca`,2052:`zh_CN`,3076:`zh_HK`,5124:`zh_MO`,4100:`zh_SG`,1028:`zh_TW`,1050:`hr`,1029:`cs`,1030:`da`,1125:`dv`,2067:`nl_BE`,1043:`nl_NL`,1126:`bin`,3081:`en_AU`,10249:`en_BZ`,4105:`en_CA`,9225:`en_CB`,2057:`en_GB`,16393:`en_IN`,6153:`en_IE`,8201:`en_JM`,5129:`en_NZ`,13321:`en_PH`,7177:`en_ZA`,11273:`en_TT`,1033:`en_US`,12297:`en_ZW`,1061:`et`,1071:`mk`,1080:`fo`,1065:`fa`,1124:`fil`,1035:`fi`,2060:`fr_BE`,11276:`fr_CM`,3084:`fr_CA`,9228:`fr_CG`,12300:`fr_CI`,1036:`fr_FR`,5132:`fr_LU`,13324:`fr_ML`,6156:`fr_MC`,14348:`fr_MA`,10252:`fr_SN`,4108:`fr_CH`,7180:`fr`,1122:`fy_NL`,2108:`gd_IE`,1084:`gd`,1110:`gl`,1079:`ka`,3079:`de_AT`,1031:`de_DE`,5127:`de_LI`,4103:`de_LU`,2055:`de_CH`,1032:`el`,1140:`gn`,1095:`gu`,1279:`en`,1037:`he`,1081:`hi`,1038:`hu`,1039:`is`,1136:`ig_NG`,1057:`id`,1040:`it_IT`,2064:`it_CH`,1041:`ja`,1099:`kn`,1120:`ks`,1087:`kk`,1107:`km`,1111:`kok`,1042:`ko`,1088:`ky`,1108:`lo`,1142:`la`,1062:`lv`,1063:`lt`,2110:`ms_BN`,1086:`ms_MY`,1100:`ml`,1082:`mt`,1112:`mni`,1153:`mi`,1102:`mr`,1104:`mn`,2128:`mn`,1121:`ne`,1044:`no_NO`,2068:`no_NO`,1096:`or`,1045:`pl`,1046:`pt_BR`,2070:`pt_PT`,1094:`pa`,1047:`rm`,2072:`ro_MO`,1048:`ro_RO`,1049:`ru`,2073:`ru_MO`,1083:`se`,1103:`sa`,3098:`sr_SP`,2074:`sr_SP`,1072:`st`,1074:`tn`,1113:`sd`,1115:`si`,1051:`sk`,1060:`sl`,1143:`so`,1070:`sb`,11274:`es_AR`,16394:`es_BO`,13322:`es_CL`,9226:`es_CO`,5130:`es_CR`,7178:`es_DO`,12298:`es_EC`,17418:`es_SV`,4106:`es_GT`,18442:`es_HN`,2058:`es_MX`,19466:`es_NI`,6154:`es_PA`,15370:`es_PY`,10250:`es_PE`,20490:`es_PR`,1034:`es_ES`,14346:`es_UY`,8202:`es_VE`,1089:`sw`,2077:`sv_FI`,1053:`sv_SE`,1114:`syc`,1064:`tg`,1097:`ta`,1092:`tt`,1098:`te`,1054:`th`,1105:`bo`,1073:`ts`,1055:`tr`,1090:`tk`,1058:`uk`,1056:`ur`,2115:`uz_UZ`,1091:`uz_UZ`,1075:`ve`,1066:`vi`,1106:`cy`,1076:`xh`,1085:`yi`,1077:`zu`}),xt=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,St={},V=(e,t=``)=>e.replace(/~/g,t).split(`;`),Ct=(e,t=0,n=0)=>(e.mmm||=t<1?e.mmmm.concat():e.mmmm.map(e=>{let n=e.slice(0,t%10);return n+(t<10||e===n?``:`.`)}),e.ddd||=n<1?e.dddd.concat():e.dddd.map(e=>{let t=e.slice(0,n%10);return t+(n<10||e===t?``:`.`)}),!e.mmm6&&e.mmmm6&&(e.mmm6=e.mmmm6),e),wt={group:`\xA0`,decimal:`.`,positive:`+`,negative:`-`,percent:`%`,exponent:`E`,nan:`NaN`,infinity:`∞`,ampm:V(`AM;PM`),mmmm6:V(`Muharram;Safar;Rabiʻ I;Rabiʻ II;Jumada I;Jumada II;Rajab;Shaʻban;Ramadan;Shawwal;Dhuʻl-Qiʻdah;Dhuʻl-Hijjah`),mmm6:V(`Muh.;Saf.;Rab. I;Rab. II;Jum. I;Jum. II;Raj.;Sha.;Ram.;Shaw.;Dhuʻl-Q.;Dhuʻl-H.`),mmmm:V(`January;February;March;April;May;June;July;August;September;October;November;December`),mmm:V(`Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec`),dddd:V(`Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday`),ddd:V(`Sun;Mon;Tue;Wed;Thu;Fri;Sat`),bool:V(`TRUE;FALSE`),preferMDY:!1};function Tt(e){let t=xt.exec(e);if(!t)throw SyntaxError(`Malformed locale: ${e}`);return{lang:t[1]+(t[2]?`_`+t[2]:``),language:t[1],territory:t[2]||``}}function Et(e){if(typeof e==`number`)return bt[65535&e]||null;let t=parseInt(e,16);return isFinite(t)&&bt[65535&t]?bt[65535&t]||null:xt.test(e)?e:null}function Dt(e){let t=Et(e),n=null;if(t){let e=Tt(t);n=St[e.lang]||St[e.language]||null}return n}function Ot(e){return Object.assign({},wt,e)}function H(e,t){let n=typeof t==`object`?t:Tt(t);return St[n.lang]=Ot(e),n.language===n.lang||St[n.language]||(St[n.language]=Ot(e)),St[n.lang]}var kt=Ot({group:`,`,preferMDY:!0});kt.isDefault=!0,H({group:`,`,ampm:V(`上午;下午`),mmmm:V(`一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月`),mmm:V(`1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月`),dddd:V(`~日;~一;~二;~三;~四;~五;~六`,`星期`),ddd:V(`周日;周一;周二;周三;周四;周五;周六`)},`zh_CN`);var At={group:`,`,ampm:V(`上午;下午`),mmmm:V(`1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月`),mmm:V(`1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月`),dddd:V(`~日;~一;~二;~三;~四;~五;~六`,`星期`),ddd:V(`周日;周一;周二;周三;周四;周五;周六`)};H({...At,nan:`非數值`,dddd:V(`~日;~一;~二;~三;~四;~五;~六`,`星期`)},`zh_TW`),H({...At,dddd:V(`~日;~一;~二;~三;~四;~五;~六`,`星期`)},`zh_HK`),H({...At,ampm:V(`午前;午後`),dddd:V(`日~;月~;火~;水~;木~;金~;土~`,`曜日`),ddd:V(`日;月;火;水;木;金;土`)},`ja`),H({group:`,`,ampm:V(`오전;오후`),mmmm:V(`1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월`),mmm:V(`1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월`),dddd:V(`일요일;월요일;화요일;수요일;목요일;금요일;토요일`),ddd:V(`일;월;화;수;목;금;토`)},`ko`),H({group:`,`,ampm:V(`ก่อนเที่ยง;หลังเที่ยง`),mmmm:V(`มกร~;กุมภาพันธ์;มีน~;เมษายน;พฤษภ~;มิถุนายน;กรกฎ~;สิงห~;กันยายน;ตุล~;พฤศจิกายน;ธันว~`,`าคม`),mmm:V(`ม.ค.;ก.พ.;มี.ค.;เม.ย.;พ.ค.;มิ.ย.;ก.ค.;ส.ค.;ก.ย.;ต.ค.;พ.ย.;ธ.ค.`),dddd:V(`วันอาทิตย์;วันจันทร์;วันอังคาร;วันพุธ;วันพฤหัสบดี;วันศุกร์;วันเสาร์`),ddd:V(`อา.;จ.;อ.;พ.;พฤ.;ศ.;ส.`)},`th`),H(Ct({decimal:`,`,ampm:V(`dop.;odp.`),mmmm:V(`ledna;února;března;dubna;května;června;července;srpna;září;října;listopadu;prosince`),mmm:V(`I;II;III;IV;V;VI;VII;VIII;IX;X;XI;XII`),dddd:V(`neděle;pondělí;úterý;středa;čtvrtek;pátek;sobota`),bool:V(`PRAVDA;NEPRAVDA`)},-1,2),`cs`),H(Ct({group:`.`,decimal:`,`,mmmm:V(`januar;februar;marts;april;maj;juni;juli;august;september;oktober;november;december`),dddd:V(`søn~;man~;tirs~;ons~;tors~;fre~;lør~`,`dag`),bool:V(`SAND;FALSK`)},13,13),`da`),H(Ct({group:`.`,decimal:`,`,ampm:V(`a.m.;p.m.`),mmmm:V(`januari;februari;maart;april;mei;juni;juli;augustus;september;oktober;november;december`),mmm:V(`jan.;feb.;mrt.;apr.;mei;jun.;jul.;aug.;sep.;okt.;nov.;dec.`),dddd:V(`zondag;maandag;dinsdag;woensdag;donderdag;vrijdag;zaterdag`),bool:V(`WAAR;ONWAAR`)},-1,2),`nl`),H({group:`,`,preferMDY:!0},`en`),H({group:`,`,preferMDY:!0},`en_US`),H({group:`,`},`en_AU`),H({group:`,`},`en_CA`),H({group:`,`},`en_GB`),H({group:`,`,mmm:V(`Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sept;Oct;Nov;Dec`)},`en_IE`),H(Ct({decimal:`,`,nan:`epäluku`,ampm:V(`ap.;ip.`),mmmm:V(`tammi~;helmi~;maalis~;huhti~;touko~;kesä~;heinä~;elo~;syys~;loka~;marras~;joulu~`,`kuuta`),mmm:V(`tammik.;helmik.;maalisk.;huhtik.;toukok.;kesäk.;heinäk.;elok.;syysk.;lokak.;marrask.;jouluk.`),dddd:V(`sunnun~;maanan~;tiis~;keskiviikkona;tors~;perjan~;lauan~`,`taina`),bool:V(`TOSI;EPÄTOSI`)},-1,2),`fi`);var jt=Ct({group:` `,decimal:`,`,mmmm:V(`janvier;février;mars;avril;mai;juin;juillet;août;septembre;octobre;novembre;décembre`),mmm:V(`janv.;févr.;mars;avr.;mai;juin;juil.;août;sept.;oct.;nov.;déc.`),dddd:V(`~manche;lun~;mar~;mercre~;jeu~;vendre~;same~`,`di`),bool:V(`VRAI;FAUX`)},-1,13);H({...jt},`fr`),H({...jt,mmm:V(`janv.;févr.;mars;avr.;mai;juin;juill.;août;sept.;oct.;nov.;déc.`)},`fr_CA`),H({group:`'`,decimal:`.`,...jt},`fr_CH`);var Mt=Ct({mmmm:V(`Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember`),mmm:V(`Jan.;Feb.;März;Apr.;Mai;Juni;Juli;Aug.;Sept.;Okt.;Nov.;Dez.`),dddd:V(`Sonn~;Mon~;Diens~;Mittwoch;Donners~;Frei~;Sams~`,`tag`),bool:V(`WAHR;FALSCH`)},-1,12);H({group:`.`,decimal:`,`,...Mt},`de`),H({group:`'`,decimal:`.`,...Mt},`de_CH`),H(Ct({group:`.`,decimal:`,`,ampm:V(`π.μ.;μ.μ.`),mmmm:V(`Ιανουαρ~;Φεβρουαρ~;Μαρτ~;Απριλ~;Μαΐου;Ιουν~;Ιουλ~;Αυγούστου;Σεπτεμβρ~;Οκτωβρ~;Νοεμβρ~;Δεκεμβρ~`,`ίου`),mmm:V(`Ιαν;Φεβ;Μαρ;Απρ;Μαΐ;Ιουν;Ιουλ;Αυγ;Σεπ;Οκτ;Νοε;Δεκ`),dddd:V(`Κυριακή;Δευτέρα;Τρίτη;Τετάρτη;Πέμπτη;Παρασκευή;Σάββατο`)},-1,3),`el`),H({decimal:`,`,ampm:V(`de.;du.`),mmmm:V(`január;február;március;április;május;június;július;augusztus;szeptember;október;november;december`),mmm:V(`jan.;febr.;márc.;ápr.;máj.;jún.;júl.;aug.;szept.;okt.;nov.;dec.`),dddd:V(`vasárnap;hétfő;kedd;szerda;csütörtök;péntek;szombat`),ddd:V(`V;H;K;Sze;Cs;P;Szo`),bool:V(`IGAZ;HAMIS`)},`hu`),H(Ct({group:`.`,decimal:`,`,ampm:V(`f.h.;e.h.`),mmmm:V(`janúar;febrúar;mars;apríl;maí;júní;júlí;ágúst;september;október;nóvember;desember`),dddd:V(`sunnu~;mánu~;þriðju~;miðviku~;fimmtu~;föstu~;laugar~`,`dagur`)},13,13),`is`),H(Ct({group:`.`,decimal:`,`,mmmm:V(`Januari;Februari;Maret;April;Mei;Juni;Juli;Agustus;September;Oktober;November;Desember`),dddd:V(`Minggu;Senin;Selasa;Rabu;Kamis;Jumat;Sabtu`)},3,3),`id`);var Nt=Ct({mmmm:V(`gennaio;febbraio;marzo;aprile;maggio;giugno;luglio;agosto;settembre;ottobre;novembre;dicembre`),dddd:V(`domenica;lunedì;martedì;mercoledì;giovedì;venerdì;sabato`),bool:V(`VERO;FALSO`)},3,3);H({group:`.`,decimal:`,`,...Nt},`it`),H({group:`'`,decimal:`.`,...Nt},`it_CH`);var Pt={decimal:`,`,ampm:V(`a.m.;p.m.`),mmmm:V(`januar;februar;mars;april;mai;juni;juli;august;september;oktober;november;desember`),mmm:V(`jan.;feb.;mar.;apr.;mai;jun.;jul.;aug.;sep.;okt.;nov.;des.`),dddd:V(`søn~;man~;tirs~;ons~;tors~;fre~;lør~`,`dag`),bool:V(`SANN;USANN`)};H(Ct({...Pt},-1,13),`nb`),H(Ct({...Pt},-1,13),`no`),H(Ct({decimal:`,`,mmmm:V(`stycznia;lutego;marca;kwietnia;maja;czerwca;lipca;sierpnia;września;października;listopada;grudnia`),dddd:V(`niedziela;poniedziałek;wtorek;środa;czwartek;piątek;sobota`),ddd:V(`niedz.;pon.;wt.;śr.;czw.;pt.;sob.`),bool:V(`PRAWDA;FAŁSZ`)},3,-1),`pl`);var Ft={group:`.`,decimal:`,`,mmmm:V(`janeiro;fevereiro;março;abril;maio;junho;julho;agosto;setembro;outubro;novembro;dezembro`),dddd:V(`domingo;segunda-feira;terça-feira;quarta-feira;quinta-feira;sexta-feira;sábado`),bool:V(`VERDADEIRO;FALSO`)};H(Ct(Ft,13,13),`pt`),H(Ct(Ft,13,13),`pt_BR`),H({decimal:`,`,nan:`не\xA0число`,mmmm:V(`января;февраля;марта;апреля;мая;июня;июля;августа;сентября;октября;ноября;декабря`),mmm:V(`янв.;февр.;мар.;апр.;мая;июн.;июл.;авг.;сент.;окт.;нояб.;дек.`),dddd:V(`воскресенье;понедельник;вторник;среда;четверг;пятница;суббота`),ddd:V(`вс;пн;вт;ср;чт;пт;сб`),mmmm6:V(`рамадан;шавваль;зуль-каада;зуль-хиджжа;мухаррам;раби-уль-авваль;раби-уль-ахир;джумад-уль-авваль;джумад-уль-ахир;раджаб;шаабан;рамадан`),mmm6:V(`рам.;шав.;зуль-к.;зуль-х.;мух.;раб. I;раб. II;джум. I;джум. II;радж.;шааб.;рам.`),bool:V(`ИСТИНА;ЛОЖЬ`)},`ru`),H(Ct({decimal:`,`,mmmm:V(`januára;februára;marca;apríla;mája;júna;júla;augusta;septembra;októbra;novembra;decembra`),dddd:V(`nedeľa;pondelok;utorok;streda;štvrtok;piatok;sobota`)},3,2),`sk`);var It={group:`.`,decimal:`,`,ampm:V(`a.\xA0m.;p.\xA0m.`),mmmm:V(`enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiem~;octu~;noviem~;diciem~`,`bre`),mmm:V(`ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic`),dddd:V(`domingo;lunes;martes;miércoles;jueves;viernes;sábado`),ddd:V(`dom;lun;mar;mié;jue;vie;sáb`),bool:V(`VERDADERO;FALSO`)},Lt=V(`ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic`),Rt=V(`ene.;feb.;mar.;abr.;may.;jun.;jul.;ago.;sept.;oct.;nov.;dic.`);H({...It},`es`),H({...It},`es_AR`),H({...It},`es_BO`),H({...It},`es_CL`),H({...It},`es_CO`),H({...It},`es_EC`),H({...It,mmm:Lt,ampm:V(`a.m.;p.m.`)},`es_MX`),H({...It,mmm:Rt},`es_PY`),H({...It,mmm:Rt},`es_UY`),H({...It,mmm:Rt,mmmm:V(`enero;febrero;marzo;abril;mayo;junio;julio;agosto;setiembre;octubre;noviembre;diciembre`)},`es_VE`),H({decimal:`,`,ampm:V(`fm;em`),mmmm:V(`januari;februari;mars;april;maj;juni;juli;augusti;september;oktober;november;december`),mmm:V(`jan.;feb.;mars;apr.;maj;juni;juli;aug.;sep.;okt.;nov.;dec.`),dddd:V(`sön~;mån~;tis~;ons~;tors~;fre~;lör~`,`dag`),ddd:V(`sön;mån;tis;ons;tors;fre;lör`)},`sv`),H(Ct({group:`.`,decimal:`,`,ampm:V(`ÖÖ;ÖS`),mmmm:V(`Ocak;Şubat;Mart;Nisan;Mayıs;Haziran;Temmuz;Ağustos;Eylül;Ekim;Kasım;Aralık`),mmm:V(`Oca;Şub;Mar;Nis;May;Haz;Tem;Ağu;Eyl;Eki;Kas;Ara`),dddd:V(`Pazar;Pazartesi;Salı;Çarşamba;Perşembe;Cuma;Cumartesi`),ddd:V(`Paz;Pzt;Sal;Çar;Per;Cum;Cmt`),bool:V(`DOĞRU;YANLIŞ`)},3,-1),`tr`),H({group:`,`,ampm:V(`yb;yh`),mmmm:V(`Ionawr;Chwefror;Mawrth;Ebrill;Mai;Mehefin;Gorffennaf;Awst;Medi;Hydref;Tachwedd;Rhagfyr`),mmm:V(`Ion;Chwef;Maw;Ebr;Mai;Meh;Gorff;Awst;Medi;Hyd;Tach;Rhag`),dddd:V(`Dydd Sul;Dydd Llun;Dydd Mawrth;Dydd Mercher;Dydd Iau;Dydd Gwener;Dydd Sadwrn`),ddd:V(`Sul;Llun;Maw;Mer;Iau;Gwen;Sad`)},`cy`),H({group:`.`,decimal:`,`,mmmm:V(`yanvar;fevral;mart;aprel;may;iyun;iyul;avqust;sentyabr;oktyabr;noyabr;dekabr`),mmm:V(`yan;fev;mar;apr;may;iyn;iyl;avq;sen;okt;noy;dek`),dddd:V(`bazar;bazar ertəsi;çərşənbə axşamı;çərşənbə;cümə axşamı;cümə;şənbə`),ddd:V(`B.;B.e.;Ç.a.;Ç.;C.a.;C.;Ş.`)},`az`),H(Ct({decimal:`,`,mmmm:V(`студзеня;лютага;сакавіка;красавіка;мая;чэрвеня;ліпеня;жніўня;верасня;кастрычніка;лістапада;снежня`),dddd:V(`нядзеля;панядзелак;аўторак;серада;чацвер;пятніца;субота`),ddd:V(`нд;пн;аў;ср;чц;пт;сб`)},3,-1),`be`),H({decimal:`,`,ampm:V(`пр.об.;сл.об.`),mmmm:V(`януари;февруари;март;април;май;юни;юли;август;септември;октомври;ноември;декември`),mmm:V(`яну;фев;март;апр;май;юни;юли;авг;сеп;окт;ное;дек`),dddd:V(`неделя;понеделник;вторник;сряда;четвъртък;петък;събота`),ddd:V(`нд;пн;вт;ср;чт;пт;сб`),bool:V(`ИСТИНА;ЛОЖЬ`)},`bg`),H({group:`.`,decimal:`,`,mmmm:V(`de gener;de febrer;de març;d’abril;de maig;de juny;de juliol;d’agost;de setembre;d’octubre;de novembre;de desembre`),mmm:V(`de gen.;de febr.;de març;d’abr.;de maig;de juny;de jul.;d’ag.;de set.;d’oct.;de nov.;de des.`),dddd:V(`diumenge;dilluns;dimarts;dimecres;dijous;divendres;dissabte`),ddd:V(`dg.;dl.;dt.;dc.;dj.;dv.;ds.`),ampm:V(`a.\xA0m.;p.\xA0m.`)},`ca`),H(Ct({group:`,`,decimal:`.`,mmmm:V(`Enero;Pebrero;Marso;Abril;Mayo;Hunyo;Hulyo;Agosto;Setyembre;Oktubre;Nobyembre;Disyembre`),dddd:V(`Linggo;Lunes;Martes;Miyerkules;Huwebes;Biyernes;Sabado`)},3,3),`fil`),H({group:`,`,decimal:`.`,mmmm:V(`જાન્યુઆરી;ફેબ્રુઆરી;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટેમ્બર;ઑક્ટોબર;નવેમ્બર;ડિસેમ્બર`),mmm:V(`જાન્યુ;ફેબ્રુ;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટે;ઑક્ટો;નવે;ડિસે`),dddd:V(`રવિ~;સોમ~;મંગળ~;બુધ~;ગુરુ~;શુક્ર~;શનિ~`,`વાર`),ddd:V(`રવિ;સોમ;મંગળ;બુધ;ગુરુ;શુક્ર;શનિ`)},`gu`),H({group:`,`,decimal:`.`,ampm:V(`לפנה״צ;אחה״צ`),dddd:V(`~ראשון;~שני;~שלישי;~רביעי;~חמישי;~שישי;~שבת`,`יום `),ddd:V(`~א׳;~ב׳;~ג׳;~ד׳;~ה׳;~ו׳;שבת`,`יום `),mmmm:V(`ינואר;פברואר;מרץ;אפריל;מאי;יוני;יולי;אוגוסט;ספטמבר;אוקטובר;נובמבר;דצמבר`),mmm:V(`ינו׳;פבר׳;מרץ;אפר׳;מאי;יוני;יולי;אוג׳;ספט׳;אוק׳;נוב׳;דצמ׳`),mmmm6:V(`רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע אל־אוול;רביע א־ת׳אני;ג׳ומאדא אל־אולא;ג׳ומאדא א־ת׳אניה;רג׳ב;שעבאן;רמדאן`),mmm6:V(`רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע א׳;רביע ב׳;ג׳ומאדא א׳;ג׳ומאדא ב׳;רג׳ב;שעבאן;רמדאן`)},`he`),H(Ct({group:`.`,decimal:`,`,mmmm:V(`siječnja;veljače;ožujka;travnja;svibnja;lipnja;srpnja;kolovoza;rujna;listopada;studenoga;prosinca`),mmm:V(`sij;velj;ožu;tra;svi;lip;srp;kol;ruj;lis;stu;pro`),dddd:V(`nedjelja;ponedjeljak;utorak;srijeda;četvrtak;petak;subota`)},-1,3),`hr`),H({decimal:`,`,mmmm:V(`հունվարի;փետրվարի;մարտի;ապրիլի;մայիսի;հունիսի;հուլիսի;օգոստոսի;սեպտեմբերի;հոկտեմբերի;նոյեմբերի;դեկտեմբերի`),mmm:V(`հնվ;փտվ;մրտ;ապր;մյս;հնս;հլս;օգս;սեպ;հոկ;նոյ;դեկ`),dddd:V(`կիրակի;երկուշաբթի;երեքշաբթի;չորեքշաբթի;հինգշաբթի;ուրբաթ;շաբաթ`),ddd:V(`կիր;երկ;երք;չրք;հնգ;ուր;շբթ`)},`hy`),H(Ct({decimal:`,`,mmmm:V(`იანვარი;თებერვალი;მარტი;აპრილი;მაისი;ივნისი;ივლისი;აგვისტო;სექტემბერი;ოქტომბერი;ნოემბერი;დეკემბერი`),dddd:V(`კვირა;ორშაბათი;სამშაბათი;ოთხშაბათი;ხუთშაბათი;პარასკევი;შაბათი`)},3,3),`ka`),H(Ct({decimal:`,`,mmmm:V(`қаңтар;ақпан;наурыз;сәуір;мамыр;маусым;шілде;тамыз;қыркүйек;қазан;қараша;желтоқсан`),dddd:V(`жексенбі;дүйсенбі;сейсенбі;сәрсенбі;бейсенбі;жұма;сенбі`),ddd:V(`жс;дс;сс;ср;бс;жм;сб`)},13,-1),`kk`),H({group:`,`,mmmm:V(`ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿಲ್;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂಬರ್;ಅಕ್ಟೋಬರ್;ನವೆಂಬರ್;ಡಿಸೆಂಬರ್`),mmm:V(`ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿ;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂ;ಅಕ್ಟೋ;ನವೆಂ;ಡಿಸೆಂ`),dddd:V(`ಭಾನು~;ಸೋಮ~;ಮಂಗಳ~;ಬುಧ~;ಗುರು~;ಶುಕ್ರ~;ಶನಿ~`,`ವಾರ`),ddd:V(`ಭಾನು;ಸೋಮ;ಮಂಗಳ;ಬುಧ;ಗುರು;ಶುಕ್ರ;ಶನಿ`),ampm:V(`ಪೂರ್ವಾಹ್ನ;ಅಪರಾಹ್ನ`)},`kn`),H({decimal:`,`,mmmm:V(`sausio;vasario;kovo;balandžio;gegužės;birželio;liepos;rugpjūčio;rugsėjo;spalio;lapkričio;gruodžio`),mmm:V(`saus.;vas.;kov.;bal.;geg.;birž.;liep.;rugp.;rugs.;spal.;lapkr.;gruod.`),dddd:V(`sekmadienis;pirmadienis;antradienis;trečiadienis;ketvirtadienis;penktadienis;šeštadienis`),ddd:V(`sk;pr;an;tr;kt;pn;št`),ampm:V(`priešpiet;popiet`)},`lt`),H({decimal:`,`,mmmm:V(`janvāris;februāris;marts;aprīlis;maijs;jūnijs;jūlijs;augusts;septembris;oktobris;novembris;decembris`),mmm:V(`janv.;febr.;marts;apr.;maijs;jūn.;jūl.;aug.;sept.;okt.;nov.;dec.`),dddd:V(`svētdiena;pirmdiena;otrdiena;trešdiena;ceturtdiena;piektdiena;sestdiena`),ddd:V(`svētd.;pirmd.;otrd.;trešd.;ceturtd.;piektd.;sestd.`),ampm:V(`priekšpusdienā;pēcpusdienā`)},`lv`),H({group:`,`,decimal:`.`,mmmm:V(`ജനുവരി;ഫെബ്രുവരി;മാർച്ച്;ഏപ്രിൽ;മേയ്;ജൂൺ;ജൂലൈ;ഓഗസ്റ്റ്;സെപ്റ്റംബർ;ഒക്ടോബർ;നവംബർ;ഡിസംബർ`),mmm:V(`ജനു;ഫെബ്രു;മാർ;ഏപ്രി;മേയ്;ജൂൺ;ജൂലൈ;ഓഗ;സെപ്റ്റം;ഒക്ടോ;നവം;ഡിസം`),dddd:V(`ഞായറാഴ്ച;തിങ്കളാഴ്ച;ചൊവ്വാഴ്ച;ബുധനാഴ്ച;വ്യാഴാഴ്ച;വെള്ളിയാഴ്ച;ശനിയാഴ്ച`),ddd:V(`ഞായർ;തിങ്കൾ;ചൊവ്വ;ബുധൻ;വ്യാഴം;വെള്ളി;ശനി`)},`ml`),H({group:`,`,decimal:`.`,mmmm:V(`нэгдүгээ~;хоёрдугаа~;гуравдугаа~;дөрөвдүгээ~;тавдугаа~;зургаадугаа~;долоодугаа~;наймдугаа~;есдүгээ~;аравдугаа~;арван нэгдүгээ~;арван хоёрдугаа~`,`р сар`),mmm:V(`1~;2~;3~;4~;5~;6~;7~;8~;9~;10~;11~;12~`,`-р сар`),dddd:V(`ням;даваа;мягмар;лхагва;пүрэв;баасан;бямба`),ddd:V(`Ня;Да;Мя;Лх;Пү;Ба;Бя`),ampm:V(`ү.ө.;ү.х.`)},`mn`),H({group:`,`,decimal:`.`,mmmm:V(`जानेवारी;फेब्रुवारी;मार्च;एप्रिल;मे;जून;जुलै;ऑगस्ट;सप्टेंबर;ऑक्टोबर;नोव्हेंबर;डिसेंबर`),mmm:V(`जाने;फेब्रु;मार्च;एप्रि;मे;जून;जुलै;ऑग;सप्टें;ऑक्टो;नोव्हें;डिसें`),dddd:V(`रविवार;सोमवार;मंगळवार;बुधवार;गुरुवार;शुक्रवार;शनिवार`),ddd:V(`रवि;सोम;मंगळ;बुध;गुरु;शुक्र;शनि`)},`mr`),H(Ct({group:`,`,decimal:`.`,mmmm:V(`ဇန်နဝါရီ;ဖေဖော်ဝါရီ;မတ်;ဧပြီ;မေ;ဇွန်;ဇူလိုင်;ဩဂုတ်;စက်တင်ဘာ;အောက်တိုဘာ;နိုဝင်ဘာ;ဒီဇင်ဘာ`),mmm:V(`ဇန်;ဖေ;မတ်;ဧ;မေ;ဇွန်;ဇူ;ဩ;စက်;အောက်;နို;ဒီ`),dddd:V(`တနင်္ဂနွေ;တနင်္လာ;အင်္ဂါ;ဗုဒ္ဓဟူး;ကြာသပတေး;သောကြာ;စနေ`),ampm:V(`နံနက်;ညနေ`)},-1,0),`my`),H({group:`,`,decimal:`.`,mmmm:V(`ਜਨਵਰੀ;ਫ਼ਰਵਰੀ;ਮਾਰਚ;ਅਪ੍ਰੈਲ;ਮਈ;ਜੂਨ;ਜੁਲਾਈ;ਅਗਸਤ;ਸਤੰਬਰ;ਅਕਤੂਬਰ;ਨਵੰਬਰ;ਦਸੰਬਰ`),mmm:V(`ਜਨ;ਫ਼ਰ;ਮਾਰਚ;ਅਪ੍ਰੈ;ਮਈ;ਜੂਨ;ਜੁਲਾ;ਅਗ;ਸਤੰ;ਅਕਤੂ;ਨਵੰ;ਦਸੰ`),dddd:V(`ਐਤਵਾਰ;ਸੋਮਵਾਰ;ਮੰਗਲਵਾਰ;ਬੁੱਧਵਾਰ;ਵੀਰਵਾਰ;ਸ਼ੁੱਕਰਵਾਰ;ਸ਼ਨਿੱਚਰਵਾਰ`),ddd:V(`ਐਤ;ਸੋਮ;ਮੰਗਲ;ਬੁੱਧ;ਵੀਰ;ਸ਼ੁੱਕਰ;ਸ਼ਨਿੱਚਰ`),ampm:V(`ਪੂ.ਦੁ.;ਬਾ.ਦੁ.`)},`pa`),H({group:`.`,decimal:`,`,mmmm:V(`ianuarie;februarie;martie;aprilie;mai;iunie;iulie;august;septem~;octom~;noiem~;decem~`,`brie`),mmm:V(`ian.;feb.;mar.;apr.;mai;iun.;iul.;aug.;sept.;oct.;nov.;dec.`),dddd:V(`duminică;luni;marți;miercuri;joi;vineri;sâmbătă`),ddd:V(`dum.;lun.;mar.;mie.;joi;vin.;sâm.`),ampm:V(`a.m.;p.m.`)},`ro`),H(Ct({group:`.`,decimal:`,`,mmmm:V(`januar;februar;marec;april;maj;junij;julij;avgust;september;oktober;november;december`),mmm:V(`jan.;feb.;mar.;apr.;maj;jun.;jul.;avg.;sep.;okt.;nov.;dec.`),dddd:V(`nedelja;ponedeljek;torek;sreda;četrtek;petek;sobota`),ampm:V(`dop.;pop.`)},-1,13),`sl`),H(Ct({group:`.`,decimal:`,`,mmmm:V(`јануар;фебруар;март;април;мај;јун;јул;август;септембар;октобар;новембар;децембар`),dddd:V(`недеља;понедељак;уторак;среда;четвртак;петак;субота`)},3,3),`sr`),H({group:`,`,decimal:`.`,mmmm:V(`ஜனவரி;பிப்ரவரி;மார்ச்;ஏப்ரல்;மே;ஜூன்;ஜூலை;ஆகஸ்ட்;செப்டம்பர்;அக்டோபர்;நவம்பர்;டிசம்பர்`),mmm:V(`ஜன.;பிப்.;மார்.;ஏப்.;மே;ஜூன்;ஜூலை;ஆக.;செப்.;அக்.;நவ.;டிச.`),dddd:V(`ஞாயிறு;திங்கள்;செவ்வாய்;புதன்;வியாழன்;வெள்ளி;சனி`),ddd:V(`ஞாயி.;திங்.;செவ்.;புத.;வியா.;வெள்.;சனி`)},`ta`),H({group:`,`,decimal:`.`,mmmm:V(`జనవరి;ఫిబ్రవరి;మార్చి;ఏప్రిల్;మే;జూన్;జులై;ఆగస్టు;సెప్టెంబర్;అక్టోబర్;నవంబర్;డిసెంబర్`),mmm:V(`జన;ఫిబ్ర;మార్చి;ఏప్రి;మే;జూన్;జులై;ఆగ;సెప్టెం;అక్టో;నవం;డిసెం`),dddd:V(`ఆదివారం;సోమవారం;మంగళవారం;బుధవారం;గురువారం;శుక్రవారం;శనివారం`),ddd:V(`ఆది;సోమ;మంగళ;బుధ;గురు;శుక్ర;శని`)},`te`),H({decimal:`,`,mmmm:V(`січня;лютого;березня;квітня;травня;червня;липня;серпня;вересня;жовтня;листопада;грудня`),mmm:V(`січ.;лют.;бер.;квіт.;трав.;черв.;лип.;серп.;вер.;жовт.;лист.;груд.`),dddd:V(`неділю;понеділок;вівторок;середу;четвер;пʼятницю;суботу`),ddd:V(`нд;пн;вт;ср;чт;пт;сб`),ampm:V(`дп;пп`)},`uk`),H({group:`.`,decimal:`,`,mmmm:V(`~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12`,`tháng `),mmm:V(`~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12`,`thg `),dddd:V(`Chủ Nhật;Thứ Hai;Thứ Ba;Thứ Tư;Thứ Năm;Thứ Sáu;Thứ Bảy`),ddd:V(`CN;Th 2;Th 3;Th 4;Th 5;Th 6;Th 7`),ampm:V(`SA;CH`)},`vi`),H(Ct({group:`٬`,decimal:`٫`,ampm:V(`ص;م`),mmmm:V(`يناير;فبراير;مارس;أبريل;مايو;يونيو;يوليو;أغسطس;سبتمبر;أكتوبر;نوفمبر;ديسمبر`),dddd:V(`الأحد;الاثنين;الثلاثاء;الأربعاء;الخميس;الجمعة;السبت`),mmmm6:V(`رمضان;شوال;ذو القعدة;ذو الحجة;محرم;ربيع الأول;ربيع الآخرة;جمادى الأولى;جمادى الآخرة;رجب;شعبان;رمضان`)},0,0),`ar`),H({group:`,`,decimal:`.`,mmmm:V(`জানুয়ারী;ফেব্রুয়ারী;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগস্ট;সেপ্টেম্বর;অক্টোবর;নভেম্বর;ডিসেম্বর`),mmm:V(`জানু;ফেব;মার্চ;এপ্রি;মে;জুন;জুল;আগ;সেপ্টেঃ;অক্টোঃ;নভেঃ;ডিসেঃ`),dddd:V(`রবিবার;সোমবার;মঙ্গলবার;বুধবার;বৃহস্পতিবার;শুক্রবার;শনিবার`),ddd:V(`রবি;সোম;মঙ্গল;বুধ;বৃহস্পতি;শুক্র;শনি`)},`bn`),H({group:`,`,decimal:`.`,mmmm:V(`जनवरी;फ़रवरी;मार्च;अप्रैल;मई;जून;जुलाई;अगस्त;सितंबर;अक्तूबर;नवंबर;दिसंबर`),mmm:V(`जन॰;फ़र॰;मार्च;अप्रैल;मई;जून;जुल॰;अग॰;सित॰;अक्तू॰;नव॰;दिस॰`),dddd:V(`रविवार;सोमवार;मंगलवार;बुधवार;गुरुवार;शुक्रवार;शनिवार`),ddd:V(`रवि;सोम;मंगल;बुध;गुरु;शुक्र;शनि`),ampm:V(`am;pm`)},`hi`);var zt={overflow:`######`,dateErrorThrows:!1,dateErrorNumber:!0,bigintErrorNumber:!1,dateSpanLarge:!0,leap1900:!0,nbsp:!1,throws:!0,invalid:`######`,locale:``,ignoreTimezone:!1,grouping:[3,3],indexColors:!0,skipChar:``,repeatChar:``,digitChar:``};function Bt(e,t=0){if(typeof e!=`number`)return e;if(e<0)return-Bt(-e,t);if(t){let n=10**t||1;return Bt(e*n,0)/n}return Math.round(e)}var Vt=Math.floor;function Ht(e,t=!0){if(t&&e>=0){if(e===0)return[1900,1,0];if(e===60)return[1900,2,29];if(e<60)return[1900,e<32?1:2,(e-1)%31+1]}let n=e+68569+2415019,r=Vt(4*n/146097);n-=Vt((146097*r+3)/4);let i=Vt(4e3*(n+1)/1461001);n=n-Vt(1461*i/4)+31;let a=Vt(80*n/2447),o=n-Vt(2447*a/80);return n=Vt(a/11),[100*(r-49)+i+n|0,0|a+2-12*n,0|o]}function Ut(e,t=0,n=!0){let r=Vt(e);return t===6?function(e){if(e===60)throw Error(`#VALUE!`);if(e<=1)return[1317,8,29];if(e<60)return[1317,e<32?9:10,1+(e-2)%30];let t=10631/30,n=.1335,r=e+466935,i=Vt(r/10631);r-=10631*i;let a=Vt((r-n)/t);r-=Vt(a*t+n);let o=Vt((r+28.5001)/29.5);return o===13?[30*i+a,12,30]:[30*i+a,o,r-Vt(29.5001*o-29)]}(r):t===-1?function(e){return Ht(e+1462)}(r):Ht(r,n)}var Wt=Math.floor,Gt=86400;function Kt(e,t){let n=null;if(Array.isArray(e)){let[t,r,i,a,o,s]=e;n=Date.UTC(t,r==null?0:r-1,i??1,a||0,o||0,s||0)}else if(e instanceof Date&&(n=1*e,!t?.ignoreTimezone)){let t=new Date;t.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t.setUTCHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n=1*t}if(n!=null&&isFinite(n)){let e=n/864e5;return e-(e<=-25509?-25568:-25569)}return null}function qt(e,t){let n=0|e,r=Gt*(e-n),i=Wt(r);r-i>.9999&&(i+=1,i===Gt&&(i=0,n+=1));let a=i<0?Gt+i:i,[o,s,c]=Ut(e,0,t?.leap1900);return[o,s,c,Wt(a/60/60)%60,Wt(a/60)%60,Wt(a)%60]}var Jt={},Yt={};function Xt(e,t,n=1){if(e){let r=e[0],i=e.slice(1);r===`!`?Xt(i,t,4):r===`?`?Xt(i,t,2):(t[r]=t[r]||{},Xt(i,t[r],n))}else t.$=n}function Zt(e,t){Xt(e,t),Xt(e+` x`,t),Xt(e+` l`,t),Xt(e+` l x`,t),Xt(`l `+e,t),Xt(`l `+e+` x`,t),Xt(e+` D`,t),Xt(e+` D x`,t),Xt(`D `+e,t),Xt(`D `+e+` x`,t)}`!d-m-y.!d-m-Y.!j-m-y.!j-m-Y.!d-n-y.!d-n-Y.!j-n-y.!j-n-Y.?m-d-y.?m-d-Y.?m-j-y.?m-j-Y.?n-d-y.?n-d-Y.?n-j-y.?n-j-Y.d-M-y.d-M-Y.j-M-y.j-M-Y.M-d-y.M-d-Y.M-j-y.M-j-Y.d-F-y.d-F-Y.F-d-y.F-d-Y.F-j-y.F-j-Y.j-F-y.j-F-Y.y-F-d.y-F-j.y-M-d.y-M-j.Y-F-d.Y-F-j.Y-M-d.Y-m-d.Y-M-j.Y-m-j.Y-n-d.Y-n-j.j-F.j-M.d-F.d-M.n-d.n-j.n-Y.m-d.m-j.m-Y.M-Y.M-y.F-y.F-Y.Y-M.Y-n.Y-m.Y-F.Y-M`.split(`.`).forEach(e=>{e.startsWith(`?`)||Zt(e,Jt),e.startsWith(`!`)||Zt(e,Yt)}),new Date().getUTCFullYear();var Qt=` `,$t=`\xA0`,en=` `,tn=`'`,nn=`٬`,rn={".":[`,`,$t,en,tn,nn],",":[`.`,$t,en,tn,nn],"٫":[`.`,$t,en,tn,nn]},an=e=>e?.length===1&&e>=`0`&&e<=`9`;function on(e,t,n){return t[n+`_max`]=e.length,t[n+`_min`]=e.replace(/#/g,``).length,t}function sn(e,t){typeof e==`string`?t.push({type:`string`,value:e}):t.push(e)}function cn(e,t){let n=e?.type;return n===`hash`||n===`zero`||n===`qmark`||n===`digit`&&t===`den`}function ln(e){let t,n=[],r={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:1,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:n},i=`int`,a=null,o=[],s=!1,c=-1,l=!1,u=``,d=!1;for(;++c<e.length&&!l;){let f=e[c],p=f.type||`error`;if(u+=f.raw,p===`general`)r.general=!0,sn(f,n);else if(cn(f,i)){let e=r[i+`_pattern`];cn(t,i)||t?.type===`group`?(e.push((e.pop()||``)+f.value),a.num+=f.value):(e.push(f.value),a={type:i,num:f.value},sn(a,n))}else if(p===`paren`)f.value===`(`&&(r.parens=!0),sn(f.value,n);else if(p===`digit`)sn(f.value,n);else if(p===`slash`)if(d=!0,r[i+`_pattern`].length){if(!a)throw SyntaxError(`Format pattern is missing a numerator`);r.fractions=!0,r.num_pattern.push(r[i+`_pattern`].pop()),a.type=`num`,i=`den`,sn({type:`div`},n)}else sn(f.value,n);else if(p===`comma`)sn(`,`,n);else if(p===`scale`)r.scale*=.001**f.raw.length;else if(p===`group`){if(i===`int`&&(r.grouping=!0),i===`den`)throw SyntaxError(`Cannot group denominator digits`)}else if(p===`space`)sn(f,n);else{if(p===`break`){l=!0;break}if(p===`text`)r.text=!0,sn(f,n);else if(p===`plus`||p===`minus`)sn(f,n);else if(p===`duration`){let e=f.value.toLowerCase(),t=e[0],i={type:``,size:0,date:1,pad:e.length};t===`h`?(i.size=16,i.type=`hour-elap`):t===`m`?(i.size=32,i.type=`min-elap`):(i.size=64,i.type=`sec-elap`),r.date|=i.size,o.push(i),sn(i,n)}else if(r.date&&p===`point`&&e[c+1]?.type===`zero`){let t=1;c++;let i=`0`;e[c+1]?.type===`zero`&&(i+=`0`,t=2,c++),e[c+1]?.type===`zero`&&(i+=`0`,t=3,c++),u+=i;let a=[64,128,256,512][t];r.date|=a,r.date_eval=!0,r.sec_decimals=Math.max(r.sec_decimals,t),sn({type:`subsec`,size:a,decimals:t,date:1},n)}else if(p===`calendar`)s||(f.value===`B2`||f.value===`b2`?r.date_system=6:r.date_system=1);else if(p===`datetime`){let e={type:``,size:0,date:1},t=f.value.toLowerCase(),i=t[0];if(t===`y`||t===`yy`)e.size=2,e.type=`year-short`;else if(i===`y`||i===`e`)e.size=2,e.type=`year`;else if(t===`b`||t===`bb`)e.size=2,e.type=`b-year-short`;else if(i===`b`)e.size=2,e.type=`b-year`;else if(t===`d`||t===`dd`)e.size=8,e.type=`day`,e.pad=/dd/.test(t);else if(t===`ddd`||t===`aaa`)e.size=8,e.type=`weekday-short`;else if(i===`d`||i===`a`)e.size=8,e.type=`weekday`;else if(i===`h`)e.size=16,e.type=`hour`,e.pad=/hh/i.test(t);else if(i===`m`){t.length===3?(e.size=4,e.type=`monthname-short`):t.length===5?(e.size=4,e.type=`monthname-single`):t.length>=4&&(e.size=4,e.type=`monthname`);let n=o[o.length-1];!e.type&&n&&!n.used&&80&n.size&&(n.used=!0,e.size=32,e.type=`min`,e.pad=/mm/.test(t)),e.type||(e.size=4,e.type=`month`,e.pad=/mm/.test(t),e.indeterminate=!0)}else if(i===`s`){e.size=64,e.type=`sec`,e.pad=/ss/.test(t);let n=o[o.length-1];n&&32&n.size?e.used=!0:n?.indeterminate&&(delete n.indeterminate,n.size=32,n.type=`min`,e.used=!0)}r.date|=e.size,r.date_eval=!0,o.push(e),sn(e,n)}else if(p===`ampm`)r.clock=12,r.date=16|r.date,r.date_eval=!0,f.short=f.value===`A/P`,sn(f,n);else if(p===`string`||p===`escaped`||p===`char`)sn(f.value,n);else if(p===`condition`)r.condition=[f.value[0],parseFloat(f.value[1]??`0`)];else if(p===`locale`){let e=f.value.split(`-`),t=e.length<2?``:e.slice(1).join(`-`),i=e[0];i&&sn(i,n);let a=Et(t);a&&(r.locale=a);let o=parseInt(t,16);isFinite(o)&&16711680&o&&(o>>16&255)==6&&(r.date_system=6),s=!0}else if(p===`color`){let e,t=f.value.toLowerCase();(e=/^color\s*(\d+)$/i.exec(t))&&(t=parseInt(e[1],10)),r.color=t}else if(p===`percent`)r.scale*=100,r.percent=!0,sn(`%`,n);else if(p===`point`)sn(f,n),r.date||(r.dec_fractions=!0,i=`frac`);else if(p===`exp`)r.exponential=!0,r.exp_plus=f.value.includes(`+`),i=`man`,sn({type:`exp`,plus:r.exp_plus},n);else if(p===`skip`)sn(f,n);else if(p===`fill`)sn(f,n);else if(p!==`dbnum`&&p!==`natnum`)throw SyntaxError(p===`error`?`Illegal character: ${u}`:`Unknown token ${p} in ${u}`)}t=f}if(r.tokensUsed=c,r.pattern=u,/^((?:\[[^\]]+\])+)(;|$)/.test(r.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(r.pattern)&&sn({type:`text`},n),r.fractions&&r.dec_fractions||r.grouping&&!r.int_pattern.length||r.fractions&&r.exponential||r.fractions&&r.den_pattern.length*r.num_pattern.length===0||d&&!r.fractions&&!r.date||r.exponential&&(r.int_pattern.length||r.frac_pattern.length)*r.man_pattern.length===0)throw SyntaxError(`Invalid pattern: ${u}`);let f=r.int_pattern.join(``),p=r.man_pattern.join(``),m=r.frac_pattern.join(``);on(f,r,`int`);let h=0;for(let e=0;e<f.length;e++){let t=f[f.length-1-e];/^[0-9?]/.test(t)&&(h=e+1)}r.int_min=h,on(m,r,`frac`),on(p,r,`man`);let g=r.num_pattern.join(``),_=r.den_pattern[0]||``;if(_.includes(`?`)||g.includes(`?`)?(_=_.replace(/\d/g,`?`),_=_.replace(/#$/g,`?`),on(g,r,`num`),on(_,r,`den`),g=g.replace(/#$/g,`?`)):(on(g,r,`num`),on(_,r,`den`)),r.int_p=f,r.man_p=p,r.num_p=g,r.den_p=_,r.den_pattern.length&&(r.denominator=parseInt(r.den_pattern.join(``).replace(/\D/g,``),10)),r.integer=!!f.length,!r.integer&&!r.exponential&&m.length){let e=r.tokens.findIndex(e=>e.type===`point`);r.tokens.splice(e,0,{type:`int`,value:`#`}),r.integer=!0,r.int_pattern=[`#`],r.int_p=`#`}if(r.fractions)for(let e=0;e<n.length-1;e++){let t=n[e];if(t.type!==`string`&&t.type!==`space`)continue;let r=n[e+1].type;r===`num`?t.rule=`num+int`:r===`div`?t.rule=`num`:r===`den`&&(t.rule=`den`)}return r.grouping&&r.int_pattern.length>1&&(r.grouping=!1),r}function un(e,t=0){let n=Math.floor(Math.log10(e));return t>1?Math.floor(n/t)*t:n}function dn(e,t=1){return t<-300?parseFloat(e.toExponential().split(`e`)[0]):e*10**-t}var fn={total:1,sign:0,period:0,int:1,frac:0},pn=(e,t)=>e.replace(/\./,t.decimal),mn=(e,t,n)=>{let r,i=Math.abs(t);return r=e===1?e:Bt(e,5),[pn(r+``,n),n.exponent,t<0?n.negative:n.positive,i<10?`0`:``,i]};function hn(e,t,n,r){let i=0|n;if(typeof n==`string`)e.push(n);else if(n===i)e.push(Math.abs(i));else{let t=Math.abs(n),i=un(t),a=dn(t,i);a===10&&(a=1,i++);let o=function(e,t=!0){let n=Math.abs(e);if(!n)return fn;let r=t&&e<0?1:0,i=Math.floor(n),a=Math.floor(Math.log10(n)+1),o=0,s=0;if(i!==n){o=1;let e=String(Bt(n*10**-a,15)),t=e.length,r=!0,i=0;for(;i<=e.length;){if(e[i]===`.`){t--;break}e[i]===`0`&&r?t--:r=!1,i++}s=t-a,s<0&&(s=0,o=0)}return{total:r+Math.max(a,1)+o+s,digits:Math.max(a,0)+s,sign:r,period:o,int:Math.max(a,1),frac:s}}(t);if(i>=-4&&i<=-1){let n=t.toPrecision(10+i).replace(/\.?0+$/,``);e.push(pn(n,r))}else if(i===10){let n=t.toFixed(10).slice(0,12).replace(/\.$/,``);e.push(pn(n,r))}else if(Math.abs(i)<=9)if(o.total<=11){let n=Bt(t,9).toFixed(o.frac);e.push(pn(n,r))}else i===9?e.push(Math.floor(t)):i>=0&&i<9?e.push(pn(String(Bt(t,9-i)),r)):e.push(...mn(a,i,r));else o.total>=12?e.push(...mn(a,i,r)):e.push(pn(Bt(t,9).toFixed(o.frac),r))}return e}function gn(e,t=!1){return e===`0`?`0`:e===`?`?t?`\xA0`:` `:``}function _n(e){return typeof e==`number`&&isFinite(e)&&e!==0?Number(e.toPrecision(15)):e}function vn(e,t){return _n(Bt(e,t))}function yn(e){let t=String(e),n=/^(-?)(\d)(?:\.(\d+))?e([+-]\d+)$/.exec(t);if(!n)return t;let r=n[1],i=n[2],a=n[3]||``,o=+n[4];if(o>=0){let e=o-a.length;return e>=0?r+i+a+`0`.repeat(e):r+i+a.slice(0,o)+`.`+a.slice(o)}return r+`0.`+`0`.repeat(-o-1)+i+a}var bn=86400;function xn(e,t,n,r){let i=``,a=``,o=``,s=``,c=``,l=``,u=0,d=0;if(typeof e==`bigint`){if(!(e<=2**53-1&&e>=-(2**53-1)))return n.bigintErrorNumber?String(e):n.overflow;d=e=Number(e)}else d=Math.trunc(e);let f=0,p=0,m=1,h=0,g=0,_=0,v=0,y=0,b=0,x=r||kt;if(!t.text&&isFinite(t.scale)&&t.scale!==1&&(e=function(e){if(e===0)return e;let t=Math.ceil(Math.log10(e<0?-e:e)),n=10**(16-Math.floor(t));return isFinite(n)?Math.round(e*n)/n:0}(e*t.scale)),t.exponential){let n=Math.abs(e);n&&(u=un(n,t.int_max)),e&&!t.integer&&u++,n=dn(n,u),t.int_max===1&&Bt(n,t.frac_max)===10&&(n=1,u++),e=e<0?-n:n,i+=Math.abs(u)}if(e=_n(e),t.integer){let n=Math.abs(vn(e,t.fractions?1:t.frac_max));l+=n<1?``:yn(Math.floor(n))}let S=n.grouping[0]??3,C=n.grouping[1]??S;t.dec_fractions&&(c=yn(vn(e,t.frac_max)).split(`.`)[1]||``);let w=!t.error&&(t.num_p.includes(`0`)||t.den_p.includes(`0`)),T=w;if(t.fractions){T=w||!!(e%1);let n=Math.abs(t.integer?e%1:e);if(n)if(T=!0,t.denominator&&isFinite(t.denominator))s+=t.denominator,o+=Bt(n*t.denominator),o===`0`&&(o=``,s=``,T=w);else{let e=function(e,t=2,n=2){let r,i,a=e<0?-1:1,o=10**(t||2),s=10**(n||2),c=Math.abs(e),l=0,u=0,d=0,f=1;if((e=c)%1==0)i=[e*a,1];else if(e<1e-19)i=[a,0x8ac7230489e80000];else if(e>0x8ac7230489e80000)i=[0x8ac7230489e80000*a,1];else{do if(c=1/(c-Math.floor(c)),r=f,f=f*Math.floor(c)+l,l=r,u=d,d=Math.floor(e*f+.5),d>=o||f>=s)return[a*u,l];while(Math.abs(e-d/f)>=1e-13&&c!==Math.floor(c));i=[a*d,f]}return i}(n,1/0,t.den_max);o+=e[0],s+=e[1],t.integer&&o===`0`&&(o=``,s=``,T=w)}else e||t.integer||(T=!0,o=`0`,s=`1`);!t.integer||T||Math.trunc(e)||(l=`0`)}if(t.date){d=Math.trunc(e);let r=bn*(e-d);if(f=Math.floor(r),b=r-f,Math.abs(b)<1e-6?b=0:b>.9999&&(b=0,f+=1,f===bn&&(f=0,d+=1)),b){let e=512&t.date||256&t.date||128&t.date;(e===512&&b>.9995||e===256&&b>.995||e===128&&b>.95||!e&&b>=.5)&&(f++,b=0)}if(d||t.date_system){let r=Ut(e,t.date_system,n.leap1900);p=r[0],m=r[1],h=r[2]}if(f){let e=f<0?bn+f:f;y=Math.floor(e)%60,v=Math.floor(e/60)%60,_=Math.floor(e/60/60)%60}if(g=(6+d)%7,t.date_eval&&(E=e,D=d+f/bn,n.dateSpanLarge?E<-694324||D>=35830291:E<0||D>=2958466)){if(n.dateErrorThrows)throw Error(`Date out of bounds`);return n.dateErrorNumber?hn(e<0?[x.negative]:[],0,e,x).join(``):n.overflow}}var E,D;let O=gn(`?`,n.nbsp),k=e=>n.digitChar?n.digitChar+e:O,A=e=>n.digitChar&&e===`?`?n.digitChar+`0`:gn(e,n.nbsp);u<0?a=`-`:t.exp_plus&&(a=`+`);let j=[],M=(e,t,n,r)=>{let i=!r&&e.length>t.length?n.length+e.length-t.length:n.length;e.length<t.length&&(r+=e.length-t.length);for(let t=0;t<i;t++)j.push(e[t+r]||A(n[t]));return i},N=!1,P=-1;for(let e=0,n=t.tokens.length;e<n;e++){let n=t.tokens[e];if(n.date&&/^(?:year|b-year|month|weekday|day)/.test(n.type||``)){P=e;break}}let F={int:0,frac:0,man:0,num:0,den:0};for(let u=0,w=t.tokens.length;u<w;u++){let w=t.tokens[u],E=w.type,D=w.num?w.num.length:0;if(E===`string`)w.rule?w.rule===`num`?T?j.push(w.value.replace(/ /g,O)):(t.num_min>0||t.den_min>0)&&j.push(w.value.replace(/./g,e=>k(e))):w.rule===`num+int`?T&&l?j.push(w.value.replace(/ /g,O)):t.den_min>0&&(l||t.num_min)&&j.push(w.value.replace(/./g,e=>k(e))):w.rule===`den`&&(T?j.push(w.value.replace(/ /g,O)):(t.den_min>0||t.den_min>0)&&j.push(w.value.replace(/./g,e=>k(e)))):j.push(w.value.replace(/ /g,O));else if(E===`space`)w.rule===`num+int`?(T||t.num_min||t.den_min)&&(l||t.num_min)&&j.push(O):j.push(O);else if(E===`error`)j.push(n.invalid);else if(E===`point`)j.push(t.date?w.value:x.decimal);else if(E===`general`)hn(j,0,e,x);else if(E===`exp`)j.push(x.exponent);else if(E===`minus`)w.volatile&&t.date||w.volatile&&(e>=0||typeof e!=`number`)||(w.volatile&&!t.fractions&&(t.integer||t.dec_fractions)?(e<0&&l&&l!==`0`||c)&&j.push(x.negative):j.push(x.negative));else if(E===`plus`)j.push(x.positive);else if(E===`text`)j.push(e);else if(E===`fill`)n.fillChar&&j.push(n.fillChar,w.value);else if(E===`skip`)n.skipChar?j.push(n.skipChar,w.value):j.push(n.nbsp?`\xA0`:` `);else if(E===`div`)T?j.push(`/`):t.num_min>0||t.den_min>0?j.push(k(`/`)):j.push(gn(`#`,n.nbsp));else if(E===`int`)if(t.int_pattern.length===1){let e=t.int_p,n=``;for(let r=Math.max(t.int_min,l.length);r>0;r--){let i=l.charAt(l.length-r),a=i?``:e.charAt(e.length-r)||e[0],o=``;if(t.grouping){let e=r-1-S;e>=0&&!(e%C)&&(o=i||a===`0`?x.group:k(x.group))}n+=(i||A(a))+o}j.push(n)}else F.int+=M(l,t.int_p,w.num,F.int);else if(E===`frac`){let e=F.frac;for(let t=0;t<D;t++)j.push(c[t+e]||A(w.num[t]));F.frac+=D}else if(E===`man`)F[E]||F.man||j.push(a),F.man+=M(i,t.man_p,w.num,F.man);else if(E===`num`)F.num+=M(o,t.num_p,w.num,F.num);else if(E===`den`){let e=F.den;for(let t=0;t<D;t++){let n=s[t+e];if(!n){let e=w.num[t];`123456789`.includes(e)||N&&e===`0`?(N=!0,n=k(e)):n=N||t!==D-1||e!==`0`||s?A(e):`1`}j.push(n)}F.den+=D}else if(E===`year`)p<0&&j.push(x.negative),j.push(String(Math.abs(p)).padStart(4,`0`));else if(E===`year-short`){let e=p%100;j.push(e<10?`0`:``,e)}else if(E===`month`)j.push(w.pad&&m<10?`0`:``,m);else if(E===`monthname-single`)t.date_system===6?j.push(x.mmmm6[m-1].charAt(0)):j.push(x.mmmm[m-1].charAt(0));else if(E===`monthname-short`)t.date_system===6?j.push(x.mmm6[m-1]):j.push(x.mmm[m-1]);else if(E===`monthname`)t.date_system===6?j.push(x.mmmm6[m-1]):j.push(x.mmmm[m-1]);else if(w.type===`weekday-short`)j.push(x.ddd[g]);else if(E===`weekday`)j.push(x.dddd[g]);else if(E===`day`)j.push(w.pad&&h<10?`0`:``,h);else if(E===`hour`){let e=_%t.clock||(t.clock<24?t.clock:0);j.push(w.pad&&e<10?`0`:``,e)}else if(E===`min`)j.push(w.pad&&v<10?`0`:``,v);else if(E===`sec`)j.push(w.pad&&y<10?`0`:``,y);else if(E===`subsec`){j.push(x.decimal);let e=b.toFixed(t.sec_decimals);j.push(e.slice(2,2+w.decimals))}else if(E===`ampm`){let e=_<12?0:1;w.short&&!r?j.push(`AP`[e]):j.push(x.ampm[e])}else if(E===`hour-elap`){e<0&&j.push(x.negative);let t=P!==-1&&u>P?12:24*d+Math.floor(Math.abs(f)/3600);j.push(String(Math.abs(t)).padStart(w.pad,`0`))}else if(E===`min-elap`){e<0&&j.push(x.negative);let t=P!==-1&&u>P?720:1440*d+Math.floor(Math.abs(f)/60);j.push(String(Math.abs(t)).padStart(w.pad,`0`))}else if(E===`sec-elap`){e<0&&j.push(x.negative);let t=P!==-1&&u>P?43200:d*bn+Math.abs(f);j.push(String(Math.abs(t)).padStart(w.pad,`0`))}else if(E===`b-year`)j.push(p+543);else if(E===`b-year-short`){let e=(p+543)%100;j.push(e<10?`0`:``,e)}}return j.join(``)}var Sn=ln([{type:qe,value:`@`,raw:`@`}]);function Cn(e,t){for(let n=0;n<3;n++){let r=t[n];if(r){let t;if(r.condition){let n=r.condition[0],i=r.condition[1];n===`=`?t=e===i:n===`>`?t=e>i:n===`<`?t=e<i:n===`>=`?t=e>=i:n===`<=`?t=e<=i:n===`<>`&&(t=e!==i)}else t=!0;if(t)return r}}}function wn(e){return!!(e[0]?.percent||e[1]?.percent||e[2]?.percent||e[3]?.percent)}function Tn(e){return!!(e[0]?.date||e[1]?.date||e[2]?.date||e[3]?.date)}function En(e){let[t,n,r,i]=e;return!(t&&!t.generated||n&&!n.generated||r&&!r.generated||!i?.text||i.generated)}var Dn={text:15,datetime:10.8,date:10.8,time:10.8,percent:10.6,currency:10.4,grouped:10.2,scientific:6,number:4,fraction:2,general:0,error:0},On=[[`DMY`,1],[`DM`,2],[`MY`,3],[`MDY`,4],[`MD`,5],[`hmsa`,6],[`hma`,7],[`hms`,8],[`hm`,9]],kn=[[Re,/^General/i,0],[ze,/^#/,0],[Be,/^0/,0],[Ve,/^\?/,0],[He,/^\//,0],[Ke,/^;/,0],[qe,/^@/,0],[Je,/^\+/,0],[Ye,/^-/,0],[Xe,/^\./,0],[Ze,/^ /,0],[Qe,/^%/,0],[$e,/^[1-9]/,0],[et,/^(?:B[12])/i,0],[tt,/^B$/,0],[nt,/^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/,0],[rt,/^(?:\[(h+|m+|s+)\])/i,1],[it,/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+(?:[eE][+-]?\d+)?)?\]/,[1,2]],[at,/^\[(DBNum[0-4]?\d)\]/i,1],[ot,/^\[(NatNum[0-4]?\d)\]/i,1],[st,/^\[\$([^\]]+)\]/,1],[ct,/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i,1],[lt,/^\[([^\]]+)\]/,1],[ut,/^(?:AM\/PM|am\/pm|A\/P)/,0],[dt,/^\\(.)/,1],[ft,/^"([^"]*?)"/,1],[pt,/^_(\\.|.)/,1],[`exp`,/^[Ee]([+-])/,1],[mt,/^\*(\\.|.)/,1],[ht,/^[()]/,0],[tt,/^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/,0],[gt,/^./,0]],An=e=>{let t=(e||`\0`).charCodeAt(0);return t===63||t===35||t>=48&&t<=57};function jn(e){let t=0,n=[],r=[];for(;t<e.length;){let i=e.slice(t),a=0,o=/^(,+)(.)?/.exec(i);if(o){let i=o[1];a=i.length;let s=e[t-1]||``,c=!1,l=!1;An(s)?(c=!0,l=!0):s===`.`&&(l=!0);let u=o[2]||``;if(!c||u&&u!==`;`||(c=!1),l&&An(u)&&(l=!1),c&&!l)n.push({type:Ue,value:`,`,raw:i});else if(!c&&l)n.push({type:We,value:`,`,raw:i});else if(c&&l){let e={type:We,value:`,`,raw:i};n.push(e),r.push(e)}else n.push({type:Ge,value:`,`,raw:i})}else{let e;for(let[t,r,o]of kn){let s=r.exec(i);if(s){e={type:t,value:Array.isArray(o)?o.map(e=>s[e]):s[o||0],raw:s[0]},n.push(e),a=s[0].length;break}}r.length&&e.raw===`;`&&(r.length=0),r.length&&e.raw===`.`&&(r.length=0),r.length&&An(e.raw)&&(r.forEach(e=>e.type=Ue),r.length=0)}if(!a){let e=i[0];a=1,n.push({type:gt,value:e,raw:e})}t+=a}return n}var Mn=e=>{let[t,n]=e.condition??[];n<0&&(t===`<`||t===`<=`||t===`=`)||n===0&&t===`<`||e.tokens.unshift({type:`minus`,volatile:!0})},Nn=(e,t=null)=>{let n={};for(let t in e)Array.isArray(e[t])?n[t]=[...e[t]]:n[t]=e[t];return t&&n.tokens.unshift(t),n.generated=!0,n},Pn=Object.create({});function Fn(e,t=!1){e||=`General`;let n=Pn[e];if(!n)try{n=function(e){let t,n=[],r=!1,i=null,a=0,o=!1,s=0,c=0,l=jn(e);do{if(o=ln(l),(o.date||o.general)&&(o.int_pattern.length||o.frac_pattern.length||o.scale!==1||o.text))throw Error(`Illegal format`);if(o.condition&&(c++,r=!0),o.text){if(i)throw Error(`Unexpected partition`);i=o}o.locale&&(t=Et(o.locale)),n.push(o),a=+(l[o.tokensUsed]?.type===`break`),l=l.slice(o.tokensUsed+a),s++}while(a&&s<4&&c<3);if(a)throw Error(`Unexpected partition`);if(c>2)throw Error(`Unexpected condition`);let u=n[3];if(u&&(u.int_pattern.length||u.frac_pattern.length||u.date))throw Error(`Unexpected partition`);if(r){n[0].condition||(n[0].condition=[`>`,0]);let e=n.length;if(e===1&&(n[1]=ln(jn(`General`)),n[1].generated=!0),e<3){let e=n[0],t=n[1];if(Mn(e),t.condition)Mn(t);else{let n=e.condition;(n[0]===`=`||n[1]>=0&&(n[0]===`>`||n[0]===`>=`))&&t.tokens.unshift({type:`minus`,volatile:!0})}}else n.forEach(Mn)}else{if(n.length<4&&i)for(let e=0,t=n.length;e<t;e++)n[e]===i&&n.splice(e,1);if(n.length<1&&i&&(n[0]=ln(jn(`General`)),n[0].generated=!0),n.length<2&&n.push(Nn(n[0],{type:`minus`,volatile:!0})),n.length<3&&n.push(Nn(n[0])),n.length<4)if(i)n.push(i);else{let e=ln(jn(`@`));e.generated=!0,n.push(e)}n[0].condition=[`>`,0],n[1].condition=[`<`,0],n[2].condition=null}return{pattern:e,partitions:n,locale:t}}(e),Pn[e]=n}catch(r){if(t)throw r;let i={tokens:[{type:`error`}],error:r.message};n={pattern:e,partitions:[i,i,i,i],error:r.message,locale:null}}return n}function In(e,t,n={}){let r=Object.assign({},zt,n),i=Fn(e,r.throws);return function(e,t,n){let r=t.partitions,i=Dt(t.locale||n.locale),a=r[3]?r[3]:Sn;if(typeof e==`boolean`&&(e=(i||kt).bool[+!e]),e==null)return``;let o=typeof e==`bigint`;if(typeof e!=`number`&&!o)return xn(e,a,n,i);if(!o&&!isFinite(e)){let t=i||kt;return isNaN(e)?t.nan:(e<0?t.negative:``)+t.infinity}let s=Cn(e,r);return s?xn(e,s,n,i):n.overflow}(Kt(t,r)??t,i,r)}function Ln(e,t={}){let n=Fn(e,!1);return n.info||=function(e,t=null){let[n,r]=e,i=n.frac_max,a={type:`general`,isDate:Tn(e),isText:En(e),isPercent:wn(e),maxDecimals:n.general?9:i,scale:n.scale??1,color:0,parentheses:0,grouped:+!!n.grouping},o=!a.isDate&&!a.isText&&!n.error&&n.tokens.some(e=>e.type===`string`&&(t?e.value===t:yt.test(e.value))),s=`G`,c=i>=0?Math.min(15,i):``,l=``,u=``;if(r?.color&&(u=`-`,a.color=1),n.parens&&(l=`()`,a.parentheses=1),o)s=`C`,a.type=`currency`;else if(n.error)a.type=`error`,a.maxDecimals=0;else if(a.isDate){let e=0,t=0,r=``;n.tokens.forEach(n=>{let i=n.type;/^(b-)?year/.test(i)?(r+=`Y`,t++):i.startsWith(`month`)?(r+=`M`,t++):/^(week)?day/.test(i)?(r+=`D`,t++):i!==`hour`&&i!==`min`&&i!==`sec`&&i!==`ampm`||(r+=i[0],e++)}),a.type=`date`,t&&e?a.type=`datetime`:!t&&e&&(a.type=`time`);let i=On.find(e=>r.startsWith(e[0]));s=i?`D`:`G`,c=i?i[1]:``}else a.isText?(s=`G`,a.type=`text`,c=``,a.maxDecimals=0):n.general?(s=`G`,a.type=`general`,c=``):n.fractions?(s=`G`,a.type=`fraction`,c=``):n.exponential?(s=`S`,a.type=`scientific`):a.isPercent?(s=`P`,a.type=`percent`):n.grouping?(s=`,`,a.type=`grouped`):(n.int_max||i)&&(s=`F`,a.type=`number`);return a.code=s+c+u+l,a.level=Dn[a.type],Object.freeze(a)}(n.partitions,t?.currency),n.info}Object.freeze({AMPM:ut,BREAK:Ke,CALENDAR:et,CHAR:gt,COLOR:ct,COMMA:Ge,CONDITION:it,DATETIME:nt,DBNUM:at,DIGIT:$e,DURATION:rt,ERROR:tt,ESCAPED:dt,EXP:`exp`,FILL:mt,GENERAL:Re,GROUP:Ue,HASH:ze,LOCALE:st,MINUS:Ye,MODIFIER:lt,NATNUM:ot,PAREN:ht,PERCENT:Qe,PLUS:Je,POINT:Xe,QMARK:Ve,SCALE:We,SKIP:pt,SLASH:He,SPACE:Ze,STRING:ft,TEXT:qe,ZERO:Be});var Rn=Object.freeze({0:`General`,1:`0`,2:`0.00`,3:`#,##0`,4:`#,##0.00`,5:`$#,##0_);($#,##0)`,6:`$#,##0_);[Red]($#,##0)`,7:`$#,##0.00_);($#,##0.00)`,8:`$#,##0.00_);[Red]($#,##0.00)`,9:`0%`,10:`0.00%`,11:`0.00E+00`,12:`# ?/?`,13:`# ??/??`,14:`m/d/yy`,15:`d-mmm-yy`,16:`d-mmm`,17:`mmm-yy`,18:`h:mm AM/PM`,19:`h:mm:ss AM/PM`,20:`h:mm`,21:`h:mm:ss`,22:`m/d/yy h:mm`,23:`General`,24:`General`,25:`General`,26:`General`,27:`m/d/yyyy`,28:`m/d/yyyy`,29:`m/d/yyyy`,30:`m/d/yyyy`,31:`m/d/yyyy`,32:`h:mm:ss`,33:`h:mm:ss`,34:`h:mm:ss`,35:`h:mm:ss`,36:`m/d/yyyy`,37:`#,##0_);(#,##0)`,38:`#,##0_);[Red](#,##0)`,39:`#,##0.00_);(#,##0.00)`,40:`#,##0.00_);[Red](#,##0.00)`,41:`_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)`,42:`_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)`,43:`_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)`,44:`_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)`,45:`mm:ss`,46:`[h]:mm:ss`,47:`mmss.0`,48:`##0.0E+0`,49:`@`,50:`m/d/yyyy`,51:`m/d/yyyy`,52:`m/d/yyyy`,53:`m/d/yyyy`,54:`m/d/yyyy`,55:`m/d/yyyy`,56:`m/d/yyyy`,57:`m/d/yyyy`,58:`m/d/yyyy`,59:`00000`,60:`0.00`,61:`#,##0`,62:`#,##0.00`,63:`$#,##0_);($#,##0)`,64:`$#,##0_);[Red]($#,##0)`,65:`$#,##0.00_);($#,##0.00)`,66:`$#,##0.00_);[Red]($#,##0.00)`,67:`0%`,68:`0.00%`,69:`# ?/?`,70:`# ??/??`,71:`m/d/yyyy`,72:`m/d/yyyy`,73:`d-mmm-yy`,74:`d-mmm`,75:`mmm-yy`,76:`h:mm`,77:`h:mm:ss`,78:`m/d/yyyy h:mm`,79:`mm:ss`,80:`[h]:mm:ss`,81:`mm:ss.0`});function zn(e){return Rn[e]}function Bn(e){return typeof e==`number`?Rn[e]??`General`:e}var Vn=new Map;for(let e in Rn){let t=Number(e),n=Rn[t];Vn.has(n)||Vn.set(n,t)}var Hn={AD:`EUR`,AT:`EUR`,BE:`EUR`,CY:`EUR`,DE:`EUR`,EE:`EUR`,ES:`EUR`,FI:`EUR`,FR:`EUR`,GR:`EUR`,HR:`EUR`,IE:`EUR`,IT:`EUR`,LT:`EUR`,LU:`EUR`,LV:`EUR`,MC:`EUR`,ME:`EUR`,MT:`EUR`,NL:`EUR`,PT:`EUR`,SI:`EUR`,SK:`EUR`,SM:`EUR`,VA:`EUR`,XK:`EUR`,AL:`ALL`,BA:`BAM`,BG:`BGN`,BY:`BYN`,CH:`CHF`,CZ:`CZK`,DK:`DKK`,FO:`DKK`,GB:`GBP`,GE:`GEL`,GG:`GBP`,GI:`GIP`,IM:`GBP`,IS:`ISK`,JE:`GBP`,LI:`CHF`,MD:`MDL`,MK:`MKD`,NO:`NOK`,PL:`PLN`,RO:`RON`,RS:`RSD`,RU:`RUB`,SE:`SEK`,SJ:`NOK`,TR:`TRY`,UA:`UAH`,AG:`XCD`,AI:`XCD`,AR:`ARS`,AW:`AWG`,BB:`BBD`,BL:`EUR`,BM:`BMD`,BO:`BOB`,BQ:`USD`,BR:`BRL`,BS:`BSD`,BZ:`BZD`,CA:`CAD`,CL:`CLP`,CO:`COP`,CR:`CRC`,CU:`CUP`,CW:`XCG`,DM:`XCD`,DO:`DOP`,EC:`USD`,FK:`FKP`,GD:`XCD`,GF:`EUR`,GL:`DKK`,GP:`EUR`,GT:`GTQ`,GY:`GYD`,HN:`HNL`,HT:`HTG`,JM:`JMD`,KN:`XCD`,KY:`KYD`,LC:`XCD`,MF:`EUR`,MQ:`EUR`,MS:`XCD`,MX:`MXN`,NI:`NIO`,PA:`PAB`,PE:`PEN`,PM:`EUR`,PR:`USD`,PY:`PYG`,SR:`SRD`,SV:`USD`,SX:`XCG`,TC:`USD`,TT:`TTD`,US:`USD`,UY:`UYU`,VC:`XCD`,VE:`VES`,VG:`USD`,VI:`USD`,AE:`AED`,AF:`AFN`,AM:`AMD`,AZ:`AZN`,BD:`BDT`,BH:`BHD`,BN:`BND`,BT:`BTN`,CC:`AUD`,CN:`CNY`,CX:`AUD`,HK:`HKD`,ID:`IDR`,IL:`ILS`,IN:`INR`,IQ:`IQD`,IR:`IRR`,JO:`JOD`,JP:`JPY`,KG:`KGS`,KH:`KHR`,KP:`KPW`,KR:`KRW`,KW:`KWD`,KZ:`KZT`,LA:`LAK`,LB:`LBP`,LK:`LKR`,MM:`MMK`,MN:`MNT`,MO:`MOP`,MV:`MVR`,MY:`MYR`,NP:`NPR`,OM:`OMR`,PH:`PHP`,PK:`PKR`,PS:`ILS`,QA:`QAR`,SA:`SAR`,SG:`SGD`,SY:`SYP`,TH:`THB`,TJ:`TJS`,TL:`USD`,TM:`TMT`,TW:`TWD`,UZ:`UZS`,VN:`VND`,YE:`YER`,AO:`AOA`,BF:`XOF`,BI:`BIF`,BJ:`XOF`,BW:`BWP`,CD:`CDF`,CF:`XAF`,CG:`XAF`,CI:`XOF`,CM:`XAF`,CV:`CVE`,DJ:`DJF`,DZ:`DZD`,EG:`EGP`,EH:`MAD`,ER:`ERN`,ET:`ETB`,GA:`XAF`,GH:`GHS`,GM:`GMD`,GN:`GNF`,GQ:`XAF`,GW:`XOF`,KE:`KES`,KM:`KMF`,LR:`LRD`,LS:`LSL`,LY:`LYD`,MA:`MAD`,MG:`MGA`,ML:`XOF`,MR:`MRU`,MU:`MUR`,MW:`MWK`,MZ:`MZN`,NA:`NAD`,NE:`XOF`,NG:`NGN`,RE:`EUR`,RW:`RWF`,SC:`SCR`,SD:`SDG`,SH:`SHP`,SL:`SLE`,SN:`XOF`,SO:`SOS`,SS:`SSP`,ST:`STN`,SZ:`SZL`,TD:`XAF`,TG:`XOF`,TN:`TND`,TZ:`TZS`,UG:`UGX`,YT:`EUR`,ZA:`ZAR`,ZM:`ZMW`,ZW:`ZWG`,AS:`USD`,AU:`AUD`,CK:`NZD`,FJ:`FJD`,FM:`USD`,GU:`USD`,KI:`AUD`,MH:`USD`,MP:`USD`,NC:`XPF`,NF:`AUD`,NR:`AUD`,NU:`NZD`,NZ:`NZD`,PF:`XPF`,PG:`PGK`,PW:`USD`,SB:`SBD`,TK:`NZD`,TO:`TOP`,TV:`AUD`,VU:`VUV`,WF:`XPF`,WS:`WST`},Un=new Set([`ar`,`he`,`fa`,`ur`,`ps`,`sd`,`ug`,`dv`,`ku`]),Wn={US:{firstDay:0,weekend:[6,0]},CA:{firstDay:0,weekend:[6,0]},GB:{firstDay:1,weekend:[6,0]},DE:{firstDay:1,weekend:[6,0]},FR:{firstDay:1,weekend:[6,0]},ES:{firstDay:1,weekend:[6,0]},IT:{firstDay:1,weekend:[6,0]},BR:{firstDay:0,weekend:[6,0]},MX:{firstDay:0,weekend:[6,0]},JP:{firstDay:0,weekend:[6,0]},CN:{firstDay:1,weekend:[6,0]},IN:{firstDay:0,weekend:[6,0]},AE:{firstDay:6,weekend:[5,6]},SA:{firstDay:0,weekend:[5,6]}},Gn=new Set([`hi-IN`,`en-IN`,`bn-IN`,`gu-IN`,`mr-IN`,`ta-IN`,`te-IN`,`kn-IN`,`ml-IN`,`pa-IN`]);function Kn(e,t){let n=new Intl.DateTimeFormat(e,t),r=new Date(Date.UTC(2001,10,21,13,5,9)),i=n.formatToParts(r),a=n.resolvedOptions(),o=typeof a.hour12==`boolean`?a.hour12:a.hourCycle?/h1[12]/.test(a.hourCycle):i.some(e=>e.type===`dayPeriod`),s=(e,t)=>{switch(e){case`year`:return t.length>=4?`yyyy`:`yy`;case`month`:return/^\d+$/.test(t)?t.length===2?`MM`:`M`:t.length<=3?`MMM`:`MMMM`;case`day`:return t.length===2?`dd`:`d`;case`weekday`:return t.length<=3?`EEE`:`EEEE`;case`hour`:{let e=t.length===2;return o?e?`hh`:`h`:e?`HH`:`H`}case`minute`:return t.length===2?`mm`:`m`;case`second`:return t.length===2?`ss`:`s`;case`dayPeriod`:return`a`;case`era`:return t.length<=3?`G`:`GGGG`;case`timeZoneName`:return t.length>3?`zzzz`:`z`;default:return``}},c=``;for(let e of i)c+=e.type===`literal`?e.value:s(e.type,e.value);return c}function qn(e,t){let n=new Intl.DateTimeFormat(e,{month:t});return Array.from({length:12},(e,t)=>n.format(new Date(2020,t,1)))}function Jn(e,t){let n=new Intl.DateTimeFormat(e,{weekday:t});return Array.from({length:7},(e,t)=>n.format(new Date(2020,7,2+t)))}function Yn(e){return typeof e==`object`&&e?Array.isArray(e)?`[`+e.map(Yn).join(`,`)+`]`:`{`+Object.keys(e).sort().map(t=>JSON.stringify(t)+`:`+Yn(e[t])).join(`,`)+`}`:JSON.stringify(e)??`null`}var Xn=new Map;function Zn(e,t){let n=t?e+`\0`+Yn(t):e,r=Xn.get(n);return r||(r=function(e,t){let n=new Intl.NumberFormat(e).resolvedOptions().numberingSystem||`latn`,{decimal:r,group:i,minusSign:a,percentSign:o}=function(e){let t=new Intl.NumberFormat(e,{useGrouping:!0,maximumFractionDigits:1}).formatToParts(12345.6);return{decimal:t.find(e=>e.type===`decimal`)?.value??`.`,group:t.find(e=>e.type===`group`)?.value??`,`,minusSign:new Intl.NumberFormat(e).formatToParts(-1).find(e=>e.type===`minusSign`)?.value??`-`,percentSign:new Intl.NumberFormat(e,{style:`percent`,maximumFractionDigits:0}).formatToParts(50).find(e=>e.type===`percentSign`)?.value??`%`}}(e),s=Gn.has(e)?[3,2]:i===``?[]:function(e,t){let n=new Intl.NumberFormat(e,{useGrouping:!0}).format(1234567890123),r=[];for(let e=0;e<n.length;e++)n[e]===t&&r.push(e);if(r.length===0)return[];let i=r.map(e=>n.length-1-e).sort((e,t)=>e-t),a=[];for(let e=0;e<i.length;e++){let t=e===0?-1:i[e-1];a.push(i[e]-t-1)}if(a.every(e=>e===a[0]))return[a[0]];let o=a[a.length-1];return[a[a.length-2],o]}(e,i),{code:c,symbol:l,position:u,spacing:d}=function(e){let t;try{t=new Intl.Locale(e).maximize().region??``}catch{t=``}let n=Hn[t]??`USD`,r=new Intl.NumberFormat(e,{style:`currency`,currency:n}).formatToParts(12),i=r.map(e=>e.type),a=i.indexOf(`currency`),o=[i.indexOf(`integer`),i.indexOf(`nan`)].filter(e=>e!==-1),s=o.length>0?Math.min(...o):-1,c=a!==-1&&s!==-1&&a<s,l=r.some(e=>e.type===`literal`&&/\s/.test(e.value))?`space`:`tight`;return{code:n,symbol:r[a]?.value??n,position:c?`before`:`after`,spacing:l}}(e),f=Kn(e,{dateStyle:`short`}),p=Kn(e,{dateStyle:`medium`}),m=Kn(e,{dateStyle:`long`}),h=Kn(e,{timeStyle:`short`}),g=Kn(e,{timeStyle:`medium`}),{firstDay:_,weekend:v}=function(e){try{let t=new Intl.Locale(e);if(t.weekInfo)return{firstDay:t.weekInfo.firstDay,weekend:[t.weekInfo.weekend[0],t.weekInfo.weekend[t.weekInfo.weekend.length-1]]}}catch{}return Wn[function(e){let t=e.split(/[-_]/);return t.length>=2?t[1].toUpperCase():``}(e)]??{firstDay:1,weekend:[6,0]}}(e),{am:y,pm:b}=function(e){return{am:new Intl.DateTimeFormat(e,{hour:`numeric`,hour12:!0}).formatToParts(new Date(Date.UTC(2e3,0,1,9))).find(e=>e.type===`dayPeriod`)?.value,pm:new Intl.DateTimeFormat(e,{hour:`numeric`,hour12:!0}).formatToParts(new Date(Date.UTC(2e3,0,1,18))).find(e=>e.type===`dayPeriod`)?.value}}(e),x=qn(e,`long`),S=qn(e,`short`),C=Jn(e,`long`),w=Jn(e,`short`),T=function(e){return!!new Intl.DateTimeFormat(e,{hour:`numeric`}).resolvedOptions().hour12}(e),{list:E,csv:D}=function(e){let t=e===`,`?`;`:`,`;return{list:t,csv:t}}(r),O=function(e){let t=function(e){return e.split(/[-_]/)[0]}(e);return Un.has(t)}(e),k={tag:e,numberingSystem:n,decimal:r,group:i,grouping:s,minusSign:a,percentSign:o,permilleSign:`‰`,currencyCode:c,currencySymbol:l,currencyDisplay:`symbol`,currencyPosition:u,currencySpacing:d,date:{calendar:new Intl.DateTimeFormat(e).resolvedOptions().calendar||`gregory`,short:f,medium:p,long:m,timeShort:h,timeLong:g,am:y,pm:b,firstDay:_,weekend:v,monthsWide:x,monthsAbbr:S,weekdaysWide:C,weekdaysAbbr:w,hour12:T},listSeparator:E,csvDelimiter:D,rtl:O,collator:{sensitivity:`accent`,numeric:!1}};return t?function(e,t){let{date:n,...r}=t;return{...e,...r,tag:e.tag,date:n?{...e.date,...n}:e.date}}(k,t):k}(e,t),Xn.set(n,r)),r}var Qn=1462;function $n(e){let t=(6+Math.floor(e))%7;return t===0?7:t}function er(e,t,n){let r=function(e,t){let n=Math.floor((14-t)/12),r=e+4800-n,i=t+12*n-3;return 1+Math.floor((153*i+2)/5)+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)-32045}(e,t)-2415019;return(r<=60?r-1:r)+n-1}function tr(e,t,n,r=0,i=0,a=0,o=0){let s=3600*r+60*i+a+o/1e3,c=Math.floor(s/86400);return er(e,t,n)+c+(s-86400*c)/86400}function nr(e){let t=86400*(e-Math.floor(e)),n=t-Math.floor(t);return(n>.9999||n<1e-6)&&(n=0),Math.round(1e3*n)}function rr(e,t=!1){return e instanceof Date||Object.prototype.toString.call(e)===`[object Date]`?!isNaN(e.getTime()):!t&&typeof e==`number`&&!(e<0||e>2958465)}function ir(e,t,n){return n===`m`||n===`month`||n===`months`?(r=e,12*((i=t).getUTCFullYear()-r.getUTCFullYear())+(i.getUTCMonth()-r.getUTCMonth())+(i.getUTCDate()-r.getUTCDate()<0?-1:0)):n===`y`||n===`year`||n===`years`?function(e,t){return Math.abs(t.getFullYear()-e.getFullYear())}(e,t):n===`d`||n===`day`||n===`days`?function(e,t){return Math.floor((Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())-Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()))/864e5)}(e,t):void console.warn(`invalid unit`+n);var r,i}var ar=`d`;function or(e,t,n){if(n===`m`||n===`month`||n===`months`){let n=new Date(e.getTime());return new Date(n.setMonth(n.getMonth()+t))}if(n===`y`||n===`year`||n===`years`){let n=new Date(e.getTime());return n.setFullYear(n.getFullYear()+t),n}if(n===`d`||n===`day`||n===`days`){let n=new Date(e.getTime());return n.setDate(n.getDate()+t),n}if(n===`hour`||n===`hours`||n===`h`){let n=new Date(e.getTime());return n.setHours(n.getHours()+t),n}return console.warn(`invalid unit`+n),null}function sr(e,t=!1,n){if(typeof e!=`number`||isNaN(e)||e<0)return null;let r=t?e+Qn:e;if(r>2958465)return null;let[i,a,o,s,c,l]=qt(r,{leap1900:!0}),u=nr(r),d=$n(r),f=!0===n?cr:n||void 0;return f?(f.year=i,f.month=a,f.day=o,f.hour=s,f.minute=c,f.second=l,f.millis=u,f.dow=d,f.serial=e,f):{year:i,month:a,day:o,hour:s,minute:c,second:l,millis:u,dow:d,serial:e}}var cr={year:0,month:0,day:0,hour:0,minute:0,second:0,millis:0,dow:0,serial:0};function lr(e,t=!1){if(!e)return null;let n=tr(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millis);return t?n-Qn:n}function ur(e,t=!1){if(typeof e!=`number`||isNaN(e)||e<0)return null;let n=t?e+Qn:e;if(n>2958465)return null;let[r,i,a,o,s,c]=qt(n,{leap1900:!0});return new Date(r,i-1,a,o,s,c,nr(n))}function dr(e,t=!1){if(isNaN(e))return null;let n=tr(e.getFullYear(),e.getMonth()+1,e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds());return t?n-Qn:n}var fr=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),pr=e=>e.map(fr).join(`|`),mr=/MMMM|MMM|MM|M|dd|d|yyyy|yyy|EEEE|EEE|[^MdyE]+/g;function hr(e,t,n){let r=t.regex.exec(e);if(!r)return null;let i={};for(let e=0;e<t.fields.length;e++){let a=r[e+1];switch(t.fields[e]){case`monthName`:{let e=n.get(a.toLowerCase());if(!e)return null;i.month=e;break}case`monthNum`:{let e=parseInt(a,10);if(e<1||e>12)return null;i.month=e;break}case`day`:{let e=parseInt(a,10);if(e<1||e>31)return null;i.day=e;break}case`year`:i.year=parseInt(a,10)}}return i.month===void 0?null:i}var gr=new Map,_r={year:0,month:1,day:0,hour:0,minute:0,second:0,millis:0};function vr(e,t){let n={..._r,...t},r=e.isDate1904();return n.year=r?1904:1900,r&&t.day===void 0&&(n.day=1),n.serial=lr(n,r),n.dow=$n(r?n.serial+Qn:n.serial),n}var yr=RegExp(`([0-9]{1,2})\\s*(P[M]?|A[M]?)\\s*$`,`i`),br=RegExp(`([0-9]+)\\s*\\:$`,`i`),xr=RegExp(`(\\s*[0-9]{1,2})\\s+(P[M]?|A[M]?)\\s*$`,`i`),Sr=new Map;function Cr(e,t,n=!1,r=!1){if(!t||t.trim().length<2||t.indexOf(`:`)===-1&&t.match(xr)===null)return null;let{mid:i,last:a,lastMeridiem:o,split:s}=function(e){let t=Sr.get(e);if(t)return t;let n=fr(e);return t={mid:RegExp(`(\\s*[0-9]{1,4})\\s*(${n}\\s*[0-9]+)?\\s*\\:`,`i`),last:RegExp(`(\\s*[0-9]{1,4})\\s*(${n}\\s*[0-9]*)?\\s*$`,`i`),lastMeridiem:RegExp(`(\\s*[0-9]{1,4})\\s*(${n}\\s*[0-9]*)?\\s+(P[M]?|A[M]?)\\s*$`,`i`),split:RegExp(`^(\\s*[0-9]{1,4}\\s*(?:${n}\\s*[0-9]*)?(?:\\s+[AP]M?)?)\\s+(\\S.*)$`,`i`)},Sr.set(e,t),t}(e.getLocaleProfile().decimal),c=null,l=null,u=null,d=!1,f=!1,p=`h:mm AM/PM`,m=[],h=t,g=null;do{let e=h.indexOf(`:`);e===-1?(m.push(h),h=null):(m.push(h.substring(0,e+1)),h=h.substring(e+1,h.length))}while(m.length<3&&h&&h.length>0);if((h?.length??0)>0)return null;let _=(e,t,n,r=!1)=>{let i=e.match(t);if(!i||r&&(i.index!==0||i[0].length!==e.length))return null;g===null&&(g=e.substring(0,i.index));let a=parseInt(i[1]);if(i[2]&&u===null){if(n){let e=parseFloat(i[2].substring(1,i[2].length));isNaN(e)||(l=e)}let e=parseFloat(`.`+i[2].substring(1,i[2].length).trim());isNaN(e)||(c=e),u=n}return a},v=(e,t,n=!1)=>{let r=e.match(t);if(!r||r.length!==3||n&&(r.index!==0||r[0].length!==e.length))return null;g===null&&(g=e.substring(0,r.index)),d=!0;let i=parseInt(r[1]);return f=r[2].charAt(0)===`p`||r[2].charAt(0)===`P`,i};m[m.length-1].trim().length===0&&m.pop();let y=[];if(m.length>0){let e=_(m[0],br,!1);if(e===null&&(e=v(m[0],yr)),e===null)return null;y.push(e)}if(m.length>2){let e=_(m[1],i,!0,!0);if(e===null&&(e=v(m[0],xr)),e===null)return null;y.push(e)}let b=``;if(m.length>1){let e=m[m.length-1],t=e=>{let t=_(e,i,!1,!0);return t===null&&(t=_(e,a,!1,!0)),t===null&&(t=v(e,xr,!0)),t===null&&(t=(e=>{let t=e.match(o);if(!t||t.index!==0||t[0].length!==e.length)return null;if(g===null&&(g=``),d=!0,f=t[3].charAt(0)===`p`||t[3].charAt(0)===`P`,t[2]&&u===null){let e=parseFloat(`.`+t[2].substring(1).trim());isNaN(e)||(c=e),u=!1}return parseInt(t[1])})(e)),t},n=t(e);if(n===null&&r){let r=e.match(s);r&&(n=t(r[1]),n!==null&&(b=r[2]))}if(n===null)return null;y.push(n)}if((g??``).length>0&&!n)return null;if(!0===u&&(y.length===2&&y.splice(1,0,0),y[2]=l||0),y.length===2&&c!==null&&!0!==u&&y.unshift(0),d){if(y[0]>12||y[1]>=60||y[2]>=60)return null;y[0]===12?y[0]=f?12:0:f&&(y[0]+=12),c!==null&&(p=`mm:ss.0`)}else p=m.length>2?`h:mm:ss`:`h:mm`,y[0]>23&&(p=`[h]:mm:ss`),c!==null&&(p=`mm:ss.0`),y[1]>=60&&(p=`General`),y[2]>=60&&(p=`General`);return p!==`General`&&(y.length===1&&y.push(0),y.length===2&&(c===null?y.push(0):y.unshift(0))),{numberFormat:p,parsed:vr(e,{hour:y[0]??0,minute:y[1]??0,second:y[2]??0,millis:1e3*(c??0)}),leadingText:g,trailingText:b}}var wr=(e,t,n=null,r=!1,i=!1)=>{let a=new Date(n??Date.now()).getFullYear(),{formats:o,compiled:s,monthByName:c,weekdaysAbbr:l,weekdaysWide:u,numericSep:d,wildcardSep:f}=function(e){let t=gr.get(e);if(t)return t;let{date:n}=Zn(e),r=new Map,i=[];for(let e=0;e<12;e++){let t=n.monthsWide[e],a=[n.monthsAbbr[e],t];for(let e=3;e<t.length;e++)a.push(t.slice(0,e));for(let t of a){let n=t.toLowerCase();r.has(n)||(r.set(n,e+1),i.push(t))}}i.sort((e,t)=>t.length-e.length);let a={mmm:i,mmmm:i,ddd:n.weekdaysAbbr,dddd:n.weekdaysWide},o=function(e){let t=e,n=[];for(let e=0;e<t.length;e++){let r=t[e][0],i=!r.startsWith(`~`);i||(r=r.slice(1));let a=/yyy(?!y)/.test(r),o=r.indexOf(`yyyy`)>-1,s=r.indexOf(`.`)>-1,c=r.indexOf(`-`)>-1;n.push({parseFormat:r,numberFormat:t[e][1],todaysYear:!a&&!o,windowYear:!o,excelOnly:i,containsDot:s,containsDash:c}),a&&n.push({parseFormat:r.replace(/yyy/g,`yyyy`),numberFormat:t[e][1],todaysYear:!1,windowYear:!1,excelOnly:i,containsDot:s,containsDash:c})}return n}([(s=function(e){let t=[];for(let n of e){let e=n===`d`||n===`D`?`d`:n===`M`||n===`L`?`M`:n===`y`||n===`Y`?`y`:null;e&&!t.includes(e)&&t.push(e)}let n=t.indexOf(`d`),r=t.indexOf(`M`);return{dayFirst:n!==-1&&r!==-1&&n<r,yearFirst:t[0]===`y`}}(n.short)).dayFirst?[`d-MM`,`d-mmm`]:[`MM-d`,`d-mmm`],[`MM-yyy`,`mmm-yy`],[`M-yyy`,`mmm-yy`],s.dayFirst?[`d-M-yyy`,`Short Date`]:[`M-d-yyy`,`Short Date`],[`yyyy-M-d`,`Short Date`],[`d.MMM`,`d-mmm`],[`d.MMMM`,`d-mmm`],[`d.MMM.yyy`,`d-mmm-yy`],[`d.MMMM.yyy`,`d-mmm-yy`],[`MMM.d`,`d-mmm`],[`MMMM.d`,`d-mmm`],[`MMM.yyy`,`mmm-yy`],[`MMMM.yyy`,`mmm-yy`],[`MMM dd, yyy`,`d-mmm-yy`],[`MMMM dd, yyy`,`d-mmm-yy`],[`~EEE, MMMM dd, yyy`,`[$-x-sysdate]ddd, mmmm dd, yyyy`],[`~EEEE, MMMM dd, yyy`,`[$-x-sysdate]dddd, mmmm dd, yyyy`]]);var s;let c=o.map(e=>function(e,t){let n=[],r=`^`;for(let i of e.match(mr)??[])switch(i){case`MMMM`:n.push(`monthName`),r+=`(${pr(t.mmmm)})`;break;case`MMM`:n.push(`monthName`),r+=`(${pr(t.mmm)})`;break;case`MM`:case`M`:n.push(`monthNum`),r+=`(\\d{1,2})`;break;case`dd`:case`d`:n.push(`day`),r+=`(\\d{1,2})`;break;case`yyyy`:n.push(`year`),r+=`(\\d{3,4})`;break;case`yyy`:n.push(`year`),r+=`(\\d{1,2})`;break;case`EEEE`:n.push(`weekday`),r+=`(${pr(t.dddd)})`;break;case`EEE`:n.push(`weekday`),r+=`(${pr(t.ddd)})`;break;default:r+=fr(i.replaceAll(`.`,``))}return{regex:RegExp(r+`$`,`i`),fields:n}}(e.parseFormat,a)),l=function(e){let t=e.match(/[^a-zA-Z]/);return t?t[0]:`/`}(n.short),u=l===`/`||l===`-`?``:fr(l),d=RegExp(`[/${u}]`,`g`),f=RegExp(`[-/ ${u}]`,`g`);return t={formats:o,compiled:c,monthByName:r,weekdaysAbbr:n.weekdaysAbbr,weekdaysWide:n.weekdaysWide,numericSep:d,wildcardSep:f},gr.set(e,t),t}(e.getLocale()),p=t.replaceAll(/^ +| +$/g,``).replaceAll(/ +/g,` `);p=p.replaceAll(/ *([-/]) */g,`$1`);let m=p.replaceAll(f,``),h=p.replaceAll(d,`-`),g=e.isDate1904();for(let e=0;e<o.length;e++){if(!o[e].excelOnly&&!i)continue;let t=p;o[e].containsDot?t=m:o[e].containsDash&&(t=h);let n=hr(t,s[e],c);if(!n)continue;let r=n.year??a;o[e].windowYear&&n.year!==void 0&&(r=r<=29?2e3+r:1900+r),o[e].todaysYear&&(r=a);let d=n.day??1,f=r===1900&&n.month===2&&d===29,_=new Date(0);if(_.setFullYear(r,n.month-1,d),_.setHours(0,0,0,0),!f&&(_.getMonth()!==n.month-1||_.getDate()!==d))continue;let v=f?er(1900,2,29)-(g?Qn:0):dr(_,g),y=+!g;if(o[e].windowYear||v>=y){if(o[e].parseFormat.indexOf(`EEE`)>-1){let e=_.getDay(),n=t.toLowerCase();if(!n.includes(l[e].toLowerCase())&&!n.includes(u[e].toLowerCase()))return null}return{asSerialDate:v,asJSDate:_,numberFormat:o[e].numberFormat}}}if(!r){let r=t.replace(Tr,`$1 $2`).replace(Er,`$1 $2`);if(r!==t)return wr(e,r,n,!0,i)}return null},Tr=/(\d)(\p{L})/gu,Er=/(\p{L})(\d)/gu;function Dr(e){if(!e&&e!==0)return!1;let t=(e=Bn(e)).replaceAll(/\[([^)]+)\]/g,``).toLowerCase();return t=t.replaceAll(/".*"/g,``),t=t.replaceAll(/\\./g,``),t=t.replace(/[_*]./g,``),!!t.includes(`datetime`)||!t.includes(`time`)&&!!(t.includes(`d`)||t.includes(`m`)&&!t.includes(`h`)&&!t.includes(`s`)||t.includes(`y`)||t===`short date`||t===`medium date`||t===`long date`)}function Or(e){if(!e&&e!==0)return!1;let t=(e=Bn(e)).replaceAll(/\[([^)]+)\]/g,``).toLowerCase();return t=t.replaceAll(/".*"/g,``),t=t.replaceAll(/\\./g,``),t=t.replace(/[_*]./g,``),!!t.includes(`datetime`)||!t.includes(`date`)&&!(!t.includes(`h`)&&!t.includes(`s`)&&t!==`short time`&&t!==`medium time`&&t!==`long time`)}function kr(e,t,n=!1){let r=t,i=Cr(e,t,!0,!0);if(i){let e=i.leadingText.trim(),t=i.trailingText.trim();if(e.length>0&&t.length>0)return null;r=e.length>0?e:t}let a=null;if(r.trim().length>0&&(a=wr(e,r),!a&&n)||(!a&&i&&(i.leadingText.trim().length>0||i.trailingText.trim().length>0)&&(i=null),!a&&!i))return null;let o=0;return a&&(o+=a.asSerialDate),i&&(o+=i.parsed.serial),o}var Ar,jr=null,Mr=()=>jr||=Intl.DateTimeFormat().resolvedOptions().locale??`en-US`,Nr=null,Pr=()=>{let t=e.d.getActive();if(!t)return null;let n,r=Nr;if(r!==null&&r.active===t)return r.locale;try{let e=new Intl.Locale(t).maximize();n=e.region?`${e.language}-${e.region}`:e.baseName}catch{n=null}return Nr={active:t,locale:n},n},Fr=class{constructor(e=`SheetXL Runtime`,t,n){this._description=e,this._options={isDate1904:()=>!1,...t},this._license=n}getDescription(){return this._description}getLocale(){return this._options.getLocale?.()??Mr()}getNow(){return this._options.getNow?.()??dr(new Date,this.isDate1904())}getLocaleProfile(){return Zn(this.getLocale(),this._options.getLocaleOverrides?.())}isDate1904(){return this._options.isDate1904()??!1}isR1C1(){return this._options.isR1C1?.()??!1}getLocation(){return Ce()}getVersion(){try{let e=`0.7.28-beta.1`;if(e.indexOf(`.env.`)===-1)return`${e}`}catch{return`local`}return`local`}getOS(){return we()}getUser(){return this._license?.getLicensee?.()??null}};function Ir(t,n){if(n===null)return null;let r=e.A.isObject(n);return t!=null&&r?e.A.mergeContentful(t,n):r?e.A.cloneObject(n):n}function Lr(e,t,n){return e==null||typeof e==`object`&&Object.keys(e).length===0}function Rr(e,t,n,r){if(e===t)return e??null}function zr(e){return e==null}function Br(t,n,r){if(!t)throw Error(`runs can not be null`);if(!n)return{preceding:[],modified:t?[...t]:[],trailing:[]};let i=function(t,n,r,i,a=!1){if(!n)return{preceding:[],modified:t?[...t]:[],trailing:[]};let o,s=e.A.findEqualOrGreater(t,n.min,e=>e.max),c=t.slice(0,s),l=t.slice(s),u=[],d={...n},f=l[0]||{min:n.min,max:n.max,value:void 0};for(o=a?(e,t,n)=>{let r=(i||Ir)(t,n,e);r===void 0?delete e.value:e.value=r,u.push(e)}:(e,t,n)=>{let r=(i||Ir)(t??null,n,e);r===void 0?delete e.value:e.value=r,u.push(e)};l.length>=0&&d.max-d.min>=0;){if(d.min<f.min)o({min:d.min,max:Math.min(d.max,f.min-1)},void 0,d.value),d={min:f.min,max:d.max,value:d.value},f={min:d.min,max:f.max,value:f.value};else if(d.min>f.min){let e=f.value!==void 0&&r?r(f,d.min):[f.value,f.value];u.push({min:f.min,max:Math.min(d.min,f.max)-1,value:e[0]}),d={min:Math.min(d.min,f.max),max:d.max,value:d.value},f={min:d.min,max:f.max,value:e[1]}}else{let e=f.value!==void 0&&r?r(f,d.min):[f.value,f.value];o({min:f.min,max:Math.min(d.max,f.max)},e[0],d.value),d={min:Math.min(d.max,f.max)+1,max:d.max,value:d.value},f={min:Math.min(d.max,f.max)+1,max:f.max,value:e[1]}}f.min<=f.max?l[0]=f:(l=l.slice(1),f=l[0]||{min:f.min,max:d.max})}return{preceding:c,modified:u,trailing:l}}(t,n,r?.onSplit,r?.onUpdate,r?.inPlace),a=[];i.preceding.length>0&&a.push(i.preceding.pop()),a=a.concat(i.modified),i.trailing.length>0&&a.push(i.trailing.shift());let o=function(e,t){if(!e||e.length===0)return{preceding:[],modified:e?[...e]:[],trailing:[]};let n=Math.min(e.length-1,t?.startOffset??0),r=Math.min(e.length,t?.endOffset??e.length),i=t?.cull??zr,a=e.slice(0,n),o=e.slice(r),s=[];for(let t=n;t<r;t++)!0!==i(e[t].value,e[t].min,e[t].max)&&s.push(e[t]);return{preceding:a,modified:s,trailing:o}}(Hr(a,{onMerge:r?.onMerge??Rr}).modified,{cull:r?.isCull||Lr});return{preceding:i.preceding,modified:o.modified,trailing:i.trailing}}function Vr(e){return[...e.preceding,...e.modified,...e.trailing]}function Hr(e,t){if(!e||e.length===0)return{preceding:[],modified:e?[...e]:[],trailing:[]};let n=Math.min(e.length-1,t?.startOffset??0),r=Math.min(e.length,t?.endOffset??e.length),i=t?.onMerge??Rr,a=e.slice(0,n),o=e.slice(r),s=[],c={...e[n]},l=e[n]?.max||0;for(let t=n+1;t<=r;t++){let n=e[t],r=!1;if(n&&n.min<=e[t-1].max+1)if(c.value===void 0&&n.value===void 0)r=!0;else{let e=i(c.value,n.value,c.max-c.min+1,n.max-n.min+1);e!==void 0&&(r=!0,c.value=e)}r?c.max=Math.max(l,n.max):(s.push(c),c={...e[t]},n&&(c.max=Math.max(l,n.max))),c&&(l=c.max)}return{preceding:a,modified:s,trailing:o}}function Ur(e){return e&&e.sort((e,t)=>{let n=e.min-t.min;return n===0&&(n=e.max-t.max),n})}function Wr(t,n=!1){if(!t||t.length===0)return e.A.EmptyArray;let r=n?t:t.sort(),i=[],a=null;for(let e=0;e<r.length;e++){let t=r[e];a?a.max===t-1?a.max=t:(i.push(a),a={min:t,max:t}):a={min:t,max:t}}return a&&i.push(a),i}function Gr(e,t){return e?t?e||t?e.min>t.max||e.max<t.min?null:{min:Math.max(e.min,t.min),max:Math.min(e.max,t.max)}:null:{...e}:{...t}}function Kr(e){let t=e.length===0;return{runs:e,run:{min:t?-(2**53-1):2**53-1,max:t?2**53-1:-(2**53-1),value:null},index:2**53-1}}function qr(t,n){let r=n.run,i=r.min,a=r.max;if(t>=i&&t<=a)return r.value;let o=n.index,s=n.runs;if(o<s.length-1&&t>a){o++;let e=s[o],i=e.min,a=e.max;if(t>=i&&t<=a)return n.index=o,r.min=i,r.max=a,r.value=e.value,r.value}if(o!==2**53-1&&o>0&&t<i){o--;let e=s[o],i=e.min,a=e.max;if(t>=i&&t<=a)return n.index=o,r.min=i,r.max=a,r.value=e.value,r.value}if(o=e.A.findEqualOrGreater(s,t,e=>e.max),o===s.length)return o=s.length,n.index=o,r.min=s[o-1].max+1,r.max=2**53-1,r.value=null,null;let c=s[o],l=c.min,u=c.max;if(t>=l&&t<=u){n.index=o,r.min=l,r.max=u;let e=c.value;return r.value=e,e}return o--,n.index=o,r.min=o>=0?s[o].max+1:-(2**53-1),r.max=l-1,r.value=null,null}function Jr(t,n,r,i){if(t.length===0){if(r!=null||i!=null){let e=n({min:r??i,max:i??r});if(e&&e.break)return e}return}let a=r??t[0].min,o=i??t[t.length-1].max,s=a-1,c=e.A.findEqualOrGreater(t,a,e=>e.max),l=t[c];for(;l&&l.min<=o;){if(s<l.min-1){let e=n({min:Math.max(s+1,a),max:Math.min(l.min-1,o)});if(e&&e.break)return e}let e=n({...l,min:Math.max(l.min,a),max:Math.min(l.max,o)});if(e&&e.break)return e;s=l.max,l=t[++c]}if(s<o){let e=n({min:Math.min(s+1,o),max:o});if(e&&e.break)return e}}function Yr(t,n,r){if(!t||t.length===0)return e.A.EmptyArray;let i=t.length,a=Array(i),o=r?n.rowStart:n.colStart,s=r?n.rowEnd:n.colEnd;for(let e=0;e<i;e++){let n=t[e],i={colStart:r?n.min:o,rowStart:r?o:n.min,colEnd:r?n.max:s,rowEnd:r?s:n.max};n.value!==void 0&&(i.value=n.value),a[e]=i}return a}function Xr(t,n=!1){if(!t||t.length===0)return e.A.EmptyArray;let r=[],i=null,a=t.slice().sort((e,t)=>e.min-t.min),o=a.length;for(let e=0;e<o;e++){let t=a[e];i&&t.min<=i.max+1?n?i.max=Math.max(i.max,t.max):(i={min:i.max+1,max:t.max},r.push(i)):(i={min:t.min,max:t.max},r.push(i))}return r}function Zr(e,t,n,r){let i;for(r&&(t=t.bind(r));!(i=e.next()).done;)try{t(i.value[1],i.value[0],n)}catch(t){if(typeof e.throw!=`function`)throw t;e.throw(t)}typeof e.return==`function`&&e.return()}function Qr(e){let t=e.next.bind(e),n={next:e=>{let n=t(e);return n.done?ei:{done:n.done,value:n.value[1]}},[Symbol.iterator]:()=>n,...e.return&&{return:e.return.bind(e)},...e.throw&&{throw:e.throw.bind(e)}};return n}function $r(t){if(!t||t.length===0)return null;let n=2**53-1,r=-1,i=null;return(a,o=!1)=>{if(a===n)return a;!1!==o&&(n=2**53-1),a!==n+(o?-1:1)&&(r=function(t,n,r=!0){if(!t||t.length===0)return null;let i,a=-1;return r?(a=e.A.findEqualOrGreater(t,n,e=>e.max),i=t[a]):(a=e.A.findEqualOrLesser(t,n,e=>e.min),i=t[a]),i?(r?n>i.max&&(a+=1,i=t[a]):n<i.min&&(--a,i=t[a]),i?a:-1):-1}(t,a,!o),i=t[r]);let s=a;if(o)for(;i&&s<=i.max;)s=i.min-1,i=t[--r];else for(;i&&s>=i.min;)s=i.max+1,i=t[++r];return n=s,s}}var ei=Object.freeze({done:!0,value:void 0}),ti=Object.freeze({next:()=>ei,[Symbol.iterator]:()=>ti});Object.seal({done:!1,value:void 0}),function(t){t.isList=function(e){return!!e&&!!e.isIList},t.isListLike=function(e){return!!e&&typeof e.length==`number`&&typeof e.at==`function`},t.fromArray=function(e,t,r,i){return new n(e,t,r,i)};class n{constructor(t,n,r,i){this.g=n,this.s=r;let a=t??i;if(r&&t&&!i){i=Array(t.length);for(let e=0;e<t.length;e++){let n=t[e];i[e]=r(n,e)}a=i}this.a=a??e.A.EmptyArray,n&&(this.at=e=>{e<0&&(e=a.length+e);let t=a[e];if(t!==void 0)return n(t,e)})}at(e){let t=this.a;return e<0&&(e=t.length+e),t[e]}fromArray(e){return new n(e,this.g,this.s)}get length(){return this.a.length}get isIList(){return!0}}t.ArrayList=n}(Ar||={});var ni,ri,ii=class t{constructor(e){if(this._single=null,this._runs=null,this._length=0,this._runCache=null,e&&e.length>0){let t=Ar.isList(e)&&!Array.isArray(e)?e:new Ar.ArrayList(e);this._single=t,this._length=e.length}}at(t){let n=this._single;if(n)return n.at(t);let r=this._runCache;if(r&&r.min<=t&&r.max>=t){let e=r.value;return e.list.at(t-r.min+e.start)}let i=this._runs,a=i[e.A.findEqualOrGreater(i,t,e=>e.max)];if(!a)return;let o=a.value;return this._runCache=a,o.list.at(t-a.min+o.start)}toArray(e=2**53-1){let t=[],n=this.entries(ci),r=n.next();for(;!r.done&&t.length<e;)t.push(r.value[1]),r=n.next();return t}entries(t){let n=this.length;if(n===0)return ti;let r,i,a,o=!0,s=0,c=n-1;if(t){o=!t.reverse;let e=t.bounds;e&&(s=Math.max(e.min??s,s),c=Math.min(e.max??c,c)),r=t.reuseResult??null,i=t.processSkip}let l=o?1:-1,u=(o?s:c)-l,d=this._single;if(d)a=e=>{if(!(e<s||e>c))return d.at(e)};else{let t=this._runs,n=o?0:t.length-1,r=t[n],i=(e,i)=>{let a=e===n?r:t[e];if(a&&i>=a.min&&i<=a.max)return n=e,r=a,a};a=r=>{if(r<s||r>c)return;let a=i(n,r);if(a||=i(n+l,r),!a){let n=e.A.findEqualOrGreater(t,r,e=>e.max);a=i(n,r)}if(!a)return;let o=a.value;return o.list.at(r-a.min+o.start)}}let f={next:e=>{let t,d=u+l;return e!==void 0&&(e<0&&(e=n+e),d=e),d<s||d>c||i&&(d=i(d,!o),d<s||d>c)?ei:(t=a(d),u=d,r?(r.done=!1,r.value[0]=d,r.value[1]=t,r):{done:!1,value:[u,t]})},[Symbol.iterator]:()=>f};return f}slice(e,n){let r=this._runs??ai(this._single);if(!r)return oi;let i=this.length;if(e=Math.min(Math.max(0,e),i),(n=Math.min(Math.max(0,n??i),i))-e<=0)return oi;if(e<=0&&n>=i)return this;let a=e,o=n-1,s=[],c=0;for(let e=0;e<r.length;e++){let t=r[e],n=t.max;if(a===0&&n<=o){s.push(t);continue}let i=t.min;if(i>o){e=r.length;continue}if(n<a){c=n+1;continue}let l=Math.max(0,a-i),u=Math.max(0,n-o),d=u+l,f=t.value;s.push({min:i-c,max:n-d-c,value:{start:f.start+l,end:f.end-u,list:f.list}}),c+=d}let l=new t;return l._runs=s,l._length=o-a+1,l}concat(e){if(!e)return this;if(!Ar.isListLike(e))throw Error(`Value must be IListLike`);let n=this._length;if(n===0)return e.isIReadableList?e:e.length===0?oi:new t(e);let r=e,i=e.length;if(i===0)return this;let a=this._runs??ai(this._single),o=a.slice(0,a.length-1),s=a[a.length-1],c=s?s.min:0,l=s?s.max:0,u=s?s.value:null,d=u?u.list:null,f=u?u.end-u.start:0,p=e=>{let t=e.start,n=e.end,r=n-t;if(r+f<li&&d&&d.fromArray){let r=e.list,i=[],a=u.start,o=u.end;for(let e=a;e<=o;e++)i.push(d.at(e));for(let e=t;e<=n;e++)i.push(r.at(e));let p=d.fromArray(i);if(p)return r=p,f=r.length-1,u={start:0,end:f,list:r},s={min:c,max:c+f,value:u},l=c+f,void(d=r)}o.push(s);let i=l+1,a=i+r;s={min:i,max:a,value:e},c=i,l=a,u=s?s.value:null,d=u?u.list:null,f=u?u.end-u.start:0};if(e instanceof t){let t=e._single;if(t)p({start:0,end:t.length-1,list:t});else{let t=e._runs;for(let e=0;e<t.length;e++)p(t[e].value)}}else p({start:0,end:i-1,list:r});o.push(s);let m=new t,h=n+i;return o.length===1&&o[0].min===0&&o[0].max===h-1?m._single=o[0].value.list:m._runs=o,m._length=h,m}get length(){return this._length}[Symbol.iterator](){return Qr(this.entries())}get isIReadableList(){return!0}get isIList(){return!0}get[Symbol.toStringTag](){return`[ImmutableList]`}toString(){let e=this.length;if(e===0)return``;let t=``;for(let n=0;n<e;n++){n>0&&(t+=`,`);let e=this.at(n);t+=e==null?``:String(e)}return t}},ai=e=>[{min:0,max:e.length-1,value:{start:0,end:e.length-1,list:e}}],oi=new ii,si=Object.seal({done:!1,value:[-1,null]}),ci=Object.freeze({reverse:!1,bounds:{min:0,max:2**53-1},skipRuns:null,reuseResult:si}),li=4,ui=class e{constructor(t,n,r){this._root=gi,this._size=0,this._maxNodeSize=r>=4?Math.min(r,256):32,this._compare=n||e.defaultComparator,t&&this.setPairs(t)}get size(){return this._size}get length(){return this._size}isEmpty(){return this._size===0}clear(){this._root=gi,this._size=0}forEach(e,t){return t!==void 0&&(e=e.bind(t)),this.forEachPair((t,n)=>e(n,t,this))}forEachPair(e,t){let n=this.minKey(),r=this.maxKey();return this.forRange(n,r,!0,e,t)}get(e,t){return this._root.get(e,t,this)}set(e,t,n){this._root.isShared&&(this._root=this._root.clone());let r=this._root.set(e,t,n,this);return!0===r||!1===r?r:(this._root=new pi([this._root,r]),!0)}has(e){return this.forRange(e,e,!0,void 0)!==0}delete(t){return this.editRange(t,t,!0,e.DeleteRange)!==0}filter(t,n){let r,i=this.greedyClone();return i.editAll((n,i,a)=>{if(!t(n,i,a))return r=e.DeleteValue}),!r&&n?this:i}mapValues(e){let t={},n=this.greedyClone();return n.editAll((n,r,i)=>(t.value=e(r,n,i),t)),n}reduce(e,t){let n,r=0,i=t,a=this.entries(this.minKey());for(;!(n=a.next()).done;)i=e(i,n.value,r++);return i}entries(e,t){let n=this.findPath(e);if(n===void 0)return di();let{nodeQueue:r,nodeIndex:i,leaf:a}=n,o=t===void 0?0:1,s=e===void 0?-1:a.indexOf(e,0,this._compare)-1;return di(()=>{e:for(;;)switch(o){case 0:if(++s<a.keys.length)return{done:!1,value:[a.keys[s],a.values[s]]};o=2;continue;case 1:if(++s<a.keys.length){let e=a.keys[s],n=a.values[s];return t?(t.done=!1,t.value[0]=e,t.value[1]=n,t):{done:!1,value:[e,n]}}o=2;case 2:for(var e=-1;;){if(++e>=r.length){o=3;continue e}if(++i[e]<r[e].length)break}for(;e>0;e--)r[e-1]=r[e][i[e]].children,i[e-1]=0;a=r[0][i[0]],s=-1,o=t===void 0?0:1;continue;case 3:return hi}})}entriesReversed(e,t,n){if(e===void 0&&(n=void 0,(e=this.maxKey())===void 0))return di();let{nodeQueue:r,nodeIndex:i,leaf:a}=this.findPath(e)||this.findPath(this.maxKey());vi(!r[0]||a===r[0][i[0]],`wat!`);let o=a.indexOf(e,0,this._compare);!n&&o<a.keys.length&&this._compare(a.keys[o],e)<=0&&o++;let s=t===void 0?0:1;return di(()=>{e:for(;;)switch(s){case 0:if(--o>=0)return{done:!1,value:[a.keys[o],a.values[o]]};s=2;continue;case 1:if(--o>=0){let e=a.keys[o],n=a.values[o];return t?(t.done=!1,t.value[0]=e,t.value[1]=n,t):{done:!1,value:[e,n]}}s=2;case 2:for(var e=-1;;){if(++e>=r.length){s=3;continue e}if(--i[e]>=0)break}for(;e>0;e--)r[e-1]=r[e][i[e]].children,i[e-1]=r[e-1].length-1;a=r[0][i[0]],o=a.keys.length,s=t===void 0?0:1;continue;case 3:return hi}})}findPath(e){let t,n,r=this._root;if(r.isLeaf)t=_i,n=_i;else{t=[],n=[];for(let i=0;!r.isLeaf;i++){if(t[i]=r.children,n[i]=e===void 0?0:r.indexOf(e,0,this._compare),n[i]>=t[i].length)return;r=t[i][n[i]]}t.reverse(),n.reverse()}return{nodeQueue:t,nodeIndex:n,leaf:r}}diffAgainst(t,n,r,i){if(t._compare!==this._compare)throw Error(`SortedMap: Comparators are not the same.`);if(this.isEmpty()||t.isEmpty())return this.isEmpty()&&t.isEmpty()?void 0:this.isEmpty()?r===void 0?void 0:e.stepToEnd(e.makeDiffCursor(t),r):n===void 0?void 0:e.stepToEnd(e.makeDiffCursor(this),n);let{_compare:a}=this,o=e.makeDiffCursor(this),s=e.makeDiffCursor(t),c=!0,l=!0,u=e.compare(o,s,a);for(;c&&l;){let t=e.compare(o,s,a),{leaf:d,internalSpine:f,levelIndices:p}=o,{leaf:m,internalSpine:h,levelIndices:g}=s;if(d||m){if(u!==0){if(t===0){if(d&&m&&i){let e=d.values[p[p.length-1]],t=m.values[g[g.length-1]];if(!Object.is(e,t)){let n=i(o.currentKey,e,t);if(n&&n.break)return n.break}}}else if(t>0){if(m&&r){let e=m.values[g[g.length-1]],t=r(s.currentKey,e);if(t&&t.break)return t.break}}else if(n&&d&&u!==0){let e=d.values[p[p.length-1]],t=n(o.currentKey,e);if(t&&t.break)return t.break}}}else if(!d&&!m&&t===0){let t=f.length-1,n=h.length-1,r=f[t][p[t]];if(h[n][g[n]]===r){u=0,c=e.step(o,!0),l=e.step(s,!0);continue}}u=t,t<0?c=e.step(o):l=e.step(s)}return c&&n?e.finishCursorWalk(o,s,a,n):l&&r?e.finishCursorWalk(s,o,a,r):void 0}static finishCursorWalk(t,n,r,i){let a=e.compare(t,n,r);if(a===0){if(!e.step(t))return}else a<0&&vi(!1,`cursor walk terminated early`);return e.stepToEnd(t,i)}static stepToEnd(t,n){let r=!0;for(;r;){let{leaf:i,levelIndices:a,currentKey:o}=t;if(i){let e=n(o,i.values[a[a.length-1]]);if(e&&e.break)return e.break}r=e.step(t)}}static makeDiffCursor(e){let t=e._root;return{height:e.getHeight(),internalSpine:[[t]],levelIndices:[0],leaf:void 0,currentKey:t.maxKey()}}static step(e,t){let{internalSpine:n,levelIndices:r,leaf:i}=e;if(!0===t||i){let a=r.length;if(!0===t||r[a-1]===0){let t=n.length;if(t===0)return!1;let i=t-1,o=i;for(;o>=0;){if(r[o]>0)return o<a-1&&(e.leaf=void 0,r.pop()),o<i&&(e.internalSpine=n.slice(0,o+1)),e.currentKey=n[o][--r[o]].maxKey(),!0;o--}return!1}{let t=--r[a-1];return e.currentKey=i.keys[t],!0}}{let t=n.length,i=t-1,a=n[i][r[i]];if(a.isLeaf){e.leaf=a;let n=r[t]=a.values.length-1;e.currentKey=a.keys[n]}else{let i=a.children;n[t]=i;let o=i.length-1;r[t]=o,e.currentKey=i[o].maxKey()}return!0}}static compare(e,t,n){let{height:r,currentKey:i,levelIndices:a}=e,{height:o,currentKey:s,levelIndices:c}=t,l=n(s,i);if(l!==0)return l;let u=r<o?r:o;return a.length-(r-u)-(c.length-(o-u))}keys(e,t){let n=this.entries(e,t);return di(()=>{let e=n.next();return e.value&&=e.value[0],e})}values(e,t){let n=this.entries(e,t);return di(()=>{let e=n.next();return e.value&&=e.value[1],e})}getMaxNodeSize(){return this._maxNodeSize}minKey(){return this._root.minKey()}maxKey(){return this._root.maxKey()}clone(){this._root.isShared=!0;let t=new e(void 0,this._compare,this._maxNodeSize);return t._root=this._root,t._size=this._size,t}greedyClone(t){let n=new e(void 0,this._compare,this._maxNodeSize);return n._root=this._root.greedyClone(t),n._size=this._size,n}toArray(e=2147483647){let t=this.minKey(),n=this.maxKey();return t===void 0?[]:this.getRange(t,n,!0,e)}keysArray(){let e=[];return this._root.forRange(this.minKey(),this.maxKey(),!0,!1,this,0,(t,n)=>{e.push(t)}),e}valuesArray(){let e=[];return this._root.forRange(this.minKey(),this.maxKey(),!0,!1,this,0,(t,n)=>{e.push(n)}),e}toString(){return this.toArray().toString()}setIfNotPresent(e,t){return this.set(e,t,!1)}nextHigherPair(e,t){return e===void 0?this._root.minPair(t):this._root.getPairOrNextHigher(e,this._compare,!1,t)}nextHigherKey(e,t){let n=this.nextHigherPair(e,t);return n&&n[0]}nextLowerPair(e,t){return e===void 0?this._root.maxPair(t):this._root.getPairOrNextLower(e,this._compare,!1,t)}nextLowerKey(e,t){let n=this.nextLowerPair(e,t);return n&&n[0]}getPairOrNextLower(e,t){return this._root.getPairOrNextLower(e,this._compare,!0,t)}getPairOrNextHigher(e,t){return this._root.getPairOrNextHigher(e,this._compare,!0,t)}changeIfPresent(e,t){return this.editRange(e,e,!0,(e,n)=>({value:t}))!==0}getRange(t,n,r,i=67108863){let a=[];return this._root.forRange(t,n,r,!1,this,0,(t,n)=>(a.push([t,n]),a.length>i?e.Break:void 0)),a}setPairs(e,t){let n=0;for(let r=0;r<e.length;r++)this.set(e[r][0],e[r][1],t)&&n++;return n}forRange(e,t,n,r,i){let a=this._root.forRange(e,t,n,!1,this,i||0,r);return typeof a==`number`?a:a.break}editRange(e,t,n,r,i){let a=this._root;a.isShared&&(this._root=a=a.clone());try{let o=a.forRange(e,t,n,!0,this,i||0,r);return typeof o==`number`?o:o.break}finally{let e;for(;a.keys.length<=1&&!a.isLeaf;)e||=a.isShared,this._root=a=a.keys.length===0?gi:a.children[0];e&&(a.isShared=!0)}}editAll(e,t){return this.editRange(this.minKey(),this.maxKey(),!0,e,t)}deleteRange(t,n,r){return this.editRange(t,n,r,e.DeleteRange)}deleteKeys(e){let t=0;for(let n=0;n<e.length;n++)this.delete(e[n])&&t++;return t}getHeight(){let e=this._root,t=-1;for(;e;)t++,e=e.isLeaf?void 0:e.children[0];return t}freeze(){let e=this;e.clear=e.set=e.editRange=function(){throw Error(`SortedMap: Attempted to modify when frozen.`)}}unfreeze(){delete this.clear,delete this.set,delete this.editRange}isFrozen(){return this.hasOwnProperty(`editRange`)}checkValid(){let e=this._root.checkValid(0,this,0);vi(e===this.size,`size mismatch: counted `,e,`but stored`,this.size)}};function di(e=()=>hi){let t={next:e};return Symbol&&Symbol.iterator&&(t[Symbol.iterator]=function(){return this}),t}Symbol&&Symbol.iterator&&(ui.prototype[Symbol.iterator]=ui.prototype.entries),ui.prototype.where=ui.prototype.filter,ui.prototype.setRange=ui.prototype.setPairs,ui.prototype.add=ui.prototype.set;var fi=class e{constructor(e,t=[],n){this.keys=t,this.values=n||mi,this.isShared=void 0,this.isLeaf=e}maxKey(){return this.keys[this.keys.length-1]}indexOf(e,t,n){let r=this.keys,i=0,a=r.length,o=a>>1;for(;i<a;){let t=n(r[o],e);if(t<0)i=o+1;else{if(!(t>0)){if(t===0)return o;if(e==e)return r.length;throw Error(`SortedMap: NaN was used as a key.`)}a=o}o=i+a>>1}return o^t}minKey(){return this.keys[0]}minPair(e){if(this.keys.length!==0)return(e??=[null,null])[0]=this.keys[0],e[1]=this.values[0],e}maxPair(e){if(this.keys.length===0)return;let t=this.keys.length-1;return(e??=[null,null])[0]=this.keys[t],e[1]=this.values[t],e}clone(){let t=this.values,n=t===mi?t:t.slice(0),r=this.keys.slice(0);return new e(!0,r,n)}greedyClone(e){return this.isShared&&!e?this:this.clone()}get(e,t,n){let r=this.indexOf(e,-1,n._compare);return r<0?t:this.values[r]}getPairOrNextLower(e,t,n,r){let i=this.indexOf(e,-1,t),a=i<0?~i-1:n?i:i-1;if(a>=0){let e=this.keys[a],t=this.values[a];return r?(r[0]=e,r[1]=t,r):[e,t]}}getPairOrNextHigher(e,t,n,r){let i=this.indexOf(e,-1,t),a=i<0?~i:n?i:i+1,o=this.keys;if(a<o.length){let e=o[a],t=this.values[a];return r?(r[0]=e,r[1]=t,r):[e,t]}}checkValid(e,t,n){let r=this.keys.length,i=this.values.length;return vi(this.values===mi?r<=i:r===i,`keys/values length mismatch: depth`,e,`with lengths`,r,i,`and baseIndex`,n),vi(e===0||r>0,`empty leaf at depth`,e,`and baseIndex`,n),r}set(e,t,n,r){let i=this.indexOf(e,-1,r._compare);if(i<0){if(i=~i,r._size++,this.keys.length<r._maxNodeSize)return this.insertInLeaf(i,e,t,n,r);{let a=this.splitOffRightSide(),o=this;return i>this.keys.length&&(i-=this.keys.length,o=a),o.insertInLeaf(i,e,t,n,r),a}}if(!1!==n){t!==void 0&&this.reifyValues(),this.keys[i]=e;let r=t;if(typeof n==`function`){let a=n(this.values[i],e,t);a!==void 0&&(r=a)}this.values[i]=r}return!1}reifyValues(){return this.values===mi?this.values=this.values.slice(0,this.keys.length):this.values}insertInLeaf(e,t,n,r,i){if(this.keys.splice(e,0,t),this.values===mi){for(;mi.length<i._maxNodeSize;)mi.push(void 0);if(n===void 0)return!0;this.values=mi.slice(0,this.keys.length-1)}let a=n;if(typeof r==`function`){let e=r(void 0,t,n);e!==void 0&&(a=e)}return this.values.splice(e,0,a),!0}takeFromRight(e){let t=this.values;e.values===mi?t!==mi&&t.push(void 0):(t=this.reifyValues(),t.push(e.values.shift())),this.keys.push(e.keys.shift())}takeFromLeft(e){let t=this.values;e.values===mi?t!==mi&&t.unshift(void 0):(t=this.reifyValues(),t.unshift(e.values.pop())),this.keys.unshift(e.keys.pop())}splitOffRightSide(){let t=this.keys.length>>1,n=this.keys.splice(t),r=this.values===mi?mi:this.values.splice(t);return new e(!0,n,r)}forRange(e,t,n,r,i,a,o){let s,c,l=i._compare;if(t===e){if(!n||(c=(s=this.indexOf(e,-1,l))+1,s<0))return a}else s=this.indexOf(e,0,l),c=this.indexOf(t,-1,l),c<0?c=~c:!0===n&&c++;let u=this.keys,d=this.values;if(o!==void 0)for(let e=s;e<c;e++){let t=u[e],n=o(t,d[e],a++);if(n!==void 0){if(n.break!==void 0)return n;if(!0===r){if(t!==u[e]&&i._compare(t,u[e])!==0||!0===this.isShared)throw Error(`SortedMap: illegally changed or cloned in editRange.`);n.delete?(this.keys.splice(e,1),this.values!==mi&&this.values.splice(e,1),i._size--,e--,c--):n.hasOwnProperty(`value`)&&(d[e]=n.value)}}}else a+=c-s;return a}mergeSibling(e,t){if(this.keys.push.apply(this.keys,e.keys),this.values===mi){if(e.values===mi)return;this.values=this.values.slice(0,this.keys.length)}this.values.push.apply(this.values,e.reifyValues())}},pi=class e extends fi{constructor(e,t){if(!t){t=[];let n=e.length;for(let r=0;r<n;r++)t[r]=e[r].maxKey()}super(!1,t),this.children=e}clone(){let t=this.children.slice(0),n=t.length;for(let e=0;e<n;e++)t[e].isShared=!0;return new e(t,this.keys.slice(0))}greedyClone(t){if(this.isShared&&!t)return this;let n=new e(this.children.slice(0),this.keys.slice(0)),r=n.children,i=r.length;for(let e=0;e<i;e++)r[e]=r[e].greedyClone(t);return n}minKey(){return this.children[0].minKey()}minPair(e){return this.children[0].minPair(e)}maxPair(e){return this.children[this.children.length-1].maxPair(e)}get(e,t,n){let r=this.indexOf(e,0,n._compare),i=this.children;return r<i.length?i[r].get(e,t,n):void 0}getPairOrNextLower(e,t,n,r){let i=this.indexOf(e,0,t),a=this.children;if(i>=a.length)return this.maxPair(r);let o=a[i].getPairOrNextLower(e,t,n,r);return o===void 0&&i>0?a[i-1].maxPair(r):o}getPairOrNextHigher(e,t,n,r){let i=this.indexOf(e,0,t),a=this.children,o=a.length;if(i>=o)return;let s=a[i].getPairOrNextHigher(e,t,n,r);return s===void 0&&i<o-1?a[i+1].minPair(r):s}checkValid(e,t,n){let r=this.keys.length,i=this.children.length;vi(r===i,`keys/children length mismatch: depth`,e,`lengths`,r,i,`baseIndex`,n),vi(r>1||e>0,`internal node has length`,r,`at depth`,e,`baseIndex`,n);let a=0,o=this.children,s=this.keys,c=0;for(let r=0;r<i;r++)a+=o[r].checkValid(e+1,t,n+a),c+=o[r].keys.length,vi(a>=c,`wtf`,n),vi(r===0||o[r-1].constructor===o[r].constructor,`type mismatch, baseIndex:`,n),o[r].maxKey()!==s[r]&&vi(!1,`keys[`,r,`] =`,s[r],`is wrong, should be `,o[r].maxKey(),`at depth`,e,`baseIndex`,n),r===0||t._compare(s[r-1],s[r])<0||vi(!1,`sort violation at depth`,e,`index`,r,`keys`,s[r-1],s[r]);let l=c===0;return(l||c>t.getMaxNodeSize()*i)&&vi(!1,l?`too few`:`too many`,`children (`,c,a,`) at depth`,e,`maxNodeSize:`,t.getMaxNodeSize(),`children.length:`,i,`baseIndex:`,n),a}set(e,t,n,r){let i=this.children,a=r._maxNodeSize,o=r._compare,s=Math.min(this.indexOf(e,0,o),i.length-1),c=i[s];if(c.isShared&&(i[s]=c=c.clone()),c.keys.length>=a){let t;s>0&&(t=i[s-1]).keys.length<a&&o(c.keys[0],e)<0?(t.isShared&&(i[s-1]=t=t.clone()),t.takeFromRight(c),this.keys[s-1]=t.maxKey()):(t=i[s+1])!==void 0&&t.keys.length<a&&o(c.maxKey(),e)<0&&(t.isShared&&(i[s+1]=t=t.clone()),t.takeFromLeft(c),this.keys[s]=i[s].maxKey())}let l=c.set(e,t,n,r);if(!1===l)return!1;if(this.keys[s]=c.maxKey(),!0===l)return!0;if(this.keys.length<a)return this.insert(s+1,l),!0;{let e=this.splitOffRightSide(),t=this;return o(l.maxKey(),this.maxKey())>0&&(t=e,s-=this.keys.length),t.insert(s+1,l),e}}insert(e,t){this.children.splice(e,0,t),this.keys.splice(e,0,t.maxKey())}splitOffRightSide(){let t=this.children.length>>1;return new e(this.children.splice(t),this.keys.splice(t))}takeFromRight(e){this.keys.push(e.keys.shift()),this.children.push(e.children.shift())}takeFromLeft(e){this.keys.unshift(e.keys.pop()),this.children.unshift(e.children.pop())}forRange(e,t,n,r,i,a,o){let s=i._compare,c=this.keys,l=this.children,u=this.indexOf(e,0,s),d=u,f=Math.min(t===e?u:this.indexOf(t,0,s),c.length-1);if(r){if(d<=f)try{for(;d<=f;d++){l[d].isShared&&(l[d]=l[d].clone());let s=l[d].forRange(e,t,n,r,i,a,o);if(c[d]=l[d].maxKey(),typeof s!=`number`)return s;a=s}}finally{let e=i._maxNodeSize>>1;for(u>0&&u--,d=f;d>=u;d--)l[d].keys.length<=e&&(l[d].keys.length===0?(c.splice(d,1),l.splice(d,1)):this.tryMerge(d,i._maxNodeSize));l.length!==0&&l[0].keys.length===0&&vi(!1,`emptiness bug`)}}else for(;d<=f;d++){let s=l[d].forRange(e,t,n,r,i,a,o);if(typeof s!=`number`)return s;a=s}return a}tryMerge(e,t){let n=this.children,r=n.length;return e>=0&&e+1<r&&n[e].keys.length+n[e+1].keys.length<=t&&(n[e].isShared&&(n[e]=n[e].clone()),n[e].mergeSibling(n[e+1],t),n.splice(e+1,1),this.keys.splice(e+1,1),this.keys[e]=n[e].maxKey(),!0)}mergeSibling(e,t){let n=this.keys.length;this.keys.push.apply(this.keys,e.keys);let r=e.children;if(this.children.push.apply(this.children,r),e.isShared&&!this.isShared)for(let e=0;e<r.length;e++)r[e].isShared=!0;this.tryMerge(n-1,t)}},mi=[],hi=Object.freeze({done:!0,value:void 0}),gi=function(){let e=new fi(!0);return e.isShared=!0,e}(),_i=[],vi=(e,...t)=>{if(!e)throw t.unshift(`SortedMap:`),Error(t.join(` `))};(function(e){let t=e.DeleteValue=Object.freeze({delete:!0});e.Break=Object.freeze({break:!0}),e.DeleteRange=()=>t,e.EmptySortedMap=(()=>{let e=new ui;return e.freeze(),e})(),e.defaultComparator=function(e,t){if(Number.isFinite(e)&&Number.isFinite(t))return e-t;let n=typeof e,r=typeof t;if(n!==r)return n<r?-1:1;if(n===`object`){if(e===null)return t===null?0:-1;if(t===null)return 1;if(n=typeof(e=e.valueOf()),r=typeof(t=t.valueOf()),n!==r)return n<r?-1:1}return e<t?-1:e>t?1:e===t?0:Number.isNaN(e)?Number.isNaN(t)?0:-1:Number.isNaN(t)?1:Array.isArray(e)?0:NaN},e.simpleComparator=function(e,t){return e>t?1:e<t?-1:0}})(ui||={}),function(t){let n=(t,n)=>{let r=t!==e.N.Row;return n?(e,t)=>{if(e===t)return 0;let n=e[0],i=e[1],a=t[1];if(i===a)return n?-1:1;let o=t[0],s=0,c=0;if(r?(s=n?i.colEnd:i.colStart,c=o?a.colEnd:a.colStart):(s=n?i.rowEnd:i.rowStart,c=o?a.rowEnd:a.rowStart),s===c&&n!==o)return n?-1:1;if(s!==c)return c-s;let l=0,u=0;if(r?(l=n?i.colStart:i.colEnd,u=o?a.colStart:a.colEnd):(l=n?i.rowStart:i.rowEnd,u=o?a.rowStart:a.rowEnd),l===u&&n!==o)return n?-1:1;if(l!==u)return u-l;let d=e[2]??0;return(t[2]??0)-d}:(e,t)=>{if(e===t)return 0;let n=e[0],i=e[1],a=t[1];if(i===a)return n?-1:1;let o=t[0],s=0,c=0;if(r?(s=n?i.colStart:i.colEnd,c=o?a.colStart:a.colEnd):(s=n?i.rowStart:i.rowEnd,c=o?a.rowStart:a.rowEnd),s===c&&n!==o)return n?-1:1;if(s!==c)return s-c;let l=0,u=0;return r?(l=n?i.colEnd:i.colStart,u=o?a.colEnd:a.colStart):(l=n?i.rowEnd:i.rowStart,u=o?a.rowEnd:a.rowStart),l===u&&n!==o?n?-1:1:l===u?(e[2]??0)-(t[2]??0):l-u}};class r{constructor(t,r){if(this._isColumn=!0,this._isByCell=!1,this._isReverse=!1,this._cursor=null,this._reuse=null,this._localReuse={done:!1,value:[null,null]},this._eventsMajor=null,this._eventMajorIndex=0,this._majorStart=0,this._majorEnd=0,this._eventMinorPeek=null,this._minorStart=0,this._minorEnd=0,!t||t.length===0)return;let i=e.N.Column,a=!1,o=!0,s=!1;r&&(i=r.axis??e.N.Column,this._isColumn=o=i!==e.N.Row,this._isReverse=a=r.reverse??!1,this._isByCell=s=r.byCell??!1);let c=t.length,l=Array(2*c);for(let e=0;e<c;e++){let n=t[e],r=[null,null];l[2*e]=[!0,n,e,r],l[2*e+1]=[!1,n,e,r]}l.sort(n(i,a)),this._eventsMajor=l;let u=l[0][1];this._majorStart=a?2**53-1:-(2**53-1),this._majorEnd=o?a?u.colEnd+1:u.colStart-1:a?u.rowEnd+1:u.rowStart-1,this._eventsMinor=new ui(void 0,n(o?e.N.Row:e.N.Column,a));let d=Array(16);if(d.length=0,this._cursor={cell:null,range:{colStart:u.colStart,rowStart:u.rowStart,colEnd:u.colEnd,rowEnd:u.rowEnd},overlaps:d},s&&(this._cursor.cell={colIndex:a?-(2**53-1):2**53-1,rowIndex:a?-(2**53-1):2**53-1}),r?.reuseIterator)throw Error(`Not implemented yet`)}next(t){let n=this._isColumn,r=this._isReverse;if(t){if(!this._isByCell)throw Error(`nextCell is only supported when byCell is true`);let i,a=e.l.createCellComparator(n?e.N.Column:e.N.Row,r);do{let e=this._cursor,o=e.cell,s=o.colIndex===2**53-1||o.rowIndex===2**53-1;if(!s&&a(o,t)>=0)throw Error(`nextCell must be after the current iteration cell`);if(i=this.next(),i.done)return i;let c=i.value.cell;if(a(c,t)>=0)return i;let l=e.range;if(n){let e=t.colIndex===o.colIndex;o.rowIndex=r?e?Math.max(t.rowIndex,l.rowStart):l.rowStart:e?Math.min(t.rowIndex,l.rowEnd):l.rowEnd}else{let e=t.rowIndex===o.rowIndex;o.colIndex=r?e?Math.max(t.colIndex,l.colStart):l.colStart:e?Math.min(t.colIndex,l.colEnd):l.colEnd}if(!s&&a(o,t)>=0)return c.rowIndex=o.rowIndex,c.colIndex=o.colIndex,i}while(!i.done);return i}let i=this._cursor;if(!i)return ei;let a=this._reuse,o=i.cell,s=i.range;if(a){a.done=!1;let e=a.value,t=e.cell;o?(t.colIndex=o.colIndex,t.rowIndex=o.rowIndex):t&&(t.colIndex=-1,t.rowIndex=-1);let n=e.range;n.colStart=s.colStart,n.rowStart=s.rowStart,n.colEnd=s.colEnd,n.rowEnd=s.rowEnd,e.overlaps=[...i.overlaps],this._cursor.overlaps=e.overlaps}else{let e={cell:null,range:{colStart:s.colStart,rowStart:s.rowStart,colEnd:s.colEnd,rowEnd:s.rowEnd},overlaps:[...i.overlaps]};o&&(e.cell={colIndex:o.colIndex,rowIndex:o.rowIndex}),this._cursor=e,a={done:!1,value:e}}let c=a.value,l=c.range,u=c.cell,d=this._isByCell,f=r?-1:1,p=!1;if(d){let e=u.rowIndex,t=u.colIndex,i=n?e:t,o=n?r?l.rowStart:l.rowEnd:r?l.colStart:l.colEnd;if((r?i>=o:i<=o)&&(n?u.rowIndex=e+f:u.colIndex=t+f,r?i>o:i<o))return a;let s=n?u.colIndex:u.rowIndex,c=n?r?l.colStart:l.colEnd:r?l.rowStart:l.rowEnd;(r?s>c:s<c)&&(p=!0)}let m=c.overlaps,h=this._majorStart,g=this._majorEnd,_=this._eventsMinor,v=this._minorStart,y=this._minorEnd,b=this._eventsMinorIterator,x=this._eventMinorPeek,S=x;for(;S&&!S.done;){let e=S.value[0];if(e[0])S=null;else{if(x=b.next(),x.done)m.length=0;else{let t=e[1],i=m.length;if(i>1){let e=m.indexOf(t);e!==-1&&(m[e]=m[i-1])}if(m.length=i-1,i=m.length,i>0){let e=x.value[0],t=e[1],i=n?r?t.colStart:t.colEnd:r?t.rowStart:t.rowEnd;if(r?h>=i:h<=i){let i=!1;if(e[0]){let e=n?r?t.rowEnd:t.rowStart:r?t.colEnd:t.colStart;(r?e<y+f:e>y+f)&&(v=y+f,y=e-f,i=!0)}else{let e=n?r?t.rowStart:t.rowEnd:r?t.colStart:t.colEnd;(r?e<y:e>y)&&(v=y+f,y=e,i=!0)}if(i)return n?(l.rowStart=r?y:v,l.rowEnd=r?v:y):(l.colStart=r?y:v,l.colEnd=r?v:y),this._minorStart=v,this._minorEnd=y,this._eventMinorPeek=x,a}}}x.done&&(x=null),S=x}}if(!x)if(p){b=_.entries(void 0,this._localReuse),x=b.next(),this._eventsMinorIterator=b;let e=x.value[0][1],t=n?r?e.rowEnd:e.rowStart:r?e.colEnd:e.colStart;n?(u.colIndex+=f,u.rowIndex=t):(u.colIndex=t,u.rowIndex+=f)}else{let e=this._eventMajorIndex,t=this._eventsMajor,i=t.length;if(e>=i)return this._cursor=null,ei;let a=t[e],o=a[0],s=!1;for(;!o&&!s&&a;){let i=a[1],c=n?r?i.colStart:i.colEnd:r?i.rowStart:i.rowEnd;if(r?c<g:c>g){s=!0;continue}let l=a[3];_.delete(l[0]),_.delete(l[1]),e++,a=t[e],a&&(o=a[0])}let c=_.size>0?g+f:-1;for(s=!1;o&&!s&&a;){let i=a[1];if(c!==-1&&(n?r?i.colEnd:i.colStart:r?i.rowEnd:i.rowStart)!==c){s=!0;continue}let l=a[2],u=[!0,i,l],d=[!1,i,l],f=a[3];if(f[0]=u,f[1]=d,_.set(u,0),_.set(d,0),c===-1&&(c=n?r?i.colEnd:i.colStart:r?i.rowEnd:i.rowStart),e++,a=t[e],!a||(o=a[0],!o))continue;let p=a[1];(n?r?p.colEnd:p.colStart:r?p.rowEnd:p.rowStart)!==c&&(s=!0)}if(c!==-1&&(h=c),d&&(n?u.colIndex=h:u.rowIndex=h),this._eventMajorIndex=e,e>=i)return this._eventsMinorIterator=b,this._cursor=null,ei;if(a){let e=a[0],t=a[1],i=n?r?t.colEnd:t.colStart:r?t.rowEnd:t.rowStart,o=n?r?t.colStart:t.colEnd:r?t.rowStart:t.rowEnd;g=e?i-f:o}m.length=0,b=_.entries(void 0,this._localReuse),x=b.next(),this._eventsMinorIterator=b}let C=x;do{let e=C.value;C=null;let t=e[0],i=t[1];if(!t[0])continue;let a=n?r?i.rowEnd:i.rowStart:r?i.colEnd:i.colStart;v!==a&&(v=a),x=b.next();let o=x.value[0],s=o[0],c=o[1],l=n?r?c.rowEnd:c.rowStart:r?c.colEnd:c.colStart;if(s&&l===v)C=x;else{let e=n?r?i.rowStart:i.rowEnd:r?i.colStart:i.colEnd,t=n?r?c.rowStart:c.rowEnd:r?c.colStart:c.colEnd;y=(r?Math.max:Math.min)(e,s?l-f:t),d&&(n?u.rowIndex=v:u.colIndex=v)}m[m.length]=Object.freeze(i)}while(C);return n?(l.colStart=r?g:h,l.colEnd=r?h:g,l.rowStart=r?y:v,l.rowEnd=r?v:y):(l.rowStart=r?g:h,l.rowEnd=r?h:g,l.colStart=r?y:v,l.colEnd=r?v:y),this._eventMinorPeek=x,this._minorStart=v,this._minorEnd=y,this._majorStart=h,this._majorEnd=g,a}return(e){return null}throw(e){return null}[Symbol.iterator](){return this}}t.IteratorInstance=r}(ni||={}),function(t){t.Builder=class{constructor(e,t=0,n=0){this._tuples=[],this._minors=null,this._values=null,this._minorMin=2**53-1,this._minorMax=0,this._majorIndex=-(2**53-1),this._minorIndex=-(2**53-1),this._offsetMajor=0,this._offsetMinor=0,this._createList=e,this._offsetMajor=t,this._offsetMinor=n}pushMultipleAt(e,t,n){if(n&&n.isIList)return this.pushAt(e,t,n);Array.isArray(n)||(n=[n]),this.pushAt(e,t,n[0]);let r=n.length,i=this._values;for(let e=1;e<r;e++)i.push(n[e]);return this._minorIndex=this._minorIndex+i.length-1,this}pushAt(e,t,r){let i=this._majorIndex,a=this._minorIndex;if(e+=this._offsetMajor,t+=this._offsetMinor,e<i||e===i&&t<=a)throw new n(`major: ${e}, minor: ${t}, prevMajor: ${this._majorIndex}, prevMinor: ${this._minorIndex}`);let o=this._minors;if(e!==i){if(o){this._minorMin=Math.min(this._minorMin,o[0][0]);let e=o[o.length-1];this._minorMax=Math.max(this._minorMax,e[0]+e[1].length-1)}this._minors=o=[],this._tuples.push([e,o]),this._majorIndex=e}if(r&&r.isIList){t===a+1&&i!==e&&this._values;let n=r;o.push([t,n]),t=t+n.length-1,this._values=null}else{let n,s=this._values;s&&t===a+1&&i===e?n=s:(this._values=n=[],o.push([t,n])),n.push(r)}return this._minorIndex=t,this}build(){let e=this._tuples;if(e.length===0)return null;let t=this._minors;this._minorMin=Math.min(this._minorMin,t[0][0]);let n=t[t.length-1];this._minorMax=Math.max(this._minorMax,n[0]+n[1].length-1);let r=this._createList;if(r){let e=t.length;for(let n=0;n<e;n++)t[n][1]=r(t[n][1])}return{tuples:e,bounds:{majorStart:e[0][0],minorStart:this._minorMin,majorEnd:e[e.length-1][0],minorEnd:this._minorMax}}}},t.TransposedBuilder=class{constructor(e,t=0,n=0){this._current=null,this._first=null,this._majorMin=2**53-1,this._majorMax=0,this._majorIndex=-(2**53-1),this._minorIndex=-(2**53-1),this._offsetMajor=0,this._offsetMinor=0,this._createList=e,this._offsetMajor=t,this._offsetMinor=n,this._minors=new ui}pushMultipleAt(e,t,n){Array.isArray(n)||(n=[n]);let r=n.length;for(let i=0;i<r;i++){let r=t+i;this.pushAt(e,r,n[i])}return this}pushAt(e,t,r){let i,a,o=this._majorIndex,s=this._minorIndex;if(e+=this._offsetMajor,t+=this._offsetMinor,a=this._current,e!==o){if(this._majorIndex=e,e<o)throw new n(`major: ${e}, minor: ${t}, prevMajor: ${this._majorIndex}, prevMinor: ${this._minorIndex}`);s=-(2**53-1)}else if(a=this._current,t<=s)throw new n(`major: ${e}, minor: ${t}, prevMajor: ${this._majorIndex}, prevMinor: ${this._minorIndex}`);if(a&&a.minor===t&&(i=a.span),i)a.minor>=t&&a.next&&(this._current=a.next);else{let n=this._minors,r=a?a.next??a.prev:null;if(r){let e,o=r.minor;r&&r.minor===t?(a=r,i=a.span):e=o>t?n.getPairOrNextHigher(t,yi):n.getPairOrNextLower(t,yi),e&&(a=e[1],e[0]===t&&(i=a.span))}if(!i){this._majorMin=Math.min(this._majorMin,e),i=[t,[[e,[]]]];let r={minor:t,span:i,prev:null,next:null};a&&(a.minor<t?(r.prev=a,r.next=a.next,a.next&&(a.next.prev=r),a.next=r):(r.prev=a.prev,r.next=a,a.prev&&(a.prev.next=r),a.prev=r)),n.set(t,r),this._current=r;let o=this._first;(!o||t<o.minor)&&(this._first=r),r.next&&(this._current=r.next)}}let c=i[1],l=c[c.length-1],u=l[0],d=l[1];return u+d.length!==e&&(d=[],u=e,c.push([u,d])),d.push(r),this._majorMax=Math.max(this._majorMax,e),this._minorIndex=t,this}build(){let e=[],t=this._createList,n=this._minors.entries(void 0,bi),r=n.next();for(;!r.done;){let i=r.value[1].span;if(t){let e=i[1],n=e.length;for(let r=0;r<n;r++)e[r][1]=t(e[r][1])}e.push(i),r=n.next()}return e.length===0?null:{tuples:e,bounds:{majorStart:e[0][0],minorStart:this._majorMin,majorEnd:e[e.length-1][0],minorEnd:this._majorMax}}}};class n extends e.p{constructor(e=`Out of order`,t=null){super(e,t),this.name=`OutOfOrderError`}}t.OutOfOrderError=n}(ri||={});var yi=[-1,null],bi={done:!1,value:[-1,null]};function xi(t,n=e.i.Right,r=null){if(!t)return t;if(t.length===0)return[];let i=n===e.i.Right,a=n===e.i.Left,o=n===e.i.Up,s=n===e.i.Down;return t.sort((e,t)=>{if(!e&&!t)return 0;if(e&&!t)return-1;if(t&&!e)return 1;let n=r?.(e,t)??0;return n===0?i?e.rowStart===t.rowStart?e.colStart-t.colStart:e.rowStart-t.rowStart:s?e.colStart===t.colStart?e.rowStart-t.rowStart:e.colStart-t.colStart:a?e.rowStart===t.rowStart?t.colStart-e.colStart:t.rowStart-e.rowStart:o?e.colStart===t.colStart?t.rowStart-e.rowStart:t.colStart-e.colStart:0:n})}function Si(e,t){let n=t.min,r=e.min;if(t.max===2**53-1){let i=n,a=e.max;return r<=i&&i<=a?0:a<i?-1:r>i?1:(console.warn(`coords are not inserted correctly`,e,t),0)}return r-n}var Ci=class t{constructor(e){this._dataCoords=null,this._count=0,this._length=0,this._maxCoords=null,this._options=e,e?.maxCoords&&(this._maxCoords=Object.freeze({...e.maxCoords})),this._runs=new ui(void 0,Si,e?.nodeSize),this._reuseRunsIterator={done:!1,value:[null,null]},this._reuseRunsEntry=[null,null]}_validateBounds(t=-(2**53-1),n=2**53-1){let r=this._maxCoords;if(t<(r?.min??-(2**53-1))||n>(r?.max??2**53-1))throw new e.C}entries(t){let n,r,i=-(2**53-1),a=2**53-1,o=!0;t&&(t?.bounds&&(i=t.bounds?.min??-(2**53-1),a=t.bounds?.max??2**53-1,this._validateBounds(i,a)),o=!t.reverse,n=wi(t.reuseResult),r=t.processSkip);let s=this._dataCoords;if(!s)return ti;i=Math.max(s.min,i),a=Math.min(s.max,a);let c=null,l=null,u=2**53-1,d=-(2**53-1);if(r){let e=r;r=(t,n)=>e(t+u,n)-u}let f=e=>{let t;e!==-(2**53-1)&&e!==2**53-1&&(Ni.min=e,t=Ni),c=o?this._runs.entries(t,this._reuseRunsIterator):this._runs.entriesReversed(t,this._reuseRunsIterator),u=2**53-1,d=-(2**53-1),l=null},p=e=>{if(e!==void 0){if(e<u||e>d)return void(l=void 0);e-=u}if(!l)return;let t=l.next(e);if(!l)return;let r=t.value,i=r?.[1];if(!t.done)return Ti(r[0]+u,i,n);l=void 0};return f(o?i:a),{next(t){if(t!==void 0&&(t<0||t>a))throw new e.C;return(e=>{let t;return t=p(e),t||(t=(e=>{let t;do{if(e!==void 0&&f(e),!c)return;if(t=c.next(),t.done)return void(c=void 0);let s=t.value,m=s[0],h=s[1],g=m.min,_=m.max,v=Math.max(g,i)-g,y=Math.max(v,Math.min(_,a))-g;ji.bounds.min=v,ji.bounds.max=y,ji.reverse=!o,ji.processSkip=r,ji.reuseResult=n,u=g,d=_,l=h.entries(ji);let b=p(e);if(b)return b;e=void 0}while(!t.done);c=void 0})(e),t||ei)})(t)},return:e=>null,throw:e=>null}}runs(t){let n,r=-(2**53-1),i=2**53-1,a=!0,o=!1;t&&(t.bounds&&(r=t.bounds?.min??-(2**53-1),i=t.bounds?.max??2**53-1,this._validateBounds(r,i),t.overflowRun&&(o=!0)),a=!t.reverse,n=Ei(t.reuseResult));let s=this._dataCoords;if(!s)return ti;r=Math.max(s.min,r),i=Math.min(s.max,i);let c=null,l=e=>{let t;e!==-(2**53-1)&&e!==2**53-1&&(Ni.min=e,t=Ni),c=a?this._runs.entries(t,this._reuseRunsIterator):this._runs.entriesReversed(t,this._reuseRunsIterator)};return l(a?r:i),{next(t){if(t!==void 0){if(t<r||t>i)throw new e.C;l(t)}if(!c)return ei;let s=c.next();if(s.done)return c=void 0,ei;let u=s.value,d=u[0],f=d,p=f.min,m=f.max;if(a&&p>i||!a&&m<r)return ei;let h=u[1];return o||(m>i&&(h=h.slice(0,h.length-(m-i)),f={...f},f.max=i),p<r&&(h=h.slice(r-p),f===d&&(f={...f}),f.min=r)),Di(f,h,n)},return:e=>null,throw:e=>null}}slice(e,n){let r=this._runs;if(this._count===0)return this.clone();let i=r.minKey().min,a=r.maxKey().max;if(n===void 0&&(n=a+1),e<=i&&n-1>=a)return this.clone();let o=Math.max(i,e),s=Math.min(a,n-1),c=s-o,l=[],u=0;Ii.bounds.min=o,Ii.bounds.max=s;let d=this.runs(Ii),f=d.next();for(;!f.done;){let e=f.value,t=e[0],n=e[1];t={min:t.min-o,max:t.max-o},t.min<0&&(n=n.slice(-t.min),t.min=0),t.max>=c&&(n=n.slice(0,n.length-(t.max-c)),t.max=c),u+=n.length,l.push([t,n]),f=d.next()}let p=new t(this._options);return p._runs.setPairs(l),p._updateCount(u),p}concat(e){let t=this.clone();if(!e||e.length===0)return t;let n=this._runs;if(this._count===0){let n=[],r=0;if(e.isISparseList){let t=e.runs(),i=t.next();for(;!i.done;){let e=i.value;n.push([{min:e[0].min,max:e[0].max},e[1]]),r+=e[1].length,i=t.next()}}else n.push([{min:0,max:e.length-1},e]),r+=e.length;return t._runs.setPairs(n),t._updateCount(r),t}let r=n.nextLowerPair(void 0,this._reuseRunsEntry),i=r[0],a=r[1],o=i.max+1,s=!1,c=0,l=[];if(e.isISparseList){let t=e.runs(),n=t.next();for(;!n.done;){let e=n.value,r=e[0],u={min:r.min+o,max:r.max+o},d=e[1];if(r.min===0){s=!0,c-=a.length,d=a.concat(d);let e=i.min;u.min=e,u.max=d.length-1+e}c+=d.length,l.push([u,d]),n=t.next()}}else{let t=e.length,n={min:i.min,max:t-1+o};e=a.concat(e),s=!0,c+=t,l.push([n,e])}return s&&t._runs.delete(i),t._runs.setPairs(l),t._updateCount(c),t}toArray(t=2**53-1,n=!0){if(this.length===0)return e.A.EmptyArray;let r=n?0:-(2**53-1),i=Math.min(this._runs.maxKey().max,t);return Mi.bounds.min=-(2**53-1),Mi.bounds.max=i,Oi(this.entries(Mi),n,i,r)}get isIReadableList(){return!0}get length(){return this._length}getCoords(){return this._dataCoords}clear(){this._runs.clear(),this._dataCoords=null,this._lastRunsRead=void 0,this._lastListRead=void 0,this._count=0,this._length=0}get isISparseList(){return!0}get isIList(){return!0}_updateCount(e){if(this._count+=e,this._lastRunsRead=void 0,this._lastListRead=void 0,this._count>0){let e=this._runs,t=Object.freeze({min:e.minKey().min,max:e.maxKey().max});this._dataCoords=t,this._length=t.max+1}else this._dataCoords=null,this._length=0}_update(e,t,n=null,r=void 0){let i=e,a=i+t-1,o=0,s=a,c=a,l=null,u=null;Ni.min=i,Pi.min=a,(n||r)&&(--Ni.min,Pi.min+=1);let d=this._runs,f=!1;if(d.editRange(Ni,Pi,!0,(e,t,n)=>{let r=e.min,d=e.max;return r<i&&d+1>=i&&(s=r,l=t),r-1<=a&&d>a&&(c=r,u=t),o-=d-r+1,f=!0,ui.DeleteValue}),n||r===void 0||(n=new ii([r])),n){let e=n;f=!0;let t=i;l&&(l=l.slice(0,i-s),e=l.concat(e),t=s),u&&(u=u.slice(a+1-c),e=e.concat(u)),o+=e.length,d.set({min:t,max:t+e.length-1},e)}else l&&(l=l.slice(0,i-s),o+=l.length,d.set({min:s,max:s+l.length-1},l)),u&&(u=u.slice(a+1-c),o+=u.length,d.set({min:a+1,max:a+u.length},u));return this._updateCount(o),f}setAt(t,n){if(t===void 0)throw new e.O;return this._validateBounds(t,t),this._update(t,1,null,n)}setRunAt(t,n){if(!n||n.length===0)return!1;if(t===void 0||!n.length)throw new e.O;let r=n.length;return this._validateBounds(t,t+r-1),this._update(t,r,n)}delete(e,t){if(t===void 0){let n=this.getCoords();if(!n)return!1;t=Math.max(n.max-e+1,0)}return!(t<=0)&&(this._validateBounds(e,e),this._update(e,t,null))}shift(e,t){if(t===0)return!1;let n=e,r=e;t<0&&(r=e-t-1),this._validateBounds(n,r);let i=this._runs;if(this._count===0)return!1;let a=i.maxKey();if(t<0&&r>=a.max&&n<=i.minKey().min)return this._runs.clear(),this._dataCoords=null,this._count=0,this._length=0,!0;let o=0,s=n,c=r,l=null,u=null;Ni.min=s,Pi.min=a.min,t<0&&(--Ni.min,Pi.min+=1);let d=!1,f=[];if(i.editRange(Ni,Pi,!0,(e,i,a)=>{let p=e.min,m=e.max;return p<n&&m+1>=n&&(s=p,l=i),(p<n||t<0)&&p-1<=r&&e.max>r&&(c=p,u=i),t>0&&p>=n||t<0&&p-1>r?f.push([{min:p+t,max:m+t},i]):o-=m-p+1,d=!0,ui.DeleteValue}),t>0){let r=l||u;r&&(l=r.slice(0,n-s),c=e+t,u=r.slice(n-s))}else l&&=l.slice(0,n-s),u&&(u=u.slice(r+1-c),c=e),l&&u&&s+l.length===c&&(l=l.concat(u),u=null);return l&&l.length>0&&(o+=l.length,i.set({min:s,max:s+l.length-1},l)),u&&(o+=u.length,i.set({min:c,max:c+u.length-1},u)),f.length>0&&i.setPairs(f),this._updateCount(o),d}at(e){Ni.min=e;let t=this._lastRunsRead;if(t){let n=t.min;if(n<=e&&t.max>=e)return this._lastListRead.at(e-n)}let n,r,i=this._runs.getPairOrNextHigher(Ni,Fi);if(i&&(n=i[0],r=i[1]),this._lastRunsRead=n,this._lastListRead=r,!(!n||e<n.min||e>n.max))return r.at(e-n.min)}[Symbol.iterator](){return Qr(this.entries())}clone(){let e=new t(this._options);return e._runs=this._runs.clone(),e._count=this._count,e._dataCoords=this._dataCoords,e._length=this._length,e}getMaxCoords(){return this._maxCoords||null}getCount(){return this._count}getRunsCount(){return this._runs.size}get[Symbol.toStringTag](){return`[SparseList]`}};Ci||={};var wi=e=>typeof e==`boolean`?!0===e?Ai:void 0:(e&&!e.value&&(e.value=[-1,null]),e),Ti=(e,t,n)=>{let r=n??{done:!1,value:[-1,null]},i=r.value;return i[0]=e,i[1]=t,r},Ei=e=>typeof e==`boolean`?!0===e?ki:void 0:(e&&!e.value&&(e.value=[null,null]),e),Di=(e,t,n)=>{let r=n??{done:!1,value:[null,null]},i=r.value;return i[0]=e,i[1]=t,r},Oi=(e,t=!1,n=-(2**53-1),r=2**53-1)=>{let i=[],a=e.next(),o=Math.max(r,0)-1;for(;!a.done;){if(t){let e=a.value[0];for(let t=o;t<e-1;t++)i.push(void 0);o=e}i.push(a.value[1]),a=e.next()}if(t)for(let e=o;e<n;e++)i.push(void 0);return i},ki=Object.seal({done:!1,value:[{min:-(2**53-1),max:2**53-1},null]}),Ai=Object.seal({done:!1,value:[-1,null]}),ji={reverse:!1,bounds:{min:-(2**53-1),max:2**53-1},processSkip:null,reuseResult:Ai},Mi=Object.freeze({reverse:!1,bounds:{min:-(2**53-1),max:2**53-1},processSkip:null,reuseResult:Ai}),Ni={min:0,max:2**53-1},Pi={min:0,max:2**53-1},Fi=[null,null],Ii={bounds:{min:0,max:0},overflowRun:!0},Li=class{constructor(e,t){this._l=0,e&&t>0&&(this._u=e,this._l=t)}at(e){if(e>=this._l||e<0||!this._u)return;let t=e%this._u.length;return this._u.at(t)}toArray(e){let t=[],n=this._u,r=n.length,i=Math.min(e??this._l,this._l);for(let e=0;e<i;e++){let i=e%r;t.push(n.at(i))}return t}get length(){return this._l}get[Symbol.toStringTag](){return`[RepeatingList]`}get isIList(){return!0}},Ri=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(t){return this.isEmpty()?t??e.A.EmptyArray:this._all(this._data,t??[])}search(t,n){if(this.isEmpty()||!ia(t,this._data.range))return n??e.A.EmptyArray;let r=n??[],i=ua,a=this._data;for(;a;){let e=a.children;if(e!==null){let n=e.length;for(let i=0;i<n;i++){let n=e[i];ia(t,n.range)&&(n.children===null?r.push(n.range):ra(t,n.range)?this._all(n,r):la[ua++]=n)}}a=ua>i?la[--ua]:void 0}return ua=i,r}collides(e){if(this.isEmpty()||!ia(e,this._data.range))return!1;let t=ua,n=this._data;for(;n;){let r=n.children;if(r!==null){let n=r.length;for(let i=0;i<n;i++){let n=r[i],a=n.range;if(ia(e,a)){if(n.children===null||ra(e,a))return ua=t,!0;la[ua++]=n}}}n=ua>t?la[--ua]:void 0}return ua=t,!1}isEmpty(){let e=this._data.children;return e!==null&&e.length===0}getBoundingRange(){let e=this._data,t=e.children;if(t!==null&&t.length===0)return null;let n=e.range;return{colStart:n.colStart,rowStart:n.rowStart,colEnd:n.colEnd,rowEnd:n.rowEnd}}load(e){if(!e||!e.length)return this;let t=e.length;if(t<this._minEntries){for(let n=0;n<t;n++)this.insert(e[n]);return this}let n=this._build(e.slice(),0,e.length-1,0);if(this.isEmpty())this._data=n;else if(this._data.height===n.height)this._splitRoot(this._data,n);else{if(this._data.height<n.height){let e=this._data;this._data=n,n=e}this._insert(n,this._data.height-n.height-1)}return this}removeAll(e,t){let n=e?e.length:0;if(n===0||this.isEmpty())return this;let r,i=ma;i.colStart=Hi,i.rowStart=Hi,i.colEnd=Ui,i.rowEnd=Ui;for(let t=0;t<n;t++)Ji(i,e[t]);if(t)r=r=>{for(let i=0;i<n;i++)if(t(r,e[i]))return!0;return!1};else{let t=new Set(e);r=e=>t.has(e)}return Bi(this._data,r,i)&&this.clear(),this}clear(){return this._data=Gi([]),this}insert(e){return e&&this._insert(Vi(e),this._data.height-1),this}remove(e,t){if(!e)return this;let n=e,r=fa,i=pa,a=0,o=this._data,s=0,c=null,l=!1;for(;o||a>0;){if(!o){let e=--a;o=r[e],r[e]=ca,c=a>0?r[a-1]:null,s=i[a],l=!0}if(o.height===1){let n=zi(e,o.children,t);if(n!==-1){o.children.splice(n,1),r[a++]=o;for(let e=a-1;e>=0;e--)if(r[e].children.length===0)if(e>0){let t=r[e-1].children;t.splice(t.indexOf(r[e]),1)}else this.clear();else Ki(r[e]);return this}}!l&&o.height>1&&ra(o.range,n)?(r[a]=o,i[a]=s,a++,s=0,c=o,o=o.children[0]):c?(s++,o=c.children[s]??null,l=!1):o=null}return this}_all(e,t){let n=ua,r=e;for(;r;){if(r.children===null)t.push(r.range);else{let e=r.children,t=e.length;for(let n=0;n<t;n++)la[ua++]=e[n]}r=ua>n?la[--ua]:void 0}return ua=n,t}_build(e,t,n,r){let i=n-t+1,a=this._maxEntries;if(i<=a){let n=i,r=[];for(let i=0;i<n;i++)r.push(Vi(e[t+i]));let a=Gi(r);return a.height=1,Ki(a),a}r||(r=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/a**(r-1)));let o=Gi([]);o.height=r;let s=Math.ceil(i/a),c=s*Math.ceil(Math.sqrt(a));aa(e,t,n,c,Zi);for(let i=t;i<=n;i+=c){let t=Math.min(i+c-1,n);aa(e,i,t,s,Qi);for(let n=i;n<=t;n+=s)o.children.push(this._build(e,n,Math.min(n+s-1,t),r-1))}return Ki(o),o}_chooseSubtree(e,t,n,r){let i=0;for(;r[i++]=t,t.children!==null&&i-1!==n;){let n,r=1/0,i=1/0,a=t.children,o=a.length;for(let t=0;t<o;t++){let o=a[t],s=o.range,c=$i(s),l=ta(e,s)-c;l<i?(i=l,r=c<r?c:r,n=o):l===i&&c<r&&(r=c,n=o)}t=n??a[0]}return t}_insert(e,t){let n=da;n.length=0;let r=e.range,i=this._chooseSubtree(r,this._data,t,n);i.children.push(e),Ji(i.range,r);let a=t,o=this._maxEntries;for(;a>=0&&n[a].children.length>o;)this._split(n,a),a--;for(let e=a;e>=0;e--)Ji(n[e].range,r)}_split(e,t){let n=e[t],r=n.children,i=r.length,a=this._minEntries;this._chooseSplitAxis(n,a,i);let o=this._chooseSplitIndex(n,a,i),s=Gi(r.splice(o,i-o));s.height=n.height,Ki(n),Ki(s),t?e[t-1].children.push(s):this._splitRoot(n,s)}_splitRoot(e,t){this._data=Gi([e,t]),this._data.height=e.height+1,Ki(this._data)}_chooseSplitIndex(e,t,n){let r=-1,i=1/0,a=1/0;for(let o=t;o<=n-t;o++){let t=qi(e,0,o,ha),s=qi(e,o,n,ga),c=na(t,s),l=$i(t)+$i(s);c<i?(i=c,r=o,a=l<a?l:a):c===i&&l<a&&(a=l,r=o)}return r||n-t}_chooseSplitAxis(e,t,n){this._allDistMargin(e,t,n,Yi)>=this._allDistMargin(e,t,n,Xi)||e.children.sort(Yi)}_allDistMargin(e,t,n,r){let i=e.children;i.sort(r);let a=qi(e,0,t,ha),o=qi(e,n-t,n,ga),s=ea(a)+ea(o);for(let e=t;e<n-t;e++)Ji(a,i[e].range),s+=ea(a);for(let e=n-t-1;e>=t;e--)Ji(o,i[e].range),s+=ea(o);return s}};function zi(e,t,n){let r=t.length;for(let i=0;i<r;i++){let r=t[i].range;if(n?n(e,r):e===r)return i}return-1}function Bi(e,t,n){if(e.height===1){let n=e.children,r=n.length;for(let e=n.length-1;e>=0;e--)t(n[e].range)&&n.splice(e,1);return n.length!==r&&n.length>0&&Ki(e),n.length===0}let r=e.children,i=!1;for(let e=r.length-1;e>=0;e--){let a=r[e];ia(a.range,n)&&Bi(a,t,n)&&(r.splice(e,1),i=!0)}return i&&r.length>0&&Ki(e),r.length===0}function Vi(e){return{range:e,children:null,height:0}}var Hi=1073741823,Ui=-1073741824;function Wi(){return{colStart:Hi,rowStart:Hi,colEnd:Ui,rowEnd:Ui,value:null}}function Gi(e){return{range:Wi(),children:e,height:1}}function Ki(e){let t=e.range;t.colStart=Hi,t.rowStart=Hi,t.colEnd=Ui,t.rowEnd=Ui;let n=e.children;if(n){let e=n.length;for(let r=0;r<e;r++)Ji(t,n[r].range)}}function qi(e,t,n,r){let i=r??Wi();i.colStart=Hi,i.rowStart=Hi,i.colEnd=Ui,i.rowEnd=Ui;let a=e.children;for(let e=t;e<n;e++)Ji(i,a[e].range);return i}function Ji(e,t){let n=e.colStart,r=e.colEnd,i=e.rowStart,a=e.rowEnd;return e.colStart=n<t.colStart?n:t.colStart,e.rowStart=i<t.rowStart?i:t.rowStart,e.colEnd=r>t.colEnd?r:t.colEnd,e.rowEnd=a>t.rowEnd?a:t.rowEnd,e}function Yi(e,t){return e.range.colStart-t.range.colStart}function Xi(e,t){return e.range.rowStart-t.range.rowStart}function Zi(e,t){return e.colStart-t.colStart}function Qi(e,t){return e.rowStart-t.rowStart}function $i(e){return(e.colEnd-e.colStart+1)*(e.rowEnd-e.rowStart+1)}function ea(e){return e.colEnd-e.colStart+1+(e.rowEnd-e.rowStart+1)}function ta(e,t){let n=e.colStart,r=e.colEnd,i=e.rowStart,a=e.rowEnd;return((t.colEnd>r?t.colEnd:r)-(t.colStart<n?t.colStart:n)+1)*((t.rowEnd>a?t.rowEnd:a)-(t.rowStart<i?t.rowStart:i)+1)}function na(e,t){let n=e.colStart,r=e.colEnd,i=n>t.colStart?n:t.colStart,a=(r<t.colEnd?r:t.colEnd)-i+1;if(a<=0)return 0;let o=e.rowStart,s=e.rowEnd,c=o>t.rowStart?o:t.rowStart,l=(s<t.rowEnd?s:t.rowEnd)-c+1;return l<=0?0:a*l}function ra(e,t){return e.colStart<=t.colStart&&e.rowStart<=t.rowStart&&t.colEnd<=e.colEnd&&t.rowEnd<=e.rowEnd}function ia(e,t){return t.colStart<=e.colEnd&&t.rowStart<=e.rowEnd&&t.colEnd>=e.colStart&&t.rowEnd>=e.rowStart}function aa(e,t,n,r,i){let a=0;for(_a[a++]=t,_a[a++]=n;a>0;){if((n=_a[--a])-(t=_a[--a])<=r)continue;let o=t+Math.ceil((n-t)/r/2)*r;oa(e,o,t,n,i),_a[a++]=t,_a[a++]=o,_a[a++]=o,_a[a++]=n}}function oa(e,t,n,r,i){let a=n,o=r,s=i;for(;o>a;){if(o-a>600){let n=o-a+1,r=t-a+1,i=Math.log(n),c=.5*Math.exp(2*i/3),l=.5*Math.sqrt(i*c*(n-c)/n)*(r-n/2<0?-1:1),u=Math.floor(t-r*c/n+l),d=u>a?u:a,f=Math.floor(t+(n-r)*c/n+l);oa(e,t,d,f<o?f:o,s)}let n=e[t],r=a,i=o;for(sa(e,a,t),s(e[o],n)>0&&sa(e,a,o);r<i;){for(sa(e,r,i),r++,i--;s(e[r],n)<0;)r++;for(;s(e[i],n)>0;)i--}s(e[a],n)===0?sa(e,a,i):(i++,sa(e,i,o)),i<=t&&(a=i+1),t<=i&&(o=i-1)}}function sa(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}var ca={range:Wi(),children:null,height:0},la=[];for(let e=0;e<128;e++)la.push(ca);var ua=0,da=[];for(let e=0;e<4;e++)da.push(ca);var fa=[],pa=[];for(let e=0;e<8;e++)fa.push(ca),pa.push(0);var ma=Wi(),ha=Wi(),ga=Wi(),_a=[];for(let e=0;e<64;e++)_a.push(0);var va=class t{constructor(e){this._shared=null,this._cloneKey=null,this._lastMiss={colStart:2**53-1,rowStart:0,colEnd:0,rowEnd:0},this._lastSingle={colStart:2**53-1,rowStart:0,colEnd:0,rowEnd:0},this._lastSingleResult=null,this._options=e,this._rTree=new ya(e?.maxNodeEntries??16)}visitRanges(e,t,n=null){let r,i=this.search(e);n&&(i=xi(i,n));let a=[],o=null,s=i.length;for(let e=0;!o&&e<s;e++){let n=i[e],s=t?.(n);s&&(!0===s.delete?a.push(n):s.update!==void 0&&(a.push(n),r||=[],r.push(s.update)),s&&!0===s.break&&(o=s))}return a.length>0&&this._getWritableTree().removeAll(a),r&&this.load(r),this._onModified(),o}getBoundingRange(){return this._getReadTree().getBoundingRange()}size(){return this._getReadTree().all().length}isEmpty(){return this._getReadTree().isEmpty()}search(t,n=!1,r=!1,i){let a=this._getReadTree();if(a.isEmpty())return e.A.EmptyArray;let o=!n&&!r&&!i;if(o){let n=this._lastMiss;if(n.colStart!==2**53-1&&e.l.isRangeWithinRange(t,n))return e.A.EmptyArray;let r=this._lastSingle;if(r.colStart!==2**53-1&&r.colStart===t.colStart&&r.colEnd===t.colEnd&&r.rowStart===t.rowStart&&r.rowEnd===t.rowEnd)return this._lastSingleResult;if(r.colStart!==2**53-1&&this._lastSingleResult?.length===1&&e.l.isRangeWithinRange(t,r)){let r=this._lastSingleResult[0];return r.colStart<=t.colEnd&&r.colEnd>=t.colStart&&r.rowStart<=t.rowEnd&&r.rowEnd>=t.rowStart?this._lastSingleResult:(n.colStart=t.colStart,n.rowStart=t.rowStart,n.colEnd=t.colEnd,n.rowEnd=t.rowEnd,e.A.EmptyArray)}}let s=a.searchRange(t,n,i);return o&&(s.length===0?(this._lastMiss.colStart=t.colStart,this._lastMiss.rowStart=t.rowStart,this._lastMiss.colEnd=t.colEnd,this._lastMiss.rowEnd=t.rowEnd,this._lastSingle.colStart=2**53-1,this._lastSingleResult=null):(this._lastMiss.colStart=2**53-1,this._lastSingle.colStart=t.colStart,this._lastSingle.rowStart=t.rowStart,this._lastSingle.colEnd=t.colEnd,this._lastSingle.rowEnd=t.rowEnd,this._lastSingleResult=s)),r&&s.sort(e.l.columnFirstRangeComparator),s}has(e){return this._getReadTree().collides(e)}all(e){return this._getReadTree().all(e)}shift(t){let n=t.range,r=t.direction,i=t.cloneIfUpdate??!1,a=t.coordValidator??null,o=t.onShift??null,s=r===e.i.Left||r===e.i.Right,c=s?e.N.Column:e.N.Row,l=r===e.i.Up||r===e.i.Left?-1:1,u=(s?n.colEnd-n.colStart+1:n.rowEnd-n.rowStart+1)*l,d=[],f=[],p=null,m=this.getBoundingRange();if(!m)return this;let h,g=r===e.i.Up||r===e.i.Left?e.i.Right:e.i.Left,_=new Map,v=new Map,y=this._options?.updateEntryOptions,b=y?.isMergeOnShift??!1,x=y?.isSplitOnExpand??!1,S=y?.isTrailingEdge??!1,C=r===e.i.Left||r===e.i.Up,w=y?.getSplit??Oa,T=y?.getShifted,E=y?.onShifted,D=y?.onRemoved,O=y?.onMerged,k=y?.onUpdated,A=E?[]:null,j=D?[]:null,M=k?[]:null;this.visitRanges({colStart:n.colStart-+!!s,rowStart:n.rowStart-+!s,colEnd:s?m.colEnd:n.colEnd,rowEnd:s?n.rowEnd:m.rowEnd},t=>{if((s?t.colEnd<n.colStart:t.rowEnd<n.rowStart)&&!S)return;let i=function(t,n,r=e.I.Both){let i=e=>e?t.rowStart>n.rowStart&&t.rowStart<=n.rowEnd||t.rowEnd<n.rowEnd&&t.rowEnd>=n.rowStart:t.colStart>n.colStart&&t.colStart<=n.colEnd||t.colEnd<n.colEnd&&t.colEnd>=n.colStart,a=r===e.I.Column,o=r===e.I.Row;return r===e.I.Both&&(a=o=!0),!(!a||!i(!0))||!(!o||!i(!1))}(n,t,s?e.I.Column:e.I.Row),l=t.group;if(C&&!l&&n.colStart<=t.colStart&&n.rowStart<=t.rowStart&&n.colEnd>=t.colEnd&&n.rowEnd>=t.rowEnd){let r=Aa(t,null,{after:null,before:t,intersect:n,isSplit:i,axis:c,amount:u},T,w,o,!1);if(r===void 0)return;if(r===null)return p=e.l.unionRanges(p,t),j&&j.push(t),void d.push(t)}let m={...t};r===e.i.Right?(n.colStart<=m.colStart&&(m.colStart+=u),m.colEnd+=u):r===e.i.Left?n.colStart<m.colStart?(m.colStart=Math.max(m.colStart+u,n.colStart),m.colEnd=Math.max(m.colEnd+u,m.colStart-1)):m.colEnd+=Math.max(u,n.colStart-m.colEnd-1):r===e.i.Down?(n.rowStart<=m.rowStart&&(m.rowStart+=u),m.rowEnd+=u):r===e.i.Up&&(n.rowStart<m.rowStart?(m.rowStart=Math.max(m.rowStart+u,n.rowStart),m.rowEnd=Math.max(m.rowEnd+u,n.rowStart-1)):m.rowEnd+=Math.max(u,n.rowStart-m.rowEnd-1)),(m.colEnd<m.colStart||m.rowEnd<m.rowStart)&&(m=null);let h=Aa(t,m,{after:m,before:t,intersect:n,isSplit:i,axis:c,amount:u},T,w,o,x&&u>0);if(h===void 0)return;let g=h===null?[m]:h,y=g.length;if(g[0]!==t||y!==1){if(a)for(let e=0;e<y;e++){let t=g[e];t&&a(t)}let n;l?(_.set(l.uuid,l),n=[],v.set(t.uuid,n)):d.push(t);for(let r=0;r<y;r++){let i=g[r];p=e.l.unionRanges(p,i),l?n.push(i):(f.push(i),A&&A.push(i),M&&M.push(t))}}},g),h=i&&(d.length>0||f.length>0||v.size>0)?this.clone():this,h._updateNodes(f,d),t?.onUpdates&&t.onUpdates(f,d,h),v.size>0&&h._updateGroupedEntries(_,v);let N=e.A.EmptyArray;if(b&&m&&p){let t=!0;if(u>0&&(t=s?n.rowStart>m.rowStart||n.rowEnd<m.rowEnd:n.colStart>m.colStart||n.colEnd<m.colEnd),t){let t=ba(p,e.l.unionRanges(m,p),+!s,+!!s);O&&(N=h._mergeNodes(t,!1))}}return k&&M.length>0&&k(M),E&&A.length>0&&E(A),O&&N.length>0&&O(N),D&&j.length>0&&D(j),this._onModified(),h}insertNonOverlapping(t,n){let r=n?.onIntersect??((e,t)=>({...e,value:t.value})),i=this.search(t),a=new Map,o=new Map,s=this._options?.updateEntryOptions,c=s?.onUpdated,l=s?.onRemoved,u=s?.onMerged,d=s?.getSplit,f=s?.getIntersect,p=s?.getUpdate,m=null,h=null,g=null,_=function(t,n,r){let i=r?.getIntersect??Sa,a=r?.getUpdate??Ta;if(t.length===0){let t=n;if(i){let e=i({...n,value:null},n);t=e&&e.value!==null?{...e}:null}if(a){let e=a(t);e!==void 0&&(t=e)}return t?[t]:e.A.EmptyArray}let o=r?.getSplit??xa,s=(e,t,n=!0)=>{let r=t.search(e),i=r.length;for(let a=0;a<i;a++){let i=r[a];if(Ca(i,e))continue;t?.remove(i);let c=wa(i,e,o,n);for(let e=0;e<c.length;e++){let n=c[e];t.insert(n),s(n,t,!1)}}},c=new va;c.load(t),s(n,c);let l=new va;l.load([n]);let u=c.search(n);for(let e=0;e<u.length;e++)s(u[e],l);let d=(e,t,n)=>{let r=t.search(e);console.assert(r.length<=1,`intersecting incorrect ranges`);let a=r[0]??{...e,value:null};if(Ca(a,e)){let r=i(a,e);t.remove(a),n.insert(r)}else{t.remove(a);let r=wa(a,e,o),s=r.length;for(let a=0;a<s;a++){let o=r[a];if(Ca(o,e)){let t=i(o,e);n.insert(t)}else t.insert(o)}}},f=new va,p=l.all([]),m=p.length;for(let e=0;e<m;e++)d(p[e],c,f);let h=c.all([]);return((e,t)=>{let n=e.all([]),r=n.length;for(let e=0;e<r;e++){let r=n[e];if(a){let e=a(r);e!==void 0&&(r=e)}r!==null&&r.value!==null&&t.push(r)}})(f,h),h}(i,t,{getSplit:(e,t,n,r)=>{let i;return d?(i=d(e,t,n,r),i):(i=Oa(e,t,n,r),i)},getIntersect:(e,t)=>{f&&(t=f(e,t));let n=r(e,t);return n===void 0||n!==null&&n.value!==null||e.value?.onRemove?.(e),n},getUpdate:e=>{let t=e?.group;if(t){a.set(t.uuid,t);let n=o.get(e.lastId??e.uuid);n||(n=[],o.set(e.lastId??e.uuid,n)),n.push(e.value===null?null:e)}let n=e;if(p&&(n=p(e)),n&&n.value!==null)c&&(m||=[],m.push(n));else if(l&&!g){g=[];let t=n&&n.value===null?n:{...e,value:null};g.push(t)}return n}}),v=this.getBoundingRange();if(a.size>0){let e=[],t=_.length;for(let n=0;n<t;n++){let t=_[n];t.group||e.push(t)}_=e}if(this._updateNodes(_,i,n?.onUpdates),a.size>0&&this._updateGroupedEntries(a,o),v&&!s?.noMerge&&!n?.noMerge){let r=ba(t,e.l.unionRanges(v,t)),i=this.search(r);if(i.length>1){let t=s?.getMerged??ka,r=i;r=Ea(r,e.N.Column,1,t),r=Ea(r,e.N.Row,1,t),i.length!==r.length&&(u&&r.length>0&&(h=r),this._updateNodes(r,i,n?.onUpdates))}}return m&&c(m),h&&u(h),g&&l(g),this._onModified(),this}insertGroup(t,n){n??=e.A.uuidV4();let r=[],i=t.length;for(let a=0;a<i;a++){let i={...t[a],group:{entries:r,uuid:n,offset:a},uuid:e.A.uuidV4()};r.push(i),t[a]=i}return this.load(t),this._options?.updateEntryOptions?.onGroupUpdate?.(t,n),this._onModified(),this}createCopiedEntries(t,n,r,i,a){return function(t,n,r,i,a,o,s){let c=r.colEnd-r.colStart+1,l=r.rowEnd-r.rowStart+1,u=r.colStart-n.colStart,d=r.rowStart-n.rowStart,f=i?.transpose??!1,p=1,m=1;f?(p=n.rowEnd-n.rowStart+1,m=n.colEnd-n.colStart+1):(p=n.colEnd-n.colStart+1,m=n.rowEnd-n.rowStart+1);let h=Math.ceil(c/p),g=Math.ceil(l/m),_=r.scope,v=a??[],y=o??e.A.EmptyArray,b=r.colEnd,x=r.rowEnd;return t.visitRanges(n,t=>{let a=t.value;if(!a.copyTo)return;let o=t;if(!e.l.isRangeWithinRange(o,n)){let e=wa(o,n,s);o=e[e.length-1]}a=o.value;let y=o.colEnd-o.colStart+1,S=o.rowEnd-o.rowStart+1,C=u+o.colStart,w=d+o.rowStart;if(f){C=o.rowStart-n.rowStart+r.colStart,w=o.colStart-n.colStart+r.rowStart;let e=y;y=S,S=e}let T=h,E=g,D=c<=T*y,O=l<=E*S;if(D||O){let t=a?.canTile?.({colStart:C,rowStart:w,colEnd:Math.min(C+(D?c:y)-1,b),rowEnd:Math.min(w+(O?l:S)-1,x)},i);!D||!0!==t&&t!==e.N.Column||(y=c,T=1),!O||!0!==t&&t!==e.N.Row||(S=l,E=1)}for(let e=0;e<T;e++){let t=C+e*p;for(let e=0;e<E;e++){let n=w+e*m,r=Math.min(t+y-1,b),o=Math.min(n+S-1,x),s={colStart:t,rowStart:n,colEnd:r,rowEnd:o,scope:_};if(t>r||n>o)continue;let c=a.copyTo(s,i);c&&v.push(c)}}},e.i.Right),{inserts:v,removes:y}}(this,t,n,r,i,a,this._options?.updateEntryOptions?.getSplit??Oa)}remove(e,t){return e&&(this._getWritableTree().remove(e,t??Ca),this._onModified()),this}removeAll(e,t){return e&&e.length>0&&this._getWritableTree().removeAll(e,t),this._onModified(),this}insert(e){return e&&this._getWritableTree().insert(e),this._onModified(),this}load(e){return e&&e.length>0&&this._getWritableTree(e),this._onModified(),this}clear(){return this.isEmpty()||this._getWritableTree().clear(),this._onModified(),this}delete(e){if(this.isEmpty())return this;if(!e)return this.clear();let t=this.search(e);return t.length===0||(this._getWritableTree().removeAll(t),this._onModified()),this}clone(e=null){if(e!==null&&this._cloneKey===e)return this;let t=this._shared;t||(t={rTree:this._rTree,refCount:1},this._shared=t),t.refCount++;let n=this._createClone(this._options);return n._shared=t,n._cloneKey=e,n}_updateGroupedEntries(e,t){let n=[],r=[],i=new Map,a=e.values(),o=a.next();for(;!o.done;){let e=o.value,s=e.entries,c=e.uuid,l=[];for(let e=0;e<s.length;e++){let i=s[e];n.push(i);let a=t.get(i.uuid);a===void 0&&(a=[{...i}]);for(let e=0;e<a.length;e++){let t=a[e];t!==null&&(t={...t,group:{offset:l.length,entries:l,uuid:c}},l.push(t),r.push(t))}}l.sort((e,t)=>e.group.offset-t.group.offset),i.set(c,l),o=a.next()}if(this._updateNodes(r,n),i){let e=this._options?.updateEntryOptions?.onGroupUpdate;if(e){let t=i.entries(),n=t.next();for(;!n.done;){let r=n.value[0];e(n.value[1],r),n=t.next()}}}}_copy(e,t){let n=e.rTree.all([]),r=new ya(this._options?.maxNodeEntries);return t&&(n=n.concat(t)),n.length>0&&r.load(n),{refCount:1,rTree:r}}_updateNodes(e,t,n){if(!(e&&e.length!==0||t&&t.length!==0))return;let r=this._getWritableTree();if(t){let e=t.length;for(let n=0;n<e;n++){let e=t[n],i=e.value;i&&i.onRemove&&i.onRemove(e),r.remove(e)}}e.length>0&&r.load(e),n?.(e,t,this),this._options?.updateEntryOptions?.onUpdates?.(e,t,this)}_mergeNodes(t,n){let r=this.search(t,n),i=e.A.EmptyArray;if(r.length>1){let t=this._options?.updateEntryOptions?.getMerged??ka,n=r;n.length>1&&(n=Ea(n,e.N.Column,1,t)),n.length>1&&(n=Ea(n,e.N.Row,1,t)),r.length!==n.length&&(i=n,this._updateNodes(n,r))}return i}_getReadTree(){return this._shared?.rTree??this._rTree}_ensureWritable(e){let t=this._shared;if(!t)return;if(t.refCount--,t.refCount===0)return this._shared=null,void(e&&this._rTree.load(e));let n=this._copy(t,e);this._shared=null,this._rTree=n.rTree}_getWritableTree(e){return this._lastMiss.colStart=2**53-1,this._lastSingle.colStart=2**53-1,this._lastSingleResult=null,this._shared?(this._ensureWritable(e),this._rTree):(e&&this._rTree.load(e),this._rTree)}_onModified(){}_createClone(e){return new t(e)}},ya=class extends Ri{isEmpty(){return super.isEmpty()}searchRange(t,n=!1,r){if(this.isEmpty())return e.A.EmptyArray;let i=this.search(t,r);return n?i.filter(e=>e.colStart>=t.colStart&&e.rowStart>=t.rowStart&&e.colEnd<=t.colEnd&&e.rowEnd<=t.rowEnd):i}};function ba(e,t=e,n=1,r=1){return{...e,colStart:Math.max(e.colStart-n,t.colStart),rowStart:Math.max(e.rowStart-r,t.rowStart),colEnd:Math.min(e.colEnd+n,t.colEnd),rowEnd:Math.min(e.rowEnd+r,t.rowEnd)}}function xa(e,t,n,r){return[{...t[0],value:e.value},{...t[0],value:e.value}]}function Sa(e,t){return{...e}}function Ca(e,t){return e===t||!(!e||!t)&&e.rowStart===t.rowStart&&e.rowEnd===t.rowEnd&&e.colStart===t.colStart&&e.colEnd===t.colEnd}function wa(t,n,r=null,i=!0){if(Ca(t,n))return[{...t}];let a=e.l.intersectRanges(t,n,Na);if(!a)return null;let o=[],s=t.uuid,c=t;if(c.rowStart<a.rowStart){let t={...c,colStart:c.colStart,rowStart:c.rowStart,colEnd:c.colEnd,rowEnd:a.rowStart-1};s&&(i&&(t.lastId=s),t.uuid=e.A.uuidV4());let n={...c,colStart:c.colStart,rowStart:a.rowStart,colEnd:c.colEnd,rowEnd:c.rowEnd};s&&(i&&(n.lastId=s),n.uuid=e.A.uuidV4());let l=n.rowStart-t.rowStart;Ma[0]=t,Ma[1]=n;let u=r(c,Ma,e.N.Row,l);u!==void 0&&(o.push(u[0]),c=u[1])}if(c.rowEnd>a.rowEnd){let t={...c,colStart:c.colStart,rowStart:c.rowStart,colEnd:c.colEnd,rowEnd:a.rowEnd};s&&(i&&(t.lastId=s),t.uuid=e.A.uuidV4());let n={...c,colStart:c.colStart,rowStart:a.rowEnd+1,colEnd:c.colEnd,rowEnd:c.rowEnd};s&&(i&&(n.lastId=s),n.uuid=e.A.uuidV4());let l=n.rowStart-t.rowStart;Ma[0]=t,Ma[1]=n;let u=r(c,Ma,e.N.Row,l);u!==void 0&&(o.push(u[1]),c=u[0])}if(c.colStart<a.colStart){let t={...c,colStart:c.colStart,rowStart:c.rowStart,colEnd:a.colStart-1,rowEnd:c.rowEnd};s&&(i&&(t.lastId=s),t.uuid=e.A.uuidV4());let n={...c,colStart:a.colStart,rowStart:c.rowStart,colEnd:c.colEnd,rowEnd:c.rowEnd};s&&(i&&(n.lastId=s),n.uuid=e.A.uuidV4());let l=n.colStart-t.colStart;Ma[0]=t,Ma[1]=n;let u=r(c,Ma,e.N.Column,l);u!==void 0&&(o.push(u[0]),c=u[1])}if(c.colEnd>a.colEnd){let t={...c,colStart:c.colStart,rowStart:c.rowStart,colEnd:a.colEnd,rowEnd:c.rowEnd};s&&(i&&(t.lastId=s),t.uuid=e.A.uuidV4());let n={...c,colStart:a.colEnd+1,rowStart:c.rowStart,colEnd:c.colEnd,rowEnd:c.rowEnd};s&&(i&&(n.lastId=s),n.uuid=e.A.uuidV4());let l=n.colStart-t.colStart;Ma[0]=t,Ma[1]=n;let u=r(c,Ma,e.N.Column,l);u!==void 0&&(o.push(u[1]),c=u[0])}return c===t&&(c={...t}),o.push(c),o}function Ta(e){return e.value===null?null:e}function Ea(t,n=e.N.Column,r=2,i,a){let o=[...t];if(r<=0||t.length<=1)return o;let s=n===e.N.Column,c=0,l=0;do{let t=o.sort(e.l.createRangeComparator(s?e.N.Row:e.N.Column));o=[];let r=!1;o.push(t[0]);let u=t.length;for(let e=1;e<u;e++){let c=t[e],l=o[o.length-1],u=!1;if(u=s?l&&l.rowStart===c.rowStart&&l.rowEnd===c.rowEnd&&l.colEnd+1===c.colStart&&l.scope===c.scope:l&&l.colStart===c.colStart&&l.colEnd===c.colEnd&&l.rowEnd+1===c.rowStart&&l.scope===c.scope,u){let e={...l};if(e.colEnd=s?c.colEnd:l.colEnd,e.rowEnd=s?l.rowEnd:c.rowEnd,i){let t=a??[null,null];t[0]=l,t[1]=c,e=i(t,e,n)}if(e){o[o.length-1]=e,r=!0;continue}}o.push(c)}l=r?0:l+1,c++,s=!s}while(c<r&&l<2&&o.length>1);return o}function Da(t,n=2,r=e.N.Row,i,a,o){if(t.length<=1)return[...t];let s=function(e){let t=e[0]?.scope??null,n=!1;for(let r=1;r<e.length;r++)if((e[r]?.scope??null)!==t){n=!0;break}if(!n)return null;let r=new Map;for(let t=0;t<e.length;t++){let n=e[t],i=n?.scope??null,a=r.get(i);a?a.push(n):r.set(i,[n])}return Array.from(r.values())}(t);if(s){let e=[];for(let t=0;t<s.length;t++){let c=Da(s[t],n,r,i,a,o);for(let t=0;t<c.length;t++)e.push(c[t])}return e}let c=t[0]?.scope??void 0,l=[],u=r===e.N.Column,d=new ni.IteratorInstance(t,{axis:u?e.N.Row:e.N.Column}),f=d.next();for(;!f.done;){let e=f.value;f=d.next();let t=e.range;if(a&&e.overlaps.length>1&&a(t,e.overlaps),n>0){let e=l[l.length-1],n=!1;if(n=u?e&&e.rowStart===t.rowStart&&e.rowEnd===t.rowEnd&&e.colEnd+1===t.colStart:e&&e.colStart===t.colStart&&e.colEnd===t.colEnd&&e.rowEnd+1===t.rowStart,n){let n={...e,colEnd:u?t.colEnd:e.colEnd,rowEnd:u?e.rowEnd:t.rowEnd};if(i){let a=o??[null,null];a[0]=e,a[1]=t,n=i(a,n,r)}if(n){l[l.length-1]=n;continue}}}l.push(t)}if(n>1&&(l=Ea(l,u?e.N.Row:e.N.Column,n,i,o)),c!==void 0)for(let e=0;e<l.length;e++)l[e].scope===void 0&&(l[e]={...l[e],scope:c});return l}function Oa(e,t,n,r){let i=e.value;if(i?.getSplit){let e=i.getSplit(t,n,r);if(e===void 0)return;t[0].value=e[0],t[1].value=e[1]}return t}function ka(t,n,r){let i=t[0].value,a=t[1].value;if(a){let o;if(i?.getMerged?o=i.getMerged(t[1].value,e.l.sanitizeRange(n),r):i&&(o=i===a?a:void 0),o===void 0)return;n.value=o}return n}function Aa(t,n,r,i,a,o,s){let c=r.axis===e.N.Column,l=r.intersect,u=(n,u)=>{let d=n.value,f=null,p=u.after;if(s){let r=null,i=0,o=0;if(c&&l.colStart>n.colStart?(r={...n,colEnd:l.colStart-1},o=u.amount):!c&&l.rowStart>n.rowStart&&(r={...n,rowEnd:l.rowStart-1},i=u.amount),r){let n=wa(t,r,a);if(n.length>1)for(let t=0;t<n.length;t++){let a=n[t];Ca(a,r)?(f??=[],f.push(a)):(p=a,d=a.value,u={...u,after:{...a,colStart:a.colStart+o,rowStart:a.rowStart+i,colEnd:a.colEnd+o,rowEnd:a.rowEnd+i,uuid:e.A.uuidV4()},before:a,isSplit:!0})}}}if(i?p=i(u.before,u.after,u):d&&d.getShifted?p=d.getShifted(u):u.after&&(p={...u.after,value:n.value}),p!==void 0)return o&&(p!==u.after&&(u={...u,after:p}),o(u)),p=(e=>{if(!e){let e=t.value;return e.onRemove&&e.onRemove(r.before),null}return e})(p),p&&(f??=[],f.push(p)),f};if(r.isSplit){let e;e=c?{...t,rowStart:Math.max(l.rowStart,r.before.rowStart),rowEnd:Math.min(l.rowEnd,r.before.rowEnd)}:{...t,colStart:Math.max(l.colStart,r.before.colStart),colEnd:Math.min(l.colEnd,r.before.colEnd)};let i=wa(t,e,a),o=[];for(let t=0;t<i.length;t++){let a=i[t];if(Ca(a,e)){let t=null;n&&(t=c?{colStart:n.colStart,rowStart:e.rowStart,colEnd:n.colEnd,rowEnd:e.rowEnd,value:a.value}:{colStart:e.colStart,rowStart:n.rowStart,colEnd:e.colEnd,rowEnd:n.rowEnd,value:a.value});let i=u(a,{...r,before:a,after:t});if(i)for(let e=0;e<i.length;e++)o.push(i[e])}else o.push(a)}return o}return u(t,r)}function ja(t,n){let r=e=>`${e.scope??``}!${e.rowStart},${e.colStart},${e.rowEnd},${e.colEnd}`,i=new Set,a=[],o=Da(n(t),2,e.N.Row);for(;o.length>0;){let t=[];for(let e of o){let o=r(e);i.has(o)||(i.add(o),a.push(e),t.push(...n(e)))}o=Da(t,2,e.N.Row)}return Da(a,2,e.N.Row)}var Ma=[null,null],Na={colStart:0,rowStart:0,colEnd:0,rowEnd:0};function Pa(t=-(2**53-1),n=-(2**53-1),r=2**53-1,i=2**53-1,a,o,s){if(o&&(t!==-(2**53-1)&&t<o.colStart||n!==-(2**53-1)&&n<o.rowStart||r!==2**53-1&&r>o.colEnd||i!==2**53-1&&i>o.rowEnd))throw new e.C;return s&&(t=Math.max(s.colStart,t),n=Math.max(s.rowStart,n),r=Math.min(s.colEnd,r),i=Math.min(s.rowEnd,i),r<t||i<n)?null:(Ia.majorStart=a?t:n,Ia.majorEnd=a?r:i,Ia.minorStart=a?n:t,Ia.minorEnd=a?i:r,Ia)}function Fa(e,t,n){let r=n??{colStart:0,rowStart:0,colEnd:0,rowEnd:0};return r.colStart=t?e.majorStart:e.minorStart,r.rowStart=t?e.minorStart:e.majorStart,r.colEnd=t?e.majorEnd:e.minorEnd,r.rowEnd=t?e.minorEnd:e.majorEnd,r}var Ia={majorStart:0,majorEnd:0,minorStart:0,minorEnd:0};function La(e,t){return e[0]-t[0]}var Ra=class{constructor(t,n){this._isColumn=!0,this._isReverse=!1,this._skipMajors=!1,this._majorMin=2**53-1,this._majorMax=-(2**53-1),this._minorMin=2**53-1,this._minorMax=-(2**53-1),this._majorIndex=-(2**53-1),this._minorIndex=-(2**53-1),this._delegateMajorIndex=-(2**53-1),this._delegateMinorIndex=-(2**53-1),this._delegate=t;let r=(n.axis??e.N.Column)===e.N.Column;this._isColumn=r,this._isReverse=n.reverse??!1,this._skipMajors=n.skipMajors??!1;let i=n.bounds,a=i.colStart,o=i.rowStart,s=i.colEnd,c=i.rowEnd;this._majorMin=r?a:o,this._majorMax=r?s:c,this._minorMin=r?o:a,this._minorMax=r?c:s,this._processMajorSkip=r?n.processColumnSkip:n.processRowSkip,this._processMinorSkip=r?n.processRowSkip:n.processColumnSkip;let l=t.next();this._delegateResult=l,this._initialize()}_initialize(){let e=this._isColumn,t=this._isReverse,n=t?-1:1,r=t?this._majorMax:this._majorMin,i=(t?this._minorMax:this._minorMin)-n,a=this._processMinorSkip;a&&(i=a(i,t));let o=this._processMajorSkip;o&&(r=o(r,t)),this._majorIndex=r,this._minorIndex=i;let s=this._delegateResult;if(s.done)this._delegateMajorIndex=this._majorMax,this._delegateMinorIndex=this._minorMax+n;else{let t=s.value[0];this._delegateMajorIndex=e?t.colIndex:t.rowIndex,this._delegateMinorIndex=e?t.rowIndex:t.colIndex}}next(e){e!==void 0&&(this._delegateResult=this._delegate.next(e),this._initialize());let t=this._isReverse,n=this._isColumn,r=this._majorMin,i=this._majorMax,a=this._majorIndex,o=this._minorIndex;if(a>i||a<r)return ei;let s=this._delegateMajorIndex,c=this._delegateMinorIndex,l=this._delegateResult.done;if(a===s&&o===c){let e=this._delegate.next();if(this._delegateResult=e,l=e.done,l)s=t?r:i,s=t?this._minorMin:this._minorMax;else{let t=e.value[0];s=n?t.colIndex:t.rowIndex,c=n?t.rowIndex:t.colIndex}this._delegateMajorIndex=s,this._delegateMinorIndex=c}let u=t?-1:1;if(this._minorIndex=o+=u,a===s&&o===c&&!l)return this._delegateResult;let d=this._processMinorSkip;if(d&&(o=d(o,t)),o>this._minorMax||o<this._minorMin){a+=u;let e=this._processMajorSkip;e&&(a=e(a,t)),this._skipMajors&&(!t&&a<s||t&&a>s)&&(a=s),this._majorIndex=a,o=t?this._minorMax:this._minorMin}return this._minorIndex=o,a!==s||o!==c||l?a>i||a<r?ei:{done:!1,value:[{colIndex:n?a:o,rowIndex:n?o:a},void 0]}:this._delegateResult}return(e){return null}throw(e){return null}[Symbol.iterator](){return this}},za=class{constructor(t){this._isColumn=!0,this._majorSize=2**53-1,this._minorSize=2**53-1,this._majorMin=2**53-1,this._majorMax=-(2**53-1),this._minorMin=2**53-1,this._minorMax=-(2**53-1),this._majorIndex=2**53-1,this._minorIndex=2**53-1,this._minorOffset=0,this._minorRepeat=0,this._majorOffset=-1,this._majorRepeat=1,this._pattern=[];let n=t.delegate;this._delegate=n;let r=(t.axis??e.N.Column)===e.N.Column;this._isColumn=r;let i=t.dims,a=t.bounds,o=a.colStart,s=a.rowStart,c=a.colEnd,l=a.rowEnd;if(this._majorSize=1+(r?c-o:l-s),this._minorSize=1+(r?l-s:c-o),this._majorMin=r?o:s,this._minorMin=r?s:o,this._majorMax=(r?o+i.major:s+i.major)-1,this._minorMax=(r?s+i.minor:o+i.minor)-1,this._majorSize>this._majorMax+1||this._minorSize>this._minorMax+1)throw Error(`The dimensions must be larger than the bounds.`);let u=n.next();this._nextDelegateResult=u,this._initialize()}_initialize(){let e=this._isColumn,t=this._nextDelegateResult;if(t.done)this._nextResult=ei;else{let n=t.value[0],r=e?n.colIndex:n.rowIndex,i=e?n.rowIndex:n.colIndex,a=[[i,t.value[1]]];this._minorSpan=a,this._majorIndex=r,this._minorIndex=i,this._pattern.push([r,a]),this._nextResult=t}}next(t){if(t!==void 0)throw new e.y;let n=this._nextResult,r=this._isColumn,i=this._majorIndex,a=this._nextDelegateResult;if(!a.done){let e=a.value[0];if((r?e.colIndex:e.rowIndex)===i&&(a=this._delegate.next(),this._nextDelegateResult=a,!a.done)){let e=a.value,t=e[0],o=r?t.colIndex:t.rowIndex,s=r?t.rowIndex:t.colIndex;if(o===i)return this._minorSpan.push([s,e[1]]),this._minorOffset=this._minorSpan.length-1,this._minorIndex=s,this._nextResult=a,n}}let o=this._minorMax,s=this._minorIndex;if(s<o){let e=this._minorOffset;e++;let t=this._minorSpan;e>=t.length&&(e=0,this._minorRepeat++);let a=t[e],c=this._minorMin;if(s=c+(a[0]-c+this._minorSize*this._minorRepeat),this._minorIndex=s,this._minorOffset=e,s<=o){let e=[{colIndex:r?i:s,rowIndex:r?s:i},a[1]];return this._nextResult={done:!1,value:e},n}}if(!a.done){let e=a.value,t=e[0],i=r?t.colIndex:t.rowIndex,o=r?t.rowIndex:t.colIndex,s=[[o,e[1]]];return this._pattern.push([i,s]),this._majorIndex=i,this._minorSpan=s,this._minorOffset=0,this._minorIndex=o,this._minorRepeat=0,this._nextResult=a,n}let c=this._majorMax;if(i<c){let e=this._majorOffset;e++;let t=this._pattern;e>=t.length&&(e=0,this._majorRepeat++);let a=t[e],o=a[1],l=o[0],u=this._majorMin;if(i=u+(a[0]-u+this._majorSize*this._majorRepeat),this._majorIndex=i,this._majorOffset=e,i<=c){this._minorSpan=o,this._minorOffset=0,s=l[0],this._minorIndex=s,this._minorRepeat=0;let e=[{colIndex:r?i:s,rowIndex:r?s:i},l[1]];return this._nextResult={done:!1,value:e},n}}return n.done||(this._nextResult=ei),n}return(e){return null}throw(e){return null}[Symbol.iterator](){return this}},Ba=class{constructor(t,n,r){this._comparator=t?.comparator??e.l.createCellComparator(t.axis??e.N.Column,t.reverse??!1),this._iterator1=n,this._iterator2=r;let i=n.next();this._nextResult1=i;let a=r.next();this._nextResult2=a,t?.reuseResult&&(!0===t.reuseResult?this._reuseResult={done:!1,value:[void 0,void 0,void 0,void 0]}:this._reuseResult=t.reuseResult)}next(e){let t=this._nextResult1,n=this._nextResult2;if(t.done&&n.done)return t;if(t.done){let e=n;this._nextResult2=this._iterator2.next();let t=this._reuseResult??{done:!1,value:[void 0,void 0,void 0,void 0]};t.done=!1;let r=t.value,i=e.value;return r[2]=i[0],r[3]=i[1],r[0]=void 0,r[1]=void 0,t}if(n.done){let e=t;this._nextResult1=this._iterator1.next();let n=this._reuseResult??{done:!1,value:[void 0,void 0,void 0,void 0]};n.done=!1;let r=n.value,i=e.value;return r[0]=i[0],r[1]=i[1],r[2]=void 0,r[3]=void 0,n}let r=(0,this._comparator)(t.value[0],n.value[0]);if(r<0){let e=t;this._nextResult1=this._iterator1.next();let n=this._reuseResult??{done:!1,value:[void 0,void 0,void 0,void 0]};n.done=!1;let r=n.value,i=e.value;return r[0]=i[0],r[1]=i[1],r[2]=void 0,r[3]=void 0,n}if(r>0){let e=n;this._nextResult2=this._iterator2.next();let t=this._reuseResult??{done:!1,value:[void 0,void 0,void 0,void 0]};t.done=!1;let r=t.value,i=e.value;return r[2]=i[0],r[3]=i[1],r[0]=void 0,r[1]=void 0,t}this._nextResult1=this._iterator1.next(),this._nextResult2=this._iterator2.next();let i=this._reuseResult??{done:!1,value:[void 0,void 0,void 0,void 0]};i.done=!1;let a=i.value;return a[0]=t.value[0],a[1]=t.value[1],a[2]=n.value[0],a[3]=n.value[1],i}return(e){return null}throw(e){return null}[Symbol.iterator](){return this}},Va=`Must be an array of arrays.`;function Ha(e,t,n){let r=t.majorStart,i=t.minorStart,a=t.majorEnd,o=[],s=t.minorEnd-i+1,c=typeof e==`function`;for(let t=r;t<=a;t++){let r;if(c)if(r=[],n){let n=i;for(let i=0;i<s;i++)r.push(e(n++,t))}else{let n=i;for(let i=0;i<s;i++)r.push(e(t,n++))}else s<=Ja?(r=Array(s),r.fill(e,0,s)):r=new Li([e],s);let a=[[i,r]];o.push([t,a])}return{tuples:o,bounds:t}}function Ua(t,n=!1,r=null,i=!1){let a=0,o=0,s=2**53-1,c=2**53-1;if(r&&(a=r.majorStart??0,o=r.minorStart??0,s=(r.majorEnd??2**53-1)-a+1,c=(r.minorEnd??2**53-1)-o+1),n){let e=a;a=o,o=e;let t=s;s=c,c=t}if(!Array.isArray(t))throw Error(Va);if(t.length>s)throw new e.C;let l=n?new ri.TransposedBuilder:new ri.Builder;for(let n=0;n<t.length;n++){let r=t[n];if(r!=null&&r.length!==0){if(!Array.isArray(r))throw Error(Va);if(r.length>c)throw new e.C;if(i){let e=-1;for(let t=0;t<r.length;t++)r[t]==null?e!==-1&&(l.pushMultipleAt(n+a,o+e,r.slice(e,t)),e=-1):e===-1&&(e=t);e!==-1&&l.pushMultipleAt(n+a,o+e,r.slice(e))}else l.pushMultipleAt(n+a,o,r)}}return l.build()}var Wa=(e,t,n)=>{if(e===t)return t},Ga=(e,t,n)=>{if(e[0].value===e[1].value)return t},Ka=[null,null];function qa(t=!0,n=Wa){let r,i,a=[],o=-(2**53-1),s=-(2**53-1);return{append:(e,c,l)=>{let u=!0;if(l!==void 0){let e=i===void 0?l:n(i,l,t);e===void 0?u=!1:l=e}if(u&&c===s+1&&e===o)return t?r.rowEnd=c:r.colEnd=c,s=c,void(i=l);r&&a.push(r);let d=t?e:c,f=t?c:e;r={colStart:d,rowStart:f,colEnd:d,rowEnd:f,value:l},o=e,s=c,i=l},done:(n=!1)=>(r&&=(a.push(r),null),n?Ea(a,t?e.N.Column:e.N.Row,2,Ga,Ka):a)}}var Ja=4,Ya=class t{constructor(t){this._dataCoords=null,this._count=0,this._isColumn=!0,this._lastMajor=-(2**53-1),this._lastMinorSpan=null,this._maxCoords=void 0,this._isShared=!1,this._options={axis:e.N.Row,...t},this._isColumn=(this._options?.axis??e.N.Column)===e.N.Column,t?.maxCoords&&(this._maxCoords=Object.freeze({colStart:Math.max(0,t.maxCoords.colStart??0),rowStart:Math.max(0,t.maxCoords.rowStart??0),colEnd:Math.min(2**53-1,t.maxCoords.colEnd??2**53-1),rowEnd:Math.min(2**53-1,t.maxCoords.rowEnd??2**53-1)})),this._createRun=t?.createRun??(e=>new ii(e)),this._optionsMinor={},this._major=new Ci({nodeSize:Xa})}getRuns(e){let t=this._isColumn,n=this._maxCoords,r=this.getCoords();if(!r)return ti;let i,a,o=e?.bounds;if(o){let s=Pa(o?.colStart??-(2**53-1),o?.rowStart??-(2**53-1),o?.colEnd??2**53-1,o?.rowEnd??2**53-1,t,n,r);if(!s)return ti;i={bounds:{min:s.majorStart,max:s.majorEnd}},a={bounds:{min:s.minorStart,max:s.minorEnd},overflowRun:e?.overflowRun}}let s,c,l,u,d=this._major.entries(i);do{if(s=d.next(),s.done)return ti;c=s.value[1],l=c.runs(a),u=l.next()}while(u.done);let f=s.value[0],p=u.value[0].min,m=u.value[1];return{[Symbol.iterator](){return this},next(){if(s.done)return ei;let e={done:!1,value:[f,p,m]};for(u=l.next();u.done&&!s.done;)s=d.next(),s.done||(f=s.value[0],c=s.value[1],l=c.runs(a),u=l.next());return u.done||(p=u.value[0].min,m=u.value[1]),e}}}getAxis(){return this._isColumn?e.N.Column:e.N.Row}entries(t){let n=this._isColumn,r=n,i=!0,a=this._maxCoords,o=this.getCoords(),s=Pa(-(2**53-1),-(2**53-1),2**53-1,2**53-1,n,a,o??void 0);if(!s)return ti;let c,l,u,d=s.majorStart,f=s.majorEnd,p=s.minorStart,m=s.minorEnd,h=!1;if(t){t?.axis&&(r=t?.axis===e.N.Column,i=n===r);let s=t?.bounds;if(s){let e=Pa(s.colStart,s.rowStart,s.colEnd,s.rowEnd,n,a,o??void 0);if(!e)return ti;d=e.majorStart,f=e.majorEnd,p=e.minorStart,m=e.minorEnd}h=t.reverse??!1,u=function(e){if(typeof e==`boolean`){if(!0===e)return{done:!1,value:[{colIndex:-1,rowIndex:-1},null]}}else if(e)return e}(t.reuseResult),c=n?t.processColumnSkip:t.processRowSkip,c&&(h?f=c(f,h):d=c(d,h)),l=n?t.processRowSkip:t.processColumnSkip,l&&(h?m=l(f,h):p=l(p,h))}if(!o)return ti;i||d!==f||(i=!0),to.bounds.min=d,to.bounds.max=f,to.reverse=h,to.processSkip=c,to.reuseResult=$a;let g=this._major.entries(to),_=no(),v=e=>{if(!e.nextActive)return;let t=t=>{let n=e.nextMinorIndex,r=e.nextMinorValue,i=e.nextActive;return t?(e.nextMinorIndex=t[0],e.nextMinorValue=t[1],e.nextActive=!0):(e.nextActive=!1,e.nextMinorIndex=h?-(2**53-1):2**53-1,e.nextMinorValue=null),e.value=r,e.minorIndex=n,e.active=i,Za[0]=e.majorIndex,Za[1]=n,Za[2]=r,Za},n=e.minorIterator;if(!n)return t();let r=n.next();return r.done&&(e.minorIterator=null),t(r.value)},y=e=>{if(g)for(;;){let t=g.next();if(t.done)return void(g=void 0);let n=t.value,r=n[1];e.majorIndex=n[0],e.active=!0,e.nextActive=!1,eo.bounds.min=p,eo.bounds.max=m,eo.reverse=h,eo.processSkip=l,eo.reuseResult=Qa;let i=r.entries(eo),a=i.next();if(!a.done){let t=a.value;return e.nextMinorIndex=t[0],e.nextMinorValue=t[1],e.minorIterator=i,e.nextActive=!0,v(e)}}},b=null;if(i)b=()=>{let e;return e=v(_),e||(e=y(_),e||void 0)};else{let e,t=h?m:p,n=h?p:m,r=t,i=n,a=!0,o=()=>{let t=_.nextMajorCursor;if(t)return _=t,_;_=e,(r<p||r>m||r===i)&&(_=null),r=i,i=n};b=()=>{for(;_;){let s=null;if(a){let n=e?no():_;if(s=y(n),s){e?(n.prevMajorCursor=_,_.nextMajorCursor=n,_=n):e=_,i=h?Math.max(i,_.nextMinorIndex):Math.min(i,_.nextMinorIndex);let r=_.minorIndex;r!==t&&(i=h?Math.max(i,r):Math.min(i,r),s=null)}else a=!1,o()}else{let t=_.minorIndex,a=_.nextMinorIndex;t===r?(Za[0]=_.majorIndex,Za[1]=t,Za[2]=_.value,s=Za):!h&&t>r||h&&t<r?i=h?Math.max(i,t):Math.min(i,t):!h&&a>r||h&&a<r?i=h?Math.max(i,a):Math.min(i,a):s=v(_),_.active&&(i=h?Math.max(i,_.nextMinorIndex):Math.min(i,_.nextMinorIndex)),n===r||_.active||(_.prevMajorCursor?_.prevMajorCursor.nextMajorCursor=_.nextMajorCursor:e=_.nextMajorCursor,_.nextMajorCursor&&(_.nextMajorCursor.prevMajorCursor=_.prevMajorCursor)),o()}if(s)return s}}}return{next(t){if(t)throw new e.y(`Iterator with next argument is not supported.`);let r=b();return r?function(e,t,n,r,i){let a=i??{done:!1,value:[{colIndex:-1,rowIndex:-1},null]},o=a.value,s=o[0];return s.colIndex=r?e:t,s.rowIndex=r?t:e,o[1]=n,a}(r[0],r[1],r[2],n,u):ei},[Symbol.iterator](){return this},return:e=>null,throw:e=>null}}values(e){let t,n=this.entries(e);return e?.reuseResult&&(t=!0===e.reuseResult?{done:!1,value:null}:e.reuseResult),{next(e){let r=n.next(e);return r.done?ei:t?(t.value=r.value[1],t):{done:!1,value:r.value[1]}},[Symbol.iterator](){return this},return:e=>null,throw:e=>null}}keys(e){let t,n=this.entries(e);return e?.reuseResult&&(t=!0===e.reuseResult?{done:!1,value:null}:e.reuseResult),{next(e){let r=n.next(e);return r.done?ei:t?(t.value=r.value[0],t):{done:!1,value:r.value[0]}},[Symbol.iterator](){return this},return:e=>null,throw:e=>null}}_updateMajorSpan(e,t=!1){if(!e||e.length===0)return;t&&e.sort((e,t)=>e[0]-t[0]);let n=this._major,r=e[0],i=r[0],a=i,o=[r[1]];for(let t=1;t<e.length;t++){let r=e[t],s=r[0],c=r[1];s===a+1?o.push(c):(n.setRunAt(i,new ii(o)),i=s,o=[c]),a=s}o.length>0&&n.setRunAt(i,new ii(o))}setValues(t){if(!t)throw new e.O;if(t.length===0)return this;let n=(t=t.sort(La))[0][0],r=t[t.length-1][0],i=-(2**53-1),a=2**53-1,o=this._isColumn,s=this._maxCoords;if(s){let t=o?s.colStart:s.rowStart,c=o?s.colEnd:s.rowEnd;if(n<t||r>c)throw new e.C;i=o?s.rowStart:s.colStart,a=o?s.rowEnd:s.colEnd}if(!t||t.length===0)return this;let c=2**53-1,l=-(2**53-1),u=0,d=n-1,f=[],p=(t,n,r)=>{if(d===r)throw new ri.OutOfOrderError(`Duplicate major Indices: {${r}}.`);d=r,n=n.sort(La),t=t.clone();let o=-(2**53-1),s=n.length;for(let d=0;d<s;d++){let s=n[d],f=s[0],p=s[1],h=f+p.length-1;if(o>=f)throw new ri.OutOfOrderError(`Overlapping minor Indices: {${r}, ${f}}.`);if(f<i||h>a)throw new e.C;if(p&&p.length>0){let e=t.getCount();t.setRunAt(f,m(p));let n=t.getCount();u+=n-e,c=Math.min(c,t.getCoords().min),l=Math.max(l,t.getCoords().max)}o=h}g++,f.push([r,t])},m=this._createRun,h=this._optionsMinor,g=0,_=()=>{let e=t[g],n=e[0],r=e[1],i=new Ci(h);p(i,r,n)},v=this._major;to.bounds.min=n,to.bounds.max=r,to.reverse=!1,to.processSkip=null,to.reuseResult=$a;let y=v.entries(to),b=y.next();for(;!b.done;){let e=b.value,n=e[0],r=t[g],i=r[0];if(i>n)b=y.next();else{for(;i<n;)_(),r=t[g],i=r[0];if(i===n){let t=r[1],i=e[1];p(i,t,n)}b=y.next()}}for(;t[g];)_();return this._updateMajorSpan(f),this._updateCountAndCoords(u,n,c,r,l),this}getValues(e){let t=this.getRuns(e?{bounds:e}:void 0),n=t.next();if(n.done)return null;let r=new ri.Builder;for(;!n.done;){let e=n.value[0],i=n.value[1],a=n.value[2];r.pushMultipleAt(e,i,a),n=t.next()}return r.build()}_updateCountAndCoords(e,t,n,r,i,a=!1){let o=this._count+e;if(this._count=o,this._lastMajor=-(2**53-1),!this._dataCoords)return;let s=this._isColumn,c=s?t:n,l=s?n:t,u=s?r:i,d=s?i:r;if(o===0)this._dataCoords=null;else{let e=this._dataCoords;e&&(c=(a?Math.max:Math.min)(c,e.colStart),l=(a?Math.max:Math.min)(l,e.rowStart),u=(a?Math.min:Math.max)(u,e.colEnd),d=(a?Math.min:Math.max)(d,e.rowEnd));let t={colStart:c,rowStart:l,colEnd:u,rowEnd:d};this._dataCoords=t}}clear(){this._major.clear(),this._dataCoords=null,this._count=0,this._lastMajor=-(2**53-1)}delete(t){let n=this._count;if(!t)return this.clear(),n>0;let r=this._isColumn,i=this._maxCoords,a=this.getCoords(),o=Pa(t.colStart,t.rowStart,t.colEnd,t.rowEnd,r,i,a);if(!o||n===0)return!1;if(e.l.isRangeWithinRange(a,t))return this.clear(),n>0;let s=o.majorStart,c=o.majorEnd,l=o.minorStart,u=o.minorEnd,d=r?a.colStart:a.rowStart,f=r?a.colEnd:a.rowEnd,p=r?a.rowStart:a.colStart,m=r?a.rowEnd:a.colEnd,h=!1,g=0,_=this._major;if(this._lastMajor=-(2**53-1),l<=p&&u>=m){to.bounds.min=s,to.bounds.max=c;let e=_.entries(to),t=e.next();for(;!t.done;)g-=t.value[1].getCount(),t=e.next();return _.delete(s,c-s+1),this._count+=g,this._dataCoords=null,g!==0}let v=[],y=this._isShared,b=[];to.bounds.min=s,to.bounds.max=c,eo.reverse=!1,eo.processSkip=null,eo.reuseResult=$a;let x=_.entries(to),S=x.next();for(;!S.done;){let e=S.value,t=e[0],n=e[1],r=n.getCoords(),i=r.min,a=r.max;if(l<=i&&u>=i||l<=a&&u<=a)if((i===p&&l<=p||a===m&&u>=m)&&(h=!0),i>=l&&a<=u)v.push(t),g-=n.getCount();else{let e=n.getCount();y&&(n=n.clone(),b.push([t,n])),n.delete(l,u-l+1),g+=n.getCount()-e}S=x.next()}this._updateMajorSpan(b);let C=v.length;if(C>0){let e=Wr(v,!0);for(let t=0;t<e.length;t++){let n=e[t];_.delete(n.min,n.max-n.min+1)}let t=_.getCoords();if(!t)return this.clear(),!0;d=t.min,f=t.max}return h?(this._count+=g,this._dataCoords=null,!0):C===0?(this._count+=g,g!==0):(this._updateCountAndCoords(g,d,p,f,m,!0),g!==0)}shift(t,n){if(!t||!n)throw new e.O;let r=this._isColumn,i=this._maxCoords,a=n===e.i.Right||n===e.i.Down,o=n===e.i.Left||n===e.i.Right,s=Pa(t.colStart,t.rowStart,t.colEnd,t.rowEnd,r,i,t);if(!s)return!1;let c=s.majorStart,l=s.majorEnd,u=s.minorStart,d=s.minorEnd,f=this.getCoords();if(!f)return!1;let p=r?f.colStart:f.rowStart,m=r?f.colEnd:f.rowEnd,h=r?f.rowStart:f.colStart,g=r?f.rowEnd:f.colEnd,_=u<=h&&d>=g,v=r===o;if((v&&_||!v&&c<=p&&l>=m)&&!Pa(f.colStart,f.rowStart,f.colEnd+(a&&o?t.colEnd-t.colStart+1:0),f.rowEnd+(a&&!o?t.rowEnd-t.rowStart+1:0),r,i)||v&&c>m||!v&&u>g)return!1;let y=v?l-c+1:d-u+1;if(!a&&(y*=-1,e.l.isRangeWithinRange(f,t)))return this.clear(),!0;let b=0,x=this._major,S=[];if(to.bounds.min=c,to.bounds.max=v?2**53-1:l,eo.reverse=!a,eo.processSkip=null,eo.reuseResult=$a,v&&_){if(!a){to.bounds.max=l;let e=x.entries(to),t=e.next();for(;!t.done;)b-=t.value[1].getCount(),t=e.next()}x.shift(c,y);let e=x.getCoords();return this._dataCoords=null,this._updateCountAndCoords(b,e?.min??0,h,e?.max??0,g),!0}let C=r?f.colStart:f.rowStart,w=r?f.colEnd:f.rowEnd,T=r?f.rowStart:f.colStart,E=r?f.rowEnd:f.colEnd;a||(T=2**53-1,E=-(2**53-1));let D=2**53-1;i&&(D=o?i.colEnd:i.rowEnd);let O=new Set,k=v?new Map:null,A=[],j=x.entries(to),M={bounds:{min:u,max:d}},N=j.next();for(;!N.done;){let t=N.value,n=t[0],r=t[1].clone(),i=r.getCoords(),a=i.min,o=i.max;if(v&&k.set(n,r),u<=o){let t=r.getCount();v?(n>=c-y&&Zr(r.runs(M),(e,t)=>{let r=t.min,i=t.max,a=e;r-1<=d&&i>d&&(a=a.slice(0,d+1-r)),r<u&&i+1>=u&&(a=a.slice(u-r)),A.push({majorIndex:n+y,minorIndex:Math.max(r,u),run:a})}),r.delete(u,d-u+1)):r.shift(u,y);let i=r.getCount();if(i===0)O.add(n),T=Math.min(T,o),E=Math.max(E,a);else{let t=r.getCoords();if(T=Math.min(T,t.min),E=Math.max(E,t.max),E>D)throw new e.C}b+=i-t,S.push([n,r])}N=j.next()}let P=this._optionsMinor,F=!1;for(let e=0;e<A.length;e++){let t=A[e],n=t.majorIndex,r=t.run,i=k.get(n);i||(i=new Ci(P),k.set(n,i),S.push([n,i]),F=!0),i.setRunAt(t.minorIndex,r),b+=r.length,C=Math.min(C,n),w=Math.max(w,n),O&&O.delete(n)}if(this._updateMajorSpan(S,F),O&&O.size>0){let e=Wr(Array.from(O.values()));for(let t=0;t<e.length;t++){let n=e[t];x.delete(n.min,n.max-n.min+1)}let t=x.getCoords();if(!t)return this.clear(),!0;C=t.min,w=t.max}if(E!==g||T!==h)return this._count+=b,this._dataCoords=null,!0;{let e=this._count+b;this._count=e,this._dataCoords=e===0?null:Object.freeze({colStart:r?C:T,rowStart:r?T:C,colEnd:r?w:E,rowEnd:r?E:w})}return b!==0||!e.l.isEqualRanges(f,this.getCoords())}getCount(){return this._count}getValueAt(e,t){let n,r=this._isColumn,i=r?t:e,a=r?e:t,o=this._lastMajor;if(o===i&&o!==-(2**53-1)?n=this._lastMinorSpan:(n=this._major.at(i),this._lastMajor=i,this._lastMinorSpan=n),n)return n.at(a)}setValueAt(e,t,n){let r=this._isColumn,i=[r?t:e,[[r?e:t,[n]]]];this.setValues([i])}copyTo(t,n,r){if(this.getCount()===0)return;let i=this.getAxis(),a=t.getAxis(),o=this.getRuns({bounds:r}),s=o.next(),c=e.l.cellToRange(n);c.colEnd=r.colEnd-r.colStart+n.colIndex,c.rowEnd=r.rowEnd-r.rowStart+n.rowIndex;let l,u=this._isColumn,d=this._maxCoords,f=this.getCoords(),p=Pa(r.colStart??-(2**53-1),r.rowStart??-(2**53-1),r.colEnd??2**53-1,r.rowEnd??2**53-1,u,d,f);p={...p};let m=a!==e.N.Row,h=t.getMaxCoords()??void 0;l=Pa(c?.colStart??-(2**53-1),c?.rowStart??-(2**53-1),c?.colEnd??2**53-1,c?.rowEnd??2**53-1,m,h),l={...l};let g=u?r.colStart:r.rowStart,_=u?r.rowStart:r.colStart,v=l.majorStart-(g??p.majorStart),y=l.minorStart-(_??p.minorStart),b=i===a?new ri.Builder:new ri.TransposedBuilder;for(;!s.done;){let e=s.value[0],t=s.value[1],n=s.value[2];t+n.length>p.minorEnd&&(n=n.slice(0,p.minorEnd-t+1)),t<p.minorStart&&(n=n.slice(p.minorStart-t),t=p.minorStart),b.pushMultipleAt(e+v,t+y,n),s=o.next()}let x=b.build();t.delete(c),x&&t.setValues(x.tuples)}getCoords(){if(this._dataCoords)return this._dataCoords;if(this._major.getCount()===0)return null;let e=2**53-1,t=-(2**53-1),n=2**53-1,r=-(2**53-1),i=this._major.entries(),a=i.next();for(;!a.done;){let o=a.value,s=o[0];e=Math.min(s,e),t=Math.max(s,t);let c=o[1].getCoords();n=Math.min(c.min,n),r=Math.max(c.max,r),a=i.next()}let o=this._isColumn,s=Object.freeze({colStart:o?e:n,rowStart:o?n:e,colEnd:o?t:r,rowEnd:o?r:t});return this._dataCoords=s,s}clone(e){this._isShared=!0;let n=new t(this._options);return n._isShared=!0,n._major=this._major.clone(),n._dataCoords=this._dataCoords,n._count=this._count,n}cloneEmpty(e){return new t(this._options)}getMaxCoords(){return this._maxCoords||null}get[Symbol.toStringTag](){let e=``,t=this.getCoords();if(t){let n=t.colEnd-t.colStart+1,r=t.rowEnd-t.rowStart+1;e=`${this.getCount()}-${this._isColumn?n:r}x${this._isColumn?r:n}`}return`[SparseGrid:${e}]`}};Ya||={};var Xa=12;Object.seal({done:!1,value:null});var Za=[-1,-1,null],Qa=Object.seal({done:!1,value:[-1,null]}),$a=Object.seal({done:!1,value:[-1,null]}),eo={bounds:{min:-1,max:-1},reverse:!1,processSkip:null,reuseResult:Qa},to={bounds:{min:-1,max:-1},reverse:!1,processSkip:null,reuseResult:$a},no=()=>({majorIndex:-1,minorIndex:-1,value:null,active:!1,nextMinorIndex:-1,nextActive:!1,nextMinorValue:null,minorIterator:null,nextMajorCursor:null,prevMajorCursor:null}),ro=class t{constructor(e){this._mapScopeTo2Ds=new Map,this._last2DKey=void 0,this._last2DMap=void 0,this._options=e,this._options2D=e;let t=e?.updateEntryOptions?.onUpdates;t&&(this._options2D={...e},this._options2D.updateEntryOptions={...e.updateEntryOptions},this._options2D.updateEntryOptions.onUpdates=(e,n,r)=>{t(e,n,this)})}all3D(e){e||=[];let t=e.length,n=this._mapScopeTo2Ds;for(let[r,i]of n){i.all(e);let n=e.length;for(let i=t;i<n;i++){let t=e[i];t.scope||(t={...t},t.scope=r,e[i]=t)}t=n}return e}getSpatialAt(e){if(e===this._last2DKey)return this._last2DMap;let t=this._mapScopeTo2Ds.get(e);return this._last2DKey=e,this._last2DMap=t,t}getScopeEntries(){return this._mapScopeTo2Ds.entries()}getScopeKeys(){return this._mapScopeTo2Ds.keys()}getScopeValues(){return this._mapScopeTo2Ds.values()}getBoundingRange(){throw Error(io)}isEmpty(){for(let e of this._mapScopeTo2Ds.values())if(!e.isEmpty())return!1;return!0}search(t,n=!1,r=!1,i){return t.scope,this.getSpatialAt(t.scope)?.search(t,n,r,i)??e.A.EmptyArray}has(e){return e.scope,this.getSpatialAt(e.scope)?.has(e)??!1}shift(e){let t=this.getSpatialAt(e?.range?.scope),n=t?.shift(e),r=this;return n!==t&&(r=this.clone(),r._mapScopeTo2Ds.set(this._last2DKey,n)),r}insertNonOverlapping(e,t){return this._getOrCreate2D(e.scope)?.insertNonOverlapping(e,t),this}createCopiedEntries(t,n,r,i,a){!t.scope||n.scope;let o=t.scope,s=this.getSpatialAt(o)?.createCopiedEntries(t,n,r,i,a)??{inserts:e.A.EmptyArray,removes:e.A.EmptyArray},c=s.inserts,l=c?c.length:0;for(let e=0;e<l;e++){let t=c[e];t.scope||=o}let u=s.removes,d=u?u.length:0;for(let e=0;e<d;e++){let t=u[e];t.scope||=o}return s}remove(e,t){e.scope;let n=this.getSpatialAt(e.scope);return n?.remove(e,t),this._cleanupEmpty2D(this._last2DKey,n),this}removeAll(e,t){let n=e?e.length:0;if(n===0)return this;let r,i,a=new Map;for(let t=0;t<n;t++){let n=e[t],o=n.scope;o!==r&&(r=o,i=a.get(o),i||a.set(o,i=[])),i.push(n)}for(let[e,n]of a){let r=this.getSpatialAt(e);r&&(r.removeAll(n,t),this._cleanupEmpty2D(e,r))}return this}insert(e){return this._getOrCreate2D(e.scope).insert(e),this}load(e){let t=e?e.length:0;if(t===0)return this;let n,r,i=new Map;for(let a=0;a<t;a++){let t=e[a],o=t.scope;if(!o)throw Error(ao);o!==n&&(n=o,r=i.get(o),r||i.set(o,r=[])),r.push(t)}for(let[e,t]of i)this._getOrCreate2D(e).load(t);return this}delete(e){if(!e)throw Error(io);let t=this.getSpatialAt(e?.scope);return t?.delete(e),this._cleanupEmpty2D(this._last2DKey,t),this}clone(e=null){let t=this._createClone(this._options),n=new Map;for(let[t,r]of this._mapScopeTo2Ds)n.set(t,r.clone(e));return t._mapScopeTo2Ds=n,t}_getOrCreate2D(e){if(!e)throw Error(ao);let t=this._mapScopeTo2Ds.get(e);return t||(t=new va(this._options2D),this._mapScopeTo2Ds.set(e,t),this._last2DKey=e,this._last2DMap=t),t}_cleanupEmpty2D(e,t){t?.isEmpty()&&(this._mapScopeTo2Ds.delete(e),this._last2DKey===e&&(this._last2DKey=void 0,this._last2DMap=void 0))}_createClone(e){return new t(e)}},io=`Not supported on SpatialMap3D`,ao=`SpatialMap3D: a valid scope key is required`;function oo(t){let n=t??e.d.getActive(),r=e.d.getPacks(t).filter(po),i=mo.get(n);if(i&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(i.packs,r))return i.merged;let a=function(e,t){if(t.length===0)return;let n,r,i={},a={},o=[],s=!1,c=!1;for(let e of t)e.functions&&(Object.assign(i,e.functions),s=!0),e.errors&&(Object.assign(a,e.errors),c=!0),e.booleans&&(n={...n??{},...e.booleans}),e.specifiers&&(r={...r??{},...e.specifiers}),e.functionHelp&&o.push(e.functionHelp);let l={tag:e};return s&&(l.functions=i),c&&(l.errors=a),n&&(l.booleans=n),r&&(l.specifiers=r),o.length===1?l.functionHelp=o[0]:o.length>1&&(l.functionHelp=()=>Promise.all(o.map(e=>e())).then(e=>Object.assign({},...e.map(e=>e&&typeof e==`object`&&`default`in e?e.default:e)))),l}(n,r);return mo.set(n,{packs:r,merged:a}),a}var so={};for(let[e,t]of Object.entries(n.a.Code))so[t]=e;function co(e,t){let n=oo(t)?.booleans;return e?n?.true??`TRUE`:n?.false??`FALSE`}function lo(e,t){let r=e?.getLabel?.()??n.a.Label.Unknown,i=e?.getCode?.(),a=i===void 0?void 0:so[i];return(a&&oo(t)?.errors?.[a])??r}function uo(e,t){let n=e.toUpperCase();if(n===`TRUE`)return!0;if(n===`FALSE`)return!1;let r=oo(t)?.booleans;if(r){if(r.true&&n===r.true.toUpperCase())return!0;if(r.false&&n===r.false.toUpperCase())return!1}}function fo(e,t){let r=e.toUpperCase(),i=n.a.getBuiltInByLabel(r);if(i)return i;let a=oo(t)?.errors;if(a){for(let e in a)if(a[e]?.toUpperCase()===r)return n.a.BuiltIn[e]}}function po(e){return!!(e.functions&&Object.keys(e.functions).length>0||e.errors&&Object.keys(e.errors).length>0||e.booleans||e.specifiers||e.functionHelp)}var mo=new Map,ho={"condition.anySelector":`Any`,"condition.operator.after.title":`After`,"condition.operator.afterEqualTo.title":`After or On`,"condition.operator.and.desc":`Checks if all params are met`,"condition.operator.and.title":`And`,"condition.operator.average.desc":`Check if value is above or below the average`,"condition.operator.average.title":`Average`,"condition.operator.average.toString":`{dir, select, above{{eq, select, yes{Above or Equal} other{Above}}} other{{eq, select, yes{Below or Equal} other{Below}}}} Average{stdDevs, plural, =0{} one{ (# Std Dev)} other{ (# Std Devs)}}`,"condition.operator.before.title":`Before`,"condition.operator.beforeEqualTo.title":`Before or On`,"condition.operator.between.desc":`Check if value is between 2 numbers`,"condition.operator.between.title":`Between`,"condition.operator.between.toString":`Between {from} and {to}`,"condition.operator.blank.title":`Blank`,"condition.operator.color.desc":`Check if value has a specific color`,"condition.operator.color.title":`Color`,"condition.operator.equalTo.title":`Equal To`,"condition.operator.error.title":`Error`,"condition.operator.expression.desc":`Evaluates a formula expression against the value of the cell`,"condition.operator.expression.title":`Formula`,"condition.operator.greaterThan.title":`Greater Than`,"condition.operator.greaterThanEqualTo.title":`Greater Than or Equal To`,"condition.operator.icon.desc":`Check if value has a matching icon`,"condition.operator.icon.title":`Icon`,"condition.operator.inSet.dateGroups":`{title} {count, plural, one{# Date Group} other{# Date Groups}}`,"condition.operator.inSet.desc":`Check if value is in a list of items`,"condition.operator.inSet.items":`{title} {count, plural, one{# Item} other{# Items}}`,"condition.operator.inSet.title":`In`,"condition.operator.lessThan.title":`Less Than`,"condition.operator.lessThanEqualTo.title":`Less Than Or Equal To`,"condition.operator.not.desc":`Check if value does not meet a condition`,"condition.operator.not.title":`Not`,"condition.operator.not.toString":`{title} {condition}`,"condition.operator.or.desc":`Checks if any params are met`,"condition.operator.or.title":`Or`,"condition.operator.textContains.title":`Contains`,"condition.operator.textEmail.title":`Is Email`,"condition.operator.textEndsWith.title":`Ends With`,"condition.operator.textIsUrl.title":`Is URL`,"condition.operator.textStartsWith.title":`Starts With`,"condition.operator.timePeriod.desc":`Check if value falls within a time period`,"condition.operator.timePeriod.title":`Time Period`,"condition.operator.timePeriod.toString":`{title} {period}`,"condition.operator.titleWithParam":`{title} {param}`,"condition.operator.topN.desc":`Check if value is in the top or bottom N`,"condition.operator.topN.title":`Top N`,"condition.operator.topN.toString":`{edge, select, top{Top} other{Bottom}} {limit} {unit, select, percent{Percent} other{Items}}`,"condition.operator.unique.desc":`Check if value is unique`,"condition.operator.unique.title":`Unique`,"condition.selector.date.desc":`The date portion of a date time`,"condition.selector.date.title":`Date`,"condition.selector.dateTime.desc":`DateTime`,"condition.selector.dateTime.title":`Date Time`,"condition.selector.list.desc":`List`,"condition.selector.list.title":`List`,"condition.selector.logical.desc":`Logical`,"condition.selector.logical.title":`Logical`,"condition.selector.number.desc":`Number`,"condition.selector.number.title":`Number`,"condition.selector.ruleDescription":`{title} Rule`,"condition.selector.text.desc":`Text`,"condition.selector.text.title":`Text`,"condition.selector.textLength.desc":`The length of text`,"condition.selector.textLength.title":`Text Length`,"condition.selector.time.desc":`The time portion of a date time`,"condition.selector.time.title":`Time`,"condition.selector.whole.desc":`The whole portion of a number`,"condition.selector.whole.title":`Whole`,"condition.selectorWithOperator":`{selector}: {operator}`,"copy.columnCopy":`Column Copy`,"copy.columnHeaders":`Column Headers`,"copy.rowCopy":`Row Copy`,"copy.rowHeaders":`Row Headers`,"error.address.invalidAddress":`Invalid cell address: {address}`,"error.address.invalidAddressCoords":`Invalid cell address: invalid coords`,"error.address.invalidArguments":`Invalid arguments.`,"error.address.invalidCell":`Invalid cell.`,"error.address.invalidRange":`Invalid range. The Range must be at a size of at least 1x1.`,"error.address.invalidRangeAddress":`Invalid address. Can not parse ''{address}'' as an address or named item.`,"error.address.invalidRangeAddressAny":`Invalid address. Can not parse as an address or named item.`,"error.address.invalidRangeCoords":`Invalid range. All points must be valid integers.`,"error.address.invalidRangeEmpty":`Invalid range.`,"error.address.invalidRangeHeader":`Invalid header range.`,"error.address.invalidRangeInverted":`Invalid range. The Range must be specified as '{ TOP_LEFT:BOTTOM_RIGHT }'.`,"error.address.invalidRangeRelative":`Invalid address. Relative ranges as not allowed: {address}`,"error.address.noAddress":`Must specify an address.`,"error.address.noRange":`Must specify a range.`,"error.address.removeDuplicatesColumn":`Invalid column ''{column}''. The column must be within the range.`,"error.address.removeDuplicatesNoData":`Can not remove duplicates. The range does not contain any data.`,"error.address.singleCellOnly":`Only a single cell is allowed.`,"error.address.singleRangeOnly":`Only a single range is allowed for this operation.`,"error.address.singleRangeOnlyAlt":`Only a single range is allowed for this operation. Use ''getRanges'' instead.`,"error.address.textToColumnsMulti":`The range must be a single column range.`,"error.address.textToColumnsOverwrite":`The destination range has data.`,"error.anchor.protected":`Unable to {description}. The item is protected.`,"error.function.builtInName":`''{name}'' is a built-in function. Choose a different name.`,"error.hyperlink.invalidHyperlink":`Invalid hyperlink`,"error.model.modelClosed":`Model has been closed. No further operations are allowed.`,"error.model.nameRequired":`Name is required`,"error.named.containsSpaces":`Name must not contain any spaces.`,"error.named.invalidFirstChar":`First letter must be either a letter, an underscore, or a backslash.`,"error.named.invalidInvalidCellAddress":`Name can not be an address.`,"error.named.invalidSpecialRC":`Name can not be 'r' or 'c'.`,"error.named.invalidTrailingChar":`Name must be either letters, numbers, periods or underscores.`,"error.named.nameEmpty":`Name must be a non-empty string`,"error.named.nameExists":`Named item ''{name}'' already exists.`,"error.named.nameExistsInScope":`Named item ''{name}'' already exists in scope {scope}.`,"error.named.nameMaxLength":`Name must not exceed 255 characters.`,"error.named.nameReadonly":`Names are read-only.`,"error.named.templateRequired":`A template string must be specified.`,"error.protectedRange.noName":`Protected range must have a name.`,"error.protectedRange.uniqueName":`A protected range named ''{name}'' already exists.`,"error.sheet.addressInvalidScope":`When using addresses directly from the sheet do not include the sheet name.`,"error.sheet.autofillInvalidDestination":`AutoFill destination ({destination}) must extend or shrink the source range ({template}) in a single direction.`,"error.sheet.autofillMultiple":`When filling with merged cells the amount to fill must be a multiple of the input range [{modulus}].`,"error.sheet.autofillOverlapMerge":`Unable to partially fill over merged cells.`,"error.sheet.copyInvalidSource":`Unable to determine source.`,"error.sheet.copyMissingArgs":`Both a source and a destination are required to copy.`,"error.sheet.copyMultipleRanges":`Multiple selection ranges can not be copied.`,"error.sheet.copyNoSource":`The source has no range.`,"error.sheet.deleteOverlapping":`We can't delete cells with overlapping selections.`,"error.sheet.emptyView":`View can not be empty.`,"error.sheet.insertCopyMultipleRanges":`Only a single selection is supported when using 'Insert Copy'.`,"error.sheet.insertCutOverlap":`When pasting before or after the cut area both areas must align.`,"error.sheet.insertItemOob":`We can't insert cells because this would push items off the end of the worksheet.`,"error.sheet.insertItemProtected":`We can't insert items. The sheet is protected.`,"error.sheet.insertMergeThrough":`We can't insert through merges. Unmerge and try again.`,"error.sheet.insertOob":`We can't insert cells because this would push values off the end of the worksheet. These cells may appear empty but they have some formatting or formulas. Delete enough rows or columns and try again.`,"error.sheet.insertOobFreeze":`We can't insert cells because this would push the frozen panes off the end of the worksheet. Unfreeze the panes and try again.`,"error.sheet.insertOverlapping":`We can't insert cells with overlapping selections.`,"error.sheet.invalidCellType":`Invalid cell type: {type}. See documentation for information on valid built in cell types and creating custom cell types.`,"error.sheet.invalidScopedRangeAddress":`Invalid sheet address. Can not parse ''{address}'' as a sheet address or items scope to ''{scope}''. Sheet address must not include the sheet name.`,"error.sheet.invalidScopedRangeArguments":`Invalid sheet address. Can not parse arguments as a sheet address or items scope to ''{scope}''. Sheet address must not include the sheet name.`,"error.sheet.itemOverlapping":`We can't create a {type} that overlaps with another table or merge.`,"error.sheet.iteratorClosed":`IteratorContext can only be used during visit.`,"error.sheet.listenerNull":`Listener can not be null`,"error.sheet.maxValues":`Unable to return more than {max} values. To access values in a more scalable solution use ''ICellRange.forEach'' or an iterator.`,"error.sheet.mergeMultipleValues":`Merging cells would cause some values to be discarded. Use 'discardMultipleValues' option if desired.`,"error.sheet.mergeOob":`We can't merge outside of the maximum cell location.`,"error.sheet.mergeOverlapping":`Overlapping ranges can not be merged.`,"error.sheet.modelClosed":`Sheet has been closed. No further operations are allowed.`,"error.sheet.modelDelete":`Unable to delete.`,"error.sheet.noImageProvided":`An image must be provided as a string or a resource option.`,"error.sheet.oobCell":`The cell is outside of the bounds of the range.`,"error.sheet.oobRange":`The range is outside of the bounds of the sheet.`,"error.sheet.paste":`Unable to paste: {message}`,"error.sheet.pasteOob":`We can't paste outside of the sheet bounds.`,"error.sheet.previewRange":`This range is an autoFill preview and cannot be modified. Run 'autoFill' without 'preview' to apply it.`,"error.sheet.protectedField":`Unable to {description}, this sheet is protected. To make a change, unprotect the sheet. You might be requested to enter a password.`,"error.sheet.protectedRangeLocked":`This range is protected with a password. Enter the password to make a change.`,"error.sheet.protectedSheet":`This sheet is protected. To make a change, unprotect the sheet. You might be requested to enter a password.`,"error.sheet.readonlyRange":`Readonly sheet`,"error.sheet.readonlySheet":`Unable to {description}, this sheet is readonly.`,"error.sheet.setValuesType":`'setValues' expects a 2d array; when working with a single value use 'setValue'.`,"error.sheet.setValueType":`'setValue' expects a single value; when working with an array use 'setValues'.`,"error.sheet.snapshotDone":`Unable to use a snapshot multiple times.`,"error.sheet.sortMergeSize":`Unable to sort merged cells unless they are all the same size.`,"error.sheet.table1By1":`A table must have a least two rows; one for the table header and one for data.`,"error.sheet.tableEmpty":`An autotable must have data to be created.`,"error.sheet.uniqueName":`Name must be unique: ''{name}'' is already in use.`,"error.sheet.unmergeOverlapping":`We can't unmerge intersecting ranges.`,"error.sheet.unmergePartial":`We can't unmerge partial cells.`,"error.sheet.unsupportedFloatingType":`Unsupported float type: {type}`,"error.sheetHeader.protectedColumns":`The columns are protected. To make a change, unprotect the sheet. You might be requested to enter a password.`,"error.sheetHeader.protectedRows":`The rows are protected. To make a change, unprotect the sheet. You might be requested to enter a password.`,"error.sort.sortOobRange":`The sort offset is outside of the bounds of the sort.`,"error.table.autoTableInvalidOperation":`That operation is not valid for an AutoTable.`,"error.table.tableBodyRows":`Select rows within the table body.`,"error.table.tableNoBody":`A table must have a least one row and one column for the data.`,"error.table.tableNoName":`Table must have a name.`,"error.table.tableRemoveHeader":`We can not remove rows that contain table headers. Remove the table header.`,"error.table.tableResizeInvalidBounds":`The top of the table must not change and the new table location must overlap with the original table.`,"error.table.tableSplit":`We can not partially insert or remove cells as this would split a table.`,"error.workbook.deleteKey":`Invalid reference for delete: {key}`,"error.workbook.invalidId":`Invalid id: {id}`,"error.workbook.invalidLocale":`Invalid locale: ''{locale}''. Expected a BCP 47 tag such as ''de-DE''.`,"error.workbook.invalidSheetKey":`Invalid SheetKey: {key}`,"error.workbook.modelClosed":`Workbook has been closed. No further operations are allowed.`,"error.workbook.nameDuplicate":`The sheet name ''{sheetName}'' already exist in workbook.`,"error.workbook.nameTaken":`That name is already taken. Try a different one.`,"error.workbook.notSetValue":`A value must be provided.`,"error.workbook.noVisibleRefs":`Internal error no visible sheetRefs`,"error.workbook.protection":`This workbook structure is protected. To make a change, unprotect the workbook. You might be requested to enter a password.`,"error.workbook.sheetIndexNotFound":`No sheet found at {index}.`,"error.workbook.sheetNameBlank":`A sheet name can not be blank.`,"error.workbook.sheetNameInvalidChars":`A sheet name can not contain any of the following characters '\\ , / , * , ? , : , [ , ]'.`,"error.workbook.sheetNameInvalidCharsNamed":`''{sheetName}'' can not contain any of the following characters '\\ , / , * , ? , : , [ , ]'.`,"error.workbook.sheetNameNotFound":`''{sheetName}'' not found.`,"error.workbook.sheetNameNotProvided":`Sheet name not provided. If you are trying to reference the active sheet, use getSelectedSheet() instead.`,"error.workbook.sheetNameQuotes":`A sheet name can not begin or end with a "'" (single quote).`,"error.workbook.sheetNameTooLong":`A sheet name can not be longer than 31 characters.`,"error.workbook.sheetOne":`A workbook must contain at least one visible worksheet.`,"movable.copySuffix":`{name} (Copy)`,"name.dataValidation":`Data Validation`,"op.addColumns":`Add Columns`,"op.addDataValidation":`Add Data Validation`,"op.addNamedFormulaNamed":`Add Named Formula ''{name}''`,"op.addProtectedRange":`Add Protected Range`,"op.addRangeListener":`Add Range Listener`,"op.addScript":`Add Script`,"op.addSheet":`Add Sheet`,"op.addSheetNamed":`Add Sheet ''{name}''`,"op.addTable":`Add Table`,"op.addTableColumn":`Add Table Column`,"op.addTableColumns":`Add Table Columns`,"op.addTableRow":`Add Table Row`,"op.addTableRows":`Add Table Rows`,"op.applyFilters":`Apply Filters`,"op.applySort":`Apply Sort`,"op.autoFill":`Auto Fill`,"op.autofit":`Autofit`,"op.autofitAll":`Autofit All`,"op.autofitColumns":`Autofit Columns`,"op.autofitRows":`Autofit Rows`,"op.clear":`Clear`,"op.clearAll":`Clear All`,"op.clearColumnHeaders":`Clear Column Headers`,"op.clearComments":`Clear Comments`,"op.clearFormats":`Clear Formats`,"op.clearFormulas":`Clear Formulas`,"op.clearHyperlinks":`Clear Hyperlinks`,"op.clearRowHeaders":`Clear Row Headers`,"op.clearSort":`Clear Sort`,"op.clearStyle":`Clear Style`,"op.clearValues":`Clear Values`,"op.closeTable":`Close Table`,"op.convertToRange":`Convert to Range`,"op.copyImageFromClipboard":`Copy Image from Clipboard`,"op.copyMovable":`Copy Movable`,"op.copyNamed":`Copy {name}`,"op.createAnchoredItem":`Create Anchored Item`,"op.createItem":`Create Item`,"op.createItemNamed":`Create Item ''{name}''`,"op.cutNamed":`Cut {name}`,"op.darkerPercent":`Darker {percent}%`,"op.delete":`Delete`,"op.deleteCells":`Delete Cells`,"op.deleteColumnNamed":`Delete Column ''{name}''`,"op.deleteColumns":`Delete Columns`,"op.deleteConditionalFormat":`Delete Conditional Format`,"op.deleteConditionalFormatNamed":`Delete Conditional Format ''{name}''`,"op.deleteDataValidation":`Delete Data Validation`,"op.deleteDataValidationNamed":`Delete Data Validation ''{name}''`,"op.deleteDrawing":`Delete Drawing`,"op.deleteFilter":`Delete Filter`,"op.deleteFilters":`Delete Filters`,"op.deleteModule":`Delete Module`,"op.deleteNamedItem":`Delete Named Item ''{name}''`,"op.deletePicture":`Delete Picture`,"op.deleteProtectedRange":`Delete Protected Range`,"op.deleteProtectedRangeNamed":`Delete Protected Range ''{name}''`,"op.deleteRows":`Delete Rows`,"op.deleteSheet":`Delete Sheet ''{name}''`,"op.deleteSorts":`Delete Sorts`,"op.deleteSortsAndFilters":`Delete Sorts and Filters`,"op.deleteTableColumn":`Delete Table Column`,"op.deleteTableColumns":`Delete Table Columns`,"op.deleteTableNamed":`Delete Table ''{name}''`,"op.deleteTableRow":`Delete Table Row`,"op.deleteTableRows":`Delete Table Rows`,"op.duplicateNamed":`Duplicate ''{name}''`,"op.filter":`Filter`,"op.filterColumn":`Filter {name}`,"op.filterTable":`Filter Table`,"op.hideBandedColumns":`Hide Banded Columns`,"op.hideBandedRows":`Hide Banded Rows`,"op.hideColumns":`Hide Columns`,"op.hideHeaders":`Hide Headers`,"op.hideHighlightFirstColumn":`Hide Highlight First Column`,"op.hideHighlightLastColumn":`Hide Highlight Last Column`,"op.hideRows":`Hide Rows`,"op.hideSheet":`Hide Sheet`,"op.hideTotals":`Hide Totals`,"op.initialize":`Initialize`,"op.initializeConditionalFormat":`Initialize Conditional Format`,"op.initializeDataValidation":`Initialize Data Validation`,"op.initializeProtectedRange":`Initialize Protected Range`,"op.initializeTable":`Initialize Table`,"op.insertAutoTable":`Insert AutoTable`,"op.insertCells":`Insert Cells`,"op.insertColumns":`Insert Columns`,"op.insertConditionalFormat":`Insert Conditional Format`,"op.insertCopiedCells":`Insert Copied Cells`,"op.insertDataValidation":`Insert Data Validation`,"op.insertDrawing":`Insert Drawing`,"op.insertImage":`Insert Image`,"op.insertProtectedRange":`Insert Protected Range`,"op.insertRows":`Insert Rows`,"op.insertTable":`Insert Table`,"op.lighterPercent":`Lighter {percent}%`,"op.loadMovable":`Load Movable`,"op.loadSheet":`Load Sheet`,"op.merge":`Merge`,"op.moveBackwards":`Move Backwards`,"op.moveForward":`Move Forward`,"op.moveSheetNamed":`Move Sheet ''{name}''`,"op.moveToBack":`Move to Back`,"op.moveToFront":`Move to Front`,"op.newSheet":`New Sheet`,"op.newWorkbook":`New Workbook`,"op.openWorkbook":`Open Workbook`,"op.paste":`Paste`,"op.pasteNamed":`Paste {name}`,"op.range":`Range`,"op.rangesUpdate":`Ranges Update`,"op.rangeUpdate":`Range Update`,"op.realizeCalcs":`Realize Calcs`,"op.refreshSortsAndFilters":`Refresh Sorts and Filters`,"op.removeDuplicates":`Remove Duplicates`,"op.removeNamedFormula":`Remove Named Formula`,"op.removePicture":`Remove Picture`,"op.removeRangeListener":`Remove Range Listener`,"op.removeScript":`Remove Script`,"op.renameSheet":`Rename Sheet`,"op.reorderConditionalFormat":`Reorder Conditional Format`,"op.reorderDataValidations":`Reorder Data Validations`,"op.reorderProtectedRange":`Reorder Protected Range`,"op.replace":`Replace`,"op.replaceAll":`Replace All`,"op.replaceAllWith":`Replace All with ''{value}''`,"op.replaceAt":`Replace {address}`,"op.replaceAtWith":`Replace {address} with ''{value}''`,"op.replaceWith":`Replace with ''{value}''`,"op.resizeColumns":`Resize Columns`,"op.resizeRows":`Resize Rows`,"op.resizeTable":`Resize Table`,"op.saveScripts":`Save Scripts`,"op.setAlertMessage":`Set Alert Message`,"op.setAlertStyle":`Set Alert Style`,"op.setAlertTitle":`Set Alert Title`,"op.setAlignment":`Set Alignment`,"op.setAngle":`Set Angle`,"op.setBackgroundColor":`Set Background Color`,"op.setBorder":`Set Border`,"op.setBottomBorder":`Set Bottom Border`,"op.setBottomBorderColor":`Set Bottom Border Color`,"op.setBottomBorderStyle":`Set Bottom Border Style`,"op.setCellAddress":`Set Cell {address}`,"op.setColumnName":`Set Column Name`,"op.setComment":`Set Comment`,"op.setComments":`Set Comments`,"op.setComputedValues":`Set Computed Values`,"op.setCondition":`Set Condition`,"op.setDiagonalDownBorder":`Set Diagonal Down Border`,"op.setDiagonalDownBorderColor":`Set Diagonal Down Border Color`,"op.setDiagonalDownBorderStyle":`Set Diagonal Down Border Style`,"op.setDiagonalUpBorder":`Set Diagonal Up Border`,"op.setDiagonalUpBorderColor":`Set Diagonal Up Border Color`,"op.setDiagonalUpBorderStyle":`Set Diagonal Up Border Style`,"op.setDisabledAutoExpand":`Set Disabled Auto Expand`,"op.setEntireSize":`Set Entire Size`,"op.setFill":`Set Fill`,"op.setFillColor":`Set Fill Color`,"op.setFillGradient":`Set Fill Gradient`,"op.setFillNone":`Set Fill None`,"op.setFillPattern":`Set Fill Pattern`,"op.setFillSolid":`Set Fill Solid`,"op.setFocus":`Set Focus`,"op.setFont":`Set Font`,"op.setFontBold":`Set Font Bold`,"op.setFontCharset":`Set Font Charset`,"op.setFontColor":`Set Font Color`,"op.setFontExtend":`Set Font Extend`,"op.setFontFallbacks":`Set Font Fallbacks`,"op.setFontFamily":`Set Font Family`,"op.setFontItalic":`Set Font Italic`,"op.setFontLetterSpacing":`Set Font Letter Spacing`,"op.setFontOutline":`Set Font Outline`,"op.setFontScheme":`Set Font Scheme`,"op.setFontShadow":`Set Font Shadow`,"op.setFontSize":`Set Font Size`,"op.setFontStrike":`Set Font Strike`,"op.setFontStyle":`Set Font Style`,"op.setFontUnderline":`Set Font Underline`,"op.setFontVerticalAlignment":`Set Font Vertical Alignment`,"op.setFontWeight":`Set Font Weight`,"op.setForegroundColor":`Set Foreground Color`,"op.setGradientType":`Set Gradient Type`,"op.setHidden":`Set Hidden`,"op.setHiddenButtons":`Set Hidden Buttons`,"op.setHideDropdown":`Set Hide Dropdown`,"op.setHorizontalAlignment":`Set Horizontal Alignment`,"op.setHorizontalBorder":`Set Horizontal Border`,"op.setHorizontalBorderColor":`Set Horizontal Border Color`,"op.setHorizontalBorderStyle":`Set Horizontal Border Style`,"op.setHyperlink":`Set Hyperlink`,"op.setIncludeBlanks":`Set Include Blanks`,"op.setIndent":`Set Indent`,"op.setIndex":`Set Index`,"op.setJustifyLastLine":`Set Justify Last Line`,"op.setLeftBorder":`Set Left Border`,"op.setLeftBorderColor":`Set Left Border Color`,"op.setLeftBorderStyle":`Set Left Border Style`,"op.setLockAspectRatio":`Set Lock Aspect Ratio`,"op.setMovableBounds":`Set Movable Bounds`,"op.setMovableDescription":`Set Movable Description`,"op.setMovableName":`Set Movable Name`,"op.setMovableResizeBehavior":`Set Movable Resize Behavior`,"op.setMovableRotation":`Set Movable Rotation`,"op.setMovableVisibility":`Set Movable Visibility`,"op.setName":`Set Name`,"op.setNamedStyle":`Set Named Style`,"op.setNumberFormat":`Set Number Format`,"op.setOutlineBorder":`Set Outline Border`,"op.setOverflow":`Set Overflow`,"op.setPatternType":`Set Pattern Type`,"op.setPicture":`Set Picture`,"op.setPromptMessage":`Set Prompt Message`,"op.setPromptTitle":`Set Prompt Title`,"op.setProtectedRangeName":`Set Protected Range Name`,"op.setProtectedRangePassword":`Set Protected Range Password`,"op.setProtectedRangePermissions":`Set Protected Range Permissions`,"op.setQuotePrefix":`Set Quote Prefix`,"op.setRangeAddress":`Set Range {address}`,"op.setRanges":`Set Ranges`,"op.setReadingDirection":`Set Reading Direction`,"op.setRelativeIndent":`Set Relative Indent`,"op.setRightBorder":`Set Right Border`,"op.setRightBorderColor":`Set Right Border Color`,"op.setRightBorderStyle":`Set Right Border Style`,"op.setRotation":`Set Rotation`,"op.setShowErrorMessage":`Set Show Error Message`,"op.setShowPromptMessage":`Set Show Prompt Message`,"op.setStacked":`Set Stacked`,"op.setStopFalse":`Clear Stop If True`,"op.setStops":`Set Stops`,"op.setStopTrue":`Set Stop If True`,"op.setTableDescription":`Set Table Description`,"op.setTableName":`Set Table Name`,"op.setTableNameNamed":`Set Table Name ''{name}''`,"op.setTopBorder":`Set Top Border`,"op.setTopBorderColor":`Set Top Border Color`,"op.setTopBorderStyle":`Set Top Border Style`,"op.setTotalsRowFormula":`Set Totals Row Formula`,"op.setTotalsRowLabel":`Set Totals Row Label`,"op.setValue":`Set Value`,"op.setValueAddress":`Set Value {address}`,"op.setValuesAddress":`Set Values {address}`,"op.setVerticalAlignment":`Set Vertical Alignment`,"op.setVerticalBorder":`Set Vertical Border`,"op.setVerticalBorderColor":`Set Vertical Border Color`,"op.setVerticalBorderStyle":`Set Vertical Border Style`,"op.shiftingMovableBounds":`Shifting Movable Bounds`,"op.showBandedColumns":`Show Banded Columns`,"op.showBandedRows":`Show Banded Rows`,"op.showHeaders":`Show Headers`,"op.showHighlightFirstColumn":`Show Highlight First Column`,"op.showHighlightLastColumn":`Show Highlight Last Column`,"op.showTotals":`Show Totals`,"op.sortAscending":`Sort Ascending`,"op.sortColumn":`Sort {name}`,"op.sortDescending":`Sort Descending`,"op.sortTable":`Sort Table`,"op.syncColumnsFromSheet":`Sync Columns From Sheet`,"op.syncColumnsToSheet":`Sync Columns To Sheet`,"op.tableAutoExpansion":`Table Auto Expansion`,"op.textToColumns":`Text to Columns`,"op.unhideColumns":`Unhide Columns`,"op.unhideRows":`Unhide Rows`,"op.unhideSheet":`Unhide Sheet`,"op.unmerge":`Unmerge`,"op.update":`Update`,"op.updateAnchor":`Update Anchor`,"op.updateCalculations":`Update Calculations`,"op.updateCells":`Update Cells`,"op.updateColumnNamed":`Update Column ''{name}''`,"op.updateColumns":`Update Columns`,"op.updateColumnsFromSheet":`Update Columns From Sheet`,"op.updateColumnsRange":`Update Columns {range}`,"op.updateConditionalFormat":`Update Conditional Format`,"op.updateConditionalFormatListener":`Update Conditional Format Listener`,"op.updateDataValidation":`Update Data Validation`,"op.updateDataValidationListener":`Update Data Validation Listener`,"op.updateDataValidations":`Update Data Validations`,"op.updateDrawing":`Update Drawing`,"op.updateFormulaAt":`Update Formula at {address}`,"op.updateHeader":`Update Header`,"op.updateListener":`Update Listener`,"op.updateMovableBounds":`Update Movable Bounds`,"op.updateMovables":`Update Movables`,"op.updateNamed":`Update Named ''{name}''`,"op.updateProtectedRange":`Update Protected Range`,"op.updateProtectedRanges":`Update Protected Ranges`,"op.updateReferenceStyle":`Update Reference Style`,"op.updateReferenceStyleAt":`Update Reference Style at {address}`,"op.updateRows":`Update Rows`,"op.updateRowsRange":`Update Rows {range}`,"op.updateSheet":`Update Sheet`,"op.updateStyle":`Update Style`,"op.updateStyleInfo":`Update Style Info`,"op.updateWorkbook":`Update Workbook`,"op.updatingMovableBounds":`Updating Movable Bounds`,"op.veryHideSheet":`Very Hide Sheet`,"style.builtin.accent":`Accent{n}`,"style.builtin.accentTint":`{pct}% - Accent{n}`,"style.builtin.bad":`Bad`,"style.builtin.calculation":`Calculation`,"style.builtin.checkCell":`Check Cell`,"style.builtin.comma":`Comma`,"style.builtin.comma0":`Comma [0]`,"style.builtin.currency":`Currency`,"style.builtin.currency0":`Currency [0]`,"style.builtin.explanatoryText":`Explanatory Text`,"style.builtin.followedHyperlink":`Followed Hyperlink`,"style.builtin.good":`Good`,"style.builtin.heading":`Heading {n}`,"style.builtin.hyperlink":`Hyperlink`,"style.builtin.input":`Input`,"style.builtin.linkedCell":`Linked Cell`,"style.builtin.neutral":`Neutral`,"style.builtin.normal":`Normal`,"style.builtin.note":`Note`,"style.builtin.output":`Output`,"style.builtin.percent":`Percent`,"style.builtin.title":`Title`,"style.builtin.total":`Total`,"style.builtin.warningText":`Warning Text`,"table.autoTableDescription":`AutoTable created for filtering and sorting`,"table.autoTableName":`AutoTable`,"table.defaultName":`Table{n}`,"table.emptyColumnName":`Column`,"table.totalsRowLabel":`Total`,"workbook.defaultSheetName":`Sheet{n}`};function go(){return e.n(`@sheetxl/sdk`,{}.url,ho)}var _o=(e,t,n,r=null)=>{let i=t||11*U.getDeviceScale(),a=r?.letterSpacing||0,o=e.length,s=.68*i*o-(e.match(/[il.,;!|]/g)||[]).length*i*.15+(e.match(/[mwMW]/g)||[]).length*i*.1+(o>0?(o-1)*a:0),c=Math.ceil(1.2*i),l=Math.ceil(.8*i),u=Math.ceil(.2*i),d=Math.ceil(.45*i),f=Math.ceil(1.1*i),p=Math.max(1,Math.ceil(.08*i));return{width:s,lineHeight:c,baseline:l,lineGap:u,strikePosition:d,underlinePosition:f,strikeThickness:p,underlineThickness:p,actualBoundingBoxLeft:0,actualBoundingBoxRight:s,actualBoundingBoxAscent:l,actualBoundingBoxDescent:c-l,fontBoundingBoxAscent:l,fontBoundingBoxDescent:c-l,emHeightAscent:l,emHeightDescent:c-l,hangingBaseline:.8*l,alphabeticBaseline:l,ideographicBaseline:c}},vo=t.r({CanvasFontMeasurer:()=>ko,getDeviceScale:()=>Po,getInstance:()=>No}),yo={},bo=` `,xo=`px `,So=(e,t)=>{let n=`normal`;return e&&t?n=`bold italic`:e?n=`bold`:t&&(n=`italic`),n},Co=e=>e.split(`,`).map(e=>{let t=(e=e.trim()).indexOf(` `)>=0,n=e.indexOf(`"`)>=0||e.indexOf(`'`)>=0;return t&&!n&&(e=`"${e}"`),e}).join(`, `),wo=new Map,To=new Map,Eo=.6,Do=null,Oo=(e,t,n,r,i,a)=>e+Math.round(100*t)/100+n+r+i+a;function ko(t,n,r,i=null){let a=i?.letterSpacing||0;typeof window>`u`||yo.contextMeasure||(yo.canvasMeasure=document?document.createElement(`canvas`):null,yo.contextMeasure=yo.canvasMeasure.getContext(`2d`),yo.contextMeasure.letterSpacing=`${a}px`,yo.contextMeasure.textRendering=`geometricPrecision`,yo.contextMeasure.textBaseline=`alphabetic`,yo.contextMeasure.textAlign=`left`);let o=r||`calibri`,s=n||11*U.getDeviceScale(),c=i?.isBold||!1,l=i?.isItalic||!1,u=null;if(t===`#`||t===`0`||t===`M`||t===``||t===`_`||t===`-`){u=Oo(t,s,o,c,l,a);let e=wo.get(u);if(e)return e}if(Do&&Do.text===t&&Do.size===n&&Do.family===r&&Do.options?.isBold===i?.isBold&&Do.options?.isItalic===i?.isItalic&&Do.options?.letterSpacing===i?.letterSpacing)return Do.metrics;let d={},f=So(c,l)+bo+e.A.roundAccurately(s,2)+xo+Co(o);yo.contextMeasure?(yo.contextMeasure.font=f,yo.contextMeasure.letterSpacing=`${i?.letterSpacing??0}px`,d=yo.contextMeasure.measureText(t)):d.width=t.length*e.A.roundAccurately(Eo*(s/U.getDeviceScale()),2);let p=To.get(f);if(!p&&typeof window<`u`){let t=document.createElement(`div`);t.style.visibility=`hidden`,t.style.position=`absolute`;let n=document.createElement(`span`);n.textContent=`Mj`,n.style.fontSize=`100px`,n.style.fontWeight=i?.isBold?`bold`:`normal`,n.style.fontStyle=i?.isItalic?`italic`:`normal`,n.style.fontFamily=`'${o}'`,n.style.lineHeight=`1.2`,t.appendChild(n),document.body.appendChild(t);let r=t.getBoundingClientRect(),a=n.getBoundingClientRect();document.body.removeChild(t),yo.contextMeasure.font=So(c,l)+bo+e.A.roundAccurately(100,2)+xo+Co(o);let u=yo.contextMeasure.measureText(`M`),d=r.bottom-r.top,m=d-(u.fontBoundingBoxAscent+u.fontBoundingBoxDescent),h=u.fontBoundingBoxAscent+a.top,g=yo.contextMeasure.measureText(`_`),_=h-g.actualBoundingBoxAscent,v=Math.max(1,Math.abs(g.actualBoundingBoxAscent+g.actualBoundingBoxDescent)),y=yo.contextMeasure.measureText(`-`),b=e.A.roundAccurately(h-y.actualBoundingBoxAscent+Math.max(1,.05*d,0)),x=v,S=s/100;p={lineHeight:Math.ceil(d*S),baseline:Math.ceil(h*S),lineGap:Math.ceil(m*S),strikePosition:Math.ceil(b*S),underlinePosition:Math.ceil(_*S),strikeThickness:Math.ceil(x*S),underlineThickness:Math.ceil(v*S)},yo.contextMeasure.font=f,To.set(f,p)}p||(p={lineHeight:Math.ceil(1.2*s),baseline:Math.ceil(s)+Math.floor(.1*s),lineGap:Math.ceil(.1*s),strikePosition:Math.ceil(.55*s)+Math.floor(.1*s),strikeThickness:1,underlinePosition:Math.ceil(1.1*s),underlineThickness:1},To.set(f,p));let m={...d,width:d.width,...p};return u!==null&&wo.set(u,m),Do={text:t,size:n,family:r,options:i,metrics:m},m}var U,Ao,W,jo,Mo=null;function No(){if(Mo)return Mo;try{let e=document.createElement(`canvas`),t=e.getContext&&e.getContext(`2d`);t&&typeof t.fillText==`function`&&(Mo=ko)}catch{}return Mo||=(console.warn(`⚠️ CanvasFontMeasurer not available, falling back to SimpleFontMeasurer`),_o),Mo}function Po(){return 96/72*1}var Fo,Io=null,Lo=vo;(Ao=U||={}).Style={Normal:`normal`,Italic:`italic`},Ao.Scheme={Major:`major`,Minor:`minor`,None:`none`},Ao.Charset={Ansi:0,Default:1,Symbol:2,Mac:77,ShiftJIS:128,Hangul:129,Johab:130,GB2312:134,ChineseBig5:136,Greek:161,Turkish:162,Vietnamese:163,Hebrew:177,Arabic:178,Baltic:186,Russian:204,Thai:222,EastEurope:238,Oem:255},Ao.UnderlineStyle={None:`none`,Double:`double`,DoubleAccounting:`doubleAccounting`,Single:`single`,SingleAccounting:`singleAccounting`},Ao.VerticalAlignment={Baseline:`baseline`,Sub:`sub`,Super:`super`},Ao.setSharedMeasurer=function(e){Io=e},Ao.getSharedMeasurer=function(){return Io||=Lo.getInstance()},Ao.getDeviceScale=function(){return Lo.getDeviceScale()},Ao.getPanoseFallback=function(e){let t=[],n=e.length;for(let r=0;r<n;r+=2)t.push(parseInt(e.substring(r,r+2),16));let r=t[0],i=t[1],a=t[3];switch(r){case 2:return a===9?`monospace`:i>=2&&i<=8?`serif`:`sans-serif`;case 3:return`cursive`;case 4:return`fantasy`;case 5:return`monospace`;default:return`sans-serif`}},Ao.GenericName={Serif:`serif`,SanSerif:`sans-serif`,MonoSpace:`monospace`,Cursive:`cursive`,Fantasy:`fantasy`,SystemUI:`system-ui`,UISystem:`ui-system`,UISerif:`ui-serif`,UISanSerif:`ui-sans-serif`,UIMonoSpace:`ui-monospace`,UIRounded:`ui-rounded`,Math:`math`,Emoji:`emoji`,Fangsong:`fangsong`},(jo=W||={}).StrokeStyle={None:`none`,DashDot:`dashDot`,MediumDashDot:`mediumDashDot`,Dotted:`dotted`,Hair:`hair`,Thin:`thin`,Medium:`medium`,Thick:`thick`,MediumDashDotDot:`mediumDashDotDot`,DashDotDot:`dashDotDot`,Dashed:`dashed`,MediumDashed:`mediumDashed`,SlantDashDot:`slantDashDot`,Double:`double`},jo.Edge={Left:`left`,Top:`top`,Right:`right`,Bottom:`bottom`,Horizontal:`horizontal`,Vertical:`vertical`,DiagonalUp:`diagonalUp`,DiagonalDown:`diagonalDown`};var Ro=[],zo=new Map,Bo=Object.freeze([[W.StrokeStyle.Thin,`Thin`,1,null],[W.StrokeStyle.Hair,`Hair`,1,[1,1]],[W.StrokeStyle.Dotted,`Dotted`,1,[2,2]],[W.StrokeStyle.Dashed,`Dashed`,1,[3,1]],[W.StrokeStyle.DashDot,`Dash Dot`,1,[3,3,9,3]],[W.StrokeStyle.DashDotDot,`Dash Dot Dot`,1,[3,3,3,3,9,3]],[W.StrokeStyle.Double,`Double`,3,null],[W.StrokeStyle.Medium,`Medium`,2,null],[W.StrokeStyle.MediumDashed,`Medium Dashed`,2,[9,3]],[W.StrokeStyle.MediumDashDot,`Medium Dash Dot`,2,[3,3,9,3]],[W.StrokeStyle.MediumDashDotDot,`Medium Dash Dot Dot`,2,[3,3,3,3,9,3]],[W.StrokeStyle.SlantDashDot,`Slant Dash Dot`,2,[5,1,11,1]],[W.StrokeStyle.Thick,`Thick`,3,null],[W.StrokeStyle.None,`None`,0,null]]);for(let e=0;e<Bo.length;e++){let t=Bo[e],n=t[0],r=Object.freeze({style:n,description:t[1],width:t[2],pattern:t[3]});Ro.push(r),zo.set(n,r)}(Fo=W||={}).isEqualStrokes=function(e,t){return!(e&&!t||t&&!e)&&(e===t||e.getStyle()===t.getStyle()&&e.getColor().isEqual(t.getColor()))},Fo.oppositeEdge=function(e){return e===W.Edge.Left?W.Edge.Right:e===W.Edge.Right?W.Edge.Left:e===W.Edge.Top?W.Edge.Bottom:e===W.Edge.Bottom?W.Edge.Top:e},Fo.BuiltInDefinitionsArray=Ro,Fo.BuiltInDefinitions=zo;var Vo,Ho=Object.freeze({ß:`ss`,ẞ:`SS`,æ:`ae`,Æ:`AE`,œ:`oe`,Œ:`OE`,þ:`th`,Þ:`TH`,ij:`ij`,IJ:`IJ`,ff:`ff`,fi:`fi`,fl:`fl`,ffi:`ffi`,ffl:`ffl`,st:`st`,LJ:`LJ`,Lj:`Lj`,lj:`lj`,NJ:`NJ`,Nj:`Nj`,nj:`nj`,DZ:`DZ`,Dz:`Dz`,dz:`dz`,ȸ:`db`}),Uo=/[ßẞæÆœŒþÞijIJff-fflstLJ-njDZ-dzȸ]/g;function Wo(e,t=!0){let n=e.replace(Uo,e=>Ho[e]);return t?n.toLowerCase():n}function Go(e){return e.toLowerCase()}var Ko,qo={Options:Object.freeze({sensitivity:`variant`,numeric:!1,ignorePunctuation:!1}),isCaseInsensitive:e=>{let t=e?.sensitivity;return t===void 0||t===`accent`||t===`base`},collator:e=>{let t=Jo.get(e);return t||(t=new Intl.Collator(e.tag,qo.Options),Jo.set(e,t)),t},collatorFor:(e,t)=>{let n=`${e}|${t?.numeric??``}|${t?.caseFirst??``}|${t?.ignorePunctuation??``}`,r=Yo.get(n);return r||(r=new Intl.Collator(e,{...qo.Options,...t,sensitivity:`variant`}),Yo.set(n,r)),r},compareTextWith:(e,t,n,r=!0)=>{if(e===t)return 0;let i=Wo(e,r),a=Wo(t,r),o=Zo(i),s=Zo(a);if(o===i&&s===a)return Qo(i,a,n);let c=Qo(o,s,n);return c===0?cs(i,a,n):c},compare:(e,t,n,r)=>{if(e==null){if(t==null)return 0;e=us(t)}else t??=us(e);let i=ls(e),a=ls(t);if(i!==a)return i<a?-1:1;switch(i){case 0:return ds(e,t);case 1:return qo.compareTextWith(e,t,r?qo.collatorFor(n.tag,r):qo.collator(n),qo.isCaseInsensitive(r));case 2:return e===t?0:e?1:-1;case 3:{let n=e.getCode(),r=t.getCode();return n===r?0:n<r?-1:1}default:return 0}}},Jo=new WeakMap,Yo=new Map,Xo=new Map([[39,1],[65287,2],[45,3],[65123,3],[65293,5],[8722,6],[8208,7],[8209,8],[8210,9],[8211,10],[8212,11],[65112,11],[8213,13],[700,14]]),Zo=e=>{let t=e.length,n=0;for(;n<t&&!Xo.has(e.charCodeAt(n));)n++;if(n===t)return e;let r=e.slice(0,n);for(;n<t;n++)Xo.has(e.charCodeAt(n))||(r+=e[n]);return r},Qo=(e,t,n)=>{let r=e.length<t.length?e.length:t.length,i=0;for(;i<r&&e.charCodeAt(i)===t.charCodeAt(i);)i++;if(i===r)return n.compare(e,t);let a=e.codePointAt(i),o=t.codePointAt(i);if(os(a)||os(o))return n.compare(e,t);let s=ns(a),c=ns(o);return s===c?s===2?n.compare(e,t):a<o?-1:1:s<c?-1:1},$o=new Set([43,60,61,62]),es=/[\p{P}\p{S}\p{Z}]/u,ts=/\p{Cf}/u,ns=e=>{if(e<128){let t=is[e];return t===void 0&&(t=is[e]=rs(e)),t}let t=as.get(e);return t===void 0&&(t=rs(e),as.set(e,t)),t},rs=e=>$o.has(e)?1:es.test(String.fromCodePoint(e))?0:2,is=Array(128),as=new Map,os=e=>{let t=ss.get(e);return t===void 0&&(t=e>=128&&ts.test(String.fromCodePoint(e)),ss.set(e,t)),t},ss=new Map,cs=(e,t,n)=>{let r=0,i=0;for(;r<e.length&&i<t.length;){let n=e.charCodeAt(r),a=t.charCodeAt(i),o=Xo.get(n),s=Xo.get(a);if(o===void 0!=(s===void 0))return o===void 0?-1:1;if(o!==void 0&&o!==s)return o<s?-1:1;r++,i++}return r<e.length?1:i<t.length?-1:0},ls=e=>{switch(typeof e){case`number`:return 0;case`string`:return 1;case`boolean`:return 2;default:return n.a.isError(e)?3:4}},us=e=>{switch(typeof e){case`string`:return``;case`boolean`:return!1;default:return 0}},ds=(e,t)=>{if(e===t)return 0;if(!Number.isFinite(e)||!Number.isFinite(t))return e<t?-1:+(e>t);let n=e-t;if(Math.abs(n)>1e-14*Math.max(Math.abs(e),Math.abs(t)))return n<0?-1:1;let r=fs(e),i=fs(t);return r===i?0:r<i?-1:1},fs=e=>Number(e.toPrecision(15));(function(e){e.CaseInsensitiveOptions={sensitivity:`accent`},e.CaseSensitiveOptions={sensitivity:`variant`};let t=e.NumberCollator=Object.freeze({type:n.n.Number,compare:(e,t,n)=>e<t?-1:1}),r=e.StringCollator=Object.freeze({type:n.n.String,compare:(e,t,n)=>qo.compareTextWith(e,t,qo.collatorFor(n?.locale??`en`,n),qo.isCaseInsensitive(n)),defaultOptions:Vo.CaseInsensitiveOptions}),i=e.ErrorCollator=Object.freeze({type:n.n.Error,compare:(e,t,n)=>e.getCode()-t.getCode()}),a=e.NullCollator=Object.freeze({type:n.n.Null,compare:(e,t,n)=>0}),o=e.RichDataCollator=Object.freeze({type:n.n.RichData,compare:(e,t,n)=>e.getType().localeCompare(t.getType(),n?.locale??`en`)}),s=e.BooleanCollator=Object.freeze({type:n.n.Boolean,compare:(e,t,n)=>!0===e?1:-1});e.DefaultRangeOptions=Object.freeze({hasHeader:!1,reverse:!1,includeHidden:!1,collatorOptions:Vo.CaseInsensitiveOptions,axis:n.l.Axis.Row}),e.DefaultCollators=Object.freeze([t,r,s,o,i,a])})(Vo||={});var G={General:`General`,Number:`Number`,Currency:`Currency`,Accounting:`Accounting`,ShortDate:`Short Date`,LongDate:`Long Date`,MediumDate:`Medium Date`,ShortTime:`Short Time`,MediumTime:`Medium Time`,LongTime:`Long Time`,Comma:`Comma`,Percentage:`Percentage`,Fraction:`Fraction`,Scientific:`Scientific`,Text:`Text`,Special:`Special`,Custom:`Custom`},ps=`\\s*([-]?[0-9e]*[.]?[0-9]+)`,ms=RegExp(`^rgb\\(${ps},${ps},${ps}\\)$`,`i`),hs=RegExp(`^rgba\\(${ps},${ps},${ps},${ps}\\)$`,`i`),gs=RegExp(`^lrgb\\(${ps},${ps},${ps}\\)$`,`i`),_s=RegExp(`^lrgba\\(${ps},${ps},${ps},${ps}\\)$`,`i`),vs=RegExp(`^hsl\\(${ps},${ps},${ps}\\)$`,`i`),ys=RegExp(`^hsla\\(${ps},${ps},${ps},${ps}\\)$`,`i`),bs=new RegExp(/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/),xs=new RegExp(/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/),Ss=RegExp(`^index(\\d+)$`,`i`),Cs=(e,t,n)=>[parseFloat(e),parseFloat(t),parseFloat(n)],ws=(e,t=255)=>{let n=[...e];for(var r=0;r<e.length;r++)n[r]=e[r]/t;return n},Ts=(e,t=255)=>{let n=[...e];for(var r=0;r<e.length;r++)n[r]=e[r]*t;return n},Es=(t,n=0)=>{let r=[...t];for(var i=0;i<t.length;i++)e.A.roundAccurately(t[i],n+8)%1==.5?r[i]=Math.floor(t[i]):r[i]=e.A.roundAccurately(t[i],n);return r},Ds=(e,t=!0)=>{let n=[...e],r=t?1:255;for(var i=0;i<e.length;i++)n[i]=Math.max(0,Math.min(r,e[i]));return n},Os=e=>Math.max(0,Math.min(1,e)),ks=e=>((e%=360)<0&&(e-=360),e),As=e=>{let t=[...e];for(var n=0;n<e.length;n++)t[n]=Ms(e[n]);return t},js=e=>{let t=[...e];for(var n=0;n<e.length;n++)t[n]=Ns(e[n]);return t},Ms=e=>e<.04045?e/12.92:((e+.055)/1.055)**2.4,Ns=e=>e<.0031308?12.92*e:1.055*e**(1/2.4)-.055,Ps=e=>{let t=e[0],n=e[1],r=e[2];t%=360,t/=360,n/=100,r/=100;let i=r<.5?r*(1+n):r+n-n*r,a=2*r-i;return[Math.max(0,Fs(a,i,t+1/3)),Math.max(0,Fs(a,i,t)),Math.max(0,Fs(a,i,t-1/3))]},Fs=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,6*n<1?e+6*(t-e)*n:2*n<1?t:3*n<2?e+6*(t-e)*(2/3-n):e),Is=e=>{let t=e[0],n=e[1],r=e[2],i=Math.min(t,Math.min(n,r)),a=Math.max(t,Math.max(n,r)),o=0;a===i?o=0:a===t?o=(60*(n-r)/(a-i)+360)%360:a===n?o=60*(r-t)/(a-i)+120:a===r&&(o=60*(t-n)/(a-i)+240);let s=(a+i)/2,c=0;return c=a===i?0:s<=.5?(a-i)/(a+i):(a-i)/(2-a-i),[o,100*c,100*s]},Ls=(e,t)=>{let n=t/100;return((e,t)=>{let n=As(e);n[0]=t(n[0],n),n[1]=t(n[1],n),n[2]=t(n[2],n);let r=js(n);return r=Ds(r),r})(e,(e,t)=>e*n)},Rs=2.55,zs=(t,n)=>{let r=Is(t),i=r[2];var a,o;r[2]=e.A.roundAccurately((a=i,(o=n)>0?(a*Rs*(1-o)+(255-255*(1-o)))/Rs:o<0?a*Rs*(1+o)/Rs:a),3);let s=Ps(r);return s=Ds(s),s},Bs=(e,t)=>{let n=As(e),r=t/100;for(var i=0;i<3;i++)n[i]=n[i]*r+(1-r);let a=js(n);return a=Ds(a),a},Vs=(e,t,n)=>{let r=Is(t),i=n/1;e===0&&(i=ks(n)),r[e]=i;let a=Ps(r);return a=Ds(a),a},Hs=(e,t,n)=>{let r=Is(t);if(e===0){let e=n/360;r[0]=360*(r[0]/360+e),r[0]%=360,r[0]<0&&(r[0]-=360)}else{let t=n/.1;r[e]=.1*(r[e]/.1+t)}let i=Ps(r);return i=Ds(i),i},Us=(e,t,n)=>{let r=Is(t),i=n/100;r[e]=r[e]*i,e===0&&(r[0]=ks(r[0]));let a=Ps(r);return a=Ds(a),a},Ws=(e,t,n,r)=>{let i=As(t),a=n/100;r===0?i[e]=a:r===1?i[e]+=a:r===2&&(i[e]*=a);let o=js(i);return o=Ds(o),o},Gs=e=>{let t=As(e),n=.213*t[0]+.715*t[1]+.072*t[2];t[0]=n,t[1]=n,t[2]=n;let r=js(t);return r=Ds(r),r},Ks=e=>{let t=Is(e);t[0]+=180,t[0]%=360,t[0]<0&&(t[0]-=360);let n=Ps(t);return n=Ds(n),n},qs=(e,t=!0)=>{let n=t?As(e):[...e],r=t?1:255;return n[0]=r-n[0],n[1]=r-n[1],n[2]=r-n[2],t&&(n=js(n)),n=Ds(n,t),n},Js=e=>{let t=[0,0,0];return t[0]=Ns(e[0]),t[1]=Ns(e[1]),t[2]=Ns(e[2]),Ds(t)},Ys=e=>{let t=[0,0,0];return t[0]=Ms(e[0]),t[1]=Ms(e[1]),t[2]=Ms(e[2]),Ds(t)},Xs=(e,t,n,r=null)=>{let i=e=>{let t=e.toString(16);return t.length===1?`0`+t:t};return(r===null?``:i(Math.round(255*r)))+i(Number(e)).toUpperCase()+i(Number(t)).toUpperCase()+i(Number(n)).toUpperCase()},Zs=.2126,Qs=.7152,$s=.0722;(function(e){e.RGBA=class{constructor(e,t,n,r=1){this._private={red:e,green:t,blue:n,alpha:r}}get red(){return this._private.red}get green(){return this._private.green}get blue(){return this._private.blue}get alpha(){return this._private.alpha??1}toString(e=!0){return e&&this._private.alpha!==null?`rgba(${this.red},${this.green},${this.blue},${this.alpha})`:`rgb(${this.red},${this.green},${this.blue})`}isEqual(e){return!!e&&e.red===this.red&&e.green===this.green&&e.blue===this.blue&&e.alpha===this.alpha}isAlmostEqual(e){if(!e)return!1;let t=1.5;return!(Math.abs(e.red-this.red)>t||Math.abs(e.green-this.green)>t||Math.abs(e.blue-this.blue)>t||Math.abs(e.alpha-this.alpha)>t)}},e.HSLA=class{constructor(e,t,n,r){this._private={hue:e,sat:t,lum:n,alpha:r}}get hue(){return this._private.hue}get sat(){return this._private.sat}get lum(){return this._private.lum}get alpha(){return this._private.alpha??1}toString(e=!0){return e&&this._private.alpha!==null?`hsla(${this.hue},${this.sat},${this.lum},${this.alpha})`:`hsl(${this.hue},${this.sat},${this.lum})`}isEqual(e){return!!e&&e.hue===this.hue&&e.sat===this.sat&&e.lum===this.lum&&e.alpha===this.alpha}isAlmostEqual(e){if(!e)return!1;let t=1.5;return!(Math.abs(e.hue-this.hue)>t||Math.abs(e.sat-this.sat)>t||Math.abs(e.lum-this.lum)>t||Math.abs(e.alpha-this.alpha)>t)}};class t extends Ko.RGBA{toString(e=!0){return e&&this._private.alpha!==null?`#`+Xs(this.red,this.green,this.blue,this.alpha??1).toUpperCase():`#`+Xs(this.red,this.green,this.blue).toUpperCase()}}e.HEX=t})(Ko||={});var ec=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,tc=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,nc=function(e){if(!e)return null;e=e.replace(ec,function(e,t,n,r){return t+t+n+n+r+r});let t=tc.exec(e);return t?new Ko.RGBA(parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)):null},rc=`000000.FFFFFF.FF0000.00FF00.0000FF.FFFF00.FF00FF.00FFFF.000000.FFFFFF.FF0000.00FF00.0000FF.FFFF00.FF00FF.00FFFF.800000.008000.000080.808000.800080.008080.C0C0C0.808080.9999FF.993366.FFFFCC.CCFFFF.660066.FF8080.0066CC.CCCCFF.000080.FF00FF.FFFF00.00FFFF.800080.800000.008080.0000FF.00CCFF.CCFFFF.CCFFCC.FFFF99.99CCFF.FF99CC.CC99FF.FFCC99.3366FF.33CCCC.99CC00.FFCC00.FF9900.FF6600.666699.969696.003366.339966.003300.333300.993300.993366.333399.333333`.split(`.`),ic=new Map;for(let e=0;e<rc.length;e++)ic.set(e,nc(rc[e]));function ac(e){return ic.get(e)??null}function oc(e){if(typeof e==`number`)return zn(e)??`General`;let t=_c[e];return t===void 0?e:typeof t==`number`?zn(t)??`General`:t}ic.set(-4105,null),ic.set(-4142,null),ic.set(64,nc(`000000`)),ic.set(65,nc(`FFFFFF`)),ic.set(81,nc(`FFFFFF`));var sc=Object.freeze({leap1900:!0,dateSpanLarge:!1,dateErrorThrows:!0,dateErrorNumber:!1,throws:!0,indexColors:!1}),cc=class{constructor(){this.key=`numfmt`}format(e,t,n){let r=n?.date1904??!1,i=n?.locale,a=e;if(_c[a]!==void 0&&(a=_c[a]),typeof t==`number`){let e=gc(a,t,{date1904:r,locale:i});if(e!==null)return{text:e.fmt,color:null,fills:null,skips:null}}typeof a==`number`&&(a=zn(a)??`General`);let o=this.isDateFormat(a)||this.isTimeFormat(a),s=t;if(o&&typeof s==`number`){if(s<0||s>2958465)return{text:null,color:null,fills:null,skips:null};r&&(s+=1462)}let c,l={...sc,locale:i},u=null,d=null;try{if(n?.placeholders){let e=In(a,s,{...l,nbsp:!0,skipChar:``,fillChar:``,digitChar:``}),t=``;for(let n=0;n<e.length;n++){let r=e[n];r===``||r===``?((d??=[]).push({offset:t.length,char:e[n+1]??` `}),n++):r===``?((u??=[]).push({offset:t.length,char:e[n+1]??` `}),n++):t+=r}c=t}else c=In(a,s,l)}catch(e){if(o&&this.isValidFormat(a))return{text:null,color:null,fills:null,skips:null};throw e}let f=null;if(n?.placeholders){let e=function(e,t,n){let r=Object.assign({},zt,n),i=Fn(e,r.throws);return function(e,t,n){let r=t.partitions,i=r[3],a=null;return typeof e!=`number`&&typeof e!=`bigint`||!isFinite(e)||(i=Cn(e,r)),i?.color&&(a=i.color),a&&typeof a==`number`&&n.indexColors&&(a=_t[a-1]||`#000`),a}(Kt(t,r)??t,i,r)}(a,s,l);e!=null&&(f=function(e){let t=null;if((e=e.toLowerCase()).startsWith(`color`)){let n=parseInt(e.substring(5));n>=0&&n<=56&&(t=`Index${n+7}`)}if(!t){let n=vc[e];n!==void 0&&(t=ac(n).toString())}return t}(typeof e==`number`?`color${e}`:String(e)))}return{text:c,color:f,fills:u,skips:d}}isDateFormat(e){return Dr(e)}isTimeFormat(e){return Or(e)}isFractionFormat(e){return bc(Bn(e))}adjustDecimalPlaces(e,t){return function(e,t){if(!e&&e!==0)return``;let n=Bn(e),r=(e,t)=>{let n=e||``,r=n.length,i=r===0||n.endsWith(`.`)?`0`:n.charAt(r-1);return t<0?(n=n.substring(0,Math.max(0,r+t)),n===`.`&&(n=``)):(n.startsWith(`.`)||(n+=`.`),n+=i.repeat(t)),n},i=(e,t)=>{if(e===`General`)return t>0?`0`+r(``,t):e;if(bc(e))return e;let n=e,i=-1,a=-1,o=n.indexOf(`E`);if(o>=0&&(n=n.substring(0,o)),i=n.indexOf(`.`),i>=0){n=n.substring(i,n.length);let t=n&&n.match(/([.]{1}[0,#]+)/);if(!t)return e;n=t[1],a=i+n.length}else{if(t<=0)return e;i=n.lastIndexOf(`0`),i<0&&(i=n.lastIndexOf(`#`)),i>=0&&(i+=1),a=i,n=``}return i===-1?e:(n=r(n,t),e.substring(0,i)+n+e.substring(a,e.length))},a=[],o=pc(n);for(let e=0;e<o.length;e++)a.push(i(o[e].trim(),t));return a.join(`;`)}(e,t)}getFormatInfo(e){try{return Ln(oc(e))}catch{return null}}getFormatDateInfo(e){try{let t=oc(e);return Ln(t).isDate?function(e){let t=Fn(e,!1);return t.dateInfo||=function(e){let[t]=e;return{year:!!(2&t.date),month:!!(4&t.date),day:!!(8&t.date),hours:!!(16&t.date),minutes:!!(32&t.date),seconds:!!(64&t.date),clockType:t.clock===12?12:24}}(t.partitions),t.dateInfo}(t):null}catch{return null}}isValidFormat(e){try{return function(e){try{return Fn(e,!0),!0}catch{return!1}}(oc(e))}catch{return!1}}},lc=null;function uc(){return lc??=new cc}var dc=/^\[\$-(.*?)\]/i,fc=1462;function pc(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`"`){for(n+=i,r++;r<e.length&&e[r]!==`"`;)n+=e[r++];r<e.length&&(n+=e[r])}else if(i===`[`){for(n+=i,r++;r<e.length&&e[r]!==`]`;)n+=e[r++];r<e.length&&(n+=e[r])}else i===`\\`?(n+=i,r+1<e.length&&(n+=e[++r])):i===`;`?(t.push(n),n=``):n+=i}return t.push(n),t}function mc(e,t,n){return In(zn(e)??`General`,n?.date1904?t+fc:t,{leap1900:!0,locale:n?.locale})}function hc(e,t,n,r){return gc(t,n,{...r,date1904:e?.isDate1904()??!1,locale:e?.getLocale()??void 0})}function gc(e,t,n){if(typeof t!=`number`||t>2958465||t<0)return null;let r=ur(t,n?.date1904??!1),i=n?.locale??`en-US`,a=!1,o=e,s=-1;if(typeof o==`number`)switch(o){case 14:o=new Intl.DateTimeFormat(i).format(r),a=!0;break;case 22:o=new Intl.DateTimeFormat(i).format(r)+` `+mc(20,t,n),a=!0}else{let e=dc.exec(o);if(e&&e[1]){let t=e[1].toUpperCase();t===`F800`?o=`Long Date`:t===`F400`&&(o=`Long Time`)}if((s=o.indexOf(`Short Date`))!==-1){let e=new Intl.DateTimeFormat(i).format(r);o=o.substring(0,s)+e+o.substring(s+10),a=!0}if((s=o.indexOf(`Medium Date`))!==-1){let e=mc(15,t,n);o=o.substring(0,s)+e+o.substring(s+11),a=!0}if((s=o.indexOf(`Long Date`))!==-1){let e=new Intl.DateTimeFormat(i,{dateStyle:`full`}).format(r);o=o.substring(0,s)+e+o.substring(s+9),a=!0}if((s=o.indexOf(`Short Time`))!==-1){let e=mc(20,t,n);o=o.substring(0,s)+e+o.substring(s+10),a=!0}if((s=o.indexOf(`Medium Time`))!==-1){let e=mc(18,t,n);o=o.substring(0,s)+e+o.substring(s+11),a=!0}if((s=o.indexOf(`Long Time`))!==-1){let e=new Intl.DateTimeFormat(i,{timeStyle:`medium`}).format(r);o=o.substring(0,s)+e+o.substring(s+9),a=!0}}return a?{fmt:o,date:r}:null}var _c=Object.freeze({"General Number":`General`,"General Date":`m/d/yyyy h:mm`,"Short Date":14,"Medium Date":15,"Long Date":`[$-F800]dddd\\,\\ mmmm\\ dd\\,\\ yyyy`,"Short Time":20,"Medium Time":18,"Long Time":`[$-F400]h:mm:ss\\ AM/PM;@`,"Short DateTime":22,Currency:`"$"#,##0.00_);[Red]\\("$"#,##0.00\\)`,Fixed:2,Standard:4,Percent:10,Scientific:11,"Yes/No":`"Yes";"Yes";"No";@`,"True/False":`"True";"True";"False";@`,"On/Off":`"Yes";"Yes";"No";@`}),vc=Object.freeze({black:0,white:1,red:2,green:3,blue:4,yellow:5,magenta:6,cyan:7}),yc=new Map;function bc(e){return!(!e.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/)&&!e.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))}yc.set(`=`,(e,t)=>e===t),yc.set(`<>`,(e,t)=>e!==t),yc.set(`>`,(e,t)=>e>t),yc.set(`<`,(e,t)=>e<t),yc.set(`>=`,(e,t)=>e>=t),yc.set(`<=`,(e,t)=>e<=t),Object.freeze({op:`>=`,comp:0}),Object.freeze({op:`<`,comp:0}),Object.freeze({op:`>`,comp:0}),Object.freeze({op:`=`,comp:0});var xc=Object.freeze({formatValue:function(e,t,n,r){return function(e,t,n){let r=!(!n||!n.onSpacingChar&&!n.onRepeatChar&&n.spacingCharacter===void 0),i=uc().format(e,t,{date1904:n?.date1904??!1,locale:n?.locale,placeholders:r});if(!r)return i.text??``;let a=i.skips??[],o=i.fills??[];if(n.onRepeatChar)for(let e of o)n.onRepeatChar(e.offset,e.char);let s=i.text??``;if(n.spacingCharacter!==``&&a.length){let e=``,t=0;for(let r=0;r<a.length;r++){let i=a[r];e+=s.slice(t,i.offset)+(n.spacingCharacter??` `),t=i.offset,n.onSpacingChar&&n.onSpacingChar(i.offset+r,i.char)}s=e+s.slice(t)}else if(n.onSpacingChar)for(let e of a)n.onSpacingChar(e.offset,e.char);return s}(t,n,{...r,date1904:e?.isDate1904()??!1,locale:e?.getLocale()??void 0})},isFractionFormat:e=>uc().isFractionFormat(e),adjustDecimalPlaces:(e,t)=>uc().adjustDecimalPlaces(e,t),getFormatInfo:e=>uc().getFormatInfo(e),getFormatDateInfo:e=>uc().getFormatDateInfo(e),isValidFormat:e=>uc().isValidFormat(e)});function Sc(e){return e===14?`Short Date`:Rn[e]??null}var Cc=[{numberFormat:`General`,formatType:G.General,primary:1},{numberFormat:`0`,formatType:G.Number,regMatch:/^0[.]{0,1}[0]*$/,args:{decimalPlaces:0,separator:!1}},{numberFormat:`#,##0.00`,formatType:G.Number,regMatch:/^#,##0[.]{0,1}[0]*$/,primary:2,args:{decimalPlaces:2,separator:!0}},{numberFormat:`#,##0_);(#,##0)`,formatType:G.Number,args:{decimalPlaces:0,separator:!0}},{numberFormat:`#,##0_);[Red](#,##0)`,formatType:G.Number,args:{decimalPlaces:0,separator:!0}},{numberFormat:`#,##0.00_);(#,##0.00)`,formatType:G.Number,args:{decimalPlaces:2,separator:!0}},{numberFormat:`#,##0.00_);[Red](#,##0.00)`,formatType:G.Number,args:{decimalPlaces:2,separator:!0}},{numberFormat:`$#,##0.00`,formatType:G.Currency,primary:3,args:{decimalPlaces:2,currencySymbol:`$`}},{numberFormat:`$#,##0_);($#,##0)`,formatType:G.Currency,args:{decimalPlaces:0,currencySymbol:`$`}},{numberFormat:`$#,##0_);[Red]($#,##0)`,formatType:G.Currency,args:{decimalPlaces:0,currencySymbol:`$`}},{numberFormat:`$#,##0.00_);($#,##0.00)`,formatType:G.Currency,args:{decimalPlaces:2,currencySymbol:`$`}},{numberFormat:`$#,##0.00_);[Red]($#,##0.00)`,formatType:G.Currency,args:{decimalPlaces:2,currencySymbol:`$`}},{numberFormat:`_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)`,primary:4,formatType:G.Accounting},{numberFormat:`_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)`,formatType:G.Accounting},{numberFormat:`_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)`,formatType:G.Accounting},{numberFormat:`_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)`,formatType:G.Accounting},{numberFormat:`Short Date`,formatType:G.ShortDate,primary:5},{numberFormat:`d-mmm-yy`,formatType:G.MediumDate,primary:5.5},{numberFormat:`Long Date`,formatType:G.LongDate,primary:6},{numberFormat:`h:mm`,formatType:G.ShortTime,primary:7},{numberFormat:`h:mm AM/PM`,formatType:G.MediumTime,primary:7.5},{numberFormat:`Long Time`,formatType:G.LongTime,primary:8},{numberFormat:`_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)`,formatType:G.Comma,primary:9},{numberFormat:`0.00%`,formatType:G.Percentage,primary:10,args:{decimalPlaces:2},regMatch:/^^[0#?]*[.]{0,1}[0#?]*%*$/},{numberFormat:`0%`,formatType:G.Percentage,args:{decimalPlaces:0}},{numberFormat:`# ?/?`,formatType:G.Fraction,primary:11},{numberFormat:`# ??/??`,formatType:G.Fraction},{numberFormat:`0.00E+00`,formatType:G.Scientific,primary:12,args:{decimalPlaces:2},regMatch:/^[0#?]*[.]{0,1}[0#?]*E\+[0#?]*$/},{numberFormat:`##0.0E+0`,formatType:G.Custom,args:{decimalPlaces:0}},{numberFormat:`@`,formatType:G.Text,primary:13},{numberFormat:`d-mmm`,formatType:G.Custom},{numberFormat:`mmm-yy`,formatType:G.Custom},{numberFormat:`h:mm:ss`,formatType:G.Custom},{numberFormat:`m/d/yyyy h:mm`,formatType:G.Custom},{numberFormat:`mm:ss`,formatType:G.Custom},{numberFormat:`mm:ss.0`,formatType:G.Custom},{numberFormat:`[h]:mm:ss`,formatType:G.Custom}],wc=[{numberFormat:`00000`,formatType:G.Special,primary:11},{numberFormat:`00000-0000`,formatType:G.Special},{numberFormat:`[<=9999999]###-####;(###) ###-####`,formatType:G.Special},{numberFormat:`000-00-0000`,formatType:G.Special}],Tc=[...Cc,...wc],Ec=new Map,Dc=[];for(let e=0;e<Cc.length;e++){let t=Cc[e].numberFormat.toLowerCase();Ec.set(t,Cc[e]),Cc[e].regMatch&&Dc.unshift(Cc[e])}for(let e=0;e<wc.length;e++){let t=wc[e].numberFormat.toLowerCase();Ec.set(t,wc[e])}var Oc=[],kc=new Map;Ec.forEach(function(t,n,r){t.primary&&(Oc.push(t),kc.set(e.A.textToKey(t.formatType),t.numberFormat))}),Oc.sort(function(e,t){return e.primary-t.primary});var Ac,jc,Mc,Nc=Ec.get(G.General.toLowerCase()),Pc=class{lookupStyle(e){if(!e)return Nc;if(typeof e==`number`&&(e=Sc(e)),!e.toLowerCase)return console.warn(`Invalid numberFormat`,e),Nc;e=e.toLowerCase();let t=Ec.get(e);if(t)return t;for(let n=0;!t&&n<Dc.length;n++)Dc[n].regMatch&&e.match(Dc[n].regMatch)&&(t=Dc[n]);return t||{numberFormat:e,formatType:G.Custom}}lookupPrimary(){return Oc}lookupByType(e){return Tc.filter(t=>t.formatType===e)}lookupDefault(t){return kc.get(e.A.textToKey(t))}},Fc=t.r({CATEGORIES:()=>Lc,CURRENCY_SYMBOLS:()=>Gc,DATE_PRESETS:()=>Kc,FRACTION_PRESETS:()=>Jc,NEGATIVE_STYLES:()=>Wc,SPECIAL_PRESETS:()=>Yc,TIME_PRESETS:()=>qc,build:()=>$c,defaultCodeForCategory:()=>Xc,isParametricCategory:()=>zc,parse:()=>nl}),Ic=new Pc,Lc=Object.freeze([`General`,`Number`,`Currency`,`Accounting`,`Date`,`Time`,`Percentage`,`Fraction`,`Scientific`,`Text`,`Special`,`Custom`]),Rc=new Set([`Number`,`Currency`,`Accounting`,`Percentage`,`Scientific`]);function zc(e){return Rc.has(e)}var Bc,Vc,Hc,Uc,Wc=Object.freeze([{key:`minus`,label:`Minus sign`,red:!1,parens:!1},{key:`red`,label:`Red`,red:!0,parens:!1},{key:`parens`,label:`Parentheses`,red:!1,parens:!0},{key:`redParens`,label:`Red parentheses`,red:!0,parens:!0}]),Gc=Object.freeze([`$`,`€`,`£`,`¥`,`₹`,`₩`,`₽`,`₺`,`R$`,`CHF`,`kr`,`฿`]),Kc=Object.freeze([`Short Date`,`Long Date`,`m/d/yyyy`,`d-mmm-yy`,`d-mmm`,`mmm-yy`,`mmmm d, yyyy`,`m/d/yy h:mm`]),qc=Object.freeze([`h:mm AM/PM`,`h:mm:ss AM/PM`,`h:mm`,`h:mm:ss`,`Long Time`,`[h]:mm:ss`,`mm:ss`,`mm:ss.0`]),Jc=Object.freeze([`# ?/?`,`# ??/??`,`# ???/???`,`# ?/2`,`# ?/4`,`# ?/8`,`# ??/16`,`# ?/10`,`# ??/100`]),Yc=Object.freeze([`00000`,`00000-0000`,`[<=9999999]###-####;(###) ###-####`,`000-00-0000`]);function Xc(e){switch(e){case`General`:case`Custom`:return`General`;case`Text`:return`@`;case`Number`:return $c({category:`Number`,decimalPlaces:2,useSeparator:!1,negativeStyle:0});case`Currency`:return $c({category:`Currency`,decimalPlaces:2,currencySymbol:`$`,negativeStyle:0});case`Accounting`:return $c({category:`Accounting`,decimalPlaces:2,currencySymbol:`$`});case`Percentage`:return`0.00%`;case`Scientific`:return`0.00E+00`;case`Date`:return Kc[0];case`Time`:return qc[0];case`Fraction`:return Jc[0];case`Special`:return Yc[0]}}function Zc(e){let t=e??`$`;return t===`$`?`$`:`"${t}"`}function Qc(e,t){let n=Wc[t??0]??Wc[0];return n.parens?n.red?`${e}_);[Red](${e})`:`${e}_);(${e})`:n.red?`${e};[Red]${e}`:e}function $c(e){let{category:t,decimalPlaces:n,useSeparator:r,currencySymbol:i,negativeStyle:a,code:o}=e,s=function(e){let t=Math.max(0,Math.min(30,e??0));return t>0?`.`+`0`.repeat(t):``}(n??0);switch(t){case`General`:return`General`;case`Text`:return`@`;case`Number`:return Qc((r?`#,##0`:`0`)+s,a);case`Currency`:return Qc(Zc(i)+`#,##0`+s,a);case`Accounting`:{let e=Zc(i);return`_(${e}* #,##0${s}_);_(${e}* (#,##0${s});_(${e}* ${(n??0)>0?`"-"`+`?`.repeat(n):`"-"`}_);_(@_)`}case`Percentage`:return`0`+s+`%`;case`Scientific`:return`0`+s+`E+00`;case`Date`:case`Time`:case`Fraction`:case`Special`:case`Custom`:return o||Xc(t)}}function el(e){let t=e.match(/\[\$([^\]-]+)(?:-[^\]]*)?\]/);if(t)return t[1];let n=e.match(/"([^"]+)"/);return n&&n[1]!==`-`?n[1]:(e.includes(`$`),`$`)}function tl(e){let t=pc(e);if(t.length<2)return 0;let n=t[1],r=/\[red\]/i.test(n);return n.includes(`(`)?r?3:2:+!!r}function nl(e){if(e==null||e===``)return{category:`General`};let t=uc().getFormatInfo(e),n=function(e,t){if(Ic.lookupStyle(e).formatType===G.Special)return`Special`;switch(t){case`general`:return`General`;case`text`:return`Text`;case`percent`:return`Percentage`;case`scientific`:return`Scientific`;case`fraction`:return`Fraction`;case`date`:return`Date`;case`time`:return`Time`;case`datetime`:default:return`Custom`;case`currency`:return function(e){return e.includes(`_(`)&&e.includes(`* `)}(e)?`Accounting`:`Currency`;case`number`:case`grouped`:return function(e){return Ic.lookupStyle(e).formatType===G.Special}(e)?`Special`:`Number`}}(e,t?.type),r={category:n};switch(n){case`Number`:r.decimalPlaces=t?.maxDecimals??0,r.useSeparator=!!t?.grouped,r.negativeStyle=tl(e);break;case`Currency`:r.decimalPlaces=t?.maxDecimals??2,r.currencySymbol=el(e),r.negativeStyle=tl(e);break;case`Accounting`:r.decimalPlaces=t?.maxDecimals??2,r.currencySymbol=el(e);break;case`Percentage`:case`Scientific`:r.decimalPlaces=t?.maxDecimals??2;break;default:r.code=e}return r}(jc=Ac||={}).Type=G,jc.Parser=xc,jc.Styles=new Pc,jc.ParseRunType={Text:`text`,Repeat:`repeat`,Spacing:`spacing`},jc.toBuiltInID=function(e){if(typeof e==`number`)return e;let t=e,n=_c[e];return n&&(t=n),typeof t==`number`?t:(r=t,Vn.get(r)??t);var r},jc.resolve=Bn,jc.builtInFormat=zn,jc.getEngine=uc,jc.Builder=Fc,(Mc||={}).Visibility={Visible:`visible`,Hidden:`hidden`,VeryHidden:`veryHidden`};var rl=new RegExp(/^([$]?[a-zA-Z]*[$]?[0-9]*)[:]?([$]?[a-zA-Z]*[$]?[0-9]*)?$/),il=new RegExp(/^(R(?:\[?[-+]?\d+\]?|\d+)?C(?:\[?[-+]?\d+\]?|\d+)?)(:(R(?:\[?[-+]?\d+\]?|\d+)?C(?:\[?[-+]?\d+\]?|\d+)?))?$/,`i`),al=new RegExp(/^(R?)(\[?[-+]?\d+\]?|\d+)?(C?)(\[?[-+]?\d+\]?|\d+)?$/,`i`),ol=RegExp(`(?:(?:'(?:[^']|'')+')!|(?:[A-Za-z0-9_]+)!)?(\\$?[A-Za-z]+\\$?\\d+(?::\\$?[A-Za-z]+\\$?\\d+)?|\\$?[A-Za-z]+:\\$?[A-Za-z]+|\\$?\\d+:\\$?\\d+)`,`g`),sl=/\s+/g,cl=/"(?:[^"]|"")*"|\[[^[\]]+\]/g,ll=/[\uE000-\uF8FF]/g,ul=`#REF!`;function dl(e){return Bc===e?Vc:(Bc=e,Vc=``+(e+1))}function fl(e){if(Hc===e)return Uc;Hc=e,e<0&&console.warn(`invalid column `+e);let t=``;for(++e;e;e=Math.floor((e-1)/26))t=String.fromCharCode((e-1)%26+65)+t;return Uc=t}var pl=/[^A-Za-z_.\d\u007F-\uFFFF[\]:]/,ml=/^\d/;function hl(e){return e?fl(e.colIndex)+dl(e.rowIndex):null}function gl(e){if(!e)return ul;let t=fl(e.colIndex),n=dl(e.rowIndex);return(e.$colIndex?`$`+t:t)+(e.$rowIndex?`$`+n:n)}function _l(e,t){let n=e??t;return n&&(n=N(n),n=n.replace(/'/g,`''`),(pl.test(n)||ml.test(n))&&(n=P(n))),n}function vl(e,t){return e?e+(e.endsWith(`!`)?``:`!`)+t:ul}function yl(e,t,r=hl){if(!e)return null;if(typeof e==`string`)return e;if(n.a.isError(e))return e.toString();let i=e,a=i.colStart,o=i.rowStart,s=i.colEnd,c=i.rowEnd;if(a===s&&o===c)return r({colIndex:a,rowIndex:o});t&&(i={...t,...i});let l,u,d=a===-(2**53-1)||t&&a<=t.colStart&&s>=t.colEnd,f=o===-(2**53-1)||t&&o<=t.rowStart&&c>=t.rowEnd;return l=f?fl(a):d?dl(o):r({colIndex:a,rowIndex:o}),u=f?fl(s):d?dl(c):r({colIndex:s,rowIndex:c}),l+`:`+u}function bl(e,t){if(!e||!t)return null;let n=e.rowStart===-(2**53-1)||e.rowStart<=t.rowStart&&e.rowEnd>=t.rowEnd,r=e.colStart===-(2**53-1)||e.colStart<=t.colStart&&e.colEnd>=t.colEnd;return n&&!r?(e.$colStart?`$`:``)+fl(e.colStart)+`:`+(e.$colEnd?`$`:``)+fl(e.colEnd):r&&!n?(e.$rowStart?`$`:``)+dl(e.rowStart)+`:`+(e.$rowEnd?`$`:``)+dl(e.rowEnd):null}function xl(e,t,n=gl){if(!e)return ul;let r,i=e.colIndex,a=e.rowIndex;return a===-(2**53-1)?(r=fl(i),e.$colIndex&&(r=`$`+r)):i===-(2**53-1)?(r=dl(a),e.$rowIndex&&(r=`$`+r)):r=n(e),(e.scope||t)&&(r=vl(_l(e.scope,t),r)),r}function Sl(e,t,n=gl,r){if(!e)return ul;let i=e.rowStart!==void 0&&e.rowStart===e.rowEnd,a=e.colStart!==void 0&&e.colStart===e.colEnd&&i;if(!r&&a)return n({colIndex:e.colStart,rowIndex:e.rowStart,$colIndex:e.$colStart,$rowIndex:e.$rowStart});e={...t,...e};let o,s,c=!r&&t&&e.rowStart<=t.rowStart&&e.rowEnd>=t.rowEnd,l=!r&&t&&e.colStart<=t.colStart&&e.colEnd>=t.colEnd;return c?(o=fl(e.colStart),o=e.$colStart?`$`+o:o):l?(o=dl(e.rowStart),o=e.$rowStart?`$`+o:o):o=n({colIndex:e.colStart,rowIndex:e.rowStart,$colIndex:e.$colStart,$rowIndex:e.$rowStart}),c?(s=fl(e.colEnd),s=e.$colEnd?`$`+s:s):l?(s=dl(e.rowEnd),s=e.$rowEnd?`$`+s:s):s=n({colIndex:e.colEnd,rowIndex:e.rowEnd,$colIndex:e.$colEnd,$rowIndex:e.$rowEnd}),o+`:`+s}function Cl(e,t,n=gl){let r=Sl(e,t,n),i=_l(e?.scope,t?.scope);return i?vl(i,r):r}function wl(e,t=!1){if(!e)return null;let n=0,r=0,i=!1,a=!1,o=e.length;for(let s=0;s<o;++s){let o=e.charCodeAt(s);if(o>=48&&o<=57){if(r=10*r+(o-48),n===0&&!t)return}else if(o>=65&&o<=90){if(n=26*n+(o-64),r!==0)return}else if(o>=97&&o<=122){if(n=26*n+(o-96),r!==0)return}else{if(o!==36)return;if(n!==0||i){if(r!==0||a)return;a=!0}else i=!0}}let s={};return t||r!==0&&n!==0?(n>0&&(s.colIndex=n-1,i&&(s.$colIndex=i)),r>0&&(s.rowIndex=r-1,(a||t&&i)&&(s.$rowIndex=a||t&&i)),s):null}var Tl=e=>{let t=e.lastIndexOf(`!`);if(t===-1)return null;let n=e.slice(0,t);return n=N(n),n=n.replace(/''/g,`'`),[n,e.slice(t+1)]};function El(e,t=QT,n=!1){if(!e)return null;let r=Rl(e.toUpperCase(),n),i=null,a=null;if(r?.[1]){let e=!!r[2],t=n?Pl:wl;i=t(r[1],e),a=t(r[2]??r[1],e)}if(!i&&!a||i&&a&&(i.rowIndex===void 0&&a.rowIndex!==void 0||i.rowIndex!==void 0&&a.rowIndex===void 0||i.colIndex===void 0&&a.colIndex!==void 0||i.colIndex!==void 0&&a.colIndex===void 0))return null;let o={};return i&&(i.colIndex!==void 0&&(o.colStart=i.colIndex),i.rowIndex!==void 0&&(o.rowStart=i.rowIndex),i.$colIndex!==void 0&&(o.$colStart=i.$colIndex),i.$rowIndex!==void 0&&(o.$rowStart=i.$rowIndex),o?.colStart!==void 0&&o?.colStart>t?.colEnd)?null:(a&&(a.colIndex!==void 0&&(o.colEnd=a.colIndex),a.rowIndex!==void 0&&(o.rowEnd=a.rowIndex),a.$colIndex!==void 0&&(o.$colEnd=a.$colIndex),a.$rowIndex!==void 0&&(o.$rowEnd=a.$rowIndex)),o.colStart===void 0&&(o.colStart=t.colStart),o.colEnd===void 0&&(o.colEnd=t.colEnd),o.rowStart===void 0&&(o.rowStart=t.rowStart),o.rowEnd===void 0&&(o.rowEnd=t.rowEnd),t.scope&&(o.scope=t.scope),o)}function Dl(e,t,n=!1){let r,i=Tl(e);if(i){let a=e.lastIndexOf(`!`),o=e.indexOf(`:`);if(o!==-1&&o<a){let t=e.indexOf(`!`),n=e.indexOf(`:`,t),r=Tl(e.slice(0,n)),a=Tl(e.slice(n+1));if(!r||!a||r[0].toUpperCase()!==a[0].toUpperCase())return null;i=[r[0],`${r[1]}:${a[1]}`]}if(r=El(i[1],t,n),!r)return null;r.scope=i[0]}else r=El(e,t,n);return r||null}function Ol(e,t,r=Sl,i=gl,a=!1){if(!e||e.length===0)return null;let o=[],s=e.length;for(let a=0;a<s;a++){let s=e[a],c=null;s?s.rowIndex!==void 0||s.colIndex!==void 0?c=i(s):s.rowStart!==void 0||s.colStart!==void 0?c=r(s,t,i):typeof s==`string`?c=s:`nameId`in s?c=s.nameId:n.a.isError(s)&&(c=s.toString()):c=ul,c&&o.push(c)}return o}function kl(e,t,n=Cl,r=gl,i=!1){let a=Ol(e,t,n,r,i);return a?a.join(`,`):ul}var Al=e=>e!==void 0&&e!==-(2**53-1)&&e!==2**53-1,jl=(t,n,r,i=Dl,a,o=!1)=>{if(n!==null){if(typeof n==`string`){let e=i(n,r,o);if(!e){let e=a?.(n);if(e){let n=e.length;for(let s=0;s<n;s++){let n=e[s];jl(t,n,r,i,a,o)}}return}n=e}else n.isICellRange?n=n.getCoords():n.isICell&&(n=e.l.cellToRange(n.getCoords()));if(n!==null){if(n.rowStart!==void 0||n.colStart!==void 0||n.colEnd!==void 0||n.rowEnd!==void 0){let e=n;t.push({...r,...e,colStart:Al(e.colStart)?e.colStart:r.colStart,rowStart:Al(e.rowStart)?e.rowStart:r.rowStart,colEnd:Al(e.colEnd)?e.colEnd:r.colEnd,rowEnd:Al(e.rowEnd)?e.rowEnd:r.rowEnd})}else if(n.rowIndex!==void 0||n.colIndex!==void 0){let e=n,i={...r,...e,colStart:e.colIndex,rowStart:e.rowIndex,colEnd:e.colIndex,rowEnd:e.rowIndex};i.scope===null&&r.scope&&(i.scope=r.scope),delete i.colIndex,delete i.rowIndex,t.push(i)}}else t.push(null)}else t.push(null)};function Ml(e,t,n=Dl,r,i=!1){if(!e)return[t];let a;a=typeof e==`string`?F(e):e.isICellRanges?e.getCoords():e.isIReferenceRange?[e.getCoords()]:Array.isArray(e)?e:[e];let o=[],s=a.length;for(let e=0;e<s;e++){let s=a[e];jl(o,s,t,n,r,i)}return o}function Nl(e,t){let n=0,r=0,i=e.length;for(let t=0;t<i;++t){let i=e.charCodeAt(t);if(i>=48&&i<=57){if(n=10*n+(i-48),r===0)return}else if(i>=65&&i<=90){if(r=26*r+(i-64),n!==0)return}else if(!(i>=97&&i<=122)||(r=26*r+(i-96),n!==0))return}return t?(t.colIndex=r-1,t.rowIndex=n-1,t):{colIndex:r-1,rowIndex:n-1}}function Pl(e,t=!1,n){n?(n.colIndex=-(2**53-1),n.rowIndex=-(2**53-1),n.$colIndex=!1,n.$rowIndex=!1):n={colIndex:-(2**53-1),rowIndex:-(2**53-1),$colIndex:!1,$rowIndex:!1};let r=al.exec(e);if(!r)return null;let i=r[1],a=r[3];if(!(t||i&&a))return null;if(i){let e=r[2];e?e&&(e.startsWith(`[`)?(n.rowIndex=parseInt(e.slice(1,-1)),n.$rowIndex=!1):(n.rowIndex=parseInt(e)-1,n.$rowIndex=!0)):(n.rowIndex=0,n.$rowIndex=!1)}if(a){let e=r[4];e?e.startsWith(`[`)?(n.colIndex=parseInt(e.slice(1,-1)),n.$colIndex=!1):(n.colIndex=parseInt(e)-1,n.$colIndex=!0):(n.colIndex=0,n.$colIndex=!1)}return n}function Fl(e,t){let n=0,r=0,i=!1,a=!1,o=e.length;for(let t=0;t<o;++t){let o=e.charCodeAt(t);o>=48&&o<=57?n=10*n+(o-48):o>=65&&o<=90?r=26*r+(o-64):o>=97&&o<=122?r=26*r+(o-96):o===36&&(t===0?i=!0:a=!0)}return r--,n--,t.colIndex=r,t.rowIndex=n,n===-1?(t.$colIndex=i,t.$rowIndex=!1,t):r===-1?(t.$colIndex=!1,t.$rowIndex=i,t):(t.$colIndex=i,t.$rowIndex=a,t)}function Il(e){let t=0,n=e.length;for(let r=0;r<n;++r){let n=e.charCodeAt(r);if(n>=65&&n<=90)t=26*t+(n-64);else{if(!(n>=97&&n<=122))return t-1;t=26*t+(n-96)}}return t-1}function Ll(e,t){let n=t;n?(n.rowStart=0,n.colStart=0,n.rowEnd=0,n.colEnd=0):n={rowStart:0,colStart:0,rowEnd:0,colEnd:0};let r=0,i=0,a=0,o=e.length;for(r=0;i<o&&(a=e.charCodeAt(i),a>96&&a<123&&(a-=32),!(a<65||a>91));++i)r=26*r+(a-64);for(n.colStart=--r,r=0;i<o;++i){let t=e.charCodeAt(i)-48;if(t<0||t>9)break;r=10*r+t}if(n.rowStart=--r,i===o||e.charCodeAt(++i)===58)return n.colEnd=n.colStart,n.rowEnd=n.rowStart,n;for(r=0;i!==o&&(a=e.charCodeAt(i),a>96&&a<123&&(a-=32),!(a<65||a>91));++i)r=26*r+(a-64);for(n.colEnd=--r,r=0;i!==o;++i){let t=e.charCodeAt(i)-48;if(t<0||t>9)break;r=10*r+t}return n.rowEnd=--r,n}function Rl(e,t=!1){let n=e.match(t?il:rl);return e.endsWith(`:`)?null:n}var zl={rowIndex:-1,colIndex:-1,$colIndex:!1,$rowIndex:!1};function Bl(e,t,n,r=16384){let i,a=e.lastIndexOf(`!`),o=``;a!==-1&&(o=e.slice(0,a)+`!`,e=e.slice(a+1));let s=()=>{let e=``,r=i.rowIndex;if(r!==-1)if(i.$rowIndex)e+=`R${r+1}`;else{let n=r-t;e+=n===0?`R`:`R[${n}]`}let a=``,s=i.colIndex;if(s!==-1)if(i.$colIndex)a+=`C${s+1}`;else{let e=s-n;a+=e===0?`C`:`C[${e}]`}o+=e+a};a=e.lastIndexOf(`:`);let c=a!==-1;if(c){let t=e.slice(0,a);e=e.slice(a+1),i=Fl(t,zl),i.colIndex!==-1&&i.rowIndex!==-1&&(s(),o+=`:`)}return i=Fl(e,zl),!c&&i.colIndex>r?e:(s(),o)}var Vl=[],Hl=e=>(Vl.push(e),String.fromCharCode(57344+Vl.length-1)),Ul=e=>Vl[e.charCodeAt(0)-57344];function Wl(e,t){let n=``,r=e.rowIndex;r!==-(2**53-1)&&(e.$rowIndex?n+=`R${r+1}`:n+=r===0?`R`:`R[${r}]`);let i=``,a=e.colIndex;return a!==-(2**53-1)&&(e.$colIndex?i+=`C${a+1}`:i+=a===0?`C`:`C[${a}]`),e.scope&&(n=_l(e.scope,t)+`!`+n),n+i}function Gl(e,t,n){let r,i=e.scope;r=i?_l(i)+`!`:``;let a=e.colIndex;a!==-(2**53-1)&&(e.$colIndex?r+=`$`+fl(a):r+=fl(a+n));let o=e.rowIndex;return o!==-(2**53-1)&&(e.$rowIndex?r+=`$`+dl(o):r+=dl(o+t)),r}function Kl(e,t,n,r){let i,a=e.colStart,o=e.rowStart,s=e.colEnd,c=e.rowEnd,l=e.$colStart??!1,u=e.$rowStart??!1,d=e.$colEnd??!1,f=e.$rowEnd??!1;if(l||a===-(2**53-1)||(a+=n),u||o===-(2**53-1)||(o+=t),d||s===2**53-1||(s+=n),f||c===2**53-1||(c+=t),a>s){let e=a;a=s,s=e}if(o>c){let e=o;o=c,c=e}return r?(i=r,i.colStart=a,i.rowStart=o,i.colEnd=s,i.rowEnd=c,i.$colStart=l,i.$rowStart=u,i.$colEnd=d,i.$rowEnd=f):i={colStart:a,rowStart:o,colEnd:s,rowEnd:c,$colStart:l,$rowStart:u,$colEnd:d,$rowEnd:f},e.scope&&(i.scope=e.scope),i}function ql(e,t,n){let r=e.$colStart??!1,i=e.$rowStart??!1,a=e.$colEnd??!1,o=e.$rowEnd??!1,s={colStart:r?e.colStart:e.colStart-n,rowStart:i?e.rowStart:e.rowStart-t,colEnd:a?e.colEnd:e.colEnd-n,rowEnd:o?e.rowEnd:e.rowEnd-t,$colStart:r,$rowStart:i,$colEnd:a,$rowEnd:o};return e.scope&&(s.scope=e.scope),s}function Jl(t,n){let r,i,a;return Array.isArray(t)?(r=t[0],i=t[1]):t.r===void 0?r=t:(r=t.r,i=t.v),Array.isArray(r)&&(r=r[0]),a=typeof r==`string`?El(r,n):e.l.sanitizeRange(r,n),i!==void 0&&a&&(a.value=i),a}function Yl(t,n){let r,i;Array.isArray(t)?(r=t[0],i=t[1]):t.r===void 0?r=t:(r=t.r,i=t.v);let a=[],o=t=>{let r=typeof t==`string`?El(t,n):e.l.sanitizeRange(t,n);r&&a.push(r)};if(typeof r==`string`){let e=F(r),t=e.length;for(let n=0;n<t;n++)o(e[n])}else if(Array.isArray(r)){let e=r.length;for(let t=0;t<e;t++)o(r[t])}else o(r);return a.length===0?null:{coords:a,value:i}}var Xl=/^\$?([A-Z]+)(?::\$?([A-Z]+))?$/,Zl=/^\$?(\d+)(?::\$?(\d+))?$/;function Ql(e,t,n){let r=n?fl:dl,i=r(e);return e===t?`${i}:${i}`:`${i}:${r(t)}`}function $l(e,t){if(!e)return null;let n,r,i=e.trim().toUpperCase(),a=Xl.exec(i);if(a)n=Il(a[1]),r=a[2]===void 0?n:Il(a[2]);else if(a=Zl.exec(i))n=parseInt(a[1])-1,r=a[2]===void 0?n:parseInt(a[2])-1;else{let e=El(i);if(!e)return null;n=t?e.colStart:e.rowStart,r=t?e.colEnd:e.rowEnd}return n===void 0||r===void 0||Number.isNaN(n)||Number.isNaN(r)?null:n<=r?{min:n,max:r}:{min:r,max:n}}function eu(e,t){return{r:Ql(e.min,e.max,t),v:e.value}}function tu(e,t){let n,r;Array.isArray(e)?(n=e[0],r=e[1]):(n=e?.r,r=e?.v),Array.isArray(n)&&(n=n[0]);let i=null;if(typeof n==`string`)i=$l(n,t);else if(n){let e=n,r=t?e.colStart:e.rowStart,a=t?e.colEnd:e.rowEnd;r!==void 0&&a!==void 0&&(i=r<=a?{min:r,max:a}:{min:a,max:r})}return i?(i.value=r,i):null}function nu(e,t){let n=e?e.length:0,r=Array(n);for(let i=0;i<n;i++)r[i]=eu(e[i],t);return r}function ru(e,t){let n=e?e.length:0,r=[];for(let i=0;i<n;i++){let n=tu(e[i],t);n&&r.push(n)}return r}function iu(e,t,n=hl){let r=e?e.length:0;if(r===0)return null;let i=[];for(let a=0;a<r;a++){let r=yl(e[a],t,n);r&&i.push(r)}return i.length===0?null:i.join(`,`)}function au(t,n){return typeof t==`string`?El(t,n):e.l.sanitizeRange(t,n)}function ou(e,t){return typeof e==`string`?e:Sl(e,t)}function su(t,r,i){let a=e.l.intersectRanges(t,r,i);if(!a)return null;let o=t.scope,s=r.scope;if(o&&s){if(o!==s)return n.a.BuiltIn.Value;a.scope=o}else(o||s)&&(a.scope=o||s);return a}function cu(t,r,i){let a=e.l.unionRanges(t,r,i);if(!a)return null;let o=t.scope,s=r.scope;if(o&&s){if(o!==s)return n.a.BuiltIn.Value;a.scope=o}else(o||s)&&(a.scope=o||s);return a}var lu=class t{constructor(e,t,n=`dynamic`){this._c=e,this._cycleId=t,this._k=n}getCycleId(){return this._cycleId}getKind(){return this._k}getError(){return this._k===`dynamicSpillError`}isFixed(){return this._k===`static`}getCoords(){return this._c}setError(e,n){let r=this._k===`static`?`static`:e?`dynamicSpillError`:`dynamic`,i=r===`dynamicSpillError`?{colStart:this._c.colStart,rowStart:this._c.rowStart,colEnd:this._c.colStart,rowEnd:this._c.rowStart,scope:this._c.scope}:this._c;return{...i,value:new t(i,n,r)}}getTranslated(e,n){let r=this._c,i={colStart:r.colStart+n,rowStart:r.rowStart+e,colEnd:r.colEnd+n,rowEnd:r.rowEnd+e,scope:r.scope};return{...i,value:new t(i,this._cycleId,this._k)}}getShifted(n){let r=n.after;if(!r)return null;let i=e.l.sanitizeRange(r);return{...i,value:new t(i,this._cycleId,this._k)}}getMerged(e,t,n){}getSplit(e,t){}},uu=class e{constructor(e,t){this._c=e,this._a=t}getCoords(){return this._c}getAxis(){return this._a}getShifted(t){return t.after?{...t.after,value:new e(t.after,this._a)}:null}getMerged(t,n,r){let i=this._a;return new e(n,i)}getSplit(t,n){let r=this._a;return[new e(t[0],r),new e(t[1],r)]}getState(){return this._c}};function du(t,r,i){if(!t||t.length===0)return e.A.EmptyArray;let a=[],o=i?n.l.Axis.Column:n.l.Axis.Row;for(let e=0;e<t.length;e++){let n=t[e],s=n[0],c=n[1];for(let e=0;e<c.length;e++){let t=c[e],n=t[0],l=t[1].length-1,u={colStart:i?s:n,rowStart:i?n:s,colEnd:i?s:n+l,rowEnd:i?n+l:s,scope:r,value:new uu({colStart:i?s:n,rowStart:i?n:s,colEnd:i?s:n+l,rowEnd:i?n+l:s},o)};a.push(u)}}return a}function fu(e,t,n,r,i){return pu(t- -310,n)}function pu(e,t){e-=313;let n=vu(),r=n[e];pu.XLMGSZ===void 0&&(pu.OkQZRT=function(e,t){let n,r,i=[],a=0,o=``;for(e=function(e){let t=``,n=``;for(let n,r,i=0,a=0;r=e.charAt(a++);~r&&(n=i%4?64*n+r:r,i++%4)&&(t+=String.fromCharCode(255&n>>(-2*i&6))))r=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=`.indexOf(r);for(let e=0,r=t.length;e<r;e++)n+=`%`+(`00`+t.charCodeAt(e).toString(16)).slice(-2);return decodeURIComponent(n)}(e),r=0;r<256;r++)i[r]=r;for(r=0;r<256;r++)a=(a+i[r]+t.charCodeAt(r%t.length))%256,n=i[r],i[r]=i[a],i[a]=n;r=0,a=0;for(let t=0;t<e.length;t++)r=(r+1)%256,a=(a+i[r])%256,n=i[r],i[r]=i[a],i[a]=n,o+=String.fromCharCode(e.charCodeAt(t)^i[(i[r]+i[a])%256]);return o},pu.hvtjhJ={},pu.XLMGSZ=!0);let i=e+n[0],a=pu.hvtjhJ[i];return a?r=a:(pu.jOqbHt===void 0&&(pu.jOqbHt=!0),r=pu.OkQZRT(r,t),pu.hvtjhJ[i]=r),r}(function(){let e=vu();function t(e,t,n,r,i){return pu(e-249,i)}function n(e,t,n,r,i){return pu(t-201,e)}function r(e,t,n,r,i){return pu(r- -473,t)}function i(e,t,n,r,i){return pu(t- -143,n)}for(;;)try{if(parseInt(i(0,186,`xhX(`))/1*(-parseInt(i(0,184,`aQWp`))/2)+parseInt(n(`Sn[a`,552))/3+-parseInt(t(617,0,0,0,`e!!J`))/4+parseInt(r(0,`N7VT`,0,-121))/5*(parseInt(n(`K9#@`,592))/6)+-parseInt(t(641,0,0,0,`T(dW`))/7+parseInt(r(0,`T(dW`,0,-86))/8+-parseInt(i(0,267,`4b]e`))/9*(-parseInt(t(629,0,0,0,`e!!J`))/10)==658743)break;e.push(e.shift())}catch{e.push(e.shift())}})();var mu=fu(0,55,`y3RN`),hu=fu(0,57,`!Jw3`),gu=RegExp(`^`+mu+mu+hu),_u=RegExp(`^`+mu+hu);function vu(){let e=`o8kHbSo6w8oF.o0VdKmoUkeRcVa.W5yDWONcHW.kmkWF8okxv8.WOVdSs5ZlG.h8kWW5hcP8oJWOVdRCk8W6LTes3dKa.WOb+jGa.wmkMWRSpW4ddGW.W5KFWPOKiSo1pvddU2bl.CZddOmoMbmkyW6ddKdqbW40D.emkWW5pcO8oNWO3dQ8knW5XcoWRdGW.aMK1WPajBCoW.WOPqdq.bComW5yKiCoTWPjcW5ayWPldUa.ghL+WRJdVwC.iMxdPbPBFCkjW4jP.WPOoFcaGua.W7RcOWHVWRCS.gSoYmMTq.amonWP5VumkpWOPL.x8oPlSo/WOZcPq.qmklWOP/yG.kGdcIW7cJmoCW63cPCobbrZdRmkYwW.bgmpWPOmE8oNW55gW7pcVW.W6OqW73cJHCmEmkI.tmoMW4RcOSogd2fjl0/dR3fWB20vW6TvW41NWQm.zsSVxCor.W6pdTmozWOldRSoDDSk0W60xrL0.a8oxW5m3ECoyW4tcQSo8zINdLuBcHq.v8oPWPpdOSkZ.WQqZAaldI8klBSksW4u.WPviWQhdNgBdLmk/ste.s8oTWO/dTSkIW5a.WPPTW7LrW6W.z8oQW53cGCoDegH1AKFdRG.WPvVW6bFW7lcN0yoxtL+kglcPMXLrgbeWRBdG8k+.W6BdRSoxWP3dRSoAC8kJW68m.lMnZaSkqjCoJW7JdPG7dRSkcW6u.WPueAdi.mmobWPGlW54wW6FcQZy.C8oTi8kFgaiHzSo2WRhdUIqD.fwiNWOySD8oHW7u.WQRdUZvoawC.jw07tCoJtmk7W54.WPL0oYJcU1JcKabnW6/cQq.AHRcLmkFCw7cRmoSW63dV1S.u8kjE8k2.qCo6WO7dVmkvW5dcUSkCW4XNjZ8.WQZdStjh.W5eLeqXIW5ldM8kyoa.FCk2iSk8.WQxdTJPBnMancwza.WPW1umomWQZcUW.dhvGWRRdUwfHaqy6W5W.hICCvSkLW6m.m8kRbCo8rSozyq.Cd4IqmoqzmkWW5K.bNLGWRRdQhS.W4JdMCkokCkaqCkzW7RdPG.CmolWOJdJSkQW6C5WPy.wmolrHbR.ACoHW5/cPSoefwamA0NdStbRzczaWQi.ACo8W6JcTCoAhx0.z8oXp8k2WOFcJ8ohW7uSW6xcGq.nSk5e8k1De7cSdS.yIiZuq.sCoLD8o3qmonqW.W7dcQwSBqJCFp0TAWQBcRq.WQpcJWHSWPiSzW.WQNcPCkgy8ktdG.xSoLDCowtCowvIymW5nGEY/cLq.EJ4Tu8orFG.nKhdJCoe.W4aUW4aeW6Gh.qmkfWPzGpSkCWPm.W4NcQ38VASkgk8oqWQHG.ESkvWPb3ESk8WOaXW5aFWRVdI8oQFSkXm8ocvJpdHq.xSkfWO5Iomkh.W5ChdGGLda.EwZcLmoQWPdcH8orva.r8kuWQP5yCkWWPzsW50fWR0.g8oeW4C7p8koWQu8W6yxW7xdLmk0imoTpSo0shVdH8kqW7JcLmojcCkdWRHbW6K.imkKf8krAuhcSdPVW58.W7ddT8oohSkuaSkkW5pdPmkUaSkRW7qk.DmoPx8oolXldSdfHW7RdPmoXW7K.WPi4xmorWP3cRwJdQSooWPG.yCoWwmkOf8oNzWtdSLRdGG.x8oUz8oaDSoquIS.WPRcG8oBCSobhCoeW6ZdVSoxBmo/W7m.exGSWPC.sCk3WQaOW4ddM2JcGG.i8k2aCoW.WO/cLSoGWQ1kWOCab1K.WP7dV8knimkKr8kB.yJ4Wqa.nmk6WPddTSkzsfzKEf7dVYu.DmoSl8kcAexcStu.dxL6WPddS31LgW`.split(`.`);return(vu=function(){return e})()}function yu(e,t,n,r,i){return K(e-970,r)}function bu(e,t,n,r,i){return K(r- -54,e)}function xu(){let e=`WPK+WPG0tSkQcbFdTmkZq8kpx8k8WPS.ddKTWOepW7pdP8osW71/gmoyBa.WOLtW7xdLmk2o8ol.bg3cRbaNB8k2p8kIg8oyWRRdNG.WRJdS8kg.DH/cVf8TgdZcKmo/WQD5.W44lwffLpG.kc3dJM00WPddUeHmWRlcQmkaW4W.eNO0W7ddK3tcG8oWa0a.WPGYWOirxSkXfahdI8k4rq.WO4PWOmBuSkWaq.WQxdS8kEuwVcIq.WPPFW7JdImk/xq.W643o2y.FuBcMSk1W5SEEeNdNSkZWPS.FX4+WPvrx3ycW5G.A8o/W4X4xurFWOldP3NdTCoN.gM3cTtm8Dq.AmkSzX7dUSoYp8kqu2a7u8ocW5S.yatcU1y8.aw0PW5xdMG.W7fNxCobWRRdVexcPSkaDv8.zmk4W6pcM8kOWPVcRSkKW5VcLmkqpNOAb8o6WOFdTW.WP5YDrtdT8o7dmo3W6RdOM/dJW.WOxdRmoSwCkSWP7cGY3dIai.WQhdOmkvwNtcNGxcKtlcS31QtW.WPRdUmkjySoOjxJcRmksW5OzF8oRcW.W7mNjwfPWPu.ntJcJN/cN8kC.W48zBMj8mCo/W7ddGSo6j8oMWOu.geVcLCoGWOKlumoVWPpdNqy.pCkPWO8TabPF.umo0ssNcPtG.BXNdUrddJSodWRVcStZdScdcVLTw.j1OFkSksW74.W6qTy8kmdmktl8kMhd0kW7ZdJG.h08zf8kvW6Cc.WPhcQhRdLq.p8k+WP4PeXm.eg3cRbONySk0nmkJdSoHWRBdICoh.W7iNjMLVWOq.WRqVpvVcSmoN.rCogW63cGa.jWjLWRtdHLzMix3cHmoSW5VdMmkCbSosWP3cOW.W7NcVSkfWRykmmkp.rJ3dOgr3p8oHa8kuo8o0WRRdNG.WQVdOMmX.a34SW4hdK0BcLa.tmoKvcy.W4uzC0LHimokW7ldN8o9pmoTWPi.jcFdNhlcNSkfWR3cRCoaWQOdmG8rW5lcLxVcMCo0WQq.WO7cUSkQjmo0W6dcOJJdMgKd.WRXDW7tdJmkMe8ouaN4.saCRW7npD3ddVsv4lSkCbW.WOTaW7ddJa.xxRdIx7cP8k+WPFcQ8om.d1r9WQO.uCopWQpdUSogWQmOiMtcL15RW659.bI3cKNhcHCka.mN7cUta7BCkNomk+emkZWQ/dGSobWPdcSSoFECoXbMPHW4DZfa.W5lcLqvT.W7KNpez0WP8zmY/dRw/cO8kDWPK.vbBcSumWxW.BmouW6ldHmoBWRmAjwpcMG.FLhcH8kqW4OL.tYCDr8kdzq.WOpcTvNdLZVdOCokwCkvW4yS.W7pdTSkDrf/cKSkgW4K.WPbkke9sbmorW6/dLa.yv3cKmk+W4eVFgZdLCkV.W4eMj15PWOudaW.ltyOWQuBW7NdPSkcW4v/fmotCuhcQ8kglIvkWR9lb8oemvjvxq.CSkRW5jtWP7dP8o5.dI3cIhFcMmkeWQ/cLmoCWRbnnrOq.dKZcKmoI.FKdcKSk5W4m5.bG1GWPddKLXNCwZcLCoZW5ZdMq.sahcTKOWEsqgn8oZua.f1rLWOajlsK.yHldUXddI8ogWQW.ghOTW5VdHhNcPCoB.W4mDAuzTpSoP.WPC/i8oEraHFW7VcHSkKW4W.q3/cLGHYW4ZcOM0.cKddQbbWbtilj8oGx8k7.uSowW6RcQSktuNxdT8ktCJVcMa.d1rOWO0EoW.WOOOj8oFqJm.WRtdS8klr8oHoh3dPCkAW4y.WPxdLSocdKRcSa.FWxdVrq.WRKZW5FdNsKRcMOifSkIWQeW.W5NdMmk7W7pcMCoGt2JcQq.W4pcJcHUW4tdOvldP8khicXPW6VcN1CEW4NcUa.ESoyW7pdN8oDWRK.WQhcVSkIjSoPW4RcPINdMq.WQiVmvdcVSogW7SLW7ddM33cKq.W7evW6BcUamjiG.WQpdO8kmAW.FZCVWOTxt3GPW6i.r8kNW6ZcKmk4WOJcQSk/W53cLmoe.oYGSWQ0zW6tdHSohW713hSoABa.E8oCWR7cG8kdqG.WP0MgmkBW6BdU3JcJmk4yfddHSoe.WQdcL2HxWOxcPCoBcq.WRddRSkwuq.W6BdRCkkxW.WQNdLSofjeVcSCkKpa.WPVcS3BdNsldT8oDuCkrW4W.g1ZcNCoI.WPdcV2hdUJNdRCouFSkWW5q9W6S.v8kVW67cGSk4WRZcRa.W5uqzCkWW5tdHG.CCkHW4TWWOldOmoMW5JcQSkukCoj.puVcU0pcL8kAWQtcIt/dVIFcUG.d1ZcImoAWPqKva.WRy3W5ddNdq8dNmqda.WRiJgCkA.emoUw3aUW6NdHmk8Fmo1qGxdG8kS.WQe4lhlcO8oHW7S/W6ldL1RcHYm.fujyWQmnbYRdMG.zCk6vGNdSSoY.W6VdK8kRWPVcGCoUWRhdR8klWRC.W6pdLCkLWP/cHSoZWQC.WRddTCkAvN3cIq.W64wA0zOo8o+WQddMSo6k8oTWPHlWPLKW6vqw8oG.W4SrFKjQiCo/W4VdK8oQ.xXBcQ2yXxI0hf8o3qmk9.WOOPWOuB.ad0OWQeBW7/dSSohW7TvgmodCuy.lCkrWRVcGSkwW7r5FfRcIZHkW7Lx.WPddRmoXz8k7WOxcVsVdHaJcVMv2.DbRcVeeQrcrdnSoUrmkXamovrmoXx8ouWPG.hgWwW5xdMMNcHG.tWdcS1qHdI3cLSoZ.uJaFrCkyB3u.WPtdV8o6BmkKWPi.fwNcTJiRFSkdi8k4emoNWRRdGW.W5ffW49qWRKMDqpdHqFcTmk/eCkjlSkXW5WQ.WPLxW7JdLCkMd8oybq.qmoqW7hdN8obWRqjkwpcKXDmW7G.F8k9CG3dP8oTg8kPvwe.WRddPmkAwa.W7WJjMb+WP49bspdT3RcR8kv.WQJdSNe1.W4mxCezTpa.W4/cKSkJWQujlCkeWOBdJW.WRRdK8oddW.deuHlmklW68vWOtcGdSM.WRRdLmoFcK3cT8kV.WO4IW5BdSt88.WRddPSkkCa.F8k3W7PeWPBdPq.WO7cUSkQjmo0W6ZcPJpdKMKv.iwZcJmoqrcxcK23dIWj6WPXiuIi.WQFcQmonbdddISogW6BcVrWInw4.WQddSCkorW.WOhdS8kuq2lcIsFdGZtcS2v2c2VcISkvcCoCWQ/dMW.WQ3dG8oejvhcRCkMlbddPmkiWP3cGCkEWO4.b8o5qfuOW6NdLq.WPpcTxJdMsxdQG.W4SMowlcU8kMvmkJW6pdUL3dGmoCyW.W5ldJSopxmkT.dfZcImoVWPqLqSorWO/dKrPujYK.EuBcMSk2.W7/dJZWbW5NcPCohiXFcOKy.ECofW6ldGSoAWRiOpW.h0fPWRu.WPSJWPWFsCk6.W57cOSoZWRSpoSkoWRFdOXhdU8k4vCkUuebKCSoe.WPlcOMxdKt7dVq.yG/dIaFdHSod.W4iAFmkDW5tdI8oyW71WW5hdKmkwW50.WR7dQ20YW6G.gGnFWRRdNvPWqNNcJ8o5.WO4+dSovrG9qW6m.WO9aW7ddJ8kNmCoufwldU8kXW4pdVWrZoSkqWQ0.W4JdHSoFaSkqWQ7dGYRdO1C.h0fPWOuunYRdMa.W44Nn8kihCkpnCkedYanW6FdHw4.WQFdPmkpvxJcGcBcSYNcTgD7tKm.jgJcLSo8vd7cR3VdTaL8WOPf.WP0Gc8kEW6hdQ13cNCkP.w33dHc7dImoBW67cLSoRWPXejay.W4tcUSkPo8oUW4lcGthdNahcO3a.v8o0xGJcOZ/cJa.WPO+WPGxuSkVfW.WR7dRMW5W5BdI1pcOSoDW6/dGxhdGta.WPu+WPuWsCkScq.ww3cMdqGW6NcPxPkWORcJCkZWOf7eem.WObppmoIWOxcMCkjW5rmW6ddI8kQW5m.d1ZcImoiWPGOrCo0WO/dNqC.WRRdPMWZW7/dKgdcTCoAW7ldKf/dGa.WQa3bmkCW63dVwZcM8kLB03dJ8ot.W4pdQSk7W7xcJ8ovuKxcL8kZ.rcq6WOzxr2O.ccNcKNJcLmkAWOZcTSohWRDxjbS.evrXWQKjoW.jwxcMCo7xaRcIMxdSsTHWOXeuZ/cSSoUW57dLwaK.WRiIW5hdMZ49aw4.W4XsW4TrWR8twYi.EmofW7FdTmoAWQKHkehcLWXtW6jRWOi.FuBcMSk1W5SyFfpdKCk/WOvz.WOZdOmkEB8oTkh3dUmkt.WR/dV8kCzSoQp3NdH8ktW4W.WPVdVSoBBmkOWRlcGY8.WRRcL3HBWP/dTG.WRqKW4xdTa.WPZdSCkjxx/cMa.WQVdSNiTW6JdH0pcTmoJW67dJvtdKa.wWpcQMCRqI8x.FmoDW6JcICkkuN3cS8k5FcVcMdFdT8oMWQi+k8o0WQ4`.split(`.`);return(xu=function(){return e})()}(function(){function e(e,t,n,r,i){return K(n-416,r)}function t(e,t,n,r,i){return K(e- -357,i)}function n(e,t,n,r,i){return K(n- -298,r)}function r(e,t,n,r,i){return K(n-19,r)}let i=xu();for(;;)try{if(-parseInt(e(0,0,728,`Ctw*`))/1+-parseInt(e(0,0,560,`lHGz`))/2+-parseInt(n(0,0,-125,`qtQX`))/3+-parseInt(n(0,0,-5,`F8bS`))/4*(parseInt(r(0,0,215,`9s3S`))/5)+-parseInt(r(0,0,337,`5rDK`))/6+parseInt(t(-176,0,0,0,`K]FG`))/7+parseInt(e(0,0,705,`$Dd2`))/8==750278)break;i.push(i.shift())}catch{i.push(i.shift())}})();var Su,Cu=async t=>{let n=`1Oa8`,r=e.A[l(1056,1118,1104,960,`z@t@`)],i=se[a(-585,-436,-591,-538,`$Dd2`)]();function a(e,t,n,r,i){return K(r- -689,i)}let o=new Date(i),s=new Date;function c(e,t,n,r,i){return K(t-731,i)}function l(e,t,n,r,i){return K(e-734,i)}function u(e,t,n,r,i){return K(t- -302,i)}return Math[a(0,0,0,-388,`!q(x`)]((s[a(0,0,0,-446,n)]()-o[c(0,895,0,0,`cwlk`)]())/864e5)>=120&&(r=[l(921,0,0,0,`qtQX`)]),Object[u(0,-65,0,0,n)]({getLicensee:()=>a(0,0,0,-539,`n6SF`),getExpiration:()=>null,getDomains:()=>[],getDeveloperCount:()=>1,getCpuCount:()=>0,getMemory:()=>0,getType:()=>l(1069,0,0,0,`dMCG`),isEval:()=>!0,getExceptions:()=>r,hasExceptions:()=>r[K(168,`@AyD`)]>0,isValidFor:()=>r[a(0,0,0,-521,`@AyD`)]===0,isValid:()=>!1,getFeatures:()=>Object[a(0,0,0,-523,`lHGz`)]({}),getKeyFrom:()=>t,getBuildVersion:se[u(0,38,0,0,`c&0h`)],getBuildDate:se[c(0,986,0,0,`kgyx`)]})},wu=async e=>{if(Tu[n(796,`9s3S`,787,727,809)]&&Tu[K(291,`1Oa8`)])return!1;function t(e,t,n,r,i){return K(t- -329,n)}function n(e,t,n,r,i){return K(r-550,t)}return!!(e[n(0,`lLRp`,0,830)]()||e[n(0,`c4i*`,0,891)]()||e[t(0,-10,`1Oa8`)]()?.pb||await ye[t(0,-26,`EbYE`)]())},Tu={promise:null,printNeeded:!1,details:null,bannerPrinted:!1,detailsPrinted:!1,licenseKey:null,keyFrom:null},Eu=!1,Du=!1;function Ou(e,t,n,r,i){return K(r-516,i)}function ku(e,t,n,r,i){return K(t- -674,i)}var Au,ju=new class{constructor(){function e(e,t,n,r,i){return K(i- -666,e)}this[e(`)SyG`,0,0,0,-523)][e(`n6SF`,0,0,0,-427)]=null}async[Mu(-334,-312,-285,`qtQX`,-244)](e,t=!1){if(!e||e[n(664,626,720,`qFjK`,619)](r(85,`F8bS`,186,153,117))||e[r(21,`NnEz`,-51,10,72)](n(445,546,450,`hr2j`,454))||e[i(-167,-25,3,-97,`qFjK`)](a(`[(zr`,-564,-622,-510,-576))||e[a(`ign&`,-449,-353,-468,-455)](s(113,-19,76,`J3xr`,130)))return Eu=!0,await ye[a(`K]FG`,-565,-551,-521,-510)](e,t),Tu[i(-50,-22,21,-70,`6LS8`)]=null,Tu[n(710,688,724,`c&0h`,630)]=i(-250,-177,-251,-155,`YYgq`),Tu[s(297,188,211,`)SyG`,177)]=null,Tu[r(153,`&#xO`,125,82,89)]=null,await this[n(697,616,657,`6LS8`,645)](!0);function n(e,t,n,r,i){return Mu(e-221,t-209,i-942,r,i-345)}if(Eu=!1,!t&&Tu[a(`px#Q`,-415,-436,-511,-488)]){let e=await this[r(66,`*270`,142,81,37)]();if(e[a(`Qp98`,-602,-614,-558,-552)]()&&!e[s(181,116,187,`58Y]`,225)]())return e}function r(e,t,n,r,i){return Mu(e-276,t-22,r-447,t,i-35)}function i(e,t,n,r,i){return Mu(e-454,t-409,r-226,i,i-338)}function a(e,t,n,r,i){return Mu(e-338,t-189,i- -96,e,i-430)}Tu[r(22,`*VZV`,0,69,-34)]=e,Tu[a(`#mc0`,-425,0,0,-411)]=r(116,`5rDK`,0,119,194),Tu[a(`c&0h`,-316,0,0,-410)]=null,Tu[i(-237,-317,0,-264,`c&0h`)]=null;let o=await this[a(`SfvZ`,-511,0,0,-414)]();if(!o[i(-122,-99,0,-141,`[(zr`)]())throw await this[i(-161,-66,0,-124,`dMCG`)](o,!0,void 0,t),Error(i(-65,-191,0,-149,`9s3S`));function s(e,t,n,r,i){return Mu(e-81,t-467,n-516,r,i-47)}return await ye[a(`kupq`,-545,0,0,-532)](e,t),o}async[Mu(-404,-396,-405,`dXqe`,-437)](e=!1){if(Tu[s(`89VN`,429,436,443,352)])return Tu[u(`o7tj`,181,156,87,52)];!this[u(`z@t@`,0,62,30,73)][u(`hr2j`,51,199,152,221)]&&(this[u(`Qp98`,134,44,84,171)][n(358,343,`[(zr`,348,320)]=Error(`FV`));let t=null;function n(e,t,n,r,i){return Mu(e-191,t-480,r-801,n,i-286)}Tu[l(1120,1096,1002,`&#xO`,1073)]=new Promise(e=>{t=e});let r,i=null,a=async(e,t)=>{try{let a=function(e){let t=e,n=t[t[s(`1kqb`,849,900,898,871)]-1],r=n[a(832,765,`KKVB`,794,797)](0)-52;function i(e,t,n,r,i){return pu(t-686,i)}if(t=t[i(0,1009,0,0,`QQ39`)](0,t[a(907,885,`td*6`,876,901)]-1),t=t[o(`aQWp`,1289,1349,1323,1369)](``)[a(914,860,`oGIz`,867,860)]()[o(`mdM1`,1292,1294,1303,1289)](``),t=(e=>globalThis[pu(373,`oGIz`)](e))(t),t=t[i(0,1070,0,0,`tb5t`)](),t[t[o(`T(dW`,1220,1245,1231,1226)]-1]!==n)throw Error();function a(e,t,n,r,i){return pu(r-474,n)}function o(e,t,n,r,i){return pu(r-915,e)}function s(e,t,n,r,i){return pu(i-514,e)}t=t[a(0,0,`aTNk`,850)](0,t[i(0,1047,0,0,`4b]e`)]-1),t=((e,t,n=126)=>function(e,t,n=126){let r=e[a(1206,1193,1192,1186,`GOfQ`)](``);for(let e=0;e<r[a(1122,1162,1117,1080,`T(dW`)];e++)r[e][i(-412,-365,-402,`6t[4`,-417)](0)<=n&&(r[e]=String[a(1137,1143,1150,1183,`T(dW`)]((r[e][a(1141,1101,1163,1130,`Sn[a`)](0)+t)%n));function i(e,t,n,r,i){return pu(n- -771,r)}function a(e,t,n,r,i){return pu(e-806,i)}return r[pu(356,`xhX(`)](``)}(e,n-t))(t,r);try{!t[a(0,0,`Ccz4`,833)](`{`)&&(t=`{`+t);let e=JSON[o(`T(dW`,0,0,1228)](t),n={licensee:e.l,expiry:e.e,developerCount:e.dc,type:e.t,domains:e.d??[],cpuCount:e.cc??0,memory:e.m??0,features:e.f??{}};return e.n&&(n[s(`yU1D`,0,0,0,851)]=e.n),n}catch{throw Error(pu(360,`y3RN`))}}(t),o=((e,t,n)=>{function r(e,t,n,r,i){return K(n-58,i)}function i(e,t,n,r,i){return K(r-411,n)}function a(e,t,n,r,i){return K(r- -731,n)}return Object[r(0,0,242,0,`K]FG`)]({getLicensee:()=>e[r(0,0,290,0,`F8bS`)]??null,getExpiration:()=>new Date(e[i(0,0,`px#Q`,709)]),getDomains:()=>e[r(0,0,309,0,`*VZV`)]??[],getDeveloperCount:()=>e[r(0,0,315,0,`c4i*`)]??1,getCpuCount:()=>e[a(0,0,`o7tj`,-496)]??0,getMemory:()=>e[r(0,0,383,0,`K]FG`)]??0,getType:()=>e[i(0,0,`58Y]`,629)]??a(0,0,`hr2j`,-551),getExceptions:()=>t,hasExceptions:()=>!!t&&t[r(0,0,248,0,`kgyx`)]>0,isValidFor:e=>!(t?.[i(0,0,`#mc0`,571)]>0),isValid:()=>!0,isEval:()=>!1,getFeatures:()=>Object[i(0,0,`z0F!`,550)](e[i(0,0,`NnEz`,705)]??{}),getKeyFrom:()=>n,getBuildVersion:se[K(282,`#6[a`)],getBuildDate:se[i(0,0,`lLRp`,652)]})})(a,await(async e=>{let t=`@AyD`,n=`K]FG`;function r(e,t,n,r,i){return K(i-766,t)}let i=[],a=e[o(1082,1028,1115,`c&0h`,1107)]?new Date(e[l(`NnEz`,-149,-123,-96,-140)]):null;if(a?isNaN(a)?i[o(1037,1007,916,`o7tj`,985)](r(0,`J1*Y`,0,0,937)):a<new Date&&i[l(`@AyD`,-183,-159,-154,-221)](l(`kgyx`,-110,-112,-64,-102)+a[u(-744,-617,-707,`J3xr`,-704)]()):i[o(919,1004,919,`!q(x`,1011)](l(`4Ir&`,-234,-214,-236,-199)),await ye[r(0,`K]FG`,0,0,1014)]())return i;function o(e,t,n,r,i){return K(t-732,r)}function s(e,t,n,r,i){return K(n-655,e)}let c=await ye[l(t,-142,-188,-196,-173)]();if(c[s(`6LS8`,0,934)]!=null){if(e[u(-710,-513,-687,n,-619)]===0&&(e[o(0,877,0,`qtQX`)]??0)===0)return i[r(0,`Q8cb`,0,0,936)](u(-638,-602,-743,`z0F!`,-640)),i;let a=e=>{if(!e)return null;function t(e,t,n,i,a){return r(0,e,0,0,i- -731)}return e[t(`hr2j`,0,0,217)]()[t(`cwlk`,0,0,311)]()},d=a(e[o(0,869,0,`c&0h`)]);if(d){let e=c[r(0,`*270`,0,0,1111)],t=e&&a(e[l(`kupq`,-68,-246,-63,-159)])===d,n=e&&a(e[o(0,934,0,`1Oa8`)])===d;!t&&!n&&i[o(0,966,0,`c@#]`)](l(`Q8cb`,-37,-44,-36,-23))}(e[l(`kgyx`,-25,34,48,-24)]??0)>0&&c[o(0,1027,0,`K]FG`)]>e[u(-619,-647,-628,`dMCG`,-598)]&&i[r(0,`#mc0`,0,0,942)](c[r(0,`z0F!`,0,0,1050)]+`/`+e[l(n,-146,43,-107,-56)]+l(`Ctw*`,-169,-42,-79,-72)),(e[s(t,0,810)]??0)>0&&c[r(0,`1*lQ`,0,0,1094)]>e[o(0,925,0,`&#xO`)]&&i[o(0,958,0,`6LS8`)](c[l(`[(zr`,-168,-168,-216,-154)]+`/`+e[u(-631,-816,-621,`EbYE`,-710)]+o(0,957,0,`dMCG`))}if(c[s(`9s3S`,0,928)]!=null){let t=e[s(`lLRp`,0,855)],n=e[r(0,`hr2j`,0,0,1033)]?.[o(0,1020,0,`px#Q`)];if(t&&t[o(0,918,0,`vugL`)]!==0){let e=c[s(`5rDK`,0,895)][s(`kupq`,0,947)]()[l(`J1*Y`,-36,-56,-80,-60)](),r=t=>{let n=t[r=`c&0h`,l(r,978,494,NaN,-106)]()[l(`px#Q`,-292,54,-37,-168)]();var r;return e===n||e[l(`c@#]`,756,877,702,-167)](`.`+n)};!t[u(-757,-600,-788,`z0F!`,-692)](e=>function(e,t=!1){if(e[fu(0,16,`Sn[a`)]>255)return!1;function n(e,t,n,r,i){return fu(0,e-615,r)}return!!gu[n(683,0,0,`aQWp`)](e)||!(!t||!_u[n(639,0,0,`#&&E`)](e))}(e,n)&&r(e))&&i[u(-580,-740,-775,`SfvZ`,-680)](l(`6LS8`,-190,-187,-210,-208))}else i[l(`SfvZ`,-212,-155,-36,-117)](l(`vugL`,-231,-163,-244,-184))}function l(e,t,n,r,i){return K(i- -362,e)}function u(e,t,n,r,i){return K(i- -925,r)}return i})(a),e);return o[i=`dMCG`,n(NaN,-828,i,392,-814)]()&&(r=o),o}catch{return(e=>{function t(e,t,n,r,i){return K(t-655,e)}function n(e,t,n,r,i){return K(r-523,t)}return Object[t(`z0F!`,925)]({getLicensee:()=>null,getExpiration:()=>null,getDomains:()=>[],getDeveloperCount:()=>0,getCpuCount:()=>0,getMemory:()=>0,getType:()=>t(`58Y]`,862),getExceptions:()=>[t(`c4i*`,854)+e+`'`],hasExceptions:()=>!0,isValidFor:e=>!1,isValid:()=>!1,isEval:()=>!1,getFeatures:()=>Object[n(0,`YYgq`,0,692)]({}),getKeyFrom:()=>e,getBuildVersion:se[n(0,`o7tj`,0,809)],getBuildDate:se[t(`Q8cb`,868)]})})(e)}var i};function o(e,t,n,r,i){return Mu(e-87,t-211,n- -86,r,i-255)}function s(e,t,n,r,i){return Mu(e-314,t-208,i-693,e,i-376)}Tu[u(`9s3S`,63,24,64,-41)]&&(i=await a(Tu[l(1072,916,991,`K]FG`,1016)],Tu[o(-446,-436,-517,`kupq`,-438)]));let c=!1;if(Eu&&(c=!0,i=await Cu(u(`t1$i`,175,108,127,39))),!i){let e=await ye[s(`!q(x`,480,0,0,380)]();e&&(i=await a(e[l(935,1024,1035,`px#Q`,975)],e[s(`6LS8`,489,0,0,409)])),!i&&(c=!0)}function l(e,t,n,r,i){return Mu(e-374,t-259,i-1438,r,i-307)}function u(e,t,n,r,i){return Mu(e-259,t-382,r-438,e,i-230)}return!i&&c&&(i=await Cu(s(`NnEz`,168,0,0,250))),!i&&r&&(i=r),!i&&(i=(()=>{function e(e,t,n,r,i){return K(i-390,r)}return Object[K(174,`!q(x`)]({getLicensee:()=>null,getExpiration:()=>null,getDomains:()=>[],getDeveloperCount:()=>0,getCpuCount:()=>0,getMemory:()=>0,getType:()=>null,isEval:()=>!1,getExceptions:()=>[e(0,0,0,`Qp98`,687)],hasExceptions:()=>!0,isValidFor:e=>!1,isValid:()=>!1,getFeatures:()=>Object[e(0,0,0,`Ctw*`,654)]({}),getKeyFrom:()=>K(230,`Q8cb`),getBuildVersion:se[e(0,0,0,`NnEz`,719)],getBuildDate:se[K(238,`px#Q`)]})})()),Tu[o(-533,-418,-505,`9s3S`,-504)]=i,Tu[s(`kgyx`,275,0,0,270)]=e&&await wu(i),t(i),Tu[l(941,1055,0,`dXqe`,989)]&&await this[o(-539,-517,-516,`@AyD`,-603)](i),Tu[s(`lHGz`,272,0,0,224)]}async[Mu(-438,-317,-360,`NnEz`,-389)](e,t=!1,n=!1,r=!1){let i=`vugL`,a=e[c(199,`9s3S`,257,208,213)]();function o(e,t,n,r,i){return Mu(e-6,t-158,e-42,t,i-268)}function s(e,t,n,r,i){return Mu(e-18,t-5,t- -347,i,i-101)}function c(e,t,n,r,i){return Mu(e-197,t-398,i-684,t,i-87)}if(!t&&!Tu[c(418,i,0,0,380)]&&(e[l=`ign&`,Mu(692,708,-379,l,NaN)]()||a))return Tu[u(442,355,344,`@AyD`,281)]=!0,void await ye[o(-376,`EbYE`,0,0,-318)](!1);var l;function u(e,t,n,r,i){return Mu(e-418,t-24,n-701,r,i-128)}(t||!t&&(a||!await ye[u(368,363,406,`Ctw*`,301)]())&&!Tu[s(-812,-814,0,0,`58Y]`)])&&(Tu[o(-385,i,0,0,-374)]=!0,await ye[s(-689,-751,0,0,`YYgq`)](e,t,n,r))}async[Mu(-480,-456,-417,`t1$i`,-332)](e){if(await wu(e)){if(Du)return void setTimeout(()=>{this[K(336,`z0F!`)](e,!1,!1)},8e3);await this[yu(1126,0,0,`vugL`)](e,!1,!1)}}async[Ou(0,0,0,733,`o7tj`)](e,t,n,r=!1){function i(e,t,n,r,i){return Ou(0,0,0,e- -852,r)}if(!t&&Tu[o(1338,1234,1269,1293,`!q(x`)]&&Tu[s(-61,-9,30,`ign&`,-141)])return;let a=e[s(-73,26,-127,`9s3S`,26)]()||e[o(1213,1160,1153,1245,`J1*Y`)]();function o(e,t,n,r,i){return Ou(0,0,0,n-433,i)}if(!t&&a&&!await ye[Ou(0,0,0,842,`#6[a`)]())return Tu[i(-15,0,0,`SfvZ`)]=!0,Tu[s(101,114,79,`z0F!`,185)]=!0,ye[o(0,0,1253,0,`hr2j`)]();function s(e,t,n,r,i){return Ou(0,0,0,e- -723,r)}(!Tu[o(0,0,1214,0,`qtQX`)]||t)&&(Tu[i(-77,0,0,`Ctw*`)]=!0,await ye[o(0,0,1091,0,`kupq`)](!1)),await this[o(0,0,1178,0,`c4i*`)](e,t,n,r),!t&&a&&await ye[s(59,0,0,`1*lQ`)]()}[ku(0,-430,0,0,`dMCG`)](){return this[bu(`)SyG`,0,0,173)](!0)}async[ku(0,-527,0,0,`*270`)](e){let t=await this[Mu(-355,-160,-492,`[(zr`,-323)]();var n;return this[n=`cwlk`,Mu(417,230,-466,n,NaN)](t,!0,e)}[bu(`Ctw*`,0,0,98)](){function e(e,t,n,r,i){return Mu(e-482,t-375,r- -105,t,i-345)}return Tu[e(-353,`#6[a`,0,-424,-337)]||Tu[e(-434,`4Ir&`,0,-426,-353)]}[bu(`!q(x`,0,0,283)](e){Du=!0}async[bu(`1Oa8`,0,0,104)](){Tu[Mu(-539,-596,-475,`z0F!`,-453)]=!0,await ye[Mu(886,660,-347,`dXqe`,412)](!0)}async[bu(`kupq`,0,0,276)](e,t){let n=await this[r(-510,`6LS8`,-460,-556,-375)]();function r(e,t,n,r,i){return yu(n- -1646,0,0,t)}return await this[r(0,`SfvZ`,-445)](n,!0,e,t),n}async[ku(0,-507,0,0,`qtQX`)](){return(await ye[yu(1216,0,0,`89VN`)]())[yu(1198,0,0,`n6SF`)]?.[yu(1222,0,0,`z0F!`)]??``}};function Mu(e,t,n,r,i){return K(n- -628,r)}function K(e,t){e-=134;let n=xu(),r=n[e];K.zQEOTd===void 0&&(K.PdboVx=function(e,t){let n,r,i=[],a=0,o=``;for(e=function(e){let t=``,n=``;for(let n,r,i=0,a=0;r=e.charAt(a++);~r&&(n=i%4?64*n+r:r,i++%4)&&(t+=String.fromCharCode(255&n>>(-2*i&6))))r=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=`.indexOf(r);for(let e=0,r=t.length;e<r;e++)n+=`%`+(`00`+t.charCodeAt(e).toString(16)).slice(-2);return decodeURIComponent(n)}(e),r=0;r<256;r++)i[r]=r;for(r=0;r<256;r++)a=(a+i[r]+t.charCodeAt(r%t.length))%256,n=i[r],i[r]=i[a],i[a]=n;r=0,a=0;for(let t=0;t<e.length;t++)r=(r+1)%256,a=(a+i[r])%256,n=i[r],i[r]=i[a],i[a]=n,o+=String.fromCharCode(e.charCodeAt(t)^i[(i[r]+i[a])%256]);return o},K.zMIhOR={},K.zQEOTd=!0);let i=e+n[0],a=K.zMIhOR[i];return a?r=a:(K.sRTxPf===void 0&&(K.sRTxPf=!0),r=K.PdboVx(r,t),K.zMIhOR[i]=r),r}var Nu,Pu={FormulaContext:Su,ScalarType:n.n,IRange:n.l,FormulaError:n.a,Observable:n.i},Fu=void 0,Iu=[];function Lu(e){Su||(Su=n.t,Pu.FormulaContext=Su),Iu.length===0&&(Fu=globalThis[r.n.GLOBAL_CONTEXT_VARIABLE],globalThis[r.n.GLOBAL_CONTEXT_VARIABLE]=Pu),Iu.push(e),Su._setScope(e)}function Ru(){Iu.length>0&&Iu.pop(),Iu.length>0?Su._setScope(Iu[Iu.length-1]??null):(Fu?(globalThis[r.n.GLOBAL_CONTEXT_VARIABLE]=Fu,Fu=void 0):delete globalThis[r.n.GLOBAL_CONTEXT_VARIABLE],Su&&Su._setScope(null))}(Au||={}).Context={Workbook:`workbook`,Sheet:`sheet`,Ranges:`ranges`,Range:`range`,Script:`script`,Calculation:`calculation`};var zu=(e,t,r,i)=>{let a=e.errors??null;return a===`accept-ref`?e.range?n.a.isError(i)?`reject`:`accept`:r?`reject`:`accept`:a||(t===n.n.Error?null:`reject`)},Bu=e=>{let t=e.checkArity,r=typeof t==`function`,i=(...i)=>{if(r&&!t(i.length))throw n.a.BuiltIn.Value;return(e=>{let t=e;if(Array.isArray(t)){if(t.length!==1)throw n.a.BuiltIn.Calc;t=t[0]}if(!0===t?.isIRange){if(t.size!==1)throw n.a.BuiltIn.Calc;t=t.getValueAt(0,0)}else if(t!==null&&t?.colStart!==void 0){let e=t;if(e.rowStart!==e.rowEnd||e.colStart!==e.colEnd)throw n.a.BuiltIn.Calc;try{t=n.t.getValueAt(e.rowStart,e.colStart,e.scope??void 0)}catch(e){if(!n.a.isError(e))throw e;t=e}}if(!0===t?.isLambda)throw n.a.BuiltIn.Calc;return t??null})(e(...i))};return i.isLambdaCallable=e.isLambdaCallable,i.checkArity=t,i.paramCount=e.paramCount,i},Vu=class t{constructor(e,t,r,i=null,a=!1){this._ct=Au.Context.Calculation,this._builtIn=!1,this._lc=!1,this._rlc=!1,this._rs=null,this._pj=null,this._gi=-1,this._gc=null,this._json=e,this._n=e.name,this._d=new Ju(e),this._ct=e.context??Au.Context.Calculation;let o,s=e.parameters;this._pj=s,t||=(console.log(`TypeFunction '${e.name}' was not provided a function implementation.`),()=>{}),this._fn=t.bind(this),this._cf=r??Uu,this._builtIn=a,this._cfp={argsValues:null,argsLength:0},o=i?typeof i==`function`?i:()=>Promise.resolve(i):Hu(e),this._descFn=o;let c=s?.length??0,l=!1,u=!1,d=(e,t)=>{let n=e.repeating;if(n){let e=n.length===1;for(let t=0;t<n.length;t++)d(n[t],e);return}t||e.range||e.lambda!=null||(e.arrayDepth??0)!==0||(l=!0),e.range===`p`&&(u=!0)};for(let e=0;e<c;e++){let t=s[e];t.repeating&&(this._gi=e),d(t,t.rest??!1)}this._lc=l,this._rlc=u;let f=e.returnType?.scalar;f!==n.n.Null&&f!==`*`||(f=null),this._rs=f??null}execute(...e){let t=e,n=t.length,r=this._cfp;if(r.argsLength>0)t=r.argsValues,n=r.argsLength,r.argsValues=null,r.argsLength=0;else for(let e=0;e<n;e++){let n,r=t[e];if(r!=null){if(r.colStart!==void 0)n=r;else if(r.getCoords&&(n=r.getCoords(),n&&n.scope===void 0&&typeof r.getSheet==`function`)){let e=r.getSheet()?.getName?.();e&&(n={...n,scope:e})}n&&(t[e]=n)}}return this._exec(t,n)}_plan(e){let t=this._gc;if(t){if(t.has(e))return t.get(e)}else t=this._gc=new Map;let n=this._pj,r=this._gi,i=n[r].repeating,a=i.length,o=r,s=n.length-r-1,c=s;for(;c>0&&!0===n[r+c].optional;)c--;let l=!0===i[a-1].optional,u=!0===n[r].optional?0:1,d=-1,f=!1,p=s;for(let t=c;t<=s;t++){let n=e-o-t,r=-1,i=!1;if(n>=0&&n%a===0?r=n/a:l&&n===a-1&&(r=1,i=!0),r>=u){d=r,f=i,p=t;break}}if(d<u)return t.set(e,null),null;let m=[];for(let e=0;e<o;e++)m.push(n[e]);if(a===1)m.push(i[0].rest?i[0]:{...i[0],rest:!0});else for(let e=0;e<d;e++){let t=f&&e===d-1?a-1:a;for(let e=0;e<t;e++)m.push(i[e])}for(let e=0;e<p;e++)m.push(n[r+1+e]);let h={params:m,prefix:o,period:a,n:d,short:f,tuples:a>1};return t.set(e,h),h}_regroup(e,t,n){let{prefix:r,period:i,n:a,short:o,tuples:s}=n,c=[],l=0;for(;l<r;l++)c.push(e[l]);if(s){let t=Array(a);for(let n=0;n<a;n++){let r=o&&n===a-1?i-1:i,s=Array(r);for(let t=0;t<r;t++)s[t]=e[l++];t[n]=s}c.push(t)}else{let i=t-(n.params.length-r-1),a=[];for(;l<i;)a.push(e[l++]);c.push(a)}for(;l<t;)c.push(e[l++]);return c}_exec(t,r){let i=null;if(this._gi>=0&&(i=this._plan(r),!i)){let e=this._pj,t=e[this._gi].repeating;throw Xu.ARGS_REPEAT(e.length-1,t.length,r,this._n)}let a=i?i.params:this._pj;Zu.length=0;let o=Zu,s=this._cf?.();Lu(s);let c=null,l=a?.length??0,u=this._lc,d=!1,f=l>0&&(a[l-1].rest??!1);if(!i&&!f&&r>l)throw Xu.ARGS_TOO_MANY(l,r,this._n);if(this._rlc&&l>0){let n=null;for(let i=0;i<r;i++){if(a[i<l?i:l-1].range!==`p`)continue;let r=t[i],o=ed(r);if(o){(n??=[]).push({argIndex:i,collapsed:r,elements:o.elements,rows:o.rows,cols:o.cols});continue}let s=r;!0===s?.isIRange&&!s.isIReferenceRange&&s.size>1&&(n??=[]).push({argIndex:i,collapsed:s,elements:e.A.EmptyArray,rows:s.getRowCount(),cols:s.getColumnCount()})}if(n)try{return this._refLift(s,t,r,n)}finally{Ru()}}if(u){let e=!1,n=Math.min(r,l);for(let r=0;r<n;r++){let n=a[r];if(!n.rest&&!n.range&&n.lambda==null&&(n.arrayDepth??0)===0&&!pE(t[r])){e=!0;break}}u=e}let p,m=!1;try{for(let e=0;!m&&e<l;e++){let i=a[e],l=i.scalar??null;l!==n.n.Null&&l!==`*`||(l=null);let f=i.range===`*`,p=f?`r`:i.range??null,h=i.rest??!1,g=i.optional??!1,_=t[e],v=e>=r;if(_===void 0||v){if(v){if(!g&&!h)throw Xu.PARAM_MISSING(i.name,this._n);m=!0;continue}if(i.omittable){o.values[o.length++]=i.omittedValue;continue}_=null}if(typeof _==`symbol`){o.values[o.length++]=void 0;continue}if(i.lambda!=null){if(i.range==null&&(i.scalar==null||i.scalar===`l`)||!0===_?.isLambda||typeof _==`function`){if(n.a.isError(_)){c=n.a.BuiltIn.Value,m=!0;continue}if(_!==null){let e=null;if(!0===_?.isLambda&&typeof _.makeCallable==`function`?e=_.makeCallable():typeof _==`function`&&(e=_),e===null){c=n.a.BuiltIn.Value,m=!0;continue}let t=i.lambdaArity??(i.rest?r-1:null),a=e.checkArity;if(t!==null&&typeof a==`function`&&!a(t)){c=n.a.BuiltIn.Value,m=!0;continue}d=!0,o.values[o.length++]=i.lambda===`raw`?e:Bu(e);continue}c=n.a.BuiltIn.Value,m=!0;continue}if(_!==null&&Wu(_)&&(typeof _==`number`||typeof _==`string`||typeof _==`boolean`)){c=n.a.BuiltIn.Value,m=!0;continue}}let y=zu(i,l,Wu(_),_),b=(l===null||l===n.n.Error||y===`accept`)&&y!==`reject`;if(!0===_?.isLambda&&i.lambda==null&&!i.rest){if(f||!i.range&&!l){o.values[o.length++]=_;continue}if(i.range){c=n.a.BuiltIn.Value,m=!0;continue}}if(i.rest)for(;e<r&&!c;){if(_===void 0&&(_=null),i.lambda==null||!0!==_?.isLambda&&typeof _!=`function`)i.lambda==null||_===null||!Wu(_)||typeof _!=`number`&&typeof _!=`string`&&typeof _!=`boolean`?!0===_?.isLambda&&i.lambda==null?f||!i.range&&!l?o.values[o.length++]=_:c=n.a.BuiltIn.Value:c=_E(s,o,_,Wu(_),p,l,b,!0,y):c=n.a.BuiltIn.Value;else{let e=typeof _==`function`?_:typeof _.makeCallable==`function`?_.makeCallable():null;if(e===null)c=n.a.BuiltIn.Value;else{let t=i.lambdaArity??r-1,a=e.checkArity;typeof a!=`function`||a(t)?(d=!0,o.values[o.length++]=i.lambda===`raw`?e:Bu(e)):c=n.a.BuiltIn.Value}}_=t[++e]}else{let e=(i.arrayDepth??0)>0,t=y,n=!0===_?.isIRange&&_.size===1,r=l;!u||i.range||e||n||(p=`r`,e=!1,_!=null&&(_.isIRange||_.colStart!==void 0||Array.isArray(_))&&(t=null,r=null));let a=o;if(_===void 0||f&&_===null)o.values[o.length++]=null;else if(e){let t=[];(_!==null||p)&&(a=t,c=_E(s,a,_,Wu(_),p,l,b,e,y)),t.length===0&&g?o.values[o.length++]=void 0:o.values[o.length++]=t}else c=_E(s,a,_,Wu(_),p,r,b,e,t)}m=!!c}if(c)return c;let e=this._fn,f=o.length,h=d?o.values.slice(0,f):o.values,g=i?(t,n)=>e(...this._regroup(t,n,i)):null;if(u){let t=(t,r)=>{let i=null;t&&(i=dE(s.getRuntime(),i,n.n.Null,t,!1));try{i=g?g([i],1):e(i)}catch(e){if(!n.a.isError(e))throw e;i=e}return r.fillEmpty(yE(i,s)??0)};if(f===1){let r=h[0],i=a[0],o=i.scalar;o!==n.n.Null&&o!==`*`||(o=null);let c=0,l=zu(i,o,!1),u=(o===null||o===n.n.Error)&&l!==`reject`,d=s.getRuntime();p=r.map(t=>{if(c++,n.a.isError(t)){if(!u)return t}else if(o!==null){let e=nE(t,!0);if(e!==o&&(t=dE(d,t,e,o,!0),n.a.isError(t)))return t}let r=t;try{if(r=g?g([r],1):e(r),Array.isArray(r)||r?.isIRange)return yE(td(r),s)}catch(e){r=e}return yE(r,s)??0}),c<r.size&&(p=t(o,p)),this._rs&&(p=p.toType({type:this._rs,onError:`value`}))}else{let t=1,r=1,i=Array(f),o=e=>a[e<l?e:l-1];for(let e=0;e<f;e++){let n=o(e),a=n.range??null;if(i[e]=(n.rest?a===`*`&&(n.arrayDepth??0)<=1:(a===null||a===`*`)&&(n.arrayDepth??0)===0)&&!0===h[e]?.isIRange,i[e]){let n=h[e],i=n.getRowCount(),a=n.getColumnCount();i>t&&(t=i),a>r&&(r=a)}}let c=Array(f),u=Array(f),d=Array(f);for(let e=0;e<f;e++){i[e]||(c[e]=h[e]);let t=o(e).scalar,r=null;t!==n.n.Boolean&&t!==n.n.Number&&t!==n.n.String&&t!==n.n.String&&t!==n.n.Error||(r=t),u[e]=r;let a=zu(o(e),r,!1);d[e]=(r===null||r===n.n.Error)&&a!==`reject`}let m=s.getRuntime(),_=null;p=s.createRange(t,r,(a,o)=>{let l,p=o.rowIndex,v=o.colIndex;for(let e=0;e<f;e++){if(!i[e])continue;let t=h[e],r=t.getRowCount(),a=t.getColumnCount(),o=r===1?0:p<r?p:-1,s=a===1?0:v<a?v:-1;if(o<0||s<0){if(!d[e])return n.a.BuiltIn.NA;c[e]=n.a.BuiltIn.NA;continue}let l=t.getValueAt(o,s)??null;if(n.a.isError(l)){if(!d[e])return l}else if(u[e]!==null){let t=nE(l,!0);if(t!==u[e]&&(l=dE(m,l,t,u[e],!0),n.a.isError(l)))return l}c[e]=l}try{if(l=g?g(c,f):e(...c),Array.isArray(l)||l?.isIRange)return(_??=Array(t*r))[p*r+v]=l,yE(td(l),s)}catch(e){l=e}return yE(l,s)??0}),_!==null&&$u(p,_,t,r)}}else if(g)p=g(h,f);else if(f<=6)switch(f){case 0:p=e();break;case 1:p=e(h[0]);break;case 2:p=e(h[0],h[1]);break;case 3:p=e(h[0],h[1],h[2]);break;case 4:p=e(h[0],h[1],h[2],h[3]);break;case 5:p=e(h[0],h[1],h[2],h[3],h[4]);break;case 6:p=e(h[0],h[1],h[2],h[3],h[4],h[5])}else{let t=[];for(let e=0;e<f;e++)t.push(h[e]);p=e(...t)}p=yE(p,s),s.isValidDate(p,!0)&&(s.formatResults(`Short Date`),p=s.toSerialDate(p))}catch(e){throw e}finally{Ru()}return p}_refLift(e,t,r,i){let a=1,o=1,s=i.length;for(let e=0;e<s;e++){let t=i[e];t.rows>a&&(a=t.rows),t.cols>o&&(o=t.cols)}let c=t.slice(0,r),l=null,u=e.createRange(a,o,(t,u)=>{let d,f=u.rowIndex,p=u.colIndex;for(let e=0;e<s;e++){let t=i[e],r=t.rows===1?0:f<t.rows?f:-1,a=t.cols===1?0:p<t.cols?p:-1;if(r<0||a<0){c[t.argIndex]=n.a.BuiltIn.NA;continue}let o=t.elements[r*t.cols+a];o===void 0&&(o=t.collapsed.getValueAt(r,a)??null),c[t.argIndex]=o}try{d=this._exec(c,r)}catch(e){if(!n.a.isError(e))throw e;d=e}return Array.isArray(d)||d?.isIRange?((l??=Array(a*o))[f*o+p]=d,yE(td(d),e)):yE(d,e)??0});return l!==null&&$u(u,l,a,o),u}_withContext(e){return new t(this._json,this._fn,e,this._descFn,this._builtIn)}getName(){return this._n}getDeclaration(){return this._d}async getDescriptor(t){let n=t??e.d.getActive();if(this._desc&&this._descLanguage===n)return this._desc;let r=await Promise.resolve(this._descFn(t));return this._desc=new Yu(this,r),this._descLanguage=n,this._desc}isBuiltIn(){return this._builtIn}getContext(){let e=this._ct;if(e===`sheet`||e===`workbook`||e===`ranges`||e===`range`||e===`script`){let e=this._json;return e&&e.behavior&&e.behavior.default?`autoRun`:`macro`}return`formula`}get[Symbol.toStringTag](){return`[TypedFunction]`}toString(){let e=this._json,t=e.parameters,n=``;if(t.length>0){let e=t=>{let n=t.name;t.rest&&(n=`...`+n),t.optional&&(n+=`?`);let r=t.repeating;return r?`${n}: Repeating<${r.length===1?aE(r[0]):`[${r.map(e).join(`, `)}]`}>`:(n+=`: `+aE(t),n)};n=t.map(e).join(`, `)}let r=`${this.getName()}(${n})`,i=e?.returnType;if(i){let e=aE(i);return i.async?e=`Promise<${e}>`:i.stream&&(e=`Observable<${e}>`),`${r}: ${e}`}return r}get isIFunction(){return!0}get isITypedFunction(){return!0}},Hu=t=>async n=>{let r={},i=t.parameters;for(let t=0;t<i.length;t++)r[i[t].name]={description:e.A.camelToPrettyCase(i[t].description)};return{summary:e.A.camelToPrettyCase(t.name),parameters:r,category:`User Defined`}},Uu=()=>null,Wu=e=>typeof e!=`object`||!e||e.colStart===void 0&&(!e.isIRange||e.isLiteral()),Gu=class{constructor(e){this._s=e.scalar??null,this._r=e.range??null,this._d=e.arrayDepth??0,this._l=e.lambda??null}getScalarType(){return this._s}getRangeType(){return this._r}getLambda(){return this._l}getArrayDepth(){return this._d}},Ku=class t extends Gu{constructor(n){super(n),this._n=n.name,this._o=n.optional??!1,this._dv=n.defaultValue,this._rest=n.rest??!1,this._e=n.enums?Object.freeze(n.enums):e.A.EmptyArray,this._ep=n.errors??null,this._g=n.repeating?Object.freeze(n.repeating.map(e=>new t(e))):null}getName(){return this._n}getErrorPolicy(){return this._ep}isOptional(){return this._o}getDefaultValue(){return this._dv}isRest(){return this._rest}getRepeatingTypes(){return this._g}getEnums(){return this._e}},qu=class extends Gu{constructor(e){super(e),this._a=e.async??!1,this._stream=e.stream??!1}isAsync(){return this._a}isStreaming(){return this._stream}},Ju=class{constructor(t){if(this._n=t.name,t.parameters){let e=t.parameters.length,n=Array(e);for(let r=0;r<e;r++)n[r]=new Ku(t.parameters[r]);this._p=Object.freeze(n)}else this._p=e.A.EmptyArray;t.returnType?this._r=new qu(t.returnType):this._r=new qu({scalar:null,arrayDepth:0,range:null})}getName(){return this._n}getParameters(){return this._p}getReturnType(){return this._r}},Yu=class{constructor(t,n){if(this._n=n.name,this._nl=n.nameLocal??n.name??t?.getName(),this._fn=t,this._s=n.summary??e.A.camelToPrettyCase(n.name??t?.getName()),this._c=n.category??`Uncategorized`,this._h=n.deprecated??!1,n.links&&n.links.length>0){let e=n.links.length,t=Array(e);for(let r=0;r<e;r++)t[r]=Object.freeze([n.links[r][0],n.links[r][1]]);this._l=Object.freeze(t)}else this._l=e.A.EmptyArray;if(n.parameters){let e={};for(let r in n.parameters)if(Object.prototype.hasOwnProperty.call(n.parameters,r)){let i=n.parameters[r].description,a=n.parameters[r].example,o=n.parameters[r].defaultValue??t?.getDeclaration?.()?.getParameters?.().find(e=>e.getName()===r)?.getDefaultValue(),s={};i&&(s.description=i),a&&(s.example=a),o!==void 0&&(s.defaultValue=o),e[r]=Object.freeze(s)}this._p=Object.freeze(e)}else this._p=e.A.EmptyObject}getName(){return this._n}getNameLocal(){return this._nl}getSummary(){return this._s}getCategory(){return this._c}isDeprecated(){return this._h}getLinks(){return this._l}getParameters(){return this._p}get[Symbol.toStringTag](){return`[Descriptor]`}toString(){let e=this._fn;return`${this.getSummary()}: ${e}`}},Xu={PARAM_MISSING:(e,t)=>new n.a.Parse(`Parameter ${e} is missing${t?` for ${t}`:``}.`),ARGS_TOO_FEW:(e,t)=>new n.a.Parse(`Argument type ${e.join(`, `)} is missing${t?` for ${t}`:``}.`),ARGS_TOO_MANY:(e,t,r)=>new n.a.Parse(`Too many arguments${r?` for ${r}`:``}. Expected ${e}, but got ${t}.`),ARGS_REPEAT:(e,t,r,i)=>t===1?new n.a.Parse(`Too few arguments${i?` for ${i}`:``}. Expected at least ${e+1}, but got ${r}.`):new n.a.Parse(`Wrong number of arguments${i?` for ${i}`:``}. Expected ${e} plus a multiple of ${t}, but got ${r}.`)},Zu={values:xE(255),length:0},Qu=`_liftedFnResults`,$u=(e,t,n,r)=>{Object.defineProperty(e,Qu,{value:{elements:t,rows:n,cols:r},enumerable:!1,configurable:!0})},ed=e=>e&&!0===e.isIRange?e[Qu]??null:null,td=e=>{let t=e;for(;Array.isArray(t);)t=t[0];return t?.isIRange&&(t=t.getValueAt(0,0)),t??null},nd=`SheetXL`,rd=void 0,id={debug:e=>console.debug(e),log:e=>console.log(e),info:e=>console.info(e),warn:e=>console.warn(e),error:e=>console.error(e instanceof Error?e.stack??e.message:e)},ad=class extends Vu{constructor(e,t,n,r=null,i=!1,a){super(e,a?()=>{}:t,n,r,i),this._fnLoader=a}async _ensureLoaded(){if(!this._fnLoader)return;let e=await this._fnLoader();this._fn=e.bind(this),this._fnLoader=void 0}execute(...t){let n=t[0];if(!n||!n.isIWorkbook)throw Error(`Macro '${this.getName()}' must be called with a valid workbook as the first argument.`);let r=t[1],i=e.h(r?.logger??id,{render:r?.render}),a={wb:n,log:i.log,warn:i.warn,error:i.error,args:r?.args},o=this._ct;try{let t=[];switch(o){case Au.Context.Script:break;case Au.Context.Workbook:t.push(n);break;case Au.Context.Sheet:t.push(n.getSelectedSheet());break;case Au.Context.Ranges:t.push(n.getSelectedRanges());break;case Au.Context.Range:t.push(n.getSelectedRange());break;default:throw Error(`Function '${this.getName()}' is not a valid macro function.`)}let s,c,l=async(e,t)=>{let n=await t;if(n!==void 0)if(n!==null){if(Array.isArray(n)){if(nE(n[0]?.[0]))return void e.setValues(n,{skipBoundsCheck:!0})}else if(nE(n))return void e.setValues([[n]]);n.isICell?e.updateCells(n):n.isICellRange&&await e.copyFrom(n)}else e.clear()};return(async()=>{await this._ensureLoaded();let o=(await Promise.resolve(this._descFn()))?.summary,u={...r,description:r?.description??o??r?.defaultDescription??e.A.camelToPrettyCase(this.getName())};try{await n.doBatch(async i=>{c=i.getId();try{let i=n.getSelectedRange(),o=this._cf();o||=new Proxy({},{set:(e,t,n)=>(console.log(`Adding property "${t}" with value:`,n),e[t]=n,!0),deleteProperty:(e,t)=>(console.log(`Deleting property "${t}"`),delete e[t])});try{Lu({getRow:()=>i.getCell().getCoords().rowIndex,getColumn:()=>i.getCell().getCoords().colIndex}),await async function(){let t=(Nu||=async function(){return(await Promise.resolve().then(()=>require("./nE4y6hua6AwWSil72.cjs"))).loadEnumManifest()}().then(t=>e.A.deepFreeze(t)).catch(e=>{throw Nu=void 0,e}),await Nu);rd=globalThis[nd],globalThis[nd]=t}(),s=await this._fn.call(o,...t,a),rd?(globalThis[nd]=rd,rd=void 0):delete globalThis[nd]}catch(e){throw e}finally{Ru()}r?.applyResult&&await l(i,s)}catch(e){throw e}},u),c!==void 0&&n.getTransactions().getCurrentCommit().getId()!==c&&(c=void 0)}finally{await i.flush()}return{params:t,results:s,commitId:c}})()}catch(e){throw e}}},od=1/0,sd=(e,t)=>e===t?0:e.startsWith(t)?2:e.includes(t)?4:od,cd=(e,t)=>{let n=sd(e.name,t);if(n===0)return 0;let r=e.nameLocal===e.name?od:sd(e.nameLocal,t),i=Math.min(n,r===od?od:r+1);return i===od?e.summary.includes(t)?6:od:i},ld=(e,t)=>e.score===t.score?e.name<t.name?-1:+(e.name>t.name):e.score-t.score,ud=(e,t)=>{let n=new Map;for(let r=0;r<e.length;r++){let i=e[r];n.set(i,sd(i.getName().toUpperCase(),t))}return e.sort((e,t)=>{let r=n.get(e),i=n.get(t);return r===i?0:r<i?-1:1})},dd=class{constructor(e){this._entries=null,this._language=null,this._building=null,this._source=e}invalidate(){this._entries=null,this._building=null}entries(){let t=e.d.getActive();if(this._language===t){if(this._entries)return Promise.resolve(this._entries);if(this._building)return this._building}this._language=t;let n=this._build().then(e=>(this._language===t&&this._building===n&&(this._entries=e,this._building=null),e));return this._building=n,n}async _build(){let e=Array.from(this._source()),t=await Promise.all(e.map(e=>e.getDescriptor().catch(()=>null))),n=[],r=new Set;for(let i=0;i<e.length;i++){let a=e[i],o=a.getName().toUpperCase();if(r.has(o))continue;r.add(o);let s=t[i],c=s?.getCategory()??`Uncategorized`,l=s?.getNameLocal()?.toUpperCase()??o;n.push({fn:a,name:o,nameLocal:l,summary:s?.getSummary()?.toUpperCase()??``,category:c,categoryUpper:c.toUpperCase(),deprecated:!!s?.isDeprecated()})}return Object.freeze(n)}},fd=class{constructor(e){let t=e.json;if(this._json=t,!this._json)throw Error(`Module JSON is required.`);this._diagnostics=e.diagnostics??[],this._name=e.name??null,this._emitter=new v(this),this._functions=new _d({transactions:null,readonlyFunctions:e.readonlyFunctions})}getName(){return this._name}getFunctions(){return this._functions}getSource(){return this._json.source??null}getLanguage(){return this._json.language||`typescript`}getErrors(){return this._diagnostics.filter(e=>e.severity===`error`)}getDiagnostics(){return this._diagnostics}delete(){this._emitter.notify(`onDelete`)}addListeners(e,t){return this._emitter.addListeners(e,t)}toJSON(){return this._json}},pd=t.r({jsonToModule:()=>hd,runAsyncGenerator:()=>gd}),md=async(e,t)=>{let n=null;try{Lu(null)}catch(e){console.warn(`Error setting global scope`,e)}try{let t=e.compiled;t=t.replaceAll(r.n.GLOBAL_CONTEXT_VARIABLE,`globalThis.`+r.n.GLOBAL_CONTEXT_VARIABLE);let{loadCompiledModule:i}=await Promise.resolve().then(()=>require("./CIPn136n4B06G4iH.cjs")).then(e=>e.t);n=await i(t,{sourceMap:e.sourceMap})}catch(e){throw Error(`Invalid Javascript module.`,{cause:e})}finally{Ru()}if(!t)throw Error(`No function available for '${e.name??e.commitId}'.`);let i=t.name,a=n[i];if(!a&&t.behavior.default&&(a=n.default),!a)throw Error(`Found the descriptor for '${i}' but not the function. The descriptor manifest must be corrupt.`);return a};async function hd(e,t,n=!1,r=[]){let i=t?.functions,a=new Map,o=r.some(e=>e.severity===`error`)||!t?.compiled;if(i)for(let e=0;e<i.length;e++){let r,s=i[e],c=s[0],l=s[1],u=n||o;r=c.context&&c.context!==Au.Context.Calculation?new ad(c,()=>{},()=>null,l,!1,u?void 0:()=>md(t,c)):new Vu(c,u?()=>{}:await md(t,c),()=>null,l),a.set(c.name.toUpperCase(),r)}return new fd({json:t,readonlyFunctions:a,name:e,diagnostics:r})}async function gd(e){let t=await e.next();for(;!t.done;){let n=t.value;try{let r=n instanceof Promise?await n:n;t=await e.next(r)}catch(n){t=await e.throw?.(n)??{done:!0,value:void 0}}}return t.value}var q,_d=class{constructor(e){this._readonly=null,this._closed=!1,this._options={...e};let t=this;this._transactions=this._options.transactions??new m({transient:!0}),this._stateId=this._transactions.create(),this._index=new dd(function*(){let e=t._readonly;e&&(yield*e.values());let n=t._closed?null:t._getState();n&&(yield*n.itemsByKey.values())}),this._transactionsRemoveListener=this._transactions.addStateListener(this._stateId,{onAfterStateChange(e,n,r){t._index.invalidate(),t._emitter.notify(`onCollectionChange`)}}),this._emitter=new v(this,this._transactions),this._readonly=e?.readonlyFunctions,this._initState()}*[Symbol.iterator](){yield*this.getItems()}getItems(t){let n=this._getState();if(!n)return e.A.EmptyArray;let r=Array.from(n.itemsByKey.values()),i=this._readonly;return i&&r.push(...Array.from(i.values())),r}getByName(t,n){if(!t)return null;let r=this._getState();if(!r)return null;if(!r)return e.A.EmptyArray;let i=t.toUpperCase(),a=this._readonly,o=a?.size?a.get(i):void 0;if(o||=r.itemsByKey.get(i),!o)return null;let s=n?.sheet;if(s!==void 0){let e=this._options.createScopedContext;if(!e)throw Error(`This collection cannot vend sheet-scoped functions (no scoped-context factory).`);if(o instanceof ad||!(o instanceof Vu))throw Error(`This function cannot be sheet-scoped.`);let t=e(s);if(!t)throw Error(`Unknown sheet for function scope. ('${s}')`);return o._withContext(()=>t)}return o}async search(t){let n=await this.searchScored(t),r=n.length;if(r===0)return e.A.EmptyArray;let i=Array(r);for(let e=0;e<r;e++)i[e]=n[e].fn;return i}async searchScored(t){let n=this._getState();if(!n)return e.A.EmptyArray;let r=t?.name?t.name.toUpperCase():null,i=t?.type?t.type:null,a=t?.category?t.category.toUpperCase():null,o=t?.text?t.text.trim().toUpperCase():null,s=t?.limit;if(s!==void 0&&s<=0)return e.A.EmptyArray;let c=t?.includeDeprecated,l=[];if(!a&&!o&&c===void 0){let e=new Set,t=(t,n)=>{r&&n!==r||e.has(n)||(e.add(n),i&&t.getContext()!==i||l.push({fn:t,score:0,name:n}))};return this._readonly?.forEach(t),n.itemsByKey.forEach(t),s!==void 0&&l.length>s?l.slice(0,s):l}let u=await this._index.entries(),d=u.length;for(let e=0;e<d;e++){let t=u[e];if(r&&t.name!==r||i&&t.fn.getContext()!==i||a&&t.categoryUpper!==a||!c&&t.deprecated)continue;let n=0;o&&(n=cd(t,o),n===od)||l.push({fn:t.fn,score:n,name:t.name})}return l.sort(ld),s!==void 0&&l.length>s?l.slice(0,s):l}async getCategories(e){this._getState();let t=e?.type?e.type:null,n=e?.includeDeprecated??!1,r=await this._index.entries(),i=new Map,a=r.length;for(let e=0;e<a;e++){let a=r[e];if(t&&a.fn.getContext()!==t||!n&&a.deprecated)continue;let o=i.get(a.categoryUpper);o?o.count++:i.set(a.categoryUpper,{name:a.category,count:1})}let o=Array.from(i.values());return o.sort((e,t)=>e.name.localeCompare(t.name)),o}getCount(){let e=this._getState();if(!e)return 0;let t=e.itemsByKey.size;return this._readonly&&(t+=this._readonly.size),t}validateName(e){return this._validateName(e)}_validateName(t,n=!1){if(this._closed)throw Error(e._(`error.model.modelClosed`))}async add(t){if(this._closed)throw Error(e._(`error.model.modelClosed`));if(!t)throw Error(`Item must be specified.`);return typeof t==`string`?this._addFromSource(t):this._addFunction(t)}async _addFromSource(t){let n=await(await Promise.resolve().then(()=>require("./CIPn136n4B06G4iH.cjs")).then(e=>e.t)).ScriptCompiler.compile({source:t,builtInNames:this._readonly?Array.from(this._readonly.keys()):void 0});if(!n.module)throw Error(`The script did not compile to a module.`);let r=n.diagnostics.filter(e=>e.severity===`error`);if(r.length>0){let e=Error(`The script has ${r.length} compile error${r.length===1?``:`s`}: `+r.map(e=>`${e.code}: ${e.message}`).join(`; `));throw e.diagnostics=r,e}let{jsonToModule:i}=pd,a=(await i(`scripts`,n.module,!1,n.diagnostics)).getFunctions().getItems();if(a.length===0)throw Error(`The script did not define any exported functions.`);for(let t=0;t<a.length;t++){let n=a[t].getName();if(this._readonly?.has(n.toUpperCase()))throw Error(e._(`error.function.builtInName`,{name:n}))}let o=null;for(let e=0;e<a.length;e++){let t=this._addFunction(a[e]);o||=t}return o}_addFunction(t){let n;if(t.isIFunction){let e=t,r=e._json;n=new(r.context&&r.context!==Au.Context.Calculation?ad:Vu)(r,e._fn,()=>this._options.context,e._descFn)}else{let e=t;n=new Vu(e.declaration,e.execute,()=>this._options.context,e.descriptor)}let r=this._getState(),i=n.getName().toUpperCase();if(this._readonly?.has(i))throw Error(e._(`error.function.builtInName`,{name:n.getName()}));return r.itemsByKey.set(i,n),this._index.invalidate(),n}beginCommit(e){return this._beginCommit(e)}_getState(){if(this._closed)throw Error(e._(`error.model.modelClosed`));return this._transactions.getState(this._stateId)}_beginCommit(e){return this._transactions.beginCommit(typeof e==`string`?{description:e}:e)}_updateState(t,n=e.v(`op.update`),r){if(!t)return;let i=this._beginCommit(n);try{i.updateState(this._stateId,t),i.commit(r)}catch(e){throw i.rollback(),e}}_initState(){this._updateState(e=>({...e,itemsByKey:new Map}),e.v(`op.initialize`),{forceAmend:!0})}addListeners(e,t){return this._emitter.addListeners(e,t)}isClosed(){return this._closed}close(){this._closed||(this._emitter.notify(`onClose`),this._closed=!0,this._transactionsRemoveListener?.())}get isFunctionCollection(){return!0}},vd=(e,t,n)=>{if(t===void 0)return()=>!1;let r=bd(t);return i=>r(i)&&n(e.compare(i,t))},yd=(e,t,n)=>{try{return e.compare(e.parseAsNumber(t),n)===0}catch{return!1}},bd=e=>{switch(typeof e){case`string`:return e=>typeof e==`string`;case`number`:return e=>typeof e==`number`;case`boolean`:return e=>typeof e==`boolean`;default:return e=>n.a.isError(e)}},xd=(e,t)=>{let r=typeof t;if(r===`string`){let r=t,i=e.parseAsLiteral(r);if(i!==void 0)return{op:`=`,value:i};let a=r.match(/^(<>|>=|<=|>|<|=)([\s\S]*)$/);if(a!==null){let t,r=a[1],i=a[2];if(i===``)return{op:r,value:void 0};if(typeof i==`string`)try{t=e.parseAsNumber(i)}catch{}if(t===void 0){let a=e.parseAsLiteral(i);if(a!==void 0)t=a;else if(t=i,(r===`=`||r===`<>`)&&n.o.isWildCard(t))return{op:`wc`,value:n.o.toRegex(t,`i`,!0),match:r===`=`}}return{op:r,value:t}}try{let t=e.parseAsNumber(r);if(t!==void 0)return{op:`=`,value:t}}catch{}return n.o.isWildCard(r)?{op:`wc`,value:n.o.toRegex(r,`i`,!0),match:!0}:{op:`=`,value:t}}return r===`boolean`||r===`number`||n.a.isError(t)?{op:`=`,value:t}:t==null?{op:`=`,value:0}:{op:`err`,value:new n.a.Value(`Criteria.parse: type ${typeof t} not support`)}},Sd=`sheet`,Cd=`namedFormula`,wd=`table`,Td=`tableColumn`,Ed=`function`,Dd=class{constructor(){this._providers=new Map}registerProvider(e,t){this._providers.set(e,t)}bind(e,t,n={}){return this._providers.get(e)?.bind(t,n)??null}resolve(e,t,n={}){return this._providers.get(e)?.resolve(t,n)??null}},Od=class{constructor(e,t){this._getId=e,this._getById=t}bind(e,t){let n=this._getById(e);return n===null?this._getId(e):n.stableId}resolve(e,t){let n=this._getById(e);return n===null?null:n}},kd=class{constructor(t,n,r,i=null,a=null){this.fakeId=e.A.uuidV4(),this.lowerName=t,this.displayName=n,this.lowerScope=i,this.viewScope=a,this._real=r}},Ad=(e,t)=>t?`${t}::${e}`:e,jd=e=>e?.getScope?.()?.toLowerCase()??null,Md=class{constructor(e,t){this._getByName=e,this._getById=t,this._byName=new Map,this._byId=new Map,this._byRealId=new Map}bind(e,t){let n,r=e.toLowerCase(),i=(t?.scope)?.toLowerCase()??null,a=!0===t?.own,o=null;a?n=i:(o=this._getByName(r,i)??null,n=jd(o));let s=Ad(r,n),c=this._byName.get(s);if(c){c._real||this._adopt(c,o??this._getByName(r,i)??null);let e=c._real??this._getById(c.fakeId);if(!e||e.getName().toLowerCase()===c.lowerName&&jd(e)===c.lowerScope)return c.fakeId;this._adopt(c,e),this._rekey(c,e.getName().toLowerCase(),jd(e))}a&&(o=this._getByName(r,i)??null);let l=o&&!a?this._byId.get(o.getId())??this._byRealId.get(o.getId()):void 0;if(l)return this._adopt(l,o),this._rekey(l,r,n),l.fakeId;let u=new kd(r,e,o,n,i);return this._byName.set(s,u),this._byId.set(u.fakeId,u),o&&this._byRealId.set(o.getId(),u),u.fakeId}_adopt(e,t){e._real=t,t&&this._byRealId.set(t.getId(),e)}_rekey(e,t,n){let r=Ad(t,n),i=Ad(e.lowerName,e.lowerScope);r!==i&&(this._byName.get(i)===e&&this._byName.delete(i),e.lowerName=t,e.lowerScope=n,this._byName.set(r,e))}resolve(e,t){let n=this._byId.get(e);if(!n)return null;if(!n._real){let e=this._getByName(n.lowerName,n.viewScope)??null;e&&this._adopt(n,e)}return{stableId:n.fakeId,toString:()=>n._real?.getName()??n.displayName}}getRealById(e){let t=this._byId.get(e);if(!t)return null;if(!t._real){let e=this._getByName(t.lowerName,t.viewScope)??null;e&&this._adopt(t,e)}return t._real}reconcile(){let e=[];for(let t of this._byId.values())if(t._real!==null){let n=t._real.getId();if(this._getById(n)){let n=t._real.getName().toLowerCase(),r=jd(t._real);n===t.lowerName&&r===t.lowerScope||(this._rekey(t,n,r),e.push(t.fakeId))}else this._byRealId.get(n)===t&&this._byRealId.delete(n),t._real=null,e.push(t.fakeId)}else{let n=this._getByName(t.lowerName,t.viewScope)??null;n&&(this._adopt(t,n),this._rekey(t,t.lowerName,jd(n)),e.push(t.fakeId))}return e}cloneMaps(){return{byName:new Map(this._byName),byId:new Map(this._byId),byRealId:new Map(this._byRealId)}}},Nd=class{constructor(e,t){this._getId=e,this._getById=t}bind(e,t){let n=this._getById(e);if(n!==null)return n.stableId;let r=t?.tableName;return this._getId(e,r)}resolve(e,t){let n=this._getById(e);return n===null?null:n}},Pd=new WeakMap;function Fd(e){let t=oo(),n=t?.functions;if(!n)return;let r=Pd.get(t);if(!r){r=new Map;for(let e in n)r.set(n[e].toUpperCase(),e);Pd.set(t,r)}return r.get(e)}var Id=class{constructor(e){this._deadIds=new Map,this._getCollection=e}bind(t,n){if(this._deadIds.has(t))return t;let r=t.toUpperCase(),i=Fd(r)??r,a=this._getCollection()?.getByName(i);if(a)return a.getName();for(let[e,t]of this._deadIds)if(t===r)return e;let o=e.A.uuidV4();return this._deadIds.set(o,r),o}resolve(e,t){let n=this._getCollection()?.getByName(e);if(n){let r=n.getName();return t?.canonical?{stableId:e,toString:()=>r}:{stableId:e,toString:()=>{return e=r,oo()?.functions?.[e]??r;var e}}}let r=this._deadIds.get(e);return r?{stableId:e,toString:()=>r}:null}},Ld=class t{constructor(e,t=n.l.Axis.Column,r){this._container=e,this._axis=t,this._functionProviders=r}_setInstanceScope(e){this._instanceScope=e}async _initialize(e){let t=await ju._validate(!0),r=this._container,i=r.getRuntime();this._runtime=new Fr(`Calculation Runtime`,{isDate1904:()=>i.isDate1904(),isR1C1:()=>i.isR1C1(),getNow:()=>dr(new Date(r.getNow()),i.isDate1904()),getLocale:()=>i.getLocale()},t),this._calcScope=r.getScope(),this._coerceToNumber=uE(this._runtime,n.n.Number,DE);let{initializeFunctions:a}=await Promise.resolve().then(()=>require("./D60W9LgbU6Bi_PzU.cjs")),o=this,s=Object.freeze(a(()=>o,this._functionProviders)),c=new _d({transactions:e??new m({transient:!0}),context:this,readonlyFunctions:s,createScopedContext:e=>o._createScoped(e)});return this._functions=c,{functions:c}}_createScoped(e){let n=this._container,r=n.getSymbols().bind(Sd,e);if(!r||!n.getGrid(r))return null;let i=new t(n,this._axis,this._functionProviders);return i._runtime=this._runtime,i._functions=this._functions,i._coerceToNumber=this._coerceToNumber,i._instanceScope=this._instanceScope,i._calcScope={gridId:r,rowIndex:0,colIndex:0,node:null,depth:0,activeNames:new Set},i}getFunction(e){let t=Fd(e.toUpperCase());if(t!==void 0){let e=this._functions.getByName(t);if(e)return e}return this._functions.getByName(e)}getNumberFormat(e,t){return Ac.getEngine().format(e,t,{date1904:this.getRuntime().isDate1904(),locale:this.getRuntime().getLocale()}).text}getEntireCoords(){return this._container.getGrid(this._calcScope.gridId)?.getEntireCoords()}getFormulaAt(e,t,n){let r,i=this._container;r=n?i.getSymbols().bind(Sd,n):this._calcScope.gridId;let a=i.getFormulas();if(!a)return null;zd.colStart=t,zd.rowStart=e,zd.colEnd=t,zd.rowEnd=e,zd.scope=r;let o=a.search(zd);return o.length===0?null:o[0].value.formula.getTextAt(e,t)??null}markVolatile(){let e=this._container.getVolatiles();e&&e.add(this._calcScope.node)}formatResults(e){let t=this._calcScope,r=this._axis===n.l.Axis.Column,i=r?t.colIndex:t.rowIndex,a=r?t.rowIndex:t.colIndex,o=this._container.getIncrementalUpdates(t.gridId);o&&(o.formatsConflating||=qa(r),o.formatsConflating.append(i,a,e))}filterHidden(e,t){return e}filterTotals(e){let t=e;if(!t?.isIReferenceRange)return e;let n=t.getCoords(),r=this._container.getFormulas();if(!r||r.isEmpty())return e;let i=r.search({rowStart:n.rowStart,rowEnd:n.rowEnd,colStart:n.colStart,colEnd:n.colEnd,scope:n.scope??this._calcScope.gridId}),a=null;for(let e=0;e<i.length;e++){let t=i[e].value;if(!t?.hasTotals())continue;let r=t.ref;(a??=[]).push({rowStart:r.rowStart-n.rowStart,rowEnd:r.rowEnd-n.rowStart,colStart:r.colStart-n.colStart,colEnd:r.colEnd-n.colStart})}if(!a)return e;let o=a.length;return e.filter((e,t)=>{let n=t.rowIndex,r=t.colIndex;for(let e=0;e<o;e++){let t=a[e];if(n>=t.rowStart&&n<=t.rowEnd&&r>=t.colStart&&r<=t.colEnd)return!1}return!0})}getSheetIndex(e){let t;return t=typeof e==`string`?e:e?.getCoords()?.scope??this._container.getSymbols().resolve(Sd,this._calcScope.gridId)?.toString(),this._container.getSheetIndex?.(t)??-1}getSheetCount(){return this._container.getSheetCount?.()??1}isValidDate(e,t=!1){return rr(e,t)}fromSerialDate(e,t=!1){return ur(t?Math.floor(e):e,this.getRuntime().isDate1904())}toSerialDate(e,t=!1){let n=dr(e,this.getRuntime().isDate1904());return t?Math.floor(n):n}getDateParts(e,t){let r=sr(e,this.getRuntime().isDate1904(),t);if(r===null)throw n.a.BuiltIn.Num;return r}getSerialDate(e,t,n,r=0,i=0,a=0,o=0){return lr({year:e,month:t,day:n,hour:r,minute:i,second:a,millis:o,dow:-1,serial:0},this.getRuntime().isDate1904())}getNow(){return this.getRuntime().getNow()}compare(e,t,n){return qo.compare(e,t,this.getRuntime().getLocaleProfile(),n)}_fromTuples(e,t=null,n=!1,r=!1){if(!e)return null;let i=Fa(e.bounds,!0),a=this._container.getGrid(this._calcScope.gridId)?.getEntireCoords(),o=new Ya({axis:this._axis,maxCoords:a});o.setValues(e.tuples);let s=t?{type:t}:void 0;return new nD(this._runtime,o,i,s,n,r)}getValueAt(t,r,i=null,a){let o,s,c=this._container,l=this._calcScope;if(o=i?c.getSymbols().bind(Sd,i):l.gridId,!o)return n.a.BuiltIn.Ref;let u=l.node,d=u?u.precedents:e.A.EmptyArray,f=u?u.inputs:e.A.EmptyArray,p=d.length;for(let e=0;e<p;e++){let i=d[e];if(!i||n.a.isError(i))continue;let c=i;if(t<c.rowStart||t>c.rowEnd||r<c.colStart||r>c.colEnd||c.scope&&o!==c.scope)continue;let l=f[e];l!==void 0&&(s=l,s!==null&&s.isIRange&&(s=s.getValueAt(0,0,a)));break}return s===void 0&&(s=c.getGridValues(o)?.getValueAt(t,r)??null),a&&a.type,s}getSpillAt(t,r,i){let a,o,s=this._container,c=this._calcScope;a=i?s.getSymbols().bind(Sd,i):c.gridId;let l=c.node,u=l?l.precedents:e.A.EmptyArray,d=l?l.inputs:e.A.EmptyArray,f=u.length;for(let e=0;e<f;e++){let i=u[e];if(n.a.isError(i))continue;let s=i;if(!(t<s.rowStart||t>s.rowEnd||r<s.colStart||r>s.colEnd||s.scope&&a!==s.scope)){o=d[e];break}}if(o!==void 0){if(o==null)return null;if(o.isIReferenceRange)return o;if(o.isIRange||(o=this.createRange(1,1,o)),o.isIRange){let n=o,i=n._values,l=i.clone();l.clear(),i.copyTo(l,{colIndex:r,rowIndex:t},n._coords??e.l.EmptyRange);let u={colStart:r,rowStart:t,colEnd:r+n.getColumnCount()-1,rowEnd:t+n.getRowCount()-1,scope:a===c.gridId?null:a},d=s.getGrid(a),f=d.getEntireCoords.bind(d);return new _D(this._runtime,l,u,void 0,f,s.resolveScope)}}let p=s.getIncrementalUpdates(a)?.spillSpatial;if(!p)return null;Bd.rowStart=t,Bd.colStart=r,Bd.rowEnd=t,Bd.colEnd=r,Bd.scope=a;let m=p.search(Bd);if(m.length===0)return null;for(let e=0;e<m.length;e++){let n=m[e];if(n.rowStart===t&&n.colStart===r){let e={colStart:n.colStart,rowStart:n.rowStart,colEnd:n.colEnd,rowEnd:n.rowEnd,scope:a===c.gridId?null:a};return this.getReference(e)}}return null}createRange(e=0,t=0,n=null){let r=this._container.getGrid(this._calcScope.gridId)?.getEntireCoords(),i=new Ya({axis:this._axis,maxCoords:r}),a=new nD(this._runtime,i,null,void 0,!1);return e>0&&t>0&&(typeof n==`function`?(a=a.resize(e,t),a=a.map(n,Hd)):Array.isArray(n)?(a=a.replace(n),a=a.resize(e,t)):a=a.resize(e,t,n)),a}getRange(t,r=null,i=!1){if(t===null)return null;if(t?.isIRange){if(r!==t.getType()||i!==t.isLiteral()){let e=typeof r==`string`?{type:r}:r;return t.clone(e,i,t.isDirectScalar())}return t}let a,o=Array.isArray(t);if(i??=o,o)if(Array.isArray(t[0]))a=t;else{if(t[0]?.isIRange)throw n.a.BuiltIn.Value;a=[t]}else a=[[t]];let s=this._axis,c=s===n.l.Axis.Column,l=this._fromTuples(Ua(a,c,Pa(0,0,void 0,void 0,c),!0),r,i,!o);if(l)return l;let u=this._container.getGrid(this._calcScope.gridId)?.getEntireCoords(),d=new Ya({axis:s,maxCoords:u}),f=r?{type:r}:void 0;return new nD(this._runtime,d,e.l.EmptyRange,f,i)}getRow(){return this._calcScope.rowIndex}getColumn(){return this._calcScope.colIndex}getReference(e,t){if(!e)throw n.a.BuiltIn.Ref;let r=this._calcScope,i=this._container,a=r.gridId,o=i.getGrid(a),s=o?.getEntireCoords.bind(o);if(typeof e==`string`){if(t)throw n.a.BuiltIn.Ref;try{let r=Ml(e,s?.(),Dl,()=>{throw n.a.BuiltIn.Ref},t);if(r.length>1)throw n.a.BuiltIn.Ref;e=r[0]}catch{throw n.a.BuiltIn.Ref}}else e||={colStart:r.colIndex,rowStart:r.rowIndex,colEnd:r.colIndex,rowEnd:r.rowIndex};if(!e)throw n.a.BuiltIn.Ref;let c=e.scope;if(c){if(c=i.getSymbols().bind(Sd,e.scope),!c)return n.a.BuiltIn.Ref;if(c!==e.scope&&((e={...e}).scope=c),c!==a){if(a=c,o=i.getGrid(a),!o)return n.a.BuiltIn.Ref;s=o?.getEntireCoords.bind(o)}}let l,u=i.getGridValues(a),d=r.node,f=-1;if(d&&(f=Rd(d.precedents,e)),f!==-1){let t=d.inputs[f];if(t!=null&&t.isIReferenceRange)l=t;else if(t!==void 0){let r=t;r!==null&&r.isIRange&&(r=r.getValueAt(0,0));let i=new Ya({axis:this._axis,maxCoords:s?.()});if(r!==null){let t=this._axis===n.l.Axis.Column,a=t?e.colStart:e.rowStart,o=t?e.rowStart:e.colStart;i.setValues([[a,[[o,[r]]]]])}l=this._toReference(i,e,s)}else l=this._toReference(u,e,s)}else i.addDynamicPrecedent(d,e,Wd.Reference),l=this._toReference(u,e,s);return l}getResizedReference(e,t,n){let r=e.scope?this._container.getSymbols().bind(Sd,e.scope):this._calcScope.gridId,i=r?this._container.getGrid(r)?.getEntireCoords():void 0,a=e.rowStart+t-1,o=e.colStart+n-1;return this.getReference({rowStart:e.rowStart,rowEnd:i?Math.min(a,i.rowEnd):a,colStart:e.colStart,colEnd:i?Math.min(o,i.colEnd):o,scope:e.scope})}_toReference(t,r,i){try{return new _D(this._runtime,t,r,void 0,i,this._container.resolveScope)}catch(t){throw t instanceof e.C?n.a.BuiltIn.Ref:t}}getAddress(e,t=!1){e||=(Vd.rowIndex=this._calcScope.rowIndex,Vd.colIndex=this._calcScope.colIndex,Vd.scope=null,Vd);let n=this.getEntireCoords().scope;return e.colIndex===void 0?function(e,t,n=!1){return(n?Wl({colIndex:e.colStart,rowIndex:e.rowStart,$colIndex:e.$colStart,$rowIndex:e.$rowStart,scope:e.scope},t):xl({colIndex:e.colStart,rowIndex:e.rowStart,$colIndex:e.$colStart,$rowIndex:e.$rowStart,scope:e.scope},t))+`:`+(n?Wl({colIndex:e.colEnd,rowIndex:e.rowEnd,$colIndex:e.$colEnd,$rowIndex:e.$rowEnd},null):xl({colIndex:e.colEnd,rowIndex:e.rowEnd,$colIndex:e.$colEnd,$rowIndex:e.$rowEnd},null))}(e,n,t):function(e,t,n=!1){return n?Wl(e,t):xl(e,t)}(e,n,t)}parseAsSerialDate(e,t){if(e===void 0)return;if(typeof e==`number`)return e;if(n.a.isError(e))throw e;if(typeof e!=`string`)throw n.a.BuiltIn.Value;let r=kr(this._runtime,e,t);if(r===null)throw n.a.BuiltIn.Value;return r}parseAsDate(e,t){if(e!==void 0){if(n.a.isError(e))throw e;if(typeof e==`number`)return this.fromSerialDate(e);if(typeof e==`string`)return this.fromSerialDate(this.parseAsSerialDate(e,t));if(e instanceof Date)return e;throw n.a.BuiltIn.Value}}parseAsNumber(e,t){if(e===void 0)return;if(typeof e==`number`)return e;if(n.a.isError(e))throw e;if(typeof e!=`string`)throw n.a.BuiltIn.Value;let r=this._coerceToNumber(e,n.n.String,t);if(typeof r!=`number`)throw n.a.BuiltIn.Value;return r}createCriteria(e){return((e,t)=>{let r=xd(e,t),i=r.value;switch(r.op){case`wc`:{let e=i,t=r.match;return n=>typeof n==`string`?t===e.test(n):!t}case`=`:return i===void 0?e=>e==null:i===``?e=>e==null||e===``:typeof i==`string`?t=>typeof t==`string`&&e.compare(t,i)===0:n.a.isError(i)?e=>!!n.a.isError(e)&&e.equals(i):typeof i==`number`?t=>typeof t==`number`?e.compare(t,i)===0:typeof t==`string`&&yd(e,t,i):e=>e===i;case`<>`:return i===void 0?e=>e!=null:typeof i==`string`?t=>typeof t!=`string`||e.compare(t,i)!==0:n.a.isError(i)?e=>!n.a.isError(e)||!e.equals(i):typeof i==`number`?t=>typeof t!=`number`||e.compare(t,i)!==0:e=>e!==i;case`>`:return vd(e,i,e=>e>0);case`>=`:return vd(e,i,e=>e>=0);case`<`:return vd(e,i,e=>e<0);case`<=`:return vd(e,i,e=>e<=0);default:return()=>!1}})(this,e)}parseAsLiteral(e){return uo(e)??fo(e)}toText(e){return function(e,t){return typeof e==`string`?e:e==null?``:typeof e==`boolean`?co(e):typeof e==`number`?cE(e,t):e?.isFormulaError?lo(e):String(e)}(e,this._runtime)}getRuntime(){return this._runtime}get[Symbol.toStringTag](){return`[CalculationContext]`}toString(){let e,t=``,n=this._instanceScope;return n&&(e=n.toString?.()),e&&e&&(t=`${t}:[${e}]`),t}},Rd=(e,t)=>{if(!e)return-1;let r=e.length;if(r===0)return-1;let i=t.colStart,a=t.rowStart,o=t.colEnd,s=t.rowEnd,c=t.scope;for(let t=0;t<r;t++){let r=e[t];if(r!=null&&!(n.a.isError(r)||r.colStart!==i||r.rowStart!==a||r.colEnd!==o||r.rowEnd!==s||c&&r.scope!==c))return t}return-1},zd={rowStart:0,colStart:0,rowEnd:0,colEnd:0,scope:null},Bd={rowStart:0,colStart:0,rowEnd:0,colEnd:0,scope:null},Vd={rowIndex:0,colIndex:0,scope:null},Hd=Object.freeze({includeEmpty:!0}),Ud=class t{constructor(e,t,n,r,i,a){this.registeredPrecedents=null,this.ref=e,this.gridId=t,this._container=r,this.formula=n,this.unanchored=i;let o=e.colStart,s=e.rowStart;this.calcs=a?this._cloneCalcs(a,o,s,t):this._createCalcs(n,t,e)}_createCalcs(t,n,r){let i=r.colStart,a=r.rowStart;if(!t)return[[{block:this,gridId:n,colIndex:i,rowIndex:a,cycleId:0,markId:0,inDegree:0,dependents:e.A.EmptyArray,inputs:e.A.EmptyArray,precedents:e.A.EmptyArray,cachedValue:void 0,pending:!1,pendingPrecedents:!1,pendingPromise:null,pendingResolved:!1,circular:!1,state:0}]];let o=t.resolvedPrecedentsAt(a,i),s=o?.length??0,c=xE(r.rowEnd-a+1),l=r.colEnd-i+1,u=c.length;for(let r=0;r<u;r++){let u=xE(l),d=u.length;for(let c=0;c<d;c++){let l=r+a,d=c+i,f=s===0?e.A.EmptyArray:r===0&&c===0?o:t.resolvedPrecedentsAt(l,d);u[c]={block:this,gridId:n,colIndex:d,rowIndex:l,cycleId:0,markId:0,inDegree:0,dependents:e.A.EmptyArray,inputs:s===0?e.A.EmptyArray:Array(s).fill(void 0),precedents:f,cachedValue:void 0,pending:!1,pendingPrecedents:!1,pendingPromise:null,pendingResolved:!1,circular:!1,state:0}}c[r]=u}return c}_cloneCalcs(t,n,r,i){let a=this.formula,o=a.resolvedPrecedentsAt(r,n),s=o?.length??0,c=t.length,l=xE(c);for(let u=0;u<c;u++){let c=t[u],d=c.length,f=xE(d);l[u]=f;for(let t=0;t<d;t++){let l=u+r,d=t+n,p=s===0?e.A.EmptyArray:u===0&&t===0?o:a.resolvedPrecedentsAt(l,d),m={...c[t]};f[t]=m,m.colIndex=d,m.rowIndex=l,m.block=this,m.inputs=s===0?e.A.EmptyArray:SE(s),m.precedents=p,i!==void 0&&(m.gridId=i)}}return l}toJSON(e=!1,t){let n=this.ref;return[yl(n),this.formula.getTextAt(n.rowStart,n.colStart,e,t,void 0,!0)]}getCoords(){return this.ref}getShifted(r){if(!r.after)return null;let i=e.l.sanitizeRange(r.after),a=r.axis!==n.l.Axis.Row,o=r.amount,s=r.intersect,c=s.colStart,l=s.rowStart,u=s.colEnd,d=s.rowEnd,f=a?o:0,p=a?0:o,m=this.ref,h=i,g=this._container.getGrid(this.gridId)?.getEntireCoords(),_=this.formula,v=_.getReferences(m.rowStart,m.colStart);for(let e=0;e<v.length;e++){let t=v[e];if(t===null||`nameId`in t||n.a.isError(t))continue;let r=t,i=r.scope!=null&&r.scope!==this.gridId,s=r,y=r.$colStart?r.colStart:m.colStart+r.colStart,b=r.$rowStart?r.rowStart:m.rowStart+r.rowStart;if(!i&&y>u&&!r.$colStart&&!r.$colEnd)continue;let x=r.$colEnd?r.colEnd:m.colStart+r.colEnd,S=r.$rowEnd?r.rowEnd:m.rowStart+r.rowEnd;if(i)f!==0&&(r.$colStart||(s={...r},s.colStart=y-h.colStart),r.$colEnd||(s=s===r?{...r}:s,s.colEnd=x-h.colStart)),p!==0&&(r.$rowStart||(s=s===r?{...r}:s,s.rowStart=b-h.rowStart),r.$rowEnd||(s=s===r?{...r}:s,s.rowEnd=S-h.rowStart)),s!==r&&(_=_.setReferenceAt(e,s));else{if(o<0){if(a){if(y>=c&&x<=u){_=_.setReferenceAt(e,null);continue}}else if(b>=l&&S<=d){_=_.setReferenceAt(e,null);continue}}f!==0&&(r.$colStart?y>=c&&(s=s===r?{...r}:s,s.colStart+=f,y=s.colStart):y<c?(s=s===r?{...r}:s,s.colStart=y-h.colStart,y=h.colStart+s.colStart):f<0&&y<=u&&(s=s===r?{...r}:s,y=Math.max(c,y+f),s.colStart=y-h.colStart,y=h.colStart+s.colStart),r.$colEnd?x>=c&&(s=s===r?{...r}:s,s.colEnd+=f,x=s.colEnd):x<c?(s=s===r?{...r}:s,s.colEnd=x-h.colStart,x=h.colStart+s.colEnd):f<0&&x<=u&&(s=s===r?{...r}:s,x=Math.max(c-1,x+f),s.colEnd=x-h.colStart,x=h.colStart+s.colEnd)),p!==0&&(r.$rowStart?b>=l&&(s=s===r?{...r}:s,s.rowStart+=p,b=s.rowStart):b<l?(s=s===r?{...r}:s,s.rowStart=b-h.rowStart,b=h.rowStart+s.rowStart):p<0&&b<=d&&(s=s===r?{...r}:s,b=Math.max(l,b+p),s.rowStart=b-h.rowStart,b=h.rowStart+s.rowStart),r.$rowEnd?S>=l&&(s=s===r?{...r}:s,s.rowEnd+=p,S=s.rowEnd):S<l?(s=s===r?{...r}:s,s.rowEnd=S-h.rowStart,S=h.rowStart+s.rowEnd):p<0&&S<=d&&(s=s===r?{...r}:s,S=Math.max(l-1,S+p),s.rowEnd=S-h.rowStart,S=h.rowStart+s.rowEnd)),s!==r&&((x<y||S<b||g&&(y<g.colStart||b<g.rowStart||x>g.colEnd||S>g.rowEnd))&&(s=n.a.BuiltIn.Ref),_=_.setReferenceAt(e,s))}}let y=new t(i,this.gridId,_,this._container,this.unanchored,this.calcs);return{...r.after,value:y}}getMerged(e,r,i){let a=this.formula,o=e.formula;if(!a.isEquals(o))return;let s,c=this.calcs,l=e.calcs;if(i===n.l.Axis.Row)s=[...c,...l];else{let e=c.length;s=xE(e);for(let t=0;t<e;t++)s[t]=[...c[t],...l[t]]}return new t(r,this.gridId,a,this._container,this.unanchored,s)}getSplit(e,r,i){let a,o,s=this.formula,c=r===n.l.Axis.Column,l=this.calcs;if(c){let e=l.length;a=xE(e),o=xE(e);for(let t=0;t<e;t++){let e=l[t];a[t]=e.slice(0,i),o[t]=e.slice(i)}}else a=l.slice(0,i),o=l.slice(i);return[new t(e[0],this.gridId,s,this._container,this.unanchored,a),new t(e[1],this.gridId,s,this._container,this.unanchored,o)]}copyTo(e,r){let i=this.formula,a=r?.cutFrom;if(a){let t=this.ref,r=t.colStart-e.colStart,o=t.rowStart-e.rowStart,s=i.getReferences(t.rowStart,t.colStart);for(let e=0;e<s.length;e++){let c=s?s[e]:null;if(!c||`nameId`in c||n.a.isError(c))continue;let l,u=c,d=u.$colStart?u.colStart:t.colStart+u.colStart,f=u.$rowStart?u.rowStart:t.rowStart+u.rowStart,p=u.$colEnd?u.colEnd:t.colEnd+u.colEnd,m=u.$rowEnd?u.rowEnd:t.rowEnd+u.rowEnd,h=u.scope!=null&&u.scope!==this.gridId,g=!h&&f>=a.rowStart&&m<=a.rowEnd,_=!h&&d>=a.colStart&&p<=a.colEnd;r!==0&&(u.$colStart||g&&d>=a.colStart&&d<=a.colEnd||(l??={...u},l.colStart+=r),u.$colEnd||g&&p>=a.colStart&&p<=a.colEnd||(l??={...u},l.colEnd+=r)),o!==0&&(u.$rowStart||_&&f>=a.rowStart&&f<=a.rowEnd||(l??={...u},l.rowStart+=o),u.$rowEnd||_&&m>=a.rowStart&&m<=a.rowEnd||(l??={...u},l.rowEnd+=o)),l&&(i=i.setReferenceAt(e,l))}}let o=new t(e,this.gridId,i,this._container,this.unanchored);return{colStart:e.colStart,rowStart:e.rowStart,colEnd:e.colEnd,rowEnd:e.rowEnd,scope:e.scope,value:o}}canTile(e,t){return!0}onRemove(e){let t=e.value.calcs,n=t.length;for(let e=0;e<n;e++){let n=t[e],r=n.length;for(let e=0;e<r;e++){let t=n[e];t.pendingPromise&&(t.pendingPromise.cancelled=!0)}}}evaluateAt(e,t,r){return this.formula?.evaluateAt(e,t,r)??n.a.BuiltIn.NA}finalizeValue(e){return this.formula?.finalizeValue(e)??e}finalizeValueForCell(e){return this.formula?.finalizeValueForCell(e)??e}getTokensAt(t,n,r){return this.formula?.getTokensAt(t,n,r)??e.A.EmptyArray}getTextAt(e,t,n,r){return this.formula?.getTextAt(e,t,n,r)??``}resolvedPrecedentsAt(t,n,r,i,a){return this.formula?.resolvedPrecedentsAt(t,n,r,i,a)??e.A.EmptyArray}getReferences(t,n){return this.formula?.getReferences(t,n)??e.A.EmptyArray}getReferenceAt(e,t,n){return this.formula?.getReferenceAt(e,t,n)??null}setReferenceAt(e,r,i){let a=this.ref;if(r&&!n.a.isError(r)&&!(`nameId`in r)){let e=r,t=a.colStart,n=a.rowStart,i=e.$colStart?e.colStart:t+e.colStart,o=e.$rowStart?e.rowStart:n+e.rowStart,s=e.$colEnd?e.colEnd:t+e.colEnd,c=e.$rowEnd?e.rowEnd:n+e.rowEnd;if(s<i||c<o)r=null;else{let e=this._container.getGrid(this.gridId)?.getEntireCoords();e&&(i<e.colStart||o<e.rowStart||s>e.colEnd||c>e.rowEnd)&&(r=null)}}let o=this.formula.setReferenceAt(e,r,i);return new t(a,this.gridId,o,this._container,this.unanchored,this.calcs)}reanchorReferences(e,n){let r=this.formula,i=r.reanchorReferences(e,n);return r===i&&this.gridId===e?this:new t(this.ref,e,i,this._container,this.unanchored,this.calcs)}replaceSheetReferences(e,n){let r=this.formula,i=r.replaceSheetReferences(e,n);return r===i?this:new t(this.ref,this.gridId,i,this._container,this.unanchored,this.calcs)}wrapImplicit(e,n,r){let i=this.formula,a=i.wrapImplicit(e,n,r);if(i===a)return this;let o=[...this.calcs];return new t(this.ref,this.gridId,a,this._container,this.unanchored,o)}getError(){return this.formula?.getError()??null}getNamedIds(){return this.formula?.getNamedIds()??e.A.EmptyArray}getReferencedSymbolIds(){return this.formula?.getReferencedSymbolIds()??e.A.EmptyArray}hasTotals(){return this.formula?.hasTotals()??!1}isReferenceOnly(){return this.formula?.isReferenceOnly()??!1}isEquals(e){return this.formula?.isEquals(e)??!1}},Wd={Reference:-1,Spill:-2},Gd=Object.freeze({break:!0});(q||={}).Type={BorderStyle:`borderStyle`,FillStyle:`fillStyle`,ContentStyle:`contentStyle`,Continuous:`continuous`,DateFormat:`dateFormat`,Table:`table`,AutoTable:`autoTable`,DataValidations:`dataValidations`,Merge:`merge`,Hyperlink:`hyperlink`,Comments:`comments`,Unlock:`unlock`,Contentful:`contentful`,Conditionals:`conditionals`,Formula:`formula`,Spills:`spills`,Pending:`pending`,CalcError:`calcError`,Error:`error`,Validation:`dataValidation`};var J,Kd,qd=Object.freeze({contentful:q.Type.Contentful,dateFormat:q.Type.DateFormat,error:q.Type.Error,formula:q.Type.Formula,spills:q.Type.Spills,calcError:q.Type.CalcError,fill:q.Type.FillStyle,border:q.Type.BorderStyle,numberFormat:q.Type.ContentStyle,alignment:q.Type.ContentStyle,font:q.Type.ContentStyle,merge:q.Type.Merge,table:q.Type.Table,autoTable:q.Type.AutoTable,hyperlink:q.Type.Hyperlink,comments:q.Type.Comments,unlock:q.Type.Unlock,conditionals:q.Type.Conditionals,dataValidations:q.Type.DataValidations});function Jd(e){let t=function(e){if(e===void 0)return!0;let t=typeof e==`string`?[e]:e;if(t.length===0)return!1;let n={};for(let e=0;e<t.length;e++){let r=qd[t[e]];r&&(n[r]=!1)}return n}(e);if(typeof t==`boolean`)return t;let n={...t};return delete n[q.Type.Contentful],n[q.Type.ContentStyle]!==void 0&&(n[q.Type.Continuous]=!1),n[q.Type.Formula]===void 0&&n[q.Type.CalcError]===void 0||(n[q.Type.Pending]=!1),n}function Yd(e,t){switch(t){case`contentful`:case`error`:return null;case`border`:return e.borderSpatial.getContentfulCoords();case`fill`:return e.fillSpatial.getContentfulCoords();case`numberFormat`:case`alignment`:case`font`:return e.contentSpatial.getContentfulCoords();case`dateFormat`:return e.dateFormatSpatial.getBoundingRange();case`merge`:return e.mergeSpatial.getContentfulCoords();case`formula`:return e.calcGrid.getBoundingRange();case`calcError`:return e.calcErrorsSpatial.getBoundingRange();case`spills`:return e.spillSpatial.getBoundingRange();case`table`:return e.tables.getBoundingRange();case`autoTable`:return e.autoTables.getBoundingRange();case`hyperlink`:return e.hyperlinkSpatial.getBoundingRange();case`comments`:return e.commentsSpatial.getBoundingRange();case`unlock`:return e.protectedRanges.getBoundingRange();case`conditionals`:return e.conditionalFormats.getBoundingRange();case`dataValidations`:return e.dataValidations.getBoundingRange()}}var Xd=Object.freeze({[q.Type.BorderStyle]:!1,[q.Type.FillStyle]:!1,[q.Type.ContentStyle]:!1,[q.Type.DateFormat]:!1,[q.Type.AutoTable]:!1,[q.Type.Table]:!1,[q.Type.Merge]:!1,[q.Type.Hyperlink]:!1,[q.Type.Comments]:!1,[q.Type.Unlock]:!1,[q.Type.Formula]:!1,[q.Type.Spills]:!1,[q.Type.Pending]:!1,[q.Type.CalcError]:!1,[q.Type.Contentful]:!1,[q.Type.DataValidations]:!1,[q.Type.Conditionals]:!1,[q.Type.Continuous]:!1}),Zd=Object.freeze({[q.Type.BorderStyle]:!1,[q.Type.FillStyle]:!1,[q.Type.ContentStyle]:!1,[q.Type.DateFormat]:!1,[q.Type.AutoTable]:!1,[q.Type.Table]:!1,[q.Type.Merge]:!1,[q.Type.Hyperlink]:!1,[q.Type.Comments]:!1,[q.Type.Unlock]:!1,[q.Type.Formula]:!1,[q.Type.Spills]:!1,[q.Type.Pending]:!1,[q.Type.CalcError]:!1,[q.Type.DataValidations]:!1,[q.Type.Conditionals]:!1,[q.Type.Continuous]:!1}),Qd=Object.freeze({[q.Type.BorderStyle]:!1,[q.Type.FillStyle]:!1,[q.Type.ContentStyle]:!1,[q.Type.DateFormat]:!1,[q.Type.Table]:!0,[q.Type.DataValidations]:!1,[q.Type.Merge]:!1,[q.Type.Hyperlink]:!1,[q.Type.Comments]:!1,[q.Type.Unlock]:!1,[q.Type.Formula]:!1}),$d=(Object.freeze({[q.Type.BorderStyle]:!1,[q.Type.FillStyle]:!1,[q.Type.ContentStyle]:!1,[q.Type.DateFormat]:!1,[q.Type.Table]:!1,[q.Type.AutoTable]:!1,[q.Type.DataValidations]:!1,[q.Type.Hyperlink]:!1,[q.Type.Comments]:!1,[q.Type.Unlock]:!1,[q.Type.Contentful]:!1,[q.Type.Formula]:!1}),Object.freeze({[q.Type.BorderStyle]:!1,[q.Type.FillStyle]:!1,[q.Type.ContentStyle]:!1,[q.Type.Hyperlink]:!1,[q.Type.Continuous]:!1,[q.Type.Merge]:!1,[q.Type.Contentful]:!1}));(Kd=J||={}).AdjustmentType={Alpha:`alpha`,AlphaOff:`alphaOff`,AlphaMod:`alphaMod`,Hue:`hue`,Sat:`sat`,Lum:`lum`,HueOff:`hueOff`,SatOff:`satOff`,LumOff:`lumOff`,HueMod:`hueMod`,SatMod:`satMod`,LumMod:`lumMod`,Red:`red`,Green:`green`,Blue:`blue`,RedOff:`redOff`,GreenOff:`greenOff`,BlueOff:`blueOff`,RedMod:`redMod`,GreenMod:`greenMod`,BlueMod:`blueMod`,Shade:`shade`,Tint:`tint`,ETint:`eTint`,Gray:`gray`,Comp:`comp`,Inv:`inv`,Gamma:`gamma`,InvGamma:`invGamma`},Kd.Named={ActiveBorder:`activeBorder`,ActiveCaption:`activeCaption`,CaptionText:`captionText`,AppWorkspace:`appWorkspace`,BtnFace:`btnFace`,BtnShadow:`btnShadow`,DkShadow3d:`3dDkShadow`,BtnHighlight:`btnHighlight`,Light3d:`3dLight`,BtnText:`btnText`,Background:`background`,GrayText:`grayText`,Highlight:`highlight`,HighlightText:`highlightText`,HotLight:`hotLight`,InactiveBorder:`inactiveBorder`,InactiveCaption:`inactiveCaption`,InactiveCaptionText:`inactiveCaptionText`,InfoBk:`infoBk`,InfoText:`infoText`,Menu:`menu`,MenuText:`menuText`,ScrollBar:`scrollBar`,Window:`window`,WindowFrame:`windowFrame`,WindowText:`windowText`,Transparent:`transparent`,AliceBlue:`aliceBlue`,AntiqueWhite:`antiqueWhite`,Aqua:`aqua`,Aquamarine:`aquamarine`,Azure:`azure`,Beige:`beige`,Bisque:`bisque`,Black:`black`,BlanchedAlmond:`blanchedAlmond`,Blue:`blue`,BlueViolet:`blueViolet`,Brown:`brown`,BurlyWood:`burlyWood`,CadetBlue:`cadetBlue`,Chartreuse:`chartreuse`,Chocolate:`chocolate`,Coral:`coral`,CornflowerBlue:`cornflowerBlue`,Cornsilk:`cornsilk`,Crimson:`crimson`,Cyan:`cyan`,DkBlue:`dkBlue`,DkCyan:`dkCyan`,DkGoldenrod:`dkGoldenrod`,DkGray:`dkGray`,DkGreen:`dkGreen`,DkKhaki:`dkKhaki`,DkMagenta:`dkMagenta`,DkOliveGreen:`dkOliveGreen`,DkOrange:`dkOrange`,DkOrchid:`dkOrchid`,DkRed:`dkRed`,DkSalmon:`dkSalmon`,DkSeaGreen:`dkSeaGreen`,DkSlateBlue:`dkSlateBlue`,DkSlateGray:`dkSlateGray`,DkTurquoise:`dkTurquoise`,DkViolet:`dkViolet`,DeepPink:`deepPink`,DeepSkyBlue:`deepSkyBlue`,DimGray:`dimGray`,DodgerBlue:`dodgerBlue`,Firebrick:`firebrick`,FloralWhite:`floralWhite`,ForestGreen:`forestGreen`,Fuchsia:`fuchsia`,Gainsboro:`gainsboro`,GhostWhite:`ghostWhite`,Gold:`gold`,Goldenrod:`goldenrod`,Gray:`gray`,Grey:`grey`,Green:`green`,GreenYellow:`greenYellow`,Honeydew:`honeydew`,HotPink:`hotPink`,IndianRed:`indianRed`,Indigo:`indigo`,Ivory:`ivory`,Khaki:`khaki`,Lavender:`lavender`,LavenderBlush:`lavenderBlush`,LawnGreen:`lawnGreen`,LemonChiffon:`lemonChiffon`,LtBlue:`ltBlue`,LtCoral:`ltCoral`,LtCyan:`ltCyan`,LtGoldenrodYellow:`ltGoldenrodYellow`,LtGray:`ltGray`,LtGreen:`ltGreen`,LtPink:`ltPink`,LtSalmon:`ltSalmon`,LtSeaGreen:`ltSeaGreen`,LtSkyBlue:`ltSkyBlue`,LtSlateGray:`ltSlateGray`,LtSteelBlue:`ltSteelBlue`,LtYellow:`ltYellow`,Lime:`lime`,LimeGreen:`limeGreen`,Linen:`linen`,Magenta:`magenta`,Maroon:`maroon`,MedAquamarine:`medAquamarine`,MedBlue:`medBlue`,MedOrchid:`medOrchid`,MedPurple:`medPurple`,MedSeaGreen:`medSeaGreen`,MedSlateBlue:`medSlateBlue`,MedSpringGreen:`medSpringGreen`,MedTurquoise:`medTurquoise`,MedVioletRed:`medVioletRed`,MidnightBlue:`midnightBlue`,MintCream:`mintCream`,MistyRose:`mistyRose`,Moccasin:`moccasin`,NavajoWhite:`navajoWhite`,Navy:`navy`,OldLace:`oldLace`,Olive:`olive`,OliveDrab:`oliveDrab`,Orange:`orange`,OrangeRed:`orangeRed`,Orchid:`orchid`,PaleGoldenrod:`paleGoldenrod`,PaleGreen:`paleGreen`,PaleTurquoise:`paleTurquoise`,PaleVioletRed:`paleVioletRed`,PapayaWhip:`papayaWhip`,PeachPuff:`peachPuff`,Peru:`peru`,Pink:`pink`,Plum:`plum`,PowderBlue:`powderBlue`,Purple:`purple`,Red:`red`,RosyBrown:`rosyBrown`,RoyalBlue:`royalBlue`,SaddleBrown:`saddleBrown`,Salmon:`salmon`,SandyBrown:`sandyBrown`,SeaGreen:`seaGreen`,SeaShell:`seaShell`,Sienna:`sienna`,Silver:`silver`,SkyBlue:`skyBlue`,SlateBlue:`slateBlue`,SlateGray:`slateGray`,Snow:`snow`,SpringGreen:`springGreen`,SteelBlue:`steelBlue`,Tan:`tan`,Teal:`teal`,Thistle:`thistle`,Tomato:`tomato`,Turquoise:`turquoise`,Violet:`violet`,Wheat:`wheat`,White:`white`,WhiteSmoke:`whiteSmoke`,Yellow:`yellow`,YellowGreen:`yellowGreen`,ButtonFace:`buttonFace`,ButtonHighlight:`buttonHighlight`,ButtonShadow:`buttonShadow`,GradientActiveCaption:`gradientActiveCaption`,GradientInactiveCaption:`gradientInactiveCaption`,MenuBar:`menuBar`,MenuHighlight:`menuHighlight`},Kd.Scheme={Bg1:`bg1`,Bg2:`bg2`,Tx1:`tx1`,Tx2:`tx2`,Accent1:`accent1`,Accent2:`accent2`,Accent3:`accent3`,Accent4:`accent4`,Accent5:`accent5`,Accent6:`accent6`,Hlink:`hlink`,FolHlink:`folHlink`},Kd.Type={Scheme:`scheme`,Named:`named`,Index:`index`,Auto:`auto`,HSL:`hsl`,RGB:`rgb`,LRGB:`lrgb`,Hex:`hex`};var ef=[[16777215,J.Named.Transparent,!0],[4290032820,J.Named.ActiveBorder,!0],[4288263377,J.Named.ActiveCaption,!0],[4278190080,J.Named.CaptionText,!0],[4289440683,J.Named.AppWorkspace,!0],[4293980400,J.Named.BtnFace,!0],[4285098345,J.Named.BtnShadow,!0],[4278190080,J.Named.DkShadow3d,!0],[4293125091,J.Named.BtnHighlight,!0],[4293125091,J.Named.Light3d,!0],[4278190080,J.Named.BtnText,!0],[4278190080,J.Named.Background,!0],[4285361517,J.Named.GrayText,!0],[4281571839,J.Named.Highlight,!0],[4294967295,J.Named.HighlightText,!0],[4278216396,J.Named.HotLight,!0],[4294244348,J.Named.InactiveBorder,!0],[4290760155,J.Named.InactiveCaption,!0],[4278190080,J.Named.InactiveCaptionText,!0],[4294967265,J.Named.InfoBk,!0],[4278190080,J.Named.InfoText,!0],[4293980400,J.Named.Menu,!0],[4278190080,J.Named.MenuText,!0],[4291348680,J.Named.ScrollBar,!0],[4294967295,J.Named.Window,!0],[4284769380,J.Named.WindowFrame,!0],[4278190080,J.Named.WindowText,!0],[16777215,J.Named.Transparent],[4293982463,J.Named.AliceBlue],[4294634455,J.Named.AntiqueWhite],[4278255615,J.Named.Aqua],[4286578644,J.Named.Aquamarine],[4293984255,J.Named.Azure],[4294309340,J.Named.Beige],[4294960324,J.Named.Bisque],[4278190080,J.Named.Black],[4294962125,J.Named.BlanchedAlmond],[4278190335,J.Named.Blue],[4287245282,J.Named.BlueViolet],[4289014314,J.Named.Brown],[4292786311,J.Named.BurlyWood],[4284456608,J.Named.CadetBlue],[4286578432,J.Named.Chartreuse],[4291979550,J.Named.Chocolate],[4294934352,J.Named.Coral],[4284782061,J.Named.CornflowerBlue],[4294965468,J.Named.Cornsilk],[4292613180,J.Named.Crimson],[4278255615,J.Named.Cyan],[4278190219,J.Named.DkBlue],[4278225803,J.Named.DkCyan],[4290283019,J.Named.DkGoldenrod],[4289309097,J.Named.DkGray],[4278215680,J.Named.DkGreen],[4290623339,J.Named.DkKhaki],[4287299723,J.Named.DkMagenta],[4283788079,J.Named.DkOliveGreen],[4294937600,J.Named.DkOrange],[4288230092,J.Named.DkOrchid],[4287299584,J.Named.DkRed],[4293498490,J.Named.DkSalmon],[4287609995,J.Named.DkSeaGreen],[4282924427,J.Named.DkSlateBlue],[4281290575,J.Named.DkSlateGray],[4278243025,J.Named.DkTurquoise],[4287889619,J.Named.DkViolet],[4294907027,J.Named.DeepPink],[4278239231,J.Named.DeepSkyBlue],[4285098345,J.Named.DimGray],[4280193279,J.Named.DodgerBlue],[4289864226,J.Named.Firebrick],[4294966e3,J.Named.FloralWhite],[4280453922,J.Named.ForestGreen],[4294902015,J.Named.Fuchsia],[4292664540,J.Named.Gainsboro],[4294506751,J.Named.GhostWhite],[4294956800,J.Named.Gold],[4292519200,J.Named.Goldenrod],[4286611584,J.Named.Gray],[4278222848,J.Named.Green],[4289593135,J.Named.GreenYellow],[4293984240,J.Named.Honeydew],[4294928820,J.Named.HotPink],[4291648604,J.Named.IndianRed],[4283105410,J.Named.Indigo],[4294967280,J.Named.Ivory],[4293977740,J.Named.Khaki],[4293322490,J.Named.Lavender],[4294963445,J.Named.LavenderBlush],[4286381056,J.Named.LawnGreen],[4294965965,J.Named.LemonChiffon],[4289583334,J.Named.LtBlue],[4293951616,J.Named.LtCoral],[4292935679,J.Named.LtCyan],[4294638200,J.Named.LtGoldenrodYellow],[4292072403,J.Named.LtGray],[4287688336,J.Named.LtGreen],[4294948545,J.Named.LtPink],[4294942842,J.Named.LtSalmon],[4280332970,J.Named.LtSeaGreen],[4287090426,J.Named.LtSkyBlue],[4286023833,J.Named.LtSlateGray],[4289774814,J.Named.LtSteelBlue],[4294967264,J.Named.LtYellow],[4278255360,J.Named.Lime],[4281519410,J.Named.LimeGreen],[4294635750,J.Named.Linen],[4294902015,J.Named.Magenta],[4286578688,J.Named.Maroon],[4284927402,J.Named.MedAquamarine],[4278190285,J.Named.MedBlue],[4290401747,J.Named.MedOrchid],[4287852763,J.Named.MedPurple],[4282168177,J.Named.MedSeaGreen],[4286277870,J.Named.MedSlateBlue],[4278254234,J.Named.MedSpringGreen],[4282962380,J.Named.MedTurquoise],[4291237253,J.Named.MedVioletRed],[4279834992,J.Named.MidnightBlue],[4294311930,J.Named.MintCream],[4294960353,J.Named.MistyRose],[4294960309,J.Named.Moccasin],[4294958765,J.Named.NavajoWhite],[4278190208,J.Named.Navy],[4294833638,J.Named.OldLace],[4286611456,J.Named.Olive],[4285238819,J.Named.OliveDrab],[4294944e3,J.Named.Orange],[4294919424,J.Named.OrangeRed],[4292505814,J.Named.Orchid],[4293847210,J.Named.PaleGoldenrod],[4288215960,J.Named.PaleGreen],[4289720046,J.Named.PaleTurquoise],[4292571283,J.Named.PaleVioletRed],[4294963157,J.Named.PapayaWhip],[4294957753,J.Named.PeachPuff],[4291659071,J.Named.Peru],[4294951115,J.Named.Pink],[4292714717,J.Named.Plum],[4289781990,J.Named.PowderBlue],[4286578816,J.Named.Purple],[4294901760,J.Named.Red],[4290547599,J.Named.RosyBrown],[4282477025,J.Named.RoyalBlue],[4287317267,J.Named.SaddleBrown],[4294606962,J.Named.Salmon],[4294222944,J.Named.SandyBrown],[4281240407,J.Named.SeaGreen],[4294964718,J.Named.SeaShell],[4288696877,J.Named.Sienna],[4290822336,J.Named.Silver],[4287090411,J.Named.SkyBlue],[4285160141,J.Named.SlateBlue],[4285563024,J.Named.SlateGray],[4294966010,J.Named.Snow],[4278255487,J.Named.SpringGreen],[4282811060,J.Named.SteelBlue],[4291998860,J.Named.Tan],[4278222976,J.Named.Teal],[4292394968,J.Named.Thistle],[4294927175,J.Named.Tomato],[4282441936,J.Named.Turquoise],[4293821166,J.Named.Violet],[4294303411,J.Named.Wheat],[4294967295,J.Named.White],[4294309365,J.Named.WhiteSmoke],[4294967040,J.Named.Yellow],[4288335154,J.Named.YellowGreen],[4293980400,J.Named.ButtonFace],[4294967295,J.Named.ButtonHighlight],[4288716960,J.Named.ButtonShadow],[4290367978,J.Named.GradientActiveCaption],[4292338930,J.Named.GradientInactiveCaption],[4293980400,J.Named.MenuBar],[4281571839,J.Named.MenuHighlight],[4286611584,J.Named.Grey]],tf=new class{constructor(){this._lookupByName=new Map;let e=ef.length;for(let t=0;t<e;t++){let e=ef[t],n=e[0],r=(n>>24&255)/255,i=n>>16&255,a=n>>8&255,o=255&n,s={id:t,name:e[1],rgbaColor:{r:i,g:a,b:o,a:r},system:e.length>2};this._lookupByName.set(s.name.toLowerCase(),s)}}valueOfName(e){return this._lookupByName.get(e?e.toLowerCase():`transparent`)}getSystemColorDefaults(){let e=e=>e.toString(16).padStart(2,`0`).toUpperCase(),t={};return this._lookupByName.forEach((n,r)=>{if(!n.system)return;let{r:i,g:a,b:o}=n.rgbaColor;t[r]=`#${e(i)}${e(a)}${e(o)}`}),t}},nf=[{scheme:J.Scheme.Tx1,description:`First Text Color`},{scheme:J.Scheme.Tx2,description:`Second Text Color`},{scheme:J.Scheme.Bg1,description:`First Background Color`},{scheme:J.Scheme.Bg2,description:`Second Background Color`},{scheme:J.Scheme.Accent1,description:`Accent 1`},{scheme:J.Scheme.Accent2,description:`Accent 2`},{scheme:J.Scheme.Accent3,description:`Accent 3`},{scheme:J.Scheme.Accent4,description:`Accent 4`},{scheme:J.Scheme.Accent5,description:`Accent 5`},{scheme:J.Scheme.Accent6,description:`Accent 6`},{scheme:J.Scheme.Hlink,description:`Hyperlink`},{scheme:J.Scheme.FolHlink,description:`Followed Hyperlink`},{scheme:`dk1`,description:`Text/Background - Dark 1`},{scheme:`lt1`,description:`Text/Background - Light 1`},{scheme:`dk2`,description:`Text/Background - Dark 2`},{scheme:`lt2`,description:`Text/Background - Light 2`}],rf=new Map;for(let e=0;e<nf.length;e++)rf.set(nf[e].scheme.toLowerCase(),nf[e]);var Y,af,X,of,sf=`lastclr`,cf=e=>{if(!e)return null;let t=e.replace(`#`,``);if(t.length<6)return null;let n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16);return isNaN(n)||isNaN(r)||isNaN(i)?null:new Ko.RGBA(n,r,i,1)},lf=e=>new Ko.HEX(e.red,e.green,e.blue,1).toString(!1).replace(`#`,``),uf=e=>new Ko.RGBA(e.rgbaColor.r,e.rgbaColor.g,e.rgbaColor.b,e.rgbaColor.a),df=(e,t,n)=>{let r=tf.valueOfName(e);if(!r)return null;if(r.system){let e=r.name;return{rgba:(t?t(e,!1):null)?.toRGBA()??n??uf(r),systemName:e}}return{rgba:uf(r),systemName:null}},ff=e=>{if(!e)return null;let t=e.getAdjustments();if(t&&t.length>0)return null;let n=e.getType();return n===J.Type.Auto?J.Named.WindowText:n===J.Type.Named&&Df.isSystem(e.getVal())?e.getVal():null},pf=e=>e?{srgb:[e.red/255,e.green/255,e.blue/255],alpha:e.alpha===void 0?1:e.alpha}:null,mf=function(e,t,n,r,i){let a,o=null,s=null,c=null,l=J.Type.Named;if(e.toLowerCase()===`auto`){let e=df(J.Named.WindowText,r,i);a=pf(e.rgba),o=e.systemName,l=J.Type.Auto}else{let t=df(e,r,i);a=pf(t?.rgba??null),o=t?.systemName??null}if(a===null&&((u=e)===`phClr`&&(u=`dk1`),rf.get(u.toLowerCase()))){if(!t)throw Error(`a scheme val was used but a schemeLookup was not provided`);s=e;let n=t(s);c=n.toRGBA(),a=pf(c),o=ff(n),l=J.Type.Scheme}var u;if(a===null){let t=e.match(bs)||e.match(xs);if(t){let e,n=1;t.length===4?e=[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:(e=[parseInt(t[2],16),parseInt(t[3],16),parseInt(t[4],16)],n=Os(parseInt(t[1],16)/255)),e=ws(e),e=Ds(e),a={srgb:e,alpha:n},l=J.Type.Hex}}if(a===null){let t=e.match(ms)||e.match(hs);if(t){let e=Cs(t[1],t[2],t[3]);e=ws(e),e=Ds(e),a={srgb:e,alpha:t[4]?Os(parseFloat(t[4])):1},l=J.Type.RGB}}if(a===null){let t=e.match(gs)||e.match(_s);if(t){let e=Cs(t[1],t[2],t[3]);e=ws(e,100),e=js(e),e=Ds(e),a={srgb:e,alpha:t[4]?Os(parseFloat(t[4])):1},l=J.Type.LRGB}}if(a===null){let t=e.match(vs)||e.match(ys);if(t){let e=Cs(t[1],t[2],t[3]);e=Ps(e),e=Ds(e),a={srgb:e,alpha:t[4]?Os(parseFloat(t[4])):1},l=J.Type.HSL}}if(a===null){let t=e.match(Ss);if(t){let e=parseInt(t[1]),r=n?.(e),i=r?r.toRGBA():ac(e);i&&(a={srgb:[i.red/255,i.green/255,i.blue/255],alpha:i.alpha},o=r?ff(r):null,l=J.Type.Index)}}if(a===null)throw Error(`Not a valid color format: `+e);return{srgbAlpha:a,key:s,color:c,type:l,systemName:o}},hf=(e,t)=>{let n=[...e.srgb],r=e.alpha===void 0?1:e.alpha,i=t?t.length:0;for(var a=0;a<i;a++){let e=t[a],i=Object.keys(e)[0],o=e[i];i===J.AdjustmentType.Alpha?(r=o/100,r=Math.max(0,Math.min(1,r))):i===J.AdjustmentType.AlphaOff?(r+=o/100,r=Math.max(0,Math.min(1,r))):i===J.AdjustmentType.AlphaMod?(r*=o/100,r=Math.max(0,Math.min(1,r))):i===J.AdjustmentType.Hue?n=Vs(0,n,o):i===J.AdjustmentType.Sat?n=Vs(1,n,o):i===J.AdjustmentType.Lum?n=Vs(2,n,o):i===J.AdjustmentType.HueOff?n=Hs(0,n,o):i===J.AdjustmentType.SatOff?n=Hs(1,n,o):i===J.AdjustmentType.LumOff?n=Hs(2,n,o):i===J.AdjustmentType.HueMod?n=Us(0,n,o):i===J.AdjustmentType.SatMod?n=Us(1,n,o):i===J.AdjustmentType.LumMod?n=Us(2,n,o):i===J.AdjustmentType.Red?n=Ws(0,n,o,0):i===J.AdjustmentType.Green?n=Ws(1,n,o,0):i===J.AdjustmentType.Blue?n=Ws(2,n,o,0):i===J.AdjustmentType.RedOff?n=Ws(0,n,o,1):i===J.AdjustmentType.GreenOff?n=Ws(1,n,o,1):i===J.AdjustmentType.BlueOff?n=Ws(2,n,o,1):i===J.AdjustmentType.RedMod?n=Ws(0,n,o,2):i===J.AdjustmentType.GreenMod?n=Ws(1,n,o,2):i===J.AdjustmentType.BlueMod?n=Ws(2,n,o,2):i===J.AdjustmentType.Shade?n=Ls(n,o):i===J.AdjustmentType.Tint?n=Bs(n,o):i===J.AdjustmentType.ETint?n=zs(n,o):i===J.AdjustmentType.Gray?n=Gs(n):i===J.AdjustmentType.Comp?n=Ks(n):i===J.AdjustmentType.Inv?n=qs(n,o):i===J.AdjustmentType.Gamma?n=Js(n):i===J.AdjustmentType.InvGamma?n=Ys(n):console.warn(`unknown adjustmentType: `+i)}return{srgb:n,alpha:r}},gf=new Map,_f=Object.keys(J.AdjustmentType),vf=_f.length;for(let e=0;e<vf;e++){let t=_f[e];gf.set(J.AdjustmentType[t].toLowerCase(),J.AdjustmentType[t])}var yf,bf=RegExp(`\\s+\\s*(?![^()]*\\))|,\\s*(?![^()]*\\))`),xf=RegExp(`\\s*[,]\\s*|\\s+`),Sf=null,Cf=null,wf=`--sxl-sys-color-`,Tf=0,Ef={[J.Scheme.Bg1]:`window`,[J.Scheme.Bg2]:`E7E6E6`,[J.Scheme.Tx1]:`windowText`,[J.Scheme.Tx2]:`44546A`,[J.Scheme.Accent1]:`4472C4`,[J.Scheme.Accent2]:`ED7D31`,[J.Scheme.Accent3]:`A5A5A5`,[J.Scheme.Accent4]:`FFC000`,[J.Scheme.Accent5]:`5B9BD5`,[J.Scheme.Accent6]:`70AD47`,[J.Scheme.Hlink]:`0563C1`,[J.Scheme.FolHlink]:`954F72`},Df=class e{constructor(t,n,r,i=null,a){let o=null,s=null,c=i;if(t instanceof e)o=t.getVal(),t.getAdjustments()&&(s=[...t.getAdjustments()]),c??=t._private.last;else if(typeof t==`string`){let e=this._parse(t);o=e.val,s=e.adjs,e.last&&(c=cf(e.last))}else if(t?.val){o=t.val,s=t.adjs;let e=t.last;e&&(c=cf(e))}if(!o)throw Error(`Unable to determine color value`);let l=a??Cf;this._private={val:o,last:c,adjs:s,schemeLookup:n,indexedLookup:r,systemLookup:a,parsedVal:mf(o,n,r,l,c),adjusted:null,resolved:null,resolvedEpoch:Tf}}_parse(e){let t=null,n=e.trim(),r=n.split(bf);if(r&&(t=r[0],n=n.substring(t.length,n.length).trim()),!t)throw Error(`no color key found`);let i=[],a=null,o=n.split(xf),s=o.length;for(let e=0;e<s;e++){let t=o[e];if(!t)continue;if(t.toLowerCase()===sf){e++,a=o[e];continue}let n=gf.get(t.toLowerCase());if(!n)throw Error(`Invalid adjustment type:`+t);let r=null;if(n!==J.AdjustmentType.Gray&&n!==J.AdjustmentType.Comp&&n!==J.AdjustmentType.Inv&&n!==J.AdjustmentType.Gamma&&n!==J.AdjustmentType.InvGamma){e++;let n=o[e];if(r=parseFloat(n),r==null)throw Error(`Invalid adjustment value: missing value for'${t}'`);if(isNaN(r))throw Error(`Invalid adjustment value:`+n)}i.push({[n]:r})}return{val:t,last:a,adjs:i}}_forceDark(e=!0){this._resolve();let t=this._private.parsedVal,n=this._private.systemLookup??Cf;if(t.systemName&&n){let r=n(t.systemName,!0);if(r){let t=hf(pf(r.toRGBA()),this._private.adjs),n=Os(t.alpha);if(e){let e=Es(Ts([...t.srgb]));return new Ko.RGBA(e[0],e[1],e[2],n)}let i=Is(t.srgb);return new Ko.HSLA(i[0],i[1],i[2],n)}}let r=this._private.resolved,i=[r.red,r.green,r.blue];i=((e,t)=>{t=(t%360+360)%360;let n=[1,0,0,0,1,0,0,0,1],r=Math.cos(t*Math.PI/180),i=Math.sin(t*Math.PI/180);n[0]=Zs+.7874*r-Zs*i,n[1]=Qs-Qs*r-Qs*i,n[2]=$s-$s*r+.9278*i,n[3]=Zs-Zs*r+.143*i,n[4]=Qs+(1-Qs)*r+.14*i,n[5]=$s-$s*r-.283*i,n[6]=Zs-Zs*r-.7874*i,n[7]=Qs-Qs*r+Qs*i,n[8]=$s+.9278*r+$s*i;let a=e=>Math.round(Math.max(0,Math.min(255,e))),o=e[0],s=e[1],c=e[2];return[a(n[0]*o+n[1]*s+n[2]*c),a(n[3]*o+n[4]*s+n[5]*c),a(n[6]*o+n[7]*s+n[8]*c)]})(i,180),i=qs(i,!1);let a=As(i),o=Is(a);if(o[2]=.95*o[2],a=Ps(o),i=js(a),i=Es(i),i=Ds(i,!1),e)return new Ko.RGBA(i[0],i[1],i[2],r.alpha);let s=Is(As(i));return new Ko.HSLA(s[0],s[1],s[2],r.alpha)}_resolve(){if(this._private.resolved){let e=this._private.parsedVal;if(!e.key&&!e.systemName)return;if(e.systemName){if(this._private.resolvedEpoch===Tf)return}else{let t=this._private.schemeLookup(e.key)?.toRGBA();if(t===e.color||t?.isEqual(e.color))return}}let e=this._private.systemLookup??Cf,t=mf(this._private.val,this._private.schemeLookup,this._private.indexedLookup,e,this._private.last),n=t.srgbAlpha,r=hf(n,this._private.adjs),i=Ts(r.srgb);i=Es(i);let a=Os(r.alpha);this._private.adjusted=r,this._private.parsedVal=t,this._private.resolved=new Ko.RGBA(i[0],i[1],i[2],a),this._private.resolvedEpoch=Tf}static parse(t,n,r,i=null,a){if(t instanceof e)return t;let o=t,s=null,c=o?.trim(),l=null;try{if(!s){let e=c?.split(bf);e&&(s=e[0],c=c.substring(s.length,c.length).trim())}if(!s)throw Error(`no color found`);let t=[],o=null,u=c.split(xf),d=u.length;for(let e=0;e<d;e++){let n=u[e];if(!n)continue;if(n.toLowerCase()===sf){e++,o=u[e];continue}let r=gf.get(n.toLowerCase());if(!r)throw Error(`Invalid adjustment type:`+n);let i=null;if(r!==J.AdjustmentType.Gray&&r!==J.AdjustmentType.Comp&&r!==J.AdjustmentType.Inv&&r!==J.AdjustmentType.Gamma&&r!==J.AdjustmentType.InvGamma){e++;let t=u[e];if(i=parseFloat(t),i==null)throw Error(`Invalid adjustment value: missing value for'${n}'`);if(isNaN(i))throw Error(`Invalid adjustment value:`+t)}t.push({[r]:i})}l=new e({val:s,adjs:t,last:o},n,r,i,a)}catch(e){throw e}return l}static isSystem(e){return!!e&&!0===tf.valueOfName(e)?.system}static getDefaultSystemLookup(){return Cf}static setDefaultSystemLookup(e){let t=Cf;return Cf=e??null,Tf++,t}static getSystemEpoch(){return Tf}static invalidateSystemColors(){Tf++}static getSystemColorDefaults(){return tf.getSystemColorDefaults()}static getDefaultSchemeLookup(){if(!Sf){let t=new Map,n=Object.keys(Ef),r=n.length;for(let i=0;i<r;i++){let r=n[i];t.set(r.toLowerCase(),e.parse(Ef[r],null))}Sf=e=>t.get(e.toLowerCase())}return Sf}isEqual(t){return t instanceof e&&this.toString().toLowerCase()===t.toString().toLowerCase()}getVal(){return this._private.val}getAdjustments(){return this._private.adjs}getBaseColor(){return new e({val:this._private.val,adjs:null},this._private.schemeLookup,this._private.indexedLookup,this._private.last,this._private.systemLookup)}getLastColor(){return this._private.last&&this._private.parsedVal.systemName?lf(this._private.last):null}getType(){return this._resolve(),this._private.parsedVal.type??null}adjust(t){return new e({val:this._private.val,adjs:this._private.adjs?this._private.adjs.concat(t):t},this._private.schemeLookup,this._private.indexedLookup,this._private.last,this._private.systemLookup)}_systemCSSVar(e){this._resolve();let t=this._private.parsedVal;if(!t.systemName||this._private.adjs&&this._private.adjs.length>0)return null;let n=t.systemName.toLowerCase(),r=df(t.systemName,null,this._private.last).rgba,i=`#`+lf(r),a=`${wf}${n}`;return e?`var(${a}-dark, var(${a}, ${i}))`:`var(${a}, ${i})`}toCSS(e=!1,t=!1){if(e===`adaptive`){let e=this.toCSS(!1,t),n=this.toCSS(!0,t);return e===n?e:`light-dark(${e}, ${n})`}let n=!0===e,r=this._systemCSSVar(n);if(r)return r;let i=n?this._forceDark():this.toRGBA();return i.alpha===0?`none`:i.toString(t)}toRGBA(e=!1){return this._resolve(),e?this._forceDark():this._private.resolved}toHSLA(e=!1){if(this._resolve(),e)return this._forceDark(!1);let t=Is(this._private.adjusted.srgb);return new Ko.HSLA(t[0],t[1],t[2],Os(this._private.adjusted.alpha??1))}toHex(e=!1){this._resolve();let t=e?this._forceDark():this._private.resolved;return new Ko.HEX(t.red,t.green,t.blue,t.alpha??1)}toBlackOrWhite(t=!1,n=157){let r=this.toRGBA(t),i=.299*r.red+.587*r.green+.114*r.blue>n;return new e(i?`#000000`:`#FFFFFF`,this._private.schemeLookup,this._private.indexedLookup,this._private.last,this._private.systemLookup)}get[Symbol.toStringTag](){return this.toString()}toString(){let e=this._private.val,t=this._private.adjs,n=t?t.length:0;for(let r=0;r<n;r++){let i=t[r];if(!i)continue;let a=Object.keys(i)[0];e+=` `+a;let o=i[a];typeof o==`number`&&(e+=` `+o),r<n-1&&(e+=`,`)}let r=this.getLastColor();return r&&(e+=` lastClr `+r),e}get isIColor(){return!0}};(af=Y||={}).Type={None:`none`,Solid:`solid`,Gradient:`gradient`,Pattern:`pattern`,Image:`pattern`,Background:`background`,Group:`group`,Custom:`custom`},af.GradientType={Linear:`linear`,Path:`path`,Rect:`rect`,Shape:`shape`},af.TileMirror={None:`none`,Vertical:`v`,Horizontal:`h`,Both:`b`},af.BuiltInSheetPattern={None:`none`,Solid:`solid`,DarkGray:`darkGray`,MediumGray:`mediumGray`,LightGray:`lightGray`,Gray0625:`gray0625`,Gray125:`gray125`,DarkHorizontal:`darkHorizontal`,DarkVertical:`darkVertical`,DarkDown:`darkDown`,DarkUp:`darkUp`,DarkGrid:`darkGrid`,DarkTrellis:`darkTrellis`,LightHorizontal:`lightHorizontal`,LightVertical:`lightVertical`,LightDown:`lightDown`,LightUp:`lightUp`,LightGrid:`lightGrid`,LightTrellis:`lightTrellis`,Custom:`custom`},function(e){let t=e.BuiltInName={Normal:`Normal`,RowLevel:`RowLevel_#`,ColLevel:`ColLevel_#`,Comma:`Comma`,Currency:`Currency`,Percent:`Percent`,Comma0:`Comma [0]`,Currency0:`Currency [0]`,Hyperlink:`Hyperlink`,FollowedHyperlink:`Followed Hyperlink`,Note:`Note`,WarningText:`Warning Text`,Unknown12:`??-12`,Unknown13:`??-13`,Unknown14:`??-14`,Title:`Title`,Heading1:`Heading 1`,Heading2:`Heading 2`,Heading3:`Heading 3`,Heading4:`Heading 4`,Input:`Input`,Output:`Output`,Calculation:`Calculation`,CheckCell:`Check Cell`,LinkedCell:`Linked Cell`,Total:`Total`,Good:`Good`,Bad:`Bad`,Neutral:`Neutral`,Accent1:`Accent1`,Accent1_20:`20% - Accent1`,Accent1_40:`40% - Accent1`,Accent1_60:`60% - Accent1`,Accent2:`Accent2`,Accent2_20:`20% - Accent2`,Accent2_40:`40% - Accent2`,Accent2_60:`60% - Accent2`,Accent3:`Accent3`,Accent3_20:`20% - Accent3`,Accent3_40:`40% - Accent3`,Accent3_60:`60% - Accent3`,Accent4:`Accent4`,Accent4_20:`20% - Accent4`,Accent4_40:`40% - Accent4`,Accent4_60:`60% - Accent4`,Accent5:`Accent5`,Accent5_20:`20% - Accent5`,Accent5_40:`40% - Accent5`,Accent5_60:`60% - Accent5`,Accent6:`Accent6`,Accent6_20:`20% - Accent6`,Accent6_40:`40% - Accent6`,Accent6_60:`60% - Accent6`,ExplanatoryText:`Explanatory Text`},n=Object.values(t);e.builtInNameFromId=function(e){return n[e]},e.IconSet={Arrows3:`3Arrows`,ArrowsGray3:`3ArrowsGray`,Flags3:`3Flags`,Signs3:`3Signs`,Symbols3:`3Symbols`,Symbols3_2:`3Symbols2`,TrafficLights3:`3TrafficLights1`,TrafficLights3_2:`3TrafficLights2`,Triangles3:`3Triangles`,Stars3:`3Stars`,Arrows4:`4Arrows`,ArrowsGray4:`4ArrowsGray`,Rating4:`4Rating`,RedToBlack4:`4RedToBlack`,TrafficLights4:`4TrafficLights`,Arrows5:`5Arrows`,ArrowsGray5:`5ArrowsGray`,Quarters5:`5Quarters`,Rating5:`5Rating`,Boxes5:`5Boxes`}}(X||={}),(of||={}).BuiltInFilterType={BuiltIn:`builtIn`,All:`all`,Custom:`custom`};var Of=[[`Office`,`windowText`,`window`,`0E2841`,`E8E8E8`,`156082`,`E97132`,`196B24`,`0F9ED5`,`A02B93`,`4EA72E`,`467886`,`96607D`],[`Office 2013-2022`,`windowText`,`window`,`44546A`,`E7E6E6`,`4472C4`,`ED7D31`,`A5A5A5`,`FFC000`,`5B9BD5`,`70AD47`,`0563C1`,`954F72`],[`Office 2007-2010`,`windowText`,`window`,`1F497D`,`EEECE1`,`4F81BD`,`C0504D`,`9BBB59`,`8064A2`,`4BACC6`,`F79646`,`0000FF`,`800080`],[`Grayscale`,`windowText`,`window`,`000000`,`F8F8F8`,`DDDDDD`,`B2B2B2`,`969696`,`808080`,`5F5F5F`,`4D4D4D`,`5F5F5F`,`919191`],[`Atlas`,`windowText`,`window`,`454545`,`E0E0E0`,`F81B02`,`FC7715`,`AFBF41`,`50C49F`,`3B95C4`,`B560D4`,`FC5A1A`,`B49E74`],[`Banded`,`2C2C2C`,`FFFFFF`,`099BDD`,`F2F2F2`,`FFC000`,`A5D028`,`08CC78`,`F24099`,`828288`,`F56617`,`005DBA`,`6C606A`],[`Basis`,`000000`,`FFFFFF`,`565349`,`DDDDDD`,`A6B727`,`DF5327`,`FE9E00`,`418AB3`,`D7D447`,`818183`,`F59E00`,`B2B2B2`],[`Berlin`,`windowText`,`window`,`9D360E`,`E7E6E6`,`F09415`,`C1B56B`,`4BAF73`,`5AA6C0`,`D17DF9`,`FA7E5C`,`FFAE3E`,`FCC77E`],[`Celestial`,`windowText`,`window`,`18276C`,`EBEBEB`,`AC3EC1`,`477BD1`,`46B298`,`90BA4C`,`DD9D31`,`E25247`,`C573D2`,`CCAEE8`],[`Circuit`,`windowText`,`window`,`134770`,`82FFFF`,`9ACD4C`,`FAA93A`,`D35940`,`B258D3`,`63A0CC`,`8AC4A7`,`B8FA56`,`7AF8CC`],[`Damask`,`windowText`,`window`,`2A5B7F`,`ABDAFC`,`9EC544`,`50BEA3`,`4A9CCC`,`9A66CA`,`C54F71`,`DE9C3C`,`6BA9DA`,`A0BCD3`],[`Depth`,`windowText`,`window`,`455F51`,`94D7E4`,`41AEBD`,`97E9D5`,`A2CF49`,`608F3D`,`F4DE3A`,`FCB11C`,`FBCA98`,`D3B86D`],[`Dividend`,`windowText`,`window`,`3D3D3D`,`EBEBEB`,`4D1434`,`903163`,`B2324B`,`969FA7`,`66B1CE`,`40619D`,`828282`,`A5A5A5`],[`Droplet`,`windowText`,`window`,`355071`,`AABED7`,`2FA3EE`,`4BCAAD`,`86C157`,`D99C3F`,`CE6633`,`A35DD1`,`56BCFE`,`97C5E3`],[`Facet`,`windowText`,`window`,`2C3C43`,`EBEBEB`,`90C226`,`54A021`,`E6B91E`,`E76618`,`C42F1A`,`918655`,`99CA3C`,`B9D181`],[`Frame`,`000000`,`FFFFFF`,`545454`,`BFBFBF`,`40BAD2`,`FAB900`,`90BB23`,`EE7008`,`1AB39F`,`D5393D`,`90BB23`,`EE7008`],[`Gallery`,`windowText`,`window`,`454545`,`DFDBD5`,`B71E42`,`DE478E`,`BC72F0`,`795FAF`,`586EA6`,`6892A0`,`FA2B5C`,`BC658E`],[`Integral`,`windowText`,`window`,`335B74`,`DFE3E5`,`1CADE4`,`2683C6`,`27CED7`,`42BA97`,`3E8853`,`62A39F`,`6B9F25`,`B26B02`],[`Ion Boardroom`,`windowText`,`window`,`3B3059`,`EBEBEB`,`B31166`,`E33D6F`,`E45F3C`,`E9943A`,`9B6BF2`,`D53DD0`,`8F8F8F`,`A5A5A5`],[`Ion`,`windowText`,`window`,`1E5155`,`EBEBEB`,`B01513`,`EA6312`,`E6B729`,`6AAC90`,`54849A`,`9E5E9B`,`58C1BA`,`9DFFCB`],[`Madison`,`windowText`,`window`,`1F2D29`,`C5FAEB`,`A1D68B`,`5EC795`,`4DADCF`,`CDB756`,`E29C36`,`8EC0C1`,`6D9D9B`,`6D8583`],[`Main Event`,`windowText`,`window`,`424242`,`C8C8C8`,`B80E0F`,`A6987D`,`7F9A71`,`64969F`,`9B75B2`,`80737A`,`F21213`,`B6A394`],[`Mesh`,`windowText`,`window`,`363D46`,`EBEBEB`,`6F6F6F`,`BFBFA5`,`DCD084`,`E7BF5F`,`E9A039`,`CF7133`,`F28943`,`F1B76C`],[`Metropolitan`,`windowText`,`window`,`162F33`,`EAF0E0`,`50B4C8`,`A8B97F`,`9B9256`,`657689`,`7A855D`,`84AC9D`,`2370CD`,`877589`],[`Organic`,`windowText`,`window`,`212121`,`DADADA`,`83992A`,`3C9770`,`44709D`,`A23C33`,`D97828`,`DEB340`,`A8BF4D`,`B4CA80`],[`Parallax`,`windowText`,`window`,`212121`,`CDD0D1`,`30ACEC`,`80C34F`,`E29D3E`,`D64A3B`,`D64787`,`A666E1`,`3085ED`,`82B6F4`],[`Parcel`,`000000`,`FFFFFF`,`4A5356`,`E8E3CE`,`F6A21D`,`9BAFB5`,`C96731`,`9CA383`,`87795D`,`A0988C`,`00B0F0`,`738F97`],[`Quotable`,`windowText`,`window`,`212121`,`636363`,`00C6BB`,`6FEBA0`,`B6DF5E`,`EFB251`,`EF755F`,`ED515C`,`8F8F8F`,`A5A5A5`],[`Retrospect`,`000000`,`window`,`637052`,`CCDDEA`,`E48312`,`BD582C`,`865640`,`9B8357`,`C2BC80`,`94A088`,`2998E3`,`8C8C8C`],[`Savon`,`windowText`,`window`,`1485A4`,`E3DED1`,`1CADE4`,`2683C6`,`27CED7`,`42BA97`,`3E8853`,`62A39F`,`F49100`,`739D9B`],[`Slate`,`windowText`,`window`,`212123`,`DADADA`,`BC451B`,`D3BA68`,`BB8640`,`AD9277`,`A55A43`,`AD9D7B`,`E98052`,`F4B69B`],[`Slice`,`windowText`,`window`,`146194`,`76DBF4`,`052F61`,`A50E82`,`14967C`,`6A9E1F`,`E87D37`,`C62324`,`0D2E46`,`356A95`],[`Vapor Trail`,`windowText`,`window`,`454545`,`DADADA`,`DF2E28`,`FE801A`,`E9BF35`,`81BB42`,`32C7A9`,`4A9BDC`,`F0532B`,`F38B53`],[`View`,`000000`,`FFFFFF`,`46464A`,`D6D3CC`,`6F6F74`,`92A9B9`,`A7B789`,`B9A489`,`8D6374`,`9B7362`,`67AABF`,`ABAFA5`],[`Wisp`,`windowText`,`window`,`766F54`,`E3EACF`,`A53010`,`DE7E18`,`9F8351`,`728653`,`92AA4C`,`6AAC91`,`FB4A18`,`FB9318`],[`Wood Type`,`windowText`,`window`,`696464`,`E9E5DC`,`D34817`,`9B2D1F`,`A28E6A`,`956251`,`918485`,`855D5D`,`CC9900`,`96A9A9`]],kf=[[`Office`,`Calibri Light`,`Calibri`],[`Office 2013-2022`,`Calibri Light`,`Calibri`],[`Office 2007-2010`,`Calibri Light`,`Calibri`],[`Grayscale`,`Calibri Light`,`Calibri`],[`Atlas`,`Calibri Light`,`Rockwell`],[`Banded`,`Corbel`,`Corbel`],[`Basis`,`Corbel`,`Corbel`],[`Berlin`,`Trebuchet MS`,`Trebuchet MS`],[`Celestial`,`Calibri Light`,`Calibri`],[`Circuit`,`Tw Cen MT`,`Tw Cen MT`],[`Damask`,`Bookman Old Style`,`Rockwell`],[`Depth`,`Corbel`,`Corbel`],[`Madison`,`Arial`,`Arial`],[`Main Event`,`Impact`,`Impact`],[`Mesh`,`Century Gothic`,`Century Gothic`],[`Metropolitan`,`Calibri Light`,`Calibri Light`],[`Organic`,`Garamond`,`Garamond`],[`Parallax`,`Corbel`,`Corbel`],[`Parcel`,`Gill Sans MT`,`Gill Sans MT`],[`Quotable`,`Century Gothic`,`Century Gothic`],[`Retrospect`,`Calibri Light`,`Calibri`],[`Savon`,`Century Gothic`,`Century Gothic`],[`Slate`,`Calisto MT`,`Calisto MT`],[`Slice`,`Century Gothic`,`Century Gothic`],[`Vapor Trail`,`Century Gothic`,`Century Gothic`],[`View`,`Century Schoolbook`,`Century Schoolbook`],[`Wisp`,`Century Gothic`,`Century Gothic`],[`Wood Type`,`Rockwell Condensed`,`Rockwell`]],Af=[[`Office`,`Office`,`Office`],[`2013-2022`,`Office 2013-2022`,`Office 2013-2022`],[`Atlas`,`Atlas`,`Atlas`],[`Banded`,`Banded`,`Banded`],[`Basis`,`Basis`,`Basis`],[`Berlin`,`Berlin`,`Berlin`],[`Celestial`,`Celestial`,`Celestial`],[`Circuit`,`Circuit`,`Circuit`],[`Damask`,`Damask`,`Damask`],[`Depth`,`Depth`,`Depth`],[`Dividend`,`Dividend`,`Dividend`],[`Droplet`,`Droplet`,`Droplet`],[`Facet`,`Facet`,`Facet`],[`Frame`,`Frame`,`Frame`],[`Gallery`,`Gallery`,`Gallery`],[`Grayscale`,`Grayscale`,`Grayscale`],[`Integral`,`Integral`,`Integral`],[`Ion Boardroom`,`Ion Boardroom`,`Ion Boardroom`],[`Ion`,`Ion`,`Ion`],[`Madison`,`Madison`,`Madison`],[`Main Event`,`Main Event`,`Main Event`],[`Mesh`,`Mesh`,`Mesh`],[`Metropolitan`,`Metropolitan`,`Metropolitan`],[`Organic`,`Organic`,`Organic`],[`Parallax`,`Parallax`,`Parallax`],[`Parcel`,`Parcel`,`Parcel`],[`Quotable`,`Quotable`,`Quotable`],[`Retrospect`,`Retrospect`,`Retrospect`],[`Savon`,`Savon`,`Savon`],[`Slate`,`Slate`,`Slate`],[`Slice`,`Slice`,`Slice`],[`Vapor Trail`,`Vapor Trail`,`Vapor Trail`],[`View`,`View`,`View`],[`Wisp`,`Wisp`,`Wisp`],[`Wood Type`,`Wood Type`,`Wood Type`],[`Office 2007-2010`,`Office 2007-2010`,`Office 2007-2010`]],jf=`Themes is readonly. To make modifications create a new DocsThemes instance.`,Mf={[J.Scheme.Bg1]:`lt1`,[J.Scheme.Bg2]:`lt2`,[J.Scheme.Tx1]:`dk1`,[J.Scheme.Tx2]:`dk2`,[J.Scheme.Accent1]:`accent1`,[J.Scheme.Accent2]:`accent2`,[J.Scheme.Accent3]:`accent3`,[J.Scheme.Accent4]:`accent4`,[J.Scheme.Accent5]:`accent5`,[J.Scheme.Accent6]:`accent6`,[J.Scheme.Hlink]:`hlink`,[J.Scheme.FolHlink]:`folHlink`},Nf=`Office`,Pf=[Nf,`Calibri Light`,`Calibri`],Ff=[`dk1`,`lt1`,`dk2`,`lt2`,`accent1`,`accent2`,`accent3`,`accent4`,`accent5`,`accent6`,`hlink`,`folHlink`],If=e=>{let t={},n=e.length;for(let r=0;r<n;r++){let n=e[r],i=n[0],a={name:i};t[i]=a;let o=Ff.length;for(let e=0;e<o;e++){let t=Ff[e],r=n[e+1];if(!r)continue;let i=Df.parse(r);i&&(a[t]=i.toString())}}return t},Lf=e=>{let t={},n=e.length;for(let r=0;r<n;r++){let n=e[r],i=n[0],a={name:i};t[i]=a,a.majorFont=n[1]??Pf[1],a.minorFont=n[2]??Pf[2]}return t},Rf=If([[Nf,`windowText`,`window`,`44546A`,`E7E6E6`,`4472C4`,`ED7D31`,`A5A5A5`,`FFC000`,`5B9BD5`,`70AD47`,`0563C1`,`954F72`]]),zf=Lf([Pf]),Bf=Rf[Nf],Vf=zf[Nf],Hf=null,Uf=new class{constructor(){this._colors={};let e=Ff.length;for(let t=0;t<e;t++){let e=Ff[t],n=Df.parse(Bf[e]);this._colors[e]=n}}getName(){return Bf.name}getDk1(){return this._colors.dk1}getLt1(){return this._colors.lt1}getDk2(){return this._colors.dk2}getLt2(){return this._colors.lt2}getAccent1(){return this._colors.accent1}getAccent2(){return this._colors.accent2}getAccent3(){return this._colors.accent3}getAccent4(){return this._colors.accent4}getAccent5(){return this._colors.accent5}getAccent6(){return this._colors.accent6}getHlink(){return this._colors.hlink}getFolHlink(){return this._colors.folHlink}toJSON(){return null}},Wf=class{constructor(e,t=Uf){this._delegate=t,this._fromJSON(e)}_fromJSON(e){if(this._overrides={},!e)return;let t=Object.keys(e),n=t.length;if(n!==0)for(let r=0;r<n;r++){let n=t[r];this._overrides[n]=n===`name`?e[n]:Df.parse(e[n])}}_value(e,t){return this._overrides&&this._overrides[e]!==null&&this._overrides[e]!==void 0?this._overrides[e]:this._delegate?.[t]?.()}getName(){return this._value(`name`,`getName`)}getDk1(){return this._value(`dk1`,`getDk1`)}getLt1(){return this._value(`lt1`,`getLt1`)}getDk2(){return this._value(`dk2`,`getDk2`)}getLt2(){return this._value(`lt2`,`getLt2`)}getAccent1(){return this._value(`accent1`,`getAccent1`)}getAccent2(){return this._value(`accent2`,`getAccent2`)}getAccent3(){return this._value(`accent3`,`getAccent3`)}getAccent4(){return this._value(`accent4`,`getAccent4`)}getAccent5(){return this._value(`accent5`,`getAccent5`)}getAccent6(){return this._value(`accent6`,`getAccent6`)}getHlink(){return this._value(`hlink`,`getHlink`)}getFolHlink(){return this._value(`folHlink`,`getFolHlink`)}toJSON(){let t=e.A.toSafeJSON(this._overrides),n=this.getName();return n&&(t.name=n),t}},Gf=new class{constructor(){this._colors={};let e=Ff.length;for(let t=0;t<e;t++){let e=Ff[t],n=Df.parse(Bf[e]);this._colors[e]=n}}getName(){return Vf.name}getMajorFont(){return Vf.majorFont}getMinorFont(){return Vf.minorFont}getMajorFallbacks(){return Vf.majorFallbacks}getMinorFallbacks(){return Vf.minorFallbacks}},Kf=class{constructor(e,t=Gf){this._delegate=t,this._fromJSON(e)}_fromJSON(e){if(this._overrides={},!e)return;let t=Object.keys(e),n=t.length;if(n!==0)for(let r=0;r<n;r++){let n=t[r];this._overrides[n]=e[n]}}_value(e,t){return this._overrides&&this._overrides[e]!==null&&this._overrides[e]!==void 0?this._overrides[e]:this._delegate?.[t]?.()}getName(){return this._value(`name`,`getName`)}getMajorFont(){return this._value(`majorFont`,`getMajorFont`)}getMinorFont(){return this._value(`minorFont`,`getMinorFont`)}getMajorFallbacks(){return this._value(`majorFallbacks`,`getMajorFallbacks`)}getMinorFallbacks(){return this._value(`minorFallbacks`,`getMinorFallbacks`)}toJSON(){let t=e.A.toSafeJSON(this._overrides),n=this.getName();return n&&(t.name=n),t}},qf=class{constructor(e,t=null,n=null){if(this._cacheColors=new Map,this._cacheEpoch=Df.getSystemEpoch(),!t&&e?.name){let n=Hf?Hf.get(e.name.toLowerCase()):null;n&&(t=n)}!t&&Hf&&(t=Hf.get(Nf.toLowerCase())??null),this._name=e?.name??t?.getName(),this._builtInID=n,this._delegate=t,this._formatSchemeXml=e?.formatSchemeXml,this._fillStyleLst=e?.fillStyleLst,this._lnStyleLst=e?.lnStyleLst,this._effectStyleLst=e?.effectStyleLst,this._bgFillStyleLst=e?.bgFillStyleLst,this._colors=new Wf(e?.colors,this._delegate?.getColorScheme()),this._fonts=new Kf(e?.fonts,this._delegate?.getFontScheme());let r=Mf,i={},a=Object.keys(r),o=a.length;for(let e=0;e<o;e++){let t=a[e];i[t]=`get${x(r[t])}`}i.dk1=`getDk1`,i.dk2=`getDk2`,i.lt1=`getLt1`,i.lt2=`getLt2`,i.folhlink=`getFolHlink`,this._colorMap=i;let s=this;this._schemeLookup=e=>{let t=Df.getSystemEpoch();s._cacheEpoch!==t&&(s._cacheColors=new Map,s._cacheEpoch=t);let n=s._cacheColors.get(e);if(n)return n;e===`phClr`&&(e=J.Scheme.Tx1);let r=s._colorMap[e];if(!r)throw Error(`Invalid color scheme key: ${e}`);let i=s.getColorScheme(),a=i[r].bind(i)();return a||=Bf[Mf[e]??e],n=new Df(a),s._cacheColors.set(e,n),n}}get builtInID(){return this._builtInID??null}getName(){return(this._name??this._delegate?.getName())||`Custom`}isCustom(){return this._builtInID!==null&&this._builtInID!==void 0}getColorScheme(){return this._colors}getFontScheme(){return this._fonts}schemeLookup(){return this._schemeLookup}parseColor(e){return Df.parse(e,this._schemeLookup)}toJSON(){let e={name:this.getName()},t=this._colors.toJSON();t&&(Object.keys(t).length>1||t.name&&t.name!==e.name)&&(e.colors=t);let n=this._fonts.toJSON();return n&&(Object.keys(n).length>1||n.name&&n.name!==e.name)&&(e.fonts=n),this._fillStyleLst&&(e.fillStyleLst=this._fillStyleLst),this._lnStyleLst&&(e.lnStyleLst=this._lnStyleLst),this._effectStyleLst&&(e.effectStyleLst=this._effectStyleLst),this._bgFillStyleLst&&(e.bgFillStyleLst=this._bgFillStyleLst),this._formatSchemeXml&&(e.formatSchemeXml=this._formatSchemeXml),Object.keys(e).length===1&&e.name===Nf?null:e}},Jf=class{constructor(e=null,t=!1){(()=>{if(Hf)return Hf;let e=((e,t,n)=>{let r=[],i=e.length;for(let a=0;a<i;a++){let i=e[a],o=i[0],s=t[i[1]]??Bf,c=n[i[2]]??Vf;r.push({name:o,colors:s,fonts:c})}return r})(Af,If(Of),Lf(kf)),t=new Map,n=e.length;for(let r=0;r<n;r++){let n=new qf(null,new qf(e[r]),r+1);t.set(n.getName().toLowerCase(),n)}Hf=t})(),this._isReadOnly=t,this._customMap=new Map,this._defaultTheme=this.getByName(`Office`)}getDefaultTheme(){return this._defaultTheme}setDefaultTheme(e){if(this._isReadOnly)throw Error(jf);if(!e)throw Error(`Theme cannot be null.`);let t=this.getDefaultTheme();return this.getByName(e.getName())||this.setCustomTheme(e),this._defaultTheme=e,t}getByName(e){return e=e.toLowerCase(),this._customMap.get(e)||(Hf.get(e)??null)}*[Symbol.iterator](){yield*this.getItems()}getItems(t){let n=t?.type??of.BuiltInFilterType.All,r=new Map;return n!==of.BuiltInFilterType.BuiltIn&&n!==of.BuiltInFilterType.All||Hf.forEach((e,t)=>r.set(t,e)),n!==of.BuiltInFilterType.Custom&&n!==of.BuiltInFilterType.All||this._customMap.forEach((e,t)=>r.set(t,e)),t?.selected&&r.set(t.selected.getName().toLowerCase(),t.selected),(t=>{let n=[...t];return n.sort((t,n)=>e.A.isDefined(t.builtInID)&&!e.A.isDefined(n.builtInID)?1:!e.A.isDefined(t.builtInID)&&e.A.isDefined(n.builtInID)?-1:e.A.isDefined(t.builtInID)&&e.A.isDefined(n.builtInID)?t.builtInID-n.builtInID:t.getName().localeCompare(n.getName())),n})(Array.from(r.values()))}getCount(){return this._customMap.size+Hf.size}setCustomTheme(e){if(this._isReadOnly)throw Error(jf);let t=e.getName().toLowerCase(),n=this._customMap.get(t);return this._customMap.set(t,e),n??null}deleteCustomTheme(e){if(this._isReadOnly)throw Error(jf);let t=null;t=typeof e==`string`?e.toLowerCase():e.getName().toLowerCase();let n=this._customMap.get(t);return this._customMap.delete(t),n??null}};(yf||={}).ElementType={WholeTable:`wholeTable`,FirstColumnStripe:`firstColumnStripe`,SecondColumnStripe:`secondColumnStripe`,FirstRowStripe:`firstRowStripe`,SecondRowStripe:`secondRowStripe`,LastColumn:`lastColumn`,FirstColumn:`firstColumn`,HeaderRow:`headerRow`,TotalRow:`totalRow`,FirstHeaderCell:`firstHeaderCell`,LastHeaderCell:`lastHeaderCell`,FirstTotalCell:`firstTotalCell`,LastTotalCell:`lastTotalCell`},(yf||={}).Empty=class{constructor(e){this._normalStyle=e}getName(){return`None`}isShownInTableStyles(){return!1}isShownInPivotStyles(){return!1}getRanged(e){return null}getProperties(){return e.A.EmptyObject}isBuiltIn(){return!0}delete(){}toJSON(){return null}get isITableStyle(){return!0}};var Yf=Object.freeze({fallbacks:e.A.EmptyArray,weight:400,style:U.Style.Normal,color:J.Scheme.Tx1,letterSpacing:null,underline:U.UnderlineStyle.None,strike:!1,scheme:U.Scheme.None,verticalAlign:U.VerticalAlignment.Baseline,shadow:!1,outline:!1,extend:!1}),Xf=Object.freeze({style:W.StrokeStyle.None,color:J.Scheme.Tx1}),Zf=Object.freeze({[W.Edge.Top]:Xf,[W.Edge.Left]:Xf,[W.Edge.Bottom]:Xf,[W.Edge.Right]:Xf,[W.Edge.Horizontal]:Xf,[W.Edge.Vertical]:Xf,[W.Edge.DiagonalUp]:Xf,[W.Edge.DiagonalDown]:Xf}),Qf=Object.freeze({horizontal:o.HorizontalAlignment.General,vertical:o.VerticalAlignment.Bottom,indent:0,relativeIndent:0,overflow:o.Overflow.Visible,rotation:0,stacked:!1,quotePrefix:!1,justifyLastLine:!1,readingOrder:o.ReadingDirection.Auto,readingDirection:o.ReadingDirection.Auto}),$f=Object.freeze({locked:!1,formulaHidden:!1}),ep=Object.freeze({fill:Object.freeze({type:Y.Type.None}),numberFormat:`General`,alignment:Qf,font:Yf,border:Zf,protection:$f,quotePrefix:!1,namedStyle:null}),tp=(()=>{let t=[{named:X.BuiltInName.Normal},{named:X.BuiltInName.RowLevel},{named:X.BuiltInName.ColLevel},{named:X.BuiltInName.Comma,numberFormat:`_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)`},{named:X.BuiltInName.Currency,numberFormat:`_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)`},{named:X.BuiltInName.Percent,numberFormat:`0%`},{named:X.BuiltInName.Comma0,numberFormat:`_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)`},{named:X.BuiltInName.Currency0,numberFormat:`_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)`},{named:X.BuiltInName.Hyperlink,font:{color:J.Scheme.Hlink,underline:U.UnderlineStyle.Single}},{named:X.BuiltInName.FollowedHyperlink,font:{color:J.Scheme.FolHlink,underline:U.UnderlineStyle.Single}},{named:X.BuiltInName.Note,fill:`FFFFFFCC`,font:{style:U.Style.Normal,color:J.Scheme.Tx1},border:{left:{style:W.StrokeStyle.Thin,color:`FFB2B2B2`},top:{style:W.StrokeStyle.Thin,color:`FFB2B2B2`},right:{style:W.StrokeStyle.Thin,color:`FFB2B2B2`},bottom:{style:W.StrokeStyle.Thin,color:`FFB2B2B2`}}},{named:X.BuiltInName.WarningText,font:{color:`FFFF0000`}},{named:X.BuiltInName.Unknown12},{named:X.BuiltInName.Unknown13},{named:X.BuiltInName.Unknown14},{named:X.BuiltInName.Title,font:{size:18,color:J.Scheme.Tx2}},{named:X.BuiltInName.Heading1,font:{size:15,weight:700,color:J.Scheme.Tx2},border:{bottom:{style:W.StrokeStyle.Thick,color:J.Scheme.Accent1}}},{named:X.BuiltInName.Heading2,font:{size:13,weight:700,color:J.Scheme.Tx2},border:{bottom:{style:W.StrokeStyle.Thick,color:`accent1 lumMod 40, lumOff 60`}}},{named:X.BuiltInName.Heading3,font:{weight:700,color:J.Scheme.Tx2},border:{bottom:{style:W.StrokeStyle.Medium,color:`accent1 lumMod 40, lumOff 60`}}},{named:X.BuiltInName.Heading4,font:{weight:700,color:J.Scheme.Tx2}},{named:X.BuiltInName.Input,fill:`FFFFCC99`,font:{color:`FF3F3F76`},border:{left:{style:W.StrokeStyle.Thin,color:`FF7F7F7F`},top:{style:W.StrokeStyle.Thin,color:`FF7F7F7F`},right:{style:W.StrokeStyle.Thin,color:`FF7F7F7F`},bottom:{style:W.StrokeStyle.Thin,color:`FF7F7F7F`}}},{named:X.BuiltInName.Output,fill:`FFF2F2F2`,font:{color:`FF3F3F3F`},border:{left:{style:W.StrokeStyle.Thin,color:`FF3F3F3F`},top:{style:W.StrokeStyle.Thin,color:`FF3F3F3F`},right:{style:W.StrokeStyle.Thin,color:`FF3F3F3F`},bottom:{style:W.StrokeStyle.Thin,color:`FF3F3F3F`}}},{named:X.BuiltInName.Calculation,fill:`FFF2F2F2`,font:{color:`FFFA7D00`},border:{left:{style:W.StrokeStyle.Thin,color:`FF7F7F7F`},top:{style:W.StrokeStyle.Thin,color:`FF7F7F7F`},right:{style:W.StrokeStyle.Thin,color:`FF7F7F7F`},bottom:{style:W.StrokeStyle.Thin,color:`FF7F7F7F`}}},{named:X.BuiltInName.CheckCell,fill:`FFA5A5A5`,font:{color:J.Scheme.Bg1},border:{left:{style:W.StrokeStyle.Double,color:`FF3F3F3F`},top:{style:W.StrokeStyle.Double,color:`FF3F3F3F`},right:{style:W.StrokeStyle.Double,color:`FF3F3F3F`},bottom:{style:W.StrokeStyle.Double,color:`FF3F3F3F`}}},{named:X.BuiltInName.LinkedCell,font:{color:`FFFA7D00`},border:{bottom:{style:W.StrokeStyle.Double,color:`FFFF8001`}}},{named:X.BuiltInName.Total,font:{weight:700,color:J.Scheme.Tx1},border:{top:{style:W.StrokeStyle.Thin,color:J.Scheme.Accent1},bottom:{style:W.StrokeStyle.Double,color:J.Scheme.Accent1}}},{named:X.BuiltInName.Good,fill:`FFC6EFCE`,font:{color:`FF006100`}},{named:X.BuiltInName.Bad,fill:`FFFFC7CE`,font:{color:`FF9C0006`}},{named:X.BuiltInName.Neutral,fill:`FFFFEB9C`,font:{color:`FF9C5700`}},{named:X.BuiltInName.Accent1},{named:X.BuiltInName.Accent1_20},{named:X.BuiltInName.Accent1_40},{named:X.BuiltInName.Accent1_60},{named:X.BuiltInName.Accent2},{named:X.BuiltInName.Accent2_20},{named:X.BuiltInName.Accent2_40},{named:X.BuiltInName.Accent2_60},{named:X.BuiltInName.Accent3},{named:X.BuiltInName.Accent3_20},{named:X.BuiltInName.Accent3_40},{named:X.BuiltInName.Accent3_60},{named:X.BuiltInName.Accent4},{named:X.BuiltInName.Accent4_20},{named:X.BuiltInName.Accent4_40},{named:X.BuiltInName.Accent4_60},{named:X.BuiltInName.Accent5},{named:X.BuiltInName.Accent5_20},{named:X.BuiltInName.Accent5_40},{named:X.BuiltInName.Accent5_60},{named:X.BuiltInName.Accent6},{named:X.BuiltInName.Accent6_20},{named:X.BuiltInName.Accent6_40},{named:X.BuiltInName.Accent6_60},{named:X.BuiltInName.ExplanatoryText,font:{style:U.Style.Italic,color:`FF7F7F7F`}}];for(let e=29;e<=52;e++){let n=(e-29)%4,r=Math.floor((e-29)/4),i=``;n===1?i=` lumMod 20, lumOff 80`:n===2?i=` lumMod 40, lumOff 60`:n===3&&(i=` lumMod 60, lumOff 40`),t[e].fill=`accent${r+1}${i}`,t[e].font={color:n===0?J.Scheme.Bg1:J.Scheme.Tx1}}return e.A.deepFreeze(t)})(),np=null,rp=`TableStyleMedium2`;function ip(e){return!/^(-?\d|--)/.test(e)}function ap(e){let t=[],n=``,r=``,i=7;for(let a,o=0;a=e.charAt(o);o++)if(/[a-zA-Z\d\xa0-\uffff_-]/.test(a)&&i===7)n+=a;else if(a===`\\`&&i===7)i=6;else if(a===` `&&i===7){if(n!==``){if(!ip(n))return null;t.push(n),n=``}}else if(i===6)/[0-9a-f]/i.test(a)?(r+=a,i=8):(n+=a,i=7);else{if(i!==8)return null;/[0-9a-f]/i.test(a)&&r.length<6?r+=a:(n+=String.fromCodePoint(parseInt(r,16)),n+=a,r=``,i=7)}if(n!==``){if(!ip(n))return null;t.push(n)}return t.join(` `)}function op(e,t){let n=t,r=``,i={"font-family":[]};for(let t,a=0;t=e.charAt(a);a+=1)if(n!==4||t!==`"`&&t!==`'`)if(n===3&&t===`,`)n=4,r=``;else if(n===4&&t===`,`){let e=ap(r);e&&i[`font-family`].push(e),r=``}else if(n===5&&t===` `)/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:deg|grad|rad|turn)$/.test(r)?(i[`font-style`]+=` `+r,r=``):--a,n=1;else if(n!==1||t!==` `&&t!==`/`)n===2&&t===` `?(/^(?:\+|-)?([0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)?$/.test(r)&&(i[`line-height`]=r),n=4,r=``):r+=t;else{if(/^(?:(?:xx|x)-large|(?:xx|s)-small|small|large|medium)$/.test(r)||/^(?:larg|small)er$/.test(r)||/^(?:\+|-)?(?:[0-9]*\.)?[0-9]+(?:em|ex|ch|rem|vh|vw|vmin|vmax|px|mm|cm|in|pt|pc|%)$/.test(r))n=t===`/`?2:4,i[`font-size`]=r;else if(/^italic$/.test(r))i[`font-style`]=r;else if(/^oblique$/.test(r))i[`font-style`]=r,n=5;else if(/^small-caps$/.test(r))i[`font-variant`]=r;else if(/^(?:bold(?:er)?|lighter|normal)$/.test(r))i[`font-weight`]=r;else if(/^[+-]?(?:[0-9]*\.)?[0-9]+(?:e[+-]?(?:0|[1-9][0-9]*))?$/.test(r)){let e=parseFloat(r);e>=1&&e<=1e3&&(i[`font-weight`]=r)}else/^(?:(?:ultra|extra|semi)-)?(?:condensed|expanded)$/.test(r)&&(i[`font-stretch`]=r);r=``}else{let o=a+1;do if(o=e.indexOf(t,o)+1,!o)return null;while(e.charAt(o-2)===`\\`);i[`font-family`].push(e.slice(a+1,o-1).replace(/\\('|")/g,`$1`)),a=o-1,n=3,r=``}if(n===3&&!/^\s*$/.test(r))return null;if(n===4){let e=ap(r);e&&i[`font-family`].push(e)}return i}function sp(e){let t=parseFloat(e);return isNaN(t)||(t%=360,t>0?t=360-t:t<0&&(t*=-1)),t}function cp(e){if(typeof e!=`string`)return null;let t=function(e){let t=op(e,4);return t===null?null:t[`font-family`]}(e);Array.isArray(t)&&t.length===0&&(t=null),t=t?{"font-family":t}:function(e){let t=op(e,1);return t!==null&&t[`font-size`]&&t[`font-family`].length?t:null}(e);let n=null,r=null,i=null;if(t){let e=t[`font-family`],a=e.shift();a&&(n=a),e.length>0&&(r=e),t[`font-size`]!==void 0&&(i=t[`font-size`])}return{family:n,fallbacks:r,size:i}}function lp(e,t=!1){return t===`adaptive`?e?.toCSS(`adaptive`)??null:function(e,t=!1){return e?.toHex(t)?.toString(!1).toLowerCase()??null}(e,t)}function up(t){return t==null?null:e.A.roundAccurately(t,2)+`pt`}function dp(e,t){let n=``,r=e&&e!==U.UnderlineStyle.None;return t&&(n+=`line-through`),r&&t&&(n+=` `),r&&(n+=`underline`,!0!==e&&e!==U.UnderlineStyle.Single&&e!==U.UnderlineStyle.SingleAccounting||(n+=` solid`),e!==U.UnderlineStyle.Double&&e!==U.UnderlineStyle.DoubleAccounting||(n+=` double`)),n}var fp=Object.freeze({underline:U.UnderlineStyle.None,strike:!1});function pp(e){if(!e)return fp;let t=U.UnderlineStyle.None,n=!1;return(e=e.toLowerCase()).includes(`underline`)&&(t=U.UnderlineStyle.Single),(e.includes(`line-through`)||e.includes(`linethrough`))&&(n=!0),{underline:t,strike:n}}function mp(e){return e?(e=e.toLowerCase())===`single`?U.UnderlineStyle.Single:e===`double`?U.UnderlineStyle.Double:e===`single-accounting`||e===`singleaccounting`?U.UnderlineStyle.SingleAccounting:e===`double-accounting`||e===`doubleaccounting`?U.UnderlineStyle.DoubleAccounting:U.UnderlineStyle.None:U.UnderlineStyle.None}function hp(e){return e?e.toLowerCase():null}function gp(e){return e?e===o.Overflow.Visible||e===o.Overflow.Clip||e===o.Overflow.Shrink?`nowrap`:e===o.Overflow.Wrap?`normal`:void 0:null}function _p(e,t){let n=``;if(e&&(e.includes(` `)&&(e=`"`+e+`"`),n=e),t)for(let e=0;e<t.length;e++)n.length>0&&(n+=`, `),n+=t[e];return n}function vp(e){let t=``,n=!1,r=``;for(let i=0;i<e.length;i++){let a=e.charAt(i);n&&a!==`]`&&a!==`"`?t+=a:a===`"`?(t+=`\\0022`,n=!n):[`[`,`]`,`,`,`#`,`.`,`@`,`/`,`:`,`;`,`-`,` `].includes(a)?(t+=`\\`+a,a===`[`?n=!0:a===`]`&&(n=!1)):[`(`,`)`].includes(a)?t+=r===`_`?`\\`+a:`\\\\\\`+a:[`$`].includes(a)?t+=`\\0022`+a+`\\0022`:t+=a,r=a}return`"`+t+`"`}function yp(e){let t=e.replace(/(\\[0-9]{4})/g,e=>String.fromCharCode(parseInt(e.replace(/\\/g,``),16)));return t=t.replace(/(\\.{1})/g,e=>e.substring(e.length-1,e.length)),t.includes(`\\`)&&(t=t.replace(/(\\.{1})/g,e=>e.substring(e.length-1,e.length))),t=t.replace(/^"(.*)"$/,`$1`),t}var bp=`Normal`,xp=new Map;xp.set(e.A.textToKey(`Thin`),100),xp.set(e.A.textToKey(`Hairline`),100),xp.set(e.A.textToKey(`Extra Light`),200),xp.set(e.A.textToKey(`Ultra Light`),200),xp.set(e.A.textToKey(`Light`),300),xp.set(e.A.textToKey(bp),400),xp.set(e.A.textToKey(`Regular`),400),xp.set(e.A.textToKey(`Medium`),500),xp.set(e.A.textToKey(`Semi Bold`),600),xp.set(e.A.textToKey(`Demi Bold`),600),xp.set(e.A.textToKey(bp),400),xp.set(e.A.textToKey(`Bold`),700),xp.set(e.A.textToKey(`Extra Bold`),800),xp.set(e.A.textToKey(`Ultra Bold`),800),xp.set(e.A.textToKey(`Black`),900),xp.set(e.A.textToKey(`Heavy`),900),xp.set(e.A.textToKey(`Extra Black`),950),xp.set(e.A.textToKey(`Ultra Black`),950),xp.set(e.A.textToKey(`lighter`),100),xp.set(e.A.textToKey(`normal`),400),xp.set(e.A.textToKey(`bold`),700),xp.set(e.A.textToKey(`bolder`),700);var Sp=RegExp(`^[0-9]*[.]?[0-9]+$`,`g`),Cp=new Map;function wp(t,n=11,r=`pt`){if(!t)return null;let i=n;t=t.trim().toLowerCase();let a=r===`pt`?U.getDeviceScale():1,o=r===`pt`?1:U.getDeviceScale();if(Sp.test(t)){let e=parseFloat(t);isNaN(e)||(t=e+r)}if(t.endsWith(`pt`))i=parseFloat(t.substring(0,t.length-2).trim())*o;else if(t.endsWith(`px`))i=parseFloat(t.substring(0,t.length-2).trim())/a;else if(t.endsWith(`em`))i=parseFloat(t.substring(0,t.length-2).trim())*n;else if(t.endsWith(`rem`))i=parseFloat(t.substring(0,t.length-3).trim())*n;else if(t.endsWith(`%`))i=parseFloat(t.substring(0,t.length-1).trim())/100*n;else if(typeof t==`string`){let r=e.A.textToKey(t),i=Cp.get(r);if(i)return i(n)}return isNaN(i)?null:i}Cp.set(e.A.textToKey(`xx-small`),e=>.4*e),Cp.set(e.A.textToKey(`x-small`),e=>.5*e),Cp.set(e.A.textToKey(`small`),e=>.6*e),Cp.set(e.A.textToKey(`medium`),e=>e),Cp.set(e.A.textToKey(`large`),e=>1.1*e),Cp.set(e.A.textToKey(`x-large`),e=>1.25*e),Cp.set(e.A.textToKey(`xx-large`),e=>1.5*e),Cp.set(e.A.textToKey(`xxx-large`),e=>2*e),Cp.set(e.A.textToKey(`smaller`),e=>.9*e),Cp.set(e.A.textToKey(`larger`),e=>1.1*e),Cp.set(e.A.textToKey(`math`),e=>e);var Tp=new Map;Tp.set(Y.BuiltInSheetPattern.None,{description:`None`,cssKey:`none`}),Tp.set(Y.BuiltInSheetPattern.Solid,{description:`Solid`,cssKey:`solid`}),Tp.set(Y.BuiltInSheetPattern.DarkGray,{description:`75% gray`,cssKey:`gray-75`}),Tp.set(Y.BuiltInSheetPattern.MediumGray,{description:`50% gray`,cssKey:`gray-50`}),Tp.set(Y.BuiltInSheetPattern.LightGray,{description:`25% gray`,cssKey:`gray-25`}),Tp.set(Y.BuiltInSheetPattern.Gray125,{description:`12.5% Gray`,cssKey:`gray-125`}),Tp.set(Y.BuiltInSheetPattern.Gray0625,{description:`6.25% Gray`,cssKey:`gray-0625`}),Tp.set(Y.BuiltInSheetPattern.DarkHorizontal,{description:`Horizontal Strip`,cssKey:`horz-stripe`}),Tp.set(Y.BuiltInSheetPattern.DarkVertical,{description:`Vertical Strip`,cssKey:`vert-stripe`}),Tp.set(Y.BuiltInSheetPattern.DarkDown,{description:`Reverse Diagonal Stripe`,cssKey:`reverse-diag-stripe`}),Tp.set(Y.BuiltInSheetPattern.DarkUp,{description:`Diagonal Strip`,cssKey:`diag-stripe`}),Tp.set(Y.BuiltInSheetPattern.DarkGrid,{description:`Diagonal Crosshatch`,cssKey:`diag-cross`}),Tp.set(Y.BuiltInSheetPattern.DarkTrellis,{description:`Thick Diagonal Crosshatch`,cssKey:`thick-diag-cross`}),Tp.set(Y.BuiltInSheetPattern.LightHorizontal,{description:`Thin Horizontal Stripe`,cssKey:`thin-horz-stripe`}),Tp.set(Y.BuiltInSheetPattern.LightVertical,{description:`Thin Vertical Stripe`,cssKey:`thin-vert-stripe`}),Tp.set(Y.BuiltInSheetPattern.LightDown,{description:`Thin Reverse Diagonal Stripe`,cssKey:`thin-reverse-diag-stripe`}),Tp.set(Y.BuiltInSheetPattern.LightUp,{description:`Thin Diagonal Stripe`,cssKey:`thin-diag-stripe`}),Tp.set(Y.BuiltInSheetPattern.LightGrid,{description:`Thin Horizontal Cross`,cssKey:`thin-horz-cross`}),Tp.set(Y.BuiltInSheetPattern.LightTrellis,{description:`Thin Diagonal Cross`,cssKey:`thin-diag-cross`});var Ep=``,Dp=new Map;Tp.forEach((e,t)=>{Ep.length>0&&(Ep+=`|`),Ep+=`\\b`+e.cssKey+`\\b`,Dp.set(e.cssKey,t)});var Op=RegExp(`(\\s*(?:${Ep}))`,`g`);function kp(e){if(!e)return null;let t=e.toLowerCase();t=t.replace(/;/,``);let n=t.match(Op);if(!n)return null;let r=null;n&&n.length>0&&(r=(e=>{if(!e)return null;let n=t.indexOf(e);return t=t.substring(0,n)+t.substring(n+e.length,t.length),e.trim()})(n[0])),t=t.trim();let i=t?t.trim():null;return r||i?{patternType:Dp.get(r??`solid`),foreground:i}:null}var Ap=(e,t=!1,n=null)=>{if(!e)return null;let r=e.getStops();if(!r||r.length<1)return null;let i=r.length;if(i===1)return lp(r[0].getColor(),t);let a=``;for(let e=0;e<i;e++){let n=r[e],o=n.getOffset(),s=o===void 0?e/(i-1)*100:100*o;a+=`${lp(n.getColor(),t)} ${s}%${e<i-1?`, `:``}`}if(e.getGradientType()===Y.GradientType.Linear){let t=e.getAngle()??0;if(n&&n.width>0&&n.height>0&&t%90!=0){let e=n.width,r=n.height,i=(90-t)*(Math.PI/180),a=Math.cos(i)*r,o=Math.sin(i)*e;t=(90-180*Math.atan2(o,a)/Math.PI+360)%360}return`linear-gradient(${t}deg, ${a})`}return e.getGradientType()===Y.GradientType.Path||e.getGradientType()===Y.GradientType.Rect||e.getGradientType()===Y.GradientType.Shape?function(e,t,n){let r=t??Jp,i=jp(r.left??0),a=jp(r.right??0),o=jp(r.top??0),s=jp(r.bottom??0);if(i>a||o>s)return null;let c=(i+a)/2,l=(o+s)/2,u=(100*c).toFixed(3),d=(100*l).toFixed(3);if(!n||n.width<=0||n.height<=0)return`radial-gradient(ellipse farthest-corner at ${u}% ${d}%, ${e})`;let f=n.width,p=n.height,m=Math.max(c,1-c),h=Math.max(l,1-l),g=Math.sqrt(m*m+h*h);return`radial-gradient(ellipse ${(g*f).toFixed(3)}px ${(g*p).toFixed(3)}px at ${u}% ${d}%, ${e})`}(a,e.getFocus(),n)||lp((r[i-1]??r[0]).getColor(),t):null},jp=e=>Math.max(0,Math.min(1,e)),Mp=new Map;function Np(e){if(!e)return`none`;let t=Mp.get(e.getStyle());if(!t)return null;if(t.cssKey===`none`)return t.cssKey;let n=function(e,t=!1){return e?.toRGBA(t).toString(!1)??null}(e?.getColor());return n=n?` `+n:``,`${t.size===null?``:`${t.size}pt `}${t.cssKey}${n}`}Mp.set(W.StrokeStyle.None,{size:null,cssKey:`none`}),Mp.set(W.StrokeStyle.DashDot,{size:.5,cssKey:`dot-dash`}),Mp.set(W.StrokeStyle.DashDotDot,{size:.5,cssKey:`dot-dot-dash`}),Mp.set(W.StrokeStyle.Dashed,{size:.5,cssKey:`dashed`}),Mp.set(W.StrokeStyle.MediumDashed,{size:1,cssKey:`dashed`}),Mp.set(W.StrokeStyle.Dotted,{size:.5,cssKey:`dotted`}),Mp.set(W.StrokeStyle.MediumDashDot,{size:1,cssKey:`dot-dash`}),Mp.set(W.StrokeStyle.MediumDashDotDot,{size:1,cssKey:`dot-dot-dash`}),Mp.set(W.StrokeStyle.Hair,{size:.5,cssKey:`hairline`}),Mp.set(W.StrokeStyle.Thin,{size:.5,cssKey:`solid`}),Mp.set(W.StrokeStyle.Thick,{size:1.5,cssKey:`solid`}),Mp.set(W.StrokeStyle.Medium,{size:1,cssKey:`solid`}),Mp.set(W.StrokeStyle.Double,{size:2,cssKey:`double`}),Mp.set(W.StrokeStyle.SlantDashDot,{size:1,cssKey:`dot-dash-slanted`});var Pp=[],Fp=new Set,Ip=new Map,Lp=(e,t)=>{let n=e.size===null?e.cssKey:`${e.size.toString()} ${e.cssKey}`;Ip.set(n,t),Fp.has(e.cssKey)||(Pp.push(e.cssKey),Fp.add(e.cssKey))};Mp.forEach(Lp);var Rp=Object.keys(W.StrokeStyle);for(let e=0;e<Rp.length;e++)Lp({size:null,cssKey:Rp[e].toLowerCase()},W.StrokeStyle[Rp[e]]);Lp({size:null,cssKey:`double`},W.StrokeStyle.Double),Lp({size:null,cssKey:`solid`},W.StrokeStyle.Medium),Lp({size:null,cssKey:`hidden`},W.StrokeStyle.None),Pp.sort((e,t)=>t.length-e.length);var zp=``,Bp=Pp.length;for(let e=0;e<Bp;e++)zp.length>0&&(zp+=`|`),zp+=`\\b`+Pp[e]+`\\b`;var Vp=RegExp(`(\\s*(?:${zp}))`,`g`),Hp=RegExp(`(\\s*[0-9]*[.]?[0-9]+(?:pt|px){0,1})`,`g`);function Up(e,t){if(!e)return null;let n=e.toLowerCase(),r=n.match(Vp);if(!r){let e=t?.(n);return e?{color:e,style:W.StrokeStyle.Medium}:null}let i=e=>{if(!e)return null;let t=n.indexOf(e);return n=n.substring(0,t)+n.substring(t+e.length,n.length).trim(),e.trim()},a=null;if(r&&r.length>0&&(a=i(r[0])),!a)return null;let o=null;if(r=n.match(Hp),r&&r.length>0){let e=i(r[0]);o=parseFloat(e.substring(0,e.length-2))}n=n.trim();let s=n?n.trim():null,c=o===null?a:`${o.toString()} ${a}`,l=Ip.get(c);return l||=Ip.get(a),l?{color:s,style:l}:null}var Wp=new Map;function Gp(t){let n=e.A.textToKey(t);return Wp.get(n)||null}Wp.set(e.A.textToKey(`start`),o.HorizontalAlignment.Left),Wp.set(e.A.textToKey(`left`),o.HorizontalAlignment.Left),Wp.set(e.A.textToKey(`end`),o.HorizontalAlignment.Right),Wp.set(e.A.textToKey(`right`),o.HorizontalAlignment.Right),Wp.set(e.A.textToKey(`center`),o.HorizontalAlignment.Center),Wp.set(e.A.textToKey(`justify`),o.HorizontalAlignment.Justify),Wp.set(e.A.textToKey(`justify-all`),o.HorizontalAlignment.Justify);var Kp=new Map;Kp.set(e.A.textToKey(`baseline`),o.VerticalAlignment.Bottom),Kp.set(e.A.textToKey(`top`),o.VerticalAlignment.Top),Kp.set(e.A.textToKey(`middle`),o.VerticalAlignment.Center),Kp.set(e.A.textToKey(`bottom`),o.VerticalAlignment.Bottom),Kp.set(e.A.textToKey(`sub`),o.VerticalAlignment.Bottom),Kp.set(e.A.textToKey(`text-top`),o.VerticalAlignment.Top),Kp.set(e.A.textToKey(`justify`),o.VerticalAlignment.Justify),Kp.set(e.A.textToKey(`distributed`),o.VerticalAlignment.Distributed);var qp=t=>{let n=e.A.textToKey(t);return Kp.get(n)||null},Jp=Object.freeze({left:0,right:0,top:0,bottom:0}),Yp=e=>{if(e instanceof Df)return{color:e.toString()};if(typeof e==`string`)try{return{color:e===`none`||e===`transparent`?null:e}}catch(e){throw e}return e},Xp=e.w.PassThrough,Zp={shorthand:(e,t)=>{if(!e||e===`none`||e===`transparent`)return null;try{return t.parseColor(e).toString()}catch(e){console.warn(`error`,e)}return e},merge:(e,t,n)=>e},Qp={shorthand:(e,t)=>{if(e.isIStroke)return e.getProperties();if(typeof e==`string`&&(e=Up(e,e=>{try{return t.parseColor(e).toString()}catch{}return null})),!e)return null;let n={};return e.style&&(n.style=e.style),e.color&&(n.color=e.color),n},properties:{color:Zp,style:Xp}},$p={shorthand:(e,t)=>{if(e.isIBorder)return e.getProperties();if(typeof e==`string`){let n=Up(e,e=>{try{return t.parseColor(e).toString()}catch{}return null});return{left:n,right:n,top:n,bottom:n,horizontal:null,vertical:null,diagonalUp:null,diagonalDown:null}}return e},properties:{top:Qp,left:Qp,right:Qp,bottom:Qp,horizontal:Qp,vertical:Qp,diagonalUp:Qp,diagonalDown:Qp}},em={shorthand:(e,t)=>{if(typeof e==`string`){let t=Ac.Styles.lookupDefault(e);return t===void 0?e:t}return typeof e==`number`?Sc(e):null}},tm={shorthand:(e,t)=>{if(e.isIStyledFont)return e.toJSON();if(typeof e==`string`){let t=cp(e);if(t){let e={};if(t.family&&(e.family=t.family),t.fallbacks&&(e.fallbacks=t.fallbacks),t.size&&(e.size=wp(t.size)),Object.keys(t).length>0)return e}return e}return e&&(e=>{let{bold:t,italic:n,...r}=e;if(t===void 0&&n===void 0)return e;let i=r;return t!==void 0&&i.weight===void 0&&(i.weight=t===null?null:t?700:400),n!==void 0&&i.style===void 0&&(i.style=n===null?null:n?U.Style.Italic:U.Style.Normal),i})(e)},properties:{family:{shorthand:(e,t)=>cp(e)?.family??null},fallbacks:{shorthand:(e,t)=>{if(typeof e!=`string`)return e;let n=cp(e);if(!n)return null;let r=[n.family];return n.fallbacks&&(r=r.concat(n.fallbacks)),r}},size:{shorthand:(t,n)=>{let r=t;return typeof t==`string`&&(r=wp(t,n.getNormal().getFont().getSize())),isNaN(r)||typeof r!=`number`?null:(r=Math.max(1,Math.min(e.A.roundAccurately(r,1),409)),r)}},weight:{shorthand:(t,n)=>{if(typeof t!=`string`)return t;let r=function(t){let n=400;if(n=typeof t==`number`?t:parseFloat(t),!isNaN(n))return n;if(typeof t==`string`){let n=e.A.textToKey(t),r=xp.get(n);if(r)return r}return n}(t);return isNaN(r)||typeof r!=`number`?null:r}},style:Xp,color:Zp,letterSpacing:Xp,underline:{shorthand:(e,t)=>e?!0===e?U.UnderlineStyle.Single:mp(e):U.UnderlineStyle.None},strike:Xp,scheme:Xp,verticalAlign:Xp,shadow:Xp,outline:Xp,extend:Xp,charset:{shorthand:(e,t)=>{if(e==null)return null;let n=typeof e==`string`?parseInt(e,10):e;return typeof n==`number`&&Number.isFinite(n)?n:null}}}},nm={properties:{horizontal:Xp,vertical:Xp,indent:{shorthand:(e,t)=>{let n=e;return typeof e==`string`&&(n=parseFloat(e)),isNaN(n)||typeof n!=`number`?null:n}},relativeIndent:Xp,overflow:Xp,rotation:{shorthand:(e,t)=>{let n=e;return typeof e==`string`&&(n=parseFloat(e)),isNaN(n)||typeof n!=`number`?null:(n%=360,n<0&&(n+=360),n)}},stacked:Xp,justifyLastLine:Xp,readingDirection:Xp}},rm={shorthand:(e,t)=>e===`none`||e===`transparent`||typeof e==`object`&&Object.keys(e).length===0?{type:Y.Type.None}:(e.getType?.(),Y.Type.None,e)},im={shorthand:e=>{let t=Yp(e);return typeof t==`object`&&t.color&&(t.type=Y.Type.Solid),t},merge:(e,t)=>{let n=e,r=t;return n&&`color`in n&&n.color===null?{type:Y.Type.None}:n.color?n:(r?.toJSON&&(r=r.toJSON()),r?.type===Y.Type.Solid?{...r}:r?.type===Y.Type.Gradient?{type:Y.Type.Solid,color:r?.stops?.[0]?.color??J.Scheme.Bg1}:r?.type===Y.Type.Pattern?{type:Y.Type.Solid,color:r?.foreground??J.Scheme.Bg1}:n?{...n}:null)},properties:{color:Zp,type:Xp,isRotatedWithShape:Xp}},am={shorthand:e=>(typeof e==`object`&&e.stops&&(e.type=Y.Type.Gradient),e),merge:(e,t,n)=>{let r=e,i=t;return r.stops?r:(i?.toJSON&&(i=i.toJSON()),i?.type===Y.Type.Gradient?{...i}:i?.type===Y.Type.Solid?{type:Y.Type.Gradient,stops:[{offset:0,color:i?.color??J.Scheme.Accent1},{offset:1,color:J.Scheme.Bg1}]}:i?.type===Y.Type.Pattern?{type:Y.Type.Gradient,stops:[{offset:0,color:i?.foreground??J.Scheme.Bg1},{offset:1,color:i?.background??J.Scheme.Accent1}]}:r?{...r}:null)},properties:{type:Xp,stops:{shorthand:e=>(typeof e==`string`&&(e=e.split(`,`).map(e=>e.trim())),Array.isArray(e)?e.map((e,t)=>{if(!e)return;let n=e;return typeof e==`string`&&(n=Yp(e)),e.isIColor&&(n={color:e.toString()}),n}):e),arrayType:{shorthand:e=>Yp(e),properties:{color:Zp,offset:Xp}}},gradientType:Xp,angle:Xp,focus:Xp,isRotatedWithShape:Xp}},om={shorthand:(e,t)=>{if(typeof e==`object`){let t=e;(t.foreground||t.background||t.patternType)&&(t.type=Y.Type.Pattern,t.patternType=t.patternType??Y.BuiltInSheetPattern.Solid)}return e},merge:(e,t,n)=>{let r=e,i=t;if(r.background&&r.foreground)return r;i?.toJSON&&(i=i.toJSON());let a=Y.BuiltInSheetPattern.MediumGray;if(i?.type===Y.Type.Pattern){let e={type:Y.Type.Pattern,patternType:r.patternType??i.patternType};return i.foreground&&(e.foreground=i.foreground),i.background&&(e.background=i.background),r.foreground&&(e.foreground=r.foreground),r.background&&(e.background=r.background),e}return i?.type===Y.Type.Solid?{patternType:a,foreground:i?.color??J.Named.WindowText,background:J.Scheme.Bg1,...r}:i?.type===Y.Type.Gradient?{patternType:a,foreground:i?.stops?.[0]?.color??J.Named.WindowText,background:i?.stops?.[1]?.color??J.Scheme.Bg1,...r}:r?{type:Y.Type.Pattern,patternType:Y.BuiltInSheetPattern.Solid,foreground:J.Named.WindowText,background:J.Scheme.Bg1,...r}:null},properties:{type:Xp,patternType:Xp,foreground:Zp,background:Zp,isRotatedWithShape:Xp}},sm=[rm,im,am,om],cm=[];for(let e=0;e<sm.length;e++){let t=sm[e]?.shorthand;cm.push(t)}var lm=cm.length,um={properties:{font:tm,fill:{shorthand:(e,t)=>{e.isIFill&&(e=e.toJSON());for(let n=0;n<lm;n++){let r=cm[n](e,t);if(r?.type)return r}return e},getSubType:(e,t)=>{let n=e.type??t?.type;return n===Y.Type.None?rm:n===Y.Type.Solid?im:n===Y.Type.Gradient?am:n===Y.Type.Pattern?om:null}},alignment:nm,border:$p,numberFormat:em,quotePrefix:Xp,named:Xp,insets:Xp}},dm=Object.freeze([`font`,`fill`,`alignment`,`border`,`numberFormat`,`quotePrefix`,`insets`]),fm={shorthand:(e,t)=>{if(!e||typeof e!=`object`)return;let n=e.named;if(!n||(n.isINamed&&(n=n.getName()),typeof n!=`string`))return;let r=null;if(n.toLowerCase()===X.BuiltInName.Normal.toLowerCase())r=dm;else{let e=t?.getNamed(n)?.getRanged().getPropertiesAt(0,0,null);e&&(r=Object.keys(e))}let i={...e,named:n},a=r?r.length:0;for(let e=0;e<a;e++){let t=r[e];t!==`named`&&i[t]===void 0&&(i[t]=null)}return i},properties:um.properties},pm={properties:{style:fm,name:Xp,hidden:Xp,iLevel:Xp}},mm=(e,t,n)=>{let r=e.border;if(!r)return e;let i=((e,t,n)=>{if(!e)return e;let r=null;return(e.top||e.horizontal)&&(t.rowIndex!==n.rowStart||t.colIndex<n.colStart||t.colIndex>n.colEnd)&&(r??={...e},delete r.top,e.horizontal&&(r.top=e.horizontal)),(e.bottom||e.horizontal)&&(t.rowIndex!==n.rowEnd||t.colIndex<n.colStart||t.colIndex>n.colEnd)&&(r??={...e},delete r.bottom,e.horizontal&&(r.bottom=e.horizontal)),(e.left||e.vertical)&&(t.colIndex!==n.colStart||t.rowIndex<n.rowStart||t.rowIndex>n.rowEnd)&&(r??={...e},delete r.left,e.vertical&&(r.left=e.vertical)),(e.right||e.vertical)&&(t.colIndex!==n.colEnd||t.rowIndex<n.rowStart||t.rowIndex>n.rowEnd)&&(r??={...e},delete r.right,e.vertical&&(r.right=e.vertical)),e.horizontal&&(r??={...e},delete r.horizontal),e.vertical&&(r??={...e},delete r.vertical),r??e})(r,t,n),a=e;return i!==e.border&&(a={...e},Object.keys(i).length>0?a.border=i:delete a.border),a},hm=class{constructor(e,t,n){this._permCache=null,this._table=e,this._styles=t,this._properties=n}_resolveProperties(t){let n={name:t.name},r=this._styles,i=Object.values(yf.ElementType),a=i.length;for(let o=0;o<a;o++){let a=i[o],s=t[a];s&&e.A.isObject(s)&&(n[a]=e.w.resolveTypedUpdates(Object.freeze(s),um,r))}return Object.freeze(n)}getCoords(){return this._table.getRange().getCoords()}getPropertiesAt(t,n){let r=this._table,i=this._styles,a=this._properties;_m.rowIndex=t,_m.colIndex=n;let o=r.getVisibleCellCoords(_m),s=r.getVisibleRefRangeCoords();if(!s)return null;let c=Math.max(0,s.colEnd-s.colStart)+1,l=Math.max(0,s.rowEnd-s.rowStart)+1,u=Math.max(0,o.rowIndex-s.rowStart),d=Math.max(0,o.colIndex-s.colStart),f=r.getStyleOptions(),p=!1,m=0;r.isHeaderVisible()&&(m=+!!r.isShowHeaders(),p=m>u);let h=!1,g=0;r.isTotalVisible()&&(g=+!!r.isShowTotals(),h=l-g<=u);let _=d===c-1&&f.showLastColumn;r.isLastColumnVisible()||(_=!1);let v=d===0&&f.showFirstColumn;r.isFirstColumnVisible()||(v=!1);let y=!p&&!h,b=y&&f.showColumnStripes,x=0,S=0,C=0,w=!1,T=0;b&&(x=a.firstColumnStripe?.size??1,S=a.secondColumnStripe?.size??1,C=d%(x+S),w=C<x,w||(C-=x),T=Math.min(c-d,w?x:S));let E=y&&f.showRowStripes,D=0,O=0,k=0,A=!1,j=0;E&&(D=a.firstRowStripe?.size??1,O=a.secondRowStripe?.size??1,k=(u-m)%(D+O),A=k<D,A||(k-=D),j=Math.min(l-u,A?D:O));let M=!1;if(p&&a.headerRow){let e=r.getColumnAt(d);M=!!e&&!e.isHiddenButton()}let N=0;p&&(N|=1),h&&(N|=2),v&&(N|=4),_&&(N|=8),u===0&&(N|=16),u===l-1&&(N|=32),d===0&&(N|=64),d===c-1&&(N|=128),u===m&&(N|=256),u===l-g-1&&(N|=512),M&&(N|=1024),m>0&&(N|=2048),g>0&&(N|=4096);let P=`${N}`+(b?`|c${w?`f`:`s`}${C},${T}`:``)+(E?`|r${A?`f`:`s`}${k},${j}`:``),F=this._permCache?.get(P);if(F!==void 0)return F;let I={rowIndex:u,colIndex:d},L={};if(a.wholeTable&&(L=a.wholeTable,L.border&&(L=mm(L,I,{rowStart:0,rowEnd:l-1,colStart:0,colEnd:c-1}))),b){let t=w?a.firstColumnStripe:a.secondColumnStripe;if(t){let n=t,r=t.border;r&&(n=mm(n,{rowIndex:u,colIndex:C},{rowStart:m,rowEnd:l-g-1,colStart:0,colEnd:T}),w&&C===0&&d>0&&r?.left&&a.secondColumnStripe?.border?.right&&(r={...n.border},n.border=r,r.left=null),w&&C===x-1&&d<c-1&&r?.right&&a.secondColumnStripe?.border?.left&&(r={...n.border},n.border=r,r.right=null)),L=e.w.resolveTypedUpdates(n,um,i,L)}}if(E){let t=m,n=l-g-1,r=A?a.firstRowStripe:a.secondRowStripe;if(r){let o=r,s=r.border;if(s){o=mm(o,{colIndex:d,rowIndex:k},{colStart:0,colEnd:c-1,rowStart:0,rowEnd:j}),A&&k===0&&u>=t&&r.border?.top&&a.secondRowStripe?.border?.bottom&&(s={...o.border},o.border=s,s.top=null);let e=r.border?.bottom;(e&&A&&k===D-1&&u<n&&a.secondRowStripe?.border?.top||e&&u===n)&&(s={...o.border},o.border=s,s.bottom=null)}L=e.w.resolveTypedUpdates(o,um,i,L)}}if(_&&a.lastColumn){let t=a.lastColumn;t.border&&(t=mm(t,I,{rowStart:0,rowEnd:l-1,colStart:c-1,colEnd:c-1})),L=e.w.resolveTypedUpdates(t,um,i,L)}if(v&&a.firstColumn){let t=a.firstColumn;t.border&&(t=mm(t,I,{rowStart:0,rowEnd:l-1,colStart:0,colEnd:0})),L=e.w.resolveTypedUpdates(t,um,i,L)}if(p&&a.headerRow){let t=a.headerRow;t.border&&(t=mm(t,I,{rowStart:0,rowEnd:m-1,colStart:0,colEnd:c-1})),L=e.w.resolveTypedUpdates(t,um,i,L)}if(h&&a.totalRow){let t=a.totalRow;t.border&&(t=mm(t,I,{rowStart:l-g,rowEnd:l-1,colStart:0,colEnd:c-1})),L=e.w.resolveTypedUpdates(t,um,i,L)}if(p&&v&&a.firstHeaderCell){let t=a.firstHeaderCell;t.border&&(t=mm(t,I,{rowStart:0,rowEnd:m-1,colStart:0,colEnd:0})),L=e.w.resolveTypedUpdates(t,um,i,L)}if(p&&_&&a.lastHeaderCell){let t=a.lastHeaderCell;t.border&&(t=mm(t,I,{rowStart:0,rowEnd:m-1,colStart:c-1,colEnd:c-1})),L=e.w.resolveTypedUpdates(t,um,i,L)}if(h&&v&&a.firstTotalCell){let t=a.firstTotalCell;t.border&&(t=mm(t,I,{rowStart:l-g,rowEnd:l-1,colStart:0,colEnd:0})),L=e.w.resolveTypedUpdates(t,um,i,L)}if(h&&_&&a.lastTotalCell){let t=a.lastTotalCell;t.border&&(t=mm(t,I,{rowStart:l-g,rowEnd:l-1,colStart:c-1,colEnd:c-1})),L=e.w.resolveTypedUpdates(t,um,i,L)}M&&(L.insets={right:15});let ee=this._permCache;return ee||=this._permCache=new Map,ee.set(P,Object.freeze(L)),L}},gm=class{constructor(t,n,r,i){this._styles=t,this._isBuiltIn=r,this._doDelete=i,this._properties=e.A.deepFreeze(this._resolveProperties(n)),this.isShownInTableStyles()}_resolveProperties(t){let n={name:t.name};t.table!==void 0&&(n.table=t.table),t.pivot!==void 0&&(n.pivot=t.pivot);let r=this._styles,i=Object.values(yf.ElementType),a=i.length;for(let o=0;o<a;o++){let a=i[o],s=t[a];s&&e.A.isObject(s)&&(n[a]=e.w.resolveTypedUpdates(Object.freeze(s),um,r))}return Object.freeze(n)}delete(){if(!this._doDelete)throw Error(`Not able to delete builtin style.`);this._doDelete(this._properties.name)}getRanged(e){return new hm(e,this._styles,this._properties)}getProperties(){return this._properties}getName(){return this._properties.name}isShownInTableStyles(){return!1!==this._properties.table}isShownInPivotStyles(){return this._properties.pivot??!1}isBuiltIn(){return this._isBuiltIn}toJSON(){let t=e.A.cloneObject(this._properties);return t.name=this._properties.name,t}get isITableStyle(){return!0}},_m={rowIndex:0,colIndex:0};function vm(e,t){if(!e||!t)return e===t;if(e===t)return!0;if(e.style!==t.style)return!1;if(e.color===t.color)return!0;let n=e.color;(e&&e.color).isIColor&&(n=e.color.toString());let r=t.color;return(t&&t.color).isIColor&&(r=t.color.toString()),n===r}function ym(e,t,n,r){let i=r?W.Edge.Left:W.Edge.Top,a=r?W.Edge.Right:W.Edge.Bottom,o=r?W.Edge.Vertical:W.Edge.Horizontal,s=r?t.colStart:t.rowStart,c=r?t.colEnd:t.rowEnd,l=r?n.colStart:n.rowStart,u=r?n.colEnd:n.rowEnd,d=s===l,f=c===u,p={...e};return d&&f?e:(delete p[i],delete p[a],delete p[o],d?e[i]!==void 0&&(p[i]=e[i]):e[o]!==void 0&&(p[i]=e[o]),f?e[a]!==void 0&&(p[a]=e[a]):e[o]!==void 0&&(p[a]=e[o]),u-l>0&&e[o]!==void 0&&(p[o]=e[o]),Object.keys(p).length===0?null:p)}function bm(e,t,n){let r=e.colEnd-e.colStart+1,i=e.rowEnd-e.rowStart+1,a=t.border;if(r===1&&i===1||!a)return[[e,t]];let o=n!==void 0&&e.colEnd>=n.colEnd,s=n!==void 0&&e.rowEnd>=n.rowEnd;if((o||s)&&(a={...a},o&&(a[W.Edge.Vertical]===void 0?delete a[W.Edge.Right]:a[W.Edge.Right]=a[W.Edge.Vertical]),s&&(a[W.Edge.Horizontal]===void 0?delete a[W.Edge.Bottom]:a[W.Edge.Bottom]=a[W.Edge.Horizontal]),Object.keys(a).length===0)){let n={...t};return delete n.border,Object.keys(n).length>0?[[e,n]]:[]}let c=r===1||vm(a[W.Edge.Left],a[W.Edge.Vertical])&&vm(a[W.Edge.Right],a[W.Edge.Vertical]),l=i===1||vm(a[W.Edge.Top],a[W.Edge.Horizontal])&&vm(a[W.Edge.Bottom],a[W.Edge.Horizontal]);if(c&&l)return[[e,a===t.border?t:{...t,border:a}]];let u=[],d=(e,t,n,r,a)=>{let o=ym(n,e,t,a);if(!o)return;if(!a||i===1){let e={...r};e.border=o,u.push([t,e]);return}let c={colStart:t.colStart,rowStart:t.rowStart,colEnd:t.colEnd,rowEnd:t.rowStart};if(d(t,c,o,r,!1),i>2||s){let e={colStart:t.colStart,rowStart:t.rowStart+1,colEnd:t.colEnd,rowEnd:s?t.rowEnd:t.rowEnd-1};d(t,e,o,r,!1)}if(!s){let e={colStart:t.colStart,rowStart:t.rowEnd,colEnd:t.colEnd,rowEnd:t.rowEnd};d(t,e,o,r,!1)}};return r===1?d(e,e,a,t,!0):(d(e,{colStart:e.colStart,rowStart:e.rowStart,colEnd:e.colStart,rowEnd:e.rowEnd},a,t,!0),(r>2||o)&&d(e,{colStart:e.colStart+1,rowStart:e.rowStart,colEnd:o?e.colEnd:e.colEnd-1,rowEnd:e.rowEnd},a,t,!0),o||d(e,{colStart:e.colEnd,rowStart:e.rowStart,colEnd:e.colEnd,rowEnd:e.rowEnd},a,t,!0)),u}var xm=(e,t,n,r)=>{let i=t,a=[],o=e[i],s=o.value;for(;o;){if(r){let e=o.rowEnd-o.rowStart+1;a.push({min:o.colStart,max:o.colEnd,value:e,touchMax:o.rowEnd})}else{let e=o.colEnd-o.colStart+1;a.push({min:o.rowStart,max:o.rowEnd,value:e,touchMax:o.colEnd})}i++,o=e[i],o&&o.value!==s&&(o=null)}let c=a.length;if(c===0)return i;if(c===1)return n.push(a[0]),i;a.sort((e,t)=>e.min===t.min?e.max-t.max:e.min-t.min);let l={...a[0]};for(let e=1;e<c;e++){let t=a[e],r=l.max,i=t.min;if(i<=r+1)if(i<=r){let e=t.max,a=t.value,o=l.value,s=l.min,c=Math.min(r,e);i>s&&n.push({min:s,max:i-1,value:o,touchMax:l.touchMax});let u=o+a,d=Math.max(l.touchMax,t.touchMax);c<Math.max(r,e)?(n.push({min:i,max:c,value:u,touchMax:d}),l=e>c?{min:c+1,max:e,value:a,touchMax:t.touchMax}:{min:c+1,max:r,value:o,touchMax:l.touchMax}):l={min:i,max:c,value:u,touchMax:d}}else n.push(l),l={...t};else n.push(l),l={...t}}return n.push(l),i},Sm={onUpdate:(e,t)=>({...e,s:t}),onSplit:e=>[e.value,e.value],onMerge:(t,n,r,i)=>{if(t.s===n.s)return e.A.deepEqual(t,n)?t:void 0}},Cm=(e,t,n,r,i)=>{let a=t.colStart,o=t.rowStart,s=t.colEnd,c=t.rowEnd,l=i?c-o+1:s-a+1,u=Math.floor(.5*l),d=i?c:s,f=e.length,p=0;do{let t=e[p].value,a=[];p=xm(e,p,a,i);let o=a.length;for(let e=0;e<o;e++){let o=a[e];o.value<u||o.touchMax<d||!i&&o.min>=c||(i||n===null||n!==t)&&(r=Vr(Br(r??[],{min:o.min,max:o.max,value:t},Sm)))}}while(p<f);return r};function wm(t,r){let i=t.before,a=t.after;if(i&&r){let o=t.amount,s=t.axis===n.l.Axis.Column,c=s?`colStart`:`rowStart`,l=s?`colEnd`:`rowEnd`,u=r[c],d=r[l],f=i[c]<=u,p=i[l]>=d,m=a?a[c]:-1;if(f&&p)return i;if(f&&o>0&&m!==u)a={...a},a[c]=u;else if(p)if(o>0){if(m>d)throw new e.C(``);a={...a},a[l]=d}else a?(a={...a},a[l]=d):(a={...i},a[c]=t.intersect[c])}if(!a)return null;if(r&&!e.l.isRangeWithinRange(a,r))throw new e.C(``);return e.l.sanitizeRange(a)}var Tm,Em=e=>{if(e==null)return null;let t,n=Object.keys(e),r=n.length;for(let i=0;i<r;i++){let r=n[i],a=e[r],o=a;if(a===null)o=void 0;else if(a&&typeof a==`object`&&!Array.isArray(a)){let e=Em(a);o=e===null?void 0:e}if(o!==a){if(t===void 0){t={};for(let r=0;r<i;r++)t[n[r]]=e[n[r]]}o!==void 0&&(t[r]=o)}else t!==void 0&&(t[r]=a)}return t===void 0?r===0?null:e:Object.keys(t).length===0?null:t},Dm=class t{constructor(e,t,r,i,a,o){this._c=e,this._getEntireRange=t,this._r=r,this._p=i??null,this._t=a??null,this._o=o??n.l.AxisSelection.Both,this._e=this._p===null||Object.keys(this._p).length===1&&this._p.named===X.BuiltInName.Normal}isEmpty(){return this._e}getProperties(){return this._p}getCoords(){return this._r}getUpdateProperties(){return this._u}static{this.BorderKeys=[`border`]}static{this.FillKeys=[`fill`]}static{this.ContentKeys=[`font`,`numberFormat`,`alignment`,`quotePrefix`,`named`,`insets`]}splitByFeature(){let e=(e,t)=>{if(!e)return;let n;for(let r=0;r<t.length;r++){let i=t[r];e[i]!==void 0&&((n??={})[i]=e[i])}return n},n=n=>{let r=e(this._p,n),i=e(this._u,n);if(r===void 0&&i===void 0)return null;let a=new t(this._c,this._getEntireRange,this._r,r??null,this._t,this._o);return i!==void 0&&(a._u=i),a};return{border:n(t.BorderKeys),fill:n(t.FillKeys),content:n(t.ContentKeys)}}static compose(e,n,r){if(!e&&!n&&!r)return null;if(e&&!n&&!r)return e;if(!e&&n&&!r)return n;if(!e&&!n&&r)return r;let i=e??r??n,a={...r?r._p:null,...n?n._p:null,...e?e._p:null};return new t(i._c,i._getEntireRange,i._r,a,i._t,i._o)}static mergeOverlay(e,n){if(!e)return n??null;if(!n)return e;let r=n._p?.border?n:e,i={...e._p,...n._p};return new t(r._c,r._getEntireRange,r._r,i,r._t,r._o)}cloneWithUpdate(n,r=!1){if(n===void 0)return this;let i=this._c,a=this._r,o=this._p,s=e.w.resolveTypedUpdates(n,fm,i,o,r);if(r){let e=Em(s),n=new t(i,this._getEntireRange,a,e,this._t,this._o);return e!==s&&(n._u=s),n}return new t(i,this._getEntireRange,a,s,this._t,this._o)}copyTo(n,r){let i=this._c,a=this._r,o=n.rowStart-a.rowStart,s=n.colStart-a.colStart,c=null;return e.l.isEqualRanges(a,this._t)||(c=e.l.translateRange(a,o,s)),{...n,value:new t(i,this._getEntireRange,n,this._p,c,this._o)}}canTile(e,t){return!(this._u??this._p)?.border}_createShifted(e){return new t(this._c,this._getEntireRange,e,this._p,this._t,this._o)}getShifted(e){let t=this._getEntireRange?.(),n=wm(e,t);return n?{...n,value:this._createShifted(n)}:null}getSplit(e,r){let i=this._c,a=this._u,o=a??this._p,s=this._r,c=o,l=e[0],u=o,d=e[1],f=o?o.border:null;if(f){let e=r===n.l.Axis.Column;if(e?f.left!==void 0||f.right!==void 0||f.vertical!==void 0:f.top!==void 0||f.bottom!==void 0||f.horizontal!==void 0){c={...c};let t=ym(f,s,l,e);t?c.border=t:t===null&&delete c.border,u={...u};let n=ym(f,s,d,e);n?u.border=n:n===null&&delete u.border}}let p=this._t,m=this._o,h=this._getEntireRange;if(a){let n=new t(i,h,e[0],Em(c),p,m);n._u=c;let r=new t(i,h,e[1],Em(u),p,m);return r._u=u,[n,r]}return[new t(i,h,e[0],c,p,m),new t(i,h,e[1],u,p,m)]}getMerged(r,i,a){let o=a===n.l.Axis.Column,s=this._p,c=r._p;if(s&&!c||c&&!s||!s&&!c)return;let l=Object.keys(s),u=Object.keys(c),d=l.length;if(d!==u.length)return;for(let t=0;t<d;t++){let n=l[t];if(n===`border`)continue;let r=s[n],i=c[n];if(!e.A.deepEqual(r,i))return}let f=s.border,p=c.border;if(f&&!p||p&&!f)return;let m=this._c;if(f||p){let n=o?W.Edge.Top:W.Edge.Left,a=o?W.Edge.Bottom:W.Edge.Right;if(!vm(f[n],p[n])||!vm(f[a],p[a]))return;let c=this._r,l=r._r,u=1+(o?c.rowEnd-c.rowStart:c.colEnd-c.colStart),d=1+(o?c.colEnd-c.colStart:c.rowEnd-c.rowStart),h=1+(o?l.colEnd-l.colStart:l.rowEnd-l.rowStart),g=o?W.Edge.Horizontal:W.Edge.Vertical;if(u>1&&!vm(f[g],p[g]))return;let _=o?W.Edge.Right:W.Edge.Bottom,v=o?W.Edge.Left:W.Edge.Top;if(!vm(f[_],p[v]))return;let y=o?W.Edge.Vertical:W.Edge.Horizontal,b=f[_];if(d>1&&!vm(b,f[y]))return;let x=h===1?p[v]:p[y];if(h>1&&!vm(x,p[y])||!vm(b,x))return;let S={border:{[n]:f[n],[a]:f[a],[g]:f[g],[y]:b,[v]:f[v],[_]:p[_]}},C=e.w.resolveTypedUpdates(S,um,m,s);return new t(m,this._getEntireRange,i,C,this._t,this._o)}return new t(m,this._getEntireRange,i,this._p,this._t,this._o)}hasTrailingEdge(){return!0}isMergeOnShift(){return!0}getInnerBorder(t){let n=this._p?.border;if(!n)return null;let r=this._t??this._r;if(!r||!e.l.isRangeWithinRange(t,r))return null;let i=this._localizeBorderRange(n,r,t);return i?i.horizontal===void 0&&i.vertical===void 0?null:i:null}_localizeBorderRange(e,t,n){if(!e)return;let r=null,i=t.rowStart,a=t.rowEnd,o=n.rowStart,s=n.rowEnd;e.top&&o===i&&(r??={},r.top=e.top),e.bottom&&s===a&&(r??={},r.bottom=e.bottom),e.horizontal&&(s-o>0&&(r??={},r.horizontal=e.horizontal),o>i&&(r??={},r.top=e.horizontal),s<a&&(r??={},r.bottom=e.horizontal));let c=t.colStart,l=t.colEnd,u=n.colStart,d=n.colEnd;return e.left&&u===c&&(r??={},r.left=e.left),e.right&&d===l&&(r??={},r.right=e.right),e.vertical&&(d-u>0&&(r??={},r.vertical=e.vertical),u>c&&(r??={},r.left=e.vertical),d<l&&(r??={},r.right=e.vertical)),r}_localizeBorder(e,t,n,r){if(!e)return;let i=null,a=t.rowStart,o=t.rowEnd;e.top&&n===a&&(i??={},i.top=e.top),e.bottom&&n===o&&(i??={},i.bottom=e.bottom),e.horizontal&&(n>a&&(i??={},i.top=e.horizontal),n<o&&(i??={},i.bottom=e.horizontal));let s=t.colStart,c=t.colEnd;return e.left&&r===s&&(i??={},i.left=e.left),e.right&&r===c&&(i??={},i.right=e.right),e.vertical&&(r>s&&(i??={},i.left=e.vertical),r<c&&(i??={},i.right=e.vertical)),i}getPropertiesAt(e,t,n){let r=this._p,i=r,a=this._t;if(a){let n=this._r,r=a.colEnd-a.colStart+1,i=a.rowEnd-a.rowStart+1;t=n.colStart+(t-n.colStart+(a.colStart-n.colStart))%r,e=n.rowStart+(e-n.rowStart+(a.rowStart-n.rowStart))%i}let o=i?.border;if(o&&i){let n=a??this._r,s=this._localizeBorder(o,n,e,t);s!==void 0&&(i===r&&(i={...i}),s===null?delete i.border:i.border=s)}return i}toJSON(){let t=e.A.toSafeJSON(this._p);if(!t)return t;let n=t.border;return n&&(n.top?.style===W.StrokeStyle.None&&delete n.top,n.bottom?.style===W.StrokeStyle.None&&delete n.bottom,n.left?.style===W.StrokeStyle.None&&delete n.left,n.right?.style===W.StrokeStyle.None&&delete n.right,n.horizontal?.style===W.StrokeStyle.None&&delete n.horizontal,n.vertical?.style===W.StrokeStyle.None&&delete n.vertical,Object.keys(n).length===0&&delete t.border),t}},Om=class extends Dm{constructor(t,n){super(t,null,e.l.EmptyRange,n)}isEmpty(){return this._p===null}getCoords(){return this._r}cloneWithUpdate(t){if(t===void 0)return this;let n=this._c,r=this._r;return new Dm(n,null,r,e.w.resolveTypedUpdates(t,um,n,this._p))}_createShifted(e){return new Dm(this._c,null,e,this._p)}getShifted(t){return t.after?{...t.after,value:this._createShifted(e.l.sanitizeRange(t.after))}:null}getSplit(e,t){let n=this._c,r=this._p;return[new Dm(n,null,e[0],r),new Dm(n,null,e[1],r)]}getMerged(t,n,r){let i=this._p,a=t._p;if(i&&!a||a&&!i||!i&&!a)return;let o=Object.keys(i),s=Object.keys(a);if(i.named===X.BuiltInName.Normal&&(o=o.filter(e=>e.toLowerCase()!==X.BuiltInName.Normal)),a.named===X.BuiltInName.Normal&&(s=s.filter(e=>e.toLowerCase()!==X.BuiltInName.Normal)),o.length!==s.length)return;for(let t=0;t<o.length;t++){let n=o[t],r=i[n],s=a[n];if(!e.A.deepEqual(r,s))return}let c=this._c;return new Dm(c,null,n,this._p)}getPropertiesAt(e,t){return this._p}toJSON(){return e.A.toSafeJSON(this._p)}},km=class{constructor(e,t,n,r=null){this._name=t.name,this._properties=t,this._rangeStyle=new Om(e,t.style),this._doDelete=n,this._builtInID=r}getRanged(){return this._rangeStyle}getName(){return this._name}isHidden(){return this._properties.hidden??!1}getILevel(){return this._properties.iLevel??null}getBuiltInID(){return this._builtInID}delete(){this._doDelete?.(this)}toJSON(){return this._properties?e.A.toSafeJSON(this._properties):null}get isINamed(){return!0}},Am=class{constructor(t,n,r,i,a){this._state=t,this._normalJSON=n??{},this._toJSONInternal=r,this._fromJSONInternal=i,this._onLastEnd=a,this._state.openScopes.add(this),this._isClosed=!1,this._state.byJSONs.set(e.F.JSONStableStringify(this._normalJSON),0),this._state.byIds.set(0,this._normalJSON)}endPersist(){if(!this._state.openScopes.delete(this))throw Error(`PersistScope is closed.`);this._isClosed=!0,this._state.openScopes.size===0&&this._onLastEnd()}getElementID(t){if(this._isClosed)throw Error(`PersistScope is closed.`);t??={};let n=e.F.JSONStableStringify(t),r=this._state.byJSONs.get(n);return r!==void 0||(r=this._state.byJSONs.size,this._state.byJSONs.set(n,r),this._state.byIds.set(r,t)),r}getElementJSON(e){if(this._isClosed)throw Error(`PersistScope is closed.`);return this._state.byIds.get(e)??null}fromJSON(t){if(this._isClosed)throw Error(`PersistScope is closed.`);let n=JSON.parse(JSON.stringify(t||{}));this._fromJSONInternal(n);let r=n.direct,i=r?r.length:0;for(let t=0;t<i;t++){let n=t,i=r[t],a=e.F.JSONStableStringify(i);this._state.byIds.set(n,i),this._state.byJSONs.set(a,n)}}toJSON(){if(this._isClosed)throw Error(`PersistScope is closed.`);let e=[];return this._state.byIds.forEach((t,n)=>{e[n]=t}),e.length===1&&e.splice(0,1),this._toJSONInternal(e)}},jm=class{constructor(e=null,t=null,n=11){this._defaultTableStyle=null,this._theme=e??new Jf().getDefaultTheme(),this._defaultFontSize=n;let r=this;this._emitter=new v(this),this._schemeLookup=e=>r._theme.schemeLookup()(e),this._customIndexedColors=this._fromJSONIndexedColors(t),this._indexedLookup=e=>this._customIndexedColors[e]??null,this._initializeBuiltIns(),this._customCellStyles=new Map,this._customTableStyles=new Map,this._customIndexedColors=[],this._mruColors=[],this._persistCache=null}_initializeNamedStyles(t,n){let r=t?t.length:0;for(let i=0;i<r;i++){let r=t[i],a={...r},o=r.named;delete a.named;let s=e.w.resolveTypedUpdates(a,um,this),c=new km(this,{name:o,style:s},this._hideOrRemoveNamed.bind(this),i);o===X.BuiltInName.Normal&&(this._normalRanged=c.getRanged(),this._normalStyle=vh(void 0,this,null)),n.set(o.toLowerCase(),c)}}_initializeTableStyles(){let e=(()=>{if(np)return np;let e=new Map;np=e;let t=(e,t)=>{if(t===0)return`TableStyleNone`;let n=`Custom`;return e===`l`?n=`Light`:e===`m`?n=`Medium`:e===`d`&&(n=`Dark`),`TableStyle${n}${t}`},n=(e,t=0)=>t>0?`${e} lumMod ${100-t}, lumOff ${t}`:t<0?`${e} lumMod ${100+t}`:e,r=e=>({type:Y.Type.Pattern,patternType:Y.BuiltInSheetPattern.Solid,foreground:e,background:e}),i=(e,t=!1)=>{let n={color:e};return t&&(n.weight=700),n},a=(e,t=W.StrokeStyle.Thin)=>({style:t,color:e}),o=(e,t)=>{for(let n=0;n<7;n++)e.push(t(`accent${n+1}`))},s=0,c=[];c.push([`dk1`,n(`bg1`,-15),`dk1`]),o(c,e=>[n(e,-25),n(e,80),e]),s=1;for(let n=0;n<7;n++){let o=t(`l`,n+s),l=c[n][0],u=c[n][1]??l,d=c[n][2]??l;e.set(o.toLocaleLowerCase(),Object.freeze({name:o,wholeTable:{font:i(l),border:{top:a(d),bottom:a(d)}},headerRow:{font:i(l,!0),border:{bottom:a(d)}},totalRow:{font:i(l,!0),border:{top:a(d)}},firstColumn:{font:i(l,!0)},lastColumn:{font:i(l,!0)},firstRowStripe:{fill:r(u)},firstColumnStripe:{fill:r(u)}}))}s+=7,c=[],c.push([`dk1`,`dk1`,`lt1`]),o(c,e=>[`dk1`,e,`lt1`]);for(let n=0;n<7;n++){let o=t(`l`,n+s),l=c[n][0],u=c[n][1],d=c[n][2];e.set(o.toLocaleLowerCase(),Object.freeze({name:o,wholeTable:{font:i(l),border:{left:a(u),right:a(u),top:a(u),bottom:a(u)}},headerRow:{font:i(d,!0),fill:r(u)},totalRow:{font:i(l,!0),border:{top:a(u,W.StrokeStyle.Double)}},firstColumn:{font:i(l,!0)},lastColumn:{font:i(l,!0)},firstRowStripe:{border:{top:a(u)}},secondRowStripe:{border:{top:a(u)}},firstColumnStripe:{border:{left:a(u)}},secondColumnStripe:{border:{left:a(u)}}}))}s+=7,c=[],c.push([`dk1`,n(`bg1`,-15)]),o(c,e=>[e,n(e,80)]);for(let n=0;n<7;n++){let o=t(`l`,n+s),l=c[n][0],u=c[n][1];e.set(o.toLocaleLowerCase(),Object.freeze({name:o,wholeTable:{font:i(`dk1`),border:{left:a(l),right:a(l),top:a(l),bottom:a(l),horizontal:a(l),vertical:a(l)}},headerRow:{font:i(`dk1`,!0)},totalRow:{font:i(`dk1`,!0),border:{top:a(l,W.StrokeStyle.Double)}},firstColumn:{font:i(`dk1`,!0)},lastColumn:{font:i(`dk1`,!0)},firstRowStripe:{fill:r(u)},firstColumnStripe:{fill:r(u)}}))}s=1,c=[],c.push([`dk1`,`dk1`,n(`bg1`,-15)]),o(c,e=>[e,n(e,40),n(e,80)]);for(let n=0;n<7;n++){let o=t(`m`,n+s),l=c[n][0],u=c[n][1],d=c[n][2];e.set(o.toLocaleLowerCase(),Object.freeze({name:o,wholeTable:{font:i(`dk1`),border:{left:a(u),right:a(u),top:a(u),bottom:a(u),horizontal:a(u)}},headerRow:{font:i(`lt1`,!0),fill:r(l)},totalRow:{font:i(`dk1`,!0),border:{top:a(l,W.StrokeStyle.Double)}},firstColumn:{font:i(`dk1`,!0)},lastColumn:{font:i(`dk1`,!0)},firstRowStripe:{fill:r(d)},firstColumnStripe:{fill:r(d)}}))}s+=7,c=[],c.push([`dk1`,n(`bg1`,-15),n(`bg1`,-35)]),o(c,e=>[e,n(e,80),n(e,60)]);for(let n=0;n<7;n++){let o=t(`m`,n+s),l=c[n][0],u=c[n][1],d=c[n][2];e.set(o.toLocaleLowerCase(),Object.freeze({name:o,wholeTable:{font:i(`dk1`),fill:r(u),border:{horizontal:a(`lt1`),vertical:a(`lt1`)}},headerRow:{font:i(`lt1`,!0),fill:r(l),border:{bottom:a(`lt1`,W.StrokeStyle.Thick)}},totalRow:{font:i(`lt1`,!0),fill:r(l),border:{top:a(`lt1`,W.StrokeStyle.Thick)}},firstColumn:{font:i(`lt1`,!0),fill:r(l)},lastColumn:{font:i(`lt1`,!0),fill:r(l)},firstRowStripe:{fill:r(d)},firstColumnStripe:{fill:r(d)}}))}s+=7,c=[],c.push([`dk1`,n(`bg1`,-15),n(`bg1`,-35)]),o(c,e=>[e,n(e,80),n(e,60)]);for(let o=0;o<7;o++){let l=t(`m`,o+s),u=c[o][0],d=n(`bg1`,-15);e.set(l.toLocaleLowerCase(),Object.freeze({name:l,wholeTable:{font:i(`dk1`),border:{top:a(`dk1`,W.StrokeStyle.Medium),bottom:a(`dk1`,W.StrokeStyle.Medium),left:o===0?a(`dk1`,W.StrokeStyle.Thin):void 0,right:o===0?a(`dk1`,W.StrokeStyle.Thin):void 0,horizontal:o===0?a(`dk1`,W.StrokeStyle.Thin):void 0,vertical:o===0?a(`dk1`,W.StrokeStyle.Thin):void 0}},headerRow:{font:i(`lt1`,!0),fill:r(u),border:{bottom:a(`dk1`,W.StrokeStyle.Medium)}},totalRow:{border:{top:a(`dk1`,W.StrokeStyle.Double)}},firstColumn:{font:i(`lt1`,!0),fill:r(u)},lastColumn:{font:i(`lt1`,!0),fill:r(u)},firstRowStripe:{fill:r(d)},firstColumnStripe:{fill:r(d)}}))}s+=7,c=[],c.push([`dk1`,n(`bg1`,-15),n(`bg1`,-35),`dk1`]),o(c,e=>[e,n(e,80),n(e,60),n(e,40)]);for(let n=0;n<7;n++){let o=t(`m`,n+s),l=c[n][0],u=c[n][1],d=c[n][2],f=c[n][3];e.set(o.toLocaleLowerCase(),Object.freeze({name:o,wholeTable:{font:i(`dk1`),fill:r(u),border:{top:a(f),right:a(f),left:a(f),bottom:a(f),vertical:a(f),horizontal:a(f)}},headerRow:{font:i(`dk1`),fill:r(u)},totalRow:{font:i(`dk1`),border:{top:a(l,W.StrokeStyle.Medium)}},firstColumn:{font:i(`dk1`,!0)},lastColumn:{font:i(`dk1`,!0)},firstRowStripe:{fill:r(d)},firstColumnStripe:{fill:r(d)}}))}s=1,c=[],c.push([`dk1`,n(`dk1`,15),n(`dk1`,25),n(`dk1`,50)]),o(c,e=>[`dk1`,n(e,-50),n(e,-25),e]);for(let n=0;n<7;n++){let o=t(`d`,n+s),l=c[n][0],u=c[n][1],d=c[n][2],f=c[n][3];e.set(o.toLocaleLowerCase(),Object.freeze({name:o,wholeTable:{font:i(`lt1`),fill:r(f)},headerRow:{font:i(`lt1`,!0),fill:r(l),border:{bottom:a(`lt1`,W.StrokeStyle.Medium)}},totalRow:{font:i(`lt1`,!0),fill:r(u),border:{top:a(`lt1`,W.StrokeStyle.Medium)}},firstColumn:{font:i(`lt1`,!0),fill:r(d),border:{right:a(`lt1`,W.StrokeStyle.Medium)}},lastColumn:{font:i(`lt1`,!0),fill:r(d),border:{left:a(`lt1`,W.StrokeStyle.Medium)}},firstRowStripe:{fill:r(d)},firstColumnStripe:{fill:r(d)}}))}s+=7,c=[],c.push([n(`bg1`,-15),`dk1`,n(`bg1`,-35)]),c.push([n(`accent1`,80),`accent2`,n(`accent1`,60)]),c.push([n(`accent3`,80),`accent4`,n(`accent3`,60)]),c.push([n(`accent5`,80),`accent6`,n(`accent5`,60)]);for(let n=0;n<4;n++){let o=t(`d`,n+s),l=c[n][0],u=c[n][1],d=c[n][2];e.set(o.toLocaleLowerCase(),Object.freeze({name:o,wholeTable:{font:i(`dk1`),fill:r(l)},headerRow:{font:i(`lt1`,!0),fill:r(u)},totalRow:{font:i(`dk1`,!0),border:{top:a(`dk1`,W.StrokeStyle.Double)}},firstColumn:{font:i(`dk1`,!0)},lastColumn:{font:i(`dk1`,!0)},firstRowStripe:{fill:r(d)},firstColumnStripe:{fill:r(d)}}))}return e})(),t=new Map;return e.forEach((e,n)=>{let r=e.name.toLowerCase(),i=new gm(this,e,!0);t.set(r,i)}),t}_initializeBuiltIns(){let e=new Map;this._builtInsCellStyles=e,this._initializeNamedStyles(tp,e),this._builtInsTableStyles=this._initializeTableStyles(),this._emptyTableStyle=new yf.Empty(this._normalStyle)}getNormal(){return this._normalStyle}getNormalRanged(){return this._normalRanged}setTheme(e){this._theme=e,this._emitter.notify(`onThemeChange`),this._emitter.notify(`onAnyChange`)}getTheme(){return this._theme}setDefaultFontSize(e){this._defaultFontSize=e,this._emitter.notify(`onDefaultFontChange`),this._emitter.notify(`onAnyChange`)}getDefaultFontSize(){return this._defaultFontSize}beginPersist(){return this._persistCache||={byIds:new Map,byJSONs:new Map,openScopes:new Set},new Am(this._persistCache,{},this._toJSONInternal.bind(this),this._fromJSONInternal.bind(this),()=>{this._persistCache=null})}getNamed(e){if(!e)return null;e=e.toLowerCase();let t=null;return this._customCellStyles&&(t=this._customCellStyles.get(e)),t||=this._builtInsCellStyles.get(e),t??null}getCustomNamed(){let e=Array.from(this._customCellStyles.values());return e.sort((e,t)=>e.getName().localeCompare(t.getName())),e}setNamed(t,n=!1){if(!t||!t.name||!t.style)throw new e.O;this.validateStyleName(t.name,!1);let r=this._setCustomCellStyleInternal(t,n);return this._emitter.notify(`onNamedStylesChange`),this._emitter.notify(`onAnyChange`),r}_setCustomCellStyleInternal(t,n=!1,r=0){let i=t.name.toLowerCase(),a=this._builtInsCellStyles.get(i),o=a?.getBuiltInID()??null,s=null;n&&(s=(this._customCellStyles.get(i)??a)?._properties??null);let c=nh(t.style,this.getNormal());t={...t,style:c};let l=e.w.resolveTypedUpdates(t,pm,this,s),u=l.style,d=u?.named;if(typeof d==`string`&&d.toLowerCase()!==i){let t={...u};delete t.named;let n=d.toLowerCase()===X.BuiltInName.Normal.toLowerCase()?null:this.getNamed(d)?.getRanged().getPropertiesAt(0,0,null),r=n?e.w.resolveTypedUpdates(t,um,this,n):t;l={...l,style:r}}let f=new km(this,l,this._hideOrRemoveNamed.bind(this),o);return l.name===X.BuiltInName.Normal&&(this._normalRanged=f.getRanged(),this._normalStyle=vh(void 0,this,null)),this._customCellStyles.set(i,f),f}_setCustomTableStyleInternal(e,t){let n=e.toLowerCase(),r=this._customTableStyles.get(n)??this._builtInsTableStyles.get(n);r&&(e=r.getName());let i=new gm(this,{...t,name:e},!1,this._deleteCustomTableStyle.bind(this));return this._customTableStyles.set(n,i),i}_hideOrRemoveNamed(e){let t=null;if(t=typeof e==`string`?e:e?.getName?.(),!t||(t=t.toLowerCase(),t===X.BuiltInName.Normal.toLowerCase()))return!1;let n=this._builtInsCellStyles.get(t),r=!1;if(n&&!n.isHidden()){let e=n.toJSON();this.setNamed({...e,hidden:!0}),r=!0}else t=t.toLowerCase(),r=this._customCellStyles.delete(t);return r&&(this._emitter.notify(`onNamedStylesChange`),this._emitter.notify(`onAnyChange`)),r}getTableStyle(e){if(!e)return this._emptyTableStyle;let t=this._customTableStyles.get(e.toLowerCase());return t||=this._builtInsTableStyles.get(e.toLowerCase()),t??null}getCustomTableStyles(){let e=Array.from(this._customTableStyles.values());return e.sort((e,t)=>e.getName().localeCompare(t.getName())),e}setDefaultTableStyle(e){let t=e?.toLowerCase();return this._defaultTableStyle=this._customTableStyles.get(t)??this._builtInsTableStyles.get(t)??this._builtInsTableStyles.get(`tablestylemedium2`),this._emitter.notify(`onTableStylesChange`),this._emitter.notify(`onAnyChange`),e===this._defaultTableStyle.getName()}getDefaultTableStyle(){return this._defaultTableStyle||=this._builtInsTableStyles.get(rp.toLowerCase()),this._defaultTableStyle}_deleteCustomTableStyle(e){let t=this._customTableStyles.get(e?.toLowerCase());return!!t&&(this._customTableStyles.delete(e.toLowerCase()),this._defaultTableStyle?.getName()===t.getName()&&(this._defaultTableStyle=this._builtInsTableStyles.get(rp.toLowerCase())),this._emitter.notify(`onTableStylesChange`),this._emitter.notify(`onAnyChange`),!0)}setCustomTableStyle(e,t){let n=this._setCustomTableStyleInternal(e,t);return this._emitter.notify(`onTableStylesChange`),this._emitter.notify(`onAnyChange`),n}validateStyleName(e,t=!1){if(!e||e.trim().length===0)throw Error(`Style name cannot be empty.`);if(t&&this.getNamed(e)!==null)throw Error(`Style name is already taken.`)}normalize(t,n){if(!t)return null;let r=e.w.resolveTypedUpdates(t,um,this);if(!r)return null;let i=null,a=n??r.named??X.BuiltInName.Normal;i=a===X.BuiltInName.Normal?this._normalRanged.getPropertiesAt(0,0,null):this.getNamed(a)?.getRanged().getPropertiesAt(0,0,null);let o=this.getTheme().getFontScheme(),s={font:{size:this.getDefaultFontSize(),family:o.getMinorFont(),fallbacks:o.getMinorFallbacks()}};return e.A.removeEqualValuesLayered(r,[i,s,ep]),r}resolve(t,n){if(!t)return null;let r=n??t.named??X.BuiltInName.Normal,i=r===X.BuiltInName.Normal?this._normalRanged.getPropertiesAt(0,0,null):this.getNamed(r)?.getRanged().getPropertiesAt(0,0,null),a={...t};delete a.named;let o=e.w.resolveTypedUpdates(a,um,this,i??void 0);return o?(typeof t.named==`string`&&(o.named=t.named),o):null}schemeLookup(){return this._schemeLookup}indexedLookup(){return this._indexedLookup}parseColor(e){return Df.parse(e,this._schemeLookup,this._indexedLookup)}recentColors(){return this._mruColors}addRecentColor(e){if(!e)return;let t=this._mruColors,n=[],r=e.toString(),i=t.length;for(let e=0;e<i&&e<10;e++){let i=t[e];i.toString()!==r&&n.push(i)}return n.unshift(e),this._mruColors=Object.freeze(n),this._mruColors}clearRecentColors(){this._mruColors=e.A.EmptyArray}getCustomIndexedColors(){return this._customIndexedColors}setCustomIndexedColors(e){this._customIndexedColors=(e?.length??0)>0?[...e]:[]}getIndexedColors(){let e=this._customIndexedColors,t=Math.max(e?.length,66),n=[];for(let r=0;r<t;r++){let t=e[r];if(t!==null){let e=t??ac(r);if(!e)continue;n.push(t??new Df(e.toString()))}}return n}addListeners(e,t){return this._emitter.addListeners(e,t)}_toJSONInternal(e){let t={};e.length>0&&(t.direct=e);let n=this.getCustomNamed(),r=n.length,i=Array(r);for(let e=0;e<r;e++)i[e]=n[e].toJSON();i.length>0&&(t.named=i);let a={};this._defaultTableStyle&&this._defaultTableStyle.getName()!==`TableStyleMedium2`&&(a.defaultTableStyle=this._defaultTableStyle.getName());let o={},s=this.getCustomTableStyles(),c=s.length;for(let e=0;e<c;e++){let t=s[e],n=t.toJSON();delete n.name,n&&Object.keys(n).length>0&&(o[t.getName()]=n)}Object.keys(o).length>0&&(a.styles=o),Object.keys(a).length>0&&(t.tables=a);let l=this._customIndexedColors,u=l.length??0;if(u>0){let e=Array(u);for(let t=0;t<u;t++)e[t]=l[t].toString();t.indexedColors=e}let d=this._mruColors,f=d.length;if(f>0){let e=Array(f);for(let t=0;t<f;t++)e[t]=d[t].toString();t.mruColors=e}return Object.keys(t).length===0?null:t}_fromJSONIndexedColors(t){if(!t||t.length===0)return e.A.EmptyArray;let n=t.length,r=Array(n);if(n>0)for(let e=0;e<n;e++){let n=t[e];try{r[e]=this.parseColor(n)}catch{console.warn(`Unable to parse color: `+n)}}return r}_fromJSONInternal(e){this._customIndexedColors=this._fromJSONIndexedColors(e.indexedColors);let t=e.named,n=t?t.length:0;for(let e=0;e<n;e++)this._setCustomCellStyleInternal(t[e]);let r=e.direct,i=r?r.length:0;for(let e=0;e<i;e++)r[e]=this.normalize(r[e])??{};let a=rp;if(this._defaultTableStyle=null,e.tables){e.tables.defaultTableStyle&&(a=e.tables.defaultTableStyle);let t=e.tables.styles,n=t?Object.keys(t):null,r=n?n.length:0;for(let e=0;e<r;e++){let r=n[e],i=t[r];this._setCustomTableStyleInternal(r,i)}}this._defaultTableStyle=this.getTableStyle(a);let o=e.mruColors,s=o?o.length:0,c=Array(s);if(s>0)for(let e=0;e<s;e++){let t=o[e];try{c[e]=this.parseColor(t)}catch{console.warn(`Unable to parse color: `+t)}}this._mruColors=c}},Mm=class t{constructor(t,n,r,i=null,a=null,s=null){this._private={wrapped:!0,insets:e.o.EmptyRect,orientation:o.Orientation.Horizontal,autoFit:o.Autofit.None,fontScale:1,vertical:!1,columnCount:1,columnSpacing:0,verticalAlignment:o.VerticalAlignment.Center,horizontalCentered:!1,lineReduction:0,isSpaceFirstLastPara:!1,presetTextWarp:null,paragraphs:e.A.EmptyArray},this._bounds=null,this._textBounds=null,this._lines=null,this._lastLayoutSize=void 0,this._lastLayout=void 0,this._private=Object.assign(this._private,t||{}),this._defaultFont=n,this._alignment=r,this._lines=i,this._bounds=Object.freeze(a),this._textBounds=Object.freeze(s)}visitParas(e){e?.visitTextFrame?.(this);let t=this.paragraphs,n=t.length;for(let r=0;r<n;r++){let i=t[r];e?.visitTextParagraph?.(i,r,n);let a=i.runs,o=a.length;for(let t=0;t<o;t++)e?.visitTextRun?.(a[t],t,o)}}visitLines(e){e?.visitTextFrame?.(this);let t=this.lines,n=t.length;for(let r=0;r<n;r++){let i=t[r];e?.visitTextLine?.(i,r,n);let a=i.runs,o=a.length;for(let t=0;t<o;t++)e?.visitTextRun?.(a[t],t,o)}}layout(t=null){return this._lastLayout&&this._lastLayoutSize?.width===t?.width&&this._lastLayoutSize?.height===t?.height||(this._lastLayout=function(t,n,r,i=null,a=U.getSharedMeasurer()){let o=``,s=null,c=null,l=t.paragraphs,u=l.length;for(let e=0;e<u;e++){let t=l[e].runs,n=t.length;for(let e=0;e<n;e++){let n=t[e];o+=n.text,e===0&&(s=n)}e===0&&(c=l[e])}let d=t.insets??e.o.EmptyRect,f=new Ym(a),p=i?.width?i.width-d.right-d.left:i?.width,m=i?.height?i.height-d.bottom-d.top:void 0,h=f.wrap(o,{fontName:s.fontName,fontSize:s.fontSize*U.getDeviceScale(),bold:s.bold,italic:s.italic,superSub:s.superSub,letterSpacing:s.letterSpacing,maxWidth:t.wrapped&&p?p:void 0,maxHeight:m}),g=[],_=h.lines,v=_.length,y=Array(v);for(let e=0;e<v;e++){let t=_[e],n={x:t.x,y:t.y,width:t.width,height:t.height},r=new Im({text:t.text,fontName:s.fontName,fontSize:s.fontSize,bold:s.bold,italic:s.italic,superSub:s.superSub,letterSpacing:s.letterSpacing},n);g.push(r),y[e]=new Lm(n,t.baseline,[r])}return new Mm({paragraphs:[new Fm({runs:g,align:c.align})],wrapped:t.wrapped,verticalAlignment:t.verticalAlignment},n,r,y,{x:h.bounds.x,y:h.bounds.y,width:h.bounds.widthWhitespace,height:h.bounds.height},{x:h.bounds.x,y:h.bounds.y,width:h.bounds.width,height:h.bounds.height})}(this,this._defaultFont,this._alignment,t),this._lastLayoutSize=t),this._lastLayout}clone(e){let n=e?.visitTextFrame?.(this),r=Object.assign({},this._private,n||{});return delete r.bounds,new t(r,this._defaultFont,this._alignment)}equals(t){return e.A.deepEqual(this._private,t._private)}createTextFrame(e,t){return Zm(e,this._defaultFont,this._alignment,t??this._private.wrapped)}get bounds(){if(this._bounds===null)throw Error(Nm);return this._bounds}get textBounds(){if(this._textBounds===null)throw Error(Nm);return this._textBounds}get lines(){return this._lines}get wrapped(){return this._private.wrapped}get insets(){return this._private.insets}get orientation(){return this._private.orientation}get autoFit(){return this._private.autoFit}get fontScale(){return this._private.fontScale}get vertical(){return this._private.vertical}get columnCount(){return this._private.columnCount}get columnSpacing(){return this._private.columnSpacing}get verticalAlignment(){return this._private.verticalAlignment}get horizontalCentered(){return this._private.horizontalCentered}get lineReduction(){return this._private.lineReduction}get isSpaceFirstLastPara(){return this._private.isSpaceFirstLastPara}get presetTextWarp(){return this._private.presetTextWarp??null}get paragraphs(){return this._private.paragraphs}},Nm=`bounds can not be used until layout`,Pm=class{static{this.NL=`
|
|
3
|
-
`}static{this.DefaultLineSpacing=100}static{this.DefaultTabWidth=72}},Fm=class t{constructor(t){this._private={defaultFontSize:11,defaultTabSize:Pm.DefaultTabWidth,tabOverrides:e.A.EmptyArray,spacingBefore:0,spacingAfter:0,lineSpacing:Pm.DefaultLineSpacing,align:o.HorizontalAlignment.Left,endParagraphSize:0,indentLevel:0,leadingIndent:0,hangingIndent:0,rightMargin:0,bullet:null},this._private=Object.assign(this._private,t||{})}clone(e){let n=e?.visitTextParagraph?.(this,0,1),r=Object.assign({},this._private,n||{});return delete r.bounds,new t(r)}equals(t){return e.A.deepEqual(this._private,t._private)}get bounds(){return this._bounds}get defaultFontSize(){return this._private.defaultFontSize}get defaultTabSize(){return this._private.defaultTabSize}get tabOverrides(){return this._private.tabOverrides}get spacingBefore(){return this._private.spacingBefore}get spacingAfter(){return this._private.spacingAfter}get lineSpacing(){return this._private.lineSpacing}get align(){return this._private.align}get endParagraphSize(){return this._private.endParagraphSize}get indentLevel(){return this._private.indentLevel}get leadingIndent(){return this._private.leadingIndent}get hangingIndent(){return this._private.hangingIndent}get rightMargin(){return this._private.rightMargin}get bullet(){return this._private.bullet??null}get runs(){return this._private.runs}},Im=class t{constructor(e,t=null){this._private={text:null,fontName:`Arial`,bold:!1,italic:!1,superSub:!1,fontSize:11,letterSpacing:0,kerningMin:10,smallCaps:i.SmallCaps.None,offset:0,strikeStyle:i.StrikeStyle.None},this._private={...this._private,...e},this._bounds=t}clone(e){let n=e?.visitTextRun?.(this,0,1),r=Object.assign({},this._private,n||{});return delete r.bounds,new t(r)}equals(t){return e.A.deepEqual(this._private,t._private)}get bounds(){return this._bounds}get text(){return this._private.text}get fontName(){return this._private.fontName}get bold(){return this._private.bold}get italic(){return this._private.italic}get fontSize(){return this._private.fontSize}get superSub(){return this._private.superSub}get letterSpacing(){return this._private.letterSpacing}get kerningMin(){return this._private.kerningMin}get smallCaps(){return this._private.smallCaps}get offset(){return this._private.offset}get strikeStyle(){return this._private.strikeStyle}},Lm=class{constructor(e,t,n){this._private={},this._private={bounds:e,baseline:t,runs:n}}get bounds(){return this._private.bounds}get baseline(){return this._private.baseline}get runs(){return this._private.runs}get bullet(){return null}},Rm=t.n((e,t)=>{function n(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function r(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new n,this.dtree=new n}var i=new n,a=new n,o=new Uint8Array(30),s=new Uint16Array(30),c=new Uint8Array(30),l=new Uint16Array(30),u=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new n,f=new Uint8Array(320);function p(e,t,n,r){var i,a;for(i=0;i<n;++i)e[i]=0;for(i=0;i<30-n;++i)e[i+n]=i/n|0;for(a=r,i=0;i<30;++i)t[i]=a,a+=1<<e[i]}var m=new Uint16Array(16);function h(e,t,n,r){var i,a;for(i=0;i<16;++i)e.table[i]=0;for(i=0;i<r;++i)e.table[t[n+i]]++;for(e.table[0]=0,a=0,i=0;i<16;++i)m[i]=a,a+=e.table[i];for(i=0;i<r;++i)t[n+i]&&(e.trans[m[t[n+i]]++]=i)}function g(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=1&e.tag;return e.tag>>>=1,t}function _(e,t,n){if(!t)return n;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var r=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,r+n}function v(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var n=0,r=0,i=0,a=e.tag;do r=2*r+(1&a),a>>>=1,++i,n+=t.table[i],r-=t.table[i];while(r>=0);return e.tag=a,e.bitcount-=i,t.trans[n+r]}function y(e,t,n){var r,i,a,o,s,c;for(r=_(e,5,257),i=_(e,5,1),a=_(e,4,4),o=0;o<19;++o)f[o]=0;for(o=0;o<a;++o){var l=_(e,3,0);f[u[o]]=l}for(h(d,f,0,19),s=0;s<r+i;){var p=v(e,d);switch(p){case 16:var m=f[s-1];for(c=_(e,2,3);c;--c)f[s++]=m;break;case 17:for(c=_(e,3,3);c;--c)f[s++]=0;break;case 18:for(c=_(e,7,11);c;--c)f[s++]=0;break;default:f[s++]=p}}h(t,f,0,r),h(n,f,r,i)}function b(e,t,n){for(;;){var r,i,a,u,d=v(e,t);if(d===256)return 0;if(d<256)e.dest[e.destLen++]=d;else for(r=_(e,o[d-=257],s[d]),i=v(e,n),u=a=e.destLen-_(e,c[i],l[i]);u<a+r;++u)e.dest[e.destLen++]=e.dest[u]}}function x(e){for(var t,n;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if((t=256*(t=e.source[e.sourceIndex+1])+e.source[e.sourceIndex])!==(65535&~(256*e.source[e.sourceIndex+3]+e.source[e.sourceIndex+2])))return-3;for(e.sourceIndex+=4,n=t;n;--n)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,0}(function(e,t){var n;for(n=0;n<7;++n)e.table[n]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,n=0;n<24;++n)e.trans[n]=256+n;for(n=0;n<144;++n)e.trans[24+n]=n;for(n=0;n<8;++n)e.trans[168+n]=280+n;for(n=0;n<112;++n)e.trans[176+n]=144+n;for(n=0;n<5;++n)t.table[n]=0;for(t.table[5]=32,n=0;n<32;++n)t.trans[n]=n})(i,a),p(o,s,4,3),p(c,l,2,1),o[28]=0,s[28]=258,t.exports=function(e,t){var n,o,s=new r(e,t);do{switch(n=g(s),_(s,2,0)){case 0:o=x(s);break;case 1:o=b(s,i,a);break;case 2:y(s,s.ltree,s.dtree),o=b(s,s.ltree,s.dtree);break;default:o=-3}if(o!==0)throw Error(`Data error`)}while(!n);return s.destLen<s.dest.length?typeof s.dest.slice==`function`?s.dest.slice(0,s.destLen):s.dest.subarray(0,s.destLen):s.dest}}),zm=t.n((e,t)=>{var n=new Uint8Array(new Uint32Array([305419896]).buffer)[0]===18,r=(e,t,n)=>{let r=e[t];e[t]=e[n],e[n]=r};t.exports={swap32LE:e=>{n&&(e=>{let t=e.length;for(let n=0;n<t;n+=4)r(e,n,n+3),r(e,n+1,n+2)})(e)}}}),Bm=t.n((e,t)=>{var n=Rm(),{swap32LE:r}=zm();t.exports=class{constructor(e){let t=typeof e.readUInt32BE==`function`&&typeof e.slice==`function`;if(t||e instanceof Uint8Array){let i;if(t)this.highStart=e.readUInt32LE(0),this.errorValue=e.readUInt32LE(4),i=e.readUInt32LE(8),e=e.slice(12);else{let t=new DataView(e.buffer);this.highStart=t.getUint32(0,!0),this.errorValue=t.getUint32(4,!0),i=t.getUint32(8,!0),e=e.subarray(12)}e=n(e,new Uint8Array(i)),e=n(e,new Uint8Array(i)),r(e),this.data=new Uint32Array(e.buffer)}else({data:this.data,highStart:this.highStart,errorValue:this.errorValue}=e)}get(e){let t;return e<0||e>1114111?this.errorValue:e<55296||e>56319&&e<=65535?(t=(this.data[e>>5]<<2)+(31&e),this.data[t]):e<=65535?(t=(this.data[2048+(e-55296>>5)]<<2)+(31&e),this.data[t]):e<this.highStart?(t=this.data[2080+(e>>11)],t=this.data[t+(e>>5&63)],t=(t<<2)+(31&e),this.data[t]):this.data[this.data.length-4]}}}),Vm=t.n(e=>{(function(e){var t=typeof Uint8Array<`u`?Uint8Array:Array;function n(e){var t=e.charCodeAt(0);return t===43||t===45?62:t===47||t===95?63:t<48?-1:t<58?t-48+26+26:t<91?t-65:t<123?t-97+26:void 0}e.toByteArray=function(e){var r,i,a,o,s,c;if(e.length%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var l=e.length;s=e.charAt(l-2)===`=`?2:+(e.charAt(l-1)===`=`),c=new t(3*e.length/4-s),a=s>0?e.length-4:e.length;var u=0;function d(e){c[u++]=e}for(r=0,i=0;r<a;r+=4,i+=3)d((16711680&(o=n(e.charAt(r))<<18|n(e.charAt(r+1))<<12|n(e.charAt(r+2))<<6|n(e.charAt(r+3))))>>16),d((65280&o)>>8),d(255&o);return s===2?d(255&(o=n(e.charAt(r))<<2|n(e.charAt(r+1))>>4)):s===1&&(d((o=n(e.charAt(r))<<10|n(e.charAt(r+1))<<4|n(e.charAt(r+2))>>2)>>8&255),d(255&o)),c},e.fromByteArray=function(e){var t,n,r,i=e.length%3,a=``;function o(e){return`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.charAt(e)}function s(e){return o(e>>18&63)+o(e>>12&63)+o(e>>6&63)+o(63&e)}for(t=0,r=e.length-i;t<r;t+=3)a+=s(n=(e[t]<<16)+(e[t+1]<<8)+e[t+2]);switch(i){case 1:a+=o((n=e[e.length-1])>>2),a+=o(n<<4&63),a+=`==`;break;case 2:a+=o((n=(e[e.length-2]<<8)+e[e.length-1])>>10),a+=o(n>>4&63),a+=o(n<<2&63),a+=`=`}return a}})(e===void 0?e.base64js={}:e)}),Hm=t.t(Bm(),1),Um=t.t(Vm(),1),Wm=[[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,4,4],[0,4,4,1,1,4,4,4,4,1,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[0,4,4,1,1,4,4,4,4,1,1,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[4,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1,1,1,1,1],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1,1,1,1,1],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,0,1,0,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,0,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,1,1,1,1,0,0,4,2,4,1,1,1,1,1,0,1,1,1,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[0,4,4,1,0,1,4,4,4,0,0,1,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[0,4,4,1,0,1,4,4,4,0,0,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1,1,1,1,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,1,1,1,0,4,4,2,4,0,0,0,0,0,0,0,0,1,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1,1,1,1,1],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,1,1,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,1,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,1,1,1,1,0,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,1,1,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,1,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,1,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,1,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0],[0,4,4,1,1,0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,4,2,4,0,0,0,0,0,0,0,0,1,0]],Gm=new Hm.default(Um.default.toByteArray(`AAgOAAAAAAAQ4QAAAQ0P8vDtnQuMXUUZx+eyu7d7797d9m5bHoWltKVUlsjLWE0VJNigQoMVqkStEoNQQUl5GIo1KKmogEgqkKbBRki72lYabZMGKoGAjQRtJJDaCCIRiiigREBQS3z+xzOTnZ3O+3HOhd5NfpkzZx7fN9988zivu2M9hGwB28F94DnwEngd/Asc1EtIs9c/bIPDwCxwLDgezHcodyo4w5C+CCwBS8FnwSXgCnA1uFbI93XwbXAbWAfWgx+CzWAb+An4KfgFeAzsYWWfYuFz4CXwGvgb+Dfo6yNkEEwGh4CZYB44FpwI3g1OY+kfBItZOo2fB84Hy8DF4HJwNbiWpV8PVoO1LH4n2NRXyN+KcAd4kNVP9XsY4aPgcfAbsBfs6SniL4K/sPjfEf6HlanXCRkCw2BGvUh/keWfXS/CY+pFXs7x9XHmM94LTmWIeU2cgbxnS/k/B3kf86jDhU8L9V2E40vAFWAlWFUfb++NOL4F3C7JX4/4GiE+hvgWsF0oS7mXldspnN+F493gyXrh9xTav0cg3EvzgVfBG6wsmVSEkxBOBgdPGpd7JI6PnqRvJ68/xlbHof53gPeA94OzwLngk+ACsAwsByvASrAK3MB0Ws3CtQjvBJvAVrADPMDSHkb4CNijaccTwvnf4fiPEs8Lxy+D18A/QU8/xjgYBjPAbDAKTgYLwOngTHAO+EQ/8wuEF4EvsPiVCFf2+9tsFStzA8LVHuXXBsi6QyqzUYiPMR/7Mc7dAx7oL8bzw/3u/Bw8Bp4Az4AXwCtgHzsmDXP5fiF9iiVvly5d0sHngar16NKlS5cuXbp06fLmYlqHXrcd3ph4P0THUY3iXh49novju4S0tzfs5d+JPKewfAsRntZb3K9ZhOMlrO6lCC8An28U9+OuovcPcPxlVu5rCL/VmHh/iHIrzn3fIPu7SN8Axmg+8AOwEWwCm7tp3bRuWjetm5Y8bSu4B9zbKO6ZVsnORrVU3f4uXTqZ2H3sLoyx3eDXjfDndE9qyj6L838CfwVvgFpzYnof4oNgOhgBc8Fos9DrZIQLmtXPP1MmF6wGj4H+KXoWguvADkXaPil+YpuQy8Am8Ey7ODdtmJDF4HowBp4De6HDTNjhfHAHeBr0DBBy0kDxfPbcgSIusgrcWhtnJ8vL+TPix7UIOQtcBq4C28Cr4KRBnANbwSuDE+s50JgyNNFuXbp06XIgsXjIvPafjvXozKY+fVFz/z0LT1uCtKVSWbrOLWPnztG8e0Xfy7ol8XtZJi7WtG+5od2UFXQ/A12vUeS7jp27yVKHjdsU9lXB869TyNvAzt0lpP2oWbwLdjiO78bx/Sz+EMJHwK9Y/LcIfw+eZ3F67/Hl5vh9xX80J+rwX8SvRDhpgL17iPAQMHNArfPrqHPewLheI+AERV6efwV418B4nOZ/H+IfYHV8GOF5LJ3eAz0fx8sM9S0fUNud39O9CulfGZhY5huI3wzWgNvBelbHZoTbNPVpfYjKQpkHwUNgl0LWblbnk0LbbDxr0OMFpL3iqWdu9nWYPlVAWkXY39LnGdCkDbeqv1YNbfcMQ3t9oe8lzm6NH9N1ZB6Ln4BwfkJZJk7RyFnYKt6b/JDQXx9p5X+eFdqOjzM9P9MB/lUlFzr20aXIdzlY4dmn9F3YqtvoO76/2hp/D/xA5Zue88nNyL8GbFbs075X0tyUig3Qd2MCnf//HjnzpbsR3g9+1kHzzVjdnE71/qVBX9rGPUh/ysNWe1neFzvIDi5zAufV1sT0N0poR22wkFUfTOPfA4N2mbZ5fSrqOHSw+IbkSBbOGSzSRgf91/GTUWYBOB2cIZQ/G8cfBZ8CFwrnL8XxF8FKcA24jqXdiPA7Qr61OF7H4mMItwzuv2/YLth1ISt3Hzu3k4W7EH5JqPdRHD/O4k+z8A8IX5Lq3y7Z4nXE9xn6kX6vQ4bKfy+ok+hH+xf3hq9dnTTHhjKd2GmDuWA242iHMq4cC7A8kJ7i8o1+skSa7Jieo38HCWnoNjKFhdSFBxzpZ7QE6lI8N4S14aASZcryaV/WWHw66f6NHuCoxuQxmvM56GX9QMd8Q4D65ywGP+ZzRJuM+zQvx/MOS2VFeqQ4IXnH26zM9Xe6/E6D+4foAzzuajPZp8Qyw5ayZVDWuH0z0BtYRkeIDqH9KO9VbH1btd/lhNqCzvl8zeLnG0S/hnU6baHfpiuO6yy0rd+DHURo/zYF5H26j03rQsip2ndzz82u1z9N4VjWKWeb68Tedpt95HRVXp7H1R6p+/Wt4FPy/PpWwscOLRJ+PVWF/+W0iVyGzs18TIvXkOJ1Wxm66vSXz+vylenrZcj1ub439W+K8RNCGTJi2p/TJ1K23VaXr35tRpnzmjxequgfcfyk6B/TGBVlyedsNgpdd/h+W1U3P99QyFPNo1X3TwpM/WLTIWYfoBqXrv6iskHZ/RFr79R6hIyHBrH3f1nrUVnjP8SnZZ+rYtzr9Exld5MNbPNErusAPg+77u/eDOPftU9yj39TH7rezxd1LvsZQJlzkWlOirG/79zjMj/mtHUKu7vKy+3/LnXr9okyKedjX5/0He9iP/j63LwOQdarEVlfy8OO/Lqw023j6xcqmwxLiOd6heM2i9cV9LJy8jMJ23yQ+rpbfu7EQ/pXE8KYvUSqvVnb4XzZa6LrHMXHR+zcLvqWbm/Bn0/HzIs6fWPHoat8XfnDKmZGxRxeMbn2UqZ5Q94nmcZRbqqUXbZ8+lcjE+cPX11t814orvvAXNcG8vqj2vvk1MGn3anlj0bIT72v47bvE+Lc98T9b6r7AKn6j+8Duf7D0nnZx/j7Zjn0j9nbpSTndaLr9WNLivP+iN23xF7L+fqv6ZouFyb78jxVXvv5jJ9YUs9/sddO8h7KNg5jrhfaJGztT6G7KF+1d6yCmD5Kdb2fan60rSc552fZr3zeQ9DpnPp+Si5cx5Ktv2QfSzF/mMbWdOm46rFI4XstnU9xeqX4NKb7TKEdcr6pZOK3ID1k/LvFHkVczEuZLEDr499YqvqBym1aEHWgcvoYOtv0M91qQl5TfpO/in6rWx8OVpT1Wedkv3f5xom3T/xeR/6Gx6V86PWAOB4bBpqWdN+yTcVxjIyGRz/FrDGu6w/3d7kPm8StX8RyPu+uuvpNju/vTLJV37GpvoM0oZPnW87VLnL/5pDno1NoW1R6yedU6TyUv3u19a3KFnIbTLYz+ZCLP4T0tU1uivFgso0pnsJ/UtXvarNY28Xq5cvkBDrQP/E5ZaiuQwwfmTlsOiQRU1fMuqrDd/3ISSuwjOwXOfTyGUMpZIXq4GpLn3pUcdfzch2x7XO1u2uZHOPb1G6b3Xg9PH1IIWeEpJlPQtqos2EKW8b0u8rnuP1UeVLoXJb9be0uG9nnbchjU+XTszT5VeNBThPHnc5OKj1U9aj0GTHIVaGy1YhEWT4ixns00DT+XEzWn/7VAsIc63Cov3OdyhwjrnaqQqZvWKXdypRdlq+k8msZ031U+Rm4fA+3TtyeR9hwfW9G9yxDN0fZMN33F+9TE6md4hwoxumfaUzI9fN3PFT3xVV2msrQ3UsnChm6Nulk8TndpS28D3zX9tTIPsF/z7Am5OkTjm1tI1JZW74+4VgsZ0N3L1yXV3WeP5uR7TGHHdvC3JQlxybfpd22tDlk/2eofRK8TzrN/qnar/K/OUTth6I/+jAnEptNbPvFHP2gs40N3+dfMWtwqvVct7/wfd8gtQ7imifial9ZJ9/3IHLYU6eDj3+4PhsNhX+vwvcWLnu6kGfEMe8DuciPfUfGZB8X/7HJy/Gefe5n+VRGFd/wyP2ta7/LO4yh/sbLV/k9lev6kfO9Dt/5U67b1/6u/epqB1U9Me23jfHY9sscAg4tkbLl+e4/U36rJ9ddxfd6sg5vq5ice42Wpk/pb9FOJ36/W9tpv4kbC79nUbZceX8Zu6/qJ+P3WvhvA8v3reh7Jbn2d6rrNC7XNZTLma4Ba0JI9efX2uLzF5scG/w9UNU1ZxW+ymUfzELeTllXlQ1rUuhzjS5fp9c964iFBOqeSz63bU065nZKdU+mDEz3qHIjjifquw0pnb/raRtvrnsYcb46ihT3taoYz6brdNW9l6rWRnE/navdPn1XlR1km7hcz1WlH/elKuSOSvLLuE8U6m8uzwRdfcGl73VyTHuyMvzJ1Sa2cWDTP/Z63Kc94n2B1PYr24dz1JlyHLlcP+S4B6vD1c9EW4q2LWstCvUjeVy63k/LMYdUNd5D1xQfvVTzX1VjkMsUv88N8VH5fReVn/Fjn++/h6X6Q8a6b1/q3g/i/ewi0/Scs8zxXeV6mWIOUPlPzBgdFerW+bZrm2P18dnjuK6HunEp+rHvPMXbr+sHVb/lnL+pTP57jPw9Cvk3PW178JD9qChfzuvTf7Htl38L1QUf/VKu9SFjwWbTWPvFEvu7Uq76y7+31g6QlYPc669pbsm9Xur2LWI9Pu8ypfDXqm3A2z8s1FWGn4ntL9NfQu2oSlftX9uetvTtv7J8Ql4zxfXGZ3zk8PeQ9w59x2uMfqI8/q5eKh/l9cb2rwsu9rSNl06ZP2Pmxtz+rNMx93yno0n2/82rVH7rQ+y9P15H6FyRun9ViH81ATmffI7nJ5r8uXXW6enbP6b/B8/l5OifVHYLnb9S39s2zcc+Ph+rh8+eQgVPS72elzGWY/tUtbbabBpDiI7yN1q6/4th2y+ErAc5+9BVvu/7KamJbWNZeuqI/R4tRf+YyD1HmOZM1bMV3/14Sn10c0Xu+Sj1nOXb5jL73ncdy02uvlXZNde65dOHYl7Vs4KYuS6FzWLn2zJlpZqPXPVPOa5yzKOyn1VhT9lmMfdbfH7D11Wf2PXN5h9y+dD287+qxgSnaYmnIrRtIb8pJe6/Uv9OVer6Whn0zfGO/BEloZI9ojmfAlUflClDd178bTmVHVTpZXOkAlk/lb42UujmI89HH5V+cl7XtowY6vTxLVWok6UrGzoGTHN+bB+6ri05687VNpvfuvRfaP2uMlNQth1D5JjGelm/8yn+9p3p/7qk9gnfeddXZmq/Sm333PJT659Kv1zjNbZ9uv2Oi//67CV8/N1nj1DmviyXDNVeJkaeaX8UsyesYg8cu2+NvdaPfb+lLDu5tvt/`)),Km=function(e){switch(e){case 33:case 39:case 40:case 42:return 12;case 35:return 5;default:return e}},qm=function(e){switch(e){case 37:case 38:return 34;case 41:return 22;default:return e}},Jm=class{constructor(e,t=!1){this.position=e,this.required=t}};Tm=class{nextCodePoint(){let e=this.string.charCodeAt(this.pos++),t=this.string.charCodeAt(this.pos);return 55296<=e&&e<=56319&&56320<=t&&t<=57343?(this.pos++,1024*(e-55296)+(t-56320)+65536):e}nextCharClass(){return Km(Gm.get(this.nextCodePoint()))}getSimpleBreak(){switch(this.nextClass){case 41:return!1;case 34:case 37:case 38:return this.curClass=34,!1;case 36:return this.curClass=36,!1}return null}getPairTableBreak(e){let t=!1;switch(Wm[this.curClass][this.nextClass]){case 0:t=!0;break;case 1:t=e===41;break;case 2:if(t=e===41,!t)return t=!1,t;break;case 3:if(e!==41)return t}return this.LB8a&&(t=!1),!this.LB21a||this.curClass!==16&&this.curClass!==17?this.LB21a=this.curClass===13:(t=!1,this.LB21a=!1),this.curClass===28?(this.LB30a++,this.LB30a==2&&this.nextClass===28&&(t=!0,this.LB30a=0)):this.LB30a=0,this.curClass=this.nextClass,t}nextBreak(){if(this.curClass==null){let e=this.nextCharClass();this.curClass=qm(e),this.nextClass=e,this.LB8a=e===31,this.LB30a=0}for(;this.pos<this.string.length;){this.lastPos=this.pos;let e=this.nextClass;if(this.nextClass=this.nextCharClass(),this.curClass===34||this.curClass===36&&this.nextClass!==37)return this.curClass=qm(Km(this.nextClass)),new Jm(this.lastPos,!0);let t=this.getSimpleBreak();if(t===null&&(t=this.getPairTableBreak(e)),this.LB8a=this.nextClass===31,t)return new Jm(this.lastPos)}return this.lastPos<this.string.length?(this.lastPos=this.string.length,new Jm(this.string.length)):null}constructor(e){this.string=e,this.pos=0,this.lastPos=0,this.curClass=null,this.nextClass=null,this.LB8a=!1,this.LB21a=!1,this.LB30a=0}};var Ym=class{constructor(e){this._textMeasurer=e}_measureText(e){let t=this._fontSize,n=this._fontName,r=this._metricOptions;if(this._isSuperSub){let i=this._textMeasurer(e,.6*t,n,r);return{...this._textMeasurer(`M`,t,n,r),width:i.width}}return this._textMeasurer(e,t,n,r)}_breakWord(e,t,n){let r=0;for(;r<e.length;){let i={startPosition:this._charactersRead+r,text:``,x:0,y:0,width:0,widthWhitespace:0,height:0,baseline:0},a=!1,o=0,s=this._maxWidth;do{a=!1;let t=e.substring(r,r+o+1),n=t.replace(/\s+$/,``),c=this._measureText(n),l=c;t.length!==n.length&&(l=this._measureText(t)),(i.x+c.width<=s||t.length<=1)&&(i.text=t,i.width=c.width,i.widthWhitespace=l.width,i.height=Math.max(i.height,c.lineHeight),i.baseline=Math.max(i.baseline,c.baseline),a=!0,o++)}while(a&&r+o<e.length);if(a){let n=e.substring(r,e.length),i=n.replace(/\s+$/,``),a=this._measureText(i),o=a;n.length!==i.length&&(o=this._measureText(n)),t.startPosition=this._charactersRead+r,t.width=a.width,t.widthWhitespace=o.width,t.height=Math.max(t.height,a.lineHeight),t.baseline=Math.max(t.baseline,a.baseline),t.text=n}else if(!1===n?.(i))return!1;r+=o}}_breakWhiteSpace(e,t=null){for(;e&&this._charactersRead<e.length;){let n={startPosition:this._charactersRead,text:``,x:0,y:0,width:0,widthWhitespace:0,height:0,baseline:0},r=!1,i=this._maxWidth,a=this._indent,o=this._breaker;do if(r=!1,n.startPosition===0&&n.text.length===0&&(n.x=a,this._lastBreak=o.nextBreak()),this._lastBreak){let a=e.substring(n.startPosition,this._lastBreak.position),s=a.replace(/\s+$/,``),c=this._measureText(s),l=c;a.length!==s.length&&(l=this._measureText(a)),n.x+c.width<=i?(n.text=a,n.width=c.width,n.widthWhitespace=l.width,n.height=Math.max(n.height,c.lineHeight),n.baseline=Math.max(n.baseline,c.baseline),r=!0,this._charactersRead=this._lastBreak.position):n.text.length===0&&!1!==this._breakWord(a,n,t)&&(r=!0,this._charactersRead=this._lastBreak.position),(r||a.indexOf(`
|
|
4
|
-
`)===-1)&&this._lastBreak.required&&(this._lastBreak=o.nextBreak(),r=!1)}while(r&&(this._lastBreak=o.nextBreak()));if(!1===t?.(n))return!1}}wrap(e,t=null){this._breaker=new Tm(e),this._linesRead=[],this._charactersRead=0,this._maxXRead=0,this._maxXWhitespaceRead=0,this._maxYRead=0,this._fontName=t?.fontName??`Arial`,this._fontSize=t?.fontSize??12,this._metricOptions={isBold:t?.bold??!1,isItalic:t?.italic??!1,letterSpacing:t?.letterSpacing??0},this._isSuperSub=t?.superSub??!1,this._indent=t?.indent??0,this._maxWidth=t?.maxWidth??2**53-1,this._maxWidth<=0&&(this._maxWidth=2**53-1),this._maxHeight=t?.maxHeight??2**53-1,this._maxHeight<=0&&(this._maxHeight=2**53-1);let n=e=>{if(this._linesRead.length>0){let t=this._linesRead[this._linesRead.length-1];e.y=t.y+t.height}if(e.y+e.height>this._maxHeight)return!1;this._maxXRead=Math.max(this._maxXRead,e.x+e.width),this._maxXWhitespaceRead=Math.max(this._maxXWhitespaceRead,e.x+e.widthWhitespace),this._maxYRead=Math.max(this._maxYRead,e.y+e.height),this._linesRead.push(e)};if(e===``){let t=this._measureText(e);n({startPosition:0,text:``,x:0,y:0,width:0,widthWhitespace:0,height:t.lineHeight,baseline:t.baseline})}else if(this._breakWhiteSpace(e,n),new Tm(e.charAt(e.length-1).repeat(2)).nextBreak().required){let t=this._measureText(e);n({startPosition:e.length,text:``,x:0,y:0,width:0,widthWhitespace:0,height:t.lineHeight,baseline:t.baseline})}let r={bounds:{x:0,y:0,width:this._maxXRead,widthWhitespace:this._maxXWhitespaceRead,height:this._maxYRead},lines:this._linesRead};return this._breaker=null,this._linesRead=[],r}};function Xm(e){let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>=65&&i<=90?t=!0:i>=97&&i<=122&&(n=!0),t&&n)return 0}return t?1:n?-1:0}function Zm(e,t,n,r,i=!1){if(e==null)return null;let a=new Im({text:e,fontName:t.toCSS().fontFamily,fontSize:t.getSize(),bold:t.getWeight()>400,italic:t.getStyle()===U.Style.Italic,superSub:!i&&(t.getVerticalAlignment()===U.VerticalAlignment.Sub||t.getVerticalAlignment()===U.VerticalAlignment.Super),letterSpacing:t.getLetterSpacing()}),s=i?o.HorizontalAlignment.Left:n.getHorizontal(),c=n.getVertical(),l=new Fm({runs:[a],align:s}),u=[];return u.push(new Lm(null,t.getSize(),[a])),new Mm({paragraphs:[l],wrapped:r&&(n.getOverflow()===o.Overflow.Wrap||s===o.HorizontalAlignment.Justify||s===o.HorizontalAlignment.Distributed||c===o.VerticalAlignment.Justify||c===o.VerticalAlignment.Distributed),verticalAlignment:c},t,n,u)}var Qm={[Y.BuiltInSheetPattern.Gray0625]:{path:`M 0.5 0.5 L 0.5 1.5 M 0.5 4.5 L 0.5 5.5 M 4.5 2.5 L 4.5 3.5 M 4.5 6.5 L 4.5 7.5`,size:8},[Y.BuiltInSheetPattern.LightGray]:{path:`M 0.5 0.5 L 0.5 1.5 M 0.5 2.5 L 0.5 3.5 M 2.5 -0.5 L 2.5 0.5 M 2.5 1.5 L 2.5 2.5 M 2.5 3.5 L 2.5 4.5`,size:4},[Y.BuiltInSheetPattern.MediumGray]:{path:`M 0.5 0.5 L 0.5 1.5 M 1.5 1.5 L 1.5 2.5 M 1.5 -0.5 L 1.5 0.5 M -0.5 -0.5 L -0.5 0.5`,size:2},[Y.BuiltInSheetPattern.DarkGray]:{path:`M 0 0 L 0 4 M 1 1 L 1 2 M 1 3 L 1 4 M 2 0 L 2 4 M 3 0.5 L 3 1.5 M 3 2.5 L 3 3.5 M 4 0 L 4 4`,size:4},[Y.BuiltInSheetPattern.LightHorizontal]:{path:`M 0 2 L 4 2`,size:4},[Y.BuiltInSheetPattern.DarkHorizontal]:{path:`M 0 2 L 4 2 M 0 3 L 4 3`,size:4},[Y.BuiltInSheetPattern.LightVertical]:{path:`M 2 0 L 2 4`,size:4},[Y.BuiltInSheetPattern.DarkVertical]:{path:`M 2 0 L 2 4 M 3 0 L 3 4`,size:4},[Y.BuiltInSheetPattern.LightUp]:{path:`M 0.5 0.5 L 0.5 1.5 M 1.5 3.5 L 1.5 4.5 M 1.5 -0.5 L 1.5 0.5 M 2.5 2.5 L 2.5 3.5 M 3.5 1.5 L 3.5 2.5`,size:4},[Y.BuiltInSheetPattern.DarkUp]:{path:`M 0.5 -0.5 L 0.5 1.5 M 0.5 3.5 L 0.5 4.5 M 1.5 2.5 L 1.5 4.5 M 2.5 1.5 L 2.5 3.5 M 3.5 0.5 L 3.5 2.5 M 1.5 -0.5 L 1.5 0.5`,size:4},[Y.BuiltInSheetPattern.LightDown]:{path:`M 0.5 0 L 0.5 1 M 1.5 1 L 1.5 2 M 2.5 2 L 2.5 3 M 3.5 3 L 3.5 4`,size:4},[Y.BuiltInSheetPattern.DarkDown]:{path:`M 0.5 -0.5 L 0.5 2 M 1.5 1 L 1.5 3 M 2.5 2 L 2.5 4 M 3.5 3 L 3.5 5 M 3.5 -0.5 L 3.5 1.0`,size:4},[Y.BuiltInSheetPattern.LightGrid]:{path:`M 1.5 -0.5 L 1.5 4.5 M -0.5 1.5 L 4.5 1.5`,size:4},[Y.BuiltInSheetPattern.DarkGrid]:{path:`M 0.5 -0.5 L 0.5 1.5 M 1.5 -0.5 L 1.5 1.5 M 2.5 1.5 L 2.5 3.5 M 3.5 1.5 L 3.5 3.5 M 0.5 3.5 L 0.5 4.5 M 1.5 3.5 L 1.5 4.5`,size:4},[Y.BuiltInSheetPattern.LightTrellis]:{path:`M 0.5 0.5 L 0.5 1.5 M 1.5 3.5 L 1.5 4.5 M 1.5 -0.5 L 1.5 0.5 M 2.5 2.5 L 2.5 3.5 M 3.5 1.5 L 3.5 2.5 M 1.5 1.5 L 1.5 2.5 M 3.5 3.5 L 3.5 4.5 M 3.5 -0.5 L 3.5 0.5`,size:4},[Y.BuiltInSheetPattern.DarkTrellis]:{path:`M 0 0 L 4 0 M 0 1 L 2 1 M 0 2 L 4 2 M 2 3 L 4 3 M 0 4 L 4 4`,size:4},[Y.BuiltInSheetPattern.Gray125]:{path:`M 0.5 0.5 L 0.5 1.5 M 0.5 4.5 L 0.5 5.5 M 2.5 2.5 L 2.5 3.5 M 2.5 6.5 L 2.5 7.5 M 4.5 0.5 L 4.5 1.5 M 4.5 4.5 L 4.5 5.5 M 6.5 2.5 L 6.5 3.5 M 6.5 6.5 L 6.5 7.5`,size:8}},$m=Qm[Y.BuiltInSheetPattern.Gray125],eh=(e,t,n)=>`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${t}' viewBox='0 0 ${t} ${t}' shape-rendering='crispEdges' %3E%3Cpath d='${e}' stroke='${n}' %3E%3C/path%3E%3C/svg%3E")`,th=new class{_svgImage(e,t,n){let{path:r,size:i}=n;return{backgroundImage:eh(r,i,e),backgroundRepeat:`repeat`,backgroundSize:`${i}px ${i}px`,backgroundPositionX:`0px`,backgroundPositionY:`0px`,backgroundPosition:``+-i,backgroundColor:t}}toCSS(e,t,n){return e&&e!==Y.BuiltInSheetPattern.None?e===Y.BuiltInSheetPattern.Solid?{background:n}:this._svgImage(t,n,Qm[e]??$m):{background:`none`}}toCSSMask(e,t,n){if(!e||e===Y.BuiltInSheetPattern.None||e===Y.BuiltInSheetPattern.Solid)return null;let{path:r,size:i}=Qm[e]??$m;return{base:{backgroundColor:n},marks:{backgroundColor:t,maskImage:eh(r,i,`black`),maskRepeat:`repeat`,maskSize:`${i}px ${i}px`,maskPosition:`0px 0px`}}}};function nh(e,t){if(e===void 0)return;if(e===null)return null;if(e.isIStyle)return e.getAuthoredProperties();let n;return n=typeof e==`function`?e(typeof t==`function`?t():t):e,n}var rh=class{constructor(e){this._p=Object.freeze(Array.isArray(e)?e:[e??null])}value(e){let t=this._p;for(let n=t.length-1;n>=0;n--){let r=t[n];if(!r)continue;let i=r[e];if(i!==void 0)return i}}values(e){let t,n=this._p,r=n.length;for(let i=0;i<r;i++){let r=n[i];if(!r)continue;let a=r[e];a!==void 0&&(t===void 0&&(t=[]),t.push(a))}return t}getProperties(){let e=this._p;return e?e[e.length-1]:null}toJSON(){let t=this._p,n=t.length,r={};for(let i=0;i<n;i++){let n=t[i];r=e.A.deepMerge(r,n)}return r}},ih=class{constructor(e,t){this._o=e,this._c=e.styles,this._p=Object.freeze(t)}_setValue(e,t){let n={[e]:t};this._o.updater(n)}_value(e){let t=this._p;for(let n=t.length-1;n>=0;n--){let r=t[n];if(!r)continue;let i=r[e];if(i!==void 0)return i}}_values(e){let t,n=this._p,r=n.length;for(let i=0;i<r;i++){let r=n[i];if(!r)continue;let a=r[e];a!==void 0&&(t===void 0&&(t=[]),t.push(a))}return t}getProperties(){let e=this._p;return e?e[e.length-1]:null}toJSON(){return null}},ah=t=>{switch(t){case`top`:return e.v(`op.setTopBorderStyle`);case`right`:return e.v(`op.setRightBorderStyle`);case`bottom`:return e.v(`op.setBottomBorderStyle`);case`horizontal`:return e.v(`op.setHorizontalBorderStyle`);case`vertical`:return e.v(`op.setVerticalBorderStyle`);case`diagonalUp`:return e.v(`op.setDiagonalUpBorderStyle`);case`diagonalDown`:return e.v(`op.setDiagonalDownBorderStyle`);default:return e.v(`op.setLeftBorderStyle`)}},oh=t=>{switch(t){case`top`:return e.v(`op.setTopBorderColor`);case`right`:return e.v(`op.setRightBorderColor`);case`bottom`:return e.v(`op.setBottomBorderColor`);case`horizontal`:return e.v(`op.setHorizontalBorderColor`);case`vertical`:return e.v(`op.setVerticalBorderColor`);case`diagonalUp`:return e.v(`op.setDiagonalUpBorderColor`);case`diagonalDown`:return e.v(`op.setDiagonalDownBorderColor`);default:return e.v(`op.setLeftBorderColor`)}},sh=class extends ih{constructor(e,t,n){super(t,n),this._edge=e}getStyle(){return this._value(`style`)}setStyle(e,t){let n=this._edge,r=n.charAt(0).toUpperCase()+n.slice(1);return this._o.updater({border:{[n]:{style:e}}},{description:ah(n),...t}).getBorder()[`get`+r]()}getColor(){let e=this._value(`color`);return e?this._c.parseColor(e):null}setColor(e,t){let n=this._edge,r=n.charAt(0).toUpperCase()+n.slice(1);return this._o.updater({border:{[n]:{color:e}}},{description:oh(n),...t}).getBorder()[`get`+r]()}isNone(){return this.getStyle()===W.StrokeStyle.None}toCSS(){let e=Np(this);switch(this._edge){case W.Edge.Left:return{borderLeft:e};case W.Edge.Right:return{borderRight:e};case W.Edge.Top:return{borderTop:e};case W.Edge.Bottom:return{borderBottom:e};case W.Edge.DiagonalUp:case W.Edge.DiagonalDown:return{borderDiagonalUp:e}}}get[Symbol.toStringTag](){return`[CellBorderStroke]`}toString(){return`[CellBorderStroke]`}get isIStroke(){return!0}},ch=class extends ih{getLeft(){return this._left||=new sh(W.Edge.Left,this._o,this._values(W.Edge.Left)),this._left}setLeft(t,n){return this._o.updater({border:{left:t}},{description:e.v(`op.setLeftBorder`),...n}).getBorder()}getRight(){return this._right||=new sh(W.Edge.Right,this._o,this._values(W.Edge.Right)),this._right}setRight(t,n){return this._o.updater({border:{right:t}},{description:e.v(`op.setRightBorder`),...n}).getBorder()}getTop(){return this._top||=new sh(W.Edge.Top,this._o,this._values(W.Edge.Top)),this._top}setTop(t,n){return this._o.updater({border:{top:t}},{description:e.v(`op.setTopBorder`),...n}).getBorder()}getBottom(){return this._bottom||=new sh(W.Edge.Bottom,this._o,this._values(W.Edge.Bottom)),this._bottom}setBottom(t,n){return this._o.updater({border:{bottom:t}},{description:e.v(`op.setBottomBorder`),...n}).getBorder()}getHorizontal(){return this._inner(W.Edge.Horizontal)}getVertical(){return this._inner(W.Edge.Vertical)}_inner(e){let t=this._o.extent;if(!t)return null;let n=this._o.direct;if(!(n instanceof Dm))return null;let r=n.getInnerBorder(t)?.[e];return r?new sh(e,this._o,[r]):null}getDiagonalUp(){return this._diagUp||=new sh(W.Edge.DiagonalUp,this._o,this._values(W.Edge.DiagonalUp)),this._diagUp}setDiagonalUp(t,n){return this._o.updater({border:{diagonalUp:t}},{description:e.v(`op.setDiagonalUpBorder`),...n}).getBorder()}getDiagonalDown(){return this._diagDown||=new sh(W.Edge.DiagonalDown,this._o,this._values(W.Edge.DiagonalDown)),this._diagDown}setDiagonalDown(t,n){return this._o.updater({border:{diagonalDown:t}},{description:e.v(`op.setDiagonalDownBorder`),...n}).getBorder()}setVertical(t,n){return this._o.updater({border:{vertical:t}},{description:e.v(`op.setVerticalBorder`),...n}).getBorder()}setHorizontal(t,n){return this._o.updater({border:{horizontal:t}},{description:e.v(`op.setHorizontalBorder`),...n}).getBorder()}setOutline(t,n){return this._o.updater({border:{top:t,bottom:t,left:t,right:t}},{description:e.v(`op.setOutlineBorder`),...n}).getBorder()}_edgeStyleIsNone(e){let t=this._values(e);if(!t)return!0;for(let e=t.length-1;e>=0;e--){let n=t[e]?.style;if(n!==void 0)return n===W.StrokeStyle.None}return!0}isEmpty(){return this._isEmpty!==void 0||(this._isEmpty=this._edgeStyleIsNone(W.Edge.Top)&&this._edgeStyleIsNone(W.Edge.Bottom)&&this._edgeStyleIsNone(W.Edge.Left)&&this._edgeStyleIsNone(W.Edge.Right)&&this._edgeStyleIsNone(W.Edge.DiagonalUp)&&this._edgeStyleIsNone(W.Edge.DiagonalDown)),this._isEmpty}get[Symbol.toStringTag](){return`[CellBorder]`}toString(){return`[CellBorder]`}get isIBorder(){return!0}},lh=class extends ih{getHorizontal(){return this._value(`horizontal`)}setHorizontal(t,n){return this._o.updater({alignment:{horizontal:t}},{description:e.v(`op.setHorizontalAlignment`),...n}).getAlignment()}getVertical(){return this._value(`vertical`)}setVertical(t,n){return this._o.updater({alignment:{vertical:t}},{description:e.v(`op.setVerticalAlignment`),...n}).getAlignment()}getIndent(){return this._value(`indent`)}setIndent(t,n){return this._o.updater({alignment:{indent:t}},{description:e.v(`op.setIndent`),...n}).getAlignment()}getRelativeIndent(){return this._value(`relativeIndent`)}setRelativeIndent(t,n){return this._o.updater({alignment:{relativeIndent:t}},{description:e.v(`op.setRelativeIndent`),...n}).getAlignment()}getOverflow(){return this._value(`overflow`)}setOverflow(t,n){return this._o.updater({alignment:{overflow:t}},{description:e.v(`op.setOverflow`),...n}).getAlignment()}getRotation(){return this._value(`rotation`)}setRotation(t,n){return this._o.updater({alignment:{rotation:t}},{description:e.v(`op.setRotation`),...n}).getAlignment()}getStacked(){return this._value(`stacked`)}setStacked(t,n){return this._o.updater({alignment:{stacked:t}},{description:e.v(`op.setStacked`),...n}).getAlignment()}getJustifyLastLine(){return this._value(`justifyLastLine`)}setJustifyLastLine(t,n){return this._o.updater({alignment:{justifyLastLine:t}},{description:e.v(`op.setJustifyLastLine`),...n}).getAlignment()}getReadingDirection(){return this._value(`readingDirection`)}setReadingDirection(t,n){return this._o.updater({alignment:{readingDirection:t}},{description:e.v(`op.setReadingDirection`),...n}).getAlignment()}get[Symbol.toStringTag](){return`[CellAlignment]`}toString(){return`[CellAlignment]`}get isITextBoxAlignment(){return!0}},uh=class extends ih{isEqualMeasure(t){return!!t&&this.getFamily()===t.getFamily()&&!!e.A.isEqualArrays(this.getFallbacks(),t.getFallbacks())&&this.getSize()===t.getSize()&&this.getWeight()===t.getWeight()&&this.getStyle()===t.getStyle()&&this.getStrike()===t.getStrike()&&this.getScheme()===t.getScheme()&&this.getShadow()===t.getShadow()&&this.getOutline()===t.getOutline()&&this.getLetterSpacing()===t.getLetterSpacing()&&this.getVerticalAlignment()===t.getVerticalAlignment()}toCSS(t,n=1,r=!1){let i={fontFamily:_p(this.getFamily(),this.getFallbacks()),letterSpacing:`${this.getLetterSpacing()}px`,fontWeight:this.getWeight(),fontStyle:this.getStyle(),textDecoration:dp(this.getUnderline(),this.getStrike()),color:this.getColor().toCSS(t),fontSize:`${e.A.roundAccurately(this.getSize()*U.getDeviceScale()*n,2)}px`,textRendering:`geometricPrecision`};if(r){let r=this._c.getNormal().getFont().toCSS(t,n,!1),a=i.textDecoration,o=i.fontWeight;e.A.removeEqualValues(i,r),a&&(i.textDecoration=a),o&&(i.fontWeight=o)}return i}isSuperSub(){let e=this.getVerticalAlignment();return e===U.VerticalAlignment.Sub||e===U.VerticalAlignment.Super}isSuperScript(){let e=this.getVerticalAlignment();return e===U.VerticalAlignment.Sub||e===U.VerticalAlignment.Super}getSuperSubScale(){return this.getFamily(),this.getSize(),this.getVerticalAlignment(),.6}getSuperSubShift(){return this.getFamily(),e=this.getSize(),(t=this.getVerticalAlignment())===U.VerticalAlignment.Super?-e/3:t===U.VerticalAlignment.Sub?e/5:0;var e,t}_schemeFamily(){let e=this._value(`scheme`);if(e!==U.Scheme.Major&&e!==U.Scheme.Minor)return;let t=this._c.getTheme().getFontScheme();return e===U.Scheme.Major?t.getMajorFont():t.getMinorFont()}getFamily(){return this._schemeFamily()??this._value(`family`)??this._c.getTheme().getFontScheme().getMinorFont()}setFamily(t,n){return this._o.updater({font:{family:t,scheme:t?U.Scheme.None:null}},{description:e.v(`op.setFontFamily`),...n}).getFont()}getFallbacks(){let t=this._value(`fallbacks`)??this._c.getTheme().getFontScheme().getMinorFallbacks()??e.A.EmptyArray,n=this.getFamily();n===`Aptos Narrow`&&(t=[`Calibri`,...t]);let r=this._schemeFamily()?this._value(`family`):void 0;return r&&r!==n&&!t.includes(r)&&(t=[r,...t]),t}setFallbacks(t,n){return this._o.updater({font:{fallbacks:t}},{description:e.v(`op.setFontFallbacks`),...n}).getFont()}getSize(){return this._value(`size`)??this._c.getDefaultFontSize()??11}setSize(t,n){return this._o.updater({font:{size:t}},{description:e.v(`op.setFontSize`),...n}).getFont()}getWeight(){return this._value(`weight`)}setWeight(t,n){return this._o.updater({font:{weight:t}},{description:e.v(`op.setFontWeight`),...n}).getFont()}getBold(){return this.getWeight()>400}setBold(t,n){let r=t===null?null:t?700:400;return this.setWeight(r,{description:e.v(`op.setFontBold`),...n})}getStyle(){return this._value(`style`)}setStyle(t,n){return this._o.updater({font:{style:t}},{description:e.v(`op.setFontStyle`),...n}).getFont()}getItalic(){return this.getStyle()===U.Style.Italic}setItalic(t,n){let r=t===null?null:t?U.Style.Italic:U.Style.Normal;return this.setStyle(r,{description:e.v(`op.setFontItalic`),...n})}getColor(){let e=this._value(`color`);return this._c.parseColor(e??J.Scheme.Bg1)}setColor(t,n){return this._o.updater({font:{color:t}},{description:e.v(`op.setFontColor`),...n}).getFont()}getLetterSpacing(){return this._value(`letterSpacing`)??this.getSize()/-25}setLetterSpacing(t,n){return this._o.updater({font:{letterSpacing:t}},{description:e.v(`op.setFontLetterSpacing`),...n}).getFont()}getUnderline(){return this._value(`underline`)}setUnderline(t,n){return this._o.updater({font:{underline:t}},{description:e.v(`op.setFontUnderline`),...n}).getFont()}getStrike(){return this._value(`strike`)}setStrike(t,n){return this._o.updater({font:{strike:t}},{description:e.v(`op.setFontStrike`),...n}).getFont()}getScheme(){return this._value(`scheme`)}setScheme(t,n){let r=t===U.Scheme.Major||t===U.Scheme.Minor?{scheme:t,family:null}:{scheme:t};return this._o.updater({font:r},{description:e.v(`op.setFontScheme`),...n}).getFont()}getVerticalAlignment(){return this._value(`verticalAlign`)}setVerticalAlignment(t,n){return this._o.updater({font:{verticalAlign:t}},{description:e.v(`op.setFontVerticalAlignment`),...n}).getFont()}getShadow(){return this._value(`shadow`)}setShadow(t,n){return this._o.updater({font:{shadow:t}},{description:e.v(`op.setFontShadow`),...n}).getFont()}getOutline(){return this._value(`outline`)}setOutline(t,n){return this._o.updater({font:{outline:t}},{description:e.v(`op.setFontOutline`),...n}).getFont()}getExtend(){return this._value(`extend`)}setExtend(t,n){return this._o.updater({font:{extend:t}},{description:e.v(`op.setFontExtend`),...n}).getFont()}getCharset(){return this._value(`charset`)??null}setCharset(t,n){return this._o.updater({font:{charset:t}},{description:e.v(`op.setFontCharset`),...n}).getFont()}get[Symbol.toStringTag](){return`[StyledFont]`}toString(){return`[StyledFont]`}get isIStyledFont(){return!0}},dh=Object.freeze({background:`none`}),fh=class extends ih{getType(){return Y.Type.None}getColor(){return null}setColor(t,n){return t===null?this:this._o.updater({fill:{color:t}},{description:e.v(`op.setFillColor`),...n}).getFill()}toCSS(e){return dh}hasVisibleStyling(){return!1}isEqual(e){return!!e&&e.getType()===Y.Type.None}toJSON(){return{type:Y.Type.None}}get[Symbol.toStringTag](){return`[NoneFill]`}toString(){return`[NoneFill]`}get isIFill(){return!0}},ph=class extends ih{getType(){return Y.Type.Solid}getColor(){return this._c.parseColor(this._value(`color`)??J.Scheme.Bg1)}setColor(t,n){return this._o.updater({fill:{color:t}},{description:e.v(`op.setFillColor`),...n}).getFill()}toCSS(e){return{background:this.getColor().toCSS(e)}}hasVisibleStyling(){let e=this._o.styles?.getNormal();return!e||!e.getFill().isEqual(this)}isEqual(e){return!!e&&e.getType()===Y.Type.Solid&&!!e.getColor().isEqual(this.getColor())}toJSON(){return{type:Y.Type.Solid,color:this.getColor()?.toString()??null}}get[Symbol.toStringTag](){return`[SolidFill]`}toString(){return`[SolidFill]`}get isIFill(){return!0}},mh=class extends ih{constructor(e,t,n,r){super(n,r),this._i=e,this._l=t}getOffset(){return this._value(`offset`)??this._i/this._l*100}getColor(){return this._c.parseColor(this._value(`color`)??J.Scheme.Bg1)}},hh=class extends ih{getType(){return Y.Type.Gradient}getColor(){let t=this._value(`stops`)??e.A.EmptyArray,n=t.length;return n===0?null:new mh(0,n,this._o,[t[0]]).getColor()}setColor(t,n){let r=this._value(`stops`)??e.A.EmptyArray,i=r.length>0?{...r[0]}:{offset:0,color:null},a=[...r];return a[0]=i,i.color=t,this._o.updater({fill:{stops:a}},{description:e.v(`op.setFillColor`),...n}).getFill()}getStops(){let t=this._value(`stops`)??e.A.EmptyArray,n=t.length,r=n===0?e.A.EmptyArray:Array(n);for(let e=0;e<n;e++){let i=t[e];r[e]=new mh(e,n,this._o,[i])}return r}setStops(t,n){return this._o.updater({fill:{stops:t}},{description:e.v(`op.setStops`),...n}).getFill()}getGradientType(){return this._value(`gradientType`)??Y.GradientType.Linear}setGradientType(t,n){return this._o.updater({fill:{gradientType:t}},{description:e.v(`op.setGradientType`),...n}).getFill()}getAngle(){return this._value(`angle`)??0}setAngle(t,n){return this._o.updater({fill:{angle:t}},{description:e.v(`op.setAngle`),...n}).getFill()}getFocus(){return this._value(`focus`)??null}setFocus(t,n){return this._o.updater({fill:{focus:t}},{description:e.v(`op.setFocus`),...n}).getFill()}toCSS(e,t){let n=Ap(this,e,t);return n?{background:n}:null}hasVisibleStyling(){return!0}isEqual(e){return!1}toJSON(){let t={type:Y.Type.Gradient},n=this._value(`stops`)??e.A.EmptyArray,r=n.length;if(r>0){let e=Array(r);for(let t=0;t<r;t++){let r=n[t],i={color:r.color.toString()},a=r.offset;a!==void 0&&(i.offset=a),e[t]=i}t.stops=e}return this.getAngle()!==0&&(t.angle=this.getAngle()),this.getGradientType()!==Y.GradientType.Linear&&(t.gradientType=this.getGradientType()),this.getFocus()&&(t.focus=this.getFocus()),t}get[Symbol.toStringTag](){return`[GradientFill]`}toString(){return`[GradientFill]`}get isIFill(){return!0}},gh=class extends ih{getType(){return Y.Type.Pattern}getColor(){return this.getBackground()}setColor(e,t){return this.setBackground(e,t)}getBackground(){let e=this._value(`background`)??J.Named.Window;return this._c.parseColor(e)}setBackground(t,n){return this._o.updater({fill:{background:t}},{description:e.v(`op.setBackgroundColor`),...n}).getFill()}getForeground(){return this._c.parseColor(this._value(`foreground`)??J.Scheme.Tx1)}setForeground(t,n){return this._o.updater({fill:{foreground:t}},{description:e.v(`op.setForegroundColor`),...n}).getFill()}getPatternType(){return this._value(`patternType`)??Y.BuiltInSheetPattern.None}setPatternType(t,n){return this._o.updater({fill:{patternType:t}},{description:e.v(`op.setPatternType`),...n}).getFill()}toCSS(e){if(this.getPatternType()===Y.BuiltInSheetPattern.None)return{background:`none`};if(this.getPatternType()===Y.BuiltInSheetPattern.Solid)return{background:this.getForeground().toCSS(e)};let t=e!==`adaptive`&&e,n=this.getBackground().toCSS(t),r=this.getForeground().toCSS(t);return th.toCSS(this.getPatternType(),r,n)}toCSSMask(e){return th.toCSSMask(this.getPatternType(),this.getForeground().toCSS(e),this.getBackground().toCSS(e))}hasVisibleStyling(){return!0}isEqual(e){if(!e||e.getType()!==Y.Type.Pattern)return!1;let t=e;return t.getPatternType()===this.getPatternType()&&!!t.getForeground().isEqual(this.getForeground())&&!!t.getBackground().isEqual(this.getBackground())}toJSON(){let e={type:Y.Type.Pattern};this.getPatternType()!==Y.BuiltInSheetPattern.None&&(e.patternType=this.getPatternType());let t=this.getForeground();t&&(e.foreground=t.toString());let n=this.getBackground();return n&&(e.background=n.toString()),e}get[Symbol.toStringTag](){return`[PatternFill]`}toString(){return`[PatternFill]`}get isIFill(){return!0}},_h=class{constructor(e){this._o=e,this._p=new rh(e.properties)}toJSON(){let e=this._p.toJSON(),t=e.namedStyle??X.BuiltInName.Normal;return delete e.namedStyle,e.named=t,e}hasVisibleStyling(){if(this._hasVisibleStyling!==void 0)return this._hasVisibleStyling;let e=this.getFill();return this._hasVisibleStyling=!e||e.getType()!==Y.Type.None||!this.getBorder().isEmpty(),this._hasVisibleStyling}isNormal(){return!1}getAuthoredProperties(){let t=this._o,n=t.direct;if(!n)return null;let r=t.range,i=r?.rowStart??e.l.EmptyCell.rowIndex,a=r?.colStart??e.l.EmptyCell.colIndex;return n.getAuthoredPropertiesAt?n.getAuthoredPropertiesAt(i,a,null):n.getPropertiesAt(i,a,null)}createStyle(e){let t=this._o,n=nh(e,this),r=t.range,i=t.direct.cloneWithUpdate(n);return vh(void 0,t.styles,i,r)}measureText(e,t=this.getFont().getSize(),n,r){let i=this.getFont();n||=i.getFamily();let a=i.getFallbacks();n===`Aptos Narrow`&&(a=[`Calibri`,...a]);let o=_p(n,a);return U.getSharedMeasurer()(e,t*U.getDeviceScale(),o,{isBold:i.getWeight()>400,isItalic:i.getStyle().includes(`italic`),letterSpacing:i.getLetterSpacing(),...r})}createTextFrame(e,t=!1){return Zm(e,this.getFont(),this.getAlignment(),t)}update(e,t){return this._o.updater(e,t)}clear(){return this._o.updater(null,{description:e.v(`op.clearStyle`)})}getBestFit(){if(this._bestFit!==void 0)return this._bestFit;let e=this.getInsets(),t=this.measureText(`My`);return this._bestFit={width:null,height:t.lineHeight+e.top+e.bottom},this._bestFit}getInsets(){if(this._insets!==void 0)return this._insets;this.getFont().getSize();let e=(t=this.getFont().getSize(),Math.max(3,Math.round(t<225?t/5:t/3.5)));var t;let n={top:1,left:e,bottom:1,right:e},r=this._p?.value(`insets`);return r&&(r.top!==void 0&&(n.top+=r.top),r.left!==void 0&&(n.left+=r.left),r.bottom!==void 0&&(n.bottom+=r.bottom),r.right!==void 0&&(n.right+=r.right)),this._insets=Object.freeze(n),this._insets}getBorder(){return this._border||=new ch(this._o,this._p.values(`border`)),this._border}setBorder(t,n){return this._o.updater({border:t},{description:e.v(`op.setBorder`),...n})}getFont(){return this._font||=new uh(this._o,this._p.values(`font`)),this._font}setFont(t,n){return this._o.updater({font:t},{description:e.v(`op.setFont`),...n})}getFill(){if(this._fill)return this._fill;let e,t=this._p,n=t.values(`fill`);for(let t=n.length-1;e===void 0&&t>=0;t--)e=n[t]?.type;let r=t.value(`fill`);return e===Y.Type.None?this._fill=new fh(this._o,n):e===Y.Type.Solid||!e&&r.color?this._fill=new ph(this._o,n):e===Y.Type.Gradient?this._fill=new hh(this._o,n):e===Y.Type.Pattern?this._fill=new gh(this._o,n):this._fill=new fh(this._o,n)}setFill(t,n){return this._o.updater({fill:t},{description:e.v(`op.setFill`),...n})}setFillSolid(t){return this._o.updater({fill:{type:Y.Type.Solid}},{description:e.v(`op.setFillSolid`),...t}).getFill()}setFillGradient(t){return this._o.updater({fill:{type:Y.Type.Gradient}},{description:e.v(`op.setFillGradient`),...t}).getFill()}setFillPattern(t){return this._o.updater({fill:{type:Y.Type.Pattern}},{description:e.v(`op.setFillPattern`),...t}).getFill()}setFillNone(t){return this._o.updater({fill:{type:Y.Type.None}},{description:e.v(`op.setFillNone`),...t}).getFill()}getAlignment(){return this._alignment||=new lh(this._o,this._p.values(`alignment`)),this._alignment}setAlignment(t,n){return this._o.updater({alignment:t},{description:e.v(`op.setAlignment`),...n})}getNumberFormat(){let e=this._p.value(`numberFormat`);return typeof e==`number`?Sc(e):e}setNumberFormat(t,n){return this._o.updater({numberFormat:t},{description:e.v(`op.setNumberFormat`),...n})}getQuotePrefix(){return this._p.value(`quotePrefix`)}setQuotePrefix(t,n){return this._o.updater({quotePrefix:t},{description:e.v(`op.setQuotePrefix`),...n})}getNamed(){let e=this._p.value(`named`)??X.BuiltInName.Normal;return this._o.styles.getNamed(e)}setNamed(t,n){let r=t==null?null:typeof t==`string`?t:t.getName();return this._o.updater({named:r},{description:e.v(`op.setNamedStyle`),...n})}get[Symbol.toStringTag](){return`[SheetCellStyle]`}toString(){return`Style: ${yl(this._o.range)}`}get isIStyle(){return!0}};function vh(t,n,r,i,a=bh,o){let s=i?.rowStart??e.l.EmptyCell.rowIndex,c=i?.colStart??e.l.EmptyCell.colIndex,l=[ep],u=n.getNormalRanged(),d=u.getPropertiesAt(s,c,t);d&&l.push(d);let f=(e,t)=>a(e,t,i);if(!r)return new yh({styles:n,range:i,properties:l,direct:u,extent:o,updater:f});let p=r.getPropertiesAt(s,c,t);return p?(l.push(p),new _h({styles:n,range:i,properties:l,direct:r,extent:o,updater:f})):new yh({styles:n,range:i,properties:l,direct:u,extent:o,updater:f})}var yh=class extends _h{isNormal(){return!0}getAuthoredProperties(){return null}};function bh(e){throw Error(`Style is read-only and cannot be updated`)}async function xh(){return globalThis.crypto}var Sh,Ch=async(e,t,...n)=>{let r=wh(...n);return e.subtle.digest(t,r)},wh=(...e)=>{let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(t),r=0;return e.forEach(e=>{n.set(new Uint8Array(e),r),r+=e.byteLength}),n.buffer},Th=e=>{let t=new Uint8Array(e),n=``,r=t.byteLength;for(let e=0;e<r;e++)n+=String.fromCharCode(t[e]);return btoa(n)},Eh=class t{static{this.DefaultAlgo=`SHA-512`}static{this.DefaultSpinCount=1e5}static async generateSaltAndHash(e,n=t.DefaultAlgo,r=t.DefaultSpinCount){if(!e)return null;let i=Th((await xh()).getRandomValues(new Uint8Array(16)).buffer);return{salt:i,hash:await t._convertPasswordToHash(e,i,n,r)}}static async verifyPassword(n,r,i=t.DefaultAlgo,a=t.DefaultSpinCount){if(!n||!r)throw new e.O;return((e,t)=>{let n=e.length,r=t.length,i=n===r?0:1,a=Math.max(n,r);for(let o=0;o<a;o++)i|=e.charCodeAt(o%n)^t.charCodeAt(o%r);return i===0})(await t._convertPasswordToHash(n,r.salt,i,a),r.hash)}static async _convertPasswordToHash(e,t,n,r){let i=await xh();n=n.toUpperCase();let a=(e=>{let t=e.length,n=new ArrayBuffer(2*t),r=new DataView(n);for(let n=0;n<t;n++)r.setUint16(2*n,e.charCodeAt(n),!0);return new Uint8Array(n)})(e),o=(e=>{let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer})(t),s=await Ch(i,n,o,a.buffer);for(let e=0;e<r;e++){let t=new Uint32Array([e]).buffer;s=await Ch(i,n,s,t)}return Th(s)}},Dh=class{constructor(e,t=!1){this._isPaused=!1,this._password=null,this._identities=null,this._properties=null,this._emitter=new v(this),this.fromJSON(e),this._isReadOnly=t}async lock(e,t,n,r){if(this._isReadOnly)return this;if(this.isLocked()&&!this._isPaused)throw Error(`Cannot lock an already locked object. Use unlock first.`);try{this._validatePassword()}catch{throw Error(`A password is already set. Unlock first to change.`)}let i;if(t){let e=await Eh.generateSaltAndHash(t,n,r);i={salt:e.salt,hash:e.hash},n&&(i.algorithm=n),r&&(i.spinCount=r)}else i=null;return e??={},this._updateProperties(e),this._properties=e,this._password=i,this._emitter.notify(`onLockChange`),this._emitter.notify(`onChange`),this}async unlock(e){if(this._isReadOnly)throw Error(`Cannot unlock a readonly workbook.`);return await this._validatePassword(e),this._clearProperties(),this._password=null,this._identities=null,this._password=null,this._emitter.notify(`onLockChange`),this._emitter.notify(`onChange`),this}checkPassword(e){return this._validatePassword(e)}hasPassword(){return this._password!==null}async pause(e){return this._emitter.notify(`onLockChange`),this._emitter.notify(`onChange`),await this._validatePassword(e),this._password&&(this._isPaused=!0),this}resume(){return this._isPaused=!1,this}isPaused(){return this._isPaused}isLocked(){return this._properties!==null&&!this._isPaused}isReadOnly(){return this._isReadOnly}async _validatePassword(e){let t=this._password;if(!t||!t.hash)return!0;if(!e||e.length===0)throw Error(`Password is required.`);if(!await Eh.verifyPassword(e,{salt:t.salt,hash:t.hash},t.algorithm,t.spinCount))throw Error(`Invalid password.`);return!0}getProperties(){return this._properties}_isPropertyAllowed(e){if(this._isReadOnly)return!1;if(!this.isLocked())return!0;let t=this._properties[e];return typeof t==`boolean`&&t}_updateProperties(e){this._properties={...e,...this._properties??{}}}_clearProperties(){this._properties=null}addListeners(e,t){return this._emitter.addListeners(e,t)}fromJSON(e){this._password=null,this._identities=null,this._isPaused=!1,this._properties=null,this._fromJSON(e??null),e&&(e.password&&(this._password=e.password),e.identities&&(this._identities=e.identities))}_fromJSON(e){}_toJSON(e){return e}toJSON(){if(!this._properties)return null;let e={};return e=this._toJSON(e)??{},this._password&&(e.password=this._password),this._identities&&(e.identities=this._identities),e}},Oh=Object.freeze({selectLockedCells:!0,selectUnlockedCells:!0,autoTable:!1,deleteColumns:!1,deleteRows:!1,formatCells:!1,formatColumns:!1,formatRows:!1,insertColumns:!1,insertHyperlinks:!1,insertRows:!1,objects:!1,pivotTables:!1,scenarios:!1,sheet:!1,sort:!1,verifier:null}),kh=class extends Dh{isAutoTableAllowed(){return this._isPropertyAllowed(`autoTable`)}isDeleteColumnsAllowed(){return this._isPropertyAllowed(`deleteColumns`)}isDeleteRowsAllowed(){return this._isPropertyAllowed(`deleteRows`)}isFormatCellsAllowed(){return this._isPropertyAllowed(`formatCells`)}isFormatColumnsAllowed(){return this._isPropertyAllowed(`formatColumns`)}isFormatRowsAllowed(){return this._isPropertyAllowed(`formatRows`)}isInsertColumnsAllowed(){return this._isPropertyAllowed(`insertColumns`)}isInsertHyperlinksAllowed(){return this._isPropertyAllowed(`insertHyperlinks`)}isInsertRowsAllowed(){return this._isPropertyAllowed(`insertRows`)}isObjectsAllowed(){return this._isPropertyAllowed(`objects`)}isPivotTablesAllowed(){return this._isPropertyAllowed(`pivotTables`)}isScenariosAllowed(){return this._isPropertyAllowed(`scenarios`)}isSortAllowed(){return this._isPropertyAllowed(`sort`)}isSelectLockedCellsAllowed(){return!1}isSelectUnlockedCellsAllowed(){return!1}_updateProperties(e){super._updateProperties(e),this._properties=e}_clearProperties(){super._clearProperties(),this._properties=null}_fromJSON(e){super._fromJSON(e),this._properties=e}_toJSON(e){let t=this._properties;if(t){e={...e,...t};let n=Object.keys(t);for(let r=0;r<n.length;r++){let i=t[n[r]];i!=null&&i!==Oh[n[r]]&&(e[n[r]]=i)}}return super._toJSON(e)}get[Symbol.toStringTag](){return`[SheetProtection]`}toString(){return null}},Ah=t=>typeof t==`string`?e._(`error.address.invalidRangeAddress`,{address:t}):e._(`error.address.invalidRangeAddressAny`),Z=()=>{throw Error(e._(`error.address.invalidRangeEmpty`))},jh={hasSubscribers:!1},Mh=jh,Nh=jh,Ph=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,Fh=()=>Mh.hasSubscribers||Nh.hasSubscribers,Ih=new Set,Lh=typeof process==`object`&&process?process:{},Rh=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),zh=e=>Rh(e)?e<=256?Uint8Array:e<=65536?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?Bh:null:null,Bh=class extends Array{constructor(e){super(e),this.fill(0)}},Vh=class e{heap;length;static#e=!1;static create(t){let n=zh(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Hh=class e{#e;#t;#n;#r;#i;#a;#o;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;backgroundFetchSize;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#x,autopurgeTimers:e.#S,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#f,next:e.#p,prev:e.#m,get head(){return e.#h},get tail(){return e.#g},free:e.#_,isBackgroundFetch:t=>e.#W(t),backgroundFetch:(t,n,r,i)=>e.#U(t,n,r,i),moveToTail:t=>e.#X(t),indexes:t=>e.#I(t),rindexes:t=>e.#L(t),isStale:t=>e.#j(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#o}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:_,memoMethod:v,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:S,ignoreFetchAbort:C,backgroundFetchSize:w=1,perf:T}=t;if(this.backgroundFetchSize=w,T!==void 0&&typeof T?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(this.#s=T??Ph,n!==0&&!Rh(n))throw TypeError(`max option must be a nonnegative integer`);let E=n?zh(n):Array;if(!E)throw Error(`invalid max value: `+n);if(this.#e=n,this.#t=m,this.maxEntrySize=h||this.#t,this.sizeCalculation=g,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(v!==void 0&&typeof v!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#o=v,_!==void 0&&typeof _!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#a=_,this.#w=!!_,this.#u=new Map,this.#d=Array.from({length:n}).fill(void 0),this.#f=Array.from({length:n}).fill(void 0),this.#p=new E(n),this.#m=new E(n),this.#h=0,this.#g=0,this.#_=Vh.create(n),this.#c=0,this.#l=0,typeof l==`function`&&(this.#n=l),typeof u==`function`&&(this.#r=u),typeof d==`function`?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#C=!!this.#n,this.#E=!!this.#r,this.#T=!!this.#i,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!C,this.maxEntrySize!==0){if(this.#t!==0&&!Rh(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!Rh(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#M()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=Rh(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!Rh(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#D()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;(e=>!Ih.has(e))(t)&&(Ih.add(t),((e,t,n,r)=>{typeof Lh.emitWarning==`function`?Lh.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)})(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#D(){let e=new Bh(this.#e),t=new Bh(this.#e);this.#x=e,this.#b=t;let n=this.ttlAutopurge?Array.from({length:this.#e}):void 0;this.#S=n,this.#A=(n,i,a=this.#s.now())=>{t[n]=i===0?0:a,e[n]=i,r(n,i)},this.#O=n=>{t[n]=e[n]===0?0:this.#s.now(),r(n,e[n])};let r=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&t!==0&&n){let i=setTimeout(()=>{this.#j(e)?(this.#Z(this.#d[e],`expire`),n[e]=void 0):r(e,o(e))},t+1);i.unref&&i.unref(),n[e]=i}}:()=>{};this.#k=(n,r)=>{if(e[r]){let o=e[r],s=t[r];if(!o||!s)return;n.ttl=o,n.start=s,n.now=i||a(),n.remainingTTL=o-(n.now-s)}};let i=0,a=()=>{let e=this.#s.now();if(this.ttlResolution>0){i=e;let t=setTimeout(()=>i=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=e=>{let t=this.#u.get(e);return t===void 0?0:o(t)};let o=n=>{let r=e[n],o=t[n];return r&&o?r-((i||a())-o):1/0};this.#j=n=>{let r=t[n],o=e[n];return!!o&&!!r&&(i||a())-r>o}}#O=()=>{};#k=()=>{};#A=()=>{};#j=()=>!1;#M(){let e=new Bh(this.#e);this.#l=0,this.#y=e,this.#N=t=>{this.#l-=e[t],e[t]=0},this.#F=(e,t,n,r)=>{if(!Rh(n)){if(this.#W(t))return this.backgroundFetchSize;if(!r)throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`);if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!Rh(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}return n},this.#P=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#B(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#N=e=>{};#P=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#h);)t=this.#m[t]}*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;this.#R(t)&&((e||!this.#j(t))&&(yield t),t!==this.#g);)t=this.#p[t]}#R(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#L())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#W(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#L()){let t=this.#d[e];t!==void 0&&!this.#W(this.#f[e])&&(yield t)}}*values(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#L())this.#f[e]!==void 0&&!this.#W(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.#J(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#L()){let r=this.#f[n],i=this.#W(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#L({allowStale:!0}))this.#j(t)&&(this.#Z(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#W(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#W(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.#z(t,n.value,n)}}set(e,t,n={}){let{status:r=Mh.hasSubscribers?{}:void 0}=n;n.status=r,r&&(r.op=`set`,r.key=e,t!==void 0&&(r.value=t),r.cache=this);let i=this.#z(e,t,n);return r&&Mh.hasSubscribers&&Mh.publish(r),i}#z(e,t,n,r){let{ttl:i=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:c}=n,l=this.#W(t);if(t===void 0)return c&&(c.set=`deleted`),this.delete(e),this;let{noUpdateTTL:u=this.noUpdateTTL}=n;c&&!l&&(c.value=t);let d=this.#F(e,t,n.size||0,s,c);if(this.maxEntrySize&&d>this.maxEntrySize)return this.#Z(e,`set`),c&&(c.set=`miss`,c.maxEntrySizeExceeded=!0),this;let f=this.#c===0?void 0:this.#u.get(e);if(f===void 0)f=this.#c===0?this.#g:this.#_.length===0?this.#c===this.#e?this.#B(!1):this.#c:this.#_.pop(),this.#d[f]=e,this.#f[f]=t,this.#u.set(e,f),this.#p[this.#g]=f,this.#m[f]=this.#g,this.#g=f,this.#c++,this.#P(f,d,c),c&&(c.set=`add`),u=!1,this.#E&&!l&&this.#r?.(t,e,`add`);else{this.#X(f);let n=this.#f[f];if(t!==n){if(!o)if(this.#W(n)){n!==r&&n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:i}=n;i!==void 0&&i!==t&&(this.#C&&this.#n?.(i,e,`set`),this.#T&&this.#v?.push([i,e,`set`]))}else this.#C&&this.#n?.(n,e,`set`),this.#T&&this.#v?.push([n,e,`set`]);if(this.#N(f),this.#P(f,d,c),this.#f[f]=t,!l){let r=n&&this.#W(n)?n.__staleWhileFetching:n,i=r===void 0?`add`:t===r?`update`:`replace`;c&&(c.set=i,r!==void 0&&(c.oldValue=r)),this.#E&&this.onInsert?.(t,e,i)}}else l||(c&&(c.set=`update`),this.#E&&this.onInsert?.(t,e,`update`))}if(i!==0&&!this.#x&&this.#D(),this.#x&&(u||this.#A(f,i,a),c&&this.#k(c,f)),!o&&this.#T&&this.#v){let e,t=this.#v;for(;e=t?.shift();)this.#i?.(...e)}return this}pop(){try{for(;this.#c;){let e=this.#f[this.#h];if(this.#B(!0),this.#W(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#T&&this.#v){let e,t=this.#v;for(;e=t?.shift();)this.#i?.(...e)}}}#B(e){let t=this.#h,n=this.#d[t],r=this.#f[t],i=this.#W(r);i&&r.__abortController.abort(Error(`evicted`));let a=i?r.__staleWhileFetching:r;return(this.#C||this.#T)&&a!==void 0&&(this.#C&&this.#n?.(a,n,`evict`),this.#T&&this.#v?.push([a,n,`evict`])),this.#N(t),this.#S?.[t]&&(clearTimeout(this.#S[t]),this.#S[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#_.push(t)),this.#c===1?(this.#h=this.#g=0,this.#_.length=0):this.#h=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{status:n=Mh.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`has`,n.key=e,n.cache=this);let r=this.#V(e,t);return Mh.hasSubscribers&&Mh.publish(n),r}#V(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(i!==void 0){let e=this.#f[i];if(this.#W(e)&&e.__staleWhileFetching===void 0)return!1;if(!this.#j(i))return n&&this.#O(i),r&&(r.has=`hit`,this.#k(r,i)),!0;r&&(r.has=`stale`,this.#k(r,i))}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{status:n=Fh()?{}:void 0}=t;n&&(n.op=`peek`,n.key=e,n.cache=this),t.status=n;let r=this.#H(e,t);return Mh.hasSubscribers&&Mh.publish(n),r}#H(e,t){let{status:n,allowStale:r=this.allowStale}=t,i=this.#u.get(e);if(i===void 0||!r&&this.#j(i))return void(n&&(n.peek=i===void 0?`miss`:`stale`));let a=this.#f[i],o=this.#W(a)?a.__staleWhileFetching:a;return n&&(o===void 0?n.peek=`miss`:(n.peek=`hit`,n.value=o)),o}#U(e,t,n,r){let i=t===void 0?void 0:this.#f[t];if(this.#W(i))return i;let a=new AbortController,{signal:o}=n;o?.addEventListener(`abort`,()=>a.abort(o.reason),{signal:a.signal});let s={signal:a.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:o}=a.signal,c=n.ignoreFetchAbort&&r!==void 0,d=n.ignoreFetchAbort||!(!n.allowStaleOnFetchAbort||r===void 0);if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!c&&!i)return l(a.signal.reason,d);let f=u,p=this.#f[t];return(p===u||p===void 0&&c&&i)&&(r===void 0?f.__staleWhileFetching===void 0?this.#Z(e,`fetch`):this.#f[t]=f.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),this.#z(e,r,s.options,f))),r},l=(r,i)=>{let{aborted:o}=a.signal,s=o&&n.allowStaleOnFetchAbort,c=s||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,d=u;if(this.#f[t]===u&&(!l||!i&&d.__staleWhileFetching===void 0?this.#Z(e,`fetch`):s||(this.#f[t]=d.__staleWhileFetching)),c)return n.status&&d.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),d.__staleWhileFetching;if(d.__returned===d)throw r};n.status&&(n.status.fetchDispatched=!0);let u=new Promise((t,r)=>{let o=this.#a?.(e,i,s);a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))}),o&&o instanceof Promise?o.then(e=>t(e===void 0?void 0:e),r):o!==void 0&&t(o)}).then(c,e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),l(e,!1))),d=Object.assign(u,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.#z(e,d,{...s.options,status:void 0}),t=this.#u.get(e)):this.#f[t]=d,d}#W(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof AbortController}fetch(e,t={}){let n=Nh.hasSubscribers,{status:r=Fh()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#G(e,t);return r&&n&&(r.trace=!0,Nh.tracePromise(()=>i,r).catch(()=>{})),i}async#G(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(g&&(g.op=`fetch`,g.key=e,h&&(g.forceRefresh=!0),g.cache=this),!this.#w)return g&&(g.fetch=`get`),this.#J(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#u.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#U(e,y,v,m);return t.__returned=t}{let t=this.#f[y];if(this.#W(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#j(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#X(y),r&&this.#O(y),g&&this.#k(g,y),t;let a=this.#U(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}forceFetch(e,t={}){let n=Nh.hasSubscribers,{status:r=Fh()?{}:void 0}=t;t.status=r,r&&t.context&&(r.context=t.context);let i=this.#K(e,t);return r&&n&&(r.trace=!0,Nh.tracePromise(()=>i,r).catch(()=>{})),i}async#K(e,t={}){let n=await this.#G(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let{status:n=Mh.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`memo`,n.key=e,t.context&&(n.context=t.context),n.cache=this);let r=this.#q(e,t);return n&&(n.value=r),Mh.hasSubscribers&&Mh.publish(n),r}#q(e,t={}){let n=this.#o;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,status:i,forceRefresh:a,...o}=t;i&&a&&(i.forceRefresh=!0);let s=this.#J(e,o),c=a||s===void 0;if(i&&(i.memo=c?`miss`:`hit`,c||(i.value=s)),!c)return s;let l=n(e,s,{options:o,context:r});return i&&(i.value=l),this.#z(e,l,o),l}get(e,t={}){let{status:n=Mh.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`get`,n.key=e,n.cache=this);let r=this.#J(e,t);return n&&(r!==void 0&&(n.value=r),Mh.hasSubscribers&&Mh.publish(n)),r}#J(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(o===void 0)return void(a&&(a.get=`miss`));let s=this.#f[o],c=this.#W(s);return a&&this.#k(a,o),this.#j(o)?c?(a&&(a.get=`stale-fetching`),n&&s.__staleWhileFetching!==void 0?(a&&(a.returnedStale=!0),s.__staleWhileFetching):void 0):(i||this.#Z(e,`expire`),a&&(a.get=`stale`),n?(a&&(a.returnedStale=!0),s):void 0):(a&&(a.get=c?`fetching`:`hit`),this.#X(o),r&&this.#O(o),c?s.__staleWhileFetching:s)}#Y(e,t){this.#m[t]=e,this.#p[e]=t}#X(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#Y(this.#m[e],this.#p[e]),this.#Y(this.#g,e),this.#g=e)}delete(e){return this.#Z(e,`delete`)}#Z(e,t){Mh.hasSubscribers&&Mh.publish({op:`delete`,delete:t,key:e,cache:this});let n=!1;if(this.#c!==0){let r=this.#u.get(e);if(r!==void 0)if(this.#S?.[r]&&(clearTimeout(this.#S[r]),this.#S[r]=void 0),n=!0,this.#c===1)this.#Q(t);else{this.#N(r);let n=this.#f[r];if(this.#W(n)?n.__abortController.abort(Error(`deleted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(n,e,t),this.#T&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#f[r]=void 0,r===this.#g)this.#g=this.#m[r];else if(r===this.#h)this.#h=this.#p[r];else{let e=this.#m[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#m[t]=this.#m[r]}this.#c--,this.#_.push(r)}}if(this.#T&&this.#v?.length){let e,t=this.#v;for(;e=t?.shift();)this.#i?.(...e)}return n}clear(){return this.#Q(`delete`)}#Q(e){for(let t of this.#L({allowStale:!0})){let n=this.#f[t];if(this.#W(n))n.__abortController.abort(Error(`deleted`));else{let r=this.#d[t];this.#C&&this.#n?.(n,r,e),this.#T&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#x&&this.#b){this.#x.fill(0),this.#b.fill(0);for(let e of this.#S??[])e!==void 0&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#h=0,this.#g=0,this.#_.length=0,this.#l=0,this.#c=0,this.#T&&this.#v){let e,t=this.#v;for(;e=t?.shift();)this.#i?.(...e)}}},Uh=`Resource is closed.`,Wh=class{constructor(e){if(this._listeners=new Set,this._arrayBuffer=null,this._type=null,this._sourceResolved=null,this._externalURI=null,this._name=e?.name??null,this._source=e.source,!e.source)throw Error(`Source undefined`);this._refs=new Set,this._isClosed=!1}async _resolveSource(){let e=this._sourceResolved;return e||(e=this._source,typeof e==`function`&&(e=e()),e&&typeof e==`object`&&typeof e.then==`function`&&(e=await Promise.resolve(e)),this._sourceResolved=e,e)}async _resolveArrayBuffer(){let t=await this._resolveSource();if(t.base64){let n=t.base64;return e.F.base64ToArrayBuffer(n)}if(t.fetch||t.external){let e,n,r=t.fetch??t.external;e=typeof r==`string`?r:t.input;try{let t=await fetch(e,n),r=await t.arrayBuffer(),i=t.headers.get(`Content-Type`);if(i){let e=await Gh(r);e&&(this._type={mime:i,ext:e.ext},e.mime!==i&&console.warn(`Resource fetch detected mime type ${e.mime} does not match response mime type ${i}. Using response mime type.`))}return r}catch(t){throw Error(`Unable to fetch '${e}'`,{cause:t.message})}}if(t.buffer)return t.buffer;if(t.file)return await t.file.arrayBuffer();throw Error(`BinaryResource must have an initial data value.`)}getName(){return this._name}async toJSONAsync(){let t={},n=await this.getExternalURI();if(n)t.uri=n;else{let n=await this.toBuffer();t.base64=e.F.arrayBufferToBase64(n)}return this._name&&(t.name=this._name),t}async toBuffer(){if(this._arrayBuffer)return this._arrayBuffer;try{this._arrayBuffer=this._resolveArrayBuffer()}catch(e){throw e}return this._arrayBuffer}async getType(){if(this._type)return this._type;let e=await Gh(await this.toBuffer());return this._type=e,e}async getExternalURI(){if(this._externalURI)return this._externalURI;let e=await this._resolveSource(),t=Promise.resolve(null),n=e.fetch??e.external;if(n)if(typeof n==`string`)t=Promise.resolve(n);else{let e=n.input;typeof e==`string`?t=Promise.resolve(e):e instanceof URL?t=Promise.resolve(e.href):e instanceof Request&&(t=Promise.resolve(e.url))}return this._externalURI=t,t}addReference(e){if(this._isClosed)throw Error(Uh);this._refs.add(e)}deleteReference(e){if(this._isClosed)throw Error(Uh);if(this._refs.size===0||!this._refs.has(e))return;this._refs.delete(e);let t=this;if(this._refs.size===0){let e=this._listeners;e.forEach(n=>{n.onUnload?.(t),e.delete(n)}),this._arrayBuffer=null,this._isClosed=!0}}addUnloadListener(e){if(this._isClosed)throw Error(Uh);this._listeners.add(e)}get isIResource(){return!0}isClosed(){return this._isClosed}};async function Gh(e){return function(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):e;if(t.length<4)return null;if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71)return{mime:`image/png`,ext:`png`};if(t[0]===255&&t[1]===216&&t[2]===255)return{mime:`image/jpeg`,ext:`jpeg`};if(t[0]===71&&t[1]===73&&t[2]===70&&t[3]===56)return{mime:`image/gif`,ext:`gif`};if(t[0]===66&&t[1]===77)return{mime:`image/bmp`,ext:`bmp`};if(t[0]===73&&t[1]===73&&t[2]===42&&t[3]===0||t[0]===77&&t[1]===77&&t[2]===0&&t[3]===42)return{mime:`image/tiff`,ext:`tif`};if(t.length>=44&&t[0]===1&&t[1]===0&&t[2]===0&&t[3]===0&&t[40]===32&&t[41]===69&&t[42]===77&&t[43]===70)return{mime:`image/x-emf`,ext:`emf`};if(t[0]===215&&t[1]===205&&t[2]===198&&t[3]===154||t[0]===1&&t[1]===0&&t[2]===9&&t[3]===0)return{mime:`image/x-wmf`,ext:`wmf`};if(t.length>=100){let e=new TextDecoder(`utf-8`,{fatal:!1}).decode(t.slice(0,100));if(e.includes(`<svg`)||e.includes(`<?xml`)&&e.includes(`svg`))return{mime:`image/svg+xml`,ext:`svg`}}return null}(e)||null}var Kh,qh=class{constructor(e,t,n){this._state=e,this._fromJSON=t,this._onLastEnd=n,this._state.openScopes.add(this),this._isClosed=!1}endPersist(){if(!this._state.openScopes.delete(this))throw Error(`PersistScope is closed.`);this._isClosed=!0,this._state.openScopes.size===0&&this._onLastEnd()}toResourceId(e){if(this._isClosed)throw Error(`PersistScope is closed.`);let t=this._state.byRefs.get(e);return t!==void 0||(t=this._state.byRefs.size,this._state.byRefs.set(e,t),this._state.byIds.set(t,e)),t}fromResourceId(e){return this._state.byIds.get(e)??null}fromJSON(e){if(this._isClosed)throw Error(`PersistScope is closed.`);if(!e||e.length===0)return;let t=this._state.byRefs.size;for(let n=0;n<e.length;n++){let r=e[n],i=this._fromJSON(r);this._state.byRefs.set(i,t+n),this._state.byIds.set(t+n,i)}}toJSONAsync(){if(this._isClosed)throw Error(`PersistScope is closed.`);let e=[];return this._state.byRefs.forEach((t,n)=>{e[t]=Promise.resolve(n.toJSONAsync())}),Promise.all(e)}},Jh=class{constructor(){this._persistOpen=null,this._resources=new Set}add(e){if(typeof e==`string`){let t=!1;this._resources.forEach(n=>{n.getName()===e&&(t=!0,e=n)}),t||(e=new Wh({name:e,source:{fetch:e}}))}let t;t=e instanceof Wh?e:new Wh({...e});let n=this;return this._resources.has(t)||(t.addUnloadListener({onUnload:e=>{n._resources.delete(t)}}),this._resources.add(t)),t}*[Symbol.iterator](){yield*this.getItems()}getItems(e){return Array.from(this._resources)}getCount(){return this._resources.size}beginPersist(){this._persistOpen||={byRefs:new Map,byIds:new Map,openScopes:new Set};let e={},t=new Set,n=this;return new qh(this._persistOpen,r=>{let i=r.base64,a=r.uri,o={};i?o.base64=i:a&&(o.external=a);let s=n.add({name:r.name,source:o});return s.addReference(e),t.add(s),s},()=>{t.forEach(t=>{t.deleteReference(e)}),n._persistOpen=null})}},Yh=class{constructor(){this._persistOpen=null,this._nextId=0,this._lastReadId=-1,this._lastReadValue=null,this._stringsByText=new Map,this._stringsById=new Map}addMultiple(e,t=!1){let n=this._stringsByText,r=this._stringsById,i=e.length,a=this._nextId;for(let o=0;o<i;o++){let i=e[o];n.get(i)!==void 0&&t||(n.set(i,a),r.set(a,i),a++)}this._lastReadId=-1,this._nextId=a}add(e){let t=this._stringsByText,n=t.get(e);if(n!==void 0)return n;let r=this._nextId++;return t.set(e,r),this._stringsById.set(r,e),this._lastReadId=-1,r}*[Symbol.iterator](){yield*this.getItems()}getItems(e){if(e?.id!==void 0){let t=this.getById(e.id);return t?[t]:[]}return Array.from(this._stringsById.values())}getById(e){if(this._lastReadId===e)return this._lastReadValue;let t=this._stringsById.get(e)??null;return this._lastReadId=e,this._lastReadValue=t,t}getCount(){return this._stringsById.size}beginPersist(){this._persistOpen||={byRefs:new Map,byIds:new Map,openScopes:new Set};let e=this;return new Xh(this._persistOpen,t=>(Array.isArray(t)?e.addMultiple(t):e.add(t),t),()=>{e._persistOpen=null})}},Xh=class{constructor(e,t,n){this._state=e,this._fromJSON=t,this._onLastEnd=n,this._state.openScopes.add(this),this._isClosed=!1}endPersist(){if(!this._state.openScopes.delete(this))throw Error(`PersistScope is closed.`);this._isClosed=!0,this._state.openScopes.size===0&&this._onLastEnd()}add(e){if(this._isClosed)throw Error(`PersistScope is closed.`);let t=this._state.byRefs.get(e);return t!==void 0||(t=this._state.byRefs.size,this._state.byRefs.set(e,t),this._state.byIds.set(t,e)),t}at(e){return this._state.byIds.get(e)??null}fromJSON(e){if(this._isClosed)throw Error(`PersistScope is closed.`);e&&e.length!==0&&this._fromJSON(e)}toJSONAsync(){if(this._isClosed)throw Error(`PersistScope is closed.`);let e=[];return this._state.byRefs.forEach((t,n)=>{e[t]=Promise.resolve(n.toJSONAsync?n.toJSONAsync():n)}),Promise.all(e)}};(Sh||={}).Type={Absolute:`absolute`,OneCell:`oneCell`,TwoCell:`twoCell`};var Zh=class t{constructor(e){this._cacheSearchRange={colStart:0,rowStart:0,colEnd:0,rowEnd:0},this._cacheSearchFullyContained=!1,this._cacheSearchResults=null,this._init(e)}_init(e){this._options=Object.freeze({getEntireCoords:$T,...e}),this._isEmpty=!0,this._spatial=new va,this._mapModelToEntries=new Map,this._setIndexToModel([]),this._mapNameToModel=new Map,this._nextOrder=0,this._createEntry=null,this._mapModelToMeta=new Map}_allocateOrder(){let e=this._nextOrder;return this._nextOrder=e+eg,e}_createSpatialEntry(e,t){let n=(this._createEntry??ag)(e,t);return n.order=this._allocateOrder(),n.orderSpan=eg,n.getSplit||=rg,{colStart:t.colStart,rowStart:t.rowStart,colEnd:t.colEnd,rowEnd:t.rowEnd,value:n}}_entriesOf(t){return this._mapModelToEntries.get(t)??e.A.EmptyArray}all(){return this._indexToModel}_setIndexToModel(e){this._indexToModel=Object.freeze(e)}search(t,n=!1,r,i){if(this._isEmpty)return i??e.A.EmptyArray;let a=this._cacheSearchRange,o=this._cacheSearchResults;if(o!==null&&e.l.isEqualRanges(t,a)&&n===this._cacheSearchFullyContained||(this._cacheSearchFullyContained=n,a.colStart=t.colStart,a.rowStart=t.rowStart,a.colEnd=t.colEnd,a.rowEnd=t.rowEnd,o=this._searchModels(t,n),this._cacheSearchResults=o),!i)return o;let s=o.length;for(let e=0;e<s;e++)i.push(o[e]);return i}_searchModels(t,n){let r=this._spatial.search(t,n),i=r.length;if(i===0)return e.A.EmptyArray;let a=this._mapModelToMeta,o=i>1?[...r].sort((e,t)=>{let n=a.get(e.value.model).index,r=a.get(t.value.model).index;return n===r?e.value.order-t.value.order:n-r}):r,s=Array(i);for(let e=0;e<i;e++){let t=o[e];s[e]={...t,value:t.value.model}}return s}getByName(e){if(this._isEmpty)return null;let t=e.toLocaleLowerCase();return this._mapNameToModel.get(t)??null}setName(e,t){let n=this._mapModelToMeta,r=n.get(e);if(!r)return this;let i=new Map(n),a=new Map(this._mapNameToModel),o=r?.name;o&&a.delete(o.toLocaleLowerCase());let s={...r};s.name=t,i.set(e,s);let c=t.toLocaleLowerCase();a.set(c,e);let l=this._shallowClone();return l._mapNameToModel=a,l._mapModelToMeta=i,l}getByIndex(e){return this._isEmpty?null:this._indexToModel[e]||null}setIndex(e,t){let n=this._indexToModel,r=n.length;t<0?t=0:t>r-1&&(t=r-1);let i=this._mapModelToMeta,a=i.get(e);if(a.index===t)return this;let o=[...n],s=new Map(i),c=a.index;o.splice(c,1),o.splice(t,0,e);let l=Math.min(c,t);this._reIndexMeta(o,s,l);let u=this._shallowClone();return u._mapModelToMeta=s,u._setIndexToModel(o),u}getIndex(e){let t=this._mapModelToMeta.get(e);return t?t.index:-1}getCoords(t){let n=this._entriesOf(t);return n.length===0?null:e.l.sanitizeRangeArray(n)}setCoords(t,n){let r=this._mapModelToEntries,i=this._entriesOf(t);if(i.length===0)return this;let a=n?n.length:0;if(a===0)return this.deleteModel(t);let o=this._spatial.clone(),s=i.length;for(let e=0;e<s;e++)o.remove(i[e],tg);let c=this._shallowClone(),l=Array(a);for(let e=0;e<a;e++)l[e]=c._createSpatialEntry(t,n[e]);o.load(l);let u=new Map(r);u.set(t,l),c._spatial=o,c._mapModelToEntries=u;let d=e.l.sanitizeRangeArray(i),f=e.l.sanitizeRangeArray(l);return ig(d,f)||this._mapModelToMeta.get(t)?.callbacks?.processAfterShift?.(d,f),c}clone(){let n=new t(e.A.EmptyObject);return n._options=this._options,n._spatial=this._spatial.clone(),n._mapModelToEntries=new Map(this._mapModelToEntries),n._mapModelToMeta=new Map(this._mapModelToMeta),n._mapNameToModel=new Map(this._mapNameToModel),n._setIndexToModel([...this._indexToModel]),n._isEmpty=this._isEmpty,n._nextOrder=this._nextOrder,n._createEntry=this._createEntry,n}size(){return this._mapModelToEntries.size}isEmpty(){return this._isEmpty}has(e){return!this._isEmpty&&this._spatial.has(e)}shift(t){if(this._isEmpty)return this;let n=t?.ranges,r=t?.direction,i=t?.coordValidator,a=n.length,o=this._spatial,s=o,c=this._mapModelToEntries,l=c,u=this._mapModelToMeta,d=u,f=this._mapNameToModel,p=f,m=new Set,h=new Map,g=t=>{let n=h.get(t);return n||(n=[...c.get(t)??e.A.EmptyArray],h.set(t,n)),n},_=(e,t)=>{let n=t?t.length:0;for(let e=0;e<n;e++){let n=t[e],r=n.value.model;m.add(r);let i=g(r),a=i.indexOf(n);a>=0&&i.splice(a,1)}let r=e?e.length:0;for(let t=0;t<r;t++){let n=e[t],r=n.value.model;m.add(r),g(r).push(n)}},v=e=>{let t=e.before.value.model;m.add(t),u.get(t)?.callbacks?.processShift?.(e)};for(let e=0;e<a;e++){let t=n[e];s=s.shift({range:t,direction:r,cloneIfUpdate:s===o,coordValidator:i,onShift:v,onUpdates:_})}if(m.size===0)return this;l=new Map(c),d=new Map(u),p=new Map(f);let y=[...this._indexToModel];this._applyEntryDeltas(h,c,l,d,p,y);let b=this._shallowClone();return b._spatial=s,b._mapModelToEntries=l,b._mapNameToModel=p,b._setIndexToModel(y),b._mapModelToMeta=d,b._isEmpty=l.size===0,b}_applyEntryDeltas(t,n,r,i,a,o){let s=2**53-1;t.forEach((t,c)=>{let l=i.get(c);if(!l)return;let u,d=n.get(c),f=d?e.l.sanitizeRangeArray(d):null;if(t.length===0){u=null,r.delete(c),i.delete(c);let e=l.name;e&&a.delete(e.toLocaleLowerCase()),s=Math.min(s,l.index),o[l.index]=null}else t.sort(ng),r.set(c,t),u=e.l.sanitizeRangeArray(t);ig(f,u)||l.callbacks.processAfterShift?.(f,u),u||l.callbacks.processDelete?.()}),s!==2**53-1&&this._reIndexMeta(o,i,s,!0)}deleteRanges(e,t=!1){if(this._isEmpty)return this;let n=this._spatial,r=e.length,i=[];for(let a=0;a<r;a++){let r=e[a];n.search(r,t,!1,i)}if(i.length===0)return this;let a=this._shallowClone(),o=this._spatial.clone(),s=this._mapModelToEntries,c=new Map(s),l=new Map(this._mapNameToModel),u=new Map(this._mapModelToMeta),d=[...this._indexToModel],f=new Map,p=i.length;for(let e=0;e<p;e++){let t=i[e],n=t.value.model,r=f.get(n);r||(r=new Set,f.set(n,r)),r.add(t),o.remove(t,tg)}let m=new Map;return f.forEach((e,t)=>{let n=s.get(t);n&&m.set(t,n.filter(t=>!e.has(t)))}),this._applyEntryDeltas(m,s,c,u,l,d),a._spatial=o,a._mapModelToEntries=c,a._mapNameToModel=l,a._setIndexToModel(d),a._mapModelToMeta=u,a._isEmpty=c.size===0,a}_reIndexMeta(e,t,n=0,r=!1){if(r)for(let t=e.length-1;t>=n;t--)e[t]||e.splice(t,1);let i=e.length;for(let r=n;r<i;r++){let n=e[r],i=t.get(n);if(i.index===r)continue;let a={...i};a.index=r,t.set(n,a)}}deleteModel(e){if(this._isEmpty)return this;let t=new Map(this._mapModelToEntries),n=this._mapNameToModel,r=new Map(this._mapModelToMeta),i=r.get(e);i.callbacks.processDelete?.();let a=i?.name;a&&(n=new Map(n),n.delete(a.toLocaleLowerCase()));let o=t.get(e),s=o?o.length:0,c=this._spatial;if(o&&s>0){c=this._spatial.clone();for(let e=0;e<s;e++){let t=o[e];c.remove(t,tg)}}r.delete(e),t.delete(e);let l=[...this._indexToModel],u=i.index;l[u]=null,this._reIndexMeta(l,r,u,!0);let d=this._shallowClone();return d._spatial=c,d._mapModelToEntries=t,d._mapNameToModel=n,d._mapModelToMeta=r,d._setIndexToModel(l),d._isEmpty=t.size===0,d}_onLoadFailure(t,n){let r=n?.message??(n?String(n):void 0);if(Qh)throw Error(r?`${t} ${r}`:t);e.V.warn(t,{meta:{type:`error`,detail:r}})}load(t,n){let r=t?t.length:0;if(r===0)return this;let i=this._options.getRanges,a=this._options.getEntireRange,o=n.createModel,s=n.addListeners,c=n.setContainerCoords,l=n.setContainerName,u=n.setContainerIndex,d=n.getContainerIndex,f=n.deleteFromContainer,p=n.invalidate,m=new Map(this._mapModelToEntries),h=new Map(this._mapModelToMeta),g=new Map(this._mapNameToModel),_=[],v=this._shallowClone();v._createEntry=n.createEntry??this._createEntry;let y=(t,n,r)=>{let m,h={model:null,callbacks:e.A.EmptyObject,name:null,index:n},g=null,_=t,y=!1,b={getRanges:i,getEntireRange:a,invalidate:p,setContainerCallbacks:e=>{if(g)throw Error(`Cannot set container callbacks after model creation.`);h.callbacks={...h.callbacks,...e}},setContainerCoords:(e,t)=>{let n=i(e).getCoords();if(g)return c?.(g,n,t),n;_=[...n]},setContainerName:(e,t)=>{g?l?.(g,e,t):h.name=e},setContainerIndex:(e,t)=>{if(!g)throw Error(`Cannot set container index curring initializations.`);u?.(g,e,t)},getContainerIndex:()=>g?d?.(g):h.index,deleteFromContainer:e=>{g?(f?.(g,e),m?.()):y=!0},coords:t,json:r};if(y)return null;if(g=o(b),h.model=g,!h.name){let e=g.getName?.();e&&(h.name=e)}h.index;let x=[],S=_.length;for(let e=0;e<S;e++)x.push(v._createSpatialEntry(g,_[e]));return s&&(m=s(g)),{entries:x,meta:h}},b=[...this._indexToModel],x=b.length,S=a().getCoords();for(let e=0;e<r;e++){let n,r=t[e],i=Yl(r,S);if(!i){this._onLoadFailure(`Invalid ref '${r?.r}'.`,null);continue}try{n=y(i.coords,e+x,i.value)}catch(e){this._onLoadFailure(`Unable to load anchored item at '${r?.r}'.`,e)}if(!n)continue;let a=n.entries,o=n.meta,s=o.model;m.set(s,a);let c=o.name;c&&g.set(c.toLocaleLowerCase(),s),h.set(s,o),b.push(s);let l=a.length;for(let e=0;e<l;e++)_.push(a[e])}let C=this._spatial.clone();return C.load(_),v._spatial=C,v._mapModelToEntries=m,v._mapNameToModel=g,v._mapModelToMeta=h,v._setIndexToModel(b),v._isEmpty=m.size===0,v}getBoundingRange(){return this._spatial.getBoundingRange()}toJSON(){let e=this.all(),t=e.length;if(t===0)return null;let n=this._options.getEntireRange().getCoords(),r=[];for(let i=0;i<t;i++){let t=e[i];if(t.toJSON===void 0)continue;let a=this._entriesOf(t);if(a.length===0)continue;let o=t.toJSON();r.push({r:iu(a,n),v:o})}return r}processCallbacks(e){this._mapModelToMeta.forEach((t,n)=>{e(n,t.callbacks)})}close(){let e=this._mapModelToMeta.keys();for(let t of e)t.close()}_shallowClone(){let n=new t(e.A.EmptyObject);return n._options=this._options,n._spatial=this._spatial,n._mapModelToEntries=this._mapModelToEntries,n._mapModelToMeta=this._mapModelToMeta,n._mapNameToModel=this._mapNameToModel,n._indexToModel=this._indexToModel,n._isEmpty=this._isEmpty,n._nextOrder=this._nextOrder,n._createEntry=this._createEntry,n}},Qh=!1;(Kh=Zh||={}).setStrictLoad=function(e){Qh=e},Kh.isStrictLoad=function(){return Qh};var Q,$h,eg=1024,tg=(e,t)=>{let n=e.value,r=t.value;return n.model===r.model&&n.order===r.order},ng=(e,t)=>e.value.order-t.value.order;function rg(e,t,n){let r=this.order,i=this.orderSpan,a=i/2>0?i/2:0;return[{...this,order:r,orderSpan:a},{...this,order:r+a,orderSpan:i-a}]}var ig=(t,n)=>{let r=t?t.length:0;if(r!==(n?n.length:0))return!1;for(let i=0;i<r;i++)if(!e.l.isEqualRanges(t[i],n[i]))return!1;return!0},ag=(e,t)=>({model:e,order:0,orderSpan:eg}),og=class{constructor(e){this._subscriptions=[],this._getSheets=e.getSheets,this._addSheetsListener=e.addSheetsListener??null}getItems(){this._syncSubscriptions();let t=this._getSheets()??e.A.EmptyArray,n=t.length;if(n===0)return e.A.EmptyArray;let r=null;for(let i=0;i<n;i++){let n=t[i]?.getTables().getItems()??e.A.EmptyArray,a=n.length;for(let e=0;e<a;e++){let t=n[e]?.getNamed?.();t&&(r||=[],r.push(t))}}return r??e.A.EmptyArray}addListeners(t,n){let r=()=>{t.onCollectionChange?.()},i={notify:r,sheets:e.A.EmptyArray,removes:[],options:n};this._subscriptions.push(i),this._syncSubscription(i);let a=this._addSheetsListener?.(()=>{this._syncSubscription(i),r()},n);return()=>{for(let e=0;e<i.removes.length;e++)i.removes[e]?.();i.removes=[],i.sheets=e.A.EmptyArray,this._subscriptions=this._subscriptions.filter(e=>e!==i),a?.()}}_syncSubscription(t){let n=this._getSheets()??e.A.EmptyArray,r=t.sheets;if(n.length===r.length){let e=!0;for(let t=0;t<n.length;t++)if(n[t]!==r[t]){e=!1;break}if(e)return}for(let e=0;e<t.removes.length;e++)t.removes[e]?.();t.removes=[],t.sheets=n;for(let e=0;e<n.length;e++){let r=n[e];r&&t.removes.push(r.addListeners({onTablesChange:t.notify},t.options))}}_syncSubscriptions(){for(let e=0;e<this._subscriptions.length;e++)this._syncSubscription(this._subscriptions[e])}};($h=Q||={}).BuiltInSelectorNames={List:`list`,Logical:`logical`,Date:`date`,DateTime:`dateTime`,Time:`time`,Text:`text`,TextLength:`textLength`,Number:`number`,Whole:`wholeNumber`},$h.BuiltInOperatorNames={And:`and`,Average:`average`,Between:`between`,Color:`color`,EqualTo:`equalTo`,GreaterThan:`greaterThan`,GreaterThanEqualTo:`greaterThanEqualTo`,LessThan:`lessThan`,LessThanEqualTo:`lessThanEqualTo`,After:`after`,AfterEqualTo:`afterEqualTo`,Before:`before`,BeforeEqualTo:`beforeEqualTo`,Unique:`unique`,Blank:`blank`,Error:`error`,InSet:`inSet`,Icon:`icon`,Not:`not`,TextEmail:`textEmail`,TextIsUrl:`textUrl`,TextStartsWith:`textStartsWith`,TextEndsWith:`textEndsWith`,TextContains:`textContains`,Expression:`expression`,TimePeriod:`timePeriod`,TopN:`topN`,Or:`or`},$h.AverageType={Above:`above`,Below:`below`,AboveOrEqual:`aboveOrEqual`,BelowOrEqual:`belowOrEqual`},$h.TimePeriodType={Last7Days:`last7Days`,LastMonth:`lastMonth`,LastQuarter:`lastQuarter`,LastWeek:`lastWeek`,LastYear:`lastYear`,M1:`M1`,M2:`M2`,M3:`M3`,M4:`M4`,M5:`M5`,M6:`M6`,M7:`M7`,M8:`M8`,M9:`M9`,M10:`M10`,M11:`M11`,M12:`M12`,NextMonth:`nextMonth`,NextQuarter:`nextQuarter`,NextWeek:`nextWeek`,Null:`null`,Q1:`Q1`,Q2:`Q2`,Q3:`Q3`,Q4:`Q4`,ThisMonth:`thisMonth`,ThisQuarter:`thisQuarter`,ThisWeek:`thisWeek`,Today:`today`,Tomorrow:`tomorrow`,YearToDate:`yearToDate`,Yesterday:`yesterday`},$h.DateItemGroupingType={Day:`day`,Hour:`hour`,Minute:`minute`,Month:`month`,Second:`second`,Year:`year`},go();var sg=class{constructor(e){this._name=e.name,this._title=e.title,this._description=e.description,e.acceptTypes&&e.acceptTypes.length>0?this._acceptTypes=Object.freeze([...e.acceptTypes]):this._acceptTypes=null,this._paramType=e.paramType}getName(){return this._name}getAcceptsTypes(){return this._acceptTypes}acceptsList(){return!1}getParamType(e){if(this._paramType!==void 0)return this._paramType;if(e)return e.getName();let t=this._acceptTypes;if(!t)return null;for(let e of t)switch(e){case n.s.Number:return`number`;case n.s.String:return`text`;case n.s.Date:return`dateTime`;case n.s.Boolean:return`logical`}return null}isCombinator(){return!1}createDefaultParam(e){return null}getTitle(){return this._title?e._(this._title):e.A.camelToPrettyCase(this.getName())}getDescription(){return this._description?e._(this._description):null}doBatch(e,t,n){return null}async _resolveOperand(t,r){if(typeof t!=`string`||!t.startsWith(`=`))return()=>t;let i=t.slice(1),a=await r.watchFormula(i);if(!a)return null;let o=r.getCoords(),s=!1,c=this.getName();return t=>{let r,l=t.getPosition();try{r=a.getValueAt(l.rowIndex-o.rowStart,l.colIndex-o.colStart)}catch(e){if(!n.a.isError(e))throw e;r=e}return!n.a.isError(r)&&r?.isIRange&&(r=r.getValueAt(0,0)),n.a.isError(r)&&!s&&(s=!0,e.V.warn(`Condition operand '=${i}' resolves to ${r.getLabel()}; '${c}' matches nothing there.`,{onceKey:`condition.operand.error.${i}`,meta:{type:`condition`}})),r}}async _createComparePredicate(e,t,r){let i=await this._resolveOperand(e,t);return i?(e,t)=>{let a=i(t);return!n.a.isError(a)&&r(e,a)}:null}toString(t,n){let r=this.getTitle(),i=t;return i==null?r:e._(`condition.operator.titleWithParam`,{title:r,param:i})}},cg=()=>!1,lg=class e{constructor(e,t,n,r,i,a,o){this._groups=e,this._keyFn=t,this._compareFn=n,this._reverseBuild=r,this._visitedCount=i,this._totalCount=a,this._truncated=o}*getUniqueValues(){let e=this._groups,t=this._getValueOrderAscending();if(this._reverseBuild)for(let n=t.length-1;n>=0;n--)yield e.get(t[n]).value;else for(let n=0;n<t.length;n++)yield e.get(t[n]).value}getFrequency(e){return this._groups.get(this._keyFn(e))?.count??0}*getValueCounts(e){let t,n=this._groups,r=e?.sortBy??`frequency`,i=e?.descending??!0;if(r===`value`)t=this._getValueOrderAscending().slice(),i&&t.reverse();else{let e=i?-1:1;t=Array.from(n.keys()),t.sort((t,r)=>e*(n.get(t).count-n.get(r).count))}for(let e=0;e<t.length;e++){let r=n.get(t[e]);yield[r.value,r.count]}}getUniqueCount(){return this._groups.size}getVisitedCount(){return this._visitedCount}getTotalCount(){return this._totalCount}isTruncated(){return this._truncated}_getValueOrderAscending(){let e=this._valueOrderAscending;if(!e){let t=this._groups,n=this._compareFn,r=Array.from(t.keys());r.sort((e,r)=>n(t.get(e).value,t.get(r).value)),e=Object.freeze(r),this._valueOrderAscending=e}return e}static fromGrid(t,r,i,a,o,s,c){let l=a?.keyFn??ug,u=a?.filterFn,d=a?.limit,f=new Map,p=0,m=!1;if(t.getCount()!==0){let e=t.getAxis()===n.l.Axis.Column,a=r.length,o=(i?{...dg,...i}:dg).bounds;e:for(let n=0;n<a;n++){let i=r[n];if(!i)continue;let a=e?i.colStart:i.rowStart,s=e?i.rowStart:i.colStart,c=e?i.colEnd:i.rowEnd,h=e?i.rowEnd:i.colEnd;o.colStart=e?a:s,o.rowStart=e?s:a,o.colEnd=e?c:h,o.rowEnd=e?h:c;let g=t.getRuns(dg),_=g.next();for(;!_.done;){let[,e,t]=_.value;_=g.next();let n=t.length,r=Math.max(0,s-e),i=Math.min(n-1,h-e);if(!(r>i))for(let e=r;e<=i;e++){let n=t.at(e);if(u&&!u(n))continue;let r=l(n),i=f.get(r);if(i)i.count++;else{if(d!==void 0&&f.size>=d){m=!0;break e}f.set(r,{value:n,count:1})}p++}}}}return s>0&&f.set(l(null),{value:null,count:s}),new e(f,l,a?.compareFn??o,a?.reverse??!1,p,c??p+s,m)}static fromGroups(t,n,r,i,a,o,s){return new e(t,n,r?.compareFn??i,r?.reverse??!1,a,o,s)}};function ug(e){if(e===null)return`\0`;let t=typeof e;return t===`number`?``+e.toString():t===`string`?``+Wo(e.normalize(`NFC`),!0):t===`boolean`?``+(e?`1`:`0`):n.a.isError(e)?``+e.getCode():``+String(e)}var dg={bounds:{colStart:0,rowStart:0,colEnd:0,rowEnd:0},overflowRun:!0},fg=()=>!1,pg=(e,t)=>!(t.year!==void 0&&t.year!==e.year||t.month!==void 0&&t.month!==e.month||t.day!==void 0&&t.day!==e.day||t.hour!==void 0&&t.hour!==e.hour||t.minute!==void 0&&t.minute!==e.minute||t.second!==void 0&&t.second!==e.second),mg=()=>!1,hg=()=>!0,gg={Blank:new class extends sg{constructor(t){super({name:Q.BuiltInOperatorNames.Blank,title:e.v(`condition.operator.blank.title`),acceptTypes:[n.s.Null],paramType:null,...t})}createPredicate(e,t){return e=>e===null}},Error:new class extends sg{constructor(t){super({name:Q.BuiltInOperatorNames.Error,title:e.v(`condition.operator.error.title`),acceptTypes:[n.s.Error],paramType:null,...t})}createPredicate(e,t){return e=>e&&n.a.isError(e)}},Average:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.Average,title:e.v(`condition.operator.average.title`),acceptTypes:[n.s.Number],paramType:`average`,description:e.v(`condition.operator.average.desc`)})}async createPredicate(e,t){let n=t.getRange().getStats().getAggregates(),r=n.average,i=n.stdDev;if(r==null)return cg;let a=Q.AverageType.Above,o=e.type??a,s=e.stdDevs??0,c=s!==0&&i!=null?r+s*i*(o===a?1:-1):r;if(o===a||o===Q.AverageType.AboveOrEqual){let e=o===Q.AverageType.AboveOrEqual;return t=>e?t>=c:t>c}{let e=o===Q.AverageType.BelowOrEqual;return t=>e?t<=c:t<c}}createDefaultParam(e){return{type:Q.AverageType.Above,stdDevs:0}}toString(t,n){let r={...this.createDefaultParam(n),...t},i=r.type===Q.AverageType.Above||r.type===Q.AverageType.AboveOrEqual,a=r.type===Q.AverageType.AboveOrEqual||r.type===Q.AverageType.BelowOrEqual;return e._(`condition.operator.average.toString`,{dir:i?`above`:`below`,eq:a?`yes`:`no`,stdDevs:r.stdDevs??0})}},Between:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.Between,title:e.v(`condition.operator.between.title`),acceptTypes:[n.s.Number,n.s.Date],paramType:`between`,description:e.v(`condition.operator.between.desc`)})}async createPredicate(e,t){let r=await this._resolveOperand(e?.from??0,t),i=await this._resolveOperand(e?.to??0,t);return r&&i?(e,t)=>{let a=r(t),o=i(t);return!n.a.isError(a)&&!n.a.isError(o)&&e>=(a??0)&&e<=(o??0)}:null}createDefaultParam(e){return{from:0,to:0}}toString(t,n){let r={...this.createDefaultParam(n),...t};return e._(`condition.operator.between.toString`,{from:r.from??0,to:r.to??0})}},EqualTo:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.EqualTo,acceptTypes:[n.s.String,n.s.Number,n.s.Date,n.s.Boolean],title:e.v(`condition.operator.equalTo.title`)})}async createPredicate(e,t){if(typeof e!=`string`||!e.startsWith(`=`)){if(typeof e==`string`){let t=Go(e);return e=>typeof e==`string`&&Go(e)===t}return t=>t===e}let r=await this._resolveOperand(e,t);return r?(e,t)=>{let i=r(t);return!n.a.isError(i)&&(typeof i==`string`?typeof e==`string`&&Go(e)===Go(i):e===i)}:null}createDefaultParam(e){return e?e.getSelectType()===n.s.String?``:e.getSelectType()===n.s.Number?0:e.getSelectType()===n.s.Boolean||(e.getSelectType()===n.s.Date?0:void 0):null}},GreaterThan:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.GreaterThan,acceptTypes:[n.s.Number],title:e.v(`condition.operator.greaterThan.title`)})}createPredicate(e,t){return this._createComparePredicate(e,t,(e,t)=>e>t)}},GreaterThanEqualTo:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.GreaterThanEqualTo,acceptTypes:[n.s.Number],title:e.v(`condition.operator.greaterThanEqualTo.title`)})}createPredicate(e,t){return this._createComparePredicate(e,t,(e,t)=>e>=t)}},LessThan:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.LessThan,acceptTypes:[n.s.Number],title:e.v(`condition.operator.lessThan.title`)})}createPredicate(e,t){return this._createComparePredicate(e,t,(e,t)=>e<t)}},LessThanEqualTo:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.LessThanEqualTo,acceptTypes:[n.s.Number],title:e.v(`condition.operator.lessThanEqualTo.title`)})}createPredicate(e,t){return this._createComparePredicate(e,t,(e,t)=>e<=t)}},After:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.After,acceptTypes:[n.s.Date],title:e.v(`condition.operator.after.title`)})}createPredicate(e,t){return this._createComparePredicate(e,t,(e,t)=>e>t)}},AfterOrEqualTo:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.AfterEqualTo,acceptTypes:[n.s.Date],title:e.v(`condition.operator.afterEqualTo.title`)})}createPredicate(e,t){return this._createComparePredicate(e,t,(e,t)=>e>=t)}},Before:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.Before,acceptTypes:[n.s.Date],title:e.v(`condition.operator.before.title`)})}createPredicate(e,t){return this._createComparePredicate(e,t,(e,t)=>e<t)}},BeforeOrEqualTo:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.BeforeEqualTo,acceptTypes:[n.s.Date],title:e.v(`condition.operator.beforeEqualTo.title`)})}createPredicate(e,t){return this._createComparePredicate(e,t,(e,t)=>e<=t)}},Unique:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.Unique,title:e.v(`condition.operator.unique.title`),paramType:null,acceptTypes:null,description:e.v(`condition.operator.unique.desc`)})}async createPredicate(e,t){let n=t.getRange().getStats().getFrequencies();return e=>n.getFrequency(e)===1}},Expression:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.Expression,title:e.v(`condition.operator.expression.title`),paramType:Q.BuiltInOperatorNames.Expression,description:e.v(`condition.operator.expression.desc`)})}createDefaultParam(e){return``}async createPredicate(e,t){let n=await t.watchFormula(e);if(!n)return null;let r=t.getCoords();return(e,t)=>{let i=t.getPosition(),a=n.getValueAt(i.rowIndex-r.rowStart,i.colIndex-r.colStart);return!0===a||typeof a==`number`&&a!==0}}},InSet:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.InSet,title:e.v(`condition.operator.inSet.title`),description:e.v(`condition.operator.inSet.desc`)})}acceptsList(){return!0}createPredicate(e,t){let n=e?.blank??!1,r=Array.isArray(e?.items)?e.items:[],i=e?.dateGroups??[],a=i.length;if(r.length===0&&a===0&&!n)return fg;let o=r.length>0?new Set(r.map(ug)):void 0,s=a>0?{year:0,month:0,day:0,hour:0,minute:0,second:0,millis:0,dow:0,serial:0}:void 0;return e=>{if(e===null||e===``)return n;if(o?.has(ug(e)))return!0;if(a>0&&typeof e==`number`){let n=t.getDateParts(e,s);for(let e=0;e<a;e++)if(pg(n,i[e]))return!0}return!1}}createDefaultParam(e){return{items:[]}}toString(t,n){let r={...this.createDefaultParam(n),...t},i=this.getTitle(),a=r.items;if(a)return e._(`condition.operator.inSet.items`,{title:i,count:a?a.length:0});let o=r.dateGroups;return o?e._(`condition.operator.inSet.dateGroups`,{title:i,count:o?o.length:0}):i}},Icon:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.Icon,title:e.v(`condition.operator.icon.title`),description:e.v(`condition.operator.icon.desc`)})}createPredicate(e,t){return e=>!1}},Color:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.Color,title:e.v(`condition.operator.color.title`),description:e.v(`condition.operator.color.desc`)})}createPredicate(e,t){return e=>!1}},TextStartsWith:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.TextStartsWith,acceptTypes:[n.s.String],title:e.v(`condition.operator.textStartsWith.title`)})}createPredicate(e,t){let n=Go(e);return e=>Go(e).startsWith(n)}},TextEndsWith:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.TextEndsWith,acceptTypes:[n.s.String],title:e.v(`condition.operator.textEndsWith.title`)})}createPredicate(e,t){let n=Go(e);return e=>Go(e).endsWith(n)}},TextContains:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.TextContains,acceptTypes:[n.s.String],title:e.v(`condition.operator.textContains.title`)})}createPredicate(e,t){let n=Go(e);return e=>Go(e).includes(n)}},TextEmail:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.TextEmail,acceptTypes:[n.s.String],paramType:null,title:e.v(`condition.operator.textEmail.title`)})}createPredicate(e,t){return ee}},TextIsUrl:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.TextIsUrl,acceptTypes:[n.s.String],paramType:null,title:e.v(`condition.operator.textIsUrl.title`)})}createPredicate(e,t){return I}},TimePeriod:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.TimePeriod,acceptTypes:[n.s.Date],title:e.v(`condition.operator.timePeriod.title`),paramType:`timePeriod`,description:e.v(`condition.operator.timePeriod.desc`)})}async createPredicate(e,t){let{min:n,max:r}=this._computeRange(e,t);return e=>{if(typeof e!=`number`)return!1;let t=Math.floor(e);return t>=n&&t<=r}}createDefaultParam(e){return{type:Q.TimePeriodType.Today}}toString(t,n){let r={...this.createDefaultParam(n),...t};return e._(`condition.operator.timePeriod.toString`,{title:this.getTitle(),period:e.A.camelToPrettyCase(r.type)})}_computeRange(e,t){let n=e.type??Q.TimePeriodType.Today,r=e.anchorDate??t.getNow(),i=Math.floor(r),a=t.fromSerialDate(i),o=a.getFullYear(),s=a.getMonth(),c=a.getDay();switch(n){case`today`:return{min:i,max:i};case`yesterday`:return{min:i-1,max:i-1};case`tomorrow`:return{min:i+1,max:i+1};case`last7Days`:return{min:i-6,max:i};case`thisWeek`:{let e=new Date(a);e.setDate(a.getDate()-c);let n=new Date(e);return n.setDate(e.getDate()+6),{min:t.toSerialDate(e),max:t.toSerialDate(n)}}case`lastWeek`:{let e=new Date(a);e.setDate(a.getDate()-c-7);let n=new Date(e);return n.setDate(e.getDate()+6),{min:t.toSerialDate(e),max:t.toSerialDate(n)}}case`nextWeek`:{let e=new Date(a);e.setDate(a.getDate()-c+7);let n=new Date(e);return n.setDate(e.getDate()+6),{min:t.toSerialDate(e),max:t.toSerialDate(n)}}case`thisMonth`:return{min:t.toSerialDate(new Date(o,s,1)),max:t.toSerialDate(new Date(o,s+1,0))};case`lastMonth`:return{min:t.toSerialDate(new Date(o,s-1,1)),max:t.toSerialDate(new Date(o,s,0))};case`nextMonth`:return{min:t.toSerialDate(new Date(o,s+1,1)),max:t.toSerialDate(new Date(o,s+2,0))};case`M1`:case`M2`:case`M3`:case`M4`:case`M5`:case`M6`:case`M7`:case`M8`:case`M9`:case`M10`:case`M11`:case`M12`:{let e=parseInt(n.substring(1))-1;return{min:t.toSerialDate(new Date(o,e,1)),max:t.toSerialDate(new Date(o,e+1,0))}}case`Q1`:return this._quarterRange(t,o,0);case`Q2`:return this._quarterRange(t,o,1);case`Q3`:return this._quarterRange(t,o,2);case`Q4`:return this._quarterRange(t,o,3);case`thisQuarter`:{let e=Math.floor(s/3);return this._quarterRange(t,o,e)}case`lastQuarter`:{let e=Math.floor(s/3)-1,n=e<0?o-1:o,r=e<0?3:e;return this._quarterRange(t,n,r)}case`nextQuarter`:{let e=Math.floor(s/3)+1,n=e>3?o+1:o,r=e>3?0:e;return this._quarterRange(t,n,r)}case`lastYear`:return{min:t.toSerialDate(new Date(o-1,0,1)),max:t.toSerialDate(new Date(o-1,11,31))};case`yearToDate`:return{min:t.toSerialDate(new Date(o,0,1)),max:i};default:return{min:1/0,max:-1/0}}}_quarterRange(e,t,n){let r=3*n;return{min:e.toSerialDate(new Date(t,r,1)),max:e.toSerialDate(new Date(t,r+3,0))}}},TopN:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.TopN,title:e.v(`condition.operator.topN.title`),acceptTypes:[n.s.Number],paramType:`topN`,description:e.v(`condition.operator.topN.desc`)})}createPredicate(e,t){let n=t.getRange().getStats(),r=e?.top??!0,i=e?.limit??10;if(e?.percent){let e=n.getAggregates().numericalCount;if(!e)return mg;i=Math.max(1,Math.floor(i/100*e))}else if(i<1)return mg;let a=n.getSortedNumbers(),o=r?a.getLarge(i):a.getSmall(i);return o===null?hg:r?e=>e>=o:e=>e<=o}createDefaultParam(e){return{top:!0,limit:10,percent:!1}}toString(t,n){let r={...this.createDefaultParam(n),...t};return e._(`condition.operator.topN.toString`,{edge:r.top?`top`:`bottom`,limit:r.limit??10,unit:r.percent?`percent`:`items`})}},And:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.And,title:e.v(`condition.operator.and.title`),description:e.v(`condition.operator.and.desc`)})}isCombinator(){return!0}async createPredicate(e,t){let n=e?e.length:0,r=Array(n),i=Array(n);for(let a=0;a<n;a++){let n=e[a],o=await t.resolveInput(n);r[a]=await o.getSelector()?.createTransformer(t),i[a]=await o.getOperator().createPredicate(o.getParam(),t)}return e=>{for(let r=0;r<n;r++)if(!(0,i[r])(e,t))return!1;return!0}}toString(e,t){let n=this.getTitle();if(!e)return n;let r=``,i=e.length,a=n.toLowerCase();for(let t=0;t<i;t++){let n=e[t],i=Fg.resolveInput(n),o=i.getOperator(),s=o.toString(i.getParam(),i.getSelector())??o.getTitle?.()??``;r.length>0&&(r+=` ${a} `),r+=`${s}`}return r}},Or:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.Or,title:e.v(`condition.operator.or.title`),description:e.v(`condition.operator.or.desc`)})}isCombinator(){return!0}async createPredicate(e,t){let n=e?e.length:0,r=Array(n),i=Array(n);for(let a=0;a<n;a++){let n=e[a],o=await t.resolveInput(n);r[a]=await o.getSelector()?.createTransformer(t),i[a]=await o.getOperator().createPredicate(o.getParam(),t)}return e=>{for(let r=0;r<n;r++)if((0,i[r])(e,t))return!0;return!1}}toString(e,t){let n=this.getTitle();if(!e)return n;let r=``,i=e.length,a=n.toLowerCase();for(let t=0;t<i;t++){let n=e[t],i=Fg.resolveInput(n),o=i.getOperator(),s=o.toString(i.getParam(),i.getSelector())??o.getTitle?.()??``;r.length>0&&(r+=` ${a} `),r+=`${s}`}return r}},Not:new class extends sg{constructor(){super({name:Q.BuiltInOperatorNames.Not,title:e.v(`condition.operator.not.title`),description:e.v(`condition.operator.not.desc`)})}isCombinator(){return!0}async createPredicate(e,t){let n=await t.resolveInput(e);await n.getSelector()?.createTransformer(t);let r=await n.getOperator().createPredicate(n.getParam(),t);return r?e=>!r(e,t):null}toString(t,n){let r=this.getTitle();if(!t)return r;let i=Fg.resolveInput(t),a=i.getOperator();return e._(`condition.operator.not.toString`,{title:r,condition:a.toString(i.getParam(),i.getSelector())??a.getTitle?.()??r})}}};go();var _g=class{constructor(e){this._name=e.name,this._title=e.title,this._description=e.description,this._type=e.type??null,this._inputType=e.inputType??this._type,this._renderingHints=null,e.renderingHints&&(Array.isArray(e.renderingHints)?this._renderingHints=Object.freeze([...e.renderingHints]):this._renderingHints=Object.freeze([e.renderingHints]))}createTransformer(e){return null}getName(){return this._name}getSelectType(){return this._type}getInputType(){return this._inputType}getTitle(){return this._title?e._(this._title):e.A.camelToPrettyCase(this.getName())}getDescription(){return this._description?e._(this._description):e._(`condition.selector.ruleDescription`,{title:this.getTitle()})}getRenderHints(){return this._renderingHints}},vg={List:new class extends _g{constructor(e){super({renderingHints:`list`,...e})}get isList(){return!0}}({name:Q.BuiltInSelectorNames.List,title:e.v(`condition.selector.list.title`),type:null,description:e.v(`condition.selector.list.desc`)}),Logical:new _g({name:Q.BuiltInSelectorNames.Logical,title:e.v(`condition.selector.logical.title`),type:n.s.Boolean,description:e.v(`condition.selector.logical.desc`)}),DateTime:new _g({name:Q.BuiltInSelectorNames.DateTime,title:e.v(`condition.selector.dateTime.title`),type:n.s.Date,description:e.v(`condition.selector.dateTime.desc`)}),Date:new class extends _g{constructor(){super({name:Q.BuiltInSelectorNames.Date,title:e.v(`condition.selector.date.title`),type:n.s.Date,inputType:n.s.Date,description:e.v(`condition.selector.date.desc`),renderingHints:[`date`,`calendar`]})}createTransformer(e){return e=>Math.floor(e)}},Time:new class extends _g{constructor(){super({name:Q.BuiltInSelectorNames.Time,title:e.v(`condition.selector.time.title`),type:n.s.Date,inputType:n.s.Date,description:e.v(`condition.selector.time.desc`),renderingHints:[`time`,`clock`]})}createTransformer(e){return e=>e-Math.floor(e)}},Text:new _g({name:Q.BuiltInSelectorNames.Text,title:e.v(`condition.selector.text.title`),type:n.s.String,description:e.v(`condition.selector.text.desc`)}),TextLength:new class extends _g{constructor(){super({name:Q.BuiltInSelectorNames.TextLength,title:e.v(`condition.selector.textLength.title`),type:n.s.Number,inputType:n.s.String,description:e.v(`condition.selector.textLength.desc`)})}createTransformer(e){return e=>e?.length??0}},Number:new _g({name:Q.BuiltInSelectorNames.Number,title:e.v(`condition.selector.number.title`),type:n.s.Number,description:e.v(`condition.selector.number.desc`)}),Whole:new class extends _g{constructor(){super({name:Q.BuiltInSelectorNames.Whole,title:e.v(`condition.selector.whole.title`),type:n.s.Number,inputType:n.s.Number,description:e.v(`condition.selector.whole.desc`)})}createTransformer(e){return e=>Math.floor(e)}}},yg=class{constructor(e){this._delegate=e,this._types=e.getAcceptsTypes?e.getAcceptsTypes():null}getName(){return this._delegate.getName()}createPredicate(e,t){return this._delegate.createPredicate(e,t)}getAcceptsTypes(){return this._types?this._types:null}acceptsList(){return this._delegate.acceptsList?.()??!1}getParamType(e){return e?e.getName():null}isCombinator(){return!1}getTitle(){return this._delegate.getTitle?.()}getDescription(){return this._delegate.getDescription?.()??null}createDefaultParam(e){return this._delegate.createDefaultParam?.(e)}doBatch(e,t,n){return this._delegate.doBatch?.(e,t,n)}toString(e,t){return this._delegate.toString?.(e,t)}get[Symbol.toStringTag](){return`[Condition]: ${this.getName()}`}};function bg(e){if(n.a.isError(e))return{t:`e`,v:e.getCode()};if(!e||typeof e!=`object`)return e;if(e.isICondition)return e.toJSON();if(Array.isArray(e)){let t=!1,n=e.map(e=>{let n=xg(e);return n!==e&&(t=!0),n});return t?n:e}if(typeof e.operator==`string`)return xg(e);if(n.a.isError(e.from)||n.a.isError(e.to)){let t={...e};return n.a.isError(t.from)&&(t.from={t:`e`,v:t.from.getCode()}),n.a.isError(t.to)&&(t.to={t:`e`,v:t.to.getCode()}),t}return e}function xg(e){if(!e||typeof e!=`object`)return e;if(e.isICondition)return e.toJSON();let t=bg(e.param);return t===e.param?e:{...e,param:t}}function Sg(e){if(e&&typeof e==`object`&&e.t===`e`&&typeof e.v==`number`)return n.a.getBuiltInByCode(e.v)}function Cg(e){if(!e)return null;if(e.isICondition)return e;if(typeof e==`function`){let t=e;return new Fg(null,new yg({getName:()=>`Predicate`,createPredicate:e=>t}))}if(typeof e==`string`){let t=e.trim(),n=/^(<=|>=|<>|=|<|>)(.*)$/i.exec(t);if(n){let[,e,t]=n,r=t.trim(),i={"<":Q.BuiltInOperatorNames.LessThan,"<=":Q.BuiltInOperatorNames.LessThanEqualTo,">":Q.BuiltInOperatorNames.GreaterThan,">=":Q.BuiltInOperatorNames.GreaterThanEqualTo,"=":Q.BuiltInOperatorNames.EqualTo}[e],a=Fg.Operators.get(i);if(!a)throw Error(`Unknown operator for shorthand: ${e}`);return new Fg(null,a,r)}}if(typeof e==`object`){let t={...e},n=null,r=t.selector;if(r)if(typeof r==`string`){if(n=Fg.Selectors.get(r)??null,!n)throw Error(`Unknown selector name: ${r}`)}else n=r;let i=t.operator;if(typeof i==`function`&&(i=i()),typeof i==`string`){let e=Fg.Operators.get(i);if(!e)throw Error(`Unknown operator name: ${i}`);i=e}let a=t.includeBlanks,o=function(e){let t=Sg(e);if(t)return t;if(!e||typeof e!=`object`||Array.isArray(e))return e;let n=Sg(e.from),r=Sg(e.to);return n||r?{...e,from:n??e.from,to:r??e.to}:e}(t.param);if(i||n||a!==void 0)return new Fg(n,i,o,a)}return null}var wg=class{constructor(e,t){this._resolved=null,this._json={...e},this._reason=t}resolve(){let e=this._resolved;if(e)return e;try{e=Cg(this._json)}catch(e){return this._reason=e?.message??this._reason,null}return this._resolved=e,e}getUnresolvedReason(){return this._reason}getSelector(){return this.resolve()?.getSelector()??null}getOperator(){return this.resolve()?.getOperator()??null}getParam(){return this._json.param??null}isIncludeBlanks(){return this._json.includeBlanks??!1}toString(){return this.resolve()?.toString()??this._reason}toJSON(){let e=this._resolved;return e?e.toJSON():{...this._json}}get isICondition(){return!0}};function Tg(t){if(!t)return null;try{return Cg(t)}catch(n){let r=n?.message??`Unresolvable condition.`;return e.V.debug(`Condition kept unresolved: ${r}`,{onceKey:`condition.unresolved.${r}`,meta:{type:`condition`}}),new wg(t,r)}}function Eg(e){return e.getOperator()?.getName()===Q.BuiltInOperatorNames.Expression||Dg(e.getParam())}function Dg(e){return typeof e==`string`?e.startsWith(`=`):!(!e||typeof e!=`object`)&&(Array.isArray(e)?e.some(Og):e.isICondition||e.operator!==void 0?Og(e):!(typeof e.from!=`string`||!e.from.startsWith(`=`))||!(typeof e.to!=`string`||!e.to.startsWith(`=`)))}function Og(e){if(!e||typeof e!=`object`)return!1;if(e.isICondition)return Eg(e);let t=e.operator;return(typeof t==`string`?t:t?.getName?.())===Q.BuiltInOperatorNames.Expression||Dg(e.param)}var kg=(e,t)=>e===t||e===n.s.Date&&t===n.s.Number;async function Ag(e,t){let r=t.coords,i=t.values,a=t.cellValuesOptions,o=i.entries(a),s={position:null},c=new Pg(t.runtime,s,t.values,r,t.calculation??null,t.visibleCoords);c.setWatchFormula(t.watchFormula??null);let l=e.getSelector(),u=l?await l.createTransformer(c):null,d=l?.getInputType()??null,f=l?.getSelectType()??null,p=e.getOperator(),m=p?.getAcceptsTypes?.()??null,h=await p?.createPredicate(e.getParam(),c);if(!h)return;c.setBatchCapable(typeof p?.doBatch==`function`);let g=t.onBlank;if(g){let e=i.getCount();if((r.rowEnd-r.rowStart+1)*(r.colEnd-r.colStart+1)>e){c.beginPredicateCall();let e=h(null,c);c.wasDeferred()||g(e)}}let _=t.onTrue,v=t.onFalse,y=[],b=o.next();for(;!b.done;){let e=b.value;b=o.next();let t=e[1],n=e[0];if(d!==null&&!kg(d,nE(t))){v&&v(n,t);continue}let r=u?u(t,c):t;if(m!==null){let e=f??nE(r);if(!m.includes(e)){v&&v(n,t);continue}}s.position=n,c.beginPredicateCall();let i=h(r,c);c.wasDeferred()?y.push([n,t]):i?_&&_(n,t):v&&v(n,t)}if(y.length>0){let t=await p.doBatch(c.getDeferredKeys(),e.getParam(),c);for(let[e,i]of y){let a;try{a=t?.getValueAt(e.rowIndex-r.rowStart,e.colIndex-r.colStart)??null}catch(e){if(!n.a.isError(e))throw e;a=e}!n.a.isError(a)&&a?_&&_(e,i):v&&v(e,i)}}}async function jg(t){let r=t.coords,i={bounds:r,axis:t.axis??n.l.Axis.Column},a=t.getHiddenRuns;if(a){let e=t.includeHidden;!0!==e&&e!==n.l.Axis.Row&&(i.processRowSkip=$r(a(n.l.Axis.Row))),!0!==e&&e!==n.l.Axis.Column&&(i.processColumnSkip=$r(a(n.l.Axis.Column)))}let o=t.conditions[0];if(!o)return;let s=Fg.resolveInput(o);if(!s)return void e.V.debug(`No condition to evaluate.`,{onceKey:`condition.none`,meta:{type:`condition`}});let c=t.calculation;c&&Eg(s)&&await c.ready(),await Ag(s,{runtime:t.runtime,values:t.values,coords:r,cellValuesOptions:i,calculation:t.calculation,watchFormula:t.watchFormula,onTrue:t.onTrue,onFalse:t.onFalse,onBlank:t.onBlank})}function Mg(e,t,n){if(t>n)return[];let r=Ur(e.map(e=>({min:e.min,max:e.max,value:!0}))),i=[];return Jr(r,e=>{!0!==e.value&&i.push({min:e.min,max:e.max})},t,n),i}function Ng(...e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(let e=0;e<r.length;e++)t.push({min:r[e].min,max:r[e].max})}return t.length===0?[]:Vr(Hr(Ur(t)))}var Pg=class{constructor(e,t,n,r,i=null,a){this._coords=null,this._values=null,this._range=null,this._watchFormula=null,this._batchCapable=!1,this._deferredCall=!1,this._deferredKeys=null,this._runtime=e,this._scope=t,this._values=n,this._coords=Object.freeze(r),this._calculation=i,this._visibleCoords=a}setBatchCapable(e){this._batchCapable=e,this._deferredKeys=null}beginPredicateCall(){this._deferredCall=!1}wasDeferred(){return this._deferredCall}getDeferredKeys(){return this._deferredKeys??new Set}getType(e){return nE(e)}getPosition(){return this._scope.position}getCoords(){return this._coords}getRange(){let e=this._range;if(!e){let t=this._visibleCoords;e=t?new rD(this._runtime,this._values,this._coords,t):new nD(this._runtime,this._values,this._coords),this._range=e}return e}toType(e,t){return dE(this._runtime,e,nE(e),t,!1)}async resolveInput(e){return Fg.resolveInput(e)}fromSerialDate(e){return ur(e,this._runtime.isDate1904())}getDateParts(e,t){return sr(e,this._runtime.isDate1904(),t)}toSerialDate(e){return dr(e,this._runtime.isDate1904())}getNow(){return this._runtime.getNow()}deferBatch(e){if(!this._batchCapable)throw Error(`ICondition.IContext.deferBatch was called but the active operator does not implement doBatch.`);this._deferredCall=!0,(this._deferredKeys??=new Set).add(e)}setWatchFormula(e){this._watchFormula=e}async watchFormula(e){if(!e||!e.trim())return null;let t=this._watchFormula;if(t)return t(e);let n=this.createFormula(e);return n?await n.evaluate({block:this._coords,alwaysReturnRange:!0}):null}createFormula(e,t){return this._calculation?this._calculation.createFormula(e,t??{rowIndex:this._coords.rowStart,colIndex:this._coords.colStart}):null}async resolveFormula(e){if(typeof e!=`string`||!e.startsWith(`=`))return e;let t=this.createFormula(e);if(!t)return null;let n=await t.evaluate();return n?.isIRange?n.getValueAt(0,0):n}},Fg=class{constructor(e,t,n=void 0,r=!1){this._selector=e,this._operator=t,this._param=n,this._includeBlanks=r}getSelector(){return this._selector}getOperator(){return this._operator}getParam(){return this._param??null}isIncludeBlanks(){return this._includeBlanks}toString(){let t,n=this._selector,r=n?n.getTitle():e._(`condition.anySelector`),i=this._operator;return i&&(t=i.toString?.(this.getParam(),n)??i.getTitle?.()??e.A.camelToPrettyCase(i.getName())),t?e._(`condition.selectorWithOperator`,{selector:r,operator:t}):r}toJSON(){let e=this.getOperator(),t=this.getSelector(),n=this.getParam(),r={};return t&&(r.selector=t.getName()),e&&(r.operator=e.getName()),n!=null&&(typeof n.toJSON==`function`&&(n=n.toJSON()),r.param=bg(n)),this.isIncludeBlanks()&&(r.includeBlanks=!0),r}get isICondition(){return!0}};(function(e){let t=e.BuiltInSelectors=vg,n=e.BuiltInOperators=gg;e.Selectors=new c(t),e.Operators=new c(n),e.resolveInput=Cg,e.fromJSON=Tg})(Fg||={});var Ig=`Item has been closed. No further operations are allowed.`,Lg=class{constructor(t){this._closed=!1,this._range=null,this._ranges=null,this._options=t,t=this._initializeOptions(t),this._options=t;let n=this;this._transactions=this._options.transactions??new m({transient:!0}),this._id=this._transactions.create(),this._emitter=new v(this,this._transactions);let r=this._options.coords;r=Array.isArray(r)?e.l.sanitizeRangeArray(r):e.l.sanitizeRange(r),this._options.setContainerCallbacks?.({processShift:e=>n._processContainerShift(e),processAfterShift:(e,t)=>n._processAfterContainerShift(e,t),processDelete(){n._processContainerDelete()},processLayout(){n._processContainerLayout()},processProtection(){n._processContainerProtection()}}),this._transactionsRemoveListener=this._transactions.addStateListener(this._id,{onBeforeCommitStart(e,t,r){n._processBeforeCommitStart(e,t,r)},onAfterStateChange(e,t,r){n._processAfterStateChange(e,t,r)},onRestoreOrRevert(e,t,r){n._processRestoreOrRevert(e,t,r)}}),this._updateState({isDeleted:!1,anchorCoords:r},e.v(`op.createAnchoredItem`)),this._initialize(t)}_initializeOptions(e){if(!e)throw Error(`Anchored.ConstructorOptions is required`);if(!(e={...e}).coords)throw Error(`coords is required`);return e}_initialize(e){}_getEmitter(){return this._emitter}delete(e){this._delete()}isProtected(){return this._options.isProtected?.()??!1}getAnchorCoords(){let e=this._getState()?.anchorCoords;return e?Array.isArray(e)?e.length===0?null:e:[e]:null}getFirstAnchorCoords(){let e=this._getState()?.anchorCoords;return e?Array.isArray(e)?e[0]??null:e:null}_invalidateRangeCache(){this._range=null,this._ranges=null}_isAnchorAbsolute(){return!1}getRanges(e){if(!e&&this._ranges)return this._ranges;let t=this._getState()?.anchorCoords,n=t?this._options.getRanges(t,e):new gT(null);return t&&this._isAnchorAbsolute()&&(n=n.getFixed(!0)),e||(this._ranges=n),n}getRange(e){if(!e&&this._range)return this._range;let t=this.getRanges(e),n=t.isInvalid()?hT:t.at(0);return e||(this._range=n),n}_setAnchorRanges(t,n){let r=this._options.getRanges(t).getCoords();if(r.length===0)throw new e.s(e._(`error.address.noAddress`));let i=this._options.setContainerCoords;return i?(i(t,n),this):(this._updateState({anchorCoords:[...r]},{description:e.v(`op.setRanges`),...n}),this._processAnchorCoords(),this._emitter.notify(`onAnchorCoordsChange`),this)}getAnchorType(){return this._getState()?.anchorType??Sh.Type.TwoCell}getId(){return this._id}getVersionId(){return this._transactions.getVersionId(this._id)}beginCommit(e){return this._beginCommit(e)}doBatch(e,t){let n=this;return this._transactions.doBatch(e,typeof t==`string`?{description:t}:t,e=>{n._processTransactionDone(e)})}_processTransactionDone(e){}_getState(){if(this._closed)throw Error(Ig);return this._transactions.getState(this._id)}_beginCommit(e){return this._transactions.beginCommit(typeof e==`string`?{description:e}:e)}_getTransactions(){return this._transactions}_updateState(t,n,r,i=!1){if(this._closed)throw Error(Ig);if(!t)return;if(typeof n==`string`&&(n={description:n}),!i&&this.isProtected())throw new e.s(((t=e.v(`op.update`))=>e._(`error.anchor.protected`,{description:e._(t)}))(n?.description));let a=this._beginCommit(n?.description);t&&`anchorCoords`in t&&this._invalidateRangeCache();try{let e=this._getState(),n=a.updateState(this._id,t),i=!1;if(r){let e=r.length;for(let t=0;t<e;t++){let e=r[t];i||=e===`onAnyChange`,this._emitter.notify(e)}}!i&&r&&r.length>0&&this._emitter.notify(`onAnyChange`),this._processUpdateState(e,n),a.commit()}catch(e){throw a.rollback(),e}return this}_notify(e){if(!e)return;Array.isArray(e)||(Rg[0]=e,e=Rg);let t=e?e.length:0;if(t===0)return;let n=!1;for(let r=0;r<t;r++){let t=e[r];n||=t!==`onAnyChange`,this._emitter.notify(t)}n||this._emitter.notify(`onAnyChange`)}_processAfterContainerShift(t,n){let r=n?n.length:0;if(!zg(this._getState()?.anchorCoords,n)){let t=null,i={anchorCoords:r===0?null:n};r===0&&(i.isDeleted=!0,t=[`onDelete`]),this._updateState(i,{description:e.v(`op.updateAnchor`)},t),this._processAnchorCoords()}this._emitter.notify(`onAnchorCoordsChange`)}_processContainerShift(t){let n=this._getState()?.anchorCoords;if(Array.isArray(n)&&n.length>1)return t.after;let r=null,i={anchorCoords:t.after};return t.after||(i.isDeleted=!0,r=[`onDelete`]),this._updateState(i,{description:e.v(`op.updateAnchor`)},r),this._processAnchorCoords(),t.after}_processBeforeCommitStart(e,t,n){}_processAfterStateChange(e,t,n){}_processUpdateState(e,t){}_processRestoreOrRevert(e,t,n){this._invalidateRangeCache(),this._emitter.notify(`onInvalidated`)}_processAnchorCoords(){this._invalidateRangeCache()}_processContainerLayout(){}_getActionDescription(e){return null}_delete(){if(this._getState().isDeleted)return;let t={description:this._getActionDescription(`delete`)??e.v(`op.delete`)},n=this._beginCommit(t?.description);try{this._processDelete(),this._updateState({isDeleted:!0}),this._options.deleteFromContainer?.(t),n.commit()}catch(e){throw n.rollback(),e}}_processContainerDelete(){this._processAnchorCoords(),this._processDelete()}_processDelete(){this._invalidateRangeCache(),this._emitter.notify(`onDelete`)}_processContainerProtection(){this._emitter.notify(`onProtectedChange`)}addListeners(e,t){return this._emitter.addListeners(e,t)}isClosed(){return this._closed}isDeleted(){return this._closed||(this._getState()?.isDeleted??!1)}_processClose(){this._closed=!0,this._invalidateRangeCache(),this._emitter.notify(`onClose`),this._transactionsRemoveListener?.(),this._transactions.remove(this._id)}close(){this._closed||this._processClose()}get isIAnchored(){return!0}},Rg=[null],zg=(t,n)=>{let r=n?n.length:0;if(!t)return r===0;let i=Array.isArray(t)?t:[t];if(i.length!==r)return!1;for(let t=0;t<r;t++)if(!e.l.isEqualRanges(i[t],n[t]))return!1;return!0};function Bg(t,n,r){let i=e._(t,r);return i===t?n:i}function Vg(t=1){return Bg(e.v(`table.defaultName`),`Table${t}`,{n:t})}function Hg(){return Bg(e.v(`table.emptyColumnName`),`Column`)}function Ug(e,t){return`${e}${t+1}`}function Wg(e){return e?e.trim().toLocaleLowerCase():null}var Gg=Object.freeze({showRowStripes:!0,showColumnStripes:!1,showFirstColumn:!1,showLastColumn:!1});function Kg(t){if(!t)return e.A.EmptyArray;let n=t.length,r=t;for(let e=0;e<n;e++){let n=t[e];typeof n==`string`&&(r===t&&(r=[...t]),r[e]={name:n})}return r}var qg,Jg,Yg=(e,t=Hg(),n=Ug)=>{let r=new Set,i=e.length;for(let t=0;t<i;t++){let n=e[t]?.name;if(!n)continue;let i=Wg(n);r.add(i)}let a=-1,o=Wg(t);return()=>{let e;do a++,e=n(o,a);while(r.has(e));return a}};function Xg(e,t,n=0,r,i=Hg(),a=Ug){let o=e?e.length:0,s=Kg(e),c=t?t.length:0,l=Kg(t),u=Math.max(c,o),d=Array(u);for(let e=0;e<u;e++){let t=e>=n?l[e-n]:void 0;t===void 0&&(t=s[e]),d[e]=t}let f=0,p=0,m=0,h=0,g=!0,_=Yg(d,i),v=new Map;for(let e=0;e<n;e++){let t=d[e]?.name,n=Wg(t);n&&v.set(n,1)}let y,b,x=n+c;for(let e=n;e<u;e++){let t=d[e],n=t?.name,o=n,c=Wg(o);if(c)h++,y=c,b=n,g=!1;else{if(e>=x&&(h=0,m=0),g||(m=h),r||m<=1){let t=_();o=a(i,t),o!==s[e]?.name&&(p=t+1),c=Wg(o)}else f++,c=y,o=b;h=0,g=!0}let l=v.get(c)??0;l===1&&(l+=Math.max(0,Math.max(p+f,m)-1)),l>0&&(o=a(o,l)),l++,v.set(c,l),o!==n&&(d[e]={...t,name:o})}return d}var Zg,Qg,$g=class{constructor(e,t,n,r,i){this._table=e,this._id=t,this._getProps=n,this._updateProps=r,this._deleteSelf=i}getTable(){return this._table}getName(){return this._getProps(this._id).name??null}setName(t){return this._updateProps(this._id,{name:t},e.v(`op.setColumnName`)),this}getId(){return this._getProps(this._id).id??null}getIndex(){return this._getProps(this._id).index??-1}setTotalsRowLabel(t){return this._updateProps(this._id,{totalsRowLabel:t},e.v(`op.setTotalsRowLabel`)),this}getTotalsRowLabel(){return this._getProps(this._id).totalsRowLabel||null}setTotalsRowFormula(t){return this._updateProps(this._id,{totalsRowFormula:t},e.v(`op.setTotalsRowFormula`)),this}getTotalsRowFormula(){return this._getProps(this._id).totalsRowFormula??null}getSort(){return this._table.getSortAt(this._getProps(this._id).index)}getFilter(){return this._table.getFilterAt(this._getProps(this._id).index)}isHiddenButton(){return this._table.isHiddenButtonAt(this._getProps(this._id).index)}setHiddenButton(e){return this._table.setHiddenButtonAt(this._getProps(this._id).index,e),this}getRange(){let e=this._table.getRange(),t=e?.getCoords(),n=this._getProps(this._id).index;return e.getIntersect({colStart:t.colStart+n,rowStart:t.rowStart,colEnd:t.colStart+n,rowEnd:t.rowEnd})}delete(e){this._deleteSelf(this._id,e)}toJSON(){let t=e.A.cloneObject(this._getProps(this._id));return delete t.index,delete t.sortProps,delete t.filterProps,t}get[Symbol.toStringTag](){return`[TableColumn]`}toString(){return this.getName()??``}get isIColumn(){return!0}},e_=class{constructor(e){this._closed=!1,this._options={...e};let t=this;this._transactions=this._options?.transactions??new m({transient:!0}),this._id=this._transactions.create({isDeleted:!1}),this._emitter=new v(this,this._transactions),e?.json&&this._fromJSON(e.json),this._options?.setContainerReadOnlyCallback?.(()=>{t._processOnContainerReadOnly()}),this._transactionsRemoveListener=this._transactions.addStateListener(this._id,{onAfterStateChange(e,n,r){t._processAfterStateChange(e,n,r)},onRestoreOrRevert(e,n,r){t._processRestoreOrRevert(e,n,r)}}),this._processInit()}_fromJSON(e){}isReadOnly(){return this._options.isReadOnly?.()??!1}isDeleted(){return this._getState().isDeleted??!1}getType(){return this._options.type}get isIModel(){return!0}_processTransactionDone(e){}_getActionDescription(e){return null}_getState(){if(this._closed)throw Error(e._(`error.model.modelClosed`));return this._transactions.getState(this._id)}_beginCommit(e){return this._transactions.beginCommit(typeof e==`string`?{description:e}:e)}_getTransactions(){return this._transactions}_updateState(t,n,r){if(this._closed)throw Error(e._(`error.model.modelClosed`));if(!t)return this;let i=this._beginCommit(n?.description);try{i.updateState(this._id,t);let e=!1,a=r?r.length:0;for(let t=0;t<a;t++){let n=r[t];e||=n===`onAnyChange`,this._emitter.notify(n)}!e&&r&&a>0&&this._emitter.notify(`onAnyChange`),i.commit(n)}catch(e){throw i.rollback(),e}return this}_getEmitter(){return this._emitter}_processInit(){}_processAfterStateChange(e,t,n){}_processRestoreOrRevert(e,t,n){this._emitter.notify(`onInvalidated`)}delete(e){this._getState().isDeleted||this._delete(e)}_delete(t){t={description:this._getActionDescription(`delete`)??e.v(`op.delete`),...t};let n=this._beginCommit(t?.description);try{this._options.deleteFromContainer&&this._options.deleteFromContainer?.(t),this._processDelete(),n.commit()}catch(e){throw n.rollback(),e}}_processOnContainerDeleted(){this._processDelete()}_processDelete(){this._updateState({isDeleted:!0},void 0,[`onDelete`])}_processOnContainerReadOnly(){this._emitter.notify(`onReadOnlyChange`)}addListeners(e,t){return this._emitter.addListeners(e,t)}getId(){return this._id}getVersionId(){return this._transactions.getVersionId(this._id)}beginCommit(e){return this._beginCommit(e)}doBatch(e,t){let n=this;return this._transactions.doBatch(e,typeof t==`string`?{description:t}:t,e=>{n._processTransactionDone(e)})}isClosed(){return this._closed}close(){this._closed||(this._emitter.notify(`onClose`),this._closed=!0,this._transactionsRemoveListener?.(),this._transactions.remove(this._id))}},t_=class extends e_{_fromJSON(t){let n={};if(n.name=t?.name??null,!n.name)throw Error(e._(`error.model.nameRequired`));n.comment=t?.comment??null,n.hidden=t?.hidden??!1,n.scope=t?.scope??null,this._updateState(n,{description:n.name?e._(`op.createItemNamed`,{name:n.name}):e.v(`op.createItem`)})}_toJSON(){let e=this._getState(),t={name:e.name};return e.comment&&(t.comment=e.comment),e.hidden&&(t.hidden=e.hidden),e.hidden&&(t.hidden=e.hidden),e.scope&&(t.scope=e.scope),t}getName(){return this._getState().name}setName(t,n){if(!t)throw Error(e._(`error.model.nameRequired`));return this._updateState({name:t},{description:e._(`op.updateNamed`,{name:t}),...n})}getComment(){return this._getState().comment}setComment(t,n){return this._updateState({comment:t},{description:e.v(`op.setComment`),...n})}isHidden(){return this._getState().hidden}getScope(){return this._getState().scope}get isINamed(){return!0}},n_=class extends t_{constructor(e,t,n){super({...n,type:`namedTable`}),this._sheet=e,this._table=t;let r=this;this._table.addListeners({onDelete:()=>{r._options.deleteFromContainer?r._options.deleteFromContainer?.():r._delete()},onAnyChange:()=>{r._emitter.notify(`onAnyChange`)},onAnchorCoordsChange:()=>{r._emitter.notify(`onAnyChange`)}},{transactional:!0})}async select(e){return await this._table.select(e),this}getRanges(){let e=this._table;return(this._sheet.getWorkbook()??this._sheet).getRanges(e.getDataRange()).getFixed(!0)}getPartReference(e){if(e?.length!==1)return null;let t=e[0],n=this._table.getName();if(t.scope&&t.scope!==this._sheet.getName())return null;let r=this._rowBand(t);if(!r)return null;let i=this._columnSpan(t);if(!i||i.kind===`all`&&r.length===1&&r[0]===`#Data`)return null;let a=i.kind!==`all`&&r.length===1&&r[0]===`#Data`?[]:r,o=null,s=null;i.kind===`one`?(o=i.name,s=`[${i.name}]`):i.kind===`span`&&(o=s=`[${i.first}]:[${i.last}]`);let c=a.map(e=>`[${e}]`);return s&&c.push(s),c.length===1?`${n}[${a.length===1?a[0]:o}]`:`${n}[${c.join(this._listSeparator())}]`}_rowBand(e){let t=this._table,n=e=>e?.getCoords()??null,r=t=>{let r=n(t);return!!r&&r.rowStart===e.rowStart&&r.rowEnd===e.rowEnd};if(r(t.getDataRange()))return[`#Data`];if(t.isShowHeaders()&&r(t.getHeaderRowRange()))return[`#Headers`];if(t.isShowTotals()&&r(t.getTotalRowRange()))return[`#Totals`];if(r(t.getRange()))return[`#All`];let i=n(t.getDataRange()),a=t.isShowHeaders()?n(t.getHeaderRowRange()):null,o=t.isShowTotals()?n(t.getTotalRowRange()):null;return i&&a&&e.rowStart===a.rowStart&&e.rowEnd===i.rowEnd?[`#Headers`,`#Data`]:i&&o&&e.rowStart===i.rowStart&&e.rowEnd===o.rowEnd?[`#Data`,`#Totals`]:null}_columnSpan(e){let t=this._table,n=t.getRange()?.getCoords();if(n&&e.colStart===n.colStart&&e.colEnd===n.colEnd)return{kind:`all`};let r=t.getColumns(),i=null,a=null;for(let t=0;t<r.length;t++){let n=r[t].getRange()?.getCoords();n&&(n.colStart===e.colStart&&(i=r[t]),n.colEnd===e.colEnd&&(a=r[t]))}return i&&a?i===a?{kind:`one`,name:i.getName()}:{kind:`span`,first:i.getName(),last:a.getName()}:null}_listSeparator(){return Zn(this._sheet.getWorkbook()?.getLocale()??`en`).listSeparator}getScope(){return null}getType(){return`table`}getName(){return this._table.getName()}getValue(){return this._table}},r_=class{constructor(e,t,n,r){this._table=e,this._id=t,this._getProps=n,this._getColumnProps=r}sort(e){this.setCriteria({reverse:e??!1},!1)}getCriteria(){return this._getProps(this._id).criteria??null}setCriteria(t,n,r){let i,a={};if(t&&(t.reverse!==void 0&&(a.reverse=t.reverse),t.collatorOptions!==void 0&&(a.collatorOptions=t.collatorOptions),t.sortOn!==void 0&&(a.sortOn=t.sortOn),t.iconSet!==void 0&&(a.iconSet=t.iconSet),t.iconId!==void 0&&(a.iconId=t.iconId),t.dxfId!==void 0&&(a.dxfId=t.dxfId),t.customList!==void 0&&(a.customList=t.customList)),n){let n=this._table.getActiveSorts(),o=n.length,s=this.getIndex(),c=!1,l=[];for(let e=0;e<o;e++){let t=n[e],r=t.getIndex(),i=r===s;c||=i,i||(l[e]={index:r,criteria:t.getCriteria()})}t!==null&&l.push({index:this.getIndex(),criteria:a}),i={sorts:l,description:e._(`op.sortColumn`,{name:this._getColumnProps(this._id).name}),...r}}else i={sorts:[{index:this.getIndex(),criteria:a}],description:e._(`op.sortColumn`,{name:this._getColumnProps(this._id).name}),...r};this._table.sort(i)}apply(){this._table.applySorts()}getIndex(){return this._getColumnProps(this._id).index}getRange(){let e=this._table,t=e.getRange(),n=t.getCoords(),r=e.isShowTotals(),i=n.colStart+this.getIndex();return t.getIntersect({colStart:i,rowStart:n.rowStart,colEnd:i,rowEnd:n.rowEnd-+!!r})}getLevel(){return this._getProps(this._id).level??-1}delete(t){this.getLevel()!==-1&&this.setCriteria(null,!0,{description:e.v(`op.clearSort`),...t})}},i_=class{constructor(e,t,n,r){this._table=e,this._id=t,this._getProps=n,this._getColumnProps=r}filter(e,t){return this.setCondition(e,!1,t),this}getCondition(){return this._getProps(this._id).condition??null}setCondition(t,n,r){let i=[];if(n){let e=this._table.getActiveFilters(),t=e.length,n=this.getIndex(),r=!1;for(let a=0;a<t;a++){let t=e[a],o=t.getIndex(),s=o===n;r||=s,s||(i[a]={index:o,...t.getCondition().toJSON()})}}let a=Fg.resolveInput(t);a!==null&&i.push({index:this.getIndex(),...a});let o={conditions:i,description:e._(`op.filterColumn`,{name:this._getColumnProps(this._id).name}),...r};this._table.filter(o)}apply(){this._table.applyFilters()}getIndex(){return this._getColumnProps(this._id).index}getRange(){let e=this._table,t=e.getRange(),n=t.getCoords(),r=e.isShowTotals(),i=n.colStart+this.getIndex();return t.getIntersect({colStart:i,rowStart:n.rowStart,colEnd:i,rowEnd:n.rowEnd-+!!r})}getLevel(){return this._getProps(this._id).level??-1}delete(t){this.getLevel()!==-1&&this.setCondition(null,!1,{description:e.v(`op.deleteFilter`),...t})}},a_=class extends Lg{constructor(e){super(e)}_initializeOptions(e){let t=e?.coords;return Array.isArray(t)&&(e={...e,coords:t[0]}),super._initializeOptions(e)}initializeColumnCreator(e,t,n,r){return i=>new $g(e,i,t,n,r)}initializeSortCreator(e,t,n){return r=>new r_(e,r,t,n)}initializeFilterCreator(e,t,n){return r=>new i_(e,r,t,n)}_initialize(t){super._initialize(t),this._emptyColumnName=Hg(),this._emptyColumnNamer=Ug;let n=this;this._styles=t.styles??t?.sheet?.getStyles()??new jm,this._names=t?.names,this._sheet=t?.sheet,this._processTableUpdate=t?.processTableUpdate,this._setContainerName=t?.setContainerName,this._lastTransactionId=this._getTransactions().getCurrentCommit().getId(),this._colHeadersSizeUnlistener=null,this._rowHeadersSizeUnlistener=null,this._visibleRange=null,this._isHeaderVisible=!0,this._isTotalVisible=!0,this._isFirstColumnVisible=!0,this._isLastColumnVisible=!0,this._styleCache=null,this._stylePropsCache=null,this._stylesRemoveListener=this._styles.addListeners({onTableStylesChange(){n._styleCache=null,n._stylePropsCache=null,n._notify(`onStyleChange`),n._notify(`onAnyChange`)}}),this._createColumn=this.initializeColumnCreator(this,e=>n._getState().mapColumnPropsById.get(e),(t,r,i)=>{let a,o=n._getState(),s=o.mapColumnPropsById.get(t);if(i=typeof i==`string`?{description:i}:{description:e._(`op.updateColumnNamed`,{name:s.name}),...i},r){if(r.id)throw Error(`Table column ID is immutable and can not be changed.`);if(a={...s,...r},r.name||r.totalsRowFormula||r.totalsRowLabel){let e=o.orderedColumnsProps,t=[...e];t[s.index]=a,t=Xg(e,t,0,!0,this._emptyColumnName,this._emptyColumnNamer);let r=n._beginCommit(i);try{this._updateColumnsState(t),this._writeSyncSheet(!1),r.commit()}catch(e){throw r.rollback(),e}return}}else a={id:s.id,index:s.index,name:s.name,sortProps:null,filterProps:null};this._updateState(a,i)},(e,t)=>{n._deleteColumn(e,t)});let r=e=>n._getState().mapColumnPropsById.get(e);this._createSort=this.initializeSortCreator(this,e=>n._getState().mapColumnPropsById.get(e)?.sortProps||c_,r),this._createFilter=this.initializeFilterCreator(this,e=>n._getState().mapColumnPropsById.get(e)?.filterProps||l_,r),this._updateState({name:Vg(),headerRowCount:1,totalsRowCount:0,mapColumnById:s_,mapColumnByIndex:s_,mapColumnByName:s_,orderedColumns:e.A.EmptyArray,mapColumnPropsById:s_,orderedColumnsProps:e.A.EmptyArray,sortsActive:e.A.EmptyArray,filtersActive:e.A.EmptyArray,mapHiddenButtons:s_,lastColId:0,description:``},e.v(`op.initializeTable`));let i=t?.sheet;if(i&&t?.syncSheet){let e=this._getState(),n=e.anchorCoords,r=e.headerRowCount,i=e.totalsRowCount;this._ensureHeightForHeaderTotals(n,r,i,t?.json?.headerRowCount,t?.json?.totalsRowCount)}try{this._fromJSON(t?.json)}catch(e){throw console.error(`Error creating Table from JSON`,e),e}if(i){if(t?.syncSheet){let t=this._readSyncSheet(!0);t&&(this._updateColumnsState(t.columns,e.v(`op.updateColumnsFromSheet`)),this._writeSyncSheet())}this._setupAutoExpand(),this._columnListener=t=>{if(this._lastTransactionId===t.getTransactionId()||t.isUndo)return;let n=this._readSyncSheet();if(!n)return;let r=n.columns;this._updateColumnsState(r,e.v(`op.updateColumnsFromSheet`)),n.converted&&this._writeSyncSheet()},this._processHeaderListener(),this._processTotalsListener();let n=this,r={onSizesChange:()=>{n._calcVisible()}};this._colHeadersSizeUnlistener=i.getColumnHeaders().addListeners(r),this._rowHeadersSizeUnlistener=i.getRowHeaders().addListeners(r),this._calcVisible()}if(this._names){let e=this._createNamed();e&&t.setContainerName?.(e.getName()),this._namedItem=e}}getNamed(){return this._namedItem??null}_ensureVisible(){this._calcVisible()}_calcVisible(){let e=this.getFirstAnchorCoords(),t=this._sheet,n=0,r=0;e&&t&&(n=t.getColumnHeaders().getVisibleIndex(e.colEnd).min,r=t.getRowHeaders().getVisibleIndex(e.rowEnd).min);let i=this.isShowHeaders(),a=this.isShowTotals();if(e&&t&&(n<e.colEnd||r<e.rowEnd)){let o=t.getColumnHeaders(),s=t.getRowHeaders(),c=o.getVisibleIndex(e.colStart).max,l=s.getVisibleIndex(e.rowStart).max;this._visibleRange={colStart:c,colEnd:n,rowStart:l,rowEnd:r},this._isHeaderVisible=i&&!s.at(e.rowStart).isHidden(),this._isTotalVisible=a&&!s.at(e.rowEnd).isHidden(),this._isFirstColumnVisible=!o.at(e.colStart).isHidden(),this._isLastColumnVisible=!o.at(e.colEnd).isHidden()}else this._visibleRange=null,this._isFirstColumnVisible=!0,this._isLastColumnVisible=!0,this._isHeaderVisible=i,this._isTotalVisible=a}getSnapshot(e){let t=this.toJSON(),n=this.getFirstAnchorCoords(),r=this.getName(),i={...t},a=this,o=Object.freeze({...e}),s=!1;return{async copyTo(e,t){let r=e.tables,c=e.range;({...o,...t}).isCut&&!s&&(a.delete(),s=!0);let l={colStart:c.colStart,rowStart:c.rowStart,colEnd:n.colEnd-n.colStart+c.colStart,rowEnd:n.rowEnd-n.rowStart+c.rowStart};return r.add(l,{properties:i,disabledAutofit:!0,hasHeader:!0}),l},getCoords:()=>n,getSource:()=>a,getName:()=>r,getMarkOptions:()=>o,isISnapshot:!0}}getAnchorType(){return Sh.Type.TwoCell}getStyle(){if(this._styleCache)return this._styleCache;let e=this._getState();return e?(this._styleCache=this._styles.getTableStyle(e.style.name)??this._styles.getDefaultTableStyle(),this._styleCache):this._styles.getTableStyle(null)}addRow(e,t){return this.addRows(e??2**53-1,1,t)}_ensureHeightForHeaderTotals(t,r,i,a,o){let s=this._sheet;if(!s)return!1;let c=t,l=a??r,u=l-r;if(l>r){let t=s.getEntireRange().getCoords().rowStart,r=c.rowStart-u,i={colStart:c.colStart,rowStart:r,colEnd:c.colEnd,rowEnd:c.rowStart-1};if(r<t){let e=t-r;i.rowStart=t,i.rowEnd=e-1,s.getRange(i).insert(n.l.Axis.Row),i.rowEnd=c.rowEnd+e,c=i}else{let t=s.getRange(i);if(c=e.l.unionRanges(i,c),t.isContentful()){let e=t.getOffsetBy(u,0);e.insert(n.l.Axis.Row),i=e.getCoords(),c.rowStart+=u,c.rowEnd+=u}}}else if(u!==0){let e={...c};e.rowEnd=c.rowStart+u+1,s.doBatch(()=>{s.getRange(e).clear()},{}),c={...c},c.rowStart-=u}let d=o??i,f=d-i;if(d>i){let t={colStart:c.colStart,rowStart:c.rowEnd+1,colEnd:c.colEnd,rowEnd:c.rowEnd+f},r=s.getRange(t);r.isContentful()&&r.insert(n.l.Axis.Row),c=e.l.unionRanges(t,c)}else if(f!==0){let e={...c};e.rowStart=c.rowEnd+f+1,s.doBatch(()=>{s.getRange(e).clear()},{}),c={...c},c.rowEnd+=f}let p=e.l.isEqualRanges(c,t);return p||(this._updateState({anchorCoords:c}),this._options.setContainerCoords?.(c),this._calcVisible(),this._styleCache=null),u!==0&&this._processHeaderListener(),f!==0&&this._processTotalsListener(),p||u!==0||f!==0}addRows(t,r=1,i){let a=this._getState(),o={...a.anchorCoords},s=this._sheet,c=o.rowEnd,l=a.headerRowCount,u=a.totalsRowCount,d=c-o.rowStart+1-l-u;t=Math.max(0,Math.min(t??2**53-1,d-1));let f=o.rowStart+l+t,p=this._beginCommit({description:e.v(r>1?`op.addTableRows`:`op.addTableRow`),...i});try{if(s){let e={colStart:o.colStart,rowStart:f,colEnd:o.colEnd,rowEnd:f+r-1};if(s.getRange(e).insert(n.l.Axis.Row),t===0&&l===0){let e={...this._getState().anchorCoords,rowStart:o.rowStart};this._updateState({anchorCoords:e}),this._options.setContainerCoords?.(e),this._calcVisible(),this._styleCache=null}}(!s||f>c)&&this._resize({colStart:o.colStart,rowStart:o.rowStart,colEnd:o.colEnd,rowEnd:o.rowEnd+r},i),p.commit()}catch(e){throw p.rollback(),e}return this}deleteRowsAt(t,r=1,i){let a=this._getState(),o={...a.anchorCoords},s=this._sheet,c=a.headerRowCount,l=o.rowStart+c+t,u=o.rowEnd-l+1;if(c>0&&u<0)throw Error(e._(`error.table.tableNoBody`));r=Math.max(1,Math.min(r,u));let d=this._beginCommit({description:e.v(r>1?`op.deleteTableRows`:`op.deleteTableRow`),...i});try{if(s){let e={colStart:o.colStart,rowStart:l,colEnd:o.colEnd,rowEnd:l+r-1};s.getRange(e).delete(n.l.Axis.Row)}else this._resize({colStart:o.colStart,rowStart:o.rowStart,colEnd:o.colEnd,rowEnd:o.rowEnd-r},i);d.commit()}catch(e){throw d.rollback(),e}return this}_deleteColumn(t,r){let i=this._getState(),a=i.mapColumnPropsById.get(t);if(!a)return;let o=this._beginCommit({description:e._(`op.deleteColumnNamed`,{name:a.name}),...r});try{let e=a.index,t=this._sheet;if(t){let r=i.anchorCoords,a=r.colStart+e,o={colStart:a,rowStart:r.rowStart,colEnd:a,rowEnd:r.rowEnd};t.getRange(o).delete(n.l.Axis.Column)}let s=i.orderedColumnsProps,c=[...s.slice(0,e),...s.slice(e+1)];this._updateColumnsState(c,r),o.commit()}catch(e){throw o.rollback(),e}}addColumn(t=-1,r,i,a){let o=this._getState().anchorCoords,s=t,c=o.colEnd-o.colStart+1;s===-1&&(s=c),s=Math.min(Math.max(0,s),c);let l=this._beginCommit({description:e.v(`op.addTableColumn`),...a});try{let e=o.colStart+s,t=o.rowStart,a=o.rowEnd,u={colStart:e,rowStart:t,colEnd:e,rowEnd:a},d=this._sheet;if(d&&d.getRange(u).insert(n.l.Axis.Column),(!d||s===0||s>=c)&&this._resize({colStart:o.colStart,rowStart:o.rowStart,colEnd:o.colEnd+1,rowEnd:o.rowEnd}),i!==void 0){let e=this._getState().orderedColumnsProps,t=[...e.slice(0,s),{name:i},...e.slice(s)];t=Xg(e,t,0,!0,this._emptyColumnName,this._emptyColumnNamer),this._updateColumnsState(t)}if(d&&r&&r.length>0){if(!Array.isArray(r))throw Error(`Values must be an 1D array if provided.`);let i=a-t+1;if(r.length>i)throw Error(`Values length ${r.length} exceeds table data row count of ${i}.`);d.getRange({colStart:e,rowStart:t,colEnd:e,rowEnd:t+r.length-1}).setValues([r],{axis:n.l.Axis.Column})}l.commit()}catch(e){throw l.rollback(),e}return this.getColumnAt(s)}getColumns(){return this._getState()?.orderedColumns??e.A.EmptyArray}getColumn(e){let t=this.getColumnByName(e);return t===null?this.getColumnById(e):t}getColumnById(e){let t=this._getState()?.mapColumnById;return t?t.get(e)??null:null}getColumnByName(e){let t=this._getState()?.mapColumnByName;return t?t.get(e?.toLocaleLowerCase())??null:null}convertToRange(t=2**53-1,r){let i=this._beginCommit(e.v(`op.convertToRange`));try{if(this._sheet){let e=this.getFirstAnchorCoords(),r=(e.colEnd-e.colStart+1)*(e.rowEnd-e.rowStart+1);if(r>t)throw Error(`There are ${r} and there is a limit of ${t}.`);let i=this._sheet.getRange(e),a=i.createSparseBuilder({axis:n.l.Axis.Column});i.forEach((e,t)=>{let n=t.getCoords(),r=t.getCell();a.pushAt(n.rowIndex,n.colIndex,{style:r.getStyle(!1)})},{includeEmpty:!0,axis:n.l.Axis.Column}),a.apply()}this.delete(r)}catch{i.rollback(),i=null}return i&&i.commit(),this._sheet.getRange(this._getState().anchorCoords)}resizeTo(e,t,n){let r=this._getState().anchorCoords,i=r.colStart,a=r.rowStart;return this._resize({colStart:i,rowStart:a,colEnd:i+t-1,rowEnd:a+e-1},n)}resize(e,t){return this._resize(e,t)}_resize(t,n,r=e.v(`op.resizeTable`)){let i=this._sheet.getRange(t).getCoords();if(!i)throw Error(Ah(t));let a=this._getState(),o=a.anchorCoords,s=a.headerRowCount,c=a.totalsRowCount;if(o.rowStart!==i.rowStart||i.colEnd<o.colStart||i.colStart>o.colEnd||i.rowEnd<o.rowStart+s+c+1)throw new e.s(e._(`error.table.tableResizeInvalidBounds`));let l=this._beginCommit({description:r,...n});try{e.l.isEqualRanges(i,o)||this._modifyTable({anchorCoords:i},n,r,!0),l.commit()}catch(e){throw l.rollback(),e}return this._sheet.getRange(i)}getName(){return this._getState()?.name}setName(t,n){return this._modifyTable({name:t},n,e._(`op.setTableNameNamed`,{name:t}))}getDescription(){return this._getState()?.description}setDescription(t,n){return this._modifyTable({description:t},n,e.v(`op.setTableDescription`))}select(e){return this.getDataRange().select(e)}_processRestoreOrRevert(e,t,n){this._styleCache=null,super._processRestoreOrRevert(e,t,n)}_processAnchorCoords(){this._styleCache=null,super._processAnchorCoords()}_processAfterContainerShift(e,t){super._processAfterContainerShift(e,t)}getDataRange(){let e=this._getUsedCoords();return e?this._sheet.getRange(e):hT}_getUsedCoords(){let e=this._getState(),t=e.headerRowCount,n=e.totalsRowCount,r=e.anchorCoords;if(!r)return null;let i={...r,rowStart:r.rowStart+t,rowEnd:r.rowEnd-n};return i.rowEnd<i.rowStart||i.colEnd<i.colStart?null:i}getHeaderRowRange(){let e=this._getHeaderCoords();return e?this._sheet.getRange(e):hT}_getHeaderCoords(){let e=this._getState(),t=e.headerRowCount;if(t<1)return null;let n=e.anchorCoords;return n?{...n,rowEnd:n.rowStart+t-1}:null}getTotalRowRange(){let e=this._getTotalCoords();return e?this._sheet.getRange(e):hT}_getTotalCoords(){let e=this._getState(),t=e.totalsRowCount;if(t<1)return null;let n=e.anchorCoords;return n?{...n,rowStart:n.rowEnd-t+1}:null}getStyleOptions(){return this.isDeleted()?Gg:this._getState()?.style}updateStyleOptions(t,n=e.v(`op.updateStyleInfo`)){let r=this.getStyleOptions(),i=t?{...r,...t}:Gg;return this._modifyTable({style:i},void 0,n),this._styleCache=null,this._notify(`onStyleChange`),this}getRangedStyle(){let e=this._stylePropsCache;return e||(e=this.getStyle().getRanged(this),this._stylePropsCache=e),e}getStyleAt(t){return vh(void 0,this._styles,this.getRangedStyle(),e.l.cellToRange(t))}isShowTotals(){return this._getState()?.totalsRowCount>0}setShowTotals(t,n){return this._modifyTable({totalsRowCount:+!!t},n,e.v(t?`op.showTotals`:`op.hideTotals`))}isShowHeaders(){return this._getState()?.headerRowCount>0}setShowHeaders(t,n){return this._modifyTable({headerRowCount:+!!t},n,e.v(t?`op.showHeaders`:`op.hideHeaders`))}isShowHighlightFirstColumn(){return this._getState().style?.showFirstColumn??!1}setShowHighlightFirstColumn(t,n){return this._modifyTable({style:{...this._getState().style,showFirstColumn:t}},n,e.v(t?`op.showHighlightFirstColumn`:`op.hideHighlightFirstColumn`))}isShowHighlightLastColumn(){return this._getState().style?.showLastColumn??!1}setShowHighlightLastColumn(t,n){return this._modifyTable({style:{...this._getState().style,showLastColumn:t}},n,e.v(t?`op.showHighlightLastColumn`:`op.hideHighlightLastColumn`))}isShowBandedColumns(){return this._getState().style?.showColumnStripes??!1}setShowBandedColumns(t,n){return this._modifyTable({style:{...this._getState().style,showColumnStripes:t}},n,e.v(t?`op.showBandedColumns`:`op.hideBandedColumns`))}isShowBandedRows(){return this._getState().style?.showRowStripes??!1}setShowBandedRows(t,n){return this._modifyTable({style:{...this._getState().style,showRowStripes:t}},n,e.v(t?`op.showBandedRows`:`op.hideBandedRows`))}_setupAutoExpand(){if(this._autoExpandRemoveListener?.(),this.isDisabledAutoExpand())return;let t=this._sheet;if(!t)return;let n=this;this._autoExpandRemoveListener=t.getEntireRange().addListener(r=>{if(this._lastTransactionId===r.getTransactionId()||r.trigger!==`setCells`||r.isUndo)return;let i=n.getFirstAnchorCoords();if(!i)return;let a=r.getFrom().getCoords()[0],o=null;if(a.rowStart>=i.rowStart&&a.rowEnd<=i.rowEnd&&a.colStart>=i.colStart&&a.colStart<=i.colEnd+1&&a.colEnd>i.colEnd){let e={...a,colStart:i.colEnd+1};if(t.getRange(e).isContentful()){let n={...e,rowStart:i.rowStart,rowEnd:e.rowStart-1};if(n.rowEnd-n.rowStart<0||!t.getRange(n).isContentful()){let n={...e,rowStart:e.rowEnd+1,rowEnd:i.rowEnd};(n.rowEnd-n.rowStart<0||!t.getRange(n).isContentful())&&(o={...i,colEnd:a.colEnd})}}}else if(!n.isShowTotals()&&a.colStart>=i.colStart&&a.colEnd<=i.colEnd&&a.rowStart>=i.rowStart&&a.rowStart<=i.rowEnd+1&&a.rowEnd>i.rowEnd){let n={...a,rowStart:i.rowEnd+1};if(e.l.isRangeWithinRange(n,t.getEntireRange().getCoords())&&t.getRange(n).isContentful()){let e={...n,colStart:i.colStart,colEnd:n.colStart-1};if(e.colEnd-e.colStart<0||!t.getRange(e).isContentful()){let e={...n,colStart:n.colEnd+1,colEnd:i.colEnd};(e.colEnd-e.colStart<0||!t.getRange(e).isContentful())&&(o={...i,rowEnd:a.rowEnd})}}}if(o&&t.getRange(o).getMerges().length>0&&(o=null),o&&t.getTables().getItems({address:o}).length!==1&&(o=null),o){let t=n._beginCommit(e.v(`op.tableAutoExpansion`));try{n.resize(o),t.commit({viewAfter:null})}catch(e){t.rollback(),console.warn(`Unable to AutoExpand`),console.warn(e)}}},{transactional:!1,ignoreShifts:!0})}setDisabledAutoExpand(t,n){return this._modifyTable({disabledAutoExpand:t},n,e.v(`op.setDisabledAutoExpand`)),this._setupAutoExpand(),this}isDisabledAutoExpand(){return(this._getState()?.disabledAutoExpand||!this._sheet)??!1}applyFilters(t){let n=this._getState().filtersActive,r=n.length;if(r===0)return this;let i=Array(r);for(let e=0;e<r;e++){let t=n[e];i[e]={index:t.getIndex(),...t.getCondition().toJSON()}}let a={description:e.v(`op.applyFilters`),...t,conditions:i};return this._applyFilters(a),this}deleteFilters(t){let n=this._beginCommit({description:e.v(`op.deleteFilters`),...t});try{let e=this._getState(),t=[...e.orderedColumnsProps],r=new Map(e.mapColumnPropsById),i=this._updateFilters([],e.filtersActive,t,r);this._updateState({orderedColumnsProps:Object.freeze(t),mapColumnPropsById:r,filtersActive:i}),this._processTableUpdate?.(),this._notify(`onFilterChange`),n.commit()}catch(e){throw n.rollback(),e}return this}getActiveFilters(){let e=this._getState();return e?e.filtersActive:null}getFilterAt(e){let t=this._getState();if(!t)return null;let n=t.orderedColumnsProps[e]??null;if(!n)return null;let r=n.filterProps;return r?t.filtersActive[r.level]:this._createFilter(n.id)}_updateSorts(t,n,r,i){let a=n.length;for(let e=0;e<a;e++){let t=n[e].getIndex(),a=r[t];if(!a||!a.sortProps)continue;let o={...a};delete o.sortProps,i.set(o.id,o),r[t]=o}let o=t?t.length:0;if(o===0)return e.A.EmptyArray;let s=[];for(let n=0;n<o;n++){let a=t[n],o=a.index??n,c=r[o];if(!c)continue;let l={...c};if(i.set(l.id,l),r[o]=l,a.criteria===null)l.sortProps=null;else{let t=e.A.cloneObject({...a});delete t.index,l.sortProps={level:n,...t}}let u=this._createSort(l.id);s.push(u)}return Object.freeze(s)}_updateFilters(t,n,r,i){let a=n.length;for(let e=0;e<a;e++){let t=n[e].getIndex(),a=r[t];if(!a)continue;let o={...a};delete o.filterProps,i.set(o.id,o),r[t]=o}let o=t?t.length:0;if(o===0)return e.A.EmptyArray;let s=[];for(let e=0;e<o;e++){let n=t[e],a=Fg.resolveInput(n),o=n?.index??e,c=r[o];if(!c)continue;let l={...c};i.set(l.id,l),r[o]=l,l.filterProps=n===null?null:{level:e,condition:a};let u=this._createFilter(l.id);s.push(u)}return Object.freeze(s)}filter(t,n){let r=this._beginCommit({description:e.v(`op.filterTable`),...n}),i=t;try{let e=this._getState(),t=[...e.orderedColumnsProps],n=new Map(e.mapColumnPropsById),a=this._updateFilters(i.conditions,e.filtersActive,t,n);this._updateState({orderedColumnsProps:Object.freeze(t),mapColumnPropsById:n,filtersActive:a}),this._applyFilters(i),this._processTableUpdate?.(),this._notify(`onFilterChange`),r.commit()}catch(e){throw r.rollback(),e}return this}sort(t){let n=this._beginCommit({description:e.v(`op.sortTable`),...t});try{let e=this._getState(),r=[...e.orderedColumnsProps],i=new Map(e.mapColumnPropsById),a=this._updateSorts(t?.sorts,e.sortsActive,r,i);this._updateState({orderedColumnsProps:Object.freeze(r),mapColumnPropsById:i,sortsActive:a}),t&&t.sorts&&t.sorts.length===0||this._applySorts(t),this._processTableUpdate?.(),this._notify(`onSortChange`),n.commit()}catch(e){throw n.rollback(),e}return this}applySorts(t){let r=this._getState().sortsActive,i=r.length;if(i===0)return this;let a=Array(i);for(let e=0;e<i;e++){let t=r[e];a[e]={index:t.getIndex(),criteria:t.getCriteria()}}let o={description:e.v(`op.applySort`),...t,sorts:a,hasHeader:this.isShowHeaders(),axis:n.l.Axis.Row};return this._applySorts(o,!0),this}deleteSorts(t){let n=this._beginCommit({description:e.v(`op.deleteSorts`),...t});try{let e=this._getState(),t=[...e.orderedColumnsProps],r=new Map(e.mapColumnPropsById),i=this._updateSorts([],e.sortsActive,t,r);this._updateState({orderedColumnsProps:Object.freeze(t),mapColumnPropsById:r,sortsActive:i}),this._processTableUpdate?.(),this._notify(`onSortChange`),n.commit()}catch(e){throw n.rollback(),e}return this}applySortsAndFilters(t){return this.doBatch(()=>{this.applyFilters(),this.applySorts()},{description:e.v(`op.refreshSortsAndFilters`),...t}),this}deleteSortsAndFilters(t){return this.doBatch(()=>{this.deleteSorts(),this.deleteFilters()},{description:e.v(`op.deleteSortsAndFilters`),...t}),this}getActiveSorts(){return this._getState().sortsActive}getSortAt(e){let t=this._getState();if(!t)return null;let n=t.orderedColumnsProps[e]??null;if(!n)return null;let r=n.sortProps;return r?t.sortsActive[r.level]:this._createSort(n.id)}setHiddenButtonAt(t,n){let r,i=this._getState(),a=i.mapHiddenButtons;return n===i.hiddenButtons?a.get(t)!==n&&(a=new Map(a),a.delete(t),r={mapHiddenButtons:a}):a.get(t)!==n&&(a=new Map(a),a.set(t,n),r={mapHiddenButtons:a}),r&&this._updateState(r,e.v(`op.setHiddenButtons`)),this}isHiddenButtonAt(e){let t=this._getState();return!t||(t.mapHiddenButtons.get(e)??t.hiddenButtons??!1)}setHiddenButtons(t){if(this._getState())return this._updateState({hiddenButtons:t,mapHiddenButtons:o_},e.v(`op.setHiddenButtons`),[`onHiddenButtonsChange`]),this}isHiddenButtons(){let e=this._getState();return!e||!0===e.hiddenButtons&&e.mapHiddenButtons.size===0}_applyFilters(e){this.getRange().filter({...e,conditions:e?.conditions??[],hasHeader:this.isShowHeaders(),axis:n.l.Axis.Row}),this._processTableUpdate?.(),this._notify(`onFilterChange`)}_applySorts(e,t=!1){this.getRange().sort({...e,hasHeader:this.isShowHeaders(),axis:n.l.Axis.Row}),t&&(this._processTableUpdate?.(),this._notify(`onSortChange`))}getColumnAt(e){return this._getState()?.orderedColumns[e]??null}_updateColumnsState(t,n){let r=this._getState(),i=r.lastColId,a=t.length;if(a===0&&!this._sheet)throw Error(e._(`error.table.tableNoBody`));let o,s,c=r.mapColumnById,l=new Map,u=t,d=new Map,f=new Map,p=new Map,m=Array(a);for(let e=0;e<a;e++){let t=u[e];t.index=e,o=null,t.id!==void 0&&(s=parseInt(t.id),Number.isInteger(s)&&(i=Math.max(i,s),o=t.id)),o===null&&(i++,o=i+``),t.id=o;let n=c.get(o);n||=this._createColumn(o),l.set(o,t),m[e]=n,d.set(o,n),f.set(e,n);let r=t.name.toLocaleLowerCase();p.set(r,n)}return this._updateState({orderedColumnsProps:Object.freeze(u),mapColumnPropsById:l,orderedColumns:Object.freeze(m),mapColumnById:d,mapColumnByIndex:f,mapColumnByName:p,lastColId:i},n),m}getVisibleRefRangeCoords(){return this._ensureVisible(),this._visibleRange?this._visibleRange:this.getFirstAnchorCoords()}getVisibleCellCoords(e){return this._ensureVisible(),e&&this._visibleRange?{colIndex:Math.min(this._visibleRange.colEnd,Math.max(this._visibleRange.colStart,this._sheet.getColumnHeaders().getVisibleIndex(e.colIndex).min)),rowIndex:Math.min(this._visibleRange.rowEnd,Math.max(this._visibleRange.rowStart,this._sheet.getRowHeaders().getVisibleIndex(e.rowIndex).min))}:e}isHeaderVisible(){return this._ensureVisible(),this._isHeaderVisible}isTotalVisible(){return this._ensureVisible(),this._isTotalVisible}isFirstColumnVisible(){return this._ensureVisible(),this._isFirstColumnVisible}isLastColumnVisible(){return this._ensureVisible(),this._isLastColumnVisible}_readSyncSheet(t=!1,n=!1){let r=this._sheet;if(!r)return null;let i=this._getState().orderedColumnsProps,a=this.getFirstAnchorCoords();if(!a)return null;let o=this._getHeaderCoords(),s=n?void 0:this._getTotalCoords();if(!o&&!s)return null;let c=a.colEnd-a.colStart+1,l=Array(c).fill(null),u=!1;if(o){let e=0;r.getRange({...o,rowEnd:o.rowStart}).forEach((n,r)=>{let a,o=i[e];n===null?t?(a=o?.name,u=!0):a=null:typeof n==`string`?a=n:(a=r.getCell().getText(),u=!0),l[e]={...o,name:a},e++},{includeEmpty:!0})}if(s){let e=0;r.getRange({...s,rowStart:s.rowEnd}).forEach((t,n)=>{let r,a=n.getCell(),o=a.getFormulaText()??void 0;typeof t==`string`?r=t:t!==null&&(r=a.getText());let s=l[e]??i[e];if(s&&o===s.totalsRowFormula&&r===s.totalsRowLabel)return void e++;u=!0;let c={...s};l[e]=c,delete c.totalsRowLabel,delete c.totalsRowFormula,o?c.totalsRowFormula=o:r&&(c.totalsRowLabel=r),e++},{includeEmpty:!0})}let d=Xg(i,l,0,!0,this._emptyColumnName,this._emptyColumnNamer);var f,p;return u||=(f=l,p=d,!e.A.isEqualArrays(f,p,(t,n)=>e.A.deepEqual(t,n))),{columns:d,converted:u}}_writeSyncSheet(t=!1){let r=this._sheet;if(!r)return;let i=this._getState(),a=i.orderedColumnsProps,o=this._getHeaderCoords(),s=this._getTotalCoords();if(!o&&!s||t)return;let c=e.v(`op.syncColumnsToSheet`),l=this._beginCommit(c);try{let e=r.getEntireRange().createSparseBuilder({axis:n.l.Axis.Row}),t=a.length;if(o){let n=o.rowStart,r=o.colStart;for(let i=0;i<t;i++){let t=a[i].name;t&&e.pushAt(n,r+i,t)}}if(s&&!i.shownTotalsRow){let e=r.getEntireRange().createSparseBuilder({axis:n.l.Axis.Row}),i=s.rowStart,o=s.colStart;for(let n=0;n<t;n++){let t=a[n].totalsRowLabel;t&&e.pushAt(i,o+n,t)}e.apply(),this._updateState({shownTotalsRow:!0})}e.apply({textParser:!1})}catch(e){throw l.rollback(),e}l&&l.commit()}_processDelete(){let e=this._getState();e.headerRemoveListener?.(),e.totalsRemoveListener?.(),this._updateState({headerRemoveListener:null,totalsRemoveListener:null});let t=this._namedItem;t&&t.delete(),super._processDelete()}_processFilterUpdate(){let e=this._getUsedCoords();console.log(`process on Filter and Sort dataRange`,e)}_processContainerShift(t){if(t.isSplit)throw Error(e._(`error.table.tableSplit`));let r=this._getState(),i=t.after,a=t.intersect;if(i&&i.rowStart+r.headerRowCount>=i.rowEnd+1)throw Error(e._(`error.table.tableNoBody`));let o=t.axis===n.l.Axis.Column;if(t.amount<0&&i&&!o){let t=this._getHeaderCoords();if(t&&a.rowStart<=t.rowEnd&&a.rowEnd>=t.rowStart)throw Error(e._(`error.table.tableRemoveHeader`));let n=this._getTotalCoords();n&&a.rowStart<=n.rowEnd&&a.rowEnd>=n.rowStart&&this.setShowTotals(!1)}let s=super._processContainerShift(t);if(o){let n=t.amount,r=a.colStart-t.before.colStart,i=n>0;if(r<=0&&i)return s;r<0&&(n-=r,r=0);let o=[...this._getState().orderedColumnsProps];i?o=function(e,t,n,r=Hg(),i=Ug){let a=Array(n),o=e.length;t<0&&(t=o),e.splice(t,0,...a);let s=Yg(e,r)(),c=s!==0&&s<o,l=0;if(s===0){let t=new Set,n=e.length;for(let r=0;r<n;r++){let n=e[r]?.name;if(!n)continue;let i=Wg(n);t.add(i)}for(let e=0;s===0&&e<n;e++){let n=Wg(i(r,e));t.has(n)&&(s=e)}s===0&&(s=o-1)}let u=c?null:e[t-1]?.name;(c||s>=o)&&(l=s);for(let e=0;e<n;e++){let t;c||l<s?(t=i(r,l),u=t,l++):t=u,a[e]={...a[e],name:t}}return Xg(e,a,t,!1,r,i)}(o,r,n):o.splice(r,-n),this._updateColumnsState(o,e.v(i?`op.addColumns`:`op.deleteColumns`)),this._writeSyncSheet(!i)}else i||this._updateColumnsState([],e.v(`op.deleteColumns`));return i||this._delete(),this._processAnchorCoords(),s}_beginCommit(e){let t=super._beginCommit(e);return this._lastTransactionId=t.getId(),t}_modifyTable(t,n,r,i=!0){if(this.isDeleted())throw Error(`Table has been closed. No further operations are allowed.`);let a=this._getState(),o=a.anchorCoords,s=a.headerRowCount,c=a.totalsRowCount,l=this._getTotalCoords()??null;n?.description||(n={...n,description:r});let u=this._beginCommit(n);try{if(this._updateState(t,n),t.name!==void 0){if(!t.name)throw Error(e._(`error.table.tableNoName`));this._setContainerName?.(t.name)}let d=t.anchorCoords??null,f=this._ensureHeightForHeaderTotals(d??a.anchorCoords,s,c,t.headerRowCount,t.totalsRowCount),p=!1,m=!1;if(d){if(!this._getUsedCoords())throw Error(e._(`error.table.tableNoBody`));this._updateState({anchorCoords:d},r);let t=this._getState();if(d.colStart!==o.colStart||d.colEnd!==o.colEnd){let n=d.colEnd-d.colStart+1,r=t.orderedColumnsProps;if(p=n!==r.length,p){let t=[...r];if(d.colEnd>o.colEnd)t.splice(t.length,0,...Array(d.colEnd-o.colEnd)),t=Xg(null,t,0,!0,this._emptyColumnName,this._emptyColumnNamer);else if(d.colEnd<o.colEnd){let e=o.colEnd-d.colEnd;t.splice(t.length-e,e)}d.colStart<o.colStart?(t.splice(0,0,...Array(o.colStart-d.colStart)),t=Xg(null,t,0,!0,this._emptyColumnName,this._emptyColumnNamer)):d.colStart>o.colStart&&t.splice(0,d.colStart-o.colStart),this._updateColumnsState(t,e.v(`op.updateColumns`))}}let n=d.rowEnd!==o.rowEnd;if(m=n&&l!==null,d.rowStart!==o.rowStart||n){if(n&&l){let e=this._sheet;e&&e.getRange(l).clear()}this._calcVisible()}if(i){let t=this._readSyncSheet(!0,m);t&&t.converted&&this._updateColumnsState(t.columns,e.v(`op.syncColumnsFromSheet`))}this._options.setContainerCoords?.(d)}(f||p)&&this._writeSyncSheet(),t.style!==void 0&&(this._styleCache=null),this._notify(`onAnyChange`),u.commit()}catch(e){throw u.rollback(),e}return this}addListeners(e,t){return this._getEmitter().addListeners(e,t)}_processAfterStateChange(e,t,n){super._processAfterStateChange(e,t,n),this._styleCache=null,this._stylePropsCache=null,this._processTableUpdate?.(),this._notify(`onAnyChange`)}_processHeaderListener(){this._getState().headerRemoveListener?.();let e=this._sheet;if(!e)return;let t=this._getHeaderCoords();if(!t){let e=this._getUsedCoords();t={...e,rowEnd:e.rowStart}}this._lastTransactionId=this._getTransactions().getCurrentCommit().getId();let n=e.getRange(t).addListener(this._columnListener,{transactional:!0});this._updateState({headerRemoveListener:n})}_processTotalsListener(){this._getState().totalsRemoveListener?.();let e=this._sheet;if(!e)return;let t=this._getTotalCoords();if(!t)return;this._lastTransactionId=this._getTransactions().getCurrentCommit().getId();let n=e.getRange(t).addListener(this._columnListener,{transactional:!0});this._updateState({totalsRemoveListener:n})}get[Symbol.toStringTag](){return`[Table]`}toString(){return this.getName()??``}toJSON(){let t={},n=this._getState();if(!n)return null;n.name&&(t.name=n.name),n.description&&(t.description=n.description),n.headerRowCount!==1&&(t.headerRowCount=n.headerRowCount),n.totalsRowCount!==0&&(t.totalsRowCount=n.totalsRowCount),n.disabledAutoExpand&&(t.disabledAutoExpand=n.disabledAutoExpand);let r=n.orderedColumns;if(r){let e=r.length,n=Array(e);for(let t=0;t<e;t++){let e=r[t]?.toJSON();e&&(n[t]=e)}t.columns=n}if(n.style){let r=e.A.diffValues(n.style,{...Gg,name:null});r&&(t.style=r)}let i=n.sortsActive,a=i.length;if(a>0){let e=n.orderedColumnsProps,r=Array(a);for(let t=0;t<a;t++){let n=i[t]?.getIndex(),a=e[n];if(!a)continue;let o={...a.sortProps,index:n};delete o.level,r[t]=o}t.sort={sorts:r}}let o=n.filtersActive,s=o.length;if(s>0){let e=n.orderedColumnsProps,r=Array(s);for(let t=0;t<s;t++){let n=o[t]?.getIndex(),i=e[n];if(!i)continue;let a=i.filterProps;if(!a)continue;let s=a.condition.toJSON();s.index=n,r[t]=s}t.filter={conditions:r}}if(!0===n.hiddenButtons)t.hiddenButtons=!0;else{let e=n.mapHiddenButtons;if(e.size>0){let n=[];e.forEach((e,t)=>{n.push(t)}),t.hiddenButtons=n}}return t}getSheet(){return this._sheet??null}_createNamed(){return this._names?new n_(this._sheet,this,{transactions:this._getTransactions(),json:{name:this.getName()}}):null}_fromJSON(t){let n=t??{},r=e.v(`op.addTable`),i=this.getFirstAnchorCoords(),a=i.colEnd-i.colStart+1,o=function(e,t=Hg(),n=Ug){let r=Array(e);for(let i=0;i<e;i++)r[i]={name:n(t,i)};return r}(a);a>1&&(o[0].totalsRowLabel=Bg(e.v(`table.totalsRowLabel`),`Total`));let s=n.columns;s&&(s.length>a&&(s=s.slice(0,a)),o=Kg(s)),this._updateColumnsState(o,r);let c={...this._getState()};if(n.name!==void 0&&(c.name=n.name),this._names){let e=this._names.findValidName(c.name);c.name!==e&&(c.name=e)}c.description&&=c.description.trim(),c.headerRowCount=n.headerRowCount??1,c.totalsRowCount=n.totalsRowCount??0,c.disabledAutoExpand=n.disabledAutoExpand??!1;let l=n.style;typeof l==`string`&&(l={name:l}),c.style={...Gg,...l};let u=n.sort;if(u){let e=[...c.orderedColumnsProps],t=new Map(c.mapColumnPropsById),n=this._updateSorts(u.sorts,c.sortsActive,e,t);c.orderedColumnsProps=Object.freeze(e),c.mapColumnPropsById=t,c.sortsActive=n}let d=n.filter;if(d){let e=[...c.orderedColumnsProps],t=new Map(c.mapColumnPropsById),n=this._updateFilters(d.conditions,c.filtersActive,e,t);c.orderedColumnsProps=Object.freeze(e),c.mapColumnPropsById=t,c.filtersActive=n}let f=n.hiddenButtons;if(f!==void 0)if(Array.isArray(f)){c.hiddenButtons=!1;let e=f.length,t=new Map;for(let n=0;n<e;n++){let e=f[n];t.set(e,!0)}c.mapHiddenButtons=t}else c.hiddenButtons=f,c.mapHiddenButtons=o_;this._updateState(c,r)}close(){super.close(),this.isClosed()||(this._autoExpandRemoveListener?.(),this._getState()?.headerRemoveListener?.(),this._updateState({headerRemoveListener:null},e.v(`op.closeTable`)),this._stylesRemoveListener?.(),this._colHeadersSizeUnlistener?.(),this._rowHeadersSizeUnlistener?.())}get isITable(){return!0}},o_=new Map,s_=new Map,c_=Object.freeze({criteria:null,level:-1}),l_=Object.freeze({condition:null,level:-1}),u_=class extends $g{getName(){let e,t=this.getIndex(),n=this.getTable(),r=n.getSheet();if(r){let i=n.getRange().getCoords().colStart;e=r.getColumnHeaders().getTextAt(i+t)}return e||=`Column ${t+1}`,e}setName(t){throw Error(e._(`error.table.autoTableInvalidOperation`))}getId(){return this._getProps(this._id).id??null}getIndex(){return this._getProps(this._id).index??-1}setTotalsRowLabel(t){throw Error(e._(`error.table.autoTableInvalidOperation`))}getTotalsRowLabel(){return null}setTotalsRowFormula(t){throw Error(e._(`error.table.autoTableInvalidOperation`))}getTotalsRowFormula(){return null}delete(t){throw Error(e._(`error.table.autoTableInvalidOperation`))}get[Symbol.toStringTag](){return`[AutoTableColumn]`}toJSON(){return null}},d_=class extends a_{_initialize(t){let n={...t.json};t={...t,json:n},n.disabledAutoExpand=!0,n.name=Bg(e.v(`table.autoTableName`),`AutoTable`),n.description=Bg(e.v(`table.autoTableDescription`),`AutoTable created for filtering and sorting`),t.names=null,t.styles=new jm,t.setContainerName=t=>{throw Error(e._(`error.table.autoTableInvalidOperation`))},super._initialize(t)}initializeColumnCreator(e,t,n,r){return i=>new u_(e,i,t,n,r)}_processHeaderListener(){}_readSyncSheet(e=!1){return null}_writeSyncSheet(e=!1){}_calcVisible(){}isShowHeaders(){return!1}addRows(t,n=1,r){throw Error(e._(`error.table.autoTableInvalidOperation`))}addColumn(t=-1,n,r,i){throw Error(e._(`error.table.autoTableInvalidOperation`))}deleteRowsAt(t,n=1,r){throw Error(e._(`error.table.autoTableInvalidOperation`))}getColumnByName(t){throw Error(e._(`error.table.autoTableInvalidOperation`))}convertToRange(t=2**53-1,n){throw Error(e._(`error.table.autoTableInvalidOperation`))}setName(t,n){throw Error(e._(`error.table.autoTableInvalidOperation`))}setDescription(t,n){throw Error(e._(`error.table.autoTableInvalidOperation`))}updateStyleOptions(t,n=e.v(`op.updateStyleInfo`)){throw Error(e._(`error.table.autoTableInvalidOperation`))}setShowTotals(t,n){throw Error(e._(`error.table.autoTableInvalidOperation`))}setShowHeaders(t,n){throw Error(e._(`error.table.autoTableInvalidOperation`))}setShowHighlightFirstColumn(t,n){throw Error(e._(`error.table.autoTableInvalidOperation`))}setShowHighlightLastColumn(t,n){throw Error(e._(`error.table.autoTableInvalidOperation`))}setShowBandedColumns(t,n){throw Error(e._(`error.table.autoTableInvalidOperation`))}setShowBandedRows(t,n){throw Error(e._(`error.table.autoTableInvalidOperation`))}_resize(t,n,r=e.v(`op.resizeTable`)){throw Error(e._(`error.table.autoTableInvalidOperation`))}get[Symbol.toStringTag](){return`[AutoTable]`}toString(){return this.getRange().toString()}toJSON(){let e=super.toJSON();return e?(delete e.name,delete e.description,delete e.style,delete e.columns,delete e.disabledAutoExpand,delete e.totalsRowCount,delete e.headerRowCount,e):null}},f_=class t extends Lg{static{this.instanceCounter=0}constructor(e){if(super(e),!e.content)throw Error(`Content type is required`);this._content=e.content,this._optionsMovable=e;let t=this;this._optionsMovable.setContainerCallbacks?.({processZIndex:()=>t._processZIndex(),processSelection:(e,n)=>t._processContainerSelect(e,n)}),e.json&&this._fromJSON(e.json);let n=this._content.addListeners({onDelete:()=>{t._options.deleteFromContainer&&t._options.deleteFromContainer?.()}},{transactional:!0});this._updateState({contentListenerRemove:n},null,[])}getContent(){return this._content}_processAfterStateChange(e,t,n){super._processAfterStateChange(e,t,n),this._getEmitter().notify(`onBoundsChange`),this._getEmitter().notify(`onAnyChange`)}_processZIndex(){this._getEmitter().notify(`onAnyChange`)}_processContainerSelect(e,t){this._getEmitter().notify(`onSelectionChange`)}isSelected(){return this._optionsMovable.isSelected?.()??!1}async scrollIntoView(e){return this._optionsMovable.scrollIntoView?.(e)??!1}async select(e){if(!1===await this._optionsMovable.select?.(e))return!1;if(!1!==e?.autoFocus){let e=await this._getEmitter().notify(`onRequestFocus`,{async:!0});if(!e)return!1;let t=e.length;for(let n=0;n<t;n++)if(!1===e[n])return!1}return!0}unselect(){let e=this._optionsMovable.isSelected?.()??!1;return this._optionsMovable.unselect?.(),e}_clone(){let e=this.isSelected(),n=this.getZIndex(),r=this._optionsMovable.getMaxBounds,i=this.getContent(),a={beginPersistResource:this._optionsMovable.beginPersistResource,getBoundsAtCoords:this._optionsMovable.getBoundsAtCoords,getCoordsAtBounds:this._optionsMovable.getCoordsAtBounds,isSelected:()=>e,getZIndex:()=>n,getContainerIndex:()=>n,getMaxBounds:r,getRanges:e=>this._optionsMovable.getRanges(e),getEntireRange:()=>this._optionsMovable.getEntireRange(),transactions:new m({transient:!0}),json:this.toJSON(),coords:this.getFirstAnchorCoords(),content:i},o=new t(a),s=this._getState();return o._updateState({...s}),o}getSnapshot(t,n){let r=this._optionsMovable.getCoordsAtBounds(t),i=this._getState().offsets,a=this.getFirstAnchorCoords();if((i.br.x>0||i.br.y>0)&&(a={...a},a.colEnd-=+(i.br.x>0),a.rowEnd-=+(i.br.y>0)),!e.l.isRangeWithinRange(a,r))return null;let o=this,s=o._clone(),c=Object.freeze({...n}),l=!1;return{async copyTo(e,t){let n={...c,...t};return await s._doCopy(e,n),n.isCut&&!l&&(o.delete(),l=!0),e.bounds},getCoords:()=>s.getBounds(),getSource:()=>s,getName:()=>s.getName(),getMarkOptions:()=>c,toText:()=>s._toText(),toHtml:()=>s._toHtml(),toImage:()=>s._toImage(),isISnapshot:!0}}async _doCopy(t,n){let r=this._optionsMovable.beginPersistResource(),i=this.toJSON(r.toResourceId.bind(r)),a=e._(e.v(`movable.copySuffix`),{name:this.getName()});i.content.json.name=a===`movable.copySuffix`?`${this.getName()} (Copy)`:a;let o=i.content.json;delete i.content;let s=t.movables;if(!s)throw Error(`Movables is required`);let c=t.bounds??this.getBounds();try{await s.add({...i,...n,fromResourceId:r.fromResourceId.bind(r),bounds:c,type:this.getContent().getType(),json:o,description:e.v(`op.copyMovable`)})}finally{r.endPersist()}}_toText(){return this.getContent().toText?.()}_toHtml(){return this.getContent().toHtml?.()}_toImage(){return this.getContent().toImage?.()}setName(t){return this._updateState({name:t},{description:e.v(`op.setMovableName`)},[`onNameChange`]),this}getName(){return this.isDeleted()?null:this._getState()?.name}setDescription(t){return this._updateState({description:t},{description:e.v(`op.setMovableDescription`)}),this}getDescription(){return this.isDeleted()?null:this._getState()?.description}setHidden(t=!1){return this._updateState({hidden:t},{description:e.v(`op.setMovableVisibility`)}),this}isHidden(){return this._getState()?.hidden??!1}setLockAspectRatio(t){return this._updateState({lockAspectRatio:t},{description:e.v(`op.setLockAspectRatio`)}),this}isLockAspectRatio(){return this._getState()?.lockAspectRatio??this._optionsMovable.defaultLockAspectRatio??!1}setRotation(t=0){return this._updateState({rotation:t},{description:e.v(`op.setMovableRotation`)}),this}getRotation(){return this._getState()?.rotation??0}moveToBack(){return this._optionsMovable.moveToBackOnContainer?.(),this}moveBackward(){return this._optionsMovable.moveBackwardOnContainer?.(),this}moveToFront(){return this._optionsMovable.moveToFrontOnContainer?.(),this}moveForward(){return this._optionsMovable.moveForwardOnContainer?.(),this}getZIndex(){return this._optionsMovable.getZIndex?.()??0}setBounds(t,n){if(!t)return this;let r={...this.getBounds(),...t};if(this._optionsMovable.getMaxBounds&&(r={x:Math.max(r.x,this._optionsMovable.getMaxBounds().x),y:Math.max(r.y,this._optionsMovable.getMaxBounds().y),width:Math.min(r.width,this._optionsMovable.getMaxBounds().width),height:Math.min(r.height,this._optionsMovable.getMaxBounds().height)}),r.width<0||r.height<0)throw new e.C;let i=this._updateMovableLocation({bounds:r,anchorType:Sh.Type.Absolute}),a=this._beginCommit(n?.description??e.v(`op.setMovableBounds`));return this._updateState({offsets:i.offsets,anchorCoords:i.anchorCoords},{description:e.v(`op.updateMovableBounds`)}),this._options.setContainerCoords(i.anchorCoords),this._invalidateBounds(),a.commit(),this}_updateMovableLocation(e){let t=e.offsets??p_(),n=e.anchorCoords??this.getFirstAnchorCoords(),r=e.anchorType??this.getAnchorType(),i=e.bounds??this.getBounds();if(i){if(r===Sh.Type.Absolute){n=this._optionsMovable.getCoordsAtBounds(i);let e=this._optionsMovable.getBoundsAtCoords(n);t={...t,tl:{x:i.x-e.x,y:i.y-e.y}}}if(r===Sh.Type.Absolute||r===Sh.Type.OneCell){let e=this._optionsMovable.getBoundsAtCoords({colStart:n.colStart,rowStart:n.rowStart,colEnd:n.colStart,rowEnd:n.rowStart}),r=this._optionsMovable.getCoordsAtBounds({x:e.x,y:e.y,width:i.width+Math.min(e.width,t.tl.x),height:i.height+Math.min(e.height,t.tl.y)});n={colStart:n.colStart,rowStart:n.rowStart,colEnd:r.colEnd,rowEnd:r.rowEnd};let a=this._optionsMovable.getBoundsAtCoords({colStart:n.colEnd,rowStart:n.rowEnd,colEnd:n.colEnd,rowEnd:n.rowEnd}),o=i.width-(a.x-e.x-Math.min(t?.tl.x??0,e.width)),s=i.height-(a.y-e.y-Math.min(t?.tl.y??0,e.height));t={...t,br:{x:o,y:s}}}return t!==e.offsets&&(t.br.y<=0&&(t.br={...t.br,y:0},n.rowEnd--),t.br.x<=0&&(t.br={...t.br,x:0},n.colEnd--)),{anchorCoords:n,offsets:t}}}_calcAbsoluteBounds(e,t=p_()){if(!e)return null;let n=this._optionsMovable.getBoundsAtCoords({rowStart:e.rowStart,colStart:e.colStart,colEnd:e.colStart,rowEnd:e.rowStart}),r=+!t.br.x,i=+!t.br.y,a=this._optionsMovable.getBoundsAtCoords({colStart:e.colEnd+r,rowStart:e.rowEnd+i,colEnd:e.colEnd+r,rowEnd:e.rowEnd+i}),o=Math.min(n.x+(t?.tl.x??0),n.x+n.width),s=Math.min(n.y+(t?.tl.y??0),n.y+n.height);return{x:o,y:s,width:Math.min(a.x+(t?.br.x??0),a.x+a.width)-o,height:Math.min(a.y+(t?.br.y??0),a.y+a.height)-s}}getBounds(){return this._getState()?.bounds}setAnchorType(t){return e.A.validEnumValue(Sh.Type,t),this._updateState({anchorType:t},{description:e.v(`op.setMovableResizeBehavior`)},[`onAnchorTypeChange`]),this}_processContainerShift(t){let r=this.getAnchorType(),i=this._getState()?.offsets,a=i,o=!1,s=t.before,c=t.axis===n.l.Axis.Column,l=t.intersect,u=t.amount,d=t.after;if(r!==Sh.Type.Absolute){let e=c?l.colStart:l.rowStart,t=c?s.colStart:s.rowStart;r===Sh.Type.TwoCell&&(t=c?s.colEnd:s.rowEnd),o=e<=t}if(o&&(r!==Sh.Type.OneCell||d)||(d=s),o&&d&&u<0&&(c?(l.colStart<=s.colStart&&l.colEnd>=s.colStart&&(a={...a,tl:{...a.tl,x:0}}),a.br.x>0&&l.colStart<=s.colEnd&&l.colEnd>=s.colEnd&&(a={...a,br:{...a.br,x:0}},d={...d,colEnd:d.colEnd+1})):(l.rowStart<=s.rowStart&&l.rowEnd>=s.rowStart&&(a={...a,tl:{...a.tl,y:0}}),a.br.y>0&&l.rowStart<=s.rowEnd&&l.rowEnd>=s.rowEnd&&(a={...a,br:{...a.br,y:0}},d={...d,rowEnd:d.rowEnd+1}))),d!==null){let{offsets:e,anchorCoords:t}=this._updateMovableLocation({anchorCoords:d,offsets:a});a=e,d=t}let f=null,p=this._beginCommit(e.v(`op.shiftingMovableBounds`));try{if(i!==a||!e.l.isEqualRanges(s,d)){let e={offsets:a,anchorCoords:d};this._updateState(e)}this._invalidateBounds(),f=super._processContainerShift({...t,after:d}),p.commit()}catch(e){throw p.rollback(),e}return f}_invalidateBounds(){let e=this.getFirstAnchorCoords();if(e===null)return;let t=this._getState()?.offsets,n=this._calcAbsoluteBounds(e,t);this._updateState({bounds:n},null,[`onBoundsChange`])}_processContainerDelete(){super._processContainerDelete(),this._getState().contentListenerRemove?.(),this.getContent().delete()}_processContainerLayout(){let t=this.getFirstAnchorCoords(),n=this._getState()?.offsets,{offsets:r,anchorCoords:i}=this._updateMovableLocation({anchorCoords:t,offsets:n}),a=this._beginCommit(e.v(`op.updatingMovableBounds`));try{if(n!==r||t!==i){let e={offsets:r,anchorCoords:i};this._updateState(e)}this._invalidateBounds(),super._processContainerLayout(),a.commit(m_)}catch(e){throw a.rollback(),e}}_processAnchorCoords(){super._processAnchorCoords()}enrichOffset(t,n,r){if(t.r!==void 0&&t.c!==void 0)return t;let i=(t?.x??0)+n,a=(t?.y??0)+r,o=this._optionsMovable.getCoordsAtBounds({x:i,y:a,width:0,height:0}),s=this._optionsMovable.getBoundsAtCoords(o);return(t={...t}).c===void 0&&(t.c=o.colStart,t.x=e.A.roundAccurately(i-s.x,1)),t.r===void 0&&(t.r=o.rowStart,t.y=e.A.roundAccurately(a-s.y,1)),t}_fromJSON(n){let r=p_(),i={...e.l.EmptyRange},a=n.anchor,o=a?.tl??e.A.EmptyObject,s=a?.br??e.A.EmptyObject,c={c:o.c,r:o.r,x:o.x,y:o.y},l={c:s.c,r:s.r,x:s.x,y:s.y},u=n.anchorType;c.r!=null&&c.c!=null||(u??=Sh.Type.Absolute);let d=c.x=c.x??0,f=c.y=c.y??0;if(c=this.enrichOffset(c,0,0),l.x=l.x??0,l.y=l.y??0,l.r==null||l.c==null){u??=Sh.Type.OneCell;let e=this._optionsMovable.getBoundsAtCoords({rowStart:c.r,colStart:c.c,colEnd:c.c,rowEnd:c.r}),t=this.enrichOffset(l,e.x+c.x,e.y+c.y);l.r??(l.r=t.r,l.y=t.y),l.c??(l.c=t.c,l.x=t.x)}l=this.enrichOffset(l,d,f),r.tl=c,r.br=l,i.colStart=c.c,i.rowStart=c.r,i.colEnd=Math.max(i.colStart,l.c+(r.br.x>0?0:-1)),i.rowEnd=Math.max(i.rowStart,l.r+(r.br.y>0?0:-1));let p=this._beginCommit(e.v(`op.loadMovable`));u??=Sh.Type.TwoCell;let m={offsets:r,name:n.name??null,description:n.description??null,hidden:n.hidden??!1,rotation:n.rotation??0,lockAspectRatio:n.lockAspect??null,anchorType:u};m.name||=`${this._content.getTypeDescription()} ${++t.instanceCounter}`,m.bounds=this._calcAbsoluteBounds(i,r),this._updateState(m,{description:e.v(`op.loadMovable`)}),this._optionsMovable.setContainerCoords?.(i),p.commit()}toJSON(t){let n=this._getState(),r=n.anchorCoords,i=n.offsets,a={tl:{c:r.colStart,r:r.rowStart},br:{c:r.colEnd+ +!i?.br?.x,r:r.rowEnd+ +!i?.br?.y}};i&&(i.tl?.x&&(a.tl.x=e.A.roundAccurately(i.tl.x,1)),i.tl?.y&&(a.tl.y=e.A.roundAccurately(i.tl.y,1)),i.br?.x&&(a.br.x=e.A.roundAccurately(i.br.x,1)),i.br?.y&&(a.br.y=e.A.roundAccurately(i.br.y,1)));let o=this._content.toJSON(t)??{},s={anchor:a,content:{type:this._content.getType(),json:o}},c=n.anchorType;return c&&c!==Sh.Type.TwoCell&&(s.anchorType=this.getAnchorType()),n.hidden&&(s.hidden=n.hidden),n.name&&(s.name=n.name),n.description&&(s.description=n.description),n.rotation!==void 0&&n.rotation!==0&&(s.rotation=n.rotation),e.A.isDefined(n.lockAspectRatio)&&n.lockAspectRatio!==this._optionsMovable.defaultLockAspectRatio&&(s.lockAspect=n.lockAspectRatio),s}get isIMovable(){return!0}},p_=()=>({tl:{x:0,y:0},br:{x:0,y:0}}),m_={forceAmend:!0},h_=class{constructor(e,t,n,r,i,a){this._add=e,this._getItems=t,this._getCount=n,this._updateSelected=r,this._addListeners=i,this._addPicture=a}async add(e){return this._add(e)}*[Symbol.iterator](){yield*this.getItems()}getItems(e){return this._getItems(e)}getCount(){return this._getCount()}updateSelected(e,t){return this._updateSelected(e,t)}addListeners(e,t){return this._addListeners(e,t)}addPicture(e,t){return this._addPicture(e,t)}},g_=/^[^a-zA-Z_\\]+$/,__=/^[^a-zA-Z0-9_.]+$/,v_=class{constructor(t){this._closed=!1,this._lastLookup=e.A.EmptyArray,this._lastLookupAddress=null,this._lastLookupType=null,this._lastIncludeHidden=!1,this._lastAllowExtrudes=!1,this._lastLookupName=void 0,this._lastLookupScope=void 0,this._lastLookupHasScope=!1,this._sources=e.A.EmptyArray,this._sourcesRemoveListeners=[],this._options={...t},this._getSources=t.getSources??null,this._transactions=this._options.transactions??new m({transient:!0}),this._emitter=new v(this,this._transactions)}_resolveSources(){if(!this._getSources||this._closed)return this._sources;let t=this._getSources()??e.A.EmptyArray,n=this._sources;if(t.length===n.length){let e=!0;for(let r=0;r<t.length;r++)if(t[r]!==n[r]){e=!1;break}if(e)return n}let r=this,i=this._sourcesRemoveListeners.length;for(let e=0;e<i;e++)this._sourcesRemoveListeners[e]?.();this._sourcesRemoveListeners=[],this._sources=t;let a=t.length;for(let e=0;e<a;e++)this._sourcesRemoveListeners.push(t[e].addListeners({onCollectionChange:()=>{r._closed||(r._invalidateLookup(),r._emitter.notify(`onCollectionChange`))}},{transactional:!1}));return this._invalidateLookup(),t}_getOwningSource(){let e=this._resolveSources(),t=e.length;for(let n=0;n<t;n++)if(e[n].add)return e[n];return null}*[Symbol.iterator](){yield*this.getItems()}getItems(t){if(this.isClosed())return e.A.EmptyArray;let n,r,i,a,o,s=null,c=!1;if(t&&(s=t.address??null,n=t.allowExtrudes??void 0,r=t.type??void 0,i=t.includeHidden??void 0,a=t.name??void 0,c=`scope`in t,o=c?t.scope??null:void 0,s===this._lastLookupAddress&&r===this._lastLookupType&&i===this._lastIncludeHidden&&n===this._lastAllowExtrudes&&a===this._lastLookupName&&o===this._lastLookupScope&&c===this._lastLookupHasScope))return this._lastLookup;this._lastLookupAddress=s,this._lastLookupType=r,this._lastIncludeHidden=i,this._lastAllowExtrudes=n??void 0,this._lastLookupName=a,this._lastLookupScope=o,this._lastLookupHasScope=c;let l=null;if(s){let t=this._options.addressToRanges(s);if(!t)return e.V.debug(`Invalid range`,{meta:{type:`error`,address:s}}),this._lastLookup=null,null;l=t.getCoords()}let u=this._collectCandidates(l,n);if(u.length===0)return this._lastLookup=e.A.EmptyArray,e.A.EmptyArray;let d=a?.toLowerCase(),f=[],p=u.length;for(let e=0;e<p;e++){let t=u[e];r&&t.getType()!==r||!i&&t.isHidden()||d&&t.getName().toLowerCase()!==d||c&&t.getScope()!==o||f.push(t)}return f=f.sort((e,t)=>{let n=e.getType().localeCompare(t.getType());return n===0?e.getName().localeCompare(t.getName()):n}),this._lastLookup=f,f}getByRanges(e,t){return this._getByRanges(e,t,null)}_getByRanges(t,n,r){if(this.isClosed())return e.A.EmptyArray;let i=this._qualifyCoords(t,r);if(!i)return e.A.EmptyArray;let a=this.getItems(n),o=a?a.length:0;if(o===0)return e.A.EmptyArray;let s=[],c=[];for(let t=0;t<o;t++){let r=a[t],o=null;try{o=r.getRanges?.()?.getCoords()??null}catch{}if(o&&e.l.isEqualRangesArrays(o.slice().sort(e.l.rowFirstRangeComparator),i)){s.push(r.getName());continue}if(!n?.includeParts)continue;let l=r.getPartReference?.(i)??null;l&&c.push(l)}for(let e=0;e<c.length;e++)s.push(c[e]);return s}_qualifyCoords(t,n){let r=null;try{r=(n?n.getRanges(t):this._options.addressToRanges(t))?.getCoords()??null}catch{return null}if(!r||r.length===0)return null;let i=n?n.getName():this._currentScope();return r.map(e=>e.scope?e:{...e,scope:i}).sort(e.l.rowFirstRangeComparator)}_collectCandidates(t,n){let r=this._resolveSources(),i=r.length;if(i===0)return e.A.EmptyArray;let a=[];for(let e=0;e<i;e++){let i=r[e].getItems(),o=i.length;for(let e=0;e<o;e++){let r=i[e];r&&(t&&!this._matchesCoords(r,t,n)||a.push(r))}}return a}_matchesCoords(t,n,r){let i=null;try{i=t.getRanges?.()?.getCoords()??null}catch{return!1}if(!i||i.length===0)return!1;let a=n.length,o=i.length;for(let t=0;t<a;t++){let a=n[t],s=a.scope;for(let t=0;t<o;t++){let n=i[t];if(n&&(!s||!n.scope||n.scope===s)){if(r){if(e.l.isRangesIntersect(n,a))return!0}else if(e.l.isRangeWithinRange(n,a))return!0}}}return!1}getByName(e,t=!1){return this._getByName(e,t,this._currentScope())}_getByName(e,t=!1,n=null){if(!e||this._closed||typeof e!=`string`)return null;let r=e.toLowerCase();return this._findInSources(e=>e.getName().toLowerCase()===r,t?void 0:n??void 0)}_currentScope(){return this._options.getCurrentScope?.()??null}_scopedTo(e){let t=this,n=new Map;return new Proxy(t,{get:(r,i)=>{if(i===`getItems`)return n=>((e,t)=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i].getScope();a?a===t&&n.push(e[i]):r.push(e[i])}if(n.length===0)return r.slice();let i=new Map;for(let e=0;e<r.length;e++)i.set(r[e].getName().toLowerCase(),r[e]);for(let e=0;e<n.length;e++)i.set(n[e].getName().toLowerCase(),n[e]);return Array.from(i.values())})(t.getItems(n),e.getName());if(i===`getByName`)return(n,r)=>t._getByName(n,r,e.getName());if(i===`getByRanges`)return(n,r)=>t._getByRanges(n,r,e);if(i===`addFormula`)return(n,r,i)=>t._addFormula(n,r,i,e.getName());let a=Reflect.get(t,i,t);if(typeof a!=`function`)return a;let o=n.get(i);return o||(o=a.bind(t),n.set(i,o)),o}})}getById(e){return e?this._closed?null:this._findInSources(t=>t.getId()===e):null}_findInSources(e,t){let n=t?.toLowerCase(),r=null,i=this._resolveSources(),a=i.length;for(let t=0;t<a;t++){let a=i[t].getItems(),o=a.length;for(let t=0;t<o;t++){let i=a[t];if(!i||!e(i))continue;let o=i.getScope();if(o){if(n&&o.toLowerCase()===n)return i}else r||=i}}return r}_findInSourcesByKey(e,t){let n=e.toLowerCase().trim(),r=t?t.toLowerCase():null,i=this._resolveSources(),a=i.length;for(let e=0;e<a;e++){let t=i[e].getItems(),a=t.length;for(let e=0;e<a;e++){let i=t[e];if(!i||i.getName().toLowerCase().trim()!==n)continue;let a=i.getScope();if((a?a.toLowerCase():null)===r)return i}}return null}getCount(){if(this._closed)return 0;let e=0,t=this._resolveSources(),n=t.length;for(let r=0;r<n;r++)e+=t[r].getItems().length;return e}findValidName(t,n=null,r=!1){if(!t)throw Error(e._(`error.named.templateRequired`));let i=this,a=e=>{try{return i._validateName(e,n,r),!0}catch{}return!1};return a(t)?t:b(t,a)}validateName(e,t=null,n=!1){return this._validateName(e,t,n)}_validateName(t,n,r=!1){if(this._closed)throw Error(e._(`error.model.modelClosed`));if(!t||t.length===0)throw Error(e._(`error.named.nameEmpty`));if(t.length>255)throw Error(e._(`error.named.nameMaxLength`));if(t.indexOf(` `)!==-1)throw Error(e._(`error.named.containsSpaces`));let i=t.trim().toLowerCase(),a=i.substring(1,t.length-1);if(new RegExp(g_).test(i[0]))throw Error(e._(`error.named.invalidFirstChar`));if(new RegExp(__).test(a))throw Error(e._(`error.named.invalidTrailingChar`));if(i.length===1&&(i[0]===`r`||i[0]===`c`))throw Error(e._(`error.named.invalidSpecialRC`));if(function(e,t=1048576,n=16384,r=!1){let i=Rl(e,r);if(!i||i[2]||!i[1])return!1;let a=Fl(e,zl);if(!a)return!1;let o=a.rowIndex;if(o<0||o>t)return!1;let s=a.colIndex;return!(s<0||s>=n)}(t))throw Error(e._(`error.named.invalidInvalidCellAddress`));let o=t.toLowerCase()?.trim();n&&(o=o+`:`+n.toLowerCase());let s=this._findInSourcesByKey(t,n);if(s){let i=s.getRanges?.()??null;if(!r||i&&i.getCount()>0)throw Error(e._(`error.named.nameExistsInScope`,{name:t,scope:n}))}}addFormula(e,t,n=!1){return this._addFormula(e,t,n,null)}_addFormula(t,n,r=!1,i=null){let a=this._getOwningSource();if(!a?.add)throw Error(`Cannot define '${t}': no calculation engine is attached to these names.`);if(this._options.isReadOnly?.())throw Error(e._(`error.named.nameReadonly`));return this._validateName(t,i,r),a.add({name:t,expression:n,replaceExisting:r,scope:i})}beginCommit(e){return this._transactions.beginCommit(typeof e==`string`?{description:e}:e)}_invalidateLookup(){this._lastLookup=e.A.EmptyArray,this._lastLookupAddress=null,this._lastLookupType=null,this._lastLookupName=void 0,this._lastLookupScope=void 0,this._lastLookupHasScope=!1}addListeners(e,t){return this._resolveSources(),this._emitter.addListeners(e,t)}isClosed(){return this._closed}close(){if(this._closed)return;this._emitter.notify(`onClose`),this._closed=!0;let e=this._sourcesRemoveListeners.length;for(let t=0;t<e;t++)this._sourcesRemoveListeners[t]?.();this._sourcesRemoveListeners=[]}get isINamedCollection(){return!0}},y_=class extends e_{constructor(e){if(super(e),e.resource)this._resource=e.resource;else{if(!e.json)throw Error(`Resource is required to create Picture.`);this._resource=e.fromResourceId(e.json.resId)}}getType(){return`picture`}toJSON(e){let t={},n=e?.(this._resource);n!==null&&(t.resId=n);let r=this._getState();return r&&r.effects&&(t.effects=r.effects),t}getTypeDescription(){return`Picture`}async _asDataUrl(){if(this._dataUrl)return this._dataUrl;let t=await this.getDetails(),n=await e.L.getImageDataUrl(t.asUrl());return this._dataUrl=n.dataUrl,this._dataUrl}toHtml(){return null}async toImage(){let t=await this.toArrayBuffer();return new Blob([t],{type:e.r.Png})}async toArrayBuffer(){let t=(await this._asDataUrl()).substring(e.L.DATA_URL_PNG_PREFIX.length);return e.F.base64ToArrayBuffer(t)}getResource(){return this._resource}async getDetails(){return this._details||=new Promise(async(t,n)=>{try{let n=await this._resource.toBuffer(),r=await this._resource.getType(),i=await e.L.loadImageDetails(n,r?.mime);t({getNaturalSize:()=>i.naturalSize,asUrl:()=>i.asUrl,asSVGText:()=>i.asSVGText})}catch(e){n(e)}}),this._details}_getActionDescription(t){return e.v(`op.deletePicture`)}_fromDrawingJSON(e,t){this._resource?.deleteReference(this),this._resource=t?.(e.resId),this._resource.addReference(this)}_toDrawingJSON(e){let t={},n=e?.(this._resource);return n!==null&&(t.resId=n),t}_processDelete(){super._processDelete()}},b_=class extends e_{constructor(e){super(e),e.json&&this._updateState({data:e.json})}getType(){return`chart`}getChartTitle(){let e=this._getState()?.data;if(!e)return null;let t=e?.title?.text?.runs?.[0]?.text??null;return t&&typeof t==`string`?t:null}getChartType(){return(this._getState()?.data)?.types?.[0]?.type??`unknown`}getDescription(){return`Chart: ${this.getChartType()}`}toJSON(e){let t=this._getState(),n=null;return t&&t.data&&(n=t.data),n}getTypeDescription(){return`Chart`}},x_=class extends e_{constructor(e){super(e),e.json&&this._updateState({data:e.json})}getType(){return`shape`}getName(){return this._options?.getName?.()??``}getDescription(){return`Shape: ${this._getState()?.data}`}toJSON(e){let t=this._getState(),n=null;return t&&t.data&&(n=t.data),n}getTypeDescription(){return`Shape`}get[Symbol.toStringTag](){return`[Shape]`}toString(){return this.getTypeDescription()}},S_=class extends e_{constructor(e){super(e),e.json&&this._updateState({data:e.json,name:e.name})}getType(){return`slicer`}getDescription(){let e=this._getState();return`Slicer: ${e?.data?.name??e?.name}`}toJSON(e){return this._getState(),null}getTypeDescription(){return`Slicer`}get[Symbol.toStringTag](){return`[Slicer]`}toString(){return this.getTypeDescription()}},C_=class extends e_{constructor(e){super(e),e.json&&this._updateState({data:e.json,type:e.type})}getType(){return this._getState()?.type??`custom`}getDescription(){let e=this._getState(),t=e?.type??`Custom`,n=e?.data;return`${t}${n?`: ${n}`:``}`}toJSON(e){let t=this._getState(),n=null;return t&&t.data&&(n=t.data),n}getTypeDescription(){return`CustomElement`}};function w_(e,t,n=!0,r=!0){let i=0,a=0;if(!n&&!r)return{x:i,y:a};let o=!1,s=0;do{let s={x:t.x+i,y:t.y+a,width:0,height:0},c=e.getItems({bounds:s});if(o=!1,c.length>0){for(let e=0;!o&&e<c.length;e++){let t=c[e].getBounds();t.x===s.x&&t.y===s.y&&(o=!0)}o&&(i+=n?16:0,a+=r?16:0)}}while(o&&++s<100);return{x:i,y:a}}function T_(t){if(!t||t.length<=1)return!1;if(t.length===2)return e.l.isRangesIntersect(t[0],t[1]);let n=new va;n.load(t);let r=t.length;for(let e=0;e<r;e++)if(n.search(t[e]).length>1)return!0;return!1}function E_(t,r,i){let a=[];if(e.l.isRangesIntersect(t,r)){let o=e.A.subtractRect({top:t.rowStart,left:t.colStart,bottom:t.rowEnd+1,right:t.colEnd+1},{top:r.rowStart,left:r.colStart,bottom:r.rowEnd+1,right:r.colEnd+1},i===n.l.Axis.Column),s=o.length;for(let e=0;e<s;e++){let t={colStart:o[e].left,rowStart:o[e].top,colEnd:o[e].right-1,rowEnd:o[e].bottom-1};a.push(t)}}else a.push(t);return a}function D_(t,n,r){if(!n||!t?.[0])return;let i=t.length;for(let a=0;a<i;a++){let i=t[a];e.l.intersectRanges(i,n)&&r(i,!e.l.isRangeWithinRange(i,n),a)}}function O_(e){return e?{colIndex:e.colStart,rowIndex:e.rowStart}:null}function k_(e,t){let n=e.colStart,r=e.rowStart,i=t.colStart,a=t.rowStart;return(e,t)=>{let o=e.colIndex-n,s=t.colIndex-i;return o===s?e.rowIndex-r-(t.rowIndex-a):o-s}}function A_(e,t){let n=e.colStart,r=e.rowStart,i=t.colStart,a=t.rowStart;return(e,t)=>{let o=e.rowIndex-r,s=t.rowIndex-a;return o===s?e.colIndex-n-(t.colIndex-i):o-s}}function j_(t,n,r=!1,i=!1){n||={...t};let a=n.colEnd-n.colStart+1,o=n.rowEnd-n.rowStart+1;if(i){let e=a;a=o,o=e}let s={...t};if(s.colEnd=t.colStart+a-1,s.rowEnd=t.rowStart+o-1,r){if(!e.l.isSingleCell(t)){let e=t.colEnd-t.colStart,n=t.rowEnd-t.rowStart;s.colEnd=t.colStart+(i?n:e),s.rowEnd=t.rowStart+(i?e:n)}return s}let c=t.colEnd-t.colStart+1;if(c%a!==0)return s;let l=t.rowEnd-t.rowStart+1;return l%o!==0||(s.colEnd=t.colStart+c-1,s.rowEnd=t.rowStart+l-1),s}(qg||={}).Content={Values:`values`,Formats:`formats`,Formulas:`formulas`,Hyperlinks:`hyperlinks`,Tables:`tables`,Notes:`notes`,Comments:`comments`},(Jg||={}).Feature={Contentful:`contentful`,DateFormat:`dateFormat`,Error:`error`,Formula:`formula`,Spills:`spills`,CalcError:`calcError`,Fill:`fill`,Border:`border`,NumberFormat:`numberFormat`,Alignment:`alignment`,Font:`font`,Merge:`merge`,Table:`table`,AutoTable:`autoTable`,Hyperlink:`hyperlink`,Comments:`comments`,Unlock:`unlock`,Conditionals:`conditionals`,DataValidations:`dataValidations`};var M_=class{constructor(e,t,n){this._add=e,this._get=t,this._getByName=n}add(t,n){if(!t)throw Error(e._(`error.table.tableNoBody`));return this._add(t,n)}*[Symbol.iterator](){yield*this.getItems()}getItems(e){if(e&&e.name&&Object.keys(e).length===0)return[this._getByName(e.name)];let t;e?.address&&(t=e.address);let n=this._get(t,e?.ignoreHidden,e?.fullyContained);if(e?.name){let t=e.name.toLocaleLowerCase();for(let e=0;e<n.length;e++)if(n[e].getName().toLocaleLowerCase()===t)return[n[e]]}return n}getByName(e){if(typeof e!=`string`)throw Error(`Get by name must take a valid name.`);return this._getByName(e)}getCount(){return this._get(null,!1,!1).length}};function N_(t,r,i){let a=[];r?.ranges&&r.ranges.length>0?a=r.ranges:r?.cell&&(a=[e.l.cellToRange(r.cell)]);let o=t===n.l.Axis.Column,s=o?i.rowStart:i.colStart,c=o?i.rowEnd:i.colEnd,l=[];for(let e=0;e<a.length;e++){let t=a[e],n=o?t.colStart:t.rowStart,r=o?t.colEnd:t.rowEnd,i=o?t.rowStart:t.colStart,u=o?t.rowEnd:t.colEnd;l=Vr(Br(l,{min:n,max:r,value:i<=s&&u>=c},{onUpdate:(e,t)=>!!e||!!t}))}return l}function P_(t,n,r){if(!t)return e.l.EmptySelection;let i=n.cell,a=r.colStart,o=r.rowStart,s=r.colEnd,c=r.rowEnd,l=t?.cell;!l||e.l.isEqualCells(i,l)&&l.scope===i?.scope||(i=Object.freeze({...l,colIndex:Math.max(a,Math.min(l.colIndex??n.cell?.colIndex??0,s)),rowIndex:Math.max(o,Math.min(l.rowIndex??n?.cell?.rowIndex??0,c))}));let u=t?.ranges?[...t.ranges]:[],d=!1,f=u.length,p=f===0;for(let t=0;t<f;t++){let n=u[t];n&&(u[t]=Object.freeze({...n,colStart:Math.max(a,Math.min(n.colStart,s)),rowStart:Math.max(o,Math.min(n.rowStart,c)),colEnd:Math.max(a,Math.min(n.colEnd,s)),rowEnd:Math.max(o,Math.min(n.rowEnd,c))}),p||=e.l.isCellWithinRange(i,n),d||=Object.keys(n).length>4)}let m=n?.ranges??[];!d&&e.l.isEqualRangesArrays(m,u)||(m=u);let h=t?.rangeIndex??n?.rangeIndex??e.l.EmptySelection.rangeIndex;if(h=Math.max(-1,Math.min(h,m.length-1)),!p&&h>=0&&m[h]){let e=m[h],t=i.rowIndex;t<e.rowStart?t=e.rowStart:t>e.rowEnd&&(t=e.rowEnd);let n=i.colIndex;n<e.colStart?n=e.colStart:n>e.colEnd&&(n=e.colEnd),i=Object.freeze({...i,colIndex:n,rowIndex:t})}return Object.freeze({cell:i,ranges:m,rangeIndex:h})}function F_(t){if(!t)return null;let n=[];if(t.ranges&&t.ranges.length>0){let e=Math.max(0,Math.min(t.rangeIndex??0,t.ranges.length));for(let r=e;r<t.ranges.length;r++)n.push(t.ranges[r]);for(let r=0;r<e;r++)n.push(t.ranges[r])}else t.cell&&n.push(e.l.cellToRange(t.cell));return n}function I_(t,n,r=-1){if(!t||t.length===0)return null;let i=t[0],a=t.length===1&&i.rowStart===i.rowEnd&&i.colStart===i.colEnd,o=r===-1?t.length-1:Math.min(Math.max(0,r),t.length-1);if(!n){let e=t[o];n={rowIndex:e.rowStart,colIndex:e.colStart}}return{cell:n,ranges:a?e.A.EmptyArray:[...t],rangeIndex:a?-1:o}}function L_(e,t){if(!t||t.rowStart>e.rowEnd||t.rowEnd<e.rowStart||t.colStart>e.colEnd||t.colEnd<e.colStart)return[{...e}];let n=[];t.rowStart>e.rowStart&&n.push({colStart:e.colStart,rowStart:e.rowStart,colEnd:e.colEnd,rowEnd:t.rowStart-1}),t.rowEnd<e.rowEnd&&n.push({colStart:e.colStart,rowStart:t.rowEnd+1,colEnd:e.colEnd,rowEnd:e.rowEnd});let r=Math.max(e.rowStart,t.rowStart),i=Math.min(e.rowEnd,t.rowEnd);return t.colStart>e.colStart&&n.push({colStart:e.colStart,rowStart:r,colEnd:t.colStart-1,rowEnd:i}),t.colEnd<e.colEnd&&n.push({colStart:t.colEnd+1,rowStart:r,colEnd:e.colEnd,rowEnd:i}),n}function R_(e,t){if(!t||t.length===0)return e.map(e=>({...e}));let n=e;for(let e=0;e<t.length&&n.length>0;e++){let r=[];for(let i=0;i<n.length;i++)r.push(...L_(n[i],t[e]));n=r}return n}function z_(e,t){return e.colStart<=t.colStart&&e.colEnd>=t.colEnd&&e.rowStart<=t.rowStart&&e.rowEnd>=t.rowEnd?{...e}:t.colStart<=e.colStart&&t.colEnd>=e.colEnd&&t.rowStart<=e.rowStart&&t.rowEnd>=e.rowEnd?{...t}:e.colStart===t.colStart&&e.colEnd===t.colEnd&&e.rowStart<=t.rowEnd+1&&t.rowStart<=e.rowEnd+1?{colStart:e.colStart,rowStart:Math.min(e.rowStart,t.rowStart),colEnd:e.colEnd,rowEnd:Math.max(e.rowEnd,t.rowEnd)}:e.rowStart===t.rowStart&&e.rowEnd===t.rowEnd&&e.colStart<=t.colEnd+1&&t.colStart<=e.colEnd+1?{colStart:Math.min(e.colStart,t.colStart),rowStart:e.rowStart,colEnd:Math.max(e.colEnd,t.colEnd),rowEnd:e.rowEnd}:null}(Qg=Zg||={}).fastStringToCol=Il,Qg.fastStringToCell=Nl,Qg.fastStringToRange=Ll,Qg.rangeToString=(e,t,n)=>yl(e,t,n),Qg.cellToString=gl,Qg.normalizeA1ToR1C1=function(e,t,n,r){Vl.length=0;let i=e.replace(cl,Hl),a=0,o=i.replace(ol,(e,o,s)=>{let c=Bl(e,t,n);if(r){if(s>a){let e=i.slice(a,s);r.push(e.replace(ll,Ul))}let o,l=e,u=l.lastIndexOf(`!`);u!==-1&&(o=l.slice(0,u).replace(ll,Ul),l=l.slice(u+1));let d,f=l.lastIndexOf(`:`);if(f!==-1){let e=l.slice(0,f),i=l.slice(f+1),a=Bl(e,t,n),o=Bl(i,t,n);d=Pl(a,!0),r.push(d??a),r.push(`:`),r.push(Pl(o,!0)??o)}else d=Pl(Bl(l,t,n),!0),r.push(d??c.replace(ll,Ul));o&&d&&(d.scope=o)}return a=s+e.length,c});if(r&&a<i.length){let e=i.slice(a);r.push(e.replace(ll,Ul))}return o=o.toUpperCase().replace(sl,``),o.replace(ll,Ul)},Qg.resolveRelativeToA1=function(e,t,n){let r=``,i=e.length;for(let a=0;a<i;a++){let i=e[a];r+=typeof i==`string`?i:Gl(i,t,n)}return r},Qg.sheetNameToString=_l,Qg.sheetAndRangeToString=vl,Qg.runToString=Ql,Qg.stringToRun=$l,Qg.runToRef=eu,Qg.refToRun=tu,Qg.runsToRefs=nu,Qg.refsToRuns=ru;var B_=(e,t)=>e-t;function V_(e,t){return e.rowStart<=t.rowEnd&&t.rowStart<=e.rowEnd&&e.colStart<=t.colEnd&&t.colStart<=e.colEnd}var H_,U_,W_=class{constructor(){this._bands=new Map,this._tall=[],this._isTall=[],this._all=[],this._isKnown=[],this._overlapping=!1}isOverlapping(){return this._overlapping}markOverlapping(){this._overlapping=!0}add(e,t){this._isKnown[e]||(this._isKnown[e]=!0,this._all.push(e));let n=t.rowStart>>5,r=t.rowEnd>>5;if(r-n>64)return void(this._isTall[e]||(this._isTall[e]=!0,this._tall.push(e)));let i=this._bands;for(let t=n;t<=r;t++){let n=i.get(t);n===void 0&&i.set(t,n=[]),n.push(e)}}collectRows(e,t,n,r,i){let a=this._tall;for(let e=0;e<a.length;e++){let t=a[e];n[t]!==r&&(n[t]=r,i.push(t))}let o=e>>5,s=t>>5;if(s-o>64){let e=this._all;for(let t=0;t<e.length;t++){let a=e[t];n[a]!==r&&(n[a]=r,i.push(a))}return}let c=this._bands;for(let e=o;e<=s;e++){let t=c.get(e);if(t!==void 0)for(let e=0;e<t.length;e++){let a=t[e];n[a]!==r&&(n[a]=r,i.push(a))}}}collectNeighbors(e,t,n,r){this.collectRows(e.rowStart-1,e.rowStart-1,t,n,r),this.collectRows(e.rowEnd+1,e.rowEnd+1,t,n,r),(e.rowEnd>>5)-(e.rowStart>>5)>64&&!this._overlapping||this.collectRows(e.rowStart,e.rowEnd,t,n,r)}},G_=class{constructor(){this._keys=[]}getSize(){return this._keys.length}push(e){let t=this._keys;t.push(e);let n=t.length-1;for(;n>0;){let e=n-1>>1;if(t[e]<=t[n])break;let r=t[e];t[e]=t[n],t[n]=r,n=e}}pop(){let e=this._keys,t=e[0],n=e.pop(),r=e.length;if(r>0){e[0]=n;let t=0;for(;;){let n=2*t+1;if(n>=r)break;let i=n+1,a=i<r&&e[i]<e[n]?i:n;if(e[t]<=e[a])break;let o=e[t];e[t]=e[a],e[a]=o,t=a}}return t}};function K_(e,t){let n=e.map(e=>({...e})),r=Array(n.length).fill(!1),i=n.length+t.length;return i*i<=256?(function(e,t,n){for(let r=0;r<n.length;r++){let i=[n[r]];for(let t=0;t<e.length&&i.length>0;t++){let n=[];for(let r=0;r<i.length;r++)n.push(...L_(i[r],e[t]));i=n}for(let n=0;n<i.length;n++)e.push(i[n]),t.push(!0)}let r=!0;for(;r;){r=!1;for(let n=0;n<e.length&&!r;n++)for(let i=n+1;i<e.length&&!r;i++){if(!t[n]&&!t[i])continue;let a=z_(e[n],e[i]);a&&(e[n]=a,t[n]=!0,e.splice(i,1),t.splice(i,1),r=!0)}}}(n,r,t),n):function(e,t,n){let r=e.length,i=Array(r).fill(!0),a=Array(r).fill(-1),o=new G_,s=[],c=0,l=l=>{s.length=0,n.collectNeighbors(e[l],a,c++,s);for(let n=0;n<s.length;n++){let a=s[n];if(a===l||!i[a]||!t[l]&&!t[a]||!z_(e[l],e[a]))continue;let c=a<l?a:l,u=a<l?l:a;o.push(c*r+u)}};for(let e=0;e<r;e++)l(e);for(;o.getSize()>0;){let a=o.pop(),s=Math.floor(a/r),c=a-s*r;if(!i[s]||!i[c]||!t[s]&&!t[c])continue;let u=z_(e[s],e[c]);u&&(e[s]=u,t[s]=!0,i[c]=!1,n.add(s,u),l(s))}let u=[];for(let t=0;t<r;t++)i[t]&&u.push(e[t]);return u}(n,r,function(e,t,n){let r=new W_,i=[],a=[],o=e.length;for(let t=0;t<o;t++){if(i.push(-1),!r.isOverlapping()){a.length=0,r.collectRows(e[t].rowStart,e[t].rowEnd,i,-2-t,a);for(let n=0;n<a.length;n++)if(V_(e[t],e[a[n]])){r.markOverlapping();break}}r.add(t,e[t])}for(let o=0;o<n.length;o++){a.length=0,r.collectRows(n[o].rowStart,n[o].rowEnd,i,o,a),a.sort(B_);let s=[n[o]];for(let t=0;t<a.length&&s.length>0;t++){let r=e[a[t]];if(!V_(n[o],r))continue;let i=[];for(let e=0;e<s.length;e++)i.push(...L_(s[e],r));s=i}for(let n=0;n<s.length;n++){let a=e.length;e.push(s[n]),t.push(!0),i.push(-1),r.add(a,s[n])}}return r}(n,r,t))}var q_=class extends Lg{constructor(...e){super(...e),this._conditionWatches=new Map,this._markedValueRange=void 0,this._valueUpdatesScheduled=!1}_initialize(t){super._initialize(t),this._getValueGrid=t.getGridValues,this._updateState({...J_,...this._getDefaultState(t)},this._getActionDescription(`initialize`)??e.v(`op.initialize`));try{this._fromJSON(t?.json)}catch(e){throw console.error(`Error creating anchored conditional from JSON`,e),e}let n=this;this._rangeListener=e=>{n._markValueUpdates(e.getTo())},this._processAnchorCoords()}_markValueUpdates(e=null){this._markedValueRange===void 0?this._markedValueRange=e:this._markedValueRange=null,this._valueUpdatesScheduled||(this._valueUpdatesScheduled=!0,queueMicrotask(()=>{this._valueUpdatesScheduled=!1;let e=this._markedValueRange;this._markedValueRange=void 0,e!==void 0&&(this.isClosed()||this.isDeleted()||this._processValueUpdates(e))}))}_watchConditionFormula(e,t,n,r){r.add(t);let i=this._conditionWatches.get(t);if(!i){if(e.getCount()===0)return null;let n=this;i={remove:()=>{},values:[],pending:[]},this._conditionWatches.set(t,i);let r=i;r.remove=e.addWatch(t,(e,t)=>{r.values[t]=e;let i=r.pending[t];if(i&&i.length>0){r.pending[t]=[];for(let t=0;t<i.length;t++)i[t](e)}n._markValueUpdates(null)})}let a=i.values[n];if(a)return a;let o=i;return new Promise(e=>{(o.pending[n]??=[]).push(e)})}_pruneConditionWatches(e){for(let[t,n]of[...this._conditionWatches])e.has(t)||(this._removeConditionWatch(n),this._conditionWatches.delete(t))}_removeConditionWatches(){for(let e of this._conditionWatches.values())this._removeConditionWatch(e);this._conditionWatches.clear()}_removeConditionWatch(e){e.remove();for(let t=0;t<e.pending.length;t++){let n=e.pending[t];if(n)for(let e=0;e<n.length;e++)n[e](null)}e.pending.length=0}_processClose(){this._removeConditionWatches(),this._getState().removeListener?.(),super._processClose()}_processAnchorCoords(){let t=this._getState();if(!t||(t.removeListener?.(),super._processAnchorCoords(),!this._rangeListener))return;let n=this.getRanges(),r=n.isInvalid()?void 0:n.addListener(this._rangeListener,Y_);this._updateState({removeListener:r},this._getActionDescription(`updateListener`)??e.v(`op.updateListener`)),this._markValueUpdates(null)}_processContainerShift(e){let t=super._processContainerShift(e);return e.after||this._getState().anchorCoords||this._delete(),this._processAnchorCoords(),t}_isAnchorAbsolute(){return!0}getCoords(){return this.getFirstAnchorCoords()}setRanges(e,t){return this._setAnchorRanges(e,t)}getIndex(){return this._options?.getContainerIndex?.()??-1}setIndex(e){return this._options?.setContainerIndex?.(e),this}getCondition(){return this._getState().condition??null}setCondition(t,n){let r=Fg.resolveInput(t);return this._updateState({condition:r},{description:e.v(`op.setCondition`),...n},[`onConditionChange`])}_rebaseAnchorFormulas(e,t){if(e.rowIndex===t.rowIndex&&e.colIndex===t.colIndex)return!0;let n=this._getState().condition;if(!n)return!0;let r=JSON.parse(JSON.stringify(n.toJSON())),i=this._rebaseConditionFormulas(r,e,t);return i!==null&&(i&&this.setCondition(r),!0)}_rebaseConditionFormulas(e,t,n){if(!e||typeof e!=`object`)return!1;let r=e.param;if(e.operator===Q.BuiltInOperatorNames.Expression){if(typeof r!=`string`||!r)return!1;let i=this._shiftFormulaText(r,t,n);return i===null?null:i!==r&&(e.param=i,!0)}if(typeof r==`string`){if(!r.startsWith(`=`))return!1;let i=this._shiftFormulaText(r.slice(1),t,n);return i===null?null:`=`+i!==r&&(e.param=`=`+i,!0)}if(!r||typeof r!=`object`)return!1;if(Array.isArray(r)){let e=!1;for(let i of r){let r=this._rebaseConditionFormulas(i,t,n);if(r===null)return null;e||=r}return e}if(typeof r.operator==`string`)return this._rebaseConditionFormulas(r,t,n);let i=!1;for(let e of[`from`,`to`]){let a=r[e];if(typeof a!=`string`||!a.startsWith(`=`))continue;let o=this._shiftFormulaText(a.slice(1),t,n);if(o===null)return null;`=`+o!==a&&(r[e]=`=`+o,i=!0)}return i}_extendPastedRanges(e,t){return!(this.isDeleted()||this.getIndex()<0||JSON.stringify(this.toJSON())!==t||(this._extendRanges(e),0))}_extendRanges(t){let n=this.getRanges().getCoords(),r=K_(n,t);if(e.l.isEqualRangesArrays(n,r))return;let i=n[0],a=r[0];if((a.rowStart!==i.rowStart||a.colStart!==i.colStart)&&!this._rebaseAnchorFormulas({rowIndex:i.rowStart,colIndex:i.colStart},{rowIndex:a.rowStart,colIndex:a.colStart})){let i=R_(t,n);if(i.length===0)return;r=n.concat(K_(e.l.EmptyRanges,i))}this.setRanges(r)}_shiftFormulaText(e,t,n){let r=this._options.getCalculation?.()??null;if(!r)return null;try{let i=r.createFormula(e,t),a=i?.shift(n);return a?a.hasRefError()&&!i.hasRefError()?null:a.getExpression():null}catch{return null}}createDefaultCondition(){return Fg.resolveInput({selector:null,operator:null,param:null})}apply(){}async _evalConditionRanges(e){let t=this._getState().condition;if(!t)return;let n=this._options,r=n.getCalculation?.()??null,i=this._getValueGrid(),a=this.getRanges(),o=new Set,s=a.getCount();for(let c=0;c<s;c++){let s=a.at(c).getCoords();if(!s)continue;let l=c;await jg({runtime:n.getRuntime?.(),calculation:r,conditions:[t],values:i,coords:s,watchFormula:e=>this._watchConditionFormula(a,e,l,o),onTrue:e.onTrue,onFalse:e.onFalse})}this._pruneConditionWatches(o)}get[Symbol.toStringTag](){return`[${this._getType()}]`}toString(){let e=this._getState().condition,t=e?.getSelector()?.getName(),n=e?.getOperator()?.getName(),r=this.getRange()?.toString();return`${this._getType()}${t?`:${t}`:``}${n?`:${n}`:``}${r?`:${r}`:``}`}},J_=Object.freeze({condition:null,removeListener:null}),Y_=Object.freeze({transactional:!1});(U_=H_||={}).ScaleType={ColorScale:`colorScale`,DataBar:`dataBar`,IconSet:`iconSet`},U_.ColorStopType={AutoMin:`autoMin`,AutoMax:`autoMax`,Formula:`formula`,Max:`max`,Min:`min`,Num:`num`,Percent:`percent`,Percentile:`percentile`};var X_,Z_=class e{constructor(e,t){this._c=e,this._m=t}getModel(){return this._m}getCoords(){return this._c}getPropertiesAt(e,t,n){return this._m.getPropertiesAt(e,t,n)}getDecorationAt(e,t,n){return this._m.getDecorationAt(e,t,n)}getSplit(t){let n=this._m;return[new e(t[0],n),new e(t[1],n)]}},Q_=class extends q_{constructor(...e){super(...e),this._colorScale=null,this._dataBar=null,this._iconSet=null,this._matches=null,this._stopValues=new Map,this._stopWatchRemoves=null,this._stopWatchKey=null,this._prepareGeneration=0}_initialize(e){if(!e.json)throw Error(`json is required`);this._styles=e.sheet?.getStyles()??new jm,super._initialize(e),this._stylesRemoveListener=this._styles.addListeners({onThemeChange:()=>{this._markValueUpdates(null)}})}_getType(){return`ConditionalFormat`}_getActionDescription(t){return e.v(t===`delete`?`op.deleteConditionalFormat`:t===`initialize`?`op.initializeConditionalFormat`:`op.updateConditionalFormatListener`)}_getDefaultState(e){return{...$_}}_processValueUpdates(e=null){let t=this._getState();if(!t)return;let n=this._options,r=this,i=t.scale,a=this.getRanges();this._syncStopWatches(a,i?.stops??null);let o=++this._prepareGeneration,s=i?.type===H_.ScaleType.ColorScale?i.stops:null;s?(async()=>{let e=await r._prepareColorScale(a,s);o===r._prepareGeneration&&(r._colorScale=e,n.invalidate?.())})():this._colorScale=null;let c=i?.type===H_.ScaleType.DataBar?i:null;c?(async()=>{let e=await r._prepareDataBar(a,c);o===r._prepareGeneration&&(r._dataBar=e,n.invalidate?.())})().catch(()=>{o===r._prepareGeneration&&(r._dataBar=null)}):this._dataBar=null;let l=i?.type===H_.ScaleType.IconSet?i:null;l?(async()=>{let e=await r._prepareIconSet(a,l);o===r._prepareGeneration&&(r._iconSet=e,n.invalidate?.())})().catch(()=>{o===r._prepareGeneration&&(r._iconSet=null)}):this._iconSet=null,t.condition&&t.style?(async()=>{let e=new Ya({axis:r._getValueGrid().getAxis()});await r._evalConditionRanges({onTrue:t=>{e.setValueAt(t.rowIndex,t.colIndex,!0)}}),o===r._prepareGeneration&&(r._matches=e,n.invalidate?.())})().catch(()=>{o===r._prepareGeneration&&(r._matches=null)}):this._matches=null}async _resolveStopValues(e,t){let n=t.some(e=>e.type===H_.ColorStopType.Min||e.type===H_.ColorStopType.Max||e.type===H_.ColorStopType.Percent||e.type===H_.ColorStopType.AutoMin||e.type===H_.ColorStopType.AutoMax),r=null,i=null,a=null;if(n){r=e.getStats();let t=r.getAggregates();i=t.min??null,a=t.max??null}let o=[];for(let n of t){let t=null;switch(n.type??H_.ColorStopType.Num){case H_.ColorStopType.Min:t=i;break;case H_.ColorStopType.Max:t=a;break;case H_.ColorStopType.AutoMin:t=i===null?null:Math.min(0,i);break;case H_.ColorStopType.AutoMax:t=a===null?null:Math.max(0,a);break;case H_.ColorStopType.Num:t=Number(n.value)??0;break;case H_.ColorStopType.Percentile:r??=e.getStats(),t=r.getSortedNumbers().getPercentile((Number(n.value)??0)/100);break;case H_.ColorStopType.Percent:{let e=Math.max(0,Math.min(100,Number(n.value)??0));i!==null&&a!==null&&(t=i+e/100*(a-i));break}case H_.ColorStopType.Formula:{let e=this._stopValues.get(``+n.value);typeof e==`number`&&(t=e);break}default:t=Number(n.value)??0}o.push(t!==null&&Number.isFinite(t)?t:null)}return o}_formulaAnchor(e){let t=e.getCount()>0?e.at(0).getCoords():null;return t?{rowIndex:t.rowStart,colIndex:t.colStart}:null}_syncStopWatches(e,t){let n=[],r=t?t.length:0;for(let e=0;e<r;e++){let r=t[e];if(r.type!==H_.ColorStopType.Formula)continue;let i=``+(r.value??``);i.trim().length>0&&!n.includes(i)&&n.push(i)}let i=n.length>0?this._formulaAnchor(e):null,a=i?`${i.rowIndex}:${i.colIndex}|${n.join(`\0`)}`:null;if(a===this._stopWatchKey||(this._removeStopWatches(),this._stopWatchKey=a,!a||!i))return;let o=e.getSheet().getRange({rowStart:i.rowIndex,rowEnd:i.rowIndex,colStart:i.colIndex,colEnd:i.colIndex}),s=this,c=[];for(let e=0;e<n.length;e++){let t=n[e];c.push(o.addWatch(t,e=>{let n=e.getValueAt(0,0),r=typeof n==`number`&&Number.isFinite(n)?n:null;s._stopValues.has(t)&&s._stopValues.get(t)===r||(s._stopValues.set(t,r),s._markValueUpdates(null))}))}this._stopWatchRemoves=c}_removeStopWatches(){let e=this._stopWatchRemoves;if(e){for(let t=0;t<e.length;t++)e[t]();this._stopWatchRemoves=null,this._stopValues.clear()}}_processClose(){this._removeStopWatches(),this._stopWatchKey=null,this._stylesRemoveListener?.(),this._stylesRemoveListener=null,super._processClose()}async _prepareColorScale(e,t){if(!t||t.length===0)return null;let n=await this._resolveStopValues(e,t),r=this._styles,i=[];for(let e=0;e<t.length;e++){let a=n[e];if(a===null)continue;let o=t[e],s=r.parseColor(o.color).toRGBA(),c=[s.red,s.green,s.blue];i.push({v:a,rgb:c,exclusive:o.exclusive??!1})}return i.length===0?null:(i.sort((e,t)=>e.v-t.v),{stops:i,colorFor:iv(i)})}async _prepareDataBar(e,t){let n=t.stops;if(!n||n.length<2)return null;let r,i=await this._resolveStopValues(e,n),a=i[0],o=i[i.length-1];if(a===null||o===null||o===a)return null;r=t.axisPosition===`none`?0:t.axisPosition===`middle`?.5:nv((0-a)/(o-a));let s=nv((t.minLength??0)/100),c=nv((t.maxLength??100)/100),l=this._styles,u=e=>e===void 0?void 0:l.parseColor(e).toCSS(`adaptive`,!0),d={type:H_.ScaleType.DataBar,axis:r,color:u(t.color)??ev,negativeColor:u(t.negativeFillColor),borderColor:u(t.borderColor),negativeBorderColor:u(t.negativeBorderColor),axisColor:u(t.axisColor),gradient:t.gradient??!1,direction:t.direction===`rightToLeft`?`rightToLeft`:`leftToRight`,showValue:t.showValue??!0};return{barFor:e=>{let t,n=nv((e-a)/(o-a))-r,i=n>=0?1-r:r;if(i<=0)t=r;else{let e=s+Math.abs(n)/i*(c-s);t=r+(n>=0?1:-1)*e*i}return{...d,value:nv(t)}}}}async _prepareIconSet(e,t){let n=t.stops;if(!n||n.length===0)return null;let r=t.iconSet;if(!r)return null;let i=await this._resolveStopValues(e,n),a=n.length,o=t.icon,s=t.reverse??!1,c=t.showValue??!0;return{iconFor:e=>{let t=0;for(let r=1;r<a;r++){let a=i[r];if(a!==null){if(!(n[r].exclusive?e>a:e>=a))break;t=r}}s&&(t=a-1-t);let l=o?.[t];if(l){let e=function(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:0}(l.set);return l.id<0||l.id>=e?null:{type:H_.ScaleType.IconSet,index:l.id,set:l.set,count:e,showValue:c}}return{type:H_.ScaleType.IconSet,index:t,set:r,count:a,showValue:c}}}}setStopIfTrue(t,n){return this._updateState({stopIfTrue:t},{description:e.v(t?`op.setStopTrue`:`op.setStopFalse`),...n},[`onAnyChange`]),this}isStopIfTrue(){return this._getState().stopIfTrue??!1}getScale(){return this._getState().scale??null}getStyle(){return this._getState().style??null}_rebaseAnchorFormulas(e,t){if(!super._rebaseAnchorFormulas(e,t))return!1;if(e.rowIndex===t.rowIndex&&e.colIndex===t.colIndex)return!0;let n=this._getState().scale,r=n?.stops;if(!r||r.length===0)return!0;let i=!1,a=Array(r.length);for(let n=0;n<r.length;n++){let o=r[n];if(a[n]=o,o.type!==H_.ColorStopType.Formula||typeof o.value!=`string`||!o.value)continue;let s=this._shiftFormulaText(o.value,e,t);if(s===null)return!1;s!==o.value&&(i=!0,a[n]={...o,value:s})}return i&&this.update({scale:{...n,stops:a}}),!0}getSnapshot(t){let n={...this.toJSON()},r=JSON.stringify(this.toJSON()),i=this.getRange().getCoords(),a=this,o=Object.freeze({...t});return{async copyTo(t,i){let o=t.ranges??[t.range];if(!t.extend||!a._extendPastedRanges(o,r)){let e=t.conditionals.add(o,{...n});t.index!==void 0&&e.setIndex(t.index)}return e.l.unionRangesArrays(o)},getCoords:()=>i,getSource:()=>a,getName:()=>`Conditional Format`,getMarkOptions:()=>o,isISnapshot:!0}}_createSpatial(e){return new Z_(e,this)}update(t,n){if(this.isDeleted())throw Error(`Table has been closed. No further operations are allowed.`);let r=this._getState(),i=this._beginCommit(n?.description??e.v(`op.updateConditionalFormat`));try{let{condition:e,stopIfTrue:a,...o}=t,s={...r,...o,...`stopIfTrue`in t?{stopIfTrue:a??!1}:null,...`condition`in t?{condition:Fg.fromJSON(e)}:null};`condition`in t&&s.condition&&!(`scale`in t)?s.scale=null:`scale`in t&&s.scale&&!(`condition`in t)&&(s.condition=null),this._updateState(s,n),this._getEmitter().notify(`onAnyChange`),i.commit()}catch(e){throw i.rollback(),e}return this._markValueUpdates(null),this}toJSON(){let e={},t=this._getState();if(t===null)return null;if(t.condition){let n=t.condition.toJSON();n&&(e.condition=n)}return t.style&&(e.style=t.style),t.scale&&(e.scale=t.scale),t.stopIfTrue&&(e.stopIfTrue=t.stopIfTrue),t.pivot&&(e.pivot=t.pivot),t.ext&&(e.ext=t.ext),e}_fromJSON(t){let n=t??{},r={...$_,style:n.style??null,scale:n.scale??null,stopIfTrue:n.stopIfTrue??!1,pivot:n.pivot??!1,ext:n.ext??null,condition:Fg.fromJSON(n.condition)};this._updateState(r,{description:e.v(`op.initializeConditionalFormat`)})}getPropertiesAt(e,t,n){let r=this._colorScale;if(r&&typeof n==`number`)return{fill:{type:`solid`,color:r.colorFor(n)}};let i=this._matches;return i&&i.getValueAt(e,t)?this._getState().style:null}getDecorationAt(e,t,n){if(typeof n!=`number`||!Number.isFinite(n))return null;let r=this._dataBar;if(r)return r.barFor(n);let i=this._iconSet;return i?i.iconFor(n):null}get isIConditionalFormat(){return!0}},$_=Object.freeze({condition:null,removeListener:null,style:null,scale:null,stopIfTrue:!1,pivot:!1,ext:null}),ev=`rgb(99, 142, 198)`;function tv(e,t,n){return e+(t-e)*n}function nv(e){return e<0?0:e>1?1:e}function rv(e){return`rgb(${e[0]}, ${e[1]}, ${e[2]})`}function iv(e){let t=e.length;if(t===0)return e=>``;let n=e[0],r=e[t-1];return i=>{if(!Number.isFinite(i))return``;if(i<=n.v)return rv(n.rgb);if(i>=r.v)return rv(r.rgb);let a=1;for(;a<t;){let t=e[a];if(i<t.v)break;if(i!==t.v)a++;else{if(!t.exclusive)break;a++}}if(a<=0)return rv(n.rgb);if(a>=e.length)return rv(r.rgb);let o=e[a-1],s=e[a],c=s.v-o.v;if(c===0)return rv((s.exclusive?o:s).rgb);let l=(i-o.v)/c;return rv(function(e,t,n){return n=nv(n),[Math.round(tv(e[0],t[0],n)),Math.round(tv(e[1],t[1],n)),Math.round(tv(e[2],t[2],n))]}(o.rgb,s.rgb,l))}}var av,ov,sv=class{constructor(e,t,n){this._add=e,this._get=t,this._createItem=n}add(t,n){if(!t)throw Error(e._(`error.address.noAddress`));return this._add(t,n)}*[Symbol.iterator](){yield*this.getItems()}getItems(e){let t;return e?.address&&(t=e.address),this._get(t,e?.ignoreHidden,e?.fullyContained)}createItem(e){return this._createItem(e)}getCount(){return this._get(null,!1,!1).length}};(X_||={}).AlertStyle={Stop:`stop`,Warning:`warning`,Information:`information`};var cv,lv,uv=class extends q_{constructor(...e){super(...e),this._results=null,this._evalGeneration=0}_getType(){return`DataValidation`}_getActionDescription(t){return e.v(t===`delete`?`op.deleteDataValidation`:t===`initialize`?`op.initializeDataValidation`:`op.updateDataValidationListener`)}_getDefaultState(e){return{...dv}}_processValueUpdates(e=null){let t=this._getState();if(!t)return;let r=t.condition,i=++this._evalGeneration;if(!r)return void(this._results&&this._results.getCount()>0&&(this._results=null,this._options.invalidate?.(this.getRange().getCoords())));let a=this._options;(async()=>{let e=this._getValueGrid(),t=e.getAxis()===n.l.Axis.Column,r=new ri.Builder;if(await this._evalConditionRanges({onFalse:e=>{let n=t?e.colIndex:e.rowIndex,i=t?e.rowIndex:e.colIndex;r.pushAt(n,i,!0)}}),i!==this._evalGeneration)return;let o=r.build(),s=(this._results?.getCount()??0)>0;if(!o&&!s)return;let c=new Ya({axis:e.getAxis()});o&&c.setValues(o.tuples),this._results=c;let l=this.getRanges(),u=l.getCount();for(let e=0;e<u;e++){let t=l.at(e).getCoords();t&&a.invalidate?.(t)}})().catch(()=>{})}getAlertAt(e,t){return this._results?.getValueAt(e,t)??!1}getAlertEntries(e){let t=this._results;return t||=this._results=new Ya({axis:this._getValueGrid().getAxis()}),t.entries(e)}getAlertCount(){return this._results?.getCount()??0}setHideDropdown(t,n){return this._updateState({hideDropdown:t??!1},{description:e.v(`op.setHideDropdown`),...n},[`onConfigChange`])}isHideDropdown(){return this._getState().hideDropdown}setPromptMessage(t,n){return this._updateState({prompt:t??``},{description:e.v(`op.setPromptMessage`),...n},[`onConfigChange`])}getPromptMessage(){return this._getState().prompt}setPromptTitle(t,n){return this._updateState({promptTitle:t??``},{description:e.v(`op.setPromptTitle`),...n},[`onConfigChange`])}getPromptTitle(){return this._getState().promptTitle}setShowPromptMessage(t,n){return this._updateState({showPromptMessage:t??!1},{description:e.v(`op.setShowPromptMessage`),...n},[`onConfigChange`])}isShowPromptMessage(){return this._getState().showPromptMessage}setAlertMessage(t,n){return this._updateState({alert:t??``},{description:e.v(`op.setAlertMessage`),...n},[`onConfigChange`])}getAlertMessage(){return this._getState().alert}setAlertTitle(t,n){return this._updateState({alertTitle:t??``},{description:e.v(`op.setAlertTitle`),...n},[`onConfigChange`])}getAlertTitle(){return this._getState().alertTitle}setShowAlertMessage(t,n){return this._updateState({showAlertMessage:t??!1},{description:e.v(`op.setShowErrorMessage`),...n},[`onConfigChange`])}isShowAlertMessage(){return this._getState().showAlertMessage}setAlertStyle(t,n){return this._updateState({alertStyle:t??dv.alertStyle},{description:e.v(`op.setAlertStyle`),...n},[`onConfigChange`])}getAlertStyle(){return this._getState().alertStyle}setIncludeBlanks(t,n){let r=this._getState().condition;return r?this._updateState({condition:Fg.fromJSON({...r.toJSON(),includeBlanks:t??!1})},{description:e.v(`op.setIncludeBlanks`),...n},[`onConfigChange`]):this}isIncludeBlanks(){return this._getState().condition?.isIncludeBlanks()??!1}getRenderHints(){return this._getState().condition?.getSelector()?.getRenderHints?.()??e.A.EmptyArray}update(t,n){let r=t&&`isIDataValidation`in t?t.toJSON()??{}:{...t};return this.doBatch(()=>{this._fromJSON(r),this._markValueUpdates(),this._notify([`onAnyChange`])},{description:e.v(`op.updateDataValidation`),...n}),this}getSnapshot(t){let n={...this.toJSON()},r=JSON.stringify(this.toJSON()),i=this.getFirstAnchorCoords(),a=e._(`name.dataValidation`),o=this,s=Object.freeze({...t});return{async copyTo(t,i){let a=t.ranges??[t.range];if(!t.extend||!o._extendPastedRanges(a,r)){let e=t.validations.add(a,{...n});t.index!==void 0&&e.setIndex(t.index)}return e.l.unionRangesArrays(a)},getCoords:()=>i,getSource:()=>o,getName:()=>a,getMarkOptions:()=>s,isISnapshot:!0}}addListeners(e,t){return this._getEmitter().addListeners(e,t)}toJSON(){let e={},t=this._getState();if(!t)return null;if(t.prompt&&(e.prompt=t.prompt),t.promptTitle&&(e.promptTitle=t.promptTitle),t.showPromptMessage&&(e.showPromptMessage=t.showPromptMessage),t.alert&&(e.alert=t.alert),t.alertTitle&&(e.alertTitle=t.alertTitle),t.showAlertMessage&&(e.showAlertMessage=t.showAlertMessage),t.alertStyle&&t.alertStyle!==dv.alertStyle&&(e.alertStyle=t.alertStyle),t.hideDropdown&&(e.hideDropdown=t.hideDropdown),t.imeMode&&(e.imeMode=t.imeMode),t.ext&&(e.ext=t.ext),t.condition){let n=t.condition.toJSON();n&&(e.condition=n)}return e}_fromJSON(t,n){let r=t??{},i={...this._getState()};r.prompt!==void 0&&(i.prompt=r.prompt),r.promptTitle!==void 0&&(i.promptTitle=r.promptTitle),r.showPromptMessage!==void 0&&(i.showPromptMessage=r.showPromptMessage),r.alert!==void 0&&(i.alert=r.alert),r.alertTitle!==void 0&&(i.alertTitle=r.alertTitle),r.showAlertMessage!==void 0&&(i.showAlertMessage=r.showAlertMessage),r.alertStyle!==void 0&&(i.alertStyle=r.alertStyle),r.hideDropdown!==void 0&&(i.hideDropdown=r.hideDropdown),r.imeMode!==void 0&&(i.imeMode=r.imeMode),r.ext!==void 0&&(i.ext=r.ext);let a=r.condition;i.condition=a===void 0?null:Fg.fromJSON(a),this._updateState(i,{description:e.v(`op.addDataValidation`),...n})}get isIDataValidation(){return!0}},dv=Object.freeze({condition:null,removeListener:null,alertStyle:X_.AlertStyle.Information,hideDropdown:!1,imeMode:null,ext:null,prompt:``,promptTitle:``,showPromptMessage:!1,alert:``,alertTitle:``,showAlertMessage:!1}),fv=class{constructor(e,t,n){this._add=e,this._get=t,this._createItem=n}add(t,n){if(!t)throw Error(e._(`error.address.invalidRange`));return this._add(t,n)}*[Symbol.iterator](){yield*this.getItems()}getItems(e){let t;return e?.address&&(t=e.address),this._get(t,e?.ignoreHidden,e?.fullyContained)}getCount(){return this._get(null,!1,!1).length}createItem(e){return this._createItem(e)}},pv=class extends Lg{constructor(...e){super(...e),this._sessionUnlocked=!1}_initialize(t){super._initialize(t),this._updateState({...mv},e.v(`op.initializeProtectedRange`)),this._fromJSON(t?.json);let n=this._getState().name;n&&this._options.setContainerName?.(n)}_getActionDescription(t){return t===`delete`?e.v(`op.deleteProtectedRange`):t===`initialize`?e.v(`op.initializeProtectedRange`):null}_isAnchorAbsolute(){return!0}_processContainerShift(e){let t=super._processContainerShift(e);return e.after||this._getState().anchorCoords||this._delete(),this._processAnchorCoords(),t}getName(){return this._getState().name}setName(t,n){if(!t)throw new e.s(e._(`error.protectedRange.noName`));if(t===this._getState().name)return this;let r=n?.description??e.v(`op.setProtectedRangeName`);return this.doBatch(()=>{this._options.setContainerName?.(t,{...n,description:r}),this._updateState({name:t},{...n,description:r},[`onConfigChange`])},{...n,description:r}),this}getIndex(){return this._options?.getContainerIndex?.()??-1}setIndex(e){return this._options?.setContainerIndex?.(e),this}setRanges(e,t){return this._setAnchorRanges(e,t)}getSecurityDescriptor(){return this._getState().securityDescriptor}setSecurityDescriptor(t,n){return this._updateState({securityDescriptor:t||null},{description:e.v(`op.setProtectedRangePermissions`),...n},[`onConfigChange`])}hasPassword(){return this._getState().password!==null}getEncryptedPassword(){return this._getState().password}async setPassword(t,n){let r=null;if(t){let e=n?.algorithm,i=n?.spinCount,a=await Eh.generateSaltAndHash(t,e,i);r={salt:a.salt,hash:a.hash},e&&(r.algorithm=e),i&&(r.spinCount=i)}return this.relock(),this._updateState({password:r},{description:e.v(`op.setProtectedRangePassword`),...n},[`onConfigChange`])}isUnlocked(){return!this.hasPassword()||this._sessionUnlocked}async unlock(e){return!this.hasPassword()||!!await this.checkPassword(e)&&(this._sessionUnlocked||(this._sessionUnlocked=!0,this._notify([`onUnlockChange`])),!0)}relock(){return this._sessionUnlocked&&(this._sessionUnlocked=!1,this._notify([`onUnlockChange`])),this}async checkPassword(e){let t=this._getState().password;return!t||!t.hash||!!e&&Eh.verifyPassword(e,{salt:t.salt,hash:t.hash},t.algorithm,t.spinCount)}update(t,n){let r=t&&`isIProtectedRange`in t?t.toJSON()??{}:{...t};return this.doBatch(()=>{let e=r.name;e!==void 0&&e!==this._getState().name&&this.setName(e,n),this._fromJSON({...r,name:void 0},n),this._notify([`onConfigChange`])},{description:e.v(`op.updateProtectedRange`),...n}),this}addListeners(e,t){return this._getEmitter().addListeners(e,t)}toJSON(){let e=this._getState();if(!e)return null;let t={};return e.name&&(t.name=e.name),e.securityDescriptor&&(t.securityDescriptor=e.securityDescriptor),e.password&&(t.password={...e.password}),t}_fromJSON(t,n){let r=t??{},i={};r.name!==void 0&&(i.name=r.name),r.securityDescriptor!==void 0&&(i.securityDescriptor=r.securityDescriptor||null),r.password!==void 0&&(i.password=r.password??null),Object.keys(i).length!==0&&this._updateState(i,{description:e.v(`op.addProtectedRange`),...n})}get[Symbol.toStringTag](){return`[ProtectedRange]`}toString(){return`ProtectedRange:${this.getName()}:${this.getRanges()?.toString()}`}get isIProtectedRange(){return!0}},mv=Object.freeze({name:``,securityDescriptor:null,password:null}),hv=class{constructor(e,t,n,r){this._add=e,this._get=t,this._getByName=n,this._createItem=r}add(t,n){if(!t)throw Error(e._(`error.address.noAddress`));return this._add(t,n)}*[Symbol.iterator](){yield*this.getItems()}getItems(e){if(e?.name){let t=this._getByName(e.name);return t?[t]:[]}let t;return e?.address&&(t=e.address),this._get(t,e?.ignoreHidden,e?.fullyContained)}createItem(e){return this._createItem(e)}getCount(){return this._get(null,!1,!1).length}};(ov=av||={}).HeaderTextStyle={A1:`a1`,Zero:`zero`,One:`one`},ov.ColumnHeaderTableNames={Sticky:`sticky`,Hidden:`hidden`,None:`none`};var gv=(t=e.v(`op.update`))=>e._(`error.sheet.protectedField`,{description:e._(t)}),_v=t=>e._(`error.sheet.itemOverlapping`,{type:t}),vv=t=>e._(`error.sheet.maxValues`,{max:t}),yv=Object.freeze([Jg.Feature.Contentful]),bv=e=>e===void 0?yv:Object.freeze([...typeof e==`string`?[e]:e]),xv=class{constructor(e,t,n,r){this._range=null,this._clipped=null,this._coords=Object.freeze(e),this._internal=t,this._features=n,this._bounds=r}getFeatures(){return this._features}getCoords(){return this._coords}getAddress(e){let t=this._internal;return Sl(this._coords,t.getSheet().getEntireCoords(),void 0)}getRowCount(){let e=this._coords;return e.rowEnd-e.rowStart+1}getColumnCount(){let e=this._coords;return e.colEnd-e.colStart+1}isClipped(){let e=this._clipped;return e===null&&(e=this._probeClipped(),this._clipped=e),e}_probeClipped(){let e=this._coords,t=this._bounds,n=this._internal.getSheet().getEntireCoords(),r=e=>{let t=new Tv(e,this._internal).getCounts(this._features),n=this._features;for(let e=0;e<n.length;e++)if((t[n[e]]??0)>0)return!0;return!1};return!!(e.rowStart===t.rowStart&&t.rowStart>n.rowStart&&r({rowStart:t.rowStart-1,rowEnd:t.rowStart-1,colStart:e.colStart,colEnd:e.colEnd})||e.rowEnd===t.rowEnd&&t.rowEnd<n.rowEnd&&r({rowStart:t.rowEnd+1,rowEnd:t.rowEnd+1,colStart:e.colStart,colEnd:e.colEnd})||e.colStart===t.colStart&&t.colStart>n.colStart&&r({rowStart:e.rowStart,rowEnd:e.rowEnd,colStart:t.colStart-1,colEnd:t.colStart-1})||e.colEnd===t.colEnd&&t.colEnd<n.colEnd&&r({rowStart:e.rowStart,rowEnd:e.rowEnd,colStart:t.colEnd+1,colEnd:t.colEnd+1}))}getCell(){return this.getRange().getCell()}getRange(){let e=this._range;return e||(e=new Tv(this._coords,this._internal),this._range=e),e}toString(){return this.getAddress()}get[Symbol.toStringTag](){return`[CellRegion: ${this.getAddress()}]`}get isICellRegion(){return!0}},Sv=class{constructor(e,t,n,r){this._regions=null,this._range=null,this._bounds=e,this._internal=t,this._features=n,this._options=r}getFeatures(){return this._features}getRange(){let e=this._range;return e||(e=new Tv(this._bounds,this._internal),this._range=e),e}getCount(){return this._materialize().length}*[Symbol.iterator](){yield*this._materialize()}_materialize(){let e=this._regions;if(!e){let t=this._internal,n=t.featureRegions(this._bounds,this._features,this._options),r=n.length;e=Array(r);for(let i=0;i<r;i++)e[i]=new xv(n[i],t,this._features,this._bounds);this._regions=e}return e}get[Symbol.toStringTag](){return`[CellRegions: ${this._features.join(`, `)}]`}get isICellRegions(){return!0}},Cv=Object.freeze([]),wv=Object.freeze({transactional:!1}),Tv=class t{constructor(e,t,n){this._coords=Object.freeze(e),this._internal=t,this._readOnly=n?.readOnly??null,this._options=n??void 0}_getStickyOptions(){return this._options?.getOptions}getCoords(){return this._coords}_createRange(e,n){let r=this._internal;if(!e)return wT(r.getSheet(),r.getSheet().getEntireCoords());if(e=this._scopeDerived(e),r.validateCoords(e),r.getSheet().isClosed())return wT(null,r.getSheet().getEntireCoords(),e);let i=this._options;return n&&(i={...this._options,getOptions:zT(this._options?.getOptions,n)}),new t(e,this._internal,i)}_scopeDerived(e){let t=this._coords.scope;return t&&e&&!e.scope?{...e,scope:t}:e}_createRanges(e,t){let n=this._options;return t&&(n={...this._options,getOptions:zT(this._options?.getOptions,t)}),new eT(this._coords.scope?e?.map(e=>this._scopeDerived(e)):e,this._internal,n)}_deriveRanges(e,t){let n=this.getCoords(),r=n;return t&&(r=t(n),!r)?null:this._createRanges(r,e)}_deriveRange(e,t,n){if(!e)return this;let r=this._internal.rangeToCoords(e);if(!r)return this;let i=this.getCoords();if(FT(r,i))return this;if(n){let e=n(r,i);if(!e)return null;r={...i,...e}}return function(e,t){t&&(t.$colStart===void 0?delete e.$colStart:e.$colStart=t.$colStart,t.$rowStart===void 0?delete e.$rowStart:e.$rowStart=t.$rowStart,t.$colEnd===void 0?delete e.$colEnd:e.$colEnd=t.$colEnd,t.$rowEnd===void 0?delete e.$rowEnd:e.$rowEnd=t.$rowEnd)}(r,i),this._createRange(r,zT(this._options?.getOptions,t))}_validateMaxSize(t=5e4){let n=this.getCoords(),r=this._internal,i=r.getUsedCoords(),a=Math.min(n.colEnd,i?.colEnd??n.colEnd),o=Math.min(n.rowEnd,i?.rowEnd??n.rowEnd),s=1;a>=n.colStart&&(s=r.getSheet().getColumnHeaders().getVisibleCount(n.colStart,a));let c=1;if(o>=n.rowStart&&(c=r.getSheet().getRowHeaders().getVisibleCount(n.rowStart,o)),c*s>t)throw new e.s(vv(t))}entries(t){let n=this.getCoords(),r=n,i=this._internal;if(t?.address){let a=i.rangeToCoords(t?.address);if(!a)throw new e.s(Ah(t?.address));if(r=e.l.intersectRanges(a,n),!r)return ti}r.colEnd<r.colStart&&(r.colStart=n.colStart,r.colEnd=n.colEnd),r.rowEnd<r.rowStart&&(r.rowStart=n.rowStart,r.rowEnd=n.rowEnd);let a=this._getStickyOptions();return i.cellIterator({ignoreHidden:a?.ignoreHidden??!1,...t,searchTypes:Jd(t?.features??a?.features),bounds:r})}[Symbol.iterator](){return this.values()}values(e){let t=this.entries({...e,features:Cv});return{next(){let e=t.next();return e.done?ei:{done:!1,value:e.value.value}},[Symbol.iterator](){return this}}}forEach(e,t){if(!e)return;let n=this.entries(t),r=n.next();for(;!r.done;){let t=r.value,i=e(t.value,t.context);if(i)return i.break;r=n.next()}}_validateWrite(){let t=this._readOnly;if(t)throw new e.s(e._(t))}updateCells(t,r,i){this._validateWrite();let a=this.getCoords();i||=a;let o=this._internal,s=o.isDataColumn(),c={majorStart:s?a.colStart:a.rowStart,majorEnd:s?a.colEnd:a.rowEnd,minorStart:s?a.rowStart:a.colStart,minorEnd:s?a.rowEnd:a.colEnd},l=(r?.axis??n.l.Axis.Row)===n.l.Axis.Column!==s,u=Ua(Array.isArray(t)?t:[[t]],l,c);return o.updateTuples(u,{description:r?.description??(e.l.isSingleCell(i)?e._(`op.setCellAddress`,{address:Sl(i,o.getSheet().getEntireCoords())}):e._(`op.setRangeAddress`,{address:Sl(i,o.getSheet().getEntireCoords())})),...r},null,{isCell:!0}),this}setValues(t,n){if(!t||!Array.isArray(t)&&!t.isIRange)throw new e.s(e._(`error.sheet.setValuesType`));return this._setValueOrValues(t,n)}setValue(t,n){if(t&&(Array.isArray(t)||t.isIRange))throw new e.s(e._(`error.sheet.setValueType`));return this._setValueOrValues(t,n)}setFormula(t,n){if(t&&(Array.isArray(t)||t.isIRange))throw new e.s(e._(`error.sheet.setValueType`));return this._setValueOrValues(t,n)}_setValueOrValues(t,r){this._validateWrite();let i=this.getCoords(),a=this,o=this._internal,s=o.isDataColumn(),c=(r?.axis??n.l.Axis.Row)===n.l.Axis.Column,l=Array.isArray(t),u=!l&&t?.isIRange;if(r?.skipBoundsCheck??e.l.isSingleCell(i)){let n=c?i.colStart:i.rowStart,r=c?i.rowStart:i.colStart,o=0,s=0;if(l){let e=t;o=Math.max(0,e.length-1),s=0;for(let t=0;t<e.length;t++)s=Math.max(s,e[t].length-1)}else if(u){let e=t.getColumnCount(),n=t.getRowCount();o=c?e-1:n-1,s=c?n-1:e-1}let d={...i,colEnd:c?n+o:r+s,rowEnd:c?r+s:n+o};e.l.isEqualRanges(d,i)||(i=d,a=this._deriveRange(d)??this)}let d=s?i.colStart:i.rowStart,f=s?i.colEnd:i.rowEnd,p=s?i.rowStart:i.colStart,m={majorStart:d,majorEnd:f,minorStart:p,minorEnd:s?i.rowEnd:i.colEnd},h=null;if(l){let e=c!==s;h=Ua(Array.isArray(t)?t:[[t]],e,m)}else if(u){let r=t,a=r._values;if(a&&a.getValues&&a.getAxis&&a.getAxis()===(s?n.l.Axis.Column:n.l.Axis.Row)){let e=r._coords;if(h=a.getValues(e),h){let e=h.bounds;h=function(e,t,n){let r=e.tuples,i=e.bounds,a=t,o=n,s=[];for(let e of r){let t=e[0]+a,n=e[1],r=[];for(let e of n){let t=e[0]+o;r.push([t,e[1]])}s.push([t,r])}return{tuples:s,bounds:{majorStart:i.majorStart+a,minorStart:i.minorStart+o,majorEnd:i.majorEnd+a,minorEnd:i.minorEnd+o}}}(h,d-e.majorStart,p-e.minorStart)}}else{let t=s?n.l.Axis.Column:n.l.Axis.Row;h=function(t,n,r,i=null){let a=n!==e.N.Row,o=i?.colIndex??0,s=i?.rowIndex??0,c=a?o:s,l=a?s:o,u=t.next();for(;!u.done;){let e=u.value,n=e.coords,i=a?n.colIndex:n.rowIndex,o=a?n.rowIndex:n.colIndex;r.pushAt(c+i,l+o,e.value),u=t.next()}return r.build()}(r.entries({axis:t}),t,o.createTupleBuilder(),{colIndex:i.colStart,rowIndex:i.rowStart})}}else h=Ha(t,m,s);return o.updateTuples(h,{description:r?.description??(e.l.isSingleCell(i)?e._(`op.setValueAddress`,{address:Sl(i,o.getSheet().getEntireCoords())}):e._(`op.setValuesAddress`,{address:Sl(i,o.getSheet().getEntireCoords())})),...r}),a}getValues(e){this._validateMaxSize(e?.maxSize);let t=this.getCoords();return PT(this._internal.cellIterator,t,e,!1,!1)}getValuesRange(){let e=this._internal,t=e.getSheet();return new _D(t.getRuntime(),e.getState().cellValuesGrid,this.getCoords(),void 0,t.getEntireCoords.bind(t),t.getName.bind(t))}setComputedValues(t,n){let r=this;return r._internal.getSheet().doBatch(()=>{let e=t(r.getValuesRange());r.setValues(e)},{description:e.v(`op.setComputedValues`),...n}),this}getInteropValues(e){this._validateMaxSize(e?.maxSize);let t=this.getCoords();return PT(this._internal.cellIterator,t,e,!1,!0)}getValue(){let e=this.getCoords();return this._internal.getScalar(e.rowStart,e.colStart,!1)}getInteropValue(){let e=this.getCoords();return this._internal.getScalar(e.rowStart,e.colStart,!0)}calculate(e){return this._internal.calculate([this.getCoords()],{full:e}),this}getCells(e){this._validateMaxSize(e?.maxSize);let t=this.getCoords();return PT(this._internal.cellIterator,t,e,!0,!1)}getCell(t){let n=this.getCoords(),r=n.colStart,i=n.rowStart,a=this._internal;if(t){let o=a.cellToCoords(t);if(!e.l.isCellWithinRange(o,n))throw new e.s(e._(`error.sheet.oobCell`));r=o.colIndex,i=o.rowIndex}return a.getCellAt(i,r)}getFormula(e){return this.getCell(e).getFormula()}createFormula(e){let t=this.getCoords();return this.getSheet().createFormula(e,{rowIndex:t.rowStart,colIndex:t.colStart})}addWatch(e,t){return this._addWatch(e,{onValues:t})}_addWatch(e,t,n){let r=this.getCoords(),i=this.getSheet().getCalculation();if(!n&&typeof e!=`string`){let t=e.getAnchor();if(t&&(t.rowIndex!==r.rowStart||t.colIndex!==r.colStart))throw Error(`ICellRange.addWatch was given a formula anchored outside the range; fill it with IFormula.shift first.`)}let a=!1,o=null,s=0,c=async e=>{let n=t.onValues;if(!n)return void(a||t.onChange?.());let i=++s,o=await e.evaluate({block:r,alwaysReturnRange:!0});a||i!==s||n(o)};return(async()=>{if(await i.ready(),a)return;let s=n??{rowIndex:r.rowStart,colIndex:r.colStart},l=typeof e==`string`?this.getSheet().createFormula(e,s):e;if(l.getAnchor()?.rowIndex===r.rowStart&&l.getAnchor()?.colIndex===r.colStart||(l=l.shift({rowIndex:r.rowStart,colIndex:r.colStart})??l),a)return;let u=l.getReferences()?.getCoords()??[],d=r.rowEnd!==r.rowStart||r.colEnd!==r.colStart?l.shift({rowIndex:r.rowEnd,colIndex:r.colEnd})?.getReferences()?.getCoords()??[]:[],f=[];for(let e=0;e<u.length;e++){let t=u[e];if(!t)continue;let n=d[e]??t;f.push({rowStart:Math.min(t.rowStart,n.rowStart),rowEnd:Math.max(t.rowEnd,n.rowEnd),colStart:Math.min(t.colStart,n.colStart),colEnd:Math.max(t.colEnd,n.colEnd),scope:t.scope})}o=f.length>0?this.getSheet().getRanges(f).addListener(()=>{c(l)},wv):null,a?o?.():t.onValues&&await c(l)})(),()=>{a=!0,o?.()}}async select(e){let t=await this._internal.autoSelect(e??!0,I_([this.getCoords()]));return this._createRange(t[0])}find(e){return this._internal.find([this.getCoords()],e)}getFixed(e){return this._createRange(IT(this.getCoords(),e))}getRangeAt(e,t,n,r,i){return this._createRange({rowStart:e,colStart:t,rowEnd:n??e,colEnd:r??t},i)}getRowAt(e,t){let n=this.getCoords();return this._createRange({colStart:n.colStart,rowStart:e,colEnd:n.colEnd,rowEnd:e},t)}getRowAfter(e){let t=this.getCoords();if(!t)return this;let n=t.rowEnd;return this._createRange({colStart:t.colStart,rowStart:n+1,colEnd:t.colEnd,rowEnd:n+1},e)}getRowBefore(e){let t=this.getCoords();if(!t)return this;let n=t.rowStart;return this._createRange({colStart:t.colStart,rowStart:n-1,colEnd:t.colEnd,rowEnd:n-1},e)}getRowBy(e,t){let n=this.getCoords(),r=n.rowStart+e;return this._createRange({colStart:n.colStart,rowStart:r,colEnd:n.colEnd,rowEnd:r},t)}getColumnAt(e,t){let n=this.getCoords();return this._createRange({colStart:e,rowStart:n.rowStart,colEnd:e,rowEnd:n.rowEnd},t)}getColumnAfter(e){let t=this.getCoords();if(!t)return this;let n=t.colEnd;return this._createRange({colStart:n+1,rowStart:t.rowStart,colEnd:n+1,rowEnd:t.rowEnd},e)}getColumnBefore(e){let t=this.getCoords();if(!t)return this;let n=t.colStart;return this._createRange({colStart:n-1,rowStart:t.rowStart,colEnd:n-1,rowEnd:t.rowEnd},e)}getColumnBy(e,t){let n=this.getCoords(),r=n.colStart+e;return this._createRange({colStart:r,rowStart:n.rowStart,colEnd:r,rowEnd:n.rowEnd},t)}getTopLeft(e){let t=this.getCoords();if(!t)return this;let n=t.colStart,r=t.rowStart;return this._createRange({colStart:n,rowStart:r,colEnd:n,rowEnd:r},e)}getBottomRight(e){let t=this.getCoords();if(!t)return this;let n=t.colEnd,r=t.rowEnd;return this._createRange({colStart:n,rowStart:r,colEnd:n,rowEnd:r},e)}getSurrounding(e){let t=this._internal;return this._createRange(t.surroundingRegion(this.getCoords(),e))}getExtended(t,r){let i=null,a=this.getCoords();switch(t){case n.l.Direction.Up:i={colIndex:a.colStart,rowIndex:a.rowStart};break;case n.l.Direction.Down:i={colIndex:a.colStart,rowIndex:a.rowEnd};break;case n.l.Direction.Left:i={colIndex:a.colStart,rowIndex:a.rowStart};break;case n.l.Direction.Right:i={colIndex:a.colEnd,rowIndex:a.rowStart}}let o=this._internal,s=r?o.cellToCoords(r):i;if(!e.l.isCellWithinRange(s,a))throw new e.s(e._(`error.address.invalidCell`));let c=o.extendRange(t,s);return c=e.l.unionRanges(a,c),this._createRange(c)}getEntireRows(e,t){let r=this._internal;return this._createRange(_T([this.getCoords()],r.getSheet().getEntireCoords(),n.l.Axis.Column,e)[0],t)}getEntireColumns(e,t){let r=this._internal;return this._createRange(_T([this.getCoords()],r.getSheet().getEntireCoords(),n.l.Axis.Row,e)[0],t)}getRowHeaders(e){let t=this.getCoords();return this._internal.getSheet().getRowHeaders().getRange(t,e)}getColumnHeaders(e){let t=this.getCoords();return this._internal.getSheet().getColumnHeaders().getRange(t,e)}getDifferences(e,t){return this._deriveRanges(t,r=>{let i=this._internal,a=E_(r,i.rangeToCoords(e),n.l.Axis.Row);return i.getVisible(a,t)})}getIntersect(t,n){return this._deriveRange(t,n,(t,n)=>e.l.intersectRanges(t,n))}getUnion(t,n){return this._deriveRange(t,n,(t,n)=>e.l.unionRanges(t,n))}getResizeTo(t,n,r){if(n??=0,(t??=0)<0||n<0)throw new e.s(e._(`error.address.invalidRange`));let i=this.getCoords();return this._deriveRange({colStart:i.colStart,rowStart:i.rowStart,colEnd:n+i.colStart-1,rowEnd:t+i.rowStart-1},r)}getResizeBy(e,t,n){e??=0,t??=0;let r=this.getCoords();return this._deriveRange({colStart:r.colStart,rowStart:r.rowStart,colEnd:r.colEnd+t,rowEnd:r.rowEnd+e},n)}getOffsetTo(e,t,n){let r=this.getCoords(),i=t,a=e,o={colStart:i,rowStart:a,colEnd:r.colEnd-r.colStart+i,rowEnd:r.rowEnd-r.rowStart+a};return this._deriveRange(o,n)}getOffsetBy(e,t,n){let r=this.getCoords(),i=r.colStart+t,a=r.rowStart+e,o={colStart:i,rowStart:a,colEnd:r.colEnd-r.colStart+i,rowEnd:r.rowEnd-r.rowStart+a};return this._deriveRange(o,n)}getUsedRange(t){let n=this._internal.getUsedCoords(zT(this._getStickyOptions(),t));if(!n)return null;let r=e.l.intersectRanges(n,this.getCoords());return r?this._deriveRange(r,t):null}isEmpty(){let t=this._internal.getUsedCoords();return!t||!e.l.intersectRanges(t,this.getCoords())}getColumnStart(){return this.getCoords().colStart}getRowStart(){return this.getCoords().rowStart}getColumnEnd(){return this.getCoords().colEnd}getRowEnd(){return this.getCoords().rowEnd}getColumnCount(){let e=this.getCoords();return e.colEnd-e.colStart+1}getRowCount(){let e=this.getCoords();return e.rowEnd-e.rowStart+1}getVisible(e){return this._deriveRanges(e,t=>this._internal.getVisible([t],e))}isContentful(e){let t=this._internal,n=this._getStickyOptions(),r=e??n?.features;if(r===void 0)return t.isContentful([this.getCoords()],n?.ignoreHidden??!1);let i=t.featureCounts([this.getCoords()],r,n?.ignoreHidden??!1),a=typeof r==`string`?[r]:r;for(let e=0;e<a.length;e++)if(i[a[e]]>0)return!0;return!1}getStats(e){return this._internal.getRangeStats([this.getCoords()],e)}getCounts(e){let t=this._internal,n=this._getStickyOptions();return t.featureCounts([this.getCoords()],e??n?.features,n?.ignoreHidden??!1)}getDirectPrecedents(){return this._internal.dependencyRanges(this.getCoords(),`precedents`,!0)}getDirectDependents(){return this._internal.dependencyRanges(this.getCoords(),`dependents`,!0)}getPrecedents(){return this._internal.dependencyRanges(this.getCoords(),`precedents`,!1)}getDependents(){return this._internal.dependencyRanges(this.getCoords(),`dependents`,!1)}getRegions(e,t){let n=this._getStickyOptions(),r=bv(e??t?.features??n?.features);return new Sv(this.getCoords(),this._internal,r,{...t,ignoreHidden:t?.ignoreHidden??n?.ignoreHidden??!1})}getCount(e){let t=this._internal,n=e??qg.Content.Values,r=t.contentCounts([this.getCoords()],[n],this._getStickyOptions()?.ignoreHidden??!1);return r?r[n]??0:0}isEntireRows(){let e=this._internal;return vT([this.getCoords()],e.getSheet().getEntireCoords(),!0)}isEntireColumns(){let e=this._internal;return yT([this.getCoords()],e.getSheet().getEntireCoords(),!0)}isEntireRange(){let e=this.getCoords(),t=this._internal;return yT([e],t.getSheet().getEntireCoords(),!0)&&vT([e],t.getSheet().getEntireCoords(),!0)}isSingleCell(){let t=this.getCoords();return e.l.isSingleCell(t)}isEqual(e,t){let n=this._internal.rangeToCoords(e);return FT(this.getCoords(),n)}get size(){let e=this._coords;return e.colEnd-e.colStart+1*(e.rowEnd-e.rowStart+1)}getBounds(){return this._internal.getBoundsAtCoords(this.getCoords())}isInvalid(){return!1}getDefaultShiftAxis(){return this._internal.getDefaultShiftAxis(this.getCoords())}getDefaultSortCriteria(e,t){return this._internal.getDefaultSortCriteria(this.getCoords(),e,t)}getMerges(){return this._internal.getMerges([this.getCoords()],this._getStickyOptions()?.ignoreHidden??!1)}_itemQuery(e){return{ignoreHidden:!!this._getStickyOptions()?.ignoreHidden,...e,address:this.getCoords()}}getConditionalFormats(e){return this._internal.getSheet().getConditionalFormats().getItems(this._itemQuery(e))}getDataValidations(e){return this._internal.getSheet().getDataValidations().getItems(this._itemQuery(e))}getTables(e){return this._internal.getSheet().getTables().getItems(this._itemQuery(e))}getMovables(e){return this._internal.getSheet().getMovables().getItems(this._itemQuery(e))}getSnapshot(e){return this._internal.getSnapshot([this.getCoords()],e)}isReadOnly(){return this._readOnly!==null}addListener2(e,t){return this._internal.addRangesListeners2([this.getCoords()],e,t,!1)}addListener(e,t){return this._internal.addRangesListeners([this.getCoords()],e,t)}getSheet(){return this._internal.getSheet()}autoFill(e,t){t?.preview||this._validateWrite();let n=this._internal,r=n.rangeToCoords(e,()=>[],!0);t?.snap&&(r=n.autoFillRange(this.getCoords(),r));let i=n.autoFill(this.getCoords(),r,t);return t?.preview?new Ev(r,n,i,this._getStickyOptions()):i?this._createRange(r):this}autoFit(e){return this._validateWrite(),this._internal.autoFit([this.getCoords()],e),this}clear(e,t){return this._validateWrite(),this._internal.clear([this.getCoords()],e,t),this}setHyperlink(e,t){return this._validateWrite(),this._internal.setHyperlinks([this.getCoords()],e,t),this}setComments(e,t){return this._validateWrite(),this._internal.setComments([this.getCoords()],e,t),this}getStyle(){return this._internal.getStyle([this.getCoords()])}merge(e){return this._validateWrite(),this._internal.merge([this.getCoords()],e),this}unmerge(e){return this._validateWrite(),this._internal.unmerge([this.getCoords()],e),this}textToColumns(t){if(this._validateWrite(),this.getColumnCount()!==1)throw new e.s(e._(`error.address.textToColumnsMulti`));typeof t==`string`&&(t={delimiter:t});let r=function(e,t){let r=t?.textQualifier===void 0?`"`:t.textQualifier,i=t?.preserveEmptyFields??!1,a=t?.delimiter,o=e.sparseBuilder(),s=1,c=e.entries({axis:n.l.Axis.Column,onError:`ignore`}),l=c.next();for(;!l.done;){let e=l.value.value,t=l.value.coords.rowIndex;l=c.next();let n=e,u=typeof e;if(u===`string`)a===void 0&&(a=YT(e,r));else{if(u!==`number`)continue;n=e.toString()}if(a===void 0)continue;let d=XT(n,a,r,i);for(let e=0;e<d.length;e++)d[e]!==null&&o.pushAt(t,e,d[e]);s=Math.max(s,d.length)}return s===1?e:o.build()}(this.getValuesRange(),t),i=r.getColumnCount(),a=this,o=!0;if(t?.destination&&(a=this._deriveRange(t.destination),o=a.getTopLeft().isEqual(this.getTopLeft())),i<=1&&o)return this;if(!t?.replaceExisting){let t=a.getCoords(),n=o?t.colStart+1:t.colStart,s=t.colStart+i-1;if(s>=n&&this.getRangeAt(t.rowStart,n,t.rowStart+r.getRowCount()-1,s).isContentful())throw new e.s(e._(`error.address.textToColumnsOverwrite`))}return a.setValues(r,{description:e.v(`op.textToColumns`),...t,skipBoundsCheck:!0})}removeDuplicates(t){this._validateWrite();let r,i=this.getCoords(),a=this.getColumnCount(),o=this.getRowCount(),s=t?.hasHeader??!1;Array.isArray(t?.columns)&&(r=t.columns.map(t=>{let n=typeof t==`string`?Il(t)-i.colStart:t;if(!(n>=0&&n<a))throw new e.s(e._(`error.address.removeDuplicatesColumn`,{column:t}));return n}));let c=function(e,t,r){let i=r?new Set(r):null,a=new Map,o=new Set,s=[],c=0,l=(e,t)=>{c+=t-e+1;let n=s[s.length-1];n&&n.rowEnd===e-1?n.rowEnd=t:s.push({rowStart:e,rowEnd:t})},u=(e,n)=>{t&&e===0||(o.has(n)?l(e,e):o.add(n))},d=(e,n)=>{t&&e===0&&(e+=1),e<n&&!o.has(``)&&(o.add(``),e+=1),e<n&&l(e,n-1)},f=-1,p=``,m=e.entries({axis:n.l.Axis.Row,includeEmpty:!1}),h=m.next();for(;!h.done;){let{value:e,coords:{rowIndex:n,colIndex:r}}=h.value;n!==f&&(f!==-1&&u(f,p),d(f+1,n),f=n,p=``),t&&n===0||i!==null&&!i.has(r)||(p+=ZT(r,e,a)),h=m.next()}return f!==-1&&u(f,p),{runs:s,count:c,isEmpty:f===-1}}(this.getValuesRange(),s,r);if(c.isEmpty)throw new e.s(e._(`error.address.removeDuplicatesNoData`));let l=this._internal,u=this.getResizeTo(o-c.count,a);if(c.count>0){let r=c.runs.map(e=>({colStart:i.colStart,colEnd:i.colEnd,rowStart:i.rowStart+e.rowStart,rowEnd:i.rowStart+e.rowEnd})),a={colStart:i.colStart,colEnd:i.colEnd,rowStart:i.rowEnd-c.count+1,rowEnd:i.rowEnd},o={description:e.v(`op.removeDuplicates`),...t,autoSelect:!1,viewBefore:{view:l.getSheet().getView(),selection:I_([i]),selectOptions:t?.autoSelect},viewAfter:{view:l.getSheet().getView(),selection:I_([u.getCoords()]),selectOptions:t?.autoSelect}};this.doBatch(()=>{l.deleteCells(r,n.l.Axis.Row),l.insertCells([a],n.l.Axis.Row)},o)}return t?.autoSelect&&l.autoSelect(t.autoSelect,I_([u.getCoords()])),u}insert(e){return this._validateWrite(),typeof e==`object`&&e?.span?(this._spanShift(e,!0),this):(this._internal.insertCells([this.getCoords()],e),this)}_spanShift(t,r){let{span:i,...a}=t,o=this._internal.getSheet(),s=this.getCoords(),c=t.axis??this.getDefaultShiftAxis(),l=null,u=o.getTables().getItems();for(let t=0;t<u.length;t++){let n=u[t].getRange().getCoords();if(!(s.rowEnd<n.rowStart||s.rowStart>n.rowEnd||s.colEnd<n.colStart||s.colStart>n.colEnd)){if(!(s.rowStart>=n.rowStart&&s.rowEnd<=n.rowEnd&&s.colStart>=n.colStart&&s.colEnd<=n.colEnd))throw new e.s(e._(`error.table.tableSplit`));l=u[t];break}}if(!l){let e=o.getEntireCoords(),t=c===n.l.Axis.Row?{...s,colStart:e.colStart,colEnd:e.colEnd}:{...s,rowStart:e.rowStart,rowEnd:e.rowEnd};r?this._internal.insertCells([t],{...a,axis:c}):this._internal.deleteCells([t],{...a,axis:c});return}if(c===n.l.Axis.Row){let t=l.getDataRange().getCoords();if(s.rowStart<t.rowStart||s.rowEnd>t.rowEnd)throw new e.s(e._(`error.table.tableBodyRows`));let n=s.rowStart-t.rowStart,i=s.rowEnd-s.rowStart+1;r?l.addRows(n,i,a):l.deleteRowsAt(n,i,a);return}let d=l.getRange().getCoords(),f=s.colStart-d.colStart,p=s.colEnd-s.colStart+1,m=l,h=a.description??e.v(r?p>1?`op.addTableColumns`:`op.addTableColumn`:p>1?`op.deleteTableColumns`:`op.deleteTableColumn`);o.doBatch(()=>{if(r)for(let e=0;e<p;e++)m.addColumn(f);else{let e=[];for(let t=0;t<p;t++){let n=m.getColumnAt(f+t);n&&e.push(n)}for(let t=e.length-1;t>=0;t--)e[t].delete()}},{...a,description:h})}addAutoTable(e){return this._validateWrite(),this._internal.getSheet().addAutoTable(this.getCoords(),e)}addTable(e){return this._validateWrite(),this._internal.getSheet().getTables().add(this.getCoords(),e)}async insertFrom(e,t){this._validateWrite();let n=await this._internal.insertFrom([this.getCoords()],e,t);return n?this._createRange(n):null}async copyFrom(e,t){this._validateWrite();let n=await this._internal.copyFrom(this.getCoords(),e,t);return n?this._createRange(n):null}delete(e){return this._validateWrite(),typeof e==`object`&&e?.span?(this._spanShift(e,!1),this):(this._internal.deleteCells([this.getCoords()],e),this)}sort(t){this._validateWrite();let n=this._internal,r=this.getCoords(),i=n.sort(r,t);return e.l.isEqualRanges(i,r)?this:this._createRange(i)}sortAt(e,t,n,r){return this.sort({sorts:[{index:e,criteria:{reverse:t,sortOn:n}}],...r})}async filter(t,n){this._validateWrite();let r=this._internal,i=this.getCoords(),a=await r.filter(i,t,n);return e.l.isEqualRanges(a,i)?this:this._createRange(a)}doBatch(t,n){return this._internal.getSheet().doBatch(e=>t(e),typeof n==`string`?n:{description:e.v(`op.rangeUpdate`),...n})}createSparseBuilder(e){return this._internal.createSparseBuilder(e,this)}getAddress(e){let t=this._internal;return Cl(this.getCoords(),t.getSheet().getEntireCoords())}toString(){return this.getAddress()}get[Symbol.toStringTag](){return`[SheetRange]`}get isICellRange(){return!0}},Ev=class extends Tv{constructor(t,n,r,i){super(t,n,{getOptions:i??{},readOnly:e.v(`error.sheet.previewRange`)}),this._projection=r}getCell(t){let n=this.getCoords(),r=n.rowStart,i=n.colStart;if(t){let a=this._internal.cellToCoords(t);if(!e.l.isCellWithinRange(a,n))throw new e.s(e._(`error.sheet.oobCell`));r=a.rowIndex,i=a.colIndex}return this._projection.getCellAt(r,i)}getCells(e){return this._validateMaxSize(e?.maxSize),this._projectRows(e=>e)}getValues(e){return this._validateMaxSize(e?.maxSize),this._projectRows(e=>e.getValue())}getInteropValues(e){return this._validateMaxSize(e?.maxSize),this._projectRows(e=>e.getInteropValue())}getValuesRange(){return Dv()}_projectRows(e){let t=this.getCoords(),n=this._projection,r=[];for(let i=t.rowStart;i<=t.rowEnd;i++){let a=[];for(let r=t.colStart;r<=t.colEnd;r++)a.push(e(n.getCellAt(i,r)));r.push(a)}return r}get[Symbol.toStringTag](){return`[PreviewSheetRange]`}},Dv=()=>{throw new e.s(e._(`error.sheet.previewRange`))},Ov=class extends Tv{constructor(e,t,n,r,i,a){super(n,r,i),this.isINamedRange=!0,this._id=e,this._name=t,this._rangesResolver=a??null}getId(){return this._id}getName(){return this._name}getRanges(){return this._rangesResolver?this._rangesResolver():new eT([this._coords],this._internal,this._options)}toString(){return`${this.getName()} => ${this.getAddress()}`}get[Symbol.toStringTag](){return`[NamedRange: ${this._name}]`}},kv=class extends Ov{constructor(e,t,n){super(e.id,e.name,{rowStart:e.rowIndex,colStart:e.colIndex,rowEnd:e.rowIndex,colEnd:e.colIndex},t,n),this._node=e}getRanges(){return this._node.ranges()}getDirectPrecedents(){return this._node.directPrecedents()}getPrecedents(){return this._node.precedents()}getDirectDependents(){return this._node.directDependents()}getDependents(){return this._node.dependents()}get[Symbol.toStringTag](){return`[NamedCellRange: ${this.getName()} @ ${this.getAddress()}]`}};(lv=cv||={}).MAX_EXPRESSION_LENGTH=8192,lv.Status={Ready:`ready`,Error:`error`,Starting:`starting`,Stopping:`stopping`,Off:`off`},lv.CalculationMode={Automatic:`auto`,Manual:`manual`,AutomaticExceptTables:`automaticExceptTables`},lv.ResultStatus={Ready:`ready`,Stale:`stale`,Pending:`pending`,Streaming:`streaming`};var Av={separatorFunction:`,`,separatorColumn:`,`,separatorRow:`;`,separatorDecimal:`.`};function jv(e){return e===`,`?{separatorDecimal:`,`,separatorFunction:`;`,separatorColumn:`;`,separatorRow:`|`}:Av}var Mv=[[`All`,`all`],[`Data`,`data`],[`Headers`,`headers`],[`Totals`,`totals`],[`This Row`,`thisRow`]];function Nv(e,t){let n=e.trim().toUpperCase();for(let[e,r]of Mv)if(e.toUpperCase()===n||t?.[r]?.trim().toUpperCase()===n)return e}var Pv={separators:Av,booleanTrue:`TRUE`,booleanFalse:`FALSE`,errorLiterals:[],errorRefs:[],parseBoolean:e=>{let t=e.toUpperCase();return t===`TRUE`||t!==`FALSE`&&void 0},parseError:e=>n.a.getBuiltInByLabel(e.toUpperCase())??void 0,parseSpecifier:e=>Nv(e),localizeBoolean:e=>e?`TRUE`:`FALSE`,localizeError:e=>e?.getLabel?.()??String(e),localizeSpecifier:e=>e};function Fv(e=Av,t){let n=oo(t),r=n?.booleans?.true??`TRUE`,i=n?.booleans?.false??`FALSE`,a=[],o=[],s=n?.errors;if(s)for(let e in s)(e===`Ref`||e===`Name`?o:a).push(s[e]);let c=n?.specifiers;return{separators:e,booleanTrue:r,booleanFalse:i,errorLiterals:a,errorRefs:o,specifiers:c,parseBoolean:e=>uo(e,t),parseError:e=>fo(e,t),parseSpecifier:e=>Nv(e,c),localizeBoolean:e=>e?r:i,localizeError:e=>lo(e,t),localizeSpecifier:e=>function(e,t){if(!t)return e;let n=e.trim().toUpperCase();for(let[r,i]of Mv)if(r.toUpperCase()===n)return t[i]?.trim()||e;return e}(e,c)}}var $={Unparsed:`unparsed`,Paren:`paren`,Infix:`infix`,Prefix:`prefix`,Postfix:`postfix`,Function:`function`,Call:`call`,Error:`error`,Number:`number`,Boolean:`boolean`,String:`string`,Separator:`separator`,List:`list`,Type:`type`,Array:`array`,Row:`row`,Cell:`cell`,Named:`named`,TableReference:`tableReference`,TableSpecifier:`tableSpecifier`,TableColumn:`tableColumn`,ExternalReference:`externalReference`,Empty:`empty`,Whitespace:`whitespace`};function Iv(e){let t=(e=e.toUpperCase()).length,n=0;for(let r=0;r<t;r++){let i=e.charCodeAt(r);isNaN(i)||(n+=(i-64)*26**(t-r-1))}return n}function Lv(e,t,n){let r=e.match(/([$]?)([A-Za-z]{1,3})([$]?)([1-9][0-9]*)/),i=Iv(r[2])-1,a=r[1].length===1,o=r[4]-1,s=r[3].length===1;return a||i===-(2**53-1)||(i-=n),s||o===-(2**53-1)||(o-=t),{type:$.Cell,value:{colIndex:i,rowIndex:o,$colIndex:a,$rowIndex:s,scope:null},inputs:null,isReference:!0}}function Rv(e){return{type:$.Cell,value:{colIndex:e.colIndex,rowIndex:e.rowIndex,$colIndex:e.$colIndex||!1,$rowIndex:e.$rowIndex||!1,scope:null},inputs:null,isReference:!0}}function zv(e,t){let n=e.startsWith(`$`);n&&(e=e.substring(1));let r=Iv(e)-1;return n||r===-(2**53-1)||(r-=t),{type:$.Cell,value:{colIndex:r,rowIndex:-(2**53-1),$colIndex:n,$rowIndex:!1,scope:null},inputs:null,isReference:!0}}function Bv(e,t){let n=e.startsWith(`$`);n&&(e=e.substring(1));let r=parseInt(e)-1;return n||r===-(2**53-1)||(r-=t),{type:$.Cell,value:{colIndex:-(2**53-1),$colIndex:!1,rowIndex:r,$rowIndex:n,scope:null},inputs:null,isReference:!0}}function Vv(e,t){return{type:$.Function,value:e,inputs:t}}function Hv(e,t){return{type:$.Call,value:null,inputs:t&&t.length>0?[e,...t]:[e]}}function Uv(e,t){return{type:$.TableReference,value:e,inputs:t,isReference:!0}}function Wv(e,t=Pv){let n=e.startsWith(`[`)?e.slice(1,-1):e;if(n.startsWith(`#`)&&t.parseSpecifier){let e=t.parseSpecifier(n.slice(1));e&&(n=`#`+e)}return{type:$.TableSpecifier,value:n,inputs:null,isReference:!0}}function Gv(e){let t=e;return e.startsWith(`[`)&&e.endsWith(`]`)?t=e.slice(1,-1):e.startsWith(`'`)&&e.endsWith(`'`)&&(t=e.slice(1,-1).replace(/''/g,`'`)),{type:$.TableColumn,value:t,inputs:null,isReference:!0}}function Kv(e,t,n,r=!1){let i={type:$.Infix,value:e,inputs:[t,n]};return r&&(i.isReference=!0),i}function qv(e,t,n=!1){let r={type:$.Postfix,value:e,inputs:t?[t]:null};return n&&(r.isReference=!0),r}function Jv(e,t,n=!1){let r={type:$.Prefix,value:e,inputs:t?[t]:null};return n&&(r.isReference=!0),r}function Yv(e,t){return{type:$.Prefix,value:e,inputs:[t]}}function Xv(e){return{type:$.Named,value:{nameId:e,scope:null},inputs:null,isReference:!0}}function Zv(e,t=Pv){let r=t.separators.separatorDecimal,i=e;r!==`.`&&(i=i.split(r).join(`.`)),i.includes(`**`)&&(i=i.replace(`**`,`e`));let a=Number(n.r.truncateNumberText(i));if(!(a>=-999999999999999e293&&a<=999999999999999e293))throw new n.a.Parse(`Number out of range: ${e}`);return{type:$.Number,value:a,image:e,isLiteral:!0}}function Qv(e){return{type:$.String,value:e.length>1?e.substring(1,e.length-1).replace(/""/g,`"`):e,isLiteral:!0}}function $v(e){return{type:$.Array,value:[e],isLiteral:!0}}function ey(){return{type:$.Row,value:[],isLiteral:!0}}function ty(e,t=Pv){return{type:$.Boolean,value:t.parseBoolean(e)??!1,image:e,isLiteral:!0}}function ny(e,t=Pv){return{type:$.Error,value:t.parseError(e)??n.a.getBuiltInByLabel(e.toUpperCase()),image:e,isLiteral:!0}}function ry(e,t=Pv,r){let i=e?t.parseError(e)??n.a.getBuiltInByLabel(e.toUpperCase()):n.a.BuiltIn.Ref;return{type:$.Error,value:r?{error:i,scope:r}:{error:i},image:e,inputs:null,isReference:!0}}function iy(e){return n.a.isError(e)?e:e?.error}function ay(e){return e.indexOf(`#`)>0}function oy(){return{type:$.Empty,value:void 0,isLiteral:!0}}function sy(e,t){return e&&function e(n,r,i=[]){let a,o=n.inputs;if(o){let t=o.length;for(let r=0;r<t;r++){let t=o[r];if(t===void 0)continue;i.push(n);let s=e(t,n,i);i.pop(),s!==void 0&&s!==t&&(a||=[...o],a[r]=s)}}let s=n;if(a&&(s={...n},s.inputs=a),s===void 0)return s;let c=t(s,r,i);return c===void 0?s:c}(e,void 0,[])}function cy(e,t){return t.wsBefore&&(e.wsBefore=t.wsBefore),t.wsAfter&&(e.wsAfter=t.wsAfter),t.image&&(e.image=t.image),e}var ly=Object.freeze([[`^`],[`*`,`/`],[`+`,`-`],[`&`],[`<`,`>`,`=`,`<>`,`<=`,`>=`]]),uy=(Object.freeze([`:`,`.:.`,`.:`,`:.`]),Object.freeze([`:`,` `,`.:.`,`.:`,`:.`])),dy=Object.freeze([`@`]),fy=Object.freeze([`#`]),py=(Object.freeze(uy.concat(fy)),Object.freeze(uy.concat(dy).concat(fy))),my=class{constructor(t,n,r){if(!r)throw new e.O;if(typeof r==`string`&&(r={address:r}),typeof r.address!=`string`)throw Error(e._(`error.hyperlink.invalidHyperlink`));this._t=t,this._r=n,this._p=r}open(e,t){return this._r(this.getAddress(),null,e??this.getTarget(),t)}getTarget(){return this._p.target||(this._p.address.startsWith(`#`)?`_self`:`_blank`)}getTextToDisplay(){return this._t()||this.getAddress()}getAddress(){return this._p.address??``}getScreenTip(){return this._p.screenTip??null}get isIHyperlink(){return!0}},hy=Object.freeze({displayText:``,conditionalColor:null,repeatChars:e.A.EmptyArray,spacingChars:e.A.EmptyArray,errorPlaceholder:null,formattedRuns:Object.freeze({runs:e.A.EmptyArray,length:0,width:0,lastRepeatIndex:-1}),canWrap:!1,asDate:null,isDateFormat:!1,isTimeFormat:!1});function gy(t,r,i,a,s,c){if(r==null)return hy;let l=``,u=null,d=null,f=null,p=null,m=uc();if(a===n.n.Error)l=lo(r);else if(a===n.n.RichData)l=`(Rich Object)`;else if(a===n.n.Boolean)l=co(r);else if(s)try{let e=m.format(s,r,{date1904:t?.isDate1904()??!1,locale:t?.getLocale()??void 0,placeholders:!0});l=e.text,d=e.fills??null,f=e.skips??null,p=e.color}catch(e){console.warn(`Invalid formatCode: `+l,s,e)}let h=m.isDateFormat(s),g=m.isTimeFormat(s),_=h||g?ur(r,t?.isDate1904()??!1):null;l===null&&(u=`#`,l=u.repeat(5));let v=null,y=i.getAlignment(),b=y.getHorizontal(),x=y.getVertical(),S=y.getOverflow(),C=!(a!==n.n.String||b===o.HorizontalAlignment.Fill||d!==null&&d.length!==0||S!==o.Overflow.Wrap&&b!==o.HorizontalAlignment.Justify&&b!==o.HorizontalAlignment.Distributed&&x!==o.VerticalAlignment.Justify&&x!==o.VerticalAlignment.Distributed),w=l;C||a!==n.n.String||(w=w.replaceAll(/\n/g,``));let T=f?f.length:0,E=d?d.length:0,D=T>0||E>0;if(S!==o.Overflow.Wrap||D){let e=i.getFont(),t=e.getSize();e.isSuperSub()&&(t*=e.getSuperSubScale());let n=[];for(let e=0;e<T;e++){let r=f[e],a=i.measureText(r.char,t).width;n.push({...r,type:`spacing`,width:a})}if(E>0){let e=d[E-1],r=i.measureText(e.char,t).width;n.push({...e,type:`repeat`,width:r})}n=n.sort((e,t)=>e.offset-t.offset);let r=[],a=0,o=0,s=-1,c=-1,l=e=>{let n={type:`text`,width:i.measureText(e,t).width,text:e};r.push(n),o+=n.width,a+=e.length},u=n.length;for(let e=0;e<u;e++){let t=n[e];if(c!==t.offset){let e=w.substring(a,t.offset);e&&l(e)}let i={type:t.type,width:t.width,text:t.char};t.type===`repeat`?s=r.length:o+=i.width,r.push(i),c=t.offset}if(a<w.length){let e=w.substring(a,w.length);e&&l(e)}v={runs:Object.freeze(r),length:a,width:o,lastRepeatIndex:s}}let O={displayText:l??``,conditionalColor:p?c(p):null,repeatChars:d??e.A.EmptyArray,spacingChars:f??e.A.EmptyArray,errorPlaceholder:u,formattedRuns:v,canWrap:C,asDate:_,isDateFormat:h,isTimeFormat:g};return Object.freeze(O)}function _y(t){let n=typeof t==`number`?Number(t.toPrecision(15)):t,r=e.A.castToString(n),i=r.indexOf(`e`);if(i===-1)return r;let a=r.substring(i+2);return`${r.substring(0,i)}E${r[i+1]}${a.length<2?`0`+a:a}`}function vy(e,t){if(e==null)return``;switch(t){case n.n.Number:return _y(e);case n.n.Boolean:return co(e);case n.n.Error:{let t=e;return typeof t?.getLabel==`function`?lo(t):n.a.Label.Unknown}}return``+e}function yy(e,t,n,r){return{x:e*r-t*n,y:e*n+t*r}}function by(e){let t=0,n=0,r=0,i=0,a=0,o=0,s=0,c=e.length;if(c===0)return{m:0,b:0};if(c===1)return{m:1,b:e[0]};for(let l=0;l<c;l++)o=l+1,s=e[l],s==null||isNaN(s)||(t+=o,n+=s,i+=o*o,r+=o*s,a++);let l=(a*r-t*n)/(a*i-t*t);return{m:l,b:n/a-l*t/a}}var xy=class{constructor(e,t){this._c=e,this._tvTl=t}tvTl(){return this._tvTl(this._c)}getCoords(){return this._c}},Sy=class t{get _block(){return this._blockOwn}constructor(e,t,n){this._coords=e,this._blockOwn=t,this._options=n}getTokens(t){let n=this._coords??e.l.EmptyCell;return this._block.getTokensAt(n.rowIndex,n.colIndex,t)}isValid(){return!this._block.getError()}autoCorrect(){return this.isValid()?null:this._options.autoCorrect?.(this.getExpression(),this._coords??void 0)??null}evaluate(t){let n=this._coords??e.l.EmptyCell,r=typeof t==`number`?t:t?.evalIndex,i=this._block.evaluateAt(n.rowIndex,n.colIndex,r);return this._block.finalizeValue(i)}getCalculationStatus(){return cv.Status.Ready}getReferences(){let e=this._coords;return e?this._resolveReferences(this._options.getCalcGrid?.()?.getReferencesAt(e.rowIndex,e.colIndex)):null}hasRefError(){let e=this._coords;return!!e&&wy(this._options.getCalcGrid?.()?.getReferencesAt(e.rowIndex,e.colIndex))}_resolveReferences(e){if(!e?.length)return null;let t=this._options.resolveSheetScope,r=[];for(let i of e)if(i&&!n.a.isError(i))if(`nameId`in i)r.push(i.nameId);else{let e=i;if(e.scope&&t){let n=t(e.scope);n&&(e={...e,scope:n})}else if(!e.scope){let t=this._options.getOwnScope?.();t&&(e={...e,scope:t})}r.push(e)}else r.push(null);if(!r.some(e=>e!==null))return null;try{return this._options.getRanges(r)}catch{let e=r.map(e=>{if(e===null)return null;try{return this._options.getRanges([e]),e}catch{return null}});return e.some(e=>e!==null)?this._options.getRanges(e):null}}setReferenceAt(n,r,i){let a=this._coords,o=this._options,s=o.getCalcGrid?.();if(!a||!s)return e.A.EmptyArray;let c=o.getRange(r),l=c?.isINamedRange?{nameId:c.getId()}:c.getCoords()??null;if(typeof r==`string`&&!r.includes(`:`)&&l?.colStart!==void 0){let e=l,t={colIndex:e.colStart,rowIndex:e.rowStart,$colIndex:e.$colStart??!1,$rowIndex:e.$rowStart??!1};e.scope&&(t.scope=e.scope),l=t}let u,d=e._(`op.updateFormulaAt`,{address:o.getRange(a).getAddress()});return i&&typeof i!=`string`&&!i.description&&((i={...i}).description=d),o.doBatchCalcGrid(t=>{let r=a.rowIndex,i=a.colIndex;return t.setReferenceAt(r,i,n,l),u=t.getFormulaBlockAt(r,i),e.l.cellToRange(a)},i??d),new t(a,u,o)}setReferenceModeAt(n,r=`self`,i,a){let o=this._coords??e.l.EmptyCell,s=this._options,c=s.getCalcGrid().getReferencesAt(o.rowIndex,o.colIndex)[n];if(!c||`nameId`in c)throw Error(`Reference at index ${n} is not a cell reference and cannot have its style changed.`);let l=c,u=s.getRange(o),d=u?e._(`op.updateReferenceStyleAt`,{address:u.getAddress()}):e.v(`op.updateReferenceStyle`);a&&typeof a!=`string`&&!a.description&&((a={...a}).description=d);let f,p=Ty(l,r,i);return s.doBatchCalcGrid(t=>{let r=o.rowIndex,i=o.colIndex;return t.setReferenceAt(r,i,n,p),f=t.getFormulaBlockAt(r,i),e.l.cellToRange(o)},a??d),new t(o,f,s)}isReferenceOnly(){return this._block.isReferenceOnly()}isVolatile(){let e=this._coords;return!!e&&(this._options.getCalcGrid?.()?.isVolatileAt(e.rowIndex,e.colIndex)??!1)}getExpression(t){let n=t?.cell??this._coords??e.l.EmptyCell,r=t?.r1c1??!1;return this._block.getTextAt(n.rowIndex,n.colIndex,r,t?.formulaTransform,t?.evalIndex,t?.canonical)}getAnchor(){return this._coords}shift(e){return this._options.createAt?.(this.getExpression({cell:e}),e)??null}get[Symbol.toStringTag](){return`[Formula]`}toString(){return this.getExpression()}get isIFormula(){return!0}},Cy=class t extends Sy{constructor(e,t,n,r){super(e,t,n),this._doEval=r}evaluate(e){let t=this._block;return this._doEval(t,e)}getReferences(){let e=this._coords;if(!e)return null;let t=this._block.getReferences(e.rowIndex,e.colIndex);return this._resolveReferences(t?.map(t=>t?.colStart===void 0?t:Kl(t,e.rowIndex,e.colIndex)))}hasRefError(){let t=this._coords??e.l.EmptyCell;return wy(this._block.getReferences(t.rowIndex,t.colIndex))}setReferenceAt(e,n){let r=this._coords;if(!r)return this;let i=this._options.getRange(n),a=i?.isINamedRange?{nameId:i.getId()}:i.getCoords()??null,o=typeof n==`string`?n.includes(`!`):n?.colStart===void 0||!!n.scope;a?.scope&&!o&&(a={...a,scope:void 0});let s=a?.colStart===void 0?a:ql(a,r.rowIndex,r.colIndex);if(typeof n==`string`&&!n.includes(`:`)&&s?.colStart!==void 0){let e=s,t={colIndex:e.colStart,rowIndex:e.rowStart,$colIndex:e.$colStart??!1,$rowIndex:e.$rowStart??!1};e.scope&&(t.scope=e.scope),s=t}return new t(r,this._block.setReferenceAt(e,s),this._options,this._doEval)}setReferenceModeAt(e,t=`self`,n,r){let i=this._coords;if(!i)return this;let a=this._block.getReferences(i.rowIndex,i.colIndex)?.[e];if(!a||`nameId`in a||a.colStart===void 0)return this;let o=a;if(o.scope&&this._options.resolveSheetScope){let e=this._options.resolveSheetScope(o.scope);e&&(a={...o,scope:e})}let s=Kl(a,i.rowIndex,i.colIndex);return this.setReferenceAt(e,Ty(s,t,n))}};function wy(e){if(!e?.length)return!1;for(let t=0;t<e.length;t++){let r=e[t];if(!r||n.a.isError(r))return!0}return!1}var Ty=(e,t=`self`,n)=>{let r=t===`right`,i=n;if(i===void 0){let t=r?e.$colEnd:e.$colStart,n=r?e.$rowEnd:e.$rowStart;i=t&&n?0:n&&!t?1:t&&!n?2:3}let a=i+1;(a>3||a<0)&&(a=0);let o=a===0||a===1,s=a===0||a===2,c={...e};return t===`self`?(c.$rowStart=o,c.$colStart=s,c.$rowEnd=o,c.$colEnd=s):t===`right`?(c.$rowEnd=o,c.$colEnd=s):(c.$rowStart=o,c.$colStart=s),c},Ey=(e,t)=>e+t,Dy=(e,t)=>e-t,Oy=(e,t)=>e*t,ky=(e,t)=>t===0?n.a.BuiltIn.Div0:e/t,Ay=(e,t)=>{if(e===0){if(t<0)return n.a.BuiltIn.Div0;if(t===0)return NaN}return e**t},jy=(e=``,t=``)=>{e===null&&(e=``),t===null&&(t=``);let r=typeof t;typeof e==`boolean`&&(e=co(e)),r===`boolean`&&(t=co(t));let i=``+e+t;return i.length>n.r.MAX_TEXT_LENGTH?i.slice(0,n.r.MAX_TEXT_LENGTH):i},My=(e,t=null,n=null)=>e.compare(t,n)===0,Ny=(e,t=null,n=null)=>e.compare(t,n)!==0,Py=(e,t=null,n=null)=>e.compare(t,n)>0,Fy=(e,t=null,n=null)=>e.compare(t,n)>=0,Iy=(e,t=null,n=null)=>e.compare(t,n)<0,Ly=(e,t=null,n=null)=>e.compare(t,n)<=0,Ry={type:n.n.Number,coerce:[n.n.Boolean,n.n.String],onError:`value`,misalignValue:n.a.BuiltIn.NA},zy={type:n.n.String,coerce:[n.n.Boolean,n.n.Number],onError:`value`,misalignValue:n.a.BuiltIn.NA},By={onError:`value`,misalignValue:n.a.BuiltIn.NA},Vy=(e,t,r,i)=>{if(t!==null&&t.colStart!==void 0&&(t=e.getValueAt(t.rowStart,t.colStart,t.scope))&&n.a.isError(t))return t;if(r!==null&&r.colStart!==void 0&&(r=e.getValueAt(r.rowStart,r.colStart,r.scope))&&n.a.isError(r))return r;if(typeof t==`number`&&typeof r==`number`)return i(t,r);let a,o;if(t?.isIRange?a=t:r?.isIRange&&(o=r),!a&&!o){let a=e.getRuntime();return t=dE(a,t,nE(t,!0),n.n.Number,!0),r=dE(a,r,nE(r,!0),n.n.Number,!0),t&&n.a.isError(t)?t:r&&n.a.isError(r)?r:i(t,r)}let s=!a,c=s?t:r;return(a??o).broadcast(c,(t,r)=>t&&n.a.isError(t)?t:r&&n.a.isError(r)?r:yE(s?i(r,t):i(t,r),e),Ry).fillEmpty(0)},Hy=(e,t,r,i)=>{if(!0===t?.isLambda||!0===r?.isLambda)return n.a.BuiltIn.Value;if(t!==null&&t.colStart!==void 0&&(t=e.getValueAt(t.rowStart,t.colStart,t.scope))&&n.a.isError(t))return t;if(r!==null&&r.colStart!==void 0&&(r=e.getValueAt(r.rowStart,r.colStart,r.scope))&&n.a.isError(r))return r;let a,o,s=!1;return t?.isIRange?(a=t,o=r):r?.isIRange&&(a=r,o=t,s=!0),a?a.broadcast(o,(t,r)=>t&&n.a.isError(t)?t:r&&n.a.isError(r)?r:s?i(e,r,t):i(e,t,r),By):n.a.isError(t)?t:n.a.isError(r)?r:i(e,t,r)},Uy=(e,t,r)=>{if(r??=0,r!==null&&r.colStart!==void 0&&(r=e.getValueAt(r.rowStart,r.colStart,r.scope))&&n.a.isError(r))return r;let i,a=1;if(t===`+`)return r;if(t!==`-`)throw new n.a.Value(`Unrecognized prefix: ${t}`);return a=-a,r?.isIRange&&(i=r),i?i.broadcast(a,(e,t)=>e&&n.a.isError(e)?e:t&&n.a.isError(t)?t:Oy(e,t),Ry):typeof(r=dE(e.getRuntime(),r,nE(r,!0),n.n.Number,!0))==`number`?r*a:n.a.BuiltIn.Value},Wy=e=>e.getCode()<=n.a.Code.NA?e:n.a.BuiltIn.Value,Gy=(e,t,r,i)=>{if(n.a.isError(t))return Wy(t);if(r&&n.a.isError(r))return Wy(r);if(!t)return n.a.BuiltIn.Ref;if(t.isIReferenceRange&&r&&!r.isIReferenceRange?r=e.getReference(r):r&&r.isIReferenceRange&&t&&!t.isIReferenceRange&&(t=e.getReference(t)),t.isIReferenceRange&&(t=t.getCoords()),t.colStart===void 0||(r.isIReferenceRange&&(r=r.getCoords()),r.colStart===void 0))return n.a.BuiltIn.Value;let a=i(t,r);return n.a.isError(a)?a:a?e.getReference(a):n.a.BuiltIn.Null},Ky={"+":(e,t,n)=>Vy(e,t,n,Ey),"-":(e,t,n)=>Vy(e,t,n,Dy),"*":(e,t,n)=>Vy(e,t,n,Oy),"/":(e,t,n)=>Vy(e,t,n,ky),"^":(e,t,n)=>Vy(e,t,n,Ay)," ":(e,t,n,r)=>Gy(e,t,n,su),":":(e,t,n,r)=>Gy(e,t,n,cu),".:.":(e,t,n,r)=>{let i=Gy(e,t,n,cu);return e.getFunction(`TRIMRANGE`).execute(i,3,3)},".:":(e,t,n,r)=>{let i=Gy(e,t,n,cu);return e.getFunction(`TRIMRANGE`).execute(i,1,1)},":.":(e,t,n,r)=>{let i=Gy(e,t,n,cu);return e.getFunction(`TRIMRANGE`).execute(i,2,2)},"&":(e,t,r)=>((e,t,r,i)=>{if(t!==null&&t.colStart!==void 0&&(t=e.getValueAt(t.rowStart,t.colStart,t.scope))&&n.a.isError(t))return t;if(r!==null&&r.colStart!==void 0&&(r=e.getValueAt(r.rowStart,r.colStart,r.scope))&&n.a.isError(r))return r;if(typeof t==`string`&&typeof r==`string`)return i(t,r);let a,o;if(t?.isIRange?a=t:r?.isIRange&&(o=r),!a&&!o){let a=e.getRuntime();return t=dE(a,t,nE(t,!0),n.n.String,!1),r=dE(a,r,nE(r,!0),n.n.String,!1),n.a.isError(t)?t:n.a.isError(r)?r:i(t,r)}let s=!a,c=s?t:r;return(a??o).broadcast(c,(e,t)=>e&&n.a.isError(e)?e:t&&n.a.isError(t)?t:s?i(t,e):i(e,t),zy)})(e,t,r,jy),"=":(e,t,n)=>Hy(e,t,n,My),"<>":(e,t,n)=>Hy(e,t,n,Ny),">":(e,t,n)=>Hy(e,t,n,Py),"<":(e,t,n)=>Hy(e,t,n,Iy),">=":(e,t,n)=>Hy(e,t,n,Fy),"<=":(e,t,n)=>Hy(e,t,n,Ly)},qy={"-":(e,t)=>Uy(e,`-`,t),"+":(e,t)=>Uy(e,`+`,t),"@":(e,t)=>{if(!t||!t.isIRange)return t;let r=t;if(!t.isIReferenceRange)return r.getValueAt(0,0);let i=t.getCoords(),a=r.getRowCount(),o=r.getColumnCount();if(o>1&&a>1)return n.a.BuiltIn.Value;if(a>1){let t=e.getRow()-i.rowStart;if(t>=0&&t<a)return r.getValueAt(t,0)}else{if(!(o>1))return r.getValueAt(0,0);{let t=e.getColumn()-i.colStart;if(t>=0&&t<o)return r.getValueAt(0,t)}}return n.a.BuiltIn.Value}},Jy={"%":(e,t)=>Vy(e,t,100,ky),"#":(e,t)=>e.getSpillAt(t.rowStart,t.colStart,t.scope)||n.a.BuiltIn.Ref};function Yy(e,t){for(let n=e.length-1;n>=0;n--)if(e[n].type===t)return e[n]}var Xy=class{constructor(){this.referenceIndices=[],this.rootReferences=new Set,this.cells=new Map,this.references=new Map,this.names=new Map}processNode(e,t){let n=e.type;if(e.isReference){let t={node:e,index:this.references.size,op:null,value:null,inputs:null};if(this.references.set(e,t),n===$.Cell){let n=e.value;n.$colIndex&&(t.hasHorizontalAbs=!0),n.$rowIndex&&(t.hasVerticalAbs=!0),t.value=this.cells.size,this.cells.set(e,this.cells.size),this.rootReferences.add(t),e.referenceIndex=this.referenceIndices.length,this.referenceIndices.push(t.index);return}if(n===$.Infix||n===$.Prefix||n===$.Postfix||n===$.List){let n=e.inputs||[],r=n.length,i=e.value;t.op=i;let a=xE(r);t.inputs=a;for(let e=0;e<r;e++){let r=n[e],i=this.references.get(r);i?(i.hasHorizontalAbs&&(t.hasHorizontalAbs=!0),i.hasVerticalAbs&&(t.hasVerticalAbs=!0),a[e]=i.index):a[e]=-1,i&&this.rootReferences.delete(i)}if(this.rootReferences.add(t),sb.includes(i)){let r=n[0],i=!!r&&r.type===$.Cell,a=n[1],o=!!a&&a.type===$.Cell;i&&o&&a.referenceIndex!==void 0&&r.referenceIndex!==void 0&&(this.referenceIndices.splice(a.referenceIndex,1),a.referenceIndex=r.referenceIndex,e.referenceIndex=r.referenceIndex,this.referenceIndices[r.referenceIndex]=t.index)}else i===`#`&&(e.referenceIndex=n[0].referenceIndex);return}if(n===$.Error||n===$.Named){let r=n===$.Named?e.value.nameId:iy(e.value),i=this.names.get(r);t.op=n,i===void 0&&(i=this.names.size,this.names.set(r,i)),t.value=i,this.rootReferences.add(t),e.referenceIndex=this.referenceIndices.length,this.referenceIndices.push(t.index);return}if(n===$.TableReference)return t.op=n,this.rootReferences.add(t),e.referenceIndex=this.referenceIndices.length,void this.referenceIndices.push(t.index)}else if(t&&t.isReference){let t={node:e,index:this.references.size,op:$.Function,value:e.value,inputs:null};this.references.set(e,t)}}};function Zy(e,t=!1,n=Av){let r=[],i=(e,n,i)=>{let a={type:e.type,value:e.value};e.image!==void 0&&(a.text=(e=>{let n=t?e.value?.scopeImage:void 0;return typeof n==`string`?n:``})(e)+e.image);let o=e.evalIndex??i;return o!==void 0&&(a.evalIndex=o),n&&(a.context=n),e.referenceIndex!==void 0&&(a.referenceIndex=e.referenceIndex),e.isReference&&(a.isReference=!0),r.push(a),a},a=(e,t,n,i,a)=>{if(t==null||r.length>1&&e===$.Whitespace&&r[r.length-1].type===$.Whitespace)return;let o={type:e,value:t,text:a??t};i!==void 0&&(o.evalIndex=i),n&&(o.context=n),r.push(o)};(function e(t,o,s){let c=t.evalIndex??s??0,l=t.type,u=(t,r,i)=>{if(!t)return;let o=t.length;for(let s=0;s<o;s++)e(t[s],r,i),s<o-1&&a($.Separator,`,`,r,i,n.separatorFunction)};if(t.isLiteral){if(a($.Whitespace,t.wsBefore,o,c),l===$.Array){a($.Type,`{`,o,c);let r=t.value,i=r.length;for(let t=0;t<i;t++){let s=r[t],l=s.value,u=l.length;for(let t=0;t<u;t++){let r=l[t];a($.Whitespace,r.wsBefore,o,c),e(r,o,c),a($.Whitespace,r.wsAfter,o,c),t<u-1&&a($.Separator,`,`,o,c,n.separatorColumn)}t<i-1&&(a($.Whitespace,s.wsBefore,o,c),a($.Separator,`;`,o,c,n.separatorRow),a($.Whitespace,s.wsAfter,o,c))}t.error||a($.Type,`}`,o,c)}else l===$.String&&(t={type:l,value:`"`+`${t.value}`.replace(/"/g,`""`)+`"`,image:t.image}),i(t,o,c);a($.Whitespace,t.wsAfter,o,c)}else if(l===$.Infix)e(t.inputs[0],o,c),a($.Whitespace,t.wsBefore,o,c),i(t,o,c),a($.Whitespace,t.wsAfter,o,c),e(t.inputs[1],o,c);else if(l===$.Prefix)a($.Whitespace,t.wsBefore,o,c),i(t,o,c),a($.Whitespace,t.wsAfter,o,c),t.inputs&&e(t.inputs[0],o,c);else if(l===$.Postfix)e(t.inputs[0],o,c),a($.Whitespace,t.wsBefore,o,c),i(t,o,c),a($.Whitespace,t.wsAfter,o,c);else{a($.Whitespace,t.wsBefore,o,c);let s=t.inputs;switch(l){case $.Function:{let i=String(t.value),l={type:$.Function,value:i,text:t.image??i,evalIndex:t.evalIndex};o&&(l.context=o),l.isLookup=!0,t.referenceIndex&&(l.referenceIndex=t.referenceIndex),r.push(l);let u={name:i,argIndex:-1,type:`function`};if(a($.Paren,`(`,u,t.evalIndex),s){let t=s.length;for(let r=0;r<t;r++){let i={...u,argIndex:r};e(s[r],i,c),r<t-1&&a($.Separator,`,`,i,c,n.separatorFunction)}}t.error||a($.Paren,`)`,u,t.evalIndex);break}case $.Call:{let r=function(e){return e.inputs?.[0]}(t);r&&e(r,o,c);let i={name:r?.type===$.Named?r.value.nameId:``,argIndex:-1,type:`function`};a($.Paren,`(`,i,t.evalIndex);let s=function(e){let t=e.inputs;return t&&t.length>1?t.slice(1):[]}(t),l=s.length;for(let t=0;t<l;t++){let r={...i,argIndex:t};e(s[t],r,c),t<l-1&&a($.Separator,`,`,r,c,n.separatorFunction)}t.error||a($.Paren,`)`,i,t.evalIndex);break}case $.Cell:i(t,o,c);break;case $.Paren:a(l,`(`,o,c),u(s,o,c),t.error||a(l,`)`,o,c);break;case $.TableReference:{let n=t.value?.tableId??``,i={name:n,argIndex:-1,type:`table`},l=r.length;if(n&&(a($.TableReference,n,o,c),r[r.length-1].isLookup=!0),a($.Paren,`[`,i,c),s){let t=s.length;for(let n=0;n<t;n++){let r={...i,argIndex:n};e(s[n],r,c),n<t-1&&a($.Separator,`,`,r,c)}}t.error||a($.Paren,`]`,i,c);let u=t.referenceIndex;for(let e=l;e<r.length;e++)u!==void 0&&(r[e].referenceIndex=u),r[e].isReference=!0;break}case $.TableSpecifier:{let e=t.image,n=t.value,r=e!=null&&e.startsWith(`[`)&&e.endsWith(`]`);a($.TableSpecifier,r?`[${n}]`:n,o,c);break}case $.TableColumn:{let e=t.image,n=t.value,r=e!=null&&e.startsWith(`[`)&&e.endsWith(`]`);a($.TableColumn,r?`[${n}]`:n,o,c);break}case $.List:u(s,o,c);break;case $.Named:{let e=i(t,o,c),n=t.value;e.value=n.scope?{name:n.nameId,scope:n.scope}:{name:n.nameId},t.binding?.declaration&&t.binding.optional&&(e.value.optional=!0),e.isLookup=!0,delete e.referenceIndex;break}default:t.value!==void 0&&i(t,o,c),s&&s.forEach(t=>e(t,o,c))}a($.Whitespace,t.wsAfter,o,c)}})(e);let o=new Map;for(let e of r)if(e.type===$.Cell&&e.referenceIndex!==void 0){let t=o.get(e.referenceIndex);t?t.push(e):o.set(e.referenceIndex,[e])}for(let e of o.values())e.length===1?e[0].refSide=`self`:(e[0].refSide=`left`,e[e.length-1].refSide=`right`);let s=new Map;for(let e of r)if(e.isReference&&e.referenceIndex!==void 0&&e.evalIndex!==void 0){let t=s.get(e.referenceIndex);(t===void 0||e.evalIndex<t)&&s.set(e.referenceIndex,e.evalIndex)}if(s.size>0){for(let e of r)if(e.isReference&&e.referenceIndex!==void 0){let t=s.get(e.referenceIndex);t!==void 0&&(e.evalIndex=t)}}return r}function Qy(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e[r],a=i.type;if(a===$.Cell||a===$.Named||a===$.Error){let e=a===$.Cell?i.value?.scope:i.value?.scope??void 0,r=a===$.Error?i.text!==void 0&&ay(i.text):i.text?.includes(`!`)??!1;if(e&&i.text!==void 0&&!r){n+=_l(t?.resolve(Sd,e)?.toString()??e)+`!`+i.text;continue}if(a===$.Named){n+=i.text??i.value?.name??``;continue}}let o=i.text??i.value;typeof o==`string`&&(n+=o)}return n}function $y(e,t){let n;if(sy(e,e=>{e.evalIndex===t&&(n=e)}),!n)return[];let r=Zy(n);return r.length>1&&r[0].type===$.Whitespace&&r.shift(),r.length>1&&r[r.length-1].type===$.Whitespace&&r.pop(),r}var eb=e=>{if(e?.type!==$.TableSpecifier)return 4;switch(e.value.toUpperCase().trim()){case`#ALL`:return 0;case`#HEADERS`:return 1;case`#DATA`:return 2;case`#TOTALS`:return 3;default:return 4}};function tb(t){if(!t)return e.A.EmptyArray;let n=e.A.EmptyArray;return sy(t,t=>{if(t.type!==$.Named||t.binding)return;let r=t.value.nameId;r&&(n===e.A.EmptyArray&&(n=[]),n.includes(r)||n.push(r))}),n}var nb=new Set([`SUBTOTAL`,`AGGREGATE`]);function rb(e,t){if(!e||!t)return!1;let n=!1;return sy(e,e=>{if(n||e.type!==$.Function)return;let r=t(e.value)?.getName();r&&nb.has(r.toUpperCase())&&(n=!0)}),n}function ib(t){if(!t)return e.A.EmptyArray;let n=e.A.EmptyArray;return sy(t,t=>{let r=null;if(t.type===$.Named){if(t.binding)return;r=t.value.nameId??null}else t.type===$.TableReference&&(r=typeof t.value==`string`?t.value:null);r&&(n===e.A.EmptyArray&&(n=[]),n.includes(r)||n.push(r))}),n}function ab(e,t,n,r=!1,i=null,a=null){let o,s,c=n;c=function(e){return sy(e,e=>{if(e.type!==$.TableReference)return;let t=function(e){if(e.value!==null&&typeof e.value==`object`)return e.value;let t,n=e.value,r=e.inputs,i=!1,a=!1,o=!1,s=!1,c=null,l=null,u=!1,d=e=>{e?.type===$.TableColumn&&(c=e.value,l=e.value)};if(r)for(let e of r){let t=e.type;if(t===$.TableSpecifier){let t=e.value.toUpperCase().trim();t===`#ALL`?a=!0:t===`#HEADERS`?o=!0:t===`#TOTALS`?s=!0:t===`#DATA`?i=!0:t!==`@`&&t!==`#THIS ROW`||(u=!0)}else if(t===$.TableColumn)d(e);else if(t===$.Infix&&e.value===`:`){let t=e.inputs?.[0],n=e.inputs?.[1];t?.type===$.TableColumn&&(c=t.value),n?.type===$.TableColumn&&(l=n.value)}else t===$.Prefix&&e.value===`@`&&(u=!0,d(e.inputs?.[0]))}return t=a?1:o&&i?4:s&&i?5:o?2:s?3:0,{tableId:n,spec:t,columnFromId:c,columnToId:l,isThisRow:u}}(e);return{...e,value:t}})}(c),r||(c=sy(c,e=>{if(e.type!==$.TableReference)return;let t=e.inputs;if(!t||t.findIndex(e=>e.type===$.TableSpecifier&&e.value.toUpperCase().trim()===`#THIS ROW`)===-1)return;let n,r=[];for(let e of t)e.type===$.TableSpecifier&&e.value.toUpperCase().trim()===`#THIS ROW`||(e.type!==$.TableColumn&&(e.type!==$.Infix||e.value!==`:`)||n?r.push(e):n=e);if(!n)return r.push({type:$.Prefix,value:`@`,inputs:null,isReference:!0}),{...e,inputs:r};let i=n.image??n.value,a=i.startsWith(`[`)&&i.endsWith(`]`)?{...n,image:i.slice(1,-1)}:n;return r.push(Jv(`@`,a,!0)),{...e,inputs:r}}),c=function(e){return sy(e,e=>{if(e.type!==$.TableReference)return;let t=e.inputs;if(!t||t.length<2)return;let n=t.map((e,t)=>({input:e,index:t,rank:eb(e)})).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.input);return n.every((e,n)=>e===t[n])?void 0:{...e,inputs:n}})}(c)),[o,s]=function(e){let t=new Map,n=0,r=[e];for(;r.length>0;){let e=r.shift();if(t.set(e,{...e,evalIndex:n++}),e&&e.inputs)for(let t of e.inputs)r.push(t)}return t.forEach((e,n)=>{n&&n.inputs&&(e.inputs=n.inputs.map(e=>t.get(e)??e))}),[t.get(e),n]}(c);let l=xE(s),u=[],d=[],f=new Xy,p=!1;o=sy(o,(t,n,r)=>{let i=t.type,a=t.evalIndex;if(l[a]=null,i===$.TableColumn||i===$.TableSpecifier||t.isReference&&Yy(r,$.TableReference))return;if(p||=!fb(t),t.binding?.declaration)return d[t.binding.slot]=-1,void(l[a]=void 0);let o=(e=>{for(let t=e.length-1;t>=0;t--)if(e[t].binder?.kind===`lambda`)return!0;return!1})(r);o&&i===$.Named&&(t.deferredResolve=!0);let s=t.binder;if(s&&s.kind===`let`){let e=t.inputs,n=e?.length??0,r=0;for(let t=0;t+1<n&&r<s.slots.length;t+=2)e[t]?.binding?.declaration&&(d[s.slots[r++]]=e[t+1]?.evalIndex??-1)}if((t.isReference||n&&n.isReference)&&(f.processNode(t,n),t.isReference)){if(i===$.Cell||i===$.TableReference||i===$.Error||i===$.Named)return;if(i===$.Infix||i===$.Prefix||i===$.Postfix||i===$.List)return void(o||u.push(t))}if(t.isLiteral)if(i!==$.Array)l[a]=t.value;else{let n=t.value,r=n.length,i=xE(r);for(let e=0;e<r;e++){let t=n[e].value,r=t.length,a=xE(r);for(let e=0;e<r;e++){let n=t[e],r=null;if(n&&(r=n.type===$.Error?iy(n.value):n.value,n.type===$.Prefix)){let e=n.value;r=n.inputs[0].value,e===`-`&&(r=-r)}a[e]=r}i[e]=a}let o=bE(i);l[a]=new nD(e,o.values,o.coords,void 0,o.isLiteral)}else{if(i!==$.Empty)return o||u.push(t),t;l[a]=void 0}});let m=xE(f.cells.size);f.cells.forEach((e,t)=>{let n=t.value,r=n.colIndex,i=n.rowIndex,a=n.$colIndex,o=n.$rowIndex,s={colStart:r,rowStart:i,colEnd:r,rowEnd:i,$colStart:a,$rowStart:o,$colEnd:a,$rowEnd:o};r===-(2**53-1)&&(s.colEnd=2**53-1),i===-(2**53-1)&&(s.rowEnd=2**53-1),n.scope&&(s.scope=n.scope),m[e]=s});let h=m.length,g=xE(h);for(let e=0;e<h;e++)g[e]={colStart:0,rowStart:0,colEnd:0,rowEnd:0,scope:null};let _=xE(f.references.size);f.references.forEach(e=>{_[e.index]=e});let v=[];f.rootReferences.forEach(e=>{v.push(e.index)});let y=u.length;for(let e=0;e<y;e++){let t=u[e],n=t.type;n===$.Infix?t.fn=Ky[t.value]:n===$.Prefix?t.fn=qy[t.value]:n===$.Postfix&&(t.fn=Jy[t.value])}let b,x=r?jv(Zn(e.getLocale()).decimal):Av,S={runtime:e,symbols:t,getFunction:a,ast:o,evaluations:l,executions:u,bindings:d,referencesAbsolute:g,referencesExecute:_,referencesRelative:m,referencesRoot:v,referenceIndices:f.referenceIndices,getTokens:()=>b??=Zy(o,r,x),namedIds:tb(o),symbolIds:ib(o),hasTotals:rb(o,a),isReferenceOnly:!p,error:i,transform:n=>{let s=sy(o,n);return s===o?S:ab(e,t,s,r,i,a)}};return S}function ob(e){let t=-1,r=-1;return Number.isSafeInteger(e.previousToken?.startLine)?(t=e.previousToken.startLine,r=e.previousToken.endColumn+1):Number.isSafeInteger(e.token?.startLine)&&(t=e.token.startLine,r=e.token.startColumn),t===-1?new n.a.Parse(e.message,{cause:e}):(e.errorLocation={line:t,column:r},new n.a.Parse(e.message,{line:t,column:r,cause:e}))}Object.freeze([[`:`,`.:.`,`.:`,`:.`],[`^`],[`*`,`/`],[`+`,`-`],[`&`],[`<`,`>`,`=`,`<>`,`<=`,`>=`]]);var sb=Object.freeze([`:`,`.:.`,`.:`,`:.`]),cb=Object.freeze([`:`,` `,`.:.`,`.:`,`:.`]),lb=Object.freeze([`@`]),ub=Object.freeze([`#`]),db=Object.freeze(cb.concat(ub)),fb=(Object.freeze(cb.concat(lb).concat(ub)),e=>{if(!e)return!1;let t=e.type;if(t===$.Cell||t===$.TableReference)return!0;if(t===$.Infix){if(!cb.includes(e.value))return!1;let t=e.inputs,n=t[0],r=t[1];return fb(n)&&fb(r)}return t===$.List&&(e.inputs?.every(fb)??!1)}),pb=e=>!!(e&&(e.type===$.Infix&&db.includes(e.value)||e.type===$.Postfix&&ub.includes(e.value)||e.type===$.Array||e.type===$.TableReference)),mb=Object.freeze([`+`,`-`,`*`,`/`,`^`,`&`,`=`,`<>`,`>`,`<`,`>=`,`<=`]),hb=Object.freeze([`-`,`+`]),gb=(e,t)=>{if(!e)return!1;let n=e.type;if(e.isLiteral)return n!==$.Error;if(n===$.Paren||n===$.List){let n=e.inputs;return!(!n||n.length===0)&&n.every(e=>gb(e,t))}if(n===$.Infix)return mb.includes(e.value);if(n===$.Prefix)return hb.includes(e.value);if(n===$.Postfix)return e.value===`%`;if(n===$.Function){if(!t)return!1;let n=t(e.value);if(!n)return!1;let r=n.getDeclaration().getReturnType(),i=r.getRangeType();return i!==`p`&&(i!==null||r.getLambda()===null&&r.getScalarType()!=null)}return!1},_b=(e,t)=>{if(!e)return null;let n=null,r=e=>{if(n||!e)return;if(e.type===$.Infix&&e.value===` `){let r=e.inputs,i=r?.[0],a=r?.[1];if(gb(i,t))return void(n=i);if(gb(a,t))return void(n=a)}let i=e.inputs;if(i)for(let e=0;e<i.length&&!n;e++)r(i[e])};return r(e),n},vb=e=>{for(let t=0;t<e.length;t++)if(e[t].getRepeatingTypes())return t;return-1},yb=(e,t,n)=>{let r=e[t].getRepeatingTypes(),i=r.length,a=t,o=e.length-t-1,s=o;for(;s>0&&e[t+s].isOptional();)s--;let c=+!e[t].isOptional(),l=r[i-1].isOptional();for(let e=s;e<=o;e++){let t=n-a-e;if(t>=0&&t%i===0&&t/i>=c)return{n:t/i,short:!1,variable:t,period:i,prefix:a,suffix:e};if(l&&t===i-1)return{n:1,short:!0,variable:t,period:i,prefix:a,suffix:e}}return null},bb=e=>{if(!e)return null;let t=null,n=e=>{if(t||!e)return;if(e.type===$.Array&&Array.isArray(e.value)){let n=e.value,r=n[0]?.value?.length??0;for(let e=1;e<n.length&&!t;e++){let i=n[e]?.value?.length??0;i!==r&&(t=`Array rows must all be the same length — row ${e+1} has ${i} value${i===1?``:`s`}, but row 1 has ${r}.`)}}let r=e.inputs;if(r)for(let e=0;e<r.length&&!t;e++)n(r[e])};return n(e),t},xb=(e,t)=>{if(!e||!t)return null;let n=null,r=e=>{if(n||!e)return;if(e.type===$.Function){let r=e.value,i=t(r);if(i){let t=i.getDeclaration().getParameters(),a=e.inputs?.length??0,o=t.length>0?vb(t):-1,s=t.length>0&&t[t.length-1].isRest();if(o>=0){if(!yb(t,o,a)){let e=t[o].getRepeatingTypes().length,i=t.length-1;n=e===1?`Too few arguments for ${r}. Expected at least ${i+1}, but got ${a}.`:`Wrong number of arguments for ${r}. Expected ${i} plus a multiple of ${e}, but got ${a}.`}}else if(!s&&a>t.length)n=`Too many arguments for ${r}. Expected ${t.length}, but got ${a}.`;else for(let e=a;e<t.length&&!n;e++){let i=t[e];i.isOptional()||i.isRest()||(n=`Parameter ${i.getName()} is missing for ${r}.`)}}}let i=e.inputs;if(i)for(let e=0;e<i.length&&!n;e++)r(i[e])};return r(e),n},Sb=(e,t)=>{if(!e||!t)return null;let n=null,r=e=>{if(n||!e)return;if(e.type===$.Function){let r=t(e.value);if(r){let i=r.getDeclaration().getParameters(),a=e.inputs;if(i.length>0&&a){let e=((e,t)=>{let n=Array(t),r=e.length,i=r>0?vb(e):-1;if(i<0){let i=r>0?e[r-1]:null,a=!!i&&i.isRest();for(let o=0;o<t;o++)n[o]=o<r?e[o]:a?i:null;return n}let a=e[i].getRepeatingTypes(),o=a.length,s=i,c=yb(e,i,t),l=c?c.suffix:r-i-1,u=Math.max(0,t-s-l);for(let c=0;c<t;c++)if(c<s)n[c]=e[c];else if(c<s+u)n[c]=a[(c-s)%o];else{let t=i+1+(c-s-u);n[c]=t<r?e[t]:null}return n})(i,a.length);for(let r=0;r<a.length&&!n;r++){let i=e[r];i&&i.getRangeType()===`p`&&gb(a[r],t)&&(n=a[r])}}}}let i=e.inputs;if(i)for(let e=0;e<i.length&&!n;e++)r(i[e])};return r(e),n},Cb=(e,t)=>{if(!e)return null;let n=null,r=e=>{if(n||!e)return;if(e.type===$.Call){let r=e.inputs?.[0];if(r&&gb(r,t))return void(n=`This expression always produces a value, so it cannot be called as a function.`)}let i=e.inputs;if(i)for(let e=0;e<i.length&&!n;e++)r(i[e])};return r(e),n},wb=(e,t)=>{if(e.type!==$.Function)return;let n=e.value;if(typeof n!=`string`)return;let r=(t?.(n)?.getName()??n).toUpperCase();return r===`LET`?`let`:r===`LAMBDA`?`lambda`:void 0},Tb=e=>{if(e?.type!==$.Named)return;let t=e.value;return t?.nameId&&!t.scope&&!0!==t.optional?t.nameId:void 0},Eb=/^[A-Za-z_\\][A-Za-z0-9_\\]*$/,Db=new Set([`TRUE`,`FALSE`]),Ob=e=>{if(e?.type===$.Named){let t=e.value;return!0!==t?.optional||!t.nameId||t.scope?void 0:t.nameId}if(e?.type!==$.TableReference)return;let t,n=e.value;if(n===null||typeof n==`string`){if(n)return;let r=e.inputs;if(!r||r.length!==1||r[0]?.type!==$.TableColumn)return;let i=r[0].value;if(typeof i!=`string`)return;t=i}else{let e=n;if(!e||e.tableId!==``||e.spec!==0||!0===e.isThisRow||!e.columnFromId||e.columnFromId!==e.columnToId)return;t=e.columnFromId}return Eb.test(t)&&!Db.has(t.toUpperCase())&&e.image===`[${t}]`?t:void 0},kb=e=>{let t=Xv(e.image??e.value);t.image=e.image??e.value,t.wsBefore=e.wsBefore;let n={type:$.Call,value:null,inputs:[t,...e.inputs??[]],wsAfter:e.wsAfter};return e.error&&(n.error=e.error),n};function Ab(e,t){return e&&t?sy(e,e=>{if(e.type===$.Function&&typeof e.value==`string`&&!t(e.value))return kb(e)}):e}function jb(e,t=null){if(!e)return e;let n=[],r=0,i=e=>{let t,n=e.inputs;if(!n)return e;for(let e=0;e<n.length;e++){let r=n[e];if(!r)continue;let i=a(r);i!==r&&(t||=[...n],t[e]=i)}return t?{...e,inputs:t}:e},a=e=>{if(!e)return e;let o=wb(e,t);if(o)return((e,t)=>{let o=e.inputs,s=o?.length??0;if(!o||s<1)return i(e);let c=n.length,l=[],u=[...o],d=(e,t=!1)=>{let i=u[e],a=Tb(i),o=!1;if(a===void 0&&t){if(a=Ob(i),a===void 0)return;o=!0}else if(a===void 0)return;let s=r++;n.push({key:a.toUpperCase(),slot:s,name:a}),l.push(s),u[e]=o?{...i,type:$.Named,value:{nameId:a,scope:null},inputs:null,binding:{slot:s,declaration:!0,optional:!0},isReference:!1}:{...i,binding:{slot:s,declaration:!0},isReference:!1}};if(t===`lambda`){for(let e=0;e<s-1;e++)d(e,!0);u[s-1]&&(u[s-1]=a(u[s-1]))}else{for(let e=0;e+1<s;e+=2)u[e+1]&&(u[e+1]=a(u[e+1])),d(e);s%2==1&&u[s-1]&&(u[s-1]=a(u[s-1]))}for(;n.length>c;)n.pop();return{...e,inputs:u,binder:{kind:t,slots:l}}})(e,o);if(e.type===$.Function&&typeof e.value==`string`){let t=e.value.toUpperCase();if(n.some(e=>e.key===t))return i(kb(e))}if(e.type===$.Named){let t=Tb(e);if(t!==void 0){let r=t.toUpperCase();for(let i=n.length-1;i>=0;i--){if(n[i].key!==r)continue;let a={...e,binding:{slot:n[i].slot},isReference:!1};return t!==n[i].name&&(a.value={...e.value,nameId:n[i].name}),a}}return e}let s=i(e);if(s.type===$.Function&&typeof s.value==`string`&&(t?.(s.value)?.getName()??s.value).toUpperCase()===`ISOMITTED`){let e=s.inputs;if(e){let t;for(let n=0;n<e.length;n++){let r=e[n];r?.binding&&!r.binding.declaration&&!0!==r.rawFrameRead&&((t??=[...e])[n]={...r,rawFrameRead:!0})}if(t)return{...s,inputs:t}}}return s};return a(e)}var Mb=(e,t)=>{if(!e)return null;let n=null,r=e=>{if(n||!e)return;let i=wb(e,t);i&&((e,t)=>{let r=t===`let`?`LET`:`LAMBDA`,i=e.inputs,a=i?.length??0;if(!i||a<2)return;if(t===`let`&&a%2==0)return void(n=`Wrong number of arguments for LET. Expected name/value pairs followed by a calculation, but got ${a}.`);let o=new Set,s=t===`let`?2:1,c=!1;for(let e=0;e<a-1;e+=s){let a=Tb(i[e]);if(a===void 0&&t===`lambda`)a=Ob(i[e]),a!==void 0&&(c=!0);else if(a!==void 0&&c)return void(n=`Required name '${a}' cannot follow an optional name in ${r}.`);if(a===void 0)return void(n=`Expected a name in ${r} argument ${e+1}; a name cannot be the output of a formula.`);if(a.includes(`.`))return void(n=`Expected a name in ${r} argument ${e+1}; a name cannot contain '.'.`);let s=a.toUpperCase();if(o.has(s))return void(n=`Duplicate name '${a}' in ${r}.`);o.add(s)}})(e,i);let a=e.inputs;if(a)for(let e=0;e<a.length&&!n;e++)r(a[e])};return r(e),n};function Nb(e,t,n){return sy(e,(e,r,i=[])=>{let a,o=e.type;if(o===$.Cell){let n=e.value;if(n?.scope){let r=t.bind(Sd,n.scope);r!==null&&(a||={...e},a.value={...n,scope:r})}}else if(o===$.Named){let r=e.value;if(r&&!e.binding){let i=r.scope?t.bind(Sd,r.scope):null,o=(i===null?r.scope:t.resolve(Sd,i)?.toString()??r.scope)??n,s=t.bind(Cd,r.nameId,o?{scope:o}:void 0);s===null&&i===null||(a||={...e},a.value={...r,nameId:s??r.nameId,...i===null?void 0:{scope:i}})}}else if(o===$.Error){let n=e.value;if(n?.scope){let r=t.bind(Sd,n.scope);r!==null&&(a||={...e},a.value={...n,scope:r})}}else if(o===$.TableReference){let n=e.value;if(n){let r=t.bind(wd,n);a||={...e},r!==null&&(a.value=r)}}else if(o===$.TableColumn){let n=e.value;if(n){let r=Yy(i,$.TableReference)?.value,o=t.bind(Td,n,r?{tableName:r}:void 0);a||={...e},o!==null&&(a.value=o)}}else if(o===$.Function){let n=e.value;if(n){let r=t.bind(Ed,n);a||={...e},r!==null&&(a.value=r)}}return a})}var Pb=Symbol(`sheetxl.formulaNode.internal`),Fb=Symbol(`sheetxl.formulaNode.value`),Ib=Symbol(`sheetxl.formulaNode.replaced`),Lb={canonical:!0},Rb=(e,t)=>{let n=e.inputs,r=null;if(n){let e=n.length;r=Array(e);for(let i=0;i<e;i++){let e=n[i];r[i]=e&&Rb(e,t)}}let i=((e,t)=>{let n=e.type,r=e.value;if(n===$.Named){let n=r,i=n?.nameId,a=n?.scope??null;return t&&(i=t.resolve(Cd,i)?.toString()??i,a&&=t.resolve(Sd,a)?.toString()??a),e.binding?.declaration&&e.binding.optional?{name:i,scope:a,optional:!0}:{name:i,scope:a}}if(!t)return r;switch(n){case $.Function:return t.resolve(Ed,r,Lb)?.toString()??r;case $.TableReference:{let e=typeof r==`string`?r:r?.tableId;return e?t.resolve(wd,e)?.toString()??e:``}case $.TableColumn:return t.resolve(Td,r)?.toString()??r;case $.Cell:{let e=r;if(e?.scope){let n=t.resolve(Sd,e.scope)?.toString()??e.scope;return{...e,scope:n}}return r}case $.Error:{let e=r;if(e?.scope){let n=t.resolve(Sd,e.scope)?.toString()??e.scope;return{...e,scope:n}}return r}default:return r}})(e,t);return{type:e.type,value:i,inputs:r,isReference:e.isReference,[Pb]:e,[Fb]:i}},zb=(e,t,n)=>{let r,i=e.inputs;if(i){let t=i.length;for(let a=0;a<t;a++){let t=i[a];if(!t)continue;let o=zb(t,e,n);o!==t&&(r||=[...i],r[a]=o)}}let a=e;r&&(a={...e,inputs:r});let o=n(a,t);return o==null||o===a?a:(o[Pb]===void 0&&a[Pb]!==void 0&&(o[Ib]=a[Pb]),o)},Bb=[`:`,`.:.`,`.:`,`:.`,` `],Vb=(e,t)=>{let n=e.type,r=e.value;switch(n){case $.Function:return Vv(String(r),t);case $.Infix:return Kv(r,t[0],t[1],e.isReference??Bb.includes(r));case $.Prefix:return Jv(r,t?.[0],e.isReference??r===`@`);case $.Postfix:return qv(r,t?.[0],e.isReference??r===`#`);case $.Named:{let e=Xv(typeof r==`string`?r:r?.name),t=typeof r==`object`?r?.scope:null;return t&&(e.value={...e.value,scope:t}),typeof r==`object`&&!0===r?.optional&&(e.value={...e.value,optional:!0}),e}case $.Cell:{let e=r,t=Rv(e);return e?.scope&&(t.value.scope=e.scope),t}case $.TableReference:return{type:$.TableReference,value:r,inputs:t??null,isReference:!0};case $.TableSpecifier:return{type:$.TableSpecifier,value:r,image:`[${r}]`,inputs:null,isReference:!0};case $.TableColumn:{let e=typeof r==`string`&&r.startsWith(`[`)?r:`[${r}]`;return{type:$.TableColumn,value:r,image:e,inputs:null,isReference:!0}}default:return{type:n,value:r,inputs:t??null,isReference:e.isReference}}},Hb=e=>{let t=e[Pb],n=e.inputs,r=null;if(n){let e=n.length;r=Array(e);for(let t=0;t<e;t++){let e=n[t];r[t]=e&&Hb(e)}}if(t){let n=e.value!==e[Fb],i=!1,a=t.inputs;if(r&&a&&r.length===a.length){for(let e=0;e<r.length;e++)if(r[e]!==a[e]){i=!0;break}}else i=(r?.length??0)!==(a?.length??0);if(!n&&!i)return t;if(!n)return{...t,inputs:r};let o=Vb(e,r);return Ub(o,t),o}let i=Vb(e,r),a=e[Ib];return a&&Ub(i,a),i},Ub=(e,t)=>{cy(e,t),e.type!==t.type&&e.image!==void 0&&(e.image=void 0)};function Wb(e,t,n){if(!e||typeof t!=`function`)return e;let r=Rb(e,n),i=zb(r,void 0,t);return i===r?e:Hb(i)}var Gb=class{constructor(e,t,n,r,i,a,o,s){this.params=e,this.body=t,this.owner=n,this.compiled=r,this.regs=i,this.frame=a,this.anchorRow=o,this.anchorCol=s,this.isLambda=!0}makeCallable(){let e=this.params,t=e.length;for(;t>0&&e[t-1].optional;)t--;let n=(...e)=>this.owner._applyValues(this,e);return n.isLambdaCallable=!0,n.checkArity=n=>n>=t&&n<=e.length,n.paramCount=e.length,n}get[Symbol.toStringTag](){return`[LambdaValue(${this.params.map(e=>e.name).join(`,`)})]`}},Kb=class{constructor(e){this.fn=e,this.isLambda=!0}makeCallable(){let e=this.fn,t=(...t)=>{try{return e.execute(...t)}catch(e){return n.a.isError(e)?e:new n.a.Value(e?.message,{cause:e})}};return t.isLambdaCallable=!0,t.checkArity=()=>!0,t.paramCount=-1,t}get[Symbol.toStringTag](){return`[FunctionValue(${this.fn.getName?.()??``})]`}},qb=Symbol(`sheetxl.lambda.omitted`);function Jb(e,t,n=!1){if(!t)return e;let r=n?{canonical:!0}:void 0,i=e.length,a=Array(i);for(let n=0;n<i;n++){let i=e[n],o=i.type;if(o===$.Cell){let e=i.value;if(e?.scope){let r=t.resolve(Sd,e.scope)?.toString();if(r){let t=i.text===void 0||i.text.includes(`!`)?i.text:_l(r)+`!`+i.text;a[n]={...i,value:{...e,scope:r},text:t};continue}}a[n]=i}else if(o===$.Named){let e=i.value,r=e.name,o=t.resolve(Cd,r)?.toString()??r,s=e.scope;if(s){let r=t.resolve(Sd,s)?.toString()??s,c=i.text===void 0||i.text.includes(`!`)?i.text:_l(r)+`!`+i.text;a[n]={...i,value:{...e,name:o,scope:r},text:c}}else a[n]=o===r?i:{...i,value:{...e,name:o}}}else if(o===$.Error){let e=i.value,r=e?.scope;if(r){let o=t.resolve(Sd,r)?.toString()??r,s=i.text===void 0||ay(i.text)?i.text:_l(o)+`!`+i.text;a[n]={...i,value:{...e,scope:o},text:s}}else a[n]=i}else if(o===$.TableReference){let e=i.value,r=t.resolve(wd,e)?.toString()??e,o=i.text===e?r:i.text;a[n]=r===e?i:{...i,value:r,text:o}}else if(o===$.TableColumn){let e=i.value,r=e.startsWith(`[`)&&e.endsWith(`]`),o=r?e.slice(1,-1):e,s=t.resolve(Td,o)?.toString()??o,c=r?`[${s}]`:s,l=i.text===e?c:i.text;a[n]=c===e?i:{...i,value:c,text:l}}else if(o===$.Function){let e=i.value,o=t.resolve(Ed,e,r)?.toString()??e;a[n]=o===e?i:{...i,value:o}}else a[n]=i}return function(e,t,n){let r,i=e.length;for(let a=0;a<i;a++){let i=e[a],o=i.context;if(!o)continue;r??=new Map;let s=r.get(o);if(s===void 0){let e=o.type===`table`?wd:Ed,i=t.resolve(e,o.name,n)?.toString()??(e===Ed?t.resolve(Cd,o.name)?.toString():void 0)??o.name;s=i===o.name?o:{...o,name:i},r.set(o,s)}s!==o&&(e[a]={...i,context:s})}return e}(a,t,r)}function Yb(e,t,n=!1,r=0,i=0,a=Pv){let o=``,s=Gl,c=Wl,l=a.separators,u=e.length;for(let d=0;d<u;d++){let u=e[d],f=u.type;if(f===$.Cell){let a=u.value;if(!n&&u.refSide===`left`&&!a.scope){let n=e[d+1],s=e[d+2];if(n&&n.value===`:`&&s&&s.type===$.Cell&&s.referenceIndex===u.referenceIndex){let e=s.value,n=bl(Kl({colStart:a.colIndex,rowStart:a.rowIndex,colEnd:e.colIndex,rowEnd:e.rowIndex,$colStart:a.$colIndex,$rowStart:a.$rowIndex,$colEnd:e.$colIndex,$rowEnd:e.$rowIndex},r,i),t);if(n!==null){o+=n,d+=2;continue}}}let l=a.colIndex;if(!a.$colIndex&&l!==-(2**53-1)&&l!==2**53-1&&!n){let e=l+i;if(e<0||!a.scope&&t&&(e<t.colStart||e>t.colEnd)){o+=`#REF!`;continue}}let f=a.rowIndex;if(!a.$rowIndex&&f!==-(2**53-1)&&f!==2**53-1&&!n){let e=f+r;if(e<0||!a.scope&&t&&(e<t.rowStart||e>t.rowEnd)){o+=`#REF!`;continue}}o+=n?c(a):s(a,r,i)}else if(f===$.Named){let e=u.value;e.scope&&(o+=_l(e.scope)+`!`),o+=e.optional?`[${e.name}]`:e.name}else if(f===$.TableReference)o+=u.value;else if(f===$.TableColumn)o+=u.value;else if(f===$.TableSpecifier)o+=Zb(u.value,a);else if(f===$.Empty)o+=``;else if(f===$.Boolean)o+=a.localizeBoolean(u.value);else if(f===$.Function)o+=u.value;else if(f===$.Separator)o+=u.value===`;`?l.separatorRow:l.separatorFunction;else if(f===$.Number){let e=String(u.value);o+=l.separatorDecimal===`.`?e:e.replace(`.`,l.separatorDecimal)}else if(f===$.Error){let e=u.value;e?.scope&&(o+=_l(e.scope)+`!`),o+=a.localizeError(e?.error??u.value)}else o+=u.value}return o}function Xb(e,t,n=Pv){return Yb(e,t,!0,0,0,n)}function Zb(e,t){if(!t.localizeSpecifier)return e;let n=e.startsWith(`[`)&&e.endsWith(`]`),r=n?e.slice(1,-1):e;if(!r.startsWith(`#`))return e;let i=`#`+t.localizeSpecifier(r.slice(1));return n?`[${i}]`:i}var Qb=class t{constructor(e,t,n,r,i,a){this._gridId=null,this._resolvers=null,this._compiled=e,this._context=t,this._calcScope=n,this._gridId=r,this._getEntireCoords=i,this._resolvers=a??null}getTextAt(e,t,n=!1,r,i,a){let o=this._compiled;if(r){let e=Wb(o.ast,r,o.symbols);e!==o.ast&&(o=ab(o.runtime,o.symbols,e,!0,null,o.getFunction))}if(o.error&&!o.ast)return o.error.input;let s=i===void 0?o.getTokens():$y(o.ast,i);s=Jb(s,o.symbols,a);let c=a?Pv:this._displayLocale();return n?Xb(s,this._getEntireCoords?.(),c):function(e,t,n=0,r=0,i=Pv){return Yb(e,t,!1,n,r,i)}(s,this._getEntireCoords?.(),e,t,c)}_displayLocale(){return Fv(jv(this._context.getRuntime().getLocaleProfile().decimal))}getTokensAt(e,t,n){let r=this._compiled,i=n===void 0?r.getTokens():$y(r.ast,n);return i=Jb(i,r.symbols),function(e,t=0,n=0){let r=e.length,i=[];for(let a=0;a<r;a++){let r=e[a];if(r.type!==`cell`){i[a]=r;continue}let o={...r},s={...o.value};o.value=s,i[a]=o,s.colIndex===-(2**53-1)||s.$colIndex||(s.colIndex+=n),s.rowIndex===-(2**53-1)||s.$rowIndex||(s.rowIndex+=t)}return i}(i,e,t)}getError(){return this._compiled.error??null}getNamedIds(){return this._compiled?.namedIds??e.A.EmptyArray}getReferencedSymbolIds(){return this._compiled?.symbolIds??e.A.EmptyArray}hasTotals(){return this._compiled?.hasTotals??!1}isReferenceOnly(){return this._compiled.isReferenceOnly}isEquals(e){if(!(e&&e instanceof t))return!1;if(this===e)return!0;let n=this._compiled.getTokens(),r=e._compiled.getTokens();if(n.length!==r.length)return!1;let i=this._context.getEntireCoords();return Xb(n,i)===Xb(r,i)}getReferences(t,r){let i=this._compiled,a=i.referenceIndices,o=a.length;if(o===0)return e.A.EmptyArray;let s=i.referencesExecute,c=i.referencesRelative,l=xE(o);for(let e=0;e<o;e++){let i=s[a[e]],o=i.inputs;if(o&&o.length===2){let t=c[s[o[0]].value],n=c[s[o[1]].value];l[e]={colStart:t.colStart,rowStart:t.rowStart,colEnd:n.colEnd,rowEnd:n.rowEnd,$colStart:t.$colStart,$rowStart:t.$rowStart,$colEnd:n.$colEnd,$rowEnd:n.$rowEnd,scope:t.scope}}else if(i.node.type===$.Cell)l[e]={...c[i.value]};else if(i.op===$.Named){let t=i.node.value.nameId;l[e]={nameId:this._compiled.symbols?.resolve(Cd,t)?.toString()??t}}else if(i.op===$.TableReference){let a=i.node.value,o=this._resolveStructuredRef(a,t,r);!o||n.a.isError(o)?l[e]=null:l[e]=o}else i.op===$.Error&&(l[e]=null)}return l}getReferenceAt(e,t,n){let r=this.getReferences(e,t);return n>=0&&n<r.length?r[n]:null}setReferenceAt(r,i,a){let o=this._compiled,s=o.referenceIndices;if(s.length===0)return null;let c=o.referencesExecute;r<0&&(r=s.length+r);let l=s[r];if(l===void 0)throw Error(`Invalid reference index: ${r}`);let u,d,f=c[l],p=f.node,m=p.inputs??e.A.EmptyArray,h=f.op===$.Named,g=!1;i&&n.a.isError(i)&&(i=null),i&&`nameId`in i&&!h&&(i=null);let _=i&&`nameId`in i?null:i,v=!!_&&_.colIndex!==void 0;if(_)if(v){let e=_;u={colIndex:e.colIndex,rowIndex:e.rowIndex,$colIndex:e.$colIndex??!1,$rowIndex:e.$rowIndex??!1},e.scope&&(u.scope=e.scope),g=!1}else{let t=_;u={colIndex:t.colStart,rowIndex:t.rowStart,$colIndex:t.$colStart??!1,$rowIndex:t.$rowStart??!1},t.scope&&(u.scope=t.scope),g=!e.l.isSingleCell(t),g&&(d={colIndex:t.colEnd,rowIndex:t.rowEnd,$colIndex:t.$colEnd??!1,$rowIndex:t.$rowEnd??!1},t.colEnd===2**53-1&&(d.colIndex=-(2**53-1)),t.rowEnd===2**53-1&&(d.rowIndex=-(2**53-1)))}let y=m.length===2,b=v&&y,x=-1,S=-1,C=-1,w=-1;if(y)x=m[0].evalIndex,S=m[1].evalIndex;else if(p.type===`cell`)x=p.evalIndex;else if(f.op===$.TableReference)C=p.evalIndex;else{if(!h)throw Error(`Invalidate reference index: ${r}`);w=p.evalIndex}let T=(...e)=>{if(a?.scopeDeleted)return null;let t=this._compiled.symbols;for(let n=0;n<e.length;n++){let r=e[n]?.value?.scope;if(r)return t&&!t.resolve(Sd,r)?null:r}return null},E=p,D=this._compiled.ast,O=sy(D,t=>{if(!t||!t.isReference)return;if(b&&t===E){let e=Rv(u);return u.scope&&(e.value.scope=u.scope),e}let n=t.type;if(w!==-1&&t.evalIndex===w&&n===$.Named){if(!i)return ry();if(i&&`nameId`in i){let e=i,n=this._compiled.symbols?.bind(Cd,e.nameId)??e.nameId,r={...t};return r.value={...t.value,...e,nameId:n},r}return g?Kv(`:`,Rv(u),Rv(d),!0):Rv(u)}if(C!==-1&&t.evalIndex===C&&n===$.TableReference)return i?g?Kv(`:`,Rv(u),Rv(d),!0):Rv(u):ry();if(!i&&sb.includes(t.value)){let n=t.inputs??e.A.EmptyArray,r=n[0],i=n[1],a=r.evalIndex===x,o=i.evalIndex===S;if(a||o){let e=ry(void 0,void 0,T(r,i));return e.evalIndex=t.evalIndex,e}}if(n!==`cell`&&n!==`error`)return;let r,a=t.evalIndex,o=a===x;if((o||a===S)&&!b){if(i)if(y===g){let e=o?u:d;r={...t},r.value=e,r.image=null}else r=g?Kv(`:`,Rv(u),Rv(d),!0):Rv(u);else r=ry(void 0,void 0,T(t)),r.evalIndex=t.evalIndex;return r}});if(O===D)return this;let k=ab(o.runtime,o.symbols,O,!1,o.error);return new t(k,this._context,this._calcScope,this._gridId,this._getEntireCoords,this._resolvers)}reanchorReferences(e,n){let r=this._compiled,i=this._gridId,a=this._compiled.symbols.bind(Sd,e),o=r.transform((e,t)=>{if(!e||!e.isReference||e.type!==$.Cell||pb(t)&&t.inputs?.[0]!==e)return;let r,o=e.value.scope;return(!o||n&&o===i)&&(r={...e},r.value={...r.value},r.value.scope=a),r});return r===o&&a===i?this:new t(o,this._context,this._calcScope,i,this._getEntireCoords,this._resolvers)}replaceSheetReferences(e,n){let r=this._compiled,i=r.symbols.bind(Sd,e),a=r.symbols.bind(Sd,n);if(i===a)return this;let o=r.transform((e,t)=>{if(!e||!e.isReference||e.type!==$.Cell||pb(t)&&t.inputs?.[0]!==e||e.value.scope!==i)return;let n={...e};return n.value={...n.value},n.value.scope=a,n});return r===o?this:new t(o,this._context,this._calcScope,this._gridId,this._getEntireCoords,this._resolvers)}_evaluateNamed(e,t,r){let i=e.nameId,a=this._calcScope;if(a.activeNames.has(i))return n.a.BuiltIn.Ref;let o=this._resolvers?.getNamedFormulaBlock?.(i);if(!o){let e=this._compiled,t=e.symbols?.resolve(Cd,i),r=t?t.toString():i,a=e.getFunction?.(r)??null;return a?new Kb(a):n.a.BuiltIn.Name}let s=a.gridId,c=a.rowIndex,l=a.colIndex;a.activeNames.add(i),a.depth++;try{return o.evaluateAt(t,r)}finally{a.depth--,a.activeNames.delete(i),a.gridId=s,a.rowIndex=c,a.colIndex=l}}_resolveNamedPrecedents(t,r,i){let a=t.nameId,o=this._calcScope;if(o.activeNames.has(a))return e.A.EmptyArray;let s=this._resolvers?.getNamedFormulaBlock?.(a);if(!s)return n.a.BuiltIn.Name;o.activeNames.add(a);try{return s.resolvedPrecedentsAt(r,i)}finally{o.activeNames.delete(a)}}_resolveStructuredRef(e,t,r,i){let a=this._resolvers?.getStructureReferenceCoords;return a?a(e,t,r,this._gridId):n.a.BuiltIn.Name}resolvedPrecedentsAt(t,r,i=!1,a,o){let s=this._compiled,c=s.referencesRoot,l=c.length;if(l===0)return e.A.EmptyArray;let u=s.referencesRelative,d=s.referencesAbsolute,f=u.length;for(let e=0;e<f;e++){let n=u[e],i=d[e];d[e]=$b(n,t,r,i)}let p=s.referencesExecute,m=p.length,h=[];for(let e=0;e<m;e++){let i=p[e],a=i.op;if(!a){let e=d[i.value];h[i.index]=e;continue}if(a===$.Named){h[i.index]=this._resolveNamedPrecedents(i.node.value,t,r);continue}if(a===$.Error){h[i.index]=iy(i.node.value);continue}if(a===$.TableReference){let e,a=i.node.value;a&&(e=this._resolveStructuredRef(a,t,r)),e||=n.a.BuiltIn.Ref,h[i.index]=e;continue}if(a===`@`||a===`#`){let e=h[i.inputs[0]];h[i.index]=e===void 0?n.a.BuiltIn.Value:e;continue}let o=i.inputs;if(!o)continue;let s=h[o[0]];if(s===void 0){h[i.index]=n.a.BuiltIn.Value;continue}if(n.a.isError(s)){h[i.index]=s;continue}let c,l=h[o[1]];if(l!==void 0)if(n.a.isError(l))h[i.index]=l;else{if(a===` `)c=su(s,l);else if(a===`:`||a===`.:.`||a===`:.`||a===`.:`)c=cu(s,l);else if(a===`,`){let e=o.length;for(let t=0;t<e;t++){let e=h[o[t]];e===void 0||Array.isArray(e)||n.a.isError(e)||(c=c?cu(c,e):e)}}h[i.index]=c??n.a.BuiltIn.Null}else h[i.index]=n.a.BuiltIn.Value}let g=[],_=0;for(let e=0;e<l;e++)_=ex(c[e],p,h,g,_,a,o);return g}evaluateAt(e,t,r){let i=this._calcScope;i.rowIndex=e,i.colIndex=t,i.gridId=this._gridId;let a=this._context,o=this._compiled;if(r!==void 0){let n;if(sy(o.ast,e=>{e.evalIndex===r&&(n=e)}),!n)throw Error(`Invalid evalIndex: ${r}`);if(o.bindings.length>0&&!o.error){let n=this.evaluateAt(e,t),i=o.evaluations;return n&&typeof n.then==`function`?n.then(()=>i[r]):i[r]}o=ab(a.getRuntime(),o.symbols,n,!1)}if(o.error)return o.error.cause;let s,c=o.evaluations,l=o.executions;o.bindings;let u=o.referencesExecute,d=o.referencesRelative,f=o.referencesAbsolute,p=u.length;for(let r=0;r<p;r++){let i=u[r],o=i.op,s=i.node;if(o)if(o===$.Named)if(i.node.deferredResolve)c[i.node.evalIndex]=null;else{let n=i.node.value;c[i.node.evalIndex]=this._evaluateNamed(n,e,t)}else if(o===$.Error)c[s.evalIndex]=iy(i.node.value);else if(o===$.TableReference){let r,o=i.node.value;r=o?this._resolveStructuredRef(o,e,t):n.a.BuiltIn.Ref,n.a.isError(r)||r?.colStart===void 0?c[s.evalIndex]=r??n.a.BuiltIn.Ref:c[s.evalIndex]=a.getReference(r)}else o===`structured`&&(c[s.evalIndex]=null);else{let n=d[i.value],a=f[r],o=Kl(n,e,t,a);c[s.evalIndex]=o}}let m=l.length;for(let n=0;n<m;n++){let r=l[n];if(s)s=s.then(()=>{let n=this._executeNode(r,c,e,t);return c[r.evalIndex]=n,n});else{let n=this._executeNode(r,c,e,t);c[r.evalIndex]=n,n&&typeof n.then==`function`&&(s=n)}}return s?s.then(()=>c[o.ast.evalIndex]):c[o.ast.evalIndex]}wrapImplicit(e,n,r){let i=this._compiled,a=i.ast;if(!a||!a.isReference||a.type===`cell`||a.value===`@`||!r)return this;let o=fl(n)+dl(e);if(r.has(o))return this;let s=Jv(`@`,a,!0),c=ab(i.runtime,i.symbols,s,!1,i.error);return new t(c,this._context,this._calcScope,this._gridId,this._getEntireCoords,this._resolvers)}_executeNode(e,t,r,i){let a,o=this._context,s=e.inputs,c=s?s.length:0,l=e.type;switch(l){case $.Infix:{let r=e.value,i=t[s[0].evalIndex],c=t[s[1].evalIndex];if(typeof i==`number`&&typeof c==`number`){if(r===`+`)return yE(i+c,null);if(r===`-`)return yE(i-c,null)}if(!e.isReference){if(i&&n.a.isError(i))return i;if(c&&n.a.isError(c))return c}let l=e.fn??=Ky[e.value];return a=l?l(o,i,c):n.a.BuiltIn.Value,a=yE(a,null),a}case $.Function:{let l=e.binder;if(l!==void 0)return l.kind===`let`?t[s[c-1].evalIndex]:this._createLambdaValue(e,t,null,r,i);for(let e=0;e<c;e++)nx[e]=t[s[e].evalIndex];return a=this._callFunction(e,nx,c),a&&typeof a.then==`function`&&a.then(n=>{n=yE(n,o),t[e.evalIndex]=n}).catch(r=>{let i=n.a.isError(r)?r:new n.a.Value(`Uncaught error`,{cause:r});t[e.evalIndex]=i}),a}case $.Prefix:case $.Postfix:{let r=t[s[0].evalIndex];if(r&&n.a.isError(r))return r;let i=e.fn??=l===$.Prefix?qy[e.value]:Jy[e.value];return a=i?i(o,r):n.a.BuiltIn.Value,a}case $.List:case $.Paren:{if(c===1)return t[s[0].evalIndex];let e=xE(c);for(let n=0;n<c;n++)e[n]=t[s[n].evalIndex];return e}case $.Named:{let r=e.binding;if(r!==void 0){let e=this._compiled.bindings[r.slot];return e>=0?t[e]:n.a.BuiltIn.Calc}return t[e.evalIndex]??null}case $.TableReference:return t[e.evalIndex]??null;case $.Call:{let r=t[s[0].evalIndex];return r&&n.a.isError(r)?r:(a=this._applyCallee(r,e,t),a&&typeof a.then==`function`&&a.then(n=>{t[e.evalIndex]=yE(n,o)}).catch(r=>{t[e.evalIndex]=n.a.isError(r)?r:new n.a.Value(`Uncaught error`,{cause:r})}),a)}case $.Empty:return}}_createLambdaValue(e,t,n,r,i){let a=e.inputs,o=[];for(let e=0;e<a.length-1;e++){let t=a[e];t?.binding?.declaration&&o.push({slot:t.binding.slot,name:t.value.nameId,optional:!0===t.binding.optional})}return new Gb(o,a[a.length-1],this,this._compiled,t.slice(),n,r,i)}_applyCallee(e,t,r){if(e?.isIRange&&!e.isIReferenceRange&&e.size===1&&(e=e.getValueAt(0,0))&&n.a.isError(e))return e;let i=t.inputs,a=i.length-1;if(e instanceof Gb){let t=e.params,o=t.length;for(;o>0&&t[o-1].optional;)o--;if(a>t.length||a<o)return n.a.BuiltIn.Value;let s=new Map(e.frame??void 0);for(let e=0;e<t.length;e++){let o=t[e];if(e>=a||i[e+1]?.type===$.Empty){if(!o.optional)return n.a.BuiltIn.Value;s.set(o.slot,qb)}else s.set(o.slot,r[i[e+1].evalIndex])}return e.owner._evaluateBody(e,s)}if(e instanceof Kb){let t=[];for(let e=1;e<i.length;e++)t.push(i[e]?.type===$.Empty?void 0:r[i[e].evalIndex]);return this._dispatchFunction(e.fn,t,t.length)}return e&&(e.isIRange||e.colStart!==void 0)?n.a.BuiltIn.Ref:n.a.BuiltIn.Value}_applyValues(e,t){let r=e.params;if(t.length>r.length)return n.a.BuiltIn.Value;let i=new Map(e.frame??void 0);for(let e=0;e<r.length;e++){let a=r[e],o=e<t.length?t[e]:void 0;if(o===void 0){if(!a.optional)return n.a.BuiltIn.Value;i.set(a.slot,qb)}else i.set(a.slot,o)}let a=this._evaluateBody(e,i);return a&&typeof a.then==`function`?a:yE(a,this._context)}_evaluateBody(e,t){let r=this._calcScope;if(r.depth>=512)return n.a.BuiltIn.Num;let i=e.compiled.bindings,a=e.regs.slice(),o=e.anchorRow,s=e.anchorCol,c=e=>{let r=e.type;if(r===$.Cell||r===$.TableReference||r===$.Error||e.isLiteral)return a[e.evalIndex];if(r===$.Empty||e.binding?.declaration)return;if(r===$.Named){let r=e.binding;if(r!==void 0){let o=i[r.slot];if(o>=0)return a[o];if(t.has(r.slot)){let n=t.get(r.slot);return!0===e.rawFrameRead?n:(l=n)===qb?null:l}return n.a.BuiltIn.Calc}return this._evaluateNamed(e.value,o,s)}var l;let u=e.binder;if(u!==void 0&&u.kind===`lambda`)return this._createLambdaValue(e,a,t,o,s);let d,f=e.inputs;if(f){let e=t=>{for(let n=t;n<f.length;n++){let t=f[n];if(!t)continue;let r=c(t);if(a[t.evalIndex]=r,r&&typeof r.then==`function`){let i=n+1;return r.then(n=>(a[t.evalIndex]=yE(n,this._context),e(i)))}}};d=e(0)}return d?d.then(()=>this._executeNode(e,a,o,s)):this._executeNode(e,a,o,s)};r.depth++;try{return c(e.body)}catch(e){return n.a.isError(e)?e:e instanceof RangeError?n.a.BuiltIn.Num:new n.a.Value(e?.message,{cause:e})}finally{r.depth--}}_callFunction(e,t,r){let i=this._context,a=e?.cacheFn??i.getFunction(e.value);return a?(a.isBuiltIn()&&(e.cacheFn=a),this._dispatchFunction(a,t,r)):n.a.BuiltIn.Name}_dispatchFunction(e,t,r){let i,a=e._cfp;if(a){a.argsValues=t,a.argsLength=r;try{i=e.execute()}catch(e){i=n.a.isError(e)?e:new n.a.Value(e.message,{cause:e})}a.argsValues=null,a.argsLength=0}else try{switch(r){case 0:i=e.execute();break;case 1:i=e.execute(t[0]);break;case 2:i=e.execute(t[0],t[1]);break;case 3:i=e.execute(t[0],t[1],t[2]);break;case 4:i=e.execute(t[0],t[1],t[2],t[3]);break;case 5:i=e.execute(t[0],t[1],t[2],t[3],t[4]);break;default:let n=[];for(let e=0;e<r;e++)n.push(t[e]);i=e.execute(...n)}}catch(e){i=n.a.isError(e)?e:new n.a.Value(e.message,{cause:e})}return i===void 0?new n.a.Parse:i}finalizeValue(e){let t=this._context;if(!0===e?.isLambda)return n.a.BuiltIn.Calc;if(e&&e.colStart!==void 0)try{if(e.scope){let r=t.getReference(e);if(n.a.isError(r))return r}e=t.getValueAt(e.rowStart,e.colStart,e.scope)}catch(e){return n.a.isError(e)?e:new n.a.Value(e?.message,{cause:e})}if(Array.isArray(e)){if(mE(e)){let t=xE(e.length);for(let n=0;n<e.length;n++)t[n]=this.finalizeValue(e[n]);return t}if(e.length===1&&Array.isArray(e[0])&&e[0].length===1)e=e[0][0];else try{e=t.getRange(e)}catch{e=n.a.BuiltIn.Value}}return e?.isIRange?e.size===1?(e=yE(e=e.getValueAt(0,0,tx),t))===null&&(e=0):e=e.fillEmpty(0):(e=yE(e,t))===null&&(e=0),e}finalizeValueForCell(e){let t=this.finalizeValue(e);return Array.isArray(t)?n.a.BuiltIn.Value:t}toString(){let e=this._compiled;if(e.error)return e.error.toString();let t=this._calcScope;return t?.node?this.getTextAt(t.node.rowIndex,t.node.colIndex):Xb(e.getTokens(),null)}get[Symbol.toStringTag](){return`[FormulaBlock]`}};function $b(e,t,n,r){let i=e.colStart,a=e.rowStart,o=e.colEnd,s=e.rowEnd;if((e.$colStart??!1)||i===-(2**53-1)||(i+=n),(e.$rowStart??!1)||a===-(2**53-1)||(a+=t),(e.$colEnd??!1)||o===2**53-1||(o+=n),(e.$rowEnd??!1)||s===2**53-1||(s+=t),i>o){let e=i;i=o,o=e}if(a>s){let e=a;a=s,s=e}let c=r;return c.colStart=i,c.rowStart=a,c.colEnd=o,c.rowEnd=s,c.scope=e.scope??null,c}var ex=(e,t,r,i,a,o,s)=>{let c=t[e],l=c?.inputs;if(c?.op===`,`&&l){let e=l.length;for(let n=0;n<e;n++)a=ex(l[n],t,r,i,a,o,s);return a}let u=c===void 0?n.a.BuiltIn.Value:r[e]??n.a.BuiltIn.Value;if(Array.isArray(u)){let e=u.length;for(let t=0;t<e;t++){let e=u[t];i[a]=e?.rowStart===void 0?e:{...e},o&&(o[a]=!(!e?.$rowStart&&!e?.$rowEnd)),s&&(s[a]=!(!e?.$colStart&&!e?.$colEnd)),a++}return a}return i[a]=u?.rowStart===void 0?u:{...u},o&&(o[a]=!!c?.hasVerticalAbs),s&&(s[a]=!!c?.hasHorizontalAbs),a+1},tx=Object.freeze({type:null}),nx=Array(255),rx=Object.freeze({value:null,style:null,hyperlink:null,formula:null,type:n.n.Null,stringToParse:null}),ix=Object.seal({value:void 0,style:void 0,hyperlink:void 0,formula:void 0,type:void 0,stringToParse:void 0}),ax=Object.seal({value:void 0,style:void 0,hyperlink:void 0,formula:void 0}),ox=Object.freeze({width:1,height:1}),sx=new Hh({max:1e3}),cx=class{constructor(e=!0,t=!1){this._editAllowed=e,this._formulaHidden=t}isEditAllowed(){return this._editAllowed}isFormulaHidden(){return this._formulaHidden}get isICellProtection(){return!0}},lx=new cx,ux=new cx(!1),dx=e=>{if(Array.isArray(e))return`array`;let t=typeof e;if(t!==`object`)return t;if(e instanceof Date)return`Date (invalid)`;let n=e?.constructor?.name;return n&&n!==`Object`?n:`object`};function fx(t,r,i=null,a=null,o=!1){if(r===void 0)return;if(r===null)return rx;if(r&&r.isICell){let e=r,t=ix;t.value=e.getValue(),e.getStyle().isNormal()?t.style=null:t.style=e.getStyle()._p.getProperties();let n=e.getFormulaText();return n&&(t.formula=`=`+n),t.hyperlink=e.getHyperlink(),t.type=e.getType(),t}let s;r.value!==void 0||r.style!==void 0||r.hyperlink!==void 0?s=r:(s=ax,s.value=r.hasOwnProperty(`value`)?r.value:r,s.style=void 0,s.hyperlink=void 0);let c=ix;c.type=void 0,c.value=void 0,c.style=void 0,c.formula=void 0,c.hyperlink=void 0,c.stringToParse=void 0;let l,u=s.value,d=!1;if(s.value!==void 0&&(l=nE(u),l||(d=rr(u,!0),d&&(l=n.n.Number)),!l))throw new e.s(e._(`error.sheet.invalidCellType`,{type:dx(u)}));let f,p,m,h=null,g=null;if(l===n.n.String){if(m=s.value,i){let e=a?.get(m);if(!e){let n=m.length,r=m.charAt(0);r===`=`&&n>1?(p=m.substring(1),u=null):(e=jT(t,m,i),e&&typeof e.value==`string`&&(r===`+`||r===`-`)&&(e=>{for(let t=0;t<e.length;t++){let n=e.charAt(t);if(n!==`+`&&n!==`-`&&n!==` `&&n!==` `)return!0}return!1})(m)&&(p=m,u=null),e!==void 0&&a&&a.set(m,e))}e&&(e.value!==void 0&&(u=e.value,l=nE(u)),e.style!==void 0&&(h=e.style),e.hyperlink!==void 0&&(f=e.hyperlink)),!o&&i.parse&&(g=m)}}else d?(u=dr(s.value,t.isDate1904()),h=e=>{if(!Dr(e.getNumberFormat()))return{numberFormat:`Short Date`}}):u=s.value;let _=s.style;if(_&&_.isIStyle&&(_=_._p.getProperties()),f=s.hyperlink??f,h)if(_){let e=_;_=t=>{let n=t.createStyle(h);return n=n.createStyle(e),n=n._p.getProperties(),n}}else _=h;let v=!1;return u!==void 0&&(u===null?(c.value=null,c.type=n.n.Null):(c.value=u,c.type=l),v=!0),_!==void 0&&(c.style=_,v=!0),f!==void 0&&(c.hyperlink=f,v=!0),p!==void 0&&(c.formula=p,v=!0),o||(c.stringToParse=g,v=!0),v?(c.type=l,c):void 0}var px=t=>t===o.HorizontalAlignment.Center||t===o.HorizontalAlignment.CenterContinuous?e.b.Center:t===o.HorizontalAlignment.Right?e.b.Right:e.b.Left,mx=(e,t,r)=>t===n.n.Null?null:Zm(t,e.getFont(),e.getAlignment(),!1,!0),hx=(e,t,r,i,a=!1)=>{if(e===n.n.Null)return null;let o=``;if(a)o=vy(r,e);else{let n=gy(i.runtime,r,t,e,t.getNumberFormat(),e=>i.styles.parseColor(e));if(n.formattedRuns){let e=n.formattedRuns.runs,t=e.length;for(let n=0;n<t;n++)o+=e[n].text}else o=n.displayText}return Zm(o,t.getFont(),t.getAlignment(),e===n.n.String,a)},gx=Object.freeze({dataBar:null,iconSet:null}),_x=e=>e.isStopIfTrue()&&!e.getScale(),vx=(e,t)=>{let r=t.getInsets();if(e===n.n.Null)return r;let i=r,a=yx(e,t),s=t.getAlignment().getIndent();if(s&&(a===o.HorizontalAlignment.Left||a===o.HorizontalAlignment.Right)){i={...r};let e=t.measureText(` `.repeat(1*s)),n=Math.min(3,Math.max(1,(26-t.getFont().getSize())/2)),c=e.width*n;a===o.HorizontalAlignment.Left?i.left+=c:a===o.HorizontalAlignment.Right&&(i.right+=c)}return Object.freeze(i)},yx=(e,t)=>{let r=t.getAlignment(),i=re(r.getRotation()),a=r.getHorizontal();return i!==0&&a===o.HorizontalAlignment.General?i>0&&i<90||i>180&&i<=270?o.HorizontalAlignment.Right:o.HorizontalAlignment.Left:a===o.HorizontalAlignment.General?e===n.n.Null?o.HorizontalAlignment.Left:e===n.n.Boolean||e===n.n.Error?o.HorizontalAlignment.Center:t.getNumberFormat()===`@`?o.HorizontalAlignment.Left:e===n.n.Number?o.HorizontalAlignment.Right:o.HorizontalAlignment.Left:a};function bx(t,r,i,a,s,c,l,u,d){if(i===n.n.Null||s===``)return null;let f=r;if(!function(t,r,i=!1,a=!1){if(t===n.n.Null)return!1;let s=r.getAlignment(),c=s.getHorizontal();if(c===o.HorizontalAlignment.CenterContinuous||c===o.HorizontalAlignment.Fill)return!0;if(c===o.HorizontalAlignment.Distributed)return!1;if(B(s.getRotation())){let n=px(yx(t,r));return!(n===e.b.Right&&i||n===e.b.Center&&i&&a||n===e.b.Left&&a)}if(t!==n.n.String||s.getOverflow()!==o.Overflow.Visible||c===o.HorizontalAlignment.Right&&i||c===o.HorizontalAlignment.Center&&i&&a||a&&(c===o.HorizontalAlignment.General||c===o.HorizontalAlignment.Left))return!1;let l=s.getVertical();return l!==o.VerticalAlignment.Justify&&l!==o.VerticalAlignment.Distributed}(i,a,c!==null&&c.colIndex+1===f,l!==null&&l.colIndex-1===f))return null;let p=Ex(i,a,s,d,t),m=a.getAlignment(),h=m.getHorizontal(),g=!B(m.getRotation())&&(m.getOverflow()===o.Overflow.Wrap||i===n.n.String&&(h===o.HorizontalAlignment.Justify||h===o.HorizontalAlignment.Distributed||m.getVertical()===o.VerticalAlignment.Justify||m.getVertical()===o.VerticalAlignment.Distributed)),_=h===o.HorizontalAlignment.Fill,v=h===o.HorizontalAlignment.CenterContinuous||_;if(!p&&!v)return null;let y=px(yx(i,a)),b=0,x=0,S=0,C=0,w=1;if(v&&s!==null&&u){jx.colIndex=r,jx.rowIndex=t;let e=u.colEnd;w=Math.min(d.nextContentful(jx,e),e)-r+1}let T=d.colHeaders,E=T.getOffset.bind(T),D=T.getIndex.bind(T),O=E(f),k=O,A=E(f+w),j=A-O,M=f,N=f,P={x:0,y:0,width:j,height:p?.height??0},F=f-f+w,I=p?p.width-j:0,L=P;return j>0&&I>0&&!g&&(y===e.b.Center&&(I/=2),y!==e.b.Left&&y!==e.b.Center||(N=D(A+I),l!==null&&(N=Math.min(N,l.colIndex-1)),A=E(N),C=I,x=N-f),y!==e.b.Right&&y!==e.b.Center||(M=D(O-I),c!==null&&(M=Math.max(M,c.colIndex+1)),O=E(M),S=I,b=f-M),P.x=k-O,L.x=P.x),w>1&&(x=y===e.b.Center?Math.max(F-1,x):w-1,A=E(f+1),P.width=A-O,L={...P},L.width=j),{anchorBounds:P,leftIndex:b,rightIndex:x,leftOffset:S,rightOffset:C,colSpan:F,colBounds:L}}var xx=class{constructor(e,t){this._styles=e,this._ri=t;let n=t?.table;n&&(this._table=n.getRangedStyle())}getCoords(){return e.l.EmptyRange}_directAt(e,t,n){let r=this._ri,i=r.borderStyle?r.borderStyle.getPropertiesAt(e,t,n):null,a=r.fillStyle?r.fillStyle.getPropertiesAt(e,t,n):null,o=r.contentStyle?r.contentStyle.getPropertiesAt(e,t,n):null;return!i||a||o?i||!a||o?i||a||!o?i||a||o?{...o,...a,...i}:null:o:a:i}getPropertiesAt(t,n,r){let i=this._ri,a=this._styles,o=null,s=this._table?.getPropertiesAt(t,n,r);s&&(o=e.w.resolveTypedUpdates(s,um,a,o));let c=i.conditionals;c&&!Array.isArray(c)&&(c=[c]);let l=c?c.length:0;if(l>0)for(let i=0;i<l;i++){let s=c[i],l=s.getPropertiesAt(t,n,r);if(l&&(o=o?e.w.resolveTypedUpdates(l,um,a,o):l,_x(s)))break}let u=this._directAt(t,n,r),d=null;if(u&&u.named){let e=u.named;if(e!==X.BuiltInName.Normal){let i=a.getNamed(e);i?d=i.getRanged().getPropertiesAt(t,n,r):console.warn(`A named styled was referenced but not found: '${e}'.`)}}let f=null;d&&(f=e.w.resolveTypedUpdates(d,um,a,f)),u&&(f=f?e.w.resolveTypedUpdates(u,um,a,f):u);let p=null;if(o&&f){let t=a.normalize(f,X.BuiltInName.Normal);p=t?e.w.resolveTypedUpdates(t,um,a,o):o}else p=f??o;return p}cloneWithUpdate(e){let t=this._ri;return(Dm.compose(t.borderStyle,t.fillStyle,t.contentStyle)??this._styles.getNormalRanged()).cloneWithUpdate(e)}getAuthoredPropertiesAt(e,t,n){return this._directAt(e,t,n)}};function Sx(e,t,n,r,i,a){let o=r.styles,s=null;return n&&(s=i?Dm.compose(n.borderStyle,n.fillStyle,n.contentStyle)??null:new xx(o,n)),vh(e,o,s,t,r.styleUpdater,a)}function Cx(e,t){if(!e)return!1;if(!Array.isArray(e)){let n=e.getCoords();return t.colIndex!==n.colStart||t.rowIndex!==n.rowStart}let n=e.length;for(let r=0;r<n;r++){let n=e[r].getCoords();if(t.colIndex===n.colStart&&t.rowIndex===n.rowStart)return!1}return!0}function wx(t,r,i,a,s,c,l,u=null,d=sx,f){let p=f?.formulaText,m=f?.formulaView??!1;if(i===null&&p===void 0)return r?r.getBestFit():null;let h=p===void 0&&t===n.n.String,g=r.getFont(),_=g.getWeight(),v=g.getSize(),y=g.getFamily(),b=r.getAlignment(),x=b.getOverflow(),S=b.getRotation(),C=b.getVertical(),w=r.getNumberFormat(),T=h&&x===o.Overflow.Visible,E=h&&(x===o.Overflow.Wrap||C===o.VerticalAlignment.Justify||C===o.VerticalAlignment.Distributed),D=vx(t,r),O=D.left+D.right+2,k=(u??``)+`\0`+v+y+_+w+S+T+E+c+l+O+(u?``:i)+`\0`+m+`\0`+(p??``)+`\0`+(E?s:``)+`\0`+e.d.getRevision(),A=d.get(k);if(A)return A;let j=null,M=null,N=D.top+D.bottom+ +function(e){let t=e.getFont().getUnderline()===U.UnderlineStyle.SingleAccounting,n=e.getFont().getUnderline()===U.UnderlineStyle.DoubleAccounting,r=0;return(t||n)&&(r=e.measureText(``).underlineThickness+1,n?r*=2:r+=1),r}(r),P=!1,F=!1,I=!1;l&&(I=!0,(S!==0||E)&&(I=!1));let L=I?void 0:p===void 0?hx(t,r,i,a,m):mx(r,p);if(L){if(!m&&t===n.n.Number&&w===`General`&&c){let t=i,n=e.A.splitNumber(t),a=``;a=Math.abs(t)>=10**12||Math.abs(t)<=1e-12?`0.${`0`.repeat(Math.max(2,Math.min(n.ipLength,5)))}E+00`:Math.abs(n.ipLength)===0?`0.0`:Math.abs(n.fpLength)>0?`0`.repeat(n.ipLength)+`.0`:`0`.repeat(n.ipLength),t<0&&(a=`-`+a),a=`0`.repeat(a.length);let o=r.measureText(a);j=o.width,M=o.lineHeight}else if(p===void 0&&!m&&B(S)){let e=re(S)*Math.PI/180,t=Math.abs(Math.sin(e)),n=Math.abs(Math.cos(e)),r=L.layout({width:1e9}),i=r.lines[0]?.bounds.height??r.bounds.height;if(E){let e=Math.max(1,s-O),t=Math.max(1,Math.round(e/(1.5*i)));if(r.lines.length<t||t>1){let e=Math.max(1,r.bounds.width/t);for(let n=0;n<8;n++){let n=L.layout({width:e});if(n.lines.length<=t){r=n;break}e*=1.25}let n=0;for(let e=0;e<r.lines.length;e++)n=Math.max(n,r.lines[e].bounds.width);let i=L.layout({width:n});i.lines.length===r.lines.length&&(r=i)}}let a=r.lines,o=0,c=0;for(let e=0;e<a.length;e++){let r=a[e].bounds.width,i=a[e].bounds.height;o=Math.max(o,r*t+i*n),c=Math.max(c,r*n+i*t)}M=o,j=(a.length-1)*(t>0?i/t:0)+c,F=!0}else{let e=null;E&&(e={width:Math.max(1,s-O)});let t=L.layout(e);if(M=t.bounds.height,E){let e=t.lines,n=e.length,r=0;for(let t=0;t<n;t++){let n=e[t].bounds.width;n>r&&(r=n)}j=r}else j=t.bounds.width}if(j!==null&&(j+=O),M!==null&&(M+=N),P=t===n.n.String,S&&(P&&x===o.Overflow.Wrap&&(P=!1),!F)){let e=function(e,t){let{x:n,y:r,width:i,height:a}=e,o=t*Math.PI/180,s=Math.sin(o),c=Math.cos(o),l=i/2,u=a/2,d=yy(-l,-u,s,c),f=yy(l,-u,s,c),p=yy(-l,u,s,c),m=yy(l,u,s,c),h=Math.min(d.x,f.x,p.x,m.x)+l,g=Math.max(d.x,f.x,p.x,m.x)+l,_=Math.min(d.y,f.y,p.y,m.y)+u;return{x:n+h,y:r+_,width:g-h,height:Math.max(d.y,f.y,p.y,m.y)+u-_}}({x:0,y:0,width:j,height:M},S);j=e.width,M=e.height}E&&j!==null&&(j=Math.ceil(j))}else M=r.getBestFit().height;c&&P&&(j=0);let ee=Object.freeze({width:j,height:M});return d.set(k,ee),ee}var Tx=(e,t,n,r)=>{let i=t.getAlignment(),a=i.getHorizontal();if(a===o.HorizontalAlignment.Fill||a===o.HorizontalAlignment.CenterContinuous)return null;let s=i.getRotation();if(!B(s))return null;let c=vx(e,t),l={x:c.left,y:c.top,width:Math.max(0,r.width-c.left-c.right),height:Math.max(0,r.height-c.top-c.bottom)},u=n.layout({width:1e9}),d=u.lines[0]?.bounds.height??u.bounds.height,f=i.getVertical(),p=n.wrapped?n.layout({width:ie(l.height,d,s)}):u;return{layout:oe(p.lines.map(e=>({width:e.bounds.width,height:e.bounds.height})),s,l,yx(e,t),f),frame:p,lineHeight:d,content:l}},Ex=(e,t,n,r,i)=>{if(B(t.getAlignment().getRotation())){let a=r.sheet?.getRowHeaders().getSpanSize(i),o=a?hx(e,t,n,r,!1):null;if(o){let n=Tx(e,t,o,{width:0,height:a});if(n)return{width:Math.ceil(n.layout.bounds.width),height:Math.ceil(n.layout.bounds.height)}}}let a=vx(e,t),s=yx(e,t),c=a.left+a.right;s===o.HorizontalAlignment.Left?c=a.right:s===o.HorizontalAlignment.Right?c=a.left:s===o.HorizontalAlignment.Center&&(c=a.left+a.right);let l=wx(e,t,n,r,2**53-1,!1,!1);return{width:Math.ceil(l.width-c),height:Math.ceil(l.height)}},Dx=class t{constructor(e,t,r=n.n.Null,i=null,a=null,o=null,s=null){this._options=e,this._r=e.runtime,this._coords=t??null,this._p=o,this._n=s,this._t=r,this._ri=a,this._v=i,r===n.n.Number&&a?.dateFormat&&(this._d=this.getNumberFormat(a?.dateFormat).asDate)}getRange(){let t=this._coords,n=null,r=this._ri;return n=r&&r.merge?r.merge.getCoords():t?e.l.cellToRange(t):null,this._options.getRange(n)}isEqual(t){if(!t)return!1;if(this===t)return!0;let n=t;return!!n.isICell&&this._v===n._v&&!!e.l.isEqualCells(this._coords,t.getCoords())&&this._options.sheet===n._options?.sheet}getCoords(){return this._coords}getAddress(e){let t=this._coords;return t?Sl(this._options.getRange(t).getCoords()):ul}getSheet(){return this._options.sheet}select(e){return this._options.opener(`#`+hl(this._coords),e)}getColumn(){let t=this._column;if(t!==void 0)return t;this._column=null;let n=this._ri;if(!n)return null;let r=n.table??n.autoTable;if(!r)return null;let i=r.getHeaderRowRange().getCoords();if(i&&e.l.isCellWithinRange(this._coords,i)){let e=this._coords.colIndex-i.colStart;t=r.getColumnAt(e)??null,this._column=t}return t}getTable(){let e=this._ri;return e&&(e.table??e.autoTable)||null}getDataValidation(){let e=this._ri;if(!e)return null;let t=e.dataValidations;return t?Array.isArray(t)?t[0]:t:null}getConditionalDecorations(){let e=this._cd;if(e!==void 0)return e;let t=this._ri?.conditionals;if(!t)return this._cd=gx;Array.isArray(t)||(t=[t]);let n=this._coords;if(!n)return this._cd=gx;let r=n.rowIndex,i=n.colIndex,a=this._v,o=null,s=null;for(let e=0;e<t.length;e++){let n=t[e],c=n.getDecorationAt(r,i,a);if(c&&(c.type===H_.ScaleType.DataBar?o??=c:s??=c),o&&s||_x(n)&&(c||n.getPropertiesAt(r,i,a)))break}if(s){let e=this.getStyle().getAlignment();(e.getRotation()!==0||e.getStacked())&&(s=null)}return this._cd=o||s?Object.freeze({dataBar:o,iconSet:s}):gx}getProtection(){return this._ri?.unlock===void 0?ux:lx}getTextOverflow(){let e=this._to;if(e!==void 0)return e;let t=this._ri;if(t&&t.merge)return this._to=null,null;let r=this._t,i=null;if(r===n.n.String||t&&t.continuous){let e=this.getStyle(),n=this._coords;i=bx(n.rowIndex,n.colIndex,r,e,this._v,this._p,this._n,t?.continuous?.getCoords()??null,this._options)}return i===null||i.leftIndex===0&&i.rightIndex===0&&i.colSpan<=1?(this._to=null,null):(this._to=i,i)}getRenderHorizontalAlignment(){return yx(this._t,this.getStyle())}isEmpty(){return this._v===null&&!this._ri}getExtrusions(){let e=this._ri;if(!e&&this._to===null)return null;if(e){let t=e.merge;if(t!==void 0)return t.getCoords()}let t=this.getTextOverflow();if(!t)return null;let n=this._coords;return{colStart:n.colIndex-t.leftIndex,rowStart:n.rowIndex,colEnd:n.colIndex+t.rightIndex,rowEnd:n.rowIndex}}isEditAllowed(){let e=this._options;return!e||!e.getProtection().isLocked()||!!this._ri&&this.getProtection().isEditAllowed()}isFormulaHidden(){return!!this._options.getProtection().isLocked()&&!!this._ri&&this.getProtection().isFormulaHidden()}isContentful(){return this._v!==null}getBestFit(e,t=!1){return e===void 0&&(e=this._options.sheet?.getColumnHeaders().getSpanSize(this._coords.colIndex)??64),wx(this._t,this.getStyle(),this._v,this._options,e,t,!1)}getInsets(){if(this._v===null)return this.getStyle().getInsets();let e=vx(this._t,this.getStyle()),t=this._iconGutter();return t===0?e:Object.freeze({...e,left:e.left+t})}_iconGutter(){if(!this.getConditionalDecorations().iconSet)return 0;let e=this.getStyle();return e.measureText(``).lineHeight+e.getInsets().left}getTextFrame(e){let t,n;if(e&&(n=this.getFormulaText(),n&&=`=`+n),t=n??this._v,t===null)return null;let r=this.getStyle();return n?mx(r,t,this._options):hx(this._t,r,t,this._options,e)}getTextPlacement(e,t){let n=this.getTextFrame(t),r=n??this.getStyle().createTextFrame(` `);if(!r)return null;if(!t&&n){let t=Tx(this._t,this.getStyle(),n,e);if(t)return{content:Object.freeze(t.content),frame:t.frame,bounds:Object.freeze({...t.layout.bounds}),lineHeight:t.lineHeight,rotation:t.layout}}let i=this.getInsets(),a={x:i.left,y:i.top,width:Math.max(0,e.width-i.left-i.right),height:Math.max(0,e.height-i.top-i.bottom)},s=r.layout(r.wrapped?{width:a.width}:void 0),c=s.bounds,l=s.lines[0]?.bounds.height??c.height,u=this.getStyle().getAlignment().getVertical(),d=a.y;u===o.VerticalAlignment.Center?d=a.y+(a.height-c.height)/2:u===o.VerticalAlignment.Bottom&&(d=a.y+a.height-c.height);let f=this.getRenderHorizontalAlignment(),p=a.x;return f===o.HorizontalAlignment.Center||f===o.HorizontalAlignment.CenterContinuous?p=a.x+(a.width-c.width)/2:f===o.HorizontalAlignment.Right&&(p=a.x+a.width-c.width),{content:Object.freeze(a),frame:s,bounds:Object.freeze({x:p,y:d,width:c.width,height:c.height}),lineHeight:l}}getFormula(){let e=this._ri?.formula;if(!e)return null;let t=this._coords;return t?(Array.isArray(e)&&(e=e[0]),new Sy(t,e,this._options)):null}getFormulaText(e){let t=this._ri?.formula;if(!t)return null;let n=e?.cell??this._coords;return n?(Array.isArray(t)&&(console.log(`Multiple formula blocks`),t=t[t.length-1]),t.getTextAt(n.rowIndex,n.colIndex,e?.r1c1)):null}getCalculationStatus(){let e=this._ri;return e&&e.pending?cv.ResultStatus.Pending:cv.ResultStatus.Ready}_dependencyRanges(t,n){let r=this._coords;if(!r)return null;let i=this._options.dependencyRanges;return i?i(e.l.cellToRange(r),t,n):null}getDirectDependents(){return this._dependencyRanges(`dependents`,!0)}getDirectPrecedents(){return this._dependencyRanges(`precedents`,!0)}getDependents(){return this._dependencyRanges(`dependents`,!1)}getPrecedents(){return this._dependencyRanges(`precedents`,!1)}getValue(){return this._v}getType(){return this._t}getInteropValue(){return this._d??this._v}getInteropType(){return this._d?n.s.Date:this._t}getStyle(t=!1){if(!t&&this._s)return this._s;if(t&&this._sd)return this._sd;let n=Sx(this._v,e.l.cellToRange(this._coords),this._ri,this._options,t);return t?this._sd=n:this._s=n,n}createCell(n){if(n===null)return new t(this._options,this._coords);let r=fx(this._r,n),i=this._ri;if(r.style!==void 0){let t=this._coords??e.l.EmptyCell,n=e.l.cellToRange(t),a=this._options,o=nh(r.style,()=>Sx(this._v,n,this._ri,a,!0)),s=this._ri,c=(Dm.compose(s?.borderStyle,s?.fillStyle,s?.contentStyle)??new Dm(a.styles,null,n)).cloneWithUpdate(o),l=c.splitByFeature();i={...i,borderStyle:l.border??void 0,fillStyle:l.fill??void 0,contentStyle:l.content??void 0};let u=c._p?.numberFormat;typeof u==`string`&&(Dr(u)||Or(u))?i.dateFormat=u:i.dateFormat&&delete i.dateFormat}let a=this._t,o=this._v;return r&&r.value!==void 0&&(o=r.value,a=r.type),o===this._v&&a===this._t&&i===this._ri?this:o!==null||i?new kx(this._options,this._coords,a,o,i):new kx(this._options,this._coords)}_withProjectedMerge(e){let t=this._v;return new kx(this._options,this._coords,this._t,t,{...this._ri,merge:new xy(e,()=>t)})}getNumberFormat(e){let t=this._r,n=this._options,r=this._v;return e===void 0?gy(t,r,this.getStyle(),this._t,this.getStyle().getNumberFormat(),e=>n.styles.parseColor(e)):gy(t,r,this.getStyle(),this._t,e,e=>n.styles?.parseColor(e))}getDate(){return this._d??null}getText(t){let r;if(t?.showFormulas){if(this.isSpillOverflow())return``;let e=this.getFormulaText();return e?`=`+e:vy(this._v,this._t)}if(t&&t.useFormattingCategory){let t=this._v;return this.isSpillOverflow()&&(t=null),r=function(t,r,i,a,o){if(i===n.n.Null||r==null)return``;if(i===n.n.Number){let n=uc(),i=r,s=n.isDateFormat(a),c=n.isTimeFormat(a);if(s||c){let n=parseFloat(r),a=n%1!=0,l=n>=1;if(n<0)return e.A.castToString(r);if(!s||c||a)if(!c||s||l){let e=hc(t,`Short Date`,i,o),n=hc(t,`Long Time`,i,o);if(e&&n)return e.fmt+` `+n.fmt}else{let e=hc(t,`Long Time`,i,o);if(e)return e.fmt}else{let e=hc(t,`Short Date`,i,o);if(e)return e.fmt}}}if(i===n.n.Number&&Bn(a).endsWith(`%`)){let t=e.A.roundAccurately(100*parseFloat(r),14);if(!isNaN(t))return _y(t)+`%`}if(i===n.n.Boolean)return co(r);if(i===n.n.Error){let e=r;return typeof e?.getLabel==`function`?lo(e):n.a.Label.Unknown}return i===n.n.RichData?`(Rich Object)`:i===n.n.Number?_y(r):e.A.castToString(r)}(this._r,t,this._t,this.getStyle().getNumberFormat()),r}r=this.getNumberFormat().displayText;let i=this._t;return t?.hideStringPrefix||i!==n.n.String||(r=`'${r}`),r}getComments(){let e=this._ri?.comments;return e?Object.freeze(e):null}getHyperlink(){let e=this._ri?.hyperlink;return e?new my(this.getText.bind(this),this._options.opener,e):null}getErrors(){let t=this._ri;return t&&t.calcError?[t.calcError]:this._t===n.n.Error?[this._v]:e.A.EmptyArray}getWarnings(){return e.A.EmptyArray}getSpans(){let e=this._ri?.merge;if(!e)return ox;let t=e.getCoords();return Object.freeze({width:t.colEnd-t.colStart+1,height:t.rowEnd-t.rowStart+1})}isTopLeft(){let e=this._ri?.merge;if(!e)return!0;let t=e.getCoords();return this._coords&&this._coords.colIndex===t.colStart&&this._coords.rowIndex===t.rowStart}getSpill(){let e=this._ri?.spills;if(!e||!this._coords)return null;Array.isArray(e)||(Ax[0]=e,e=Ax);let t=null,n=e?e.length:0;for(let r=0;!t&&r<n;r++){let n=e[r];n.getError()||(t=n)}return t||=Array.isArray(e)?e[0]:e,t?this._options.getRange(t.getCoords()):null}isSpillOverflow(){let e=this._ri?.spills;if(!e)return!1;let t=this._coords;return t?Cx(e,t):null}get[Symbol.toStringTag](){return`[Cell]`}toString(){let e=`{blank}`;return this._v!==null&&(e=this.getText(Mx),this.getType()===n.n.String&&(e=`'${e}'`)),`${this.getAddress()} => ${e}`}get isICell(){return!0}},Ox=class extends Dx{constructor(e){super(e,null,null,null)}isEmpty(){return!0}isContentful(){return!1}toString(){return`{EMPTY CELL}`}},kx=class extends Dx{getAddress(e){return`{TEMPORARY CELL}`+(this._coords?`: ${super.getAddress(e)}`:``)}},Ax=[null],jx={colIndex:-1,rowIndex:-1},Mx={useFormattingCategory:!0},Nx={colStart:0,rowStart:0,colEnd:0,rowEnd:0},Px={colStart:0,rowStart:0,colEnd:0,rowEnd:0},Fx={colStart:0,rowStart:0,colEnd:0,rowEnd:0},Ix={size:null,autoSize:!0},Lx=(e,t)=>e.sizeSet-t.sizeSet;function Rx(e,t,n){return n>1?e._colHeaders.getSpanSize(t,t+n):e._colHeaders.getSpanSize(t)}function zx(e,t,n){if(e>t)return null;let r=[],i=e,a=n?n.length:0;for(let e=0;e<a;e++){let t=n[e],a=t.min,o=t.max;if(i>=a){i=o+1;continue}let s={address:{min:i,max:a-1},update:Ix};r.push(s),i=o+1}if(i<=t){let e={address:{min:i,max:t},update:Ix};r.push(e)}return r}function Bx(e,t){let n={colStart:t.colStart,rowStart:t.rowStart,colEnd:t.colEnd,rowEnd:t.rowEnd},r=e.host._getUsedCoords();return(e.isShrinkToFitRow||e.isShrinkToFitColumn)&&r&&(n.colStart=e.isShrinkToFitRow?r.colStart:t.colStart,n.rowStart=e.isShrinkToFitColumn?r.rowStart:t.rowStart,n.colEnd=e.isShrinkToFitRow?r.colEnd:t.colEnd,n.rowEnd=e.isShrinkToFitColumn?r.rowEnd:t.rowEnd),n}function Vx(e){return{searchTypes:{[q.Type.ContentStyle]:!1,[q.Type.Merge]:!1,[q.Type.Continuous]:!1,[q.Type.DateFormat]:!1,[q.Type.Contentful]:!1},ignoreHidden:!1,bounds:{colStart:e.colStart,rowStart:e.rowStart,colEnd:e.colEnd,rowEnd:e.rowEnd},axis:n.l.Axis.Column}}function Hx(t,n,r,i,a){let{host:o,cellOptions:s,isRow:c,isColumn:l}=t,u=o._rangeStateIterator(Vx(r)),d=u.next();for(;!d.done;){let r=d.value,o=r.intersection,f=r.start,p=r.end;Px.colStart=f.colIndex,Px.rowStart=f.rowIndex,Px.colEnd=p.colIndex,Px.rowEnd=p.rowIndex;let m=Sx(void 0,e.l.intersectRanges(Px,n,Nx),o,s,!0).getBestFit();if(c){let e=Math.max(f.rowIndex,n.rowStart),r=Math.min(p.rowIndex,n.rowEnd);if(e<=r){let n=m.height,a={address:{min:e,max:r},update:{size:t.clampHeight(n),autoSize:!0},sizeSet:n??-1};i.push(a)}}if(l){let e=Math.max(f.colIndex,n.colStart),r=Math.min(p.colIndex,n.colEnd);if(e<=r){let n=m.width,i={address:{min:e,max:r},update:{size:t.clampWidth(n),autoSize:!0},sizeSet:n??-1};a.push(i)}}d=u.next()}}function Ux(t,r,i){let{host:a,cellOptions:o,normalStyle:s,isFormulaView:c}=t,l=[],u=-1,d=!1,f=s,p=null,m=1,h=1,g=1,_=2**53-1,v=-(2**53-1),y=!1,b=``,x=!1,S=!1,C=!1,w=!1,T=2**53-1,E=-(2**53-1),D=-(2**53-1),O=()=>{l.push({col:u,style:f,spanWidth:m,spanHeight:h,minVal:_,maxVal:v,hasZero:y,text:b,textVerbatim:x,hasFalse:C,hasTrue:S,hasEmpty:w,minRow:T,maxRow:E,maxContentRow:D,colWidth:Rx(a,u,g),colSpan:g,measureWidth:-1,measureHeight:-1,isFit:d,formula:p})},k={[q.Type.Merge]:!1,[q.Type.Table]:!1,[q.Type.AutoTable]:!1,[q.Type.ContentStyle]:!1,[q.Type.Continuous]:!1,[q.Type.DateFormat]:!1};c&&(k[q.Type.Formula]=!1,k[q.Type.Spills]=!1);let A,j,M,N=a._cellStateIterator({...Vx(i),searchTypes:k,ignoreEmptyIntersections:!0}),P=N.next(),F=1,I=1;for(;!P.done;){let t=P.value,i=t[0],l=t[1],k=t[2],L=s,ee=k?.contentStyle??k?.table?.getStyle()??null;ee===A?L=j:(L=ee?Sx(l,e.l.cellToRange(i,Fx),k,o,!1):s,j=L);let te=1,R=1,z=k?.merge??null;if(z===M)te=F,R=I;else{if(z){let e=z.getCoords();te=e.colEnd-e.colStart+1,R=e.rowEnd-e.rowStart+1}else te=1,R=1;F=te,I=R}let ne=i.colIndex,re=i.rowIndex,B=nE(l),ie=e.l.isCellWithinRange(i,r),ae=k?.continuous??null,oe=ae?ae.getCoords().colEnd-ne+1:1,se=l instanceof n.a.Parse,ce=k?.formula??null,le=null;ce?le=Array.isArray(ce)?ce[ce.length-1]:ce:se&&!c&&(le=a._getState().calcGrid.getFormulaBlockAt(re,ne));let ue=le&&(c||se)?le:null,de=B===n.n.RichData||R>1||te>1||c&&Cx(k?.spills,i),fe=!de&&(A!==ee||te!==m||R!==h||oe!==g||B===n.n.String||B===n.n.Error||ue!==p||ie!==d);if(A=ee,M=z,(u!==ne||fe)&&(u!==-1&&O(),u=ne,f=L,d=ie,p=ue,m=te,h=R,g=oe,_=2**53-1,v=-(2**53-1),y=!1,b=``,x=!1,C=!1,S=!1,w=!1,T=re,D=re),E=re,de)P=N.next();else{if(D=re,!ue)if(l===null)w=!0;else switch(B){case n.n.Number:l===0&&(y=!0),_=Math.min(_,l),v=Math.max(v,l);break;case n.n.String:b=l,x=!1;break;case n.n.Error:b=lo(l),x=!0;break;case n.n.Boolean:l?S=!0:C=!0}P=N.next()}}return u!==-1&&O(),l}function Wx(e,t,r){let{cellOptions:i,isRowAxis:a,minContent:o,mapCache:s,isFormulaView:c}=e,l=c?{formulaView:!0}:void 0,u={formulaView:c,formulaText:void 0},d=t.length;for(let e=0;e<d;e++){let c=t[e],d=c.col>=r.colStart&&c.col<=r.colEnd,f=a||!d,p=c.style,m=c.colWidth,h=(e,t,r)=>{let a=e===n.n.String||r?.formulaText!==void 0;return wx(e,p,t,i,m,o,f,null,a?s:void 0,r)},g=0,_=0,v=e=>{g=Math.max(g,e.width),_=Math.max(_,e.height)};if(c.formula){u.formulaText=`=`+c.formula.getTextAt(c.maxContentRow,c.col);let e=h(n.n.String,null,u);c.measureWidth=e.width??0,c.measureHeight=e.height??0;continue}let y=c.maxVal;if(y!==-(2**53-1)){v(h(n.n.Number,y,l));let e=c.minVal;e!==y&&v(h(n.n.Number,e,l)),c.hasZero&&e!==0&&y!==0&&v(h(n.n.Number,0,l))}let b=c.text;b.length>0&&(c.textVerbatim?(u.formulaText=b,v(h(n.n.Error,null,u))):v(h(n.n.String,b,l))),c.hasFalse&&v(h(n.n.Boolean,!1,l)),c.hasTrue&&v(h(n.n.Boolean,!0,l)),c.hasEmpty&&v(h(n.n.Boolean,null,l)),c.measureWidth=g,c.measureHeight=_}}function Gx(e,t){let n=e.host,r=null,i=t.length;for(let e=0;e<i;e++){let i=t[e],a=Rx(n,i.col,i.colSpan);a!==i.colWidth&&(i.colWidth=a,(r??=[]).push(i))}return r}function Kx(e,t,n,r){let{host:i,isShrinkToFitColumn:a,updateHeaderOptions:o}=e,s=n.length;for(let i=0;i<s;i++){let a=n[i],o=a.col,s=n[i+1],c=a.measureWidth??0;for(;s&&s.col===o;)s.measureWidth&&(c=Math.max(s.measureWidth??0,c)),i++,a=n[i],s=n[i+1];if(o<t.colStart||o>t.colEnd)continue;c===0&&(c=null);let l=e.clampWidth(c,a.spanWidth);r.push({address:{min:o,max:o},update:{size:l,autoSize:!0},sizeSet:c===null?-1:c})}r.sort(Lx);let c=i._colHeaders.updateHeaderPairs(r,o);if(a){c=Vr(Hr(Ur(c)));let e=zx(t.colStart,t.colEnd,c);e&&i._colHeaders.updateHeaderPairs(e,o)}}function qx(e,t,n,r){let{host:i,isShrinkToFitRow:a,updateHeaderOptions:o}=e,s=n.length;for(let i=0;i<s;i++){let a=n[i],o=Math.max(a.minRow,t.rowStart),s=Math.min(a.maxRow,t.rowEnd);if(o>s)continue;let c=a.measureHeight??0;c===0&&(c=null);let l=e.clampHeight(c,a.spanHeight);r.push({address:{min:o,max:s},update:{size:l,autoSize:!0},sizeSet:c===null?-1:c})}r.sort(Lx);let c=i._rowHeaders.updateHeaderPairs(r,o);if(a){c=Vr(Hr(Ur(c)));let e=zx(t.rowStart,t.rowEnd,c);e&&i._rowHeaders.updateHeaderPairs(e,o)}}t.r({boundsToPoints:()=>Zx,centerPoint:()=>Xx,clipToOuterRect:()=>cS,minBoundingRect:()=>Qx,rotatePoints:()=>$x,unionBounds:()=>Yx});var Jx=(e,t)=>{let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push({x:i.x+t.x,y:i.y+t.y})}return n};function Yx(e,t){if(!e)return{...t};if(!t)return{...e};let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,width:Math.max(e.width+e.x,t.width+t.x)-n,height:Math.max(e.height+e.y,t.height+t.y)-r}}function Xx(e){return{x:e.width/2+e.x,y:e.height/2+e.y}}function Zx(e){return[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}]}function Qx(e){let t=2**53-1,n=2**53-1,r=-(2**53-1),i=-(2**53-1);for(let a=0;a<e.length;a++){let o=e[a];t=Math.min(t,o.x),n=Math.min(n,o.y),r=Math.max(r,o.x),i=Math.max(i,o.y)}return{x:t,y:n,width:r-t,height:i-n}}function $x(e,t,n){if(!n){let t=Qx(e);n={x:t.x+t.width/2,y:t.y+t.height/2}}e=Jx(e,{x:-n.x,y:-n.y});let r=t*Math.PI/180,i=Math.sin(r),a=Math.cos(r),o=[];for(let t=0;t<e.length;t++){let n=e[t],r=a*n.x-i*n.y,s=i*n.x+a*n.y;o.push({x:r,y:s})}return Jx(o,{x:n.x,y:n.y})}var eS=0,tS=1,nS=2,rS=3;function iS(e,t,n=!0){return function(e,t,n,r,i,a,o,s,c=!0){if(e===n&&t===r||i===o&&a===s)return!1;let l=(s-a)*(n-e)-(o-i)*(r-t);if(l===0)return!1;let u=((o-i)*(t-a)-(s-a)*(e-i))/l,d=((n-e)*(t-a)-(r-t)*(e-i))/l;return(!c||!(u<0||u>1||d<0||d>1))&&{x:e+u*(n-e),y:t+u*(r-t)}}(e.p1.x,e.p1.y,e.p2.x,e.p2.y,t.p1.x,t.p1.y,t.p2.x,t.p2.y,n)}var aS=e=>({top:{p1:e[eS],p2:e[tS]},left:{p1:e[rS],p2:e[eS]},right:{p1:e[tS],p2:e[nS]},bottom:{p1:e[nS],p2:e[rS]}}),oS=(e,t,n)=>{let r=n*Math.PI/180,i=Math.sin(r),a=Math.cos(r);return{x:e*a-t*i,y:e*i+t*a}},sS=(e,t)=>{let n=e.p2.x-t.x,r=e.p2.y-t.y,i=oS(n,r,90);n=i.x+t.x,r=i.y+t.y;let a=e.p1.x-t.x,o=e.p1.y-t.y,s=oS(a,o,90);return a=s.x+t.x,o=s.y+t.y,{p1:{x:a,y:o},p2:{x:n,y:r}}};function cS(e,t,n=0){if(n<0&&(n+=360),n>90&&n<=180?n+=180:n>180&&n<=270&&(n-=180),n===0||n===180)return{height:t.height,width:t.width};if(n===90||n===270)return{height:t.width,width:t.height};let r=Zx({...t,x:0,y:0}),i=Zx({...e,x:0,y:0});i=Jx(i,{x:t.width/2-e.width/2,y:t.height/2-e.height/2}),i=$x(i,n);let a=aS(i),o=aS(r);if(n>90){let e=iS(a.top,o.top);if(e){let t=e,n=iS(a.bottom,o.bottom,!1)||i[rS];i[eS]=iS(a.top,sS(a.bottom,n),!1)||i[eS],i[tS]=t,i[rS]=n,i[nS]=iS(a.bottom,sS(a.top,t),!1)||i[nS],a=aS(i)}let t=iS(a.top,o.left);if(t){let e=t,n=iS(a.bottom,o.right,!1)||i[nS];i[eS]=e,i[tS]=iS(a.top,sS(a.bottom,n),!1)||i[tS],i[rS]=iS(a.bottom,sS(a.top,e),!1)||i[rS],i[nS]=n}}else if(n<90){let e=iS(a.top,o.top);if(e){let t=e,n=iS(a.bottom,o.bottom,!1)||i[nS];i[eS]=t,i[tS]=iS(a.top,sS(a.bottom,n),!1)||i[tS],i[rS]=iS(a.bottom,sS(a.top,t),!1)||i[rS],i[nS]=n,a=aS(i)}let t=iS(a.top,o.right);if(t){let e=t,n=iS(a.bottom,o.left,!1)||i[rS];i[eS]=iS(a.top,sS(a.bottom,n),!1)||i[eS],i[tS]=e,i[rS]=n,i[nS]=iS(a.bottom,sS(a.top,e),!1)||i[nS]}}i=$x(i,-n);let s=Qx(i);return{width:s.width,height:s.height}}var lS=class{constructor(e,t){this._mapStylesByName=new Map,this._arrStyleNames=[],this._mapStylesByName=e,this._arrStyleNames=t}setNode(e){this._node=e}addStyle(e,t){t!=null&&(this._node?.styles||(this._node.styles=new Map),this._node.styles.set(e,t))}addAttribute(e,t){t!=null&&(this._node?.attributes||(this._node.attributes=new Map),this._node.attributes.set(e,t),e.toLowerCase()===`rowspan`&&parseInt(t)>1&&(this._node.rowspan=parseInt(t)),e.toLowerCase()===`colspan`&&parseInt(t)>1&&(this._node.colspan=parseInt(t)))}addSharedStyle(e,t){let n=this._mapStylesByName.get(e);n?n={...t}:(this._arrStyleNames.push(e),n=t),this._mapStylesByName.set(e,n)}setPlainText(e){this._node.plainText=e}setHTMLText(e){this._node.htmlText=e.replace(/(?:\r\n|\r|\n)/g,`<br>`)}};function uS(e,n=` `){return new Promise((r,i)=>{Promise.resolve().then(()=>require("./CbLXP9WY38wTcGn5.cjs")).then(e=>t.t(e.default,1)).then(t=>{try{let i=t.parse(e,{delimiter:n}).data;i.length>1&&(i[i.length-1].length===0||i[i.length-1].length===1&&i[i.length-1][0].length===0)&&i.pop(),r(i)}catch(e){console.warn(e),i(e)}},e=>{i(e)})})}var dS=e=>{let t={};if(!e)return t;e.endsWith(`;`)||(e+=`;`);let n,r=RegExp(`;(?=([^"]*"[^"]*")*[^"]*$)`,`gsm`),i=0;for(;(n=r.exec(e))!==null;){try{let r,a,o,s=e.substring(i,n.index).trim(),c=RegExp(`:(?=([^"]*"[^"]*")*[^"]*$)`,`gsm`);for(;(o=c.exec(s))!==null;)r=unescape(s.substring(0,o.index)).trim(),a=unescape(s.substring(o.index+1,s.length)).trim();r!==void 0&&a!=null&&a!==`null`&&(r=w(r),t[r]=a)}catch(e){console.warn(e)}i=n.index+1}return t},fS=(e,t)=>{let n=[];if(!e)return n;let r=e.children;for(let e=0;e<r.length;e++){let i=r.item(e);if(i.nodeType===1){let e=i.tagName.toUpperCase();t.includes(e)&&n.push(i)}}return n};function pS(e,t,n){try{let r=null,i=null,a=e=>((e,t)=>{if(!e)return{};let n={},r=t.get(e.localName);r&&(n=Object.assign(n,r));let i=e.getAttribute(`class`);if(i){let e=t.get(`.`+i);e&&(n=Object.assign(n,e))}let a=e.getAttribute(`style`);if(a){let e=dS(a);e&&(n=Object.assign(n,e))}return e.getAttribute(`align`)&&!n.textAlign&&(n.textAlign=e.getAttribute(`align`)),n})(e,i);if(e)try{r=[];let o=`P, H1, H2, H3, H4, H5, H6, PRE`,s=e.querySelector(`parsererror`);if(s)return console.warn(`error`,s),!1;let c=e.querySelectorAll(`html`),l=c[c.length-1];i=(e=>{let t=e.querySelectorAll(`style`),n=new Map;if(t.length<=0)return n;for(let e=0;e<t.length;e++){let r=t[e].childNodes;for(let e=0;e<r.length;e++)if(r[e].nodeType===Node.TEXT_NODE){let t=RegExp(`<!--(.*)-->`,`gs`),i=r[e].textContent,a=t.exec(r[e].textContent);if(a&&a.length>1&&(i=a[1]),i=i.replace(/^\s/,``),i?.startsWith(`table`)){let e,t=RegExp(`{(.*?)}`,`gs`),r=0;for(;(e=t.exec(i))!==null;)try{let t=i.substring(r,e.index),a=dS(e[1]);n.set(t.trim(),a),r=e.index+e[0].length}catch(e){console.warn(e)}return n}}}return n})(l);let u=l.querySelectorAll(`body`),d=u[u.length-1],f=d.querySelectorAll(`table`)[0],p=!1;if(!f){let e=d.querySelectorAll(`span`);f=e[0],p=e.length>1}if(f||=fS(d,o)[0],f||=fS(e,o)[0],f?.nodeName.toUpperCase()===`TABLE`){n.onStart?.(i);let e=f;n.onTableStart?.(a,e);let t=fS(e,`COLGROUP`);for(let e=0;t&&e<t.length;e++){let r=fS(t[e],`COL`),i=0;for(let e=0;e<r.length;e++){let t=r[e],o=parseFloat(t.getAttribute(`span`)),s=isNaN(o)?1:o;n.onColumn?.(i,s,a,t),i+=s}}let o=e.rows,s=0;for(let e=0;e<o.length;e++){let t=o[e],i=parseFloat(t.getAttribute(`span`)),c=isNaN(i)?1:i;n.onRowStart?.(s,c,a,t);let l=[];r.push(l);let u=t.cells;for(let e=0;e<u.length;e++){let t=u[e],n=!1;for(let e=0;!n&&e<t.childNodes.length;e++)if(t.childNodes[e].nodeType===8){let r=t.childNodes[e].textContent;if(r!==`[if gte vml 1]`&&r!==`[if !vml]`&&r===`[endif]`){let r=t.childNodes[e+1];r?.querySelectorAll&&r.querySelectorAll(`table, td`).length===2&&(t=r?.querySelectorAll(`table, td`)[1],n=!0)}}l.push({htmlValue:t.textContent?.replace(/^"|"$/gi,``),element:t})}s+=c,n.onRowDow?.(s,c,a,t)}n.onTableDone?.(a,e)}else{if(f?.nodeName.toUpperCase()===`SPAN`){let e=t?t[0]?.[0]:null,r=p&&e?e:f.textContent.replace(/^"|"$/gi,``);return n.onStart?.(i),n.onCell({colStart:0,colEnd:0,rowStart:0,rowEnd:0},t?t[0]?.[0]:null,r,e=>{let t=a(e);return delete t.backgroundColor,t},f),n.onDone?.(),!0}if(f?.textContent){let e=f.textContent.replace(/^"|"$/gi,``);return n.onStart?.(i),n.onNoTable?.(e,a,f),n.onDone?.(),!0}}}catch(e){console.warn(e),r=null}!r||r.length!==0&&(r.length!==1||r[0]!==null&&r[0].length!==0)||(r=null);let o=t&&(t.length===0||t.length===1&&(t[0]===null||t[0].length===0));r&&o&&(t=null);let s=e=>{let n=new Set,i=1,o=1;for(let s=0;s<Math.max(t?t.length:0,r?r.length:0);s++){let c=0,l=0,u=r&&r[s]?r[s].length:t&&t[s]?t[s].length:0;for(;l<u;){let u=s+`-`+c;if(!n.has(u)){i=Math.max(i,c+1),o=Math.max(o,s+1);let u=null,d=r?r[s]?.[l]?.element:void 0;if(d&&(d.getAttribute(`rowspan`)||d.getAttribute(`colspan`))){let e=parseInt(d.getAttribute(`colspan`))||1,t=parseInt(d.getAttribute(`rowspan`))||1;i=Math.max(i,c+e),o=Math.max(o,s+t),u={rowStart:s,colStart:c,rowEnd:s+Math.max(0,t-1),colEnd:c+Math.max(0,e-1)};for(let r=s;r<s+t;r++)for(let t=c;t<c+e;t++)r===s&&t===c||n.add(r+`-`+t)}else u={rowStart:s,colStart:c,rowEnd:s,colEnd:c};e(u,t?t[s]?.[c]:void 0,r?r[s]?.[l]?.htmlValue:null,a,d||null),l++}c++}}};if(r&&t){let e=0,n=0;s(t=>{e=Math.max(e,t.colEnd+1),n=Math.max(n,t.rowEnd+1)}),t&&r&&(t.length!==n||t[0].length!==e)&&(console.warn(`mismatched mimeTypes`,t,r),t=null)}return s(n.onCell.bind(n)),n.onDone?.(),!o||r!==null}catch(e){throw console.warn(e),e}}var mS=(e,t)=>{var n;if(t){if(t.getType()===Y.Type.Solid)e.background=lp(t.getColor())||`none`,e[`mso-pattern`]=`black none`;else if(t.getType()===Y.Type.Pattern){let r=t;e.background=lp(r.getBackground())||`none`;let i=lp(r.getForeground())||``;if(r.getPatternType()===Y.BuiltInSheetPattern.Solid)e[`mso-pattern`]=`${e.background} none`,e.background=i;else{let t=(n=r.getPatternType(),Tp.get(n)?.cssKey??`solid`);e[`mso-pattern`]=i+(t?` `:``)+t}}else if(t.getType()===Y.Type.Gradient){let n=t;e.background=lp(n.getStops()?.[0]?.getColor())||`auto`,e[`mso-pattern`]=`${e.background} none`,e.msoGradient=Ap(n)||`auto`}}},hS=class{constructor(e,t){if(this._visitedStyles=new Map,this._lastStyleClassId=63,this._wroteTD=!1,!e)throw Error(`Can not create with a null sheet.`);this._sheet=e,this._includeSizeInCell=t?.includeSizeInCell??!1,this._textOptions=t?.showFormulas?_S:gS,this._normalStyle=e.getStyles().getNormal()}_createCSSStyle(e){let t=this._normalStyle,n={},r=(e,t)=>e===t||!(e&&!t)&&!(!e&&t)&&t.isEqual?.(e),i=e.getFont(),a=t.getFont();var s;r(i.getColor(),a.getColor())||(n.color=lp(i.getColor())),r(i.getSize(),a.getSize())||(n[`font-size`]=up(i.getSize())),r(i.getWeight(),a.getWeight())||(n[`font-weight`]=i.getWeight()),r(i.getStyle(),a.getStyle())||(n[`font-style`]=i.getStyle()),r(i.getUnderline(),a.getUnderline())||(n[`text-decoration`]=`underline`,n[`text-underline-style`]=(s=i.getUnderline())===U.UnderlineStyle.Single?`single`:s===U.UnderlineStyle.Double?`double`:s===U.UnderlineStyle.SingleAccounting?`single-accounting`:s===U.UnderlineStyle.DoubleAccounting?`double-accounting`:`none`),r(i.getFamily(),a.getFamily())&&r(i.getFallbacks(),a.getFallbacks())||(n[`font-family`]=_p(i.getFamily(),i.getFallbacks())),r(e.getNumberFormat(),t.getNumberFormat())||(n[`mso-number-format`]=vp(e.getNumberFormat()));let c=e.getAlignment(),l=t.getAlignment();if(!r(c.getHorizontal(),l.getHorizontal())){let e=c.getHorizontal();e===o.HorizontalAlignment.CenterContinuous?n[`text-align`]=`center-across`:e===o.HorizontalAlignment.Fill?n[`text-align`]=`fill`:e===o.HorizontalAlignment.Distributed?n[`text-align`]=c.getJustifyLastLine()?`121`:`010`:n[`text-align`]=o.toCSSHorizontalTextAlign(e)}if(!r(c.getVertical(),l.getVertical())){let e=c.getVertical();e===o.VerticalAlignment.Distributed?n[`vertical-align`]=`121`:n[`vertical-align`]=hp(e)}if(!r(c.getOverflow(),l.getOverflow())){let e=c.getOverflow();n[`white-space`]=gp(e),e===o.Overflow.Shrink&&(n[`mso-text-control`]=`shrinktofit`)}var u;r(c.getRotation(),l.getRotation())||(n[`mso-rotate`]=(u=c.getRotation(),(u%=360)<0&&(u+=360),u>180?u=360-u:u>1&&(u*=-1),u)),r(c.getIndent(),l.getIndent())||(n[`mso-char-indent-count`]=c.getIndent()),r(e.getFill(),t.getFill())||mS(n,e.getFill());let d=e.getBorder();return d.getTop().isNone()||(n[`border-top`]=Np(d.getTop())),d.getLeft().isNone()||(n[`border-left`]=Np(d.getLeft())),d.getRight().isNone()||(n[`border-right`]=Np(d.getRight())),d.getBottom().isNone()||(n[`border-bottom`]=Np(d.getBottom())),d.getDiagonalUp().isNone()||(n[`border-mso-diagonal-up`]=Np(d.getDiagonalUp())),d.getDiagonalDown().isNone()||(n[`border-mso-diagonal-down`]=Np(d.getDiagonalDown())),Object.keys(n).length===0?null:n}_createCSSNormalStyle(){let e=this._normalStyle,t={"padding-top":`1px`,"padding-left":`1px`,"padding-right":`1px`,"mso-ignore":`padding`},n=e.getFont(),r=e.getAlignment();return t.color=lp(n.getColor()),mS(t,e.getFill()),t[`font-size`]=up(n.getSize()),t[`font-weight`]=n.getWeight(),t[`font-style`]=n.getStyle(),t[`text-decoration`]=dp(n.getUnderline(),n.getStrike()),t[`font-family`]=_p(n.getFamily(),n.getFallbacks()),t[`mso-font-charset`]=`0`,t[`mso-background-source`]=`auto`,t[`mso-number-format`]=vp(e.getNumberFormat()),t[`text-align`]=o.toCSSHorizontalTextAlign(r.getHorizontal()),t[`vertical-align`]=hp(r.getVertical()),t.border=`none`,t[`mso-pattern`]=`auto`,t[`white-space`]=gp(r.getOverflow()),r.getOverflow()===o.Overflow.Shrink&&(t[`mso-text-control`]=`shrinktofit`),t[`mso-rotate`]=`0`,r.getIndent()>0&&(t[`mso-char-indent-count`]=r.getIndent()),t[`mso-protection`]=`locked visible`,t}onCell(t,n,r){let i=t.getSpans();if(i.width>1||i.height>1){if(!t.isTopLeft())return!1;i.height>1&&r.addAttribute(`rowspan`,i.height),i.width>1&&r.addAttribute(`colspan`,i.width)}let a=this._textOptions,o=t.getText(a);!a.showFormulas&&t.getNumberFormat().errorPlaceholder&&(o=t.getNumberFormat().errorPlaceholder.repeat(5)),r.setPlainText(o||``);let s=t.getStyle(),c=s.getFont();if(c.getVerticalAlignment()===U.VerticalAlignment.Super&&(o=`<sup>${o}</sup>`),c.getVerticalAlignment()===U.VerticalAlignment.Sub&&(o=`<sub>${o}</sub>`),c.getStrike()&&(o=`<s>${o}</s>`),t.getHyperlink()&&(o=`<a href="${t.getHyperlink().getAddress()}">${o}</a>`),r.setHTMLText(o||` `),!this._wroteTD){let e=this._createCSSNormalStyle();r.addSharedStyle(`td`,e),this._wroteTD=!0}let l=this._visitedStyles.get(s);if(!l){let e=this._createCSSStyle(s);e&&(l=`xl`+ ++this._lastStyleClassId,this._visitedStyles.set(s,l),r.addSharedStyle(`.`+l,e))}if(l&&r.addAttribute(`class`,l),this._includeSizeInCell){let t=this._sheet.getColumnHeaders().at(n.colIndex).getSize();r.addAttribute(`width`,t),r.addStyle(`width`,e.A.roundAccurately(t/U.getDeviceScale(),2)+`pt`);let i=this._sheet.getRowHeaders().at(n.rowIndex).getSize();r.addAttribute(`height`,i),r.addStyle(`height`,e.A.roundAccurately(i/U.getDeviceScale(),2)+`pt`)}}onRow(t,n,r,i){let a=t.getSize();i.addAttribute(`height`,a),i.addStyle(`height`,e.A.roundAccurately(a/U.getDeviceScale(),2)+`pt`),t.isCustomSize()&&i.addStyle(`mso-height-source`,`userset`)}onColumn(t,n,r,i){let a=t.getSize();i.addAttribute(`width`,a),i.addStyle(`width`,e.A.roundAccurately(a/U.getDeviceScale(),2)+`pt`),t.isCustomSize()&&i.addStyle(`mso-width-source`,`userset`),r>1&&i.addAttribute(`colspan`,r)}},gS={useFormattingCategory:!0},_S={showFormulas:!0};function vS(t,n,r,i=!1){let a=n.rowEnd-n.rowStart+1,o=n.colEnd-n.colStart+1,s=i?o:a,c=i?a:o,l=Math.max(1,Math.ceil((r.rowEnd-r.rowStart+1)/s)),u=Math.max(1,Math.ceil((r.colEnd-r.colStart+1)/c)),d=(e,t,n,r,i)=>{if(t-e+1===r)return[[n+e,n+(i-1)*r+t]];let a=[];for(let o=0;o<i;o++)a.push([n+o*r+e,n+o*r+t]);return a},f=[];for(let a=0;a<t.length;a++){let o=t[a],p=o.rowStart-n.rowStart,m=o.rowEnd-n.rowStart,h=o.colStart-n.colStart,g=o.colEnd-n.colStart,_=i?p:h,v=i?m:g,y=d(i?h:p,i?g:m,r.rowStart,s,l),b=d(_,v,r.colStart,c,u);for(let t=0;t<y.length;t++)for(let n=0;n<b.length;n++){let i={rowStart:y[t][0],rowEnd:y[t][1],colStart:b[n][0],colEnd:b[n][1]},a=e.l.intersectRanges(i,r);a&&f.push(a)}}return K_(e.l.EmptyRanges,f)}function yS(t,r,i){let a=t.getAxis()===n.l.Axis.Column,o=e.v(a?`copy.columnCopy`:`copy.rowCopy`),s=t.getSnapshot(i);return{...s,getName:()=>e._(o),getCoords:()=>r,copyTo:async(e,t)=>{let n=a?e.getColumnHeaders():e.getRowHeaders(),o={...i,...t};if(!0===o.includeHeaders){let e=await s.copyTo(n,o);return a?{colStart:e.min,rowStart:r.rowStart,colEnd:e.max,rowEnd:r.rowEnd}:{colStart:r.colStart,rowStart:e.min,colEnd:r.colEnd,rowEnd:e.max}}},getMarkOptions:()=>i}}var bS=class e{constructor(e,t,n,r,i){this._getColumnAt=void 0,this._index=e,this._sheetHeader=t,this._headerState=n,this._template=r,this._getColumnAt=i}getSize(){let e=this._headerState?.sz;return Math.round(e===void 0?this._sheetHeader.getDefaultSize():e*this._sheetHeader.getScaleFactor())}getText(){return``+this.asCell().getValue()}getAxis(){return this._sheetHeader.getAxis()}isHidden(){return this._headerState?.h??!1}isCustomSize(){return this._headerState?.cs??!1}getSheetHeader(){return this._sheetHeader}getColumn(){return this._getColumnAt?.(this._index)??null}asCell(){return this._cellTemplate||=this._sheetHeader.getSheet().createCell(this._template),this._cellTemplate}getSizeRelative(){return this.getSize()/this._sheetHeader.getScaleFactor()}createCellHeader(t){let n=xS(this._sheetHeader,this._sheetHeader.getSheet().getStyles(),this._headerState,t);return new e(this._index,this._sheetHeader,n,this._template,this._getColumnAt)}isEqual(e){if(!e)return!1;if(e===this)return!0;let t=e;if(!t.isICellHeader)return!1;let n=this._headerState,r=t._headerState;return n===r||!(n&&!r||r&&!n)&&this.getSize()===t.getSize()&&this.isCustomSize()===t.isCustomSize()&&this.isHidden()===t.isHidden()}isEmpty(){let e=this._headerState;return!e||e.sz===void 0&&e.csz===void 0&&!e.cs&&e.h===void 0}get[Symbol.toStringTag](){return`[SheetCellHeader]`}toString(){return`[SheetCellHeader: ${this.getText()}]`}get isICellHeader(){return!0}};function xS(t,n,r,i){if(i!==void 0){if(i===null)return null;if(i?.isICellHeader)return{...i._headerState};if(i){let a,o=i,s=o.hidden;r&&(a={...r});let c,l=o.size;if(o.size!==void 0){if(typeof l==`function`){let e=r?.sz===void 0?t.getDefaultSize():r?.sz*t.getScaleFactor();l=l?.(e)}if(typeof l==`string`&&(l=wp(l,n.getNormal().getFont().getSize(),`px`)),typeof l==`number`){let n=t.getMinSize(),r=t.getMaxSize();l=Math.max(n,Math.min(e.A.roundAccurately(l),r)),!0!==o.relativeSize&&(l/=t.getScaleFactor()),isNaN(l)&&(console.warn(`Invalidate size: '${l}'`),l=void 0),l===0&&(s=!0,l=void 0),c=!o.autoSize}l===null&&(c=!o.autoSize)}return l!==void 0&&r?.sz!==l&&(a||={},l===null?delete a.sz:a&&(a.sz=l)),s===void 0&&o.autoSize&&(s=!1),s!==void 0&&r?.h!==s&&(s?(a||={},a.h=s):a&&delete a.h),c!==void 0&&r?.csz!==c&&(c?(a||={},a.csz=c):a&&delete a.csz),a?Object.keys(a).length===0?null:a:null}}}function SS(e,t){return Math.round(e*t)}function CS(e,t,n,r){if(e==null)return null;let i,a,o={};if(typeof e==`number`)o.colStart=e,o.colEnd=e,o.rowStart=e,o.rowEnd=e;else if(typeof e==`string`){if(t){if(e.match(/[0-9]+/))throw Error(`Invalid range address for header axis`)}else if(e.match(/[a-zA-Z]+/))throw Error(`Invalid range address for header axis`);let r=El(e,n);if(!r){let t=wl(e.toUpperCase(),!0);t?.colIndex!==void 0&&(o.colStart=t.colIndex,o.colEnd=t.colIndex),t?.rowIndex!==void 0&&(o.rowStart=t.rowIndex,o.rowEnd=t.rowIndex)}o={...o,...r}}return t?(i=e.min??e.colStart??o.colStart,a=e.max??e.colEnd??o.colEnd):(i=e.min??e.rowStart??o.rowStart,a=e.max??e.rowEnd??o.rowEnd),i===void 0||a===void 0?null:{min:i,max:a}}var wS,TS=()=>{},ES=()=>0,DS=()=>!1,OS=class{constructor(e,t){this._header=e,this._coords=t}_forEachSpan(e,t,n){let r=this._header,i=this._coords,a=r._options;n||=a.createCellHeader;let o=i;if(t?.address){let e=r._parseHeaderRangeAddress(t?.address);if(e&&(o=Gr(i,e),!o))return}let s=r._scanHeaders(e,this._header._getState(),n,a,o,t);if(s&&s.break)return s.break}forEachSpan(e,t){return this._forEachSpan(e,t)}forEach(e,t){let n,r=2**53-1,i=null,a={getIndex:()=>r,getCellHeader:()=>i.getCellHeader(),getAddress:(e,t)=>i.getAddress(e,t),getCoords:()=>i.getCoords()};return this._forEachSpan((t,o)=>{i=o;let s=this._coords,c=s.max;for(let i=s.min;i<c;i++)r=i,n=i-s.min,e(t,a)},t,()=>this.at(n))}updateHeaders(t,n){let r=this._header;return r.updateHeaderPairs([{address:this._coords,update:t}],{description:n?.description??(r._isColumn?e._(`op.updateColumnsRange`,{range:toString()}):e._(`op.updateRowsRange`,{range:toString()})),...n}),this}getCoords(){return{...this._coords}}getUsedRange(e){let t=this._header,n=t._headerRunCoords;return!n||n.min<0||n.max>t._maxDataIndex?null:Gr(n,this._coords)?t.getRange(n,e):null}getCount(){let e=this._coords;return e.max-e.min+1}getHeaderCount(){let e=this._coords;return e.max-e.min+1}getVisibleCount(){let e=this._coords;return this._header.getVisibleCount(e.min,e.max)}isEntireHeaders(){let e=this._header._entireRunCoords,t=this._coords;return!(t.min>e.min||t.max<e.max)}getSnapshot(e){return this._header._getSnapshot(this._coords,e)}setSize(e,t){return this._header._setSize(this._coords,e,t),this}setHidden(e,t){return this._header._setHidden(this._coords,e,t),this}clear(){return this._header._clear(this._coords),this}at(e){return this._header.at(this._coords.min+e)}getAxis(){return this._header.getAxis()}doBatch(e,t){return this._header.doBatch(t=>e(t),t)}getSheetHeader(){return this._header}getAddress(e){let t=this._coords,n=this._header;return Sl(n._isColumn?{colStart:t.min,colEnd:t.max}:{rowStart:t.min,rowEnd:t.max},n._entireRangeCoords)??`#REF!`}get[Symbol.toStringTag](){return`[SheetCellHeaderRange]`}toString(){return this.getAddress()}get isICellHeaderRange(){return!0}},kS=class{constructor(e,t){this._header=e,this._coords=t}updateHeaders(t,n){let r=this._header;return r.updateHeaderPairs([{address:this._coords,update:t}],{description:n?.description??(r._isColumn?e._(`op.updateColumnsRange`,{range:toString()}):e._(`op.updateRowsRange`,{range:toString()})),...n}),this}getCoords(){return[...this._coords]}setHidden(e,t){return this._header._setHidden(this._coords,e,t),this}setSize(e,t){return this._header._setSize(this._coords,e,t),this}getCount(){return this._coords.length}getHeaderCount(){let e=Xr(this._coords,!0),t=0,n=e.length;for(let r=0;r<n;r++){let n=e[r];t+=n.max-n.min+1}return t}getVisibleCount(){let e=Xr(this._coords,!0),t=0,n=this._header,r=e.length;for(let i=0;i<r;i++){let r=e[i];t+=n.getVisibleCount(r.min,r.max)}return t}isEntireHeaders(){let e=this._header._entireRunCoords,t=this._coords,n=e.min,r=e.max,i=t.length;for(let e=0;e<i;e++){let i=t[e];if(n<i.min||r>i.max)return!1}return!0}isEntireHeadersAny(){let e=this._header._entireRunCoords,t=this._coords,n=e.min,r=e.max,i=t.length;for(let e=0;e<i;e++){let i=t[e];if(i.min<=n&&i.max>=r)return!0}return!1}clear(){return this._header._clear(this._coords),this}at(e){let t=this._coords;return e<0||e>=t.length?null:this._header.getRange(t[e])}getAxis(){return this._header.getAxis()}doBatch(e,t){return this._header.doBatch(t=>e(t),t)}getSheetHeader(){return this._header}getAddress(e){let t=this._coords,n=this._header;return function(e,t,n=Sl){if(!e)return`#REF!`;let r=e.length,i=Array(r);for(let a=0;a<r;a++)i[a]=n(e[a],t);return i.join(`,`)}(Yr(t,n._entireRangeCoords,n._isColumn),n._entireRangeCoords)??`#REF!`}get[Symbol.toStringTag](){return`[SheetCellHeaderRanges]`}toString(){return this.getAddress()}get isICellHeaderRanges(){return!0}},AS=class{constructor(e){if(this._closed=!1,this._scaleFactor=1,this._defaultSize=-1,this._defaultCustomSize=-1,this._defaultPxSize=1,this._isColumn=!0,this._indexedSizes=[],this._indexedHidden=[],this._headerRunCoords=null,this._hasHidden=!1,this._hiddenSignature=0,this._lastHeaderRead=null,this._readCache=null,this._lastHeaders=null,this._lastVisibleRunsRead=null,this._lastVisibleRunCoords=null,this._selectionRuns=null,this._options={isProtected:()=>!1,scaleFactor:()=>1,defaultSize:()=>100,minSize:()=>0,maxSize:()=>500,getEntireSheetCoords:()=>null,axis:n.l.Axis.Column,createCellHeader:(t,n,r,i)=>new bS(t,n,r,i,e?.getColumnAt??jS),...e},!this._options.sheet)throw Error(`An ISheet must be provided`);this._emptyHeader=this._options.createCellHeader(0,this,null,null);let t=this._options.axis===n.l.Axis.Column;this._isColumn=t;let r=this;this._options.setContainerShiftedCallback&&this._options.setContainerShiftedCallback((e,t)=>{t<0?r._deleteHeaders(e,-t):r._insertHeaders(e,t)}),this._options.sheet&&(this._sheetRemoveListener=this._options.sheet.addListeners({onProtectionChange(){},onSelectionChange(e){r._selection=e.getSelection().getCoords(),r._selectionRuns=null},onStyleChange:()=>{},onViewChange(){let e=r._headers;r._invalidSizes(),r._invalidateMaxIndex(),r._emitter.notify(`onSizesChange`,{params:e})}},{transactional:!1}),r._selection=r._options.sheet.getSelection().getCoords()),this._transactions=this._options.transactions??new m({transient:!0}),this._id=this._transactions.create(),this._emitter=new v(r,this._transactions),this._transactionsRemoveListener=this._transactions.addStateListener(this._id,{onAfterStateChange(e){r._lastHeaders!==e.headers&&r._onHeaderChange(!0)},async onRestoreOrRevert(e){r._onHeaderChange(!0)}}),this.fromJSON(this._options?.json)}addListeners(e,t){return this._emitter.addListeners(e,t)}_invalidateMaxIndex(){let e=this._options.getEntireSheetCoords()??{colStart:0,rowStart:0,colEnd:2**53-1,rowEnd:2**53-1};this._entireSheetCoords=e;let t=this._isColumn,n=t?e.colEnd:e.rowEnd;this._entireRunMax=n,this._entireRunCoords={min:0,max:n},this._entireHeaderRange=this.getRange(this._entireRunCoords),this._entireRangeCoords={colStart:0,rowStart:0,colEnd:t?n:0,rowEnd:t?0:n}}_invalidSizes(e=!1){let t=this._defaultCustomSize===-1?this._options.defaultSize():this._defaultCustomSize;if(t<0)throw Error(`defaultSize must be greater than 0`);let n=this._options.scaleFactor();if(e||t!==this._defaultSize||n!==this._scaleFactor){this._defaultSize=t,this._scaleFactor=n,this._defaultPxSize=SS(t,n);let e=function(e,t,n){let r=[],i=[],a=[];if(!e||e.length===0)return{sizes:r,hidden:i};if(!t||!n)return console.warn(`_HeaderUtils:default size and scaleFactor should be available`),{sizes:r,hidden:i};let o=0,s=0,c=0,l=null,u=-2,d=null,f=-2,p=e.length;for(let m=0;m<p;m++){let p=e[m],h=p.min,g=p.max;if(o=r.length===0?0:r[r.length-1].runningOffsetMax,r.length>0&&r[r.length-1].spanSize>0&&o++,s<p.min){r.push({min:s,max:h-1,runningOffsetMin:o,runningOffsetMax:Math.round(o+(h-s)*t*n)-1,runningHiddenRuns:c,spanSize:Math.round(t*n)});let e=s,i=h-1;f+1===e?d.max=i:(d={min:e,max:i,value:!0},a.push(d)),f=i}let _=r.length,v=r[_-1];o=_===0?0:v.runningOffsetMax,_>0&&v.spanSize>0&&o++;let y=p.value,b=y.h?0:SS(y.sz??t,n),x=b===0?0:-1;b===0?(c+=g-h+1,u+1===h?l.max=g:(l={min:h,max:g,value:!0},i.push(l)),u=g):(f+1===h?d.max=g:(d={min:h,max:g,value:!0},a.push(d)),f=g),_>0&&v.spanSize===b&&v.max+1===h?(v.max=g,v.runningHiddenRuns=c,v.runningOffsetMax=v.runningOffsetMin+(g+1-v.min)*b+x):r.push({min:h,max:g,runningOffsetMin:o,runningOffsetMax:Math.round(o+(g+1-h)*b)+x,runningHiddenRuns:c,spanSize:b}),s=g+1}return{sizes:r,hidden:i}}(this._headers,t,n);this._indexedSizes=e.sizes,this._indexedHidden=e.hidden,this._lastVisibleRunsRead=null,this._lastVisibleRunCoords=null}}invalidate(){this._invalidSizes(!0),this._invalidateMaxIndex(),this._selection=this._options.sheet.getSelection()?.getCoords()}_onHeaderChange(e){this._lastHeaders=null;let t=this._headers,n=this._getState();this._defaultCustomSize=n.defaultCustomSize,this._invalidSizes(!0);let r=this._defaultCustomSize===-1?this._options.defaultSize():this._defaultCustomSize;this._lastHeaderRead=null,this._readCache=Kr(this._lastHeaders);let i=this._options.sheet.getStyles().getNormal(),a=!1,o=0,s=-1,c=t.length,l=this._entireRunMax;for(let e=c-1;e>=0;e--){let n=t[e],c=n.value,l=c.s,u=c.csz||c.sz!==r;s!==-1||!u&&l===i||(s=n.max),(c.h||c.sz===0)&&(a=!0,o=Math.imul(o,31)+n.min|0,o=Math.imul(o,31)+n.max|0)}s=Math.min(s??0,l);let u=Math.min(t[0]?.min??s,s);this._headerRunCoords=Object.freeze({min:u,max:s}),this._hasHidden=a;let d=this._hiddenSignature!==o;this._hiddenSignature=o,e&&this._emitter.notify(`onSizesChange`),d&&this._emitter.notify(`onHiddenChange`)}getSheet(){return this._options.sheet}getAxis(){return this._isColumn?n.l.Axis.Column:n.l.Axis.Row}getTextAt(e){return this._options.getTextAt?.(e)??e+``}_scanHeaders(t,n,r,i,a,o){let s,c=a?.min??null,l=a?.max??null,u=o?.includeEmpty??!1,d=o?.includeStyles??!1,f=o?.visibility??`all`,p=o?.includeSizes??!1,m=this,h=this._options.sheet.getStyles().getNormal(),g=this._defaultSize,_=this._scaleFactor,v=n.headers,y=this._emptyHeader,b=null,x={getCoords(){if(!b)throw Error(e._(`error.sheet.iteratorClosed`));return{min:b.min,max:b.max}},getIndex:()=>b.min,getCellHeader(){if(!b)throw Error(e._(`error.sheet.iteratorClosed`));return b.value?r(c,m,b.value):y},getAddress(t,n=!1){if(!b)throw Error(e._(`error.sheet.iteratorClosed`));let r=t===void 0?b.min:Math.max(b.min,t),i=t===void 0?b.max:Math.min(b.max,t),a=m._parseHeaderRangeAddress({min:r,max:i}),o=m._entireRangeCoords,s=m._isColumn;return Sl({colStart:s?a.min:o.colStart,rowStart:s?o.rowStart:a.min,colEnd:s?a.max:o.colEnd,rowEnd:s?o.rowEnd:a.max},o,void 0,!0)??`#REF!`}},S=e=>{let n=e.value;if(!u&&!n)return;let r=u;if(p&&!r&&n&&(n.csz||n.sz!==g)&&(r=!0),d&&!r&&n&&(n.s&&n.s!==h||n.cs)&&(r=!0),n&&!0===n.h?r=f!==`visible`:f===`hidden`&&(r=!1),!r)return;let i=g;e.value&&(i=e.value.h?0:e.value?.sz??g),i*=_,b=e;let a=t(i,x);return a&&a.break?a:void 0};return s=f===`visible`?Jr(this._indexedHidden,e=>{if(!0===e.value)return;let t=c===null?e.min:Math.max(e.min,c),n=l===null?e.max:Math.min(e.max,l),r=Jr(v,S,t,n);return r&&r.break?r:void 0},c,l):Jr(v,S,c,l),b=null,s}getRange(t,n){if(!t)throw Error(e._(`error.address.noAddress`));let r=this._parseHeaderRangeAddress(t);return r.min<0||r.max>this._entireRunMax?function(e){return Object.freeze({getCoords:()=>null,getAxis:()=>e.getAxis(),toString:()=>ul,getAddress:()=>ul,getCount:ES,getHeaderCount:ES,getVisibleCount:ES,isEntireHeaders:DS,forEach:TS,forEachSpan:TS,getUsedRange:Z,getSnapshot:Z,updateHeaders:Z,clear:Z,setHidden:Z,setSize:Z,at:Z,doBatch:Z,getSheetHeader:()=>e,isICellHeaderRange:!0})}(this):new OS(this,r)}getRanges(t,n){if(!t)throw Error(e._(`error.address.noAddress`));let r=function(e,t,n){if(typeof e==`string`){let r=Ml(e,n),i=r?r.length:0,a=Array(i);for(let e=0;e<i;e++){let n=r[e];a[e]={min:t?n.colStart:n.rowStart,max:t?n.colEnd:n.rowEnd}}return e=a,a}Array.isArray(e)||(e=[e]);let r=e.length,i=Array(r);for(let a=0;a<r;a++)i[a]=CS(e[a],t,n);return i}(t,this._isColumn,this._entireRangeCoords);return new kS(this,r)}getSelectedRange(e){let t=this._options.sheet.getSelection().getRange().getCoords();return this.getRange(t,e)}getSelectedRanges(e){let t=this._options.sheet.getSelection().getRanges().getCoords();return this.getRanges(t,e)}getUsedRange(e){return this.getRange(this._headerRunCoords,e)}getEntireRange(e){return e?this.getRange(this._entireRangeCoords,e):this._entireHeaderRange}at(e){if(e<0||e>this._entireRunMax)return this._emptyHeader;if(this._lastHeaderRead?.offset===e)return this._lastHeaderRead.header;let t=qr(e,this._readCache),n=this._options.getTextAt?.(e)??e+``,r=this._options.createCellHeader(e,this,t,{value:n});return this._lastHeaderRead={offset:e,header:r},r}updateHeaderPairs(t,n){if(this.isProtected())throw Error(this._isColumn?e._(`error.sheetHeader.protectedColumns`):e._(`error.sheetHeader.protectedRows`));return this._updatePairsInternal(t,n)}_parseHeaderRangeAddress(t,n){if(t==null)throw Error(e._(`error.address.noRange`));let r=CS(t,this._isColumn,this._entireRangeCoords);if(!r)throw Error(e._(`error.address.invalidRangeHeader`));return r}_update(e,t,n){if(!e||(Array.isArray(e)||(e=[e]),e.length===0))return;let r=[],i=e.length;for(let n=0;n<i;n++){let i=this._parseHeaderRangeAddress(e[n]);this.getRange(i).forEachSpan((e,n)=>{let i=n.getCoords();r.push({address:i,update:t})},{includeEmpty:!0})}return this.updateHeaderPairs(r,n),this}_setSize(t,n=null,r){r?.relativeSize||typeof n!=`number`||(n+=`px`);let i={size:n,autoSize:r?.autoSize??!1},a=this._isColumn?e.v(`op.resizeColumns`):e.v(`op.resizeRows`);return this._update(t,i,{description:a,...r}),this}_setHidden(t,n=null,r){let i={hidden:n},a=this._isColumn?e.v(n?`op.unhideColumns`:`op.hideColumns`):e.v(n?`op.unhideRows`:`op.hideRows`);return this._update(t,i,{description:a,...r}),this}_clear(t,n){let r=this._isColumn?e.v(`op.clearColumnHeaders`):e.v(`op.clearRowHeaders`);this.updateHeaderPairs([{address:t,update:null}],{description:r,...n})}_getSnapshot(t,n){if(t.min<0)return e.A.EmptyArray;n=Object.freeze({...n});let r=this,i=this._getState(),a=this._isColumn?e.v(`copy.columnHeaders`):e.v(`copy.rowHeaders`);return{copyTo(o,s){let c={...n,...s},l=o.getCoords(),u=l.min-t.min,d=[];if(r._scanHeaders((e,t)=>{let n=t.getCoords();d.push({address:{min:n.min+u,max:n.max+u},update:t.getCellHeader()})},i,r._options.createCellHeader,null,t,{includeSizes:!0,includeStyles:!0}),!c.fitDestination){let n=t.max-t.min+1,r=l.max-l.min+1,i=e.A.roundAccurately(r/n);if(i>1&&r%n===0){let e=d.length;for(let t=0;t<i;t++)for(let r=0;r<e;r++){let e=d[r],i=e.address,a=(t+1)*n;d.push({address:{min:i.min+a,max:i.max+a},update:e.update})}}}if(o.doBatch(()=>{o.clear(),o.getSheetHeader()._updatePairsInternal(d)},a),c.isCut){let e=r._entireRunCoords;t.min<=e.min&&t.max>=e.max&&r._clear(t)}return l},getCoords:()=>t,toText:()=>null,toHtml:()=>null,toImage:()=>null,getSource:()=>r,getName:()=>a,isISnapshot:!0}}isProtected(){return this._options?.isProtected()??!1}getScaleFactor(){return this._options.scaleFactor()??1}get _headers(){return this._lastHeaders===null&&(this._lastHeaders=this._getState()?.headers),this._lastHeaders}_updatePairsInternal(t,n){if(!t||t.length===0)return null;let r=n?.skipCustomSize??!1,i=this._isColumn,a=this.getSheet().getStyles(),o=this._beginCommit({description:n?.description??e.v(i?`op.updateColumns`:`op.updateRows`)}),s=[...this._getState().headers],c=!1,l=this,u=this._defaultCustomSize===-1?this._options.defaultSize():this._defaultCustomSize,d=(t,n)=>{if(this.isProtected())throw Error(this._isColumn?e._(`error.sheetHeader.protectedColumns`):e._(`error.sheetHeader.protectedRows`));s=Vr(Br(s,{min:t.min,max:t.max,value:n},{onUpdate:(e,t)=>{if(r&&(e?.csz||e?.h))return e;let n=xS(l,a,e,t);return n===void 0?e:n?e?(c||=n.sz!==e.sz,c||=n.h!==e.h,n):(c=!0,n):(e&&(c=!0),n)},onSplit:e=>[e.value,e.value],onMerge:(e,t,n,r)=>{if(!(e&&!t||!e&&t||!e&&!t)&&e.sz===t.sz&&e.csz===t.csz&&e.h===t.h&&e.cs===t.cs)return e},isCull:(e,t,n)=>e===void 0}))},f=this._entireRunMax,p=t.length,m=Array(p);for(let n=0;n<p;n++){let r=t[n],i=this._parseHeaderRangeAddress(r.address);if(i.min<0||i.max>f)throw new e.C(e._(`error.sheet.oobRange`));d(i,r.update),m[n]=i}let h=!1,g=s.length;if(g>0&&s[0].min===0&&s[g-1].max===f){let e=s[0],t=!1,n=-1;for(let r=0;!t&&r<g;r++){let i=s[r],a=i.min;if(n+1!==a){t=!0;continue}let o=i.max;n=o,e.max-e.min<o-a&&(e=i)}t||(this._defaultCustomSize=e.value?.sz??-1,h=!0);let r=[];for(let e=0;e<g;e++){let t=s[e],n=t.value;if(n===null)continue;let i=Object.keys(n).length;if(i===0)continue;let a=n.sz;(i!==1||a===void 0||a!==null&&a!==u)&&r.push(t)}s=r,g=s.length}let _=[];for(let e=0;e<g;e++){let t=s[e],n=t.value;if(n===null)continue;let r=!1;n.sz!==void 0&&n.sz!==u&&(r=!0),n.csz!==void 0&&(r=!0),n.h!==void 0&&(r=!0),n.l!==void 0&&(r=!0),r&&_.push(t)}return h&&l._invalidSizes(!0),this._updateState({headers:_,defaultCustomSize:this._defaultCustomSize},c),o.commit(),m}hasHidden(){return this._hasHidden}getDefaultSize(){return this._defaultPxSize}getDefaultSizeNative(){return this._defaultSize}getMaxSize(){return Math.ceil(this._options.maxSize()*this._options.scaleFactor())}getMinSize(){return Math.floor(this._options.minSize()*this._options.scaleFactor())}getOffset(t){return function(t,n,r){if(n<=0)return 0;let i=t?t.length:0;if(i===0)return n*r;let a=t[i-1];if(n>a.max)return a.runningOffsetMax+Math.round((n-a.max-1)*r+(a.spanSize===0?0:1));let o=t[i===1?0:e.A.findEqualOrGreater(t,n,e=>e.max)],s=n-o.min;return o.runningOffsetMin+s*o.spanSize}(this._indexedSizes,t,this._defaultPxSize)}getIndex(t){return Math.min(Math.max(0,function(t,n,r){let i=t?t.length:0;if(i===0)return Math.floor(n/r);let a=t[i-1];if(n>a.runningOffsetMax)return a.max+Math.ceil((n-a.runningOffsetMax)/r);let o=t[i===1?0:e.A.findEqualOrGreater(t,n,e=>e.runningOffsetMax)];if(o.spanSize===0)return Math.max(0,o.min-1);let s=n-o.runningOffsetMin;return o.min+Math.floor(s/o.spanSize)}(this._indexedSizes,t,this._defaultPxSize)),this._entireRunMax)}getVisibleIndex(t){return this._lastVisibleRunsRead===t||(this._lastVisibleRunCoords=function(t,n,r=2**53-1){let i=t?t.length:0;if(i===0)return{min:n,max:n};let a=i-1,o=t[a];if(n>o.max){let e=n-o.runningHiddenRuns;return{min:e,max:e}}a=i===1?0:e.A.findEqualOrGreater(t,n,e=>e.max),o=t[a];let s=o.spanSize===0?Math.max(-1,o.min-1-(t[a-1]?.runningHiddenRuns??1)):n-o.runningHiddenRuns;return{min:s,max:s+Math.min(r+1,+(o.spanSize===0))}}(this._indexedSizes,t,this._entireRunMax),this._lastVisibleRunsRead=t),this._lastVisibleRunCoords}getSpanSize(e,t=e+1){return this.getOffset(t)-this.getOffset(e)}getVisibleCount(t,n){if(t>n)throw Error(e._(`error.address.invalidArguments`));if(t<0||n>this._entireRunMax)throw new e.C;return this._hasHidden?function(t,n,r){let i=r-n+1;if(t.length===0)return i;let a=t.length-1,o=t[a];if(n>o.max)return i;a=t.length===1?0:e.A.findEqualOrGreater(t,n,e=>e.max),o=t[a];let s=o.runningHiddenRuns;if(o.spanSize===0&&n<=o.max){let e=o.max-o.min+1;i-=Math.min(e,o.max-n+1)}r>o.max&&a<t.length&&(a=e.A.findEqualOrGreater(t,r,e=>e.max),o=t[Math.min(a,t.length-1)]);let c=o.runningHiddenRuns;if(o.spanSize===0&&o.min<=r){let e=o.max-o.min+1;i-=Math.min(e,r-o.min+1),c-=e}return i-=c-s,i}(this._indexedSizes,t,n):n-t+1}isSelectedAll(t){let n=this.getSelectedRuns();if(n.length===0)return!1;let r=n[e.A.findEqualOrGreater(n,t,e=>e.max)];return!(!r||t<r.min||t>r.max)&&r.value}isSelected(t){let n=this.getSelectedRuns();if(n.length===0)return!1;let r=n[e.A.findEqualOrGreater(n,t,e=>e.max)];return!(!r||t<r.min||t>r.max)}getSelectedRuns(){let t=this._selectionRuns;return t||(this._selection&&(t=N_(this.getAxis(),this._selection,this._entireSheetCoords)),t||=e.A.EmptyArray),this._selectionRuns=t,this._selectionRuns}hiddenHeadersAt(t,n=!1){if(this._indexedSizes.length===0)return 0;let r=this._indexedSizes.length===1?0:e.A.findEqualOrGreater(this._indexedSizes,t,e=>e.max),i=this._indexedSizes[r];return!i||i.spanSize!==0||i.min>t||i.max<t?0:n?t-i.min+1:i.max-t+1}_insertHeaders(t,n){if(this.isProtected())throw Error(this._isColumn?e._(`error.sheetHeader.protectedColumns`):e._(`error.sheetHeader.protectedRows`));if(n<=0)return;let r=this._beginCommit({description:this._isColumn?e.v(`op.insertColumns`):e.v(`op.insertRows`)}),i=this._getState().headers,a=i.length,o=t<=(a>0?i[a-1].max:0),s=i;o&&(s=Vr(function(t,n,r=1){let i=e.A.findEqualOrGreater(t,n,e=>e.max),a=t.slice(0,i),o=[],s=[];if(!t[i])return{preceding:a,modified:s,trailing:o};t[i].min>=n?o.push({...t[i],min:t[i].min+r,max:t[i].max+r}):s.push({...t[i],min:t[i].min,max:t[i].max+r});for(let e=i+1;e<t.length;e++)o.push({...t[e],min:t[e].min+r,max:t[e].max+r});return{preceding:a,modified:s,trailing:o}}([...s],t,n))),this._updateState({headers:s},o),r.commit()}_deleteHeaders(t,n){if(this.isProtected())throw Error(this._isColumn?e._(`error.sheetHeader.protectedColumns`):e._(`error.sheetHeader.protectedRows`));let r=this._beginCommit({description:this._isColumn?e.v(`op.deleteColumns`):e.v(`op.deleteRows`)}),i=this._getState().headers,a=i.length,o=t<=(a>0?i[a-1].max:0),s=i;o&&(s=Vr(function(t,n,r=1,i){if(r===0)return{preceding:t?[...t]:[],modified:[],trailing:[]};let a=function(t,n,r=1){let i=e.A.findEqualOrGreater(t,n,e=>e.max),a=t.slice(0,i),o=[],s=[];if(!t[i])return{preceding:a,modified:o,trailing:s};for(let e=i;e<t.length;e++)n+r<t[e].min?s.push({...t[e],min:t[e].min-r,max:t[e].max-r}):n>=t[e].min?Math.max(n,t[e].max+1-r)>t[e].min&&o.push({...t[e],max:Math.max(n-1,t[e].max-r)}):n<t[e].min&&n+r<=t[e].max&&o.push({...t[e],min:Math.max(n,t[e].min-r),max:t[e].max-r});return{preceding:a,modified:o,trailing:s}}(t,n,r),o=a.preceding,s=a.trailing,c=[];return o.length>0&&c.push(o.pop()),c=c.concat(a.modified),s.length>0&&c.push(s.shift()),{preceding:o,modified:Hr(c,{onMerge:i?.onMerge??Rr}).modified,trailing:s}}([...s],t,n))),this._updateState({headers:s},o),r.commit()}beginCommit(e){return this._beginCommit(typeof e==`string`?{description:e}:e)}doBatch(t,n){return this._transactions.doBatch(t,typeof n==`string`?{description:n}:{description:e.v(`op.updateHeader`),...n})}getId(){return this._id}getVersionId(){return this._transactions.getVersionId(this._id)}isClosed(){return this._closed}close(){this._sheetRemoveListener?.(),this._emitter.close(),this._transactionsRemoveListener?.(),this._closed=!0,this._transactions.remove(this._id)}_getState(){return this._transactions.getState(this._id)}_beginCommit(e){return this._transactions.beginCommit(e)}_updateState(e,t=!1){let n=this._transactions.beginCommit();try{n.updateState(this._id,e),this._onHeaderChange(t),n.commit()}catch(e){throw n.rollback(),e}}fromJSON(e){let t=e||{};this._defaultCustomSize=t.defaultSize??-1,this._defaultCustomSize<=0&&(this._defaultCustomSize=-1),this._invalidateMaxIndex();let n=this._options.sheet.getStyles().beginPersist();try{let e=[],n=t.headers,r=n?n.length:0,i=this._entireRunMax??2**53-1,a=this._isColumn;for(let t=0;t<r;t++){let r=tu(n[t],a);if(!r)continue;let o=r.min;if(o>=i)continue;let s={min:o,max:Math.min(r.max,i)},c=r.value,l={};c.sz!==void 0&&c.sz!==-1&&(l.sz=c.sz),c.h!==void 0&&(l.h=c.h),c.csz!==void 0&&(l.csz=c.csz),Object.keys(l).length===0&&(l.cs=!0),s.value=l,e.push(s)}this._updateState({headers:e,defaultCustomSize:this._defaultCustomSize})}finally{n.endPersist()}}toJSON(){let t=this._headers,n=t.length;if(n===0&&this._defaultCustomSize===-1)return null;let r={headers:[]};if(this._defaultCustomSize!==-1&&(r.defaultSize=e.A.roundAccurately(this._defaultCustomSize,8)),n===0)return r;let i=this._defaultCustomSize,a=this._isColumn,o=this.getSheet().getStyles().beginPersist();for(let o=0;o<n;o++){let n=t[o],s=n.value;if(!s)continue;let c={},l=s.sz;l!==void 0&&l!==i&&(c.sz=e.A.roundAccurately(l,8)),s.csz!==void 0&&(c.csz=s.csz),!0===s.h&&(c.h=s.h),Object.keys(c).length>0&&r.headers.push({r:Ql(n.min,n.max,a),v:c})}return o.endPersist(),r}get[Symbol.toStringTag](){return`[SheetHeader]`}toString(){return`[SheetHeader]`}},jS=e=>null,MS=class e extends va{constructor(e){super(e),this._entireCoords=e?.entireCoords}getContentfulCoords(){let e=this._contentfulCoords;if(e!==void 0)return e;let t=this._entireCoords;if(!t||this.isEmpty())return this._contentfulCoords=null,null;let n=this.all(),r=n.length,i=t.colStart,a=t.rowStart,o=t.colEnd,s=t.rowEnd,c=2**53-1,l=2**53-1,u=-(2**53-1),d=-(2**53-1),f=0,p=0,m=0,h=0;for(let t=0;t<r;t++){let r=n[t];f=r.colStart,m=r.colEnd,m>=o&&(f=Math.max(f-1,i),m=f),p=r.rowStart,h=r.rowEnd,h>=s&&(p=Math.max(p-1,a),h=p),c=Math.min(c,f),u=Math.max(u,m),l=Math.min(l,p),d=Math.max(d,h),e={colStart:c,rowStart:l,colEnd:u,rowEnd:d}}return this._contentfulCoords=e,e}setEntireCoords(e){this._entireCoords=e,this._onModified()}getEntireCoords(){return this._entireCoords??null}clone(e=null){let t=super.clone(e);return t._entireCoords=this._entireCoords,t._contentfulCoords=this._contentfulCoords,t}_onModified(){super._onModified(),this._contentfulCoords=void 0}_createClone(t){return new e(t)}},NS={rowStart:0,colStart:0,rowEnd:0,colEnd:0},PS={includeEmpty:!0},FS={visibility:`visible`,includeEmpty:!0};function IS(t,n,r=[],i=!0,a,o=t.state,s){let c=!0===i||typeof i==`object`&&!!i&&Object.keys(i).length>0,l=a&&a.length>0;if(!c&&!l)return;let u=(t,a,o=!1)=>{if(!o&&!0!==i&&i[t]===void 0||!a)return;let c=a.search(n,!1),l=c.length;if(l===0)return;let u=i[t];for(let i=0;i<l;i++){let a=c[i];if(u&&!e.l.isRangeWithinRange(n,a)||s&&!e.l.isRangeWithinRange(a,s))continue;let o=e.l.intersectRanges(n,a),l=a.value,d=a.value?.model??l??!0;r.push({...o,value:{[t]:d}})}};if(l){let i=a?a.length:0,o=t.getEntireCoords(),s=e.l.isEqualRanges(n,o);for(let e=0;e<i;e++){let t=a[e],n=t?t.length:0;if(n>0){let i=``+e;if(s)for(let e=0;e<n;e++){let n=Jl(t[e],o);n.value={[i]:n.value},r.push(n)}else{let e=[...t];for(let t=0;t<n;t++)e[t]=Jl(e[t],o);let r=new va;r.load(e),u(i,r,!0)}}}}if(c){if(d=q.Type.Merge,(typeof i==`boolean`&&!0===i||i[d]!==void 0)&&o.mergeSpatial){let t=o.mergeSpatial.search(n),i=t.length;for(let a=0;a<i;a++){let i=t[a],o=e.l.intersectRanges(n,i);r.push({...o,value:{merge:i.value}})}}var d;u(q.Type.Unlock,o.protectedRanges),u(q.Type.Continuous,o.continuousFillSpatial),u(q.Type.DateFormat,o.dateFormatSpatial),u(q.Type.Hyperlink,o.hyperlinkSpatial),u(q.Type.Comments,o.commentsSpatial),u(q.Type.BorderStyle,o.borderSpatial),u(q.Type.FillStyle,o.fillSpatial),u(q.Type.ContentStyle,o.contentSpatial),u(q.Type.Contentful,o.contentfulSpatial),u(q.Type.Formula,o.calcGrid.getFormulas()),u(q.Type.Pending,o.pendingSpatial),u(q.Type.CalcError,o.calcErrorsSpatial),!0!==i&&i[q.Type.Error]!==void 0&&u(q.Type.Error,t.getErrorSpatial()),u(q.Type.Spills,o.spillSpatial),u(q.Type.Table,o.tables),u(q.Type.AutoTable,o.autoTables),u(q.Type.DataValidations,o.dataValidations),u(q.Type.Conditionals,o.conditionalFormats)}}function LS(t,r){let i=t.state;if(!i||!r||!r.searchTypes)return ti;let a=r?.bounds??t.getUsedCoords()??t.getEntireCoords(),o=null;!0===r.searchTypes?o=Xd:e.A.isObject(r.searchTypes)&&(o=r.searchTypes);let s=r?.ignoreHidden,c=!0===s||s===n.l.Axis.Row,l=!0===s||s===n.l.Axis.Column,u=r?.injectReferences,d=r?.includeMergeOverflow??!1,f=[],p=l?FS:PS,m={min:a.colStart,max:a.colEnd},h=c?FS:PS,g={min:a.rowStart,max:a.rowEnd};t.rowHeaders.getRange(g).forEachSpan((e,n)=>{let s=n.getCoords(),c=s.min,l=s.max;t.columnHeaders.getRange(m).forEachSpan((e,n)=>{let s=n.getCoords(),d=s.min,p=s.max;IS(t,{rowStart:c,rowEnd:l,colStart:d,colEnd:p},f,o,u,i,r?.fullyContained?a:void 0)},p)},h);let _,v=new ni.IteratorInstance(f,r),y=r?.reverse??!1,b=r?.byCell;return{next:e=>{if(_=v.next(e),_.done)return ei;let t,n=_.value,r=NT(n.overlaps),i=n.range;if(d){let e=r?.merge;if(e){let n=e.getCoords(),r=a.colStart,i=a.rowStart,o=n.colStart,s=n.rowStart;o<r&&i<s&&(t={colIndex:o,rowIndex:s})}}t||={colIndex:i.colStart,rowIndex:i.rowStart};let o={colIndex:i.colEnd,rowIndex:i.rowEnd},s=null;return b&&(s={...n.cell}),{done:!1,value:{start:y?o:t,end:y?t:o,cell:s,intersection:r}}}}}function RS(t,r,i){let a=t.state;if(!a||!r)return null;let o=t.getEntireCoords();i&&(o={colStart:Math.max(o.colStart-i,o.colStart),rowStart:o.rowStart,colEnd:Math.min(o.colEnd+i,o.colEnd),rowEnd:o.rowEnd});let s,c,l={rowStart:r.rowStart,colStart:o.colStart,rowEnd:r.rowEnd,colEnd:o.colEnd},u={bounds:l,searchTypes:$d,axis:n.l.Axis.Row,ignoreHidden:!0,byCell:!1},d=r.colStart,f=r.colEnd,p=-1,m=(e,t)=>{let n=e.next();for(;!n.done;){let r=n.value,i=r.intersection,a=i.contentful;if(a){let e=r.start.rowIndex;if(!c||e!==p){let n=r.end.rowIndex,o=a.getCoords(),c=t?o.colEnd:o.colStart,l=null;t&&(l=i.continuous),s||=[];for(let t=e;t<=n;t++)s.push({rowIndex:t,colIndex:c,continuous:l,intersection:i,scalar:null,leftIndex:0,rightIndex:0,overflow:null,style:null})}p=e,c=r}n=e.next()}};d>o.colStart&&(l.colStart=o.colStart,l.colEnd=r.colStart-1,m(LS(t,u),!0)),p=-1,c=void 0,f<o.colEnd&&(l.colStart=r.colEnd+1,l.colEnd=o.colEnd,m(LS(t,u),!1));let h=a.cellValuesGrid;if(!s)return null;s.sort(e.l.columnFirstCellComparator);let g,_,v=s.length,y=t.cellOptions;for(let e=0;e<v;e++){let t=s[e],r=t.rowIndex,i=t.colIndex,a=h.getValueAt(r,i);t.scalar=a;let o=t.continuous;if(o||typeof a==`string`&&!t.intersection?.merge){NS.colStart=i,NS.rowStart=r,NS.colEnd=i,NS.rowEnd=r;let e=Sx(void 0,NS,t.intersection,y,!0);t.style=e;let s=bx(r,i,n.n.String,e,a,null,null,o?.getCoords(),y);if(s){let e=s.leftIndex,n=s.rightIndex;t.leftIndex=e,t.rightIndex=n,(n>0&&i<d||e>0&&i>f)&&(t.overflow=s)}}t.overflow?(g||=[],g.push(t)):(_||=[],_.push(t))}return{overflows:g,stops:_}}var zS=RegExp(`([0-9]+)$`);function BS(e,t){return e.colStart===t.colStart&&e.rowStart===t.rowStart}function VS(e,t,n){return!!n&&e===n.rowStart&&t===n.colStart}function HS(t,r,i,a,o,s,c,l,u,d,f,p,m=!1){let h,g,_=null,v=o.size();p===void 0&&(p=s.getAxis()===n.l.Axis.Column);let y,b=r?r.length:0,x=i?i.length:0,S=b+x;for(let n=0;n<S&&v>0;n++){let d=n<b?r[n]:i[n-b],f=o.search(d),p=f.length;for(let n=0;n<p;n++){let r=f[n];if(!VS(r.rowStart,r.colStart,d)){if(r.value.getError())continue;y||=[],y.push(r)}o.remove(r,BS);let i=r.value;t!==-1&&t===i.getCycleId()||u?.(null,r),i.getError()||(s.delete(r),a.insertNonOverlapping({colStart:r.colStart,rowStart:r.rowStart,colEnd:r.colEnd,rowEnd:r.rowEnd,value:null},{onIntersect:(t,n)=>{if(t.value!==null)return c?.(t.colStart,t.rowStart,t.colEnd,t.rowEnd),_=e.l.unionRanges(_,t),l?.insertNonOverlapping(t),_=e.l.unionRanges(_,t),n}})),v--}}for(let t=0;t<b;t++){let n=r[t],i={colStart:n.colStart,rowStart:n.rowStart,colEnd:n.colEnd,rowEnd:n.rowEnd,scope:n.scope,value:null};a.insertNonOverlapping(i,{onIntersect:(t,n)=>{if(t.value===null)return;let r=e.l.sanitizeRange(n);return m&&l?.insertNonOverlapping(r),d?.insertNonOverlapping({...n,value:!1}),c?.(r.colStart,r.rowStart,r.colEnd,r.rowEnd),_=e.l.unionRanges(_,r),n}}),f?.insertNonOverlapping(i,{onIntersect:(t,n)=>{if(t.value!==null)return c?.(n.colStart,n.rowStart,n.colEnd,n.rowEnd),_=e.l.unionRanges(_,n),n},onUpdates:(t,n,r)=>{g||=[];let i=t.length;for(let e=0;e<i;e++){let n=t[e];g.push(n)}h||=[];let a=n.length;for(let t=0;t<a;t++){let r=n[t],i=e.l.sanitizeRange(r);h.push(i)}}})}let C=p?n.l.Axis.Column:n.l.Axis.Row;if(y){let n=y.length,r=xE(n);for(let i=0;i<n;i++){let n=y[i],o=n.value.setError(!0,t);u?.(o,null),r[i]=o,_=e.l.unionRanges(_,n),a.insertNonOverlapping({colStart:n.colStart,rowStart:n.rowStart,colEnd:n.colStart,rowEnd:n.rowStart,value:new uu(n,C)}),c?.(n.colStart,n.rowStart,n.colEnd,n.rowEnd)}o.load(r)}for(let t=0;t<x;t++){let n=e.l.sanitizeRange(i[t]);a.insertNonOverlapping({colStart:n.colStart,rowStart:n.rowStart,colEnd:n.colEnd,rowEnd:n.rowEnd,value:new uu(n,C)}),m&&l?.insertNonOverlapping(n),c?.(n.colStart,n.rowStart,n.colEnd,n.rowEnd),_=e.l.unionRanges(_,n)}return _}function US(e,t,n,r){if(!t)return;let i=t.block;if(!i)return;let a,o,s,c,l,u=t.colIndex,d=t.rowIndex;n?(a=n.colStart,o=n.rowStart,s=n.colEnd,c=n.rowEnd,l=n.scope):(a=u,o=d,s=u,c=d),l||=t.gridId;let f=e.get(i);f||(f=[],e.set(i,f));let p=f.findIndex(e=>e.value.index===r),m=p===-1?void 0:f[p];if(m&&m.scope===l){a<m.colStart&&(m.colStart=a),o<m.rowStart&&(m.rowStart=o),s>m.colEnd&&(m.colEnd=s),c>m.rowEnd&&(m.rowEnd=c);let e=m.value.formulaEntry;e.colStart=m.colStart,e.rowStart=m.rowStart,e.colEnd=m.colEnd,e.rowEnd=m.rowEnd;return}let h={colStart:a,rowStart:o,colEnd:s,rowEnd:c,scope:l,value:{formulaEntry:{colStart:a,rowStart:o,colEnd:s,rowEnd:c,scope:l,value:i},formulaBlockWidth:1,formulaBlockHeight:1,index:r,$absColStart:!1,$absColEnd:!1,$absRowStart:!1,$absRowEnd:!1}};p===-1?f.push(h):f[p]=h}(function(e){e.Date=class{constructor(e){this._options=e}canFill(e,t){return rr(e,!0)}createFillAt(e,t){t={...this._options,...t};let n=0,r=this._options?.unit;r||=e.length===1?ar:function(e,t=!1){if(!e||e.length<1)return ar;let n=e;t||(n=e.slice(),n=n.sort((e,t)=>e.getTime()-t.getTime()));let r=!1,i=-1,a=-1;for(let e=0;e<n.length;e++){let t=n[e];if(e>n.length-1&&t.getTime()<n[e+1].getTime())throw Error(`Dates are expected to be sorted.`);let o=12*t.getFullYear()+t.getMonth();if(o===a)return ar;a=o;let s=t.getFullYear();s>i?i=s:r=!0}return r?`m`:`y`}(e);let i=or(e[0],0,r);i.setHours(0,0,0,0);let a=1;t?.reverse&&(a*=-1,n*=-1);let o=e.length;for(let t=1;t<o;t++){let n=ir(e[t-1],e[t],r);if(t===1)a=n;else if(n!==a)return null}return e.length===1&&t.multiFill,e=>{let t=or(i,a*e,r);if(n!==0){let r=0+n*e,i=r%1440,a=Math.floor(i/60),o=i%60;t.setHours(a,o,0,0);let s=Math.floor(r/1440),c=Math.floor(s/365),l=s%365,u=Math.floor(l/30),d=l%30;c>0&&t.setFullYear(t.getFullYear()+c),u>0&&t.setMonth(t.getMonth()+u),d>0&&t.setDate(t.getDate()+d)}return t}}},e.Linear=class{constructor(e){this._options=e}canFill(e,t){return typeof e==`number`||e===null}createFillAt(e,t){t={...this._options,...t};let n=by(e),r=n.b,i=n.m;return e.length===1?(t.reverse&&(i=-i),t.multiFill?e=>e*i+r:null):e=>i*(e+1)+r}};let t={value:null,template:null},n={sensitivity:`accent`};e.Ordinal=class{_template(e){let t=e.match(zS);if(!t)return null;let n=t[1],r=e.lastIndexOf(n);return r===-1?null:e.substring(0,r)}canFill(e,r){if(e===null)return!0;if(typeof e!=`string`)return t.value=null,!1;let i=this._template(e);return i&&(r===void 0||r===t.value&&i.localeCompare(t.template,void 0,n)===0)?(t.value=e,t.template=i,!0):(t.value=null,!1)}createFillAt(e,t){let n=[],r=e[0],i=null,a=null,o=0;if(r){let e=r.match(zS);if(e){i=e[1],i.startsWith(`0`)&&(o=i.length);let t=r.lastIndexOf(i);a=r.substring(0,t)}}let s=e.length;for(let t=0;t<s;t++){let r=e[t],i=null;if(r){let e=r.substring(a.length,r.length);e.startsWith(`0`)&&(o=Math.max(o,e.length));let t=parseFloat(e);isNaN(t)||(i=t)}n.push(i)}let c=by(n),l=c.b,u=c.m;return u!==0&&Number.isInteger(u)?n=>{if(e[n%s]===null)return null;let r=(s===1?t.reverse?-n:n:u*(n+1))+l,i=``+Math.abs(r),c=`0`.repeat(Math.max(0,o-i.length))+i;return a+c}:null}},e.Copy=class{canFill(e,t){return!0}createFillAt(e,t){let n=e.length;return t=>e[t%n]??null}};let r=Object.freeze([`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`]),i=Object.freeze([`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]),a=Object.freeze([`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]),o=Object.freeze([`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]);e.List=class{constructor(e){this._lists=[],this._map=new Map;let t=[];if(e?.customLists){let n=e.customLists;for(let e=n.length-1;e>0;e--)t.push(n[e])}t.push(o),t.push(a),t.push(i),t.push(r);let n=this._map,s=[],c=t.length;for(let e=0;e<c;e++){let r=t[e],i=[];s.push(i);let a=r.length;for(let t=0;t<a;t++){let a=x(r[t],!0),o=a.toLowerCase().trim(),s=n.get(o);s||(s=[],n.set(o,s));let c={value:a,asKey:o,major:e,minor:t};s.push(c),i.push(c)}}this._lists=Object.freeze(s)}canFill(e,t){return e===null||typeof e==`string`&&!!this._map.get(e.toLowerCase().trim())}createFillAt(e,t){let n=[],r=e[0];n.push(r.toLowerCase().trim());let i,a=this._map.get(n[0]),o=new Map,s=new Set,c=a.length;for(let e=0;e<c;e++){let t=a[e];o.set(t.major,t)}if(e.length>1){let t=e.length;for(let r=1;r<t;r++){let t=e[r].toLowerCase().trim(),a=this._map.get(t);if(!a)return null;r===1&&(i=a),n.push(t);let c=a.length;for(let e=0;e<c;e++){let t=a[e].major;o.has(t)&&s.add(t)}}if(s.size===0)return null}let l=null,u=this._lists;for(let t=0;!l&&t<u.length;t++)(e.length===1||s.has(t))&&(l=o.get(t));if(!l)return null;let d=null;for(let e=0;!d&&i&&e<i.length;e++)i[e].asKey===n[1]&&(d=i[e]);let f=!1,p=!1,m=Xm(r);m===1?f=!0:(m===-1||Xm(r[0])===-1)&&(p=!0);let h=u[l.major],g=l.minor,_=1;if(n.length>1){_=d.minor-l.minor;let e=n.length;for(let t=2;t<e;t++)if(h[t+g].minor-h[t-1+g].minor!==_)return null}e.length===1&&t?.reverse&&(_=-_);let v=e.length,y=h.length;return t=>{if(e[t%v]===null)return null;let n=(t*_+g)%y;n<0&&(n=y+n);let r=h[n].value??null;return f?r.toUpperCase():p?r.toLowerCase():r}}},e.Composite=class{constructor(e){e=Array.isArray(e)?[...e]:[e],this._fillers=e}canFill(e,t){return!0}createFillAt(e,t){let n=this._fillers;t={multiFill:e.length>1,...t};let r=e.length,i=0,a=!1;for(let t=0;!a&&t<=r;t++)e[t]===null?i++:a=!0;let o=0;a=!1;for(let t=r-1;!a&&t>=i;t--)e[t]===null?o++:a=!0;let s=[],c=null,l=null,u=[],d=i,f=0,p=e=>{if(c&&c.max+1===d){let t=c.value;t.fillAt.push(e),c.max=d,t.length++,t.valuesLength++}else c={min:d,max:d,value:{fillAt:[e],start:d,length:1,valuesLength:r,blankInterval:0}};s.push(c)},m=r-o;for(d=i;d<m;){let r=e[d];if(r===null){d++;continue}l=null;let i,a=1,o=!1;for(let e=0;!o&&e<n.length+1;e++){let t=n[e];t&&(o=t.canFill(r,i),o&&(l=t))}if(!l){r!==null&&p(r),d++;continue}let c=0;f=0,i=r;do r=e[d+a],o=l.canFill(r,i),o&&(r===null?c++:(i=r,c>0&&(a-c===1?f=c:c!==f&&(f=0)),c=0),a++);while(o&&d+a<m);u=[e[d]];let h=1+f,g=a-c;for(let t=h;t<g;t+=h)u.push(e[d+t]);if(u.length>0){let e=u.length,n=e+(e-1)*f,r=l.createFillAt?.(u,t)??u;s.push({min:d,max:d+n-1,value:{fillAt:r,start:d,length:n,valuesLength:e,blankInterval:f}})}d+=a}let h=Kr(s);return e=>{let t=e>=0,n=Math.abs(e),i=qr(n%r,h);if(!i)return null;let a=Math.floor(n/r),o=i.length,s=i.start,c=(a+ +!!t)*s+(a+ +!t)*(r-(s+o)),l=e+(t?-c:c),u=i.blankInterval;if(u!==0){let e=l%o;if(e%(1+u)!==0)return null;l=Math.floor(e/(1+u))+i.valuesLength*a}let d=i.fillAt;return typeof d==`function`?d(l):d[l%d.length]}}},e.Types={Series:new wS.Composite([new wS.Date,new wS.Linear,new wS.Ordinal,new wS.List]),DateDays:new wS.Date({unit:ar}),DateMonths:new wS.Date({unit:`m`}),DateYears:new wS.Date({unit:`y`}),Copy:new wS.Copy},e.fillTo=(e,t,n,r)=>{let i=[],a=t.length,o=e.createFillAt(t,r);for(let e=a;e<n;e++)i.push(o(e));return i}})(wS||={});var WS=(e,t,r,i=GS)=>{if(i.$absColStart=i.$absColEnd=t,i.$absRowStart=i.$absRowEnd=r,!t&&!r||!e||n.a.isError(e)||`nameId`in e)return i;let a=e;return t&&(a.$colStart||a.$colEnd)&&(i.$absColStart=!!a.$colStart,i.$absColEnd=!!a.$colEnd),r&&(a.$rowStart||a.$rowEnd)&&(i.$absRowStart=!!a.$rowStart,i.$absRowEnd=!!a.$rowEnd),i},GS={$absColStart:!1,$absColEnd:!1,$absRowStart:!1,$absRowEnd:!1};function KS(e,t,r=null){let i=e.colEnd-e.colStart,a=e.rowEnd-e.rowStart,o=e.value,s=o.formula,c=o.ref,l=c.rowStart,u=c.colStart,d=s.resolvedPrecedentsAt(l,u,!0,rC,iC),f=d.length,p=s.getReferences(l,u);for(let o=0;o<f;o++){let s=d[o];if(n.a.isError(s))continue;let c=WS(p[o],iC[o],rC[o]),l=c.$absColEnd,u=c.$absRowEnd,f={colStart:s.colStart,rowStart:s.rowStart,colEnd:s.colEnd+(l?0:i),rowEnd:s.rowEnd+(u?0:a),scope:s.scope??e.scope,value:{formulaEntry:e,formulaBlockWidth:i+1,formulaBlockHeight:a+1,index:o,$absColStart:c.$absColStart,$absColEnd:l,$absRowStart:c.$absRowStart,$absRowEnd:u}};r&&r.push(s),t.push(f)}}var qS=(e,t,n)=>{let r=e.search(t),i=r.length;if(i===0)return null;let a=[],o=[],s=[],c=[],l=new Set;for(let e=0;e<i;e++){let i=r[e],u=i.value,d=u.formulaEntry;if(i.colEnd===i.colStart&&i.rowEnd===i.rowStart||u.index<0)continue;if(l.has(d)){a.push(i);continue}let f=d.colEnd-d.colStart,p=d.rowEnd-d.rowStart,m=i.colStart,h=i.rowStart,g=i.colEnd,_=i.rowEnd,v=n({precedentEntry:i,precedentValue:u,formulaEntry:d,fw:f,fh:p,nw:u.$absColEnd?g-m+1:g-m-f+1,nh:u.$absRowEnd?_-h+1:_-h-p+1},t);if(!v)continue;l.add(d),a.push(i),o.push(d);let y=v.length;for(let e=0;e<y;e++)c.push(v[e]),KS(v[e],s)}return a.length===0?null:{precedents:{inserts:s,removes:a},formulas:{inserts:c,removes:o}}},JS=(e,t)=>{let{precedentEntry:n,precedentValue:r,formulaEntry:i,fw:a,fh:o,nw:s,nh:c}=e,l=[],u=[],d=(e,t,n)=>{t<=0||t>n||e.indexOf(t)===-1&&e.push(t)},f=r.$absColStart,p=r.$absColEnd,m=r.$absRowStart,h=r.$absRowEnd;if(!(a>0)||f&&p||(d(l,t.colStart-i.colStart,a),f||d(l,t.colStart-n.colStart,a),p||d(l,t.colStart-n.colStart-s+1,a)),!(o>0)||m&&h||(d(u,t.rowStart-i.rowStart,o),m||d(u,t.rowStart-n.rowStart,o),h||d(u,t.rowStart-n.rowStart-c+1,o)),l.length===0&&u.length===0)return null;l.sort((e,t)=>e-t),u.sort((e,t)=>e-t);let g=[i];if(u.length>0){g=[];let e=i;for(let t=0;t<u.length;t++){let n=i.rowStart+u[t];if(n<=e.rowStart||n>e.rowEnd)continue;let r=wa(e,{rowStart:n,colStart:e.colStart,rowEnd:e.rowEnd,colEnd:e.colEnd},Oa);r&&r.length===2&&(g.push(r[0]),e=r[r.length-1])}g.push(e)}if(l.length>0){let e=[];for(let t=0;t<g.length;t++){let n=g[t];for(let t=0;t<l.length;t++){let r=i.colStart+l[t];if(r<=n.colStart||r>n.colEnd)continue;let a=wa(n,{rowStart:n.rowStart,colStart:r,rowEnd:n.rowEnd,colEnd:n.colEnd},Oa);a&&a.length===2&&(e.push(a[0]),n=a[a.length-1])}e.push(n)}g=e}return g.length>1?g:null},YS=(e,t)=>{let{precedentEntry:n,precedentValue:r,formulaEntry:i,fw:a,fh:o,nh:s,nw:c}=e,l=n.rowStart,u=n.colStart,d=t.rowStart,f=t.rowEnd,p=t.colStart,m=t.colEnd,h=[];if(o>0&&(!r.$absRowStart||!r.$absRowEnd))if(s>1){let e=Math.max(0,d-l-s+1),t=Math.min(o+1,Math.max(0,d-l)),n=Math.min(o+1,Math.max(0,f-l-s+2)),r=Math.min(o+1,Math.max(0,f-l+1));for(let n=e;n<=t;n++)n>0&&n<=o&&h.push(n);for(let e=n;e<=r;e++)e>0&&e<=o&&(h.length!==0&&h[h.length-1]===e||h.push(e))}else{let e=d-l;e>0&&e<=o&&h.push(e);let t=f-l+1;t>0&&t<=o&&t!==e&&h.push(t)}let g=[];if(a>0&&(!r.$absColStart||!r.$absColEnd))if(c>1){let e=Math.max(0,p-u-c+1),t=Math.min(a+1,Math.max(0,p-u)),n=Math.min(a+1,Math.max(0,m-u-c+2)),r=Math.min(a+1,Math.max(0,m-u+1));for(let n=e;n<=t;n++)n>0&&n<=a&&g.push(n);for(let e=n;e<=r;e++)e>0&&e<=a&&(g.length!==0&&g[g.length-1]===e||g.push(e))}else{let e=p-u;e>0&&e<=a&&g.push(e);let t=m-u+1;t>0&&t<=a&&t!==e&&g.push(t)}if(h.length===0&&g.length===0)return null;let _=[i];if(h.length>0){_=[];let e=i;for(let t=0;t<h.length;t++){let n=i.rowStart+h[t];if(n<=e.rowStart||n>e.rowEnd)continue;let r=wa(e,{rowStart:n,colStart:e.colStart,rowEnd:e.rowEnd,colEnd:e.colEnd},Oa);r&&r.length===2&&(_.push(r[0]),e=r[r.length-1])}_.push(e)}if(g.length>0){let e=[];for(let t=0;t<_.length;t++){let n=_[t];for(let t=0;t<g.length;t++){let r=i.colStart+g[t];if(r<=n.colStart||r>n.colEnd)continue;let a=wa(n,{rowStart:n.rowStart,colStart:r,rowEnd:n.rowEnd,colEnd:n.colEnd},Oa);a&&a.length===2&&(e.push(a[0]),n=a[a.length-1])}e.push(n)}_=e}return _},XS=(e,t)=>{let{precedentEntry:n,precedentValue:r,formulaEntry:i,fw:a,fh:o,nw:s,nh:c}=e;if(a===0&&o===0)return null;let l=n.colStart,u=n.rowStart,d=r.$absRowStart?u>=t.rowStart?0:o+1:Math.max(0,t.rowStart-u),f=r.$absRowEnd?n.rowEnd<=t.rowEnd?o:-1:Math.min(o,t.rowEnd-u-(c-1)),p=r.$absColStart?l>=t.colStart?0:a+1:Math.max(0,t.colStart-l),m=r.$absColEnd?n.colEnd<=t.colEnd?a:-1:Math.min(a,t.colEnd-l-(s-1));if(d>f||p>m||d===0&&f===o&&p===0&&m===a)return null;let h=d>0?i.rowStart+d:-(2**53-1),g=f<o?i.rowStart+f:2**53-1,_=p>0?i.colStart+p:-(2**53-1),v=m<a?i.colStart+m:2**53-1;return eC.colStart=_,eC.rowStart=h,eC.colEnd=v,eC.rowEnd=g,wa(i,eC,Oa)},ZS=(e,t,n)=>{let r=e.colStart,i=e.rowStart,a=e.colEnd,o=e.rowEnd,s=t.colStart,c=t.rowStart,l=t.colEnd,u=t.rowEnd,d=Math.max(r,s),f=Math.max(i,c),p=Math.min(a,l),m=Math.min(o,u),h=e.value.calcs;for(let e=f;e<=m;e++){let t=e-i,a=h[t];for(let e=d;e<=p;e++){let i=e-r;n(a[i],t,i)}}};function QS(t,r,i,a,o,s=!1,c=!1,l,u){if(!t||r.isEmpty())return null;$S.colStart=t.colStart,$S.rowStart=t.rowStart,$S.colEnd=t.colEnd,$S.rowEnd=t.rowEnd,$S.scope=null;let d,f,p,m=r.search($S),h=m.length;if(!h)return null;for(let n=0;n<h;n++){let o=m[n];if(nC.colIndex=o.colStart,nC.rowIndex=o.rowStart,nC.scope=o.scope,o.value.getError())continue;let s=e.l.isCellWithinRange({colIndex:nC.colIndex,rowIndex:nC.rowIndex,scope:nC.scope},t);s&&c||(d||(f=[],d=[],p=i.clone()),s?d.push(o):f.push(o),i.delete(o),r.remove(o,aC),a.insertNonOverlapping({...o,value:null}))}return h?(t=!1,c,m)=>{let h=s?n.l.Axis.Row:n.l.Axis.Column,g=f?f.length:0;if(g>0){r.load(f);for(let t=0;t<g;t++){let n=f[t],r=e.l.sanitizeRange(n);p.copyTo(i,{colIndex:r.colStart,rowIndex:r.rowStart},r),a.insertNonOverlapping({colStart:r.colStart,rowStart:r.rowStart,colEnd:r.colEnd,rowEnd:r.rowEnd,value:new uu(r,h)}),l?.insertNonOverlapping({colStart:r.colStart,rowStart:r.rowStart,colEnd:r.colEnd,rowEnd:r.rowEnd,scope:n.scope,value:null}),u?.(r.colStart,r.rowStart,r.colStart,r.rowStart)}}let _=d?d.length:0;if(o)for(let e=0;e<_;e++)o(null,d[e]);if(!t||c===void 0&&m===void 0||_===0)return;c??=0,m??=0;let v=[];for(let e=0;e<_;e++){let t=d[e],n={colStart:t.colStart+m,rowStart:t.rowStart+c,colEnd:t.colEnd+m,rowEnd:t.rowEnd+c,scope:t.scope},r=t.value.getTranslated(c,m);v.push(t.value.getTranslated(c,m)),o?.(r,null),p.copyTo(i,{colIndex:n.colStart,rowIndex:n.rowStart},t),a.insertNonOverlapping({colStart:n.colStart,rowStart:n.rowStart,colEnd:n.colEnd,rowEnd:n.rowEnd,value:new uu(n,h)})}r.load(v)}:null}var $S={colStart:0,rowStart:0,colEnd:0,rowEnd:0,scope:null},eC={colStart:0,rowStart:0,colEnd:0,rowEnd:0,scope:null},tC={colStart:0,rowStart:0,colEnd:0,rowEnd:0,scope:null},nC={colIndex:0,rowIndex:0,scope:null},rC=[],iC=[];function aC(e,t){return e.value===t.value}var oC={skipCustomSize:!0,expandOnly:n.l.Axis.Column,minContent:!0},sC=()=>[],cC={rowStart:0,colStart:0,rowEnd:0,colEnd:0},lC=[{colIndex:-1,rowIndex:-1},null,null,null,null];function uC(t,n,r,i){let a=i?.description??e.v(`op.setComments`),o=I_(n),s=t.beginCommit({description:a}),c=null;try{let a=t.getState();if(!a)return;let l=a.commentsSpatial,u=l,d=n.length;for(let t=0;t<d;t++){let i=n[t],a=null;if(r!==null){let e=r;if(!e)continue;a=typeof e==`string`?{content:{runs:{text:e}}}:{...e}}c=e.l.unionRanges(c,i),l===u&&(u=l.clone()),u.insertNonOverlapping({...i,value:a})}t.invalidateUsedCoords(),t.updateState({commentsSpatial:u}),t.commitAndAutoSelect(s,o,i?.autoSelect,{viewAfter:{ranges:n}})}catch(e){throw s.rollback(),e}}function dC(t,n,r,i){let a=i?.description??e.v(`op.setHyperlink`);t.protectionCheck(()=>[`insertHyperlinks`,`formatCells`],n,a);let o=I_(n),s=t.beginCommit({description:a});try{let a=t.getState();if(!a)return;let c=a.hyperlinkSpatial,l=c,u=t.styles,d=t=>{let n={...t.getAuthoredProperties()};if(n.named){let t=u.getNamed(n.named)?.getRanged().getPropertiesAt(0,0,null);n=e.A.mergeContentful(t,n)}return delete n.font,n.named=X.BuiltInName.Hyperlink,n},f=[],p=n.length;for(let e=0;e<p;e++){let i,o=n[e],s=null,u=o.value,p=u===void 0?r:u;if(p!==null)if(p.isIHyperlink)i={...p._p},s=p.getTextToDisplay();else if(typeof p==`string`)i={address:p};else if(p.address||p.textToDisplay){let e=p,t={...e};delete t.textToDisplay,i=t.address?t:null,s=e.textToDisplay??null}else i=null;else i=null;if(c===l&&(l=c.clone()),i!==null||c.size()>0){if(s&&r){let e=t.isDataColumn;hC(t,Ha(s,{majorStart:e?o.colStart:o.rowStart,majorEnd:e?o.colEnd:o.rowEnd,minorStart:e?o.rowStart:o.colStart,minorEnd:e?o.rowEnd:o.colEnd},e),void 0,null,{isHyperlink:!0})}i===null?t.getRangedEntries(a.hyperlinkSpatial,[o],{onEntry:(e,t)=>(l.insertNonOverlapping({...t,value:i}),t.value)}):(l.insertNonOverlapping({...o,value:i}),f.push({...o,value:d}))}}t.invalidateUsedCoords(),t.updateState({hyperlinkSpatial:l}),f.length>0&&fC(t,f),t.commitAndAutoSelect(s,o,i?.autoSelect,{viewAfter:{ranges:n}})}catch(e){throw s.rollback(),e}}function fC(t,n,r,i,a=!1){let s=i?.description??e.v(`op.updateStyle`);t.protectionCheck(()=>[`formatCells`],n,s);let c=t.beginCommit({description:s}),l=I_(n);try{let s=t.getState();if(!s)return;let u=c.getId(),d=t.getEntireCoords(),f=t.getEntireCoords,p=s.borderSpatial.clone(u),m=s.fillSpatial.clone(u),h=s.contentSpatial.clone(u),g=s.continuousFillSpatial,_=s.dateFormatSpatial,v=t.styles,y=function(e){return(t,n,r=!1)=>{let i=null,a=nh(n,()=>i||(i=vh(void 0,e,t,t.getCoords()),i)),o=t.cloneWithUpdate(a,r);return o.isEmpty()&&!o.getUpdateProperties()?null:o}}(v),b=(t,n)=>{if(a&&t.value&&t.value.getProperties()?.numberFormat)return t;let r=e.l.sanitizeRange(t),i=t.value??new Dm(v,f,r),o=n.value,s=o?o.getUpdateProperties()??o.getProperties():null,c=i.cloneWithUpdate(s);return c.isEmpty()&&(c=null),{...n,value:c}},x=t=>{let n=!g.isEmpty(),r=!_.isEmpty(),i=h.search(t),a=[],c=[];for(let n=0;n<i.length;n++){let r=i[n],s=r.value?r.value._p:null;if(!s)continue;let l=e.l.intersectRanges(r,t),u=s.alignment?.horizontal;u!==o.HorizontalAlignment.CenterContinuous&&u!==o.HorizontalAlignment.Fill||a.push({...l,value:y(new Dm(v,f,l),{alignment:{horizontal:u}})});let d=s.numberFormat;typeof d==`number`&&(d=Sc(d)),d&&(Dr(d)||Or(d))&&c.push({...l,value:d})}if(n||a.length){g===s.continuousFillSpatial&&(g=g.clone()),g.insertNonOverlapping({...t,value:null});for(let e=0;e<a.length;e++)g.insertNonOverlapping(a[e])}if(r||c.length){_===s.dateFormatSpatial&&(_=_.clone()),_.insertNonOverlapping({...t,value:null});for(let e=0;e<c.length;e++)_.insertNonOverlapping(c[e])}},S=n.length;for(let i=0;i<S;i++){let a=n[i],o=a.value,s=o===void 0?r:o;if(typeof s==`function`){let n={colStart:Math.max(a.colStart-1,d.colStart),rowStart:Math.max(a.rowStart-1,d.rowStart),colEnd:Math.min(a.colEnd+1,d.colEnd),rowEnd:Math.min(a.rowEnd+1,d.rowEnd)},r=t.composeDirectStyleView(n,{border:p,fill:m,content:h}),i=(t,n)=>{let r=t.value??new Dm(v,f,e.l.sanitizeRange(t)),i=y(r,s);return i&&i.isEmpty()&&(i=null),{...n,value:i}},o=y(new Dm(v,f,a),s,!0);o?._p?.border&&qT(o,a,r,y,d),r.insertNonOverlapping({...a,value:o},{onIntersect:i}),JT(r,p,m,h,n),x(n);continue}let c=y(new Dm(v,f,a),s,!0);if(c===null){let e={...a,value:null};p.insertNonOverlapping(e,{onIntersect:b}),m.insertNonOverlapping(e,{onIntersect:b}),h.insertNonOverlapping(e,{onIntersect:b})}else{let e=c.splitByFeature();e.border&&(e.border?._p?.border&&qT(e.border,a,p,y,d),p.insertNonOverlapping({...a,value:e.border},{onIntersect:b})),e.fill&&m.insertNonOverlapping({...a,value:e.fill},{onIntersect:b}),e.content&&h.insertNonOverlapping({...a,value:e.content},{onIntersect:b})}x(a)}if(t.invalidateUsedCoords(),t.updateState({borderSpatial:p,fillSpatial:m,contentSpatial:h,continuousFillSpatial:g,dateFormatSpatial:_}),i?.autoFit){let e=typeof i.autoFit==`boolean`?oC:i.autoFit;t.autoFit(n,e)}t.notify(`onStyleChange`),a?c.commit({forceAmend:!0}):t.commitAndAutoSelect(c,l,i?.autoSelect,{viewAfter:{ranges:n}})}catch(e){throw c.rollback(),e}}function pC(t,r,i=null){if(t.protectionCheck(sC,r),r.length===1&&e.l.isSingleCell(r[0]))return;let a=n.l.AxisSelection.Both;i?.axes?a=i.axes:i===n.l.AxisSelection.Row?a=n.l.AxisSelection.Row:i===n.l.AxisSelection.Column&&(a=n.l.AxisSelection.Column);let o=i?.discardMultipleValues??!1,s=I_(r),c=t.getSelection().getCoords(),l=null,u=t.beginCommit({description:i?.description??e.v(`op.merge`)}),d=r[0];try{let f=t.getMerges(r);if(T_(r)||f.length>0){let n=e.l.unionRangesArrays(f),i=e.l.unionRangesArrays(r);if(!(!n&&!i||n&&i&&e.l.isRangeWithinRange(n,i)))throw console.warn(e._(`error.sheet.mergeOverlapping`),r),new e.s(e._(`error.sheet.mergeOverlapping`));mC(t,f)}let p=t.createSparseBuilder({axis:n.l.Axis.Column}),m=[],h=[],g=[];try{let i=t.getEntireCoords(),u=t.getState().contentfulSpatial,f=null;for(let t=0;t<r.length;t++)f=e.l.unionRanges(f,r[t]);let _=t.composeDirectStyleView(f??void 0),v=!1,y=n=>{let r={rowIndex:n.rowStart,colIndex:n.colStart},i=null;if(v){let t=u.search(n),a=t.length,s=[];for(let r=0;r<a;r++){let i=e.l.intersectRanges(t[r],n);if(i){for(let e=i.rowStart;e<=i.rowEnd;e++)for(let t=i.colStart;t<=i.colEnd;t++)s.push({rowIndex:e,colIndex:t});if(s.length>1&&!o)throw new e.E(e._(`error.sheet.mergeMultipleValues`),`discardMultipleValues`)}}if(s.length>0){let e=s[0];for(let t=1;t<s.length;t++){let n=s[t];(n.rowIndex<e.rowIndex||n.rowIndex===e.rowIndex&&n.colIndex<e.colIndex)&&(e=n)}e.rowIndex===r.rowIndex&&e.colIndex===r.colIndex||(i=e);for(let t=0;t<s.length;t++){let n=s[t];n===e||n.rowIndex===r.rowIndex&&n.colIndex===r.colIndex||g.push({rowIndex:n.rowIndex,colIndex:n.colIndex,update:null})}}}i||=r;let a=null,s=null,c=null,l=null,f=null,p=null,y=null;cC.colStart=n.colStart,cC.rowStart=n.rowStart,cC.colEnd=n.colStart,cC.rowEnd=n.rowStart;let b=_.search(cC);if(b.length>0){y=b[0].value?.getPropertiesAt(n.rowStart,n.colEnd,null);let e=y?.border;a=e?.left??null,s=e?.top??null,f=e?.right??null,p=e?.bottom??null}if(cC.colStart=n.colEnd,cC.colEnd=n.colEnd,b=_.search(cC),b.length>0){let e=b[0].value?.getPropertiesAt(n.rowStart,n.colEnd,null)?.border;e&&e.right&&(c=e.right)}if(cC.colStart=n.colStart,cC.colEnd=n.colStart,cC.rowStart=n.rowEnd,cC.rowEnd=n.rowEnd,b=_.search(cC),b.length>0){let e=b[0].value?.getPropertiesAt(n.rowEnd,n.colStart,null)?.border;e&&e.bottom&&(l=e.bottom)}if(!c||!l){cC.colStart=n.colEnd,cC.colEnd=n.colEnd,cC.rowStart=n.rowEnd,cC.rowEnd=n.rowEnd,b=_.search(cC);let e=b?.[0];if(e){let t=e.value?.getPropertiesAt(n.rowEnd,n.colEnd,null)?.border;t&&(c||=t.right??null,l||=t.bottom??null)}}let x=!e.l.isEqualCells(i,r);if(x){cC.colStart=i.colIndex,cC.colEnd=i.colIndex,cC.rowStart=i.rowIndex,cC.rowEnd=i.rowIndex;let e=_.search(cC);e.length>0&&(y=e[0].value?.getPropertiesAt(i.rowIndex,i.colIndex,null)??y)}if(m.push({...n,value:null}),m.push({...n,value:{...y,border:{top:s,left:a,right:c??f,bottom:l??p,horizontal:null,vertical:null}}}),x){let e=t.getRange(i).getCell();g.push({rowIndex:r.rowIndex,colIndex:r.colIndex,update:e}),g.push({rowIndex:i.rowIndex,colIndex:i.colIndex,update:null})}h.push(n),d=e.l.unionRanges(d,n)},b=[...r].sort(e.l.createRangeComparator(n.l.Axis.Column)),x=b.length;for(let r=0;r<x;r++){let o=b[r];if(!e.l.isSingleCell(o)){if(l||!c||!e.l.isCellWithinRange(c.cell,o)||c.cell.rowIndex===o.rowStart&&c.cell.colIndex===o.colStart||(l={...s,cell:{rowIndex:o.rowStart,colIndex:o.colStart}}),v=u.search(o).length>0,t.validateOrRemoveOverlaps(o,`merge`),o.colStart<i.colStart||o.rowStart<i.rowStart||o.colEnd>i.colEnd||o.rowEnd>i.rowEnd)throw new e.s(e._(`error.sheet.mergeOob`));if(a===n.l.AxisSelection.Column){let e=o.rowEnd===i.rowEnd?Math.max(1,i.rowEnd):o.rowEnd;for(let t=o.rowStart;t<=e;t++)y({...o,rowStart:t,rowEnd:t})}else if(a===n.l.AxisSelection.Row){let e=o.colEnd===i.colEnd?Math.max(1,i.colEnd):o.colEnd;for(let t=o.colStart;t<=e;t++)y({...o,colStart:t,colEnd:t})}else y(o)}}g.sort((e,t)=>e.colIndex-t.colIndex||e.rowIndex-t.rowIndex);let S=g.length;for(let e=0;e<S;e++){let t=g[e];p.pushAt(t.rowIndex,t.colIndex,t.update)}p.apply(),t.indexMerges(h),fC(t,m),t.updateState({})}catch(t){throw t.type?new e.E(t.message??`Unable to merge`,t.type):new e.s(t.message??`Unable to merge`)}l&&(s=l,t.getSelection().updateCoords(l)),u.commit({viewAfter:{view:t.getView(),selection:s,merges:r,ranges:r,selectOptions:i?.autoSelect}}),t.autoSelect(i?.autoSelect??!1,s)}catch(e){throw u.rollback(),e}}function mC(t,n,r){if(t.protectionCheck(sC,n),T_(n))throw new e.s(e._(`error.sheet.unmergeOverlapping`));if(!t.getState())return;let i=e.l.unionRangesArrays(n),a=I_(n),o=t.beginCommit({description:r?.description??e.v(`op.unmerge`)}),s=t.stateFor(o).mergeSpatial,c=[];try{let l=n.length;for(let t=0;t<l;t++){let r=n[t],a=s.search(r),o=a.length;for(let t=0;t<o;t++){let n=a[t];if(!e.l.isSingleCell(r)&&!e.l.isRangeWithinRange(n,i))throw new e.s(e._(`error.sheet.unmergePartial`));c.push(n)}}if(c.length===0)return void o.rollback();t.indexMerges(null,c),t.commitAndAutoSelect(o,a,r?.autoSelect,{viewAfter:{merges:n,ranges:n}})}catch(e){throw o.rollback(),e}}function hC(t,r,i,a=void 0,o=null){if(!r)return;let s=o?.isCell??!1,c=o?.isHyperlink??!1,l=r.tuples,u=r.bounds,d=null,f=t.isDataColumn,p=f?n.l.Axis.Column:n.l.Axis.Row,m=t.getProtection().isLocked(),h=t.getProtection().isFormatCellsAllowed(),g=t.strings,_=u.majorStart,v=u.majorEnd,y=u.minorStart,b=u.minorEnd,x={colStart:f?_:y,rowStart:f?y:_,colEnd:f?v:b,rowEnd:f?b:v};(a??=(n,r)=>{t.validateCoords(n,r??e._(`error.sheet.oobRange`))})(x);let S={[q.Type.BorderStyle]:!1,[q.Type.FillStyle]:!1,[q.Type.ContentStyle]:!1,[q.Type.Table]:!1},C=!1,w=!1;m&&t.hasRangedEntries(`protectedRanges`,x)&&(S[q.Type.Unlock]=!1,C=!0,w=!0),t.hasRangedEntries(`mergeSpatial`,x)&&(S[q.Type.Merge]=!1,C=!0);let T=t.beginCommit({description:i?.description??e.v(`op.updateCells`),viewAfter:w?{skipProtectionCheck:!0}:void 0}),E=t.rangeStateIterator({bounds:x,axis:p,searchTypes:S}),D=E.next(),O=-1,k=-1,A=-1,j=-1,M=null;if(!D.done){let e=D.value,t=e.start,n=e.end;O=f?t.colIndex:t.rowIndex,k=f?n.colIndex:n.rowIndex,A=f?t.rowIndex:t.colIndex,j=f?n.rowIndex:n.colIndex,M=e.intersection}let N=(e,t)=>{do{if(!M||e<=A&&t<A)return null;if(e>=O&&t>=A&&e<=k&&t<=j)return M;if(D=E.next(),D.done)M=null,N=null,C=!1;else{let e=D.value;O=f?e.start.colIndex:e.start.rowIndex,k=f?e.end.colIndex:e.end.rowIndex,A=f?e.start.rowIndex:e.start.colIndex,j=f?e.end.rowIndex:e.end.colIndex,M=e.intersection}}while(M);return M},P=t.stateFor(T),F=P.cellValuesGrid.clone(),I=P.calcGrid.clone(),L=P.spillSpatial.clone(),ee=P.pendingSpatial.clone(),te=P.calcErrorsSpatial.clone(),R=P.errorSpatial,z=P.contentfulSpatial.clone(),ne=qa(f),re=qa(f),B=qa(f,(e,t)=>{if(e===t)return t}),ie=qa(f,(e,t)=>{if(e===t)return t}),ae=qa(f,(e,t)=>{if(e===t)return t}),oe=[],se=null,ce=null;!1!==i?.textParser&&(ce={ignoreQuotePrefix:!1,parse:null,...i&&!0!==i.textParser?i.textParser:{}},se=new LT(g,null,t.cellOptions));let le,ue=[],de=t.runtime,fe=new Map,pe=VT,me=!1,he=(t,r,i)=>{let a=N?.(r,i);if(a?.merge){let e=a.merge.getCoords(),t=f?e.colStart:e.rowStart,n=f?e.rowStart:e.colStart;if(t!==r||n!==i)return}let o=a?.contentStyle;if(le!==o&&(le=o,me=!1,o)){let e=o.getPropertiesAt(0,0,null)?.numberFormat;e&&(me=!!(l=e)&&(l===49||l===`@`||typeof l!=`number`&&(uc().getFormatInfo(l)?.isText??!1)))}var l;if(s&&t&&t.isICell){let e=t;if(e.isTopLeft()){let t=e.getSpans();oe.push({colStart:f?r:i,rowStart:f?i:r,colEnd:(f?r:i)+t.width-1,rowEnd:(f?i:r)+t.height-1})}}let u=fx(de,t,me?null:ce,fe);if(u===void 0)return;let d=u.value;if(typeof d==`string`&&d.length>n.r.MAX_TEXT_LENGTH&&(d=d.slice(0,n.r.MAX_TEXT_LENGTH)),u.stringToParse){lC[0].colIndex=f?r:i,lC[0].rowIndex=f?i:r,lC[1]=d,lC[2]=a,se.setState(lC);let e=ce?.parse(u.stringToParse,se.context),t=fx(de,e,ce,fe,!0);if(se.clear(),t===null)return t;t!==void 0&&(u={...t})}if(m){let n=!1,r=!1,i=a?.unlock;if(i)if(Array.isArray(i)){let e=i.length;for(let t=0;t<e;t++){if(i[t].isUnlocked()){n=!0;break}r=!0}}else i.isUnlocked()?n=!0:r=!0;if(!n){let n=e._(r?`error.sheet.protectedRangeLocked`:`error.sheet.protectedSheet`);if(t===null||u.value!==void 0||!h&&u.style!==void 0)throw new e.s(n)}}if(!c){let e=u.style;e===void 0||e===null&&!s||B.append(r,i,e);let t=u.hyperlink;t===void 0||t===null&&!s||ie.append(r,i,t)}let p=u.formula;return p===void 0||p===null&&!s||ae.append(r,i,p),d},ge=-1,_e=-1;try{let r=l.length;for(let t=0;t<r;t++){let r=l[t],i=r[0];if(ge>=i)throw new ri.OutOfOrderError(`Duplicate or out of order major indices: {${i}}.`);if(ge=i,_e=-(2**53-1),i<_||i>v)throw new e.C(`Provided major bounds is invalid`);let a=r[1],o=[],c=a.length;for(let t=0;t<c;t++){let r=a[t],c=r[1],l=c.length,u=r[0],d=u;if(_e>d)throw new ri.OutOfOrderError(`Duplicate or out of order minor indices: {${d}}.`);if(d<y||d+l>b+1)throw new e.C(`Provided minor bounds is invalid`);let f=[],p=typeof c.at==`function`;for(let e=0;e<l;e++){let t=p?c.at(e):c[e],r=null;if(C||typeof t!=`number`?(C||t!==null||s)&&(r=he(t,i,d)):r=t,typeof r==`number`&&(r=vE(r)),r==null){if(r===null&&ne.append(i,d),f.length>0){let e=pe(f,g);o.push([u,e]),f=[]}u=d+1}else f.push(r),n.a.isError(r)&&re.append(i,d);d++}if(_e=d,f.length>0){let e=pe(f,g);o.push([u,e]),f=null}}o.length>0&&ue.push([i,o])}let a=ne.done(),o=a.length;for(let e=0;e<o;e++){let t=a[e];F.delete(a[e]),z.insertNonOverlapping({...t,value:null}),I.remove(t)}let c,p=HT(ue,f),m=p.length;for(let e=0;e<m;e++){let t=p[e],n=L.search(t),r=n.length;for(let e=0;e<r;e++){let r=n[e];VS(r.rowStart,r.colStart,t)&&F.delete(r)}}ue.length>0&&(F.setValues(ue),c={tuples:ue,bounds:u});let h=ae.done();h.length>1&&(h=Ea(h,n.l.Axis.Column,1)),(c||h.length>0)&&I.setInputs(c,h);for(let e=0;e<m;e++)z.insertNonOverlapping(p[e]);let S=B.done();S.length>0&&fC(t,S),oe.length>0&&pC(t,oe);let w=ie.done();w.length>0&&dC(t,w);let E=re.done();if(!R.isEmpty()||E.length>0){R=R.clone();for(let e=0;e<o;e++)R.insertNonOverlapping({...a[e],value:null});for(let e=0;e<m;e++){let t=p[e];R.insertNonOverlapping({colStart:t.colStart,rowStart:t.rowStart,colEnd:t.colEnd,rowEnd:t.rowEnd,value:null})}let e=E.length;for(let t=0;t<e;t++)R.insertNonOverlapping({...E[t],value:!0})}if(t.cloneRangeStats(F),t.updateState({cellValuesGrid:F,contentfulSpatial:z,calcGrid:I,spillSpatial:L,pendingSpatial:ee,calcErrorsSpatial:te,errorSpatial:R}),i?.autoFit){let e=typeof i.autoFit==`boolean`?oC:i.autoFit;t.autoFit([x],e)}d={ranges:[x]},t.addEvent(`data`,x),t.commitAndAutoSelect(T,d,i?.autoSelect,{viewAfter:{formulas:[x],ranges:[x]}})}catch(e){throw T.rollback(),e}}function gC(t,n,r,i,a){if(t.isEmpty())return;let o=t.search(n),s=o.length;if(s===0)return;let c=new Set;for(let e=0;e<s;e++){let t=o[e].value;t!==void 0&&c.add(t)}let l=a?r.rowStart:r.colStart,u=a?r.rowEnd:r.colEnd;for(let o of c){let s=t.getCoords(o);if(!s)continue;let c=[];for(let t=0;t<s.length;t++){let o=e.l.intersectRanges(s[t],n);if(!o)continue;let d=a?o.rowStart:o.colStart,f=a?o.rowEnd:o.colEnd,p=Math.ceil((l-f)/i),m=Math.floor((u-d)/i);if(m<p)continue;let h=(t,n)=>{let i=a?{...o,rowStart:t,rowEnd:n}:{...o,colStart:t,colEnd:n},s=e.l.intersectRanges(i,r);s&&c.push(s)};if(f-d+1===i)h(d+p*i,f+m*i);else for(let e=p;e<=m;e++)e!==0&&h(d+e*i,f+e*i)}c.length!==0&&o._extendRanges(c)}}function _C(e,t){let n=e.search(t),r=n.length;if(r===0)return e;let i=new Set;for(let e=0;e<r;e++){let t=n[e].value;t!==void 0&&i.add(t)}for(let n of i){let r=e.getCoords(n);r&&(e=e.setCoords(n,R_(r,[t])))}return e}function vC(t,n,r=null,i,a=!1,o=!1){let s=null,c=e.v(`op.clear`),l=!1,u=!1,d=!1,f=!1,p=!1;r===qg.Content.Formulas?(c=e.v(`op.clearFormulas`),f=!0):r===qg.Content.Values?(c=e.v(`op.clearValues`),f=!0):r===qg.Content.Formats?(c=e.v(`op.clearFormats`),l=!0,s=[`formatCells`]):r===qg.Content.Comments?(c=e.v(`op.clearComments`),d=!0):r===qg.Content.Hyperlinks?(c=e.v(`op.clearHyperlinks`),u=!0,s=[`formatCells`]):(s=[],c=e.v(`op.clearAll`),f=!0,l=!0,u=!0,d=!0,p=!0),s!==null&&t.protectionCheck(()=>s,n,i?.description??c);let m,h=I_(n),g=t.beginCommit({description:i?.description??c}),_=t.getState(),v=_.cellValuesGrid,y=_.calcGrid,b=_.contentfulSpatial,x=_.spillSpatial,S=_.pendingSpatial,C=_.calcErrorsSpatial,w=_.errorSpatial,T=_.rangesListenerSpatial2,E=_.conditionalFormats,D=_.dataValidations;try{let s=e.l.sanitizeRangeArray(n);if(u&&!_.hyperlinkSpatial.isEmpty()&&dC(t,s,null),d&&!_.commentsSpatial.isEmpty()&&uC(t,s,null),l&&(fC(t,s,null),a||mC(t,s)),l||f){let i=n.length;for(let s=0;s<i;s++){let i=n[s];if(!l||a||E.isEmpty()||(E=_C(E,i)),!p||a||D.isEmpty()||(D=_C(D,i)),!a){let n=t.getTables().getItems({address:i}),a=n.length;for(let t=0;t<a;t++){let a=n[t];e.l.isRangeWithinRange(a.getRange().getCoords(),i)&&(r===qg.Content.Formats?a.updateStyleOptions({name:null}):a.delete())}let o=t.getAutoTable();if(o){if(!e.l.isRangeWithinRange(o.getRange().getCoords(),i))continue;o.delete()}}if(o){let t=T.search(i),n=t.length;for(let r=0;r<n;r++){let n=t[r];e.l.isRangeWithinRange(n,i)&&(T===_.rangesListenerSpatial2&&(T=T.clone()),console.log(`cut and move listener`),T.remove(n))}}}}if(f&&(v=v.clone(),t.cloneRangeStats(v),y=y.clone(),b=b.clone(),x=x.clone(),S=S.clone(),C=C.clone(),w.isEmpty()||(w=w.clone())),l||f){let e=(e,t)=>{m||=[],e&&m.push(e),t&&m.push(t)},t=n.length;for(let r=0;r<t;r++){let t=n[r];if(f){let n=QS(t,x,v,b,e);v.delete(t);let r={...t,value:null};b.insertNonOverlapping(r),w!==_.errorSpatial&&w.insertNonOverlapping({...t,value:null}),f&&HS(-1,[t],[],b,x,v,void 0,void 0,e),y.remove(t),n?.()}}}t.cloneRangeStats(v),t.updateState({cellValuesGrid:v,calcGrid:y,spillSpatial:x,pendingSpatial:S,calcErrorsSpatial:C,errorSpatial:w,contentfulSpatial:b,rangesListenerSpatial2:T,conditionalFormats:E,dataValidations:D}),t.commitAndAutoSelect(g,h,i?.autoSelect,{viewAfter:{ranges:n,spills:m}})}catch(e){throw g.rollback(),e}}function yC(e,t,n,r,i){let a=n=>{let i=t+n-1,a=t+n;for(let t=0;t<e.length;t++){let n=e[t],o=r?n.rowStart:n.colStart,s=r?n.rowEnd:n.colEnd;if(o<=i&&s>=a)return!0}return!1},o=[0];for(let e=1;e<n;e++)a(e)||o.push(e);return o.push(n),i?o:o.map(e=>n-e).sort((e,t)=>e-t)}function bC(e,t){return e._withProjectedMerge(t)}function xC(e,t){return{coords:t,getCellAt:(t,n)=>e.getCell({rowIndex:t,colIndex:n})}}function SC(t,r,i,a){let{direction:o,amount:s}=RT(r,i),c=!0===a?.preview;if(s===0)return!!c&&xC(t,i);if(s<0)return c?xC(t,i):CC(t,r,i,o,a);let l=o===n.l.Direction.Up||o===n.l.Direction.Down,u=t.getSelection().getCoords(),d=[],f=a?.contentsOnly,p=a?.filler??wS.Types.Series,m={...a?.fillerOptions},h=null,g=null;try{let _={...r},v={...r},y=[r],b=t.getMerges(y);if(b.length>0&&!e.l.isRangeWithinRange(e.l.unionRangesArrays(b),r))throw new e.s(e._(`error.sheet.autofillOverlapMerge`));if(o===n.l.Direction.Left)_.colStart=v.colStart=r.colStart-s,_.colEnd=r.colStart-1;else if(o===n.l.Direction.Right)_.colEnd=v.colEnd=r.colEnd+s,_.colStart=r.colEnd+1;else if(o===n.l.Direction.Up)_.rowStart=v.rowStart=r.rowStart-s,_.rowEnd=r.rowStart-1;else{if(o!==n.l.Direction.Down)throw new e.s(e.c.MESSAGE_ERROR_INVALID_ARG(o));_.rowEnd=v.rowEnd=r.rowEnd+s,_.rowStart=r.rowEnd+1}if(b.length>0){let t=o===n.l.Direction.Down||o===n.l.Direction.Right,i=l?r.rowStart:r.colStart,a=(l?r.rowEnd:r.colEnd)-i+1,c=yC(b,i,a,l,t),u=s%a;if(!c.some(e=>e%a===u)){let t=a;for(let e=0;e<c.length;e++){let n=c[e];n>0&&n<t&&(t=n)}throw new e.s(e._(`error.sheet.autofillMultiple`,{modulus:t}))}}let x=l?`rowIndex`:`colIndex`,S=l?`colIndex`:`rowIndex`,C=l?r.rowEnd+1-r.rowStart:r.colEnd+1-r.colStart,w=l?r.rowStart:r.colStart,T=l?r.rowEnd:r.colEnd,E=l?i.rowStart:i.colStart,D=l?i.rowEnd:i.colEnd,O=l?o===n.l.Direction.Down:o===n.l.Direction.Right;O||(m.reverse=!0);let k=O?T+1:E,A=O?D:w-1,j=A-k+1;d.push(e.l.unionRanges(_,r));let M=e=>{let r=[],i=null,a=t.cellIterator({bounds:e,reverse:!O,axis:l?n.l.Axis.Column:n.l.Axis.Row,searchTypes:{[q.Type.DateFormat]:!1}}),o=a.next();for(;!o.done;){let e=o.value.context,t=e.getCell(),n=e.getCoords();i?.oppositeIndex!==n[S]&&(i={oppositeIndex:n[S],lastIndex:O?w-1:T+1,values:[]},r.push(i));let s=n[x];if(O)for(let e=i.lastIndex+1;e<s;e++)i.values.push(null);else for(let e=i.lastIndex-1;e>s;e--)i.values.push(null);i.lastIndex=s;let c=t.getDate();if(c)i.values.push(c);else{let e=t.getValue();i.values.push(e)}o=a.next()}let s=r.length;for(let e=0;e<s;e++){let t=r[e].values;for(let e=t.length;e<C;e++)t.push(null)}return r},N=(e,t)=>{if(e.canFill(t[0],[])){let n=e.createFillAt(t,m);if(n)return n}return wS.Types.Copy.createFillAt(t)};if(c)return function(t){let n,{ctx:r,template:i,destination:a,mergesTemplate:o,filler:s,contentsOnly:c,isVertical:l,isForward:u,templateStart:d,templateEnd:f,templateSize:p,fillerOptions:m,scanFills:h,safeCreateFillAt:g}=t,_=r.getState(),v=r.getAutoFillPreviewCache();return v&&v.state===_&&v.isForward===u&&v.filler===s&&v.fillerOptions===m&&e.l.isEqualRanges(v.template,i)?n=v.seriesByLine:(n=new Map,r.setAutoFillPreviewCache({state:_,template:i,isForward:u,filler:s,fillerOptions:m,seriesByLine:n})),{coords:a,getCellAt:(t,a)=>{let m={rowIndex:t,colIndex:a};if(e.l.isCellWithinRange(m,i))return r.getCell(m);let _=null;if(o.length>0){let e=l?t:a,n=l?a:t,r=d+((e-d)%p+p)%p;for(let t=0;t<o.length;t++){let i=o[t],a=l?i.rowStart:i.colStart,s=l?i.rowEnd:i.colEnd,c=l?i.colStart:i.rowStart,u=l?i.colEnd:i.rowEnd;if(a<=r&&r<=s&&c<=n&&n<=u){let t=e-(r-a);_=l?{rowStart:t,rowEnd:t+(s-a),colStart:c,colEnd:u}:{rowStart:c,rowEnd:u,colStart:t,colEnd:t+(s-a)};break}}}if(_&&(t!==_.rowStart||a!==_.colStart))return bC(r.createCell(null,m),_);let v=(e=>{if(n.has(e))return n.get(e);let t={...i};l?t.colStart=t.colEnd=e:t.rowStart=t.rowEnd=e;let r=h(t),a=r.length>0?r[r.length-1]:null,o=a?g(s,a.values):null;return n.set(e,o),o})(l?m.colIndex:m.rowIndex);if(!v)return r.createCell(null,m);let y=l?m.rowIndex:m.colIndex,b=u?y-d:d-y+p-1,x=v(b),S={...m},C=b%p;S[l?`rowIndex`:`colIndex`]=u?C+d:f-C;let w=r.getCell(S),T={value:w.getFormula()===null?x:null,style:w.getStyle()},E=c?r.createCell(T,m):r.createCell(null,m).createCell(T);return _?bC(E,_):E}}}({ctx:t,template:r,destination:i,mergesTemplate:b,filler:p,contentsOnly:!0===f,isVertical:l,isForward:O,templateStart:w,templateEnd:T,templateSize:C,fillerOptions:a?.fillerOptions,scanFills:M,safeCreateFillAt:N});h=t.beginCommit({description:e.v(`op.autoFill`),operation:{name:`autoFill`,params:[r,i,a]}});let P=M(r),F=t.createSparseBuilder({axis:l?n.l.Axis.Column:n.l.Axis.Row}),I=P.length;P.sort((e,t)=>e.oppositeIndex-t.oppositeIndex);for(let e=0;e<I;e++){let n=e,r=N(p,P[n].values),i=P[n].oppositeIndex,a=O?C:C+j-1,o=t.runtime.isDate1904();for(let e=0;e<j;e++){let t=r(a+(O?e:-e));rr(t,!0)&&(t=dr(t,o));let n=k+e;l?F.pushAt(n,i,t):F.pushAt(i,n,t)}}vC(t,[_],a?.contentsOnly?qg.Content.Formats:void 0),F.apply();let L=t.getMerges([v]),ee=e.l.unionRangesArrays(L);if(L.length>0&&!e.l.isRangeWithinRange(ee,v))throw new e.s(e._(`error.sheet.autofillOverlapMerge`));if(L.length>0){let e=[],i=L.length;if(l){let t=r.rowEnd-r.rowStart+1,a=o===n.l.Direction.Up?-t:t;for(let t=0;t<i;t++){let n=L[t],r=n.rowEnd-n.rowStart+1;for(let t=1;;t++){let i=n.rowStart+t*a,o=i+r-1;if(i<_.rowStart||o>_.rowEnd)break;e.push({colStart:n.colStart,rowStart:i,colEnd:n.colEnd,rowEnd:o})}}}else{let t=r.colEnd-r.colStart+1,a=o===n.l.Direction.Left?-t:t;for(let t=0;t<i;t++){let n=L[t],r=n.colEnd-n.colStart+1;for(let t=1;;t++){let i=n.colStart+t*a,o=i+r-1;if(i<_.colStart||o>_.colEnd)break;e.push({colStart:i,rowStart:n.rowStart,colEnd:o,rowEnd:n.rowEnd})}}}pC(t,e)}let te=t.getState(),R={},z={};z.borderSpatial=te.borderSpatial,z.fillSpatial=te.fillSpatial,z.contentSpatial=te.contentSpatial,z.continuousFillSpatial=te.continuousFillSpatial,z.dateFormatSpatial=te.dateFormatSpatial;let ne=r,re=_;if(!O){let e=(l?v.rowEnd+1-v.rowStart:v.colEnd+1-v.colStart)%C,t=l?`rowStart`:`colStart`,n=l?`rowEnd`:`colEnd`;e!==0&&(re={..._,[n]:Math.min(_[n],_[t]+e)},ne={...r,[t]:r[n]-e+1},_[t]=_[t]+e)}let B=Object.keys(z),ie=B.length;for(let e=0;e<ie;e++){let t=B[e],n=z[t].createCopiedEntries(ne,re),r=te[t].clone(),i=n.removes,a=i.length;for(let e=0;e<a;e++)r.remove(i[e]);r.load(n.inserts),R[t]=r}if(O){let e=t.getTables().getItems({address:{rowIndex:r.rowEnd,colIndex:r.colEnd}});if(e.length===1){let t=e[0],n=t.getRange().getCoords();(_.rowEnd>n.rowEnd||_.colEnd>n.colEnd)&&t.resize({colStart:n.colStart,rowStart:n.rowStart,colEnd:Math.max(n.colEnd,_.colEnd),rowEnd:Math.max(n.rowEnd,_.rowEnd)})}}if(!a?.contentsOnly){let e=l?{colStart:r.colStart,colEnd:r.colEnd,rowStart:k,rowEnd:A}:{rowStart:r.rowStart,rowEnd:r.rowEnd,colStart:k,colEnd:A};gC(te.conditionalFormats,r,e,C,l),gC(te.dataValidations,r,e,C,l)}let ae=te.calcGrid.clone();ae.autoFill(r,_),R.calcGrid=ae,t.updateState(R),g={...u,ranges:d},h.commit({viewBefore:{view:t.getView(),selection:I_([r]),selectOptions:a?.autoSelect},viewAfter:{view:t.getView(),selection:g,selectOptions:a?.autoSelect}}),t.autoSelect(a?.autoSelect??!1,g)}catch(e){throw h?.rollback(),e}return!0}function CC(t,r,i,a,o){let s={...r};if(a===n.l.Direction.Down)s.rowStart=i.rowEnd+1;else if(a===n.l.Direction.Up)s.rowEnd=i.rowStart-1;else if(a===n.l.Direction.Right)s.colStart=i.colEnd+1;else{if(a!==n.l.Direction.Left)throw new e.s(e.c.MESSAGE_ERROR_INVALID_ARG(a));s.colEnd=i.colStart-1}let c=t.getMerges([s]);if(c.length>0&&!e.l.isRangeWithinRange(e.l.unionRangesArrays(c),s))throw new e.s(e._(`error.sheet.autofillOverlapMerge`));let l=t.getSelection().getCoords(),u={colStart:i.colStart,rowStart:i.rowStart,colEnd:i.colEnd,rowEnd:i.rowEnd},d=t.beginCommit({description:`Auto Fill`,operation:{name:`autoFill`,params:[r,i,o]}});try{vC(t,[s],o?.contentsOnly?qg.Content.Values:void 0);let e={...l,cell:{rowIndex:Math.min(Math.max(l.cell.rowIndex,u.rowStart),u.rowEnd),colIndex:Math.min(Math.max(l.cell.colIndex,u.colStart),u.colEnd)},ranges:[u]};d.commit({viewBefore:{view:t.getView(),selection:I_([r]),selectOptions:o?.autoSelect},viewAfter:{view:t.getView(),selection:e,selectOptions:o?.autoSelect}}),t.autoSelect(o?.autoSelect??!1,e)}catch(e){throw d?.rollback(),e}return!0}function wC(t,n,r=e._(`error.sheet.oobRange`),i=!1){if(!i&&!e.l.isRangeWithinRange(n,t.getEntireCoords()))throw new e.C(r);let a=n.colStart,o=n.rowStart,s=n.colEnd,c=n.rowEnd;if(c<o||s<a)throw new e.s(e._(`error.address.invalidRangeInverted`));if(!(Number.isInteger(a)&&Number.isFinite(a)&&Number.isInteger(o)&&Number.isFinite(o)&&Number.isInteger(s)&&Number.isFinite(s)&&Number.isInteger(c)&&Number.isFinite(c)))throw new e.s(e._(`error.address.invalidRangeCoords`))}function TC(t){return new e.s(t?e._(`error.address.noAddress`):Ah(t))}function EC(t,n=null,r=null,i=null){if(n&&t.isClosed)return;if(!t.isInitializing&&t.readonly)throw new e.s(((t=e.v(`op.update`))=>e._(`error.sheet.readonlySheet`,{description:e._(t)}))(i));r&&!Array.isArray(r)&&(r=[r]);let a=n(r),o=t.getProtection();if(o?.getProperties()){if(a.length===0)throw new e.s(e._(`error.sheet.protectedSheet`));if(a){let t=a.length;for(let n=0;n<t;n++)if(!0!==o[a[n]])throw new e.s(gv())}}}function DC(t,n,r=null,i=!0,a=!1,o=!1){if(r&&t.isClosed||n==null)return e.A.EmptyArray;let s=Ml(n,t.getEntireCoords(),a?El:Dl,n=>{if(i&&typeof n==`string`){let r=(t.getNames()?.getByName(n))?.getRanges?.();if(r)return r.getCoords();let i=t.resolveRange(n);if(i&&i.getSheet()===t.internal.getSheet())return console.warn(e._(`error.sheet.addressInvalidScope`)),[i.getCoords()];throw new e.s(`Invalid sheet reference '${n}'.`)}}),c=s.length;for(let n=0;n<c;n++){let r=s[n];if(r){if(a){let n=r.scope;if(n&&n!==t.getName())throw new e.s(e._(`error.sheet.addressInvalidScope`))}wC(t,r,void 0,o)}}if(!r)return s;if(s.length===0)throw TC(n);return EC(t,r,s),s}function OC(t,n,r=null,i=!0){if(!n)throw new e.s(e._(`error.address.noAddress`));let a=DC(t,n,r?e=>r(e):void 0,i);if(a.length===0)throw new e.s(Ah(n));return a[0]}var kC=class e{constructor(e,t,n){this.groupId=e,this.uuid=t,this.noShift=n}onRemove(e){}getShifted(t){if(!t.after)return null;let n=this.noShift;return n?void 0:{...t.after,value:new e(this.groupId,this.uuid,n)}}getSplit(e,t){}copyTo(t,n){return{...t,value:new e(this.groupId,this.uuid,this.noShift)}}canTile(e,t){return!1}},AC=class t{constructor(e,t,n,r,i,a,o,s,c,l){this.uuid=e,this.spatialsIds=t,this.isRanges=r,this.coords=n,this.sheet=i,this.generation=a,this.handler=o,this.handlerW=s,this.removeListener=c,this.options=l}delete(){this.removeListener()}createRangeEvent(e,t){let n,r=this,i=()=>{if(n)return n;let e=r.sheet,i=r.isRanges,a=r.coords;return t||!a||a.length===0?wT(e,e.getEntireRange().getCoords(),null,t):i?(n=e.getRanges(r.coords),n):(n=e.getRange(r.coords[0]),n)},a=e.trigger;return{getSource:i,getFrom:()=>null,getTo:()=>null,trigger:a,getTransactionId:e.getTransactionId,toString:()=>`SheetRangeEvent: ('${a}', ${i().toString()})`,timeStamp:e.timeStamp??Date.now()}}notify(e,t){let n=this.createRangeEvent(e,t),r=this.handler??this.handlerW.deref();try{r?.(n)}catch(e){console.warn(e)}this.options?.once&&this.removeListener()}processRemove(e){let n=this.spatialsIds,r=n.indexOf(e.value.uuid);console.assert(r!==-1,`invalid uuid`);let i=this.coords,a=i.slice(0,r).concat(i.slice(r+1)),o=n.slice(0,r).concat(n.slice(r+1));return new t(this.uuid,o,a,this.isRanges,this.sheet,this.generation,this.handler,this.handlerW,this.removeListener,this.options)}processShift(n){let r=this.spatialsIds.indexOf(n.value.uuid);console.assert(r!==-1,`invalid uuid`);let i=[...this.coords];return i[r]={...i[r],...e.l.sanitizeRange(n)},new t(this.uuid,this.spatialsIds,i,this.isRanges,this.sheet,this.generation,this.handler,this.handlerW,this.removeListener,this.options)}processSplit(e){}processMerge(e){}},jC=class t{constructor(t){if(this._magicCell=null,this._adjusting=null,this._firstActiveCoords=null,this._cache={range:null,ranges:null},this._sheet=t.sheet,!this._sheet)throw Error(`Sheet is required`);this._coords=t.coords??e.l.EmptySelection,this._emitter=new v(this),this._adjusting=null,this._shapePolicy=t.shapePolicy??`mixed`,this._navigationPolicy=t.navigationPolicy??`clear`}navigate(t,r=!1,i=!1,a=0){let o=this._coords;if(!o.cell)return this;let s=o.cell,c=o.cell;if(r&&o.ranges.length>0){let e=o.ranges[o.rangeIndex],r=o.cell;switch(t){case n.l.Direction.Up:c={rowIndex:r.rowIndex===e.rowStart?e.rowEnd:e.rowStart,colIndex:e.colEnd},s={rowIndex:r.rowIndex===e.rowStart?e.rowStart:e.rowEnd,colIndex:e.colStart};break;case n.l.Direction.Down:c={rowIndex:r.rowIndex===e.rowEnd?e.rowStart:e.rowEnd,colIndex:e.colEnd},s={rowIndex:r.rowIndex===e.rowEnd?e.rowEnd:e.rowStart,colIndex:e.colStart};break;case n.l.Direction.Left:c={rowIndex:e.rowEnd,colIndex:r.colIndex===e.colStart?e.colEnd:e.colStart},s={rowIndex:e.rowStart,colIndex:r.colIndex===e.colStart?e.colStart:e.colEnd};break;case n.l.Direction.Right:c={rowIndex:e.rowEnd,colIndex:r.colIndex===e.colEnd?e.colStart:e.colEnd},s={rowIndex:e.rowStart,colIndex:r.colIndex===e.colEnd?e.colEnd:e.colStart}}}let l=this._getRangeFromCell(c),{rowStart:u,colStart:d}=l,f=this._magicCell;if(f)switch(t){case n.l.Direction.Up:case n.l.Direction.Down:f.colIndex>=l.colStart&&f.colIndex<=l.colEnd&&(d=f.colIndex);break;case n.l.Direction.Left:case n.l.Direction.Right:f.rowIndex>=l.rowStart&&f.rowIndex<=l.rowEnd&&(u=f.rowIndex)}if(!a){let r=this._getEntireRange(),a=r.rowStart??0,o=r.rowEnd??2**53-1,s=r.colStart??0,f=r.colEnd??2**53-1;switch(t){case n.l.Direction.Up:u=e.z.traverseHiddenHeaders(this._hiddenRowsAt.bind(this),Math.max(l.rowStart-1,a),t,Math.max(a,this._hiddenRowsAt(a,!1)));break;case n.l.Direction.Down:u=e.z.traverseHiddenHeaders(this._hiddenRowsAt.bind(this),Math.min(l.rowEnd+1,o),t,Math.min(o,o-this._hiddenRowsAt(o,!0)));break;case n.l.Direction.Left:d=e.z.traverseHiddenHeaders(this._hiddenColumnsAt.bind(this),Math.max(l.colStart-1,s),t,Math.max(s,this._hiddenColumnsAt(s,!1)));break;case n.l.Direction.Right:d=e.z.traverseHiddenHeaders(this._hiddenColumnsAt.bind(this),Math.min(l.colEnd+1,f),t,Math.min(f,f-this._hiddenColumnsAt(f,!0)))}if(i)switch(t){case n.l.Direction.Up:case n.l.Direction.Down:u=this._contentfulCellFinder({...c,colIndex:this._coords.cell.colIndex},t);break;case n.l.Direction.Left:case n.l.Direction.Right:d=this._contentfulCellFinder({...c,rowIndex:this._coords.cell.rowIndex},t)}u=Math.min(Math.max(u,a),o),d=Math.min(Math.max(d,s),f)}let p=null;a&&(p={});let m={rowIndex:u,colIndex:d},h=this._getRangeFromCell(m),g={rowIndex:h.rowStart,colIndex:h.colStart};r||(this._magicCell=m);let _=this._firstActiveCoords,v=e.l.isEqualCells(_,g)&&e.l.isEqualCells(_,s);if(r&&!v?this.modify(g,s):this.clearAndModify(g),p)this._scrollCellCoordsIntoView(p);else{if(r&&_){let e=this._getEntireRange();if(t===n.l.Direction.Right&&_.colIndex===e.colEnd||t===n.l.Direction.Left&&_.colIndex===e.colStart||t===n.l.Direction.Up&&_.rowIndex===e.rowEnd||t===n.l.Direction.Down&&_.rowIndex===e.rowStart)return this}t===n.l.Direction.Left||t===n.l.Direction.Right?this._scrollCellCoordsIntoView({colStart:m.colIndex}):t!==n.l.Direction.Up&&t!==n.l.Direction.Down||this._scrollCellCoordsIntoView({rowStart:m.rowIndex})}return this}getCoords(){return this._coords}hasTopOrLeft(){let e=this._coords;if(e.cell.rowIndex===0||e.cell.colIndex===0)return!0;let t=e.ranges,n=t.length;for(let e=0;e<n;e++){let n=t[e];if(n.rowStart===0||n.colStart===0)return!0}return!1}getSheet(){return this._sheet}getCell(){let e=this._coords;return this._sheet.getCell(e.cell)}getRange(e){let t=this._coords,n=this._cache;if(!e&&n.range)return n.range;let r=F_(t),i=this._sheet.getRange(this._localCoords(r[0]));return e||(n.range=i),i}getRanges(e){let t=this._coords,n=this._cache;if(!e&&n.ranges)return n.ranges;let r=F_(t),i=this._sheet.getRanges(r,e);return e||(this._cache.ranges=i),i}updateCoords(t){let n=this._coords;if(e.l.isEqualSelectionCoords(n,t))return this;let r=this._resolveEntireHeaderSelection(P_(t,this._coords,this._getEntireRange()));if(e.l.isEqualSelectionCoords(n,r))return this;this._coords=r;let i=this._cache;return i.range=null,i.ranges=null,this._emitter.notify(`onChange`),this}isEntire(){let t=this._coords;if(t.ranges.length===0)return!1;let n=this._getEntireRange(),r=t.ranges,i=r.length;for(let t=0;t<i;t++){let i=r[t];if(!e.l.isRangeWithinRange(n,i))return!1}return!0}getSelectedRuns(e){return N_(e,this._coords,this._getEntireRange())}isEquals(t){let n=this._coords,r=t.getCoords();return e.l.isEqualSelectionCoords(n,r)}traverse(t=n.l.Axis.Row,r=!1,i){let a=n.l.Direction.Right;a=t===n.l.Axis.Row?r?n.l.Direction.Left:n.l.Direction.Right:r?n.l.Direction.Up:n.l.Direction.Down;let o=this._coords;if(o.ranges.length===0){if(i&&!e.l.isSingleCell(i)){let t={ranges:[i],cell:o.cell,rangeIndex:0},n=e.z.findNextCellWithinSelection(t,a,this._getRangeFromCell.bind(this),this._hiddenRowsAt.bind(this),this._hiddenColumnsAt.bind(this));return this.clearAndModify(n.cell),this._scrollCellCoordsIntoView({rowStart:n.cell.rowIndex,colStart:n.cell.colIndex}),this}return this.navigate(a)}let s=this._getRangeFromCell(o.cell);if(e.l.isEqualRangesArrays([s],o.ranges))return this.navigate(a);let c=e.z.findNextCellWithinSelection(o,a,this._getRangeFromCell.bind(this),this._hiddenRowsAt.bind(this),this._hiddenColumnsAt.bind(this));return this.updateCoords(c)}traverseCorners(){let t=this._coords;if(t.ranges.length===0)return this;let r,i=t.ranges[t.rangeIndex],a=this._hiddenRowsAt.bind(this),o=this._hiddenColumnsAt.bind(this),s=e.z.traverseHiddenHeaders(a,i.rowStart,n.l.Direction.Down,i.rowEnd),c=e.z.traverseHiddenHeaders(a,i.rowEnd,n.l.Direction.Up,i.rowStart),l=e.z.traverseHiddenHeaders(o,i.colStart,n.l.Direction.Right,i.colEnd),u=e.z.traverseHiddenHeaders(o,i.colEnd,n.l.Direction.Left,i.colStart),{rowIndex:d,colIndex:f}=t.cell;return r=d===s&&f===l?{rowIndex:s,colIndex:u}:d===s&&f===u?{rowIndex:c,colIndex:l}:d===c&&f===l?{rowIndex:c,colIndex:u}:{rowIndex:s,colIndex:l},this.updateCoords({ranges:t.ranges,rangeIndex:t.rangeIndex,cell:r}),this._scrollCellCoordsIntoView({rowStart:r.rowIndex,colStart:r.colIndex}),this}clearHidden(){let t=this.getRanges().getVisible();if(!t)return this;let n=t.getCoords();if(n.length===0)return this;let r=this._coords.cell,i=this._hiddenRowsAt(r.rowIndex)>0||this._hiddenColumnsAt(r.colIndex)>0?{rowIndex:n[0].rowStart,colIndex:n[0].colStart}:r,a=0;for(let t=0;t<n.length;t++)if(e.l.isCellWithinRange(i,n[t])){a=t;break}return this.updateCoords({ranges:n,rangeIndex:a,cell:i})}_resolveEntireHeaderSelection(e){let t=e.rangeIndex,n=t>=0?e.ranges[t]:null;if(!n)return e;let r=this._getEntireRange(),i=vT([n],r,!0),a=yT([n],r,!0);if(i===a)return e;let o=e.cell;if(i&&o.rowIndex!==n.rowStart||a&&o.colIndex!==n.colStart)return e;let s=this._sheet.getView();if(!s)return e;let c=(i?this._entireColumnsToTableBody(n):null)??n,l=s.getTopLeftCell(),u=i?Math.max(c.rowStart,Math.min(l.rowIndex,c.rowEnd)):o.rowIndex,d=a?Math.max(c.colStart,Math.min(l.colIndex,c.colEnd)):o.colIndex;return c===n&&u===o.rowIndex&&d===o.colIndex?e:Object.freeze({cell:Object.freeze({...o,rowIndex:u,colIndex:d}),ranges:c===n?e.ranges:e.ranges.map((e,n)=>n===t?c:e),rangeIndex:t})}_entireColumnsToTableBody(e){let t=this._sheet.getColumnHeaders(),n=t.at(e.colStart)?.getColumn();if(!n)return null;let r=n.getTable();for(let n=e.colStart+1;n<=e.colEnd;n++)if(t.at(n)?.getColumn()?.getTable()!==r)return null;let i=r.getDataRange().getCoords();return!i||i.rowStart>i.rowEnd?null:Object.freeze({...e,rowStart:i.rowStart,rowEnd:i.rowEnd})}_isEntireRange(e){e||=F_(this._coords)[0];let t=this._sheet.getEntireRange().getCoords();return yT([e],t,!0)&&vT([e],t,!0)}async selectRegion(t){let r=t?.entireRegion??!1,i=t?.contentOnly??!1,a=t?.axis,o=this._sheet;if(a!==void 0){let t=this._coords,r=o.getCell(t.cell).getTable(),i=(r?r.getDataRange():o.getEntireRange()).getCoords(),s=t.ranges.length&&t.rangeIndex>=0?t.ranges[t.rangeIndex]:e.l.cellToRange(t.cell),c=a===n.l.Axis.Column||a===n.l.AxisSelection.Both,l=a===n.l.Axis.Row||a===n.l.AxisSelection.Both,u={rowStart:c?i.rowStart:s.rowStart,rowEnd:c?i.rowEnd:s.rowEnd,colStart:l?i.colStart:s.colStart,colEnd:l?i.colEnd:s.colEnd},d=t.rangeIndex;return this._setSelectionRanges(e=>e.length?e.map((e,t)=>t===d?{...e,...u}:e):[u]),o.getRange(u)}let s=null;if(r)s=o.getEntireRange();else{let e=this._coords;if(this._isEntireRange()){let t=o.getRange(e.cell);s=t.getSurrounding(),s.isEntireRange()&&(s=t)}else s=this.getRange().getSurrounding({contentOnly:i})}return s&&await s.select(),s}clear(){this._setSelectionRanges(e.l.EmptyRanges)}modify(e,t,n){if(this._shapePolicy===`cell`)return;let r=this._coords,i=this._rangesFromCellOptional(r,e,t??r.cell);if(!i)return;let a=r.rangeIndex;this._setSelectionRanges(e=>e.length?e.map((e,t)=>a===t?{...e,...i}:e):[i]),n&&i&&this._setSelectionCell({colIndex:i.colStart,rowIndex:i.rowStart})}append(t,n=t,r){if(this._shapePolicy!==`ranges`&&this._shapePolicy!==`mixed`||!t||this._isCellOutOfBounds(t)||this._isCellOutOfBounds(n))return;let i=this._coords,a=this._cellToRangeActual(t,n);if(!a)return;let o=i.ranges.length>0?[...i.ranges]:[this._cellToRangeActual(i.cell,i.cell)];o.push(a);let s={ranges:o,cell:{rowIndex:a.rowStart,colIndex:a.colStart,...r},rangeIndex:o.length-1};e.l.isEqualSelectionCoords(s,i)||this.updateCoords(s)}clearAndModify(e,t,n){let r=this._coords;e={...r.cell,...e},t??=e;let i=this._rangesFromCellOptional(r,e,t);if(!i)return;let a={rowIndex:i.rowStart,colIndex:i.colStart},o={...a,...n};this._navigationPolicy===`modify`?this.modify(a,a):(this._firstActiveCoords=o,this.clear()),this._setSelectionCell(o)}setAdjusting(e){this._adjusting=e,this._emitter.notify(`onAdjustingChange`)}getAdjusting(){let e=this._adjusting;if(!e)return null;let n=new t({sheet:this._sheet,coords:e,shapePolicy:this._shapePolicy,navigationPolicy:this._navigationPolicy});return n._adjusting=e,n}createSelection(e){return new t({sheet:this._sheet,coords:e?.coords,shapePolicy:e?.shapePolicy??this._shapePolicy,navigationPolicy:e?.navigationPolicy??this._navigationPolicy})}addListeners(e,t){return this._emitter.addListeners(e,t)}_setSelectionRanges(t){let n=this._coords,r=typeof t==`function`?t(n.ranges):t??e.l.EmptyRanges;if(e.l.isEqualRangesArrays(r,n.ranges))return;let i=Math.max(r.length?0:-1,Math.min(n.rangeIndex,r.length-1)),a=n.cell;i===-1||e.l.isCellWithinRange(a,r[i])||(a={rowIndex:r[i].rowStart,colIndex:r[i].colStart}),this._shapePolicy===`mixed`&&r.length===1&&e.l.isSingleCell(r[0])&&e.l.isCellWithinRange(a,r[0])&&(r=[],i=-1);let o={cell:a,ranges:r,rangeIndex:i};e.l.isEqualSelectionCoords(o,n)||this.updateCoords(o)}_setSelectionCell(t){let n=this._coords,r=t??e.l.EmptyCell,i=this._getRangeFromCell(r),a=this._shapePolicy===`range`||this._shapePolicy===`ranges`;if(n.ranges.length===0&&(a||!e.l.isSingleCell(i)))return this.updateCoords({ranges:[i],rangeIndex:0,cell:r});if(e.l.isEqualCells(r,n.cell))return this;let o=n.ranges,s=n.rangeIndex;this._shapePolicy===`mixed`&&n.ranges.length===1&&(e.l.isSingleCell(n.ranges[0])&&e.l.isCellWithinRange(r,n.ranges[0])||!e.l.isCellWithinRange(r,n.ranges[0]))&&(o=[],s=-1);let c={ranges:o,rangeIndex:s,cell:r};return e.l.isEqualSelectionCoords(c,n)?this:this.updateCoords(c)}_isCellOutOfBounds(e){let t=this._getEntireRange();return e.rowIndex<t.rowStart||e.colIndex<t.colStart||e.colIndex>t.colEnd||e.rowIndex>t.rowEnd}_cellToRangeActual(t,n){let r={rowStart:Math.min(t.rowIndex,n.rowIndex),colStart:Math.min(t.colIndex,n.colIndex),rowEnd:Math.max(t.rowIndex,n.rowIndex),colEnd:Math.max(t.colIndex,n.colIndex)};if(this._canSelectionSpanMergedCells(r))return r;let i=this._getRangeFromCell(t),a=this._getRangeFromCell(n),o={rowStart:Math.min(i.rowStart,a.rowStart),colStart:Math.min(i.colStart,a.colStart),rowEnd:Math.max(i.rowEnd,a.rowEnd),colEnd:Math.max(i.colEnd,a.colEnd)},s=this._getMergedRanges(o);return e.l.extendRangeToUnionRanges(o,s)}_rangesFromCellOptional(e,t,n){let r=e.ranges.length>0?e.ranges[e.rangeIndex]:{rowStart:e.cell.rowIndex,colStart:e.cell.colIndex,rowEnd:e.cell.rowIndex,colEnd:e.cell.colIndex},i={rowStart:Math.min(t.rowIndex??r.rowStart,n.rowIndex??r.rowStart),colStart:Math.min(t.colIndex??r.colStart,n.colIndex??r.colStart),rowEnd:Math.max(t.rowIndex??r.rowEnd,n.rowIndex??r.rowEnd),colEnd:Math.max(t.colIndex??r.colEnd,n.colIndex??r.colEnd)},a={rowIndex:i.rowStart,colIndex:i.colStart},o={rowIndex:i.rowEnd,colIndex:i.colEnd};if(!this._isCellOutOfBounds(a)&&!this._isCellOutOfBounds(o))return this._cellToRangeActual(a,o)}_getEntireRange(){return this._sheet.getEntireRange().getCoords()}_hiddenRowsAt(e,t){return this._sheet.getRowHeaders().hiddenHeadersAt(e,t)}_hiddenColumnsAt(e,t){return this._sheet.getColumnHeaders().hiddenHeadersAt(e,t)}_localCoords(e){if(!e||e.scope===void 0)return e;let{scope:t,...n}=e;return n}_getRangeFromCell(t){let n=e.l.cellToRange(t);if(this._sheet.isDeleted())return n;let r=this._sheet.getRange(this._localCoords(n),{ignoreHidden:!0}).getMerges();return r.length===0?n:r[0]}_canSelectionSpanMergedCells(e){let t=this._sheet.getRange(this._localCoords(e));return t.isEntireColumns()||t.isEntireRows()}_getMergedRanges(e){return this._sheet.getRange(this._localCoords(e),{ignoreHidden:!0}).getMerges()}_isContentfulCell(){return!1}_contentfulCellFinder(t,r){let i=this._sheet.getRange(this._localCoords(e.l.cellToRange(t))).getExtended(r,t).getCoords();switch(r){case n.l.Direction.Up:return i.rowStart;case n.l.Direction.Down:return i.rowEnd;case n.l.Direction.Left:return i.colStart;case n.l.Direction.Right:return i.colEnd}}_scrollCellCoordsIntoView(e,t){return this._sheet.scrollTo(e,t?{scroll:t}:void 0)}get[Symbol.toStringTag](){return`[RangeShape]`}toString(){let e=``;return e+=`selection:[${this._sheet.getRange(this._localCoords(this._coords.cell)).toString()}`,this._coords.ranges&&this._coords.ranges.length>0&&(e+=`, ${this._sheet.getRanges(this._coords.ranges.map(e=>this._localCoords(e))).toString()}`),this._coords.rangeIndex!==void 0&&this._coords.rangeIndex!==-1&&(e+=`, ${this._coords.rangeIndex}`),e+=`]`,e}},MC=Object.freeze({coords:e.l.EmptyCell,topLeft:e.o.EmptyTopLeft}),NC=(Object.freeze({cell:e.l.EmptyCell,ranges:e.A.EmptyArray,rangeIndex:0}),Object.freeze({selection:null,topLeft:e.o.EmptyTopLeft,freezePanes:MC,showRowHeaders:!0,showColumnHeaders:!0,showRowGridlines:!0,showColumnGridlines:!0,rowHeaderStyle:av.HeaderTextStyle.One,columnHeaderStyle:av.HeaderTextStyle.A1,tableNames:av.ColumnHeaderTableNames.Sticky,showFormulas:!1,showZeros:!0,rightToLeft:!1,zoomScale:100,gridLineColor:null}));function PC(e,t=!0,n=15,r=10,i=400){let a=Math.max(e-r,0)+(t?1:-1);return Math.min(i,Math[t?`ceil`:`floor`](a/n)*n+r)}var FC=class{constructor(e){let t=e?.sheet;if(!t)throw Error(`SheetView requires a sheet.`);let n=new v(this);this._emitter=n,this._sheet=t;let r=new jC({sheet:t});this._rangeSelection=r,this.clear(!1),e?.json&&this._fromJSON(e.json);let i=this,a={onChange(e){i._emitter.notify(`onSelectionChange`)}};this._rangeSelectionRemoveListener=r.addListeners(a,{transactional:!1})}addListeners(e,t){return this._emitter.addListeners(e,t)}setTopLeft(e){if(!e)return this;let t=this._state,n=t.topLeft,r=n.left,i=n.top,a=e.left??r,o=e.top??i;return a===r&&o===i||(t.topLeft=Object.freeze({left:a,top:o}),this._emitter.notify(`onTopLeftChange`)),this}getTopLeft(){return this._state.topLeft}getTopLeftCell(){let e=this._state.topLeft,t=this._state.freezePanes,n=t?.coords,r=t?.topLeft,i=(n?.rowIndex??0)>0,a=(n?.colIndex??0)>0;return{rowIndex:this._sheet.getRowHeaders().getIndex(i?r?.top??0:e.top),colIndex:this._sheet.getColumnHeaders().getIndex(a?r?.left??0:e.left)}}getFreezePanes(){return this._state.freezePanes}setFreezePanes(e){return this._state.freezePanes=this._mergeFreezePanes(e),this._emitter.notify(`onFreezePaneChange`),this}_mergeFreezePanes(e){return e?{...this._state.freezePanes,coords:{colIndex:e?.coords?.colIndex??this._state.freezePanes.coords.colIndex,rowIndex:e?.coords?.rowIndex??this._state.freezePanes.coords.rowIndex},topLeft:{left:e?.topLeft?.left??this._state.topLeft.left,top:e?.topLeft?.top??this._state.topLeft.top}}:MC}isShowRowHeaders(){return this._state.showRowHeaders}setShowRowHeaders(e){return this._update(e,`showRowHeaders`,`onHeaderChange`),this}isShowColumnHeaders(){return this._state.showColumnHeaders}setShowColumnHeaders(e){return this._update(e,`showColumnHeaders`,`onHeaderChange`),this}isShowRowGridlines(){return this._state.showRowGridlines}setShowRowGridlines(e){return this._state.showRowGridlines=e,this._notifyAll(),this}isShowColumnGridlines(){return this._state.showColumnGridlines}setShowColumnGridlines(e){return this._state.showColumnGridlines=e,this._notifyAll(),this}getRowHeaderStyle(){return this._state.rowHeaderStyle}setRowHeaderStyle(e){return this._update(e,`rowHeaderStyle`,`onHeaderChange`),this}setColumnHeaderStyle(e){return this._update(e,`columnHeaderStyle`,`onHeaderChange`),this}getColumnHeaderStyle(){return this._state.columnHeaderStyle}setColumnHeaderTableNames(e){return this._update(e,`tableNames`,`onHeaderChange`),this}getColumnHeaderTableNames(){return this._state.tableNames}getZoomScale(){return this._state.zoomScale}setZoomScale(e){e<1&&console.warn(`Zoom scale is expressed as a whole number percentage (e.g., 100 for 100%).`);let t=Math.min(400,Math.max(10,e));return this._state.zoomScale===t?this:this._updateZoom(t)}zoomIn(){return this._updateZoom(PC(this.getZoomScale(),!0))}zoomOut(){return this._updateZoom(PC(this.getZoomScale(),!1))}_updateZoom(e){return e===this.getZoomScale()||(this.update({zoomScale:e}),this._emitter.notify(`onZoomScaleChange`)),this}getNextZoomScale(e,t){return PC(this.getZoomScale(),e,t)}isShowFormulas(){return this._state.showFormulas}setShowFormulas(e){return this._state.showFormulas=e,this._notifyAll(),this}isRightToLeft(){return this._state.rightToLeft}setRightToLeft(e){return this._state.rightToLeft=e,this._notifyAll(),this}isShowZeros(){return this._state.showZeros}setShowZeros(e){return this._state.showZeros=e,this._notifyAll(),this}getGridLineColor(){return this._state.gridLineColor}setGridLineColor(e){return this._state.gridLineColor=e,this._notifyAll(),this}getRangeSelection(){return this._rangeSelection}getMovableSelection(){return this._movableSelection}setMovableSelection(t){let n=this._movableSelection;return this._movableSelection=Object.freeze(t??[]),e.A.isEqualArrays(n,this._movableSelection)||this._emitter.notify(`onMovableSelectionChange`),this}selectMovables(t,n=!1){let r=new Set(this._sheet.getMovables().getItems()),i=null,a=!1;if(n){i=[...this._movableSelection];for(let e=t.length-1;e>=0;e--){let n=t[e],o=i.indexOf(n);if(o!==e){if(a=!0,!r.has(n))throw Error(`Movable ${n.getName()} not found in sheet.`);o!==-1&&i.splice(o,1),i.unshift(n)}}}else a=!e.A.isEqualArrays(t,this._movableSelection),i=[...t];return a?(this._movableSelection=i,this._emitter.notify(`onSelectionChange`),this._emitter.notify(`onMovableSelectionChange`),this):this}unselectMovables(e){let t=this._movableSelection,n=[];for(let r=0;r<t.length;r++){let i=t[r];e.indexOf(i)===-1&&n.push(i)}return t.length!==n.length&&(this._movableSelection=n,this._emitter.notify(`onSelectionChange`),this._emitter.notify(`onMovableSelectionChange`)),this}_update(e,t,n){let r=this._state,i=r[t];return r[t]=e,i!==e&&this._emitter.notify(n),i}_notifyAll(){let e=this._emitter;e.notify(`onSelectionChange`),e.notify(`onTopLeftChange`),e.notify(`onZoomScaleChange`),e.notify(`onFreezePaneChange`),e.notify(`onAnyChange`),e.notify(`onHeaderChange`)}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!==NC[n]&&(e[n]=i)}delete e.movableSelection,delete e.gridLineColor,this._state.gridLineColor instanceof Df&&(e.gridLineColor=this._state.gridLineColor.toString()),delete e.topLeft,!this._state.topLeft||this._state.topLeft.left===0&&this._state.topLeft.top===0||(e.topLeft={left:this._state.topLeft.left??0,top:this._state.topLeft.top??0}),delete e.selection;let r=this._rangeSelection.getCoords();if(r){let t={};!r.cell||r.cell.colIndex===0&&r.cell.rowIndex===0||(t.cell=hl(r.cell)),r.ranges&&r.ranges.length>0&&(t.ranges=Ol(r.ranges),r.rangeIndex!==void 0&&r.rangeIndex!==-1&&r.rangeIndex!==0&&(t.rangeIndex=r.rangeIndex)),Object.keys(t).length>0&&(e.selection=t)}return delete e.freezePanes,!this._state.freezePanes||this._state.freezePanes.coords.colIndex===0&&this._state.freezePanes.coords.rowIndex===0||(e.freezePanes={...this._state.freezePanes}),Object.keys(e).length===0?null:e}_fromJSON(t){let n=JSON.parse(JSON.stringify(t||{}));n?.zoomScale&&(n.zoomScale=e.A.roundAccurately(parseFloat(t.zoomScale),2));let r=e=>{let t=this._sheet.getRange(e).getBounds();return{x:1*t.x,y:1*t.y,width:1*t.width,height:1*t.height}};if(typeof n?.gridLineColor==`string`&&(this._sheet?.getStyles()?n.gridLineColor=this._sheet.getStyles().parseColor(t.gridLineColor):console.warn(`Style was created with no styles so gridLineColor can't be parsed.`)),n.topLeft)if(typeof n.topLeft==`string`){let e=r(Nl(n.topLeft));n.topLeft={left:e.x,top:e.y}}else n.topLeft=Object.freeze({left:n.topLeft?.left??n?.x??0,top:n.topLeft?.top??n?.y??0});if(n.selection){let t=Nl(n.selection.cell??`A1`);if(n.selection.cell=t,n.selection.ranges){let r=Math.max(0,Math.min(n.selection.rangeIndex??n.selection.ranges?.length-1,n.selection.ranges?.length-1));n.selection.rangeIndex=r;let i=!1;for(let a=0;a<n.selection.ranges.length;a++){let o=Ll(n.selection.ranges[a]);n.selection.ranges[a]=o,a===r&&t&&!e.l.isCellWithinRange(t,o)&&(i=!0)}if(i)for(let r=0;i&&r<n.selection.ranges.length;r++)e.l.isCellWithinRange(t,n.selection.ranges[r])&&(i=!1,n.selection.rangeIndex=r);i&&(n.selection.ranges.push(e.l.cellToRange(t)),n.selection.rangeIndex=n.selection.ranges.length-1)}else delete n.selection.rangeIndex}if(n.freezePanes){let e=n.freezePanes;if(typeof e.coords==`string`&&(e.coords=Nl(e.coords)),typeof e.topLeft==`string`){let t=Nl(e.topLeft),i=r({colIndex:t.colIndex,rowIndex:t.rowIndex}),a=r({colIndex:e?.coords?.colIndex??0,rowIndex:e?.coords?.rowIndex??0});e.topLeft={left:0,top:0},n.topLeft||={top:0,left:0},t.colIndex>0&&(e.topLeft.left=n.topLeft?.left??0,n.topLeft.left=i.x-a.x+e.topLeft.left),t.rowIndex>0&&(e.topLeft.top=n.topLeft?.top??0,n.topLeft.top=i.y-a.y+e.topLeft.top)}n.freezePanes={coords:{colIndex:e?.coords?.colIndex??0,rowIndex:e?.coords?.rowIndex??0},topLeft:{left:e?.topLeft?.left??0,top:e?.topLeft?.top??0}}}this.update(n)}clear(t=!0){return this._state={...NC},this._movableSelection=e.A.EmptyArray,this._rangeSelection.clear(),t&&this._notifyAll(),this}update(e){let t={...NC,...this._state,...e};return t.selection&&(this._rangeSelection.updateCoords(t.selection),delete t.selection),t.freezePanes=this._mergeFreezePanes(t.freezePanes),t.zoomScale=Math.min(400,Math.max(10,t.zoomScale)),this._state=t,this._notifyAll(),this}get[Symbol.toStringTag](){return`[SheetView]`}toString(){let e=this.toJSON();return e?JSON.stringify(e):`DefaultSheetView`}get isISheetView(){return!0}},IC=class t{constructor(t){this._version=0,this._iterationId=0,this._emitter=null,this._isProcessingJSON=!1,t={...t},this._options=t,this._context=t.context,this._container=t.container,this._calculation=t.calculation,this._gridId=t.uuid||`gen`+e.A.uuidV4();let r={...QT},i=t.getEntireCoords??(()=>r);if(this._getEntireCoords=i,this._unanchored=!0===t.unanchored,!this._context||!this._container)throw Error(`Invalid Options`);this._onCalculated=t?.onCalculated??(()=>{}),this._values=new Ya({axis:n.l.Axis.Column}),this._iterationId=0,this._contentfulSpatial=new va({updateEntryOptions:{isSplitOnExpand:!0,isMergeOnShift:!0}});let a={updateEntryOptions:{isSplitOnExpand:!0,isMergeOnShift:!1}};this._spillSpatial=new va(a),this._errorSpatial=new va(a),this._pendingSpatial=new va(a),this._notifyValues=new va,this._notifySpillsInsert=[],this._notifySpillsRemove=[],this._notifyFormats=new va,this._notifyPending=new va,this._container.registerGrid(this)}beginUpdates(){return{gridId:this._gridId,values:this._values,spillSpatial:this._spillSpatial,errorSpatial:this._errorSpatial,pendingSpatial:this._pendingSpatial,contentfulSpatial:this._contentfulSpatial,notifyValues:this._notifyValues,notifySpillsInsert:this._notifySpillsInsert,notifySpillsRemove:this._notifySpillsRemove,notifyFormats:this._notifyFormats,notifyPending:this._notifyPending,pendingConflating:null,errorRemovesConflating:null,errorInsertsConflating:null,formatsConflating:null,done:(e,t)=>this._notifyCalculated(e,t)}}async calculate(e){return this._container.calculateGrid(this._gridId,e?KC:void 0)}addListeners(e,t){return this._emitter||=new v(this),this._emitter.addListeners(e,t)}shift(t){let r=t.cloneIfUpdate??!0,i=r?this.clone(this):this,a=this.getId(),o={...t};o.range={...o.range},o.range.scope=a,delete o.cloneIfUpdate,delete o.onShift;let s=i._values,c=o.range,l=o.direction,u=l===n.l.Direction.Left||l===n.l.Direction.Right,d=l===n.l.Direction.Down||l===n.l.Direction.Right,f=d?1:-1,p=i._spillSpatial,m=i._contentfulSpatial,h=QS(c,p,s,m);s.shift(o.range,o.direction),o.onUpdates=(e,t)=>{i._notifySpillsRemove.push(...t),i._notifySpillsInsert.push(...e)},i._spillSpatial=p.shift(o),delete o.onUpdates,i._contentfulSpatial=m.shift(o);let g=i._container,_=g.getFormulas(),v=g.getPrecedents();r&&(_=_.clone(),v=v.clone());let y=this.getEntireCoords(),b={colStart:c.colStart,rowStart:c.rowStart,colEnd:u&&f===1?y.colEnd:c.colEnd,rowEnd:u||f!==1?c.rowEnd:y.rowEnd,scope:a},x=d?qS(v,b,JS):function(e,t){return qS(e,t,YS)}(v,c);x&&YC(_,v,x.formulas.inserts,x.formulas.removes);let S,C,w,T=(u?c.colEnd-c.colStart+1:c.rowEnd-c.rowStart+1)*f,E=function(t,r,i,a,o){let s=t(),c=s.search(i),l=c.length;if(l===0)return null;let u=i.colStart,d=i.rowStart,f=a.colIndex,p=a.rowIndex,m=a.scope,h=o?o.colEnd:i.colEnd,g=o?o.rowEnd:i.rowEnd,_=[],v=[],y=[],b=new Map,x=[];for(let t=0;t<l;t++){let r=c[t],a=r.value,o=a.formulaEntry,s=b.get(o)??o,l=s.value,S=l.ref,C=r.colStart,w=r.rowStart,T=r.colEnd,E=r.rowEnd,D=!1;if(a.index<0){x.push(r);continue}if((m===void 0||l.gridId===m)&&e.l.isRangeWithinRange(S,i))continue;let O=a.index,k=l.getReferences(S.rowStart,S.colStart),A=k.length>0?k[O]:null;if(!A||n.a.isError(A)||`nameId`in A)continue;let j=A,M=l.unanchored,N=M&&!j.$colStart,P=M&&!j.$colEnd,F=M&&!j.$rowStart,I=M&&!j.$rowEnd,L=j;if(f!==0){let e=j.$colStart?j.colStart:S.colStart+j.colStart,t=j.$colEnd?j.colEnd:S.colEnd+j.colEnd;f<0&&!N&&!P&&u<=e&&h>=t?L=null:(!N&&e>=u&&(L=L===j?{...j}:L,L.colStart+=Math.max(f,u-e)),!P&&t>=u&&(L=L===j?{...j}:L,L.colEnd+=Math.max(f,u-1-t)))}if(p!==0){let e=j.$rowStart?j.rowStart:S.rowStart+j.rowStart,t=j.$rowEnd?j.rowEnd:S.rowEnd+j.rowEnd;p<0&&!F&&!I&&d<=e&&g>=t?L=null:(!F&&e>=d&&(L=L===j?{...j}:L,L.rowStart+=Math.max(p,d-e)),!I&&t>=d&&(L=L===j?{...j}:L,L.rowEnd+=Math.max(p,d-1-t)))}if(L!==j){if(L!==null&&(C=L.$colStart?L.colStart:S.colStart+L.colStart,w=L.$rowStart?L.rowStart:S.rowStart+L.rowStart,T=L.$colEnd?L.colEnd:S.colEnd+L.colEnd,E=L.$rowEnd?L.rowEnd:S.rowEnd+L.rowEnd,D=!0),l=l.setReferenceAt(O,L),_.push(r),D){let e={...r};e.value={...a},e.value.formulaEntry=s,e.colStart=C,e.rowStart=w,e.colEnd=T,e.rowEnd=E,v.push(e),y.push(o)}s={...s},s.value=l,b.set(o,s)}}let S=x.length;if(S>0||b.size>0){let e=r();if(S>0){s.removeAll(x,aC);for(let t=0;t<S;t++){let n=x[t].value.formulaEntry.value,r=e.get(n);r&&(s.removeAll(r,aC),e.delete(n))}}for(let t of b.keys()){let n=t.value;if(!n)continue;let r=e.get(n);r&&(s.removeAll(r,aC),e.delete(n))}}for(let e=0;e<v.length;e++){let t=b.get(y[e]);t&&(v[e].value.formulaEntry=t)}let C=Array.from(b.keys());return{precedents:{inserts:v,removes:_},formulas:{inserts:Array.from(b.values()),removes:C}}}(()=>v,()=>{let e=g.getDynamics();return S=new Map(e),S},{colStart:c.colStart,rowStart:c.rowStart,colEnd:u?y.colEnd:c.colEnd,rowEnd:u?c.rowEnd:y.rowEnd,scope:a},{colIndex:u?T:0,rowIndex:u?0:T,scope:a},d?void 0:c);E&&YC(_,v,E.formulas.inserts,E.formulas.removes),o.onUpdates=(e,t)=>{C=e,w=t},_.shift(o),(C||w)&&ZC(v,C,w),r&&(g.setFormulas(_),g.setPrecedents(v),S&&g.setDynamics(S)),h?.(d,u?0:T,u?T:0);let D=[{...y,scope:this._gridId}];if(E){let e=E.formulas.inserts;for(let t=0;t<e.length;t++){let n=e[t];n.scope!==this._gridId&&D.push({colStart:n.colStart,rowStart:n.rowStart,colEnd:n.colEnd,rowEnd:n.rowEnd,scope:n.scope})}}return g.markDirty(D),i}clone(e){if(e!==void 0&&this._cloneKey===e)return this;let n=new t(this._options);return n._cloneKey=e,n._version=this._version+1,n._gridId=this._gridId,n._values=this._values.clone(n),n._contentfulSpatial=this._contentfulSpatial.clone(n),n._spillSpatial=this._spillSpatial.clone(n),n._errorSpatial=this._errorSpatial.clone(n),n._pendingSpatial=this._pendingSpatial.clone(n),n._notifyValues=this._notifyValues.clone(n),n._notifySpillsInsert=[...this._notifySpillsInsert],n._notifySpillsRemove=[...this._notifySpillsRemove],n._notifyFormats=this._notifyFormats.clone(n),n._notifyPending=this._notifyPending.clone(n),n._emitter=this._emitter,n._iterationId=this._iterationId+1,this._container.registerGrid(n),n}setInputs(e,t){return this._setInputs(e,t)}remove(e){return this._setInputs(null,[{...e,scope:this._gridId,value:null}],{...e,scope:this._gridId})}autoFill(e,t){typeof e==`string`&&(e=Ll(e)),typeof t==`string`&&(t=Ll(t));let n=this._gridId,r=this._container,i={calcGrid:this,formulaSpatial:r.getFormulas(),precedentSpatial:r.getPrecedents(),volatile:r.getVolatiles()};return this._copyTo(i,{...e,scope:n},{...t,scope:n}),this}delete(){let e=this._container,t=e.getFormulas(),n=e.getPrecedents(),r=t,i=n,a=this._gridId,o=[];if(r.getSpatialAt(a)&&(r=r.clone(),r.getSpatialAt(a).clear()),i.getSpatialAt(a)){i=i.clone();let e=i.getSpatialAt(a),t=new Map,n=new Map,s=e.all();for(let e=0;e<s.length;e++){let r=s[e].value,i=r.formulaEntry;if(i.scope!==a){let e=r.index,a=i;t.set(a,a);let o=n.get(a)??a;o={...o},o.value=o.value.setReferenceAt(e,null,{scopeDeleted:!0}),n.set(a,o)}}if(e.clear(),n.size>0||t.size>0){let e=Array.from(n.values());YC(r,i,e,Array.from(t.values()));for(let t=0;t<e.length;t++){let n=e[t];o.push({colStart:n.colStart,rowStart:n.rowStart,colEnd:n.colEnd,rowEnd:n.rowEnd,scope:n.scope})}}}r!==t&&e.setFormulas(r),i!==n&&e.setPrecedents(i),o.length>0&&e.markDirty(o),this._container.unregisterGrid(this._gridId)}markDirtyRegions(e){let t=this._gridId,n=Array(e.length);for(let r=0;r<e.length;r++){let i=e[r];n[r]=i.scope===t?i:{...i,scope:i.scope??t}}this._container.markDirty(n)}getId(){return this._gridId}getEntireCoords(){return this._getEntireCoords()}getBoundingRange(){let t=null;return t=e.l.unionRanges(this._values.getCoords(),t),t=e.l.unionRanges(this._container.getFormulas().getSpatialAt(this._gridId)?.getBoundingRange(),t),t}getValues(){return this._values}getDirtyRegions(){return this._container.getDirtyGrid(this._gridId)}getFormulas(){return this._container.getFormulas().getSpatialAt(this._gridId)??UC}getSnapshot(e){let t=this,n=this._container,r={calcGrid:t,formulaSpatial:n.getFormulas(),precedentSpatial:n.getPrecedents(),volatile:n.getVolatiles()},i=Object.freeze({...e}),a=i.range;return typeof a==`string`&&(a=Ll(a)),a={...a},a.scope=t.getId(),{async copyTo(e,t){let n=e.calcGrid,o=e.range;typeof o==`string`&&(o=Ll(o));let s={...i,...t},c=j_(o,a,s.fitDestination,s.transpose);return c.scope=n.getId(),s.isCut?n._moveTo(r,a,c):n._copyTo(r,a,c),o},getCoords:()=>a,getSource:()=>t,getName:()=>`Calculation`,getMarkOptions:()=>i,isISnapshot:!0}}getDirectDependentsAt(t){let n=t.rowStart,r=t.colStart,i=t.rowEnd,a=t.colEnd,o=this._gridId,s=this._container.getPrecedents();HC.colStart=r,HC.rowStart=n,HC.colEnd=a,HC.rowEnd=i,HC.scope=o;let c=s.search(HC);if(c.length===0)return e.A.EmptyArray;let l=[];for(let e=0;e<c.length;e++){let t,s=c[e],u=s.value,d=u.formulaEntry,f=n-s.rowStart,p=r-s.colStart,m=i-s.rowStart,h=a-s.colStart,g=d.rowEnd-d.rowStart,_=d.colEnd-d.colStart,v=u.formulaBlockHeight-1,y=u.formulaBlockWidth-1;if(u.index===Wd.Reference){let e=d.value,n=e.ref;t={rowStart:n.rowStart,rowEnd:n.rowEnd,colStart:n.colStart,colEnd:n.colEnd,scope:o===e.gridId?void 0:e.gridId??void 0}}else if(u.index===Wd.Spill||g>v||_>y)t={rowStart:d.rowStart,rowEnd:d.rowEnd,colStart:d.colStart,colEnd:d.colEnd,scope:o===d.scope?void 0:d.scope};else{let e=s.rowEnd-s.rowStart-v,n=s.colEnd-s.colStart-y,r=u.$absRowEnd?0:Math.max(0,f-e),i=u.$absRowStart?v:Math.min(m,v),a=u.$absColEnd?0:Math.max(0,p-n),c=u.$absColStart?y:Math.min(h,y);t={rowStart:d.rowStart+r,rowEnd:d.rowStart+i,colStart:d.colStart+a,colEnd:d.colStart+c,scope:o===d.scope?void 0:d.scope}}l.push(t)}return l=Da(l,2,e.N.Row),l.sort(e.l.rowFirstRangeComparator),l}getDirectPrecedentsAt(t){let n=t.rowStart,r=t.colStart,i=t.rowEnd,a=t.colEnd,o=this._container.getFormulas();HC.colStart=r,HC.rowStart=n,HC.colEnd=a,HC.rowEnd=i;let s=this._gridId;HC.scope=s;let c=o.search(HC);if(c.length===0)return e.A.EmptyArray;let l=this._getEntireCoords(),u=null,d=e=>{if(!e||e===s)return l;u??=new Map;let t=u.get(e);return t||(t=this._container.getGrid(e)?.getEntireCoords()??l,u.set(e,t)),t},f=[];for(let e=0;e<c.length;e++){let t=c[e],o=t,l=this._container.getDynamics().get(o.value);if(l)for(let e=0;e<l.length;e++){let t=l[e];t.value.index===Wd.Reference&&f.push({rowStart:t.rowStart,rowEnd:t.rowEnd,colStart:t.colStart,colEnd:t.colEnd,scope:t.scope===s?void 0:t.scope})}let u=o.value.formula.getReferences(n,r);if(!u)continue;let p=n-t.rowStart,m=r-t.colStart,h=i-t.rowStart,g=a-t.colStart,_=o.rowEnd-o.rowStart,v=o.colEnd-o.colStart,y=t.rowEnd-t.rowStart-_,b=t.colEnd-t.colStart-v,x=Math.max(0,p-y),S=Math.max(0,m-b),C=Math.min(h,_),w=Math.min(g,v),T=[];for(let e=0;e<u.length;e++){let t=u[e];if(t?.colStart===void 0)continue;let n=t.scope,r=d(n),i=Kl(t,o.rowStart+x,o.colStart+S),a=Kl(t,o.rowStart+C,o.colStart+w),c={colStart:Math.max(Math.min(i.colStart,a.colStart),r.colStart),rowStart:Math.max(Math.min(i.rowStart,a.rowStart),r.rowStart),colEnd:Math.min(Math.max(i.colEnd,a.colEnd),r.colEnd),rowEnd:Math.min(Math.max(i.rowEnd,a.rowEnd),r.rowEnd),scope:n===s?void 0:n};T.push(c)}f.push(...T)}return f=Da(f,2,e.N.Row),f.sort(e.l.rowFirstRangeComparator),f}_directAcrossGrids(t,n){let r=this._gridId,i=t.scope,a=i&&i!==r?this._container.getGrid(i)??null:this;if(!a)return e.A.EmptyArray;let o=n?a.getDirectDependentsAt(t):a.getDirectPrecedentsAt(t);if(a===this||o.length===0)return o;let s=Array(o.length);for(let e=0;e<o.length;e++){let t=o[e],n=t.scope??a._gridId;s[e]=n===r?{...t,scope:void 0}:{...t,scope:n}}return s}getDependentsAt(t){let n=ja(t,e=>this._directAcrossGrids(e,!0));return n.sort(e.l.rowFirstRangeComparator),n}getPrecedentsAt(t){let n=ja(t,e=>this._directAcrossGrids(e,!1));return n.sort(e.l.rowFirstRangeComparator),n}getFormulaBlockAt(e,t){let n=this._formulaAt(e,t);return n?n.value.formula:null}getReferencesAt(t,n){let r=this._formulaAt(t,n);if(!r)return e.A.EmptyArray;let i=r.value.formula.getReferences(t,n);if(!i)return e.A.EmptyArray;i=[...i];for(let e=0;e<i.length;e++){let r=i[e];r?.colStart!==void 0&&(i[e]=Kl(r,t,n))}return i}setReferenceAt(e,t,n,r){let i=this._formulaAt(e,t),a=r;r&&r.colStart!==void 0?a=ql(a,e,t):r&&r.colIndex!==void 0&&(a=function(e,t,n){let r=e.$colIndex??!1,i=e.$rowIndex??!1,a={colIndex:r?e.colIndex:e.colIndex-n,rowIndex:i?e.rowIndex:e.rowIndex-t,$colIndex:r,$rowIndex:i};return e.scope&&(a.scope=e.scope),a}(a,e,t));let o=i.value.formula.setReferenceAt(n,a).getTextAt(e,t,!1,void 0,void 0,!0);return o?this._setInputs(null,[{colStart:t,rowStart:e,colEnd:t,rowEnd:e,scope:this._gridId,value:o}]):this.remove({colStart:t,rowStart:e,colEnd:t,rowEnd:e}),this}isVolatileAt(e,t){let n=this._formulaAt(e,t);if(!n?.value)return!1;let r=n.value.calcs[e-n.rowStart]?.[t-n.colStart];return!!r&&this._container.getVolatiles().has(r)}_formulaAt(e,t){VC.colStart=t,VC.rowStart=e,VC.colEnd=t,VC.rowEnd=e,VC.scope=this._gridId,GC.length=0;let n=this._container.getFormulas().search(VC,!1,!1,GC);return n.length===0?null:n[0]}_createCopySpillEntries(e,t,n,r,i){let a=r??[],o=i??[],s=t.colStart,c=t.rowStart,l=t.colEnd,u=t.rowEnd,d=n.colStart,f=n.rowStart,p=e.search(t),m=p.length;for(let e=0;e<m;e++){let t=p[e];o&&o.push(t);let n=t.rowStart,r=t.colStart;if(n<c||n>u||r<s||r>l||t.value.getError())continue;let i=d+(t.colEnd-r),m=f+(t.rowEnd-n),h={colStart:d,rowStart:f,colEnd:i,rowEnd:m};a.push({colStart:d,rowStart:f,colEnd:i,rowEnd:m,value:new lu(h,0,t.value.getKind())})}return{removes:o,inserts:a}}_reanchorFormulas(e,t,n,r){let i=e?e.length:0;if(i===0)return;let a=this._container,o=n??this._gridId,s=n==null?t??o:o,c=a.getScope();c.gridId=s;let l=t?a.getSymbols().resolve(Sd,t)?.toString():void 0,u=this._context;for(let n=0;n<i;n++){let i=e[n],d=i.value,f=d.ref,p=d.formula.getTextAt(f.rowStart,f.colStart,!1,void 0,void 0,!0);c.colIndex=f.colStart,c.rowIndex=f.rowStart;let m=a.createFormulaBlock(s,u,p,f.rowStart,f.colStart);t&&(m=m.reanchorReferences(l,r));let h=new Ud(f,o,m,a,d.unanchored);i.scope=o,i.value=h}}_copyTo(e,t,n){let r=e.calcGrid,i=r.getId(),a=this._gridId,o=e.formulaSpatial,s=o.getSpatialAt(i);if(!s||s.isEmpty())return;let c=this._getEntireCoords(),l=c.colStart,u=c.rowStart,d=c.colEnd,f=c.rowEnd,p=o.createCopiedEntries(t,n),m=p.inserts,h=m.length,g=0,_=r._spillSpatial,v=[];for(;g<h;){let e=m[g];e.scope=a;let n=e.value,r=n.ref,i=r.colStart,o=r.rowStart,s=r.colEnd,c=r.rowEnd;this._createCopySpillEntries(_,t,r,v,null);let p=n.formula.getReferences(o,i),y=p.length;for(let t=0;t<y;t++){let a=p[t];if(!a||`nameId`in a)continue;let g=a,_=g.colStart,v=g.rowStart,y=g.colEnd,b=g.rowEnd,x=g.$colStart?_:_+i,S=g.$rowStart?v:v+o,C=g.$colEnd?y:y+s,w=g.$rowEnd?b:b+c;if(_===-(2**53-1)&&(x=l,C=d),v===-(2**53-1)&&(S=u,w=f),x<l||C>d||S<u||w>f){let a=l-x,g=u-S,_=d-C,v=f-w;WC.colStart=Math.max(i,i+a),WC.rowStart=Math.max(o,o+g),WC.colEnd=Math.min(s,s+_),WC.rowEnd=Math.min(c,c+v);let y=wa(e,WC,Oa);if(y){let t=y.length;e=y[t-1],n=e.value,r=n.ref,i=r.colStart,o=r.rowStart,s=r.colEnd,c=r.rowEnd;for(let e=0;e<t-1;e++){let t=y[e];m.push(t),h++}}else n=n.setReferenceAt(t,null),e.value=n,p=n.formula.getReferences(o,i)}}m[g++]=e}let y=this._container,b=y.getFormulas().clone(),x=y.getPrecedents().clone();y.setFormulas(b),y.setPrecedents(x),a!==i&&this._reanchorFormulas(m,void 0,a),YC(b,x,m,p.removes),v&&this._spillSpatial._updateNodes(v,[]),y.markDirty([{...c,scope:this._gridId}])}_moveTo(t,r,i){let a=t.calcGrid,o=a.getId(),s=t.formulaSpatial;this.remove(i);let c=this._container,l=c.getPrecedents().clone(),u=c.getFormulas().clone();c.setPrecedents(l),c.setFormulas(u);let d=qS(l,r,XS);d&&YC(u,l,d.formulas.inserts,d.formulas.removes);let f,p={cutFrom:r},m=s.createCopiedEntries(r,i,p).inserts,h=m.length,g=this._gridId;if(g!==o){let t=i.colStart-r.colStart,a=i.rowStart-r.rowStart,s=[],l=[];for(let i=0;i<h;i++){let c=m[i],u=c.value,d=u.ref,f=u.formula.resolvedPrecedentsAt(d.rowStart,d.colStart),p=!0,h=f?f.length:0;for(let i=0;i<h;i++){let s=f[i];if(n.a.isError(s)){p=!1;break}let c,l=s.scope??g;if(l===g)c={colStart:s.colStart-t,rowStart:s.rowStart-a,colEnd:s.colEnd-t,rowEnd:s.rowEnd-a};else{if(l!==o){p=!1;break}c=s}if(!e.l.isRangeWithinRange(c,r)){p=!1;break}}p?l.push(c):s.push(c)}if(l.length>0){this._reanchorFormulas(l);let e=c.getSymbols().resolve(Sd,o)?.toString(),t=c.getSymbols().resolve(Sd,g)?.toString();if(e&&t)for(let n of l){let r=n.value.replaceSheetReferences(e,t);r!==n.value&&(n.value=r)}}s.length>0&&this._reanchorFormulas(s,o)}YC(u,l,m);let _=function(t,r,i,a){let o=t,s=o.search(i),c=s.length;if(c===0)return null;let l=a.colStart-i.colStart,u=a.rowStart-i.rowStart,d=[],f=[],p=new Map,m=new Set;for(let t=0;t<c;t++){let r=s[t],o=r.value,c=o.formulaEntry,h=p.get(c),g=h??c,_=g.value,v=_.ref,y=(v.scope??null)===(i.scope??null)&&e.l.isRangeWithinRange(v,i),b=_.getReferences(v.rowStart,v.colStart),x=b?b.length:0;if(x===0)continue;let S=o.index,C=b?b[S]:null;if(!C||n.a.isError(C)||`nameId`in C)continue;let w=C;if(!h&&x>1)for(let t=0;t<x;t++){if(t===S)continue;let r=b[t];if(!r||n.a.isError(r)||`nameId`in r)continue;let a=r;if((a.scope??null)!==(i.scope??null)||!e.l.isRangeWithinRange(a,i)){m.add(c);break}}let T=g.colEnd-g.colStart,E=g.rowEnd-g.rowStart,D=r.colStart,O=r.rowStart,k=r.colEnd,A=r.rowEnd,j=o.$absColEnd?k-D+1:k-D-T+1,M=o.$absRowEnd?A-O+1:A-O-E+1,N=o.$absRowStart?O>=i.rowStart?0:E+1:Math.max(0,i.rowStart-O),P=o.$absRowEnd?A<=i.rowEnd?E:-1:Math.min(E,i.rowEnd-O-(M-1)),F=o.$absColStart?D>=i.colStart?0:T+1:Math.max(0,i.colStart-D),I=o.$absColEnd?k<=i.colEnd?T:-1:Math.min(T,i.colEnd-D-(j-1));if(N>P||F>I||N!==0||P!==E||F!==0||I!==T)continue;let L,ee=y||_.unanchored,te=r.scope!==a.scope;if(l!==0&&(w.$colStart?(L??={...w},L.colStart+=l):ee||(L??={...w},L.colStart+=l),w.$colEnd?(L??={...w},L.colEnd+=l):ee||(L??={...w},L.colEnd+=l)),u!==0&&(w.$rowStart?(L??={...w},L.rowStart+=u):ee||(L??={...w},L.rowStart+=u),w.$rowEnd?(L??={...w},L.rowEnd+=u):ee||(L??={...w},L.rowEnd+=u)),!L&&!te)continue;L||={...w},_=_.setReferenceAt(S,L),g={...g},g.value=_,p.set(c,g),d.push(r);let R={...r};R.colStart+=l,R.rowStart+=u,R.colEnd+=l,R.rowEnd+=u,R.scope=a.scope,R.value={...o},R.value.formulaEntry=g,f.push(R)}if(p.size>0){let e=r();for(let n of p.keys()){let r=n.value;if(!r)continue;let i=e.get(r);i&&(t.removeAll(i,aC),e.delete(r))}}let h=Array.from(p.keys()),g=Array.from(p.values()),_=m.size;if(_>0){let t=Array.from(m);for(let r=0;r<_;r++){let a=t[r],s=a.value,c=s.ref,l=s.getReferences(c.rowStart,c.colStart),u=l?l.length:0;if(u>1){let t=s.ref,r=t.colStart,c=t.rowStart;for(let t=0;t<u;t++){let s=l[t];if(!s||n.a.isError(s)||`nameId`in s)continue;let u=s;if(tC.colStart=u.$colStart?u.colStart:r+u.colStart,tC.rowStart=u.$rowStart?u.rowStart:c+u.rowStart,tC.colEnd=u.$colEnd?u.colEnd:r+u.colEnd,tC.rowEnd=u.$rowEnd?u.rowEnd:c+u.rowEnd,tC.scope=u.scope??a.scope,(tC.scope??null)===(i.scope??null)&&e.l.isRangeWithinRange(tC,i))continue;tC.colEnd=tC.colStart,tC.rowEnd=tC.rowStart;let m=o.search(tC);for(let e=0;e<m.length;e++){let t=m[e];if(t.value.formulaEntry===a){let e=p.get(a);if(e){let n={...t};n.value={...t.value},n.value.formulaEntry=e,d.push(t),f.push(n)}break}}}}}}return{precedents:{inserts:f,removes:d},formulas:{inserts:g,removes:h}}}(l,()=>{let e=c.getDynamics();return f=new Map(e),f},r,i);if(f&&c.setDynamics(f),_){let e=_.formulas.inserts;r.scope!==i.scope&&e.length>0&&this._reanchorFormulas(e,i.scope,r.scope,!0),YC(u,l,_.formulas.inserts,_.formulas.removes)}let v=this._values;a._values.copyTo(v,{colIndex:i.colStart,rowIndex:i.rowStart},r);let y=a._spillSpatial,b=[],x=[];for(let e=0;e<h;e++){let t=m[e];this._createCopySpillEntries(y,r,t,b,x)}let S=[];b.length>0&&(this._spillSpatial._updateNodes(b,[]),a._spillSpatial._updateNodes([],x),HS(c.getCycleId(),x,e.A.EmptyArray,a._contentfulSpatial,y,a._values,(e,t,n,r)=>{S.push({colStart:e,rowStart:t,colEnd:n,rowEnd:r,scope:g})},a._notifyValues,(e,t)=>{e&&this._notifySpillsInsert.push(e),t&&this._notifySpillsRemove.push(t)},a._notifyPending,a._errorSpatial,a._values.getAxis()!==n.l.Axis.Row,!1));let C=this.getEntireCoords();c.markDirty([{...C,scope:this._gridId}])}_notifyCalculated(t,r){let i,a=!1;a||(typeof r==`boolean`?a=r:r&&(i=r,a=i.full??!1));let o,s,c=this._notifyValues,l=c.all(),u=this._notifyPending.all([]);u.length>0&&this._notifyPending.clear(),a?o=this._spillSpatial.all():(o=this._notifySpillsInsert,s=this._notifySpillsRemove),this._notifySpillsInsert=[],this._notifySpillsRemove=[];let d=this._notifyFormats.all();d.length>0&&this._notifyFormats.clear();let f={},p=null,m=l.length;if(m>0){c.clear();let t=l,r=null;for(let e=0;e<m;e++){let t=l[e],n=t.colStart,i=t.colEnd;if(n!==i){r||=[];for(let e=n+1;e<=i;e++)r.push({colStart:e,rowStart:t.rowStart,colEnd:e,rowEnd:t.rowEnd});t.colEnd=n}}r&&(t=l.concat(r)),t.sort(e.l.columnFirstRangeComparator);let i,a=new ri.Builder(e=>new ii(e)),o=this._values,s=o.getAxis()===n.l.Axis.Column,u=t.length;for(let n=0;n<u;n++){let r=t[n];p=e.l.unionRanges(p,r,LC);let c=o.getRuns({bounds:r}),l=c.next(),u=r.colStart,d=r.rowStart,f=r.colEnd,m=r.rowEnd,h=s?d:u,g=s?f:m,_=s?m:f,v=s?u:d,y=h;for(;!l.done;){let e=l.value,t=e[0];for(;v<t;)i||=[],i.push({colStart:s?v:y,rowStart:s?y:v,colEnd:s?v:_,rowEnd:s?_:v}),v++,y=h;let n=e[1],r=e[2],o=Math.max(n,h),u=Math.min(n+r.length-1,_);a.pushMultipleAt(t,o,r),y<o&&(i||=[],i.push({colStart:s?t:y,rowStart:s?y:t,colEnd:s?t:o-1,rowEnd:s?o-1:t})),y=u+1,u>=_?(v=t+1,y=h):v=t,l=c.next()}for(;v<=g;)y<=_&&(i||=[],i.push({colStart:s?v:y,rowStart:s?y:v,colEnd:s?v:_,rowEnd:s?_:v})),v++,y=h}let d=a.build();d&&(f.valueInserts=d),i&&(f.valueRemoves=i)}if(u.length>0){let t,n=this._pendingSpatial,r=u.length;for(let i=0;i<r;i++){let r=u[i];n.insertNonOverlapping(r,{onIntersect:(n,r)=>(t||=[],t.push({colStart:r.colStart,rowStart:r.rowStart,colEnd:r.colEnd,rowEnd:r.rowEnd,value:r.value}),p=e.l.unionRanges(p,r),!1===r.value&&(r.value=null),r)})}t&&t.length>0&&(f.pendingUpdates=t,p=e.l.unionRangesArrays(t,p??void 0,LC))}let h,g,_=s?s.length:0;if(_>0){h=[];for(let e=0;e<_;e++){let t=s[e];h.push({colStart:t.colStart,rowStart:t.rowStart,colEnd:t.colEnd,rowEnd:t.rowEnd})}h&&(f.spillRemoves=h,p=e.l.unionRangesArrays(h,p??void 0,LC))}let v=o.length;if(v>0){let n,r=this._spillSpatial;for(let e=v-1;e>=0;e--){let i=o[e],s=i.value;if(!a&&s.getCycleId()!==t)continue;let c=r.search(i),l=c.length;for(let e=0;e<l;e++){let r=c[e];if(VS(i.rowStart,i.colStart,r)&&(a||r.value.getCycleId()===t)){g||(g=[],n=new Set);let e=fl(r.colStart)+dl(r.rowStart);if(n.has(e))continue;n.add(e),g.push({colStart:i.colStart,rowStart:i.rowStart,colEnd:i.colEnd,rowEnd:i.rowEnd,value:r.value.getKind()})}}}g&&(f.spillInserts=g,p=e.l.unionRangesArrays(g,p??void 0,LC))}return d.length>0&&(f.formatInserts=d,p=e.l.unionRangesArrays(d,p??void 0,LC)),p&&(f.bounds={colStart:p.colStart,rowStart:p.rowStart,colEnd:p.colEnd,rowEnd:p.rowEnd}),Object.keys(f).length===0?f.cycleId=t-1:f.cycleId=t,a&&(f.isFull=!0),this._options.onCalculated?.(f),Promise.resolve(f)}_setInputs(t,r,i){let a=this._gridId,o=this._container,s=this._context,c=o.getFormulas(),l=c.getSpatialAt(a),u=!!l&&!l.isEmpty(),d=r?r.length:0;if(this._calculation?.getStatus()===cv.Status.Starting)return o.whenSafe(()=>{let n=(o.getGrid(a)??this)._setInputs(t,r,i),s={cycleId:o.getCycleId(),bounds:e.l.unionRangesArrays(n)};return Promise.resolve(s)}),e.A.EmptyArray;let f,p,m,h=this._values,g=h.getAxis()!==n.l.Axis.Row,_=this._spillSpatial,v=this._errorSpatial,y=this._contentfulSpatial,b=[],x=u?[]:null;if(t&&t.tuples){f=t.tuples;let e=t.bounds;if(e?(p=Fa(e,g),p.scope=a):p={colStart:-(2**53-1),rowStart:-(2**53-1),colEnd:2**53-1,rowEnd:2**53-1,scope:a},x){u&&b.push(p);let e={majorStart:0,minorStart:0,majorEnd:0,minorEnd:0},t=f.length;for(let n=0;n<t;n++){let t=f[n],r=t[0];e.majorStart=r,e.majorEnd=r;let i=t[1],o=i.length;for(let t=0;t<o;t++){let n=i[t];e.minorStart=n[0];let r=n[1];e.minorEnd=e.minorStart+r.length-1;let o=Fa(e,g);o.scope=a,x&&c.search(o).length>0&&x.push(o)}}}m=du(t.tuples,a,g)}let S=(e,t)=>{e&&this._notifySpillsInsert.push(e),t&&this._notifySpillsRemove.push(t)};if(i||f){let t;i&&(t=QS(i,_,h,y,S,!1,!0,this._notifyValues,(e,t,n,r)=>{b.push({colStart:e,rowStart:t,colEnd:n,rowEnd:r,scope:a})})),HS(-1,i?[i]:e.A.EmptyArray,m,y,_,h,(e,t,n,r)=>{b.push({colStart:e,rowStart:t,colEnd:n,rowEnd:r,scope:a})},this._notifyValues,S,this._notifyPending,v,g,!1),i&&h.delete(i),t?.(),f&&h.setValues(f)}let C,w,T,E,D,O,k=o.getScope(),A=(e,t)=>{let n=e.rowStart,r=e.colStart;k&&(k.rowIndex=n,k.colIndex=r);let i=o.createFormulaBlock(a,s,t,n,r),c=new Ud(e,a,i,o,this._unanchored),l={...e,scope:a,value:c};C||=[],C.push(l)},j=e=>{let t={...e,scope:a,value:null};T.insertNonOverlapping(t,{noMerge:!0,onUpdates(e,t,n){w||=[];for(let e=0;e<t.length;e++){let n=t[e];if(w.push(n),D)for(let e=D.length-1;e>=0;e--)D[e].value===n.value&&D.splice(e,1)}let r=e?e.length:0;for(let t=0;t<r;t++){let n=e[t];n.value!==null&&(D||=[],D.push(n))}}})},M=x?x.length:0;if(d>0){O=xE(d);for(let t=0;t<d;t++){let n=r[t],i=n.value,a=e.l.sanitizeRange(n);O[t]=a,i!==null&&A(a,i)}}(M>0||d>0)&&(T=o.getFormulas().clone());for(let e=0;e<M;e++)j(x[e]);for(let e=0;e<d;e++)j(O[e]);let N=w?w.length:0;if(N>0){let e=o.getDynamics(),t=null;for(let n=0;n<N;n++){let r=w[n].value,i=e.get(r);i&&(E||=o.getPrecedents().clone(),E.removeAll(i,JC),t||=new Map(e),t.delete(r))}t&&o.setDynamics(t)}let P=[];if((C||w)&&(E||=o.getPrecedents().clone(),YC(T,E,C,w),D&&ZC(E,D,null),HS(-1,w,C,y,_,h,(e,t,n,r)=>{b.push({colStart:e,rowStart:t,colEnd:n,rowEnd:r,scope:a})},this._notifyValues,S,this._notifyPending,v,g,!0)),E&&o.setPrecedents(E),T&&o.setFormulas(T),C)for(let e=0;e<C.length;e++){let t=C[e];P.push({colStart:t.colStart,rowStart:t.rowStart,colEnd:t.colEnd,rowEnd:t.rowEnd,scope:a})}if(w)for(let e=0;e<w.length;e++){let t=w[e];P.push({colStart:t.colStart,rowStart:t.rowStart,colEnd:t.colEnd,rowEnd:t.rowEnd,scope:a})}return b.length>0&&o.markDirty(b),P}_clearAll(){this._contentfulSpatial.clear(),this._values.clear(),this._spillSpatial.clear(),this._errorSpatial.clear(),this._pendingSpatial.clear(),this._notifyValues.clear(),this._notifySpillsInsert=[],this._notifySpillsRemove=[],this._notifyFormats.clear(),this._notifyPending.clear()}fromJSON(t,r){let i=this._calculation?.getStatus();if(i===cv.Status.Starting){let e=this._gridId,n=this._container;n.whenSafe(async()=>{let i=(n.getGrid(e)??this).fromJSON(t,r);return this._options.onCalculated?.(i),i});return}if(i!==cv.Status.Ready)return;this._clearAll();let a={cycleId:0,isFull:!0};if(!t)return a;this._isProcessingJSON=!0;try{if(t.data){let e=t.data;this._values.setValues(e);let r=this._values.getAxis()===n.l.Axis.Column,i=du(e,this._gridId,r);this._contentfulSpatial.load(i)}let i=this._gridId,o=this._container,s=o.getPrecedents(),c=o.getFormulas(),l={...this._getEntireCoords(),scope:i},u=t.formulas;if(u){let d=t.formulaArray,f=new Set;if(d){let e=d.length;for(let t=0;t<e;t++){let e=ou(d[t][0],l).split(`:`)[0];f.add(e)}}let p=u.length,m=Array(p),h=[],g=o.getRuntime(),_=this._context,v=o.getScope();v.colIndex=0,v.rowIndex=0,v.gridId=i;for(let e=0;e<p;e++){let t=Jl(u[e],l);t.scope=i;let a=t.value,s=t.rowStart,c=t.colStart;v.colIndex=c,v.rowIndex=s;let d=o.createFormulaBlock(i,_,a,s,c,void 0,r?.formulaTransform),p=d.resolvedPrecedentsAt(s,c,!0,RC,zC),g=p.length;g===1&&(d=d.wrapImplicit(s,c,f)),t.value=new Ud(t,i,d,o,this._unanchored),m[e]=t;let y=t.rowEnd,b=t.colEnd-c,x=y-s,S=[],C=d.getReferences(s,c);for(let e=0;e<g;e++){let r=p[e];if(n.a.isError(r))continue;let a=WS(C[e],zC[e],RC[e]),o=a.$absColEnd,s=a.$absRowEnd,c={colStart:r.colStart,rowStart:r.rowStart,colEnd:r.colEnd+(o?0:b),rowEnd:r.rowEnd+(s?0:x),scope:r.scope??i,value:{formulaEntry:t,formulaBlockWidth:b+1,formulaBlockHeight:x+1,index:e,$absColStart:a.$absColStart,$absColEnd:o,$absRowStart:a.$absRowStart,$absRowEnd:s}};S.push(r),h.push(c)}}if(c.load(m),s.load(h),d){let t=[],r=[],u=new Map,f=this._values,p=d.length;for(let a=0;a<p;a++){let o=Jl(d[a],l),s=o.value??`dynamic`,p=s===`dynamicSpillError`,m=o.colStart,h=o.rowStart;BC.colStart=m,BC.rowStart=h,BC.colEnd=m,BC.rowEnd=h,BC.scope=i;let _=c.search(BC);if(_.length!==1)continue;let v=_[0].value,y=v.ref,b=v.calcs,x=h-y.rowStart,S=m-y.colStart,C=b[x][S],w=o.colEnd,T=o.rowEnd,E={colStart:m,rowStart:h,colEnd:w,rowEnd:T};C.cachedValue=p?n.a.BuiltIn.Spill:new nD(g,f,E);let D={colStart:m,rowStart:h,colEnd:w,rowEnd:T,value:new lu(E,0,s)};r.push(D),e.l.isSingleCell(o)||t.push({colStart:m,rowStart:h,colEnd:w,rowEnd:T,value:s}),US(u,C,E,Wd.Spill)}if(this._spillSpatial.load(r),u.size>0){s.load(Array.from(u.values()).flat());let e=new Map(o.getDynamics());for(let[t,n]of u)e.set(t,n);o.setDynamics(e)}t.length>0&&(a.spillInserts=t)}let y=t.volatile,b=y?y.length:0;if(b>0){let e=o.getVolatiles(),t=t=>{e.add(t)},n=Array(b);for(let e=0;e<b;e++){let r=au(y[e],l);n[e]={...r};let i=c.search(r),a=i.length;for(let e=0;e<a;e++){let n=i[e];ZS(n,r,t)}}this.markDirtyRegions(n),o.isLoading()?o.whenSafe(async()=>{this.calculate()}):this.calculate()}}}catch(e){throw e}finally{this._isProcessingJSON=!1}return a}async toJSON(t){let r=this._container.getFormulas().getSpatialAt(this._gridId)?.all(),i=r?r.length:0;if(i>0&&(r=Ea(r,e.N.Column,2,ka),r.sort(e.l.rowFirstRangeComparator)),i=r?r.length:0,i===0)return null;let a={};if(i>0){let e=t?.formulaTransform,n=Array(i);for(let t=0;t<i;t++)n[t]=r[t].value.toJSON(!1,e);a.formulas=n}let o=this._spillSpatial.all(),s=o.length;if(s>0){let e=this._getEntireCoords(),t=Array(s);for(let n=0;n<s;n++){let r=o[n];t[n]=[yl(r,e),r.value.getKind()]}a.formulaArray=t}let c=this._container.getVolatiles(),l=this._gridId;if(c.size>0){let e=c.values(),t=e.next(),r=this._values.getAxis()===n.l.Axis.Column,i=qa(!0);for(;!t.done;){let n=t.value;if(t=e.next(),n.gridId!==l)continue;let a=n.colIndex,o=n.rowIndex,s=r?a:o,c=r?o:a;i.append(s,c)}let o=i.done(!0),s=o.length;if(s>0){let e=Array(s);for(let t=0;t<s;t++){let n=o[t];e[t]=yl(n,this._getEntireCoords())}a.volatile=e}}return a}},LC={rowStart:0,colStart:0,rowEnd:0,colEnd:0},RC=[],zC=[],BC={colStart:0,rowStart:0,colEnd:0,rowEnd:0,scope:null},VC={colStart:0,rowStart:0,colEnd:0,rowEnd:0,scope:null},HC={rowStart:0,colStart:0,rowEnd:0,colEnd:0,scope:null},UC=Object.freeze({search:(t,n,r,i)=>i??e.A.EmptyArray,getBoundingRange:()=>null,isEmpty:()=>!0}),WC={colStart:0,rowStart:0,colEnd:0,rowEnd:0},GC=[null],KC=Object.freeze({full:!0}),qC=[];function JC(e,t){return e.value===t.value}function YC(e,t,n,r){(n&&n.length!==0||r&&r.length!==0)&&(ZC(t,null,r),XC(e,null,r),XC(e,n,null),ZC(t,n,null))}function XC(e,t,n){(t&&t.length!==0||n&&n.length!==0)&&(n&&e.removeAll(n,JC),t&&e.load(t))}function ZC(e,t,r){let i=r?r.length:0;for(let t=0;t<i;t++){let i=r[t],a=i.value,o=a.registeredPrecedents;if(o){for(let t=0;t<o.length;t++)e.remove(o[t],JC);a.registeredPrecedents=null}let s=a.ref,c=s.rowStart,l=s.colStart,u=a.formula.resolvedPrecedentsAt(c,l);if(!u)continue;let d=u.length;for(let t=0;t<d;t++){let r=u[t];if(r===null||n.a.isError(r))continue;HC.rowStart=r.rowStart,HC.colStart=r.colStart,HC.rowEnd=r.rowEnd,HC.colEnd=r.colEnd,HC.scope=r.scope??i.scope,qC.length=0;let a=e.search(HC,!1,!1,qC),o=a.length;for(let t=0;t<o;t++){let n=a[t],r=n.value.formulaEntry;r&&r.value===i.value&&e.remove(n,JC)}}}let a=t?t.length:0;if(a===0)return;let o=[];for(let e=0;e<a;e++){let n=t[e],r=[],i=o.length;KS(n,o,r),o.length>i&&(n.value.registeredPrecedents=o.slice(i))}e.load(o)}function QC(e,t=0,r=0){let i=e._values,a=e._coords,o=i.getRuns({bounds:a}),s=i.getAxis()!==n.l.Axis.Row,c=s?a.colStart:a.rowStart,l=s?a.rowStart:a.colStart,u=new ri.Builder(null,t,r),d=o.next();for(;!d.done;){let e=d.value;u.pushMultipleAt(e[0]-c,e[1]-l,e[2]),d=o.next()}return u.build()}function $C(e,t,n,r){let i=e.value,a=i.formulaBlockWidth,o=i.formulaBlockHeight,s=i.formulaEntry.value.calcs,c=n-e.colStart,l=t-e.rowStart,u=e.rowEnd-e.rowStart-(o-1),d=e.colEnd-e.colStart-(a-1),f=i.$absRowEnd?0:Math.max(0,l-u),p=i.$absRowStart?o-1:Math.min(o-1,l),m=i.$absColEnd?0:Math.max(0,c-d),h=i.$absColStart?a-1:Math.min(a-1,c);for(let e=f;e<=p;e++){let t=s[e];for(let e=m;e<=h;e++)r(t[e])}}qC.fill(null,0,10);var ew=class{constructor(t,n,r){this._pendingCalcs=new Set,this._circularNodes=[],this._circularReported=null,this._gridUpdates=null,this._addDynamicPrecedent=null,this.scheduleRecalculation=(t,n)=>{if(!n)return;let r=this._pendingCalcs;r.add(n);let i=this;e.u.debounce(()=>{let e=i._container.getVolatiles();r.forEach(n=>{n.cycleId>t||e.add(n)}),r.clear(),i._requestCalculate()},100)()},this.doCollectVolatileCalcs=(e,t,n,r,i)=>{let a=r.values,o=r.length;if(!n||n.size===0)return o;let s=o,c=new Map;return n.forEach(n=>{n.markId===t&&n.cycleId===e||(e=>{let t=e.block;if(!t)return!1;let n=c.get(t);if(n!==void 0)return n;aw.colStart=aw.colEnd=e.colIndex,aw.rowStart=aw.rowEnd=e.rowIndex,aw.scope=e.gridId;let r=i.search(aw),a=!1;for(let e=0;!a&&e<r.length;e++)a=r[e].value===t;return c.set(t,a),a})(n)&&(n.markId=t,n.cycleId=e,a[s++]=n,n.pendingPromise&&(n.pendingPromise.cancelled=!0))}),r.length=s,s},this.doCollectDirtyCalcs=(e,t,n,r,i,a,o)=>{let s=r.values,c=r.length,l=n=>{n.cycleId===e&&n.markId===t||(s[c++]=n,n.markId=t,n.cycleId=e,n.pendingPromise&&(n.pendingPromise.cancelled=!0))},u=e=>{let t=e.calcs,n=t.length;for(let e=0;e<n;e++){let n=t[e],r=n.length;for(let e=0;e<r;e++)l(n[e])}},d=(e,t,n,r,i)=>{let a=e.calcs;for(let e=t;e<=n;e++){let t=a[e];for(let e=r;e<=i;e++)l(t[e])}},f=n.length;for(let e=0;e<f;e++){let t=n[e];hw.length=0;let r=hw;a.search(t,!1,!1,r);let s=r.length;i.search(t,!1,!1,r);let c=r.length;if(c===0)continue;let l=t.colStart,f=t.rowStart,p=t.colEnd-l,m=t.rowEnd-f;for(let e=0;e<s;e++){let t=r[e],n=t.value;if(n.index<0){o.push(t),u(n.formulaEntry.value);continue}let i=n.formulaEntry.value,a=i.ref,s=a.colEnd-a.colStart,c=a.rowEnd-a.rowStart,h=t.colEnd-t.colStart-s,g=t.rowEnd-t.rowStart-c,_=0,v=c,y=0,b=s,x=f-t.rowStart,S=l-t.colStart;n.$absRowEnd||(_=Math.min(Math.max(x-g,0),c)),n.$absRowStart||(v=Math.min(x+m,c)),n.$absColEnd||(y=Math.min(Math.max(S-h,0),s)),n.$absColStart||(b=Math.min(p+S,s)),d(i,_,v,y,b)}for(let e=s;e<c;e++){let t=r[e],n=t.value,i=n.ref,a=i.colEnd-i.colStart,o=i.rowEnd-i.rowStart,s=f-t.rowStart,c=l-t.colStart;d(n,Math.min(Math.max(s,0),o),Math.min(s+m,o),Math.min(Math.max(c,0),a),Math.min(p+c,a))}}return r.length=c,c},this._container=t,this._context=n,this._requestCalculate=r}execute(e,t,n){let{isFullCalc:r,calcCoords:i,gridId:a,scopeGridId:o}=t,{gridsAll:s,formulaSpatial:c,dirtySpatial:l,oldVolatiles:u}=n,d=this._container,f=e=>d.getIncrementalUpdates(e),p=d.getPrecedents(),m=p,h=d.getDynamics(),g=h,_=new Map;this._gridUpdates=_;let v=[],y=()=>{v.length!==0&&(m===p&&(m=m.clone()),m.removeAll(v,JC),v.length=0)},b=1,x=xw;if(x.length=0,r||(this.doCollectVolatileCalcs(e,b,u,x,c),u.clear()),i)s.get(i.scope??a)&&this.doCollectDirtyCalcs(e,b,[i],x,c,m,v);else{let t=o&&s.has(o)?o:null,n=t?[t]:r?s.keys():l.getScopeKeys();for(let i of n){let n,a=s.get(i);if(a){if(f(i),r){let e={...a.getEntireCoords()};e.scope=i,n=[e]}else n=[],l.all3D(n),t&&(n=n.filter(e=>e.scope===i));this.doCollectDirtyCalcs(e,b,n,x,c,m,v)}}}if(_.size===0&&x.length===0)return this._gridUpdates=null,this._addDynamicPrecedent=null,null;if(x.length===0)return this._gridUpdates=null,this._addDynamicPrecedent=null,{precedentSpatial:m,dynamicByBlock:g,lastUpdates:new Map(_)};let S=new Map;this._addDynamicPrecedent=(e,t,n)=>{if(!e?.block)return;let r,i,a,o,s=e.block,c=t?.scope??e.gridId;t?(r=t.colStart,i=t.rowStart,a=t.colEnd,o=t.rowEnd):(r=e.colIndex,i=e.rowIndex,a=e.colIndex,o=e.rowIndex);let l=S.get(s);l||(l=[],S.set(s,l));let u=l.findIndex(e=>e.value.index===n),d=u===-1?void 0:l[u];if(d&&d.scope===c){r<d.colStart&&(d.colStart=r),i<d.rowStart&&(d.rowStart=i),a>d.colEnd&&(d.colEnd=a),o>d.rowEnd&&(d.rowEnd=o);let e=d.value.formulaEntry;e.colStart=d.colStart,e.rowStart=d.rowStart,e.colEnd=d.colEnd,e.rowEnd=d.rowEnd}else{let e=s.ref,t={colStart:r,rowStart:i,colEnd:a,rowEnd:o,scope:c,value:{formulaEntry:{colStart:r,rowStart:i,colEnd:a,rowEnd:o,scope:c,value:s},formulaBlockWidth:e.colEnd-e.colStart+1,formulaBlockHeight:e.rowEnd-e.rowStart+1,index:n,$absColStart:!1,$absColEnd:!1,$absRowStart:!1,$absRowEnd:!1}};u===-1?l.push(t):l[u]=t}};let C=new Map,w=(e,t)=>{(function(e,t,n,r){if(t===0)return;let i,a,o,s=nw,c=()=>{let e=i.build();e&&e.tuples&&o.values.setValues(e.tuples);let t=a.done(!0);for(let e=0;e<t.length;e++){let n=t[e];o.notifyValues.insertNonOverlapping(n)}let n=o.pendingConflating;if(n){let e=n.done(!0);o.notifyPending.load(e),o.pendingConflating=null}let r=o.formatsConflating;if(r){let e=r.done(!0);o.notifyFormats.load(e),o.formatsConflating=null}};e.length=t,e.sort(rw);for(let l=0;l<t;l++){let t=e[l],u=t.colIndex,d=t.rowIndex,f=t.gridId;if(f||console.log(`nodeGridId is null`,t),f!==s&&(s!==nw&&c(),i=new ri.Builder(tw),a=qa(r),s=f,o=n(f)),!t.cachedValue?.isIRange){let e=u,n=d,r=t.cachedValue;i.pushAt(e,n,r),a.append(e,n)}}c()})(e,t,f,!0);for(let[e,t]of _)C.set(e,t);_.clear()},T=r,E=Sw;E.length=0;let D=0,O=!1,k=!1;do{++b,y(),this.doMarkAndPlan(e,b,x,E)||(k=!0,this.reportCircular());let t=this.doEvaluate(e,f,this.scheduleRecalculation,w,T,E);O=t!==void 0,O&&(T=!1,++b,this.doCollectDirtyCalcs(e,b,t.all(),x,c,m,v),D>200&&(console.error(`Too many iterations, possible cycle or leak`),O=!1)),D++}while(O);if(k||(this._circularReported=null),S.size>0){m===p&&(m=m.clone()),g===h&&(g=new Map(g));for(let e of S.keys()){let t=g.get(e);t&&m.removeAll(t,JC)}m.load(Array.from(S.values()).flat());for(let[e,t]of S)g.set(e,t);S.clear()}return this._gridUpdates=null,this._addDynamicPrecedent=null,{precedentSpatial:m,dynamicByBlock:g,lastUpdates:C}}reportCircular(){let e=this._circularNodes,t=e.length;if(t===0)return;let n=e[0],r=vl(n.gridId,hl(n)??``),i=`${r}/${t}`;if(this._circularReported===i)return;this._circularReported=i;let a=t>1?` (+${t-1} more cell${t>2?`s`:``})`:``;console.warn(`Circular reference: ${r}${a}. Cells in a reference cycle evaluate to 0.`)}doMarkAndPlan(e,t,r,i){let a=r.values,o=r.length,s=i.values,c=0,l=this._container,u=l.getPrecedents(),d=l.getFormulas(),f=0,p=0,m=0,h=0,g=0;for(let n=0;n<o;n++){let r=a[n];if(r.cycleId===e&&r.markId===t)continue;r.markId=t,r.cycleId=e,r.inDegree=0,r.pendingPrecedents=!1,r.circular=!1;let i=r.inputs,o=i.length;for(let e=0;e<o;e++)i[e]=void 0;fw[f++]=r,pw[g++]=r}let _=n=>{if(n.cycleId===e&&n.markId===t)return;n.markId=t,n.cycleId=e,n.inDegree=0,n.pendingPrecedents=!1,n.circular=!1;let r=n.inputs,i=r.length;for(let e=0;e<i;e++)r[e]=void 0;fw[f++]=n,pw[g++]=n};for(;h<g;){let e,t=pw[h++],n=t.colIndex,r=t.rowIndex,i=t.gridId;ow.colStart=n,ow.rowStart=r,ow.colEnd=n,ow.rowEnd=r,ow.scope=i,e=u.search(ow),t.dependents=e;let a=e.length;if(a!==0)for(let t=0;t<a;t++)$C(e[t],r,n,_)}let v=null,y=null;for(let r=0;r<f;r++){let i=fw[r],a=i.precedents,o=a.length,s=0;for(let r=0;r<o;r++){let o=a[r];if(n.a.isError(o))continue;let c,l=o.colStart,u=o.rowStart,f=o.colEnd,p=o.rowEnd,m=o.scope??i.gridId;if(v!==null&&y===m&&l>=v.colStart&&f<=v.colEnd&&u>=v.rowStart&&p<=v.rowEnd)gw[0]=v,c=gw;else if(sw.colStart=l,sw.rowStart=u,sw.colEnd=f,sw.rowEnd=p,sw.scope=m,c=d.search(sw),c.length===1){let e=c[0];e.colEnd>e.colStart||e.rowEnd>e.rowStart?(v=e,y=m):v=null}else v=null;let h=c.length;for(let n=0;n<h;n++){let r=c[n],i=r.colStart,a=r.rowStart,o=r.colEnd,d=r.rowEnd,m=Math.max(i,l),h=Math.max(a,u),g=Math.min(o,f),_=Math.min(d,p),v=r.value.calcs;for(let n=h;n<=_;n++){let r=v[n-a];for(let n=m;n<=g;n++){let a=r[n-i];a.cycleId===e&&a.markId===t&&s++}}}}i.inDegree=s,i.inDegree===0&&(mw[m++]=i)}let b=e=>{e.markId===t&&(e.inDegree--,e.inDegree===0&&(mw[m++]=e))};for(;p<m;){let e=mw[p++];s[c++]=e;let t,n=e.colIndex,r=e.rowIndex;t=e.dependents;let i=t.length;if(i!==0)for(let e=0;e<i;e++)$C(t[e],r,n,b)}if(c<f){let e=this._circularNodes;e.length=0;for(let t=0;t<f;t++){let n=fw[t];n.inDegree>0&&(n.circular=!0,e.push(n),s[c++]=n)}return i.length=c,!1}return i.length=c,!0}doEvaluate(t,r,i,a,o,s){let c,l,u,d,f,p,m,h,g,_,v=this._container,y=this._context,b=v.getScope(),x=y.getRuntime(),S=s.values,C=s.length,w=dw,T=0,E=e=>{let t=v.getGrid(e);_=t.getEntireCoords.bind(t),l=r(e),u=l.gridId,d=l.values,f=l.contentfulSpatial,p=l.spillSpatial,m=l.notifyValues,h=l.notifySpillsInsert,g=l.notifySpillsRemove,l.notifyFormats,l.notifyPending,b.gridId=u},D=n.l.Axis.Column,O=D===n.l.Axis.Column;for(let r=0;r<C;r++){let s=S[r],y=s.colIndex,C=s.rowIndex;if(s.state===1&&t===s.cycleId){s.state=0;continue}let k=s.gridId;k!==u&&E(k);let A,j,M=s.block,N=s.cachedValue;N?.isIRange&&(A=N);let P,F=!1;n.a.isError(N,n.a.Code.Spill)&&(j=N,F=!0),o&&(N=void 0),!P&&N&&n.a.isError(N)&&(P=N);let I=s.pendingPrecedents,L=s.circular,ee=L?null:s.precedents;if(ee){let e=s.inputs,t=ee.length;for(let r=0;r<t;r++){let t=ee[r];if(n.a.isError(t)){e[r]=t;continue}let i=t.colStart,o=t.rowStart,s=t.colEnd;if(t.rowEnd!==o||i!==s){T>0&&(a(w,T),T=0);let n=t.scope,i=d,o=_;if(n&&n!==u){i=v.getGridValues(n);let e=v.getGrid(n);e&&(o=e.getEntireCoords.bind(e))}e[r]=new _D(x,i,{...t},null,o,v.resolveScope)}}}let te=O?y:C,R=O?C:y;b.node=s,b.colIndex=y,b.rowIndex=C;let z,ne,re=M.formula,B=null,ie=s.pending,ae=ie;if(L?(z=0,ae=!1,s.pendingPromise&&(s.pendingPromise.cancelled=!0,s.pendingPromise=null,s.pendingResolved=!1)):((I||s.pendingPromise)&&(ae=!0,z=s.cachedValue??null,s.pendingPromise&&(s.pendingResolved?(s.pendingPromise=null,s.pendingResolved=!1,ae=!1):(s.pendingPromise.cancelled=!0,z=void 0))),z===void 0&&(b.colIndex=y,b.rowIndex=C,z=re.evaluateAt(C,y),B=z&&z.then?z:null,B||(z=re.finalizeValueForCell(z)),ae=!!B)),ae!==ie&&(s.pending=ae,l.pendingConflating||=qa(O),l.pendingConflating.append(te,R,ae)),B&&(z=s.cachedValue??null,!B.__originator)){B.__originator=t;let e=s;lw.add(e),e.pendingPromise=B,e.pendingResolved=!1,B.then(n=>{if(lw.delete(e),B.cancelled)return;e.pendingPromise=B,e.pendingResolved=!0;let r=re.finalizeValueForCell(n);r===null&&(r=0),e.cachedValue=r,i(t,e)},r=>{lw.delete(e),e.pendingPromise=null,e.pendingResolved=!1,e.cachedValue=n.a.BuiltIn.Calc,this.scheduleRecalculation(t,e)})}if(A||j){cw.colStart=y,cw.rowStart=C,cw.colEnd=y,cw.rowEnd=C;let e=p.search(cw);for(let t=0;!ne&&t<e.length;t++){let n=e[t];n.colStart===y&&n.rowStart===C&&(ne=n)}if(ne&&(p.remove(ne,JC),!ne||!ne.value.getError())){let e={...ne,value:null};f.insertNonOverlapping(e),d.delete(e)}}let oe,se=1,ce=1,le=z,ue=le?.isIRange,de=n.a.isError(z,n.a.Code.Spill);if(ue&&le.size>1){se=le.getColumnCount(),ce=le.getRowCount();let r,i,a={colStart:y,rowStart:C,colEnd:y+se-1,rowEnd:C+ce-1,scope:k},o=_(),c=!e.l.isRangeWithinRange(a,o);if(c&&(a.colEnd=Math.min(a.colEnd,o.colEnd),a.rowEnd=Math.min(a.rowEnd,o.rowEnd)),de=c,!de){let t=f.search(a);if(de=t.length>1,!de&&t.length===1){let n=t[0],r=e.l.intersectRanges(a,n,iw);!r||r.rowEnd===r.rowStart&&r.colStart===r.colEnd&&r.colStart===y&&r.rowStart===C||(de=!0)}}if(de)z=n.a.BuiltIn.Spill,se=1,ce=1,r=[[te,[[R,[z]]]]],d.setValues(r),i={colStart:y,rowStart:C,colEnd:y,rowEnd:C};else{let e=QC(le,te,R);e&&(r=e.tuples),r&&d.setValues(r),i=a}let l=de?{colStart:y,rowStart:C,colEnd:y,rowEnd:C,scope:k}:a;oe={...l,value:new lu(l,t,de?`dynamicSpillError`:`dynamic`)},p.insert(oe),v.addDynamicPrecedent(s,a,Wd.Spill),f.insertNonOverlapping({...i,value:new uu(i,D)})}let fe=!1;if((ne||oe||de||j)&&(fe=e.l.isEqualRanges(ne,oe),ne&&g.push(ne),oe&&h.push(oe)),oe||ne){let e=1,t=1;ne&&(e=ne.colEnd-ne.colStart+1,t=ne.rowEnd-ne.rowStart+1);let n={colStart:y,rowStart:C,colEnd:y+Math.max(se,e)-1,rowEnd:C+Math.max(ce,t)-1,scope:k};m.insertNonOverlapping(n),fe&&de===F||v.getPrecedents().search(n).length>0&&(s.state=1,c||=new va,c.insertNonOverlapping(n))}z&&n.a.isError(z),re.getError()&&re.getError(),s.cachedValue=z,w[T++]=s;let pe=s.dependents,me=pe.length;if(me>0){let e=s.pending;for(let t=0;t<me;t++){let n=pe[t],r=n.value.index;r<0||(e?$C(n,C,y,bw):(_w=r,vw=z,$C(n,C,y,yw)))}}}return b.node=null,b.colIndex=2**53-1,b.rowIndex=2**53-1,T>0&&(a(w,T),T=0),c}},tw=e=>new ii(e),nw=Symbol(`unsetGridId`);function rw(e,t){return e.scope===t.scope?e.colIndex===t.colIndex?e.rowIndex-t.rowIndex:e.colIndex-t.colIndex:e.scope===null?-1:t.scope===null?1:e.scope.localeCompare(t.scope)}var iw={rowStart:0,colStart:0,rowEnd:0,colEnd:0,scope:null},aw={rowStart:0,colStart:0,rowEnd:0,colEnd:0,scope:null},ow={rowStart:0,colStart:0,rowEnd:0,colEnd:0,scope:null},sw={rowStart:0,colStart:0,rowEnd:0,colEnd:0,scope:null},cw={rowStart:0,colStart:0,rowEnd:0,colEnd:0};new n.a.Calc(`Cyclical dependency`);var lw=new Set,uw=1e4,dw=xE(uw),fw=xE(uw),pw=xE(uw),mw=xE(uw),hw=xE(uw),gw=[null],_w=-1,vw=void 0,yw=e=>{e.inputs[_w]=vw},bw=e=>{e.pendingPrecedents=!0},xw={values:xE(uw),length:0},Sw={values:xE(uw),length:0},Cw=class{constructor(e){this._closed=!1,this._wiringDirty=!1,this._wiringBatchDepth=0,this._container=e?.container??null,this._context=e?.context??null,this._ready=e?.ready??null,this._getActiveCell=e?.getActiveCell??(()=>null),this._createVirtualGrid=e?.createVirtualGrid??null,this._getRange=e?.getRange,this._getRanges=e?.getRanges,this._createGraphRanges=e?.createGraphRanges,this._resolveSheetScope=e?.resolveSheetScope??null,this._isReadOnly=e?.isReadOnly??null,this._getOrBindProxyFakeId=e?.getOrBindProxyFakeId??null,this._queuePendingAction=e?.queuePendingAction??null,this._isEngineReady=e?.isEngineReady??null;let t=this;this._transactions=e?.transactions??new m({transient:!0}),this._stateId=this._transactions.create(),this._transactionsRemoveListener=this._transactions.addStateListener(this._stateId,{onAfterStateChange(e){t._emitter.notify(`onCollectionChange`)}}),this._emitter=new v(this,this._transactions),this._initState()}hydrate(t,n){if(!t)return;let r=t.length;for(let i=0;i<r;i++){let r=t[i];try{this.add({name:r.name,expression:r.ref,scope:r.scope??null,comment:r.comment,hidden:r.hidden,formulaTransform:n})}catch(t){e.V.warn(`Unable to load named item '${r?.name}'.`,{meta:t?.message})}}}toJSON(){let e=this._getState();if(!e||e.itemsById.size===0)return null;let t=Array.from(e.itemsById.values());t.sort((e,t)=>{let n=Tw(e.getScope()).localeCompare(Tw(t.getScope()));return n===0?Tw(e.getName()).localeCompare(Tw(t.getName())):n});let n=[],r=t.length;for(let e=0;e<r;e++){let r=t[e].toJSON();r&&n.push(r)}return n.length>0?n:null}add(t){if(this._closed)throw Error(e._(`error.model.modelClosed`));if(!t?.name)throw Error(`name is required`);if(!t?.expression)throw Error(`expression is required`);let n=null;if(t.cell&&this._getRange){let r=this._getRange(t.cell)?.getCoords()??null;r&&e.l.isSingleCell(r)&&(n={colIndex:r.colStart,rowIndex:r.rowStart})}n||=this._getActiveCell?.()??e.l.EmptyCell;let r=n.scope??this._getActiveCell?.()?.scope??null,i=this._resolveScopeInput(t.scope??null),a=this._findSameIdentity(t.name,i);if(a){if(!t.replaceExisting)throw Error(e._(`error.named.nameExists`,{name:t.name}));a.delete()}let o=this._container&&this._context&&this._ready?{container:this._container,context:this._context,ready:this._ready,getScopeGridId:()=>r||(i?this._container?.getSymbols().bind(Sd,i)??null:this._getActiveCell?.()?.scope??null),queuePendingAction:this._queuePendingAction??void 0,isEngineReady:this._isEngineReady??void 0,markWired:()=>this._markWired(),getRanges:this._getRanges,getRange:this._getRange,createGraphRanges:this._createGraphRanges,resolveSheetScope:this._resolveSheetScope??void 0,getNamedById:e=>this.getById(e)}:null,s=this._getOrBindProxyFakeId?.(t.name,this._resolveScopeName(i))??null;s&&this._createVirtualGrid&&!this._container?.getGrid(s)&&this._createVirtualGrid(s);let c=new ww(n,{...t,scope:i},()=>this._remove(c.getId()),o,s,t=>{let n=this._findSameIdentity(t,c.getScopeId());if(n&&n!==c)throw Error(e._(`error.named.nameExists`,{name:t}))},this._transactions,this._isReadOnly,this._resolveSheetScope??void 0,()=>this._markContentsChanged());return this._updateState(e=>({...e,itemsById:new Map(e.itemsById).set(c.getId(),c)}),e._(`op.addNamedFormulaNamed`,{name:t.name})),o&&this._isEngineReady?.()&&c._wireNow(),c}_markWired(){this._markContentsChanged()}_graphNode(e,t){let n=this.getById(e);return n?t&&(this._container?.getNamedDependents(e).length??0)===0?null:n._asGraphNode():null}_markContentsChanged(){this._closed||(this._wiringDirty=!0,this._wiringBatchDepth===0&&this._flushWired())}_beginWiringBatch(){this._wiringBatchDepth++}_endWiringBatch(){this._wiringBatchDepth>0&&this._wiringBatchDepth--,this._wiringBatchDepth===0&&this._flushWired()}_flushWired(){this._wiringDirty&&!this._closed&&(this._wiringDirty=!1,this._emitter.notify(`onCollectionChange`))}*[Symbol.iterator](){yield*this.getItems()}getItems(t){let n=this._getState();if(!n)return e.A.EmptyArray;let r=Array.from(n.itemsById.values());if(!t)return r;let i=t.name?.toUpperCase(),a=`scope`in t;return r.filter(e=>!(i&&e.getName().toUpperCase()!==i||a&&e.getScope()!==t.scope))}getByName(e,t){if(!e)return null;let n=this._getState();if(!n)return null;let r=e.toUpperCase(),i=t?t.toUpperCase():null,a=null,o=null;for(let e of n.itemsById.values()){if(e.getName().toUpperCase()!==r)continue;let t=e.getScope();if(t!==null){if(i!==null&&t.toUpperCase()===i)return e;o||=e}else a||=e}return i===null?a??o:a}getCount(){return this._getState()?.itemsById.size??0}addListeners(e,t){return this._emitter.addListeners(e,t)}getById(e){return e?this._getState()?.itemsById.get(e)??null:null}_findSameIdentity(e,t){let n=this._getState();if(!n)return null;let r=e.toUpperCase();for(let e of n.itemsById.values())if(e.getScopeId()===t&&e.getName().toUpperCase()===r)return e;return null}_resolveScopeInput(e){if(!e)return null;try{return this._container?.getSymbols().bind(Sd,e)??e}catch{return e}}_resolveScopeName(e){return e?this._resolveSheetScope?.(e)??e:null}_remove(t){this._updateState(e=>{let n=new Map(e.itemsById);return n.delete(t),{...e,itemsById:n}},e.v(`op.removeNamedFormula`))}isClosed(){return this._closed}close(){this._closed||(this._closed=!0,this._transactionsRemoveListener?.())}_getState(){return this._closed?null:this._transactions.getState(this._stateId)}_beginCommit(e){return this._transactions.beginCommit(typeof e==`string`?{description:e}:e)}_updateState(t,n=e.v(`op.update`),r){let i=this._beginCommit(n);try{i.updateState(this._stateId,t),i.commit(r)}catch(e){throw i.rollback(),e}}_initState(){this._updateState(()=>({itemsById:new Map}),e.v(`op.initialize`),{forceAmend:!0})}},ww=class extends Sy{_getNamedState(){return this._transactions.getState(this._stateId)}get _block(){return this._options.getCalcGrid?.()?.getFormulaBlockAt(0,0)}constructor(t,n,r,i,a,o,s,c,l,u){let d=a??e.A.uuidV4();super(t,null,{getRanges:e=>i?.getRanges?.(e)??null,getRange:e=>i?.getRange?.(e)??null,getCalcGrid:()=>i?.container?.getGrid(d)??null,resolveSheetScope:e=>i?.resolveSheetScope?.(e)??null,getOwnScope:()=>{let e=i?.getScopeGridId();return e?i?.resolveSheetScope?.(e)??null:null}}),this._closed=!1,this._id=d,this._transactions=s??new m({transient:!0}),this._stateId=this._transactions.create({name:n.name,scope:n.scope??null,comment:n.comment??null,hidden:n.hidden??!1,isDeleted:!1,expression:Ew(n.expression)}),this._deleteFromCollection=r,this._checkRename=o??null,this._wire=i,this._formulaTransform=n.formulaTransform??null,this._isReadOnly=c??null,this._resolveSheetScope=l??null,this._notifyCollection=u??null;let f=this;this._emitter=new v(this,this._transactions),this._transactionsRemoveListener=this._transactions.addStateListener(this._stateId,{onRestoreOrRevert(){f._emitter.notify(`onInvalidated`),f._notifyCollection?.(),f._wire&&f._block&&(f._wire.container.invalidateNamed(f._id),f._emitter.notify(`onRangesChange`),f._wire.markWired?.())}}),i&&!i.isEngineReady?.()&&(i.queuePendingAction?i.queuePendingAction(()=>this._doWireCore()):this._wireAsync())}_wireNow(){this._wire&&!this._closed&&this._doWireCore()}getId(){return this._id}getName(){return this._getNamedState().name}getScope(){let e=this._getNamedState().scope;return e?this._resolveSheetScope?.(e)??e:null}getScopeId(){return this._getNamedState().scope}getType(){return`formula`}getValue(){return this.getExpression()}setName(t,n){let r=this._getNamedState();return t&&t!==r.name?(this._checkRename?.(t),this._updateNamedState({name:t},e._(`op.updateNamed`,{name:t}),n)):this}setExpression(t,n){if(!t)throw Error(`expression is required`);let r=Ew(t);return r===this._getNamedState().expression||(this._updateNamedState({expression:r},e._(`op.updateNamed`,{name:this.getName()}),n),this._wire&&this._block&&this._doWireCore()),this}getComment(){return this._getNamedState().comment}setComment(t,n){return this._updateNamedState({comment:t},e.v(`op.setComment`),n)}isHidden(){return this._getNamedState().hidden}setHidden(t=!1,n){return this._updateNamedState({hidden:t},e.v(`op.setHidden`),n)}_updateNamedState(t,n,r){if(this._closed)throw Error(e._(`error.model.modelClosed`));let i=this._transactions.beginCommit({description:n,...r});try{i.updateState(this._stateId,t),this._emitter.notify(`onAnyChange`),i.commit()}catch(e){throw i.rollback(),e}return this._notifyCollection?.(),this}async select(e){return await this.getRanges()?.select(e),this}toJSON(){let e=this._getNamedState(),t={name:e.name,ref:this.getExpression()},n=this.getScope();return n&&(t.scope=n),e.comment&&(t.comment=e.comment),e.hidden&&(t.hidden=!0),t}isReadOnly(){return this._isReadOnly?.()??!1}isDeleted(){return this._getNamedState()?.isDeleted??!1}addListeners(e,t){return this._emitter.addListeners(e,t)}getVersionId(){return this._transactions.getVersionId(this._stateId)}beginCommit(e){return this._transactions.beginCommit(typeof e==`string`?{description:e}:e)}doBatch(e,t){return this._transactions.doBatch(e,typeof t==`string`?{description:t}:t)}isClosed(){return this._closed}close(){this._closed||(this._emitter.notify(`onClose`),this._closed=!0,this._transactionsRemoveListener?.())}get isIModel(){return!0}get isINamed(){return!0}getRanges(){return this._block?.isReferenceOnly()?this.getReferences():null}getDirectDependents(){return this._dependentRanges(!0)}getDependents(){return this._dependentRanges(!1)}_asGraphNode(){let e=this,t=this._coords,n=t?.scope,r=(n?this._wire?.resolveSheetScope?.(n):null)??this.getScope()??null;return{id:this._id,name:this.getName(),sheetName:r,rowIndex:t?.rowIndex??0,colIndex:t?.colIndex??0,ranges:()=>e.getRanges(),directPrecedents:()=>e._precedentRanges(!0),precedents:()=>e._precedentRanges(!1),directDependents:()=>e._dependentRanges(!0),dependents:()=>e._dependentRanges(!1)}}getDirectPrecedents(){return this._precedentRanges(!0)}getPrecedents(){return this._precedentRanges(!1)}_precedentRanges(t){let n=this._wire,r=n?.container;if(!n||!r)return null;let i=n.resolveSheetScope,a=[],o=new Set,s=[this._id],c=new Set(s);for(let l=0;l<s.length;l++){let u=r.getGrid(s[l]);if(!u)continue;let d=t?u.getDirectPrecedentsAt(e.l.EmptyRange):u.getPrecedentsAt(e.l.EmptyRange);for(let e=0;e<d.length;e++){let t=d[e],n=t.scope?i?.(t.scope):null;n&&a.push({...t,scope:n})}let f=u.getFormulaBlockAt(0,0)?.getNamedIds()??e.A.EmptyArray;for(let e=0;e<f.length;e++){let r=f[e];n.getNamedById?.(r)&&(o.add(r),t||c.has(r)||(c.add(r),s.push(r)))}}let l=[];for(let e of o){let t=n.getNamedById?.(e);t&&l.push(t._asGraphNode())}if(a.length===0&&l.length===0)return null;let u=a.length>0?Da(a):[];return l.length===0?n.getRanges?.(u)??null:n.createGraphRanges?.(u,l)??(u.length>0?n.getRanges?.(u)??null:null)}_dependentRanges(t){let n=this._wire,r=n?.container;if(!n||!r)return null;let i=n.resolveSheetScope,a=[],o=[this._id],s=new Set(o),c=new Set,l=e=>{c.add(e),s.has(e)||(s.add(e),o.push(e))},u=e=>{l(e);for(let t of r.getNamedDependentNames(e))l(t)};if(!t)for(let e of r.getNamedDependentNames(this._id))l(e);for(let n=0;n<o.length;n++){let s=r.getNamedDependents(o[n]);for(let n=0;n<s.length;n++){let o=s[n],l=o.scope;if(!l)continue;let d=i?.(l);if(!d){t&&c.add(l);continue}if(a.push({...o,scope:d}),t)continue;let f=r.getGrid(l)?.getDependentsAt(o)??e.A.EmptyArray;for(let e=0;e<f.length;e++){let t=f[e],n=t.scope?i?.(t.scope):d;n?a.push({...t,scope:n}):t.scope&&u(t.scope)}}}let d=[];if(c.size>0&&n.getNamedById)for(let e of c){let t=n.getNamedById(e);t&&d.push(t._asGraphNode())}if(a.length===0&&d.length===0)return null;let f=a.length>0?Da(a):[];return d.length===0?n.getRanges?.(f)??null:n.createGraphRanges?.(f,d)??(f.length>0?n.getRanges?.(f)??null:null)}delete(t){if(this._getNamedState()?.isDeleted)return;let n=this._wire?.container,r=this._transactions.beginCommit({description:e._(`op.deleteNamedItem`,{name:this.getName()}),...t});try{if(this._block&&n){let e=n.getGrid(this._id);e&&e.setInputs(null,[{colStart:0,rowStart:0,colEnd:0,rowEnd:0,value:`#NAME?`}])}r.updateState(this._stateId,{isDeleted:!0}),this._deleteFromCollection(),this._emitter.notify(`onDelete`),r.commit()}catch(e){throw r.rollback(),e}n?.recompileNamed(this._id)}async evaluate(e){this._wire&&!this._block&&await this._wire.ready();let t=this._wire,n=this._block;if(!t||!n)throw Error(`Named formula '${this.getName()}' cannot be evaluated: calculation engine not available.`);let{container:r,context:i}=t,a=typeof e==`number`?e:e?.evalIndex,o=r.getScope();o.rowIndex=0,o.colIndex=0,o.gridId=this._id,o.node=null;let s=yE(n.evaluateAt(0,0,a),i);return s===null&&(s=0),s}getCalculationStatus(){return this._block?cv.ResultStatus.Ready:cv.ResultStatus.Stale}getExpression(e){let t=this._block;if(!t)return this._getNamedState().expression;let n=e?.cell?.rowIndex??0,r=e?.cell?.colIndex??0,i=e?.r1c1??!1,a=e?.evalIndex;return t.getTextAt(n,r,i,e?.formulaTransform,a,e?.canonical)}getTokens(t){return this._block?super.getTokens(t):e.A.EmptyArray}isReferenceOnly(){return this._block?.isReferenceOnly()??!1}getReferences(){return this._block?this._resolveReferences(this._options.getCalcGrid?.()?.getReferencesAt(0,0)):null}setReferenceAt(e,t,n){throw Error(`setReferenceAt is not supported on a named formula.`)}setReferenceModeAt(e,t,n,r){throw Error(`setReferenceModeAt is not supported on a named formula.`)}async _wireAsync(){return await this._wire.ready(),this._doWireCore()}async _doWireCore(){let{container:e,context:t,getScopeGridId:n}=this._wire,r=n();if(!r)return;let i=this._coords?.rowIndex??0,a=this._coords?.colIndex??0,o=e.createFormulaBlock(r,t,this._getNamedState().expression,i,a,void 0,this._formulaTransform??void 0).reanchorReferences(r).getTextAt(0,0,!1,void 0,void 0,!0),s=e.getGrid(this._id);s&&(s.setInputs(null,[{colStart:0,rowStart:0,colEnd:0,rowEnd:0,value:o}]),e.recompileNamed(this._id),this._emitter.notify(`onRangesChange`),this._wire.markWired?.())}toString(){return`${this.getName()} => ${this._block?this._block.getTextAt(0,0,!1):this._getNamedState().expression}`}get[Symbol.toStringTag](){return`[NamedFormula]`}};function Tw(e){return e?e.toUpperCase():``}function Ew(e){return e.startsWith(`=`)?e.substring(1):e}var Dw,Ow=class extends e_{constructor(e){super(e),this._status=cv.Status.Off,this._statusTransition=null,this._pendingNames=null,this._cycleId=0,this._volatiles=new Set,this._calculatedCommitId=null,this._pendingActions=null,this._pendingPriority=null,this._draining=!1,this._drainScheduled=!1,this._removeNamedItemsListeners=null,this._namedDependents=null,this._namedDependentsOf=null,this._resolvers=null,this._initialize(e)}_initialize(e){this._runtime=e?.runtime??new Fr(`Calculation Runtime`),this._getActiveCell=e?.getActiveCell??(()=>null),this._getRange=e?.getRange??(()=>null),this._getRanges=e?.getRanges??(()=>null);let t=e,r=t?.namedCollection??null,i=new Md(e=>r?.getByName(e,!0)??null,e=>r?.getById(e)??null),a=new Nd((e,t)=>{try{e=e.toLowerCase(),t=t?.toLowerCase();let n=r?.getByName(t,!0)??null;if(!n)return null;let a=n.getValue().getColumnByName(e);return a?`_`+(i.bind(t)??``)+`:`+a.getId():null}catch{return null}},e=>{if(!e.startsWith(`_`))return null;let t=(e=e.substring(1)).split(`:`),n=t[0],r=t[1],a=i.getRealById(n);if(!a)return null;let o=a.getValue().getColumnById(r);return o?{stableId:e,toString:()=>o.getName()??`(untitled)`}:null}),o=t?.getSheetById,s=t?.getSheetByName,c=new Od(e=>{let t=s?.(e);return t?t.getId()??null:null},e=>{let t=o?.(e);if(t)return{stableId:e,toString:()=>t.getName()??`(untitled)`,getEntireCoords:()=>t.getEntireCoords()??null};let r=p._getState().gridsAll.get(e);return r?{stableId:e,toString:()=>n.a.BuiltIn.Ref.toString(),getEntireCoords:()=>r.getEntireCoords()}:null}),l=new Dd;l.registerProvider(Sd,c),l.registerProvider(wd,i),l.registerProvider(Td,a);let u=null;this._resolvers={getStructureReferenceCoords:(e,t,r,a)=>{if(!e)return n.a.BuiltIn.Ref;let o=e.tableId;if(!o)return null;let s=i.getRealById(o);if(!s)return n.a.BuiltIn.Ref;let c,l,u=s.getValue();if(!u)return n.a.BuiltIn.Ref;switch(e.spec){case 1:{let e=u.getRange().getCoords();c=e.rowStart,l=e.rowEnd;break}case 2:{if(!u.isShowHeaders())return n.a.BuiltIn.Ref;let e=u.getHeaderRowRange().getCoords();c=e.rowStart,l=e.rowEnd;break}case 3:{if(!u.isShowTotals())return n.a.BuiltIn.Ref;let e=u.getTotalRowRange().getCoords();c=e.rowStart,l=e.rowEnd;break}case 4:{let e=u.isShowHeaders()?u.getHeaderRowRange().getCoords():u.getDataRange().getCoords(),t=u.getDataRange().getCoords();c=e.rowStart,l=t.rowEnd;break}case 5:{let e=u.getDataRange().getCoords(),t=u.isShowTotals()?u.getTotalRowRange().getCoords():e;c=e.rowStart,l=t.rowEnd;break}default:{let e=u.getDataRange().getCoords();c=e.rowStart,l=e.rowEnd}}let d=u.getRange().getCoords(),f=d.colStart,p=d.colEnd,m=e.columnFromId,h=e.columnToId;if(m){let e=m.indexOf(`:`),t=e>=0?m.substring(e+1):m,r=u.getColumnById(t);if(!r)return n.a.BuiltIn.Ref;if(f=d.colStart+r.getIndex(),p=f,h&&h!==m){let e=h.indexOf(`:`),t=e>=0?h.substring(e+1):h,r=u.getColumnById(t);if(!r)return n.a.BuiltIn.Ref;p=d.colStart+r.getIndex()}}if(e.isThisRow){if(t<c||t>l)return n.a.BuiltIn.Value;c=t,l=t}return{colStart:f,colEnd:p,rowStart:c,rowEnd:l,scope:u.getSheet().getId(),$colStart:!0,$rowStart:!0,$colEnd:!0,$rowEnd:!0}},getNamedFormulaBlock:e=>h.getGrid(e)?.getFormulaBlockAt(0,0)??null},this._emitter=new v(this),this._updateState({gridsAll:new Map,iterate:e?.enableIterativeCalculations??!1,maxIterations:e?.maxIterations??100,maxIterateChange:e?.maxIterateChange??.001});let d=new ro({updateEntryOptions:{isMergeOnShift:!0,isSplitOnExpand:!0}}),f=new ro({updateEntryOptions:{isSplitOnExpand:!0,isMergeOnShift:!1}});this._updateState({formulaSpatial:d,precedentSpatial:f,dynamicByBlock:new Map,dirtySpatial:new ro});let p=this,m={rowIndex:0,colIndex:0,gridId:null,node:null,depth:0,activeNames:new Set},h={getRuntime:()=>p._runtime,getScope:()=>m,createFormulaBlock(e,t,n,r,i,a,o){return p._compiler,new Qb((a?p._getEditingCompiler():p._compiler).compile(t.getRuntime(),r,i,n,h.getSymbols(),e=>t.getFunction(e),l.resolve(Sd,e)?.toString()??null,o),t,m,e,()=>this.getGrid(e)?.getEntireCoords()??null,p._resolvers)},getSymbols:()=>l,resolveScope:e=>l.resolve(Sd,e)?.toString(),getSheetIndex:e=>p._options.getSheetIndex?.(e)??-1,getSheetCount:()=>p._options.getSheetCount?.()??0,getFormulas:()=>p._getState().formulaSpatial,setFormulas(e){p._updateState({formulaSpatial:e},Aw)},getPrecedents:()=>p._getState().precedentSpatial,setPrecedents(e){p._updateState({precedentSpatial:e},Aw)},getDynamics:()=>p._getState().dynamicByBlock,setDynamics(e){p._updateState({dynamicByBlock:e},Aw)},addDynamicPrecedent(e,t,n){p._calcExecutor._addDynamicPrecedent?.(e,t,n)},getVolatiles:()=>p._volatiles,getGridValues(e){let t=p._calcExecutor._gridUpdates?.get(e);if(t)return t.values;let n=p._getState().gridsAll.get(e);return n?n.getValues():(console.warn(`invalid gridId for updates`,e),null)},getIncrementalUpdates(e){let t=p._calcExecutor._gridUpdates;if(!t)return null;let n=t.get(e);if(!n){let r=h.getGrid(e);if(!r)return console.warn(`invalid gridId for updates`,e),null;n=r.beginUpdates(),t.set(e,n)}return n},registerGrid:e=>{p._registerGrid(e)},unregisterGrid:e=>{p._unregisterGrid(e)},getGrid:e=>p._getState().gridsAll.get(e)??null,markDirty:e=>{let t=p._getState(),r=t.dirtySpatial.clone(),i=t.precedentSpatial,a=t.formulaSpatial,o=!1,s=Ea(e,n.l.Axis.Column,2);for(let e=0;e<s.length;e++){let t=s[e];(i?.has(t)||a?.has(t))&&(o=!0,r.insertNonOverlapping(t))}return o&&p._updateState({dirtySpatial:r},Aw),o},getDirtyGrid:e=>p._getState().dirtySpatial.getSpatialAt(e),calculateGrid:(e,t)=>p._calculate(t,e),getCycleId:()=>p._cycleId,getNow:()=>p._getTransactions().getCurrentCommit().getTimestamp(),whenSafe:e=>{p._whenSafe(e)},isLoading:()=>p._draining||p._status===cv.Status.Starting,recompileNamed(e){p._whenSafe(async()=>{let t=p._namedTargets(new Set([e])),n=p._getState().formulaSpatial.all3D();for(let e=0;e<n.length;e++){let r=n[e].value,i=r.getNamedIds(),a=!1;for(let e=0;e<i.length&&!a;e++)a=t.has(i[e]);if(!a)continue;let o=h.getGrid(r.gridId);if(!o)continue;let s=r.ref;o.setInputs(null,[{...s,value:r.getTextAt(s.rowStart,s.colStart)}])}})},invalidateNamed(e){p._whenSafe(async()=>{p._markDirtyReferencing(new Set([e]))})},getNamedDependents:e=>p._getNamedDependents(e),getNamedDependentNames:e=>p._getNamedDependentNames(e)};this._container=h,this._removeNamedItemsListeners=r?.addListeners({onCollectionChange:()=>{if(p.isClosed())return;let e=i.reconcile(),t=r.getItems(),n=this._getState().itemRemoveListeners;n?.forEach(e=>e()),n=[];for(let e of t)if(e.getType()===`table`){let t=e.getValue();n.push(t.addListeners({onAnchorCoordsChange:(e,n)=>{h.markDirty([{...t.getRange().getCoords(),scope:t.getSheet().getId()}])}}))}this._updateState({itemRemoveListeners:n},Aw),p._markDirtyReferencing(new Set(e))}})??null;let g=new Ld(h,n.l.Axis.Column,this._options?.functions);this._context=g;let _=new Cw({container:h,context:g,ready:()=>this.ready(),getActiveCell:()=>this._getActiveCell(),getRange:e=>this._getRange(e),getRanges:e=>this._getRanges(e),createGraphRanges:this._options?.createGraphRanges,resolveSheetScope:e=>this._options?.getSheetById?.(e)?.getName()??null,createVirtualGrid:e=>{this._createCalcGrid({uuid:e,getEntireCoords:tE,unanchored:!0})},getOrBindProxyFakeId:(e,t)=>u?.bind(e,{scope:t,own:!0})??null,queuePendingAction:e=>this._whenSafe(e,!0),isEngineReady:()=>this._status===cv.Status.Ready&&!this._draining,transactions:t?.transactions,isReadOnly:()=>this.isReadOnly()});this._namedFormulas=_,u=new Md((e,t)=>_.getByName(e,t),e=>_.getById(e)),l.registerProvider(Cd,u),this._pendingNames=t?.names??null,_.addListeners({onCollectionChange:()=>{if(p.isClosed())return;let e=u.reconcile();p._markDirtyReferencing(new Set(e))}}),this._calcExecutor=new ew(h,g,()=>this.calculate())}_markDirtyReferencing(e){if(e.size===0)return!1;let t=this._namedTargets(e),n=this._getState().formulaSpatial.all3D(),r=[];for(let e=0;e<n.length;e++){let i=n[e].value;if(i.gridId==null)continue;let a=i.getReferencedSymbolIds();for(let e=0;e<a.length;e++)if(t.has(a[e])){r.push({...i.ref,scope:i.gridId});break}}return r.length!==0&&(this._container.markDirty(r),!0)}_getNamedDependents(t){let n=this._getState().formulaSpatial;if(this._namedDependentsOf!==n||!this._namedDependents){let e=new Map,t=n.all3D();for(let n=0;n<t.length;n++){let r=t[n].value;if(r.gridId==null)continue;let i=r.getNamedIds();if(i.length===0)continue;let a=r.ref,o={rowStart:a.rowStart,colStart:a.colStart,rowEnd:a.rowEnd,colEnd:a.colEnd,scope:r.gridId};for(let t=0;t<i.length;t++){let n=e.get(i[t]);n?n.push(o):e.set(i[t],[o])}}this._namedDependents=e,this._namedDependentsOf=n}return this._namedDependents.get(t)??e.A.EmptyArray}_getNamedDependentNames(e){let t=new Set,n=[e];for(let e=0;e<n.length;e++){let r=this._getNamedDependents(n[e]);for(let e=0;e<r.length;e++){let i=r[e].scope;i&&!t.has(i)&&this._namedFormulas.getById(i)&&(t.add(i),n.push(i))}}return t}_namedTargets(e){let t=new Set(e);for(let n of e)for(let e of this._getNamedDependentNames(n))t.add(e);return t}start(){return this._statusTransition||(this._statusTransition=(async()=>{if(this._status===cv.Status.Off)try{this._status=cv.Status.Starting,this._emitter.notify(`onStatusChange`),this._emitter.notify(`onStarting`);let e=this._container,t=this._context,[n,r]=await Promise.all([t._initialize(),Promise.resolve().then(()=>require("./BW48QUIyFJAiIyBv.cjs"))]),i=n.functions;this._functions=i,e.getSymbols().registerProvider(Ed,new Id(()=>i)),this._compilerModule=r,this._compiler=new r.FormulaCompiler,this._status=cv.Status.Ready,this._emitter.notify(`onStatusChange`),this._emitter.notify(`onReady`),this.hydrateNames(),this._pendingActions?.length&&await this._drainPending()}catch(e){throw this._status=cv.Status.Off,this._emitter.notify(`onError`,e),this._emitter.notify(`onStatusChange`),e}finally{this._statusTransition=null}})(),this._statusTransition.catch(()=>{})),this._statusTransition}_whenSafe(e,t=!1){if(t){let t=this._pendingPriority;t||(this._pendingPriority=t=[]),t.push(e)}else{let t=this._pendingActions;t||(this._pendingActions=t=[]),t.push(e)}this._scheduleDrain()}_scheduleDrain(){this._drainScheduled||this._draining||this._status===cv.Status.Ready&&(this._drainScheduled=!0,queueMicrotask(()=>{this._drainScheduled=!1,this.isClosed()||this._status!==cv.Status.Ready||this._pendingActions?.length&&this._drainStandalone().catch(e=>{this.isClosed()||this._emitter.notify(`onError`,e)})}))}async _drainStandalone(){await this._drainPending(),this.isClosed()||this._status!==cv.Status.Ready||this._getState().dirtySpatial.isEmpty()||await this._calculate()}async _drainPending(){let e=this._draining;this._draining=!0;let t=this._namedFormulas;t?._beginWiringBatch();try{for(;this._pendingPriority?.length||this._pendingActions?.length;){let e=this._pendingPriority;if(e?.length){this._pendingPriority=null;for(let t of e)await t();continue}let t=this._pendingActions;this._pendingActions=null;for(let e of t)await e()}this._pendingPriority=null,this._pendingActions=null}finally{this._draining=e,t?._endWiringBatch()}}async calculate(e){let t;return!0===e?t=jw:e&&(t=e),this._calculate(t)}async _calculate(e,t){let n=this.getStatus();if(n===cv.Status.Off&&(await this.start(),n=this.getStatus()),n===cv.Status.Starting)return this._whenSafe(()=>this._calculate(e,t)),n;if(n!==cv.Status.Ready)return n;this._pendingActions?.length&&await this._drainPending();let r,i=this._getState(),a=e?.full??i.isFullCalcRequired,o=e?.range;if(o){let e=this._options;e.getRange?r=e.getRange(o)?.getCoords():o?.rowStart===void 0?a=!0:r=o}if(t&&!a&&!r){let e=this._getTransactions().getCurrentCommit().getId();if(e===this._calculatedCommitId&&i.dirtySpatial.isEmpty())return this.getStatus();this._calculatedCommitId=e}let s=this._volatiles;this._volatiles=new Set;let c=++this._cycleId,l=this._calcExecutor.execute(c,{isFullCalc:a,calcCoords:r,gridId:t,scopeGridId:e?.scope},{gridsAll:i.gridsAll,formulaSpatial:i.formulaSpatial,dirtySpatial:i.dirtySpatial,oldVolatiles:s});if(!l)return Promise.resolve(this.getStatus());this._updateState({precedentSpatial:l.precedentSpatial,dynamicByBlock:l.dynamicByBlock,dirtySpatial:new ro,isFullCalcRequired:!1},Aw);for(let t of l.lastUpdates.values())t.done(c,e);return this.getStatus()}_createCalcGrid(e){let t=this._options,n=new IC({...t,...e,context:this._context,container:this._container,calculation:this}),r=new Map(this._getState().gridsAll);return r.set(n.getId(),n),this._updateState({gridsAll:r},Aw),n}_registerGrid(e){let t=e.getId();this._unregisterGrid(t);let n=new Map(this._getState().gridsAll);n.set(t,e),this._updateState({gridsAll:n},Aw)}_unregisterGrid(e){let t=new Map(this._getState().gridsAll);t.get(e),t.delete(e),this._updateState({gridsAll:t},Aw)}async stop(){this._status===cv.Status.Ready&&(this._status=cv.Status.Stopping,this._emitter.notify(`onStatusChange`),this._emitter.notify(`onStopping`),this._status=cv.Status.Off,this._emitter.notify(`onStatusChange`),this._emitter.notify(`onStop`))}getStatus(){return this._status}async ready(e){this._status===cv.Status.Off?await this.start():this._status===cv.Status.Starting&&await this._statusTransition,this._pendingActions?.length&&await this._drainPending();let t=typeof e==`boolean`?e:e?.full??!1,n=this._getState(),r=n.gridsAll,i=t?r.keys():n.dirtySpatial.getScopeKeys(),a=[];for(let e of i){let t=r.get(e);t&&a.push(t.calculate())}return await Promise.all(a),kw}_getEditingCompiler(){let e=this._compilerModule;if(!e)throw Error(`Calculation not started.`);let t=jv(this._runtime.getLocaleProfile().decimal),n=Fv(t),r=n.specifiers,i=r?`${r.all},${r.data},${r.headers},${r.totals},${r.thisRow}`:``,a=`${t.separatorDecimal}|${t.separatorFunction}|${t.separatorRow}|${n.booleanTrue}|${n.booleanFalse}|${n.errorLiterals.join(`,`)}|${n.errorRefs.join(`,`)}|${i}`;if(!this._compilerEditing||this._compilerEditingSig!==a){let t={locale:n};this._compilerEditing=new e.FormulaCompiler({profile:`editing`,lexerOptions:t}),this._compilerEditingSig=a}return this._compilerEditing}createFormula(t,n){this._checkReady(),t.startsWith?.(`=`)&&(t=t.substring(1));let r=this._container,i=this._context,a=null,o=0,s=0,c=this._getActiveCell()?.scope??null,l=null;if(n)a=n.scope,o=n.colIndex??0,s=n.rowIndex??0,a&&(c=r.getSymbols().bind(Sd,a));else{l=c,c=`temporary`;let e=r.getGrid(c);e||(e=this._createCalcGrid({context:i,container:r,calculation:this,uuid:c}),this._registerGrid(e))}let u=this._getState().gridsAll.get(c);if(!u)throw Error(`'${a}' not found.`);let d,f=r.getScope();f.colIndex=o,f.rowIndex=s,f.gridId=c,d=l?r.createFormulaBlock(l,i,t,s,o,!0):r.createFormulaBlock(c,i,t,s,o,!0);let p=new Ud(e.l.EmptyRange,c,d,r,!0);return new Cy({colIndex:o,rowIndex:s},d,{...this._options,getRange:this._getRange,getRanges:this._getRanges,getCalcGrid:()=>u,resolveSheetScope:e=>this._options?.getSheetById?.(e)?.getName()??null,getOwnScope:()=>this._options?.getSheetById?.(c)?.getName()??null,autoCorrect:e=>{let t=this._getEditingCompiler().autoCorrect(e);if(t===null)return null;let r=this.createFormula(t,n);return r.isValid()?r:null},createAt:(e,t)=>this.createFormula(e,{scope:n?.scope,rowIndex:t.rowIndex,colIndex:t.colIndex})},async(e,t)=>{await this.ready();let n=p.calcs[0][0];f.colIndex=o,f.rowIndex=s,f.gridId=c,n.gridId=c,n.colIndex=o,n.rowIndex=s,f.node=n;let r=typeof t==`number`?void 0:t,a=typeof t==`number`?t:t?.evalIndex,l=r?.block;if(l){let t=l.rowStart,o=l.colStart,s=l.rowEnd-t+1,c=l.colEnd-o+1,u=i.createRange(s,c).sparseBuilder();for(let r=0;r<s;r++)for(let i=0;i<c;i++){let s=t+r,c=o+i;f.node=n,n.rowIndex=s,n.colIndex=c;let l=e.evaluateAt(s,c,a);l&&l.then&&(l=await l);let d=e.finalizeValueForCell(l);d?.isIRange&&(d=d.getValueAt(0,0)??0),u.pushAt(r,i,d)}let d=u.build();return s!==1||c!==1||r?.alwaysReturnRange?d:d.getValueAt(0,0)??0}let u=e.evaluateAt(s,o,a),d=e.finalizeValue(u);return d===null&&(d=0),!r?.alwaysReturnRange||d?.isIRange||Array.isArray(d)?d:i.createRange(1,1,d)})}async evaluate(e,t){let n,r;return await this.ready(),typeof t==`number`?n=t:(n=t,r=t),this.createFormula(e,r).evaluate(n)}getFunctions(){return this._checkReady(),this._functions}getNamedFormulas(){return this._namedFormulas}hydrateNames(){let e=this._pendingNames;e&&(this._pendingNames=null,this._namedFormulas.hydrate(e,this._options?.formulaTransform))}getRuntime(){return this._runtime}_checkReady(){if(this._status!==cv.Status.Ready)throw Error(this._statusMessage())}_statusMessage(){switch(this._status){case cv.Status.Off:return`Calculation is off`;case cv.Status.Starting:return`Calculation is starting`;case cv.Status.Ready:return`Calculation is ready`;default:return`Unknown calculation status`}}get[Symbol.toStringTag](){return`[Calculation]`}toString(){return`Calculation`}},kw=Promise.resolve(cv.Status.Ready),Aw=Object.freeze({description:e.v(`op.updateCalculations`),forceAmend:!0}),jw=Object.freeze({full:!0}),Mw=e=>{if(typeof e==`string`)return`'${e}'`;try{return JSON.stringify(e)}catch{return String(e)}},Nw=(e,t)=>{if(!e)return null;let n={colStart:Math.max(e.colStart,t.colStart),rowStart:Math.max(e.rowStart,t.rowStart),colEnd:Math.min(e.colEnd,t.colEnd),rowEnd:Math.min(e.rowEnd,t.rowEnd)};return n.rowStart>n.rowEnd||n.colStart>n.colEnd?null:n},Pw=class t{_getInternal(){return this._internal}_getReadCtx(){if(!this._readCtx){let e=this;this._readCtx={get state(){return e._getState()},get rowHeaders(){return e._rowHeaders},get columnHeaders(){return e._colHeaders},get cellOptions(){return e._cellOptions},get strings(){return e._strings},getEntireCoords:this._getEntireCoords.bind(this),getUsedCoords:this._getUsedCoords.bind(this),getErrorSpatial:this._getErrorSpatialReconciled.bind(this)}}return this._readCtx}_getErrorSpatialReconciled(){let e=this._getState()?.cellValuesGrid??null,t=this._errorReconciled;if(t&&t.grid===e&&t.epoch===this._errorEpoch)return t.spatial;let r=new va;if(e){let t=e.getAxis()===n.l.Axis.Column,i=[],a=(e,n,r)=>{i.push({colStart:t?e:n,rowStart:t?n:e,colEnd:t?e:r,rowEnd:t?r:e,value:!0})},o=e.getRuns(),s=o.next();for(;!s.done;){let[e,t,r]=s.value;s=o.next();let i=r.length,c=-1;for(let o=0;o<i;o++)n.a.isError(r.at(o))?c===-1&&(c=o):c!==-1&&(a(e,t+c,t+o-1),c=-1);c!==-1&&a(e,t+c,t+i-1)}i.length>0&&r.load(Ea(i,n.l.Axis.Column,2**53-1))}return this._errorReconciled={grid:e,epoch:this._errorEpoch,spatial:r},r}_getMutationCtx(){return this._mutationCtx||=this._buildMutationCtx(),this._mutationCtx}_buildMutationCtx(){let e=this;return{get rowHeaders(){return e._rowHeaders},get columnHeaders(){return e._colHeaders},get rowHeadersShiftCallback(){return e._rowHeadersShiftCallback},get columnHeadersShiftCallback(){return e._colHeadersShiftCallback},getEntireCoords:this._getEntireCoords.bind(this),getView:this.getView.bind(this),beginCommit:this._beginCommit.bind(this),updateState:this._updateState.bind(this),getState:this._getState.bind(this),stateFor:e=>e.getState(this._stateId),invalidateUsedCoords:()=>{e._lastUsedCoordsRead.coords=null},validateCoords:this._validateCoords.bind(this),protectionCheck:this._protectionCheck.bind(this),getDefaultShiftAxis:this._getDefaultShiftAxis.bind(this),processListenerShift:this._processListenerShift.bind(this),processLayoutChange:this._processLayoutChange.bind(this),markColumnHeaderTableNames:this._markColumnHeaderTableNames.bind(this),commitAndAutoSelect:this._commitAndAutoSelect.bind(this),cloneRangeStats:t=>{e._rangeStats=e._rangeStats.clone(t)},get styles(){return e._styles},getRangedEntries:this._getRangedEntries.bind(this),createSparseBuilder:this._createSparseBuilder.bind(this),composeDirectStyleView:this._composeDirectStyleView.bind(this),autoFit:this._autoFit.bind(this),notify:this._notify.bind(this),getRange:this.getRange.bind(this),getSelection:this.getSelection.bind(this),getMerges:this._getMerges.bind(this),indexMerges:this._indexMerges.bind(this),validateOrRemoveOverlaps:this._validateOrRemoveOverlaps.bind(this),autoSelect:this._autoSelect.bind(this),get isDataColumn(){return e._isDataColumn},get strings(){return e._strings},get cellOptions(){return e._cellOptions},get runtime(){return e._runtime},getProtection:this.getProtection.bind(this),hasRangedEntries:this._hasRangedEntries.bind(this),rangeStateIterator:this._rangeStateIterator.bind(this),addEvent:this._addEvent.bind(this),getTables:this.getTables.bind(this),getAutoTable:this.getAutoTable.bind(this),cellIterator:this._cellIterator.bind(this),rangeToCoords:this._rangeToCoords.bind(this),getCell:this.getCell.bind(this),createCell:this.createCell.bind(this),getAutoFillPreviewCache:()=>e._autoFillPreviewCache,setAutoFillPreviewCache:t=>{e._autoFillPreviewCache=t}}}_getCoordCtx(){return this._coordCtx||=this._buildCoordCtx(),this._coordCtx}_buildCoordCtx(){let e=this;return{get internal(){return e._internal},get readonly(){return e._options.readonly??!1},get isClosed(){return e._closed},get isInitializing(){return e._initializing},get lastCellDecoded(){return e._lastCellDecoded},getEntireCoords:this._getEntireCoords.bind(this),getNamedFormulas:()=>e._calculation?.getNamedFormulas(),getNames:this.getNames.bind(this),getProtection:this.getProtection.bind(this),getName:this.getName.bind(this),resolveRange:t=>e._options.resolveRange?.(t)}}constructor(t){this._lastTransactionUUID=null,this._initializing=!0,this._namesScoped=null,this._rangesListenerSorted=null,this._lastCellDecoded={address:null,coords:null},this._lastCellSelected={coords:null,cell:null},this._lastCellRead={coords:null,cell:null},this._lastValueRead={range:null,isDateOrTime:null},this._lastGetRangeRead={},this._lastUsedCoordsRead={coords:null,range:null},this._lastRangeRead={address:null,range:null,ranges:null},this._isDataColumn=!0,this._isDate1904=!1,this._colHeaders=null,this._colHeadersShiftCallback=null,this._colHeadersListener=null,this._colHeadersRemoveListener=null,this._colHeadersHiddenRemoveListener=null,this._rowHeaders=null,this._rowHeadersShiftCallback=null,this._rowHeadersListener=null,this._rowHeadersRemoveListener=null,this._rowHeadersHiddenRemoveListener=null,this._isAdjustHeaders=!1,this._closed=!1,this._internal={getSheet:()=>this,getState:this._getState.bind(this),isDataColumn:()=>this._isDataColumn,createRange:this._createRange.bind(this),isContentful:this._isContentful.bind(this),cellToCoords:this._cellToCoords.bind(this),rangeToCoords:this._rangeToCoords.bind(this),rangesToCoords:this._rangesToCoords.bind(this),validateCoords:this._validateCoords.bind(this),getScalar:this._getScalar.bind(this),getCellAt:this._getCellAt.bind(this),cellIterator:this._cellIterator.bind(this),getVisible:this._getVisible.bind(this),getUsedCoords:this._getUsedCoords.bind(this),updateTuples:this._updateTuples.bind(this),merge:this._merge.bind(this),unmerge:this._unmerge.bind(this),getMerges:this._getMerges.bind(this),insertFrom:this._insertFrom.bind(this),insertCells:this._insertCells.bind(this),deleteCells:this._deleteCells.bind(this),getStyle:this._getStyle.bind(this),updateStyles:this._updateStyles.bind(this),getSnapshot:this._getSnapshot.bind(this),getRangeStats:this._getRangeStats.bind(this),getDefaultShiftAxis:this._getDefaultShiftAxis.bind(this),getDefaultSortCriteria:this._getDefaultSortCriteria.bind(this),find:this._find.bind(this),copyFrom:this._copyFrom.bind(this),contentCounts:this._contentCounts.bind(this),featureCounts:this._featureCounts.bind(this),featureRegions:this._featureRegions.bind(this),dependencyRanges:this._dependencyRanges.bind(this),clear:this._clear.bind(this),calculate:this._calculate.bind(this),autoSelect:this._autoSelect.bind(this),autoFit:this._autoFit.bind(this),addRangesListeners:this._addRangesListeners.bind(this),addRangesListeners2:this._addRangesListeners2.bind(this),surroundingRegion:this._surroundingRegion.bind(this),sort:this._sort.bind(this),filter:this._filter.bind(this),setHyperlinks:this._setHyperlinks.bind(this),setComments:this._setComments.bind(this),getBoundsAtCoords:this._getBoundsAtCoords.bind(this),extendRange:this._extendRange.bind(this),createTupleBuilder:e=>this._createTupleBuilder(e),createSparseBuilder:this._createSparseBuilder.bind(this),autoFill:this._autoFill.bind(this),autoFillRange:this._autoFillRange.bind(this)},this._readCtx=null,this._errorReconciled=null,this._errorEpoch=0,this._mutationCtx=null,this._autoFillPreviewCache=null,this._coordCtx=null;let n=Object.freeze({...t}),r=t?.container?.getName?.();this._id=(r?r+`-`:``)+e.A.uuidV4(),ju._validate(!0),this._transactions=n.transactions??new m,this._ownTransactions=!n.transactions,this._stateId=this._transactions.create();let i=this,a=this._beginCommit({description:e.v(`op.newSheet`)});try{this._strings=n.strings??new Yh,this._ownStrings=!n.strings;let t=n.styles??new jm;this._styles=t,this._ownStyles=!n.styles,this._namedTableSource=new og({getSheets:()=>[i]}),this._names=n.names??new v_({addressToRanges:e=>i.getRanges(e),getCurrentScope:()=>i.getName(),isReadOnly:()=>i._options.readonly??!1,transactions:i._transactions,getSources:()=>i._calculation?[i._calculation.getNamedFormulas(),i._namedTableSource]:e.A.EmptyArray}),this._ownNames=!n.names,this._namesRemoveListener=this._names.addListeners({onCollectionChange:e=>{i._calculateFull()}},{transactional:!1}),this._runtime=n.runtime??new Fr(`Sheet Runtime`,{isDate1904:()=>this._isDate1904}),this._calculation=n.calculation,this._ownCalculation=!n.calculation,this._calculation||=new Ow({runtime:i._runtime,getActiveCell:()=>{let e=i.getSelectedRange()?.getCoords();return e?{rowIndex:e.rowStart,colIndex:e.colStart,scope:i.getId()}:null},getRange:i.getRange.bind(i),getRanges:i.getRanges.bind(i),getSheetIndex:e=>+(e===void 0||e===i.getName()),getSheetCount:()=>1,getSheetById:e=>this.getId()===e?this:null,getSheetByName:e=>i,namedCollection:i.getNames(),strings:i._strings,transactions:i._transactions}),this._workbook=n.workbook??null,this._normalStyleRanged=t.getNamed(X.BuiltInName.Normal).getRanged(),this._resources=n.resources??new Jh,this._ownResources=!n.resources;let r=async()=>{this._ownCalculation&&await this._calculation.start(),this._starting=null};this._starting=r(),this._starting?.catch(()=>{}),n.container?.setNameChangeCallback&&n.container.setNameChangeCallback(()=>{i._notify(`onNameChange`);let t=this._getState().rangesListenerMap,n=new Map;t.forEach((e,t)=>{n.set(t,{beforeState:e,afterState:e})});let r=this._beginCommit({description:e.v(`op.setName`)});r.updateState(i._stateId,{}),r.commit({viewAfter:{ranges:[i._getEntireCoords()],listeners:n},forceAmend:!0}),i._calculateFull()}),n.container?.setVisibilityCallback&&n.container.setVisibilityCallback(()=>{i._notify(`onVisibilityChange`)}),n.container?.setIndexCallback&&n.container.setIndexCallback(()=>{i._calculateFull(),i._notify(`onIndexChange`)}),this._movables=new h_(this._addMovable.bind(this),this._searchMovables.bind(this),()=>{let e=i._getState();return e?e.movableMapModel?.size??0:0},this._updateSelectedMovables.bind(this),(e,t)=>this._emitterMovables.addListeners(e,t),this._addMovablePicture.bind(this)),this._emitterMovables=new v(this._movables,this._transactions),this._tables=new M_(this._addTable.bind(this),this._getTables.bind(this),e=>{let t=i._getState();return t?t.tables.getByName(e):null}),this._dataValidations=new fv(this._addDataValidation.bind(this),(t,n,r)=>{let a=t?this._rangeToCoords(t):this._getEntireCoords(),o=i._getState();return o?i._getRangedEntries(o.dataValidations,[a],{ignoreHidden:n,fullyContained:r},!0):e.A.EmptyArray},e=>{let t,n=[{r:e?.getRanges().getCoords()??this.getSelectedRanges().getCoords(),v:e?.toJSON()??{condition:{selector:Q.BuiltInSelectorNames.List,operator:Q.BuiltInOperatorNames.InSet,param:{items:[]}}}}],r=i._getState().dataValidations.clone();return i._createDataValidations(r,`dataValidations`,n,e=>(t=new uv({...e,transactions:null,setContainerCallbacks:null,setContainerCoords:null,setContainerName:null,setContainerIndex:null,isProtected:null,invalidate:null}),t)),t}),this._conditionals=new sv(this._addConditionalFormat.bind(this),(t,n,r)=>{let a=t?this._rangeToCoords(t):this._getEntireCoords(),o=i._getState();return o?i._getRangedEntries(o.conditionalFormats,[a],{ignoreHidden:n,fullyContained:r},!0):e.A.EmptyArray},e=>{let t,n=[{r:e?.getRanges().getCoords()??this.getSelectedRanges().getCoords(),v:e?.toJSON()??{condition:{operator:Q.BuiltInOperatorNames.Between,param:null}}}],r=i._getState().conditionalFormats.clone();return i._createConditionalFormats(r,`conditionalFormats`,n,e=>(t=new Q_({...e,transactions:null,setContainerCallbacks:null,setContainerCoords:null,setContainerName:null,setContainerIndex:null,isProtected:null,invalidate:null}),t)),t}),this._protectedRanges=new hv(this._addProtectedRange.bind(this),(t,n,r)=>{let a=t?this._rangeToCoords(t):this._getEntireCoords(),o=i._getState();return o?i._getRangedEntries(o.protectedRanges,[a],{ignoreHidden:n,fullyContained:r},!0):e.A.EmptyArray},e=>{let t=i._getState();return t?t.protectedRanges.getByName(e):null},e=>{let t,n=[{r:e?.getRanges().getCoords()??this.getSelectedRanges().getCoords(),v:e?.toJSON()??{name:i._nextProtectedRangeName()}}],r=i._getState().protectedRanges.clone();return i._createProtectedRanges(r,`protectedRanges`,n,e=>(t=new pv({...e,transactions:null,setContainerCallbacks:null,setContainerCoords:null,setContainerName:null,setContainerIndex:null,isProtected:null,invalidate:null}),t)),t}),this._options=n,this._emitter=new v(this,this._transactions),this._view=new FC({sheet:this}),this._initListenerState(),n?.container?.beforeFromJSON?.(this),this._fromJSON(n?.json,n.disableLoadAutoFit),a.commit({forceAmend:this._ownTransactions,viewAfter:{initial:!0,skipProtectionCheck:!0}})}catch(e){throw a.rollback(),e}this._initializing=!1}_createRange(t,n,r=null){return function(t,n,r,i=null){if(typeof n==`string`){let a=n,o=t.getNamedFormulas()?.getById?.(a),s=o?.getName()??a,c=(o?.isReferenceOnly?.()?o.getReferences()?.at(0)?.getCoords():null)??t.getEntireCoords();i===null&&t.readonly&&(i=e.v(`error.sheet.readonlyRange`));let l=null;return(r||i)&&(l={getOptions:r,readOnly:i}),new Ov(a,s,c,t.internal,l,o?()=>o.getRanges():null)}if(!n)return wT(t.internal.getSheet(),t.getEntireCoords());if(wC(t,n),t.isClosed)return wT(null,t.getEntireCoords(),n);i===null&&t.readonly&&(i=e.v(`error.sheet.readonlyRange`));let a=null;(r||i)&&(a={getOptions:r,readOnly:i});let o=ST(n,t.internal.getSheet()),s=xT(t.internal,o.scope);return s?new Tv(function(e){if(!e)return null;let t={colStart:e.colIndex??e.colStart??0,rowStart:e.rowIndex??e.rowStart??0,colEnd:e.colIndex??e.colEnd??0,rowEnd:e.rowIndex??e.rowEnd??0};return e.scope&&(t.scope=e.scope),(e.$colStart||e.$colIndex)&&(t.$colStart=!0),(e.$colEnd||e.$colIndex)&&(t.$colEnd=!0),(e.$rowStart||e.$rowIndex)&&(t.$rowStart=!0),(e.$rowEnd||e.$rowIndex)&&(t.$rowEnd=!0),t}(o),s,a):wT(t.internal.getSheet(),t.getEntireCoords(),n)}(this._getCoordCtx(),t,n,r)}_createRanges(t,n,r=null){return function(t,n,r,i=null){let a=null;return i===null&&t.readonly&&(i=e.v(`error.sheet.readonlyRange`)),(r||i)&&(a={getOptions:r,readOnly:i}),new eT(function(e,t){if(!e)return e;let n=!1;for(let r=0;r<e.length;r++){let i=e[r]?.scope;if(i&&CT(i,t)){n=!0;break}}return n?e.map(e=>typeof e==`string`||!0===e?.isICellRange?e:ST(e,t)):e}(n,t.internal.getSheet()),t.internal,a)}(this._getCoordCtx(),t,n,r)}getRange(t,n){if(t===void 0)return this.getSelectedRange(n);let r=t?.scope;r!==void 0&&r!==this.getName()&&console.warn(`Sheet.getRange(${Mw(t)}) called with a scope (${r}) that does not match this sheet (${this.getName()}).`,t);let i=!n&&t&&(t.rowStart!==void 0||typeof t==`string`);if(i){if(typeof t==`string`){if(this._lastRangeRead.address===t)return this._lastRangeRead.range}else if(t.rowStart!==void 0&&FT(t,this._lastRangeRead.address))return this._lastRangeRead.range}try{let r=this._rangesToCoords(t);if(r.length>1)throw new e.s(e._(`error.address.singleRangeOnlyAlt`));let a=r[0]?.scope;a!==void 0&&a!==this.getName()&&console.warn(`Sheet.getRange(${Mw(t)}) called with a scope (${a}) that does not match this sheet (${this.getName()}).`,t);let o=this._createRange(r[0],n);return i&&(this._lastRangeRead.address={...t},this._lastRangeRead.range=o),o}catch(n){throw n instanceof e.C?new e.C(n.message):new e.s(n.message??Ah(t))}}getCell(t){if(t===void 0)return this.getSelectedCell();let n=this.getRange(t);if(n.size>1)throw new e.s(e._(`error.address.singleCellOnly`));return n.getCell()}getRanges(t,n){if(!t)throw new e.s(e._(`error.address.noAddress`));let r=this._rangesToCoords(t);if(r.length===0)throw this._createRangeError(t);return this._createRanges(r,n)}getEntireRange(e){if(!e){let e=this._entireRangeCache;return e||(e=this._createRange(this._getEntireCoords()),this._entireRangeCache=e),e}return this.getRange(this._getEntireCoords(),e)}_getEntireCoords(){let e=this._entireCoordsCache;if(!e){let t=this._getState();if(!t)return null;e=t.entireCoords,this._entireCoordsCache=e}return e}getEntireCoords(){return this._getEntireCoords()}getUsedRange(e){let t=this._getUsedCoords(e),n=t?this.getRange(t,e):null;return e||(this._lastUsedCoordsRead.coords=t,this._lastUsedCoordsRead.range=n),n}getStats(e){let t=this._getUsedCoords();return this._getRangeStats(t?[t]:[],e)}getRegions(e,t){let n=bv(e??t?.features);return new Sv(this._getEntireCoords(),this._getInternal(),n,t)}_cellToCoords(t){return function(t,n){let r=t.lastCellDecoded;if(r.address===n)return r.coords;let i=OC(t,n);if(!i||!e.l.isSingleCell(i))throw new e.s(e._(`error.address.singleCellOnly`));let a={colIndex:i.colStart,rowIndex:i.rowStart};return r.address=n,r.coords=a,a}(this._getCoordCtx(),t)}_validateCoords(t,n=e._(`error.sheet.oobRange`),r=!1){wC(this._getCoordCtx(),t,n,r)}_createRangeError(e){return TC(e)}_protectionCheck(e=null,t=null,n=null){EC(this._getCoordCtx(),e,t,n)}_rangesToCoords(e,t=null,n=!0,r=!1,i=!1){return DC(this._getCoordCtx(),e,t,n,r,i)}_rangeToCoords(e,t=null,n=!0){return OC(this._getCoordCtx(),e,t,n)}_collectRanges(e,t=[],n=!0,r=this._getState(),i){IS(this._getReadCtx(),e,t,n,i,r)}_cellIterator(e){let t=this._cellOptions,n=this._strings,r=this._cellStateIterator(e),i=e?.reuseContext?new LT(n,e,t):null;return{next(a){let o=r.next(a);if(o.done)return ei;let s=o.value,c=i??new LT(n,e,t),l=c.context;return{done:!1,value:{value:c.setState(s),context:l}}},[Symbol.iterator](){return this}}}_rangeStateIterator(e){return LS(this._getReadCtx(),e)}_overflowAndStops(e,t){return RS(this._getReadCtx(),e,t)}_cellStateIterator(t){return function(t,r){let i=t.state;if(!i)return ti;let a,o=r?.bounds,s=o??t.getEntireCoords(),c=r?.axis??n.l.Axis.Row,l=r?.reverse??!1,u=r?.includeEmpty,d={bounds:s,axis:c,reverse:l};u&&(a={bounds:s,axis:c,reverse:l});let f=r?.ignoreHidden;if(!0===f||f===n.l.Axis.Row){let e=MT(t.rowHeaders);d.processRowSkip=$r(e),u&&(a.processRowSkip=$r(e))}if(!0===f||f===n.l.Axis.Column){let e=MT(t.columnHeaders);d.processColumnSkip=$r(e),u&&(a.processRowSkip=$r(e))}let p=u||!r?.ignoreEmptyIntersections,m=r?.includeMergeOverflow??!1,h=r?.injectReferences,g=r.searchTypes;!0===g?g=Zd:g||!h&&!m||(g=e.A.EmptyObject);let _,v,y=g?LS(t,{bounds:s,axis:c,reverse:l,searchTypes:g,includeMergeOverflow:m,ignoreHidden:f,injectReferences:h,byCell:!0}):ti;if(m&&o){let n=RS(t,o);n&&(_=n.overflows,_?.sort(e.l.createCellComparator(c,l)),v=n.stops,v?.sort(e.l.createCellComparator(c,l)))}let b=_?_.length:0,x=v?v.length:0,S=0,C=0,w=i?.cellValuesGrid??null,T=w?w.entries(d):ti,E=T.next(),D=null,O=null,k=null;E.done||(D=E.value[0],O=E.value[1]);let A,j,M=_?.[S++],N=y.next(),P=null,F=c!==n.l.Axis.Row,I=e.l.createCellComparator(c,l);if(!N.done){let e=N.value;P=e.intersection,j=e.start}A=e=>{let t=null,n=null,r=null,i=!1,a=!1,o=null,s=null,c=!1;if(M&&(D?I(M,D)<0&&(c=!0):j?I(M,j)<0&&(c=!0):S<=b&&(c=!0)),c)t={colIndex:M.colIndex,rowIndex:M.rowIndex},n=M.scalar,r=M.intersection,M=_[S++];else if(D&&j){let e=I(D,j);e<0?(t=D,n=O,i=!0):e>0?(t=j,r=P,a=!0):(t=D,n=O,r=P,i=!0,a=!0)}else if(D)t=D,n=O,i=!0;else{if(!j||!p)return ei;t=j,r=P,a=!0}if(i&&(E=T.next(),E.done?D=null:(D=E.value[0],O=E.value[1])),a){let e=p?void 0:D;if(N=y.next(e),N.done)j=null,P=null;else{let e=N.value;P=e.intersection,j=e.cell}}let l=!1,u=t.rowIndex,d=t.colIndex;F||(l=u===k?.rowIndex);let f=!1;if(F||(f=u===D?.rowIndex),l)o=k;else if(m){let e=!1;for(;!e&&C<x;){let t=v[C],n=t.rowIndex;n<u?C++:(e=!0,n===u&&t.colIndex<d&&(C++,o={colIndex:t.colIndex,rowIndex:t.rowIndex}))}}if(f)s=D;else if(m){let e=!1;for(;!e&&C<x;){let t=v[C],n=t.rowIndex;n<u?C++:(e=!0,n===u&&t.colIndex>d&&(C++,s={colIndex:t.colIndex,rowIndex:t.rowIndex}))}}return(i||c)&&(k=t),{done:!1,value:[t,n,r,o,s]}};let L={next:A,return:e=>null,throw:e=>null};return u&&(L=new Ra(L,d)),L}(this._getReadCtx(),t)}_indexMerges(e,t=null){if(!(e&&e.length!==0||t&&t.length!==0))return;let n=this._getState();if(!n)return;let r=this._beginCommit({description:`indexMerges`}),i=n.mergeSpatial.clone();if(t){let e=t.length;for(let n=0;n<e;n++)i.remove(t[n])}if(e){let t=e=>this._getState().cellValuesGrid.getValueAt(e.rowStart,e.colStart),n=[],r=e.length;for(let i=0;i<r;i++){let r=e[i];n.push({...r,value:new xy(r,t)})}i.load(n)}this._updateState({mergeSpatial:i}),r.commit()}_composeDirectStyleView(e,t){let n=this._getState(),r=t??{border:n.borderSpatial,fill:n.fillSpatial,content:n.contentSpatial},i=new MS({entireCoords:this._getEntireCoords()}),a=(e,t)=>({...t,value:Dm.mergeOverlay(e.value,t.value)}),o=t=>{let n=e?t.search(e):t.all(),r=n.length;for(let e=0;e<r;e++){let t=n[e];t.value&&i.insertNonOverlapping({...t,value:t.value},{onIntersect:a})}};return o(r.content),o(r.fill),o(r.border),i}_updateStyles(e,t,n,r=!1){fC(this._getMutationCtx(),e,t,n,r)}_createSparseBuilder(t,r=null,i){let a,o,s,c=t?.axis??n.l.Axis.Row,l=t?.allowUnorderedWrites??!1,u=c===n.l.Axis.Column,d=u!==this._isDataColumn,f=this,p=this._createTupleBuilder(d),m=null;if(r){let t=r.getCoords(),n=t.colStart,i=t.rowStart,a=t.colEnd,o=t.rowEnd;m=(t,r)=>{if(t<i||t>o||r<n||r>a)throw new e.C}}u?(o=(e,t,n)=>(m?.(e,t),p.pushAt(t,e,n),a),s=(e,t,n)=>(m?.(e,t+(n?.length??0)),p.pushMultipleAt(t,e,n),a)):(o=(e,t,n)=>(m?.(e,t),p.pushAt(e,t,n),a),s=(e,t,n)=>(m?.(e+(n?.length??0),t),p.pushMultipleAt(e,t,n),a));let h=e=>{let t=p.build();return t&&f._updateTuples(t,e,null,i),r},g=!1===l?null:e.l.createCellComparator(t?.axis),_=e.A.isObject(l)?l:void 0,v=null;return a=Object.freeze({push:(e,t)=>{let n=f._cellToCoords(e);return g&&(v&&g(n,v)<=0&&(h(_),p=f._createTupleBuilder(d)),v=n),o(u?n.colIndex:n.rowIndex,u?n.rowIndex:n.colIndex,t)},pushAt:o,pushMultipleAt:s,apply:h}),a}_updateTuples(e,t,n=void 0,r=null){hC(this._getMutationCtx(),e,t,n,r)}_sort(t,r){return function(t,r,i){let a=1,o=1,s=!1,c=t._getMerges([r]);if(c.length>0){s=!0;let t=c[0];if(a=t.colEnd-t.colStart+1,o=t.rowEnd-t.rowStart+1,(r.colEnd-r.colStart+1)%a!=0||(r.rowEnd-r.rowStart+1)%o!=0)throw new e.s(e._(`error.sheet.sortMergeSize`));let n=c.length;for(let t=1;t<n;t++){let n=c[t];if(n.colEnd-n.colStart+1!==a||n.rowEnd-n.rowStart+1!==o)throw new e.s(e._(`error.sheet.sortMergeSize`))}}let l=function(t,r,i,a){let o;typeof r==`boolean`?o={sorts:[{index:0,criteria:{reverse:r}}]}:Array.isArray(r)?o={sorts:r}:(o={...r},o.sorts&&o.sorts.length!==0||(o.sorts=[{index:0}]));let s=o?.axis??n.l.Axis.Row;o.axis=s,o.hasHeader=o.hasHeader??!1,o.reverse=o.reverse??Vo.DefaultRangeOptions.reverse,o.collatorOptions=o.collatorOptions??Vo.DefaultRangeOptions.collatorOptions,o.collators=o.collators??Vo.DefaultCollators;let c=s===n.l.Axis.Row,l=t;o.hasHeader&&(l={...l},c?l.rowStart+=a:l.colStart+=i);let u=c?l.colEnd-l.colStart:l.rowEnd-l.rowStart,d=o.sorts?[...o.sorts]:[];d.length===0&&d.push({index:0});let f=d.length;for(let t=0;t<f;t++){let n=d[t]={index:t,...d[t]};if(n.index<0||n.index>u)throw new e.C(e._(`error.sort.sortOobRange`));let r=n.criteria;r!==null&&(n.criteria={reverse:r?.reverse??o.reverse,collatorOptions:r?.collatorOptions??o.collatorOptions,...r},d[t]=n)}return o.sorts=d,o}(r,i,a,o),u=l.axis,d=u===n.l.Axis.Row,f=r;l?.hasHeader&&(f={...f},d?f.rowStart+=o:f.colStart+=a);let p=d?f.colStart:f.rowStart,m=l.sorts,h=m.length;for(let e=0;e<h;e++)m[e].index+=p;let g=m[0].criteria,_=l?.description??e.v(g?.reverse?`op.sortDescending`:`op.sortAscending`);t._protectionCheck(()=>[`sort`],r,_);let v=[],y=null,b=null,x=null,S=-(2**53-1),C=Array(h),w=new Map;for(let e=0;e<h;e++)w.set(m[e],e);m.sort((e,t)=>e.index-t.index);for(let e=0;e<h;e++)C[w.get(m[e])]=e;let T=null,E=l?.includeHidden??!1;E||(T=$r(MT(d?t._rowHeaders:t._colHeaders)));let D=t._cellIterator({bounds:f,axis:u,ignoreHidden:!E&&u,searchTypes:{[q.Type.FillStyle]:!1,[q.Type.ContentStyle]:!1,[q.Type.DateFormat]:!1,[q.Type.Continuous]:!1,[q.Type.Merge]:!1}}),O=d?o:a,k=(d?f.rowStart:f.colStart)-O,A=D.next();for(;!A.done;){let e=A.value.context,t=e.getCell();if(s&&!t.isTopLeft()){A=D.next();continue}let n=e.getCoords(),r=d?n.rowIndex:n.colIndex,i=d?n.colIndex:n.rowIndex;if(k!==r){for(k+=O,T&&(k=T(k));k<r;)v.push(null),k+=O;b=[],x=[],y={minorIndex:r,values:b,sortValues:x},v.push(y),k=r,S=m[0].index}for(;i>S;){let e=m[x.length];S=e?e.index:2**53-1,i>S&&x.push(null)}i===S&&x.push(t),b.push(t),A=D.next()}if(!y||v.length===0)return;let j=new Map,M=new Map,N=l.collators,P=N.length;for(let e=0;e<P;e++){let t,n=N[e],r=n.type;typeof n==`string`||(t=n.compare),j.set(r,t),M.set(r,e)}let F,I,L,ee,te=t.getRuntime().getLocaleProfile(),R=te.tag,z=null,ne=null,re=null;v.sort((e,t)=>{let r=m.length;for(let i=0;i<r;i++){let r=C[i],a=m[r],o=e?e.sortValues[r]:null,s=t?t.sortValues[r]:null,c=o?o.getValue():null,l=s?s.getValue():null,u=c===null,d=l===null;if(c===l)continue;if(u&&d)return 0;if(!u&&d)return-1;if(u&&!d)return 1;let f=o.getType(),p=s.getType();if(f===n.n.Error&&p===n.n.Error)return 0;let h=0,g=a.criteria;if(f!==p){let e=0;f===F?e=L:(e=M.get(f),F=f,L=e);let t=0;p===I?t=ee:(t=M.get(p),I=p,ee=t),h=e-t}else{let e=ne;if(z!==f){if(e=j.get(f),ne=e,!e)continue;z=f;let t=0;p===I?t=ee:(t=M.get(p),I=p,ee=t);let n=N[t]?.defaultOptions;re={...te.collator,...n,...g?.collatorOptions,locale:R}}h=e(c,l,re)}return g?.reverse&&(h*=-1),h}return 0});let B=t._beginCommit({description:_}),ie=t._getState().borderSpatial,ae=[f];E||(ae=t._getVisible(ae,{axes:d?n.l.AxisSelection.Row:n.l.AxisSelection.Column})),t._clear(ae,void 0,void 0,!0);let oe=t._createSparseBuilder({axis:u}),se=d?f.rowStart:f.colStart,ce=v.length;for(let e=0;e<ce;e++){let t=v[e];if(T&&(se=T(se)),t){let e=t.values,n=e.length;for(let t=0;t<n;t++){let n=e[t],r=n.getCoords(),i=d?se:r.rowIndex,a=d?r.colIndex:se;oe.pushAt(i,a,n)}}se+=O}return oe.apply(),t._updateState({borderSpatial:ie}),B.commit(),f}(this,t,r)}_filter(t,r,i){return async function(t,r,i,a){let o=function(e){return e?typeof e==`object`&&Array.isArray(e.conditions)?e:{conditions:[e]}:{conditions:[]}}(i),s=o.axis??n.l.Axis.Row,c=s===n.l.Axis.Row,l=[],u=[];await async function(e){let t=e.coords,r=e.axis??n.l.Axis.Row,i=r===n.l.Axis.Row,a=i?t.rowStart:t.colStart,o=i?t.rowEnd:t.colEnd;e.hasHeader&&(a+=1);let s=e.conditions,c=s?s.length:0,l=[],u=e.getHiddenRuns;if(u){let t=e.includeHidden??!0;!0!==t&&t!==r&&(l=u(r).slice())}if(a<=o)for(let r=0;r<c;r++){let c=s[r],u=Fg.resolveInput(c);if(!u)continue;let d=c?.index,f=typeof d==`number`?d:r,p=(i?t.colStart:t.rowStart)+f,m=i?{rowStart:a,rowEnd:o,colStart:p,colEnd:p}:{rowStart:p,rowEnd:p,colStart:a,colEnd:o},h=Mg(l,a,o).map(e=>i?{rowStart:e.min,rowEnd:e.max,colStart:p,colEnd:p}:{rowStart:p,rowEnd:p,colStart:e.min,colEnd:e.max}),g={bounds:m,axis:i?n.l.Axis.Column:n.l.Axis.Row};if(l.length>0){let e=$r(l);i?g.processRowSkip=e:g.processColumnSkip=e}let _=[],v=[],y=(e,t)=>{let n=i?e.rowIndex:e.colIndex;_.push(n),t&&v.push(n)};await Ag(u,{runtime:e.runtime,values:e.values,coords:m,cellValuesOptions:g,calculation:e.calculation,visibleCoords:h,onTrue:e=>y(e,!1),onFalse:e=>y(e,!0)});let b=Wr(v,!0);if(u.isIncludeBlanks())l=Ng(l,b);else{let e=Mg(Ng(l,Wr(_,!0)),a,o);l=Ng(l,b,e)}}if(a<=o){let t=e.onHiddenRun;if(t)for(let e=0;e<l.length;e++)t(l[e]);let n=e.onVisibleRun;if(n){let e=Mg(l,a,o);for(let t=0;t<e.length;t++)n(e[t])}}}({runtime:t.getRuntime(),calculation:t._calculation,values:t._getState().cellValuesGrid,coords:r,conditions:o.conditions,axis:s,hasHeader:o.hasHeader,includeHidden:o.includeHidden,getHiddenRuns:e=>MT(e===n.l.Axis.Row?t._rowHeaders:t._colHeaders),onVisibleRun:e=>{l.push({...e})},onHiddenRun:e=>{u.push({...e})}});let d=a?.description??e.v(`op.filter`),f=c?t._rowHeaders:t._colHeaders,p=t._beginCommit({description:d,...a});try{l.length>0&&f._setHidden(l,!1,{description:d}),u.length>0&&f._setHidden(u,!0,{description:d}),p.commit()}catch(e){throw p.rollback(),e}return r}(this,t,r,i)}_autoFill(e,t,n){return SC(this._getMutationCtx(),e,t,n)}_autoFillRange(e,t){return function(e,t,r){let{direction:i,amount:a}=RT(t,r);if(a<=0)return{...r};let o=e.getMerges([t]);if(o.length===0)return{...r};let s=i===n.l.Direction.Up||i===n.l.Direction.Down,c=i===n.l.Direction.Down||i===n.l.Direction.Right,l=s?t.rowStart:t.colStart,u=(s?t.rowEnd:t.colEnd)-l+1,d=yC(o,l,u,s,c),f=e.getEntireCoords(),p=c?s?f.rowEnd-t.rowEnd:f.colEnd-t.colEnd:s?t.rowStart-f.rowStart:t.colStart-f.colStart,m=function(e,t,n){let r=e-e%t,i=e%t;for(let e=0;e<n.length;e++)if(n[e]>=i)return r+n[e];return r+t}(a,u,d);return m>p&&(m=function(e,t,n){if(e<0)return 0;let r=e-e%t,i=e%t;for(let e=n.length-1;e>=0;e--)if(n[e]<=i)return r+n[e];return r}(p,u,d)),m<=0?{...t}:s?c?{...t,rowEnd:t.rowEnd+m}:{...t,rowStart:t.rowStart-m}:c?{...t,colEnd:t.colEnd+m}:{...t,colStart:t.colStart-m}}(this._getMutationCtx(),e,t)}_autoFillShrink(e,t,n,r){return CC(this._getMutationCtx(),e,t,n,r)}_setHyperlinks(e,t,n){dC(this._getMutationCtx(),e,t,n)}_realizeCalcedValues(t){if(!t)return;let r=this._getState();if(!r)return;this._errorEpoch++;let i=t.valueInserts,a=t.spillRemoves,o=t.errorRemoves,s=r.cellValuesGrid,c=this._beginCommit(e.v(`op.realizeCalcs`));t.isFull&&(r.calcErrorsSpatial.clear(),r.spillSpatial.clear(),r.pendingSpatial.clear());let l=t.valueRemoves;if(l){let e=r.contentfulSpatial,t=l.length;for(let n=0;n<t;n++){let t=l[n];s.delete(t),e.insertNonOverlapping({...t,value:null})}}if(a){let e=r.spillSpatial,t=a.length;for(let n=0;n<t;n++){let t=a[n];e.remove(t)}}if(o){let e=r.calcErrorsSpatial,t=o.length;for(let n=0;n<t;n++){let t=o[n];e.remove(t)}}let u=t.formatInserts;if(u){let e=u.length;for(let t=0;t<e;t++){let e=u[t];e.value={numberFormat:e.value}}this._updateStyles(u,void 0,{autoFit:!0},!0)}if(i){let e=i.tuples;s.setValues(e),this._rangeStats.clear();let t=this._isDataColumn,a=t?n.l.Axis.Column:n.l.Axis.Row,o=r.contentfulSpatial,c=e.length;for(let n=0;n<c;n++){let r=e[n],i=r[0],s=r[1],c=s.length;for(let e=0;e<c;e++){let n=s[e],r=n[0],c=r+n[1].length-1,l={colStart:t?i:r,rowStart:t?r:i,colEnd:t?i:c,rowEnd:t?c:i};o.insertNonOverlapping({colStart:l.colStart,rowStart:l.rowStart,colEnd:l.colEnd,rowEnd:l.rowEnd,value:new uu(l,a)})}}}let d=t.spillInserts;if(d){let t=d.length;for(let n=0;n<t;n++){let t=d[n],r=t.value;t.value=new lu(e.l.sanitizeRange(t),0,r)}r.spillSpatial.load(d)}let f=t.pendingUpdates;if(f){let e=r.pendingSpatial,t=f.length;for(let n=0;n<t;n++){let t=f[n];!1===t.value&&(t.value=null),e.insertNonOverlapping(t)}}let p=t.errorInserts;if(p&&r.calcErrorsSpatial.load(p),c.commit({forceAmend:!0,viewAfter:{calculationSideEffect:!0}}),(t.bounds||t.isFull)&&!this._initializing){this._invalidateCaches(),this._notifyUsedRangeChange();let e=this._rangesListenerMap;if(e.size>0){let n={isDataChange:!0,getTransactionId:Uw,timeStamp:Date.now(),isUndo:!1,trigger:`calc`};this._notifyRangeListeners(this._rangeListenerSpatial,e,[t.bounds??this._getEntireCoords()],n)}(d||a)&&this._notify(`onSpillsChange`),this._notify(`onDataChange`)}}calculate(e){return this._calculation.calculate({full:e,scope:this._getState().calcGrid.getId()})}_calculate(e,t){let n=this._getState().calcGrid;n.markDirtyRegions(e),this._calculation.calculate({...t,scope:n.getId()})}_calculateFull(){this._ownCalculation&&!this._initializing&&this._calculation.calculate(!0)}_setComments(e,t,n){uC(this._getMutationCtx(),e,t,n)}_clear(e,t=null,n,r=!1,i=!1){vC(this._getMutationCtx(),e,t,n,r,i)}_merge(e,t=null){pC(this._getMutationCtx(),e,t)}_unmerge(e,t){mC(this._getMutationCtx(),e,t)}_getMerges(t,n=!1){if(t.length===0)return e.A.EmptyArray;let r=this._getState();return r?this._getRangedEntries(r.mergeSpatial,t,{ignoreHidden:n,fullyContained:!1,onEntry:e=>e.getCoords()}):e.A.EmptyArray}_clone(){let e={...this._options,container:{getName:()=>`Snapshot of ${this.getName()}`,getIndex:()=>1}};this._ownStyles&&(e.styles=this._styles),this._ownStrings&&(e.strings=this._strings),this._ownResources&&(e.resources=this._resources),this._ownNames&&(e.names=this._names),this._ownCalculation&&(e.calculation=this._calculation),e.transactions=new m({transient:!0});let n=new t(e),r=this._transactions.getState(this._stateId);n._updateState(r);let i=new FC({sheet:this,json:this.getView().toJSON()});return i.selectMovables(this.getView().getMovableSelection()),n.setView(i),n}_getSnapshot(t,n,r){if(t.length===0)return e.A.EmptyArray;let i=this._getState();if(!r){let e=this._transactions.getCurrentCommit().getId();e&&(r=()=>e)}if(!i)return null;n=Object.freeze({...n});let a=this._clone();a.isMarked=!0;let o=this,s=o.getView(),c=e.v(`op.range`),l=[];if(t.length>1)throw new e.s(e._(`error.sheet.copyMultipleRanges`));let u=UT(t,a._getState().mergeSpatial,a.getEntireCoords()),d=function(t,n,r,i){let a=[],o=null,s=null,c=r&&r.length>0;if(c){let e=r.length;for(let t=0;t<e;t++){let e=r[t].getSnapshot?.(i);e&&(a.push(e),o=Yx(e.getCoords(),o))}}else if(n){let r=n.length;for(let c=0;c<r;c++){let r=n[c],l=t.getMovables().getItems({ignoreHidden:!1,fullyContained:!0,address:r}),u=l.length;for(let n=0;n<u;n++){let c=l[n].getSnapshot?.(i);c&&(a.push(c),o=Yx(t.getRange(r).getBounds(),o),s=e.l.unionRanges(s,r))}}}if(a.length===0)return null;let l=()=>i.description??(a?.length===1?x(a[0]?.getName()):`Drawings`);return{copyTo:async(n,r)=>{let s={...i,...r},c=n.getSheet(),u=c.getView(),d=u.getMovableSelection(),f=n.getCoords(),p=s?.isCut??!1,m=u.getMovableSelection();u.selectMovables([]);let h=c.beginCommit(s.description??e._(p?`op.cutNamed`:`op.copyNamed`,{name:l()}));try{let e=0,n=0;if(m.length>0&&a.length>0){let t=2**53-1,r=2**53-1;for(let e=0;e<d.length;e++){let n=d[e].getBounds();t=Math.min(n.x,t),r=Math.min(n.y,r)}let i=2**53-1,o=2**53-1,s=a.length;for(let e=0;e<s;e++){let t=a[e].getCoords();i=Math.min(t.x,i),o=Math.min(t.y,o)}e=t-i,n=r-o;let l=a[0].getCoords(),u={...l,x:l.x+e,y:l.y+n},f=w_(c.getMovables(),u);e+=f.x,n+=f.y}else if(o){let t=c.getRange(f).getBounds();e=t.x-o.x,n=t.y-o.y}let r=[],i=a.length;for(let t=0;t<i;t++){let i=a[t],o=i.getCoords(),l={...o,x:o.x+e,y:o.y+n};r.push(i.copyTo({movables:c.getMovables(),bounds:l},{autoSelect:{addToSelection:!0},...s}))}await Promise.all(r),h?.updateState(c._getStateId(),{}),h.commit({viewBefore:e=>({...e,view:t.getView(),movableSelection:m})})}catch(e){throw h.rollback(),e}return null},getName:l,getCoords:()=>s,getMarkOptions:()=>i,toText:()=>c?a[0].toText?.()??null:null,toHtml:()=>c?a[0].toHtml?.()??null:null,toImage:()=>c?a[0].toImage?.()??null:null,getSource:()=>t,isISnapshot:!0}}(a,u,s.getMovableSelection(),n);if(d){if(s.getMovableSelection().length>0)return d;l.push(d)}let f={singleMerge:null};l.push({copyTo(r,i){let o={...n,...i},s=r.getSheet(),c=r.getCoords(),l=c,u=s.getRange(l),d=!1,p=u.getMerges();if(p.length===1&&e.l.isEqualRanges(p[0],c))if(e.l.isSingleCell(t[0]))d=!0;else{let t=O_(b);a._getMerges([e.l.cellToRange(t)]).length===1&&(d=!0)}return d?(f.singleMerge=c,u.clear(o.type??qg.Content.Values)):u.clear(o.type),l}});let p=a._getEntireCoords(),m=u.length;for(let e=0;e<m;e++){let t=u[e],o=i.rangeListenerSpatial.search(t,!1),s=i.rangesListenerMap;l.push({async copyTo(e,t){if(!t?.isCut)return null;let n=new Set,i=o.length;for(let t=0;t<i;t++){let i=o[t].value,c=i.id;if(n.has(c))continue;let l=s.get(c);if(n.add(c),l.ranges[i.offset]===null)return null;let d={getTransactionId:r,isDataChange:!1,trigger:`moveCells`,from:a.getRanges(u),to:e},f=a._createRangeEvent(l.ranges,d);a._notifyRangeListener2(l,f,d)}return null},getMarkOptions:()=>n,getCoords:()=>null,isISnapshot:!0})}let h={ignoreHidden:!1,fullyContained:!0,onEntry:e=>e.model},g=a._getState();if(!g)return e.A.EmptyArray;for(let e=0;e<m;e++){let t=u[e],r=a._getRangedEntries(g.tables,[t],h),i=r.length;for(let e=0;e<i;e++){let i=r[e],o=i.getRange().getCoords(),s=o.colStart-t.colStart,c=o.rowStart-t.rowStart,u=i.getSnapshot(n);l.push({async copyTo(e,t){let n=e.getSheet(),r=e.getCoords();if(a.getProtection().isLocked())return null;let i={colStart:r.colStart+s,rowStart:r.rowStart+c,colEnd:r.colEnd+s,rowEnd:r.rowEnd+c};return u.copyTo({tables:n.getTables(),range:i},t)}})}}for(let e=0;e<m;e++){let t=u[e];l.push(yS(o.getColumnHeaders().getRange(t),t,Object.freeze({...n,includeHeaders:t.rowStart<=p.rowStart&&t.rowEnd>=p.rowEnd})))}for(let e=0;e<m;e++){let t=u[e];l.push(yS(o.getRowHeaders().getRange(t),t,Object.freeze({...n,includeHeaders:t.colStart<=p.colStart&&t.colEnd>=p.colEnd})))}let _=function(t,n,r,i,a,o){let s,c,l=r[0],u=t.getView()?.isShowFormulas()??!1,d=()=>{if(c!==void 0)return;let[t,r]=function(t,n){let r=n.getRowHeaders(),i=n.getColumnHeaders(),a=n.getUsedRange()?.getCoords(),o=r.getUsedRange()?.getCoords(),s=i.getUsedRange()?.getCoords(),c={...e.l.EmptyRange,...a,colEnd:Math.max(a?.colEnd??0,s?.max??0),rowEnd:Math.max(a?.rowEnd??0,o?.max??0)},l=new Map,u=[];t.onStart?.();let d={rows:[],cols:[]},f=new lS(l,u);f.setNode(d),t.onTable?.(f,c);let p=0;i.forEachSpan((e,n)=>{let r=n.getCoords();p=p+r.max-r.min+1;let i={};f.setNode(i),t.onColumn?.(n.getCellHeader(),r.min,r.max-r.min+1,f),d.cols.push(i)},{address:c,includeEmpty:!0,includeStyles:!0});let m=0,h=[];if(r.forEachSpan((e,t)=>{let n=t.getCoords();m=m+n.max-n.min+1,h.push({min:n.min,max:n.max,value:t.getCellHeader()})},{address:c,includeEmpty:!0,includeStyles:!0,visibility:`all`}),p*m>5e4)return[null,`The data you've selected is too large. Try selecting a smaller set of data.`];let g=0,_=-1,v=null;n.forEach((e,n)=>{let r=n.getCoords(),i=n.getCell();if(r.rowIndex!==_){r.rowIndex>h[g].max&&++g;let e=h[g];v={cells:[]},f.setNode(v),t.onRow?.(e.value,r.rowIndex,1,f),d.rows.push(v),_=r.rowIndex}let a={};f.setNode(a),!1!==t.onCell(i,r,f)&&v.cells.push(a)},{address:c,includeEmpty:!0,ignoreHidden:!1}),t.onDone?.(),d.rows.length===0&&d.rows.push({cells:[]});let y=[];for(let e=0;e<u.length;e++){let t=u[e],n=l.get(t);y.push(t);let r=``,i=Object.keys(n);for(let e=0;e<i.length;e++){r+=` `,e===0&&(r+=`{`);let t=i[e];r+=`${t}:${n[t]};`,e===i.length-1?r+=`}`:r+=`
|
|
5
|
-
`}y.push(r)}let b=[`<div clipboard-uuid=xxx>
|
|
6
|
-
<html
|
|
7
|
-
xmlns:v="urn:schemas-microsoft-com:vml"
|
|
8
|
-
xmlns:o="urn:schemas-microsoft-com:office:office"
|
|
9
|
-
xmlns:x="urn:schemas-microsoft-com:office:excel"
|
|
10
|
-
xmlns="http://www.w3.org/TR/REC-html40"
|
|
11
|
-
>`];b.push(`<head>
|
|
12
|
-
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
|
|
13
|
-
<meta name=ProgId content=Excel.Sheet>
|
|
14
|
-
<meta name=Generator content="Microsoft Excel 15">`),b.push(`<style>
|
|
15
|
-
table
|
|
16
|
-
{mso-displayed-decimal-separator:"\\.";
|
|
17
|
-
mso-displayed-thousand-separator:"\\,";}
|
|
18
|
-
@page
|
|
19
|
-
{margin:.75in .25in .75in .25in;
|
|
20
|
-
mso-header-margin:.3in;
|
|
21
|
-
mso-footer-margin:.3in;
|
|
22
|
-
mso-horizontal-page-align:center;}
|
|
23
|
-
tr
|
|
24
|
-
{mso-height-source:auto;}
|
|
25
|
-
col
|
|
26
|
-
{mso-width-source:auto;}
|
|
27
|
-
br
|
|
28
|
-
{mso-data-placement:same-cell;}`),y.length>0&&b.push(y.join(`
|
|
29
|
-
`)),b.push(`</style>`),b.push(`</head>`),b.push(`<body>`),b.push(`<table>`),b.push(`<!--StartFragment-->`);let x=e=>{let t=(e=>{let t=``;return e&&e.attributes&&e.attributes.length!==0&&e.attributes.forEach((e,n)=>{t.length>0&&(t+=` `),t+=`${n}=${e}`}),t})(e);t.length>0&&(t=` `+t);let n=(e=>{let t=``;return e&&e.styles&&e.styles.length!==0?(e.styles.forEach((e,n)=>{t.length>0&&(t+=`;`),t+=n+`:`+e}),t.length>0&&(t=`style='${t}'`),t):t})(e);return n.length>0&&(n=` `+n),`${t}${n}`},S=[];return d.cols?.forEach(e=>{b.push(` <col${x(e)}>`)}),d.rows.forEach(t=>{b.push(` <tr${x(t)}>`);let n=[];t.cells.forEach(t=>{b.push(` <td${x(t)}>${t.htmlText??t.plainText??``}</td>`);let r=`${e.A.castToString(t.plainText??``)?.replace(/"/g,`""`)}`;n.push(r)}),S.push(n.join(` `)),b.push(` </tr>`)}),b.push(`<!--EndFragment-->`),b.push(`</table>`),b.push(`</body>`),b.push(`</html>`),b.push(`</div>`),[b.join(`
|
|
30
|
-
`),S.join(`
|
|
31
|
-
`).concat(`
|
|
32
|
-
`)]}(new hS(n,{showFormulas:u}),n.getRange(l));s=t??null,c=r??null},f=!1;return{copyTo(t,n){let r={...a,...n};if(n?.isCut&&f)throw f=!0,Error(e._(`error.sheet.snapshotDone`));return o(t,r)},getMarkOptions:()=>a,getSource:()=>t,getName:()=>e._(i),getCoords:()=>l,toText:()=>(d(),c),toHtml:()=>(d(),s),toImage:()=>null,isISnapshot:!0}}(o,a,u,c,n,(e,t)=>a._copyRange(o,a,u,e,t,f));l.push(_);let v=a._getState().calcGrid.getSnapshot({range:u[0]});l.push({async copyTo(e,t){if(t?.type&&t?.type!==qg.Content.Formulas)return null;let r=e.getSheet(),i=e.getCoords();if(a.getProtection().isLocked())return null;let o=r._getState().calcGrid,s=v.copyTo({calcGrid:o,range:i},t);return{...n,...t}.isCut,s}});let y={ignoreHidden:!1,fullyContained:!1};for(let t=0;t<m;t++){let r=u[t],i=a._getRangedEntries(g.conditionalFormats,[r],y,!0),s=i.length;for(let t=0;t<s;t++){let s=i[t],c=s.getRanges().getCoords(),u=[];for(let t=0;t<c.length;t++){let n=e.l.intersectRanges(c[t],r);n&&u.push(n)}if(u.length===0)continue;let d=s.getSnapshot(n),f=t;l.push({async copyTo(e,t){let i={...n,...t};if(i.type&&i.type!==qg.Content.Formats||a.getProtection().isLocked())return null;let s=e.getSheet(),c=vS(u,r,e.getCoords(),!!i.transpose);return c.length===0?null:d.copyTo({conditionals:s.getConditionalFormats(),range:c[0],ranges:c,extend:s===o,index:f},t)}})}let c=a._getRangedEntries(g.dataValidations,[r],y,!0),d=c.length;for(let t=0;t<d;t++){let i=c[t],s=i.getRanges().getCoords(),u=[];for(let t=0;t<s.length;t++){let n=e.l.intersectRanges(s[t],r);n&&u.push(n)}if(u.length===0)continue;let d=i.getSnapshot(n),f=t;l.push({async copyTo(e,t){let i={...n,...t};if(i.type||a.getProtection().isLocked())return null;let s=e.getSheet(),c=vS(u,r,e.getCoords(),!!i.transpose);return c.length===0?null:d.copyTo({validations:s.getDataValidations(),range:c[0],ranges:c,extend:s===o,index:f},t)}})}}let b=u[0];return function(t,n,r,i,a,o,s=null){return{async copyTo(n,i){let s=null,c={...a,...i},l=r.beginCommit(c.description??o);try{let r=t.length;for(let i=0;i<r;i++){let r=await t[i].copyTo(n,c);r&&(s=e.l.unionRanges(s,r))}l.commit()}catch(e){throw l.rollback(),e}return s},getMarkOptions:()=>a,getName:()=>o,getSource:()=>n,getCoords:()=>i,toText(){let e=s?.toText?.()??null,n=t.length;for(let r=0;!e&&r<n;r++)e=t?.[r].toText?.();return e??null},toHtml(){let e=s?.toHtml?.()??null,n=t.length;for(let r=0;!e&&r<n;r++)e=t?.[r].toHtml?.();return e??null},toImage(){let e=s?.toImage?.()??null,n=t.length;for(let r=0;!e&&r<n;r++)e=t?.[r].toImage?.();return e??null},isISnapshot:!0}}(l,o,a,b,n,c,_)}async _copyRange(t,r,i,a,o,s){if(i.length>1)throw new e.s(e._(`error.sheet.insertCopyMultipleRanges`));if(!i||i.length===0)throw new e.s(e._(`error.sheet.copyNoSource`));let c=a.getSheet(),l=a.getCoords(),u={...i[0]},d=(o={...o}).isCut,f=!o.type||o.type===qg.Content.Formats,p=!o.type||o.type===qg.Content.Values,m=!o.type||o.type===qg.Content.Formats||o.type===qg.Content.Hyperlinks,h=c.getEntireRange(),g=h.getCoords(),_=[],v=[],y=[],b=[],x=[],S=(o.fitDestination??!1)&&!e.l.isSingleCell(l),C=l;if(S&&(u={...u,colEnd:u.colStart+Math.min(C.colEnd-C.colStart,u.colEnd-u.colStart),rowEnd:u.rowStart+Math.min(C.rowEnd-C.rowStart,u.rowEnd-u.rowStart)}),!e.l.isRangeWithinRange(C,g))throw console.warn(C,g),new e.s(e._(`error.sheet.pasteOob`));let w=null;w=o.undoRange?{view:c.getView(),selection:I_([o.undoRange.getCoords()])}:{sheet:c,selection:I_([C])};let T=c.getTransactions().beginCommit({description:o.description??e.v(`op.paste`)});try{if(!this._getState())return e.A.EmptyArray;let i=new Set,a=o.transpose,g=!((a||o.adjustCells)&&f)&&i.size===1;if(g){let t=i.values().next();g=e.l.isRangeWithinRange(u,t.value.getCoords())&&!FT(u,t.value.getCoords())}g&&=c.getTables().getItems({address:C}).length===0,a&&(g=!0),s.singleMerge&&(f=!1,m=!1);let S=l.colStart-u.colStart,E=l.rowStart-u.rowStart,D=o.adjustCells,O={...Qd};if(delete O[q.Type.BorderStyle],delete O[q.Type.FillStyle],delete O[q.Type.ContentStyle],!f){let e=this.getProtection().isLocked();O={},e&&(O[q.Type.Unlock]=!1)}let k,A=n.l.Axis.Column;if(p){k=h.createSparseBuilder({axis:o.transpose?n.l.Axis.Row:n.l.Axis.Column});let t={axis:A,searchTypes:O,bounds:u},r=new LT(this._strings,t,this._cellOptions),i=(e,t,n)=>{let i=e[0],s=r.setState(e),c=r.context,d=c.getCell(),h=d.isTopLeft(),v=E,y=S;if(a){let e=i.colIndex-u.colStart,r=i.rowIndex-u.rowStart;v=e+n+l.rowStart,y=r+t+l.colStart}else v=E+i.rowIndex+t,y=S+i.colIndex+n;let b=!1,x={value:void 0,style:void 0,hyperlink:void 0};if(p&&(x.value=s,b=!0),f){let t=e[2];t&&(t.borderStyle||t.fillStyle||t.contentStyle||t.table)&&(x.style=d.getStyle(!g),b=!0)}m&&(x.hyperlink=d.getHyperlink(),b=!0);let C=x;if(D&&h){let e=D(s,c,{rowIndex:v,colIndex:y},o);e!==void 0&&(C=e,b=!0)}if(b&&(k.pushAt(v,y,C),f)){let e=d.getSpans();(e.width>1||e.height>1)&&h&&_.push({colStart:y,rowStart:v,colEnd:y+(o.transpose?e.height:e.width)-1,rowEnd:v+(o.transpose?e.width:e.height)-1})}},c=this._cellStateIterator(t),d={next(){let e=c.next();if(e.done)return ei;let t,n=e.value[0];return e.value&&(t=[n,e.value]),{done:e.done,value:t}}};if(!s.singleMerge&&!e.l.isEqualRanges(C,u)){let e=C.colEnd-C.colStart+1,t=C.rowEnd-C.rowStart+1;d=new za({delegate:d,bounds:u,axis:A,dims:{major:o.transpose?t:e,minor:o.transpose?e:t}})}let v=d.next();for(;!v.done;){let e=v.value,t=e[1],n=e[0],r=t[0];i(t,n.rowIndex-r.rowIndex,n.colIndex-r.colIndex),v=d.next()}}let j=r._getState(),M={},N={transpose:a??!1};f&&(M.borderSpatial=j.borderSpatial,M.fillSpatial=j.fillSpatial,M.contentSpatial=j.contentSpatial,M.continuousFillSpatial=j.continuousFillSpatial,M.mergeSpatial=j.mergeSpatial),d&&(t._clear([u],void 0,void 0,!1,!0),b.push(u),M.rangesListenerSpatial2=j.rangesListenerSpatial2);let P=c,F=P._getState(),I=Object.keys(M),L=I.length;for(let e=0;e<L;e++){let t=I[e],n=M[t].createCopiedEntries(u,C,N),r=F[t].clone(),i=n.removes,a=i.length;for(let e=0;e<a;e++)r.remove(i[e]);r.load(n.inserts),F[t]=r}P._updateState(F),b.push(C),x.push(C),v&&v.length>0&&P._colHeaders.updateHeaderPairs(v),y&&y.length>0&&P._rowHeaders.updateHeaderPairs(y),k?.apply(),_.length>0&&c.getRanges(_).merge(),T.commit({viewBefore:w,viewAfter:e=>({...e,view:c.getView(),selection:I_(x),ranges:b})})}catch(t){throw console.warn(t),T.rollback(),Error((E=t.message,e._(`error.sheet.paste`,{message:E})),{cause:t})}var E;return e.l.unionRangesArrays(x)}_snapShotFromSource(t,n){if(t.isISnapshot)return t;let r=t,i=null;if(r?.isICellRanges)throw new e.s(e._(`error.sheet.copyMultipleRanges`));if(r?.isICellRange)i=r;else{let e=this.getWorkbook();i=typeof r==`string`&&r.includes(`!`)&&e?e.getRange(r):this.getRange(r)}if(i.isICellRange){let t=i;if(t.isInvalid())throw new e.s(e._(`error.sheet.copyInvalidSource`));return t.getSnapshot(n)}throw new e.s(e._(`error.sheet.copyInvalidSource`))}async _copyFrom(t,n,r){if(!n)throw new e.s(e._(`error.sheet.copyMissingArgs`));let i=this._snapShotFromSource(n,r),a=e.v(`op.paste`),o=this._beginCommit({description:r?.description??a}),s=null;try{let n=j_(t,i.getCoords(),r?.fitDestination,r?.transpose),c=this.getRange(n);s=await i.copyTo(c,r);let l=i.getName?.(),u=[s];r?.isCut&&u.push(i.getCoords()),o.commit({description:l?r?.description??e._(`op.pasteNamed`,{name:l}):a,viewAfter:{view:this.getView(),selection:I_([s??n]),ranges:u}})}catch(e){throw o.rollback(),e}return s}addAutoTable(t,n){t||=this.getSelectedRange().getCoords();let r=this._rangeToCoords(t);if(r=this._surroundingRegion(r,{contentOnly:!0}),e.l.isSingleCell(r)&&!this._isContentful([r]))throw new e.s(e._(`error.sheet.tableEmpty`));r=this._rangeToCoords(r,()=>[`sort`,`autoTable`]);let i=this._getEntireCoords();if(r.rowStart===r.rowEnd){if(r.rowEnd===i.rowEnd)throw new e.s(e._(`error.sheet.table1By1`));r.rowEnd+=1}let a,o=I_([r]),s={...r},c=e.v(`op.insertAutoTable`),l=this._beginCommit({description:n?.description??c});try{let e={...n?.properties,style:null};this._validateOrRemoveOverlaps(r,`table`,null,n?.replaceExisting??!1);let t=this,i=this._getState(),c=i.autoTables;c=this._createTables(c,`autoTables`,[{r,v:e}],e=>{let t=new d_(e);return a=t,t},e=>e.addListeners({onDelete:()=>{let n=i.autoTables;n=n.deleteModel(e),t._updateState({autoTables:n}),t._notify(`onAutoTableChange`)}},{once:!0})),this._updateState({autoTables:c}),this._notify(`onAutoTableChange`),this._notify(`onTablesChange`);let u=I_([r]);l.commit({viewBefore:{view:this.getView(),selection:o,ranges:[s]},viewAfter:{view:this.getView(),selection:u,ranges:[r],table:a}})}catch(e){throw l.rollback(),e}return a}getAutoTable(){let e=this._getState();if(!e)return null;let t=e.autoTables.all();return t.length===0?null:t[0]}_getDefaultShiftAxis(e){return function(e,t){if(t){if(e.colStart<=t.colStart&&e.colEnd>=t.colEnd)return n.l.Axis.Row;if(e.rowStart<=t.rowStart&&e.rowEnd>=t.rowEnd)return n.l.Axis.Column}return e?function(e){return e.rowEnd-e.rowStart>e.colEnd-e.colStart?n.l.Axis.Column:n.l.Axis.Row}(e):n.l.Axis.Row}(e,this._getEntireCoords())}_getTables(t,n=!1,r=!1){let i=t?this._rangeToCoords(t):this._getEntireCoords(),a=this._getState();return a?this._getRangedEntries(a.tables,[i],{ignoreHidden:n,fullyContained:r,onEntry:e=>e.model}):e.A.EmptyArray}_getDefaultSortCriteria(t,r=n.l.Axis.Row,i){let a=(i?this._cellToCoords(i):null)??O_(t),o=e.l.cellToRange(a),s=this._getTables(o)[0]??null;if(!s){let e=this.getAutoTable();e&&e.getRange().getIntersect(o)&&(s=e)}let c=BT(this,t,a,r);if(s){let e=s.getActiveSorts(),t=[];for(let n=0;n<e.length;n++)t.push({index:e[n].getIndex(),criteria:e[n].getCriteria()});let n=s.getRange().getCoords(),r=s.getSortAt(a.colIndex-n.colStart),i=r.getCriteria();t.length===0&&t.push({index:r.getIndex(),criteria:i}),c.options.sorts=t,i!==null&&(c.options.reverse=i.reverse,c.options.collatorOptions=i.collatorOptions);let o=new Map;if(s.isShowHeaders()){let e=s.getColumns();for(let t=0;t<e.length;t++)o.set(t,e[t].getName())}c.headers=o,c.options.hasHeader=s.isShowHeaders()}return c}async _insertFrom(t,r,i){if(!r)throw new e.O;let a=this._snapShotFromSource(r),o=a.getCoords(),s=j_(t[0],o,i?.fitDestination),c=I_([s]),l=c,u=i?.axis??this._getDefaultShiftAxis(s),d=this._beginCommit({description:i?.description??e.v(`op.insertCopiedCells`),autoSelect:i?.autoSelect});try{if(this._insertCells([s],u),await this._copyFrom(s,a,{...i,isCut:!1}),i?.isCut){let t={...o};if(c=I_([t]),s={...s},this===a.getSource()){if(u===n.l.Axis.Row){if(s.colStart<t.colStart&&s.colEnd>=t.colStart||s.colEnd>t.colEnd&&s.colStart<=t.colEnd)throw new e.s(e._(`error.sheet.insertCutOverlap`));if(t.colStart===s.colStart&&t.colEnd===s.colEnd){let e=t.rowEnd-t.rowStart+1;s.rowStart<=t.rowStart?(t.rowStart+=e,t.rowEnd+=e):(s.rowStart-=e,s.rowEnd-=e)}}else{if(s.rowStart<t.rowStart&&s.rowEnd>=t.rowStart||s.rowEnd>t.rowEnd&&s.rowStart<=t.rowEnd)throw new e.s(e._(`error.sheet.insertCutOverlap`));if(t.rowStart===s.rowStart&&t.rowEnd===s.rowEnd){let e=t.colEnd-t.colStart+1;s.colStart<=t.colStart?(t.colStart+=e,t.colEnd+=e):(s.colStart-=e,s.colEnd-=e)}}l=I_([s])}a.getSource().getRanges([t]).delete(u)}d.commit({viewBefore:{ranges:t,view:this.getView(),selection:c,selectOptions:i?.autoSelect},viewAfter:{ranges:t,view:this.getView(),selection:l,selectOptions:i?.autoSelect}}),this._autoSelect(i?.autoSelect??!1,l)}catch(e){throw d.rollback(),e}return s}_insertCells(e,t,n){this._shiftCells(e,t,!0,n)}_deleteCells(e,t){this._shiftCells(e,t,!1)}_shiftCells(t,r,i,a){(function(t,r,i,a,o){let s;a&&(o??=(n,r)=>{t.validateCoords(n,r??e._(`error.sheet.insertOob`))}),i===n.l.Axis.Column||i===n.l.Axis.Row?(s=i,i={}):i&&(s=i.axis);let c=i?.description??e.v(a?`op.insertCells`:`op.deleteCells`),l=(s??t.getDefaultShiftAxis(r[0]))===n.l.Axis.Column;if(t.protectionCheck(()=>[l?a?`insertColumns`:`deleteColumns`:a?`insertRows`:`deleteRows`],r,c),T_(r))throw new e.s(e._(a?`error.sheet.insertOverlapping`:`error.sheet.deleteOverlapping`));let u=t.getEntireCoords(),d=u.colEnd,f=u.rowEnd,p=I_(r),m=t.beginCommit({description:c,operation:{name:a?`insertCells`:`deleteCells`}}),h=t.stateFor(m),g=l?a?n.l.Direction.Right:n.l.Direction.Left:a?n.l.Direction.Down:n.l.Direction.Up;try{let e,s=h.contentfulSpatial,c=h.mergeSpatial,_=h.borderSpatial,v=h.fillSpatial,y=h.contentSpatial,b=h.continuousFillSpatial,x=h.dateFormatSpatial,S=h.errorSpatial,C=h.hyperlinkSpatial,w=h.commentsSpatial,T=h.movableSpatial,E=h.calcGrid,D=h.rangesListenerSpatial2,O=h.rangeListenerSpatial,k=h.rangesListenerMap,A=t.getView().getFreezePanes().coords,j=A.rowIndex>0||A.colIndex>0,M={...A},N=new Map,P=h.cellValuesGrid,F=P,I=h.spillSpatial,L=h.pendingSpatial,ee=I,te=L,R=xi(r.slice(),n.l.Direction.Left),z=R.length;for(let n=0;n<z;n++){let r=R[n];d=Math.min(d,r.colStart),f=Math.min(f,r.rowStart);let i=(a?1:-1)*(l?r.colEnd-r.colStart+1:r.rowEnd-r.rowStart+1),p=F.getCoords();if(p){F===P&&(F=F.clone(),t.cloneRangeStats(F)),ee===I&&(ee=ee.clone(),te=te.clone());let n=QS(r,ee,F,s,(t,n)=>{e||=[],t&&e.push(t),n&&e.push(n)},!l);if(a){let e={...r,colEnd:l?Math.max(r.colEnd,p?.colEnd??r.colStart)+(r.colEnd-r.colStart+1):r.colStart,rowEnd:l?r.rowStart:Math.max(r.rowEnd,p?.rowEnd??r.rowStart)+(r.rowEnd-r.rowStart+1)},t=s.search(e),n=t.length;for(let e=0;e<n;e++){let n=t[e],a={...r};l?a.colEnd=Math.max(a.colEnd,n.colEnd)+i:a.rowEnd=Math.max(a.rowEnd,n.rowEnd)+i,o(a)}}F.shift(r,g),ee=ee.shift({range:r,direction:g,cloneIfUpdate:ee===h.spillSpatial,coordValidator:o}),s=s.shift({range:r,direction:g,cloneIfUpdate:s===h.contentfulSpatial,coordValidator:o}),n?.(a,l?0:i,l?i:0),t.updateState({cellValuesGrid:F,contentfulSpatial:s,spillSpatial:ee,pendingSpatial:te})}let m=r.colStart<=u.colStart&&r.colEnd>=u.colEnd,A=r.rowStart<=u.rowStart&&r.rowEnd>=u.rowEnd;j&&(m||A)&&(M=GT(M,r,l,i,u));let L=(e,t,n,r)=>{let i=null;n>1&&(i=e.at(n-1));let a=r-n+1;t?.(n,a),i&&e.updateHeaderPairs([{address:{min:n,max:r},update:i}])};m&&(a?L(t.rowHeaders,t.rowHeadersShiftCallback,r.rowStart,r.rowEnd):t.rowHeadersShiftCallback(r.rowStart,-1*(r.rowEnd-r.rowStart+1))),A&&(a?L(t.columnHeaders,t.columnHeadersShiftCallback,r.colStart,r.colEnd):t.columnHeadersShiftCallback(r.colStart,-1*(r.colEnd-r.colStart+1))),c=c.shift({range:r,direction:g,cloneIfUpdate:c===h.mergeSpatial}),_=_.shift({range:r,direction:g,cloneIfUpdate:_===h.borderSpatial}),v=v.shift({range:r,direction:g,cloneIfUpdate:v===h.fillSpatial}),y=y.shift({range:r,direction:g,cloneIfUpdate:y===h.contentSpatial}),b=b.shift({range:r,direction:g,cloneIfUpdate:b===h.continuousFillSpatial,coordValidator:o}),x=x.shift({range:r,direction:g,cloneIfUpdate:x===h.dateFormatSpatial,coordValidator:o}),S=S.shift({range:r,direction:g,cloneIfUpdate:S===h.errorSpatial,coordValidator:o}),C=C.shift({range:r,direction:g,cloneIfUpdate:C===h.hyperlinkSpatial,coordValidator:o}),w=w.shift({range:r,direction:g,cloneIfUpdate:w===h.commentsSpatial,coordValidator:o}),T=T.shift({range:r,direction:g,cloneIfUpdate:T===h.movableSpatial,coordValidator:o}),E=E.shift({range:r,direction:g,cloneIfUpdate:E===h.calcGrid}),O=O.shift({range:r,direction:g,cloneIfUpdate:O===h.rangeListenerSpatial,onShift:e=>{k===h.rangesListenerMap&&(k=new Map(k)),t.processListenerShift(k,N,h.rangesListenerMap,e)}}),D=D.shift({range:r,direction:g,cloneIfUpdate:D===h.rangesListenerSpatial2,coordValidator:o})}let ne=h.tables.shift({ranges:R,direction:g,coordValidator:o}),re=h.autoTables.shift({ranges:R,direction:g,coordValidator:o}),B=h.dataValidations.shift({ranges:R,direction:g,coordValidator:o}),ie=h.conditionalFormats.shift({ranges:R,direction:g,coordValidator:o}),ae=h.protectedRanges.shift({ranges:R,direction:g,coordValidator:o}),oe=M.rowIndex!==A.rowIndex||M.colIndex!==A.colIndex;oe&&t.getView().setFreezePanes({coords:M}),t.updateState({mergeSpatial:c,borderSpatial:_,fillSpatial:v,contentSpatial:y,continuousFillSpatial:b,dateFormatSpatial:x,errorSpatial:S,hyperlinkSpatial:C,commentsSpatial:w,movableSpatial:T,tables:ne,autoTables:re,dataValidations:B,conditionalFormats:ie,protectedRanges:ae,calcGrid:E,rangesListenerSpatial2:D,rangeListenerSpatial:O,rangesListenerMap:k}),t.processLayoutChange(),t.markColumnHeaderTableNames(),t.commitAndAutoSelect(m,p,i?.autoSelect,{viewBefore:{freezePanes:M?A:void 0},viewAfter:{ranges:R,spills:e,freezePanes:oe?M:void 0,listeners:N}},l?n.l.Axis.Column:n.l.Axis.Row)}catch(t){throw m.rollback(),t instanceof e.C?new e.s(t.message||e._(`error.sheet.insertOob`)):t}})(this._getMutationCtx(),t,r,i,a)}_processLayoutChange(){let e=this._getState();if(!e)return;this._cellOptions?.renderCellCache?.clear();let t=e.movableSpatial.all(),n=t.length;for(let e=0;e<n;e++)t[e].value.callbacks?.processLayout?.();this._notify(`onLayoutChange`)}_autoFit(t,r){(function(t,r,i){let a,o=t;if(o._closed)throw Error(e._(`error.sheet.modelClosed`));i={expandOnly:!1,skipCustomSize:!1,minContent:!1,...i};let s=yT(r,o._getEntireCoords(),!0),c=vT(r,o._getEntireCoords(),!0);a=e.v(!s&&c?`op.autofitColumns`:!c&&s?`op.autofitRows`:c&&s?`op.autofitAll`:`op.autofit`);let l=i.axes!==n.l.AxisSelection.Row;o._colHeaders.isProtected()&&(l=!1);let u=i.axes!==n.l.AxisSelection.Column;if(o._rowHeaders.isProtected()&&(u=!1),!u&&!l)return;let d=l&&(!1===i.expandOnly||i.expandOnly===n.l.Axis.Row),f=u&&(!1===i.expandOnly||i.expandOnly===n.l.Axis.Column),p=i.minContent??!1;u&&o._protectionCheck(()=>[`formatRows`],r,a),l&&o._protectionCheck(()=>[`formatColumns`],r,a);let m=I_(r),h=o._beginCommit({description:i.description??a}),g=o._isAdjustHeaders;o._isAdjustHeaders=!0;try{let t=U.getDeviceScale(),a=o._defaultRowHeight()*t,s=o._defaultColWidth(),c={host:o,cellOptions:o._cellOptions,normalStyle:o._styles.getNormal(),isRow:u,isColumn:l,isRowAxis:i.axes===n.l.AxisSelection.Row,isShrinkToFitRow:f,isShrinkToFitColumn:d,minContent:p,isFormulaView:i.formulaView??o.getView()?.isShowFormulas()??!1,updateHeaderOptions:{skipCustomSize:i.skipCustomSize},mapCache:new Map,clampHeight:(e,t=1)=>{if(e===0||t>1)return;let n=Math.max(e??0,a);return e=>f?n:Math.max(e??0,n)},clampWidth:(e,t=1)=>{if(e!==0&&!(t>1))return t=>d?e:Math.max(t??0,e??s)}},_=Da(r,1);_.sort(e.l.createRangeComparator(n.l.Axis.Column));let v=_.length;for(let e=0;e<v;e++){let t=_[e],n=Bx(c,t),r=[],i=[];Hx(c,t,n,r,i);let a=Ux(c,t,n);if(Wx(c,a,t),l&&Kx(c,t,a,i),u){let e=l?Gx(c,a):null;e&&Wx(c,e,t),qx(c,t,a,r)}}o._isAdjustHeaders=g,o._processLayoutChange(),o._commitAndAutoSelect(h,m,i?.autoSelect,{viewAfter:{ranges:r}})}catch(e){throw o._isAdjustHeaders=g,h.rollback(),e}})(this,t,r)}_createRangeEvent(e,t,n){let r=this,i=()=>{let t=r._getState();return this._closed||t.deleted?wT(null):e?Array.isArray(e)?r._createRanges(e):r._createRange(e):wT(this,this._getEntireCoords())},a=t.trigger;return{getSource:i,getFrom:()=>{let e=t.from;if(e)return e;let a=n;return a||=i().getCoords(),Array.isArray(a)?r._createRanges(a):r._createRanges([a])},getTo:()=>t.to??null,trigger:a,isUndo:t.isUndo??!1,isDataChange:t.isDataChange??!1,getTransactionId:t.getTransactionId,toString:()=>`SheetRangeEvent: ('${a}', ${i().toString()})`,timeStamp:t.timeStamp??Date.now()}}_notifyAddressListeners(e,t,n,r){let i=t.entries(),a=i.next(),o=r.trigger;for(;!a.done;){let t=a.value,s=t[0],c=t[1];if(c||=e.get(s),c&&!n.has(s)){let e=!1,t=c.options;t&&(e=(o===`address`?t.ignoreAddressChanges:t.ignoreDataChanges)??!1),!0!==e&&c.notify(r),n.add(s)}a=i.next()}}_notifyDataListeners(e,t,n=null,r,i){if(!e)return;let a=n.length;for(let o=0;o<a;o++){let a=n[o];if(!a)continue;let s=e.search(a),c=s.length;for(let e=0;e<c;e++){let n=s[e].value.groupId;if(!r.has(n)){let e=t.get(n);!0!==e.options?.ignoreDataChanges&&e.notify(i),r.add(n)}}}}_notifyRangeListeners(t,n,r=null,i){if(!t)return;let a=new Set;i.timeStamp||=Date.now();let o=this._getEntireCoords(),s=r.length;for(let c=0;c<s;c++){let s=e.l.intersectRanges(o,r[c],Qw);if(!s)continue;let l=t.search(s),u=l.length;for(let e=0;e<u;e++){let t=l[e].value.id;if(a.has(t))continue;let r=n.get(t);a.add(t);let o=r.ranges,c=o.length;for(let e=0;e<c;e++){let t=o[e],n=this._createRangeEvent(t,i,s);this._notifyRangeListener2(r,n,i)}}}}_notifyRangeListener2(e,t=null,n=null){let r=e.options;if(r?.transactional&&n?.isRestoreOrRevert||r?.ignoreDataChanges&&n?.isDataChange)return;let i=e.handler??e.handlerW?.deref();if(i)try{i?.(t)}catch(e){console.warn(e)}}_notifyUsedRangeChange(){this._lastCellRead.coords=null,this._lastUsedCoordsRead.coords=null,this._notify(`onUsedRangeChange`)}_notify(e){return this._emitter.notify(e)}_notifyConditionalFormatsChange(){this._notify(`onConditionalFormatsChange`),this._notify(`onStyleChange`)}_notifyDataValidationsChange(){this._notify(`onDataValidationsChange`),this._notify(`onStyleChange`)}_notifyProtectedRangesChange(){this._notify(`onProtectedRangesChange`),this._notify(`onProtectionChange`)}addListeners(e,t){return this._emitter.addListeners(e,t)}_addRangesListeners(t,n,r){if(this._closed)throw Error(e._(`error.sheet.modelClosed`));if(!n)throw Error(e._(`error.sheet.listenerNull`));r=r?{...Iw,...r}:Iw;let i=r?.transactional??!1,a=this,o=Jw++%(2**53-1),s=()=>{let t=null,n=null;if(i){let e=a._getState();if(!e)return;t=e.rangeListenerSpatial.clone(),n=new Map(e.rangesListenerMap)}else t=a._rangeListenerSpatial,n=a._rangesListenerMap;let r=n.get(o);if(!r)return void console.log(`Listener not found`);let s=r.ranges,c=s.length;for(let n=0;n<c;n++){let r=e.l.sanitizeRange(s[n]);r!==null&&t.remove(r,(e,t)=>t.value.id===o)}if(n.delete(o),i){let r=this._beginCommit({description:e.v(`op.removeRangeListener`)});this._updateState({rangeListenerSpatial:t,rangesListenerMap:n}),r.commit({forceAmend:!0})}},c=[...t],l={id:o,handler:null,handlerW:null,removeListener:s,options:r,ranges:c};r?.weakly?l.handlerW=new WeakRef(n):l.handler=n;let u=null,d=null,f=null;if(i){f=this._beginCommit({description:e.v(`op.addRangeListener`)});let t=this._getState();u=t.rangeListenerSpatial.clone(),d=new Map(t.rangesListenerMap)}else u=a._rangeListenerSpatial,d=a._rangesListenerMap;let p=[],m=t.length;for(let e=0;e<m;e++){let n={...t[e],value:{id:o,offset:e,options:r}};p.push(n)}return u.load(p),d.set(o,l),f&&(this._updateState({rangeListenerSpatial:u,rangesListenerMap:d}),f.commit({forceAmend:!0})),s}_addRangesListeners2(t,n,r,i){if(this._closed)throw Error(e._(`error.sheet.modelClosed`));if(!n)throw new e.s(e._(`error.sheet.listenerNull`));r=r?{...Iw,...r}:Iw;let a=r?.transactional??!1,o=this,s=e.A.uuidV4(),c=Yw++,l=()=>{let t=null,n=null,r=o._getState();if(!r)return;t=r.rangesListenerSpatial2.clone(),n=r.rangesListenerMap2;let i=n.get(s);if(i){let e=i.spatialsIds,a=i.coords,o=e.length;for(let n=0;n<o;n++){let r=e[n],i=a[n];t.remove(i,(e,t)=>t.value.uuid===r)}n=new Map(r.rangesListenerMap2),n.delete(s)}let l=this._beginCommit({description:e.v(`op.removeRangeListener`)});this._updateState({rangesListenerMap2:n}),l.commit({forceAmend:!0}),a||this._rangesListenerSorted.delete(c)},u=null,d=this._beginCommit({description:e.v(`op.addRangeListener`)}),f=this._getState();u=f.rangesListenerSpatial2.clone();let p=null,m=null;r?.weakly?m=new WeakRef(n):p=n;let h=[],g=[...t],_=[],v=t.length;for(let n=0;n<v;n++){let i={...t[n]};g[n]=i;let a=e.A.uuidV4(),o=new kC(s,a,r?.ignoreAddressChanges??!1);_.push(a);let c={...e.l.sanitizeRange(i),value:o};h.push(c)}u.load(h),r={...r};let y=new AC(s,_,g,i,this,c,p,m,l,r),b=new Map(f.rangesListenerMap2);return b.set(s,y),this._updateState({rangesListenerSpatial2:u,rangesListenerMap2:b}),a||this._rangesListenerSorted.set(c,y),d.commit({forceAmend:!0}),l}_getUsedCoords(t){let n=this._getState();if(!n)return null;let r=n.cellValuesGrid.getCoords(),i=t?.features;if(i!==void 0){let t=typeof i==`string`?[i]:i;for(let i=0;i<t.length;i++)r=e.l.unionRanges(Yd(n,t[i]),r);return Nw(r,this._getEntireCoords())}return r=e.l.unionRanges(n.borderSpatial.getContentfulCoords(),r),r=e.l.unionRanges(n.fillSpatial.getContentfulCoords(),r),r=e.l.unionRanges(n.contentSpatial.getContentfulCoords(),r),r=e.l.unionRanges(n.mergeSpatial.getContentfulCoords(),r),r=e.l.unionRanges(n.tables.getBoundingRange(),r),r=e.l.unionRanges(n.calcGrid.getBoundingRange(),r),r=e.l.unionRanges(n.spillSpatial.getBoundingRange(),r),r=e.l.unionRanges(n.pendingSpatial.getBoundingRange(),r),r=Nw(r,this._getEntireCoords()),r?(this._lastUsedCoordsRead&&this._lastUsedCoordsRead.coords&&FT(this._lastUsedCoordsRead.coords,r)||(this._lastUsedCoordsRead.coords=r,this._lastUsedCoordsRead.range=null),this._lastUsedCoordsRead.coords):(this._lastUsedCoordsRead.coords=null,null)}_getRangeStats(e,t){let r=t?.ignoreHidden;if(r&&(e=this._getVisible(e,{axes:!0===r?n.l.AxisSelection.Both:r})),e.length===0)return this._rangeStats.toLocalCoords([],t);let i=KT(e);return this._rangeStats.toLocalCoords(i,t)}_isContentful(e,t){return!!this._contentCounts(e,void 0,t)}_getCount(e,t=!1){let n=this._contentCounts(e,Rw,t);return n?n[qg.Content.Values]??0:0}_contentCounts(e,t,n=!1){if(!t){let e=Object.keys(qg.Content),n=e.length;t=[];for(let r=0;r<n;r++){let n=e[r],i=qg.Content[n];i!==qg.Content.Formats&&i!==qg.Content.Tables&&t.push(i)}}let r,i,a={},o=t.length,s=!1;for(let e=0;e<o;e++){let n=t[e];n===qg.Content.Values?a[q.Type.Contentful]=!1:n===qg.Content.Formulas?a[q.Type.Formula]=!1:n===qg.Content.Formats?(a[q.Type.BorderStyle]=!1,a[q.Type.FillStyle]=!1,a[q.Type.ContentStyle]=!1):n===qg.Content.Tables&&(a[q.Type.Table]=!1,s=!0)}let c=()=>{r=new Set,i={};for(let e=0;e<o;e++){let n=t[e];i[n]=0}},l=e.length;for(let t=0;t<l;t++){let o=e[t],l=this._rangeStateIterator({searchTypes:a,ignoreHidden:n,bounds:o}),u=l.next();for(;!u.done;){i||c();let e=u.value,t=(e.end.colIndex-e.start.colIndex+1)*(e.end.rowIndex-e.start.rowIndex+1),n=e.intersection;if(n){n.contentful&&(i[qg.Content.Values]=(i[qg.Content.Values]??0)+t),n.formula&&(i[qg.Content.Formulas]=(i[qg.Content.Formulas]??0)+t);let e=n.table;e&&(s&&!r.has(e)&&(i[qg.Content.Tables]=(i[qg.Content.Tables]??0)+1,r.add(e)),n.contentful||(i[qg.Content.Values]=(i[qg.Content.Values]??0)+t))}u=l.next()}}return i}_featureCounts(e,t,n=!1){let r=Jg.Feature,i=Object.values(r),a=t===void 0?i:typeof t==`string`?[t]:t,o={};for(let e=0;e<i.length;e++)o[i[e]]=0;e.length>1&&(e=KT(e));let s=new Map;for(let e=0;e<a.length;e++){let t=a[e],n=qd[t];if(n===null)continue;let r=s.get(n);r?r.push(t):s.set(n,[t])}let c=e.length;for(let[t,i]of s){let a=t===q.Type.ContentStyle,s={[t]:!1};for(let t=0;t<c;t++){let c=this._rangeStateIterator({searchTypes:s,ignoreHidden:n,bounds:e[t]}),l=c.next();for(;!l.done;){let e=l.value,t=e.intersection;if(t){let n=(e.end.colIndex-e.start.colIndex+1)*(e.end.rowIndex-e.start.rowIndex+1);if(a){let a=t.contentStyle?.getPropertiesAt(e.start.rowIndex,e.start.colIndex,null);if(a)for(let e=0;e<i.length;e++){let t=i[e];(t===r.NumberFormat&&a.numberFormat!==void 0||t===r.Alignment&&a.alignment!==void 0||t===r.Font&&a.font!==void 0)&&(o[t]+=n)}}else for(let e=0;e<i.length;e++){let r=i[e];Bw(t,r)&&(o[r]+=n)}}l=c.next()}}}return new zw(o)}_dependencyRanges(e,t,n){let r=this._getState().calcGrid;if(!r)return null;let i=e.scope&&e.scope===this.getName()?{...e,scope:void 0}:e,a=t===`precedents`?n?r.getDirectPrecedentsAt(i):r.getPrecedentsAt(i):n?r.getDirectDependentsAt(i):r.getDependentsAt(i),o=new Set;if(t===`precedents`){let t=r.getFormulas().search(e);for(let e=0;e<t.length;e++){let n=t[e].value?.getNamedIds();if(n)for(let e=0;e<n.length;e++)o.add(n[e])}}let s=this._toRangeScopes(a,t===`dependents`?o:void 0),c=null;if(o.size>0){let e=this._calculation?.getNamedFormulas();if(e?._graphNode){let n=this._internal;for(let r of o){let i=e._graphNode(r,t===`dependents`);if(!i)continue;let a=(i.sheetName?xT(n,i.sheetName):null)??n;(c??=[]).push(new kv(i,a,null))}}}return s.length!==0||c?this._createRanges(c?[...c,...s]:s):null}_toRangeScopes(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r];if(!i.scope){n.push(i);continue}let a=this._resolveSheetScope(i.scope);a?n.push({...i,scope:a}):t?.add(i.scope)}return n}_resolveSheetScope(e){if(this.getId()===e)return this.getName();let t=this._workbook?.getSheets().getItems();if(t){for(let n of t)if(n.getId()===e)return n.getName()}return null}_featureRegions(e,t,r){let i=Jg.Feature,a=r?.containment===`fullyContained`,o={},s=[],c=[];for(let e=0;e<t.length;e++){let n=t[e];switch(n){case i.NumberFormat:case i.Alignment:case i.Font:s.push(n),o[q.Type.ContentStyle]=!1;break;default:{let e=qd[n];if(e===null)return[];o[e]=!1,c.push(n)}}}let l=c.includes(i.Contentful),u=[];for(let e=0;e<c.length;e++)c[e]!==i.Contentful&&u.push(qd[c[e]]);let d=e=>{let t=[];l&&t.push(!!e.contentful);for(let n=0;n<u.length;n++)t.push(e[u[n]]);return s.length>0&&t.push(e.contentStyle),t},f=new Map,p=Symbol(`rects`),m=e=>{let t=f;for(let n=0;n<e.length;n++){let r=t.get(e[n]);r||(r=new Map,t.set(e[n],r)),t=r}let n=t.get(p);return n||(n=[],t.set(p,n)),n},h=this._rangeStateIterator({searchTypes:o,ignoreHidden:r?.ignoreHidden??!1,bounds:e,fullyContained:a}),g=h.next();for(;!g.done;){let t=g.value,n=t.intersection;if(n){let r=!1;for(let e=0;!r&&e<c.length;e++)r=Bw(n,c[e]);if(!r&&s.length>0){let e=n.contentStyle?.getPropertiesAt(t.start.rowIndex,t.start.colIndex,null);if(e)for(let t=0;!r&&t<s.length;t++){let n=s[t];r=n===i.NumberFormat&&e.numberFormat!==void 0||n===i.Alignment&&e.alignment!==void 0||n===i.Font&&e.font!==void 0}}r&&m(d(n)).push({rowStart:Math.max(t.start.rowIndex,e.rowStart),colStart:Math.max(t.start.colIndex,e.colStart),rowEnd:Math.min(t.end.rowIndex,e.rowEnd),colEnd:Math.min(t.end.colIndex,e.colEnd)})}g=h.next()}let _=[],v=e=>{for(let[t,r]of e)t===p?_.push(...Ea(r,n.l.Axis.Column,2**53-1)):v(r)};v(f);let y=r?.axis===n.l.Axis.Column,b=!0===r?.reverse;return _.sort((e,t)=>{let n=y?e.colStart-t.colStart||e.rowStart-t.rowStart:e.rowStart-t.rowStart||e.colStart-t.colStart;return b?-n:n}),_}find(e){return e?((e=typeof e==`string`?{text:e}:{...e}).from||(e.from=this.getSelection().getCoords().cell),this.getEntireRange().find(e)):ti}setEntireSize(t,r){t||=Ww;let i=this._getEntireCoords(),a=i.colEnd-i.colStart+1,o=i.rowEnd-i.rowStart+1,s=t?.width??a,c=t?.height??o;if(s===a&&c===o)return this;let l=this._beginCommit({description:r?.description??e.v(`op.setEntireSize`)});try{s<a&&this._deleteCells([{colStart:s,rowStart:i.rowStart,colEnd:i.colEnd,rowEnd:i.rowEnd}],n.l.Axis.Column),c<o&&this._deleteCells([{colStart:i.colStart,rowStart:c,colEnd:i.colEnd,rowEnd:i.rowEnd}],n.l.Axis.Row);let t=Object.freeze({colStart:0,rowStart:0,colEnd:s-1,rowEnd:c-1}),u=this._getState(),d=u.borderSpatial.clone();d.setEntireCoords(t);let f=u.fillSpatial.clone();f.setEntireCoords(t);let p=u.contentSpatial.clone();p.setEntireCoords(t),this._updateState({entireCoords:t,borderSpatial:d,fillSpatial:f,contentSpatial:p}),this._entireCoordsCache=null,this._entireRangeCache=null,this._emitter.notify(`onViewChange`,{source:this.getView()}),s>a&&this._insertCells([{colStart:i.colEnd+1,rowStart:t.rowStart,colEnd:s-a+i.colEnd,rowEnd:t.rowEnd}],n.l.Axis.Column),c>o&&this._insertCells([{colStart:t.colStart,rowStart:i.rowEnd+1,colEnd:t.colEnd,rowEnd:c-o+i.rowEnd}],n.l.Axis.Row);let m=this.getSelection(),h=m.getCoords(),g=P_(h,e.l.EmptySelection,t);m.updateCoords(g),this._notify(`onLayoutChange`),l.commit({...r,viewBefore:{view:this.getView(),selection:h},viewAfter:{view:this.getView(),selection:g}}),this._autoSelect(r?.autoSelect,g)}catch(e){throw l.rollback(),e}return this}_find(t,r){if(this._closed)throw Error(e._(`error.sheet.modelClosed`));typeof r==`string`&&(r={text:r});let i=r?.text;if(!i)return ti;let a=[...t],o=r?.axis??n.l.Axis.Row,s=r?.reverse,c=!r?.disableWrap,l=r?.from?this._cellToCoords(r?.from):null,u=null;if(l){let t=-1;for(let n=0;t===-1&&n<a.length;n++)e.l.isCellWithinRange(l,a[n])&&(t=n);u=e.l.cellToRange(l);let n=E_(a[t],u,o);n.push(u);let r=e.l.createRangeComparator(o,s);n.sort(r);let i=-1,d=n.length;for(let e=0;e<d;e++)r(n[e],u)<=0&&(i=e);a.splice(t,1,...n);let f=t+i,p=[];for(let e=0;e<=f;e++)p.push(a.shift());if(c){let e=p.length;for(let t=0;t<e;t++)a.push(p[t])}}if(a.length===0)return ti;let d=r?.fields?.includes(qg.Content.Formulas)??!1,f=r?.fields?.includes(qg.Content.Values)??!0,p=r?.matchEntireCell??!1,m=r?.matchCase??!1,h=r?.useRegex??!1,g=function(e,t,n){let r=t?``:`i`;return n?new RegExp(e,r):new RegExp((e=>{let t=e.replace(/[|\\{}()[\]^$+.]/g,`\\$&`);return t=t.replace(/~\?/g,`\\?`),t=t.replace(/~\*/g,`\\*`),t=t.replace(/~~/g,`~`),t})(e),r)}(i,m,h),_=i.length,v=(e,t)=>{let n=e=>{if(!e)return!1;let t=!!e.match(g);return t&&p&&e.length!==_&&(t=!1),t},r=t.getCell(),i=!1;if(!i&&d){let e=r.getFormulaText();e=e?`=`+e:r.getText(Zw),i=n(e)}else f&&(i=n(r.getNumberFormat().displayText));return i};if(r?.matchCustom){let e,t,n=r.matchCustom,i={matchCase:m,matchEntireCell:p,useRegex:h,fields:r?.fields??[qg.Content.Formulas]},a=v,o=()=>a(e,t);v=(r,a)=>(e=r,t=a,n(r,o,i,a))}let y=-1,b=null,x=ei,S=!1,C=()=>{if(x.done){if(y++,y>=a.length)return S=!0,!1;b=this._cellIterator({reverse:s,axis:o,searchTypes:!1,bounds:a[y]})}if(x=b.next(),!x.done){let e=x.value;return v(e.value,e.context)}return!1};return{next:()=>{let e=null;for(;!S&&!e;)C()&&(e=x.value.context.getCell());return e?{value:e,done:!1}:ei}}}getRuntime(){return this._runtime}_surroundingRegion(t,n){let r=this._getState(),i=n?.contentOnly??!1,a=this._getEntireCoords();if(!i){let n=r.tables.search(t);if(n.length>0){let r=n[0].value,i=r.getDataRange().getCoords(),o=r.getRange().getCoords();return e.l.isEqualRanges(i,t)?o:e.l.isEqualRanges(o,t)?a:i}}let o=i?t:a;return function(t,n,r=2e4){if(!n||n.length===0)return null;let i=null,a=!1;for(let r=0;r<n.length;r++){let o=n[r];o&&(i=e.l.unionRanges(i,o.getBoundingRange()),a||=o.search(t).length>0)}if(!i)return null;let o={...e.l.EmptyRange},s=t,c=a?{...t}:null;if(!c){let r=(t=>{let r=[],i=n.length;for(let e=0;e<i;e++){let i=n[e];if(!i)continue;let a=i.search(t),o=a.length;r=o>0?Array(o):void 0;for(let e=0;e<o;e++){let t=a[e];r[e]=t}}return r||e.A.EmptyArray})({colStart:t.colEnd,rowStart:t.rowEnd,colEnd:t.colEnd+1,rowEnd:t.rowEnd+1}),i=r.length;if(i>0){c={...t};for(let e=0;e<i;e++){let t=r[e];c.colEnd=Math.max(c.colEnd,t.colStart),c.rowEnd=Math.max(c.rowEnd,t.rowStart)}}}let l={...e.l.EmptyRange},u=()=>{let t=n.length;for(let r=0;r<t;r++){let t=n[r];if(!t)continue;let i=t.search(o),a=i.length;for(let t=0;t<a;t++){let n=i[t];c=e.l.unionRanges(c,n,l)}}return c};o.colStart=t.colStart,o.rowStart=t.rowStart,o.colEnd=t.colEnd,o.rowEnd=t.rowEnd,u();let d={...c},f={...e.l.EmptyRange},p=0;do{if(o.colStart=f.colStart=d.colStart,o.rowStart=f.rowStart=d.rowStart,o.colEnd=f.colEnd=d.colEnd,o.rowEnd=f.rowEnd=d.rowEnd,d.colStart>i.colStart&&(o.colStart=d.colStart-1,o.colEnd=d.colStart-1,o.rowStart=d.rowStart-1,o.rowEnd=d.rowEnd+1,u()),d.rowStart>i.rowStart&&(o.rowStart=d.rowStart-1,o.rowEnd=d.rowStart-1,o.colStart=d.colStart-1,o.colEnd=d.colEnd+1,u()),d.colEnd<i.colEnd&&(o.colStart=d.colEnd+1,o.colEnd=d.colEnd+1,o.rowStart=d.rowStart-1,o.rowEnd=d.rowEnd+1,u()),d.rowEnd<i.rowEnd&&(o.rowStart=d.rowEnd+1,o.rowEnd=d.rowEnd+1,o.colStart=d.colStart-1,o.colEnd=d.colEnd+1,u()),!c)return null;if(d.colStart=c.colStart,d.rowStart=c.rowStart,d.colEnd=c.colEnd,d.rowEnd=c.rowEnd,e.l.isEqualRanges(d,f))return e.l.isEqualRanges(s,d)?null:d;if(e.l.isEqualRanges(d,s))return null;if(e.l.isEqualRanges(d,f))return d;p++}while(p<r);return null}(t,[r.contentfulSpatial,r.mergeSpatial,r.calcGrid.getFormulas(),r.spillSpatial,r.pendingSpatial])||o}_extendRange(t,r){if(this._closed)throw Error(e._(`error.sheet.modelClosed`));let i={...this._getEntireCoords()},a=this.getRowHeaders(),o=this.getColumnHeaders(),s=(this._cacheTableColumnHeaders?.table)?.getRange().getCoords(),c=!1;if(s){let e={...s};e.rowStart+=a.hiddenHeadersAt(e.rowStart,!1),e.rowEnd-=a.hiddenHeadersAt(e.rowEnd,!0),e.colStart+=o.hiddenHeadersAt(e.colStart,!1),e.colEnd-=o.hiddenHeadersAt(e.colEnd,!0),(t===n.l.Direction.Up&&r.rowIndex>e.rowStart||t===n.l.Direction.Down&&r.rowIndex<e.rowEnd||t===n.l.Direction.Left&&r.colIndex>e.colStart||t===n.l.Direction.Right&&r.colIndex<e.colEnd)&&(c=!0),c&&(i=e)}i.rowStart+=a.hiddenHeadersAt(i.rowStart,!1),i.rowEnd-=a.hiddenHeadersAt(i.rowEnd,!0),i.colStart+=o.hiddenHeadersAt(i.colStart,!1),i.colEnd-=o.hiddenHeadersAt(i.colEnd,!0);let l=this,u=[],d={ignoreHidden:!0,onFound:(t,n)=>{u.push(e.l.intersectRanges(t,n))},onEntry:(e,t)=>t},f={ignoreHidden:!0,onEntry:(e,t)=>e.tvTl()===void 0?null:t},p=this._getState();if(!p)return e.A.EmptyArray;let m,h=l._getRangedEntries(p.mergeSpatial,[e.l.cellToRange(r)],f);h.length>0&&(m=h[0]);let g=[e=>l._getRangedEntries(l._getState().mergeSpatial,e,f),e=>(u=[],l._getRangedEntries(l._getState().contentfulSpatial,e,d),u)];return c||g.push(e=>(u=[],l._getRangedEntries(l._getState().tables,e,d),u)),function(t,r,i,a,o){let s,c,l,u={...r},d=e.l.cellToRange(u),f=a(d).length>0;if(f){let r=1,o=t===n.l.Direction.Up||t===n.l.Direction.Down;i&&(r+=o?i.rowEnd-i.rowStart:i.colEnd-i.colStart),t!==n.l.Direction.Left&&t!==n.l.Direction.Up||(r=-r),o?u.rowIndex+=r:u.colIndex+=r,d=e.l.cellToRange(u),f=a(d).length>0}switch(t){case n.l.Direction.Up:d.rowStart=Math.min(o.rowStart,d.rowStart),c=a(d).sort(e.l.createRangeComparator(n.l.Axis.Row,!0)),s=r.rowIndex,l=f?c.length===1&&s===c[0].rowStart?o.rowStart:c[0].rowStart:c.length===0?o.rowStart:c[0].rowEnd;break;case n.l.Direction.Down:d.rowEnd=Math.max(o.rowEnd,d.rowEnd),c=a(d).sort(e.l.createRangeComparator(n.l.Axis.Row,!1)),s=r.rowIndex,l=f?c.length===1&&s===c[0].rowEnd?o.rowEnd:c[0].rowEnd:c.length===0?o.rowEnd:c[0].rowStart;break;case n.l.Direction.Left:d.colStart=Math.min(o.colStart,d.colStart),c=a(d).sort(e.l.createRangeComparator(n.l.Axis.Column,!0)),s=r.colIndex,l=f?c.length===1&&s===c[0].colStart?o.colStart:c[0].colStart:c.length===0?o.colStart:c[0].colEnd;break;case n.l.Direction.Right:d.colEnd=Math.max(o.colEnd,d.colEnd),c=a(d).sort(e.l.createRangeComparator(n.l.Axis.Column,!1)),s=r.colIndex,l=f?c.length===1&&s===c[0].colEnd?o.colEnd:c[0].colEnd:c.length===0?o.colEnd:c[0].colStart}let p=c?c.length:0;if(f&&p>1){let e=!1;for(let r=1;!e&&r<p;r++){let i=c[r];switch(t){case n.l.Direction.Up:i.rowEnd<l-1?e=!0:l=Math.min(l,i.rowStart);break;case n.l.Direction.Down:i.rowStart>l+1?e=!0:l=Math.max(l,i.rowEnd);break;case n.l.Direction.Left:i.colEnd<l-1?e=!0:l=Math.min(l,i.colStart);break;case n.l.Direction.Right:i.colStart>l+1?e=!0:l=Math.max(l,i.colEnd)}}}let m=e.l.cellToRange(r);switch(t){case n.l.Direction.Up:m.rowStart=l;break;case n.l.Direction.Down:m.rowEnd=l;break;case n.l.Direction.Left:m.colStart=l;break;case n.l.Direction.Right:m.colEnd=l}return m}(t,r,m,e=>{let t=[],n=[e],r=g.length;for(let e=0;e<r;e++){let r=(0,g[e])(n),i=r.length;for(let e=0;e<i;e++){let n=r[e];t.push(n)}}return t},i)}_defaultFontDims(){if(this._defaultFontBoundsCache)return this._defaultFontBoundsCache;let e=this._styles.getNormal(),t=0,n=0;for(let r=0;r<=9;r++){let i=e.measureText(r.toString());t=Math.ceil(Math.max(i.width,t)),n=Math.max(i.lineHeight,n)}return this._defaultFontBoundsCache={width:t,height:n},this._defaultFontBoundsCache}getColumnWidthAsFontUnit(e){let t=Math.round(this._defaultFontDims().width),n=e/(this.getView().isShowFormulas()?2:1);if(!t||!e)return 0;let r=5;return n<r+t&&(r=n*(r/(r+t))),(n-r)/t}_createTupleBuilder(e=!1){return e?new ri.TransposedBuilder:new ri.Builder}_defaultColWidth(){if(this._defaultColWidthCache)return this._defaultColWidthCache;let e=this._defaultFontDims()?.width||7,t=8*Math.round((8*e+5)/8)/Math.round(this._defaultFontDims().width);return this._defaultColWidthCache=t}_defaultRowHeight(){if(this._defaultRowHeightCache)return this._defaultRowHeightCache;let e=this._defaultFontDims();if(!e||e.width===0)return this._defaultRowHeightCache=20/U.getDeviceScale(),this._defaultRowHeightCache;let t=e.height+2;return this._defaultRowHeightCache=Math.round(t/U.getDeviceScale()*4)/4,this._defaultRowHeightCache}getProtection(){return this._protection??null}async _scrollIntoView(t,r){if(!r)return!0;!0===r&&(r=e.A.EmptyObject);let i=r.axis,a=t;i===n.l.Axis.Column?a={colStart:t.colStart,rowStart:void 0,colEnd:t.colEnd,rowEnd:void 0}:i===n.l.Axis.Row&&(a={colStart:void 0,rowStart:t.rowStart,colEnd:void 0,rowEnd:t.rowEnd});let o={coords:a},s=await this._emitter.notify(`onRequestScrollIntoView`,{params:o,async:!0});if(!s)return!1;let c=s.length;for(let e=0;e<c;e++)if(!1===s[e])return!1;return!0}async _selectSheet(e,t){return!1!==await this._options.container?.requestSelect?.()&&this._scrollIntoView(e,t)}async scrollTo(e,t){let n={...t,coords:e},r=await this._emitter.notify(`onRequestScrollIntoView`,{params:n,async:!0});if(!r)return!1;let i=r.length;for(let e=0;e<i;e++)if(!1===r[e])return!1;return!0}_resolveSelectOptions(e,t){return e?(!0===e&&(e={autoFocus:!0,scrollIntoView:!0}),!0===e.scrollIntoView&&(e={...e,scrollIntoView:{}}),t&&(e={...e,scrollIntoView:{axis:t,...e?.scrollIntoView}}),e):null}async _commitAndAutoSelect(e,t,n=!1,r,i){let a=this._resolveSelectOptions(n,i);return r={...r,viewAfter:{view:this.getView(),selection:t,selectOptions:a,...r?.viewAfter}},e.commit(r),this._autoSelect(n,t,i)}async _autoSelect(t,n,r){if(!t)return e.A.EmptyArray;let i=this._resolveSelectOptions(t,r),a=i?.autoFocus,o=i?.scrollIntoView,s=i?.anchor,c=this.getSelection().getCoords(),l=F_(n??null),u=this._getEntireCoords(),d=UT(l,this._getState().mergeSpatial,u),f=-1,p=null;if(!s){let t=c?.cell,n=d.length;for(let r=0;f===-1&&r<n;r++){let n=d[r];e.l.isCellWithinRange(t,n)&&(f=r,p=t)}}let m=I_(d,p,f);this.getSelection().updateCoords(m);let h=e.l.cellToRange(m.cell);if(i?.preserveSelectedSheet)return await this._scrollIntoView(h,o),d;{let e=await this._selectSheet(h,o);if(!1!==o&&!1===e)return d}if(!1!==a){let e=await this._notify(`onRequestFocus`);if(!e)return d;let t=e.length;for(let n=0;n<t;n++)if(!1===e[n])return d}return d}getSelection(){return this.getView().getRangeSelection()}getSelectedCell(){return this.getSelection().getCell()}getSelectedRange(e){return this.getSelection().getRange(e)}getSelectedRanges(e){return this.getSelection().getRanges(e)}getView(){return this._view}setView(t){if(this._closed)throw Error(e._(`error.sheet.modelClosed`));if(!t)throw new e.s(e._(`error.sheet.emptyView`));this._viewRemoveListener?.(),this._view=t;let n=this._viewListener;return this._viewRemoveListener=t.addListeners(n,{transactional:!1}),n.onTopLeftChange?.(t),n.onFreezePaneChange?.(t),n.onHeaderChange?.(t),n.onZoomScaleChange?.(t),n.onSelectionChange?.(t),n.onMovableSelectionChange?.(t),n.onAnyChange?.(t),this._emitter.notify(`onViewChange`,{source:t}),this}getTabColor(){return this._tabColor}setTabColor(t){if(this._closed)throw Error(e._(`error.sheet.modelClosed`));return this._tabColor=typeof t==`string`?this._styles.parseColor(t):t??null,this._notify(`onTabColorChange`),this}getRowHeaders(){return this._rowHeaders}getColumnHeaders(){return this._colHeaders}async toJSON(t){if(this._closed)throw Error(e._(`error.sheet.modelClosed`));await this.getCalculation().ready(),await this._emitter.notify(`onBeforeSave`,{async:!0}),await Promise.resolve(this._starting);let r={},i=this._getState();if(!i)return r;let a=this._getEntireCoords(),o=null;try{let e,s=t?.ignoreData??!1,c=t?.ignoreFormulas;s&&c||(o=await i.calcGrid.toJSON(t));try{if(!s){e=this._strings.beginPersist();let t=[],i=this._cellStateIterator({searchTypes:!1,axis:n.l.Axis.Column}),a=i.next(),o=-(2**53-1),s=-(2**53-1),c=null,l=null,u=null,d=null;for(;!a.done;){let r=a.value[0],f=r.colIndex,p=r.rowIndex;f!==o&&(d&&t.push(d),c=[],u=[],d=[f,u],o=f,s=p-2),p>s+1&&(c=[],l=[p,c],u.push(l));let m,h=a.value[1],g=nE(h);if(g===n.n.Number)m=h;else if(g===n.n.Boolean)m=h;else if(g===n.n.String)m=``+e.add(h);else if(g===n.n.Error)m={t:`e`,v:h.getCode()};else if(g===n.n.RichData){let e=h,t=e.getType(),n=e?.toJSON?.();t&&n&&(m={t:`r`,v:0})}else console.warn(`error`,m);c.push(m),s=p,a=i.next()}d&&t.push(d),t.length>0&&(r.data=t)}e&&this._ownStrings&&(r.strings=await e.toJSONAsync())}catch(e){console.warn(`error`,e)}finally{e?.endPersist()}let l=a.colEnd+1,u=a.rowEnd+1;if(l!==Ww.width||u!==Ww.height){let e={};l!==Ww.width&&(e.width=l),u!==Ww.height&&(e.height=u),r.entireSize=e}let d=this._colHeaders.toJSON();d&&(d.headers&&d.headers.length>0&&(r.cols=d.headers),d.defaultSize!==void 0&&d.defaultSize!==-1&&(r.defaultColSize=d.defaultSize));let f=this._rowHeaders.toJSON();f&&(f.headers&&f.headers.length>0&&(r.rows=f.headers),f.defaultSize!==void 0&&f.defaultSize!==-1&&(r.defaultRowSize=f.defaultSize));let p=this.getProtection().toJSON();p&&(r.protection=p);let m=this._view.toJSON();m&&(r.view=m),this._tabColor&&(r.tabColor=this._tabColor.toString())}catch(e){console.warn(e)}if(!t?.ignoreStyles){let o=xi(i.mergeSpatial.all());o.length>0&&(r.merges=Ol(o));let s=xi(this._composeDirectStyleView().all());if(s.length>0){let i=this._styles.beginPersist(),o=t?.splitDirectBorders,c=t?.includeHeaderStyles;try{let t=s.length,l=[];for(let n=0;n<t;n++){let t=s[n],r=t.value.toJSON();if(!r)continue;let c=!0;if(o&&r.border&&!e.l.isSingleCell(t)){let e=bm(t,r,a),n=e.length;for(let t=0;t<n;t++){let n=e[t],r=i.getElementID(n[1]);l.push([n[0],r])}c=!1}if(c){let e=i.getElementID(r);l.push([t,e])}}if(c&&l){let e=function(e,t){if(!e.cells||e.cells.length===0)return e;let r=e.cells.map(([e,t])=>({...e,value:t}));r.sort((e,t)=>e.value-t.value);let i,a=Cm(r,t,null,e.cols,!0),o=Array(r[r.length-1].value+1).fill(0),s=Math.floor((t.colEnd-t.colStart+1)/2),c=a.length;for(let e=0;i===void 0&&e<c;e++){let t=a[e],n=t.value.s,r=o[n]+(t.max-t.min+1);r>s&&(i=n),o[n]=r}let l=Cm(r,t,i,e.rows,!1);if(e.cols===a&&e.rows===l)return e;let u=[],d=Yr(a,t,!0),f=Yr(l,t,!1),p=r,m=d.length;for(let e=0;e<m;e++){let t=d[e];p.push(t),p.push({...t,value:0})}let h=f.length;for(let e=0;e<h;e++){let t=f[e];p.push(t),p.push({...t,value:0})}let g=new ni.IteratorInstance(p,{axis:n.l.Axis.Column}),_=t.rowEnd,v=t.colEnd,y=(e,t)=>{e.rowStart>=_||e.colStart>=v||u.push([e,t])},b=g.next();for(;!b.done;){let e=b.value;b=g.next();let t,n,r,i=e.overlaps,a=e.range,o=i.length;if(o===1){let e=i[0].value;e&&y(a,e);continue}for(let e=0;e<o;e++){let a=i[e],o=a.value;typeof o==`number`?o===0&&t!==void 0||(t=o):a.rowStart===0&&a.rowEnd===_?r=o.s:a.colStart===0&&a.colEnd===v&&(n=o.s)}n===void 0?r===void 0?(t!==0||o!==2&&o!==4)&&y(a,t):r!==t&&y(a,t):n!==t&&y(a,t)}return u.sort((e,t)=>{let n=e[0],r=t[0];return n.rowStart===r.rowStart?n.colStart-r.colStart:n.rowStart-r.rowStart}),{cols:a,rows:l,cells:u}}({cells:l,cols:r.cols?ru(r.cols,!0):[],rows:r.rows?ru(r.rows,!1):[]},a);l=e.cells,e.cols.length>0?r.cols=nu(e.cols,!0):delete r.cols,e.rows.length>0?r.rows=nu(e.rows,!1):delete r.rows}let u=l.length;for(let e=0;e<u;e++){let t=l[e];l[e]=[Zg.rangeToString(t[0],a),t[1]]}if(l.length>0&&(r.directStyles=l),this._ownStyles){let e=i.toJSON();e&&Object.keys(e).length>0&&(r.styles=e)}}catch(e){console.warn(e)}finally{i.endPersist()}}let c=xi(i.hyperlinkSpatial.all()),l=c.length;if(l>0){let e=Array(l);for(let t=0;t<l;t++){let n=c[t],r=n.value;e[t]={r:Zg.rangeToString(n,a),v:r}}r.hyperlinks=e}}let s=xi(i.commentsSpatial.all()),c=s.length;if(c>0){let e=Array(c);for(let t=0;t<c;t++){let n=s[t],r=n.value;typeof r==`string`&&(r={content:r});let i={...r};e[t]={r:Zg.rangeToString(n,a),v:i}}r.comments=e}let l=i.tables.toJSON();l&&l.length>0&&(r.tables=l);let u=i.autoTables.toJSON();u&&u.length>0&&(r.autoTable=u[0]);let d=i.dataValidations.toJSON();d&&d.length>0&&(r.validations=d);let f=i.conditionalFormats.toJSON();f&&f.length>0&&(r.conditionals=f);let p=i.protectedRanges.toJSON();p&&p.length>0&&(r.protectedRanges=p);let m=null;try{let e,n=this.getMovables().getItems(),i=n.length,a=t?.ignoreResources??!1;if(a?e=()=>0:(m=this._resources.beginPersist(),e=m.toResourceId.bind(m)),i>0){let t=[];for(let r=0;r<i;r++)try{let i=n[r].toJSON?.(e);i&&t.push(i)}catch(e){console.warn(`Unable to persist movable`,e)}t.length>0&&(r.movables=t)}let o=this.getPicture();o&&(r.picture=o.toJSON(e)),!a&&this._ownResources&&(r.resources=await m.toJSONAsync())}catch(e){console.warn(e)}finally{m?.endPersist()}if(o){let e=o.formulas;e&&(r.formulas=e);let t=o.formulaArray;t&&(r.formulaArray=t);let n=o.volatile;n&&(r.volatile=n)}return this._emitter.notify(`onSave`,{params:r}),r}getStyles(){return this._styles}getResources(){return this._resources}getTransactions(){return this._transactions}getStrings(){return this._strings}_searchMovables(t){let n=t?.ignoreHidden??!1,r=t?.bounds,i=t?.fullyContained,a=this,o=this._getState();if(o===null)return e.A.EmptyArray;let s=t?.address?this._rangeToCoords(t?.address):this._getEntireCoords();return this._getRangedEntries(o.movableSpatial,[s],{ignoreHidden:n,fullyContained:i,onEntry:e=>{let i=t?.type;if(i){if(Array.isArray(i)){if(!i.includes(e.model.getContent().getType()))return null}else if(i&&e.model.getContent().getType()!==i)return null}let o=null;if(n&&(e.model.isHidden()||(o=a._getBoundsAtCoords(e.model.getRange().getCoords()),o.width===0||o.height===0)))return null;if(r){o||=a._getBoundsAtCoords(e.model.getRange().getCoords());let t=o,n=r;if(t.y>n.y+n.height||t.y+t.height<n.y||t.x>n.x+n.width||t.x+t.width<n.x)return null}return e.model}}).sort((e,t)=>e.getZIndex()-t.getZIndex())}_updateSelectedMovables(t,n){let r=this.getView().getMovableSelection();if(!r||r.length===0)return;let i=this._beginCommit({description:n??e.v(`op.updateMovables`)});try{let e=r.length;for(let n=0;n<e;n++)t(r[n]);i.commit()}catch(e){throw i.rollback(),e}}async _addMovable(t){if(!this.getProtection().isObjectsAllowed())throw new e.s(e._(`error.sheet.insertItemProtected`));if(!t)throw new e.s(`No movable options provided`);if(this._closed)throw Error(e._(`error.sheet.modelClosed`));if(t.autoPlace===`viewport`&&t.bounds?.width!=null&&t.bounds?.height!=null){let e=(await this._emitter.notify(`onRequestViewport`,{async:!0}))?.find(Boolean)??null;if(e){let n=Math.min(t.bounds.width,e.width-8),r=Math.min(t.bounds.height,e.height-8);t={...t,bounds:{x:e.x+(e.width-n)/2,y:e.y+(e.height-r)/2,width:n,height:r}}}}let n={};t?.type&&(n.content={type:t.type,json:t?.json}),t?.anchorType&&(n.anchorType=t?.anchorType),t.bounds&&(n.anchor=null);let r=this._getState().movableSpatial,i=this._beginCommit({description:t?.description??e.v(`op.insertDrawing`)}),a=this._createMovableEntry(n,r.size(),t.fromResourceId),o=r.clone();o.insert(a);let s,c,l=this._getState().movableMapModel,u=new Map(l),d=a.value.model;if(u.set(d,a),this._updateState({movableSpatial:o,movableMapModel:u}),t.bounds&&a.value.model.setBounds(t.bounds,t),!1!==t?.autoSelect){s={view:this.getView(),movableSelection:this.getView().getMovableSelection()};let e=t?.autoSelect??!1;!0===e&&(e={autoFocus:!0,scrollIntoView:!0,addToSelection:!1}),e&&this.getView().selectMovables([a.value.model],e.addToSelection),c=e=>({...e,view:this.getView(),movableSelection:this.getView().getMovableSelection()})}return i.commit({viewBefore:s,viewAfter:c}),this._emitterMovables.notify(`onCollectionChange`),this._notify(`onMovablesChange`),a.value.model}async _addMovablePicture(t,n={type:`picture`}){if(!t)throw new e.s(e._(`error.sheet.noImageProvided`));if(!this.getProtection().isObjectsAllowed())throw new e.s(e._(`error.sheet.insertItemProtected`));let r=this._resources.add(t),i=await r.toBuffer(),a=await r.getType(),o=this._getBoundsAtCoords(this.getSelection().getRange().getCoords()),{naturalSize:s,asUrl:c}=await e.L.loadImageDetails(i,a?.mime);URL.revokeObjectURL(c);let l={...o,...s,...n?.bounds};if(e.A.isNullOrUndefined(n?.bounds?.x)||e.A.isNullOrUndefined(n?.bounds?.y)){let t=w_(this.getMovables(),l,e.A.isNullOrUndefined(n?.bounds?.x),e.A.isNullOrUndefined(n?.bounds?.y));l.x+=t.x,l.y+=t.y}n?.bounds&&!1!==n?.json?.lockAspect&&(e.A.isNullOrUndefined(n?.bounds.width)&&e.A.isDefined(n?.bounds.height)&&(l.width=l.height*s.width/s.height),e.A.isNullOrUndefined(n?.bounds.height)&&e.A.isDefined(n?.bounds.width)&&(l.height=l.width*s.height/s.width));let u={...n?.json,resId:0};return await this._addMovable({anchorType:Sh.Type.OneCell,description:e.v(`op.insertImage`),...n,bounds:l,type:`picture`,json:u,fromResourceId:e=>e===0?r:(console.warn(`received an unexpected resourceId`,e),null)})}setPicture(t,n){let r,i=this;return t&&(r=new y_({resource:this._resources.add(t),deleteFromContainer:t=>{i._getState().picture&&(i._updateState({picture:null},{description:e.v(`op.deletePicture`),...t}),i._notify(`onStyleChange`))},transactions:this._transactions})),i._updateState({picture:r},{description:e.v(r?`op.setPicture`:`op.removePicture`),...n}),this}getPicture(){return this._getState().picture??null}getTables(){return this._tables}getDataValidations(){return this._dataValidations}getConditionalFormats(){return this._conditionals}getProtectedRanges(){return this._protectedRanges}getConditionals(){return this._conditionals}getMovables(){return this._movables}_validateOrRemoveOverlaps(t,n,r=null,i=!1){let a=this;n!==`merge`&&D_(this._getMerges([t]),t,(t,r)=>{if(r||!i)throw new e.s(_v(n));a._unmerge([t])});let o=[],s=this.getTables().getItems({address:t}),c=s.length;for(let e=0;e<c;e++){let t=s[e];r!==t&&o.push(t.getRange().getCoords())}D_(o,t,(t,r,a)=>{if(r||!i)throw new e.s(_v(n));s[a].delete()});let l=this._getState().autoTables.search(t);l.length>0&&D_(l,t,(t,r,a)=>{if(r||!i)throw new e.s(_v(n));l[0].value.delete()})}_addTable(t,r){let i,a=this._rangeToCoords(t,()=>[`objects`]),o=this._getEntireCoords();if(typeof r==`boolean`?i=r:r&&(i=r.hasHeader),a.rowStart===a.rowEnd){if(a.rowEnd===o.rowEnd)throw new e.s(e._(`error.sheet.table1By1`));a.rowEnd+=1}i===void 0&&(i=BT(this,a)?.options?.hasHeader??!1);let s,c=I_([a]),l={...a},u=this._beginCommit({description:e.v(`op.insertTable`)});try{if(!i){let e=a.rowEnd<o.rowEnd,t={colStart:a.colStart,rowStart:a.rowEnd+1,colEnd:a.colEnd,rowEnd:a.rowEnd+1};e&&(this._isContentful([t])||this._contentCounts([t],[qg.Content.Formats]))&&this._insertCells([{...a,rowStart:a.rowStart,rowEnd:a.rowStart}],n.l.Axis.Row),e&&(a={...a,rowEnd:a.rowEnd+1})}this._validateOrRemoveOverlaps(a,`table`,null,!1);let e=r,t=e?.properties?.style??{};typeof t==`string`&&(t={name:t});let d={...e?.properties,style:t};d.style=t,t.name===void 0&&(t.name=this._styles.getDefaultTableStyle().getName());let f=this._getState().tables;f=this._createTables(f,`tables`,[{r:a,v:d}],e=>{let t=new a_({...e,syncSheet:!0});return s=t,t}),this._updateState({tables:f}),this._notify(`onTablesChange`),e?.disabledAutofit||this._autoFit(s.getRanges().getCoords(),{expandOnly:!0,formulaView:!1});let p=I_([a]);u.commit({viewBefore:{view:this.getView(),selection:c,ranges:[l]},viewAfter:{view:this.getView(),selection:p,ranges:[a],table:s}})}catch(e){throw u.rollback(),e}return s}_addDataValidation(t,n){let r,i,a;t||=this.getSelectedRanges(),t.isIDataValidation?(a=t.toJSON(),r=t.getRanges().getCoords()):(i=n,a={...i},r=t);let o,s=this._rangesToCoords(r,()=>[`objects`]),c=i?.autoSelect?I_(s):null,l=[...s],u=this._beginCommit({description:i?.description??e.v(`op.insertDataValidation`)});try{let e=this._getState().dataValidations;e=this._createDataValidations(e,`dataValidations`,[{r:s,v:a}],e=>{let t=new uv(e);return o=t,t}),this._updateState({dataValidations:e}),this._notifyDataValidationsChange(),this._autoFit(o.getRanges().getCoords(),{expandOnly:!0,formulaView:!1}),u.commit({viewBefore:{view:this.getView(),selection:c,ranges:l},viewAfter:{view:this.getView(),selection:c,ranges:l}}),this._autoSelect(i?.autoSelect,c)}catch(e){throw u.rollback(),e}return o}_addConditionalFormat(t,n){let r,i,a;t||=this.getSelectedRanges(),t.isIConditionalFormat?(a=t.toJSON(),r=t.getRanges().getCoords()):(i=n,a={...i},r=t);let o,s=this._rangesToCoords(r,()=>[`objects`]),c=i?.autoSelect?I_(s):null,l=[...s],u=this._beginCommit({description:i?.description??e.v(`op.insertConditionalFormat`)});try{let e=this._getState().conditionalFormats;e=this._createConditionalFormats(e,`conditionalFormats`,[{r:s,v:a}],e=>{let t=new Q_(e);return o=t,t}),this._updateState({conditionalFormats:e}),this._notifyConditionalFormatsChange(),this._autoFit(o.getRanges().getCoords(),{expandOnly:!0,formulaView:!1}),u.commit({viewBefore:{view:this.getView(),selection:c,ranges:l},viewAfter:{view:this.getView(),selection:c,ranges:l}}),this._autoSelect(i?.autoSelect,c)}catch(e){throw u.rollback(),e}return o}_nextProtectedRangeName(){let e=this._getState()?.protectedRanges;if(!e)return`Range1`;for(let t=1;;t++){let n=`Range${t}`;if(!e.getByName(n))return n}}_addProtectedRange(t,n){let r,i,a;t||=this.getSelectedRanges(),t.isIProtectedRange?(a=t.toJSON(),r=t.getRanges().getCoords()):(i=n,a={...i},r=t),a.name&&!this._getState().protectedRanges.getByName(a.name)||(a={...a,name:this._nextProtectedRangeName()});let o,s=this._rangesToCoords(r,()=>[`objects`]),c=i?.autoSelect?I_(s):null,l=[...s],u=this._beginCommit({description:i?.description??e.v(`op.insertProtectedRange`)});try{let e=this._getState().protectedRanges;e=this._createProtectedRanges(e,`protectedRanges`,[{r:s,v:a}],e=>{let t=new pv(e);return o=t,t}),this._updateState({protectedRanges:e}),this._notifyProtectedRangesChange(),u.commit({viewBefore:{view:this.getView(),selection:c,ranges:l},viewAfter:{view:this.getView(),selection:c,ranges:l}}),this._autoSelect(i?.autoSelect,c)}catch(e){throw u.rollback(),e}return o}createCell(e,t=null){return e?.createCell?e:(t?this.getRange(t).getCell():this._emptyCell).createCell(e)}_getBoundsAtCoords(e){let t=this._rowHeaders,n=this._colHeaders,r=n.getOffset(e.colStart),i=t.getOffset(e.rowStart);return{x:r,y:i,width:n.getOffset(e.colEnd+1)-r,height:t.getOffset(e.rowEnd+1)-i}}_getCoordsAtBounds(e){let t=this._rowHeaders,n=this._colHeaders,r=e.x,i=e.y;return{colStart:n.getIndex(r),rowStart:t.getIndex(i),colEnd:n.getIndex(r+e.width),rowEnd:t.getIndex(i+e.height)}}getRangeAtBounds(t,n){if(!t)throw new e.O;let r=this._getCoordsAtBounds(t);return this.getRange(r,n)}getRangeAt(e,t,n,r,i){return this.getRange({rowStart:e,colStart:t,rowEnd:n??e,colEnd:r??t},i)}_getVisible(t,r){return function(t,r,i){if(r.length===0)return r;let a=new va;a.load(r);let o=i?.axes??n.l.AxisSelection.Both,s=(e,t)=>{let n=a.search(e),r=n.length;for(let i=0;i<r;i++){let r=n[i],o=E_(r,e,t);a.remove(r),a.load(o)}},c=t.getEntireCoords();if(o===n.l.AxisSelection.Both||o===n.l.AxisSelection.Row){let e=t.rowHeaders,i=r.length;for(let t=0;t<i;t++){let i=r[t];e.getRange({min:i.rowStart,max:i.rowEnd}).forEachSpan((e,t)=>{if(e!==0)return;let r=t.getCoords();s({colStart:c.colStart,rowStart:r.min,colEnd:c.colEnd,rowEnd:r.max},n.l.Axis.Row)})}}if(o===n.l.AxisSelection.Both||o===n.l.AxisSelection.Column){let e=t.columnHeaders,i=r.length;for(let t=0;t<i;t++){let i=r[t];e.getRange({min:i.colStart,max:i.colEnd}).forEachSpan((e,t)=>{if(e!==0)return;let r=t.getCoords();s({colStart:r.min,rowStart:c.rowStart,colEnd:r.max,rowEnd:c.rowEnd},n.l.Axis.Column)})}}return a.all().sort(e.l.rowFirstRangeComparator)}(this._getReadCtx(),t,r)}_hasRangedEntries(t,n){return function(t,n,r){let i=t.state;if(!i)return!1;let a=i[n];if(!a)throw new e.s(`Invalid range key ${n}`);return!a.isEmpty()&&a.has(r)}(this._getReadCtx(),t,n)}_getRangedEntries(t,r,i,a=!1){return function(t,r,i,a){if(i.length===0||!r||r.isEmpty())return e.A.EmptyArray;let o,s=a?.spatialSort??!1,c=a?.ignoreHidden??!1,l=a?.fullyContained??!1,u=a?.onEntry??null,d=a?.onFound??null,f=a?.sort;f&&(o=e.l.createRangeComparator(f.axis,f.reverse));let p=new Set,m=(e,t)=>{let n=e.length,r=d&&o?[...e].sort(o):e;for(let e=0;e<n;e++){let n=r[e];d&&d(n,t),p.add(n)}},h=i.length;for(let e=0;e<h;e++){let a=i[e];if(c){if(!0===c){let e={min:a.colStart,max:a.colEnd},n={min:a.rowStart,max:a.rowEnd};t.rowHeaders.getRange(n).forEachSpan((n,i)=>{let a=i.getCoords(),o=a.min,c=a.max;t.columnHeaders.getRange(e).forEachSpan((e,t)=>{let n=t.getCoords(),i=n.min,a=n.max,u={colStart:i,rowStart:o,colEnd:a,rowEnd:c},d=r.search(u,l,s);d.length>0&&m(d,u)},FS)},FS)}else if(c===n.l.Axis.Column){let e={min:a.colStart,max:a.colEnd};t.columnHeaders.getRange(e).forEachSpan((e,t)=>{let n=t.getCoords(),i=n.min,o=n.max,c={colStart:i,rowStart:a.rowStart,colEnd:o,rowEnd:a.rowEnd},u=r.search(c,l,s);u.length>0&&m(u,c)},FS)}else if(c===n.l.Axis.Row){let e={min:a.rowStart,max:a.rowEnd};t.rowHeaders.getRange(e).forEachSpan((e,t)=>{let n=t.getCoords(),i=n.min,o=n.max,c={colStart:a.colStart,rowStart:i,colEnd:a.colEnd,rowEnd:o},u=r.search(c,l,s);u.length>0&&m(u,c)},FS)}}else{let e=a,t=r.search(e,l,s);t.length>0&&m(t,e)}}if(p.size===0)return e.A.EmptyArray;let g=Array.from(p.values());o&&g.sort(o);let _=[],v=new Set,y=g.length;for(let e=0;e<y;e++){let t;u&&(t=u(g[e].value,g[e])),t===void 0&&(t=g[e].value),t===null||v.has(t)||(v.add(t),_.push(t))}return _||=e.A.EmptyArray,_}(this._getReadCtx(),t,r,a?{...i,spatialSort:!0}:i)}_processAnchorShift(t){let n=t.after,r=e.l.sanitizeRange(t.after),i=e.l.sanitizeRange(t.before);t.after&&this._validateCoords(r,e._(`error.sheet.insertItemOob`));let a=t.before.value.callbacks?.processShift?.({...t,after:r,before:i});return a&&(FT(a,r)||(n||=t.before,n={...n,...a})),n}_processListenerShift(t,n,r,i){if(i.isSplit||i.before.value.options.ignoreShifts)return[i.before];let a=null;i.after&&(a=e.l.intersectRanges(e.l.sanitizeRange(i.after),this._getEntireCoords()),i.after,a.colStart,a.rowStart,a.colEnd,a.rowEnd);let o=i.before.value,s=o.id,c=t.get(s),l={...c},u=[...c.ranges];l.ranges=u,u[o.offset]=a?{...u[o.offset],...a}:null,t.set(s,l);let d=r.get(s);n.set(s,{beforeState:d,afterState:l})}delete(){if(this._closed)return;try{this._notify(`onBeforeDelete`)}catch(t){throw t instanceof Error?t:new e.s(t.message??e._(`error.sheet.modelDelete`))}let t=this._beginCommit({description:e._(`op.deleteSheet`,{name:this.getName()})}),r=this._getState(),i=r.rangeListenerSpatial,a=r.rangesListenerMap,o=new Map;i=i.shift({range:this._getEntireCoords(),direction:n.l.Direction.Left,cloneIfUpdate:i===r.rangeListenerSpatial,onShift:e=>{a===r.rangesListenerMap&&(a=new Map(a)),this._processListenerShift(a,o,r.rangesListenerMap,e)}}),this._updateState({rangeListenerSpatial:i,rangesListenerMap:a,deleted:!0});let s=r.calcGrid.clone();s.delete(),this._updateState({calcGrid:s}),this._deleteCells([this._getEntireCoords()]),this._notify(`onDelete`),this._rangesListenerMap.forEach((e,t)=>{o.set(t,{beforeState:e,afterState:null})}),t.commit({viewAfter:e=>({...e,view:this.getView(),selection:this.getSelection().getCoords(),listeners:o})})}doBatch(t,n){let r=this;return n=typeof n==`string`?{description:n}:{description:e.v(`op.updateSheet`),...n},this._transactions.doBatch(t,n,(e,t)=>{if(e.getDepth()===0&&(r._lastTransactionUUID=e.getId(),n?.autoSelect)){let t=e.getView()?.selection;t&&r._autoSelect(!0,t)}})}isDeleted(){let e=this._getState();return!e||e?.deleted}isClosed(){return this._closed}close(){if(this._closed)return;this._protectionRemoveListener?.(),this._protection=new kh(void 0,this._options.readonly);let e=this._getState();e.tables.close(),e.autoTables.close(),this._searchMovables().forEach(e=>{e.close()}),this._notify(`onClose`),this._ownResources,this._namesRemoveListener?.(),this._ownNames&&this._names.close(),this._ownCalculation&&this._calculation.close(),this._ownStyles,this._colHeaders.close(),this._rowHeaders.close(),this._emitter.close(),this._transactionsRemoveListener?.(),this._closed=!0}beginCommit(t){if(this._closed)throw Error(e._(`error.sheet.modelClosed`));return this._beginCommit(typeof t==`string`?{description:t}:t)}_getState(){return this._closed?null:this._transactions.getState(this._stateId)}_getStateId(){return this._stateId}_beginCommit(e){let t=this;return this._transactions.beginCommit(e,e=>{e.getDepth()===0&&(t._lastTransactionUUID=e.getId())})}_updateState(e,t){if(!e)return;this._lastGetRangeRead=null;let n,r=this._transactions.beginCommit(t);try{n=r.updateState(this._stateId,e),r.commit()}catch(e){throw r.rollback(),e}return n}_addEvent(e,t){let n=this.getTransactions().getPendingView();if(!n)return;let r=n.events;if(r||(r={},n.events=r),e===`address`){let e=r.address;if(e||(e=new Map,r.address=e),typeof t==`string`)e.set(t,null);else{let n=t;if(n.options.ignoreAddressChanges)return;e.set(n.uuid,t)}}else if(e===`data`)if(typeof t==`string`){let e=r.dataListeners;e||(e=new Map,r.dataListeners=e),e.set(t,null)}else{let e=r.data;e||(e=[],r.data=e),e.push(t)}}_getScalar(t,n,r=!1){let i,a=this._getState();if(i===void 0&&(i=a.cellValuesGrid.getValueAt(t,n)),i===void 0)return null;let o=i;if(r&&typeof o==`number`){let r=!1;Lw.colStart=n,Lw.rowStart=t,Lw.colEnd=n,Lw.rowEnd=t;let i=this._lastValueRead,s=this._lastValueRead.range;if(s&&e.l.isRangeWithinRange(Lw,s))r=i.isDateOrTime;else{let e=a.dateFormatSpatial.search(Lw);r=e.length>0,r&&(i.range=e[0],i.isDateOrTime=!0)}r&&(o=ur(o,this._isDate1904))}return o}_markColumnHeaderTableNames(){let t=this._getState();if(!t)return;let n=this.getView().getColumnHeaderTableNames(),r=this._cacheTableColumnHeaders,i=r.showInHeader,a=t.tables;if(n===av.ColumnHeaderTableNames.None||a.isEmpty())return void(r.table&&(r.table=null,r.showInHeader=!1,r.tableMin=-1,r.tableMax=-1,r.lastTop=-1,r.lastColIndex=-1,r.lastRowIndex=-1,i&&this._notify(`onViewChange`)));let o,s=this.getSelection().getCoords().cell,c=s.colIndex,l=s.rowIndex,u=c!==r.lastColIndex||l!==r.lastRowIndex,d=r.table;if(u?(r.lastColIndex=c,r.lastRowIndex=l,d&&e.l.isCellWithinRange(s,d.getRange().getCoords())?o=d:(Vw.colStart=c,Vw.rowStart=l,Vw.colEnd=c,Vw.rowEnd=l,o=a.search(Vw)[0]?.value??null)):o=d,!o)return r.showInHeader=!1,r.table=null,r.tableMin=-1,r.tableMax=-1,void(i&&this._notify(`onViewChange`));r.table=o;let f,p=o.getRange().getCoords();if(p){if(r.tableMin=p.colStart,r.tableMax=p.colEnd,n===av.ColumnHeaderTableNames.Sticky){let t=r.lastTop,n=this.getView(),i=n.getFreezePanes(),a=((i.coords?.rowIndex??0)>0?i.topLeft:n.getTopLeft())?.top??t;if(t===a&&d===o)return;r.lastTop=a;let s={colIndex:p.colStart,rowIndex:this.getRowHeaders().getIndex(a)-1};f=e.l.isCellWithinRange(s,p)}else n===av.ColumnHeaderTableNames.Hidden&&(f=o.isITable&&!o.isHeaderVisible());r.showInHeader=f,f!==i&&this._notify(`onViewChange`)}}_getCellAt(t,r){let i=this._getState();if(!i)return this._emptyCell;let a={rowIndex:t,colIndex:r},o=i.cellValuesGrid.getValueAt(t,r),s=o===void 0?null:o,c=[];this._collectRanges(e.l.cellToRange(a),c);let l=NT(c);if(l&&Object.keys(l).length===0&&(l=null),s===null&&!l)return new Dx(this._cellOptions,a);let u=s===null?n.n.Null:nE(s);return new Dx(this._cellOptions,a,u,s,l)}_queryStyle(t,n,r){if(this._closed)throw Error(e._(`error.sheet.modelClosed`));Hw.length=0;let i=Hw;return this._collectRanges(t,i),Sx(null,t,NT(i),n,!0,r)}_getStyle(e,t,n){let r;if(t)r={colStart:t.cell.colIndex,rowStart:t.cell.rowIndex,colEnd:t.cell.colIndex,rowEnd:t.cell.rowIndex};else{let t=e[0];r={colStart:t.colStart,rowStart:t.rowStart,colEnd:t.colStart,rowEnd:t.rowStart}}let i=e.length===1?e[0]:void 0,a=this,o=this._cellOptions;return o={...o,styleUpdater:(t,s)=>(n?n(t,s):a._updateStyles(e,t,s),a._queryStyle(r,o,i))},a._queryStyle(r,o,i)}_initHeadersState(e,t){let r=this;this._cacheTableColumnHeaders={table:null,showInHeader:!1,tableMin:-1,tableMax:-1,lastTop:0,lastColIndex:-1,lastRowIndex:-1},this._defaultFontBoundsCache=null,this._defaultColWidthCache=0,this._defaultRowHeightCache=0,this._colHeadersRemoveListener?.(),this._colHeadersHiddenRemoveListener?.(),this._colHeaders=new AS({sheet:r,json:e,axis:n.l.Axis.Column,transactions:this._transactions,isProtected:()=>!r._initializing&&!r.getProtection().isFormatColumnsAllowed(),getColumnAt:e=>{let t=r._cacheTableColumnHeaders;if(!t.showInHeader||e>t.tableMax||e<t.tableMin)return null;let n=e-t.tableMin;return t.table.getColumnAt(n)},getTextAt:e=>{let t=r._cacheTableColumnHeaders;if(t.showInHeader&&e<=t.tableMax&&e>=t.tableMin){let n=t.table.getColumns()[e-t.tableMin];if(n&&n.getName()!==void 0)return n.getName()}let n=this.getView().getColumnHeaderStyle();return n===av.HeaderTextStyle.A1?Kw(e):n===av.HeaderTextStyle.Zero?Gw(e):n===av.HeaderTextStyle.One?qw(e):void 0},defaultSize:()=>this._defaultColWidth(),scaleFactor:()=>{let e=this.getView().isShowFormulas()?2:1;return Math.round(this._defaultFontDims().width)*e},maxSize:()=>255,getEntireSheetCoords:()=>r._getEntireCoords(),setContainerShiftedCallback:e=>{this._colHeadersShiftCallback=e}}),this._colHeadersRemoveListener=this._colHeaders.addListeners(this._colHeadersListener,{transactional:!0}),this._colHeadersHiddenRemoveListener=this._colHeaders.addListeners({onHiddenChange:()=>{r._notify(`onColumnsHiddenChange`)}},{transactional:!1}),this._rowHeadersRemoveListener?.(),this._rowHeadersHiddenRemoveListener?.();let i=U.getDeviceScale();this._rowHeaders=new AS({sheet:r,json:t,axis:n.l.Axis.Row,transactions:this._transactions,isProtected:()=>!r._initializing&&!r.getProtection().isFormatRowsAllowed(),getTextAt:e=>{let t=this.getView().getRowHeaderStyle();return t===av.HeaderTextStyle.One?qw(e):t===av.HeaderTextStyle.Zero?Gw(e):t===av.HeaderTextStyle.A1?Kw(e):void 0},defaultSize:()=>this._defaultRowHeight(),scaleFactor:()=>i,minSize:()=>0,maxSize:()=>409,getEntireSheetCoords:()=>r._getEntireCoords(),setContainerShiftedCallback:e=>{this._rowHeadersShiftCallback=e}}),this._rowHeadersRemoveListener=this._rowHeaders.addListeners(this._rowHeadersListener,{transactional:!0}),this._rowHeadersHiddenRemoveListener=this._rowHeaders.addListeners({onHiddenChange:()=>{r._notify(`onRowsHiddenChange`)}},{transactional:!1})}_invalidateCaches(){this._lastCellDecoded.address=null,this._lastCellSelected.coords=null,this._lastCellRead.coords=null,this._lastValueRead.range=null,this._cellOptions?.renderCellCache?.clear(),this._lastGetRangeRead={},this._lastUsedCoordsRead.coords=null,this._lastRangeRead.address=null,this._entireCoordsCache=null,this._entireRangeCache=null}_initListenerState(){let t=this,r=()=>{t._invalidateCaches()};this._transactionsRemoveListener=this._transactions.addStateListener(this._stateId,{onBeforeCommitStart(n,r,i){if(!t._initializing&&!r?.skipProtectionCheck&&t.getProtection().isLocked())throw new e.s(e._(`error.sheet.protectedSheet`))},async onBeforeCommitEnd(e,n,r){let i=()=>r.getId();if(n?.ranges){let a={isDataChange:!0,getTransactionId:i,timeStamp:r.getTimestamp(),trigger:`setCells`},o=e.rangeListenerSpatial,s=e.rangesListenerMap;t._notifyRangeListeners(o,s,n.ranges,a)}if(n?.listeners){let a={isDataChange:!1,getTransactionId:i,timeStamp:r.getTimestamp(),trigger:`shiftCells`},o=e.rangeListenerSpatial,s=e.rangesListenerMap;t._notifyRangeListeners(o,s,n.ranges,a)}},async onRestoreOrRevert(e,n,i,a){r();let o=()=>i.getId();t._calculateFull(),t._rangeStats=t._rangeStats.clone(e.cellValuesGrid),n&&(n===t.getView()&&n.selection&&t._autoSelect(n.selectOptions??!0,n.selection),n.freezePanes&&t.getView().setFreezePanes({coords:n.freezePanes}),n.movableSelection&&t.getView().selectMovables(n.movableSelection)),t._notify(`onViewChange`),t._notify(`onInvalidated`),t._emitterMovables.notify(`onInvalidated`),t._notifyUsedRangeChange();let s=t._rangesListenerMap;if(s.size>0){let e={isDataChange:!0,getTransactionId:o,timeStamp:i.getTimestamp(),isUndo:a,isRestoreOrRevert:!0,trigger:`invalidate`},n=t._rangeListenerSpatial,r=new Set;s.forEach((i,a)=>{let o=i.id;if(r.has(o))return;let c=i.ranges;c&&(r.add(o),t._notifyRangeListeners(n,s,c,e))})}},async onAfterStateChange(e,n,i,a,o){let s=()=>i.getId();r(),n&&i.getId()!==t._lastTransactionUUID&&n.view===t.getView()&&n.selection&&(a||o)&&t._autoSelect(n.selectOptions??!0,n.selection),t._lastTransactionUUID=i.getId(),n?.merges&&t._notify(`onMergesChange`),n?.spills&&t._notify(`onSpillsChange`);let c=t._rangesListenerSorted;if(c.size>0){t._notifyUsedRangeChange();let r=new Set,l=e.rangesListenerMap2,u={getTransactionId:s,timeStamp:i.getTimestamp()};if((o||a)&&(u.trigger=`restore`,t._notifyAddressListeners(l,l,r,u),c.size>l.size)){let e=c.values(),t=e.next(),n=!1;for(;!n&&!t.done;){let r=t.value;n=l.has(r.uuid),n||(r.notify(u,`#N/A`),t=e.next())}}let d=n?.events;d&&(d.address&&(u.trigger=`address`,t._notifyAddressListeners(l,d.address,r,u)),d.dataListeners&&(u.trigger=`data`,t._notifyAddressListeners(l,d.dataListeners,r,u)),d.data&&(u.trigger=`data`,t._notifyDataListeners(e.rangesListenerSpatial2,e.rangesListenerMap2,d.data,r,u)))}if(n&&!n.initial&&((a||o||!n.calculationSideEffect)&&n.ranges&&((a||o)&&e.calcGrid.markDirtyRegions(n.ranges),e.calcGrid.calculate()),n.ranges)){t._notifyUsedRangeChange();let e=t._rangesListenerMap;if(e.size>0){let r={isDataChange:!0,getTransactionId:s,timeStamp:i.getTimestamp(),isUndo:a,trigger:`setCells`};t._notifyRangeListeners(t._rangeListenerSpatial,e,n.ranges,r)}t._notify(`onDataChange`)}},onClose(){let e=t._getState();e&&e.movableSpatial.clear()}}),this._colHeadersListener={onSizesChange:e=>{t._isAdjustHeaders||t._processLayoutChange()}},this._rowHeadersListener={onSizesChange:e=>{t._isAdjustHeaders||t._processLayoutChange()}};let i=new Set,a={onTopLeftChange(e){t._markColumnHeaderTableNames(),t._notify(`onTopLeftChange`)},onZoomScaleChange(e){t._notify(`onZoomScaleChange`)},onFreezePaneChange(e){t._notify(`onFreezePaneChange`)},onHeaderChange(e){t._markColumnHeaderTableNames(),t._notify(`onNameChange`)},onSelectionChange(e){t._markColumnHeaderTableNames(),t._notify(`onSelectionChange`)},onMovableSelectionChange(e){let n=e.getMovableSelection(),r=new Map,a=new Set,o=t._getState().movableMapModel,s=n.length;for(let e=0;e<s;e++){let t=n[e];i.has(t)?i.delete(t):r.set(t,e),a.add(t)}i.forEach(e=>{o.get(e)?.value?.callbacks.processSelection(!1,!1)}),r.forEach((e,t)=>{o.get(t)?.value?.callbacks.processSelection(!0,e===0)}),i=a,t._notify(`onMovableSelectionChange`)},onAnyChange(){t._defaultColWidthCache=0,t._defaultRowHeightCache=0,t._defaultFontBoundsCache=null,t._notify(`onLayoutChange`),t._notify(`onViewChange`)}};this._viewListener=a,this._protectionListener={onChange(){if(t._closed)throw Error(e._(`error.sheet.modelClosed`));t._getState().movableMapModel.forEach(e=>{e.value?.callbacks.processProtection?.()}),t._getState().tables.processCallbacks((e,t)=>{t.processProtection?.()}),t._notify(`onProtectionChange`)}},this._stylesListener={onAnyChange(){t._defaultColWidthCache=0,t._defaultRowHeightCache=0,t._defaultFontBoundsCache=null,t._notify(`onLayoutChange`),t._notify(`onStyleChange`),t._notify(`onViewChange`);let e=t._getEntireCoords();t._autoFit([e],{axes:n.l.AxisSelection.Both,skipCustomSize:!0,expandOnly:!0,formulaView:!1})}}}_initViewState(t,r){this._lastGetRangeRead=null,this._lastCellDecoded.address=null,this._lastCellSelected.coords=null,this._lastCellRead.coords=null,this._cellOptions?.renderCellCache?.clear(),this._entireCoordsCache=t,this._entireRangeCache=null;let i=this;this._protectionRemoveListener?.(),this._protection=new kh(void 0,this._options.readonly),this._protectionRemoveListener=this._protection.addListeners(this._protectionListener),this._stylesRemoveListener?.(),this._stylesRemoveListener=this._styles.addListeners(this._stylesListener),this._viewRemoveListener?.();let a=new FC({sheet:this,json:r});this._view=a,this._viewRemoveListener=a.addListeners(this._viewListener,{transactional:!1}),this._rangeListenerSpatial=new va,this._rangesListenerMap=new Map,this._rangesListenerSorted=new ui,this._getEntireCoords.bind(this);let o=e=>{let t=i._getState().rangesListenerSpatial2;if(t.isEmpty())return;let n=e.length;for(let r=0;r<n;r++){let n=e[r],a=t.search(n),o=a.length;for(let e=0;e<o;e++){let t=a[e].value.groupId;i._addEvent(`data`,t)}}},s=this._calculation._createCalcGrid({onCalculated(e){i._realizeCalcedValues(e)},getEntireCoords:()=>i._getEntireCoords(),getSheetName:()=>i.getName(),uuid:i.getId()});s.addListeners({onStart(e){},onInvalidate:()=>{}});let c={getRanges:(e,t)=>{if(!e)return new gT(this);let n=this._rangesToCoords(e);return i._createRanges(n,t)},getEntireRange:i.getEntireRange.bind(i)},l=new Ya({axis:this._isDataColumn?n.l.Axis.Column:n.l.Axis.Row});this._rangeStats=new eD(this._runtime,l,null),this._updateState({rangesListenerSpatial2:new va({updateEntryOptions:{onShifted:e=>{let t=i._getState().rangesListenerMap2;if(t.size===0)return;t=new Map(t);let n=e.length;for(let r=0;r<n;r++){let n=e[r],a=n.value.groupId,o=t.get(a);o=o.processShift(n),i._addEvent(`address`,o),t.set(a,o)}i._updateState({rangesListenerMap2:t})},onRemoved:e=>{let t=i._getState().rangesListenerMap2;if(t.size===0)return;t=new Map(t);let n=e.length;for(let r=0;r<n;r++){let n=e[r],a=n.value.groupId,o=t.get(a);o=o.processRemove(n),i._addEvent(`address`,o),t.set(a,o)}i._updateState({rangesListenerMap2:t})}}}),rangesListenerMap2:new Map,cellValuesGrid:l,spillSpatial:new va,pendingSpatial:new va,calcErrorsSpatial:new va,errorSpatial:new va({updateEntryOptions:{isMergeOnShift:!0,isTrailingEdge:!0}}),calcGrid:s,borderSpatial:new MS({updateEntryOptions:{isMergeOnShift:!0,isTrailingEdge:!0,onUpdated:o,onRemoved:o},entireCoords:t}),fillSpatial:new MS({updateEntryOptions:{isMergeOnShift:!0,isTrailingEdge:!0,onUpdated:o,onRemoved:o},entireCoords:t}),contentSpatial:new MS({updateEntryOptions:{isMergeOnShift:!0,isTrailingEdge:!0,onUpdated:o,onRemoved:o},entireCoords:t}),continuousFillSpatial:new va({updateEntryOptions:{isMergeOnShift:!0,isTrailingEdge:!0}}),dateFormatSpatial:new va({updateEntryOptions:{isMergeOnShift:!0,isTrailingEdge:!0}}),mergeSpatial:new MS({updateEntryOptions:{getShifted(e,t,n){let r=wm(n,i._getEntireCoords());return r?{...r,value:new xy(r,e.value._tvTl)}:null},getSplit(t,n){throw new e.s(e._(`error.sheet.insertMergeThrough`))},onUpdated:o,onRemoved:o},entireCoords:t}),movableMapModel:new Map,movableSpatial:new va({updateEntryOptions:{getShifted(e,t,n){let r=e.value.callbacks.processShift?.(n),a=null,o=new Map(i._getState().movableMapModel),s=e.value.model;return r?(a={...r,value:{...e.value}},o.set(s,a)):o.delete(s),i._updateState({movableMapModel:o}),a}}}),picture:null,hyperlinkSpatial:new va({updateEntryOptions:{isSplitOnExpand:!0,isMergeOnShift:!0}}),commentsSpatial:new va({updateEntryOptions:{isSplitOnExpand:!0,isMergeOnShift:!0,onUpdated:o,onRemoved:o}}),autoTables:new Zh(c),tables:new Zh(c),conditionalFormats:new Zh(c),dataValidations:new Zh(c),protectedRanges:new Zh(c),entireCoords:{colStart:0,rowStart:0,colEnd:Ww.width-1,rowEnd:Ww.height-1},rangeListenerSpatial:new va,rangesListenerMap:new Map,contentfulSpatial:new va({updateEntryOptions:{isSplitOnExpand:!0,isMergeOnShift:!0,onShifted:e=>{let t=this._getEntireCoords(),n=t.rowEnd,r=t.colEnd,a=i._getState().rangesListenerSpatial2;if(a.size()===0)return;let o=e.length;for(let t=0;t<o;t++){let o=e[t],s=a.search({colStart:o.colStart,rowStart:o.rowStart,colEnd:r,rowEnd:n}),c=s.length;for(let e=0;e<c;e++){let t=s[e].value.groupId;i._addEvent(`data`,t)}}},onRemoved:o,onUpdated:o}}),deleted:!1})}_initCellState(){let t=this,r={colStart:0,rowStart:0,colEnd:0,rowEnd:0},i=[r],a={ignoreHidden:!0,sort:{axis:n.l.Axis.Column,reverse:!1}};this._cellOptions={runtime:this._runtime,renderCellCache:new Hh({max:Fw}),doBatchCalcGrid:(e,n)=>{let r=this._getState(),i=this._beginCommit(n);try{let n=r.calcGrid.clone(),a=e(n);t._updateState({calcGrid:n}),t._commitAndAutoSelect(i,null,!1,{viewAfter:{ranges:[a]}})}catch(e){throw i.rollback(),e}},sheet:this,normalStyleRanged:this._normalStyleRanged,colHeaders:this._colHeaders,styles:this._styles,getRange:this.getRange.bind(this),getRanges:this.getRanges.bind(this),getProtection:this.getProtection.bind(this),getCalcGrid:()=>this._getState().calcGrid,dependencyRanges:this._dependencyRanges.bind(this),resolveSheetScope:e=>this._resolveSheetScope(e),autoCorrect:(e,t)=>this.getCalculation().createFormula(e,{...t,scope:this.getName()}).autoCorrect(),createAt:(e,t)=>this.getCalculation().createFormula(e,{...t,scope:this.getName()}),nextContentful:(n,o,s=!1)=>{r.colStart=s?o:n.colIndex+1,r.rowStart=n.rowIndex,r.colEnd=s?n.colIndex-1:o,r.rowEnd=n.rowIndex,a.sort.reverse=s;let c=t._getState();if(!c)return e.A.EmptyArray;let l=t._getRangedEntries(c.contentfulSpatial,i,a);if(!l||l.length===0)return o;let u=l[0],d=s?u.getState().colStart:u.getState().colEnd;return s?Math.min(d+1,n.colIndex):Math.max(d-1,n.colIndex)},styleUpdater:(e,n,r)=>{let i=[r];return t._updateStyles(i,e,n),t._getStyle(i)},opener:async(e,t,n,r)=>{if(e.startsWith(`#`)){e=e.substring(1);let n=this._rangesToCoords(e),r=n[0]?.scope;if(r&&r!==this.getName()){let n=this.getWorkbook()?.getSheets().getByName(r)??null;return!!n&&(await n.getRanges(e).select(t??!0),!0)}return await this._autoSelect(t??!0,I_(n)),!0}{let t=this._options.opener;return t?t(e,n??`_blank`,r):window.open(e,n??`_blank`,r),!0}}},this._emptyCell=new Ox(this._cellOptions)}_createTables(t,n,r,i,a){let o=this,s=()=>{let e=o._cacheTableColumnHeaders;e.lastRowIndex=-1,e.lastColIndex=-1,o._markColumnHeaderTableNames()};a||=e=>e.addListeners({onAnchorCoordsChange(){s(),o._notify(`onTablesChange`)},onSortChange(){o._notify(`onTablesChange`)},onFilterChange(){o._notify(`onTablesChange`)},onHiddenButtonsChange(){o._notify(`onTablesChange`)},onStyleChange(){o._notify(`onStyleChange`)},onDelete(e){s(),o._notify(`onTablesChange`),o._notify(`onStyleChange`)}},{transactional:!1});let c={createModel:e=>i({transactions:o._transactions,sheet:o,names:o._names,isProtected:()=>!o._initializing&&!o.getProtection().isObjectsAllowed(),processTableUpdate(){o._notifyUsedRangeChange()},...e}),addListeners:a,setContainerCoords(t,r,i){let a=i?.description??e.v(`op.resizeTable`);o._protectionCheck(()=>[`objects`],r,a);let s=r[0];o._validateOrRemoveOverlaps(s,`table`,t);let c=o._beginCommit({description:a}),l=o._getState()?.[n];l=l.setCoords(t,[s]),o._updateState({[n]:l}),c.commit({viewAfter:{view:o.getView(),selection:I_(t.getRanges().getCoords())}})},setContainerName(t,r,i){let a=i?.description??e.v(`op.setTableName`);o._protectionCheck(()=>[`objects`],void 0,a);let s=o._beginCommit({description:a});try{let a=o._getState()?.[n];if(a.getByName(r))throw new e.s((t=>e._(`error.sheet.uniqueName`,{name:t}))(r));a=a.setName(t,r),o._updateState({[n]:a},i),s.commit()}catch(e){throw s.rollback(),e}},deleteFromContainer(t,r){let i=r?.description??e._(`op.deleteTableNamed`,{name:t.getName?.()});o._protectionCheck(()=>[`objects`],void 0,i);let a=o._beginCommit({description:i}),c=o._getState()?.[n];c=c.deleteModel(t),o._updateState({[n]:c}),o._notify(`onTablesChange`),o._notify(`onLayoutChange`),s(),a.commit({viewAfter:{sheet:o,view:o.getView(),selection:I_(t.getRanges().getCoords())}})}};return t.load(r,c)}_createDataValidations(t,n,r,i,a){let o=this;a||=e=>e.addListeners({onAnchorCoordsChange(){o._notifyDataValidationsChange()},onDelete(e){o._notifyDataValidationsChange()}},{transactional:!1});let s={createModel:e=>i({transactions:o._transactions,isProtected:()=>!o._initializing&&!o.getProtection().isObjectsAllowed(),getGridValues:()=>o._getState().cellValuesGrid,getRuntime:()=>o.getRuntime(),getCalculation:()=>o._calculation??null,...e}),addListeners:a,invalidate(e){o._addEvent(`data`,e),o._notifyUsedRangeChange(),o._notifyDataValidationsChange()},setContainerCoords(t,r,i){let a=i?.description??e.v(`op.updateDataValidations`);o._protectionCheck(()=>[`objects`],t.getRanges().getCoords(),a),o._protectionCheck(()=>[`objects`],r,a);let s=o._beginCommit({description:a}),c=o._getState()?.[n];c=c.setCoords(t,r),o._updateState({[n]:c}),o._notifyDataValidationsChange(),s.commit({viewAfter:{view:o.getView(),selection:I_(t.getRanges().getCoords())}})},getContainerIndex:e=>(o._getState()?.[n]).getIndex(e)??-1,setContainerIndex(t,r,i){let a=i?.description??e.v(`op.reorderDataValidations`);o._protectionCheck(()=>[`objects`],t.getRanges().getCoords(),a);let s=o._beginCommit({description:a}),c=o._getState()?.[n];c=c.setIndex(t,r),o._updateState({[n]:c}),o._notifyDataValidationsChange(),s.commit({viewAfter:{view:o.getView(),selection:I_(t.getRanges().getCoords())}})},deleteFromContainer(t,r){let i=r?.description??e._(`op.deleteDataValidationNamed`,{name:t.getName?.()});o._protectionCheck(()=>[`objects`],void 0,i);let a=o._beginCommit({description:i}),s=o._getState()?.[n];s=s.deleteModel(t),o._updateState({[n]:s}),o._notifyDataValidationsChange(),a.commit({viewAfter:{sheet:o,view:o.getView(),selection:I_(t.getRanges().getCoords())}})}};return t.load(r,s)}_createConditionalFormats(t,n,r,i,a){let o=this;a||=e=>e.addListeners({onAnchorCoordsChange(){o._notifyConditionalFormatsChange()},onDelete(e){o._notifyConditionalFormatsChange()}},{transactional:!1});let s={createModel:e=>i({transactions:o._transactions,sheet:o,isProtected:()=>!o._initializing&&!o.getProtection().isObjectsAllowed(),getGridValues:()=>o._getState().cellValuesGrid,getRuntime:()=>o.getRuntime(),getCalculation:()=>o._calculation??null,...e}),addListeners:a,invalidate(e){o._invalidateCaches(),o._addEvent(`data`,e),o._notifyUsedRangeChange(),o._notifyConditionalFormatsChange()},setContainerCoords(t,r,i){let a=i?.description??e.v(`op.updateConditionalFormat`);o._protectionCheck(()=>[`objects`],t.getRanges().getCoords(),a),o._protectionCheck(()=>[`objects`],r,a);let s=o._beginCommit({description:a}),c=o._getState()?.[n];c=c.setCoords(t,r),o._updateState({[n]:c}),o._notifyConditionalFormatsChange(),s.commit({viewAfter:{view:o.getView(),selection:I_(t.getRanges().getCoords())}})},getContainerIndex:e=>(o._getState()?.[n]).getIndex(e)??-1,setContainerIndex(t,r,i){let a=i?.description??e.v(`op.reorderConditionalFormat`);o._protectionCheck(()=>[`objects`],t.getRanges().getCoords(),a);let s=o._beginCommit({description:a}),c=o._getState()?.[n];c=c.setIndex(t,r),o._updateState({[n]:c}),o._notifyConditionalFormatsChange(),s.commit({viewAfter:{view:o.getView(),selection:I_(t.getRanges().getCoords())}})},deleteFromContainer(t,r){let i=r?.description??e._(`op.deleteConditionalFormatNamed`,{name:t.getName?.()});o._protectionCheck(()=>[`objects`],void 0,i);let a=o._beginCommit({description:i}),s=o._getState()?.[n];s=s.deleteModel(t),o._updateState({[n]:s}),o._notifyConditionalFormatsChange(),a.commit({viewAfter:{sheet:o,view:o.getView(),selection:I_(t.getRanges().getCoords())}})}};return t.load(r,s)}_createProtectedRanges(t,n,r,i,a){let o=this;a||=e=>e.addListeners({onAnchorCoordsChange(){o._notifyProtectedRangesChange()},onConfigChange(){o._notifyProtectedRangesChange()},onDelete(e){o._notifyProtectedRangesChange()}},{transactional:!1});let s={createModel:e=>i({transactions:o._transactions,isProtected:()=>!o._initializing&&!o.getProtection().isObjectsAllowed(),...e}),addListeners:a,invalidate(e){o._addEvent(`data`,e),o._notifyProtectedRangesChange()},setContainerCoords(t,r,i){let a=i?.description??e.v(`op.updateProtectedRanges`);o._protectionCheck(()=>[`objects`],t.getRanges().getCoords(),a),o._protectionCheck(()=>[`objects`],r,a);let s=o._beginCommit({description:a}),c=o._getState()?.[n];c=c.setCoords(t,r),o._updateState({[n]:c}),o._notifyProtectedRangesChange(),s.commit({viewAfter:{view:o.getView(),selection:I_(t.getRanges().getCoords())}})},setContainerName(t,r,i){let a=i?.description??e.v(`op.setProtectedRangeName`);o._protectionCheck(()=>[`objects`],void 0,a);let s=o._beginCommit({description:a});try{let a=o._getState()?.[n],c=a.getByName(r);if(c&&c!==t)throw new e.s(e._(`error.protectedRange.uniqueName`,{name:r}));a=a.setName(t,r),o._updateState({[n]:a},i),o._notifyProtectedRangesChange(),s.commit()}catch(e){throw s.rollback(),e}},getContainerIndex:e=>(o._getState()?.[n]).getIndex(e)??-1,setContainerIndex(t,r,i){let a=i?.description??e.v(`op.reorderProtectedRange`);o._protectionCheck(()=>[`objects`],t.getRanges().getCoords(),a);let s=o._beginCommit({description:a}),c=o._getState()?.[n];c=c.setIndex(t,r),o._updateState({[n]:c}),o._notifyProtectedRangesChange(),s.commit({viewAfter:{view:o.getView(),selection:I_(t.getRanges().getCoords())}})},deleteFromContainer(t,r){let i=r?.description??e._(`op.deleteProtectedRangeNamed`,{name:t.getName?.()});o._protectionCheck(()=>[`objects`],void 0,i);let a=o._beginCommit({description:i}),s=o._getState()?.[n];s=s.deleteModel(t),o._updateState({[n]:s}),o._notifyProtectedRangesChange(),a.commit({viewAfter:{sheet:o,view:o.getView(),selection:I_(t.getRanges().getCoords())}})}};return t.load(r,s)}_createMovableEntry(t,n,r){let i=null;if(t?.anchor)i={colStart:t.anchor.tl?.c??0,rowStart:t.anchor.tl?.r??0,colEnd:t.anchor.br?.c??0,rowEnd:t.anchor.br?.r??0},t.anchor.br?.x||--i.colEnd,t.anchor.br?.y||--i.rowEnd;else{let e=this.getSelection().getRange().getCoords();i={colStart:e.colStart,rowStart:e.rowStart,colEnd:e.colEnd,rowEnd:e.rowEnd}}let a={model:null,callbacks:{processShift:null,processAfterShift:null,processLayout:null,processDelete:null,processZIndex:null,processSelection:null,processProtection:null},zIndex:n},o={...i,value:a},s=()=>a.model?l._getState()?.movableMapModel?.get(a.model):o,c=(t,n,r=!0)=>{if(d)return;let i=s();if(!i)return;let a=n??e.v(`op.updateDrawing`);l._protectionCheck(()=>[`objects`],void 0,a);let c=l._beginCommit({description:a}),u=(l._getState()?.movableSpatial).clone(),f=l._getState()?.movableMapModel,p=new Map(f);!1!==t(i,u,p)&&(l._updateState({movableSpatial:u,movableMapModel:p}),r&&(l._emitterMovables.notify(`onCollectionChange`,{source:l,transactional:!0}),l._notify(`onMovablesChange`)),c.commit({viewAfter:e=>{if(o.value.model.isSelected()&&!e?.movableSelection?.includes(o.value.model)){let t=[...e?.movableSelection??[]];return t.push(o.value.model),{...e,view:this.getView(),movableSelection:t}}return e}}))},l=this,u=t.content.type,d=!0,f=(e,t,n,r)=>{let i=n.all().sort((e,t)=>e.value.zIndex-t.value.zIndex),a=t.value.zIndex;if((e=Math.max(0,Math.min(i.length-1,e)))===a)return!1;let o=[],s=[],c=[],l=a<e,u=t=>{let n=i[t];o.push(n);let u={...n,value:{...n.value,zIndex:l?t-1:t+1}};n.value.zIndex===a&&(u.value.zIndex=e),s.push(u),r.set(u.value.model,u),c.push(u)};if(l)for(let t=a;t<=e;t++)u(t);else for(let t=a;t>=e;t--)u(t);let d=o.length;for(let e=0;e<d;e++)n.remove(o[e],Xw);n.load(s);let f=c.length;for(let e=0;e<f;e++)c[e].value.callbacks.processZIndex?.()},p=()=>l._resources.beginPersist(),m=u===`picture`,h={content:null,fromResourceId:r,defaultLockAspectRatio:m,beginPersistResource:p,getMaxBounds:()=>l._getBoundsAtCoords(l._getEntireCoords()),getRanges:e=>l.getRanges(e),runtime:this._runtime,transactions:this._transactions,getBoundsAtCoords:l._getBoundsAtCoords.bind(l),getCoordsAtBounds:l._getCoordsAtBounds.bind(l),scrollIntoView:e=>l._selectSheet(s().value.model.getRange().getCoords(),e),select:async e=>{let t=s()?.value?.model;if(!t)return!1;try{l.getView().selectMovables([t],e?.addToSelection)}catch(e){return console.warn(e),!1}let n=await l._selectSheet(s().value.model.getRange().getCoords(),e?.scrollIntoView);return!e?.scrollIntoView||!1!==n},unselect:()=>{let e=s()?.value?.model;return!!e&&(l.getView().unselectMovables([e]),!0)},isSelected:()=>l.getView().getMovableSelection().includes(s().value.model),moveToBackOnContainer:()=>{c((e,t,n)=>f(0,e,t,n),e.v(`op.moveToBack`))},moveBackwardOnContainer:()=>{c((e,t,n)=>f(e.value.zIndex-1,e,t,n),e.v(`op.moveBackwards`))},moveForwardOnContainer(){c((e,t,n)=>f(e.value.zIndex+1,e,t,n),e.v(`op.moveForward`))},moveToFrontOnContainer(){c((e,t,n)=>f(t.size()-1,e,t,n),e.v(`op.moveToFront`))},getZIndex:()=>s()?.value?.zIndex??0,getContainerIndex:()=>s()?.value?.zIndex??0,setContainerIndex(t,n){c((e,n,r)=>f(t,e,n,r),n?.description??e.v(`op.setIndex`))},setContainerCoords(t,n){if(!t)return;let r=l._rangesToCoords(t,()=>[`objects`]),i=r[0];return o.colStart=i.colStart,o.rowStart=i.rowStart,o.colEnd=i.colEnd,o.rowEnd=i.rowEnd,c((e,t,n)=>{let r={...e,...i};t.remove(e,Xw),t.insert(r),n.set(r.value.model,r)},e.v(`op.updateDrawing`),!1),r},deleteFromContainer(t){let n=s();n?.value&&l.getView().unselectMovables([n.value.model]);let r=[];c((e,t,n)=>{n.delete(e.value.model),t.remove(e,Xw),e.value.callbacks.processDelete?.(),r.push(e);let i=e.value.model.getZIndex(),a=t.all().sort((e,t)=>e.value.zIndex-t.value.zIndex),o=[],s=[],c=a.length;for(let e=i+1;e<c;e++){let t=a[e];o.push(t);let r={...t,value:{...t.value,zIndex:e-1}};s.push(r),n.set(r.value.model,r)}let l=o.length;for(let e=0;e<l;e++)t.remove(o[e],Xw);t.load(s)},t?.description??e.v(`op.deleteDrawing`),!0);let i=r.length;for(let e=0;e<i;e++)r[e].value.callbacks.processZIndex?.()},setContainerCallbacks(e){let t=s()?.value??a;t&&(t.callbacks={...t.callbacks,...e},t.removeListener?.())},isProtected:()=>!l._initializing&&!l.getProtection().isObjectsAllowed(),coords:i,getEntireRange:l.getEntireRange.bind(l),json:t},g=t.content.json,_={type:u,transactions:this._transactions,beginPersistResource:p,fromResourceId:r,defaultLockAspectRatio:m,json:g,getName:()=>t.name??``},v=null;return u===`picture`?v=new y_(_):u===`chart`?v=new b_(_):u===`sp`||u===`cxnSp`||u===`grpSp`?v=new x_(_):u===`relIds`?v=new C_({..._,type:`smartArt`}):u===`slicer`?v=new S_({..._,name:t.name}):(u===`graphicFrame`||console.warn((t=>e._(`error.sheet.unsupportedFloatingType`,{type:t}))(u)),v=new C_(_)),a.model=new f_({...h,content:v}),d=!1,o}_fromJSON(t,r=!1){this._initializing=!0,this._emitter.notify(`onBeforeLoad`,{params:t});let i=this._beginCommit({description:e.v(`op.loadSheet`),viewAfter:{initial:!0,skipProtectionCheck:!0}}),a=t||{},s=this._strings,c=s.beginPersist(),l=this._resources.beginPersist(),u=this._styles.beginPersist();try{this._ownStrings&&c.fromJSON(a.strings),this._ownResources&&l.fromJSON(a.resources),this._ownStyles&&u.fromJSON(a.styles);let t={colStart:0,rowStart:0,colEnd:Ww.width-1,rowEnd:Ww.height-1},d=a.entireSize;d&&(t=Object.freeze({colStart:0,rowStart:0,colEnd:(d.width??Ww.width)-1,rowEnd:(d.height??Ww.height)-1}));let f=WT(a.cols,n.l.Axis.Column,t),p=WT(a.rows,n.l.Axis.Row,t);this._initHeadersState({headers:a.cols,defaultSize:a.defaultColSize},{headers:a.rows,defaultSize:a.defaultRowSize}),this._initViewState(t,a.view),this._colHeaders.invalidate(),this._rowHeaders.invalidate(),this._initCellState(),a.tabColor&&(this._tabColor=this._styles.parseColor(a.tabColor));let m=this._getState(),h=m.cellValuesGrid;this._errorEpoch++;let g=m.contentfulSpatial,_=m.errorSpatial,v=a.data,y=v?.length??0,b=VT,x=[],S=this._isDataColumn,C=[];if(y>0){for(let e=0;e<y;e++){let t=v[e];typeof t==`string`&&(t=JSON.parse(t));let r,i=t[0],a=t[1],o=a.length;for(let e=0;e<o;e++){let t=a[e],o=t[1],c=o.length;for(let e=0;e<c;e++){let r,a=o[e],s=a?.t;if(s!==void 0)switch(a=a?.v,s){case`e`:r=n.n.Error;break;case`r`:r=n.n.RichData;break;case`n`:r=n.n.Number;break;case`s`:r=n.n.String;break;case`b`:r=n.n.Boolean}else switch(typeof a){case`number`:r=n.n.Number;break;case`string`:r=n.n.String,a=parseInt(a);break;case`boolean`:r=n.n.Boolean}if(r===n.n.Error){let n=t[0]+e;C.push({colStart:S?i:n,rowStart:S?n:i,colEnd:S?i:n,rowEnd:S?n:i,value:!0})}o[e]=[a,r]}r=b(null,s,o),t[1]=r}x.push(t)}h.setValues(x);let e=HT(x,this._isDataColumn);g.load(e),C.length>0&&_.load(Ea(C,n.l.Axis.Column,2**53-1))}let w,T,E=m.borderSpatial,D=m.fillSpatial,O=m.contentSpatial,k=m.continuousFillSpatial,A=m.dateFormatSpatial,j=this._options.styles,M=a.directStyles;if(M){let e=M.length;w=Array(e);for(let r=0;r<e;r++){let e=Jl(M[r],t);e.value={axes:n.l.AxisSelection.Both,index:e.value},w[r]=e}}if(f||p){let t=[...w||e.A.EmptyArray,...f||e.A.EmptyArray,...p||e.A.EmptyArray];w=[];try{let e=new ni.IteratorInstance(t,{axis:n.l.Axis.Column}),r=e.next();for(;!r.done;){let t,i=r.value,a=i.overlaps,o=a.length;if(o===1){if(t=a[0].value,t.index===0){r=e.next();continue}}else{let e,r,i;for(let t=0;!e&&t<o;t++){let o=a[t].value,s=o.axes;s===n.l.AxisSelection.Both?e=o:s===n.l.AxisSelection.Row?i=o:s===n.l.AxisSelection.Column&&(r=o)}t=e??i??r}let s=i.range;w.push({...s,value:t}),r=e.next()}}catch(e){console.log(e)}}if(w){let t=this._getEntireCoords.bind(this),r=[],i=[],a=[],s=n=>{let s=n.value,c=u.getElementJSON(s.index),l=e.l.sanitizeRange(n),d=new Dm(j,t,l,c,void 0,s.axes),f=d._p?.alignment?.horizontal;f===o.HorizontalAlignment.CenterContinuous&&r.push(l),f===o.HorizontalAlignment.Fill&&i.push(l);let p=d._p?.numberFormat;return typeof p==`number`&&(p=Sc(p)),p&&(Dr(p)||Or(p))&&a.push({...l,value:p}),{...l,value:d}},c=w.length;T=Array(c);for(let e=0;e<c;e++)T[e]=s(w[e]);let l=[],d=[],f=[];for(let e=0;e<c;e++){let t=T[e];if(!t.value)continue;let n=t.value.splitByFeature();n.border&&l.push({...t,value:n.border}),n.fill&&d.push({...t,value:n.fill}),n.content&&f.push({...t,value:n.content})}l.length>0&&E.load(l),d.length>0&&D.load(d),f.length>0&&O.load(f);let p=(e,r)=>{let i=(e=Ea(e,n.l.Axis.Column,2**53-1)).length,a=Array(i);for(let n=0;n<i;n++){let i=e[n];a[n]={...i,value:new Dm(j,t,i,{alignment:{horizontal:r}})}}k.load(a)};p(r,o.HorizontalAlignment.CenterContinuous),p(i,o.HorizontalAlignment.Fill),a=Ea(a,n.l.Axis.Column,2**53-1),A.load(a)}this._rangeStats=this._rangeStats.clone(h),m=this._updateState({cellValuesGrid:h,contentfulSpatial:g,errorSpatial:_,borderSpatial:E,fillSpatial:D,contentSpatial:O,continuousFillSpatial:k,dateFormatSpatial:A,entireCoords:t});let N=a.merges;if(N){let e=[],n=N.length;for(let r=0;r<n;r++){let n=au(N[r],t);e.push(n)}this._indexMerges(e)}let P=m.hyperlinkSpatial,F=a.hyperlinks;if(F){let e=F,n=e.length,r=Array(n);for(let i=0;i<n;i++){let n=Jl(e[i],t),a=n.value;n.value=typeof a==`string`?{address:a}:{...a},r[i]=n}P.load(r)}let I=m.commentsSpatial,L=a.comments;if(L){let e=L,n=e.length,r=Array(n);for(let i=0;i<n;i++){let n=Jl(e[i],t),a=n.value;n.value=typeof a==`string`?{content:a}:{...a},r[i]=n}I.load(r)}let ee=m.tables,te=a.tables;te&&(ee=this._createTables(ee,`tables`,te,e=>new a_(e)));let R=m.autoTables,z=a.autoTable;z&&(R=this._createTables(R,`autoTables`,[z],e=>new d_(e)));let ne=m.dataValidations,re=a.validations;re&&(ne=this._createDataValidations(ne,`dataValidations`,re,e=>new uv(e)));let B=m.conditionalFormats,ie=a.conditionals;ie&&(B=this._createConditionalFormats(B,`conditionalFormats`,ie,e=>new Q_(e)));let ae=m.protectedRanges,oe=a.protectedRanges;oe&&(ae=this._createProtectedRanges(ae,`protectedRanges`,oe,e=>new pv(e)));let se=m.movableMapModel,ce=m.movableSpatial,le=a.movables;if(le){let e=[],t=le.length;for(let n=0;n<t;n++){let t=le[n];try{let r=this._createMovableEntry(t,n,l.fromResourceId.bind(l));se.set(r.value.model,r),e.push(r)}catch(e){console.warn(`Unable to load movable`,n,t,e)}}ce.load(e)}let ue=null,de=a.picture;if(de){let t=this;ue=new y_({json:de,fromResourceId:l.fromResourceId.bind(l),deleteFromContainer:n=>{t._getState().picture&&(t._updateState({picture:null},{description:e.v(`op.deletePicture`),...n}),t._notify(`onStyleChange`))},transactions:this._transactions})}m=this._updateState({hyperlinkSpatial:P,commentsSpatial:I,movableSpatial:ce,movableMapModel:se,autoTables:R,tables:ee,conditionalFormats:B,dataValidations:ne,protectedRanges:ae,picture:ue});let fe=m.calcGrid,pe=fe.fromJSON({formulas:a.formulas,data:x,formulaArray:a.formulaArray,volatile:a.volatile},{formulaTransform:this._options?.formulaTransform});if(m=this._updateState({calcGrid:fe}),!r){let e=this._getUsedCoords();e&&this._autoFit([e],{axes:n.l.AxisSelection.Row,skipCustomSize:!0,expandOnly:!0,formulaView:!1})}i.commit(),pe&&this._realizeCalcedValues(pe),a.protection&&this._protection.fromJSON(a.protection),this._notify(`onLoad`)}finally{u.endPersist(),l.endPersist(),c.endPersist()}this._initializing=!1}getId(){return this._id}getVersionId(){return this._transactions.getVersionId(this._stateId)}getName(){return this._closed?ul:this._options.container?.getName?.()??null}setName(t,n){if(this._closed)throw Error(e._(`error.sheet.modelClosed`));let r=this._options.container?.setName;if(!r)throw new e.s(`Unable to set name for sheet.`);return r(t,n),this}getVisibility(){return this._closed?Mc.Visibility.VeryHidden:this._options.container?.getVisibility?.()??Mc.Visibility.Hidden}setVisibility(t=!0,n){if(this._closed)throw Error(e._(`error.sheet.modelClosed`));let r,i=this._options.container?.setVisibility;if(!i)throw new e.s(`Unable to set visibility for sheet.`);return r=!0===t?Mc.Visibility.Visible:!1===t?Mc.Visibility.Hidden:t,i(r,n),this}async select(e){return await this._options.container?.requestSelect?.(e),this}async duplicate(){return await this._options.container?.duplicate?.(),this}getIndex(){return this._options.container?.getIndex?.()??-1}setIndex(e,t){return this._options.container?.setIndex?.(e,t),this}getNames(){let e=this._names;return e&&(this._namesScoped||=e._scopedTo(this),this._namesScoped)}getCalculation(){let e=this._calculation;if(!e)return e;if(!this._calculationScoped){let t=this,n=new Map,r=e=>({...e??{},scope:e?.scope??t.getName()});this._calculationScoped=new Proxy(e,{get:(e,t)=>{if(t===`createFormula`)return(t,n)=>e.createFormula(t,r(n));if(t===`evaluate`)return(t,n)=>e.evaluate(t,r(n));let i=Reflect.get(e,t,e);if(typeof i!=`function`)return i;let a=n.get(t);return a||(a=i.bind(e),n.set(t,a)),a}})}return this._calculationScoped}createFormula(e,t){return this.getCalculation().createFormula(e,t)}evaluate(e,t){return t=typeof t==`number`?{evalIndex:t,scope:this.getName()}:{...t,scope:this.getName()},this.getCalculation().evaluate(e,t)}whenCalculationReady(){return this.getCalculation().ready()}getWorkbook(){return this._workbook}get[Symbol.toStringTag](){return`[Sheet]`}toString(){return`[${this.getName()??`(untitled)`}]`}get isISheet(){return!0}},Fw=8192,Iw={ignoreDataChanges:!1},Lw={colStart:-1,rowStart:-1,colEnd:-1,rowEnd:-1},Rw=[qg.Content.Values],zw=class{constructor(e){Object.assign(this,e),Object.freeze(this)}get isICellRangeCounts(){return!0}};function Bw(e,t){let n=Jg.Feature;switch(t){case n.Contentful:return!!e.contentful;case n.DateFormat:return!!e.dateFormat;case n.Formula:return!!e.formula;case n.Spills:return!!e.spills;case n.CalcError:return e.calcError!==void 0;case n.Error:return!!e.error;case n.Fill:return!!e.fillStyle;case n.Border:return!!e.borderStyle;case n.Merge:return!!e.merge;case n.Table:return!!e.table;case n.AutoTable:return!!e.autoTable;case n.Hyperlink:return!!e.hyperlink;case n.Comments:return!!e.comments;case n.Unlock:return!!e.unlock;case n.Conditionals:return!!e.conditionals;case n.DataValidations:return!!e.dataValidations;default:return!1}}n.l.Axis.Column;var Vw={rowStart:0,colStart:0,rowEnd:0,colEnd:0},Hw=[],Uw=()=>null,Ww={width:16384,height:2**20},Gw=e=>`${e}`,Kw=e=>fl(e),qw=e=>`${e+1}`,Jw=0,Yw=0,Xw=(t,n)=>!(!e.l.isEqualRanges(t,n)||t.value.model!==n.value.model),Zw={useFormattingCategory:!0},Qw={colStart:0,rowStart:0,colEnd:0,rowEnd:0},$w=e=>typeof e==`object`&&!!e&&!0===e.isICellRange,eT=class t{constructor(e,t,n){this._coords=Object.freeze(e),this._internal=t,this._readOnly=n?.readOnly??null,this._options=n??void 0,this._cacheRanges=[]}_getStickyOptions(){return this._options?.getOptions}_createRanges(e,n){let r=this._options;return n&&(r={...this._options,getOptions:zT(this._options?.getOptions,n)}),new t(e,this._internal,r)}_createRange(e,t){if(typeof e==`string`)return this._internal.createRange(e,zT(this._getStickyOptions(),t));let n=this._options;t&&(n={...this._options,getOptions:zT(this._options?.getOptions,t)});let r=xT(this._internal,e?.scope);return r?new Tv(e,r,n):wT(this._internal.getSheet(),this._internal.getSheet().getEntireCoords(),e)}_validateWrite(){let t=this._readOnly;if(t)throw Error(e._(t))}_byScope(){let e=this.getCoords(),t=this._internal,n=!1;for(let r=0;r<e.length;r++){let i=e[r]?.scope;if(i&&xT(t,i)!==t){n=!0;break}}if(!n)return null;let r=[],i=new Map;for(let n=0;n<e.length;n++){let a=e[n];if(!a)continue;let o=xT(t,a.scope);if(!o)continue;let s=o.getSheet().getName(),c=i.get(s);c||(c={internal:o,coords:[]},i.set(s,c),r.push(c)),c.coords.push(a.scope?{...a,scope:void 0}:a)}return r}_writeByScope(e,t){let n=this._byScope();n?this.doBatch(()=>{for(let t=0;t<n.length;t++)e(n[t].internal,n[t].coords)},t):e(this._internal,this.getCoords())}_readCoordsByScope(e){let t=this._byScope();if(!t)return e(this._internal,this.getCoords());let n=this._internal,r=[];for(let i=0;i<t.length;i++){let a=t[i],o=a.internal===n?void 0:a.internal.getSheet().getName(),s=e(a.internal,a.coords);for(let e=0;e<s.length;e++)r.push(o?{...s[e],scope:o}:s[e])}return r}getCoords(){let e=this._coords;for(let t=0;t<e.length;t++){let n=e[t];if(typeof n==`string`||$w(n))return this._resolveCoords()}return e}_resolveCoords(){let e=this._coords,t=this._cacheRanges,n=Array(e.length);for(let r=0;r<e.length;r++){let i=e[r];if(typeof i==`string`)n[r]=(t[r]??(t[r]=this._createRange(i))).getCoords();else if($w(i)){t[r]||(t[r]=i);let e=i.getCoords(),a=i.getSheet()?.getName();n[r]=a&&a!==this._internal.getSheet().getName()&&!e.scope?{...e,scope:a}:e}else n[r]=i}return n}[Symbol.iterator](){let e=this.entries({features:Cv});return{next(){let t=e.next();return t.done?ei:{done:!1,value:t.value.value}},[Symbol.iterator](){return this}}}entries(e){let t=this.getCoords(),n=e?.reverse??!1,r=n?t.length-1:0,i=this,a=i.at(r),o=a.entries(e),s=o.next();return{next(){let c=s;do{if(s.done){if(r=n?r-1:r+1,r>=t.length||r<0)return s=ei,c;a=i.at(r),o=a.entries(e)}s=o.next()}while(s.done);return c},[Symbol.iterator](){return this}}}async select(e){let t=await this._internal.autoSelect(e??!0,I_(this.getCoords()));return this._createRanges(t)}calculate(){let e=this._byScope();if(!e)return this._internal.calculate(this.getCoords()),this;for(let t=0;t<e.length;t++)e[t].internal.calculate(e[t].coords);return this}addListener2(e,t){return this._listenByScope((n,r)=>n.addRangesListeners2(r,e,t,!0))}addListener(e,t){return this._listenByScope((n,r)=>n.addRangesListeners(r,e,t))}addWatch(e,t){return this._addWatch(e,(n,r,i)=>n._addWatch(e,{onValues:e=>{t(e,r,n)}},i))}_addWatch(e,t){let n=this.getCount();if(n===0)return()=>{};let r=this.at(0).getCoords(),i={rowIndex:r.rowStart,colIndex:r.colStart},a=[];for(let e=0;e<n;e++)a.push(t(this.at(e),e,i));return()=>{for(let e=0;e<a.length;e++)a[e]()}}_listenByScope(e){let t=this._byScope();if(!t)return e(this._internal,this.getCoords());let n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e(t[r].internal,t[r].coords);return()=>{for(let e=0;e<n.length;e++)n[e]?.()}}find(e){let t=this._byScope();if(!t)return this._internal.find(this.getCoords(),e);let n=0,r=t[0].internal.find(t[0].coords,e);return{next(){for(;;){let i=r.next();if(!i.done)return i;if(++n>=t.length)return ei;r=t[n].internal.find(t[n].coords,e)}}}}getFlattened(e){let t=this.getCoords();if(t.length===1)return this._createRanges(t,e);let n=KT(t);return this._createRanges(n,e)}getPrecedents(e=!1){return this._trace(!1,e)}getDependents(e=!1){return this._trace(!0,e)}_trace(e,t){let n=this.getCoords(),r=[];for(let i=0;i<n.length;i++){if(!n[i])continue;let a=this.at(i),o=e?t?a.getDependents():a.getDirectDependents():t?a.getPrecedents():a.getDirectPrecedents();o&&o.getCount()>0&&r.push(...this._rehome(o))}return r.length===0?null:this._createRanges(r.length>1?KT(r):r)}_rehome(e){let t=this._internal.getSheet().getName(),n=e.getSheet()?.getName(),r=e.getCoords(),i=Array(r.length);for(let e=0;e<r.length;e++){let a=r[e],o=a.scope??n;i[e]=o===t?a.scope?{...a,scope:void 0}:a:{...a,scope:o}}return i}getVisible(e){let t=this._readCoordsByScope((t,n)=>t.getVisible(n,e));return t&&t.length!==0?this._createRanges(t,e):null}getFixed(e){let t=this.getCoords(),n=t.length,r=Array(n);for(let i=0;i<n;i++)r[i]=IT(t[i],e);return this._createRanges(r)}autoFit(e){return this._validateWrite(),this._writeByScope((t,n)=>t.autoFit(n,e),e),this}clear(e,t){return this._validateWrite(),this._writeByScope((n,r)=>n.clear(r,e,t),t),this}setValue(t,n){this._validateWrite();let r=this.getCoords();return r.length===1?(this._createRange(r[0]).setValue(t,n),this):(this.doBatch(()=>{for(let e=0;e<r.length;e++)this._createRange(r[e]).setValue(t,n)},{description:e.v(`op.setValue`),...n}),this)}getStyle(){let e=this._byScope();if(!e)return this._internal.getStyle(this.getCoords());let t=e[0];return t.internal.getStyle(t.coords,void 0,(t,n)=>{this.doBatch(()=>{for(let r=0;r<e.length;r++)e[r].internal.updateStyles(e[r].coords,t,n)})})}merge(e){return this._validateWrite(),this._writeByScope((t,n)=>t.merge(n,e),typeof e==`object`?e:void 0),this}unmerge(e){return this._validateWrite(),this._writeByScope((t,n)=>t.unmerge(n,e),e),this}getMerges(){let e=this._getStickyOptions()?.ignoreHidden??!1;return this._readCoordsByScope((t,n)=>t.getMerges(n,e))}insert(t){if(this._validateWrite(),typeof t==`object`&&t?.span){if(this.getCount()!==1)throw new e.s(e._(`error.address.singleRangeOnly`));return this.at(0).insert(t),this}return this._writeByScope((e,n)=>e.insertCells(n,t),typeof t==`object`?t:void 0),this}delete(t){if(this._validateWrite(),typeof t==`object`&&t?.span){if(this.getCount()!==1)throw new e.s(e._(`error.address.singleRangeOnly`));return this.at(0).delete(t),this}return this._writeByScope((e,n)=>e.deleteCells(n,t),typeof t==`object`?t:void 0),this}async insertFrom(e,t){this._validateWrite();let n=await this._internal.insertFrom(this.getCoords(),e,t);return n?this._createRanges([n]):null}async copyFrom(e,t){let n=await this._internal.copyFrom(this.getCoords()[0],e,t);return n?this._createRanges([n]):null}isInvalidAny(){let e=this.getCoords(),t=e?e.length:0;if(t===0)return!0;for(let n=0;n<t;n++)if(e[n]===null)return!0;return!1}getSnapshot(e){return this._internal.getSnapshot(this.getCoords(),e)}getEntireRows(e,t){return this._createRanges(_T(this.getCoords(),this._internal.getSheet().getEntireCoords(),n.l.Axis.Column,e),t)}getEntireColumns(e,t){return this._createRanges(_T(this.getCoords(),this._internal.getSheet().getEntireCoords(),n.l.Axis.Row,e),t)}getRowHeaders(e){let t=this.getCoords();return this._internal.getSheet().getRowHeaders().getRanges(t,e)}getColumnHeaders(e){let t=this.getCoords();return this._internal.getSheet().getColumnHeaders().getRanges(t,e)}getDefaultShiftAxis(){return this._internal.getDefaultShiftAxis(this.getCoords()[0])}getCount(){return this.getCoords()?.length??0}get size(){let e=this.getCoords();if(!e)return 0;let t=0;for(let n of e)t+=(n.rowEnd-n.rowStart+1)*(n.colEnd-n.colStart+1);return t}get length(){return this.getCount()}getStats(e){return this._internal.getRangeStats(this.getCoords(),e)}getCounts(e){let t=this._getStickyOptions(),n=e??t?.features,r=t?.ignoreHidden??!1,i=this._byScope();if(!i)return this._internal.featureCounts(this.getCoords(),n,r);let a={};for(let e=0;e<i.length;e++){let t=i[e].internal.featureCounts(i[e].coords,n,r);for(let e of Object.keys(t))a[e]=(a[e]??0)+t[e]}return function(e){return new zw(e)}(a)}isContentful(e){let t=this._getStickyOptions(),n=e??t?.features;if(n===void 0){let e=this._byScope();if(!e)return this._internal.isContentful(this.getCoords(),t?.ignoreHidden??!1);for(let n=0;n<e.length;n++)if(e[n].internal.isContentful(e[n].coords,t?.ignoreHidden??!1))return!0;return!1}let r=this.getCounts(n),i=typeof n==`string`?[n]:n;for(let e=0;e<i.length;e++)if(r[i[e]]>0)return!0;return!1}getRowCount(){return this._internal.getSheet().getRowHeaders().getRanges(this.getCoords()).getHeaderCount()}getColumnCount(){return this._internal.getSheet().getColumnHeaders().getRanges(this.getCoords()).getHeaderCount()}isEntireRowsAny(){return this._internal.getSheet().getRowHeaders().getRanges(this.getCoords()).isEntireHeadersAny()}isEntireColumnsAny(){return this._internal.getSheet().getColumnHeaders().getRanges(this.getCoords()).isEntireHeadersAny()}isEntireRows(){return this._internal.getSheet().getRowHeaders().getRanges(this.getCoords()).isEntireHeaders()}isEntireColumns(){return this._internal.getSheet().getColumnHeaders().getRanges(this.getCoords()).isEntireHeaders()}isOverlapping(){let e=this._byScope();if(!e)return T_(this.getCoords());for(let t=0;t<e.length;t++)if(T_(e[t].coords))return!0;return!1}isSingleCell(){let t=this.getCoords();return t.length===1&&e.l.isSingleCell(t[0])}isEqual(e,t){let n=this._internal.rangesToCoords(e,void 0,void 0,void 0,!0);return function(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(!FT(e[r],t[r]))return!1;return!0}(this.getCoords(),n)}at(t){let n=this.getCoords();if(t<0||t>n.length-1)throw new e.C;let r=this._cacheRanges,i=r[t];return i||(i=this._createRange(n[t]),r[t]=i),i}isReadOnly(){return this._readOnly!==null}isInvalid(){return!1}getAddress(e){return kl(this.getCoords(),this._internal.getSheet().getEntireCoords(),void 0,gl)}getSheet(){return this._internal.getSheet()}doBatch(t,n){return this._internal.getSheet().doBatch(e=>t(e),typeof n==`string`?n:{description:e.v(`op.rangesUpdate`),...n})}get[Symbol.toStringTag](){return`[SheetRanges]`}toString(){return this.getAddress()}get isICellRanges(){return!0}};function tT(){return!1}function nT(){return!0}function rT(){return null}function iT(){return ti}function aT(){return 0}var oT,sT=new Fr(`InvalidRuntime`,null),cT={runtime:sT,sheet:null,styles:null,normalStyleRanged:null,nextContentful:(e,t,n)=>0,getProtection:()=>pT,getRange:e=>hT,getRanges:e=>new gT(null),opener:(e,t,n,r)=>Promise.resolve(!1)},lT=class extends Dx{constructor(e=null){super(cT,null),this._invalidSheet=e}getSheet(){return this._invalidSheet}createCell(){return this}getType(){return n.n.Error}getWarnings(){return[ul]}getStyle(e=!1){return Dw||=new jm().getNormal()}toString(){return`${this._coords?hl(this._coords):ul} => ${this._v??`{blank}`}`}},uT=new lT,dT=new WeakMap,fT=()=>hT,pT=new kh(void 0,!0),mT=new Ya,hT={forEach:function(){},[Symbol.iterator]:iT,entries:iT,values:iT,select:Z,find:Z,calculate:Z,getCell:()=>uT,getFormula:rT,createFormula:Z,getValue:rT,getInteropValue:rT,setValue:Z,setFormula:Z,setValues:Z,updateCells:Z,getCells:()=>[[uT]],getStyle:Z,getValues:()=>[[null]],getValuesRange:()=>new nD(sT,mT,null,null),setComputedValues:Z,getInteropValues:()=>[[null]],getBounds:rT,getIntersect:fT,getUnion:fT,getDifferences:Z,getResizeBy:fT,getResizeTo:fT,getOffsetBy:fT,getOffsetTo:fT,getFixed:fT,getRangeAt:fT,getRowAt:fT,getRowAfter:fT,getRowBefore:fT,getRowBy:fT,getColumnAt:fT,getColumnAfter:fT,getColumnBefore:fT,getColumnBy:fT,getTopLeft:fT,getBottomRight:fT,getUsedRange:fT,getEntireRows:fT,getEntireColumns:fT,getSurrounding:Z,getExtended:Z,isEntireRows:tT,isEntireColumns:tT,isEntireRange:tT,isSingleCell:nT,isEqual:tT,size:0,sort:Z,sortAt:Z,filter:Z,textToColumns:Z,removeDuplicates:Z,clear:Z,setHyperlink:Z,setComments:Z,merge:Z,unmerge:Z,getMerges:Z,getConditionalFormats:Z,getDataValidations:Z,getTables:Z,getMovables:Z,insert:Z,insertFrom:Z,delete:Z,addAutoTable:Z,addTable:Z,getDefaultShiftAxis:Z,getDefaultSortCriteria:Z,autoFill:Z,autoFit:Z,getSnapshot:Z,copyFrom:Z,doBatch:Z,createSparseBuilder:Z,getRowHeaders:Z,getColumnHeaders:Z,getCounts:Z,getRegions:Z,getDirectPrecedents:Z,getDirectDependents:Z,getPrecedents:Z,getDependents:Z,getCount:aT,getStats:()=>(oT||=new eD(sT,mT,null,[mT.getMaxCoords()]),oT),isContentful:tT,addListener:Z,addWatch:Z,getColumnStart:aT,getRowStart:aT,getColumnEnd:aT,getRowEnd:aT,getRowCount:aT,getColumnCount:aT,getVisible:Z,getCoords:rT,isEmpty:nT,toString:()=>ul,getAddress:()=>ul,isInvalid:nT,getSheet:rT,isReadOnly:nT,isICellRange:!0},gT=class extends eT{constructor(e,t){super(null,e,t)}getMerges(){return Z()}getStyle(){return Z()}find(){return ti}[Symbol.iterator](){return ti}entries(){return ti}calculate(){return Z()}clear(){return Z()}merge(){return Z()}unmerge(){return Z()}insert(){return Z()}delete(){return Z()}insertFrom(){return Z()}getSnapshot(){return Z()}copyFrom(){return Z()}getEntireRows(){return Z()}getEntireColumns(){return Z()}getRowHeaders(){return Z()}getColumnHeaders(){return Z()}getDefaultShiftAxis(){return Z()}getFlattened(){return Z()}getVisible(){return Z()}getAddress(){return Z()}getStats(){return oT}getCounts(){return Z()}getRegions(){return Z()}getDirectPrecedents(){return Z()}getDirectDependents(){return Z()}getPrecedents(){return Z()}getDependents(){return Z()}isContentful(){return Z()}getRowCount(){return 0}getColumnCount(){return 0}isReadOnly(){return!0}isOverlapping(){return!1}isEntireRows(){return!1}isEntireRowsAny(){return!1}isEntireColumns(){return!1}isEntireColumnsAny(){return!1}isInvalidAny(){return!1}isSingleCell(){return!0}isEqual(){return!1}getFixed(){return Z()}getCount(){return 0}at(){return Z()}doBatch(){return Z()}getCoords(){return null}isInvalid(){return!0}toString(){return ul}select(){return Z()}addListener(){return Z()}};function _T(e,t,r,i=!1){let a=r===n.l.Axis.Row,o=e.length,s=Array(o);for(let n=0;n<o;n++){let r=e[n];if(a){let e=r.colEnd-r.colStart+1;s[n]={...r,colStart:i?r.colEnd+1:r.colStart,rowStart:t.rowStart,colEnd:i?r.colEnd+e:r.colEnd,rowEnd:t.rowEnd}}else{let e=r.rowEnd-r.rowStart+1;s[n]={...r,colStart:t.colStart,rowStart:i?r.rowEnd+1:r.rowStart,colEnd:t.colEnd,rowEnd:i?r.rowEnd+e:r.rowEnd}}}return s}function vT(e,t,n){let r=t,i=e.length,a=r.rowStart,o=r.rowEnd;for(let t=0;t<i;t++){let r=e[t];if((r.rowStart<=a&&r.rowEnd>=o)!==n)return!n}return n}function yT(e,t,n){let r=t,i=e.length,a=r.colStart,o=r.colEnd;for(let t=0;t<i;t++){let r=e[t];if((r.colStart<=a&&r.colEnd>=o)!==n)return!n}return n}function bT(e){return e._getInternal()}function xT(e,t){if(!t)return e;let n=e.getSheet();if(t===n.getName())return e;let r=n.getWorkbook();if(!r)return null;let i=r.getSheets().getItems({name:t,visibility:Mc.Visibility.VeryHidden})?.[0];return i?bT(i):null}function ST(e,t){if(!e?.scope||!CT(e.scope,t))return e;let n={...e};return delete n.scope,n}function CT(e,t){return e===t.getName()||e===t.getId()}function wT(e,t=null,n=null,r=ul){if(!e&&!n)return hT;let i=function(e){if(!e)return uT;let t=dT.get(e);return t||(t=new lT(e),dT.set(e,t)),t}(e);return Object.freeze({...hT,getSheet:()=>e,getCell:()=>i,getCells:()=>[[i]],bounds:()=>n,getAddress:()=>r,toString:()=>n?yl(n,t):r})}var TT=/(\d)\*\*([-+]?\d)/g,ET=[` `,`\xA0`,` `,` `],DT=RegExp(`([0-9])[`+ET.join(``)+`](?=[0-9])`,`g`),OT=/[^\s#0.,%E+\-_();[\]]/,kT=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),AT=/^[^\w\s+\-().,%]{1,3}/;function jT(t,r,i,a){if(r===void 0)throw Error(`A value is required to create a cell from a text.`);let s=a??{value:null};if((r=e.A.castToString(r)).trim()===``)return s;let c=uo(r);if(c!==void 0)return s.value=c,s;if(r.startsWith(`'`)&&!i?.ignoreQuotePrefix)return s.style={quotePrefix:!0},s.value=r.substring(1,r.length),s;if(s.value=r,function(e,t,r,i){let a=function(e,t){let n=e.replace(TT,`$1E$2`);return ET.includes(t.group)&&(n=n.replace(DT,`$1${t.group}`)),n}(t.trim(),r);if(!function(e,t){let n=e.trim();if(n===``||(n.includes(`(`)||n.includes(`)`))&&(!n.startsWith(`(`)||!n.endsWith(`)`)||(n=n.slice(1,-1).trim(),n.includes(`(`)||n.includes(`)`))))return!1;let r=()=>{let e=n.match(AT);if(e)return void(n=n.slice(e[0].length).trimStart());let t=[...n].reverse().join(``).match(AT);t&&(n=n.slice(0,n.length-t[0].length).trimEnd())};r(),(n.startsWith(`+`)||n.startsWith(`-`))&&(n=n.slice(1).trimStart(),r()),n.endsWith(`%`)&&(n=n.slice(0,-1).trimEnd());let i=kT(t.decimal),a=kT(t.group),o=t.group?`\\d+|\\d{1,3}(?:${a}\\d{3})+`:`\\d+`;return RegExp(`^(?:(?:${o})(?:${i}\\d*)?|${i}\\d+)(?:[eE][+-]?\\d+)?$`).test(n)}(a,r))return!1;let o=function(e,t={}){let n=Dt(t.locale||``)||kt,r=n.decimal,i=[...rn[r]||[tn,nn]];i.includes(n.group)||n.group===Qt||n.group===r||i.push(n.group);let a=``,o=``,s=1,c=``,l=!1,u=!1,d=!1,f=!1,p=!1,m=null,h=!1,g=0,_=[Qt,$t,en,`+`,`%`,`(`,`-`].concat(vt);for(;_.includes(e[g]);){let t=e[g];if(t===`-`){if(l||u)return null;l=!0,s=-1}else if(yt.test(t)){if(p)return null;p=!0,m=t}else if(t===`(`){if(u||l)return null;u=!0,s=-1}else if(t===`%`){if(f)return null;f=!0}g++}let v,y=!1;if(e[g]===r||an(e[g]))for(;g<e.length;){let t=e[g];if(!v&&i.includes(t))v=t;else if(!v||v!==t)if(t===r){if(y)break;a+=`.`,y=!0}else{if(!an(t))break;a+=t}g++}if(e[g]===`e`||e[g]===`E`){o+=e[g],g++,e[g]!==`+`&&e[g]!==`-`||(o+=e[g],g++);let t=g;for(;an(e[g]);)o+=e[g],g++;if(t===g)return null}let b=[Qt,$t,en,`%`,`$`,`)`].concat(vt);for(;b.includes(e[g]);){let t=e[g];if(yt.test(t)){if(p)return null;p=!0,m=t,h=!0}else if(t===`)`){if(d||!u)return null;d=!0}else if(t===`%`){if(f)return null;f=!0}g++}if(g!==e.length)return null;let x=parseFloat(a+o);if(!isFinite(x))return null;if(o){if(f||p)return null;c=`0.00E+00`}else if(f){if(p)return null;c=a.includes(`.`)?`0.00%`:`0%`,x*=.01}else if(p){let e=a.includes(`.`)?`#,##0.00`:`#,##0`;c=h?e+m:m+e}else v&&(c=a.includes(`.`)?`#,##0.00`:`#,##0`);let S={v:x*s};return c&&(S.z=c),S}(n.r.truncateNumberText(a),{locale:r.tag});if(!o||typeof o.v!=`number`)return!1;i.value=o.v;let s=o.z;if(!s)return!0;if(s.includes(`%`))return i.style=e=>{if(!e.getNumberFormat().includes(`%`))return{numberFormat:s}},!0;let c=s.match(OT)?.[0];if(c){let e=s.includes(`.`)?`${c}#,##0.00`:`${c}#,##0`;return i.style=t=>{if(!t.getNumberFormat().includes(c))return{numberFormat:`${e}_);[Red](${e})`}},!0}return i.style={numberFormat:s},!0}(0,r,t.getLocaleProfile(),s)||function(e,t,n){if(t.startsWith(` `))return!1;let r=null,i=null;try{i=Cr(e,t,!0,!0);let n=t;if(i){let e=i.leadingText.trim(),t=i.trailingText.trim();if(e.length>0&&t.length>0)return!1;n=e.length>0?e:t}n.trim().length>0&&(r=wr(e,n,null,!1,!0)),!r&&i&&(i.leadingText.trim().length>0||i.trailingText.trim().length>0)&&(i=null)}catch{}if(!r&&!i)return!1;n.style=t=>{let n=t.getNumberFormat(),a=Dr(n);if(r&&a)return;let o=Or(n);if(!i||!o){if(r&&i&&!a&&!o?n=`m/d/yyyy h:mm`:r&&!a?n=r.numberFormat:i&&!o&&(n=i.numberFormat),i&&i.parsed.serial>1&&(n=`General`),r&&!a&&!i){let t=Ac.Parser.formatValue(e,r.numberFormat,r.asSerialDate),i=e.getLocale();t===new Intl.DateTimeFormat(i).format(r.asJSDate)?n=`Short Date`:t===new Intl.DateTimeFormat(i,{dateStyle:`full`}).format(r.asJSDate)?n=`Long Date`:t===new Intl.DateTimeFormat(i,{timeStyle:`medium`}).format(r.asJSDate)&&(n=`Long Time`)}return{numberFormat:n}}};let a=0;return r&&(a+=r.asSerialDate),i&&(a+=i.parsed.serial),n.value=a,!0}(t,r,s))return s;let l=fo(r);return l?(s.value=l,s):(s.value=r,I(r)?s.hyperlink=r:ee(r)&&(s.hyperlink=r,s.hyperlink.toLowerCase().startsWith(`mailto:`)||(s.hyperlink=`mailto:${s.hyperlink}`)),r.includes(`
|
|
33
|
-
`)&&(s.style={...s?.style,alignment:{overflow:o.Overflow.Wrap}}),s)}function MT(e){let t=[];return e.getUsedRange().forEachSpan((e,n)=>{let r=n.getCoords();e===0&&t.push(r)},{includeStyles:!1}),Vr(Hr(t))}function NT(e){if(!e)return null;let t=null,n=e.length;for(let r=0;r<n;r++){let n=e[r].value;if(!n)continue;t||={};let i=Object.keys(n),a=i.length;for(let e=0;e<a;e++){let r=i[e],a=t[r];if(a)if(Array.isArray(a)){let e=n[r];if(Array.isArray(e)){let t=e.length;for(let n=0;n<t;n++)a.push(e[n])}else a.push(e)}else t[r]=[a,n[r]];else t[r]=n[r]}}return t}function PT(e,t,r,i=!1,a=!1){let o,s=r?.includeMergeOverflow??!1;if(i)o=!0;else if(a||s){let e={};a&&(e[q.Type.DateFormat]=!1,e[q.Type.Table]=!1),s&&(e[q.Type.Merge]=!1),o=e}let c,l=r?.axis??n.l.Axis.Row,u=r?.maxSize??1e4,d=e({includeEmpty:!0,axis:l,reverse:r?.reverse,ignoreHidden:r?.ignoreHidden,includeMergeOverflow:s,searchTypes:o,bounds:t,reuseContext:!0}),f=l!==n.l.Axis.Row,p=[],m=-1,h=null,g=0;for(c=d.next();!c.done;){if(g>u)throw Error(vv(u));let e=c.value,t=e.context.getCoords(),n=f?t.colIndex:t.rowIndex;n!==m&&(h=[],p.push(h),m=n);let r=e.value;if(i)r=e.context.getCell();else if(a&&r!==null){let t=e.context.getInteropValue();t&&(r=t)}h.push(r),c=d.next(),g++}return p}function FT(e,t){return e===t||!(!e||!t)&&e.rowStart===t.rowStart&&e.rowEnd===t.rowEnd&&e.colStart===t.colStart&&e.colEnd===t.colEnd&&e.$rowStart===t.$rowStart&&e.$rowEnd===t.$rowEnd&&e.$colStart===t.$colStart&&e.$colEnd===t.$colEnd&&e.scope===t.scope}function IT(e,t){if(!e)return;let n={...e};return t?typeof t==`boolean`?(n.$colStart=t,n.$rowStart=t,n.$colEnd=t,n.$rowEnd=t,n):(typeof t.colStart==`boolean`&&(n.$colStart=t.colStart),typeof t.rowStart==`boolean`&&(n.$rowStart=t.rowStart),typeof t.colEnd==`boolean`&&(n.$colEnd=t.colEnd),typeof t.rowEnd==`boolean`&&(n.$rowEnd=t.rowEnd),n):n}var LT=class{constructor(t,r,i){this._c=null;let a=this;this.setState=e=>{let t=e[0],i=e[1],a=e[2];if(r&&r.includeMergeOverflow&&a&&a.merge){let e=r.bounds,n=a.merge.getCoords(),o=!1,s=n.colStart,c=n.rowStart,l=e.colStart,u=e.rowStart,d=t.colIndex,f=t.rowIndex;!o&&s<l&&c>=u&&d===l&&f===c&&(o=!0),!o&&c<u&&s>=l&&f===u&&d===s&&(o=!0),!o&&c<u&&s<l&&f===u&&d===l&&(o=!0),o&&(i=a.merge.tvTl())}a&&Object.keys(a).length===0&&(a=null);let o=i;return i===void 0?(this._t=n.n.Null,this._v=null,o=null):(this._t=nE(o),this._v=o),this._r=a,this._p=e[3],this._n=e[4],this._c=t,o},this.clear=()=>{a._c=null},this.context={getCoords(){let t=a._c;if(!t)throw Error(e._(`error.sheet.iteratorClosed`));return t},getCell(){let t=a._c;if(!t)throw Error(e._(`error.sheet.iteratorClosed`));let n,o=a._r,s=!0!==r?.searchTypes||o?.merge||r?.injectReferences?null:i.renderCellCache;if(s){n=32768*t.rowIndex+t.colIndex;let e=s.get(n);if(e)return e}let c=a._t,l=a._v,u=new Dx(i,s?{rowIndex:t.rowIndex,colIndex:t.colIndex}:t,c,l,o,a._p,a._n);return s&&s.set(n,u),u},getType:()=>a._t,getInteropType(){let e=a._t;return e===n.n.Number&&a._r?.dateFormat?n.s.Date:e},getInteropValue(){let e=a._t,t=a._v;return e===n.n.Number&&a._r?.dateFormat?dE(i.runtime,t,a._t,n.s.Date,!1):t},getAddress(t,n=!1){if(!a.context)throw Error(e._(`error.sheet.iteratorClosed`));let r=a._c;return t&&(r={...a._c,...t}),i.getRange(r).getAddress(n)},getInjectedReference(e){let t=a._r;if(!t)return;let n=t[e];return n===void 0?void 0:n}}}};function RT(t,r){let i=n.l.Direction.Down,a=0,o={...t};if(r.colStart<t.colStart?(i=n.l.Direction.Left,a=t.colStart-r.colStart,o.colStart=r.colStart):r.colEnd>t.colEnd?(i=n.l.Direction.Right,a=r.colEnd-t.colEnd,o.colEnd=r.colEnd):r.rowStart<t.rowStart?(i=n.l.Direction.Up,a=t.rowStart-r.rowStart,o.rowStart=r.rowStart):r.rowEnd>t.rowEnd||r.rowEnd<t.rowEnd?(i=n.l.Direction.Down,a=r.rowEnd-t.rowEnd,o.rowEnd=r.rowEnd):r.colEnd<t.colEnd?(i=n.l.Direction.Right,a=r.colEnd-t.colEnd,o.colEnd=r.colEnd):r.rowStart>t.rowStart?(i=n.l.Direction.Up,a=t.rowStart-r.rowStart,o.rowStart=r.rowStart):r.colStart>t.colStart&&(i=n.l.Direction.Left,a=t.colStart-r.colStart,o.colStart=r.colStart),!Ca(o,r))throw new e.s(((t,n)=>e._(`error.sheet.autofillInvalidDestination`,{template:t,destination:n}))(yl(t),yl(r)));return{direction:i,amount:a}}function zT(e,t){if(e||t)return e&&t?{...e,...t}:e||t}function BT(t,r,i,a=n.l.Axis.Row){let o=t.getRange(r,{ignoreHidden:a}),s=o.forEach((e,t)=>({break:t.getCoords()}),{features:[],axis:a});if(!s)return;let c,l=a===n.l.Axis.Row,u=new Map,d=new Map,f=null,p=l?s.rowIndex:s.colIndex;o.forEach((e,t)=>{let n=t.getCoords(),r=l?n.colIndex:n.rowIndex;if((l?n.rowIndex:n.colIndex)===p)u.set(r,e),c=t.getType();else{let e=t.getType();c!==e&&(f=!0)}if(f)return Gd},{axis:a===n.l.Axis.Row?n.l.Axis.Column:n.l.Axis.Row,features:[],includeEmpty:!0,address:{colStart:r.colStart,rowStart:r.rowStart,colEnd:l?r.colEnd:r.colStart+1,rowEnd:l?r.rowStart+1:r.rowEnd}});let m={colStart:s.colIndex,rowStart:s.rowIndex,colEnd:r.colEnd,rowEnd:r.rowEnd};if(m.colStart>m.colEnd||m.rowStart>m.rowEnd||e.l.isSingleCell(m))return null;if(f){let e=l?m.colStart:m.rowStart;u.forEach((t,n)=>{n<e||d.set(n-e,t+``)})}let h=Math.min(Math.max(i?.colIndex??0,m.colStart),m.colEnd),g=Math.min(Math.max(i?.rowIndex??0,m.rowStart),m.rowEnd),_=a!==n.l.Axis.Row,v={...Vo.DefaultRangeOptions,hasHeader:f,axis:a,sorts:[{index:_?g-m.rowStart:h-m.colStart}]},y=m;return f&&(y={colStart:_?m.colStart+1:m.colStart,rowStart:_?m.rowStart:m.rowStart+1,colEnd:m.colEnd,rowEnd:m.rowEnd}),{coords:m,options:v,headers:d,sortCoords:y}}function VT(e,t,r=null){return Ar.fromArray(e,(e,r)=>{let i=e?.[1];if(i==null)return null;let a=e[0]??null;switch(i){case n.n.String:a=t.getById(a);break;case n.n.Error:a=n.a.getBuiltInByCode(a)??n.a.BuiltIn.Unknown;case n.n.RichData:}return a},(e,r)=>{let i=nE(e),a=e;switch(i){case n.n.String:a=t.add(a);break;case n.n.Error:{let e=a;if(typeof e?.getCode!=`function`)throw Error(`Value is not a valid Error type: '${String(a)}' (${typeof a}). Raw NaN/Infinity must be converted to a FormulaError before reaching storage.`);a=e.getCode();break}case n.n.RichData:}return[a,i]},r)}function HT(e,t){let r=[],i=t?n.l.Axis.Column:n.l.Axis.Row,a=e.length;for(let n=0;n<a;n++){let a=e[n],o=a[0],s=a[1],c=s.length;for(let e=0;e<c;e++){let n=s[e],a=n[0],c=n[1].length-1,l={colStart:t?o:a,rowStart:t?a:o,colEnd:t?o:a+c,rowEnd:t?a+c:o,value:new uu({colStart:t?o:a,rowStart:t?a:o,colEnd:t?o:a+c,rowEnd:t?a+c:o},i)};r.push(l)}}return r}function UT(t,n,r){if(!t||t.length===0||!n)return e.A.EmptyArray;let i=[...t],a=i.length,o=r.colStart,s=r.rowStart,c=r.colEnd,l=r.rowEnd;for(let e=0;e<a;e++){let t={...i[e]},r=t,a=n.search(t),u=t.rowStart<=s&&t.rowEnd>=l,d=t.colStart<=o&&t.colStart>=c,f=a.length;for(let e=0;e<f;e++){let t=a[e];u||(r.colStart=Math.min(r.colStart,t.colStart),r.colEnd=Math.max(r.colEnd,t.colEnd)),d||(r.rowStart=Math.min(r.rowStart,t.rowStart),r.rowEnd=Math.max(r.rowEnd,t.rowEnd))}i[e]=r}return i}function WT(e,t,r){if(!e||e.length===0)return null;let i,a=e.length,o=-1,s=[],c=t===n.l.Axis.Column,l=c?r.rowStart:r.colStart,u=c?r.rowEnd:r.colEnd,d=c?n.l.AxisSelection.Column:n.l.AxisSelection.Row;for(let t=0;t<a;t++){let n=tu(e[t],c),r=n?.value.s;if(!n||r===void 0){o=-1;continue}let a=n.min,f=n.max;r!==o||i.colEnd+1!==a?(i={colStart:c?a:l,rowStart:c?l:a,colEnd:c?f:u,rowEnd:c?u:f,value:{axes:d,index:r}},o=r,s.push(i)):i.colEnd=f}return s.length===0?null:s}function GT(t,n,r,i,a){let o=t,s=r?n.colStart:n.rowStart,c=r?a.colEnd:a.rowEnd,l=r?t.colIndex:t.rowIndex;if(i>0&&l>s||i<0&&s<=l){o={...t};let n=Math.max(l+i,s);if(o[r?`colIndex`:`rowIndex`]=n,l>c)throw new e.s(e._(`error.sheet.insertOobFreeze`))}return o}function KT(e,t=n.l.AxisSelection.Both){let r=t===n.l.AxisSelection.Both,i=r?2**53-1:1,a=Da(e,i,t===n.l.AxisSelection.Row?n.l.Axis.Column:n.l.Axis.Row);if(r){let t=Da(e,i,n.l.Axis.Column);t.length<a.length&&(a=t)}return a}function qT(e,t,n,r,i){let a=e._p?.border;if(!a)return;let o,s,c={onIntersect:(e,t)=>{if(!e)return e;let n,i=e.value?._p?.border;return i?(o===W.Edge.Left?i.left&&e.colStart===s&&(n={border:{left:null}}):o===W.Edge.Top?i.top&&e.rowStart===s&&(n={border:{top:null}}):o===W.Edge.Right?i.right&&e.colEnd===s&&(n={border:{right:null}}):o===W.Edge.Bottom&&i.bottom&&e.rowEnd===s&&(n={border:{bottom:null}}),n?{...t,value:r(e.value,n)}:e):e}};a.right&&t.colEnd<i.colEnd&&(o=W.Edge.Left,s=t.colEnd+1,n.insertNonOverlapping({colStart:s,rowStart:t.rowStart,colEnd:s,rowEnd:t.rowEnd,value:void 0},c)),a.bottom&&t.rowEnd<i.rowEnd&&(o=W.Edge.Top,s=t.rowEnd+1,n.insertNonOverlapping({colStart:t.colStart,rowStart:s,colEnd:t.colEnd,rowEnd:s,value:void 0},c)),a.left&&t.colStart>i.colStart&&(o=W.Edge.Right,s=t.colStart-1,n.insertNonOverlapping({colStart:s,rowStart:t.rowStart,colEnd:s,rowEnd:t.rowEnd,value:void 0},c)),a.top&&t.rowStart>i.rowStart&&(o=W.Edge.Bottom,s=t.rowStart-1,n.insertNonOverlapping({colStart:t.colStart,rowStart:s,colEnd:t.colEnd,rowEnd:s,value:void 0},c))}function JT(e,t,n,r,i){let a=(e,t)=>({...t,value:null}),o={...i,value:null};t.insertNonOverlapping(o,{onIntersect:a}),n.insertNonOverlapping(o,{onIntersect:a}),r.insertNonOverlapping(o,{onIntersect:a});let s=e.search(i);for(let e=0;e<s.length;e++){let i=s[e],a=i.value;if(!a)continue;let o=a.splitByFeature();o.border&&t.insertNonOverlapping({...i,value:o.border}),o.fill&&n.insertNonOverlapping({...i,value:o.fill}),o.content&&r.insertNonOverlapping({...i,value:o.content})}}function YT(e,t){let n=!1;for(let r of e)if(t&&r===t)n=!n;else if(!n){if(r===`,`)return`,`;if(r===` `)return` `}}function XT(e,t,n,r){let i=[],a=``,o=!1,s=t.length;for(let r=0;r<e.length;r++){let c=e[r];n&&c===n?o=!o:o||e.slice(r,r+s)!==t?a+=c:(i.push(a),a=``,r+=s-1)}i.push(a);let c=r?i.map(e=>e.length>0?e:null):i.filter(e=>e.length>0);return c.length>0?c:[null]}function ZT(e,t,n){let r=typeof t;if(r===`number`)return``+e+``+t.toString();if(r===`string`){let r=t,i=n.get(r);return i===void 0&&(i=r.toLowerCase(),n.set(r,i)),``+e+``+i}return r===`boolean`?``+e+``+(t?`1`:`0`):t==null?``+e+`\0`:``+e+``+t.getCode()}var QT=Object.freeze({colStart:0,rowStart:0,colEnd:16383,rowEnd:1048575});function $T(){return QT}var eE=Object.freeze({colStart:0,rowStart:0,colEnd:2**31-2,rowEnd:2**31-2});function tE(){return eE}var nE=(t,r=!1)=>typeof t==`number`?isNaN(t)||t===1/0||t===-1/0?n.n.Error:n.n.Number:typeof t==`string`?n.n.String:typeof t==`boolean`?n.n.Boolean:t?.isFormulaError?n.n.Error:t===null?n.n.Null:e.A.isObject(t)&&t.hasOwnProperty(`getType`)&&typeof t.getType()==`string`?n.n.RichData:r&&rr(t,!0)?n.s.Date:t===void 0?(console.warn(`undefined`),n.n.Null):null,rE=new Map([[n.n.Null,`any`],[n.n.Number,`number`],[n.n.String,`string`],[n.n.Boolean,`boolean`],[n.n.Error,`FormulaError`],[n.n.RichData,`richData`],[n.s.Date,`Date`],[`*`,`Scalar`]]),iE=new Map([[`p`,`IReferenceRange`],[`r`,`IRange`],[`m`,`[][]`],[`*`,`any`]]);function aE(e){let t,n=e.scalar,r=e.range,i=n?rE.get(n)??`InvalidScalar`:``,a=r?iE.get(r)??`InvalidRange`:``;return t=n&&r?r===`m`?`${i}${a}`:`${a}<${i}>`:i||a,t+=`[]`.repeat(e.arrayDepth??0),t}var oE={axis:n.l.Axis.Row},sE=22250738585072014e-324;function cE(e,t){if(e===0)return`0`;if(!Number.isFinite(e))return e.toString();let n=e<0,[r,i]=Math.abs(e).toExponential(14).split(`e`),a=r.replace(`.`,``),o=a.length;for(;o>1&&a.charCodeAt(o-1)===48;)o--;a=a.slice(0,o);let s=parseInt(i,10),c=t.getLocaleProfile().decimal,l=null;if(s>=0){let e=s+1;a.length>e?l=a.slice(0,e)+c+a.slice(e):e<=20&&(l=a.padEnd(e,`0`))}else{let e=-s-1;2+e+a.length<=20&&(l=`0`+c+`0`.repeat(e)+a)}if(l===null){let e=a.length>1?a[0]+c+a.slice(1):a,t=Math.abs(s);l=e+(s<0?`E-`:`E+`)+(t<10?`0`+t:String(t))}return n?`-`+l:l}function lE(e,t){let r=t.trim();if(r===``)return n.a.BuiltIn.Value;let i=Number(n.r.truncateNumberText(r));return Number.isFinite(i)?ur(i,e.isDate1904())??n.a.BuiltIn.Value:n.a.BuiltIn.Value}function uE(e,t,r){if(!r)switch(t){case n.s.Number:return null;case n.s.String:r=CE;break;case n.s.Boolean:r=wE;break;case n.s.Date:r=TE;break;case n.s.Null:r=EE;break;case n.s.Error:case n.s.RichData:default:return null}let i=!1,a=!1,o=!1,s=!1,c=r.length;for(let e=0;e<c;e++)switch(r[e]){case n.n.Number:i=!0;break;case n.n.String:a=!0;break;case n.n.Boolean:o=!0;break;case n.n.RichData:break;case n.n.Null:s=!0}return t===n.n.Number?(t,r)=>{if(r===n.n.Error)return t;switch(r){case n.n.Null:return s?0:null;case n.n.String:if(!a)return null;let r=t;if(r.length>255)return n.a.BuiltIn.Value;let i=Number(n.r.truncateNumberText(r));if(i===0&&r.trim()===``)return n.a.BuiltIn.Value;if(isNaN(i)){let t=jT(e,r);t&&(i=t.value)}return!Number.isFinite(i)||Math.abs(i)>999999999999999e293?n.a.BuiltIn.Value:i;case n.n.Boolean:return o?+!!t:null}return null}:t===n.n.String?(t,r)=>{if(r===n.n.Error)return t;switch(r){case n.n.Number:return i?cE(t,e):null;case n.n.Boolean:return o?co(t):null;case n.n.Null:return s?``:null}return null}:t===n.s.Boolean?(e,t)=>{if(t===n.n.Error)return e;switch(t){case n.n.Number:return i?e!==0:null;case n.n.String:if(!a)return null;let t=e;return t===`TRUE`||t!==`FALSE`&&(t=t.toUpperCase(),t===`TRUE`||t!==`FALSE`&&null);case n.n.Null:return!s&&null}return null}:t===n.s.Date?(t,r)=>{if(r===n.n.Error)return t;switch(r){case n.n.Number:return i?ur(t,e.isDate1904())??n.a.BuiltIn.Value:null;case n.n.String:if(!a)return null;let r=kr(e,t);return r===null?lE(e,t):ur(r,e.isDate1904());case n.n.Null:return s?ur(0,e.isDate1904()):null}return null}:t===n.n.Null?(e,t)=>{if(t===n.n.Error)return e;switch(t){case n.n.Number:return i?0:null;case n.n.String:return a?``:null;case n.n.Boolean:return!o&&null}return null}:t===n.s.RichData?(e,t)=>null:null}function dE(e,t,r,i=n.n.Number,a=!1){if(r===i||!i)return r===n.n.Number&&(t=yE(t,null,`number`)),t;if(!0===t?.isLambda&&i!==`l`&&i!==`*`)return n.a.BuiltIn.Value;if(i===n.n.Number){switch(r){case n.n.Null:return 0;case n.n.String:if(t.length>255)return n.a.BuiltIn.Value;let r=0;try{let n=jT(e,t);r=n&&typeof n.value==`number`?n.value:NaN}catch{}return!Number.isFinite(r)||Math.abs(r)>999999999999999e293?n.a.BuiltIn.Value:r;case n.n.Boolean:return a?+!!t:n.a.BuiltIn.Value;case n.s.Date:return dr(t,e.isDate1904())??n.a.BuiltIn.Value;case n.n.Error:return t}return t.toString()}if(i===n.n.String){switch(r){case n.n.Null:return``;case n.n.Number:return cE(t,e);case n.n.Boolean:return co(t);case n.n.Error:return t}return t}if(i===n.s.Boolean){switch(r){case n.n.Null:return!1;case n.n.Number:return t!==0;case n.n.String:let e=t.toUpperCase();return e===`TRUE`||e!==`FALSE`&&n.a.BuiltIn.Value;case n.n.Error:return t}return n.a.BuiltIn.Value}if(i===n.s.Date){switch(r){case n.n.Null:return ur(0,e.isDate1904());case n.n.Number:return ur(t,e.isDate1904())??n.a.BuiltIn.Value;case n.n.String:let r=kr(e,t);return r===null?lE(e,t):ur(r,e.isDate1904());case n.n.Error:return t}return n.a.BuiltIn.Value}return i===n.s.RichData?null:n.a.BuiltIn.Value}var fE=(e,t,r=null)=>{let i=Array.isArray(t),a=e.next();for(;!a.done;){let o=a.value;if(r===`reject`&&n.a.isError(o)||o instanceof n.a.Value)return o;i?t.push(o):t.values[t.length++]=o,a=e.next()}};function pE(e){let t=e;for(;Array.isArray(t);){if(t.length>1)return!1;t=t[0]}if(!t)return!0;if(t.isIRange&&t.size!==1)return!1;if(t.colStart!==void 0){let e=t;if(e.colStart!==e.colEnd||e.rowStart!==e.rowEnd)return!1}return!0}function mE(e){if(!Array.isArray(e))return!1;let t=e[0];return!(!t||typeof t!=`object`||!t.isIRange&&t.colStart===void 0)}function hE(e,t,r,i=!1,a,o,s=null){let c=r;if(c===null)return;if(c.colStart!==void 0){let t=e.getReference?.(c);o&&(t=t.toType(o)),c=t}if(c.isIRange){let e=c,r=s===`reject`?`throw`:`value`;try{return fE(e.values({type:o,onError:r,...oE}),t,s)}catch(e){if(n.a.isError(e))return e;throw e}}let l=Array.isArray(t);if(Array.isArray(c)){let r=c.length;for(let u=0;u<r;u++){let r=c[u];if(r!==null)if(Array.isArray(r)){let n=hE(e,t,r,i,a,o,s);if(n)return n}else{if(s===`reject`&&n.a.isError(r)||o&&(r=dE(e.getRuntime(),r,nE(r,!0),o,i),r instanceof n.a.Value))return r;l?t.push(r):t.values[t.length++]=c}}return}return s===`reject`&&n.a.isError(c)||o&&(c=dE(e.getRuntime(),c,nE(c,!0),o,i),c instanceof n.a.Value)?c:void(l?t.push(c):t.values[t.length++]=c)}function gE(e,t,r,i,a,o=null){if(r===`p`){let e=t;if(!e||!e.isIReferenceRange){if(n.a.isError(t))return t;let e=t;if(e?.isIRange&&e.size===1){let t=e.getValueAt(0,0);if(n.a.isError(t))return t}return n.a.BuiltIn.Value}if(o===`reject`&&e.hasError()){let t=e.errors().next();if(!t.done)return t.value.value}return i&&(e=o===`accept`?e.toType({type:i,onError:`value`}):e.toType(i)),e}let s;try{t?.isIReferenceRange?(s=t,i&&(s=o===`accept`?s.toType({type:i,onError:`value`}):s.toType(i))):o===`accept`?(s=n.a.isError(t)?e.createRange(1,1,t):e.getRange(t,void 0,a),i&&(s=s.toType({type:i,onError:`value`}))):s=e.getRange(t,i??void 0,a)}catch(e){return e}if(o===`reject`&&s.hasError()){let e=s.errors().next();if(!e.done)return e.value.value}return r===`r`?s:s.getValues()}function _E(e,t,r,i,a,o,s,c,l=null){let u=r;if(u&&u.colStart!==void 0)if(a)u=e.getReference?.(u);else{let t=u.colStart,n=u.rowStart,r=u.colEnd;u=u.rowEnd!==n||t!==r?e.getReference?.(u):e.getValueAt(n,t,u.scope)}if(i&&typeof r==`string`&&(o===n.n.Boolean||!o&&a))if(r===`TRUE`||r===`FALSE`)u=r===`TRUE`;else{let e=r.toUpperCase();e!==`TRUE`&&e!==`FALSE`||(u=e===`TRUE`)}u?.isIRange&&u.isDirectScalar?.()&&(u=u.getValueAt(0,0));let d=u?function(e){let t=e,n=0;for(;Array.isArray(t);)n++,t=t[0];return t&&(t.isIRange||t.colStart!==void 0)&&(n+=2),n}(u):0;if(d===0&&n.a.isError(u)){if(l===`reject`)return u;l===`accept`&&(o=null)}if(d===0&&o){let t=nE(u,!0);if(t!==o){let n=!i&&c;u=dE(e.getRuntime(),u,t,o,!n)}if(!s&&n.a.isError(u))return u}if(c){if(d===3){let n=u;for(let r=0;r<n.length;r++){let u=_E(e,t,n[r],i,a,o,s,c,l);if(u)return u}return}if(!a)return hE(e,t,u,i,a,o,l);if(u=gE(e,u,a,o,i,l),n.a.isError(u))return u}else{if(mE(u))return n.a.BuiltIn.Ref;if(a){if(u=gE(e,u,a,o,i,l),n.a.isError(u))return u}else if(d>0){if(u=function(e,t=!1){let r=e;for(;Array.isArray(r);){if(r.length>1)return t?n.a.BuiltIn.Value:r;r=r[0]}if(r?.isIRange){if(t&&r.size!==1)return n.a.BuiltIn.Value;r=r.getValueAt(0,0)}return r}(u,!0),l===`reject`&&n.a.isError(u))return u;if(o&&!n.a.isError(u)){let t=nE(u,!0);if(t!==o&&(u=dE(e.getRuntime(),u,t,o,i)),!s&&n.a.isError(u))return u}}}if(!s&&n.a.isError(u))return u;Array.isArray(t)?t.push(u):t.values[t.length++]=u}function vE(e){return e!=e||e===1/0||e===-1/0?n.a.BuiltIn.Num:e>-22250738585072014e-324&&e<sE?0:e}function yE(e,t,r=typeof e){if(r===`number`)return vE(e);if(r===`string`)return e.length>n.r.MAX_TEXT_LENGTH?n.a.BuiltIn.Value:e;if(e==null)return null;if(!t)return e;if(Array.isArray(e))try{e=t.getRange(e)}catch{return n.a.BuiltIn.Value}return e}function bE(e,t,r){let i;i=Array.isArray(e)?Array.isArray(e[0])?e:[e]:[[e]],t||=new Ya({axis:n.l.Axis.Column});let a=t.getAxis()===n.l.Axis.Column,o=Ua(i,a,Pa(r?.colStart??0,r?.rowStart??0,void 0,void 0,a),!0),s=Fa(o.bounds,a);return t.setValues(o.tuples),{values:t,coords:s,isLiteral:!r}}function xE(e,t=null){let n=[];for(let r=0;r<e;r++)n.push(t);return n}function SE(e){let t=[];for(let n=0;n<e;n++)t.push(void 0);return t}var CE=Object.freeze([n.n.Number,n.n.Boolean,n.n.Null]),wE=Object.freeze([n.n.Number,n.n.Null]),TE=Object.freeze([n.n.Number,n.n.String,n.n.Null]),EE=Object.freeze([n.n.Number,n.n.String,n.n.Boolean]),DE=Object.freeze([n.n.Number,n.n.String,n.n.Boolean,n.n.Null,n.n.RichData]),OE=new WeakMap,kE=(e,t)=>{let n=OE.get(e);return n||(n=t??{coerce:void 0,byRun:new WeakMap},OE.set(e,n)),n},AE=Object.freeze({count:0,numericalCount:0,sum:null,min:null,max:null,average:null,var:null,varP:null,stdDev:null,stdDevP:null});function jE(e,t,r,i,a,o,s){if(t.getCount()===0)return null;let c=null,l=t.getAxis()===n.l.Axis.Column,u=i.length,d=a?{...PE,...a}:PE,f=d.bounds,p=a?.coerce;o.coerce!==p&&(o.byRun=new WeakMap,o.coerce=p);let m=o.byRun,h=ME(e,a),g=h.coerce,_=h.defaultCoerce,v=a?.onError??`ignore`,y=!1,b=null;if(v!==`ignore`)if(v===`throw`)y=!0;else{if(v===`value`)throw Error(`onError "value" is not supported in RangeStats`);typeof v==`function`&&(b=v)}for(let e=0;e<u;e++){let a=i[e];if(!a)continue;let o=l?a.colStart:a.rowStart,u=l?a.rowStart:a.colStart,p=l?a.colEnd:a.rowEnd,h=l?a.rowEnd:a.colEnd;f.colStart=l?o:u,f.rowStart=l?u:o,f.colEnd=l?p:h,f.rowEnd=l?h:p;let v,x,S=t.getRuns(d),C=0,w=0,T=0,E=0,D=0,O=0,k=0,A=0,j=0,M=0,N=!1,P=S.next();for(P.done||c||(c=IE());!P.done;){let[,e,t]=P.value;if(P=S.next(),C=t.length,w=Math.max(0,u-e),T=Math.min(C-1,h-e),!(w>T)){x=m.get(t),x||(E=Math.ceil(C/s),x=Array(E),m.set(t,x)),D=Math.floor(w/s),O=Math.floor(T/s);for(let e=D;e<=O;e++){if(k=e*s,A=Math.min((e+1)*s-1,C-1),j=Math.max(w,k),M=Math.min(T,A),j>M)continue;N=j===k&&M===A;let i=x[e];if(N){if(i){if((y||b)&&(i.typed[n.n.Error]>0||g!==null&&i.count!==i.typed[n.n.Number]))for(let e=k;e<=A;e++){v=t.at(e);let i=nE(v,!0);if(i!==n.n.Number&&(g&&(v=g(v,i,_,r)),n.a.isError(v))){if(y)throw v;b(v)}}}else{i=IE();for(let e=k;e<=A;e++){i.count++,v=t.at(e);let a=nE(v,!0);if(i.typed[LE(a)]++,a!==n.n.Number){let e=!0;if(g&&(v=g(v,a,_,r),a=nE(v,!0),e=a!==n.n.Number),n.a.isError(v)){if(y)throw v;b&&b(v)}if(e)continue}RE(i,v)}x[e]=i}zE(c,i)}else for(let e=j;e<=M;e++){c.count++,v=t.at(e);let i=nE(v,!0);if(c.typed[LE(i)]++,i!==n.n.Number){let e=!0;if(g&&(v=g(v,i,null,r),i=nE(v,!0),e=i!==n.n.Number),n.a.isError(v)){if(y)throw v;b&&b(v)}if(e)continue}RE(c,v)}}}}}return c}function ME(e,t){let r=t?.coerce;if(r){if(typeof r==`function`)return{coerce:r,defaultCoerce:uE(e,n.n.Number,DE)};if(Array.isArray(r))return{coerce:uE(e,n.n.Number,r),defaultCoerce:null}}return{coerce:null,defaultCoerce:null}}function NE(e){if(!e||e.count===0)return AE;let t=e.numericalCount;if(!t||e.min===void 0)return Object.freeze({...AE,count:e.count});let n=e.sum/t,r=Math.max(0,e.sumSq/t-n*n),i=t>1?r*(t/(t-1)):null,a={count:e.count,numericalCount:t,sum:e.sum,min:e.min,max:e.max,average:n,varP:r,stdDevP:Math.sqrt(r),var:i,stdDev:i===null?null:Math.sqrt(i)};return a.populationVariance=r,Object.freeze(a)}var PE={bounds:{colStart:0,rowStart:0,colEnd:0,rowEnd:0},overflowRun:!0},FE={bounds:{colStart:0,rowStart:0,colEnd:0,rowEnd:0},overflowRun:!0},IE=()=>({count:0,min:void 0,max:void 0,numericalCount:0,sum:0,sumSq:0,typed:{[n.n.Number]:0,[n.n.String]:0,[n.n.Boolean]:0,[n.n.Error]:0,[n.n.RichData]:0,[n.n.Null]:0}}),LE=e=>{switch(e){case n.n.Number:case n.n.String:case n.n.Boolean:case n.n.Error:case n.n.RichData:case n.n.Null:return e;case n.s.Date:return n.n.Number;default:return n.n.Null}},RE=(e,t)=>{e.sum+=t,e.numericalCount++,e.sumSq+=t*t,e.min===void 0?(e.min=t,e.max=t):(t<e.min&&(e.min=t),t>e.max&&(e.max=t))},zE=(e,t)=>{e.sum+=t.sum,e.numericalCount+=t.numericalCount,e.count+=t.count,e.sumSq+=t.sumSq;let r=e.typed,i=t.typed;r[n.n.Number]+=i[n.n.Number],r[n.n.String]+=i[n.n.String],r[n.n.Boolean]+=i[n.n.Boolean],r[n.n.Error]+=i[n.n.Error],r[n.n.RichData]+=i[n.n.RichData],r[n.n.Null]+=i[n.n.Null],t.min!==void 0&&(e.min===void 0?(e.min=t.min,e.max=t.max):(t.min<e.min&&(e.min=t.min),t.max>e.max&&(e.max=t.max)))},BE=0x4000000000000,VE=class{constructor(e,t,n){this._kept=[],this._limit=e,this._distinct=t,this._rank=n}offer(e){let t=this._kept,n=this._rank;if(this._distinct){let r=t.length;for(let i=0;i<r;i++)if(n(t[i],e)===0)return}let r=t.length;r<this._limit?t.splice(HE(t,e,n),0,e):n(e,t[r-1])<0&&(t.pop(),t.splice(HE(t,e,n),0,e))}values(){return this._kept}};function HE(e,t,n){let r=0,i=e.length;for(;r<i;){let a=r+i>>>1;n(e[a],t)<=0?r=a+1:i=a}return r}function UE(e,t){let n=e?.compareFn??t;return e?.reverse?n:(e,t)=>n(t,e)}function WE(e,t,r,i,a){let o=i?.limit??10;if(!(o>0)||e.getCount()===0)return KE;let s=i?.includeBlanks??!1,c=i?.filterFn,l=UE(i,a),u=new VE(o,i?.distinct??!1,l),d=e.getAxis()===n.l.Axis.Column,f=t.length,p=(r?{...qE,...r}:qE).bounds,m=0,h=0;for(let n=0;n<f;n++){let r=t[n];if(!r)continue;m+=(r.colEnd-r.colStart+1)*(r.rowEnd-r.rowStart+1);let i=d?r.colStart:r.rowStart,a=d?r.rowStart:r.colStart,o=d?r.colEnd:r.rowEnd,s=d?r.rowEnd:r.colEnd;p.colStart=d?i:a,p.rowStart=d?a:i,p.colEnd=d?o:s,p.rowEnd=d?s:o;let l=e.getRuns(qE),f=l.next();for(;!f.done;){let[,e,t]=f.value;f=l.next();let n=t.length,r=Math.max(0,a-e),i=Math.min(n-1,s-e);if(!(r>i))for(let e=r;e<=i;e++){h++;let n=t.at(e);c&&!c(n)||u.offer(n)}}}if(s){let e=m-h,t=Math.min(e,o);for(let e=0;e<t;e++)u.offer(null)}return u.values()}function GE(e,t,n){let r=t?.limit??10;if(!(r>0))return KE;let i=UE(t,n),a=new VE(r,t?.distinct??!1,i),o=e.length;for(let n=0;n<o;n++){let r=e[n].getRanked(t),i=r.next();for(;!i.done;)a.offer(i.value),i=r.next()}return a.values()}var KE=Object.freeze([]),qE={bounds:{colStart:0,rowStart:0,colEnd:0,rowEnd:0},overflowRun:!0},JE=class e{constructor(e){this._sorted=e}static fromGrid(t,n,r){return new e(e._collectNumbers(t,n,r))}getLarge(e){e=Math.floor(e);let t=this._sorted,n=t.length;return e<1||e>n?null:t[n-e]}getSmall(e){e=Math.floor(e);let t=this._sorted,n=t.length;return e<1||e>n?null:t[e-1]}getPercentile(e,t=!1){let n=this._sorted,r=n.length;if(r===0)return null;if(t){if(e<=0||e>=1)return null;let t=e*(r+1)-1;return t<0||t>r-1?null:YE(n,t)}return e<0||e>1?null:YE(n,e*(r-1))}getRankOf(e,t=!0,n=!1){let r=this._sorted,i=r.length;if(i===0)return null;let a=XE(r,e);if(a>=i||r[a]!==e)return null;let o=ZE(r,e)-1;return n?((t?i-o:a+1)+(t?i-a:o+1))/2:t?i-o:a+1}getPercentRankOf(e,t=!1,r){let i=this._sorted,a=i.length;if(a===0)return null;let o,s=XE(i,e);if(s<a&&i[s]===e){if(a===1)return 1;o=t?(s+1)/(a+1):s/(a-1)}else{if(s===0||s>=a)return null;let n=i[s-1],r=(e-n)/(i[s]-n);o=t?(s+r)/(a+1):(s-1+r)/(a-1)}if(r===void 0)return o;if(!(r>=1))return n.a.BuiltIn.Num;let c=10**Math.trunc(r);return Number.isFinite(c)?Math.floor(o*c)/c:n.a.BuiltIn.Div0}getValues(){return this._sorted}findFloor(e){let t=this._sorted;if(t.length===0)return null;let n=ZE(t,e)-1;return n<0?null:t[n]}findCeiling(e){let t=this._sorted;if(t.length===0)return null;let n=XE(t,e);return n>=t.length?null:t[n]}static _collectNumbers(e,t,r){if(e.getCount()===0)return QE;let i=[],a=e.getAxis()===n.l.Axis.Column,o=t.length,s=(r?{...$E,...r}:$E).bounds;for(let n=0;n<o;n++){let r=t[n];if(!r)continue;let o=a?r.colStart:r.rowStart,c=a?r.rowStart:r.colStart,l=a?r.colEnd:r.rowEnd,u=a?r.rowEnd:r.colEnd;s.colStart=a?o:c,s.rowStart=a?c:o,s.colEnd=a?l:u,s.rowEnd=a?u:l;let d=e.getRuns($E),f=d.next();for(;!f.done;){let[,e,t]=f.value;f=d.next();let n=t.length,r=Math.max(0,c-e),a=Math.min(n-1,u-e);if(!(r>a))for(let e=r;e<=a;e++){let n=t.at(e);typeof n==`number`&&i.push(n)}}}return i.sort((e,t)=>e-t),Object.freeze(i)}};function YE(e,t){let n=Math.floor(t),r=t-n;return r===0?e[n]:e[n]+r*(e[n+1]-e[n])}function XE(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<t?n=i+1:r=i}return n}function ZE(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<=t?n=i+1:r=i}return n}var QE=Object.freeze([]),$E={bounds:{colStart:0,rowStart:0,colEnd:0,rowEnd:0},overflowRun:!0},eD=class e{constructor(e,t,n,r,i,a,o=8192){this._runtime=e,this._grid=t,this._range=n,this._localCoords=r??[t.getCoords()],this._iteratorOptions=i,this._segmentCache=a??kE(t),this._ZoneSizeMinor=o}clone(t,n){return new e(this._runtime,t??this._grid,this._range?.clone()??null,n,this._iteratorOptions,kE(t??this._grid,this._segmentCache),this._ZoneSizeMinor)}clear(){this._sortedNumbers=void 0,this._aggregates=void 0,this._typedCounts=void 0,this._lastNumber=void 0,this._frequencies=void 0,this._ranked=void 0}_getLastNumber(){let e=this._lastNumber;return e===void 0&&(e=function(e,t,r,i,a){if(t.getCount()===0)return;let o,s=t.getAxis()===n.l.Axis.Column,c=i.length,l=ME(e,a),u=l.coerce,d=l.defaultCoerce,f=a?{...FE,...a,overflowRun:!0}:FE,p=f.bounds,m=-1,h=-1;for(let e=0;e<c;e++){let a=i[e];if(!a)continue;let c=s?a.colStart:a.rowStart,l=s?a.rowStart:a.colStart,g=s?a.colEnd:a.rowEnd,_=s?a.rowEnd:a.colEnd;p.colStart=s?c:l,p.rowStart=s?l:c,p.colEnd=s?g:_,p.rowEnd=s?_:g;let v=t.getRuns(f),y=v.next();for(;!y.done;){let[e,t,i]=y.value;y=v.next();let a=Math.max(0,l-t),c=Math.min(i.length-1,_-t);if(!(a>c))for(let l=c;l>=a;l--){let a=t+l,c=s?a:e,f=s?e:a;if(c<m||c===m&&f<=h){if(s)break;continue}let p=i.at(l),g=nE(p,!0);if((g===n.n.Number||u&&(p=u(p,g,d,r),nE(p,!0)===n.n.Number))&&(m=c,h=f,o=p,s))break}}}return o}(this._runtime,this._grid,this._range,this._localCoords,this._iteratorOptions)??null,this._lastNumber=e),e??void 0}toLocalCoords(t,n){return new e(this._runtime,this._grid,this._range,Array.isArray(t)?t:[t],n??this._iteratorOptions,this._segmentCache,this._ZoneSizeMinor)}getSize(){let e=this._localCoords,t=e.length,n=0;for(let r=0;r<t;r++){let t=e[r];n+=(t.colEnd-t.colStart+1)*(t.rowEnd-t.rowStart+1)}return n}getCount(){return jE(this._runtime,this._grid,this._range,this._localCoords,this._iteratorOptions?{...this._iteratorOptions,onError:`ignore`}:tD,this._segmentCache,this._ZoneSizeMinor)?.count??0}getAggregates(e){if(e)return NE(jE(this._runtime,this._grid,this._range,this._localCoords,this._iteratorOptions?{...this._iteratorOptions,...e}:e,this._segmentCache,this._ZoneSizeMinor));let t=this._aggregates;return t||(t=NE(jE(this._runtime,this._grid,this._range,this._localCoords,this._iteratorOptions,this._segmentCache,this._ZoneSizeMinor)),this._aggregates=t),t}getSnappedSum(e){let t=this.getAggregates(),n=e??t.sum??0;return((e,t)=>e!==0&&e!==1/0&&e!==-1/0&&Math.abs(e)*BE<=t+Math.abs(e))(n,(e=>{let t=e.min;return t==null?0:Math.max(Math.abs(t),Math.abs(e.max))})(t))?((e,t)=>t===void 0?e:Math.abs(e)*BE<=Math.abs(e-t)?0:e)(n,this._getLastNumber()):n}getSortedNumbers(){let e=this._sortedNumbers;return e||(e=JE.fromGrid(this._grid,this._localCoords,this._iteratorOptions),this._sortedNumbers=e),e}getRanked(e){if(e)return WE(this._grid,this._localCoords,this._iteratorOptions,e,this._defaultCompare())[Symbol.iterator]();let t=this._ranked;return t||(t=WE(this._grid,this._localCoords,this._iteratorOptions,e,this._defaultCompare()),this._ranked=t),t[Symbol.iterator]()}getFrequencies(e){if(e)return this._buildFrequencies(e);let t=this._frequencies;return t||(t=this._buildFrequencies(),this._frequencies=t),t}_buildFrequencies(e){let t=e?.includeBlanks?this.getTypedCounts([n.n.Null])[n.n.Null]:0,r=e?.filterFn?void 0:this.getCount()+t;return lg.fromGrid(this._grid,this._localCoords,this._iteratorOptions,e,this._defaultCompare(),t,r)}_defaultCompare(){let e=this._runtime.getLocaleProfile();return(t,n)=>qo.compare(t,n,e)}getTypedCounts(e){let t=this._typedCounts;if(!t){let e=jE(this._runtime,this._grid,this._range,this._localCoords,this._iteratorOptions?{...this._iteratorOptions,onError:`ignore`}:tD,this._segmentCache,this._ZoneSizeMinor)?.typed,r={[n.n.Number]:e?.[n.n.Number]??0,[n.n.String]:e?.[n.n.String]??0,[n.n.Boolean]:e?.[n.n.Boolean]??0,[n.n.Error]:e?.[n.n.Error]??0,[n.n.RichData]:e?.[n.n.RichData]??0,[n.n.Null]:0},i=this._localCoords,a=i.length,o=0;for(let e=0;e<a;e++){let t=i[e];t&&(o+=(t.colEnd-t.colStart+1)*(t.rowEnd-t.rowStart+1))}r[n.n.Null]=Math.max(0,o-r[n.n.Number]-r[n.n.String]-r[n.n.Boolean]-r[n.n.Error]-r[n.n.RichData]),t=Object.freeze(r),this._typedCounts=t}if(e===void 0)return t;let r={},i=e.length;for(let n=0;n<i;n++)r[e[n]]=t[e[n]]??0;return r}get isIRangeStats(){return!0}},tD={onError:`ignore`},nD=class t{constructor(e,t,n,r=null,i=!1,a=!1){this._isLiteral=!1,this._isDirectScalar=!1,this._localRangeStats=null,this._localRangeStatsOptions=void 0,this._runtime=e,this._values=t,this._coords=n,r&&(r={...sD,...r}).axis===`fastest`&&(r.axis=t.getAxis()),this._optionsIterator=r??sD,this._isLiteral=i,this._isDirectScalar=a}argsort(e=this,t=1,r=n.l.Axis.Row){let i=r===n.l.Axis.Column,a=Array.isArray(e)?e:[e],o=Array.isArray(t)?t:[t];return function(e,t,n,r){let i=Array.from({length:e},(e,t)=>t),a=t.length;if(a===1){let e=t[0],a=n[0]??1;return i.sort((t,n)=>hD(e[t],e[n],a,r)),i}return i.sort((e,i)=>{for(let o=0;o<a;o++){let a=n[o]??1,s=t[o],c=hD(s[e],s[i],a,r);if(c!==0)return c}return 0}),i}(i?this.getColumnCount():this.getRowCount(),a.map(e=>function(e,t,n){let r=n?e.getColumnCount():e.getRowCount(),i=Array(r).fill(null),a=e.entries(),o=a.next();for(;!o.done;){let{value:e,coords:t}=o.value;(n?t.rowIndex:t.colIndex)===0&&(i[n?t.colIndex:t.rowIndex]=e),o=a.next()}return i}(e,0,i)),o,this._runtime.getLocaleProfile())}uniqueIndices(e=n.l.Axis.Row,t=!1){let r=e===n.l.Axis.Column,i=r?this.getColumnCount():this.getRowCount(),a=Array(i).fill(``),o=new Map,s=this.entries({axis:e,includeEmpty:!1}),c=s.next();for(;!c.done;){let{value:e,coords:t}=c.value,n=r?t.colIndex:t.rowIndex,i=r?t.rowIndex:t.colIndex;a[n]+=gD(i,e,o),c=s.next()}return function(e,t){let n=new Map;for(let t of e)n.set(t,(n.get(t)??0)+1);let r=new Set,i=[];for(let a=0;a<e.length;a++){let o=e[a];r.has(o)||(r.add(o),t&&n.get(o)!==1||i.push(a))}return i}(a,t)}broadcast(t,r,i){let a=this._coords;if(t===void 0)return this._self();i=i?{...this._optionsIterator,...i}:this._optionsIterator;let o,s=i?.type,c=i?.otherType??s,l=s?this._coerceValue(null,s,i,n.n.Null):null,u=c?this._coerceValue(null,c,i,n.n.Null):null,d=t?.isIRange;if(!d&&a&&r.length===2)return this._broadcastScalar(t,r,i,l,u,c);if(d)o=t;else{let n=this._values.clone();n.setValueAt(0,0,t),o=this._newRange(n,e.l.EmptyRange,{type:nE(t,!0),...i})}let f=o,p=this.getColumnCount(),m=this.getRowCount(),h=f.getColumnCount(),g=f.getRowCount(),_=Math.min(p,h),v=Math.min(m,g),y=Math.max(p,h),b=Math.max(m,g),x=i?.misalignValue??null,S=x!==null&&y>_||b>v,C=!1;if(p!==h)if(p===1)_=h;else if(h===1)_=p;else{if(x===null)throw Error(`Incompatible shapes for broadcast: cols ${p} and ${h} must be equal or one must be 1`);C=!0}if(m!==g)if(m===1)v=g;else if(g===1)v=m;else{if(x===null)throw Error(`Incompatible shapes for broadcast: rows ${m} and ${g} must be equal or one must be 1`);C=!0}let w=this._values.getAxis(),T=w,E=T===n.l.Axis.Column;a??=e.l.EmptyRange;let D,O,k=f._coords??e.l.EmptyRange;if(C&&(a={colStart:a.colStart,rowStart:a.rowStart,colEnd:a.colStart+_-1,rowEnd:a.rowStart+v-1},k={colStart:k.colStart,rowStart:k.rowStart,colEnd:k.colStart+_-1,rowEnd:k.rowStart+v-1}),p===1&&p<h||m===1&&m<g){let e={...a};p===1&&(e.colEnd=e.colStart),m===1&&(e.rowEnd=e.rowStart),D=new za({delegate:this._entries({...i,axis:T,bounds:e,reuseResult:!1}),bounds:e,axis:T,dims:{major:E?_:v,minor:E?v:_}})}else D=this._entries({...i,axis:T,bounds:a,reuseResult:!1});if(h===1&&h<p||g===1&&g<m){let e={...k};h===1&&(e.colEnd=e.colStart),g===1&&(e.rowEnd=e.rowStart),O=new za({delegate:f._entries({...i,type:c??null,axis:T,bounds:e,reuseResult:!1}),bounds:e,axis:T,dims:{major:E?_:v,minor:E?v:_}})}else O=f._entries({...i,type:c??null,axis:T,bounds:k,reuseResult:!1});let A,j,M=a.colStart,N=a.rowStart,P=M-k.colStart,F=N-k.rowStart,I=T===w?new ri.Builder:new ri.TransposedBuilder,L=new Ba({...i,bounds:a,comparator:(E?k_:A_)(a,k)},D,O),ee=r.length===2,te=E?M:N,R=E?N:M,z=te+(E?_:v)-1,ne=R+(E?v:_)-1,re=te,B=R,ie=(t,n)=>{for(A===void 0&&(A=r(l,u,e.l.EmptyCell,this));re<t;){let e=ne+1-B;e>0&&I.pushMultipleAt(re,B,new Li([A],e)),re++,B=R}B<n&&(I.pushMultipleAt(re,B,new Li([A],n-B)),B=n)},ae=L.next();for(;!ae.done;){let e=ae.value,t=e[1],n=e[3],i=e[0],a=e[2],o=i?i.colIndex:a.colIndex+P,s=i?i.rowIndex:a.rowIndex+F,c=r(t??l,n??u,{colIndex:o-M,rowIndex:s-N},this),d=E?o:s,f=E?s:o;ee&&(d>re||f>B)&&ie(d,f),I.pushAt(d,f,c),B=f+1,B>ne?(re=d+1,B=R):re=d,ae=L.next()}if(ee)for(;re<=z;){let t=ne+1-B;t>0&&(A===void 0&&(A=r(l,u,e.l.EmptyCell,this)),I.pushMultipleAt(re,B,new Li([A],t))),re++,B=R}if(S){let e=this._values.clone();if(this._applyBuilder(e,I),y>_){let t=Ha(x,Pa(M+_,N,M+y-1,N+b-1,E),E);e.setValues(t.tuples)}if(b>v){let t=Ha(x,Pa(M,N+v,M+y-1,N+b-1,E),E);e.setValues(t.tuples)}j=this._newRange(e,{colStart:M,rowStart:N,colEnd:M+y-1,rowEnd:N+b-1},this._optionsIterator)}else j=this._cloneFromBuilder(I),(y>j.getColumnCount()||b>j.getRowCount())&&(j=j.resize(b,y));return j._untyped()}_broadcastScalar(t,r,i,a,o,s){let c=this._coords,l=this._values.getAxis(),u=l===n.l.Axis.Column,d=(s?this._coerceValue(t,s,i):t)??o,f=c.colStart,p=c.rowStart,m=u?f:p,h=u?p:f,g=u?c.colEnd:c.rowEnd,_=u?c.rowEnd:c.colEnd,v=r(a,d,e.l.EmptyCell,this),y=new ri.Builder,b=m,x=h,S=(e,t)=>{for(;b<e;){let e=_+1-x;e>0&&y.pushMultipleAt(b,x,new Li([v],e)),b++,x=h}x<t&&(y.pushMultipleAt(b,x,new Li([v],t-x)),x=t)},C=this._entries({...i,axis:l,bounds:c,reuseResult:!1}),w=C.next();for(;!w.done;){let e=w.value,t=e[0],n=t.colIndex,i=t.rowIndex,o=u?n:i,s=u?i:n;S(o,s),y.pushAt(o,s,r(e[1]??a,d,{colIndex:n-f,rowIndex:i-p},this)),x=s+1,x>_?(b=o+1,x=h):b=o,w=C.next()}for(;b<=g;){let e=_+1-x;e>0&&y.pushMultipleAt(b,x,new Li([v],e)),b++,x=h}return this._cloneFromBuilder(y)._untyped()}choose(t,r,i){let a=i?.misalignValue??n.a.BuiltIn.NA;if(this.isEmpty())return this.replace([[a]]);let o=t.map(e=>e.isIRange?e:this.fill(e)),s=o.length,c=this.getColumnCount(),l=this.getRowCount();if(c===1&&l===1){let t=r(this.getValueAt(0,0),e.l.EmptyCell,this);return n.a.isError(t)?this.replace([[t]]):typeof t!=`number`||t<0||t>=s?this.replace([[a]]):o[t]}let u=c,d=l,f=u===1||d===1;for(let e=0;e<s;e++){let t=o[e],n=t.getColumnCount(),r=t.getRowCount();f=f||n===1||r===1,u=Math.max(u,n),d=Math.max(d,r)}let p=this;return f&&u>1&&d>1&&(c===1||l===1)&&(p=p.tile(l===1?d:1,c===1?u:1)),p=p.map((e,t)=>{let i=t.colIndex,c=t.rowIndex,l=r(e,t,this);if(n.a.isError(l))return l;if(typeof l!=`number`||l<0||l>=s)return a;let u=o[l];f&&(u.getColumnCount()===1&&(i=0),u.getRowCount()===1&&(c=0));let d=u.getValueAt(c,i);return d===void 0?a:d}),p=p.resize(d,u,a),p}clear(){let e=this._coords,t=this._values;return e&&t.getCount()!==0?(t=t.cloneEmpty(),this._newRange(t,this._coords,this._optionsIterator)):this._self()}clone(e,t=!1,n=!1){return this._newRange(this._values,this._coords,e??this._optionsIterator,t,n)}compute(e){return e(this)}concat(e,t=n.l.Axis.Row,r=n.a.BuiltIn.NA){let i=t===n.l.Axis.Column,a=this.getColumnCount(),o=this.getRowCount(),s=e.getColumnCount(),c=e.getRowCount(),l=i?a+s:Math.max(a,s),u=i?Math.max(o,c):o+c,d=this.resize(u,l,r).sparseBuilder(n.l.Axis.Column),f=i?0:o,p=i?a:0,m=e.entries({axis:n.l.Axis.Column,includeEmpty:!1}),h=m.next();for(;!h.done;){let{value:e,coords:t}=h.value;d.pushAt(t.rowIndex+f,t.colIndex+p,e),h=m.next()}return d.build()}empty(){let e=this._coords,t=this._values;return e&&t.getCount()!==0?(t=t.cloneEmpty(),this._newRange(t,null,this._optionsIterator)):this._self()}entries(e){let t=this._coords;if(!t)return ti;let n=e?.bounds;if(e={...this._optionsIterator,...e,bounds:t},n){let r=(n.colStart??0)-t.colStart,i=(n.rowStart??0)-t.rowStart,a=Math.max(r+t.colStart,t.colStart),o=Math.max(i+t.rowStart,t.rowStart),s=Math.min((n.colEnd??2**53-1)-r,t.colEnd-t.colStart)+1,c=Math.min((n.rowEnd??2**53-1)-i,t.rowEnd-t.rowStart)+1;e.bounds={colStart:a,rowStart:o,colEnd:a+s-1,rowEnd:o+c-1}}let r=this._entries(e),i={[Symbol.iterator]:()=>i,next(){for(;;){let e=r.next();if(e.done)return ei;let n=e.value,i=n[0];return{done:!1,value:{coords:{colIndex:i.colIndex-t.colStart,rowIndex:i.rowIndex-t.rowStart},value:n[1]??null}}}}};return i}errors(e){let t=this.entries({axis:e?.axis??n.l.Axis.Row,bounds:e?.bounds,reverse:e?.reverse,type:null}),r={[Symbol.iterator]:()=>r,next(){let e=t.next();for(;!e.done;){if(n.a.isError(e.value.value))return e;e=t.next()}return ei}};return r}every(e,t){if(!e)return!0;let n=this.entries(t),r=n.next();for(;!r.done;){let t=r.value;if(!e(t.value,t.coords,this))return!1;r=n.next()}return!0}fill(e,t){let n=this._coords;if(!n||t&&(n=this._absoluteCoords(t),!n))return this._self();let r=this._values.clone();return cD(r,n,e),this._newRange(r,n,this._optionsIterator)}fillEmpty(e,t){let r=this._coords;if(!r||t&&(r=this._absoluteCoords(t),!r))return this._self();let i=this._values;if(r.rowStart===r.rowEnd&&r.colStart===r.colEnd&&i.getValueAt(r.rowStart,r.colStart)!=null)return this;let a=i.getAxis(),o=a,s=o===n.l.Axis.Column,c=s?r.colStart:r.rowStart,l=s?r.rowStart:r.colStart,u=s?r.colEnd:r.rowEnd,d=s?r.rowEnd:r.colEnd,f=i.getRuns({bounds:r,overflowRun:!0}),p=f.next(),m=c,h=l,g=o===a?new ri.Builder:new ri.TransposedBuilder;for(;!p.done;){let t=p.value,n=t[0];for(;m<n;){let t=new Li([e],d+1-h);g.pushMultipleAt(m,h,t),m++,h=l}let r=t[1],i=Math.max(r,l),a=t[2],o=Math.min(r+a.length-1,d);if(h<i){let t=new Li([e],r-h);g.pushMultipleAt(m,h,t)}h=o+1,o>=d?(m=n+1,h=l):m=n,p=f.next()}for(;m<=u;){let t=new Li([e],d+1-h);g.pushMultipleAt(m,h,t),m++,h=l}return this._cloneFromBuilder(g)}filter(e,t){let r=this._coords,i=this._values;if(!r||i.getCount()===0)return this._self();let a=t?.axis===`fastest`?i.getAxis():t?.axis??this._optionsIterator.axis,o=this.empty()._createBuilder(a),s=a===n.l.Axis.Column,c=-1,l=-1,u=!1,d=0,f=this.entries(t),p=f.next();for(;!p.done;){let t=p.value,r=t.coords,i=s?r.colIndex:r.rowIndex,a=s?r.rowIndex:r.colIndex,m=t.value;d++;let h=e(m,r,this);h?(i!==c&&(c=i,l++),n.a.isError(h)&&(m=h),o.pushAt(l,a,m)):u=!0,p=f.next()}return u||d!==this.size?this.empty()._cloneFromBuilder(o):this._self()}flatten(e){let t=[],n=this.values(e),r=n.next();for(;!r.done;)t.push(r.value),r=n.next();return t}forEach(e,t){if(!e)return;let n=this.entries(t),r=n.next();for(;!r.done;){let t=r.value,i=e(t.value,t.coords,this);if(i)return i.break;r=n.next()}}getColumnCount(){let e=this._coords;return e?e.colEnd-e.colStart+1:0}getRowCount(){let e=this._coords;return e?e.rowEnd-e.rowStart+1:0}getShape(){let e=this._coords;return{rows:e.rowEnd-e.rowStart+1,columns:e.colEnd-e.colStart+1}}getStats(e){let t=this._localRangeStats;if(!t||e!==this._localRangeStatsOptions){let n=this._coords;t=new eD(this._runtime,this._values,this,[n],e),this._localRangeStats=t,this._localRangeStatsOptions=e}return t}hasError(){return this.size<=dD?!this.errors({axis:`fastest`}).next().done:(this.getStats().getTypedCounts(fD)[n.n.Error]??0)>0}getType(){return this._optionsIterator?.type??void 0}getValueAt(e,t,n){let r=this._coords;if(!r||e<0||t<0||e>=r.rowEnd-r.rowStart+1||t>=this.getColumnCount())return;let i=this._values.getValueAt(e+r.rowStart,t+r.colStart)??null;i===void 0&&(i=null),n=n?{...this._optionsIterator,...n}:this._optionsIterator;let a=n?.type;return a&&(i=this._coerceValue(i,a,n)),i}getValues(e){if(!this._coords)return[[]];let t={...e,includeEmpty:!0,reverse:!1,onError:`value`,bounds:{colStart:0,rowStart:0,colEnd:this.getColumnCount()-1,rowEnd:this.getRowCount()-1}},r=!1;t.axis=e?.axis??n.l.Axis.Row,e&&(e.maxRows&&(t.bounds.rowEnd=0+e.maxRows-1),e.maxCols&&(t.bounds.colEnd=0+e.maxCols-1),e.trailingEmpties&&(r=e.trailingEmpties),t.axis=e?.axis??n.l.Axis.Row);let i=[];if(!r){t.includeEmpty=!1,t.reverse=!0,t.axis=n.l.Axis.Row;let r=this.entries(t).next();if(r.done)return oD;t.axis=n.l.Axis.Column;let i=this.entries(t).next();t.bounds.rowEnd=r.value.coords.rowIndex,t.bounds.colEnd=i.value.coords.colIndex,t.includeEmpty=!0,t.reverse=!1,t.axis=e?.axis??n.l.Axis.Row}let a,o=this.entries(t),s=t.axis!==n.l.Axis.Row,c=e?.onValue,l=-1,u=[];for(a=o.next();!a.done;){let e=a.value,t=e.coords,n=s?t.colIndex:t.rowIndex;n!==l&&(u=[],i.push(u),l=n);let r=e.value;if(c){let e=c(r,t.rowIndex,t.colIndex,this);e!==void 0&&(r=e)}u.push(r),a=o.next()}return i}map(e,t){let r=this._coords,i=this._values;if(!r)return this._self()._untyped();let a,o=t?.axis===`fastest`?i.getAxis():t?.axis??this._optionsIterator.axis,s=this.entries(t),c=s.next();c.done||(a=this._createBuilder(o));let l,u=o===n.l.Axis.Column,d=u?r.colStart:r.rowStart,f=u?r.rowStart:r.colStart;for(;!c.done;){let t=c.value,n=t.coords,r=u?n.colIndex:n.rowIndex,i=u?n.rowIndex:n.colIndex,o=t.value;c=s.next();let p=e(o,n,this);p===void 0?p=o:p===null?(l||=qa(u),l.append(r+d,i+f)):a.pushAt(r,i,p)}return this._cloneFromBuilder(a,l)._untyped()}mask(e,t,r){let i=r?.misalignValue??n.a.BuiltIn.NA,a=r?.emptyValue??null,o=r?.isTrue,s=uE(this._runtime,n.n.Boolean),c=e?.isIRange?e:this._newRange(this._values,null),l=t?.isIRange?t:this._newRange(this._values,null);if(c.size===1){let e=c.getValueAt(0,0),t=nE(e),i=t===n.n.Boolean?e:s(e,t);return n.a.isError(i)?this.empty().replace([[i]]):(!0===i?l:this).fillEmpty(r?.emptyValue??null)}let u=c.getColumnCount(),d=c.getRowCount(),f=l.getColumnCount(),p=this.getColumnCount(),m=Math.max(f,p,u),h=l.getRowCount(),g=this.getRowCount(),_=Math.max(h,g,d);c=c.repeat(d===1?_:1,u===1?m:1);let v=c.getColumnCount(),y=c.getRowCount(),b=this;b=b.repeat(g===1?y:1,p===1?v:1),b=b.fillEmpty(a);let x=h===1,S=f===1,C=b.sparseBuilder(uD),w=Math.max(g===1?y:g,x?y:h),T=Math.max(p===1?v:p,S?v:f);c=c.resize(w,T,i),c.forEach((e,t)=>{let r;if(o)r=o(e,t);else if(!0===e)r=!0;else if(!1===e)r=!1;else{let t=nE(e);r=t===n.n.Boolean?e:s(e,t)}let c=t.rowIndex,u=t.colIndex,d=null;!1!==r&&(!0===r?d=!S&&u>=f||!x&&c>=h?i:l.getValueAt(x?0:c,S?0:u)??a:n.a.isError(r)&&(d=r),C.pushAt(c,u,d))},pD);let E=C.build();return E=E.resize(_,m,i),E}alignValues(t,r){let i=r?{...this._optionsIterator,...r}:this._optionsIterator,a=this._values.getAxis(),o=i.axis,s=o&&o!==`fastest`?o:a,c=s===n.l.Axis.Column,l=e=>{let t=e.iterator.next();if(t.done)return void(e.done=!0);let n=t.value;e.value=n[1]??null,e.rowRel=n[0].rowIndex-e.rowBase,e.colRel=n[0].colIndex-e.colBase},u=[],d=(t,n,r)=>{let i=n._coords??e.l.EmptyRange,a={slot:t,iterator:n._entries({...r,axis:s,bounds:i,reuseResult:!1}),done:!1,value:null,rowRel:0,colRel:0,rowBase:i.rowStart,colBase:i.colStart};l(a),u.push(a)};d(0,this,i);let f=[],p=t.length;for(let e=0;e<p;e++){let n=t[e];n===null?f.push(e+1):d(e+1,n,n._optionsIterator)}let m=p+1,h=u.length,g=f.length,_=c?this.getRowCount():this.getColumnCount();return{[Symbol.iterator](){return this},next:()=>{let e=0,t=0,n=!1;for(let r=0;r<h;r++){let i=u[r];i.done||(n?(c?i.colRel-t||i.rowRel-e:i.rowRel-e||i.colRel-t)<0&&(e=i.rowRel,t=i.colRel):(e=i.rowRel,t=i.colRel,n=!0))}if(!n)return ei;let r=Array(m).fill(null);for(let n=0;n<h;n++){let i=u[n];i.done||i.rowRel!==e||i.colRel!==t||(r[i.slot]=i.value,l(i))}if(g>0){let n=c?t*_+e+1:e*_+t+1;for(let e=0;e<g;e++)r[f[e]]=n}return{done:!1,value:[r,{rowIndex:e,colIndex:t}]}}}}alignReduce(e,t,n,r){if(!t)return n;let i=Array.isArray(e)?e:[e],a=this.alignValues(i,r),o=n,s=a.next(),c=r?.emptyFold;if(!c){for(;!s.done;){let[e,n]=s.value;o=t(o,e,n,this),s=a.next()}return o}let l=this.getRowCount(),u=this.getColumnCount(),d=0;for(;!s.done;){let[e,n]=s.value;n.rowIndex<l&&n.colIndex<u&&d++,o=t(o,e,n,this),s=a.next()}let f=l*u-d;return f>0?c(o,f):o}reduce(e,t,n){if(!e)return t;let r=this.entries(n),i=r.next(),a=t;for(;!i.done;){let t=i.value;a=e(a,t.value,t.coords,this),i=r.next()}return a}repeat(e,t){if(e===1&&t===1)return this._self();if(e<=0||t<=0)throw Error(`Invalid tile dimensions: ${e} x ${t}`);let n=this._coords;if(!n)return this._self();let r=this._values.cloneEmpty(),i=n.colStart,a=n.rowStart,o={colStart:0,rowStart:0,colEnd:0,rowEnd:0};this.forEach((n,s)=>{o.colStart=i+s.colIndex*t,o.rowStart=a+s.rowIndex*e,o.colEnd=o.colStart+t-1,o.rowEnd=o.rowStart+e-1,cD(r,o,n)});let s=this.getColumnCount(),c=this.getRowCount();return n={colStart:n.colStart,rowStart:n.rowStart,colEnd:n.colStart+t*s-1,rowEnd:n.rowStart+e*c-1},this._newRange(r,n,this._optionsIterator)}reshape(e,t){let n=this.getRowCount(),r=this.getColumnCount();if(e===n&&t===r)return this._self();if(e<=0||t<=0||!Number.isFinite(e)||!Number.isFinite(t))throw Error(`Invalid reshape dimensions: ${e} x ${t}`);if(e*t<n*r)throw Error(`Cannot reshape ${n} x ${r} into ${e} x ${t}; the target holds fewer positions.`);let i=this._coords;if(!i)return this._self();let a=this._values.cloneEmpty(),o=i.rowStart,s=i.colStart;return this.forEach((e,n)=>{let i=n.rowIndex*r+n.colIndex;a.setValueAt(o+Math.trunc(i/t),s+i%t,e)}),this._newRange(a,{colStart:s,rowStart:o,colEnd:s+t-1,rowEnd:o+e-1},this._optionsIterator)}replace(t,n){let r;if(t?.isIRange)r=t;else{let e=bE(t,this._values,this._coords);r=this._newRange(e.values,e.coords,this._optionsIterator,e.isLiteral)}if(this.size===0)return r._self();if(r.size===0)return this._self();let i=this._values.clone(),a=r._values,o=r._coords??e.l.EmptyRange,s=this._coords??e.l.EmptyRange,c=s.colStart,l=s.rowStart,u=c+(n?.colIndex??0),d=l+(n?.rowIndex??0);a.copyTo(i,{colIndex:u,rowIndex:d},o);let f={colStart:c,rowStart:l,colEnd:c+Math.max(this.getColumnCount(),r.getColumnCount()+(n?.colIndex??0))-1,rowEnd:l+Math.max(this.getRowCount(),r.getRowCount()+(n?.rowIndex??0))-1};return this._newRange(i,f,this._optionsIterator)}resize(e,t,n=null){if(t<0||e<0)throw Error(`Invalid resize dimensions: ${t} x ${e}`);let r=this._coords,i=r?r.colStart:0,a=r?r.rowStart:0,o=r?r.colEnd:0,s=r?r.rowEnd:0;if(t===(r?o-i+1:0)&&e===(r?s-a+1:0))return this._self();let c=i+t-1,l=a+e-1,u=this._values;u=u.clone(),(!r||c>o||l>s)&&lD(u,r,c,l,n);let d={colStart:i,rowStart:a,colEnd:c,rowEnd:l};return this._newRange(u,d,this._optionsIterator)}select(e,t,n,r,i){Array.isArray(e)||(e=[e]);let a=e.length,o=-1;return n!==void 0&&(t=[...t,n],o=t.length-1),this.choose(t,(t,n)=>{let i=n.colIndex,s=n.rowIndex;for(let o=0;o<a;o++){let a=e[o];if(a.isIRange){let e=a,t=e.getColumnCount(),n=e.getRowCount();i+1>t&&t===1&&(i=0),s+1>n&&n===1&&(s=0),a=e.getValueAt(s,i)}if(r){if(mD.colIndex=i,mD.rowIndex=s,r(t,n,a,mD,this))return o}else if(t===a)return o}return o},i)}slice(e){if(!e)return this._self();let t=this._absoluteCoords(e);return t?this._newRange(this._values,t,this._optionsIterator):this.empty()}some(e,t){if(!e)return!1;let n=this.entries(t),r=n.next();for(;!r.done;){let t=r.value;if(e(t.value,t.coords,this))return!0;r=n.next()}return!1}sort(e=1,t=n.l.Axis.Row){let r=this.argsort(this,e,t);return this.take(r,t)}sparseBuilder(t){let r=this._values,i=this._axisFromOptions(t),a=r.getAxis(),o=i!==n.l.Axis.Row,s=i===a?new ri.Builder:new ri.TransposedBuilder,c=this,l=this._coords??e.l.EmptyRange,u=l.colStart,d=l.rowStart,f=o?u:d,p=o?d:u,m={pushAt(e,t,n){if(n===null)return m;let r=o?t:e,i=o?e:t;return s.pushAt(r+f,i+p,n),m},pushMultipleAt(e,t,n){let r;r=Array.isArray(n)?n:n.isIRange?n.flatten():[n];let i=o?t:e,a=o?e:t;return s.pushMultipleAt(i+f,a+p,r),m},build:()=>c._cloneFromBuilder(s)};return m}_takeSparse(e,t){let r=this.getRowCount(),i=this.getColumnCount(),a=t===n.l.Axis.Column,o=e.length,s=this.empty().resize(a?r:o,a?o:i,null).sparseBuilder(a?n.l.Axis.Column:n.l.Axis.Row);if(a)for(let t=0;t<o;t++){let n=e[t];for(let e=0;e<r;e++){let r=this.getValueAt(e,n);r!=null&&s.pushAt(e,t,r)}}else for(let t=0;t<o;t++){let n=e[t];for(let e=0;e<i;e++){let r=this.getValueAt(n,e);r!=null&&s.pushAt(t,e,r)}}return s.build()}_takeDense(e,t){let r=this.getRowCount(),i=this.getColumnCount(),a=t===n.l.Axis.Column,o=Array.from({length:i},()=>Array(r).fill(null)),s=this.entries(uD),c=s.next();for(;!c.done;){let{value:e,coords:t}=c.value;o[t.colIndex][t.rowIndex]=e,c=s.next()}let l=e.length,u=this.empty().resize(a?r:l,a?l:i,null).sparseBuilder(a?n.l.Axis.Column:n.l.Axis.Row);if(a)for(let t=0;t<l;t++){let n=o[e[t]];if(n)for(let e=0;e<r;e++){let r=n[e];r!=null&&u.pushAt(e,t,r)}}else for(let t=0;t<l;t++){let n=e[t];for(let e=0;e<i;e++){let r=o[e][n];r!=null&&u.pushAt(t,e,r)}}return u.build()}take(e,t=n.l.Axis.Row){let r=this.getRowCount(),i=this.getColumnCount();return e.length*i<i*r*.7?this._takeSparse(e,t):this._takeDense(e,t)}tile(e,t){if(e===1&&t===1)return this._self();if(e<=0||t<=0)throw Error(`Invalid tile dimensions: ${e} x ${t}`);let n=this._coords;if(!n)return this._self();let r=this._values,i=r.cloneEmpty(),a=this.getColumnCount(),o=this.getRowCount(),s=n.colStart,c=n.rowStart,l=0,u=0,d={rowIndex:0,colIndex:0};for(let f=0;f<e;f++){l=f*o;for(let e=0;e<t;e++)u=e*a,d.colIndex=s+u,d.rowIndex=c+l,r.copyTo(i,d,n)}return n={colStart:n.colStart,rowStart:n.rowStart,colEnd:n.colStart+t*a-1,rowEnd:n.rowStart+e*o-1},this._newRange(i,n,this._optionsIterator)}toScalar(){if(this.size!==1)throw Error(`Cannot convert to scalar, range size is ${this.size} not 1`);return this.getValueAt(0,0)}toType(e){let t=typeof e==`string`?{type:e}:e,n=this._optionsIterator;return n=n?{...n,...t}:t,this._newRange(this._values,this._coords,n)}transpose(){if(this.size<=1)return this._self();let e=this._values,t=this._coords,r=e.getAxis(),i=this._entries({axis:r===n.l.Axis.Column?n.l.Axis.Row:n.l.Axis.Column,bounds:t,reuseResult:!0}),a=r===n.l.Axis.Column,o=new ri.Builder,s=t.colStart,c=t.rowStart,l=i.next();for(;!l.done;){let e=l.value,t=e[0],n=t.colIndex-s,r=t.rowIndex-c,u=e[1];o.pushAt(a?r:n,a?n:r,u),l=i.next()}return this.empty()._cloneFromBuilder(o)}values(e){let t=this.entries(e);return{[Symbol.iterator](){return this},next(){let e=t.next();return e.done?ei:{done:!1,value:e.value.value}}}}zip(e,t,n){let r=e.map(e=>e.isIRange?e:this.fill(e)),i=this._createBuilder();for(let{coords:e,value:a}of this.entries(n)){let{rowIndex:n,colIndex:o}=e,s=[a];for(let e of r){let t=e.getValueAt(n,o);s.push(t)}i.pushAt(n,o,t(s,e,this))}return this._cloneFromBuilder(i)._untyped()}isLiteral(){return this._isLiteral}isDirectScalar(){return this._isDirectScalar}isScalar(){return this.size===1}isEmpty(){return this.size===0}isVector(){let e=this.getColumnCount(),t=this.getRowCount();return e!==0&&t!==0&&(e===1&&t!==1||t===1&&e!==1)}get size(){let e=this._coords;return e?(e.colEnd-e.colStart+1)*(e.rowEnd-e.rowStart+1):0}[Symbol.iterator](){let e=this.entries();return{next(){let t=e.next();return t.done?ei:{done:!1,value:t.value.value}},[Symbol.iterator](){return this}}}toString(){let e=this._coords;return e?`${e.rowEnd-e.rowStart+1}x${e.colEnd-e.colStart+1}:${this._toStringValues()}`:`0x0:{}`}get[Symbol.toStringTag](){return`[Range]`}_validateCoords(e){}_axisFromOptions(e){let t,n=this._optionsIterator;return e?(t=typeof e==`object`&&`axis`in e?e.axis:e,t?t===`fastest`?this._values.getAxis():t:n.axis):n.axis}_toStringValues(e=39){let t=`{`,r=this.entries({includeEmpty:!0,axis:n.l.Axis.Row,onError:`value`}),i=r.next(),a=0,o=i.value?.coords.rowIndex??0;for(;!i.done&&t.length<e;){let e=i.value;e.coords.rowIndex>o?(t+=`;`,o=e.coords.rowIndex):a>0&&(t+=`,`),a++;let n=e.value;n===null?n=``:typeof n==`string`?n=`"${n}"`:typeof n==`boolean`&&(n=n?`TRUE`:`FALSE`),t+=n,i=r.next()}return i.done?t+=`}`:t+=`...`,t}_entries(e){if(!this._coords)return ti;let t=this._values,r=this._optionsIterator,i=e?.axis===`fastest`?t.getAxis():e?.axis??r.axis,a=e?{...r,...e,axis:i}:r,o=t.entries(a),s=e?.type,c=null,l=e?.includeEmpty??!1,u=e?.errorOnInvalidCoercion??!1;if(l&&(o=new Ra(o,a),s&&(c=this._coerceValue(null,s,{...e,onError:`value`},n.n.Null))),s){let t=o,r=e.onError??`throw`,i=r===`ignore`,a=!1,d=!1,f=null;i||(r===`throw`?a=!0:r===`value`?d=!0:typeof r==`function`&&(f=r));let p,m=this._runtime,h=this,g=uE(m,s),_=e.coerce;_&&(typeof _==`function`?(g=_,p=uE(m,s,DE)):Array.isArray(_)&&(g=uE(m,s,_)));let v=this._isDirectScalar;o={[Symbol.iterator]:()=>o,next(){for(;;){let e=t.next();if(e.done)return ei;let r=e.value,o=r[1],_=null;if(o===void 0||o===null&&i)_=c;else if(s){let e=nE(o,!0);if(v&&!g&&e!==s&&(o=dE(m,o,e,s,!0),e=nE(o,!0)),e===s)_=o;else{if(g?(_=g(o,e,p,h),u&&_===null&&o!==null&&(_=n.a.BuiltIn.Value)):e===n.n.Error&&(_=o),n.a.isError(_))if(i)_=null;else{if(a)throw _;d||f&&f(o)}if(_===null){if(l)return{done:!1,value:[r[0],_]};continue}}}return _===o?e:{done:!1,value:[r[0],_]}}}}}return o}_absoluteCoords(t,n){let r=this._coords??e.l.EmptyRange,i=r.colStart,a=r.rowStart;aD.colStart=(t.colStart??0)+i,aD.rowStart=(t.rowStart??0)+a,aD.colEnd=(t.colEnd??r.colEnd-i)+i,aD.rowEnd=(t.rowEnd??r.rowEnd-a)+a;let o=e.l.intersectRanges(r,aD,n);return o&&this._validateCoords(o),o}_self(){return this._isLiteral?this.clone():this}_untyped(){let e=this._optionsIterator;if(!e?.type)return this;let{type:t,coerce:n,...r}=e;return this._newRange(this._values,this._coords,r,this._isLiteral)}_createBuilder(t){let r=this._coords??e.l.EmptyRange,i=this._values.getAxis(),a=t??i,o=a!==n.l.Axis.Row,s=o?r.colStart:r.rowStart,c=o?r.rowStart:r.colStart;return a===i?new ri.Builder(null,s,c):new ri.TransposedBuilder(null,s,c)}_applyBuilder(e,t,n=!1){if(!t)return e;let r=t.build();return r?(n&&(e=e.clone()),e.setValues(r.tuples),e):e}_cloneFromBuilder(e,t=null){let r=e?e.build():void 0;if(!r&&!t)return this._self();let i=this._values;i=i.clone();let a=i.getAxis()===n.l.Axis.Column;if(t){let e=t.done();for(let t of e)i.delete(t)}let o=this._coords;if(r){let e=Fa(r.bounds,a),t=o,n=t?t.colStart:0,s=t?t.rowStart:0,c=t?t.colEnd:0,l=t?t.rowEnd:0,u=e.colEnd,d=e.rowEnd;(u>c||d>l)&&lD(i,t,u,d),i.setValues(r.tuples),o={colStart:n,rowStart:s,colEnd:Math.max(u,c),rowEnd:Math.max(d,l)}}return this._newRange(i,o,this._optionsIterator,this._isLiteral)}_coerceValue(e,t,r,i){if(!t)return e;let a,o=this._runtime,s=uE(o,t),c=r?.coerce;c&&(typeof c==`function`?(s=c,a=uE(o,t,DE)):Array.isArray(c)&&(s=uE(o,t,c))),i??=nE(e,!0),this._isDirectScalar&&i!==t&&(e=dE(this._runtime,e,i,t,!0),i=nE(e,!0));let l=null;if(i===t)l=e;else if(s?l=s(e,i,a,this):i===n.n.Error&&(l=e),n.a.isError(l)){let e=r?.onError??`throw`;if(e===`throw`)throw l;e===`value`||(e===`ignore`?l=null:typeof e==`function`&&e(l))}return l}_mergeIterators(t,r,i){let a=this._coords??e.l.EmptyRange,o=t._coords??e.l.EmptyRange,s=this._values.getAxis(),c=i?.axis===`fastest`?s:i?.axis??s,l=c!==n.l.Axis.Row,u=this._entries(i),d=this._entries(i),f=a.colStart,p=a.rowStart,m=f-o.colStart,h=p-o.rowStart,g=c===s?new ri.Builder:new ri.TransposedBuilder,_=new Ba({...i,axis:c,bounds:a,comparator:(l?k_:A_)(a,o)},u,d),v=_.next();for(;!v.done;){let e=v.value,t=e[1],n=e[3],i=e[0],a=e[2],o=i?i.colIndex:a.colIndex+m,s=i?i.rowIndex:a.rowIndex+h,c=r(t,n,{colIndex:o-f,rowIndex:s-p},this),u=l?o:s,d=l?s:o;g.pushAt(u,d,c),v=_.next()}return g}_newRange(e,n,r=null,i=!1,a=!1){return new t(this._runtime,e,n,r,i,a)}get isIRange(){return!0}},rD=class extends nD{constructor(e,t,n,r){super(e,t,n),this._visibleCoords=r}getStats(e){return super.getStats(e).toLocalCoords(this._visibleCoords,e)}},iD={colStart:-(2**53-1),rowStart:-(2**53-1),colEnd:2**53-1,rowEnd:2**53-1},aD={colStart:-(2**53-1),rowStart:-(2**53-1),colEnd:2**53-1,rowEnd:2**53-1},oD=Object.freeze([Object.freeze([null])]),sD=Object.freeze({axis:n.l.Axis.Row}),cD=(e,t,r)=>{if(r===null)return void e.delete(t);let i=e.getAxis()===n.l.Axis.Column,a=Ha(r,Pa(t.colStart,t.rowStart,t.colEnd,t.rowEnd,i),i);e.setValues(a.tuples)},lD=(e,t,n,r,i=null)=>{if(!t)return iD.colStart=0,iD.rowStart=0,iD.colEnd=n,iD.rowEnd=r,void cD(e,iD,i);let a=t.colEnd,o=Math.max(n,a),s=t.rowEnd,c=Math.max(r,s);o>a&&(iD.colStart=a+1,iD.rowStart=t.rowStart,iD.colEnd=o,iD.rowEnd=c,cD(e,iD,i),o=a),c>s&&(iD.colStart=t.colStart,iD.rowStart=s+1,iD.colEnd=o,iD.rowEnd=c,cD(e,iD,i))},uD=Object.freeze({axis:`fastest`}),dD=64,fD=Object.freeze([n.n.Error]),pD=Object.freeze({axis:`fastest`,onError:`value`}),mD={colIndex:-(2**53-1),rowIndex:-(2**53-1)};function hD(e,t,n,r){let i=e==null,a=t==null;return i||a?i&&a?0:i?1:-1:qo.compare(e,t,r,r.collator)*n}function gD(e,t,n){if(typeof t!=`string`)return e+ug(t);let r=n.get(t);return r===void 0&&(r=ug(t),n.set(t,r)),e+r}var _D=class t extends nD{constructor(e,t,n,r,i,a){if(super(e,t,n,r??null),this._getEntireCoords=i??$T,this._resolveScope=a,this._coords=vD(n,this._getEntireCoords()),!n)throw Error(`ReferenceRange requires a coords`);this._validateCoords(n)}getCoords(){let e=this._coords;if(e.scope){let t=this._resolveScope(e.scope);if(t==null)throw new n.a.Ref;e={...e,scope:t}}return e}get isIReferenceRange(){return!0}toType(e){let n=typeof e==`string`?{type:e}:e;return new t(this._runtime,this._values,this._coords,n,this._getEntireCoords,this._resolveScope)}_validateCoords(t){let n=this._getEntireCoords?.();if(n&&(t.rowStart<n.rowStart&&t.rowStart!==-(2**53-1)||t.rowEnd>n.rowEnd&&t.rowEnd!==2**53-1||t.colStart<n.colStart&&t.colStart!==-(2**53-1)||t.colEnd>n.colEnd&&t.colEnd!==2**53-1))throw new e.C}get[Symbol.toStringTag](){return`[ReferenceRange]`}toString(){let e=this._coords,t=this._getEntireCoords();return e.scope&&(e={...e},e.scope=this._resolveScope(e.scope)??n.a.Label.Ref),`${Cl(e,t)}=>${super.toString()}`}},vD=(e,t)=>{let n=e.rowStart,r=e.rowEnd,i=e.colStart,a=e.colEnd,o=!1;return i===-(2**53-1)&&(i=t.colStart,o=!0),n===-(2**53-1)&&(n=t.rowStart,o=!0),r===2**53-1&&(r=t.rowEnd,o=!0),a===2**53-1&&(a=t.colEnd,o=!0),o?{rowStart:n,rowEnd:r,colStart:i,colEnd:a,scope:e.scope}:e};Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return Pv}}),Object.defineProperty(exports,"$t",{enumerable:!0,get:function(){return Pw}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return pp}}),Object.defineProperty(exports,"At",{enumerable:!0,get:function(){return pS}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return ly}}),Object.defineProperty(exports,"Bt",{enumerable:!0,get:function(){return qp}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"Ct",{enumerable:!0,get:function(){return ey}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return sp}}),Object.defineProperty(exports,"Dt",{enumerable:!0,get:function(){return Gp}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return cv}}),Object.defineProperty(exports,"Et",{enumerable:!0,get:function(){return $v}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return kl}}),Object.defineProperty(exports,"Ft",{enumerable:!0,get:function(){return qg}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return Ac}}),Object.defineProperty(exports,"Gt",{enumerable:!0,get:function(){return Ab}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return Ah}}),Object.defineProperty(exports,"Ht",{enumerable:!0,get:function(){return qf}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return ab}}),Object.defineProperty(exports,"It",{enumerable:!0,get:function(){return Qy}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return Ml}}),Object.defineProperty(exports,"Jt",{enumerable:!0,get:function(){return Vv}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return wf}}),Object.defineProperty(exports,"Kt",{enumerable:!0,get:function(){return ju}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return wp}}),Object.defineProperty(exports,"Lt",{enumerable:!0,get:function(){return Qv}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return ri}}),Object.defineProperty(exports,"Mt",{enumerable:!0,get:function(){return py}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return hT}}),Object.defineProperty(exports,"Nt",{enumerable:!0,get:function(){return zT}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return uS}}),Object.defineProperty(exports,"Ot",{enumerable:!0,get:function(){return NE}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return xb}}),Object.defineProperty(exports,"Pt",{enumerable:!0,get:function(){return qv}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return Nb}}),Object.defineProperty(exports,"Qt",{enumerable:!0,get:function(){return Gv}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return oy}}),Object.defineProperty(exports,"Rt",{enumerable:!0,get:function(){return Bv}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Cl}}),Object.defineProperty(exports,"St",{enumerable:!0,get:function(){return GE}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return Vo}}),Object.defineProperty(exports,"Tt",{enumerable:!0,get:function(){return Jf}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return kv}}),Object.defineProperty(exports,"Ut",{enumerable:!0,get:function(){return Zv}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return bT}}),Object.defineProperty(exports,"Vt",{enumerable:!0,get:function(){return Wv}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return jm}}),Object.defineProperty(exports,"Wt",{enumerable:!0,get:function(){return wT}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return Zg}}),Object.defineProperty(exports,"Xt",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"Yt",{enumerable:!0,get:function(){return Wb}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"Zt",{enumerable:!0,get:function(){return Jh}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return Dl}}),Object.defineProperty(exports,"_t",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Cb}}),Object.defineProperty(exports,"an",{enumerable:!0,get:function(){return cy}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return Mr}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Df}}),Object.defineProperty(exports,"bt",{enumerable:!0,get:function(){return Xv}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return eT}}),Object.defineProperty(exports,"cn",{enumerable:!0,get:function(){return JE}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return a_}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return sy}}),Object.defineProperty(exports,"dn",{enumerable:!0,get:function(){return Sb}}),Object.defineProperty(exports,"dt",{enumerable:!0,get:function(){return Uv}}),Object.defineProperty(exports,"en",{enumerable:!0,get:function(){return zv}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return kp}}),Object.defineProperty(exports,"fn",{enumerable:!0,get:function(){return Tv}}),Object.defineProperty(exports,"ft",{enumerable:!0,get:function(){return av}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Mc}}),Object.defineProperty(exports,"gt",{enumerable:!0,get:function(){return Kv}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"ht",{enumerable:!0,get:function(){return Yh}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return v_}}),Object.defineProperty(exports,"in",{enumerable:!0,get:function(){return ug}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return Fg}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"jt",{enumerable:!0,get:function(){return cp}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return _b}}),Object.defineProperty(exports,"kt",{enumerable:!0,get:function(){return Hv}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return ob}}),Object.defineProperty(exports,"ln",{enumerable:!0,get:function(){return ry}}),Object.defineProperty(exports,"lt",{enumerable:!0,get:function(){return H_}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return mp}}),Object.defineProperty(exports,"mt",{enumerable:!0,get:function(){return og}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Lv}}),Object.defineProperty(exports,"nn",{enumerable:!0,get:function(){return X_}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return Mb}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Dh}}),Object.defineProperty(exports,"on",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return ul}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return hd}}),Object.defineProperty(exports,"pt",{enumerable:!0,get:function(){return Fr}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return ei}}),Object.defineProperty(exports,"qt",{enumerable:!0,get:function(){return wS}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return ud}}),Object.defineProperty(exports,"rn",{enumerable:!0,get:function(){return ny}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return oo}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return yp}}),Object.defineProperty(exports,"sn",{enumerable:!0,get:function(){return Pr}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return ty}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"tn",{enumerable:!0,get:function(){return Jv}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return Ow}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return lg}}),Object.defineProperty(exports,"un",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"ut",{enumerable:!0,get:function(){return Sh}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"vt",{enumerable:!0,get:function(){return Yv}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return Zn}}),Object.defineProperty(exports,"wt",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return bb}}),Object.defineProperty(exports,"xt",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return jb}}),Object.defineProperty(exports,"yt",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return gl}}),Object.defineProperty(exports,"zt",{enumerable:!0,get:function(){return Vu}});
|