@sheetxl/mcp 0.8.0-beta.23 → 0.8.0-beta.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{qjyVXZeVSr_qZfX5.js → 45FAgD1JyG2a1Rti.js} +2 -2
- package/assets/{L9RIicOHtZd2Rx8g.js → 70weNsvW2LMx5QcW.js} +1 -1
- package/assets/{CndRpNCcV89ncnqz.js → APcHum0Riw3QhLBQ.js} +1 -1
- package/assets/{NDe-uS1n_Q7u1H3m.js → Abkx7KJ6_X5avkR4.js} +3 -3
- package/assets/{2xkoVdiI70Gpaxoc.js → B0FfnXdiZxExcdjB.js} +2 -2
- package/assets/{DV3PnM9lo0AW-YOA.js → B6e_DsVO4i91IYEO.js} +3 -3
- package/assets/{D-PYDPXobSWiPh1D.js → B940vbTfpMYACpDE.js} +2 -2
- package/assets/{BZaXHnsJ6RkCZsnz.js → BAowTO-7Utmg0UvM.js} +3 -3
- package/assets/{CCBQDcCHI47PZ0YQ.js → BBccc8pDH-6AJdoT.js} +5 -5
- package/assets/{CQCPJBQD0qv9y8qE.js → BD3Bc7ZHxenj4S7Q.js} +1 -1
- package/assets/{dep8oZGwBmUpxjHl.js → BFKj2ik7h-yM6oCR.js} +1 -1
- package/assets/{BcWSfKJ9Atkc0X_p.js → BHIi-cAKnh_sAifV.js} +1 -1
- package/assets/{CSisGJ4hiDhTi19U.js → BHeXL-Lo390ZSNV0.js} +1 -1
- package/assets/{a9lvcAd7rWsWSWAo.js → BNvsIyBwweYnfUz3.js} +1 -1
- package/assets/{t4qTfgdlstczTs2z.js → BSJ_L1gNOejEih6N.js} +40 -40
- package/assets/{CeVCLRwjkH3_OXJu.js → BV13tLgNXZ8MDaE_.js} +1 -1
- package/assets/{CHG4ZuzhyjGRuKBg.js → BW8ReYzx-CEJ-lAG.js} +1 -1
- package/assets/{DcO0gub7cRKVw4xB.js → BXxUz-sB48Z9nSFi.js} +1 -1
- package/assets/{DL7_uGw6KiZhlvR8.js → B_GZxEqqpKtEPbWC.js} +1 -1
- package/assets/{BPorbjbkH-VoV1M0.js → Bb7ZxgjHwiKgARXs.js} +1 -1
- package/assets/{BomatnedZsGMF7MW.js → BbfSzxx5EzAvn-_F.js} +1432 -1352
- package/assets/{CGLapmkNccH1g_ZJ.js → BktUuVP0Jew8_-ff.js} +1 -1
- package/assets/{BBuB6ffvyg2Cd7V5.js → Brlza6Jd2oGGX9vB.js} +1 -1
- package/assets/{DZt1ONN8CTTfmHGn.js → BtNEVWQWEp_Ie1nT.js} +642 -642
- package/assets/{jKIDENA_QP4bEX49.js → Bwk-CZuGiTRT2ox_.js} +4 -4
- package/assets/{CyhngJo16o7G18lq.js → BzLwCwXsh7eXQpeK.js} +1 -1
- package/assets/{CPZgEZ2jKoo7hS6g.js → BzU8BhgrkSoh-XJF.js} +8 -8
- package/assets/{DrKr8dXQEQ3Aukmt.js → C-FJab2sVwBbOTiA.js} +1 -1
- package/assets/{KhdF512BKcJXZMvq.js → C-Vt758qtn8QeCrw.js} +1 -1
- package/assets/{aTxgpOOxLenli4af.js → C2kYWrsx5mg4XOES.js} +1 -1
- package/assets/{2XwVsSfo5wF5K-HA.js → C6Vsz4e_ASJdx3LP.js} +1 -1
- package/assets/{DN1RRp4qQfCq3JAO.js → C9DvPNfuz_0hun6C.js} +1 -1
- package/assets/{PiFW6uPRJABzK3V1.js → CAI8p60cuWlgnlko.js} +14 -14
- package/assets/{BI8kb-rd9dW85XJs.js → CCOaNx5_BfWCc9yz.js} +1 -1
- package/assets/{B2zUUqxAJ1RiM7YI.js → CD2yoEhIT8DyXBou.js} +52 -52
- package/assets/{DPjWOMoJ-elAAOmS.js → CDiutOsLAzu4c0Ej.js} +1 -1
- package/assets/{DfBERTJjS9LP0RSp.js → CFrOPd_UcD7qclCq.js} +1 -1
- package/assets/{CH8DNTUgM79xk8Tt.js → CGS7apShLtnlmF8D.js} +1 -1
- package/assets/{CgYef9dYxY8YyUTE.js → CGdayif_qNMtoATI.js} +1 -1
- package/assets/{bsnhRuD-K-qhW-y5.js → CJubVukzHBNJb_Wf.js} +91 -91
- package/assets/{MzfM7zDcnyOFK1lK.js → COXWiXy3DCfmXSm5.js} +1 -1
- package/assets/{Bbmh8_bdk_HrQ5Y6.js → COZ-bhj463kGINFA.js} +1 -1
- package/assets/{BdUFL3lVdwifHrf0.js → CSMsn9bKgR9kWG0m.js} +1 -1
- package/assets/{WH1Vl-MDWX3vSMn1.js → CVWoX7wNwrZwm5XB.js} +2 -2
- package/assets/{DLuQ_rdu0XjYF7Jq.js → CX-KrjVgXM-7o--S.js} +2 -2
- package/assets/{BNEBXKAh-N4Tygk7.js → CYtkZMCX6dyEqjb9.js} +44 -44
- package/assets/{CE5DhB5As59VJ-Ig.js → Cb7FKT3S78r6IYHi.js} +1 -1
- package/assets/{Cidwv57sKqhIrpHP.js → CcTDxlAqw6HuYmmm.js} +42 -42
- package/assets/CehVpkp73IfWGN_b.js +14 -0
- package/assets/{f_dBJuakO_BJ7Tvm.js → CfWSdzSpbErVA_1h.js} +309 -309
- package/assets/{E-KM5RFByUxjlkId.js → Ci3R5B7bLke8NZRo.js} +6 -6
- package/assets/{DbbNJyL67KdOK7nc.js → ClRgSo0axU3lAOwR.js} +1 -1
- package/assets/{DJ2jlogB1DWlGM-J.js → Cmf4eJow6AIuPH_w.js} +1 -1
- package/assets/{CE-9VKh5-Xwxnxmu.js → Cplall3oc-_3AhCB.js} +1 -1
- package/assets/{BJMeWtr7TiLNpt17.js → Cu4ok_jTnQif8QtX.js} +1 -1
- package/assets/{D7oYfHgO0kEqAnPV.js → D053O1kZ7JtMwiqh.js} +1 -1
- package/assets/{BPtf3_nlovO4r9Bm.js → D5aWcMLJ2wyLm9Ws.js} +1 -1
- package/assets/{B3YRTBFhX61z6rJv.js → D6qQAWN_5p3FAshK.js} +375 -370
- package/assets/{DvkBNkPyR5kuS0Uo.js → D7NjohknztgMLqhT.js} +2 -2
- package/assets/{CBMMHYgUAhgiJhJE.js → D8cqT2lbcP5Yp1Or.js} +3 -3
- package/assets/{DACd4ZjYwzNE7Koc.js → D8wjcRGgRdU34Ata.js} +1 -1
- package/assets/{DtETpSxSR8C1voac.js → DAnTpFc2vx3CmP8e.js} +83 -83
- package/assets/{BWeaY19OpTJK5v0n.js → DB2MrmDLZ-OzVRQu.js} +2 -2
- package/assets/{ChbkkN_JqbAGrUwB.js → DBgHcEP-FcgSHLvx.js} +332 -332
- package/assets/{CnUYevzhUJYNqLad.js → DFd0JAiw5dkbnULM.js} +1 -1
- package/assets/{CC7EfXPwp7_nSBIz.js → DG9KGapq8eHlcTC7.js} +1 -1
- package/assets/{C6_KHS3-ROddeSbS.js → DHCl7HWDbT3xqx8W.js} +2 -2
- package/assets/{BDSNdgf_hbhX1DhN.js → DJlQxf99HCszeCCD.js} +1 -1
- package/assets/{DiJexWBIzdGj1H0H.js → DLW76uSURiQM07DD.js} +1 -1
- package/assets/{Cx1bc-Dsja7W3GlB.js → DQBqVPRLkZFb2P_x.js} +2 -2
- package/assets/{D60N4r1a2YsNEwqj.js → DQlLgxA592HvgKzh.js} +1 -1
- package/assets/{D5O3m16KeyU_oXqH.js → DRvzD5Tkcb2OU0G2.js} +1 -1
- package/assets/{5MnsnJcajdtAujE2.js → DUfrvQDZKh_22F91.js} +1 -1
- package/assets/{DL8wUEe2Kx7bjDYP.js → DX94YgmfoL_ngS60.js} +1 -1
- package/assets/{BazhmjGvrL7pqVQP.js → DXDhH3F4N4OOigqN.js} +1 -1
- package/assets/{CpyybSV2kR6b-SIB.js → DXVfJfT6ftWk5kYi.js} +497 -497
- package/assets/{DSyZaCML62gSnudE.js → DYx_I-o0yjx056Dq.js} +1 -1
- package/assets/{YtxPcFPURJF6CxWu.js → DZBfVpnngvY9Ra3C.js} +1 -1
- package/assets/{Dawi8y7JWn6A9gAx.js → DZOzgVEOXfHTE3YC.js} +1 -1
- package/assets/{PVGDjdR9C4stMNpM.js → DZTVTdrwu05fNZk_.js} +1 -1
- package/assets/{BYbzf-TVwbKQPCyK.js → DaB9iRVJj3TmKH92.js} +3 -3
- package/assets/{BLr8y5StL65VZQxG.js → DbHVXEt9qwlb8Gou.js} +154 -155
- package/assets/{wKkW4LO-iUp92LVC.js → DbXqd8hGNQEyS-s0.js} +1 -1
- package/assets/{BULbMlvQuB2WFBFE.js → DcHo7BC8Ny3hWq0j.js} +2 -2
- package/assets/{DAliB9N1z6qnw4NO.js → DcHvH_I64hbnNh9G.js} +1 -1
- package/assets/{DoP6myQHGI-X1gNy.js → DfaQvLAaU7HHPnSe.js} +89 -89
- package/assets/{BVUfaOAGhdMim8yB.js → DgE30NwKzEjZI1W6.js} +3 -3
- package/assets/{KMTTqSwDthnXnD4F.js → Djl7cjJyCIS_Qvbd.js} +1 -1
- package/assets/{CzoRlNMlpFz4iax3.js → DkS3EQvuEuPDvCws.js} +2 -2
- package/assets/{CrTLWpsRNBSyTLor.js → DkT0-_t9Xgp4l-Mh.js} +1 -1
- package/assets/{DuQU8JjPLBIK804w.js → DlOCT6DI5bhPtQ8j.js} +26 -26
- package/assets/{Bjk1Twm0RFO_3fS8.js → DpGFb3hbAT5Murcv.js} +1 -1
- package/assets/{D5PpcRuJYSv0i2y9.js → DunKnm-bQd0oHn9n.js} +2 -2
- package/assets/{Bz08KxFupjbdsoFx.js → Duw8QQGcrPmesb-M.js} +1 -1
- package/assets/{DUytcsu0MV3GnsrM.js → DvkgborRc2vRq8E-.js} +1 -1
- package/assets/{WuKVkvMPAOmRaCDY.js → DwmlBb640xWfAMV2.js} +2 -2
- package/assets/{CtlrxXVgZDIOcuc1.js → GfAXkT_vctdRX_9f.js} +162 -162
- package/assets/{Dg5QmWm0uBTEjZy4.js → H40qXR3Gazmnq4Mv.js} +1 -1
- package/assets/{DgLQfXTWavoBetna.js → HLtC2gb8SfNmJU5q.js} +5 -5
- package/assets/{1J1R3dclFOh322Yr.js → H_6CBe3t27jHlBHk.js} +182 -182
- package/assets/{Dol52NFQzLCbObuC.js → LQNEL4KjDxwZNwWq.js} +176 -176
- package/assets/{Cl8_HMhRgzPzqFc7.js → O8YGVK4vtz39jQ84.js} +1 -1
- package/assets/{gver5Sz7ZO6ZyrOi.js → TqxFLhPz3zbgi95t.js} +1 -1
- package/assets/{C8G_px4dGuR2KjJh.js → UdhH9UX9jQ4IV11J.js} +1 -1
- package/assets/{BEsnJS5jYwkHNcZd.js → V4pGXJr6fe-CPg7i.js} +1 -1
- package/assets/{DXmebUOAhtW4V6BO.js → V_VVW06vjWkmlbdh.js} +463 -463
- package/assets/{Cg1tSmK_AGJa2VeI.js → VkeNTI1TMsA1ZbGz.js} +3 -3
- package/assets/{BbU6aT_c6-4tkcCw.js → cTLYCAhDs2fR2ITC.js} +1 -1
- package/assets/{BynbAjhJnLjyP7HH.js → cU78RT4WJKAp5mU_.js} +1 -1
- package/assets/{Cl04_aSpBHTwfsQR.js → ckvxz2tZRlY1UPpg.js} +11464 -11420
- package/assets/{CwrOCbcS4IHLsERQ.js → eCD6fmcTsgv76IZm.js} +90 -90
- package/assets/{q1rCdlJA6Z7tA6om.js → irrAIfw6CnCOHmPE.js} +1 -1
- package/assets/{DIAQ_WlBCWhgHt-z.js → ixHQtoul8ubEJfWS.js} +12 -7
- package/assets/{CEsRqYMd5IjnAzzX.js → kmiMiNIUc6rS8DG8.js} +4 -4
- package/assets/{CqP4H_-kRRjcxO91.js → m9BgbF-NgPIYW4kc.js} +1 -1
- package/assets/{BlhJHu9ni2T9IaM1.js → s56uiNHMGbBV6xgZ.js} +1 -1
- package/assets/{BKpicdc9H5WnZPb-.js → u8xtjHo43n-S_O6j.js} +1 -1
- package/assets/{sIWsnPhnHm_MeeM9.js → u9le-qZ3tbYKK1kU.js} +2 -2
- package/assets/{BGxwDpW8DkO8W0Ig.js → xMi-tFxI2s6e18L1.js} +1 -1
- package/assets/{DKKLWACR9GsidnkS.js → xSUMX6J9-MJIGgmG.js} +2 -2
- package/index.js +191 -191
- package/lib.js +1 -1
- package/licenses/dependencies.txt +69 -69
- package/package.json +2 -2
- package/screenshot-page/assets/{DMbFr7oWja7Qpsm6.js → 0P0DnZolMnjPhiea.js} +2 -2
- package/screenshot-page/assets/3L7CY5dA_kT2UBjv.js +1 -0
- package/screenshot-page/assets/{FcTM4SB17cEX1M3X.js → 5Y11BWntgqmzo9dz.js} +1 -1
- package/screenshot-page/assets/{CXwbGzavyvYgDbWU.js → B0CDAMDdxSN4en9k.js} +1 -1
- package/screenshot-page/assets/B6UwT0pG4sQeG7fA.js +3 -0
- package/screenshot-page/assets/BCmGLxQEUabeee6Q.js +2 -0
- package/screenshot-page/assets/{Cengqc8q8BTmNfb_.js → BGIujWi3UayyIWlg.js} +1 -1
- package/screenshot-page/assets/BH2IWQ-8AfNbhYZJ.js +39 -0
- package/screenshot-page/assets/BNjmzbnQlBmX-HPQ.js +1 -0
- package/screenshot-page/assets/{DcrVJCyDwGKeil2U.js → BQTLEc84Eql61S2m.js} +1 -1
- package/screenshot-page/assets/{BjJ_nnNDZEPLpapa.js → BVnzv_sY_58zEJyM.js} +1 -1
- package/screenshot-page/assets/{Cx1kZ2u_8JFV2Q8D.js → BiRVjUOUI8Qv0CE1.js} +1 -1
- package/screenshot-page/assets/BkU12U7IqW7qjopk.js +13 -0
- package/screenshot-page/assets/{D4hvW_TF7vwc-Xlq.js → Bne-AygyF1USkPAy.js} +2 -2
- package/screenshot-page/assets/{Dkf51CnZh2zPEGMd.js → BpJaTpbR_CQzXj9M.js} +1 -1
- package/screenshot-page/assets/Bs-IXwX9BKsCxwcJ.js +2 -0
- package/screenshot-page/assets/{ONNSfQ8RDOqBDsvw.js → Bt7fKk5ZupUuo_xD.js} +2 -2
- package/screenshot-page/assets/{CGx-ZSMV9cPOzbu4.js → C-2hBFk27roWkIrQ.js} +2 -2
- package/screenshot-page/assets/C7MXfx6zf_uTwcpu.js +1 -0
- package/screenshot-page/assets/CALWodHqzUTIv9le.js +5 -0
- package/screenshot-page/assets/{Ce8b0lOBuWKlfLzJ.js → CCYEWK5QyGSnUAfh.js} +1 -1
- package/screenshot-page/assets/{CEL5lzj2NDYwJ-HC.js → CFS0h-wE9YlZRk_1.js} +1 -1
- package/screenshot-page/assets/CKdQfdZJGJFgnrr9.js +586 -0
- package/screenshot-page/assets/{DvRXbyteeo_8sy8T.js → CL_hAngRQwm_KGdR.js} +1 -1
- package/screenshot-page/assets/{BTKdl-XR9TlWaFe7.js → CMryHLEhCyKGuRSW.js} +6 -6
- package/screenshot-page/assets/COL9dj40ytErlGak.js +2 -0
- package/screenshot-page/assets/{BAxPBeFudRJ3OqIC.js → CRtk9ixuBWxhPfPU.js} +1 -1
- package/screenshot-page/assets/CUQsrLir5jYpnRPM.js +1 -0
- package/screenshot-page/assets/CUgX7ETRCJsvqa2x.js +1 -0
- package/screenshot-page/assets/{C7mXat-6esc1AmRD.js → CXeDqC02BZcixiHS.js} +2 -2
- package/screenshot-page/assets/{Cv0zGWEBpmC07Jps.js → CZaKvnrRdlLj1_X8.js} +1 -1
- package/screenshot-page/assets/CfD1bn6b-NM38iZV.js +1 -0
- package/screenshot-page/assets/{BJct69niPZc8L_gZ.js → Ck5onwb1w_19WrtG.js} +1 -1
- package/screenshot-page/assets/{DyxJBLjUkeDuu96F.js → CltB1nb5HHSmYrNG.js} +1 -1
- package/screenshot-page/assets/{D6Yv5cc1JE7DGd6j.js → CqBSIwwGzWl8mrBe.js} +1 -1
- package/screenshot-page/assets/CvBPH5c-gnUG8Jen.js +1 -0
- package/screenshot-page/assets/D-jd_TJCN7AAn125.js +48 -0
- package/screenshot-page/assets/{ChSvXfVMLxZsP9zG.js → D4RZZdlItfrgQHcE.js} +1 -1
- package/screenshot-page/assets/{B2PWru6Ty7ODc2Ie.js → D53hpXNHxIgSWl80.js} +1 -1
- package/screenshot-page/assets/{J73KTOmdZGNmnq-z.js → D72Rp__0TEqJ972a.js} +1 -1
- package/screenshot-page/assets/D8EmNst-H2v0eWcf.js +1 -0
- package/screenshot-page/assets/{Cbbl3H042tb0krfe.js → D98PlIA4qQ_6ciCu.js} +2 -2
- package/screenshot-page/assets/{Tj3B5At0OAN3tDza.js → DACqwpSwlZka3b7s.js} +1 -1
- package/screenshot-page/assets/{CI3Z1f4amZ9G2rPD.js → DJebrQ5mu8uxpX3b.js} +1 -1
- package/screenshot-page/assets/{DtQFcMvZesaQ4xRf.js → DTAKTGn53yF_B621.js} +1 -1
- package/screenshot-page/assets/{CaOsWPeN_FXseSNg.js → DYYzsN95gWMsxOaj.js} +1 -1
- package/screenshot-page/assets/{C5-sm7wuk62Nzm_p.js → Da_VIghRFdNrmfZT.js} +1 -1
- package/screenshot-page/assets/{Be1S5czBx0lxhYLW.js → DbnmgPTSEii4OGkB.js} +1 -1
- package/screenshot-page/assets/{0UZBKpOOsp7P-DkP.js → DdmX3djBOA6UCZtf.js} +2 -2
- package/screenshot-page/assets/{DEpn6VGd30cHEJOS.js → DfQS5zAy3pN31xNb.js} +1 -1
- package/screenshot-page/assets/{BT2nkqpteSR9booH.js → DkTX5ZjGNQ5SrwJa.js} +1 -1
- package/screenshot-page/assets/{Bml69dFBVggmVWda.js → DmIjTb4kKfUHxWaF.js} +9 -9
- package/screenshot-page/assets/DqOrgSpuJhQRhMoG.js +4 -0
- package/screenshot-page/assets/{JM0_BaBZ3yF6lnHC.js → Dz_yLNMXKWGx1O6V.js} +2 -2
- package/screenshot-page/assets/{B-8IMo2f1yGNXOyz.js → GxbRmvyoKhHl0ZYY.js} +13 -8
- package/screenshot-page/assets/{C-n8BDiksNjX6Orz.js → MqGbtsji4DVGCAMR.js} +1 -1
- package/screenshot-page/assets/{zvxBjll3jnL0-vNn.js → Np3jWxG724t5hLHZ.js} +2 -2
- package/screenshot-page/assets/eR9_DaySoB72PvMo.js +1 -0
- package/screenshot-page/assets/hB5riGkPy0wXVIig.js +1 -0
- package/screenshot-page/assets/hHvAGynpTvAb97GX.js +1 -0
- package/screenshot-page/assets/{CiFaOHqsDQTE4RRi.js → jKvAZg0Tp701aw1o.js} +2 -2
- package/screenshot-page/assets/{DACSL7FA_J91Z_H7.js → jteb4n23QwBT9m_4.js} +1 -1
- package/screenshot-page/assets/mzrDp0emvkWnkXBt.js +1 -0
- package/screenshot-page/assets/x1O923k1mN-CduO_.js +1 -0
- package/screenshot-page/index.html +15 -15
- package/types/scripting-api.json +5745 -5743
- package/types/scripting.d.ts +23 -4
- package/assets/DU2Dzzu0oY_eDN6i.js +0 -14
- package/screenshot-page/assets/37LAUhU1_yKtsBlH.js +0 -2
- package/screenshot-page/assets/B3c6NBI22E5SZWG-.js +0 -1
- package/screenshot-page/assets/B3yyoGGGl8ICyeoC.js +0 -39
- package/screenshot-page/assets/B56KxTxcAXDom0g4.js +0 -13
- package/screenshot-page/assets/BPMQ22uISGOm3ymr.js +0 -1
- package/screenshot-page/assets/Bh2DVAOWvWfylt77.js +0 -1
- package/screenshot-page/assets/BoiQQ-37KQn6NcLT.js +0 -1
- package/screenshot-page/assets/C9a-cNha8mBw5q-l.js +0 -1
- package/screenshot-page/assets/CAQ7QWes7j7Fq8o5.js +0 -2
- package/screenshot-page/assets/CaP_vH0sJFjNrSkW.js +0 -1
- package/screenshot-page/assets/CcVllJMjVF6SvVVq.js +0 -2
- package/screenshot-page/assets/CyfTQE0Z76Rp4Fbt.js +0 -586
- package/screenshot-page/assets/D2CxEHjkPQMAxzWl.js +0 -1
- package/screenshot-page/assets/D7Y0npF3FMsGUjgO.js +0 -1
- package/screenshot-page/assets/DEAD_MduPNVoT_T6.js +0 -5
- package/screenshot-page/assets/DMhOGCTy8V0N14gY.js +0 -1
- package/screenshot-page/assets/DVQnEWIisXaOXb_G.js +0 -4
- package/screenshot-page/assets/DXbOBAxx4_2rt5KM.js +0 -1
- package/screenshot-page/assets/DgLZb-StwCd9ftop.js +0 -1
- package/screenshot-page/assets/DrnzLCa7NIirMxno.js +0 -3
- package/screenshot-page/assets/EOw6vVvEfYNga9b4.js +0 -1
- package/screenshot-page/assets/_zzVe2R8R4vwuc5q.js +0 -48
- package/screenshot-page/assets/qFyplGXRu7IepHio.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{K as e,Kt as t,W as n}from"./CAQ7QWes7j7Fq8o5.js";import{i as r}from"./CQukCzhuewMuFOlO.js";import{A as i,Nt as a,dt as o,z as s}from"./B3yyoGGGl8ICyeoC.js";var c=[`customMenu`,`description`,`help`,`statusBar`,`shortcutKey`],l=[`function`,`vbProcedure`,`xlm`,`publishToServer`,`workbookParameter`],u=`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords`,d=class extends Error{},f=()=>{throw new d},p={t:`z`,v:0},m=/<([snbdemx])((?:\s+[^\s=/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*)\s*(\/?)>/g,h=(e,t,n)=>{try{return _(e,t,n)}catch(e){if(e instanceof d)return null;throw e}},g=e=>{let t=o(e,`cacheSource`);if(!t||i(t.attributes).get(`type`)!==`worksheet`)return;let n=o(e,`worksheetSource`,t.contentStart,t.end);if(!n)return;let r=i(n.attributes);if(r.has(`r:id`))return;let a={};for(let e of[`ref`,`sheet`,`name`]){let t=r.get(e);t!==void 0&&(a[e]=t)}return a},_=(e,t,n)=>{let r=e.xml??f(),a=ee(r,`pivotCacheDefinition`)??f(),c=i(a.attributes),l=c.get(`r:id`),u=e.parts?.find(e=>e.id===l&&e.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords`)?.xml??null;l!==void 0&&u===null&&f();let d=g(r)??f(),p=o(r,`cacheSource`)??f(),m=o(r,`worksheetSource`,p.contentStart,p.end)??f(),h=o(r,`cacheFields`)??f(),_=[],re=h.contentStart;for(;;){let e=o(r,`cacheField`,re,h.contentEnd);if(!e)break;_.push(ne(r,e,_.length,t,n)),re=e.end}let v=o(r,`calculatedItems`);v&&te(r,v,_);let ie=u===null?parseInt(c.get(`recordCount`)??`0`,10):y(u,_.filter(e=>e.records!==null),t),b=[],ae=[];for(let e=0;e<_.length;e++){let t=_[e];t.hasDate&&t.hasNumber?t.json.dateItems=t.dateItems:t.hasDate&&(t.json.dates=!0),t.items.length>0&&b.push([e,[[0,t.items]]]),t.records&&t.records.length>0&&ae.push([e,[[0,t.records]]])}let oe=v?r.substring(0,v.start)+r.substring(v.end):r,se=o(oe,`cacheFields`)??f(),x=oe.substring(0,se.start)+oe.substring(se.end),S=r.substring(m.start,m.start+m.attributes.length+16);x=x.replace(S,()=>`<worksheetSource`+s(m.attributes,[`ref`,`sheet`,`name`])),x=x.replace(a.tag,()=>`<pivotCacheDefinition`+s(a.attributes,[`r:id`,`recordCount`,`refreshOnLoad`]));let C={source:d,fields:_.map(e=>e.json),items:b,recordCount:ie,rest:x};u!==null&&(C.records=ae);let ce=c.get(`refreshOnLoad`);return ce!==`1`&&ce!==`true`||(C.refreshOnLoad=!0),C},ee=(e,t)=>{let n=RegExp(`<${t}((?:\\s+[^\\s=/>]+\\s*=\\s*(?:"[^"]*"|'[^']*'))*)`).exec(e);return n?{tag:n[0],attributes:n[1]}:null},te=(e,t,n)=>{let r=t.contentStart;for(;;){let a=o(e,`calculatedItem`,r,t.contentEnd);if(!a)break;r=a.end;let s=i(a.attributes).get(`formula`)??f(),c=[...e.substring(a.contentStart,a.contentEnd).matchAll(/<reference\s[^>]*?field="(\d+)"[^>]*>\s*<x(?:\s+v="(\d+)")?\s*\/>\s*<\/reference>/g)];c.length!==1&&f();let l=n[parseInt(c[0][1],10)]??f();(l.json.calculatedItems??=[]).push({item:c[0][2]?parseInt(c[0][2],10):0,formula:s})}},ne=(e,t,n,r,c)=>{let l=i(t.attributes),u={name:l.get(`name`)??f()},d=l.get(`numFmtId`),p=d===void 0?void 0:c(parseInt(d,10));p!==void 0&&(u.numberFormat=p);let h=l.get(`databaseField`)===`0`;h&&(u.noRecords=!0);let g=l.get(`formula`);g!==void 0&&(u.formula=g);let _=o(e,`fieldGroup`,t.contentStart,t.contentEnd);_&&(u.group=((e,t,n,r)=>{let s=i(t.attributes),c=e=>e===void 0?void 0:parseInt(e,10),l={base:c(s.get(`base`))??n,items:[]},u=c(s.get(`par`));u!==void 0&&(l.parent=u);let d=o(e,`groupItems`,t.contentStart,t.contentEnd);if(d){let t=e.substring(d.contentStart,d.contentEnd);m.lastIndex=0;let n,a=0,o={items:l.items,hasDate:!1,hasNumber:!1,dateItems:[]};for(;n=m.exec(t);)(n[3]!==`/`||t.substring(a,n.index).trim())&&f(),l.items.push(v(n[1],i(n[2]).get(`v`),o,r)),a=m.lastIndex;t.substring(a).trim()&&f(),o.hasDate&&(l.dateItems=o.dateItems)}let p=o(e,`rangePr`,t.contentStart,t.contentEnd);if(p){let e=i(p.attributes),t=e.get(`groupBy`)??`range`,n=t!==`range`,o=t=>{let i=e.get(`${t}${n?`Date`:`Num`}`)??f(),o=n?a(i,r):Number(i);return o!==null&&Number.isFinite(o)?o:f()},s={by:n?t:`numbers`,start:o(`start`),end:o(`end`)},c=e.get(`groupInterval`);c!==void 0&&(s.interval=Number(c)),e.get(`autoStart`)===`0`&&(s.fixedStart=!0),e.get(`autoEnd`)===`0`&&(s.fixedEnd=!0),l.range=s}let h=o(e,`discretePr`,t.contentStart,t.contentEnd);if(h){let t=e.substring(h.contentStart,h.contentEnd);l.discrete=Array.from(t.matchAll(/<x((?:\s+[^\s=/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*)\s*\/>/g),e=>c(i(e[1]).get(`v`))??0)}return l})(e,_,n,r));let ee=h?null:o(e,`sharedItems`,t.contentStart,t.contentEnd),te={json:u,items:[],byValue:null,records:h?null:[],hasDate:!1,hasNumber:!1,dateItems:[]},ne=[ee,_].filter(e=>!!e).sort((e,t)=>e.start-t.start),y=``,ie=t.contentStart;for(let t of ne)y+=e.substring(ie,t.start),ie=t.end;y+=e.substring(ie,t.contentEnd),ee&&re(e.substring(ee.contentStart,ee.contentEnd),te,r),h||te.items.length!==0||(u.inline=!0,te.byValue=new Map);let b=s(t.attributes,[`name`,`numFmtId`,`databaseField`,`formula`]);return(b.trim()||y.trim())&&(u.rest=y.trim()?`<cacheField${b}>${y}</cacheField>`:`<cacheField${b}/>`),te},re=(e,t,n)=>{m.lastIndex=0;let r,a=0;for(;r=m.exec(e);){e.substring(a,r.index).trim()&&f();let[,o,s,c]=r;c===`/`&&o!==`x`||f();let l=i(s);for(let e of l.keys())e!==`v`&&e!==`u`&&e!==`f`&&f();let u=l.get(`u`);u!==`1`&&u!==`true`||(t.json.unused??=[]).push(t.items.length),t.items.push(v(o,l.get(`v`),t,n)),a=m.lastIndex}e.substring(a).trim()&&f()},v=(e,t,n,i)=>{switch(e){case`m`:return p;case`s`:return t??f();case`n`:{let e=t===void 0?NaN:Number(t);return Number.isFinite(e)||f(),n.hasNumber=!0,e}case`d`:{let e=t===void 0?null:a(t,i);return e===null&&f(),n.hasDate=!0,n.dateItems.push(n.items.length),e}case`b`:return t===`1`||t===`true`;case`e`:{let e=t===void 0?void 0:r.getBuiltInByLabel(t);return e||f(),{t:`e`,v:e.getCode()}}default:return f()}},y=(e,t,n)=>{let r=o(e,`pivotCacheRecords`)??f(),i=e.substring(r.contentStart,r.contentEnd),a=/<r>([\s\S]*?)<\/r>|<r\/>/g,s,c=0,l=0;for(;s=a.exec(i);)i.substring(l,s.index).trim()&&f(),ie(s[1]??``,t,n),c++,l=a.lastIndex;return i.substring(l).trim()&&f(),c},ie=(e,t,n)=>{m.lastIndex=0;let r,a=0,o=0;for(;r=m.exec(e);){e.substring(o,r.index).trim()&&f();let[,s,c,l]=r;l!==`/`&&f();let u=t[a++]??f(),d=i(c);for(let e of d.keys())e!==`v`&&f();let p=d.get(`v`);if(s===`x`){let e=p===void 0?NaN:Number(p);(u.byValue||!Number.isInteger(e)||e<0||e>=u.items.length)&&f(),u.records.push(e)}else{let e=u.byValue??f(),t=s+(p??``),r=e.get(t);r===void 0&&(r=u.items.length,u.items.push(v(s,p,u,n)),e.set(t,r)),u.records.push(r)}o=m.lastIndex}(e.substring(o).trim()||a!==t.length)&&f()},b=/<!\[CDATA\[([\s\S]*?)\]\]>|<!--[\s\S]*?-->|<\?[\s\S]*?\?>|<!DOCTYPE[^>]*>|<(\/?)([^\s/>]+)((?:\s+[^\s=/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*)\s*(\/?)>|([^<]+)/g,ae={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`},oe=e=>e.indexOf(`&`)===-1?e:e.replace(/&(#x[0-9a-fA-F]+|#\d+|\w+);/g,(e,t)=>{if(t[0]!==`#`)return ae[t]??e;let n=t[1]===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)?String.fromCodePoint(n):e}),se=e=>{let t=e.indexOf(`:`);return t===-1?e:e.slice(t+1)},x=e=>{let t={name:``,qname:``,attrs:``,children:[],start:0,end:e.length,contentStart:0,contentEnd:e.length},n=[t];b.lastIndex=0;for(let t=b.exec(e);t;t=b.exec(e)){let e=n[n.length-1];if(t[1]!==void 0)e.children.push(t[1]);else if(t[6]!==void 0)e.children.push(oe(t[6]));else if(t[3]!==void 0){if(t[2]){if(n.length>1){let e=n.pop();e.contentEnd=t.index,e.end=t.index+t[0].length}continue}let r=t.index+t[0].length,i={name:se(t[3]),qname:t[3],attrs:t[4]??``,children:[],start:t.index,end:r,contentStart:r,contentEnd:r};e.children.push(i),t[5]||n.push(i)}}return t.children.find(e=>typeof e!=`string`)??null},S=e=>e.children.filter(e=>typeof e!=`string`),C=e=>{let t=``;for(let n of e.children)typeof n==`string`&&(t+=n);return t},ce=`http://schemas.openxmlformats.org/drawingml/2006/chart`,le=`http://purl.oclc.org/ooxml/drawingml/chart`,ue=`http://schemas.openxmlformats.org/drawingml/2006/main`,de=`http://purl.oclc.org/ooxml/drawingml/main`,fe=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,pe=`http://schemas.microsoft.com/office/drawing/2012/chart`,me=`http://schemas.microsoft.com/office/drawing/2014/chartex`,he=`http://www.w3.org/XML/1998/namespace`,w={c:`c`,a:`a`,r:`r`,c15:`c15`,cx:`cx`},ge=e=>e===ce||e===le,_e=e=>e===ue||e===de,ve=e=>e===me,ye=Object.freeze({xml:he}),be=/([^\s=]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,T=e=>{let t=[];be.lastIndex=0;for(let n=be.exec(e.attrs);n;n=be.exec(e.attrs))t.push([n[1],oe(n[2]??n[3]??``)]);return t},xe=(e,t)=>{let n=null;for(let[r,i]of T(e))r===`xmlns`?(n??={...t})[``]=i:r.startsWith(`xmlns:`)&&((n??={...t})[r.slice(6)]=i);return n??t},Se=(e,t)=>t[(e=>{let t=e.indexOf(`:`);return t===-1?``:e.slice(0,t)})(e.qname)],Ce=class{constructor(){this._parts=[]}open(e,t,n=!1){let r=`<`+e;if(t)for(let[e,n]of t)r+=` ${e}="${we(n)}"`;return this._parts.push(r+(n?`/>`:`>`)),this}close(e){return this._parts.push(`</${e}>`),this}val(e,t){return this.open(e,[[`val`,t]],!0)}text(e){return this._parts.push((e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`))(e)),this}raw(e){return this._parts.push(e),this}toString(){return this._parts.join(``)}},we=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/"/g,`"`),E=e=>e===`1`||e===`true`||e!==`0`&&e!==`false`&&null,D=e=>e?`1`:`0`,Te=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/,O=e=>{let t=E(e);return t===null?Te.test(e)?String(Number(e)):e:D(t)},Ee=new Set(`date1904.roundedCorners.autoTitleDeleted.plotVisOnly.showDLblsOverMax.varyColors.marker.smooth.invertIfNegative.bubble3D.delete.showLegendKey.showVal.showCatName.showSerName.showPercent.showBubbleSize.showLeaderLines.overlay.rAngAx.showHorzBorder.showVertBorder.showOutline.showKeys.auto.noMultiLvlLbl.wireframe.showNegBubbles.autoUpdate.applyToFront.applyToSides.applyToEnd.chartObject.data.formatting.selection.userInterface`.split(`.`)),De=(e,t,n=!1)=>{let r=xe(e,t),i=Se(e,r)??``,a=[];for(let[t,n]of T(e)){if(t===`xmlns`||t.startsWith(`xmlns:`))continue;let e=t.indexOf(`:`),i=e===-1?t:`{${r[t.slice(0,e)]??t.slice(0,e)}}${t.slice(e+1)}`;a.push(`${i}=${JSON.stringify(O(n))}`)}let o=S(e),s=o.length===0?e.children.join(``):``;a.length===0&&o.length===0&&s===``&&ge(i)&&Ee.has(e.name)&&a.push(`val="1"`),a.sort();let c=`<{${i}}${e.name}${a.length?` `+a.join(` `):``}>`;if(o.length>0){let t=[];for(let i of e.children)typeof i==`string`?i.trim()!==``&&t.push(JSON.stringify(i)):t.push(De(i,r,n));n&&t.sort(),c+=t.join(``)}else s!==``&&(c+=JSON.stringify(s));return c+`</>`},Oe=class{constructor(e,t){this.xml=e,this.rootScope=t,this.kept=0,this.reordered=0;let n=Object.values(t).find(ge)??ce,r=_e(t[w.a])?t[w.a]:ue;this.writeScope={...t,[w.c]:n,[w.cx]:me,[w.a]:r,[w.r]:t[w.r]??fe}}markupOf(e,t){let n=this.xml.slice(e.start,e.end),r=new Set(T(e).map(([e])=>e).filter(e=>e===`xmlns`||e.startsWith(`xmlns:`))),i=``;for(let e of Object.keys(t))e!==`xml`&&t[e]!==this.rootScope[e]&&(r.has(e===``?`xmlns`:`xmlns:${e}`)||(i+=e===``?` xmlns="${t[e]}"`:` xmlns:${e}="${t[e]}"`));if(i){let t=1+e.qname.length;n=n.slice(0,t)+i+n.slice(t)}return n}},ke=(e,t)=>{switch(e){case`c`:return ge(t);case`c15`:return t===pe;case`cx`:return ve(t);default:return _e(t)}},k=(e,t,n,r)=>{let i=xe(e,n),a={},o,s;for(let[n,r]of T(e)){let e=t.attributes?.find(e=>e.name===n),i=e?e.read(r):void 0;e&&i!==void 0&&O(e.write(i))===O(r)?a[e.key]=i:(o??={})[n]=r}let c=-1,l=``,u={};for(let n of S(e)){let e=xe(n,i),o=Se(n,e),d=t.fields.findIndex(e=>e.tags.includes(n.name)&&ke(e.ns,o)),f=d===-1?null:t.fields[d],p=f&&!f.many?f.get?f.get(a):a[f.key]:void 0,m=d>c||d===c&&!!f?.many;if(f&&p===void 0&&(m||!f.many)){let t=f.read(n,e,r);if(t!==void 0){f.many?(a[f.key]??=[]).push(t):f.set?f.set(a,t):a[f.key]=t,u[f.key]=(u[f.key]??0)+1,m?(c=d,l=n.name):r.reordered++;continue}}let h=c===-1?null:t.fields[c],g={after:l,xml:r.markupOf(n,i)};h?.many&&(g.at=u[h.key]),(s??=[]).push(g)}return(o||s)&&(a.unknown={},s&&(a.unknown.elements=s),o&&(a.unknown.attributes=o)),t.afterRead?.(a,e,i,r),a},A=(e,t,n,r)=>{let i=[];for(let e of r.attributes??[]){let t=n[e.key];t!==void 0&&i.push([e.name,e.write(t)])}let a=n.unknown;if(a?.attributes)for(let e of Object.keys(a.attributes))i.push([e,a.attributes[e]]);for(let e of r.declares?.(n)??[])i.some(([t])=>t===e[0])||i.push(e);let o=new Ce,s=a?.elements?[...a.elements]:[],c=e=>{for(let t=0;t<s.length;t++)e(s[t])&&(o.raw(s[t].xml),s.splice(t--,1))};c(e=>e.after===``);for(let e of r.fields){let t=e.get?e.get(n):n[e.key],r=t=>e.tags.includes(t.after);if(e.many){let n=t??[];for(let t=0;t<n.length;t++)e.write(o,n[t]),c(e=>r(e)&&e.at===t+1)}else t!==void 0&&e.write(o,t);c(r)}c(()=>!0);let l=o.toString();l===``?e.open(t,i,!0):e.open(t,i).raw(l).close(t)},j=(e,t)=>`${w[e]}:${t}`,M=(e,t,n=e,r=`c`)=>({tags:[e],key:n,ns:r,read:e=>{let n=(e=>{if(S(e).length>0)return;let t=null;for(let[n,r]of T(e)){if(n!==`val`)return;t=r}return t})(e);if(n===void 0)return;if(t===`bool`)return n===null||(E(n)??void 0);if(n===null)return;if(t===`str`)return n;let r=Number(n);return Number.isFinite(r)&&(t!==`int`||Number.isInteger(r))&&O(String(r))===O(n)?r:void 0},write:(n,i)=>{n.val(j(r,e),t===`bool`?D(i):String(i))}}),N=(e,t=e,n=`c`)=>({tags:[e],key:t,ns:n,read:e=>{if(!(S(e).length>0||T(e).some(([e])=>!e.startsWith(`xmlns`))))return C(e)},write:(t,r)=>{let i=j(n,e);r===``?t.open(i,null,!0):t.open(i).text(r).close(i)}}),P=(e,t,n=e,r)=>{let i=r?.ns??`c`,a=typeof t==`function`?t:()=>t;return{tags:[e],key:n,ns:i,many:r?.many,read:(e,t,n)=>k(e,a(),t,n),write:(t,n)=>A(t,j(i,e),n,a())}},F=(e,t,n=e,r=1)=>({name:e,key:n,read:e=>{if(t===`str`)return e;if(t===`bool`)return E(e)??void 0;let n=Number(e);return Number.isFinite(n)&&(t!==`int`||Number.isInteger(n))?r===1?n:n/r:void 0},write:e=>t===`bool`?D(e):t===`str`?e:String(r===1?e:Math.round(e*r))}),Ae=(e,t,n,r)=>({name:e,key:t,read:n,write:r}),je=e=>({...e,read:(t,n,r)=>{let i=e.read(t,n,r);if(i===void 0)return;let a=new Ce;e.write(a,i);let o=((e,t)=>{let n=x(e);return n?De(n,t):null})(a.toString(),r.writeScope)===De(t,n);return o||r.kept++,o?i:void 0}}),I=e=>`a:${e}`,Me=new Set([`bg1`,`tx1`,`bg2`,`tx2`,`accent1`,`accent2`,`accent3`,`accent4`,`accent5`,`accent6`,`hlink`,`folHlink`,`phClr`,`dk1`,`lt1`,`dk2`,`lt2`]),Ne=new Set(`scrollBar.background.activeCaption.inactiveCaption.menu.window.windowFrame.menuText.windowText.captionText.activeBorder.inactiveBorder.appWorkspace.highlight.highlightText.btnFace.btnShadow.grayText.btnText.inactiveCaptionText.btnHighlight.3dDkShadow.3dLight.infoText.infoBk.hotLight.gradientActiveCaption.gradientInactiveCaption.menuHighlight.menuBar`.split(`.`)),Pe=[`scrgbClr`,`srgbClr`,`hslClr`,`sysClr`,`schemeClr`,`prstClr`],Fe=e=>e===`hue`||e===`hueOff`||e===`hueMod`?6e4:e===`alpha`||e===`alphaOff`||e===`alphaMod`?1e5:1e3,L=(e,t)=>{let n={};for(let[r,i]of T(e)){if(!t.includes(r))return null;n[r]=i}return n},R=/^-?\d+$/,Ie=e=>{let t=S(e);return t.length===0?null:t.length>1||!Pe.includes(t[0].name)?void 0:(e=>{let t;switch(e.name){case`scrgbClr`:{let n=L(e,[`r`,`g`,`b`]);if(!(n&&R.test(n.r??``)&&R.test(n.g??``)&&R.test(n.b??``)))return;t=`lrgb(${Number(n.r)/1e3},${Number(n.g)/1e3},${Number(n.b)/1e3})`;break}case`hslClr`:{let n=L(e,[`hue`,`sat`,`lum`]);if(!(n&&R.test(n.hue??``)&&R.test(n.sat??``)&&R.test(n.lum??``)))return;t=`hsl(${Number(n.hue)/6e4},${Number(n.sat)/1e3},${Number(n.lum)/1e3})`;break}case`sysClr`:{let n=L(e,[`val`,`lastClr`]);if(!n?.val||!Ne.has(n.val))return;t=n.lastClr===void 0?n.val:`${n.val} lastClr ${n.lastClr}`;break}default:{let n=L(e,[`val`]);if(!n?.val||/\s/.test(n.val)||(Me.has(n.val)?`schemeClr`:/^[0-9A-Fa-f]{6}$/.test(n.val)?`srgbClr`:`prstClr`)!==e.name)return;t=n.val}}for(let n of S(e)){if(S(n).length>0)return;let e=L(n,[`val`]);if(!e)return;if(e.val!==void 0){if(!R.test(e.val))return;t+=` ${n.name} ${Number(e.val)/Fe(n.name)}`}else t+=` ${n.name}`}return t})(t[0])},Le=/^-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?$/i,Re=(e,n)=>{let r=(e=>{let t=e.trim(),n=/^[a-z]+\([^)]*\)|^[^\s,]+/i.exec(t)?.[0]??t,r=t.slice(n.length).split(/\s*,\s*|\s+/).filter(e=>e!==``);return[n.replace(/\s+/g,``),...r]})(n),i=r.shift(),a,o,s=/^(lrgb|hsl)\(([^,]+),([^,]+),([^)]+)\)$/.exec(i);if(s?.[1]===`lrgb`)a=`scrgbClr`,o=[[`r`,String(Math.round(1e3*Number(s[2])))],[`g`,String(Math.round(1e3*Number(s[3])))],[`b`,String(Math.round(1e3*Number(s[4])))]];else if(s?.[1]===`hsl`)a=`hslClr`,o=[[`hue`,String(Math.round(6e4*Number(s[2])))],[`sat`,String(Math.round(1e3*Number(s[3])))],[`lum`,String(Math.round(1e3*Number(s[4])))]];else if(r[0]===`lastClr`||Ne.has(i))a=`sysClr`,o=[[`val`,i]],r[0]===`lastClr`&&(r.shift(),o.push([`lastClr`,r.shift()]));else{let e=(e=>{if(Me.has(e)||/^[0-9A-Fa-f]{6}$/.test(e)||/^[a-z]+$/i.test(e))return null;let n;try{n=new t(e)}catch{return null}let r=n.getType();return r===`hex`||r===`rgb`||r===`hsl`?n.toHex().toString(!1).replace(`#`,``).toUpperCase():null})(i);a=e?`srgbClr`:Me.has(i)?`schemeClr`:/^[0-9A-Fa-f]{6}$/.test(i)?`srgbClr`:`prstClr`,o=[[`val`,e??i]]}if(r.length!==0){e.open(I(a),o);for(let t=0;t<r.length;t++){let n=r[t];t+1<r.length&&Le.test(r[t+1])?e.val(I(n),String(Math.round(Number(r[++t])*Fe(n)))):e.open(I(n),null,!0)}e.close(I(a))}else e.open(I(a),o,!0)},ze=(e,t,n,r)=>{n===void 0?e.open(I(t),r,!0):(e.open(I(t),r),Re(e,n),e.close(I(t)))},Be=[`noFill`,`solidFill`,`gradFill`,`pattFill`,`grpFill`],Ve=e=>{let t=L(e,[`l`,`t`,`r`,`b`]);if(!t)return;let n={};return t.l!==void 0&&(n.left=Number(t.l)/1e3),t.t!==void 0&&(n.top=Number(t.t)/1e3),t.r!==void 0&&(n.right=Number(t.r)/1e3),t.b!==void 0&&(n.bottom=Number(t.b)/1e3),n},He=(e,t,n)=>{let r=[];n.left!==void 0&&r.push([`l`,String(Math.round(1e3*n.left))]),n.top!==void 0&&r.push([`t`,String(Math.round(1e3*n.top))]),n.right!==void 0&&r.push([`r`,String(Math.round(1e3*n.right))]),n.bottom!==void 0&&r.push([`b`,String(Math.round(1e3*n.bottom))]),e.open(I(t),r,!0)},Ue=t=>{switch(t.name){case`noFill`:return S(t).length===0&&T(t).length===0?{type:e.Type.None}:void 0;case`grpFill`:return S(t).length===0&&T(t).length===0?{type:e.Type.Group}:void 0;case`solidFill`:{if(T(t).length>0)return;let n=Ie(t);return n===void 0?void 0:n===null?{type:e.Type.Solid}:{type:e.Type.Solid,color:n}}case`gradFill`:return(t=>{let n=L(t,[`rotWithShape`,`flip`]);if(!n)return;let r={type:e.Type.Gradient};if(n.rotWithShape!==void 0){let e=E(n.rotWithShape);if(e===null)return;r.isRotatedWithShape=e}n.flip!==void 0&&(r.flip=n.flip);for(let n of S(t))if(n.name===`gsLst`){let e=[];for(let t of S(n)){let n=t.name===`gs`?L(t,[`pos`]):null,r=n&&R.test(n.pos??``)?Ie(t):void 0;if(!r)return;e.push({offset:Number(n.pos)/1e5,color:r})}r.stops=e}else if(n.name===`lin`){let t=L(n,[`ang`,`scaled`]);if(!t||S(n).length>0)return;if(r.gradientType=e.GradientType.Linear,t.ang!==void 0){if(!R.test(t.ang))return;r.angle=(Number(t.ang)/6e4+90)%360}if(t.scaled!==void 0){let e=E(t.scaled);if(e===null)return;r.scaled=e}}else if(n.name===`path`){let t=L(n,[`path`]);if(!t)return;r.gradientType=t.path===`circle`?e.GradientType.Path:t.path;let i=S(n);if(i.length>1||i.length===1&&i[0].name!==`fillToRect`)return;if(i.length===1){let e=Ve(i[0]);if(!e)return;r.focus={left:(e.left??0)/100,top:(e.top??0)/100,right:1-(e.right??0)/100,bottom:1-(e.bottom??0)/100}}}else{if(n.name!==`tileRect`)return;{let e=Ve(n);if(!e)return;r.tileRect=e}}return r})(t);case`pattFill`:{let n=L(t,[`prst`]);if(!n)return;let r={type:e.Type.Pattern};n.prst!==void 0&&(r.patternType=n.prst);for(let e of S(t)){let t=e.name===`fgClr`||e.name===`bgClr`?Ie(e):void 0;if(!t)return;e.name===`fgClr`?r.foreground=t:r.background=t}return r}}},We=(t,n)=>{switch(n.type){case e.Type.None:t.open(I(`noFill`),null,!0);return;case e.Type.Group:t.open(I(`grpFill`),null,!0);return;case e.Type.Solid:ze(t,`solidFill`,n.color);return;case e.Type.Gradient:((t,n)=>{let r=[];if(n.flip!==void 0&&r.push([`flip`,n.flip]),n.isRotatedWithShape!==void 0&&r.push([`rotWithShape`,D(n.isRotatedWithShape)]),t.open(I(`gradFill`),r),n.stops){t.open(I(`gsLst`));for(let e of n.stops){let{offset:n,color:r}=typeof e==`string`?{offset:0,color:e}:e;ze(t,`gs`,r,[[`pos`,String(Math.round(1e5*(n??0)))]])}t.close(I(`gsLst`))}if(n.gradientType===e.GradientType.Linear){let e=[];n.angle!==void 0&&e.push([`ang`,String(Math.round((n.angle-90+360)%360*6e4))]),n.scaled!==void 0&&e.push([`scaled`,D(n.scaled)]),t.open(I(`lin`),e,!0)}else if(n.gradientType!==void 0){let r=n.gradientType===e.GradientType.Path?`circle`:n.gradientType;n.focus?(t.open(I(`path`),[[`path`,r]]),He(t,`fillToRect`,{left:100*n.focus.left,top:100*n.focus.top,right:100*(1-n.focus.right),bottom:100*(1-n.focus.bottom)}),t.close(I(`path`))):t.open(I(`path`),[[`path`,r]],!0)}n.tileRect&&He(t,`tileRect`,n.tileRect),t.close(I(`gradFill`))})(t,n);return;case e.Type.Pattern:{let e=n,r=e.patternType===void 0?[]:[[`prst`,e.patternType]];e.foreground===void 0&&e.background===void 0?t.open(I(`pattFill`),r,!0):(t.open(I(`pattFill`),r),e.foreground!==void 0&&ze(t,`fgClr`,e.foreground),e.background!==void 0&&ze(t,`bgClr`,e.background),t.close(I(`pattFill`)));return}}throw Error(`A chart cannot write a fill of type '${n.type}'.`)},Ge=e=>je({tags:Be,key:e,ns:`a`,read:e=>Ue(e),write:(e,t)=>We(e,t)}),Ke={tags:[`effectLst`],key:`effects`,ns:`a`,read:e=>S(e).length===0&&T(e).length===0?[]:void 0,write:(e,t)=>{if(t.length>0)throw Error(`A chart cannot write effects yet.`);e.open(I(`effectLst`),null,!0)}},qe={rnd:`round`,flat:`butt`,sq:`square`},Je=(e,t)=>({tags:[e],key:`${t}Type`,ns:`a`,read:e=>{let t=L(e,[`type`,`w`,`len`]);if(t&&!(S(e).length>0)&&Object.keys(t).length!==0)return t},write:(t,n)=>{let r=[];for(let e of[`type`,`w`,`len`])n[e]!==void 0&&r.push([e,n[e]]);t.open(I(e),r,!0)},get:e=>{let n={};return e[`${t}Type`]!==void 0&&(n.type=e[`${t}Type`]),e[`${t}Width`]!==void 0&&(n.w=e[`${t}Width`]),e[`${t}Length`]!==void 0&&(n.len=e[`${t}Length`]),Object.keys(n).length>0?n:void 0},set:(e,n)=>{n.type!==void 0&&(e[`${t}Type`]=n.type),n.w!==void 0&&(e[`${t}Width`]=n.w),n.len!==void 0&&(e[`${t}Length`]=n.len)}}),Ye={attributes:[F(`w`,`int`,`width`,12700),Ae(`cap`,`lineCap`,e=>qe[e],e=>Object.keys(qe).find(t=>qe[t]===e)),F(`cmpd`,`str`,`compound`),F(`algn`,`str`,`align`)],fields:[Ge(`fill`),{tags:[`prstDash`,`custDash`],key:`dash`,ns:`a`,read:e=>{if(e.name===`prstDash`){let t=L(e,[`val`]);return t?.val!==void 0&&S(e).length===0?t.val:void 0}if(T(e).length>0)return;let t=[];for(let n of S(e)){let e=n.name===`ds`?L(n,[`d`,`sp`]):null;if(!e||!R.test(e.d??``)||!R.test(e.sp??``))return;t.push(Number(e.d)/1e3,Number(e.sp)/1e3)}return t},write:(e,t)=>{if(typeof t!=`string`){e.open(I(`custDash`));for(let n=0;n<t.length;n+=2)e.open(I(`ds`),[[`d`,String(Math.round(1e3*t[n]))],[`sp`,String(Math.round(1e3*t[n+1]))]],!0);e.close(I(`custDash`))}else e.val(I(`prstDash`),t)}},{tags:[`round`,`bevel`,`miter`],key:`lineJoin`,ns:`a`,read:e=>{let t=L(e,e.name===`miter`?[`lim`]:[]);if(t&&!(S(e).length>0)&&(t.lim===void 0||R.test(t.lim)))return{join:e.name,limit:t.lim===void 0?void 0:Number(t.lim)/1e5}},write:(e,t)=>{e.open(I(t.join),t.limit===void 0?null:[[`lim`,String(Math.round(1e5*t.limit))]],!0)},get:e=>e.lineJoin?{join:e.lineJoin,limit:e.miterLimit}:void 0,set:(e,t)=>{e.lineJoin=t.join,t.limit!==void 0&&(e.miterLimit=t.limit)}},Je(`headEnd`,`head`),Je(`tailEnd`,`tail`)]},Xe=e=>je(P(`ln`,Ye,e,{ns:`a`})),Ze={fields:[Ge(`fill`),Xe(`stroke`),Ke]},Qe=(e,t,r)=>({tags:[e],key:t,ns:`a`,read:e=>{let t=L(e,[`typeface`]);if(!(t?.typeface===void 0||S(e).length>0))return r&&t.typeface===`+mn-${r}`?n.ThemeFamily.Body:r&&t.typeface===`+mj-${r}`?n.ThemeFamily.Heading:t.typeface},write:(t,i)=>{let a=r?i===n.ThemeFamily.Body?`+mn-${r}`:i===n.ThemeFamily.Heading?`+mj-${r}`:i:i;t.open(I(e),[[`typeface`,a]],!0)}}),$e=(e,t,n)=>{let r=Object.fromEntries(Object.entries(n).map(([e,t])=>[t,e]));return Ae(e,t,e=>r[e],e=>n[e]??e)},et={attributes:[F(`lang`,`str`,`language`),F(`altLang`,`str`,`alternateLanguage`),F(`sz`,`int`,`size`,100),Ae(`b`,`weight`,e=>{let t=E(e);return t===null?void 0:t?700:400},e=>D(e>=600)),Ae(`i`,`style`,e=>{let t=E(e);return t===null?void 0:t?`italic`:`normal`},e=>D(e===`italic`)),$e(`u`,`underline`,{none:`none`,words:`words`,single:`sng`,double:`dbl`,heavy:`heavy`,dotted:`dotted`,dottedHeavy:`dottedHeavy`,dash:`dash`,dashHeavy:`dashHeavy`,dashLong:`dashLong`,dashLongHeavy:`dashLongHeavy`,dotDash:`dotDash`,dotDashHeavy:`dotDashHeavy`,dotDotDash:`dotDotDash`,dotDotDashHeavy:`dotDotDashHeavy`,wavy:`wavy`,wavyHeavy:`wavyHeavy`,wavyDouble:`wavyDbl`}),$e(`strike`,`strike`,{none:`noStrike`,single:`sngStrike`,double:`dblStrike`}),F(`kern`,`int`,`kerning`,100),$e(`cap`,`capitals`,{none:`none`,small:`small`,all:`all`}),F(`spc`,`int`,`letterSpacing`,100),F(`normalizeH`,`bool`,`normalizeHeight`),F(`baseline`,`int`,`baseline`,1e3)],fields:[Xe(`outline`),Ge(`color`),Ke,Qe(`latin`,`latin`,`lt`),Qe(`ea`,`eastAsian`,`ea`),Qe(`cs`,`complexScript`,`cs`),Qe(`sym`,`symbol`)]},tt={attributes:[F(`algn`,`str`,`align`),F(`rtl`,`bool`,`rtl`)],fields:[P(`defRPr`,et,`defaultRun`,{ns:`a`})]},nt={fields:[P(`rPr`,et,`rPr`,{ns:`a`}),{tags:[`t`],key:`text`,ns:`a`,read:e=>{if(S(e).length>0)return;let t=!1;for(let[n,r]of T(e))if(n!==`xmlns`&&!n.startsWith(`xmlns:`)){if(n!==`xml:space`||r!==`preserve`)return;t=!0}return{text:C(e),preserve:t}},get:e=>e.text===void 0?void 0:{text:e.text,preserve:!0===e.preserveSpace},set:(e,t)=>{e.text=t.text,t.preserve&&(e.preserveSpace=!0)},write:(e,t)=>{let n=I(`t`),r=t.preserve?[[`xml:space`,`preserve`]]:null;t.text===``?e.open(n,r,!0):e.open(n,r).text(t.text).close(n)}}]},rt={attributes:[F(`id`,`str`,`id`),F(`type`,`str`,`type`)],fields:nt.fields},it={fields:[P(`rPr`,et,`rPr`,{ns:`a`})]},at={fields:[P(`pPr`,tt,`pPr`,{ns:`a`}),{tags:[`r`,`br`,`fld`],key:`runs`,ns:`a`,many:!0,read:(e,t,n)=>{if(e.name===`br`)return{...k(e,it,t,n),text:`
|
|
1
|
+
import{Q as e,Y as t,bt as n}from"./COL9dj40ytErlGak.js";import{i as r}from"./CQukCzhuewMuFOlO.js";import{A as i,Nt as a,dt as o,z as s}from"./BH2IWQ-8AfNbhYZJ.js";var c=[`customMenu`,`description`,`help`,`statusBar`,`shortcutKey`],l=[`function`,`vbProcedure`,`xlm`,`publishToServer`,`workbookParameter`],u=`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords`,d=class extends Error{},f=()=>{throw new d},p={t:`z`,v:0},m=/<([snbdemx])((?:\s+[^\s=/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*)\s*(\/?)>/g,h=(e,t,n)=>{try{return _(e,t,n)}catch(e){if(e instanceof d)return null;throw e}},g=e=>{let t=o(e,`cacheSource`);if(!t||i(t.attributes).get(`type`)!==`worksheet`)return;let n=o(e,`worksheetSource`,t.contentStart,t.end);if(!n)return;let r=i(n.attributes);if(r.has(`r:id`))return;let a={};for(let e of[`ref`,`sheet`,`name`]){let t=r.get(e);t!==void 0&&(a[e]=t)}return a},_=(e,t,n)=>{let r=e.xml??f(),a=ee(r,`pivotCacheDefinition`)??f(),c=i(a.attributes),l=c.get(`r:id`),u=e.parts?.find(e=>e.id===l&&e.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords`)?.xml??null;l!==void 0&&u===null&&f();let d=g(r)??f(),p=o(r,`cacheSource`)??f(),m=o(r,`worksheetSource`,p.contentStart,p.end)??f(),h=o(r,`cacheFields`)??f(),_=[],re=h.contentStart;for(;;){let e=o(r,`cacheField`,re,h.contentEnd);if(!e)break;_.push(ne(r,e,_.length,t,n)),re=e.end}let v=o(r,`calculatedItems`);v&&te(r,v,_);let ie=u===null?parseInt(c.get(`recordCount`)??`0`,10):y(u,_.filter(e=>e.records!==null),t),b=[],ae=[];for(let e=0;e<_.length;e++){let t=_[e];t.hasDate&&t.hasNumber?t.json.dateItems=t.dateItems:t.hasDate&&(t.json.dates=!0),t.items.length>0&&b.push([e,[[0,t.items]]]),t.records&&t.records.length>0&&ae.push([e,[[0,t.records]]])}let oe=v?r.substring(0,v.start)+r.substring(v.end):r,se=o(oe,`cacheFields`)??f(),x=oe.substring(0,se.start)+oe.substring(se.end),S=r.substring(m.start,m.start+m.attributes.length+16);x=x.replace(S,()=>`<worksheetSource`+s(m.attributes,[`ref`,`sheet`,`name`])),x=x.replace(a.tag,()=>`<pivotCacheDefinition`+s(a.attributes,[`r:id`,`recordCount`,`refreshOnLoad`]));let C={source:d,fields:_.map(e=>e.json),items:b,recordCount:ie,rest:x};u!==null&&(C.records=ae);let ce=c.get(`refreshOnLoad`);return ce!==`1`&&ce!==`true`||(C.refreshOnLoad=!0),C},ee=(e,t)=>{let n=RegExp(`<${t}((?:\\s+[^\\s=/>]+\\s*=\\s*(?:"[^"]*"|'[^']*'))*)`).exec(e);return n?{tag:n[0],attributes:n[1]}:null},te=(e,t,n)=>{let r=t.contentStart;for(;;){let a=o(e,`calculatedItem`,r,t.contentEnd);if(!a)break;r=a.end;let s=i(a.attributes).get(`formula`)??f(),c=[...e.substring(a.contentStart,a.contentEnd).matchAll(/<reference\s[^>]*?field="(\d+)"[^>]*>\s*<x(?:\s+v="(\d+)")?\s*\/>\s*<\/reference>/g)];c.length!==1&&f();let l=n[parseInt(c[0][1],10)]??f();(l.json.calculatedItems??=[]).push({item:c[0][2]?parseInt(c[0][2],10):0,formula:s})}},ne=(e,t,n,r,c)=>{let l=i(t.attributes),u={name:l.get(`name`)??f()},d=l.get(`numFmtId`),p=d===void 0?void 0:c(parseInt(d,10));p!==void 0&&(u.numberFormat=p);let h=l.get(`databaseField`)===`0`;h&&(u.noRecords=!0);let g=l.get(`formula`);g!==void 0&&(u.formula=g);let _=o(e,`fieldGroup`,t.contentStart,t.contentEnd);_&&(u.group=((e,t,n,r)=>{let s=i(t.attributes),c=e=>e===void 0?void 0:parseInt(e,10),l={base:c(s.get(`base`))??n,items:[]},u=c(s.get(`par`));u!==void 0&&(l.parent=u);let d=o(e,`groupItems`,t.contentStart,t.contentEnd);if(d){let t=e.substring(d.contentStart,d.contentEnd);m.lastIndex=0;let n,a=0,o={items:l.items,hasDate:!1,hasNumber:!1,dateItems:[]};for(;n=m.exec(t);)(n[3]!==`/`||t.substring(a,n.index).trim())&&f(),l.items.push(v(n[1],i(n[2]).get(`v`),o,r)),a=m.lastIndex;t.substring(a).trim()&&f(),o.hasDate&&(l.dateItems=o.dateItems)}let p=o(e,`rangePr`,t.contentStart,t.contentEnd);if(p){let e=i(p.attributes),t=e.get(`groupBy`)??`range`,n=t!==`range`,o=t=>{let i=e.get(`${t}${n?`Date`:`Num`}`)??f(),o=n?a(i,r):Number(i);return o!==null&&Number.isFinite(o)?o:f()},s={by:n?t:`numbers`,start:o(`start`),end:o(`end`)},c=e.get(`groupInterval`);c!==void 0&&(s.interval=Number(c)),e.get(`autoStart`)===`0`&&(s.fixedStart=!0),e.get(`autoEnd`)===`0`&&(s.fixedEnd=!0),l.range=s}let h=o(e,`discretePr`,t.contentStart,t.contentEnd);if(h){let t=e.substring(h.contentStart,h.contentEnd);l.discrete=Array.from(t.matchAll(/<x((?:\s+[^\s=/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*)\s*\/>/g),e=>c(i(e[1]).get(`v`))??0)}return l})(e,_,n,r));let ee=h?null:o(e,`sharedItems`,t.contentStart,t.contentEnd),te={json:u,items:[],byValue:null,records:h?null:[],hasDate:!1,hasNumber:!1,dateItems:[]},ne=[ee,_].filter(e=>!!e).sort((e,t)=>e.start-t.start),y=``,ie=t.contentStart;for(let t of ne)y+=e.substring(ie,t.start),ie=t.end;y+=e.substring(ie,t.contentEnd),ee&&re(e.substring(ee.contentStart,ee.contentEnd),te,r),h||te.items.length!==0||(u.inline=!0,te.byValue=new Map);let b=s(t.attributes,[`name`,`numFmtId`,`databaseField`,`formula`]);return(b.trim()||y.trim())&&(u.rest=y.trim()?`<cacheField${b}>${y}</cacheField>`:`<cacheField${b}/>`),te},re=(e,t,n)=>{m.lastIndex=0;let r,a=0;for(;r=m.exec(e);){e.substring(a,r.index).trim()&&f();let[,o,s,c]=r;c===`/`&&o!==`x`||f();let l=i(s);for(let e of l.keys())e!==`v`&&e!==`u`&&e!==`f`&&f();let u=l.get(`u`);u!==`1`&&u!==`true`||(t.json.unused??=[]).push(t.items.length),t.items.push(v(o,l.get(`v`),t,n)),a=m.lastIndex}e.substring(a).trim()&&f()},v=(e,t,n,i)=>{switch(e){case`m`:return p;case`s`:return t??f();case`n`:{let e=t===void 0?NaN:Number(t);return Number.isFinite(e)||f(),n.hasNumber=!0,e}case`d`:{let e=t===void 0?null:a(t,i);return e===null&&f(),n.hasDate=!0,n.dateItems.push(n.items.length),e}case`b`:return t===`1`||t===`true`;case`e`:{let e=t===void 0?void 0:r.getBuiltInByLabel(t);return e||f(),{t:`e`,v:e.getCode()}}default:return f()}},y=(e,t,n)=>{let r=o(e,`pivotCacheRecords`)??f(),i=e.substring(r.contentStart,r.contentEnd),a=/<r>([\s\S]*?)<\/r>|<r\/>/g,s,c=0,l=0;for(;s=a.exec(i);)i.substring(l,s.index).trim()&&f(),ie(s[1]??``,t,n),c++,l=a.lastIndex;return i.substring(l).trim()&&f(),c},ie=(e,t,n)=>{m.lastIndex=0;let r,a=0,o=0;for(;r=m.exec(e);){e.substring(o,r.index).trim()&&f();let[,s,c,l]=r;l!==`/`&&f();let u=t[a++]??f(),d=i(c);for(let e of d.keys())e!==`v`&&f();let p=d.get(`v`);if(s===`x`){let e=p===void 0?NaN:Number(p);(u.byValue||!Number.isInteger(e)||e<0||e>=u.items.length)&&f(),u.records.push(e)}else{let e=u.byValue??f(),t=s+(p??``),r=e.get(t);r===void 0&&(r=u.items.length,u.items.push(v(s,p,u,n)),e.set(t,r)),u.records.push(r)}o=m.lastIndex}(e.substring(o).trim()||a!==t.length)&&f()},b=/<!\[CDATA\[([\s\S]*?)\]\]>|<!--[\s\S]*?-->|<\?[\s\S]*?\?>|<!DOCTYPE[^>]*>|<(\/?)([^\s/>]+)((?:\s+[^\s=/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*)\s*(\/?)>|([^<]+)/g,ae={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`},oe=e=>e.indexOf(`&`)===-1?e:e.replace(/&(#x[0-9a-fA-F]+|#\d+|\w+);/g,(e,t)=>{if(t[0]!==`#`)return ae[t]??e;let n=t[1]===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isFinite(n)?String.fromCodePoint(n):e}),se=e=>{let t=e.indexOf(`:`);return t===-1?e:e.slice(t+1)},x=e=>{let t={name:``,qname:``,attrs:``,children:[],start:0,end:e.length,contentStart:0,contentEnd:e.length},n=[t];b.lastIndex=0;for(let t=b.exec(e);t;t=b.exec(e)){let e=n[n.length-1];if(t[1]!==void 0)e.children.push(t[1]);else if(t[6]!==void 0)e.children.push(oe(t[6]));else if(t[3]!==void 0){if(t[2]){if(n.length>1){let e=n.pop();e.contentEnd=t.index,e.end=t.index+t[0].length}continue}let r=t.index+t[0].length,i={name:se(t[3]),qname:t[3],attrs:t[4]??``,children:[],start:t.index,end:r,contentStart:r,contentEnd:r};e.children.push(i),t[5]||n.push(i)}}return t.children.find(e=>typeof e!=`string`)??null},S=e=>e.children.filter(e=>typeof e!=`string`),C=e=>{let t=``;for(let n of e.children)typeof n==`string`&&(t+=n);return t},ce=`http://schemas.openxmlformats.org/drawingml/2006/chart`,le=`http://purl.oclc.org/ooxml/drawingml/chart`,ue=`http://schemas.openxmlformats.org/drawingml/2006/main`,de=`http://purl.oclc.org/ooxml/drawingml/main`,fe=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,pe=`http://schemas.microsoft.com/office/drawing/2012/chart`,me=`http://schemas.microsoft.com/office/drawing/2014/chartex`,he=`http://www.w3.org/XML/1998/namespace`,w={c:`c`,a:`a`,r:`r`,c15:`c15`,cx:`cx`},ge=e=>e===ce||e===le,_e=e=>e===ue||e===de,ve=e=>e===me,ye=Object.freeze({xml:he}),be=/([^\s=]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,T=e=>{let t=[];be.lastIndex=0;for(let n=be.exec(e.attrs);n;n=be.exec(e.attrs))t.push([n[1],oe(n[2]??n[3]??``)]);return t},xe=(e,t)=>{let n=null;for(let[r,i]of T(e))r===`xmlns`?(n??={...t})[``]=i:r.startsWith(`xmlns:`)&&((n??={...t})[r.slice(6)]=i);return n??t},Se=(e,t)=>t[(e=>{let t=e.indexOf(`:`);return t===-1?``:e.slice(0,t)})(e.qname)],Ce=class{constructor(){this._parts=[]}open(e,t,n=!1){let r=`<`+e;if(t)for(let[e,n]of t)r+=` ${e}="${we(n)}"`;return this._parts.push(r+(n?`/>`:`>`)),this}close(e){return this._parts.push(`</${e}>`),this}val(e,t){return this.open(e,[[`val`,t]],!0)}text(e){return this._parts.push((e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`))(e)),this}raw(e){return this._parts.push(e),this}toString(){return this._parts.join(``)}},we=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/"/g,`"`),E=e=>e===`1`||e===`true`||e!==`0`&&e!==`false`&&null,D=e=>e?`1`:`0`,Te=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/,O=e=>{let t=E(e);return t===null?Te.test(e)?String(Number(e)):e:D(t)},Ee=new Set(`date1904.roundedCorners.autoTitleDeleted.plotVisOnly.showDLblsOverMax.varyColors.marker.smooth.invertIfNegative.bubble3D.delete.showLegendKey.showVal.showCatName.showSerName.showPercent.showBubbleSize.showLeaderLines.overlay.rAngAx.showHorzBorder.showVertBorder.showOutline.showKeys.auto.noMultiLvlLbl.wireframe.showNegBubbles.autoUpdate.applyToFront.applyToSides.applyToEnd.chartObject.data.formatting.selection.userInterface`.split(`.`)),De=(e,t,n=!1)=>{let r=xe(e,t),i=Se(e,r)??``,a=[];for(let[t,n]of T(e)){if(t===`xmlns`||t.startsWith(`xmlns:`))continue;let e=t.indexOf(`:`),i=e===-1?t:`{${r[t.slice(0,e)]??t.slice(0,e)}}${t.slice(e+1)}`;a.push(`${i}=${JSON.stringify(O(n))}`)}let o=S(e),s=o.length===0?e.children.join(``):``;a.length===0&&o.length===0&&s===``&&ge(i)&&Ee.has(e.name)&&a.push(`val="1"`),a.sort();let c=`<{${i}}${e.name}${a.length?` `+a.join(` `):``}>`;if(o.length>0){let t=[];for(let i of e.children)typeof i==`string`?i.trim()!==``&&t.push(JSON.stringify(i)):t.push(De(i,r,n));n&&t.sort(),c+=t.join(``)}else s!==``&&(c+=JSON.stringify(s));return c+`</>`},Oe=class{constructor(e,t){this.xml=e,this.rootScope=t,this.kept=0,this.reordered=0;let n=Object.values(t).find(ge)??ce,r=_e(t[w.a])?t[w.a]:ue;this.writeScope={...t,[w.c]:n,[w.cx]:me,[w.a]:r,[w.r]:t[w.r]??fe}}markupOf(e,t){let n=this.xml.slice(e.start,e.end),r=new Set(T(e).map(([e])=>e).filter(e=>e===`xmlns`||e.startsWith(`xmlns:`))),i=``;for(let e of Object.keys(t))e!==`xml`&&t[e]!==this.rootScope[e]&&(r.has(e===``?`xmlns`:`xmlns:${e}`)||(i+=e===``?` xmlns="${t[e]}"`:` xmlns:${e}="${t[e]}"`));if(i){let t=1+e.qname.length;n=n.slice(0,t)+i+n.slice(t)}return n}},ke=(e,t)=>{switch(e){case`c`:return ge(t);case`c15`:return t===pe;case`cx`:return ve(t);default:return _e(t)}},k=(e,t,n,r)=>{let i=xe(e,n),a={},o,s;for(let[n,r]of T(e)){let e=t.attributes?.find(e=>e.name===n),i=e?e.read(r):void 0;e&&i!==void 0&&O(e.write(i))===O(r)?a[e.key]=i:(o??={})[n]=r}let c=-1,l=``,u={};for(let n of S(e)){let e=xe(n,i),o=Se(n,e),d=t.fields.findIndex(e=>e.tags.includes(n.name)&&ke(e.ns,o)),f=d===-1?null:t.fields[d],p=f&&!f.many?f.get?f.get(a):a[f.key]:void 0,m=d>c||d===c&&!!f?.many;if(f&&p===void 0&&(m||!f.many)){let t=f.read(n,e,r);if(t!==void 0){f.many?(a[f.key]??=[]).push(t):f.set?f.set(a,t):a[f.key]=t,u[f.key]=(u[f.key]??0)+1,m?(c=d,l=n.name):r.reordered++;continue}}let h=c===-1?null:t.fields[c],g={after:l,xml:r.markupOf(n,i)};h?.many&&(g.at=u[h.key]),(s??=[]).push(g)}return(o||s)&&(a.unknown={},s&&(a.unknown.elements=s),o&&(a.unknown.attributes=o)),t.afterRead?.(a,e,i,r),a},A=(e,t,n,r)=>{let i=[];for(let e of r.attributes??[]){let t=n[e.key];t!==void 0&&i.push([e.name,e.write(t)])}let a=n.unknown;if(a?.attributes)for(let e of Object.keys(a.attributes))i.push([e,a.attributes[e]]);for(let e of r.declares?.(n)??[])i.some(([t])=>t===e[0])||i.push(e);let o=new Ce,s=a?.elements?[...a.elements]:[],c=e=>{for(let t=0;t<s.length;t++)e(s[t])&&(o.raw(s[t].xml),s.splice(t--,1))};c(e=>e.after===``);for(let e of r.fields){let t=e.get?e.get(n):n[e.key],r=t=>e.tags.includes(t.after);if(e.many){let n=t??[];for(let t=0;t<n.length;t++)e.write(o,n[t]),c(e=>r(e)&&e.at===t+1)}else t!==void 0&&e.write(o,t);c(r)}c(()=>!0);let l=o.toString();l===``?e.open(t,i,!0):e.open(t,i).raw(l).close(t)},j=(e,t)=>`${w[e]}:${t}`,M=(e,t,n=e,r=`c`)=>({tags:[e],key:n,ns:r,read:e=>{let n=(e=>{if(S(e).length>0)return;let t=null;for(let[n,r]of T(e)){if(n!==`val`)return;t=r}return t})(e);if(n===void 0)return;if(t===`bool`)return n===null||(E(n)??void 0);if(n===null)return;if(t===`str`)return n;let r=Number(n);return Number.isFinite(r)&&(t!==`int`||Number.isInteger(r))&&O(String(r))===O(n)?r:void 0},write:(n,i)=>{n.val(j(r,e),t===`bool`?D(i):String(i))}}),N=(e,t=e,n=`c`)=>({tags:[e],key:t,ns:n,read:e=>{if(!(S(e).length>0||T(e).some(([e])=>!e.startsWith(`xmlns`))))return C(e)},write:(t,r)=>{let i=j(n,e);r===``?t.open(i,null,!0):t.open(i).text(r).close(i)}}),P=(e,t,n=e,r)=>{let i=r?.ns??`c`,a=typeof t==`function`?t:()=>t;return{tags:[e],key:n,ns:i,many:r?.many,read:(e,t,n)=>k(e,a(),t,n),write:(t,n)=>A(t,j(i,e),n,a())}},F=(e,t,n=e,r=1)=>({name:e,key:n,read:e=>{if(t===`str`)return e;if(t===`bool`)return E(e)??void 0;let n=Number(e);return Number.isFinite(n)&&(t!==`int`||Number.isInteger(n))?r===1?n:n/r:void 0},write:e=>t===`bool`?D(e):t===`str`?e:String(r===1?e:Math.round(e*r))}),Ae=(e,t,n,r)=>({name:e,key:t,read:n,write:r}),je=e=>({...e,read:(t,n,r)=>{let i=e.read(t,n,r);if(i===void 0)return;let a=new Ce;e.write(a,i);let o=((e,t)=>{let n=x(e);return n?De(n,t):null})(a.toString(),r.writeScope)===De(t,n);return o||r.kept++,o?i:void 0}}),I=e=>`a:${e}`,Me=new Set([`bg1`,`tx1`,`bg2`,`tx2`,`accent1`,`accent2`,`accent3`,`accent4`,`accent5`,`accent6`,`hlink`,`folHlink`,`phClr`,`dk1`,`lt1`,`dk2`,`lt2`]),Ne=new Set(`scrollBar.background.activeCaption.inactiveCaption.menu.window.windowFrame.menuText.windowText.captionText.activeBorder.inactiveBorder.appWorkspace.highlight.highlightText.btnFace.btnShadow.grayText.btnText.inactiveCaptionText.btnHighlight.3dDkShadow.3dLight.infoText.infoBk.hotLight.gradientActiveCaption.gradientInactiveCaption.menuHighlight.menuBar`.split(`.`)),Pe=[`scrgbClr`,`srgbClr`,`hslClr`,`sysClr`,`schemeClr`,`prstClr`],Fe=e=>e===`hue`||e===`hueOff`||e===`hueMod`?6e4:e===`alpha`||e===`alphaOff`||e===`alphaMod`?1e5:1e3,L=(e,t)=>{let n={};for(let[r,i]of T(e)){if(!t.includes(r))return null;n[r]=i}return n},R=/^-?\d+$/,Ie=e=>{let t=S(e);return t.length===0?null:t.length>1||!Pe.includes(t[0].name)?void 0:(e=>{let t;switch(e.name){case`scrgbClr`:{let n=L(e,[`r`,`g`,`b`]);if(!(n&&R.test(n.r??``)&&R.test(n.g??``)&&R.test(n.b??``)))return;t=`lrgb(${Number(n.r)/1e3},${Number(n.g)/1e3},${Number(n.b)/1e3})`;break}case`hslClr`:{let n=L(e,[`hue`,`sat`,`lum`]);if(!(n&&R.test(n.hue??``)&&R.test(n.sat??``)&&R.test(n.lum??``)))return;t=`hsl(${Number(n.hue)/6e4},${Number(n.sat)/1e3},${Number(n.lum)/1e3})`;break}case`sysClr`:{let n=L(e,[`val`,`lastClr`]);if(!n?.val||!Ne.has(n.val))return;t=n.lastClr===void 0?n.val:`${n.val} lastClr ${n.lastClr}`;break}default:{let n=L(e,[`val`]);if(!n?.val||/\s/.test(n.val)||(Me.has(n.val)?`schemeClr`:/^[0-9A-Fa-f]{6}$/.test(n.val)?`srgbClr`:`prstClr`)!==e.name)return;t=n.val}}for(let n of S(e)){if(S(n).length>0)return;let e=L(n,[`val`]);if(!e)return;if(e.val!==void 0){if(!R.test(e.val))return;t+=` ${n.name} ${Number(e.val)/Fe(n.name)}`}else t+=` ${n.name}`}return t})(t[0])},Le=/^-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?$/i,Re=(e,t)=>{let r=(e=>{let t=e.trim(),n=/^[a-z]+\([^)]*\)|^[^\s,]+/i.exec(t)?.[0]??t,r=t.slice(n.length).split(/\s*,\s*|\s+/).filter(e=>e!==``);return[n.replace(/\s+/g,``),...r]})(t),i=r.shift(),a,o,s=/^(lrgb|hsl)\(([^,]+),([^,]+),([^)]+)\)$/.exec(i);if(s?.[1]===`lrgb`)a=`scrgbClr`,o=[[`r`,String(Math.round(1e3*Number(s[2])))],[`g`,String(Math.round(1e3*Number(s[3])))],[`b`,String(Math.round(1e3*Number(s[4])))]];else if(s?.[1]===`hsl`)a=`hslClr`,o=[[`hue`,String(Math.round(6e4*Number(s[2])))],[`sat`,String(Math.round(1e3*Number(s[3])))],[`lum`,String(Math.round(1e3*Number(s[4])))]];else if(r[0]===`lastClr`||Ne.has(i))a=`sysClr`,o=[[`val`,i]],r[0]===`lastClr`&&(r.shift(),o.push([`lastClr`,r.shift()]));else{let e=(e=>{if(Me.has(e)||/^[0-9A-Fa-f]{6}$/.test(e)||/^[a-z]+$/i.test(e))return null;let t;try{t=new n(e)}catch{return null}let r=t.getType();return r===`hex`||r===`rgb`||r===`hsl`?t.toHex().toString(!1).replace(`#`,``).toUpperCase():null})(i);a=e?`srgbClr`:Me.has(i)?`schemeClr`:/^[0-9A-Fa-f]{6}$/.test(i)?`srgbClr`:`prstClr`,o=[[`val`,e??i]]}if(r.length!==0){e.open(I(a),o);for(let t=0;t<r.length;t++){let n=r[t];t+1<r.length&&Le.test(r[t+1])?e.val(I(n),String(Math.round(Number(r[++t])*Fe(n)))):e.open(I(n),null,!0)}e.close(I(a))}else e.open(I(a),o,!0)},ze=(e,t,n,r)=>{n===void 0?e.open(I(t),r,!0):(e.open(I(t),r),Re(e,n),e.close(I(t)))},Be=[`noFill`,`solidFill`,`gradFill`,`pattFill`,`grpFill`],Ve=e=>{let t=L(e,[`l`,`t`,`r`,`b`]);if(!t)return;let n={};return t.l!==void 0&&(n.left=Number(t.l)/1e3),t.t!==void 0&&(n.top=Number(t.t)/1e3),t.r!==void 0&&(n.right=Number(t.r)/1e3),t.b!==void 0&&(n.bottom=Number(t.b)/1e3),n},He=(e,t,n)=>{let r=[];n.left!==void 0&&r.push([`l`,String(Math.round(1e3*n.left))]),n.top!==void 0&&r.push([`t`,String(Math.round(1e3*n.top))]),n.right!==void 0&&r.push([`r`,String(Math.round(1e3*n.right))]),n.bottom!==void 0&&r.push([`b`,String(Math.round(1e3*n.bottom))]),e.open(I(t),r,!0)},Ue=t=>{switch(t.name){case`noFill`:return S(t).length===0&&T(t).length===0?{type:e.Type.None}:void 0;case`grpFill`:return S(t).length===0&&T(t).length===0?{type:e.Type.Group}:void 0;case`solidFill`:{if(T(t).length>0)return;let n=Ie(t);return n===void 0?void 0:n===null?{type:e.Type.Solid}:{type:e.Type.Solid,color:n}}case`gradFill`:return(t=>{let n=L(t,[`rotWithShape`,`flip`]);if(!n)return;let r={type:e.Type.Gradient};if(n.rotWithShape!==void 0){let e=E(n.rotWithShape);if(e===null)return;r.isRotatedWithShape=e}n.flip!==void 0&&(r.flip=n.flip);for(let n of S(t))if(n.name===`gsLst`){let e=[];for(let t of S(n)){let n=t.name===`gs`?L(t,[`pos`]):null,r=n&&R.test(n.pos??``)?Ie(t):void 0;if(!r)return;e.push({offset:Number(n.pos)/1e5,color:r})}r.stops=e}else if(n.name===`lin`){let t=L(n,[`ang`,`scaled`]);if(!t||S(n).length>0)return;if(r.gradientType=e.GradientType.Linear,t.ang!==void 0){if(!R.test(t.ang))return;r.angle=(Number(t.ang)/6e4+90)%360}if(t.scaled!==void 0){let e=E(t.scaled);if(e===null)return;r.scaled=e}}else if(n.name===`path`){let t=L(n,[`path`]);if(!t)return;r.gradientType=t.path===`circle`?e.GradientType.Path:t.path;let i=S(n);if(i.length>1||i.length===1&&i[0].name!==`fillToRect`)return;if(i.length===1){let e=Ve(i[0]);if(!e)return;r.focus={left:(e.left??0)/100,top:(e.top??0)/100,right:1-(e.right??0)/100,bottom:1-(e.bottom??0)/100}}}else{if(n.name!==`tileRect`)return;{let e=Ve(n);if(!e)return;r.tileRect=e}}return r})(t);case`pattFill`:{let n=L(t,[`prst`]);if(!n)return;let r={type:e.Type.Pattern};n.prst!==void 0&&(r.patternType=n.prst);for(let e of S(t)){let t=e.name===`fgClr`||e.name===`bgClr`?Ie(e):void 0;if(!t)return;e.name===`fgClr`?r.foreground=t:r.background=t}return r}}},We=(t,n)=>{switch(n.type){case e.Type.None:t.open(I(`noFill`),null,!0);return;case e.Type.Group:t.open(I(`grpFill`),null,!0);return;case e.Type.Solid:ze(t,`solidFill`,n.color);return;case e.Type.Gradient:((t,n)=>{let r=[];if(n.flip!==void 0&&r.push([`flip`,n.flip]),n.isRotatedWithShape!==void 0&&r.push([`rotWithShape`,D(n.isRotatedWithShape)]),t.open(I(`gradFill`),r),n.stops){t.open(I(`gsLst`));for(let e of n.stops){let{offset:n,color:r}=typeof e==`string`?{offset:0,color:e}:e;ze(t,`gs`,r,[[`pos`,String(Math.round(1e5*(n??0)))]])}t.close(I(`gsLst`))}if(n.gradientType===e.GradientType.Linear){let e=[];n.angle!==void 0&&e.push([`ang`,String(Math.round((n.angle-90+360)%360*6e4))]),n.scaled!==void 0&&e.push([`scaled`,D(n.scaled)]),t.open(I(`lin`),e,!0)}else if(n.gradientType!==void 0){let r=n.gradientType===e.GradientType.Path?`circle`:n.gradientType;n.focus?(t.open(I(`path`),[[`path`,r]]),He(t,`fillToRect`,{left:100*n.focus.left,top:100*n.focus.top,right:100*(1-n.focus.right),bottom:100*(1-n.focus.bottom)}),t.close(I(`path`))):t.open(I(`path`),[[`path`,r]],!0)}n.tileRect&&He(t,`tileRect`,n.tileRect),t.close(I(`gradFill`))})(t,n);return;case e.Type.Pattern:{let e=n,r=e.patternType===void 0?[]:[[`prst`,e.patternType]];e.foreground===void 0&&e.background===void 0?t.open(I(`pattFill`),r,!0):(t.open(I(`pattFill`),r),e.foreground!==void 0&&ze(t,`fgClr`,e.foreground),e.background!==void 0&&ze(t,`bgClr`,e.background),t.close(I(`pattFill`)));return}}throw Error(`A chart cannot write a fill of type '${n.type}'.`)},Ge=e=>je({tags:Be,key:e,ns:`a`,read:e=>Ue(e),write:(e,t)=>We(e,t)}),Ke={tags:[`effectLst`],key:`effects`,ns:`a`,read:e=>S(e).length===0&&T(e).length===0?[]:void 0,write:(e,t)=>{if(t.length>0)throw Error(`A chart cannot write effects yet.`);e.open(I(`effectLst`),null,!0)}},qe={rnd:`round`,flat:`butt`,sq:`square`},Je=(e,t)=>({tags:[e],key:`${t}Type`,ns:`a`,read:e=>{let t=L(e,[`type`,`w`,`len`]);if(t&&!(S(e).length>0)&&Object.keys(t).length!==0)return t},write:(t,n)=>{let r=[];for(let e of[`type`,`w`,`len`])n[e]!==void 0&&r.push([e,n[e]]);t.open(I(e),r,!0)},get:e=>{let n={};return e[`${t}Type`]!==void 0&&(n.type=e[`${t}Type`]),e[`${t}Width`]!==void 0&&(n.w=e[`${t}Width`]),e[`${t}Length`]!==void 0&&(n.len=e[`${t}Length`]),Object.keys(n).length>0?n:void 0},set:(e,n)=>{n.type!==void 0&&(e[`${t}Type`]=n.type),n.w!==void 0&&(e[`${t}Width`]=n.w),n.len!==void 0&&(e[`${t}Length`]=n.len)}}),Ye={attributes:[F(`w`,`int`,`width`,12700),Ae(`cap`,`lineCap`,e=>qe[e],e=>Object.keys(qe).find(t=>qe[t]===e)),F(`cmpd`,`str`,`compound`),F(`algn`,`str`,`align`)],fields:[Ge(`fill`),{tags:[`prstDash`,`custDash`],key:`dash`,ns:`a`,read:e=>{if(e.name===`prstDash`){let t=L(e,[`val`]);return t?.val!==void 0&&S(e).length===0?t.val:void 0}if(T(e).length>0)return;let t=[];for(let n of S(e)){let e=n.name===`ds`?L(n,[`d`,`sp`]):null;if(!e||!R.test(e.d??``)||!R.test(e.sp??``))return;t.push(Number(e.d)/1e3,Number(e.sp)/1e3)}return t},write:(e,t)=>{if(typeof t!=`string`){e.open(I(`custDash`));for(let n=0;n<t.length;n+=2)e.open(I(`ds`),[[`d`,String(Math.round(1e3*t[n]))],[`sp`,String(Math.round(1e3*t[n+1]))]],!0);e.close(I(`custDash`))}else e.val(I(`prstDash`),t)}},{tags:[`round`,`bevel`,`miter`],key:`lineJoin`,ns:`a`,read:e=>{let t=L(e,e.name===`miter`?[`lim`]:[]);if(t&&!(S(e).length>0)&&(t.lim===void 0||R.test(t.lim)))return{join:e.name,limit:t.lim===void 0?void 0:Number(t.lim)/1e5}},write:(e,t)=>{e.open(I(t.join),t.limit===void 0?null:[[`lim`,String(Math.round(1e5*t.limit))]],!0)},get:e=>e.lineJoin?{join:e.lineJoin,limit:e.miterLimit}:void 0,set:(e,t)=>{e.lineJoin=t.join,t.limit!==void 0&&(e.miterLimit=t.limit)}},Je(`headEnd`,`head`),Je(`tailEnd`,`tail`)]},Xe=e=>je(P(`ln`,Ye,e,{ns:`a`})),Ze={fields:[Ge(`fill`),Xe(`stroke`),Ke]},Qe=(e,n,r)=>({tags:[e],key:n,ns:`a`,read:e=>{let n=L(e,[`typeface`]);if(!(n?.typeface===void 0||S(e).length>0))return r&&n.typeface===`+mn-${r}`?t.ThemeFamily.Body:r&&n.typeface===`+mj-${r}`?t.ThemeFamily.Heading:n.typeface},write:(n,i)=>{let a=r?i===t.ThemeFamily.Body?`+mn-${r}`:i===t.ThemeFamily.Heading?`+mj-${r}`:i:i;n.open(I(e),[[`typeface`,a]],!0)}}),$e=(e,t,n)=>{let r=Object.fromEntries(Object.entries(n).map(([e,t])=>[t,e]));return Ae(e,t,e=>r[e],e=>n[e]??e)},et={attributes:[F(`lang`,`str`,`language`),F(`altLang`,`str`,`alternateLanguage`),F(`sz`,`int`,`size`,100),Ae(`b`,`weight`,e=>{let t=E(e);return t===null?void 0:t?700:400},e=>D(e>=600)),Ae(`i`,`style`,e=>{let t=E(e);return t===null?void 0:t?`italic`:`normal`},e=>D(e===`italic`)),$e(`u`,`underline`,{none:`none`,words:`words`,single:`sng`,double:`dbl`,heavy:`heavy`,dotted:`dotted`,dottedHeavy:`dottedHeavy`,dash:`dash`,dashHeavy:`dashHeavy`,dashLong:`dashLong`,dashLongHeavy:`dashLongHeavy`,dotDash:`dotDash`,dotDashHeavy:`dotDashHeavy`,dotDotDash:`dotDotDash`,dotDotDashHeavy:`dotDotDashHeavy`,wavy:`wavy`,wavyHeavy:`wavyHeavy`,wavyDouble:`wavyDbl`}),$e(`strike`,`strike`,{none:`noStrike`,single:`sngStrike`,double:`dblStrike`}),F(`kern`,`int`,`kerning`,100),$e(`cap`,`capitals`,{none:`none`,small:`small`,all:`all`}),F(`spc`,`int`,`letterSpacing`,100),F(`normalizeH`,`bool`,`normalizeHeight`),F(`baseline`,`int`,`baseline`,1e3)],fields:[Xe(`outline`),Ge(`color`),Ke,Qe(`latin`,`latin`,`lt`),Qe(`ea`,`eastAsian`,`ea`),Qe(`cs`,`complexScript`,`cs`),Qe(`sym`,`symbol`)]},tt={attributes:[F(`algn`,`str`,`align`),F(`rtl`,`bool`,`rtl`)],fields:[P(`defRPr`,et,`defaultRun`,{ns:`a`})]},nt={fields:[P(`rPr`,et,`rPr`,{ns:`a`}),{tags:[`t`],key:`text`,ns:`a`,read:e=>{if(S(e).length>0)return;let t=!1;for(let[n,r]of T(e))if(n!==`xmlns`&&!n.startsWith(`xmlns:`)){if(n!==`xml:space`||r!==`preserve`)return;t=!0}return{text:C(e),preserve:t}},get:e=>e.text===void 0?void 0:{text:e.text,preserve:!0===e.preserveSpace},set:(e,t)=>{e.text=t.text,t.preserve&&(e.preserveSpace=!0)},write:(e,t)=>{let n=I(`t`),r=t.preserve?[[`xml:space`,`preserve`]]:null;t.text===``?e.open(n,r,!0):e.open(n,r).text(t.text).close(n)}}]},rt={attributes:[F(`id`,`str`,`id`),F(`type`,`str`,`type`)],fields:nt.fields},it={fields:[P(`rPr`,et,`rPr`,{ns:`a`})]},at={fields:[P(`pPr`,tt,`pPr`,{ns:`a`}),{tags:[`r`,`br`,`fld`],key:`runs`,ns:`a`,many:!0,read:(e,t,n)=>{if(e.name===`br`)return{...k(e,it,t,n),text:`
|
|
2
2
|
`,break:!0};if(e.name===`r`){let r=k(e,nt,t,n);return r.text===void 0?void 0:r}let{id:r,type:i,...a}=k(e,rt,t,n);return r===void 0?void 0:(a.text??=``,a.field=i===void 0?{id:r}:{id:r,type:i},a)},write:(e,t)=>{if(t.break){let{text:n,break:r,...i}=t;A(e,I(`br`),i,it)}else if(t.field){let{field:n,...r}=t;A(e,I(`fld`),{...r,id:n.id,type:n.type},rt)}else A(e,I(`r`),t,nt)}},P(`endParaRPr`,et,`endRun`,{ns:`a`})]},ot={fields:[P(`bodyPr`,{attributes:[F(`rot`,`int`,`rotation`,6e4),F(`spcFirstLastPara`,`bool`,`spcFirstLastPara`),F(`vertOverflow`,`str`,`vertOverflow`),F(`horzOverflow`,`str`,`horzOverflow`),F(`vert`,`str`,`vert`),F(`wrap`,`str`,`wrap`),F(`lIns`,`int`,`lIns`),F(`tIns`,`int`,`tIns`),F(`rIns`,`int`,`rIns`),F(`bIns`,`int`,`bIns`),F(`anchor`,`str`,`anchor`),F(`anchorCtr`,`bool`,`anchorCtr`)],fields:[]},`bodyPr`,{ns:`a`}),P(`lstStyle`,{fields:[]},`lstStyle`,{ns:`a`}),P(`p`,at,`paragraphs`,{ns:`a`,many:!0})]},z=()=>P(`spPr`,Ze),B=()=>P(`txPr`,ot),st={attributes:[F(`idx`,`int`),F(`formatCode`,`str`)],fields:[N(`v`)]},ct={fields:[N(`formatCode`),M(`ptCount`,`int`),P(`pt`,st,`points`,{many:!0})]},lt={fields:[M(`ptCount`,`int`),P(`pt`,st,`points`,{many:!0})]},ut={fields:[M(`ptCount`,`int`),P(`lvl`,{fields:[P(`pt`,st,`points`,{many:!0})]},`levels`,{many:!0})]},dt={fields:[N(`f`),P(`numCache`,ct,`cache`)]},ft={fields:[N(`f`),P(`strCache`,lt,`cache`)]},pt={fields:[N(`f`),P(`multiLvlStrCache`,ut,`cache`)]},mt=P(`datalabelsRange`,{fields:[N(`f`,`f`,`c15`),P(`dlblRangeCache`,lt,`cache`,{ns:`c15`})]},`datalabelsRange`,{ns:`c15`}),ht={...mt,read:(e,t,n)=>t[w.c15]===pe?mt.read(e,t,n):void 0},gt=M(`showDataLabelsRange`,`bool`,`showDataLabelsRange`,`c15`),_t={...gt,read:(e,t,n)=>t[w.c15]===pe?gt.read(e,t,n):void 0},vt={fields:[P(`ext`,{attributes:[F(`uri`,`str`)],fields:[ht,_t],declares:e=>e.datalabelsRange!==void 0||e.showDataLabelsRange!==void 0?[[`xmlns:${w.c15}`,pe]]:[]},`extensions`,{many:!0})]},yt={fields:[P(`multiLvlStrRef`,pt),P(`numRef`,dt),P(`numLit`,ct),P(`strRef`,ft),P(`strLit`,lt)]},bt={fields:[P(`strRef`,ft),N(`v`)]},xt={fields:[P(`strRef`,ft),P(`rich`,ot)]},St={attributes:[F(`formatCode`,`str`),F(`sourceLinked`,`bool`)],fields:[]},V={fields:[P(`manualLayout`,{fields:[M(`layoutTarget`,`str`),M(`xMode`,`str`),M(`yMode`,`str`),M(`wMode`,`str`),M(`hMode`,`str`),M(`x`,`num`),M(`y`,`num`),M(`w`,`num`),M(`h`,`num`)]})]},Ct={fields:[P(`tx`,xt),P(`layout`,V),M(`overlay`,`bool`),z(),B()]},wt={fields:[z()]},Tt={fields:[M(`symbol`,`str`),M(`size`,`int`),z()]},Et={fields:[M(`idx`,`int`),M(`invertIfNegative`,`bool`),P(`marker`,Tt),M(`bubble3D`,`bool`),M(`explosion`,`int`),z()]},Dt=()=>[P(`numFmt`,St),z(),B(),M(`dLblPos`,`str`),M(`showLegendKey`,`bool`),M(`showVal`,`bool`),M(`showCatName`,`bool`),M(`showSerName`,`bool`),M(`showPercent`,`bool`),M(`showBubbleSize`,`bool`),N(`separator`)],Ot={fields:[P(`dLbl`,{fields:[M(`idx`,`int`),M(`delete`,`bool`),P(`layout`,V),P(`tx`,xt),...Dt(),P(`extLst`,vt)]},`labels`,{many:!0}),M(`delete`,`bool`),...Dt(),M(`showLeaderLines`,`bool`),P(`leaderLines`,wt),P(`extLst`,vt)]},kt={fields:[P(`layout`,V),P(`tx`,xt),P(`numFmt`,St),z(),B()]},At={fields:[N(`name`),z(),M(`trendlineType`,`str`),M(`order`,`int`),M(`period`,`int`),M(`forward`,`num`),M(`backward`,`num`),M(`intercept`,`num`),M(`dispRSqr`,`bool`),M(`dispEq`,`bool`),P(`trendlineLbl`,kt)]},jt={fields:[M(`errDir`,`str`),M(`errBarType`,`str`),M(`errValType`,`str`),M(`noEndCap`,`bool`),P(`plus`,yt),P(`minus`,yt),M(`val`,`num`),z(),P(`extLst`,vt)]},Mt={fields:[M(`gapWidth`,`int`),P(`upBars`,wt),P(`downBars`,wt)]},H=()=>[M(`idx`,`int`),M(`order`,`int`),P(`tx`,bt),z()],U=()=>P(`dPt`,Et,`points`,{many:!0}),W=()=>P(`dLbls`,Ot),Nt=()=>P(`trendline`,At,`trendlines`,{many:!0}),Pt=()=>P(`errBars`,jt,`errBars`,{many:!0}),G=e=>P(e,yt),K=()=>P(`extLst`,vt),Ft={bar:{fields:[...H(),M(`invertIfNegative`,`bool`),U(),W(),Nt(),Pt(),G(`cat`),G(`val`),M(`shape`,`str`),K()]},line:{fields:[...H(),P(`marker`,Tt),U(),W(),Nt(),Pt(),G(`cat`),G(`val`),M(`smooth`,`bool`),K()]},area:{fields:[...H(),U(),W(),Nt(),Pt(),G(`cat`),G(`val`),K()]},pie:{fields:[...H(),M(`explosion`,`int`),U(),W(),G(`cat`),G(`val`),K()]},scatter:{fields:[...H(),P(`marker`,Tt),U(),W(),Nt(),Pt(),G(`xVal`),G(`yVal`),M(`smooth`,`bool`),K()]},bubble:{fields:[...H(),M(`invertIfNegative`,`bool`),U(),W(),Nt(),Pt(),G(`xVal`),G(`yVal`),G(`bubbleSize`),M(`bubble3D`,`bool`),K()]},radar:{fields:[...H(),P(`marker`,Tt),U(),W(),G(`cat`),G(`val`),K()]},surface:{fields:[...H(),G(`cat`),G(`val`),K()]}},q=e=>P(`ser`,Ft[e],`series`,{many:!0}),J=()=>({...M(`axId`,`int`,`axIds`),many:!0}),Y=(e,t)=>P(e,wt,e,{many:t}),It={tags:[`custSplit`],key:`custSplit`,ns:`c`,read:(e,t,n)=>{let r=k(e,{fields:[{...M(`secondPiePt`,`int`,`points`),many:!0}]},t,n);return r.unknown?void 0:r.points??[]},write:(e,t)=>{A(e,`c:custSplit`,{points:t},{fields:[{...M(`secondPiePt`,`int`,`points`),many:!0}]})}},Lt={fields:[M(`idx`,`int`),z()]},Rt={tags:[`bandFmts`],key:`bandFmts`,ns:`c`,read:(e,t,n)=>{let r=k(e,{fields:[P(`bandFmt`,Lt,`formats`,{many:!0})]},t,n);return r.unknown?void 0:r.formats??[]},write:(e,t)=>{A(e,`c:bandFmts`,{formats:t},{fields:[P(`bandFmt`,Lt,`formats`,{many:!0})]})}},zt={areaChart:{type:`area`,codec:{fields:[M(`grouping`,`str`),M(`varyColors`,`bool`),q(`area`),W(),Y(`dropLines`),J()]}},area3DChart:{type:`area`,is3D:!0,codec:{fields:[M(`grouping`,`str`),M(`varyColors`,`bool`),q(`area`),W(),Y(`dropLines`),M(`gapDepth`,`int`),J()]}},lineChart:{type:`line`,codec:{fields:[M(`grouping`,`str`),M(`varyColors`,`bool`),q(`line`),W(),Y(`dropLines`),Y(`hiLowLines`),P(`upDownBars`,Mt),M(`marker`,`bool`),M(`smooth`,`bool`),J()]}},line3DChart:{type:`line`,is3D:!0,codec:{fields:[M(`grouping`,`str`),M(`varyColors`,`bool`),q(`line`),W(),Y(`dropLines`),M(`gapDepth`,`int`),J()]}},stockChart:{type:`stock`,codec:{fields:[q(`line`),W(),Y(`dropLines`),Y(`hiLowLines`),P(`upDownBars`,Mt),J()]}},radarChart:{type:`radar`,codec:{fields:[M(`radarStyle`,`str`),M(`varyColors`,`bool`),q(`radar`),W(),J()]}},scatterChart:{type:`scatter`,codec:{fields:[M(`scatterStyle`,`str`),M(`varyColors`,`bool`),q(`scatter`),W(),J()]}},pieChart:{type:`pie`,codec:{fields:[M(`varyColors`,`bool`),q(`pie`),W(),M(`firstSliceAng`,`int`)]}},pie3DChart:{type:`pie`,is3D:!0,codec:{fields:[M(`varyColors`,`bool`),q(`pie`),W()]}},doughnutChart:{type:`doughnut`,codec:{fields:[M(`varyColors`,`bool`),q(`pie`),W(),M(`firstSliceAng`,`int`),M(`holeSize`,`int`)]}},barChart:{type:`bar`,codec:{fields:[M(`barDir`,`str`),M(`grouping`,`str`),M(`varyColors`,`bool`),q(`bar`),W(),M(`gapWidth`,`int`),M(`overlap`,`int`),Y(`serLines`,!0),J()]}},bar3DChart:{type:`bar`,is3D:!0,codec:{fields:[M(`barDir`,`str`),M(`grouping`,`str`),M(`varyColors`,`bool`),q(`bar`),W(),M(`gapWidth`,`int`),M(`gapDepth`,`int`),M(`shape`,`str`),J()]}},ofPieChart:{type:`ofPie`,codec:{fields:[M(`ofPieType`,`str`),M(`varyColors`,`bool`),q(`pie`),W(),M(`gapWidth`,`int`),M(`splitType`,`str`),M(`splitPos`,`num`),It,M(`secondPieSize`,`int`),Y(`serLines`,!0)]}},surfaceChart:{type:`surface`,codec:{fields:[M(`wireframe`,`bool`),q(`surface`),Rt,J()]}},surface3DChart:{type:`surface`,is3D:!0,codec:{fields:[M(`wireframe`,`bool`),q(`surface`),Rt,J()]}},bubbleChart:{type:`bubble`,codec:{fields:[M(`varyColors`,`bool`),q(`bubble`),W(),M(`bubble3D`,`bool`),M(`bubbleScale`,`int`),M(`showNegBubbles`,`bool`),M(`sizeRepresents`,`str`),J()]}}},Bt={tags:Object.keys(zt),key:`groups`,ns:`c`,many:!0,read:(e,t,n)=>{let{type:r,is3D:i,codec:a}=zt[e.name],o=k(e,a,t,n);return o.series??=[],o.axIds??=[],i?{type:r,is3D:i,...o}:{type:r,...o}},write:(e,t)=>{let n=(e=>`${e.type}${e.is3D?`3D`:``}Chart`)(t),{type:r,is3D:i,...a}=Wt(t);A(e,`c:${n}`,a,zt[n].codec)}},Vt=[`ctr`,`l`,`r`,`t`,`b`],Ht=e=>{switch(e.type){case`bar`:return e.is3D?[]:e.grouping===`stacked`||e.grouping===`percentStacked`?[`ctr`,`inEnd`,`inBase`]:[`ctr`,`inEnd`,`inBase`,`outEnd`];case`line`:return e.is3D?[]:Vt;case`stock`:case`scatter`:case`bubble`:return Vt;case`pie`:case`ofPie`:return[`ctr`,`inEnd`,`outEnd`,`bestFit`];default:return[]}},Ut=(e,t)=>t?.dLblPos!==void 0&&!e.includes(t.dLblPos),Wt=e=>{let t=Ht(e),n=e=>{if(!Ut(t,e))return e;let{dLblPos:n,...r}=e;return r},r=e=>e.labels?{...n(e),labels:e.labels.map(n)}:n(e);return{...e,...e.dLbls?{dLbls:r(e.dLbls)}:{},series:e.series.map(e=>e.dLbls?{...e,dLbls:r(e.dLbls)}:e)}},Gt={fields:[M(`logBase`,`num`),M(`orientation`,`str`),M(`max`,`num`),M(`min`,`num`)]},Kt={fields:[P(`layout`,V),P(`tx`,xt),z(),B()]},qt={fields:[M(`custUnit`,`num`),M(`builtInUnit`,`str`),P(`dispUnitsLbl`,Kt)]},Jt=()=>[M(`axId`,`int`),P(`scaling`,Gt),M(`delete`,`bool`),M(`axPos`,`str`),Y(`majorGridlines`),Y(`minorGridlines`),P(`title`,Ct),P(`numFmt`,St),M(`majorTickMark`,`str`),M(`minorTickMark`,`str`),M(`tickLblPos`,`str`),z(),B(),M(`crossAx`,`int`),M(`crosses`,`str`),M(`crossesAt`,`num`)],Yt={valAx:{type:`val`,codec:{fields:[...Jt(),M(`crossBetween`,`str`),M(`majorUnit`,`num`),M(`minorUnit`,`num`),P(`dispUnits`,qt)]}},catAx:{type:`cat`,codec:{fields:[...Jt(),M(`auto`,`bool`),M(`lblAlgn`,`str`),M(`lblOffset`,`int`),M(`tickLblSkip`,`int`),M(`tickMarkSkip`,`int`),M(`noMultiLvlLbl`,`bool`)]}},dateAx:{type:`date`,codec:{fields:[...Jt(),M(`auto`,`bool`),M(`lblOffset`,`int`),M(`baseTimeUnit`,`str`),M(`majorUnit`,`num`),M(`majorTimeUnit`,`str`),M(`minorUnit`,`num`),M(`minorTimeUnit`,`str`)]}},serAx:{type:`ser`,codec:{fields:[...Jt(),M(`tickLblSkip`,`int`),M(`tickMarkSkip`,`int`)]}}},Xt={tags:Object.keys(Yt),key:`axes`,ns:`c`,many:!0,read:(e,t,n)=>({type:Yt[e.name].type,...k(e,Yt[e.name].codec,t,n)}),write:(e,t)=>{let{type:n,...r}=t,i=`${n}Ax`;A(e,`c:${i}`,r,Yt[i].codec)}},Zt={fields:[M(`showHorzBorder`,`bool`),M(`showVertBorder`,`bool`),M(`showOutline`,`bool`),M(`showKeys`,`bool`),z(),B()]},Qt={fields:[P(`layout`,V),Bt,Xt,P(`dTable`,Zt),z()],afterRead:e=>{e.groups??=[],e.axes??=[]}},$t={fields:[M(`rotX`,`int`),M(`hPercent`,`int`),M(`rotY`,`int`),M(`depthPercent`,`int`),M(`rAngAx`,`bool`),M(`perspective`,`int`)]},en={fields:[M(`thickness`,`int`),z()]},tn={fields:[M(`idx`,`int`),M(`delete`,`bool`),B()]},nn={fields:[M(`legendPos`,`str`),P(`legendEntry`,tn,`entries`,{many:!0}),P(`layout`,V),M(`overlay`,`bool`),z(),B()]},rn={fields:[P(`title`,Ct),M(`autoTitleDeleted`,`bool`),P(`view3D`,$t),P(`floor`,en),P(`sideWall`,en),P(`backWall`,en),P(`plotArea`,Qt),P(`legend`,nn),M(`plotVisOnly`,`bool`),M(`dispBlanksAs`,`str`),M(`showDLblsOverMax`,`bool`)]},an={fields:[N(`name`),M(`fmtId`,`int`)]},on={fields:[M(`date1904`,`bool`),M(`lang`,`str`),M(`roundedCorners`,`bool`),M(`style`,`int`),P(`pivotSource`,an),P(`chart`,rn),z(),B()]},sn=e=>{let t=x(e);if(!t||t.name!==`chartSpace`)return null;let n=xe(t,ye);if(!ge(Se(t,n)))return null;let r=new Oe(e,n);return{model:k(t,on,ye,r),kept:r.kept,reordered:r.reordered}},cn=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
|
|
3
3
|
`,ln=e=>{let t={...e.unknown?.attributes},n=(e,n)=>{t[`xmlns:${e}`]??=n};n(w.c,ce),n(w.a,ue),n(w.r,fe);let r=new Ce().raw(cn);return((e,t)=>{A(e,`c:chartSpace`,t,on)})(r,{...e,unknown:{...e.unknown,attributes:t}}),r.toString()},un=(e,t)=>{if(t&&(n=e,!(n.chart?.plotArea?.groups??[]).some(e=>{let t=Ht(e),n=e=>Ut(t,e)||!!e?.labels?.some(e=>Ut(t,e));return n(e.dLbls)||e.series.some(e=>n(e.dLbls))}))){let n=sn(t);if(n&&JSON.stringify(n.model)===JSON.stringify(e))return t}var n;return ln(e)},X=(e,t,n=e,r)=>P(e,t,n,{ns:`cx`,many:r}),Z=()=>X(`spPr`,Ze),Q=()=>X(`txPr`,ot),dn=()=>X(`numFmt`,St),fn=e=>({name:e,key:e,read:e=>{if(e===`auto`)return`auto`;let t=Number(e);return e.trim()!==``&&Number.isFinite(t)?t:void 0},write:e=>String(e)}),pn=e=>T(e).filter(([e])=>e!==`xmlns`&&!e.startsWith(`xmlns:`)),mn=e=>({tags:[e],key:e,ns:`cx`,read:e=>{if(S(e).length>0)return;let t={f:C(e)};for(let[n,r]of pn(e)){if(n!==`dir`||r!==`col`&&r!==`row`)return;t.dir=r}return t.f===``?void 0:t},write:(t,n)=>{let r=j(`cx`,e);t.open(r,n.dir?[[`dir`,n.dir]]:null).text(n.f).close(r)}}),hn={attributes:[F(`ptCount`,`int`),F(`formatCode`,`str`),F(`name`,`str`)],fields:[{tags:[`pt`],key:`points`,ns:`cx`,many:!0,read:e=>{if(S(e).length>0)return;let t=pn(e);if(t.length!==1||t[0][0]!==`idx`)return;let n=Number(t[0][1]);return Number.isInteger(n)&&O(String(n))===O(t[0][1])?{idx:n,v:C(e)}:void 0},write:(e,t)=>{let n=j(`cx`,`pt`);t.v===``?e.open(n,[[`idx`,String(t.idx)]],!0):e.open(n,[[`idx`,String(t.idx)]]).text(t.v).close(n)}}]},gn={attributes:[F(`type`,`str`)],fields:[mn(`f`),mn(`nf`),X(`lvl`,hn,`levels`,!0)]},_n=new Set([`val`,`x`,`y`,`size`,`colorVal`]),vn=new Set([`cat`,`colorStr`,`entityId`]),yn={fields:[X(`data`,{attributes:[F(`id`,`int`)],fields:[{tags:[`numDim`,`strDim`],key:`dimensions`,ns:`cx`,many:!0,read:(e,t,n)=>{let r=k(e,gn,t,n);return(e.name===`numDim`?_n:vn).has(r.type)?r:void 0},write:(e,t)=>{A(e,j(`cx`,_n.has(t.type)?`numDim`:`strDim`),t,gn)}}],afterRead:e=>{e.dimensions??=[]}},`data`,!0)],afterRead:e=>{e.data??=[]}},bn={fields:[X(`txData`,{fields:[mn(`f`),N(`v`,`v`,`cx`)]}),X(`rich`,ot)]},xn=()=>[F(`pos`,`str`),F(`align`,`str`),F(`overlay`,`bool`)],Sn={attributes:xn(),fields:[X(`tx`,bn),Z(),Q()]},Cn={attributes:xn(),fields:[Z(),Q()]},wn={attributes:[F(`seriesName`,`bool`),F(`categoryName`,`bool`),F(`value`,`bool`)],fields:[]},Tn=()=>[dn(),Z(),Q(),X(`visibility`,wn),N(`separator`,`separator`,`cx`)],En={attributes:[F(`idx`,`int`),F(`pos`,`str`)],fields:Tn()},Dn={attributes:[F(`idx`,`int`)],fields:[]},On={attributes:[F(`pos`,`str`)],fields:[...Tn(),X(`dataLabel`,En,`labels`,!0),X(`dataLabelHidden`,Dn,`hiddenLabels`,!0)]},kn={attributes:[F(`idx`,`int`)],fields:[Z()]},An={attributes:[`connectorLines`,`meanLine`,`meanMarker`,`nonoutliers`,`outliers`].map(e=>F(e,`bool`)),fields:[]},jn={attributes:[F(`intervalClosed`,`str`),fn(`underflow`),fn(`overflow`)],fields:[M(`binSize`,`num`,`binSize`,`cx`),M(`binCount`,`int`,`binCount`,`cx`)]},Mn={fields:[{...M(`idx`,`int`,`indexes`,`cx`),many:!0}]},Nn={fields:[M(`parentLabelLayout`,`str`,`parentLabelLayout`,`cx`),M(`regionLabelLayout`,`str`,`regionLabelLayout`,`cx`),X(`visibility`,An),X(`aggregation`,{fields:[]}),X(`binning`,jn),X(`statistics`,{attributes:[F(`quartileMethod`,`str`)],fields:[]}),{tags:[`subtotals`],key:`subtotals`,ns:`cx`,read:(e,t,n)=>{let r=k(e,Mn,t,n);return r.unknown?void 0:r.indexes??[]},write:(e,t)=>{A(e,j(`cx`,`subtotals`),{indexes:t},Mn)}}]},Pn={attributes:[F(`layoutId`,`str`),F(`hidden`,`bool`),F(`ownerIdx`,`int`),F(`uniqueId`,`str`),F(`formatIdx`,`int`)],fields:[X(`tx`,bn),Z(),X(`dataPt`,kn,`points`,!0),X(`dataLabels`,On),M(`dataId`,`int`,`dataId`,`cx`),X(`layoutPr`,Nn),{...M(`axisId`,`int`,`axisIds`,`cx`),many:!0}]},Fn={fields:[X(`plotSurface`,{fields:[Z()]}),X(`series`,Pn,`series`,!0)],afterRead:e=>{e.series??=[]}},In={fields:[X(`tx`,bn),Z(),Q()]},Ln={fields:[Z()]},Rn={attributes:[F(`type`,`str`)],fields:[]},zn={attributes:[F(`id`,`int`),F(`hidden`,`bool`)],fields:[X(`catScaling`,{attributes:[F(`gapWidth`,`num`)],fields:[]}),X(`valScaling`,{attributes:[`max`,`min`,`majorUnit`,`minorUnit`].map(e=>F(e,`num`)),fields:[]}),X(`title`,In),X(`units`,{attributes:[F(`unit`,`str`)],fields:[X(`unitsLabel`,In)]}),X(`majorGridlines`,Ln),X(`minorGridlines`,Ln),X(`majorTickMarks`,Rn),X(`minorTickMarks`,Rn),X(`tickLabels`,{fields:[]}),dn(),Z(),Q()]},Bn={fields:[X(`plotAreaRegion`,Fn),X(`axis`,zn,`axes`,!0),Z()],afterRead:e=>{e.axes??=[]}},Vn={fields:[X(`title`,Sn),X(`plotArea`,Bn),X(`legend`,Cn)]},Hn={fields:[X(`chartData`,yn),X(`chart`,Vn),Z(),Q()]},Un={waterfall:`waterfall`,clusteredColumn:`histogram`,boxWhisker:`boxWhisker`,treemap:`treemap`,sunburst:`sunburst`,funnel:`funnel`,regionMap:`regionMap`},Wn=Object.fromEntries(Object.entries(Un).map(([e,t])=>[t,e])),Gn=new Set(Object.values(Un)),Kn=`paretoLine`,qn={cat:`cat`,val:`val`,x:`xVal`,y:`yVal`,size:`bubbleSize`,colorVal:`color`,colorStr:`color`,entityId:`entityId`},Jn=new Set([`val`,`x`,`y`,`size`,`colorVal`]),Yn=[`cat`,`colorStr`,`entityId`,`x`,`y`,`val`,`size`,`colorVal`],$=e=>{for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e},Xn=e=>$({f:e.f,dir:e.dir}),Zn=e=>e&&$({strRef:e.txData?.f?Xn(e.txData.f):void 0,v:e.txData?.v,rich:e.rich,unknown:e.unknown}),Qn=e=>e&&$({tx:Zn(e.tx),overlay:e.overlay,spPr:e.spPr,txPr:e.txPr,pos:e.pos,align:e.align,unknown:e.unknown}),$n=e=>$({numFmt:e.numFmt,spPr:e.spPr,txPr:e.txPr,dLblPos:e.pos,showSerName:e.visibility?.seriesName,showCatName:e.visibility?.categoryName,showVal:e.visibility?.value,separator:e.separator,unknown:e.unknown}),er=e=>{if(!e)return;let t=$n(e),n=[...(e.labels??[]).map(e=>({idx:e.idx,...$n(e)})),...(e.hiddenLabels??[]).map(e=>({idx:e.idx,delete:!0}))];return n.length>0&&(t.labels=n),t},tr=(e,t)=>{let n=(e??[]).map(e=>({...e}));for(let e of[...t??[]].sort((e,t)=>e-t)){let t=n.find(t=>t.idx===e);t?t.subtotal=!0:n.push({idx:e,subtotal:!0})}return n.length>0?n:void 0},nr=e=>{if(!e)return;let{subtotals:t,...n}=e;return Object.keys(n).length>0?n:void 0},rr=e=>$({ptCount:e.ptCount,formatCode:e.formatCode,name:e.name,points:(e.points??[]).map(e=>({idx:e.idx,v:e.v})),unknown:e.unknown}),ir=e=>{let t=Jn.has(e.type),n=e.levels?.map(rr),r={};return e.f?r[t?`numRef`:`strRef`]=$({...Xn(e.f),cache:n?{levels:n}:void 0}):r[t?`numLit`:`strLit`]=$({levels:n}),e.nf&&(r.nf=Xn(e.nf)),e.unknown&&(r.unknown=e.unknown),r},ar=(e,t)=>{let n=$({idx:e.formatIdx,hidden:e.hidden,uniqueId:e.uniqueId,tx:Zn(e.tx),spPr:e.spPr,points:tr(e.points,e.layoutPr?.subtotals),dLbls:er(e.dataLabels),layoutPr:nr(e.layoutPr),unknown:e.unknown});for(let e of t?.dimensions??[]){let t=qn[e.type];t&&!n[t]&&(n[t]=ir(e))}return n},or=e=>$({idx:e.formatIdx,hidden:e.hidden,uniqueId:e.uniqueId,tx:Zn(e.tx),spPr:e.spPr,points:tr(e.points,e.layoutPr?.subtotals),dLbls:er(e.dataLabels),layoutPr:nr(e.layoutPr),axIds:e.axisIds,unknown:e.unknown}),sr=(e,t)=>{let n=new Map(t.map(e=>[e.id,e])),r=[],i=[],a=null;for(let t of e?.series??[]){if(t.layoutId===Kn){let e=t.ownerIdx===void 0?null:i[t.ownerIdx];e&&!e.cumulativeLine&&(e.cumulativeLine=or(t)),i.push(null);continue}let e=Un[t.layoutId]??t.layoutId,o=t.axisIds??[];a&&a.type===e&&JSON.stringify(a.axIds)===JSON.stringify(o)||(a={type:e,series:[],axIds:o},r.push(a));let s=ar(t,t.dataId===void 0?void 0:n.get(t.dataId));a.series.push(s),i.push(s)}return r},cr=e=>{let t=e.catScaling??e.valScaling;return $({type:e.catScaling||!e.valScaling?`cat`:`val`,axId:e.id,scaling:$({max:e.valScaling?.max,min:e.valScaling?.min,gapWidth:e.catScaling?.gapWidth,unknown:t?.unknown}),delete:e.hidden,majorGridlines:e.majorGridlines,minorGridlines:e.minorGridlines,title:Qn(e.title),numFmt:e.numFmt,majorTickMark:e.majorTickMarks?.type,minorTickMark:e.minorTickMarks?.type,tickLblPos:e.tickLabels?void 0:`none`,spPr:e.spPr,txPr:e.txPr,majorUnit:e.valScaling?.majorUnit,minorUnit:e.valScaling?.minorUnit,dispUnits:e.units&&$({builtInUnit:e.units.unit,dispUnitsLbl:Qn(e.units.unitsLabel),unknown:e.units.unknown}),unknown:e.unknown})},lr=e=>e&&$({txData:e.strRef||e.v!==void 0?$({f:e.strRef?Xn(e.strRef):void 0,v:e.v}):void 0,rich:e.rich,unknown:e.unknown}),ur=e=>e&&$({tx:lr(e.tx),spPr:e.spPr,txPr:e.txPr,unknown:e.unknown}),dr=e=>{let t=e.showSerName!==void 0||e.showCatName!==void 0||e.showVal!==void 0;return $({pos:e.dLblPos,numFmt:e.numFmt,spPr:e.spPr,txPr:e.txPr,visibility:t?$({seriesName:e.showSerName,categoryName:e.showCatName,value:e.showVal}):void 0,separator:e.separator,unknown:e.unknown})},fr=e=>!0===e.delete&&Object.keys(e).every(e=>e===`idx`||e===`delete`),pr=e=>{if(!e)return;let t=dr(e),n=(e.labels??[]).filter(e=>!fr(e)).map(e=>({idx:e.idx,...dr(e)})),r=(e.labels??[]).filter(fr).map(e=>({idx:e.idx}));return n.length>0&&(t.labels=n),r.length>0&&(t.hiddenLabels=r),t},mr=e=>{let t=(e??[]).filter(e=>Object.keys(e).some(e=>e!==`idx`&&e!==`subtotal`)).map(({subtotal:e,...t})=>t);return t.length>0?t:void 0},hr=(e,t,n)=>{let r=(t??[]).filter(e=>e.subtotal).map(e=>e.idx).sort((e,t)=>e-t);return r.length!==0||n?{...e,subtotals:r}:e},gr=e=>$({ptCount:e.ptCount,formatCode:e.formatCode,name:e.name,points:e.points.length>0?e.points.map(e=>({idx:e.idx,v:e.v})):void 0,unknown:e.unknown}),_r=(e,t)=>e===`color`?t.strRef||t.strLit?`colorStr`:`colorVal`:Object.keys(qn).find(t=>qn[t]===e),vr=e=>{let t=[];for(let n of[`cat`,`val`,`xVal`,`yVal`,`bubbleSize`,`color`,`entityId`]){let r=e[n];if(!r)continue;let i=r.numRef??r.strRef,a=(i?i.cache:r.numLit??r.strLit)?.levels;t.push($({type:_r(n,r),f:i?Xn(i):void 0,nf:r.nf?Xn(r.nf):void 0,levels:a&&a.length>0?a.map(gr):void 0,unknown:r.unknown}))}return t.sort((e,t)=>Yn.indexOf(e.type)-Yn.indexOf(t.type))},yr=e=>{let t=e.scaling??{},n=e.type===`cat`||e.type===`date`;return $({id:e.axId,hidden:e.delete,catScaling:n?$({gapWidth:t.gapWidth,unknown:t.unknown}):void 0,valScaling:n?void 0:$({max:t.max,min:t.min,majorUnit:e.majorUnit,minorUnit:e.minorUnit,unknown:t.unknown}),title:ur(e.title),units:e.dispUnits&&$({unit:e.dispUnits.builtInUnit,unitsLabel:ur(e.dispUnits.dispUnitsLbl),unknown:e.dispUnits.unknown}),majorGridlines:e.majorGridlines,minorGridlines:e.minorGridlines,majorTickMarks:e.majorTickMark?{type:e.majorTickMark}:void 0,minorTickMarks:e.minorTickMark?{type:e.minorTickMark}:void 0,tickLabels:e.tickLblPos===`none`?void 0:{},numFmt:e.numFmt,spPr:e.spPr,txPr:e.txPr,unknown:e.unknown})},br=e=>{let t=e.chart,n=t?.plotArea,r=[],i=[],a=[];for(let e of n?.groups??[]){let t=Wn[e.type];if(t)for(let n of e.series){let o=vr(n),s;if(o.length>0){let e=JSON.stringify(o);s=a.indexOf(e),s===-1&&(s=i.length,i.push({id:s,dimensions:o}),a.push(e))}let c=r.length;r.push($({layoutId:t,hidden:n.hidden,uniqueId:n.uniqueId,formatIdx:n.idx,tx:lr(n.tx),spPr:n.spPr,points:mr(n.points),dataLabels:pr(n.dLbls),dataId:s,layoutPr:hr(n.layoutPr,n.points,e.type===`waterfall`),axisIds:e.axIds.length>0?e.axIds:void 0,unknown:n.unknown}));let l=n.cumulativeLine;l&&r.push($({layoutId:Kn,hidden:l.hidden,ownerIdx:c,uniqueId:l.uniqueId,formatIdx:l.idx,tx:lr(l.tx),spPr:l.spPr,points:mr(l.points),dataLabels:pr(l.dLbls),layoutPr:hr(l.layoutPr,l.points,!1),axisIds:l.axIds,unknown:l.unknown}))}}let o=t?.legend;return $({chartData:{data:i},chart:$({title:(s=t?.title,s&&$({pos:s.pos,align:s.align,overlay:s.overlay,tx:lr(s.tx),spPr:s.spPr,txPr:s.txPr,unknown:s.unknown})),plotArea:$({plotAreaRegion:$({plotSurface:n?.plotSurface,series:r}),axes:(n?.axes??[]).map(yr),spPr:n?.spPr,unknown:n?.unknown}),legend:o&&$({pos:o.legendPos===`tr`?`r`:o.legendPos,align:o.align,overlay:o.overlay,spPr:o.spPr,txPr:o.txPr,unknown:o.unknown}),unknown:t?.unknown}),spPr:e.spPr,txPr:e.txPr,unknown:e.unknown});var s},xr=(e,t)=>{if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null||Array.isArray(e)!==Array.isArray(t))return!1;let n=e=>Object.keys(e).filter(t=>e[t]!==void 0),r=n(e),i=n(t);return r.length===i.length&&r.every(n=>xr(e[n],t[n]))},Sr=(e,t)=>xr(e,br(t)),Cr=e=>{let t=x(e);if(!t||t.name!==`chartSpace`)return null;let n=xe(t,ye);if(!ve(Se(t,n)))return null;let r=new Oe(e,n),i=k(t,Hn,ye,r),a=(e=>{let t=e.chart,n=t?.plotArea,r=t?.legend;return $({chart:$({title:Qn(t?.title),plotArea:$({groups:sr(n?.plotAreaRegion,e.chartData?.data??[]),axes:(n?.axes??[]).map(cr),spPr:n?.spPr,plotSurface:n?.plotAreaRegion?.plotSurface,unknown:n?.unknown}),legend:r&&$({legendPos:r.pos,align:r.align,overlay:r.overlay,spPr:r.spPr,txPr:r.txPr,unknown:r.unknown}),unknown:t?.unknown}),spPr:e.spPr,txPr:e.txPr,unknown:e.unknown})})(i);return{model:a,kept:r.kept,reordered:r.reordered,lossy:!Sr(i,a)}},wr=e=>{let t={...e.unknown?.attributes},n=(e,n)=>{t[`xmlns:${e}`]??=n};n(w.a,ue),n(w.r,fe),n(w.cx,me);let r=br(e),i=new Ce().raw(cn);return((e,t)=>{A(e,j(`cx`,`chartSpace`),t,Hn)})(i,{...r,unknown:{...r.unknown,attributes:t}}),i.toString()},Tr=(e,t)=>{if(t){let n=Cr(t);if(n&&JSON.stringify(n.model)===JSON.stringify(e))return t}return wr(e)},Er={chart:{relType:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart`,contentType:`application/vnd.openxmlformats-officedocument.drawingml.chart+xml`,path:`../charts/chart{n}.xml`,graphicUri:ce},chartEx:{relType:`http://schemas.microsoft.com/office/2014/relationships/chartEx`,contentType:`application/vnd.ms-office.chartex+xml`,path:`../charts/chartEx{n}.xml`,graphicUri:me}},Dr=new Set([`area`,`bar`,`line`,`pie`,`doughnut`,`ofPie`,`scatter`,`bubble`,`radar`,`stock`,`surface`]),Or=e=>e===Er.chartEx.relType?`chartEx`:e===Er.chart.relType?`chart`:null,kr=e=>Dr.has(e)?`chart`:Gn.has(e)?`chartEx`:null,Ar=e=>{let t=sn(e);if(t)return{model:t.model,family:`chart`,kept:t.kept,lossy:!1};let n=Cr(e);return n?{model:n.model,family:`chartEx`,kept:n.kept,lossy:n.lossy}:null},jr=e=>{if(Array.isArray(e))return e.map(jr);if(typeof e!=`object`||!e)return e;let t={};for(let[n,r]of Object.entries(e))n!==`unknown`&&(t[n]=jr(r));return t},Mr=(e,t)=>{let n=e.chart?.plotArea?.groups??[],r=n.map(e=>kr(e.type)).find(e=>e!==null)??t?.family??`chart`,i=n.filter(e=>kr(e.type)!==r).map(e=>e.type),a=e;if(i.length>0){let t={...e.chart.plotArea,groups:n.filter(e=>kr(e.type)===r)};a={...e,chart:{...e.chart,plotArea:t}}}let o=(t?.family??r)===r;o||(a=jr(a));let s=o?t?.xml:void 0;return{family:r,leftOut:i,xml:r===`chartEx`?Tr(a,s):un(a,s)}};export{c as a,l as c,Or as i,u as l,Er as n,g as o,Mr as r,h as s,Ar as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./CQukCzhuewMuFOlO.js";import{
|
|
1
|
+
import{i as e}from"./CQukCzhuewMuFOlO.js";import{$i as t,At as n,Er as r,Hi as i,L as a,M as o,Ni as s,O as c,Pr as l,Rn as u,Sr as d,Tt as f,Vt as p,W as m,Yr as h,Z as g,_i as _,da as v,jn as y,lr as ee,n as b,ni as x,oi as te,ra as S,rt as C,u as w,vn as ne,w as re,wn as ie,y as T}from"./CKdQfdZJGJFgnrr9.js";function E(e){console&&console.error&&console.error(`Error: ${e}`)}function D(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function ae(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function O(e){function t(){}t.prototype=e;let n=new t;function r(){return typeof n.bar}return r(),r(),e}var k=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}},A=class extends k{constructor(e){super([]),this.idx=1,Object.assign(this,B(e))}set definition(e){}get definition(){return this.referencedRule===void 0?[]:this.referencedRule.definition}accept(e){e.visit(this)}},j=class extends k{constructor(e){super(e.definition),this.orgText=``,Object.assign(this,B(e))}},M=class extends k{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,B(e))}},N=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},P=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},F=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},I=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},L=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},R=class extends k{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,B(e))}},z=class{constructor(e){this.idx=1,Object.assign(this,B(e))}accept(e){e.visit(this)}};function oe(e){function t(e){return e.map(oe)}if(e instanceof A){let t={type:`NonTerminal`,name:e.nonTerminalName,idx:e.idx};return typeof e.label==`string`&&(t.label=e.label),t}if(e instanceof M)return{type:`Alternative`,definition:t(e.definition)};if(e instanceof N)return{type:`Option`,idx:e.idx,definition:t(e.definition)};if(e instanceof P)return{type:`RepetitionMandatory`,idx:e.idx,definition:t(e.definition)};if(e instanceof F)return{type:`RepetitionMandatoryWithSeparator`,idx:e.idx,separator:oe(new z({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof L)return{type:`RepetitionWithSeparator`,idx:e.idx,separator:oe(new z({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof I)return{type:`Repetition`,idx:e.idx,definition:t(e.definition)};if(e instanceof R)return{type:`Alternation`,idx:e.idx,definition:t(e.definition)};if(e instanceof z){let t={type:`Terminal`,name:e.terminalType.name,label:(n=e.terminalType,typeof(r=n).LABEL==`string`&&r.LABEL!==``?n.LABEL:n.name),idx:e.idx};typeof e.label==`string`&&(t.terminalLabel=e.label);let i=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=i instanceof RegExp?i.source:i),t}if(e instanceof j)return{type:`Rule`,name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error(`non exhaustive match`);var n,r}function B(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var se=class{visit(e){let t=e;switch(t.constructor){case A:return this.visitNonTerminal(t);case M:return this.visitAlternative(t);case N:return this.visitOption(t);case P:return this.visitRepetitionMandatory(t);case F:return this.visitRepetitionMandatoryWithSeparator(t);case L:return this.visitRepetitionWithSeparator(t);case I:return this.visitRepetition(t);case R:return this.visitAlternation(t);case z:return this.visitTerminal(t);case j:return this.visitRule(t);default:throw Error(`non exhaustive match`)}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function ce(e,t=[]){return e instanceof N||e instanceof I||e instanceof L||(e instanceof R?e.definition.some(e=>ce(e,t)):!(e instanceof A&&t.includes(e))&&e instanceof k&&(e instanceof A&&t.push(e),e.definition.every(e=>ce(e,t))))}function V(e){if(e instanceof A)return`SUBRULE`;if(e instanceof N)return`OPTION`;if(e instanceof R)return`OR`;if(e instanceof P)return`AT_LEAST_ONE`;if(e instanceof F)return`AT_LEAST_ONE_SEP`;if(e instanceof L)return`MANY_SEP`;if(e instanceof I)return`MANY`;if(e instanceof z)return`CONSUME`;throw Error(`non exhaustive match`)}var le=class{walk(e,t=[]){e.definition.forEach((n,r)=>{let i=e.definition.slice(r+1);if(n instanceof A)this.walkProdRef(n,i,t);else if(n instanceof z)this.walkTerminal(n,i,t);else if(n instanceof M)this.walkFlat(n,i,t);else if(n instanceof N)this.walkOption(n,i,t);else if(n instanceof P)this.walkAtLeastOne(n,i,t);else if(n instanceof F)this.walkAtLeastOneSep(n,i,t);else if(n instanceof L)this.walkManySep(n,i,t);else if(n instanceof I)this.walkMany(n,i,t);else{if(!(n instanceof R))throw Error(`non exhaustive match`);this.walkOr(n,i,t)}})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){let r=t.concat(n);this.walk(e,r)}walkOption(e,t,n){let r=t.concat(n);this.walk(e,r)}walkAtLeastOne(e,t,n){let r=[new N({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){let r=ue(e,t,n);this.walk(e,r)}walkMany(e,t,n){let r=[new N({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){let r=ue(e,t,n);this.walk(e,r)}walkOr(e,t,n){let r=t.concat(n);e.definition.forEach(e=>{let t=new M({definition:[e]});this.walk(t,r)})}};function ue(e,t,n){return[new N({definition:[new z({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function de(e){if(e instanceof A)return de(e.referencedRule);if(e instanceof z)return[e.terminalType];if(function(e){return e instanceof M||e instanceof N||e instanceof I||e instanceof P||e instanceof F||e instanceof L||e instanceof z||e instanceof j}(e))return function(e){let t=[],n=e.definition,r,i=0,a=n.length>i,o=!0;for(;a&&o;)r=n[i],o=ce(r),t=t.concat(de(r)),i+=1,a=n.length>i;return[...new Set(t)]}(e);if(function(e){return e instanceof R}(e))return function(e){let t=e.definition.map(e=>de(e));return[...new Set(t.flat())]}(e);throw Error(`non exhaustive match`)}var fe=`_~IN~_`,pe=class extends le{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){let r=(i=e.referencedRule,a=e.idx,i.name+a+fe+this.topProd.name);var i,a;let o=de(new M({definition:t.concat(n)}));this.follows[r]=o}};function H(e){return e.charCodeAt(0)}function me(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function U(e,t){if(!0===e[t])throw`duplicate flag `+t;e[t],e[t]=!0}function W(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`);return!0}function he(){throw Error(`Internal Error - Should never get here!`)}function ge(e){return e.type===`Character`}var _e=[];for(let e=H(`0`);e<=H(`9`);e++)_e.push(e);var ve=[H(`_`)].concat(_e);for(let e=H(`a`);e<=H(`z`);e++)ve.push(e);for(let e=H(`A`);e<=H(`Z`);e++)ve.push(e);var ye=[H(` `),H(`\f`),H(`
|
|
2
2
|
`),H(`\r`),H(` `),H(`\v`),H(` `),H(`\xA0`),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(`\u2028`),H(`\u2029`),H(` `),H(` `),H(` `),H(``)],be=/[0-9a-fA-F]/,xe=/[0-9]/,Se=/[1-9]/,Ce=class{visitChildren(e){for(let t in e){let n=e[t];e.hasOwnProperty(t)&&(n.type===void 0?Array.isArray(n)&&n.forEach(e=>{this.visit(e)},this):this.visit(n))}}visit(e){switch(e.type){case`Pattern`:this.visitPattern(e);break;case`Flags`:this.visitFlags(e);break;case`Disjunction`:this.visitDisjunction(e);break;case`Alternative`:this.visitAlternative(e);break;case`StartAnchor`:this.visitStartAnchor(e);break;case`EndAnchor`:this.visitEndAnchor(e);break;case`WordBoundary`:this.visitWordBoundary(e);break;case`NonWordBoundary`:this.visitNonWordBoundary(e);break;case`Lookahead`:this.visitLookahead(e);break;case`NegativeLookahead`:this.visitNegativeLookahead(e);break;case`Lookbehind`:this.visitLookbehind(e);break;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);break;case`Character`:this.visitCharacter(e);break;case`Set`:this.visitSet(e);break;case`Group`:this.visitGroup(e);break;case`GroupBackReference`:this.visitGroupBackReference(e);break;case`Quantifier`:this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}},we={},Te=new class{constructor(){this.idx=0,this.input=``,this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar(`/`);let t=this.disjunction();this.consumeChar(`/`);let n={type:`Flags`,loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case`g`:U(n,`global`);break;case`i`:U(n,`ignoreCase`);break;case`m`:U(n,`multiLine`);break;case`u`:U(n,`unicode`);break;case`y`:U(n,`sticky`)}if(this.idx!==this.input.length)throw Error(`Redundant input: `+this.input.substring(this.idx));return{type:`Pattern`,flags:n,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()===`|`;)this.consumeChar(`|`),e.push(this.alternative());return{type:`Disjunction`,value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:`Alternative`,value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case`^`:return{type:`StartAnchor`,loc:this.loc(e)};case`$`:return{type:`EndAnchor`,loc:this.loc(e)};case`\\`:switch(this.popChar()){case`b`:return{type:`WordBoundary`,loc:this.loc(e)};case`B`:return{type:`NonWordBoundary`,loc:this.loc(e)}}throw Error(`Invalid Assertion Escape`);case`(`:let t;switch(this.consumeChar(`?`),this.popChar()){case`=`:t=`Lookahead`;break;case`!`:t=`NegativeLookahead`;break;case`<`:switch(this.popChar()){case`=`:t=`Lookbehind`;break;case`!`:t=`NegativeLookbehind`}}W(t);let n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}return he()}quantifier(e=!1){let t,n=this.idx;switch(this.popChar()){case`*`:t={atLeast:0,atMost:1/0};break;case`+`:t={atLeast:1,atMost:1/0};break;case`?`:t={atLeast:0,atMost:1};break;case`{`:let n=this.integerIncludingZero();switch(this.popChar()){case`}`:t={atLeast:n,atMost:n};break;case`,`:let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:n,atMost:e}):t={atLeast:n,atMost:1/0},this.consumeChar(`}`)}if(!0===e&&t===void 0)return;W(t)}if(!0!==e||t!==void 0)return W(t)?(this.peekChar(0)===`?`?(this.consumeChar(`?`),t.greedy=!1):t.greedy=!0,t.type=`Quantifier`,t.loc=this.loc(n),t):void 0}atom(){let e,t=this.idx;switch(this.peekChar()){case`.`:e=this.dotAll();break;case`\\`:e=this.atomEscape();break;case`[`:e=this.characterClass();break;case`(`:e=this.group()}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),W(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):he()}dotAll(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[H(`
|
|
3
3
|
`),H(`\r`),H(`\u2028`),H(`\u2029`)]}}atomEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:return this.decimalEscapeAtom();case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:`GroupBackReference`,value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case`d`:e=_e;break;case`D`:e=_e,t=!0;break;case`s`:e=ye;break;case`S`:e=ye,t=!0;break;case`w`:e=ve;break;case`W`:e=ve,t=!0}return W(e)?{type:`Set`,value:e,complement:t}:he()}controlEscapeAtom(){let e;switch(this.popChar()){case`f`:e=H(`\f`);break;case`n`:e=H(`
|
|
4
4
|
`);break;case`r`:e=H(`\r`);break;case`t`:e=H(` `);break;case`v`:e=H(`\v`)}return W(e)?{type:`Character`,value:e}:he()}controlLetterEscapeAtom(){this.consumeChar(`c`);let e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error(`Invalid `);return{type:`Character`,value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar(`0`),{type:`Character`,value:H(`\0`)}}hexEscapeSequenceAtom(){return this.consumeChar(`x`),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar(`u`),this.parseHexDigits(4)}identityEscapeAtom(){return{type:`Character`,value:H(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
@@ -7,15 +7,15 @@ import{i as e}from"./CQukCzhuewMuFOlO.js";import{Bn as t,D as n,Ei as r,En as i,
|
|
|
7
7
|
`:case`\r`:case`\u2028`:case`\u2029`:case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:throw Error(`TBD`);default:return{type:`Character`,value:H(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case`g`:case`i`:case`m`:case`u`:case`y`:return!0;default:return!1}}isRangeDash(){return this.peekChar()===`-`&&this.isClassAtom(1)}isDigit(){return xe.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case`]`:case`
|
|
8
8
|
`:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case`.`:case`\\`:case`[`:case`(`:return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case`^`:case`$`:return!0;case`\\`:switch(this.peekChar(1)){case`b`:case`B`:return!0;default:return!1}case`(`:return this.peekChar(1)===`?`&&(this.peekChar(2)===`=`||this.peekChar(2)===`!`||this.peekChar(2)===`<`&&(this.peekChar(3)===`=`||this.peekChar(3)===`!`));default:return!1}}isQuantifier(){let e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:case`/`:case`
|
|
9
9
|
`:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}parseHexDigits(e){let t=``;for(let n=0;n<e;n++){let e=this.popChar();if(!1===be.test(e))throw Error(`Expecting a HexDecimal digits`);t+=e}return{type:`Character`,value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error(`Expected: '`+e+`' but found: '`+this.input[this.idx]+`' at offset: `+this.idx);if(this.idx>=this.input.length)throw Error(`Unexpected end of input`);this.idx++}loc(e){return{begin:e,end:this.idx}}};function Ee(e){let t=e.toString();if(we.hasOwnProperty(t))return we[t];{let e=Te.pattern(t);return we[t]=e,e}}var De=`Complement Sets are not supported for first char optimization`,Oe=`Unable to use "first char" lexer optimizations:
|
|
10
|
-
`;function ke(e,t=!1){try{let t=Ee(e);return Ae(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===De)t&&
|
|
10
|
+
`;function ke(e,t=!1){try{let t=Ee(e);return Ae(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===De)t&&D(`${Oe}\tUnable to optimize: < ${e.toString()} >\n\tComplement Sets cannot be automatically optimized.\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n=``;t&&(n=`
|
|
11
11
|
This will disable the lexer's first char optimizations.
|
|
12
|
-
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),
|
|
13
|
-
`],tracer:(e,t)=>t()},t)).tracer,r;n(`initCharCodeToOptimizedIndexMap`,()=>{(function(){if(Ye.length===0){Ye=Array(65536);for(let e=0;e<65536;e++)Ye[e]=e>255?255+~~(e/255):e}})()}),n(`Reject Lexer.NA`,()=>{r=e.filter(e=>e[G]!==J.NA)});let i,a,o,s,c,l,u,d,f,p,m,h=!1;n(`Transform Patterns`,()=>{h=!1,i=r.map(e=>{let t=e[G];if(t instanceof RegExp){let e=t.source;return e.length!==1||e===`^`||e===`$`||e===`.`||t.ignoreCase?e.length!==2||e[0]!==`\\`||[`d`,`D`,`s`,`S`,`t`,`r`,`n`,`t`,`0`,`c`,`b`,`B`,`f`,`v`,`w`,`W`].includes(e[1])?Ve(t):e[1]:e}if(typeof t==`function`)return h=!0,{exec:t};if(typeof t==`object`)return h=!0,t;if(typeof t==`string`){if(t.length===1)return t;{let e=t.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`);return Ve(new RegExp(e))}}throw Error(`non exhaustive match`)})}),n(`misc mapping`,()=>{a=r.map(e=>e.tokenTypeIdx),o=r.map(e=>{let t=e.GROUP;if(t!==J.SKIPPED){if(typeof t==`string`)return t;if(t===void 0)return!1;throw Error(`non exhaustive match`)}}),s=r.map(e=>{let t=e.LONGER_ALT;if(t)return Array.isArray(t)?t.map(e=>r.indexOf(e)):[r.indexOf(t)]}),c=r.map(e=>e.PUSH_MODE),l=r.map(e=>Object.hasOwn(e,`POP_MODE`))}),n(`Line Terminator Handling`,()=>{let e=qe(t.lineTerminatorCharacters);u=r.map(e=>!1),t.positionTracking!==`onlyOffset`&&(u=r.map(t=>Object.hasOwn(t,`LINE_BREAKS`)?!!t.LINE_BREAKS:!1===Ge(t,e)&&Fe(e,t.PATTERN)))}),n(`Misc Mapping #2`,()=>{d=r.map(He),f=i.map(Ue),p=r.reduce((e,t)=>{let n=t.GROUP;return typeof n==`string`&&n!==J.SKIPPED&&(e[n]=[]),e},{}),m=i.map((e,t)=>{let n=o[t]===void 0&&s[t]===void 0?function(e){if(!(e instanceof RegExp)||e.flags!==``)return;let t;try{t=Ee(e)}catch{return}if(t.value.value.length!==1||t.value.value[0].value.length!==1)return;let n,r=t.value.value[0].value[0];for(;r.type===`Group`;){if(r.capturing||r.quantifier!==void 0&&n!==void 0||r.value.value.length!==1||r.value.value[0].value.length!==1)return;n=r.quantifier??n,r=r.value.value[0].value[0]}if(r.type!==`Set`||r.complement||r.quantifier!==void 0&&n!==void 0||(n=r.quantifier??n,n?.atLeast!==1||n.atMost!==1/0||!n.greedy))return;let i=new Uint8Array(128);for(let e of r.value){let t=typeof e==`number`?e:e.from,n=typeof e==`number`?e:e.to;if(t<0||n>=i.length)return;i.fill(1,t,n+1)}return i}(r[t].PATTERN):void 0;return{pattern:i[t],asciiClass:n,longerAlt:s[t],canLineTerminator:u[t],matchType:n===void 0?!1===f[t]?d[t]?1:2:0:3,short:f[t],group:o[t],push:c[t],pop:l[t],tokenTypeIdx:a[t],tokenType:r[t]}})});let g=!0,_=[];return t.safeMode||n(`First Char Optimization`,()=>{_=r.reduce((e,n,r)=>{if(typeof n.PATTERN==`string`)Je(e,K(n.PATTERN.charCodeAt(0)),m[r]);else if(Array.isArray(n.START_CHARS_HINT)){let t;n.START_CHARS_HINT.forEach(n=>{let i=K(typeof n==`string`?n.charCodeAt(0):n);t!==i&&(t=i,Je(e,i,m[r]))})}else if(n.PATTERN instanceof RegExp){if(n.PATTERN.unicode)g=!1,t.ensureOptimizations&&
|
|
12
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),E(`${Oe}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Ae(e,t,n){switch(e.type){case`Disjunction`:for(let r=0;r<e.value.length;r++)Ae(e.value[r],t,n);break;case`Alternative`:let r=e.value;for(let e=0;e<r.length;e++){let i=r[e];switch(i.type){case`EndAnchor`:case`GroupBackReference`:case`Lookahead`:case`NegativeLookahead`:case`Lookbehind`:case`NegativeLookbehind`:case`StartAnchor`:case`WordBoundary`:case`NonWordBoundary`:continue}let a=i;switch(a.type){case`Character`:je(a.value,t,n);break;case`Set`:if(!0===a.complement)throw Error(De);a.value.forEach(e=>{if(typeof e==`number`)je(e,t,n);else{let r=e;if(!0===n)for(let e=r.from;e<=r.to;e++)je(e,t,n);else{for(let e=r.from;e<=r.to&&e<256;e++)je(e,t,n);if(r.to>=256){let e=r.from>=256?r.from:256,n=r.to,i=K(e),a=K(n);for(let e=i;e<=a;e++)t[e]=e}}}});break;case`Group`:Ae(a.value,t,n);break;default:throw Error(`Non Exhaustive Match`)}let o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type===`Group`&&!1===Ne(a)||a.type!==`Group`&&!1===o)break}break;default:throw Error(`non exhaustive match!`)}return Object.values(t)}function je(e,t,n){let r=K(e);t[r]=r,!0===n&&function(e,t){let n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){let e=K(r.charCodeAt(0));t[e]=e}else{let e=n.toLowerCase();if(e!==n){let n=K(e.charCodeAt(0));t[n]=n}}}(e,t)}function Me(e,t){return e.value.find(e=>{if(typeof e==`number`)return t.includes(e);{let n=e;return t.find(e=>n.from<=e&&e<=n.to)!==void 0}})}function Ne(e){let t=e.quantifier;return!(!t||t.atLeast!==0)||!!e.value&&(Array.isArray(e.value)?e.value.every(Ne):Ne(e.value))}var Pe=class extends Ce{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(!0!==this.found){switch(e.type){case`Lookahead`:this.visitLookahead(e);return;case`NegativeLookahead`:this.visitNegativeLookahead(e);return;case`Lookbehind`:this.visitLookbehind(e);return;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){this.targetCharCodes.includes(e.value)&&(this.found=!0)}visitSet(e){e.complement?Me(e,this.targetCharCodes)===void 0&&(this.found=!0):Me(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Fe(e,t){if(t instanceof RegExp){let n=Ee(t),r=new Pe(e);return r.visit(n),r.found}for(let n of t){let t=n.charCodeAt(0);if(e.includes(t))return!0}return!1}var G=`PATTERN`,Ie=`defaultMode`;function Le(e,t){let n=(t=Object.assign({safeMode:!1,positionTracking:`full`,lineTerminatorCharacters:[`\r`,`
|
|
13
|
+
`],tracer:(e,t)=>t()},t)).tracer,r;n(`initCharCodeToOptimizedIndexMap`,()=>{(function(){if(Ye.length===0){Ye=Array(65536);for(let e=0;e<65536;e++)Ye[e]=e>255?255+~~(e/255):e}})()}),n(`Reject Lexer.NA`,()=>{r=e.filter(e=>e[G]!==J.NA)});let i,a,o,s,c,l,u,d,f,p,m,h=!1;n(`Transform Patterns`,()=>{h=!1,i=r.map(e=>{let t=e[G];if(t instanceof RegExp){let e=t.source;return e.length!==1||e===`^`||e===`$`||e===`.`||t.ignoreCase?e.length!==2||e[0]!==`\\`||[`d`,`D`,`s`,`S`,`t`,`r`,`n`,`t`,`0`,`c`,`b`,`B`,`f`,`v`,`w`,`W`].includes(e[1])?Ve(t):e[1]:e}if(typeof t==`function`)return h=!0,{exec:t};if(typeof t==`object`)return h=!0,t;if(typeof t==`string`){if(t.length===1)return t;{let e=t.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`);return Ve(new RegExp(e))}}throw Error(`non exhaustive match`)})}),n(`misc mapping`,()=>{a=r.map(e=>e.tokenTypeIdx),o=r.map(e=>{let t=e.GROUP;if(t!==J.SKIPPED){if(typeof t==`string`)return t;if(t===void 0)return!1;throw Error(`non exhaustive match`)}}),s=r.map(e=>{let t=e.LONGER_ALT;if(t)return Array.isArray(t)?t.map(e=>r.indexOf(e)):[r.indexOf(t)]}),c=r.map(e=>e.PUSH_MODE),l=r.map(e=>Object.hasOwn(e,`POP_MODE`))}),n(`Line Terminator Handling`,()=>{let e=qe(t.lineTerminatorCharacters);u=r.map(e=>!1),t.positionTracking!==`onlyOffset`&&(u=r.map(t=>Object.hasOwn(t,`LINE_BREAKS`)?!!t.LINE_BREAKS:!1===Ge(t,e)&&Fe(e,t.PATTERN)))}),n(`Misc Mapping #2`,()=>{d=r.map(He),f=i.map(Ue),p=r.reduce((e,t)=>{let n=t.GROUP;return typeof n==`string`&&n!==J.SKIPPED&&(e[n]=[]),e},{}),m=i.map((e,t)=>{let n=o[t]===void 0&&s[t]===void 0?function(e){if(!(e instanceof RegExp)||e.flags!==``)return;let t;try{t=Ee(e)}catch{return}if(t.value.value.length!==1||t.value.value[0].value.length!==1)return;let n,r=t.value.value[0].value[0];for(;r.type===`Group`;){if(r.capturing||r.quantifier!==void 0&&n!==void 0||r.value.value.length!==1||r.value.value[0].value.length!==1)return;n=r.quantifier??n,r=r.value.value[0].value[0]}if(r.type!==`Set`||r.complement||r.quantifier!==void 0&&n!==void 0||(n=r.quantifier??n,n?.atLeast!==1||n.atMost!==1/0||!n.greedy))return;let i=new Uint8Array(128);for(let e of r.value){let t=typeof e==`number`?e:e.from,n=typeof e==`number`?e:e.to;if(t<0||n>=i.length)return;i.fill(1,t,n+1)}return i}(r[t].PATTERN):void 0;return{pattern:i[t],asciiClass:n,longerAlt:s[t],canLineTerminator:u[t],matchType:n===void 0?!1===f[t]?d[t]?1:2:0:3,short:f[t],group:o[t],push:c[t],pop:l[t],tokenTypeIdx:a[t],tokenType:r[t]}})});let g=!0,_=[];return t.safeMode||n(`First Char Optimization`,()=>{_=r.reduce((e,n,r)=>{if(typeof n.PATTERN==`string`)Je(e,K(n.PATTERN.charCodeAt(0)),m[r]);else if(Array.isArray(n.START_CHARS_HINT)){let t;n.START_CHARS_HINT.forEach(n=>{let i=K(typeof n==`string`?n.charCodeAt(0):n);t!==i&&(t=i,Je(e,i,m[r]))})}else if(n.PATTERN instanceof RegExp){if(n.PATTERN.unicode)g=!1,t.ensureOptimizations&&E(`${Oe}\tUnable to analyze < ${n.PATTERN.toString()} > pattern.\n\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let i=ke(n.PATTERN,t.ensureOptimizations);i.length===0&&(g=!1),i.forEach(t=>{Je(e,t,m[r])})}}else t.ensureOptimizations&&E(`${Oe}\tTokenType: <${n.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),g=!1;return e},[])}),{emptyGroups:p,patternIdxToConfig:m,charCodeToPatternIdxToConfig:_,hasCustom:h,canBeOptimized:g}}function Re(e,t){let n=[],r=function(e){let t=e.filter(e=>!Object.hasOwn(e,G));return{errors:t.map(e=>({message:`Token Type: ->`+e.name+`<- missing static 'PATTERN' property`,type:q.MISSING_PATTERN,tokenTypes:[e]})),valid:e.filter(e=>!t.includes(e))}}(e);n=n.concat(r.errors);let i=function(e){let t=e.filter(e=>{let t=e[G];return!(t instanceof RegExp||typeof t==`function`||Object.hasOwn(t,`exec`)||typeof t==`string`)});return{errors:t.map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.`,type:q.INVALID_PATTERN,tokenTypes:[e]})),valid:e.filter(e=>!t.includes(e))}}(r.valid),a=i.valid;return n=n.concat(i.errors),n=n.concat(function(e){let t=[],n=e.filter(e=>e[G]instanceof RegExp);return t=t.concat(function(e){class t extends Ce{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}return e.filter(e=>{let n=e.PATTERN;try{let e=Ee(n),r=new t;return r.visit(e),r.found}catch{return ze.test(n.source)}}).map(e=>({message:`Unexpected RegExp Anchor Error:
|
|
14
14
|
Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
15
15
|
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.EOI_ANCHOR_FOUND,tokenTypes:[e]}))}(n)),t=t.concat(function(e){class t extends Ce{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}return e.filter(e=>{let n=e.PATTERN;try{let e=Ee(n),r=new t;return r.visit(e),r.found}catch{return Be.test(n.source)}}).map(e=>({message:`Unexpected RegExp Anchor Error:
|
|
16
16
|
Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
17
17
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.SOI_ANCHOR_FOUND,tokenTypes:[e]}))}(n)),t=t.concat(function(e){return e.filter(e=>{let t=e[G];return t instanceof RegExp&&(t.multiline||t.global)}).map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' may NOT contain global('g') or multiline('m')`,type:q.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}))}(n)),t=t.concat(function(e){let t=[],n=e.map(n=>e.reduce((e,r)=>(n.PATTERN.source!==r.PATTERN.source||t.includes(r)||r.PATTERN===J.NA||(t.push(r),e.push(r)),e),[]));return n=n.filter(Boolean),n.filter(e=>e.length>1).map(e=>{let t=e.map(e=>e.name);return{message:`The same RegExp pattern ->${e[0].PATTERN}<-has been used in all of the following Token Types: ${t.join(`, `)} <-`,type:q.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})}(n)),t=t.concat(function(e){return e.filter(e=>e.PATTERN.test(``)).map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' must not match an empty string`,type:q.EMPTY_MATCH_PATTERN,tokenTypes:[e]}))}(n)),t}(a)),n=n.concat(function(e){return e.filter(e=>{if(!Object.hasOwn(e,`GROUP`))return!1;let t=e.GROUP;return t!==J.SKIPPED&&t!==J.NA&&typeof t!=`string`}).map(e=>({message:`Token Type: ->`+e.name+`<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String`,type:q.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}))}(a)),n=n.concat(function(e,t){return e.filter(e=>e.PUSH_MODE!==void 0&&!t.includes(e.PUSH_MODE)).map(e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:q.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}))}(a,t)),n=n.concat(function(e){let t=[],n=e.reduce((e,t,n)=>{let r=t.PATTERN;return r===J.NA||(typeof r==`string`?e.push({str:r,idx:n,tokenType:t}):r instanceof RegExp&&(i=r,[`.`,`\\`,`[`,`]`,`|`,`^`,`$`,`(`,`)`,`?`,`*`,`+`,`{`].find(e=>i.source.indexOf(e)!==-1)===void 0)&&e.push({str:r.source,idx:n,tokenType:t})),e;var i},[]);return e.forEach((e,r)=>{n.forEach(({str:n,idx:i,tokenType:a})=>{if(r<i&&function(e,t){if(t instanceof RegExp){if(/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source))return!1;let n=t.exec(e);return n!==null&&n.index===0}if(typeof t==`function`)return t(e,0,[],{});if(Object.hasOwn(t,`exec`))return t.exec(e,0,[],{});if(typeof t==`string`)return t===e;throw Error(`non exhaustive match`)}(n,e.PATTERN)){let n=`Token: ->${a.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:n,type:q.UNREACHABLE_PATTERN,tokenTypes:[e,a]})}})}),t}(a)),n}var ze=/[^\\][$]/,Be=/[^\\[][\^]|^\^/;function Ve(e){let t=e.ignoreCase?`iy`:`y`;return RegExp(`${e.source}`,t)}function He(e){let t=e.PATTERN;if(t instanceof RegExp)return!1;if(typeof t==`function`||Object.hasOwn(t,`exec`))return!0;if(typeof t==`string`)return!1;throw Error(`non exhaustive match`)}function Ue(e){return typeof e==`string`&&e.length===1&&e.charCodeAt(0)}var We={test:function(e){let t=e.length;for(let n=this.lastIndex;n<t;n++){let t=e.charCodeAt(n);if(t===10)return this.lastIndex=n+1,!0;if(t===13)return this.lastIndex=e.charCodeAt(n+1)===10?n+2:n+1,!0}return!1},lastIndex:0};function Ge(e,t){if(Object.hasOwn(e,`LINE_BREAKS`))return!1;if(e.PATTERN instanceof RegExp){try{Fe(t,e.PATTERN)}catch(e){return{issue:q.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if(typeof e.PATTERN==`string`)return!1;if(He(e))return{issue:q.CUSTOM_LINE_BREAK};throw Error(`non exhaustive match`)}function Ke(e,t){if(t.issue===q.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <${e.name}> Token Type\n\t Root cause: ${t.errMsg}.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===q.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <${e.name}> Token Type\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error(`non exhaustive match`)}function qe(e){return e.map(e=>typeof e==`string`?e.charCodeAt(0):e)}function Je(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}var Ye=[];function K(e){return e<256?e:Ye[e]}function Xe(e,t){let n=e.tokenTypeIdx;return n===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[n]}function Ze(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}var Qe=1,$e={};function et(e){let t=function(e){let t=[...e],n=e,r=!0;for(;r;){n=n.map(e=>e.CATEGORIES).flat().filter(Boolean);let e=n.filter(e=>!t.includes(e));t=t.concat(e),e.length===0?r=!1:n=e}return t}(e);(function(e){e.forEach(e=>{var t;nt(e)||($e[Qe]=e,e.tokenTypeIdx=Qe++),rt(e)&&!Array.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),rt(e)||(e.CATEGORIES=[]),t=e,Object.hasOwn(t??{},`categoryMatches`)||(e.categoryMatches=[]),function(e){return Object.hasOwn(e??{},`categoryMatchesMap`)}(e)||(e.categoryMatchesMap={})})})(t),function(e){e.forEach(e=>{tt([],e)})}(t),function(e){e.forEach(e=>{e.categoryMatches=[],Object.keys(e.categoryMatchesMap).forEach(t=>{e.categoryMatches.push($e[t].tokenTypeIdx)})})}(t),t.forEach(e=>{e.isParent=e.categoryMatches.length>0})}function tt(e,t){e.forEach(e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0}),t.CATEGORIES.forEach(n=>{let r=e.concat(t);r.includes(n)||tt(r,n)})}function nt(e){return Object.hasOwn(e??{},`tokenTypeIdx`)}function rt(e){return Object.hasOwn(e??{},`CATEGORIES`)}function it(e){return Object.hasOwn(e??{},`tokenTypeIdx`)}var q,at={buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,n,r,i,a)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`};(function(e){e[e.MISSING_PATTERN=0]=`MISSING_PATTERN`,e[e.INVALID_PATTERN=1]=`INVALID_PATTERN`,e[e.EOI_ANCHOR_FOUND=2]=`EOI_ANCHOR_FOUND`,e[e.UNSUPPORTED_FLAGS_FOUND=3]=`UNSUPPORTED_FLAGS_FOUND`,e[e.DUPLICATE_PATTERNS_FOUND=4]=`DUPLICATE_PATTERNS_FOUND`,e[e.INVALID_GROUP_TYPE_FOUND=5]=`INVALID_GROUP_TYPE_FOUND`,e[e.PUSH_MODE_DOES_NOT_EXIST=6]=`PUSH_MODE_DOES_NOT_EXIST`,e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]=`MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE`,e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]=`MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY`,e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]=`MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST`,e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]=`LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED`,e[e.SOI_ANCHOR_FOUND=11]=`SOI_ANCHOR_FOUND`,e[e.EMPTY_MATCH_PATTERN=12]=`EMPTY_MATCH_PATTERN`,e[e.NO_LINE_BREAKS_FLAGS=13]=`NO_LINE_BREAKS_FLAGS`,e[e.UNREACHABLE_PATTERN=14]=`UNREACHABLE_PATTERN`,e[e.IDENTIFY_TERMINATOR=15]=`IDENTIFY_TERMINATOR`,e[e.CUSTOM_LINE_BREAK=16]=`CUSTOM_LINE_BREAK`,e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]=`MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE`})(q||={});var ot={deferDefinitionErrorsHandling:!1,positionTracking:`full`,lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
18
|
-
`,`\r`],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:at,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(ot);var J=class{constructor(e,t=ot){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(e,t)=>{if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:i}=
|
|
18
|
+
`,`\r`],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:at,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(ot);var J=class{constructor(e,t=ot){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(e,t)=>{if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:i}=ae(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()},typeof t==`boolean`)throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
19
19
|
a boolean 2nd argument is no longer supported`);this.config=Object.assign({},ot,t);let n=this.config.traceInitPerf;!0===n?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n==`number`&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT(`Lexer Constructor`,()=>{let n,r=!0;this.TRACE_INIT(`Lexer Config handling`,()=>{if(this.config.lineTerminatorsPattern===ot.lineTerminatorsPattern)this.config.lineTerminatorsPattern=We;else if(this.config.lineTerminatorCharacters===ot.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
20
20
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error(`"safeMode" and "ensureOptimizations" flags are mutually exclusive.`);this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(e)?n={modes:{defaultMode:[...e]},defaultMode:Ie}:(r=!1,n=Object.assign({},e))}),!1===this.config.skipValidations&&(this.TRACE_INIT(`performRuntimeChecks`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(e){let t=[];return Object.hasOwn(e,`defaultMode`)||t.push({message:`A MultiMode Lexer cannot be initialized without a <defaultMode> property in its definition
|
|
21
21
|
`,type:q.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(e,`modes`)||t.push({message:`A MultiMode Lexer cannot be initialized without a <modes> property in its definition
|
|
@@ -25,9 +25,9 @@ a boolean 2nd argument is no longer supported`);this.config=Object.assign({},ot,
|
|
|
25
25
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
26
26
|
for details.`,type:q.NO_LINE_BREAKS_FLAGS}),r}(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),n.modes=n.modes?n.modes:{},Object.entries(n.modes).forEach(([e,t])=>{n.modes[e]=t.filter(e=>e!==void 0)});let i=Object.keys(n.modes);if(Object.entries(n.modes).forEach(([e,n])=>{this.TRACE_INIT(`Mode: <${e}> processing`,()=>{if(this.modes.push(e),!1===this.config.skipValidations&&this.TRACE_INIT(`validatePatterns`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Re(n,i))}),this.lexerDefinitionErrors.length===0){let r;et(n),this.TRACE_INIT(`analyzeTokenTypes`,()=>{r=Le(n,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[e]=r.patternIdxToConfig,this.charCodeToPatternIdxToConfig[e]=r.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,r.emptyGroups),this.hasCustom=r.hasCustom||this.hasCustom,this.canModeBeOptimized[e]=r.canBeOptimized}})}),this.defaultMode=n.defaultMode,this.cachedGroupKeys=Object.keys(this.emptyGroups),this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){let e=this.lexerDefinitionErrors.map(e=>e.message).join(`-----------------------
|
|
27
27
|
`);throw Error(`Errors detected in definition of Lexer:
|
|
28
|
-
`+e)}this.lexerDefinitionWarning.forEach(e=>{
|
|
28
|
+
`+e)}this.lexerDefinitionWarning.forEach(e=>{D(e.message)}),this.TRACE_INIT(`Choosing sub-methods implementations`,()=>{if(r&&(this.handleModes=()=>{}),!1===this.trackStartLines&&(this.computeNewColumn=e=>e),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=()=>{}),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else{if(!/onlyOffset/i.test(this.config.positionTracking))throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.createTokenInstance=this.createOffsetOnlyToken}this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT(`Failed Optimization Warnings`,()=>{let e=Object.entries(this.canModeBeOptimized).reduce((e,[t,n])=>(!1===n&&e.push(t),e),[]);if(t.ensureOptimizations&&e.length>0)throw Error(`Lexer Modes: < ${e.join(`, `)} > cannot be optimized.\n\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n\t Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT(`clearRegExpParserCache`,()=>{we={}}),this.TRACE_INIT(`toFastProperties`,()=>{O(this)})})}tokenize(e,t=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let e=this.lexerDefinitionErrors.map(e=>e.message).join(`-----------------------
|
|
29
29
|
`);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
30
|
-
`+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=e,v=_.length,y=0,
|
|
30
|
+
`+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=e,v=_.length,y=0,ee=0,b=this.hasCustom?0:Math.floor(e.length/10),x=Array(b),te=[],S=this.trackStartLines?1:void 0,C=this.trackStartLines?1:void 0,w={};for(let e=0;e<this.cachedGroupKeys.length;e++)w[this.cachedGroupKeys[e]]=[];let ne=this.trackStartLines,re=this.config.lineTerminatorsPattern,ie=0,T=[],E=[],D=[],ae=[];Object.freeze(ae);let O=!1,k=e=>{if(D.length===1&&e.tokenType.PUSH_MODE===void 0){let t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);te.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{D.pop();let e=D.at(-1);T=this.patternIdxToConfig[e],E=this.charCodeToPatternIdxToConfig[e],ie=T.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;O=!(!E||!t)}};function A(e){D.push(e),E=this.charCodeToPatternIdxToConfig[e],T=this.patternIdxToConfig[e],ie=T.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;O=!(!E||!t)}let j;A.call(this,t);let M=this.config.recoveryEnabled;for(;y<v;){s=null,u=-1;let t=_.charCodeAt(y),b;if(O){let e=K(t),n=E[e];b=n===void 0?ae:n}else b=T;let N=b.length;for(n=0;n<N;n++){j=b[n];let r=j.pattern;switch(c=null,j.matchType){case 0:t===j.short&&(u=1,s=r);break;case 1:g=r.exec(_,y,x,w),g===null?s=null:(s=g[0],u=s.length,g.payload!==void 0&&(c=g.payload));break;case 3:{let e=j.asciiClass;if(e[t]!==1){r.lastIndex=0;break}let n=y+1;for(;e[_.charCodeAt(n)]===1;)n++;u=n-y,r.lastIndex=n;break}case 2:r.lastIndex=y,u=this.matchLength(r,e,y)}if(u!==-1){if(o=j.longerAlt,o!==void 0){s=e.substring(y,y+u);let t=o.length;for(i=0;i<t;i++){let t=T[o[i]],n=t.pattern;if(l=null,t.matchType===1?(g=n.exec(_,y,x,w),g===null?a=null:(a=g[0],g.payload!==void 0&&(l=g.payload))):(n.lastIndex=y,a=this.match(n,e,y)),a&&a.length>s.length){s=a,u=a.length,c=l,j=t;break}}}break}}if(u!==-1){if(d=j.group,d!==void 0&&(s=s===null?e.substring(y,y+u):s,f=j.tokenTypeIdx,p=this.createTokenInstance(s,y,f,j.tokenType,S,C,u),this.handlePayload(p,c),!1===d?ee=this.addToken(x,ee,p):w[d].push(p)),!0===ne&&!0===j.canLineTerminator){let t,n,r=0;re.lastIndex=0;do s=s===null?e.substring(y,y+u):s,t=re.test(s),!0===t&&(n=re.lastIndex-1,r++);while(!0===t);r===0?C=this.computeNewColumn(C,u):(S+=r,C=u-n,this.updateTokenEndLineColumnLocation(p,d,n,r,S,C,u))}else C=this.computeNewColumn(C,u);y+=u,this.handleModes(j,k,A,p)}else{let t=y,n=S,i=C,a=!1===M;for(;!1===a&&y<v;)for(y++,r=0;r<ie;r++){let t=T[r],n=t.pattern;switch(t.matchType){case 0:_.charCodeAt(y)===t.short&&(a=!0);break;case 1:a=n.exec(_,y,x,w)!==null;break;case 3:case 2:n.lastIndex=y,a=n.exec(e)!==null}if(!0===a)break}if(m=y-t,C=this.computeNewColumn(C,m),h=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(_,t,m,n,i,D.at(-1)),te.push({offset:t,line:n,column:i,length:m,message:h}),!1===M)break}}return this.hasCustom||(x.length=ee),{tokens:x,groups:w,errors:te}}handleModes(e,t,n,r){if(!0===e.pop){let i=e.push;t(r),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)}updateTokenEndLineColumnLocation(e,t,n,r,i,a,o){let s,c;t!==void 0&&(s=n===o-1,c=s?-1:0,r===1&&!0===s||(e.endLine=i+c,e.endColumn=a-1-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}}createStartOnlyToken(e,t,n,r,i,a){return{image:e,startOffset:t,startLine:i,startColumn:a,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:a,endColumn:a+o-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}match(e,t,n){return!0===e.test(t)?t.substring(n,e.lastIndex):null}matchLength(e,t,n){return!0===e.test(t)?e.lastIndex-n:-1}};function st(e){return ct(e)?e.LABEL:e.name}function ct(e){return typeof e.LABEL==`string`&&e.LABEL!==``}J.SKIPPED=`This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.`,J.NA=/NOT_APPLICABLE/;var lt=`parent`,ut=`categories`,dt=`label`,ft=`group`,pt=`push_mode`,mt=`pop_mode`,ht=`longer_alt`,gt=`line_breaks`,_t=`start_chars_hint`;function Y(e){return function(e){let t=e.pattern,n={};if(n.name=e.name,t!==void 0&&(n.PATTERN=t),Object.hasOwn(e,lt))throw`The parent property is no longer supported.
|
|
31
31
|
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Object.hasOwn(e,ut)&&(n.CATEGORIES=e[ut]),et([n]),Object.hasOwn(e,dt)&&(n.LABEL=e[dt]),Object.hasOwn(e,ft)&&(n.GROUP=e[ft]),Object.hasOwn(e,mt)&&(n.POP_MODE=e[mt]),Object.hasOwn(e,pt)&&(n.PUSH_MODE=e[pt]),Object.hasOwn(e,ht)&&(n.LONGER_ALT=e[ht]),Object.hasOwn(e,gt)&&(n.LINE_BREAKS=e[gt]),Object.hasOwn(e,_t)&&(n.START_CHARS_HINT=e[_t]),n}(e)}var X=Y({name:`EOF`,pattern:J.NA});function vt(e,t,n,r,i,a,o,s){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:a,startColumn:o,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}et([X]);var yt={buildMismatchTokenMessage:({expected:e,actual:t,previous:n,ruleName:r})=>`Expecting ${ct(e)?`--\x3e ${st(e)} <--`:`token of type --\x3e ${e.name} <--`} but found --\x3e '${t.image}' <--`,buildNotAllInputParsedMessage:({firstRedundant:e,ruleName:t})=>`Redundant input, expecting EOF but found: `+e.image,buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){let a=`
|
|
32
32
|
but found: '`+t[0].image+`'`;return r?`Expecting: `+r+a:`Expecting: one of these possible Token sequences:\n${e.reduce((e,t)=>e.concat(t),[]).map(e=>`[${e.map(e=>st(e)).join(`, `)}]`).map((e,t)=>` ${t+1}. ${e}`).join(`
|
|
33
33
|
`)}`+a},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){let i=`
|
|
@@ -41,7 +41,7 @@ For Further details.`,r},buildEmptyRepetitionError(e){let t=V(e.repetition);retu
|
|
|
41
41
|
`).replace(/\n/g,`
|
|
42
42
|
`)}`)}}},n.prototype.constructor=n,n._RULE_NAMES=t,n}(function(e){e[e.REDUNDANT_METHOD=0]=`REDUNDANT_METHOD`,e[e.MISSING_METHOD=1]=`MISSING_METHOD`})(wn||={});var On={description:`This Object indicates the Parser is during Recording Phase`};Object.freeze(On);var kn=!0,An=Y({name:`RECORDING_PHASE_TOKEN`,pattern:J.NA});et([An]);var jn=vt(An,`This IToken indicates the Parser is in Recording Phase
|
|
43
43
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(jn);var Mn={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
44
|
-
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};function Nn(e,t,n,r=!1){In(n);let i=this.recordingProdStack.at(-1),a=typeof t==`function`?t:t.DEF,o=new e({definition:[],idx:n});return r&&(o.separator=t.SEP),Object.hasOwn(t,`MAX_LOOKAHEAD`)&&(o.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(o),a.call(this),i.definition.push(o),this.recordingProdStack.pop(),On}function Pn(e,t){In(t);let n=this.recordingProdStack.at(-1),r=!1===Array.isArray(e),i=!1===r?e:e.DEF,a=new R({definition:[],idx:t,ignoreAmbiguities:r&&!0===e.IGNORE_AMBIGUITIES});return Object.hasOwn(e,`MAX_LOOKAHEAD`)&&(a.maxLookahead=e.MAX_LOOKAHEAD),a.hasPredicates=i.some(e=>typeof e.GATE==`function`),n.definition.push(a),i.forEach(e=>{let t=new M({definition:[]});a.definition.push(t),Object.hasOwn(e,`IGNORE_AMBIGUITIES`)?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:Object.hasOwn(e,`GATE`)&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),On}function Fn(e){return e===0?``:`${e}`}function In(e){if(e<0||e>255){let t=Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than 256`);throw t.KNOWN_RECORDER_ERROR=!0,t}}var Ln=vt(X,``,-1,-1,-1,-1,-1,-1);Object.freeze(Ln);var Q,$=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:yt,nodeLocationTracking:`none`,traceInitPerf:!1,skipValidations:!1}),Rn=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});(function(e){e[e.INVALID_RULE_NAME=0]=`INVALID_RULE_NAME`,e[e.DUPLICATE_RULE_NAME=1]=`DUPLICATE_RULE_NAME`,e[e.INVALID_RULE_OVERRIDE=2]=`INVALID_RULE_OVERRIDE`,e[e.DUPLICATE_PRODUCTIONS=3]=`DUPLICATE_PRODUCTIONS`,e[e.UNRESOLVED_SUBRULE_REF=4]=`UNRESOLVED_SUBRULE_REF`,e[e.LEFT_RECURSION=5]=`LEFT_RECURSION`,e[e.NONE_LAST_EMPTY_ALT=6]=`NONE_LAST_EMPTY_ALT`,e[e.AMBIGUOUS_ALTS=7]=`AMBIGUOUS_ALTS`,e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]=`CONFLICT_TOKENS_RULES_NAMESPACE`,e[e.INVALID_TOKEN_NAME=9]=`INVALID_TOKEN_NAME`,e[e.NO_NON_EMPTY_LOOKAHEAD=10]=`NO_NON_EMPTY_LOOKAHEAD`,e[e.AMBIGUOUS_PREFIX_ALTS=11]=`AMBIGUOUS_PREFIX_ALTS`,e[e.TOO_MANY_ALTS=12]=`TOO_MANY_ALTS`,e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]=`CUSTOM_LOOKAHEAD_VALIDATION`})(Q||={});var zn,Bn=class e{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT(`performSelfAnalysis`,()=>{let t;this.selfAnalysisDone=!0;let n=this.className;this.TRACE_INIT(`toFastProps`,()=>{
|
|
44
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};function Nn(e,t,n,r=!1){In(n);let i=this.recordingProdStack.at(-1),a=typeof t==`function`?t:t.DEF,o=new e({definition:[],idx:n});return r&&(o.separator=t.SEP),Object.hasOwn(t,`MAX_LOOKAHEAD`)&&(o.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(o),a.call(this),i.definition.push(o),this.recordingProdStack.pop(),On}function Pn(e,t){In(t);let n=this.recordingProdStack.at(-1),r=!1===Array.isArray(e),i=!1===r?e:e.DEF,a=new R({definition:[],idx:t,ignoreAmbiguities:r&&!0===e.IGNORE_AMBIGUITIES});return Object.hasOwn(e,`MAX_LOOKAHEAD`)&&(a.maxLookahead=e.MAX_LOOKAHEAD),a.hasPredicates=i.some(e=>typeof e.GATE==`function`),n.definition.push(a),i.forEach(e=>{let t=new M({definition:[]});a.definition.push(t),Object.hasOwn(e,`IGNORE_AMBIGUITIES`)?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:Object.hasOwn(e,`GATE`)&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),On}function Fn(e){return e===0?``:`${e}`}function In(e){if(e<0||e>255){let t=Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than 256`);throw t.KNOWN_RECORDER_ERROR=!0,t}}var Ln=vt(X,``,-1,-1,-1,-1,-1,-1);Object.freeze(Ln);var Q,$=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:yt,nodeLocationTracking:`none`,traceInitPerf:!1,skipValidations:!1}),Rn=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});(function(e){e[e.INVALID_RULE_NAME=0]=`INVALID_RULE_NAME`,e[e.DUPLICATE_RULE_NAME=1]=`DUPLICATE_RULE_NAME`,e[e.INVALID_RULE_OVERRIDE=2]=`INVALID_RULE_OVERRIDE`,e[e.DUPLICATE_PRODUCTIONS=3]=`DUPLICATE_PRODUCTIONS`,e[e.UNRESOLVED_SUBRULE_REF=4]=`UNRESOLVED_SUBRULE_REF`,e[e.LEFT_RECURSION=5]=`LEFT_RECURSION`,e[e.NONE_LAST_EMPTY_ALT=6]=`NONE_LAST_EMPTY_ALT`,e[e.AMBIGUOUS_ALTS=7]=`AMBIGUOUS_ALTS`,e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]=`CONFLICT_TOKENS_RULES_NAMESPACE`,e[e.INVALID_TOKEN_NAME=9]=`INVALID_TOKEN_NAME`,e[e.NO_NON_EMPTY_LOOKAHEAD=10]=`NO_NON_EMPTY_LOOKAHEAD`,e[e.AMBIGUOUS_PREFIX_ALTS=11]=`AMBIGUOUS_PREFIX_ALTS`,e[e.TOO_MANY_ALTS=12]=`TOO_MANY_ALTS`,e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]=`CUSTOM_LOOKAHEAD_VALIDATION`})(Q||={});var zn,Bn=class e{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT(`performSelfAnalysis`,()=>{let t;this.selfAnalysisDone=!0;let n=this.className;this.TRACE_INIT(`toFastProps`,()=>{O(this)}),this.TRACE_INIT(`Grammar Recording`,()=>{try{this.enableRecording(),this.definedRulesNames.forEach(e=>{let t=this[e].originalGrammarAction,n;this.TRACE_INIT(`${e} Rule`,()=>{n=this.topLevelRuleRecord(e,t)}),this.gastProductionsCache[e]=n})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT(`Grammar Resolving`,()=>{r=tn({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT(`Grammar Validations`,()=>{if(r.length===0&&!1===this.skipValidations){let t=function(e){let t=e.errMsgProvider??xt;return Gt(e.rules,e.tokenTypes,t,e.grammarName)}({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:xt,grammarName:n}),r=(e={lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:n}).lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName}).map(e=>Object.assign({type:Q.CUSTOM_LOOKAHEAD_VALIDATION},e));this.definitionErrors=this.definitionErrors.concat(t,r)}var e}),this.definitionErrors.length===0&&(this.recoveryEnabled&&this.TRACE_INIT(`computeAllProdsFollows`,()=>{let e=function(e){let t={};return e.forEach(e=>{let n=new pe(e).startWalking();Object.assign(t,n)}),t}(Object.values(this.gastProductionsCache));this.resyncFollows=e}),this.TRACE_INIT(`ComputeLookaheadFunctions`,()=>{var e,t;(t=(e=this.lookaheadStrategy).initialize)==null||t.call(e,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!e.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw t=this.definitionErrors.map(e=>e.message),Error(`Parser Definition Errors detected:\n ${t.join(`
|
|
45
45
|
-------------------------------
|
|
46
46
|
`)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(t),n.initLexerAdapter(),n.initLooksAhead(t),n.initRecognizerEngine(e,t),n.initRecoverable(t),n.initTreeBuilder(t),n.initGastRecorder(t),n.initPerformanceTracer(t),Object.hasOwn(t,`ignoredIssues`))throw Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
47
47
|
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
@@ -54,4 +54,4 @@ For Further details.`,r},buildEmptyRepetitionError(e){let t=V(e.repetition);retu
|
|
|
54
54
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
55
55
|
For Further details.`)}if(Array.isArray(e))this.tokensMap=e.reduce((e,t)=>(e[t.name]=t,e),{});else if(Object.hasOwn(e,`modes`)&&Object.values(e.modes).flat().every(it)){let t=Object.values(e.modes).flat(),n=[...new Set(t)];this.tokensMap=n.reduce((e,t)=>(e[t.name]=t,e),{})}else{if(typeof e!=`object`||!e)throw Error(`<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition`);this.tokensMap=Object.assign({},e)}this.tokensMap.EOF=X;let n=(Object.hasOwn(e,`modes`)?Object.values(e.modes).flat():Object.values(e)).every(e=>e.categoryMatches?.length==0);this.tokenMatcher=n?Ze:Xe,et(Object.values(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let r=Object.hasOwn(n,`resyncEnabled`)?n.resyncEnabled:Rn.resyncEnabled,i=Object.hasOwn(n,`recoveryValueFunc`)?n.recoveryValueFunc:Rn.recoveryValueFunc,a=this.ruleShortNameIdx++,o;return this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a,o=!0===this.outputCst?function(...n){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n);let r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...n){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n)}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...t){this.onBeforeParse(e);try{return o.apply(this,t)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:t,coreRule:o})}invokeRuleCatch(e,t,n){let r=this.RULE_STACK_IDX===0,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(cn(e)){let t=e;if(i){let r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r)){if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return n(e)}if(this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(r)return this.moveToTerminatedState(),n(e);throw t}throw e}optionInternal(e,t){let n=512|t;return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof e!=`function`){r=e.DEF;let t=e.GATE;if(t!==void 0){let e=i;i=()=>t.call(this)&&e.call(this)}}else r=e;if(!0===i.call(this))return r.call(this)}atLeastOneInternal(e,t){let n=_n|e;return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof t!=`function`){r=t.DEF;let e=t.GATE;if(e!==void 0){let t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;if(!0!==i.call(this))throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY,t.ERR_MSG);{let e=this.doSingleRepetition(r);for(;!0===i.call(this)&&!0===e;)e=this.doSingleRepetition(r)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,_n,e,Ot)}atLeastOneSepFirstInternal(e,t){let n=yn|e;this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(!0!==this.currRuleLookaheadFuncs[n].call(this))throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);{r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;!0===this.tokenMatcher(this.LA_FAST(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,kt],t,yn,e,kt)}}manyInternal(e,t){let n=768|e;return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof t!=`function`){r=t.DEF;let e=t.GATE;if(e!==void 0){let t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;let a=!0;for(;!0===i.call(this)&&!0===a;)a=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,Et,a)}manySepFirstInternal(e,t){let n=vn|e;this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(!0===this.currRuleLookaheadFuncs[n].call(this)){r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;!0===this.tokenMatcher(this.LA_FAST(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,Dt],t,vn,e,Dt)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,yn,e,i)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let n=256|t,r=Array.isArray(e)?e:e.DEF,i=this.currRuleLookaheadFuncs[n].call(this,r);if(i!==void 0)return r[i].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]),this.cstFinallyStateUpdate()}subruleInternal(e,t,n){let r;try{let i=n===void 0?void 0:n.ARGS;return this.subruleIdx=t,r=e.coreRule.apply(this,i),this.cstPostNonTerminal(r,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),r}catch(t){throw this.subruleInternalError(t,n,e.ruleName)}}subruleInternalError(e,t,n){throw cn(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let r;try{let t=this.LA_FAST(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),r=t):this.consumeInternalError(e,t,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,r),r}consumeInternalError(e,t,n){let r,i=this.LA(0);throw r=n!==void 0&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new un(r,t,i))}consumeInternalRecovery(e,t,n){if(!this.recoveryEnabled||n.name!==`MismatchedTokenException`||this.isBackTracking())throw n;{let r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===`InRuleRecoveryException`?n:e}}}saveRecogState(){let e=this.errors,t=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState);let t=e.RULE_STACK;for(let e=0;e<t.length;e++)this.RULE_STACK[e]=t[e];this.RULE_STACK_IDX=t.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=n,this.RULE_STACK[++this.RULE_STACK_IDX]=e,this.currRuleShortName=e,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[e],this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.currRuleShortName;return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),X)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(e){for(let e=0;e<this.maxLookahead+1;e++)this.tokVector.push(Ln)}onAfterParse(e){if(!1===this.isAtEndOfInput()){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new fn(t,e))}for(;this.tokVector.at(-1)===Ln;)this.tokVector.pop()}},class{ACTION(e){return e.call(this)}consume(e,t,n){return this.consumeInternal(t,e,n)}subrule(e,t,n){return this.subruleInternal(t,e,n)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,n=Rn){if(this.definedRulesNames.includes(e)){let t={message:xt.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Q.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);let r=this.defineRule(e,t,n);return this[e]=r,r}OVERRIDE_RULE(e,t,n=Rn){let r=function(e,t,n){let r=[],i;return t.includes(e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:Q.INVALID_RULE_OVERRIDE,ruleName:e})),r}(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);let i=this.defineRule(e,t,n);return this[e]=i,i}BACKTRACK(e,t){let n=e.coreRule??e;return function(){this.isBackTrackingStack.push(1);let e=this.saveRecogState();try{return n.apply(this,t),!0}catch(e){if(cn(e))return!1;throw e}finally{this.reloadRecogState(e),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Object.values(this.gastProductionsCache).map(oe)}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Object.hasOwn(e,`errorMessageProvider`)?e.errorMessageProvider:$.errorMessageProvider}SAVE_ERROR(e){if(cn(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(e),e;throw Error(`Trying to save an Error which is not a RecognitionException`)}get errors(){return[...this._errors]}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){let r=this.getCurrRuleFullName(),i=Ht(e,this.getGAstProductions()[r],t,this.maxLookahead)[0],a=[];for(let e=1;e<=this.maxLookahead;e++)a.push(this.LA(e));let o=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:a,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new pn(o,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let n=this.getCurrRuleFullName(),r=Vt(e,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let e=1;e<=this.maxLookahead;e++)i.push(this.LA(e));let a=this.LA(0),o=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:a,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new dn(o,this.LA(1),a))}},class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT(`Enable Recording`,()=>{for(let e=0;e<10;e++){let t=e>0?e:``;this[`CONSUME${t}`]=function(t,n){return this.consumeInternalRecord(t,e,n)},this[`SUBRULE${t}`]=function(t,n){return this.subruleInternalRecord(t,e,n)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT(`Deleting Recording methods`,()=>{let e=this;for(let t=0;t<10;t++){let n=t>0?t:``;delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return Ln}topLevelRuleRecord(e,t){try{let n=new j({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message+=`
|
|
56
56
|
This error was thrown during the "grammar recording phase" For more info see:
|
|
57
|
-
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return Nn.call(this,N,e,t)}atLeastOneInternalRecord(e,t){Nn.call(this,P,t,e)}atLeastOneSepFirstInternalRecord(e,t){Nn.call(this,F,t,e,kn)}manyInternalRecord(e,t){Nn.call(this,I,t,e)}manySepFirstInternalRecord(e,t){Nn.call(this,L,t,e,kn)}orInternalRecord(e,t){return Pn.call(this,e,t)}subruleInternalRecord(e,t,n){if(In(t),!e||!Object.hasOwn(e,`ruleName`)){let n=Error(`<SUBRULE${Fn(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=e.ruleName,a=new A({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?Mn:On}consumeInternalRecord(e,t,n){if(In(t),!nt(e)){let n=Error(`<CONSUME${Fn(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=new z({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),jn}},class{initPerformanceTracer(e){if(Object.hasOwn(e,`traceInitPerf`)){let t=e.traceInitPerf,n=typeof t==`number`;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=$.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:i}=ie(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}}].forEach(e=>{let t=e.prototype;Object.getOwnPropertyNames(t).forEach(n=>{if(n===`constructor`)return;let r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(zn.prototype,n,r):zn.prototype[n]=e.prototype[n]})});var Vn=class extends Bn{constructor(e,t=$){let n=Object.assign({},t);n.outputCst=!1,super(e,n)}},Hn=class t{static shared(e){let n=e?.locale??y,r=e?.maxColumn??Kn,i=e?.maxRow??qn,a=Gn.get(n);a||(a=new Map,Gn.set(n,a));let o=`${r}:${i}`,s=a.get(o);return s||(s=new t({locale:n,maxColumn:r,maxRow:i}),a.set(o,s)),s}constructor(e){let t=e?.maxColumn??Kn,n=e?.maxRow??qn,r=e?.locale??y;this._locale=r,this._maxColumn=t,this._maxRow=n;let{separatorFunction:i,separatorColumn:a,separatorRow:o,separatorDecimal:s}=r.separators;if(a===o)throw Error(`FormulaLexer: separatorColumn and separatorRow must differ (both '${a}')`);let c=Y({name:`WhiteSpace`,pattern:/[ \n\v\f\r\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,group:J.SKIPPED}),l=Y({name:`StringToken`,pattern:/"(""|[^"])*"/}),u=Y({name:`FunctionToken`,pattern:/[a-zA-Z_\u007F-\uFFFF]+[a-zA-Z0-9_.\u007F-\uFFFF]*(?=\()/}),f=Y({name:`TableReference`,pattern:{exec:te},line_breaks:!1,start_chars_hint:Wn}),p=Y({name:`BracketedString`,pattern:{exec:d},line_breaks:!1,start_chars_hint:[91],longer_alt:[f,l]}),m=e=>(e??[]).map(e=>e?.trim()).filter(Boolean).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).map(e=>e+`|`).join(``),h=e=>e.replace(/[A-Za-z]/g,e=>`[${e.toUpperCase()}${e.toLowerCase()}]`),g=Y({name:`LiteralError`,pattern:new RegExp(m(r.errorLiterals)+[`#PARSE!`,`#NULL!`,`#DIV\\/0!`,`#VALUE!`,`#NUM!`,`#FIELD!`,`#N\\/A`,`#GETTING_DATA`,`#SPILL!`,`#CONNECT!`,`#BLOCKED!`,`#UNKNOWN!`,`#CALC!`,`#BUSY!`,`#PYTHON!`,`#TIMEOUT!`].map(h).join(`|`))}),_=Y({name:`RefError`,pattern:new RegExp(m(r.errorRefs)+[`#REF!`,`#NAME\\?`].map(h).join(`|`))}),v=Y({name:`SingleQuotedString`,pattern:/'(''|[^'])*'/}),b=Y({name:`SheetQuoted`,pattern:/'(?:''|[^'])*?'!/}),ee=Y({name:`Sheet`,pattern:/[A-Za-z_.\d\u007F-\uFFFF]*!/}),x=/[a-zA-Z_\\\u007F-\uFFFF][a-zA-Z0-9_.?\\\u007F-\uFFFF]*:?/y,S=Y({name:`NamedToken`,pattern:{exec:(e,t)=>{x.lastIndex=t;let n=x.exec(e);if(!n)return null;let r=n[0],i=r.indexOf(`.:`);return i===-1?r.endsWith(`:`)&&(r=r.slice(0,-1)):r=r.substring(0,i),[r]}},line_breaks:!1,start_chars_hint:Wn}),C=Y({name:`Cell`,pattern:{exec:Xn(t,n)},line_breaks:!1,start_chars_hint:[36,...Un],longer_alt:S}),w=Y({name:`Column`,pattern:{exec:Yn(t)},line_breaks:!1,start_chars_hint:[36,...Un],longer_alt:S}),ne=Y({name:`AbsRow`,pattern:/[$][0-9]+/}),T=s===`.`?`\\.`:s,re=Y({name:`NumberToken`,pattern:RegExp(`[0-9]+${T}(?!:)[0-9]*([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|${T}[0-9]+([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+`)}),E=Y({name:`ScientificDigit`,pattern:/[0-9]+\*\*[+-]?[0-9]+/}),D=Y({name:`DigitToken`,pattern:/[0-9]+/}),O=[`TRUE`,`FALSE`];for(let e of[r.booleanTrue,r.booleanFalse]){let t=e?.trim();t&&!O.some(e=>e.toLowerCase()===t.toLowerCase())&&O.push(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}let ie=Y({name:`BooleanToken`,pattern:new RegExp(O.join(`|`),`i`)}),ae=Y({name:`ArgSeparator`,pattern:Zn(i)}),k=Y({name:`ColSeparator`,pattern:Zn(a)}),A=Y({name:`RowSeparator`,pattern:Zn(o)}),j=Y({name:`RangeOp`,pattern:/:/}),M=Y({name:`RangeTrimFullOp`,pattern:/\.:\./}),N=Y({name:`RangeTrimLeadingOp`,pattern:/\.:/}),P=Y({name:`RangeTrimTrailingOp`,pattern:/:\./}),F=Y({name:`OpenParen`,pattern:/\(/}),I=Y({name:`CloseParen`,pattern:/\)/}),L=Y({name:`OpenCurlyParen`,pattern:/{/}),R=Y({name:`CloseCurlyParen`,pattern:/}/}),z=Y({name:`QuoteS`,pattern:/'/}),oe=Y({name:`MulOp`,pattern:/\*(?!\*)/}),B=Y({name:`PlusOp`,pattern:/\+/}),se=Y({name:`DivOp`,pattern:/\//}),ce=Y({name:`MinOp`,pattern:/-/}),V=Y({name:`ImplicitIntersectOp`,pattern:/@/}),le=Y({name:`ConcatOp`,pattern:/&/}),ue=Y({name:`ExOp`,pattern:/\^/}),de=Y({name:`PercentOp`,pattern:/%/}),fe=Y({name:`ArrayAnchorOp`,pattern:/#/,longer_alt:[g,_]}),pe=Y({name:`GtOp`,pattern:/>/}),H=Y({name:`EqOp`,pattern:/=/}),me=Y({name:`LtOp`,pattern:/</}),U=[c,l,b,v,ee,u,f,p,g,_,ae,...a===i?[]:[k],A,M,N,P,j,C,ie,w,ne,re,E,D,fe,V,S,F,I,L,R,z,oe,B,se,ce,le,ue,de,Y({name:`NeqOp`,pattern:/<>/}),Y({name:`GteOp`,pattern:/>=/}),Y({name:`LteOp`,pattern:/<=/}),pe,H,me];this._lexer=new J(U,{ensureOptimizations:!0});let W={};U.forEach(e=>{W[e.name]=e}),a===i&&(W.ColSeparator=ae),this._vocabulary=W}tokenize(t,n=!0){let r=this._lexer.tokenize(t);if(n&&r.errors.length>0){let n=r.errors[0],i=n.line,a=n.column,o=t.substr(n.offset,n.length||1),s=o?`Unexpected character '${o}'`:n.message;throw new e.Parse(s,{line:i,column:a,offset:n.offset,length:n.length})}return r}getVocabulary(){return this._vocabulary}getLocale(){return this._locale}getMaxColumn(){return this._maxColumn}getMaxRow(){return this._maxRow}getSeparators(){return this._locale.separators}},Un=(()=>{let e=[];for(let t=65;t<=90;t++)e.push(t);for(let t=97;t<=122;t++)e.push(t);for(let t=48;t<=57;t++)e.push(t);return e})().filter(e=>e<48||e>57),Wn=(()=>{let e=[...Un,95,92];for(let t=127;t<=65535;t++)e.push(t);return e})(),Gn=new WeakMap,Kn=16384,qn=1048576;function Jn(e,t,n){let r=0;for(let i=t;i<n;i++){let t=e.charCodeAt(i);r=26*r+(t>=97?t-96:t-64)}return r}function Yn(e){return(t,n)=>{let r=n;t.charCodeAt(r)===36&&r++;let i=r;for(;r<t.length&&r-i<3;){let e=t.charCodeAt(r);if(!(e>=65&&e<=90||e>=97&&e<=122))break;r++}if(r-i===0||Jn(t,i,r)>e)return null;if(r<t.length){let e=t.charCodeAt(r);if(e>=48&&e<=57)return null}return[t.substring(n,r)]}}function Xn(e,t){return(n,r)=>{let i=r;n.charCodeAt(i)===36&&i++;let a=i;for(;i<n.length&&i-a<3;){let e=n.charCodeAt(i);if(!(e>=65&&e<=90||e>=97&&e<=122))break;i++}if(i-a===0||Jn(n,a,i)>e)return null;i<n.length&&n.charCodeAt(i)===36&&i++;let o=i;for(;i<n.length;){let e=n.charCodeAt(i);if(!(e>=48&&e<=57))break;i++}if(i===o)return null;let s=parseInt(n.substring(o,i),10);return s<1||s>t?null:[n.substring(r,i)]}}function Zn(e){return new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}var Qn=class{constructor(e=y){let t=function(e){let t=[...ee];if(e)for(let n of Object.values(e)){let e=n?.trim();e&&!t.some(t=>t.toLowerCase()===e.toLowerCase())&&t.push(e)}return t.sort((e,t)=>t.length-e.length),t.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)}(e.specifiers),n=Y({name:`WhiteSpace`,pattern:/\s+/,group:J.SKIPPED}),r=Y({name:`TableSpecifier`,pattern:RegExp(`\\[#(?:${t})\\]`,`i`)}),i=[n,r,Y({name:`BracketedColumn`,pattern:/\[(?:'['#[\]]|'(?!['#[\]])|[^'[\]])*\]/,longer_alt:[r]}),Y({name:`BareSpecifier`,pattern:RegExp(`#(?:${t})`,`i`)}),Y({name:`ColumnSep`,pattern:/:/}),Y({name:`ListSep`,pattern:new RegExp(e.separators.separatorFunction.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))})];this._lexer=new J(i,{ensureOptimizations:!0});let a={};i.forEach(e=>{a[e.name]=e}),this._vocabulary=a}getVocabulary(){return this._vocabulary}tokenize(e){return this._lexer.tokenize(e)}},$n=class extends Vn{constructor(e=y){let t=new Qn(e),n=t.getVocabulary();super(n,{nodeLocationTracking:`none`,maxLookahead:2,skipValidations:!0,recoveryEnabled:!1}),this._lexer=t;let{TableSpecifier:i,BracketedColumn:a,BareSpecifier:o,ColumnSep:s,ListSep:c}=n,u=this;u.RULE(`ruleContent`,()=>{let e=[],t=u.SUBRULE(u.ruleItem);return u.ACTION(()=>{t&&e.push(t)}),u.MANY(()=>{u.CONSUME(c),u.OPTION(()=>{let t=u.SUBRULE2(u.ruleItem);u.ACTION(()=>{t&&e.push(t)})})}),e}),u.RULE(`ruleItem`,()=>u.OR([{ALT:()=>u.SUBRULE(u.ruleSpecifier)},{ALT:()=>u.SUBRULE(u.ruleColumnOrRange)}])),u.RULE(`ruleSpecifier`,()=>u.OR([{ALT:()=>{let t=u.CONSUME(i);return u.ACTION(()=>{let n=l(t.image,e);return n.image=t.image,n})}},{ALT:()=>{let t=u.CONSUME(o);return u.ACTION(()=>{let n=l(t.image,e);return n.image=t.image,n})}}])),u.RULE(`ruleColumnOrRange`,()=>{let e=u.CONSUME(a),t,n;return u.OPTION(()=>{t=u.CONSUME(s),n=u.CONSUME2(a)}),u.ACTION(()=>{let i=v(e.image);if(i.image=e.image,!n)return i;let a=v(n.image);a.image=n.image;let o=r(`:`,i,a,!0);return o.image=t?.image??`:`,o})}),u.performSelfAnalysis()}_parseInner(e){let t=this._lexer.tokenize(e);return t.errors.length>0||t.tokens.length===0?[]:(this.input=t.tokens,this.reset(),this.ruleContent()??[])}_parseContent(e){if(!e)return[];let t=e.trim();if(!t)return[];let n=t[0];if(n===`@`){let e=t.slice(1).trim();if(!e){let e=s(`@`,null,!0);return e.image=`@`,[e]}if(e.charAt(0)===`[`){let t=this._parseInner(e);if(t.length===1&&t[0].type===`infix`){let e=s(`@`,t[0],!0);return e.image=`@`,[e]}}let n=v(e);n.image=e;let r=s(`@`,n,!0);return r.image=`@`,[r]}if(n!==`[`&&n!==`#`){let t=v(e);return t.image=e,[t]}return this._parseInner(t)}parse(e,t,n){this.reset();let r=()=>({root:a(``,[]),errors:[]});if(!n)return r();let i=0;if(n.charAt(0)===`[`){let e=n.indexOf(`]`);e!==-1&&n.charAt(e+1)===`!`&&(i=e+2)}let o=n.indexOf(`[`,i);if(o===-1)return r();let s=n.slice(0,o),c=n.slice(o+1,-1),l=this._parseContent(c);return{root:a(s,l),errors:this.errors.length>0?[...this.errors]:[]}}},er=new Set([`:`,`.:.`,`.:`,`:.`]),tr=new Set([`.:.`,`.:`,`:.`]),nr=e=>{if(!e)return null;if(e.type===w.Cell){let t=e.value;return t.rowIndex===-(2**53-1)?`col`:t.colIndex===-(2**53-1)?`row`:null}return Number.isInteger(e.value)?`row`:null},rr=(e,t)=>{let n=parseInt(e.charCodeAt(0)===36?e.substring(1):e,10);return n>=1&&n<=t},ir=`A formula must not be empty`,ar=(e,t)=>`A formula must not be longer than ${t} characters (this one is ${e})`;function or(e,t){let n=e?.[0]?.image;if(!n){let e=t?.image;return e?`Expected a value after '${e}'`:`Expected a value`}return`Unexpected '${n}'`}var sr={...yt,buildNoViableAltMessage:e=>or(e.actual,e.previous),buildEarlyExitMessage:e=>or(e.actual,e.previous),buildNotAllInputParsedMessage:e=>{let t=e.firstRedundant?.image;return t?`Unexpected '${t}'`:yt.buildNotAllInputParsedMessage(e)},buildMismatchTokenMessage:e=>{let t=e.actual?.image;return e.expected===X&&t?`Unexpected '${t}'`:yt.buildMismatchTokenMessage(e)}},cr=class extends Vn{constructor(e){let a=e?.lexer??Hn.shared(e?.lexerOptions),l=a.getVocabulary();super(l,{skipValidations:!0,recoveryEnabled:!0,...e,nodeLocationTracking:`full`,errorMessageProvider:sr,maxLookahead:1}),this._ruleInfixOp=this.RULE(`ruleInfixOp`,()=>{let{PlusOp:e,MinOp:t,MulOp:n,DivOp:i,ExOp:a,ConcatOp:o,GtOp:s,EqOp:c,LtOp:l,NeqOp:u,GteOp:d,LteOp:f}=this._vocab,p=[];return p.push({node:this.SUBRULE(this._rulePostfixOp)}),this.MANY(()=>{let r=this.OR(this._c1||=[{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(i).image},{ALT:()=>this.CONSUME(a).image},{ALT:()=>this.CONSUME(o).image},{ALT:()=>this.CONSUME(s).image},{ALT:()=>this.CONSUME(c).image},{ALT:()=>this.CONSUME(l).image},{ALT:()=>this.CONSUME(u).image},{ALT:()=>this.CONSUME(d).image},{ALT:()=>this.CONSUME(f).image}]),m={value:r,index:this.getLexerPosition(),isRange:h.includes(r)},g=this.SUBRULE2(this._rulePostfixOp);p.push({op:m,node:g})}),this.ACTION(()=>{let e=p.length-1,t=g.length;for(let n=0;e>0&&n<t;n++){let t=g[n],i=1;for(;i<p.length;){let n=p[i].op;if(t.includes(n.value)){let t=p[i-1].node,a=p[i].node,o=r(n.value,t,a,n.isRange);o=this._tag(o,n.index),p[i-1].node=o,p.splice(i,1),e--}else i++}}}),p[0].node}),this._rulePlusMinusOp=this.RULE(`rulePlusMinusOp`,()=>{let{PlusOp:e,MinOp:t}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)}])}),this._rulePostfixOp=this.RULE(`rulePostfixOp`,()=>{let{PercentOp:e}=this._vocab,t=this.SUBRULE(this._rulePrefixOp),n=[];return this.MANY(()=>{let t=this.CONSUME(e).image;this.ACTION(()=>{n.push([t,this.getLexerPosition()])})}),this.ACTION(()=>{let e=n.length;if(e!==0)for(let r=0;r<e;r++){let e=n[r],i=e[0],a=e[1],o=h.includes(i);t=E(i,t,o),t=this._tag(t,a)}}),t}),this._rulePrefixOp=this.RULE(`rulePrefixOp`,()=>{let{PlusOp:e,MinOp:t,ImplicitIntersectOp:n}=this._vocab,r=[];this.MANY(()=>{let i=this.OR([{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image}]);this.ACTION(()=>{r.push([i,this.getLexerPosition()])})});let i=this.SUBRULE(this._ruleRangeOp);return this.ACTION(()=>{let e=r.length;if(e!==0)for(let t=e-1;t>=0;t--){let e=r[t],n=e[0],a=e[1],o=h.includes(n);i=s(n,i,o),i=this._tag(i,a)}}),i}),this._ruleRangeOp=this.RULE(`ruleRangeOp`,()=>{let{RangeOp:e,RangeTrimFullOp:t,RangeTrimLeadingOp:n,RangeTrimTrailingOp:i,ArrayAnchorOp:a}=this._vocab,o=[];return o.push({node:this.SUBRULE(this._ruleCallOp)}),this.MANY2(()=>{this.CONSUME(a),o.push({anchor:this.getLexerPosition()})}),this.MANY(()=>{let r={value:this.OR(this._c2||=[{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(i).image}]),index:this.getLexerPosition()},s=this.SUBRULE2(this._ruleCallOp);o.push({op:r,node:s}),this.MANY3(()=>{this.CONSUME2(a),o.push({anchor:this.getLexerPosition()})})}),this.ACTION(()=>{for(let e=1;e+1<o.length;e++){let t=o[e],n=o[e+1];if(t.op?.value!==`:`||n.op?.value!==`:`)continue;let i=nr(t.node);i&&nr(n.node)===i&&nr(o[e-1].node)!==i&&(t.node=this._tag(r(`:`,t.node,n.node,!0),n.op.index),o.splice(e+1,1))}for(let e=1;e<o.length;e++){let t=o[e];if(t.anchor!==void 0){o[0].node=this._tag(E(`#`,o[0].node,!0),t.anchor);continue}let n=t.op,i=r(n.value,o[0].node,t.node,!0);i=this._tag(i,n.index),o[0].node=i}}),o[0].node}),this._ruleCallOp=this.RULE(`ruleCallOp`,()=>{let{OpenParen:e,CloseParen:t}=this._vocab,n=this.SUBRULE(this._ruleFormula);return this.MANY({GATE:()=>{let t=this.LA(0),n=this.LA(1);return!(!t||!n||n.tokenType!==e)&&n.startOffset===t.endOffset+1},DEF:()=>{this.CONSUME(e);let r=this.getLexerPosition(),i=this.SUBRULE(this._ruleFunctionArguments),a=n,o=this.ACTION(()=>this._tag(_(a,i),r)),s=this.OPTION(()=>this.CONSUME(t));this.ACTION(()=>{s||this._reportError(o,`Missing closing parenthesis ')'`,r),this._tagClose(o,this.getLexerPosition()),n=o})}}),n}),this._ruleIntersectOp=this.RULE(`ruleIntersectOp`,()=>{let e=[this.SUBRULE(this._ruleInfixOp)];return this.MANY(()=>{this.OPTION({GATE:()=>{let e=this.LA(0);return this.LA(1).startOffset>e.endOffset+1},DEF:()=>{e.push(this.SUBRULE3(this._ruleInfixOp))}})}),this.ACTION(()=>{for(;e.length>1;){let t=e.length-1;for(let n=0;n<t;n++){let i=e[n],a=e[n+1],o=r(` `,i,a,!0),s=this._tokenMap.get(i);s&&delete s.tokenIndexClose;let c=this._tokenMap.get(a),l=c?.tokenIndex;if(l!==void 0){let e=this.input[l],t=this.input[l-1]?.endOffset??-1,n=this._inputText.slice(t+1,e.startOffset).slice(0,-1);n.length>0&&(o.wsBefore=n)}c&&delete c.tokenIndex,n+1<t&&c&&delete c.tokenIndexClose,e.splice(n,2,o),n--,t--}}}),e[0]}),this._ruleFormula=this.RULE(`ruleFormula`,()=>this.OR9([{ALT:()=>this.SUBRULE(this._ruleLiteral)},{ALT:()=>this.SUBRULE(this._ruleReference)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>this.SUBRULE(this._ruleParen)},{ALT:()=>this.SUBRULE(this._ruleTableReference)},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleLiteralArray)}])),this._ruleGroup=this.RULE(`ruleGroup`,()=>{let{ArgSeparator:e}=this._vocab,t=[];return this.MANY(()=>{this.CONSUME(e);let n=this.SUBRULE2(this._ruleIntersectOp);this.ACTION(()=>{t.push(n)})}),t}),this._ruleParen=this.RULE(`ruleParen`,()=>{let{OpenParen:e,CloseParen:t}=this._vocab;return this._processParen(w.Paren,e,t)}),this._ruleLiteralArray=this.RULE(`ruleLiteralArray`,()=>{let{OpenCurlyParen:e,CloseCurlyParen:t,ColSeparator:n,RowSeparator:r}=this._vocab,i=T();this.CONSUME(e);let a=this.getLexerPosition(),o=this.ACTION(()=>this._tag(C(i),a)),s=this.SUBRULE(this._ruleLiteralForArray);this.ACTION(()=>{i.value.push(s)}),this.MANY(()=>{let e=!1;this.OR([{ALT:()=>{this.CONSUME(n),e=!0}},{ALT:()=>this.CONSUME(r)}]);let t=this.SUBRULE2(this._ruleLiteralForArray);this.ACTION(()=>{e||(i=T(),o.value.push(i)),i.value.push(t)})});let c=this.OPTION(()=>this.CONSUME(t));return o=this.ACTION(()=>(c||this._reportError(o,`Missing closing parenthesis '}'`,a),this._tagClose(o,this.getLexerPosition()))),o}),this._ruleLiteralForArray=this.RULE(`ruleLiteralForArray`,()=>{let{StringToken:e,BooleanToken:t,LiteralError:n,RefError:r}=this._vocab;return this.OR([{ALT:()=>{let e=this.OPTION(()=>this.SUBRULE(this._rulePlusMinusOp)),t=this.SUBRULE(this._ruleNumber),n=this.ACTION(()=>this._tag(f(t.image,this._locale),this.getLexerPosition()));return this.ACTION(()=>e?i(e.image,n):n)}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(re(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(t);return this.ACTION(()=>this._tag(S(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(c(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);return this.ACTION(()=>this._tag(o(e.image,this._locale),this.getLexerPosition()))}}])}),this._ruleLiteral=this.RULE(`ruleLiteral`,()=>{let{StringToken:e,BooleanToken:t,LiteralError:n,RefError:r}=this._vocab;return this.OR([{ALT:()=>{let e=this.SUBRULE(this._ruleNumber);return this.ACTION(()=>this._tag(f(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(re(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(t);return this.ACTION(()=>this._tag(S(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(c(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);return this.ACTION(()=>this._tag(o(e.image,this._locale),this.getLexerPosition()))}}])}),this._ruleFunction=this.RULE(`ruleFunction`,()=>{let{FunctionToken:e,OpenParen:t,CloseParen:n}=this._vocab,r=this.CONSUME(e).image,i=this.getLexerPosition();this.CONSUME(t);let a=this.SUBRULE(this._ruleFunctionArguments),o=this.ACTION(()=>this._tag(p(r,a),i)),s=this.OPTION(()=>this.CONSUME(n));return o=this.ACTION(()=>(s||this._reportError(o,`Missing closing parenthesis ')'`,i),this._tagClose(o,this.getLexerPosition()))),o}),this._ruleFunctionArguments=this.RULE(`ruleFunctionArguments`,()=>{let{ArgSeparator:e,CloseParen:t}=this._vocab,n=[];return this.OPTION({GATE:()=>this.LA(1).tokenType!==t,DEF:()=>{let t;this.OPTION2(()=>{t=this.SUBRULE(this._ruleIntersectOp)}),t=this.ACTION(()=>t??this._tagClose(x(),this.getLexerPosition())),n.push(t),this.MANY(()=>{let t;this.CONSUME(e),this.OPTION3(()=>{t=this.SUBRULE2(this._ruleIntersectOp)}),t=this.ACTION(()=>t??this._tagClose(x(),this.getLexerPosition())),n.push(t)})}}),n}),this._ruleBracketedString=this.RULE(`ruleBracketedString`,()=>{let{BracketedString:e}=this._vocab,t=this.CONSUME(e),n=this.getLexerPosition();return this.ACTION(()=>{let e=this._srParser.parse(this.rowIndex,this.colIndex,t.image);for(let t of e.errors)this._astErrors.push(t);return this._tag(e.root,n)})}),this._ruleTableReference=this.RULE(`ruleTableReference`,()=>{let{TableReference:e}=this._vocab,t=this.CONSUME(e),n=this.getLexerPosition();return this.ACTION(()=>{let e=this._srParser.parse(this.rowIndex,this.colIndex,t.image);for(let t of e.errors)this._astErrors.push(t);return this._tag(e.root,n)})}),this._ruleReference=this.RULE(`ruleReference`,()=>{let{Sheet:e,SheetQuoted:r,DivOp:i,MulOp:a,PlusOp:s,MinOp:c,ArgSeparator:l,Cell:u,NamedToken:d,SingleQuotedString:f,Column:p,AbsRow:h,DigitToken:g,RefError:_}=this._vocab,v,y;this.OPTION2({GATE:()=>{for(let t=1;t<6;t++){let n=this.LA(t);if(n.tokenType===e||n.tokenType===r)return!0;if(n.image===``||n.image===`)`||n.tokenType===i||n.tokenType===a||n.tokenType===s||n.tokenType===c||n.tokenType===l)break}return!1},DEF:()=>{y=this.getLexerPosition()+1,v=this.SUBRULE(this._rulePrefixSheetName)}});let b=this.OR([{ALT:()=>{let e=this.CONSUME(u),t=this.getLexerPosition();return this.ACTION(()=>this._tag(n(e.image,this.rowIndex,this.colIndex),t))}},{ALT:()=>{let e=this.OR2([{ALT:()=>this.CONSUME(d)},{ALT:()=>this.CONSUME(f)}]);return this.ACTION(()=>this._tag(t(e.image),this.getLexerPosition()))}},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>{let e=this.CONSUME(p);return this.ACTION(()=>this._tag(m(e.image,this.colIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(h);return this.ACTION(()=>this._tag(ne(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(g);return this.ACTION(()=>this._tag(ne(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(_);return this.ACTION(()=>this._tag(o(e.image,this._locale),this.getLexerPosition()))}}]);return this.ACTION(()=>{if(v&&b){if(v.name===``)return void this._reportError(b,`'${v.image}' is not a valid sheet reference — a '!' needs a sheet name before it`);let e=b;if(b.type===w.Postfix&&b.inputs?.[0]&&(e=b.inputs[0]),e.type===w.Cell||e.type===w.Named||e.type===w.Row||e.type===w.TableColumn||e.type===w.Error){e.value.scope=v.name,e.value.scopeImage=v.image;let t=this._tokenMap.get(e);t&&y!==void 0&&(t.tokenIndex=y)}}}),b}),this._rulePrefixSheetName=this.RULE(`rulePrefixSheetName`,()=>{let{SheetQuoted:e,BracketedString:t,NamedToken:n,Column:r,RangeOp:i,Sheet:a}=this._vocab;return this.OR([{ALT:()=>{let t=this.CONSUME(e).image;return{name:t.slice(1,-2).replace(/''/g,`'`),image:t}}},{ALT:()=>{let e=``;this.OPTION(()=>{e+=this.CONSUME(t).image}),this.OPTION2({GATE:()=>this.LA(2).tokenType===i,DEF:()=>{e+=this.OR2([{ALT:()=>this.CONSUME(n).image},{GATE:()=>this.LA(1).image.charCodeAt(0)!==36,ALT:()=>this.CONSUME(r).image}]),this.CONSUME(i),e+=`:`}});let o=this.CONSUME(a).image;return{name:e+o.slice(0,-1),image:e+o}}}])}),this._ruleNumber=this.RULE(`ruleNumber`,()=>{let{NumberToken:e,ScientificDigit:t,DigitToken:n}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)},{ALT:()=>this.CONSUME(n)}])}),this._ruleRoot=this.RULE(`ruleRoot`,()=>{let{ArgSeparator:e}=this._vocab,t=this.SUBRULE(this._ruleIntersectOp),n=[];return this.MANY(()=>{this.CONSUME(e),n.push(this.SUBRULE2(this._ruleIntersectOp))}),this.ACTION(()=>n.length===0?t:{type:w.List,value:`,`,inputs:[t,...n],isReference:!0})}),this._lexer=a,this._locale=a.getLocale(),this._vocab=l,this._srParser=e?.srParser??new $n(this._locale),this.performSelfAnalysis()}getLexer(){return this._lexer}parse(n,r,i){let a=this._lexer.tokenize(i),o;if(!a)return{root:{type:w.Unparsed,value:i},errors:[]};let s=a.tokens;if(s.length===0)throw new e.Parse(ir);return this.input=s,this._inputText=i,this._inputTextLength=i.length,this.rowIndex=n,this.colIndex=r,this._astErrors=[],this._tokenMap=new Map,this.reset(),o=this._ruleRoot(),o&&this._bindAllWhitespace(o),o=u(o,(e,r)=>{let i=e.type,a=r?.isReference?r.value:void 0,o=typeof a==`string`&&er.has(a),s=typeof a==`string`&&tr.has(a),c=o?r.inputs:void 0,l=c?c[0]===e?c[1]:c[0]:void 0,u=this._lexer.getMaxRow();if(o&&i!==w.Cell&&Number.isInteger(e.value)){let t=ne(e.image,n);return b(t,e),nr(l)===`row`?rr(e.image,u)||this._reportError(t,`'${e.image}' is not a valid row — rows run from 1 to ${u}`):this._reportError(t,`'${e.image}' is not a valid reference — a whole row can only pair with another row (as in ${e.image}:${e.image})`),t}if(s&&i===w.Named)return this._reportError(e,`'${e.image??e.value?.nameId}' is a name — '${a}' needs a cell or range on both sides`),e;if(i===w.Cell){let n=e.value,r=n.colIndex===-(2**53-1),i=n.rowIndex===-(2**53-1);if((r||i)&&nr(l)===(r?`row`:`col`))return r&&!rr(e.image,u)&&this._reportError(e,`'${e.image}' is not a valid row — rows run from 1 to ${u}`),e;if(r||i||n.colIndex>=16384){let o=t(e.image);b(o,e);let c=n.scope;return c&&(o.value.scope=c,o.value.scopeImage=n.scopeImage),r?this._reportError(o,`'${e.image}' is not a valid reference — a row needs a column (use ${e.image}:${e.image} for the whole row)`):i&&e.image.includes(`$`)?this._reportError(o,`'${e.image}' is not a valid reference — a whole column can only pair with another column (as in ${e.image}:${e.image})`):s&&this._reportError(o,`'${e.image}' is a name — '${a}' needs a cell or range on both sides`),o}}return e}),{root:o,errors:[...this.errors,...this._astErrors]}}_processParen(e,t,n){let r;this.CONSUME(t);let i=this.getLexerPosition();r=this.ACTION(()=>(r={type:e,value:null,inputs:null},this._tag(r,i)));let a=[],o=this.SUBRULE(this._ruleIntersectOp);o&&a.push(o);let s=this.SUBRULE(this._ruleGroup),c=this.OPTION(()=>this.CONSUME(n));return r=this.ACTION(()=>{if(s)for(let e=0;e<s.length;e++)a.push(s[e]);return r&&(c||this._reportError(r,`Missing closing parenthesis`,i),r.inputs=a),this._tagClose(r,this.getLexerPosition())}),r}_reportError(e,t,n=void 0,r=`SyntaxError`){n===void 0&&(n=this.getLexerPosition()),e.error=!0,this._astErrors.push({name:r,message:t,previousToken:this.input[n],ast:e})}_tag(e,t){return e?(e.image??=this.input[t].image,this._tokenMap.set(e,{tokenIndex:t,tokenIndexClose:t}),e):(console.warn(`node is null`),e)}_tagClose(e,t){let n=this._tokenMap.get(e);return n?n.tokenIndexClose=t:this._tokenMap.set(e,{tokenIndexClose:t}),e}_bindNodeWhitespace(e){let t=this._tokenMap.get(e);if(!t)return;let n=this.input,r=this._inputText,i=t.tokenIndex;if(i!==void 0){let t=n[i],a=n[i-1]?.endOffset??-1;a+1<t.startOffset&&(e.wsBefore=r.slice(a+1,t.startOffset))}let a=t.tokenIndexClose;if(a!==void 0){let t=n[a],i=n[a+1]?.startOffset??this._inputTextLength;t.endOffset+1<i&&(e.wsAfter=r.slice(t.endOffset+1,i))}}_bindAllWhitespace(e){if(e){if(this._bindNodeWhitespace(e),e.inputs)for(let t of e.inputs)t&&this._bindAllWhitespace(t);if(e.type===w.Array&&Array.isArray(e.value)){for(let t of e.value)if(t&&Array.isArray(t.value))for(let e of t.value)e&&this._bindAllWhitespace(e)}}}};export{ir as i,ar as n,cr as r,Hn as t};
|
|
57
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return Nn.call(this,N,e,t)}atLeastOneInternalRecord(e,t){Nn.call(this,P,t,e)}atLeastOneSepFirstInternalRecord(e,t){Nn.call(this,F,t,e,kn)}manyInternalRecord(e,t){Nn.call(this,I,t,e)}manySepFirstInternalRecord(e,t){Nn.call(this,L,t,e,kn)}orInternalRecord(e,t){return Pn.call(this,e,t)}subruleInternalRecord(e,t,n){if(In(t),!e||!Object.hasOwn(e,`ruleName`)){let n=Error(`<SUBRULE${Fn(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=e.ruleName,a=new A({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?Mn:On}consumeInternalRecord(e,t,n){if(In(t),!nt(e)){let n=Error(`<CONSUME${Fn(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=new z({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),jn}},class{initPerformanceTracer(e){if(Object.hasOwn(e,`traceInitPerf`)){let t=e.traceInitPerf,n=typeof t==`number`;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=$.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:i}=ae(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}}].forEach(e=>{let t=e.prototype;Object.getOwnPropertyNames(t).forEach(n=>{if(n===`constructor`)return;let r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(zn.prototype,n,r):zn.prototype[n]=e.prototype[n]})});var Vn=class extends Bn{constructor(e,t=$){let n=Object.assign({},t);n.outputCst=!1,super(e,n)}},Hn=class t{static shared(e){let n=e?.locale??T,r=e?.maxColumn??Kn,i=e?.maxRow??qn,a=Gn.get(n);a||(a=new Map,Gn.set(n,a));let o=`${r}:${i}`,s=a.get(o);return s||(s=new t({locale:n,maxColumn:r,maxRow:i}),a.set(o,s)),s}constructor(e){let t=e?.maxColumn??Kn,n=e?.maxRow??qn,r=e?.locale??T;this._locale=r,this._maxColumn=t,this._maxRow=n;let{separatorFunction:i,separatorColumn:o,separatorRow:s,separatorDecimal:c}=r.separators;if(o===s)throw Error(`FormulaLexer: separatorColumn and separatorRow must differ (both '${o}')`);let l=Y({name:`WhiteSpace`,pattern:/[ \n\v\f\r\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,group:J.SKIPPED}),u=Y({name:`StringToken`,pattern:/"(""|[^"])*"/}),d=Y({name:`FunctionToken`,pattern:/[a-zA-Z_\u007F-\uFFFF]+[a-zA-Z0-9_.\u007F-\uFFFF]*(?=\()/}),f=Y({name:`TableReference`,pattern:{exec:a},line_breaks:!1,start_chars_hint:Wn}),p=Y({name:`BracketedString`,pattern:{exec:ne},line_breaks:!1,start_chars_hint:[91],longer_alt:[f,u]}),m=e=>(e??[]).map(e=>e?.trim()).filter(Boolean).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).map(e=>e+`|`).join(``),h=e=>e.replace(/[A-Za-z]/g,e=>`[${e.toUpperCase()}${e.toLowerCase()}]`),g=Y({name:`LiteralError`,pattern:new RegExp(m(r.errorLiterals)+[`#PARSE!`,`#NULL!`,`#DIV\\/0!`,`#VALUE!`,`#NUM!`,`#FIELD!`,`#N\\/A`,`#GETTING_DATA`,`#SPILL!`,`#CONNECT!`,`#BLOCKED!`,`#UNKNOWN!`,`#CALC!`,`#BUSY!`,`#PYTHON!`,`#TIMEOUT!`].map(h).join(`|`))}),_=Y({name:`RefError`,pattern:new RegExp(m(r.errorRefs)+[`#REF!`,`#NAME\\?`].map(h).join(`|`))}),v=Y({name:`SingleQuotedString`,pattern:/'(''|[^'])*'/}),y=Y({name:`SheetQuoted`,pattern:/'(?:''|[^'])*?'!/}),ee=Y({name:`Sheet`,pattern:/[A-Za-z_.\d\u007F-\uFFFF]*!/}),b=/[a-zA-Z_\\\u007F-\uFFFF][a-zA-Z0-9_.?\\\u007F-\uFFFF]*:?/y,x=Y({name:`NamedToken`,pattern:{exec:(e,t)=>{b.lastIndex=t;let n=b.exec(e);if(!n)return null;let r=n[0],i=r.indexOf(`.:`);return i===-1?r.endsWith(`:`)&&(r=r.slice(0,-1)):r=r.substring(0,i),[r]}},line_breaks:!1,start_chars_hint:Wn}),te=Y({name:`Cell`,pattern:{exec:Xn(t,n)},line_breaks:!1,start_chars_hint:[36,...Un],longer_alt:x}),S=Y({name:`Column`,pattern:{exec:Yn(t)},line_breaks:!1,start_chars_hint:[36,...Un],longer_alt:x}),C=Y({name:`AbsRow`,pattern:/[$][0-9]+/}),w=c===`.`?`\\.`:c,re=Y({name:`NumberToken`,pattern:RegExp(`[0-9]+${w}(?!:)[0-9]*([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|${w}[0-9]+([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+`)}),ie=Y({name:`ScientificDigit`,pattern:/[0-9]+\*\*[+-]?[0-9]+/}),E=Y({name:`DigitToken`,pattern:/[0-9]+/}),D=[`TRUE`,`FALSE`];for(let e of[r.booleanTrue,r.booleanFalse]){let t=e?.trim();t&&!D.some(e=>e.toLowerCase()===t.toLowerCase())&&D.push(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}let ae=Y({name:`BooleanToken`,pattern:new RegExp(D.join(`|`),`i`)}),O=Y({name:`ArgSeparator`,pattern:Zn(i)}),k=Y({name:`ColSeparator`,pattern:Zn(o)}),A=Y({name:`RowSeparator`,pattern:Zn(s)}),j=Y({name:`RangeOp`,pattern:/:/}),M=Y({name:`RangeTrimFullOp`,pattern:/\.:\./}),N=Y({name:`RangeTrimLeadingOp`,pattern:/\.:/}),P=Y({name:`RangeTrimTrailingOp`,pattern:/:\./}),F=Y({name:`OpenParen`,pattern:/\(/}),I=Y({name:`CloseParen`,pattern:/\)/}),L=Y({name:`OpenCurlyParen`,pattern:/{/}),R=Y({name:`CloseCurlyParen`,pattern:/}/}),z=Y({name:`QuoteS`,pattern:/'/}),oe=Y({name:`MulOp`,pattern:/\*(?!\*)/}),B=Y({name:`PlusOp`,pattern:/\+/}),se=Y({name:`DivOp`,pattern:/\//}),ce=Y({name:`MinOp`,pattern:/-/}),V=Y({name:`ImplicitIntersectOp`,pattern:/@/}),le=Y({name:`ConcatOp`,pattern:/&/}),ue=Y({name:`ExOp`,pattern:/\^/}),de=Y({name:`PercentOp`,pattern:/%/}),fe=Y({name:`ArrayAnchorOp`,pattern:/#/,longer_alt:[g,_]}),pe=Y({name:`GtOp`,pattern:/>/}),H=Y({name:`EqOp`,pattern:/=/}),me=Y({name:`LtOp`,pattern:/</}),U=[l,u,y,v,ee,d,f,p,g,_,O,...o===i?[]:[k],A,M,N,P,j,te,ae,S,C,re,ie,E,fe,V,x,F,I,L,R,z,oe,B,se,ce,le,ue,de,Y({name:`NeqOp`,pattern:/<>/}),Y({name:`GteOp`,pattern:/>=/}),Y({name:`LteOp`,pattern:/<=/}),pe,H,me];this._lexer=new J(U,{ensureOptimizations:!0});let W={};U.forEach(e=>{W[e.name]=e}),o===i&&(W.ColSeparator=O),this._vocabulary=W}tokenize(t,n=!0){let r=this._lexer.tokenize(t);if(n&&r.errors.length>0){let n=r.errors[0],i=n.line,a=n.column,o=t.substr(n.offset,n.length||1),s=o?`Unexpected character '${o}'`:n.message;throw new e.Parse(s,{line:i,column:a,offset:n.offset,length:n.length})}return r}getVocabulary(){return this._vocabulary}getLocale(){return this._locale}getMaxColumn(){return this._maxColumn}getMaxRow(){return this._maxRow}getSeparators(){return this._locale.separators}},Un=(()=>{let e=[];for(let t=65;t<=90;t++)e.push(t);for(let t=97;t<=122;t++)e.push(t);for(let t=48;t<=57;t++)e.push(t);return e})().filter(e=>e<48||e>57),Wn=(()=>{let e=[...Un,95,92];for(let t=127;t<=65535;t++)e.push(t);return e})(),Gn=new WeakMap,Kn=16384,qn=1048576;function Jn(e,t,n){let r=0;for(let i=t;i<n;i++){let t=e.charCodeAt(i);r=26*r+(t>=97?t-96:t-64)}return r}function Yn(e){return(t,n)=>{let r=n;t.charCodeAt(r)===36&&r++;let i=r;for(;r<t.length&&r-i<3;){let e=t.charCodeAt(r);if(!(e>=65&&e<=90||e>=97&&e<=122))break;r++}if(r-i===0||Jn(t,i,r)>e)return null;if(r<t.length){let e=t.charCodeAt(r);if(e>=48&&e<=57)return null}return[t.substring(n,r)]}}function Xn(e,t){return(n,r)=>{let i=r;n.charCodeAt(i)===36&&i++;let a=i;for(;i<n.length&&i-a<3;){let e=n.charCodeAt(i);if(!(e>=65&&e<=90||e>=97&&e<=122))break;i++}if(i-a===0||Jn(n,a,i)>e)return null;i<n.length&&n.charCodeAt(i)===36&&i++;let o=i;for(;i<n.length;){let e=n.charCodeAt(i);if(!(e>=48&&e<=57))break;i++}if(i===o)return null;let s=parseInt(n.substring(o,i),10);return s<1||s>t?null:[n.substring(r,i)]}}function Zn(e){return new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}var Qn=class{constructor(e=T){let t=function(e){let t=[...m];if(e)for(let n of Object.values(e)){let e=n?.trim();e&&!t.some(t=>t.toLowerCase()===e.toLowerCase())&&t.push(e)}return t.sort((e,t)=>t.length-e.length),t.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)}(e.specifiers),n=Y({name:`WhiteSpace`,pattern:/\s+/,group:J.SKIPPED}),r=Y({name:`TableSpecifier`,pattern:RegExp(`\\[#(?:${t})\\]`,`i`)}),i=[n,r,Y({name:`BracketedColumn`,pattern:/\[(?:'['#[\]]|'(?!['#[\]])|[^'[\]])*\]/,longer_alt:[r]}),Y({name:`BareSpecifier`,pattern:RegExp(`#(?:${t})`,`i`)}),Y({name:`ColumnSep`,pattern:/:/}),Y({name:`ListSep`,pattern:new RegExp(e.separators.separatorFunction.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))})];this._lexer=new J(i,{ensureOptimizations:!0});let a={};i.forEach(e=>{a[e.name]=e}),this._vocabulary=a}getVocabulary(){return this._vocabulary}tokenize(e){return this._lexer.tokenize(e)}},$n=class extends Vn{constructor(e=T){let t=new Qn(e),n=t.getVocabulary();super(n,{nodeLocationTracking:`none`,maxLookahead:2,skipValidations:!0,recoveryEnabled:!1}),this._lexer=t;let{TableSpecifier:r,BracketedColumn:i,BareSpecifier:a,ColumnSep:s,ListSep:l}=n,u=this;u.RULE(`ruleContent`,()=>{let e=[],t=u.SUBRULE(u.ruleItem);return u.ACTION(()=>{t&&e.push(t)}),u.MANY(()=>{u.CONSUME(l),u.OPTION(()=>{let t=u.SUBRULE2(u.ruleItem);u.ACTION(()=>{t&&e.push(t)})})}),e}),u.RULE(`ruleItem`,()=>u.OR([{ALT:()=>u.SUBRULE(u.ruleSpecifier)},{ALT:()=>u.SUBRULE(u.ruleColumnOrRange)}])),u.RULE(`ruleSpecifier`,()=>u.OR([{ALT:()=>{let t=u.CONSUME(r);return u.ACTION(()=>{let n=c(t.image,e);return n.image=t.image,n})}},{ALT:()=>{let t=u.CONSUME(a);return u.ACTION(()=>{let n=c(t.image,e);return n.image=t.image,n})}}])),u.RULE(`ruleColumnOrRange`,()=>{let e=u.CONSUME(i),t,n;return u.OPTION(()=>{t=u.CONSUME(s),n=u.CONSUME2(i)}),u.ACTION(()=>{let r=o(e.image);if(r.image=e.image,!n)return r;let i=o(n.image);i.image=n.image;let a=C(`:`,r,i,!0);return a.image=t?.image??`:`,a})}),u.performSelfAnalysis()}_parseInner(e){let t=this._lexer.tokenize(e);return t.errors.length>0||t.tokens.length===0?[]:(this.input=t.tokens,this.reset(),this.ruleContent()??[])}_parseContent(e){if(!e)return[];let t=e.trim();if(!t)return[];let n=t[0];if(n===`@`){let e=t.slice(1).trim();if(!e){let e=g(`@`,null,!0);return e.image=`@`,[e]}if(e.charAt(0)===`[`){let t=this._parseInner(e);if(t.length===1&&t[0].type===`infix`){let e=g(`@`,t[0],!0);return e.image=`@`,[e]}}let n=o(e);n.image=e;let r=g(`@`,n,!0);return r.image=`@`,[r]}if(n!==`[`&&n!==`#`){let t=o(e);return t.image=e,[t]}return this._parseInner(t)}parse(e,t,r){this.reset();let i=()=>({root:n(``,[]),errors:[]});if(!r)return i();let a=0;if(r.charAt(0)===`[`){let e=r.indexOf(`]`);e!==-1&&r.charAt(e+1)===`!`&&(a=e+2)}let o=r.indexOf(`[`,a);if(o===-1)return i();let s=r.slice(0,o),c=r.slice(o+1,-1),l=this._parseContent(c);return{root:n(s,l),errors:this.errors.length>0?[...this.errors]:[]}}},er=new Set([`:`,`.:.`,`.:`,`:.`]),tr=new Set([`.:.`,`.:`,`:.`]),nr=e=>{if(!e)return null;if(e.type===v.Cell){let t=e.value;return t.rowIndex===-(2**53-1)?`col`:t.colIndex===-(2**53-1)?`row`:null}return Number.isInteger(e.value)?`row`:null},rr=(e,t)=>{let n=parseInt(e.charCodeAt(0)===36?e.substring(1):e,10);return n>=1&&n<=t},ir=`A formula must not be empty`,ar=(e,t)=>`A formula must not be longer than ${t} characters (this one is ${e})`;function or(e,t){let n=e?.[0]?.image;if(!n){let e=t?.image;return e?`Expected a value after '${e}'`:`Expected a value`}return`Unexpected '${n}'`}var sr={...yt,buildNoViableAltMessage:e=>or(e.actual,e.previous),buildEarlyExitMessage:e=>or(e.actual,e.previous),buildNotAllInputParsedMessage:e=>{let t=e.firstRedundant?.image;return t?`Unexpected '${t}'`:yt.buildNotAllInputParsedMessage(e)},buildMismatchTokenMessage:e=>{let t=e.actual?.image;return e.expected===X&&t?`Unexpected '${t}'`:yt.buildMismatchTokenMessage(e)}},cr=class extends Vn{constructor(e){let n=e?.lexer??Hn.shared(e?.lexerOptions),a=n.getVocabulary();super(a,{skipValidations:!0,recoveryEnabled:!0,...e,nodeLocationTracking:`full`,errorMessageProvider:sr,maxLookahead:1}),this._ruleInfixOp=this.RULE(`ruleInfixOp`,()=>{let{PlusOp:e,MinOp:t,MulOp:n,DivOp:i,ExOp:a,ConcatOp:o,GtOp:s,EqOp:c,LtOp:u,NeqOp:d,GteOp:f,LteOp:p}=this._vocab,m=[];return m.push({node:this.SUBRULE(this._rulePostfixOp)}),this.MANY(()=>{let r=this.OR(this._c1||=[{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(i).image},{ALT:()=>this.CONSUME(a).image},{ALT:()=>this.CONSUME(o).image},{ALT:()=>this.CONSUME(s).image},{ALT:()=>this.CONSUME(c).image},{ALT:()=>this.CONSUME(u).image},{ALT:()=>this.CONSUME(d).image},{ALT:()=>this.CONSUME(f).image},{ALT:()=>this.CONSUME(p).image}]),h={value:r,index:this.getLexerPosition(),isRange:l.includes(r)},g=this.SUBRULE2(this._rulePostfixOp);m.push({op:h,node:g})}),this.ACTION(()=>{let e=m.length-1,t=r.length;for(let n=0;e>0&&n<t;n++){let t=r[n],i=1;for(;i<m.length;){let n=m[i].op;if(t.includes(n.value)){let t=m[i-1].node,r=m[i].node,a=C(n.value,t,r,n.isRange);a=this._tag(a,n.index),m[i-1].node=a,m.splice(i,1),e--}else i++}}}),m[0].node}),this._rulePlusMinusOp=this.RULE(`rulePlusMinusOp`,()=>{let{PlusOp:e,MinOp:t}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)}])}),this._rulePostfixOp=this.RULE(`rulePostfixOp`,()=>{let{PercentOp:e}=this._vocab,t=this.SUBRULE(this._rulePrefixOp),n=[];return this.MANY(()=>{let t=this.CONSUME(e).image;this.ACTION(()=>{n.push([t,this.getLexerPosition()])})}),this.ACTION(()=>{let e=n.length;if(e!==0)for(let r=0;r<e;r++){let e=n[r],i=e[0],a=e[1],o=l.includes(i);t=s(i,t,o),t=this._tag(t,a)}}),t}),this._rulePrefixOp=this.RULE(`rulePrefixOp`,()=>{let{PlusOp:e,MinOp:t,ImplicitIntersectOp:n}=this._vocab,r=[];this.MANY(()=>{let i=this.OR([{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image}]);this.ACTION(()=>{r.push([i,this.getLexerPosition()])})});let i=this.SUBRULE(this._ruleRangeOp);return this.ACTION(()=>{let e=r.length;if(e!==0)for(let t=e-1;t>=0;t--){let e=r[t],n=e[0],a=e[1],o=l.includes(n);i=g(n,i,o),i=this._tag(i,a)}}),i}),this._ruleRangeOp=this.RULE(`ruleRangeOp`,()=>{let{RangeOp:e,RangeTrimFullOp:t,RangeTrimLeadingOp:n,RangeTrimTrailingOp:r,ArrayAnchorOp:i}=this._vocab,a=[];return a.push({node:this.SUBRULE(this._ruleCallOp)}),this.MANY2(()=>{this.CONSUME(i),a.push({anchor:this.getLexerPosition()})}),this.MANY(()=>{let o={value:this.OR(this._c2||=[{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(r).image}]),index:this.getLexerPosition()},s=this.SUBRULE2(this._ruleCallOp);a.push({op:o,node:s}),this.MANY3(()=>{this.CONSUME2(i),a.push({anchor:this.getLexerPosition()})})}),this.ACTION(()=>{for(let e=1;e+1<a.length;e++){let t=a[e],n=a[e+1];if(t.op?.value!==`:`||n.op?.value!==`:`)continue;let r=nr(t.node);r&&nr(n.node)===r&&nr(a[e-1].node)!==r&&(t.node=this._tag(C(`:`,t.node,n.node,!0),n.op.index),a.splice(e+1,1))}for(let e=1;e<a.length;e++){let t=a[e];if(t.anchor!==void 0){a[0].node=this._tag(s(`#`,a[0].node,!0),t.anchor);continue}let n=t.op,r=C(n.value,a[0].node,t.node,!0);r=this._tag(r,n.index),a[0].node=r}}),a[0].node}),this._ruleCallOp=this.RULE(`ruleCallOp`,()=>{let{OpenParen:e,CloseParen:t}=this._vocab,n=this.SUBRULE(this._ruleFormula);return this.MANY({GATE:()=>{let t=this.LA(0),n=this.LA(1);return!(!t||!n||n.tokenType!==e)&&n.startOffset===t.endOffset+1},DEF:()=>{this.CONSUME(e);let r=this.getLexerPosition(),i=this.SUBRULE(this._ruleFunctionArguments),a=n,o=this.ACTION(()=>this._tag(h(a,i),r)),s=this.OPTION(()=>this.CONSUME(t));this.ACTION(()=>{s||this._reportError(o,`Missing closing parenthesis ')'`,r),this._tagClose(o,this.getLexerPosition()),n=o})}}),n}),this._ruleIntersectOp=this.RULE(`ruleIntersectOp`,()=>{let e=[this.SUBRULE(this._ruleInfixOp)];return this.MANY(()=>{this.OPTION({GATE:()=>{let e=this.LA(0);return this.LA(1).startOffset>e.endOffset+1},DEF:()=>{e.push(this.SUBRULE3(this._ruleInfixOp))}})}),this.ACTION(()=>{for(;e.length>1;){let t=e.length-1;for(let n=0;n<t;n++){let r=e[n],i=e[n+1],a=C(` `,r,i,!0),o=this._tokenMap.get(r);o&&delete o.tokenIndexClose;let s=this._tokenMap.get(i),c=s?.tokenIndex;if(c!==void 0){let e=this.input[c],t=this.input[c-1]?.endOffset??-1,n=this._inputText.slice(t+1,e.startOffset).slice(0,-1);n.length>0&&(a.wsBefore=n)}s&&delete s.tokenIndex,n+1<t&&s&&delete s.tokenIndexClose,e.splice(n,2,a),n--,t--}}}),e[0]}),this._ruleFormula=this.RULE(`ruleFormula`,()=>this.OR9([{ALT:()=>this.SUBRULE(this._ruleLiteral)},{ALT:()=>this.SUBRULE(this._ruleReference)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>this.SUBRULE(this._ruleParen)},{ALT:()=>this.SUBRULE(this._ruleTableReference)},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleLiteralArray)}])),this._ruleGroup=this.RULE(`ruleGroup`,()=>{let{ArgSeparator:e}=this._vocab,t=[];return this.MANY(()=>{this.CONSUME(e);let n=this.SUBRULE2(this._ruleIntersectOp);this.ACTION(()=>{t.push(n)})}),t}),this._ruleParen=this.RULE(`ruleParen`,()=>{let{OpenParen:e,CloseParen:t}=this._vocab;return this._processParen(v.Paren,e,t)}),this._ruleLiteralArray=this.RULE(`ruleLiteralArray`,()=>{let{OpenCurlyParen:e,CloseCurlyParen:t,ColSeparator:n,RowSeparator:r}=this._vocab,i=d();this.CONSUME(e);let a=this.getLexerPosition(),o=this.ACTION(()=>this._tag(b(i),a)),s=this.SUBRULE(this._ruleLiteralForArray);this.ACTION(()=>{i.value.push(s)}),this.MANY(()=>{let e=!1;this.OR([{ALT:()=>{this.CONSUME(n),e=!0}},{ALT:()=>this.CONSUME(r)}]);let t=this.SUBRULE2(this._ruleLiteralForArray);this.ACTION(()=>{e||(i=d(),o.value.push(i)),i.value.push(t)})});let c=this.OPTION(()=>this.CONSUME(t));return o=this.ACTION(()=>(c||this._reportError(o,`Missing closing parenthesis '}'`,a),this._tagClose(o,this.getLexerPosition()))),o}),this._ruleLiteralForArray=this.RULE(`ruleLiteralForArray`,()=>{let{StringToken:e,BooleanToken:n,LiteralError:r,RefError:a}=this._vocab;return this.OR([{ALT:()=>{let e=this.OPTION(()=>this.SUBRULE(this._rulePlusMinusOp)),t=this.SUBRULE(this._ruleNumber),n=this.ACTION(()=>this._tag(u(t.image,this._locale),this.getLexerPosition()));return this.ACTION(()=>e?y(e.image,n):n)}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(p(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(t(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);return this.ACTION(()=>this._tag(_(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(a);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}])}),this._ruleLiteral=this.RULE(`ruleLiteral`,()=>{let{StringToken:e,BooleanToken:n,LiteralError:r,RefError:a}=this._vocab;return this.OR([{ALT:()=>{let e=this.SUBRULE(this._ruleNumber);return this.ACTION(()=>this._tag(u(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(p(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(t(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);return this.ACTION(()=>this._tag(_(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(a);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}])}),this._ruleFunction=this.RULE(`ruleFunction`,()=>{let{FunctionToken:e,OpenParen:t,CloseParen:n}=this._vocab,r=this.CONSUME(e).image,i=this.getLexerPosition();this.CONSUME(t);let a=this.SUBRULE(this._ruleFunctionArguments),o=this.ACTION(()=>this._tag(w(r,a),i)),s=this.OPTION(()=>this.CONSUME(n));return o=this.ACTION(()=>(s||this._reportError(o,`Missing closing parenthesis ')'`,i),this._tagClose(o,this.getLexerPosition()))),o}),this._ruleFunctionArguments=this.RULE(`ruleFunctionArguments`,()=>{let{ArgSeparator:e,CloseParen:t}=this._vocab,n=[];return this.OPTION({GATE:()=>this.LA(1).tokenType!==t,DEF:()=>{let t;this.OPTION2(()=>{t=this.SUBRULE(this._ruleIntersectOp)}),t=this.ACTION(()=>t??this._tagClose(ee(),this.getLexerPosition())),n.push(t),this.MANY(()=>{let t;this.CONSUME(e),this.OPTION3(()=>{t=this.SUBRULE2(this._ruleIntersectOp)}),t=this.ACTION(()=>t??this._tagClose(ee(),this.getLexerPosition())),n.push(t)})}}),n}),this._ruleBracketedString=this.RULE(`ruleBracketedString`,()=>{let{BracketedString:e}=this._vocab,t=this.CONSUME(e),n=this.getLexerPosition();return this.ACTION(()=>{let e=this._srParser.parse(this.rowIndex,this.colIndex,t.image);for(let t of e.errors)this._astErrors.push(t);return this._tag(e.root,n)})}),this._ruleTableReference=this.RULE(`ruleTableReference`,()=>{let{TableReference:e}=this._vocab,t=this.CONSUME(e),n=this.getLexerPosition();return this.ACTION(()=>{let e=this._srParser.parse(this.rowIndex,this.colIndex,t.image);for(let t of e.errors)this._astErrors.push(t);return this._tag(e.root,n)})}),this._ruleReference=this.RULE(`ruleReference`,()=>{let{Sheet:e,SheetQuoted:t,DivOp:n,MulOp:r,PlusOp:a,MinOp:o,ArgSeparator:s,Cell:c,NamedToken:l,SingleQuotedString:u,Column:d,AbsRow:p,DigitToken:m,RefError:h}=this._vocab,g,_;this.OPTION2({GATE:()=>{for(let i=1;i<6;i++){let c=this.LA(i);if(c.tokenType===e||c.tokenType===t)return!0;if(c.image===``||c.image===`)`||c.tokenType===n||c.tokenType===r||c.tokenType===a||c.tokenType===o||c.tokenType===s)break}return!1},DEF:()=>{_=this.getLexerPosition()+1,g=this.SUBRULE(this._rulePrefixSheetName)}});let y=this.OR([{ALT:()=>{let e=this.CONSUME(c),t=this.getLexerPosition();return this.ACTION(()=>this._tag(re(e.image,this.rowIndex,this.colIndex),t))}},{ALT:()=>{let e=this.OR2([{ALT:()=>this.CONSUME(l)},{ALT:()=>this.CONSUME(u)}]);return this.ACTION(()=>this._tag(ie(e.image),this.getLexerPosition()))}},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>{let e=this.CONSUME(d);return this.ACTION(()=>this._tag(f(e.image,this.colIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(p);return this.ACTION(()=>this._tag(x(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(m);return this.ACTION(()=>this._tag(x(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(h);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}]);return this.ACTION(()=>{if(g&&y){if(g.name===``)return void this._reportError(y,`'${g.image}' is not a valid sheet reference — a '!' needs a sheet name before it`);let e=y;if(y.type===v.Postfix&&y.inputs?.[0]&&(e=y.inputs[0]),e.type===v.Cell||e.type===v.Named||e.type===v.Row||e.type===v.TableColumn||e.type===v.Error){e.value.scope=g.name,e.value.scopeImage=g.image;let t=this._tokenMap.get(e);t&&_!==void 0&&(t.tokenIndex=_)}}}),y}),this._rulePrefixSheetName=this.RULE(`rulePrefixSheetName`,()=>{let{SheetQuoted:e,BracketedString:t,NamedToken:n,Column:r,RangeOp:i,Sheet:a}=this._vocab;return this.OR([{ALT:()=>{let t=this.CONSUME(e).image;return{name:t.slice(1,-2).replace(/''/g,`'`),image:t}}},{ALT:()=>{let e=``;this.OPTION(()=>{e+=this.CONSUME(t).image}),this.OPTION2({GATE:()=>this.LA(2).tokenType===i,DEF:()=>{e+=this.OR2([{ALT:()=>this.CONSUME(n).image},{GATE:()=>this.LA(1).image.charCodeAt(0)!==36,ALT:()=>this.CONSUME(r).image}]),this.CONSUME(i),e+=`:`}});let o=this.CONSUME(a).image;return{name:e+o.slice(0,-1),image:e+o}}}])}),this._ruleNumber=this.RULE(`ruleNumber`,()=>{let{NumberToken:e,ScientificDigit:t,DigitToken:n}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)},{ALT:()=>this.CONSUME(n)}])}),this._ruleRoot=this.RULE(`ruleRoot`,()=>{let{ArgSeparator:e}=this._vocab,t=this.SUBRULE(this._ruleIntersectOp),n=[];return this.MANY(()=>{this.CONSUME(e),n.push(this.SUBRULE2(this._ruleIntersectOp))}),this.ACTION(()=>n.length===0?t:{type:v.List,value:`,`,inputs:[t,...n],isReference:!0})}),this._lexer=n,this._locale=n.getLocale(),this._vocab=a,this._srParser=e?.srParser??new $n(this._locale),this.performSelfAnalysis()}getLexer(){return this._lexer}parse(t,n,r){let i=this._lexer.tokenize(r),a;if(!i)return{root:{type:v.Unparsed,value:r},errors:[]};let o=i.tokens;if(o.length===0)throw new e.Parse(ir);return this.input=o,this._inputText=r,this._inputTextLength=r.length,this.rowIndex=t,this.colIndex=n,this._astErrors=[],this._tokenMap=new Map,this.reset(),a=this._ruleRoot(),a&&this._bindAllWhitespace(a),a=te(a,(e,n)=>{let r=e.type,i=n?.isReference?n.value:void 0,a=typeof i==`string`&&er.has(i),o=typeof i==`string`&&tr.has(i),s=a?n.inputs:void 0,c=s?s[0]===e?s[1]:s[0]:void 0,l=this._lexer.getMaxRow();if(a&&r!==v.Cell&&Number.isInteger(e.value)){let n=x(e.image,t);return S(n,e),nr(c)===`row`?rr(e.image,l)||this._reportError(n,`'${e.image}' is not a valid row — rows run from 1 to ${l}`):this._reportError(n,`'${e.image}' is not a valid reference — a whole row can only pair with another row (as in ${e.image}:${e.image})`),n}if(o&&r===v.Named)return this._reportError(e,`'${e.image??e.value?.nameId}' is a name — '${i}' needs a cell or range on both sides`),e;if(r===v.Cell){let t=e.value,n=t.colIndex===-(2**53-1),r=t.rowIndex===-(2**53-1);if((n||r)&&nr(c)===(n?`row`:`col`))return n&&!rr(e.image,l)&&this._reportError(e,`'${e.image}' is not a valid row — rows run from 1 to ${l}`),e;if(n||r||t.colIndex>=16384){let a=ie(e.image);S(a,e);let s=t.scope;return s&&(a.value.scope=s,a.value.scopeImage=t.scopeImage),n?this._reportError(a,`'${e.image}' is not a valid reference — a row needs a column (use ${e.image}:${e.image} for the whole row)`):r&&e.image.includes(`$`)?this._reportError(a,`'${e.image}' is not a valid reference — a whole column can only pair with another column (as in ${e.image}:${e.image})`):o&&this._reportError(a,`'${e.image}' is a name — '${i}' needs a cell or range on both sides`),a}}return e}),{root:a,errors:[...this.errors,...this._astErrors]}}_processParen(e,t,n){let r;this.CONSUME(t);let i=this.getLexerPosition();r=this.ACTION(()=>(r={type:e,value:null,inputs:null},this._tag(r,i)));let a=[],o=this.SUBRULE(this._ruleIntersectOp);o&&a.push(o);let s=this.SUBRULE(this._ruleGroup),c=this.OPTION(()=>this.CONSUME(n));return r=this.ACTION(()=>{if(s)for(let e=0;e<s.length;e++)a.push(s[e]);return r&&(c||this._reportError(r,`Missing closing parenthesis`,i),r.inputs=a),this._tagClose(r,this.getLexerPosition())}),r}_reportError(e,t,n=void 0,r=`SyntaxError`){n===void 0&&(n=this.getLexerPosition()),e.error=!0,this._astErrors.push({name:r,message:t,previousToken:this.input[n],ast:e})}_tag(e,t){return e?(e.image??=this.input[t].image,this._tokenMap.set(e,{tokenIndex:t,tokenIndexClose:t}),e):(console.warn(`node is null`),e)}_tagClose(e,t){let n=this._tokenMap.get(e);return n?n.tokenIndexClose=t:this._tokenMap.set(e,{tokenIndexClose:t}),e}_bindNodeWhitespace(e){let t=this._tokenMap.get(e);if(!t)return;let n=this.input,r=this._inputText,i=t.tokenIndex;if(i!==void 0){let t=n[i],a=n[i-1]?.endOffset??-1;a+1<t.startOffset&&(e.wsBefore=r.slice(a+1,t.startOffset))}let a=t.tokenIndexClose;if(a!==void 0){let t=n[a],i=n[a+1]?.startOffset??this._inputTextLength;t.endOffset+1<i&&(e.wsAfter=r.slice(t.endOffset+1,i))}}_bindAllWhitespace(e){if(e){if(this._bindNodeWhitespace(e),e.inputs)for(let t of e.inputs)t&&this._bindAllWhitespace(t);if(e.type===v.Array&&Array.isArray(e.value)){for(let t of e.value)if(t&&Array.isArray(t.value))for(let e of t.value)e&&this._bindAllWhitespace(e)}}}};export{ir as i,ar as n,cr as r,Hn as t};
|