@sheetxl/studio-vanilla 0.5.0 → 0.5.1
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/README.md +3 -3
- package/browser/cjs/{BYJxHR3K0UQJ8mYe.cjs → 9nujqkxYSI9ZC752.cjs} +1 -1
- package/browser/cjs/B-PgSPL2j6zjri6c.cjs +6 -0
- package/browser/cjs/{DKq35Q191eW-MovK.cjs → B7MEStBCGjzSOfyD.cjs} +2 -2
- package/browser/cjs/{DX2XUDUIVBx4UFrJ.cjs → BK02DjlaEYaTTka8.cjs} +1 -1
- package/browser/cjs/{BpeteRa_oZ-wN4Yl.cjs → BQyjl-fBSVpx5oCT.cjs} +1 -1
- package/browser/cjs/{xMzLyo_gIl82xG8k.cjs → BRn8LkQ4nKiHvOXz.cjs} +1 -1
- package/browser/cjs/{2QmtjcI-saz2rkIA.cjs → B_E21L-ayzOp5qGa.cjs} +2 -2
- package/browser/cjs/{D8mjDoZ4Yyous_Fc.cjs → BbCJIneMSx4cf-ur.cjs} +1 -1
- package/browser/cjs/{yc1bXLJ1yRhBFy0X.cjs → BcfxxMxYhAmNKCi3.cjs} +14 -14
- package/browser/cjs/{BQYUcoxlHrpI0-pX.cjs → BjTNmmCnOvBUdiDv.cjs} +1 -1
- package/browser/cjs/{BCwHln5zBNJSn0bb.cjs → BmixnfJY-Qdv0-vb.cjs} +1 -1
- package/browser/cjs/{DJZBxKlTP03_1kyT.cjs → Bp6L-F7UNS-L6N03.cjs} +2 -2
- package/browser/cjs/{BAxy7pwmXg8SI_oi.cjs → BswNvZNzfy-xnhzz.cjs} +1 -1
- package/browser/cjs/{Ce8AVRntRnXZtgzH.cjs → BvpkPfBcSDJWY8dE.cjs} +2 -2
- package/browser/cjs/{Dg9j6yGv8nrILfzN.cjs → C45wa3JLoHKrKgx9.cjs} +2 -2
- package/browser/cjs/{f_Vbi-Lelt9tKZrz.cjs → C8xLSqAZLBX2dJ4N.cjs} +3 -3
- package/browser/cjs/{BlpCu5z9eT8rzsZl.cjs → C9jH-6oidDYMUYG6.cjs} +1 -1
- package/browser/cjs/{D178aT-dgy-ngzYG.cjs → CFQ2dYAH0BbJmrls.cjs} +2 -2
- package/browser/cjs/{D-su0R92LmYTQVL3.cjs → CQT8VGZ70QydoPyX.cjs} +3 -3
- package/browser/cjs/{DjB9MJwDT6_HgF4U.cjs → CRXFlr87NPJQyxUF.cjs} +1 -1
- package/browser/cjs/{CVIlAq9nwlOXfHMl.cjs → CSxnmIlj-ZSdiqWs.cjs} +2 -2
- package/browser/cjs/{C-6TpShR6Bn0HnEd.cjs → CXs4S4JhLFZVgvTR.cjs} +3 -3
- package/browser/cjs/{K7QHOvYV_yvLLjsS.cjs → CdYqMzk5cMIE_Doy.cjs} +1 -1
- package/browser/cjs/CgZJr_HNgqQcu-4B.cjs +330 -0
- package/browser/cjs/{ByB_fmjdLNTv0T0U.cjs → Cj9vxBt4_rKsQNb0.cjs} +1 -1
- package/browser/cjs/{C5T_oiCG4PwTFSZA.cjs → CrI7eSD8XXiUCkPF.cjs} +1 -1
- package/browser/cjs/{DASsVvQwE2-IWxLR.cjs → CtJheUJbLcXjQUm3.cjs} +2 -2
- package/browser/cjs/{CBS2kMyEf0c_PUbQ.cjs → CtwgEd3i19q5yZJp.cjs} +2 -2
- package/browser/cjs/{Hi6aVJR9PyRbNYjO.cjs → CwQfym_96MXR9OLy.cjs} +1 -1
- package/browser/cjs/{3UFq2FybsZfoS4JL.cjs → Cxx1AgOSDpuJx7kX.cjs} +1 -1
- package/browser/cjs/{CO7VEOXret0qr-X3.cjs → D1-0RbtY4BXgzZY-.cjs} +1 -1
- package/browser/cjs/{CwqvcNlwUtXJrzsk.cjs → D3IWZEahAgaUWvha.cjs} +2 -2
- package/browser/cjs/{BlqTaZ2U_mKVK2lb.cjs → D4my6sTVajf6SI0E.cjs} +1 -1
- package/browser/cjs/{MgEzGw411nlqjqfH.cjs → D77ocr4cahSYERpG.cjs} +3 -3
- package/browser/cjs/{CvO-oyQ3syx7EGUA.cjs → D8o4nvExhX_QGle4.cjs} +1 -1
- package/browser/cjs/{DmT6vIsFpZJ2c8cx.cjs → DBLdpG9-iGu4QY6E.cjs} +4 -4
- package/browser/cjs/{vNEwUuTKk3qucC3P.cjs → DBe9KI_Kxj0YTvMp.cjs} +1 -1
- package/browser/cjs/{BASsCVA0ArIVtY7I.cjs → DPIjtUi5aQ4ukRIE.cjs} +1 -1
- package/browser/cjs/{BdCoVNJwhPpWfQw2.cjs → DSxzu2PfTqAXFK7u.cjs} +2 -2
- package/browser/cjs/DWmXH4vEJaHu_J43.cjs +6 -0
- package/browser/cjs/{DBavSByKdf-juvFm.cjs → DWsxyYa4mEWANxQc.cjs} +4 -4
- package/browser/cjs/{BVbQCweLw_r05vPF.cjs → Dbv-L8d50VFkQXv3.cjs} +1 -1
- package/browser/cjs/{WJXT0W6bS3bZdAUV.cjs → DfMDnmbowrTm8wAQ.cjs} +1 -1
- package/browser/cjs/{ClEZHGlmkSIz6S1O.cjs → DlJQcGerUQB6jtq9.cjs} +1 -1
- package/browser/cjs/{B2hhcNzdkhGrH1O6.cjs → DmgNvMLQXvQcxq1p.cjs} +1 -1
- package/browser/cjs/{CAZoVQtxsVdAtVKy.cjs → DvMs0RgylQcOGxo0.cjs} +1 -1
- package/browser/cjs/{BxqDS9XynU5GFbP7.cjs → Dz0TY19Ws28XwiPt.cjs} +2 -2
- package/browser/cjs/{BkZzUVGQfrUTPE_K.cjs → DzG79WXVl2LXIuWZ.cjs} +1 -1
- package/browser/cjs/{Dl5mwbo0ahDUm0he.cjs → OettkXQE2AbA_CDP.cjs} +1 -1
- package/browser/cjs/{LhLQSvaxn8yxAIwj.cjs → Sup8PX3PS57TkI6V.cjs} +1 -1
- package/browser/cjs/{tNT3tUxdeIp_Iq2Y.cjs → U-UUeruaasnyL2cE.cjs} +2 -2
- package/browser/cjs/aIICSjNBKiOkNiwu.cjs +6 -0
- package/browser/cjs/{DdzEWCcupF-0WS8y.cjs → emGp26D9pBqQifHC.cjs} +1 -1
- package/browser/cjs/{CZEOikBcE4OIr49t.cjs → gYH09gta23jOsaje.cjs} +1 -1
- package/browser/cjs/index.cjs +2 -2
- package/browser/cjs/{C5e1IjdRuLyAQqNX.cjs → s7ysGwMSg897LJKF.cjs} +1 -1
- package/browser/cjs/{D5z-zqUVI3G9JXBC.cjs → sFDhI1tJ4eXlkejB.cjs} +4 -4
- package/browser/cjs/{DMUFBhoYpT3ai2Sb.cjs → yVBWKdlLudyzwfeW.cjs} +1 -1
- package/browser/esm/{UENfAV2nBd83yFu7.mjs → 0VpVo6CQYMcz_rbP.mjs} +1 -1
- package/{cdn/assets/CozWNYg-NXzV84fz.js → browser/esm/3xXjUns8-1hKqD8-.mjs} +1 -1
- package/browser/esm/{BLseM2hNBI2PgQaX.mjs → 85NBLOptD8mgcw6l.mjs} +1 -1
- package/browser/esm/{QPkYQWSepZNIhJst.mjs → AGeyhzAoOP3Q5g4x.mjs} +1 -1
- package/browser/esm/{Di8JLQMx61fnrhOn.mjs → B-LKjeisA9lKu3u3.mjs} +1 -1
- package/browser/esm/{DOv9FndcEVmQ2LJK.mjs → B0dOwGowibI4mMD5.mjs} +2 -2
- package/browser/esm/{DzZDYedlR-CIW2TI.mjs → B1jX3dJN0xg4OAen.mjs} +2 -2
- package/browser/esm/{DYF-8AnNDaQUy3aL.mjs → BFu0JkHyxwv4JRrP.mjs} +2 -2
- package/browser/esm/{BZpMA4DGM1kbVAKF.mjs → BPsefDR0mPf5xvCO.mjs} +1 -1
- package/browser/esm/{CzMxOWYq4nqRtKmm.mjs → BXI18yI3qqOlnxNq.mjs} +1 -1
- package/browser/esm/{Dfbzljrnj4KrvtaN.mjs → BcTK3tcbPZ2IGt-X.mjs} +1 -1
- package/browser/esm/{CDu4VlyMAQ3nxTQG.mjs → BiMdfyDtnt2rYw-r.mjs} +1 -1
- package/browser/esm/{CaIFrnjL0xBOtFfM.mjs → BkvpQTMeIIK3PCYY.mjs} +1 -1
- package/browser/esm/{Af7aikoKHz0rpjfv.mjs → Bm2Aw1SUya5OXV4a.mjs} +1 -1
- package/{cdn/assets/DOG1CaEQVF1sTUFi.js → browser/esm/Bpp0yOz56huirghZ.mjs} +1 -1
- package/browser/esm/{DjGdyf6zsnIMRkQb.mjs → ByznljJVFJeVPwWx.mjs} +2 -2
- package/browser/esm/{Cq-wjvtZ92uenxU1.mjs → C3UjDQh1BUXcPgG_.mjs} +6 -6
- package/browser/esm/{DIypkIIonThPr-Vt.mjs → C7N3fqbgilVDX1EO.mjs} +2 -2
- package/browser/esm/{CeP-AnEtOGkuxLqE.mjs → CDRkgOxkDGKlIXeW.mjs} +1 -1
- package/{cdn/assets/CjScjxhY2mD7nPZA.js → browser/esm/COv8vuaYs_htqziD.mjs} +1 -1
- package/browser/esm/{BtBECeJ4mwD7SUx8.mjs → CdDk8fKkDRWivCBm.mjs} +3 -3
- package/browser/esm/ClHBG3R8IiFguFAt.mjs +39 -0
- package/browser/esm/{BXKXqOluLdKs4-V0.mjs → ClUwUv-y_4iTiZeW.mjs} +2 -2
- package/{cdn/assets/CJ9ZL3uskq3W6s-m.js → browser/esm/Clei3-jMgZKIe0CE.mjs} +1 -1
- package/browser/esm/{5F1_gQbzWEFsWO0i.mjs → Cq1zEAhyhkBIp8Ax.mjs} +2 -2
- package/{cdn/assets/B8uy0BSOVjfUw27f.js → browser/esm/CtnOw8c6WutmVo4I.mjs} +1 -1
- package/{cdn/assets/aEhgzbKqmuKv1oqm.js → browser/esm/CuQfrNq9PxAaYCFs.mjs} +1 -1
- package/browser/esm/{Dd0avXHDTPFrx-ot.mjs → CvXzw2Lpr8wS9ZVg.mjs} +2 -2
- package/browser/esm/{zQSjT9VbN7kMDV88.mjs → D-SS0LY7DTyyq29t.mjs} +3 -3
- package/{cdn/assets/B1Kc7dS9N2PVqxMT.js → browser/esm/D-ZTinSL4HYqEo_N.mjs} +1 -1
- package/browser/esm/{bxGRTnY732xGNtpL.mjs → D-cQ1_HANeEmTVak.mjs} +1 -1
- package/browser/esm/{DdQY6IuT4OziHv5i.mjs → D19Bkm5jJZngaU2r.mjs} +7 -7
- package/browser/esm/{CsVeeu8D1A8I-BbH.mjs → D5ZdMGzF8-ZfDfKQ.mjs} +4 -4
- package/browser/esm/{Bg59p3YlNG6o7-M3.mjs → DAPpJbwAZQhDZqaM.mjs} +4 -4
- package/browser/esm/{DfRKIODWn8ElqMWa.mjs → DFmGnyy1RMeIAxZc.mjs} +2 -2
- package/browser/esm/{Buw1VxSLsNI8pSYS.mjs → DQBTcrsV_oNRryeC.mjs} +2 -2
- package/browser/esm/{Dm4Fun7UoovVHafs.mjs → DXpByTfBAcSlNQ1C.mjs} +17 -17
- package/browser/esm/{Cprnt9pNXzIiMmkN.mjs → Dc4teqz-R7x3iEb3.mjs} +2 -2
- package/browser/esm/{2fFz5u9jPgrNzcVF.mjs → Dj-1ksuM43vA_8BP.mjs} +1 -1
- package/{cdn/assets/YYqCu_-Z9nzvEseu.js → browser/esm/DjC9t2nEwmPpl7WS.mjs} +1 -1
- package/{cdn/assets/BlFzVqIUaXFtDy81.js → browser/esm/DlDI3IucdebIZp8I.mjs} +1 -1
- package/{cdn/assets/BV3ROKbw5yMVArqX.js → browser/esm/Dlydw2QbG-f-sLCH.mjs} +1 -1
- package/{cdn/assets/DirXlaTG7TKxrqSR.js → browser/esm/Dm6VW-HzBzkKwcnE.mjs} +1 -1
- package/browser/esm/{DSCVDOwTpDzUVuFj.mjs → Dmvy9OlGZJIm4jkL.mjs} +1 -1
- package/{cdn/assets/DfdWpPG9ZcbRBGUg.js → browser/esm/DriS0WgSxs_p_c_I.mjs} +1 -1
- package/browser/esm/{B8ePgT5XZ0JlU3T6.mjs → FgngFsAWn9GFi4za.mjs} +1 -1
- package/browser/esm/{By3EkyTg3ZYh63C7.mjs → IH4pKmgZQrB1Zu0L.mjs} +10 -10
- package/browser/esm/{CP_sGa9QGT2Nq5ym.mjs → OxQlWm5qyGb6JYye.mjs} +3 -3
- package/{cdn/assets/DwpS4SI4gT1eqfOs.js → browser/esm/TKzzaA0mzIgbwYNm.mjs} +1 -1
- package/browser/esm/{HlyDPlaZCA3IOmF2.mjs → Y4nqyDtRcO8b4sVz.mjs} +25 -25
- package/browser/esm/{D9MGSJr45cVRF75O.mjs → YMBNcaMLJOB9vYZ5.mjs} +6 -6
- package/{cdn/assets/DAUV_w2uv0nHdk5N.js → browser/esm/ckTkfOwh_7TIQoI0.mjs} +1 -1
- package/browser/esm/{PzIeb5aTX9JzTTfm.mjs → hf76A0cAH97o_Rev.mjs} +1 -1
- package/browser/esm/index.mjs +2 -2
- package/browser/esm/{BUNUi9F3xbjfUKty.mjs → jnmCbk7hZxv17d_V.mjs} +1 -1
- package/browser/esm/{9MchcnSGrYDjX4zQ.mjs → ju2xb5hRci_-szDY.mjs} +4 -4
- package/{cdn/assets/BFweWj2oKpTGl7m3.js → browser/esm/o8ISzPTCYx_zEzDp.mjs} +1 -1
- package/browser/esm/{2kXHnuU_uz-F9i1S.mjs → yxVi9--jBfcQ0JHh.mjs} +9959 -9909
- package/cdn/assets/{O-MB9oo65vbYOjfG.js → -N2Wazi61B1TXYBK.js} +11 -11
- package/cdn/assets/{UENfAV2nBd83yFu7.js → 0VpVo6CQYMcz_rbP.js} +1 -1
- package/cdn/assets/{CaN0O_koLgCkhgEh.js → 1xm8jyYgpkpWO8k5.js} +4 -4
- package/cdn/assets/{BQvzpOcCO8uM_ZaF.js → 3AU1vXTH3P3UhXU7.js} +4 -4
- package/{browser/esm/CozWNYg-NXzV84fz.mjs → cdn/assets/3xXjUns8-1hKqD8-.js} +1 -1
- package/cdn/assets/{CzEv6qEIPTHOwOdU.js → 6c1oZ4Zev8my_1Sr.js} +5 -5
- package/cdn/assets/{BLseM2hNBI2PgQaX.js → 85NBLOptD8mgcw6l.js} +1 -1
- package/cdn/assets/{CzMF1riupKc6HLGE.js → B-4KZMrx7t8BQe_h.js} +4 -4
- package/cdn/assets/{Di8JLQMx61fnrhOn.js → B-LKjeisA9lKu3u3.js} +1 -1
- package/cdn/assets/{ClkFsS16G5memDzX.js → B2aUAymykYdZH6ea.js} +6 -6
- package/cdn/assets/{CEcpUxbZ1W-G1EPq.js → BDXndx4Yuhj_E8sP.js} +4 -4
- package/cdn/assets/{CmUGAy0Bu36DiwJO.js → BLoE30vNz4FFxozL.js} +2 -2
- package/cdn/assets/{BrwV_8GjxcVuWuUk.js → BPAkRmO-F8hAn3Zu.js} +9921 -9871
- package/cdn/assets/{BZpMA4DGM1kbVAKF.js → BPsefDR0mPf5xvCO.js} +1 -1
- package/cdn/assets/{CzMxOWYq4nqRtKmm.js → BXI18yI3qqOlnxNq.js} +1 -1
- package/cdn/assets/{YJiNeqIJTFYDQPxS.js → BbHbVER_6LWLDZ63.js} +3 -3
- package/cdn/assets/{Dfbzljrnj4KrvtaN.js → BcTK3tcbPZ2IGt-X.js} +1 -1
- package/cdn/assets/{B6QHusAaPSos46yi.js → BiBRi7uHZMh8fxz5.js} +2 -2
- package/cdn/assets/{CDu4VlyMAQ3nxTQG.js → BiMdfyDtnt2rYw-r.js} +1 -1
- package/cdn/assets/{CaIFrnjL0xBOtFfM.js → BkvpQTMeIIK3PCYY.js} +1 -1
- package/cdn/assets/{Af7aikoKHz0rpjfv.js → Bm2Aw1SUya5OXV4a.js} +1 -1
- package/cdn/assets/{DaYZ-afnc3QhJo5R.js → Bm3Sdq1xTgtChb-Q.js} +7 -7
- package/cdn/assets/{V2bW77WyjoyjJMvZ.js → BoYY0EcB08017R9U.js} +2 -2
- package/cdn/assets/{zZGhctwBXNlAYrJr.js → Bou3BFRfxUTNq4vR.js} +2 -2
- package/{browser/esm/DOG1CaEQVF1sTUFi.mjs → cdn/assets/Bpp0yOz56huirghZ.js} +1 -1
- package/cdn/assets/{DivRRrwWTqpDEOsE.js → BxtOFiIvbYJt-M5y.js} +2 -2
- package/cdn/assets/{CeP-AnEtOGkuxLqE.js → CDRkgOxkDGKlIXeW.js} +1 -1
- package/{browser/esm/CjScjxhY2mD7nPZA.mjs → cdn/assets/COv8vuaYs_htqziD.js} +1 -1
- package/cdn/assets/{C7SHJrlOqTIZCB3t.js → Ck6vzJvkZ31US1wY.js} +8 -8
- package/cdn/assets/{CCbJipmDawMQQxRJ.js → CkFQYE-fhBYA_QiP.js} +2 -2
- package/{browser/esm/CJ9ZL3uskq3W6s-m.mjs → cdn/assets/Clei3-jMgZKIe0CE.js} +1 -1
- package/cdn/assets/{djN8Su_7GYF42GqX.js → CqLP3lzPLb4sglH4.js} +5 -5
- package/cdn/assets/{NoCZPCkSed8lQpNi.js → Cr0Slu84CNaejRm5.js} +4 -4
- package/cdn/assets/{DAI9BFZBDQlMP1v4.js → CsVGGUkaHfpL1HLm.js} +20 -20
- package/{browser/esm/B8uy0BSOVjfUw27f.mjs → cdn/assets/CtnOw8c6WutmVo4I.js} +1 -1
- package/{browser/esm/aEhgzbKqmuKv1oqm.mjs → cdn/assets/CuQfrNq9PxAaYCFs.js} +1 -1
- package/cdn/assets/{7bmIdE8Moi7orOeU.js → CxIVxoZ16dEh6AVl.js} +4 -4
- package/{browser/esm/B1Kc7dS9N2PVqxMT.mjs → cdn/assets/D-ZTinSL4HYqEo_N.js} +1 -1
- package/cdn/assets/{bxGRTnY732xGNtpL.js → D-cQ1_HANeEmTVak.js} +1 -1
- package/cdn/assets/{DlGa-wREL0uZB2Nx.js → D6j_Ep7Ii-CsiXJb.js} +4 -4
- package/cdn/assets/{D-W_ANt_qJ9dfGy9.js → DGVqaqtgqT7-iLsS.js} +13 -13
- package/cdn/assets/{DlMH1vSjXgvZMwQJ.js → DL0xZucNaC25JD_B.js} +2 -2
- package/cdn/assets/{7ZUzaBw_VH3Cvii1.js → DijLxUufgRdT5tye.js} +3 -3
- package/cdn/assets/{2fFz5u9jPgrNzcVF.js → Dj-1ksuM43vA_8BP.js} +1 -1
- package/{browser/esm/YYqCu_-Z9nzvEseu.mjs → cdn/assets/DjC9t2nEwmPpl7WS.js} +1 -1
- package/{browser/esm/BlFzVqIUaXFtDy81.mjs → cdn/assets/DlDI3IucdebIZp8I.js} +1 -1
- package/{browser/esm/BV3ROKbw5yMVArqX.mjs → cdn/assets/Dlydw2QbG-f-sLCH.js} +1 -1
- package/{browser/esm/DirXlaTG7TKxrqSR.mjs → cdn/assets/Dm6VW-HzBzkKwcnE.js} +1 -1
- package/cdn/assets/{DSCVDOwTpDzUVuFj.js → Dmvy9OlGZJIm4jkL.js} +1 -1
- package/cdn/assets/{DSv3gXCV9xifjdta.js → Do8GH_esmPz_tntb.js} +4 -4
- package/cdn/assets/{uvZYEIW4EfvcdsXG.js → Dr-rVo6o44pqTYDU.js} +1 -1
- package/{browser/esm/DfdWpPG9ZcbRBGUg.mjs → cdn/assets/DriS0WgSxs_p_c_I.js} +1 -1
- package/cdn/assets/{BGF-bSrwdriQTytG.js → ECxVYs1c6UFhjnpA.js} +6 -6
- package/cdn/assets/{Yp0FxpbZyyvU_u6y.js → EPH-TGvYL0PD4nB8.js} +12 -12
- package/cdn/assets/{B8ePgT5XZ0JlU3T6.js → FgngFsAWn9GFi4za.js} +1 -1
- package/cdn/assets/{G0GROjU63_EPzAF7.js → GjM3sOILAXHEzXUB.js} +1 -1
- package/{browser/esm/DwpS4SI4gT1eqfOs.mjs → cdn/assets/TKzzaA0mzIgbwYNm.js} +1 -1
- package/cdn/assets/{Dml7K4XhLTRwUDTY.js → UayQBIW7tKZEuc8P.js} +3 -3
- package/cdn/assets/{CsYr_9x-OIQSqGIL.js → ZKt-xWFAsB8fM65l.js} +3 -3
- package/cdn/assets/{m-A0SfNBx32zKuZU.js → _0rBrQes8xS_780J.js} +2 -2
- package/{browser/esm/DAUV_w2uv0nHdk5N.mjs → cdn/assets/ckTkfOwh_7TIQoI0.js} +1 -1
- package/cdn/assets/{PzIeb5aTX9JzTTfm.js → hf76A0cAH97o_Rev.js} +1 -1
- package/cdn/assets/{BUNUi9F3xbjfUKty.js → jnmCbk7hZxv17d_V.js} +1 -1
- package/{browser/esm/BFweWj2oKpTGl7m3.mjs → cdn/assets/o8ISzPTCYx_zEzDp.js} +1 -1
- package/cdn/index.js +2 -2
- package/cdn/loader.js +1 -1
- package/package.json +3 -3
- package/browser/cjs/B-fFQgxMHns-eg-y.cjs +0 -6
- package/browser/cjs/Ba8eoGTjjWBH8TbP.cjs +0 -6
- package/browser/cjs/D68uE8Ovq38Aj-88.cjs +0 -330
- package/browser/cjs/DHRZzqw46ad6Mtw6.cjs +0 -6
- package/browser/esm/BxoWypkKac-_VAm5.mjs +0 -39
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";/**
|
|
2
|
-
* @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.5.
|
|
2
|
+
* @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.5.1
|
|
3
3
|
*
|
|
4
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
-
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./D68uE8Ovq38Aj-88.cjs");var xo=typeof global=="object"&&global&&global.Object===Object&&global,Ms=typeof self=="object"&&self&&self.Object===Object&&self,Pt=xo||Ms||Function("return this")(),At=Pt.Symbol,Co=Object.prototype,Us=Co.hasOwnProperty,Fs=Co.toString,Ae=At?At.toStringTag:void 0,Ds=Object.prototype.toString,zr=At?At.toStringTag:void 0;function Qt(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":zr&&zr in Object(t)?function(n){var r=Us.call(n,Ae),i=n[Ae];try{n[Ae]=void 0;var o=!0}catch{}var s=Fs.call(n);return o&&(r?n[Ae]=i:delete n[Ae]),s}(t):(e=t,Ds.call(e));var e}function vt(t){return t!=null&&typeof t=="object"}function Tn(t){return typeof t=="symbol"||vt(t)&&Qt(t)=="[object Symbol]"}function An(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var B=Array.isArray,Vr=At?At.prototype:void 0,Hr=Vr?Vr.toString:void 0;function ko(t){if(typeof t=="string")return t;if(B(t))return An(t,ko)+"";if(Tn(t))return Hr?Hr.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var js=/\s/,Bs=/^\s+/;function It(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var $s=/^[-+]0x[0-9a-f]+$/i,Ws=/^0b[01]+$/i,Gs=/^0o[0-7]+$/i,Ks=parseInt,zs=1/0;function Vs(t){return t?(t=function(e){if(typeof e=="number")return e;if(Tn(e))return NaN;if(It(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=It(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=function(i){return i&&i.slice(0,function(o){for(var s=o.length;s--&&js.test(o.charAt(s)););return s}(i)+1).replace(Bs,"")}(e);var r=Ws.test(e);return r||Gs.test(e)?Ks(e.slice(2),r?2:8):$s.test(e)?NaN:+e}(t))===zs||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:t===0?t:0}function In(t){var e=Vs(t),n=e%1;return e==e?n?e-n:e:0}function de(t){return t}function Ht(t){if(!It(t))return!1;var e=Qt(t);return e=="[object Function]"||e=="[object GeneratorFunction]"||e=="[object AsyncFunction]"||e=="[object Proxy]"}var Yr,bn=Pt["__core-js_shared__"],Xr=(Yr=/[^.]+$/.exec(bn&&bn.keys&&bn.keys.IE_PROTO||""))?"Symbol(src)_1."+Yr:"",Hs=Function.prototype.toString;function ie(t){if(t!=null){try{return Hs.call(t)}catch{}try{return t+""}catch{}}return""}var Ys=/^\[object .+?Constructor\]$/,Xs=Function.prototype,qs=Object.prototype,Qs=Xs.toString,Zs=qs.hasOwnProperty,Js=RegExp("^"+Qs.call(Zs).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function oe(t,e){var n,r,i=(n=t,r=e,n?.[r]);return function(o){return!(!It(o)||(s=o,Xr&&Xr in s))&&(Ht(o)?Js:Ys).test(ie(o));var s}(i)?i:void 0}var ar=oe(Pt,"WeakMap"),qr=Object.create,ta=function(){function t(){}return function(e){if(!It(e))return{};if(qr)return qr(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Q(){}var Qr,Pn,wn,ea=Date.now,an=function(){try{var t=oe(Object,"defineProperty");return t({},"",{}),t}catch{}}(),na=an?function(t,e){return an(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:de,ra=(Qr=na,Pn=0,wn=0,function(){var t=ea(),e=16-(t-wn);if(wn=t,e>0){if(++Pn>=800)return arguments[0]}else Pn=0;return Qr.apply(void 0,arguments)});function bo(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function Po(t,e,n,r){for(var i=t.length,o=n+-1;++o<i;)if(e(t[o],o,t))return o;return-1}function ia(t){return t!=t}function Cr(t,e,n){return e==e?function(r,i,o){for(var s=o-1,a=r.length;++s<a;)if(r[s]===i)return s;return-1}(t,e,n):Po(t,ia,n)}function wo(t,e){return!(t==null||!t.length)&&Cr(t,e,0)>-1}var oa=/^(?:0|[1-9]\d*)$/;function Nn(t,e){var n=typeof t;return!!(e=e??9007199254740991)&&(n=="number"||n!="symbol"&&oa.test(t))&&t>-1&&t%1==0&&t<e}function kr(t,e,n){e=="__proto__"&&an?an(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Be(t,e){return t===e||t!=t&&e!=e}var sa=Object.prototype.hasOwnProperty;function yn(t,e,n){var r=t[e];sa.call(t,e)&&Be(r,n)&&(n!==void 0||e in t)||kr(t,e,n)}function cr(t,e,n,r){var i=!n;n||(n={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=void 0;c===void 0&&(c=t[a]),i?kr(n,a,c):yn(n,a,c)}return n}var Zr=Math.max;function br(t,e){return ra((n=t,i=de,r=Zr((r=e)===void 0?n.length-1:r,0),function(){for(var o=arguments,s=-1,a=Zr(o.length-r,0),c=Array(a);++s<a;)c[s]=o[r+s];s=-1;for(var u=Array(r+1);++s<r;)u[s]=o[s];return u[r]=i(c),function(l,h,N){switch(N.length){case 0:return l.call(h);case 1:return l.call(h,N[0]);case 2:return l.call(h,N[0],N[1]);case 3:return l.call(h,N[0],N[1],N[2])}return l.apply(h,N)}(n,this,u)}),t+"");var n,r,i}function Pr(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=9007199254740991}function wt(t){return t!=null&&Pr(t.length)&&!Ht(t)}function Mo(t,e,n){if(!It(n))return!1;var r=typeof e;return!!(r=="number"?wt(n)&&Nn(e,n.length):r=="string"&&e in n)&&Be(n[e],t)}var aa=Object.prototype;function $e(t){var e=t&&t.constructor;return t===(typeof e=="function"&&e.prototype||aa)}function Jr(t){return vt(t)&&Qt(t)=="[object Arguments]"}var Uo=Object.prototype,ca=Uo.hasOwnProperty,ua=Uo.propertyIsEnumerable,Rn=Jr(function(){return arguments}())?Jr:function(t){return vt(t)&&ca.call(t,"callee")&&!ua.call(t,"callee")},Fo=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ti=Fo&&typeof module=="object"&&module&&!module.nodeType&&module,ei=ti&&ti.exports===Fo?Pt.Buffer:void 0,Pe=(ei?ei.isBuffer:void 0)||function(){return!1},z={};function vn(t){return function(e){return t(e)}}z["[object Float32Array]"]=z["[object Float64Array]"]=z["[object Int8Array]"]=z["[object Int16Array]"]=z["[object Int32Array]"]=z["[object Uint8Array]"]=z["[object Uint8ClampedArray]"]=z["[object Uint16Array]"]=z["[object Uint32Array]"]=!0,z["[object Arguments]"]=z["[object Array]"]=z["[object ArrayBuffer]"]=z["[object Boolean]"]=z["[object DataView]"]=z["[object Date]"]=z["[object Error]"]=z["[object Function]"]=z["[object Map]"]=z["[object Number]"]=z["[object Object]"]=z["[object RegExp]"]=z["[object Set]"]=z["[object String]"]=z["[object WeakMap]"]=!1;var Do=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Le=Do&&typeof module=="object"&&module&&!module.nodeType&&module,Mn=Le&&Le.exports===Do&&xo.process,Xt=function(){try{return Le&&Le.require&&Le.require("util").types||Mn&&Mn.binding&&Mn.binding("util")}catch{}}(),ni=Xt&&Xt.isTypedArray,wr=ni?vn(ni):function(t){return vt(t)&&Pr(t.length)&&!!z[Qt(t)]},la=Object.prototype.hasOwnProperty;function jo(t,e){var n=B(t),r=!n&&Rn(t),i=!n&&!r&&Pe(t),o=!n&&!r&&!i&&wr(t),s=n||r||i||o,a=s?function(l,h){for(var N=-1,S=Array(l);++N<l;)S[N]=h(N);return S}(t.length,String):[],c=a.length;for(var u in t)!e&&!la.call(t,u)||s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Nn(u,c))||a.push(u);return a}function Bo(t,e){return function(n){return t(e(n))}}var ha=Bo(Object.keys,Object),fa=Object.prototype.hasOwnProperty;function $o(t){if(!$e(t))return ha(t);var e=[];for(var n in Object(t))fa.call(t,n)&&n!="constructor"&&e.push(n);return e}function Nt(t){return wt(t)?jo(t):$o(t)}var Un,da=Object.prototype.hasOwnProperty,dt=(Un=function(t,e){if($e(e)||wt(e))cr(e,Nt(e),t);else for(var n in e)da.call(e,n)&&yn(t,n,e[n])},br(function(t,e){var n=-1,r=e.length,i=r>1?e[r-1]:void 0,o=r>2?e[2]:void 0;for(i=Un.length>3&&typeof i=="function"?(r--,i):void 0,o&&Mo(e[0],e[1],o)&&(i=r<3?void 0:i,r=1),t=Object(t);++n<r;){var s=e[n];s&&Un(t,s)}return t})),pa=Object.prototype.hasOwnProperty;function Wo(t){return wt(t)?jo(t,!0):function(e){if(!It(e))return function(o){var s=[];if(o!=null)for(var a in Object(o))s.push(a);return s}(e);var n=$e(e),r=[];for(var i in e)(i!="constructor"||!n&&pa.call(e,i))&&r.push(i);return r}(t)}var ma=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ea=/^\w*$/;function ur(t,e){if(B(t))return!1;var n=typeof t;return!(n!="number"&&n!="symbol"&&n!="boolean"&&t!=null&&!Tn(t))||Ea.test(t)||!ma.test(t)||e!=null&&t in Object(e)}var Ie=oe(Object,"create"),ga=Object.prototype.hasOwnProperty,Ta=Object.prototype.hasOwnProperty;function ee(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ge(t,e){for(var n=t.length;n--;)if(Be(t[n][0],e))return n;return-1}ee.prototype.clear=function(){this.__data__=Ie?Ie(null):{},this.size=0},ee.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},ee.prototype.get=function(t){var e=this.__data__;if(Ie){var n=e[t];return n==="__lodash_hash_undefined__"?void 0:n}return ga.call(e,t)?e[t]:void 0},ee.prototype.has=function(t){var e=this.__data__;return Ie?e[t]!==void 0:Ta.call(e,t)},ee.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ie&&e===void 0?"__lodash_hash_undefined__":e,this};var Aa=Array.prototype.splice;function zt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}zt.prototype.clear=function(){this.__data__=[],this.size=0},zt.prototype.delete=function(t){var e=this.__data__,n=Ge(e,t);return!(n<0||(n==e.length-1?e.pop():Aa.call(e,n,1),--this.size,0))},zt.prototype.get=function(t){var e=this.__data__,n=Ge(e,t);return n<0?void 0:e[n][1]},zt.prototype.has=function(t){return Ge(this.__data__,t)>-1},zt.prototype.set=function(t,e){var n=this.__data__,r=Ge(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var we=oe(Pt,"Map");function Ke(t,e){var n,r,i=t.__data__;return((r=typeof(n=e))=="string"||r=="number"||r=="symbol"||r=="boolean"?n!=="__proto__":n===null)?i[typeof e=="string"?"string":"hash"]:i.map}function Wt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Mr(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Mr.Cache||Wt),n}Wt.prototype.clear=function(){this.size=0,this.__data__={hash:new ee,map:new(we||zt),string:new ee}},Wt.prototype.delete=function(t){var e=Ke(this,t).delete(t);return this.size-=e?1:0,e},Wt.prototype.get=function(t){return Ke(this,t).get(t)},Wt.prototype.has=function(t){return Ke(this,t).has(t)},Wt.prototype.set=function(t,e){var n=Ke(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Mr.Cache=Wt;var Fn,Dn,Ia=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Na=/\\(\\)?/g,ya=(Fn=Mr(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Ia,function(n,r,i,o){e.push(i?o.replace(Na,"$1"):r||n)}),e},function(t){return Dn.size===500&&Dn.clear(),t}),Dn=Fn.cache,Fn);function On(t,e){return B(t)?t:ur(t,e)?[t]:ya(function(n){return n==null?"":ko(n)}(t))}function Me(t){if(typeof t=="string"||Tn(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function lr(t,e){for(var n=0,r=(e=On(e,t)).length;t!=null&&n<r;)t=t[Me(e[n++])];return n&&n==r?t:void 0}function Ur(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var ri=At?At.isConcatSpreadable:void 0;function Ra(t){return B(t)||Rn(t)||!!(ri&&t&&t[ri])}function Fr(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=Ra),i||(i=[]);++o<s;){var a=t[o];n(a)?Ur(i,a):r||(i[i.length]=a)}return i}function yt(t){return t!=null&&t.length?Fr(t):[]}var Go=Bo(Object.getPrototypeOf,Object);function Ko(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=t[r+e];return o}function va(t,e,n,r){var i=-1,o=t==null?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function kt(t){var e=this.__data__=new zt(t);this.size=e.size}kt.prototype.clear=function(){this.__data__=new zt,this.size=0},kt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},kt.prototype.get=function(t){return this.__data__.get(t)},kt.prototype.has=function(t){return this.__data__.has(t)},kt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof zt){var r=n.__data__;if(!we||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Wt(r)}return n.set(t,e),this.size=n.size,this};var zo=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ii=zo&&typeof module=="object"&&module&&!module.nodeType&&module,oi=ii&&ii.exports===zo?Pt.Buffer:void 0,si=oi?oi.allocUnsafe:void 0;function Dr(t,e){for(var n=-1,r=t==null?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function Vo(){return[]}var Oa=Object.prototype.propertyIsEnumerable,ai=Object.getOwnPropertySymbols,jr=ai?function(t){return t==null?[]:(t=Object(t),Dr(ai(t),function(e){return Oa.call(t,e)}))}:Vo,Sa=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Ur(e,jr(t)),t=Go(t);return e}:Vo;function Ho(t,e,n){var r=e(t);return B(t)?r:Ur(r,n(t))}function hr(t){return Ho(t,Nt,jr)}var fr=oe(Pt,"DataView"),dr=oe(Pt,"Promise"),he=oe(Pt,"Set"),ci="[object Map]",ui="[object Promise]",li="[object Set]",hi="[object WeakMap]",fi="[object DataView]",_a=ie(fr),La=ie(we),xa=ie(dr),Ca=ie(he),ka=ie(ar),Tt=Qt;(fr&&Tt(new fr(new ArrayBuffer(1)))!=fi||we&&Tt(new we)!=ci||dr&&Tt(dr.resolve())!=ui||he&&Tt(new he)!=li||ar&&Tt(new ar)!=hi)&&(Tt=function(t){var e=Qt(t),n=e=="[object Object]"?t.constructor:void 0,r=n?ie(n):"";if(r)switch(r){case _a:return fi;case La:return ci;case xa:return ui;case Ca:return li;case ka:return hi}return e});var ba=Object.prototype.hasOwnProperty,cn=Pt.Uint8Array,Pa=/\w*$/,di=At?At.prototype:void 0,pi=di?di.valueOf:void 0,mi=Xt&&Xt.isMap,wa=mi?vn(mi):function(t){return vt(t)&&Tt(t)=="[object Map]"},Ei=Xt&&Xt.isSet,Ma=Ei?vn(Ei):function(t){return vt(t)&&Tt(t)=="[object Set]"},Yo="[object Arguments]",Xo="[object Function]",qo="[object Object]",G={};function Ze(t,e,n,r,i,o){var s;if(s!==void 0)return s;if(!It(t))return t;var a,c,u,l=B(t);if(l)return c=(a=t).length,u=new a.constructor(c),c&&typeof a[0]=="string"&&ba.call(a,"index")&&(u.index=a.index,u.input=a.input),function(m,y){var p=-1,T=m.length;for(y||(y=Array(T));++p<T;)y[p]=m[p];return y}(t,s=u);var h=Tt(t),N=h==Xo||h=="[object GeneratorFunction]";if(Pe(t))return function(m){var y=m.length,p=si?si(y):new m.constructor(y);return m.copy(p),p}(t);if(h==qo||h==Yo||N&&!i)return s=N?{}:function(m){return typeof m.constructor!="function"||$e(m)?{}:ta(Go(m))}(t),function(m,y){return cr(m,jr(m),y)}(t,function(m,y){return m&&cr(y,Nt(y),m)}(s,t));if(!G[h])return i?t:{};s=function(m,y){var p,T,g,A,v,f,d,I=m.constructor;switch(y){case"[object ArrayBuffer]":return v=new(A=m).constructor(A.byteLength),new cn(v).set(new cn(A)),v;case"[object Boolean]":case"[object Date]":return new I(+m);case"[object DataView]":return g=(T=m).buffer,new T.constructor(g,T.byteOffset,T.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return d=(f=m).buffer,new f.constructor(d,f.byteOffset,f.length);case"[object Map]":case"[object Set]":return new I;case"[object Number]":case"[object String]":return new I(m);case"[object RegExp]":return function(E){var R=new E.constructor(E.source,Pa.exec(E));return R.lastIndex=E.lastIndex,R}(m);case"[object Symbol]":return p=m,pi?Object(pi.call(p)):{}}}(t,h),o||(o=new kt);var S=o.get(t);if(S)return S;o.set(t,s),Ma(t)?t.forEach(function(m){s.add(Ze(m,e,n,m,t,o))}):wa(t)&&t.forEach(function(m,y){s.set(y,Ze(m,e,n,y,t,o))});var L=l?void 0:hr(t);return bo(L||t,function(m,y){L&&(m=t[y=m]),yn(s,y,Ze(m,e,n,y,t,o))}),s}function et(t){return Ze(t,4)}function Ue(t){for(var e=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i}function fe(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Wt;++e<n;)this.add(t[e])}function Qo(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function Br(t,e){return t.has(e)}function gi(t,e,n,r,i,o){var s=1&n,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=o.get(t),l=o.get(e);if(u&&l)return u==e&&l==t;var h=-1,N=!0,S=2&n?new fe:void 0;for(o.set(t,e),o.set(e,t);++h<a;){var L=t[h],m=e[h];if(r)var y=s?r(m,L,h,e,t,o):r(L,m,h,t,e,o);if(y!==void 0){if(y)continue;N=!1;break}if(S){if(!Qo(e,function(p,T){if(!Br(S,T)&&(L===p||i(L,p,n,r,o)))return S.push(T)})){N=!1;break}}else if(L!==m&&!i(L,m,n,r,o)){N=!1;break}}return o.delete(t),o.delete(e),N}function Ua(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function $r(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}G[Yo]=G["[object Array]"]=G["[object ArrayBuffer]"]=G["[object DataView]"]=G["[object Boolean]"]=G["[object Date]"]=G["[object Float32Array]"]=G["[object Float64Array]"]=G["[object Int8Array]"]=G["[object Int16Array]"]=G["[object Int32Array]"]=G["[object Map]"]=G["[object Number]"]=G[qo]=G["[object RegExp]"]=G["[object Set]"]=G["[object String]"]=G["[object Symbol]"]=G["[object Uint8Array]"]=G["[object Uint8ClampedArray]"]=G["[object Uint16Array]"]=G["[object Uint32Array]"]=!0,G["[object Error]"]=G[Xo]=G["[object WeakMap]"]=!1,fe.prototype.add=fe.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},fe.prototype.has=function(t){return this.__data__.has(t)};var Ti=At?At.prototype:void 0,jn=Ti?Ti.valueOf:void 0,Fa=Object.prototype.hasOwnProperty,Ai="[object Arguments]",Ii="[object Array]",ze="[object Object]",Ni=Object.prototype.hasOwnProperty;function pr(t,e,n,r,i){return t===e||(t==null||e==null||!vt(t)&&!vt(e)?t!=t&&e!=e:function(o,s,a,c,u,l){var h=B(o),N=B(s),S=h?Ii:Tt(o),L=N?Ii:Tt(s),m=(S=S==Ai?ze:S)==ze,y=(L=L==Ai?ze:L)==ze,p=S==L;if(p&&Pe(o)){if(!Pe(s))return!1;h=!0,m=!1}if(p&&!m)return l||(l=new kt),h||wr(o)?gi(o,s,a,c,u,l):function(f,d,I,E,R,U,x){switch(I){case"[object DataView]":if(f.byteLength!=d.byteLength||f.byteOffset!=d.byteOffset)return!1;f=f.buffer,d=d.buffer;case"[object ArrayBuffer]":return!(f.byteLength!=d.byteLength||!U(new cn(f),new cn(d)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Be(+f,+d);case"[object Error]":return f.name==d.name&&f.message==d.message;case"[object RegExp]":case"[object String]":return f==d+"";case"[object Map]":var O=Ua;case"[object Set]":var w=1&E;if(O||(O=$r),f.size!=d.size&&!w)return!1;var C=x.get(f);if(C)return C==d;E|=2,x.set(f,d);var k=gi(O(f),O(d),E,R,U,x);return x.delete(f),k;case"[object Symbol]":if(jn)return jn.call(f)==jn.call(d)}return!1}(o,s,S,a,c,u,l);if(!(1&a)){var T=m&&Ni.call(o,"__wrapped__"),g=y&&Ni.call(s,"__wrapped__");if(T||g){var A=T?o.value():o,v=g?s.value():s;return l||(l=new kt),u(A,v,a,c,l)}}return!!p&&(l||(l=new kt),function(f,d,I,E,R,U){var x=1&I,O=hr(f),w=O.length;if(w!=hr(d).length&&!x)return!1;for(var C=w;C--;){var k=O[C];if(!(x?k in d:Fa.call(d,k)))return!1}var $=U.get(f),X=U.get(d);if($&&X)return $==d&&X==f;var W=!0;U.set(f,d),U.set(d,f);for(var rt=x;++C<w;){var mt=f[k=O[C]],xt=d[k];if(E)var Te=x?E(xt,mt,k,d,f,U):E(mt,xt,k,f,d,U);if(!(Te===void 0?mt===xt||R(mt,xt,I,E,U):Te)){W=!1;break}rt||(rt=k=="constructor")}if(W&&!rt){var nt=f.constructor,Zt=d.constructor;nt==Zt||!("constructor"in f)||!("constructor"in d)||typeof nt=="function"&&nt instanceof nt&&typeof Zt=="function"&&Zt instanceof Zt||(W=!1)}return U.delete(f),U.delete(d),W}(o,s,a,c,u,l))}(t,e,n,r,pr,i))}function yi(t){return t==t&&!It(t)}function Ri(t,e){return function(n){return n!=null&&n[t]===e&&(e!==void 0||t in Object(n))}}function Da(t,e){return t!=null&&e in Object(t)}function Zo(t,e,n){for(var r=-1,i=(e=On(e,t)).length,o=!1;++r<i;){var s=Me(e[r]);if(!(o=t!=null&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=t==null?0:t.length)&&Pr(i)&&Nn(s,i)&&(B(t)||Rn(t))}function bt(t){return typeof t=="function"?t:t==null?de:typeof t=="object"?B(t)?function(e,n){return ur(e)&&yi(n)?Ri(Me(e),n):function(r){var i,o,s=(o=(i=r)==null?void 0:lr(i,e))===void 0?void 0:o;return s===void 0&&s===n?function(a,c){return a!=null&&Zo(a,c,Da)}(r,e):pr(n,s,3)}}(t[0],t[1]):function(e){var n=function(r){for(var i=Nt(r),o=i.length;o--;){var s=i[o],a=r[s];i[o]=[s,a,yi(a)]}return i}(e);return n.length==1&&n[0][2]?Ri(n[0][0],n[0][1]):function(r){return r===e||function(i,o,s){var a=s.length,c=a;if(i==null)return!c;for(i=Object(i);a--;){var u=s[a];if(u[2]?u[1]!==i[u[0]]:!(u[0]in i))return!1}for(;++a<c;){var l=(u=s[a])[0],h=i[l],N=u[1];if(u[2]){if(h===void 0&&!(l in i))return!1}else if(!pr(N,h,3,void 0,new kt))return!1}return!0}(r,0,n)}}(t):function(e){return ur(e)?(n=Me(e),function(r){return r?.[n]}):function(r){return function(i){return lr(i,r)}}(e);var n}(t)}function ja(t,e,n,r){for(var i=-1,o=t==null?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}var vi,se=(vi=function(t,e){return t&&function(n,r,i){for(var o=-1,s=Object(n),a=i(n),c=a.length;c--;){var u=a[++o];if(r(s[u],u,s)===!1)break}return n}(t,e,Nt)},function(t,e){if(t==null)return t;if(!wt(t))return vi(t,e);for(var n=t.length,r=-1,i=Object(t);++r<n&&e(i[r],r,i)!==!1;);return t});function Ba(t,e,n,r){return se(t,function(i,o,s){e(r,i,n(i),s)}),r}var Jo=Object.prototype,$a=Jo.hasOwnProperty,mr=br(function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&Mo(e[0],e[1],i)&&(r=1);++n<r;)for(var o=e[n],s=Wo(o),a=-1,c=s.length;++a<c;){var u=s[a],l=t[u];(l===void 0||Be(l,Jo[u])&&!$a.call(t,u))&&(t[u]=o[u])}return t});function Oi(t){return vt(t)&&wt(t)}var un=br(function(t,e){return Oi(t)?function(n,r){var i=-1,o=wo,s=!0,a=n.length,c=[],u=r.length;if(!a)return c;r.length>=200&&(o=Br,s=!1,r=new fe(r));t:for(;++i<a;){var l=n[i],h=l;if(l=l!==0?l:0,s&&h==h){for(var N=u;N--;)if(r[N]===h)continue t;c.push(l)}else o(r,h,void 0)||c.push(l)}return c}(t,Fr(e,0,Oi,!0)):[]});function pe(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function tt(t,e,n){var r=t==null?0:t.length;return r?Ko(t,(e=e===void 0?1:In(e))<0?0:e,r):[]}function Fe(t,e,n){var r=t==null?0:t.length;return r?Ko(t,0,(e=r-(e=e===void 0?1:In(e)))<0?0:e):[]}function M(t,e){var n;return(B(t)?bo:se)(t,typeof(n=e)=="function"?n:de)}function Wa(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ga(t,e){var n=!0;return se(t,function(r,i,o){return n=!!e(r,i,o)}),n}function Rt(t,e,n){return(B(t)?Wa:Ga)(t,bt(e))}function ts(t,e){var n=[];return se(t,function(r,i,o){e(r,i,o)&&n.push(r)}),n}function Et(t,e){return(B(t)?Dr:ts)(t,bt(e))}var Si,Ka=Math.max,me=(Si=function(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:In(n);return i<0&&(i=Ka(r+i,0)),Po(t,bt(e),i)},function(t,e,n){var r=Object(t);if(!wt(t)){var i=bt(e);t=Nt(t),e=function(s){return i(r[s],s,r)}}var o=Si(t,e,n);return o>-1?r[i?t[o]:o]:void 0});function Ot(t){return t&&t.length?t[0]:void 0}function za(t,e){var n=-1,r=wt(t)?Array(t.length):[];return se(t,function(i,o,s){r[++n]=e(i,o,s)}),r}function b(t,e){return(B(t)?An:za)(t,bt(e))}function gt(t,e){return Fr(b(t,e))}var _i,Va=Object.prototype.hasOwnProperty,Ha=(_i=function(t,e,n){Va.call(t,n)?t[n].push(e):kr(t,n,[e])},function(t,e){return(B(t)?ja:Ba)(t,_i,bt(e),{})}),Ya=Object.prototype.hasOwnProperty;function Xa(t,e){return t!=null&&Ya.call(t,e)}function P(t,e){return t!=null&&Zo(t,e,Xa)}function ut(t){return typeof t=="string"||!B(t)&&vt(t)&&Qt(t)=="[object String]"}function Z(t){return t==null?[]:function(e,n){return An(n,function(r){return e[r]})}(t,Nt(t))}var qa=Math.max;function at(t,e,n,r){t=wt(t)?t:Z(t),n=n?In(n):0;var i=t.length;return n<0&&(n=qa(i+n,0)),ut(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Cr(t,e,n)>-1}function Li(t,e,n){return t!=null&&t.length?Cr(t,e,0):-1}var Qa=Object.prototype.hasOwnProperty;function K(t){if(t==null)return!0;if(wt(t)&&(B(t)||typeof t=="string"||typeof t.splice=="function"||Pe(t)||wr(t)||Rn(t)))return!t.length;var e=Tt(t);if(e=="[object Map]"||e=="[object Set]")return!t.size;if($e(t))return!$o(t).length;for(var n in t)if(Qa.call(t,n))return!1;return!0}var xi=Xt&&Xt.isRegExp,Gt=xi?vn(xi):function(t){return vt(t)&&Qt(t)=="[object RegExp]"};function Vt(t){return t===void 0}function Za(t,e,n,r){if(!It(t))return t;for(var i=-1,o=(e=On(e,t)).length,s=o-1,a=t;a!=null&&++i<o;){var c=Me(e[i]),u=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=s){var l=a[c];(u=void 0)==null&&(u=It(l)?l:Nn(e[i+1])?[]:{})}yn(a,c,u),a=a[c]}return t}function St(t,e){if(t==null)return{};var n=An(Ho(t,Wo,Sa),function(r){return[r]});return e=bt(e),function(r,i,o){for(var s=-1,a=i.length,c={};++s<a;){var u=i[s],l=lr(r,u);o(l,u)&&Za(c,On(u,r),l)}return c}(t,n,function(r,i){return e(r,i[0])})}function Ja(t,e,n,r,i){return i(t,function(o,s,a){n=r?(r=!1,o):e(n,o,s,a)}),n}function ft(t,e,n){var r=B(t)?va:Ja,i=arguments.length<3;return r(t,bt(e),n,i,se)}function Je(t,e){return(B(t)?Dr:ts)(t,function(n){if(typeof n!="function")throw new TypeError("Expected a function");return function(){var r=arguments;switch(r.length){case 0:return!n.call(this);case 1:return!n.call(this,r[0]);case 2:return!n.call(this,r[0],r[1]);case 3:return!n.call(this,r[0],r[1],r[2])}return!n.apply(this,r)}}(bt(e)))}function tc(t,e){var n;return se(t,function(r,i,o){return!(n=e(r,i,o))}),!!n}function es(t,e,n){return(B(t)?Qo:tc)(t,bt(e))}var ec=he&&1/$r(new he([,-0]))[1]==1/0?function(t){return new he(t)}:Q;function Er(t){return t&&t.length?function(e){var n=-1,r=wo,i=e.length,o=!0,s=[],a=s;if(i>=200){var c=ec(e);if(c)return $r(c);o=!1,r=Br,a=new fe}else a=s;t:for(;++n<i;){var u=e[n],l=u;if(u=u!==0?u:0,o&&l==l){for(var h=a.length;h--;)if(a[h]===l)continue t;s.push(u)}else r(a,l,void 0)||(a!==s&&a.push(l),s.push(u))}return s}(t):[]}function gr(t){console&&console.error&&console.error(`Error: ${t}`)}function ns(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function rs(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function is(t){function e(){}e.prototype=t;const n=new e;function r(){return typeof n.bar}return r(),r(),t}function nc(t){return ut((e=t).LABEL)&&e.LABEL!==""?t.LABEL:t.name;var e}class Mt{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),M(this.definition,n=>{n.accept(e)})}}class pt extends Mt{constructor(e){super([]),this.idx=1,dt(this,St(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Ee extends Mt{constructor(e){super(e.definition),this.orgText="",dt(this,St(e,n=>n!==void 0))}}class ht extends Mt{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,dt(this,St(e,n=>n!==void 0))}}class lt extends Mt{constructor(e){super(e.definition),this.idx=1,dt(this,St(e,n=>n!==void 0))}}class Ut extends Mt{constructor(e){super(e.definition),this.idx=1,dt(this,St(e,n=>n!==void 0))}}class Ft extends Mt{constructor(e){super(e.definition),this.idx=1,dt(this,St(e,n=>n!==void 0))}}class J extends Mt{constructor(e){super(e.definition),this.idx=1,dt(this,St(e,n=>n!==void 0))}}class _t extends Mt{constructor(e){super(e.definition),this.idx=1,dt(this,St(e,n=>n!==void 0))}}class Lt extends Mt{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,dt(this,St(e,n=>n!==void 0))}}class V{constructor(e){this.idx=1,dt(this,St(e,n=>n!==void 0))}accept(e){e.visit(this)}}function tn(t){function e(n){return b(n,tn)}if(t instanceof pt){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return ut(t.label)&&(n.label=t.label),n}if(t instanceof ht)return{type:"Alternative",definition:e(t.definition)};if(t instanceof lt)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Ut)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof Ft)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:tn(new V({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof _t)return{type:"RepetitionWithSeparator",idx:t.idx,separator:tn(new V({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof J)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof Lt)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof V){const n={type:"Terminal",name:t.terminalType.name,label:nc(t.terminalType),idx:t.idx};ut(t.label)&&(n.terminalLabel=t.label);const r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=Gt(r)?r.source:r),n}if(t instanceof Ee)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}class ge{visit(e){const n=e;switch(n.constructor){case pt:return this.visitNonTerminal(n);case ht:return this.visitAlternative(n);case lt:return this.visitOption(n);case Ut:return this.visitRepetitionMandatory(n);case Ft:return this.visitRepetitionMandatoryWithSeparator(n);case _t:return this.visitRepetitionWithSeparator(n);case J:return this.visitRepetition(n);case Lt:return this.visitAlternation(n);case V:return this.visitTerminal(n);case Ee:return this.visitRule(n);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 ln(t,e=[]){return t instanceof lt||t instanceof J||t instanceof _t||(t instanceof Lt?es(t.definition,n=>ln(n,e)):!(t instanceof pt&&at(e,t))&&t instanceof Mt&&(t instanceof pt&&e.push(t),Rt(t.definition,n=>ln(n,e))))}function Ct(t){if(t instanceof pt)return"SUBRULE";if(t instanceof lt)return"OPTION";if(t instanceof Lt)return"OR";if(t instanceof Ut)return"AT_LEAST_ONE";if(t instanceof Ft)return"AT_LEAST_ONE_SEP";if(t instanceof _t)return"MANY_SEP";if(t instanceof J)return"MANY";if(t instanceof V)return"CONSUME";throw Error("non exhaustive match")}class Sn{walk(e,n=[]){M(e.definition,(r,i)=>{const o=tt(e.definition,i+1);if(r instanceof pt)this.walkProdRef(r,o,n);else if(r instanceof V)this.walkTerminal(r,o,n);else if(r instanceof ht)this.walkFlat(r,o,n);else if(r instanceof lt)this.walkOption(r,o,n);else if(r instanceof Ut)this.walkAtLeastOne(r,o,n);else if(r instanceof Ft)this.walkAtLeastOneSep(r,o,n);else if(r instanceof _t)this.walkManySep(r,o,n);else if(r instanceof J)this.walkMany(r,o,n);else{if(!(r instanceof Lt))throw Error("non exhaustive match");this.walkOr(r,o,n)}})}walkTerminal(e,n,r){}walkProdRef(e,n,r){}walkFlat(e,n,r){const i=n.concat(r);this.walk(e,i)}walkOption(e,n,r){const i=n.concat(r);this.walk(e,i)}walkAtLeastOne(e,n,r){const i=[new lt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){const i=Ci(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new lt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=Ci(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);M(e.definition,o=>{const s=new ht({definition:[o]});this.walk(s,i)})}}function Ci(t,e,n){return[new lt({definition:[new V({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function xe(t){if(t instanceof pt)return xe(t.referencedRule);if(t instanceof V)return[t.terminalType];if(function(e){return e instanceof ht||e instanceof lt||e instanceof J||e instanceof Ut||e instanceof Ft||e instanceof _t||e instanceof V||e instanceof Ee}(t))return function(e){let n=[];const r=e.definition;let i,o=0,s=r.length>o,a=!0;for(;s&&a;)i=r[o],a=ln(i),n=n.concat(xe(i)),o+=1,s=r.length>o;return Er(n)}(t);if(function(e){return e instanceof Lt}(t))return function(e){return Er(yt(b(e.definition,n=>xe(n))))}(t);throw Error("non exhaustive match")}const os="_~IN~_";class rc extends Sn{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,n,r){}walkProdRef(e,n,r){const i=(o=e.referencedRule,s=e.idx,o.name+s+os+this.topProd.name);var o,s;const a=n.concat(r),c=xe(new ht({definition:a}));this.follows[i]=c}}function F(t){return t.charCodeAt(0)}function Bn(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function Ne(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function ae(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function ki(t){return t.type==="Character"}const hn=[];for(let t=F("0");t<=F("9");t++)hn.push(t);const fn=[F("_")].concat(hn);for(let t=F("a");t<=F("z");t++)fn.push(t);for(let t=F("A");t<=F("Z");t++)fn.push(t);const bi=[F(" "),F("\f"),F(`
|
|
6
|
+
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./CgZJr_HNgqQcu-4B.cjs");var xo=typeof global=="object"&&global&&global.Object===Object&&global,Ms=typeof self=="object"&&self&&self.Object===Object&&self,Pt=xo||Ms||Function("return this")(),At=Pt.Symbol,Co=Object.prototype,Us=Co.hasOwnProperty,Fs=Co.toString,Ae=At?At.toStringTag:void 0,Ds=Object.prototype.toString,zr=At?At.toStringTag:void 0;function Zt(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":zr&&zr in Object(t)?function(n){var r=Us.call(n,Ae),i=n[Ae];try{n[Ae]=void 0;var o=!0}catch{}var s=Fs.call(n);return o&&(r?n[Ae]=i:delete n[Ae]),s}(t):(e=t,Ds.call(e));var e}function vt(t){return t!=null&&typeof t=="object"}function Tn(t){return typeof t=="symbol"||vt(t)&&Zt(t)=="[object Symbol]"}function An(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var B=Array.isArray,Vr=At?At.prototype:void 0,Hr=Vr?Vr.toString:void 0;function ko(t){if(typeof t=="string")return t;if(B(t))return An(t,ko)+"";if(Tn(t))return Hr?Hr.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var js=/\s/,Bs=/^\s+/;function It(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var $s=/^[-+]0x[0-9a-f]+$/i,Ws=/^0b[01]+$/i,Gs=/^0o[0-7]+$/i,Ks=parseInt,zs=1/0;function Vs(t){return t?(t=function(e){if(typeof e=="number")return e;if(Tn(e))return NaN;if(It(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=It(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=function(i){return i&&i.slice(0,function(o){for(var s=o.length;s--&&js.test(o.charAt(s)););return s}(i)+1).replace(Bs,"")}(e);var r=Ws.test(e);return r||Gs.test(e)?Ks(e.slice(2),r?2:8):$s.test(e)?NaN:+e}(t))===zs||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:t===0?t:0}function In(t){var e=Vs(t),n=e%1;return e==e?n?e-n:e:0}function de(t){return t}function Ht(t){if(!It(t))return!1;var e=Zt(t);return e=="[object Function]"||e=="[object GeneratorFunction]"||e=="[object AsyncFunction]"||e=="[object Proxy]"}var Yr,bn=Pt["__core-js_shared__"],Xr=(Yr=/[^.]+$/.exec(bn&&bn.keys&&bn.keys.IE_PROTO||""))?"Symbol(src)_1."+Yr:"",Hs=Function.prototype.toString;function ie(t){if(t!=null){try{return Hs.call(t)}catch{}try{return t+""}catch{}}return""}var Ys=/^\[object .+?Constructor\]$/,Xs=Function.prototype,qs=Object.prototype,Zs=Xs.toString,Qs=qs.hasOwnProperty,Js=RegExp("^"+Zs.call(Qs).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function oe(t,e){var n,r,i=(n=t,r=e,n?.[r]);return function(o){return!(!It(o)||(s=o,Xr&&Xr in s))&&(Ht(o)?Js:Ys).test(ie(o));var s}(i)?i:void 0}var ar=oe(Pt,"WeakMap"),qr=Object.create,ta=function(){function t(){}return function(e){if(!It(e))return{};if(qr)return qr(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Z(){}var Zr,Pn,wn,ea=Date.now,an=function(){try{var t=oe(Object,"defineProperty");return t({},"",{}),t}catch{}}(),na=an?function(t,e){return an(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:de,ra=(Zr=na,Pn=0,wn=0,function(){var t=ea(),e=16-(t-wn);if(wn=t,e>0){if(++Pn>=800)return arguments[0]}else Pn=0;return Zr.apply(void 0,arguments)});function bo(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function Po(t,e,n,r){for(var i=t.length,o=n+-1;++o<i;)if(e(t[o],o,t))return o;return-1}function ia(t){return t!=t}function Cr(t,e,n){return e==e?function(r,i,o){for(var s=o-1,a=r.length;++s<a;)if(r[s]===i)return s;return-1}(t,e,n):Po(t,ia,n)}function wo(t,e){return!(t==null||!t.length)&&Cr(t,e,0)>-1}var oa=/^(?:0|[1-9]\d*)$/;function Nn(t,e){var n=typeof t;return!!(e=e??9007199254740991)&&(n=="number"||n!="symbol"&&oa.test(t))&&t>-1&&t%1==0&&t<e}function kr(t,e,n){e=="__proto__"&&an?an(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Be(t,e){return t===e||t!=t&&e!=e}var sa=Object.prototype.hasOwnProperty;function yn(t,e,n){var r=t[e];sa.call(t,e)&&Be(r,n)&&(n!==void 0||e in t)||kr(t,e,n)}function cr(t,e,n,r){var i=!n;n||(n={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=void 0;c===void 0&&(c=t[a]),i?kr(n,a,c):yn(n,a,c)}return n}var Qr=Math.max;function br(t,e){return ra((n=t,i=de,r=Qr((r=e)===void 0?n.length-1:r,0),function(){for(var o=arguments,s=-1,a=Qr(o.length-r,0),c=Array(a);++s<a;)c[s]=o[r+s];s=-1;for(var u=Array(r+1);++s<r;)u[s]=o[s];return u[r]=i(c),function(l,h,N){switch(N.length){case 0:return l.call(h);case 1:return l.call(h,N[0]);case 2:return l.call(h,N[0],N[1]);case 3:return l.call(h,N[0],N[1],N[2])}return l.apply(h,N)}(n,this,u)}),t+"");var n,r,i}function Pr(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=9007199254740991}function wt(t){return t!=null&&Pr(t.length)&&!Ht(t)}function Mo(t,e,n){if(!It(n))return!1;var r=typeof e;return!!(r=="number"?wt(n)&&Nn(e,n.length):r=="string"&&e in n)&&Be(n[e],t)}var aa=Object.prototype;function $e(t){var e=t&&t.constructor;return t===(typeof e=="function"&&e.prototype||aa)}function Jr(t){return vt(t)&&Zt(t)=="[object Arguments]"}var Uo=Object.prototype,ca=Uo.hasOwnProperty,ua=Uo.propertyIsEnumerable,Rn=Jr(function(){return arguments}())?Jr:function(t){return vt(t)&&ca.call(t,"callee")&&!ua.call(t,"callee")},Fo=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ti=Fo&&typeof module=="object"&&module&&!module.nodeType&&module,ei=ti&&ti.exports===Fo?Pt.Buffer:void 0,Pe=(ei?ei.isBuffer:void 0)||function(){return!1},z={};function vn(t){return function(e){return t(e)}}z["[object Float32Array]"]=z["[object Float64Array]"]=z["[object Int8Array]"]=z["[object Int16Array]"]=z["[object Int32Array]"]=z["[object Uint8Array]"]=z["[object Uint8ClampedArray]"]=z["[object Uint16Array]"]=z["[object Uint32Array]"]=!0,z["[object Arguments]"]=z["[object Array]"]=z["[object ArrayBuffer]"]=z["[object Boolean]"]=z["[object DataView]"]=z["[object Date]"]=z["[object Error]"]=z["[object Function]"]=z["[object Map]"]=z["[object Number]"]=z["[object Object]"]=z["[object RegExp]"]=z["[object Set]"]=z["[object String]"]=z["[object WeakMap]"]=!1;var Do=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Le=Do&&typeof module=="object"&&module&&!module.nodeType&&module,Mn=Le&&Le.exports===Do&&xo.process,Xt=function(){try{return Le&&Le.require&&Le.require("util").types||Mn&&Mn.binding&&Mn.binding("util")}catch{}}(),ni=Xt&&Xt.isTypedArray,wr=ni?vn(ni):function(t){return vt(t)&&Pr(t.length)&&!!z[Zt(t)]},la=Object.prototype.hasOwnProperty;function jo(t,e){var n=B(t),r=!n&&Rn(t),i=!n&&!r&&Pe(t),o=!n&&!r&&!i&&wr(t),s=n||r||i||o,a=s?function(l,h){for(var N=-1,S=Array(l);++N<l;)S[N]=h(N);return S}(t.length,String):[],c=a.length;for(var u in t)!e&&!la.call(t,u)||s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Nn(u,c))||a.push(u);return a}function Bo(t,e){return function(n){return t(e(n))}}var ha=Bo(Object.keys,Object),fa=Object.prototype.hasOwnProperty;function $o(t){if(!$e(t))return ha(t);var e=[];for(var n in Object(t))fa.call(t,n)&&n!="constructor"&&e.push(n);return e}function Nt(t){return wt(t)?jo(t):$o(t)}var Un,da=Object.prototype.hasOwnProperty,dt=(Un=function(t,e){if($e(e)||wt(e))cr(e,Nt(e),t);else for(var n in e)da.call(e,n)&&yn(t,n,e[n])},br(function(t,e){var n=-1,r=e.length,i=r>1?e[r-1]:void 0,o=r>2?e[2]:void 0;for(i=Un.length>3&&typeof i=="function"?(r--,i):void 0,o&&Mo(e[0],e[1],o)&&(i=r<3?void 0:i,r=1),t=Object(t);++n<r;){var s=e[n];s&&Un(t,s)}return t})),pa=Object.prototype.hasOwnProperty;function Wo(t){return wt(t)?jo(t,!0):function(e){if(!It(e))return function(o){var s=[];if(o!=null)for(var a in Object(o))s.push(a);return s}(e);var n=$e(e),r=[];for(var i in e)(i!="constructor"||!n&&pa.call(e,i))&&r.push(i);return r}(t)}var ma=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ea=/^\w*$/;function ur(t,e){if(B(t))return!1;var n=typeof t;return!(n!="number"&&n!="symbol"&&n!="boolean"&&t!=null&&!Tn(t))||Ea.test(t)||!ma.test(t)||e!=null&&t in Object(e)}var Ie=oe(Object,"create"),ga=Object.prototype.hasOwnProperty,Ta=Object.prototype.hasOwnProperty;function ee(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ge(t,e){for(var n=t.length;n--;)if(Be(t[n][0],e))return n;return-1}ee.prototype.clear=function(){this.__data__=Ie?Ie(null):{},this.size=0},ee.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},ee.prototype.get=function(t){var e=this.__data__;if(Ie){var n=e[t];return n==="__lodash_hash_undefined__"?void 0:n}return ga.call(e,t)?e[t]:void 0},ee.prototype.has=function(t){var e=this.__data__;return Ie?e[t]!==void 0:Ta.call(e,t)},ee.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ie&&e===void 0?"__lodash_hash_undefined__":e,this};var Aa=Array.prototype.splice;function zt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}zt.prototype.clear=function(){this.__data__=[],this.size=0},zt.prototype.delete=function(t){var e=this.__data__,n=Ge(e,t);return!(n<0||(n==e.length-1?e.pop():Aa.call(e,n,1),--this.size,0))},zt.prototype.get=function(t){var e=this.__data__,n=Ge(e,t);return n<0?void 0:e[n][1]},zt.prototype.has=function(t){return Ge(this.__data__,t)>-1},zt.prototype.set=function(t,e){var n=this.__data__,r=Ge(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var we=oe(Pt,"Map");function Ke(t,e){var n,r,i=t.__data__;return((r=typeof(n=e))=="string"||r=="number"||r=="symbol"||r=="boolean"?n!=="__proto__":n===null)?i[typeof e=="string"?"string":"hash"]:i.map}function Wt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Mr(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Mr.Cache||Wt),n}Wt.prototype.clear=function(){this.size=0,this.__data__={hash:new ee,map:new(we||zt),string:new ee}},Wt.prototype.delete=function(t){var e=Ke(this,t).delete(t);return this.size-=e?1:0,e},Wt.prototype.get=function(t){return Ke(this,t).get(t)},Wt.prototype.has=function(t){return Ke(this,t).has(t)},Wt.prototype.set=function(t,e){var n=Ke(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Mr.Cache=Wt;var Fn,Dn,Ia=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Na=/\\(\\)?/g,ya=(Fn=Mr(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Ia,function(n,r,i,o){e.push(i?o.replace(Na,"$1"):r||n)}),e},function(t){return Dn.size===500&&Dn.clear(),t}),Dn=Fn.cache,Fn);function On(t,e){return B(t)?t:ur(t,e)?[t]:ya(function(n){return n==null?"":ko(n)}(t))}function Me(t){if(typeof t=="string"||Tn(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function lr(t,e){for(var n=0,r=(e=On(e,t)).length;t!=null&&n<r;)t=t[Me(e[n++])];return n&&n==r?t:void 0}function Ur(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var ri=At?At.isConcatSpreadable:void 0;function Ra(t){return B(t)||Rn(t)||!!(ri&&t&&t[ri])}function Fr(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=Ra),i||(i=[]);++o<s;){var a=t[o];n(a)?Ur(i,a):r||(i[i.length]=a)}return i}function yt(t){return t!=null&&t.length?Fr(t):[]}var Go=Bo(Object.getPrototypeOf,Object);function Ko(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=t[r+e];return o}function va(t,e,n,r){var i=-1,o=t==null?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function kt(t){var e=this.__data__=new zt(t);this.size=e.size}kt.prototype.clear=function(){this.__data__=new zt,this.size=0},kt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},kt.prototype.get=function(t){return this.__data__.get(t)},kt.prototype.has=function(t){return this.__data__.has(t)},kt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof zt){var r=n.__data__;if(!we||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Wt(r)}return n.set(t,e),this.size=n.size,this};var zo=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ii=zo&&typeof module=="object"&&module&&!module.nodeType&&module,oi=ii&&ii.exports===zo?Pt.Buffer:void 0,si=oi?oi.allocUnsafe:void 0;function Dr(t,e){for(var n=-1,r=t==null?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function Vo(){return[]}var Oa=Object.prototype.propertyIsEnumerable,ai=Object.getOwnPropertySymbols,jr=ai?function(t){return t==null?[]:(t=Object(t),Dr(ai(t),function(e){return Oa.call(t,e)}))}:Vo,Sa=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Ur(e,jr(t)),t=Go(t);return e}:Vo;function Ho(t,e,n){var r=e(t);return B(t)?r:Ur(r,n(t))}function hr(t){return Ho(t,Nt,jr)}var fr=oe(Pt,"DataView"),dr=oe(Pt,"Promise"),he=oe(Pt,"Set"),ci="[object Map]",ui="[object Promise]",li="[object Set]",hi="[object WeakMap]",fi="[object DataView]",_a=ie(fr),La=ie(we),xa=ie(dr),Ca=ie(he),ka=ie(ar),Tt=Zt;(fr&&Tt(new fr(new ArrayBuffer(1)))!=fi||we&&Tt(new we)!=ci||dr&&Tt(dr.resolve())!=ui||he&&Tt(new he)!=li||ar&&Tt(new ar)!=hi)&&(Tt=function(t){var e=Zt(t),n=e=="[object Object]"?t.constructor:void 0,r=n?ie(n):"";if(r)switch(r){case _a:return fi;case La:return ci;case xa:return ui;case Ca:return li;case ka:return hi}return e});var ba=Object.prototype.hasOwnProperty,cn=Pt.Uint8Array,Pa=/\w*$/,di=At?At.prototype:void 0,pi=di?di.valueOf:void 0,mi=Xt&&Xt.isMap,wa=mi?vn(mi):function(t){return vt(t)&&Tt(t)=="[object Map]"},Ei=Xt&&Xt.isSet,Ma=Ei?vn(Ei):function(t){return vt(t)&&Tt(t)=="[object Set]"},Yo="[object Arguments]",Xo="[object Function]",qo="[object Object]",G={};function Qe(t,e,n,r,i,o){var s;if(s!==void 0)return s;if(!It(t))return t;var a,c,u,l=B(t);if(l)return c=(a=t).length,u=new a.constructor(c),c&&typeof a[0]=="string"&&ba.call(a,"index")&&(u.index=a.index,u.input=a.input),function(m,y){var p=-1,T=m.length;for(y||(y=Array(T));++p<T;)y[p]=m[p];return y}(t,s=u);var h=Tt(t),N=h==Xo||h=="[object GeneratorFunction]";if(Pe(t))return function(m){var y=m.length,p=si?si(y):new m.constructor(y);return m.copy(p),p}(t);if(h==qo||h==Yo||N&&!i)return s=N?{}:function(m){return typeof m.constructor!="function"||$e(m)?{}:ta(Go(m))}(t),function(m,y){return cr(m,jr(m),y)}(t,function(m,y){return m&&cr(y,Nt(y),m)}(s,t));if(!G[h])return i?t:{};s=function(m,y){var p,T,g,A,v,f,d,I=m.constructor;switch(y){case"[object ArrayBuffer]":return v=new(A=m).constructor(A.byteLength),new cn(v).set(new cn(A)),v;case"[object Boolean]":case"[object Date]":return new I(+m);case"[object DataView]":return g=(T=m).buffer,new T.constructor(g,T.byteOffset,T.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return d=(f=m).buffer,new f.constructor(d,f.byteOffset,f.length);case"[object Map]":case"[object Set]":return new I;case"[object Number]":case"[object String]":return new I(m);case"[object RegExp]":return function(E){var R=new E.constructor(E.source,Pa.exec(E));return R.lastIndex=E.lastIndex,R}(m);case"[object Symbol]":return p=m,pi?Object(pi.call(p)):{}}}(t,h),o||(o=new kt);var S=o.get(t);if(S)return S;o.set(t,s),Ma(t)?t.forEach(function(m){s.add(Qe(m,e,n,m,t,o))}):wa(t)&&t.forEach(function(m,y){s.set(y,Qe(m,e,n,y,t,o))});var L=l?void 0:hr(t);return bo(L||t,function(m,y){L&&(m=t[y=m]),yn(s,y,Qe(m,e,n,y,t,o))}),s}function et(t){return Qe(t,4)}function Ue(t){for(var e=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i}function fe(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Wt;++e<n;)this.add(t[e])}function Zo(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function Br(t,e){return t.has(e)}function gi(t,e,n,r,i,o){var s=1&n,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=o.get(t),l=o.get(e);if(u&&l)return u==e&&l==t;var h=-1,N=!0,S=2&n?new fe:void 0;for(o.set(t,e),o.set(e,t);++h<a;){var L=t[h],m=e[h];if(r)var y=s?r(m,L,h,e,t,o):r(L,m,h,t,e,o);if(y!==void 0){if(y)continue;N=!1;break}if(S){if(!Zo(e,function(p,T){if(!Br(S,T)&&(L===p||i(L,p,n,r,o)))return S.push(T)})){N=!1;break}}else if(L!==m&&!i(L,m,n,r,o)){N=!1;break}}return o.delete(t),o.delete(e),N}function Ua(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function $r(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}G[Yo]=G["[object Array]"]=G["[object ArrayBuffer]"]=G["[object DataView]"]=G["[object Boolean]"]=G["[object Date]"]=G["[object Float32Array]"]=G["[object Float64Array]"]=G["[object Int8Array]"]=G["[object Int16Array]"]=G["[object Int32Array]"]=G["[object Map]"]=G["[object Number]"]=G[qo]=G["[object RegExp]"]=G["[object Set]"]=G["[object String]"]=G["[object Symbol]"]=G["[object Uint8Array]"]=G["[object Uint8ClampedArray]"]=G["[object Uint16Array]"]=G["[object Uint32Array]"]=!0,G["[object Error]"]=G[Xo]=G["[object WeakMap]"]=!1,fe.prototype.add=fe.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},fe.prototype.has=function(t){return this.__data__.has(t)};var Ti=At?At.prototype:void 0,jn=Ti?Ti.valueOf:void 0,Fa=Object.prototype.hasOwnProperty,Ai="[object Arguments]",Ii="[object Array]",ze="[object Object]",Ni=Object.prototype.hasOwnProperty;function pr(t,e,n,r,i){return t===e||(t==null||e==null||!vt(t)&&!vt(e)?t!=t&&e!=e:function(o,s,a,c,u,l){var h=B(o),N=B(s),S=h?Ii:Tt(o),L=N?Ii:Tt(s),m=(S=S==Ai?ze:S)==ze,y=(L=L==Ai?ze:L)==ze,p=S==L;if(p&&Pe(o)){if(!Pe(s))return!1;h=!0,m=!1}if(p&&!m)return l||(l=new kt),h||wr(o)?gi(o,s,a,c,u,l):function(f,d,I,E,R,U,x){switch(I){case"[object DataView]":if(f.byteLength!=d.byteLength||f.byteOffset!=d.byteOffset)return!1;f=f.buffer,d=d.buffer;case"[object ArrayBuffer]":return!(f.byteLength!=d.byteLength||!U(new cn(f),new cn(d)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Be(+f,+d);case"[object Error]":return f.name==d.name&&f.message==d.message;case"[object RegExp]":case"[object String]":return f==d+"";case"[object Map]":var O=Ua;case"[object Set]":var w=1&E;if(O||(O=$r),f.size!=d.size&&!w)return!1;var C=x.get(f);if(C)return C==d;E|=2,x.set(f,d);var k=gi(O(f),O(d),E,R,U,x);return x.delete(f),k;case"[object Symbol]":if(jn)return jn.call(f)==jn.call(d)}return!1}(o,s,S,a,c,u,l);if(!(1&a)){var T=m&&Ni.call(o,"__wrapped__"),g=y&&Ni.call(s,"__wrapped__");if(T||g){var A=T?o.value():o,v=g?s.value():s;return l||(l=new kt),u(A,v,a,c,l)}}return!!p&&(l||(l=new kt),function(f,d,I,E,R,U){var x=1&I,O=hr(f),w=O.length;if(w!=hr(d).length&&!x)return!1;for(var C=w;C--;){var k=O[C];if(!(x?k in d:Fa.call(d,k)))return!1}var $=U.get(f),X=U.get(d);if($&&X)return $==d&&X==f;var W=!0;U.set(f,d),U.set(d,f);for(var rt=x;++C<w;){var mt=f[k=O[C]],xt=d[k];if(E)var Te=x?E(xt,mt,k,d,f,U):E(mt,xt,k,f,d,U);if(!(Te===void 0?mt===xt||R(mt,xt,I,E,U):Te)){W=!1;break}rt||(rt=k=="constructor")}if(W&&!rt){var nt=f.constructor,Qt=d.constructor;nt==Qt||!("constructor"in f)||!("constructor"in d)||typeof nt=="function"&&nt instanceof nt&&typeof Qt=="function"&&Qt instanceof Qt||(W=!1)}return U.delete(f),U.delete(d),W}(o,s,a,c,u,l))}(t,e,n,r,pr,i))}function yi(t){return t==t&&!It(t)}function Ri(t,e){return function(n){return n!=null&&n[t]===e&&(e!==void 0||t in Object(n))}}function Da(t,e){return t!=null&&e in Object(t)}function Qo(t,e,n){for(var r=-1,i=(e=On(e,t)).length,o=!1;++r<i;){var s=Me(e[r]);if(!(o=t!=null&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=t==null?0:t.length)&&Pr(i)&&Nn(s,i)&&(B(t)||Rn(t))}function bt(t){return typeof t=="function"?t:t==null?de:typeof t=="object"?B(t)?function(e,n){return ur(e)&&yi(n)?Ri(Me(e),n):function(r){var i,o,s=(o=(i=r)==null?void 0:lr(i,e))===void 0?void 0:o;return s===void 0&&s===n?function(a,c){return a!=null&&Qo(a,c,Da)}(r,e):pr(n,s,3)}}(t[0],t[1]):function(e){var n=function(r){for(var i=Nt(r),o=i.length;o--;){var s=i[o],a=r[s];i[o]=[s,a,yi(a)]}return i}(e);return n.length==1&&n[0][2]?Ri(n[0][0],n[0][1]):function(r){return r===e||function(i,o,s){var a=s.length,c=a;if(i==null)return!c;for(i=Object(i);a--;){var u=s[a];if(u[2]?u[1]!==i[u[0]]:!(u[0]in i))return!1}for(;++a<c;){var l=(u=s[a])[0],h=i[l],N=u[1];if(u[2]){if(h===void 0&&!(l in i))return!1}else if(!pr(N,h,3,void 0,new kt))return!1}return!0}(r,0,n)}}(t):function(e){return ur(e)?(n=Me(e),function(r){return r?.[n]}):function(r){return function(i){return lr(i,r)}}(e);var n}(t)}function ja(t,e,n,r){for(var i=-1,o=t==null?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}var vi,se=(vi=function(t,e){return t&&function(n,r,i){for(var o=-1,s=Object(n),a=i(n),c=a.length;c--;){var u=a[++o];if(r(s[u],u,s)===!1)break}return n}(t,e,Nt)},function(t,e){if(t==null)return t;if(!wt(t))return vi(t,e);for(var n=t.length,r=-1,i=Object(t);++r<n&&e(i[r],r,i)!==!1;);return t});function Ba(t,e,n,r){return se(t,function(i,o,s){e(r,i,n(i),s)}),r}var Jo=Object.prototype,$a=Jo.hasOwnProperty,mr=br(function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&Mo(e[0],e[1],i)&&(r=1);++n<r;)for(var o=e[n],s=Wo(o),a=-1,c=s.length;++a<c;){var u=s[a],l=t[u];(l===void 0||Be(l,Jo[u])&&!$a.call(t,u))&&(t[u]=o[u])}return t});function Oi(t){return vt(t)&&wt(t)}var un=br(function(t,e){return Oi(t)?function(n,r){var i=-1,o=wo,s=!0,a=n.length,c=[],u=r.length;if(!a)return c;r.length>=200&&(o=Br,s=!1,r=new fe(r));t:for(;++i<a;){var l=n[i],h=l;if(l=l!==0?l:0,s&&h==h){for(var N=u;N--;)if(r[N]===h)continue t;c.push(l)}else o(r,h,void 0)||c.push(l)}return c}(t,Fr(e,0,Oi,!0)):[]});function pe(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function tt(t,e,n){var r=t==null?0:t.length;return r?Ko(t,(e=e===void 0?1:In(e))<0?0:e,r):[]}function Fe(t,e,n){var r=t==null?0:t.length;return r?Ko(t,0,(e=r-(e=e===void 0?1:In(e)))<0?0:e):[]}function M(t,e){var n;return(B(t)?bo:se)(t,typeof(n=e)=="function"?n:de)}function Wa(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ga(t,e){var n=!0;return se(t,function(r,i,o){return n=!!e(r,i,o)}),n}function Rt(t,e,n){return(B(t)?Wa:Ga)(t,bt(e))}function ts(t,e){var n=[];return se(t,function(r,i,o){e(r,i,o)&&n.push(r)}),n}function Et(t,e){return(B(t)?Dr:ts)(t,bt(e))}var Si,Ka=Math.max,me=(Si=function(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:In(n);return i<0&&(i=Ka(r+i,0)),Po(t,bt(e),i)},function(t,e,n){var r=Object(t);if(!wt(t)){var i=bt(e);t=Nt(t),e=function(s){return i(r[s],s,r)}}var o=Si(t,e,n);return o>-1?r[i?t[o]:o]:void 0});function Ot(t){return t&&t.length?t[0]:void 0}function za(t,e){var n=-1,r=wt(t)?Array(t.length):[];return se(t,function(i,o,s){r[++n]=e(i,o,s)}),r}function b(t,e){return(B(t)?An:za)(t,bt(e))}function gt(t,e){return Fr(b(t,e))}var _i,Va=Object.prototype.hasOwnProperty,Ha=(_i=function(t,e,n){Va.call(t,n)?t[n].push(e):kr(t,n,[e])},function(t,e){return(B(t)?ja:Ba)(t,_i,bt(e),{})}),Ya=Object.prototype.hasOwnProperty;function Xa(t,e){return t!=null&&Ya.call(t,e)}function P(t,e){return t!=null&&Qo(t,e,Xa)}function ut(t){return typeof t=="string"||!B(t)&&vt(t)&&Zt(t)=="[object String]"}function Q(t){return t==null?[]:function(e,n){return An(n,function(r){return e[r]})}(t,Nt(t))}var qa=Math.max;function at(t,e,n,r){t=wt(t)?t:Q(t),n=n?In(n):0;var i=t.length;return n<0&&(n=qa(i+n,0)),ut(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Cr(t,e,n)>-1}function Li(t,e,n){return t!=null&&t.length?Cr(t,e,0):-1}var Za=Object.prototype.hasOwnProperty;function K(t){if(t==null)return!0;if(wt(t)&&(B(t)||typeof t=="string"||typeof t.splice=="function"||Pe(t)||wr(t)||Rn(t)))return!t.length;var e=Tt(t);if(e=="[object Map]"||e=="[object Set]")return!t.size;if($e(t))return!$o(t).length;for(var n in t)if(Za.call(t,n))return!1;return!0}var xi=Xt&&Xt.isRegExp,Gt=xi?vn(xi):function(t){return vt(t)&&Zt(t)=="[object RegExp]"};function Vt(t){return t===void 0}function Qa(t,e,n,r){if(!It(t))return t;for(var i=-1,o=(e=On(e,t)).length,s=o-1,a=t;a!=null&&++i<o;){var c=Me(e[i]),u=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=s){var l=a[c];(u=void 0)==null&&(u=It(l)?l:Nn(e[i+1])?[]:{})}yn(a,c,u),a=a[c]}return t}function St(t,e){if(t==null)return{};var n=An(Ho(t,Wo,Sa),function(r){return[r]});return e=bt(e),function(r,i,o){for(var s=-1,a=i.length,c={};++s<a;){var u=i[s],l=lr(r,u);o(l,u)&&Qa(c,On(u,r),l)}return c}(t,n,function(r,i){return e(r,i[0])})}function Ja(t,e,n,r,i){return i(t,function(o,s,a){n=r?(r=!1,o):e(n,o,s,a)}),n}function ft(t,e,n){var r=B(t)?va:Ja,i=arguments.length<3;return r(t,bt(e),n,i,se)}function Je(t,e){return(B(t)?Dr:ts)(t,function(n){if(typeof n!="function")throw new TypeError("Expected a function");return function(){var r=arguments;switch(r.length){case 0:return!n.call(this);case 1:return!n.call(this,r[0]);case 2:return!n.call(this,r[0],r[1]);case 3:return!n.call(this,r[0],r[1],r[2])}return!n.apply(this,r)}}(bt(e)))}function tc(t,e){var n;return se(t,function(r,i,o){return!(n=e(r,i,o))}),!!n}function es(t,e,n){return(B(t)?Zo:tc)(t,bt(e))}var ec=he&&1/$r(new he([,-0]))[1]==1/0?function(t){return new he(t)}:Z;function Er(t){return t&&t.length?function(e){var n=-1,r=wo,i=e.length,o=!0,s=[],a=s;if(i>=200){var c=ec(e);if(c)return $r(c);o=!1,r=Br,a=new fe}else a=s;t:for(;++n<i;){var u=e[n],l=u;if(u=u!==0?u:0,o&&l==l){for(var h=a.length;h--;)if(a[h]===l)continue t;s.push(u)}else r(a,l,void 0)||(a!==s&&a.push(l),s.push(u))}return s}(t):[]}function gr(t){console&&console.error&&console.error(`Error: ${t}`)}function ns(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function rs(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function is(t){function e(){}e.prototype=t;const n=new e;function r(){return typeof n.bar}return r(),r(),t}function nc(t){return ut((e=t).LABEL)&&e.LABEL!==""?t.LABEL:t.name;var e}class Mt{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),M(this.definition,n=>{n.accept(e)})}}class pt extends Mt{constructor(e){super([]),this.idx=1,dt(this,St(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Ee extends Mt{constructor(e){super(e.definition),this.orgText="",dt(this,St(e,n=>n!==void 0))}}class ht extends Mt{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,dt(this,St(e,n=>n!==void 0))}}class lt extends Mt{constructor(e){super(e.definition),this.idx=1,dt(this,St(e,n=>n!==void 0))}}class Ut extends Mt{constructor(e){super(e.definition),this.idx=1,dt(this,St(e,n=>n!==void 0))}}class Ft extends Mt{constructor(e){super(e.definition),this.idx=1,dt(this,St(e,n=>n!==void 0))}}class J extends Mt{constructor(e){super(e.definition),this.idx=1,dt(this,St(e,n=>n!==void 0))}}class _t extends Mt{constructor(e){super(e.definition),this.idx=1,dt(this,St(e,n=>n!==void 0))}}class Lt extends Mt{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,dt(this,St(e,n=>n!==void 0))}}class V{constructor(e){this.idx=1,dt(this,St(e,n=>n!==void 0))}accept(e){e.visit(this)}}function tn(t){function e(n){return b(n,tn)}if(t instanceof pt){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return ut(t.label)&&(n.label=t.label),n}if(t instanceof ht)return{type:"Alternative",definition:e(t.definition)};if(t instanceof lt)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Ut)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof Ft)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:tn(new V({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof _t)return{type:"RepetitionWithSeparator",idx:t.idx,separator:tn(new V({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof J)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof Lt)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof V){const n={type:"Terminal",name:t.terminalType.name,label:nc(t.terminalType),idx:t.idx};ut(t.label)&&(n.terminalLabel=t.label);const r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=Gt(r)?r.source:r),n}if(t instanceof Ee)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}class ge{visit(e){const n=e;switch(n.constructor){case pt:return this.visitNonTerminal(n);case ht:return this.visitAlternative(n);case lt:return this.visitOption(n);case Ut:return this.visitRepetitionMandatory(n);case Ft:return this.visitRepetitionMandatoryWithSeparator(n);case _t:return this.visitRepetitionWithSeparator(n);case J:return this.visitRepetition(n);case Lt:return this.visitAlternation(n);case V:return this.visitTerminal(n);case Ee:return this.visitRule(n);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 ln(t,e=[]){return t instanceof lt||t instanceof J||t instanceof _t||(t instanceof Lt?es(t.definition,n=>ln(n,e)):!(t instanceof pt&&at(e,t))&&t instanceof Mt&&(t instanceof pt&&e.push(t),Rt(t.definition,n=>ln(n,e))))}function Ct(t){if(t instanceof pt)return"SUBRULE";if(t instanceof lt)return"OPTION";if(t instanceof Lt)return"OR";if(t instanceof Ut)return"AT_LEAST_ONE";if(t instanceof Ft)return"AT_LEAST_ONE_SEP";if(t instanceof _t)return"MANY_SEP";if(t instanceof J)return"MANY";if(t instanceof V)return"CONSUME";throw Error("non exhaustive match")}class Sn{walk(e,n=[]){M(e.definition,(r,i)=>{const o=tt(e.definition,i+1);if(r instanceof pt)this.walkProdRef(r,o,n);else if(r instanceof V)this.walkTerminal(r,o,n);else if(r instanceof ht)this.walkFlat(r,o,n);else if(r instanceof lt)this.walkOption(r,o,n);else if(r instanceof Ut)this.walkAtLeastOne(r,o,n);else if(r instanceof Ft)this.walkAtLeastOneSep(r,o,n);else if(r instanceof _t)this.walkManySep(r,o,n);else if(r instanceof J)this.walkMany(r,o,n);else{if(!(r instanceof Lt))throw Error("non exhaustive match");this.walkOr(r,o,n)}})}walkTerminal(e,n,r){}walkProdRef(e,n,r){}walkFlat(e,n,r){const i=n.concat(r);this.walk(e,i)}walkOption(e,n,r){const i=n.concat(r);this.walk(e,i)}walkAtLeastOne(e,n,r){const i=[new lt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){const i=Ci(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new lt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=Ci(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);M(e.definition,o=>{const s=new ht({definition:[o]});this.walk(s,i)})}}function Ci(t,e,n){return[new lt({definition:[new V({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function xe(t){if(t instanceof pt)return xe(t.referencedRule);if(t instanceof V)return[t.terminalType];if(function(e){return e instanceof ht||e instanceof lt||e instanceof J||e instanceof Ut||e instanceof Ft||e instanceof _t||e instanceof V||e instanceof Ee}(t))return function(e){let n=[];const r=e.definition;let i,o=0,s=r.length>o,a=!0;for(;s&&a;)i=r[o],a=ln(i),n=n.concat(xe(i)),o+=1,s=r.length>o;return Er(n)}(t);if(function(e){return e instanceof Lt}(t))return function(e){return Er(yt(b(e.definition,n=>xe(n))))}(t);throw Error("non exhaustive match")}const os="_~IN~_";class rc extends Sn{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,n,r){}walkProdRef(e,n,r){const i=(o=e.referencedRule,s=e.idx,o.name+s+os+this.topProd.name);var o,s;const a=n.concat(r),c=xe(new ht({definition:a}));this.follows[i]=c}}function F(t){return t.charCodeAt(0)}function Bn(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function Ne(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function ae(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function ki(t){return t.type==="Character"}const hn=[];for(let t=F("0");t<=F("9");t++)hn.push(t);const fn=[F("_")].concat(hn);for(let t=F("a");t<=F("z");t++)fn.push(t);for(let t=F("A");t<=F("Z");t++)fn.push(t);const bi=[F(" "),F("\f"),F(`
|
|
7
7
|
`),F("\r"),F(" "),F("\v"),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F("\u2028"),F("\u2029"),F(" "),F(" "),F(" "),F("\uFEFF")],ic=/[0-9a-fA-F]/,Ve=/[0-9]/,oc=/[1-9]/;class Tr{visitChildren(e){for(const n in e){const r=e[n];e.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}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"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){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}let en={};const sc=new class{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(t){this.idx=t.idx,this.input=t.input,this.groupIdx=t.groupIdx}pattern(t){this.idx=0,this.input=t,this.groupIdx=0,this.consumeChar("/");const e=this.disjunction();this.consumeChar("/");const n={type:"Flags",loc:{begin:this.idx,end:t.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Ne(n,"global");break;case"i":Ne(n,"ignoreCase");break;case"m":Ne(n,"multiLine");break;case"u":Ne(n,"unicode");break;case"y":Ne(n,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:e,loc:this.loc(0)}}disjunction(){const t=[],e=this.idx;for(t.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),t.push(this.alternative());return{type:"Disjunction",value:t,loc:this.loc(e)}}alternative(){const t=[],e=this.idx;for(;this.isTerm();)t.push(this.term());return{type:"Alternative",value:t,loc:this.loc(e)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const t=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(t)};case"$":return{type:"EndAnchor",loc:this.loc(t)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(t)};case"B":return{type:"NonWordBoundary",loc:this.loc(t)}}throw Error("Invalid Assertion Escape");case"(":let e;switch(this.consumeChar("?"),this.popChar()){case"=":e="Lookahead";break;case"!":e="NegativeLookahead"}ae(e);const n=this.disjunction();return this.consumeChar(")"),{type:e,value:n,loc:this.loc(t)}}return function(){throw Error("Internal Error - Should never get here!")}()}quantifier(t=!1){let e;const n=this.idx;switch(this.popChar()){case"*":e={atLeast:0,atMost:1/0};break;case"+":e={atLeast:1,atMost:1/0};break;case"?":e={atLeast:0,atMost:1};break;case"{":const r=this.integerIncludingZero();switch(this.popChar()){case"}":e={atLeast:r,atMost:r};break;case",":let i;this.isDigit()?(i=this.integerIncludingZero(),e={atLeast:r,atMost:i}):e={atLeast:r,atMost:1/0},this.consumeChar("}")}if(t===!0&&e===void 0)return;ae(e)}if(t!==!0||e!==void 0)return ae(e)?(this.peekChar(0)==="?"?(this.consumeChar("?"),e.greedy=!1):e.greedy=!0,e.type="Quantifier",e.loc=this.loc(n),e):void 0}atom(){let t;const e=this.idx;switch(this.peekChar()){case".":t=this.dotAll();break;case"\\":t=this.atomEscape();break;case"[":t=this.characterClass();break;case"(":t=this.group()}if(t===void 0&&this.isPatternCharacter()&&(t=this.patternCharacter()),ae(t))return t.loc=this.loc(e),this.isQuantifier()&&(t.quantifier=this.quantifier()),t}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[F(`
|
|
8
8
|
`),F("\r"),F("\u2028"),F("\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 t,e=!1;switch(this.popChar()){case"d":t=hn;break;case"D":t=hn,e=!0;break;case"s":t=bi;break;case"S":t=bi,e=!0;break;case"w":t=fn;break;case"W":t=fn,e=!0}if(ae(t))return{type:"Set",value:t,complement:e}}controlEscapeAtom(){let t;switch(this.popChar()){case"f":t=F("\f");break;case"n":t=F(`
|
|
9
9
|
`);break;case"r":t=F("\r");break;case"t":t=F(" ");break;case"v":t=F("\v")}if(ae(t))return{type:"Character",value:t}}controlLetterEscapeAtom(){this.consumeChar("c");const t=this.popChar();if(/[a-zA-Z]/.test(t)===!1)throw Error("Invalid ");return{type:"Character",value:t.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:F("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:F(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),gr(`${pn}
|
|
21
21
|
Failed parsing: < ${t.toString()} >
|
|
22
22
|
Using the @chevrotain/regexp-to-ast library
|
|
23
|
-
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function Ar(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)Ar(t.value[i],e,n);break;case"Alternative":const r=t.value;for(let i=0;i<r.length;i++){const o=r[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const s=o;switch(s.type){case"Character":He(s.value,e,n);break;case"Set":if(s.complement===!0)throw Error(ss);M(s.value,c=>{if(typeof c=="number")He(c,e,n);else{const u=c;if(n===!0)for(let l=u.from;l<=u.to;l++)He(l,e,n);else{for(let l=u.from;l<=u.to&&l<Oe;l++)He(l,e,n);if(u.to>=Oe){const l=u.from>=Oe?u.from:Oe,h=u.to,N=Yt(l),S=Yt(h);for(let L=N;L<=S;L++)e[L]=L}}}});break;case"Group":Ar(s.value,e,n);break;default:throw Error("Non Exhaustive Match")}const a=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&Ir(s)===!1||s.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return
|
|
23
|
+
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function Ar(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)Ar(t.value[i],e,n);break;case"Alternative":const r=t.value;for(let i=0;i<r.length;i++){const o=r[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const s=o;switch(s.type){case"Character":He(s.value,e,n);break;case"Set":if(s.complement===!0)throw Error(ss);M(s.value,c=>{if(typeof c=="number")He(c,e,n);else{const u=c;if(n===!0)for(let l=u.from;l<=u.to;l++)He(l,e,n);else{for(let l=u.from;l<=u.to&&l<Oe;l++)He(l,e,n);if(u.to>=Oe){const l=u.from>=Oe?u.from:Oe,h=u.to,N=Yt(l),S=Yt(h);for(let L=N;L<=S;L++)e[L]=L}}}});break;case"Group":Ar(s.value,e,n);break;default:throw Error("Non Exhaustive Match")}const a=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&Ir(s)===!1||s.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return Q(e)}function He(t,e,n){const r=Yt(t);e[r]=r,n===!0&&function(i,o){const s=String.fromCharCode(i),a=s.toUpperCase();if(a!==s){const c=Yt(a.charCodeAt(0));o[c]=c}else{const c=s.toLowerCase();if(c!==s){const u=Yt(c.charCodeAt(0));o[u]=u}}}(t,e)}function Pi(t,e){return me(t.value,n=>{if(typeof n=="number")return at(e,n);{const r=n;return me(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function Ir(t){const e=t.quantifier;return!(!e||e.atLeast!==0)||!!t.value&&(B(t.value)?Rt(t.value,Ir):Ir(t.value))}class cc extends Tr{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":return void this.visitLookahead(e);case"NegativeLookahead":return void this.visitNegativeLookahead(e)}super.visitChildren(e)}}visitCharacter(e){at(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Pi(e,this.targetCharCodes)===void 0&&(this.found=!0):Pi(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function Nr(t,e){if(e instanceof RegExp){const n=dn(e),r=new cc(t);return r.visit(n),r.found}return me(e,n=>at(t,n.charCodeAt(0)))!==void 0}const te="PATTERN",ye="defaultMode",$n="modes";let wi=typeof new RegExp("(?:)").sticky=="boolean";const uc=/[^\\][$]/,lc=/[^\\[][\^]|^\^/;function Mi(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function Ui(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function as(t){const e=t.PATTERN;if(Gt(e))return!1;if(Ht(e)||P(e,"exec"))return!0;if(ut(e))return!1;throw Error("non exhaustive match")}function hc(t){return!(!ut(t)||t.length!==1)&&t.charCodeAt(0)}const fc={test:function(t){const e=t.length;for(let n=this.lastIndex;n<e;n++){const r=t.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return t.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function Fi(t,e){if(P(t,"LINE_BREAKS"))return!1;if(Gt(t.PATTERN)){try{Nr(e,t.PATTERN)}catch(n){return{issue:H.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}if(ut(t.PATTERN))return!1;if(as(t))return{issue:H.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function Di(t){return b(t,e=>ut(e)?e.charCodeAt(0):e)}function Wn(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const Oe=256;let nn=[];function Yt(t){return t<Oe?t:nn[t]}function Ce(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx||e.isParent===!0&&e.categoryMatchesMap[n]===!0}function mn(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let ji=1;const Bi={};function We(t){const e=function(n){let r=et(n),i=n,o=!0;for(;o;){i=Ue(yt(b(i,a=>a.CATEGORIES)));const s=un(i,r);r=r.concat(s),K(s)?o=!1:i=s}return r}(t);(function(n){M(n,r=>{us(r)||(Bi[ji]=r,r.tokenTypeIdx=ji++),$i(r)&&!B(r.CATEGORIES)&&(r.CATEGORIES=[r.CATEGORIES]),$i(r)||(r.CATEGORIES=[]),P(r,"categoryMatches")||(r.categoryMatches=[]),P(r,"categoryMatchesMap")||(r.categoryMatchesMap={})})})(e),function(n){M(n,r=>{cs([],r)})}(e),function(n){M(n,r=>{r.categoryMatches=[],M(r.categoryMatchesMap,(i,o)=>{r.categoryMatches.push(Bi[o].tokenTypeIdx)})})}(e),M(e,n=>{n.isParent=n.categoryMatches.length>0})}function cs(t,e){M(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),M(e.CATEGORIES,n=>{const r=t.concat(e);at(r,n)||cs(r,n)})}function us(t){return P(t,"tokenTypeIdx")}function $i(t){return P(t,"CATEGORIES")}function dc(t){return P(t,"tokenTypeIdx")}var H,j;(j=H||(H={}))[j.MISSING_PATTERN=0]="MISSING_PATTERN",j[j.INVALID_PATTERN=1]="INVALID_PATTERN",j[j.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",j[j.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",j[j.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",j[j.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",j[j.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",j[j.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",j[j.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",j[j.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",j[j.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",j[j.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",j[j.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",j[j.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",j[j.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",j[j.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",j[j.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",j[j.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";const Se={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
24
24
|
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:{buildUnableToPopLexerModeMessage:t=>`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(t,e,n,r,i)=>`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`},traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Se);class ot{constructor(e,n=Se){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,o)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const s=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${i}>`);const{time:a,value:c}=rs(o),u=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&u(`${s}<-- <${i}> time: ${a}ms`),this.traceInitIndent--,c}return o()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
25
25
|
a boolean 2nd argument is no longer supported`);this.config=dt({},Se,n);const r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,o=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Se.lineTerminatorsPattern)this.config.lineTerminatorsPattern=fc;else if(this.config.lineTerminatorCharacters===Se.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
26
26
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.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),B(e)?i={modes:{defaultMode:et(e)},defaultMode:ye}:(o=!1,i=et(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(a){const c=[];return P(a,ye)||c.push({message:"A MultiMode Lexer cannot be initialized without a <"+ye+`> property in its definition
|
|
@@ -28,7 +28,7 @@ a boolean 2nd argument is no longer supported`);this.config=dt({},Se,n);const r=
|
|
|
28
28
|
`,type:H.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),P(a,$n)&&P(a,ye)&&!P(a.modes,a.defaultMode)&&c.push({message:`A MultiMode Lexer cannot be initialized with a ${ye}: <${a.defaultMode}>which does not exist
|
|
29
29
|
`,type:H.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),P(a,$n)&&M(a.modes,(u,l)=>{M(u,(h,N)=>{Vt(h)?c.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${l}> at index: <${N}>
|
|
30
30
|
`,type:H.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):P(h,"LONGER_ALT")&&M(B(h.LONGER_ALT)?h.LONGER_ALT:[h.LONGER_ALT],S=>{Vt(S)||at(u,S)||c.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${S.name}> on token <${h.name}> outside of mode <${l}>
|
|
31
|
-
`,type:H.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),c}(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(function(a,c,u){const l=[];let h=!1;const N=Je(Ue(yt(
|
|
31
|
+
`,type:H.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),c}(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(function(a,c,u){const l=[];let h=!1;const N=Je(Ue(yt(Q(a.modes))),L=>L[te]===ot.NA),S=Di(u);return c&&M(N,L=>{const m=Fi(L,S);if(m!==!1){const y={message:function(p,T){if(T.issue===H.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
32
32
|
The problem is in the <${p.name}> Token Type
|
|
33
33
|
Root cause: ${T.errMsg}.
|
|
34
34
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(T.issue===H.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
@@ -51,11 +51,11 @@ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;y.
|
|
|
51
51
|
This will disable the lexer's first char optimizations.
|
|
52
52
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),R=!1;return x},[])}),{emptyGroups:d,patternIdxToConfig:I,charCodeToPatternIdxToConfig:U,hasCustom:E,canBeOptimized:R}}(a,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=u.charCodeToPatternIdxToConfig,this.emptyGroups=dt({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!K(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const a=b(this.lexerDefinitionErrors,c=>c.message).join(`-----------------------
|
|
53
53
|
`);throw new Error(`Errors detected in definition of Lexer:
|
|
54
|
-
`+a)}M(this.lexerDefinitionWarning,a=>{ns(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(wi?(this.chopInput=de,this.match=this.matchWithTest):(this.updateLastIndex=
|
|
54
|
+
`+a)}M(this.lexerDefinitionWarning,a=>{ns(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(wi?(this.chopInput=de,this.match=this.matchWithTest):(this.updateLastIndex=Z,this.match=this.matchWithExec),o&&(this.handleModes=Z),this.trackStartLines===!1&&(this.computeNewColumn=de),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Z),/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",()=>{const a=ft(this.canModeBeOptimized,(c,u,l)=>(u===!1&&c.push(l),c),[]);if(n.ensureOptimizations&&!K(a))throw Error(`Lexer Modes: < ${a.join(", ")} > cannot be optimized.
|
|
55
55
|
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
56
56
|
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{en={}}),this.TRACE_INIT("toFastProperties",()=>{is(this)})})}tokenize(e,n=this.defaultMode){if(!K(this.lexerDefinitionErrors)){const r=b(this.lexerDefinitionErrors,i=>i.message).join(`-----------------------
|
|
57
57
|
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
58
|
-
`+r)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,o,s,a,c,u,l,h,N,S,L,m,y,p;const T=e,g=T.length;let A=0,v=0;const f=this.hasCustom?0:Math.floor(e.length/10),d=new Array(f),I=[];let E=this.trackStartLines?1:void 0,R=this.trackStartLines?1:void 0;const U=function(q){const it={};return M(Nt(q),Dt=>{const ct=q[Dt];if(!B(ct))throw Error("non exhaustive match");it[Dt]=[]}),it}(this.emptyGroups),x=this.trackStartLines,O=this.config.lineTerminatorsPattern;let w=0,C=[],k=[];const $=[],X=[];let W;function rt(){return C}function mt(q){const it=Yt(q),Dt=k[it];return Dt===void 0?X:Dt}Object.freeze(X);const xt=q=>{if($.length===1&&q.tokenType.PUSH_MODE===void 0){const it=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(q);I.push({offset:q.startOffset,line:q.startLine,column:q.startColumn,length:q.image.length,message:it})}else{$.pop();const it=pe($);C=this.patternIdxToConfig[it],k=this.charCodeToPatternIdxToConfig[it],w=C.length;const Dt=this.canModeBeOptimized[it]&&this.config.safeMode===!1;W=k&&Dt?mt:rt}};function Te(q){$.push(q),k=this.charCodeToPatternIdxToConfig[q],C=this.patternIdxToConfig[q],w=C.length,w=C.length;const it=this.canModeBeOptimized[q]&&this.config.safeMode===!1;W=k&&it?mt:rt}let nt;Te.call(this,n);const
|
|
58
|
+
`+r)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,o,s,a,c,u,l,h,N,S,L,m,y,p;const T=e,g=T.length;let A=0,v=0;const f=this.hasCustom?0:Math.floor(e.length/10),d=new Array(f),I=[];let E=this.trackStartLines?1:void 0,R=this.trackStartLines?1:void 0;const U=function(q){const it={};return M(Nt(q),Dt=>{const ct=q[Dt];if(!B(ct))throw Error("non exhaustive match");it[Dt]=[]}),it}(this.emptyGroups),x=this.trackStartLines,O=this.config.lineTerminatorsPattern;let w=0,C=[],k=[];const $=[],X=[];let W;function rt(){return C}function mt(q){const it=Yt(q),Dt=k[it];return Dt===void 0?X:Dt}Object.freeze(X);const xt=q=>{if($.length===1&&q.tokenType.PUSH_MODE===void 0){const it=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(q);I.push({offset:q.startOffset,line:q.startLine,column:q.startColumn,length:q.image.length,message:it})}else{$.pop();const it=pe($);C=this.patternIdxToConfig[it],k=this.charCodeToPatternIdxToConfig[it],w=C.length;const Dt=this.canModeBeOptimized[it]&&this.config.safeMode===!1;W=k&&Dt?mt:rt}};function Te(q){$.push(q),k=this.charCodeToPatternIdxToConfig[q],C=this.patternIdxToConfig[q],w=C.length,w=C.length;const it=this.canModeBeOptimized[q]&&this.config.safeMode===!1;W=k&&it?mt:rt}let nt;Te.call(this,n);const Qt=this.config.recoveryEnabled;for(;A<g;){c=null;const q=T.charCodeAt(A),it=W(q),Dt=it.length;for(r=0;r<Dt;r++){nt=it[r];const ct=nt.pattern;u=null;const jt=nt.short;if(jt!==!1?q===jt&&(c=ct):nt.isCustom===!0?(p=ct.exec(T,A,d,U),p!==null?(c=p[0],p.payload!==void 0&&(u=p.payload)):c=null):(this.updateLastIndex(ct,A),c=this.match(ct,e,A)),c!==null){if(a=nt.longerAlt,a!==void 0){const Bt=a.length;for(o=0;o<Bt;o++){const $t=C[a[o]],Jt=$t.pattern;if(l=null,$t.isCustom===!0?(p=Jt.exec(T,A,d,U),p!==null?(s=p[0],p.payload!==void 0&&(l=p.payload)):s=null):(this.updateLastIndex(Jt,A),s=this.match(Jt,e,A)),s&&s.length>c.length){c=s,u=l,nt=$t;break}}}break}}if(c!==null){if(h=c.length,N=nt.group,N!==void 0&&(S=nt.tokenTypeIdx,L=this.createTokenInstance(c,A,S,nt.tokenType,E,R,h),this.handlePayload(L,u),N===!1?v=this.addToken(d,v,L):U[N].push(L)),e=this.chopInput(e,h),A+=h,R=this.computeNewColumn(R,h),x===!0&&nt.canLineTerminator===!0){let ct,jt,Bt=0;O.lastIndex=0;do ct=O.test(c),ct===!0&&(jt=O.lastIndex-1,Bt++);while(ct===!0);Bt!==0&&(E+=Bt,R=h-jt,this.updateTokenEndLineColumnLocation(L,N,jt,Bt,E,R,h))}this.handleModes(nt,xt,Te,L)}else{const ct=A,jt=E,Bt=R;let $t=Qt===!1;for(;$t===!1&&A<g;)for(e=this.chopInput(e,1),A++,i=0;i<w;i++){const Jt=C[i],kn=Jt.pattern,Kr=Jt.short;if(Kr!==!1?T.charCodeAt(A)===Kr&&($t=!0):Jt.isCustom===!0?$t=kn.exec(T,A,d,U)!==null:(this.updateLastIndex(kn,A),$t=kn.exec(e)!==null),$t===!0)break}if(m=A-ct,R=this.computeNewColumn(R,m),y=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(T,ct,m,jt,Bt),I.push({offset:ct,line:jt,column:Bt,length:m,message:y}),Qt===!1)break}}return this.hasCustom||(d.length=v),{tokens:d,groups:U,errors:I}}handleModes(e,n,r,i){if(e.pop===!0){const o=e.push;n(i),o!==void 0&&r.call(this,o)}else e.push!==void 0&&r.call(this,e.push)}chopInput(e,n){return e.substring(n)}updateLastIndex(e,n){e.lastIndex=n}updateTokenEndLineColumnLocation(e,n,r,i,o,s,a){let c,u;n!==void 0&&(c=r===a-1,u=c?-1:0,i===1&&c===!0||(e.endLine=o+u,e.endColumn=s-1-u))}computeNewColumn(e,n){return e+n}createOffsetOnlyToken(e,n,r,i){return{image:e,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,n,r,i,o,s){return{image:e,startOffset:n,startLine:o,startColumn:s,tokenTypeIdx:r,tokenType:i}}createFullToken(e,n,r,i,o,s,a){return{image:e,startOffset:n,endOffset:n+a-1,startLine:o,endLine:o,startColumn:s,endColumn:s+a-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,n,r){return e.push(r),n}addTokenUsingMemberAccess(e,n,r){return e[n]=r,++n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}matchWithTest(e,n,r){return e.test(n)===!0?n.substring(r,e.lastIndex):null}matchWithExec(e,n){const r=e.exec(n);return r!==null?r[0]:null}}function ke(t){return ls(t)?t.LABEL:t.name}function ls(t){return ut(t.LABEL)&&t.LABEL!==""}ot.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",ot.NA=/NOT_APPLICABLE/;const Wi="categories",Gi="label",Ki="group",zi="push_mode",Vi="pop_mode",Hi="longer_alt",Yi="line_breaks",Xi="start_chars_hint";function D(t){return function(e){const n=e.pattern,r={};if(r.name=e.name,Vt(n)||(r.PATTERN=n),P(e,"parent"))throw`The parent property is no longer supported.
|
|
59
59
|
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return P(e,Wi)&&(r.CATEGORIES=e[Wi]),We([r]),P(e,Gi)&&(r.LABEL=e[Gi]),P(e,Ki)&&(r.GROUP=e[Ki]),P(e,Vi)&&(r.POP_MODE=e[Vi]),P(e,zi)&&(r.PUSH_MODE=e[zi]),P(e,Hi)&&(r.LONGER_ALT=e[Hi]),P(e,Yi)&&(r.LINE_BREAKS=e[Yi]),P(e,Xi)&&(r.START_CHARS_HINT=e[Xi]),r}(t)}const ne=D({name:"EOF",pattern:ot.NA});function Wr(t,e,n,r,i,o,s,a){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:o,startColumn:s,endColumn:a,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}We([ne]);const hs={buildMismatchTokenMessage:({expected:t,actual:e,previous:n,ruleName:r})=>`Expecting ${ls(t)?`--> ${ke(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`,buildNotAllInputParsedMessage:({firstRedundant:t,ruleName:e})=>"Redundant input, expecting EOF but found: "+t.image,buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:n,customUserDescription:r,ruleName:i}){const o="Expecting: ",s=`
|
|
60
60
|
but found: '`+Ot(e).image+"'";if(r)return o+r+s;{const a=b(ft(t,(c,u)=>c.concat(u),[]),c=>`[${b(c,u=>ke(u)).join(", ")}]`);return o+`one of these possible Token sequences:
|
|
61
61
|
${b(a,(c,u)=>` ${u+1}. ${c}`).join(`
|
|
@@ -86,16 +86,16 @@ rule: <${e}> can be invoked from itself (directly or indirectly)
|
|
|
86
86
|
without consuming any Tokens. The grammar path that causes this is:
|
|
87
87
|
${e} --> ${b(t.leftRecursionPath,n=>n.name).concat([e]).join(" --> ")}
|
|
88
88
|
To fix this refactor your grammar to remove the left recursion.
|
|
89
|
-
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:t=>"deprecated",buildDuplicateRuleNameError(t){let e;return e=t.topLevelRule instanceof Ee?t.topLevelRule.name:t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};class mc extends ge{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){M(Z(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:st.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Ec extends Sn{constructor(e,n){super(),this.topProd=e,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=et(this.path.ruleStack).reverse(),this.occurrenceStack=et(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,n=[]){this.found||super.walk(e,n)}walkProdRef(e,n,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){K(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class gc extends Ec{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),o=new ht({definition:i});this.possibleTokTypes=xe(o),this.found=!0}}}class _n extends Sn{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Tc extends _n{walkMany(e,n,r){if(e.idx===this.occurrence){const i=Ot(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof V&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class qi extends _n{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=Ot(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof V&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class Ac extends _n{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=Ot(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof V&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class Qi extends _n{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=Ot(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof V&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function yr(t,e,n=[]){n=et(n);let r=[],i=0;function o(s){const a=yr(s.concat(tt(t,i+1)),e,n);return r.concat(a)}for(;n.length<e&&i<t.length;){const s=t[i];if(s instanceof ht||s instanceof pt)return o(s.definition);if(s instanceof lt)r=o(s.definition);else{if(s instanceof Ut)return o(s.definition.concat([new J({definition:s.definition})]));if(s instanceof Ft)return o([new ht({definition:s.definition}),new J({definition:[new V({terminalType:s.separator})].concat(s.definition)})]);if(s instanceof _t){const a=s.definition.concat([new J({definition:[new V({terminalType:s.separator})].concat(s.definition)})]);r=o(a)}else if(s instanceof J){const a=s.definition.concat([new J({definition:s.definition})]);r=o(a)}else{if(s instanceof Lt)return M(s.definition,a=>{K(a.definition)===!1&&(r=o(a.definition))}),r;if(!(s instanceof V))throw Error("non exhaustive match");n.push(s.terminalType)}}i++}return r.push({partialPath:n,suffixDef:tt(t,i)}),r}function fs(t,e,n,r){const i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE";let a=!1;const c=e.length,u=c-r-1,l=[],h=[];for(h.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!K(h);){const N=h.pop();if(N===s){a&&pe(h).idx<=u&&h.pop();continue}const S=N.def,L=N.idx,m=N.ruleStack,y=N.occurrenceStack;if(K(S))continue;const p=S[0];if(p===i){const T={idx:L,def:tt(S),ruleStack:Fe(m),occurrenceStack:Fe(y)};h.push(T)}else if(p instanceof V)if(L<c-1){const T=L+1;if(n(e[T],p.terminalType)){const g={idx:T,def:tt(S),ruleStack:m,occurrenceStack:y};h.push(g)}}else{if(L!==c-1)throw Error("non exhaustive match");l.push({nextTokenType:p.terminalType,nextTokenOccurrence:p.idx,ruleStack:m,occurrenceStack:y}),a=!0}else if(p instanceof pt){const T=et(m);T.push(p.nonTerminalName);const g=et(y);g.push(p.idx);const A={idx:L,def:p.definition.concat(o,tt(S)),ruleStack:T,occurrenceStack:g};h.push(A)}else if(p instanceof lt){const T={idx:L,def:tt(S),ruleStack:m,occurrenceStack:y};h.push(T),h.push(s);const g={idx:L,def:p.definition.concat(tt(S)),ruleStack:m,occurrenceStack:y};h.push(g)}else if(p instanceof Ut){const T=new J({definition:p.definition,idx:p.idx}),g={idx:L,def:p.definition.concat([T],tt(S)),ruleStack:m,occurrenceStack:y};h.push(g)}else if(p instanceof Ft){const T=new V({terminalType:p.separator}),g=new J({definition:[T].concat(p.definition),idx:p.idx}),A={idx:L,def:p.definition.concat([g],tt(S)),ruleStack:m,occurrenceStack:y};h.push(A)}else if(p instanceof _t){const T={idx:L,def:tt(S),ruleStack:m,occurrenceStack:y};h.push(T),h.push(s);const g=new V({terminalType:p.separator}),A=new J({definition:[g].concat(p.definition),idx:p.idx}),v={idx:L,def:p.definition.concat([A],tt(S)),ruleStack:m,occurrenceStack:y};h.push(v)}else if(p instanceof J){const T={idx:L,def:tt(S),ruleStack:m,occurrenceStack:y};h.push(T),h.push(s);const g=new J({definition:p.definition,idx:p.idx}),A={idx:L,def:p.definition.concat([g],tt(S)),ruleStack:m,occurrenceStack:y};h.push(A)}else if(p instanceof Lt)for(let T=p.definition.length-1;T>=0;T--){const g={idx:L,def:p.definition[T].definition.concat(tt(S)),ruleStack:m,occurrenceStack:y};h.push(g),h.push(s)}else if(p instanceof ht)h.push({idx:L,def:p.definition.concat(tt(S)),ruleStack:m,occurrenceStack:y});else{if(!(p instanceof Ee))throw Error("non exhaustive match");h.push(Ic(p,L,m,y))}}return l}function Ic(t,e,n,r){const i=et(n);i.push(t.name);const o=et(r);return o.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:o}}var Y;function Zi(t){if(t instanceof lt||t==="Option")return Y.OPTION;if(t instanceof J||t==="Repetition")return Y.REPETITION;if(t instanceof Ut||t==="RepetitionMandatory")return Y.REPETITION_MANDATORY;if(t instanceof Ft||t==="RepetitionMandatoryWithSeparator")return Y.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof _t||t==="RepetitionWithSeparator")return Y.REPETITION_WITH_SEPARATOR;if(t instanceof Lt||t==="Alternation")return Y.ALTERNATION;throw Error("non exhaustive match")}function Nc(t,e,n,r){const i=t.length,o=Rt(t,s=>Rt(s,a=>a.length===1));if(e)return function(s){const a=b(s,c=>c.GATE);for(let c=0;c<i;c++){const u=t[c],l=u.length,h=a[c];if(h===void 0||h.call(this)!==!1)t:for(let N=0;N<l;N++){const S=u[N],L=S.length;for(let m=0;m<L;m++){const y=this.LA(m+1);if(n(y,S[m])===!1)continue t}return c}}};if(o&&!r){const s=ft(b(t,a=>yt(a)),(a,c,u)=>(M(c,l=>{P(a,l.tokenTypeIdx)||(a[l.tokenTypeIdx]=u),M(l.categoryMatches,h=>{P(a,h)||(a[h]=u)})}),a),{});return function(){const a=this.LA(1);return s[a.tokenTypeIdx]}}return function(){for(let s=0;s<i;s++){const a=t[s],c=a.length;t:for(let u=0;u<c;u++){const l=a[u],h=l.length;for(let N=0;N<h;N++){const S=this.LA(N+1);if(n(S,l[N])===!1)continue t}return s}}}}function yc(t,e,n){const r=Rt(t,o=>o.length===1),i=t.length;if(r&&!n){const o=yt(t);if(o.length===1&&K(o[0].categoryMatches)){const s=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}{const s=ft(o,(a,c,u)=>(a[c.tokenTypeIdx]=!0,M(c.categoryMatches,l=>{a[l]=!0}),a),[]);return function(){const a=this.LA(1);return s[a.tokenTypeIdx]===!0}}}return function(){t:for(let o=0;o<i;o++){const s=t[o],a=s.length;for(let c=0;c<a;c++){const u=this.LA(c+1);if(e(u,s[c])===!1)continue t}return!0}return!1}}(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(Y||(Y={}));class Rc extends Sn{constructor(e,n,r){super(),this.topProd=e,this.targetOccurrence=n,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,n,r,i){return e.idx===this.targetOccurrence&&this.targetProdType===n&&(this.restDef=r.concat(i),!0)}walkOption(e,n,r){this.checkIsTarget(e,Y.OPTION,n,r)||super.walkOption(e,n,r)}walkAtLeastOne(e,n,r){this.checkIsTarget(e,Y.REPETITION_MANDATORY,n,r)||super.walkOption(e,n,r)}walkAtLeastOneSep(e,n,r){this.checkIsTarget(e,Y.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}walkMany(e,n,r){this.checkIsTarget(e,Y.REPETITION,n,r)||super.walkOption(e,n,r)}walkManySep(e,n,r){this.checkIsTarget(e,Y.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}}class ds extends ge{constructor(e,n,r){super(),this.targetOccurrence=e,this.targetProdType=n,this.targetRef=r,this.result=[]}checkIsTarget(e,n){e.idx!==this.targetOccurrence||this.targetProdType!==n||this.targetRef!==void 0&&e!==this.targetRef||(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,Y.OPTION)}visitRepetition(e){this.checkIsTarget(e,Y.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Y.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Y.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Y.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Y.ALTERNATION)}}function Ji(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function Gn(t){let e=[""];for(let n=0;n<t.length;n++){const r=t[n],i=[];for(let o=0;o<e.length;o++){const s=e[o];i.push(s+"_"+r.tokenTypeIdx);for(let a=0;a<r.categoryMatches.length;a++){const c="_"+r.categoryMatches[a];i.push(s+c)}}e=i}return e}function vc(t,e,n){for(let r=0;r<t.length;r++){if(r===n)continue;const i=t[r];for(let o=0;o<e.length;o++)if(i[e[o]]===!0)return!1}return!0}function ps(t,e){const n=b(t,s=>yr([s],1)),r=Ji(n.length),i=b(n,s=>{const a={};return M(s,c=>{M(Gn(c.partialPath),u=>{a[u]=!0})}),a});let o=n;for(let s=1;s<=e;s++){const a=o;o=Ji(a.length);for(let c=0;c<a.length;c++){const u=a[c];for(let l=0;l<u.length;l++){const h=u[l].partialPath,N=u[l].suffixDef,S=Gn(h);if(vc(i,S,c)||K(N)||h.length===e){const L=r[c];if(Or(L,h)===!1){L.push(h);for(let m=0;m<S.length;m++){const y=S[m];i[c][y]=!0}}}else{const L=yr(N,s+1,h);o[c]=o[c].concat(L),M(L,m=>{M(Gn(m.partialPath),y=>{i[c][y]=!0})})}}}}return r}function Rr(t,e,n,r){const i=new ds(t,Y.ALTERNATION,r);return e.accept(i),ps(i.result,n)}function vr(t,e,n,r){const i=new ds(t,n);e.accept(i);const o=i.result,s=new Rc(e,t,n).startWalking();return ps([new ht({definition:o}),new ht({definition:s})],r)}function Or(t,e){t:for(let n=0;n<t.length;n++){const r=t[n];if(r.length===e.length){for(let i=0;i<r.length;i++){const o=e[i],s=r[i];if(o!==s&&s.categoryMatchesMap[o.tokenTypeIdx]===void 0)continue t}return!0}}return!1}function to(t){return Rt(t,e=>Rt(e,n=>Rt(n,r=>K(r.categoryMatches))))}function Oc(t){return`${Ct(t)}_#_${t.idx}_#_${ms(t)}`}function ms(t){return t instanceof V?t.terminalType.name:t instanceof pt?t.nonTerminalName:""}class Sc extends ge{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function Es(t,e,n,r=[]){const i=[],o=rn(e.definition);if(K(o))return[];{const s=t.name;at(o,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:st.LEFT_RECURSION,ruleName:s});const a=gt(un(o,r.concat([t])),c=>{const u=et(r);return u.push(c),Es(t,c,n,u)});return i.concat(a)}}function rn(t){let e=[];if(K(t))return e;const n=Ot(t);if(n instanceof pt)e.push(n.referencedRule);else if(n instanceof ht||n instanceof lt||n instanceof Ut||n instanceof Ft||n instanceof _t||n instanceof J)e=e.concat(rn(n.definition));else if(n instanceof Lt)e=yt(b(n.definition,o=>rn(o.definition)));else if(!(n instanceof V))throw Error("non exhaustive match");const r=ln(n),i=t.length>1;if(r&&i){const o=tt(t);return e.concat(rn(o))}return e}class Sr extends ge{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}class _c extends ge{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}const gs="MismatchedTokenException",Ts="NoViableAltException",As="EarlyExitException",Is="NotAllInputParsedException",Ns=[gs,Ts,As,Is];function Ye(t){return at(Ns,t.name)}Object.freeze(Ns);class Ln extends Error{constructor(e,n){super(e),this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class eo extends Ln{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=gs}}class Lc extends Ln{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=Ts}}class xc extends Ln{constructor(e,n){super(e,n),this.name=Is}}class Cc extends Ln{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=As}}const Kn={},ys="InRuleRecoveryException";class kc extends Error{constructor(e){super(e),this.name=ys}}function bc(t,e,n,r,i,o,s){const a=this.getKeyForAutomaticLookahead(r,i);let c=this.firstAfterRepMap[a];if(c===void 0){const N=this.getCurrRuleFullName();c=new o(this.getGAstProductions()[N],i).startWalking(),this.firstAfterRepMap[a]=c}let u=c.token,l=c.occurrence;const h=c.isEndOfRule;this.RULE_STACK.length===1&&h&&u===void 0&&(u=ne,l=1),u!==void 0&&l!==void 0&&this.shouldInRepetitionRecoveryBeTried(u,l,s)&&this.tryInRepetitionRecovery(t,e,n,u)}const zn=1024,Vn=1280,Xe=1536;function Hn(t,e,n){return n|e|t}class Pc{constructor(e){var n;this.maxLookahead=(n=e?.maxLookahead)!==null&&n!==void 0?n:Kt.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(K(n)){const r=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),o=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...n,...r,...i,...o]}return n}validateNoLeftRecursion(e){return gt(e,n=>Es(n,n,re))}validateEmptyOrAlternatives(e){return gt(e,n=>function(r,i){const o=new Sr;return r.accept(o),gt(o.alternations,s=>gt(Fe(s.definition),(a,c)=>K(fs([a],[],Ce,1))?[{message:i.buildEmptyAlternationError({topLevelRule:r,alternation:s,emptyChoiceIdx:c}),type:st.NONE_LAST_EMPTY_ALT,ruleName:r.name,occurrence:s.idx,alternative:c+1}]:[]))}(n,re))}validateAmbiguousAlternationAlternatives(e,n){return gt(e,r=>function(i,o,s){const a=new Sr;i.accept(a);let c=a.alternations;return c=Je(c,u=>u.ignoreAmbiguities===!0),gt(c,u=>{const l=u.idx,h=u.maxLookahead||o,N=Rr(l,i,h,u),S=function(m,y,p,T){const g=[];return b(ft(m,(A,v,f)=>(y.definition[f].ignoreAmbiguities===!0||M(v,d=>{const I=[f];M(m,(E,R)=>{f!==R&&Or(E,d)&&y.definition[R].ignoreAmbiguities!==!0&&I.push(R)}),I.length>1&&!Or(g,d)&&(g.push(d),A.push({alts:I,path:d}))}),A),[]),A=>{const v=b(A.alts,f=>f+1);return{message:T.buildAlternationAmbiguityError({topLevelRule:p,alternation:y,ambiguityIndices:v,prefixPath:A.path}),type:st.AMBIGUOUS_ALTS,ruleName:p.name,occurrence:y.idx,alternatives:A.alts}})}(N,u,i,s),L=function(m,y,p,T){const g=ft(m,(A,v,f)=>{const d=b(v,I=>({idx:f,path:I}));return A.concat(d)},[]);return Ue(gt(g,A=>{if(y.definition[A.idx].ignoreAmbiguities===!0)return[];const v=A.idx,f=A.path;return b(Et(g,d=>{return y.definition[d.idx].ignoreAmbiguities!==!0&&d.idx<v&&(I=d.path,E=f,I.length<E.length&&Rt(I,(R,U)=>{const x=E[U];return R===x||x.categoryMatchesMap[R.tokenTypeIdx]}));var I,E}),d=>{const I=[d.idx+1,v+1],E=y.idx===0?"":y.idx;return{message:T.buildAlternationPrefixAmbiguityError({topLevelRule:p,alternation:y,ambiguityIndices:I,prefixPath:d.path}),type:st.AMBIGUOUS_PREFIX_ALTS,ruleName:p.name,occurrence:E,alternatives:I}})}))}(N,u,i,s);return S.concat(L)})}(r,n,re))}validateSomeNonEmptyLookaheadPath(e,n){return function(r,i,o){const s=[];return M(r,a=>{const c=new _c;a.accept(c),M(c.allProductions,u=>{const l=Zi(u),h=u.maxLookahead||i;if(K(yt(vr(u.idx,a,l,h)[0]))){const N=o.buildEmptyRepetitionError({topLevelRule:a,repetition:u});s.push({message:N,type:st.NO_NON_EMPTY_LOOKAHEAD,ruleName:a.name})}})}),s}(e,n,re)}buildLookaheadForAlternation(e){return function(n,r,i,o,s,a){const c=Rr(n,r,i);return a(c,o,to(c)?mn:Ce,s)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Nc)}buildLookaheadForOptional(e){return function(n,r,i,o,s,a){const c=vr(n,r,s,i),u=to(c)?mn:Ce;return a(c[0],u,o)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Zi(e.prodType),yc)}}const qe=new class extends ge{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(t){this.dslMethods.option.push(t)}visitRepetitionWithSeparator(t){this.dslMethods.repetitionWithSeparator.push(t)}visitRepetitionMandatory(t){this.dslMethods.repetitionMandatory.push(t)}visitRepetitionMandatoryWithSeparator(t){this.dslMethods.repetitionMandatoryWithSeparator.push(t)}visitRepetition(t){this.dslMethods.repetition.push(t)}visitAlternation(t){this.dslMethods.alternation.push(t)}};function no(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function ro(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function io(t,e){Object.defineProperty(t,"name",{enumerable:!1,configurable:!0,writable:!1,value:e})}function wc(t,e){const n=Nt(t),r=n.length;for(let i=0;i<r;i++){const o=t[n[i]],s=o.length;for(let a=0;a<s;a++){const c=o[a];c.tokenTypeIdx===void 0&&this[c.name](c.children,e)}}}var _r;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(_r||(_r={}));const xn={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(xn);const oo=!0,so=Math.pow(2,8)-1,Rs=D({name:"RECORDING_PHASE_TOKEN",pattern:ot.NA});We([Rs]);const vs=Wr(Rs,`This IToken indicates the Parser is in Recording Phase
|
|
89
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:t=>"deprecated",buildDuplicateRuleNameError(t){let e;return e=t.topLevelRule instanceof Ee?t.topLevelRule.name:t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};class mc extends ge{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){M(Q(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:st.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Ec extends Sn{constructor(e,n){super(),this.topProd=e,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=et(this.path.ruleStack).reverse(),this.occurrenceStack=et(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,n=[]){this.found||super.walk(e,n)}walkProdRef(e,n,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){K(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class gc extends Ec{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),o=new ht({definition:i});this.possibleTokTypes=xe(o),this.found=!0}}}class _n extends Sn{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Tc extends _n{walkMany(e,n,r){if(e.idx===this.occurrence){const i=Ot(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof V&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class qi extends _n{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=Ot(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof V&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class Ac extends _n{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=Ot(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof V&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class Zi extends _n{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=Ot(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof V&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function yr(t,e,n=[]){n=et(n);let r=[],i=0;function o(s){const a=yr(s.concat(tt(t,i+1)),e,n);return r.concat(a)}for(;n.length<e&&i<t.length;){const s=t[i];if(s instanceof ht||s instanceof pt)return o(s.definition);if(s instanceof lt)r=o(s.definition);else{if(s instanceof Ut)return o(s.definition.concat([new J({definition:s.definition})]));if(s instanceof Ft)return o([new ht({definition:s.definition}),new J({definition:[new V({terminalType:s.separator})].concat(s.definition)})]);if(s instanceof _t){const a=s.definition.concat([new J({definition:[new V({terminalType:s.separator})].concat(s.definition)})]);r=o(a)}else if(s instanceof J){const a=s.definition.concat([new J({definition:s.definition})]);r=o(a)}else{if(s instanceof Lt)return M(s.definition,a=>{K(a.definition)===!1&&(r=o(a.definition))}),r;if(!(s instanceof V))throw Error("non exhaustive match");n.push(s.terminalType)}}i++}return r.push({partialPath:n,suffixDef:tt(t,i)}),r}function fs(t,e,n,r){const i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE";let a=!1;const c=e.length,u=c-r-1,l=[],h=[];for(h.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!K(h);){const N=h.pop();if(N===s){a&&pe(h).idx<=u&&h.pop();continue}const S=N.def,L=N.idx,m=N.ruleStack,y=N.occurrenceStack;if(K(S))continue;const p=S[0];if(p===i){const T={idx:L,def:tt(S),ruleStack:Fe(m),occurrenceStack:Fe(y)};h.push(T)}else if(p instanceof V)if(L<c-1){const T=L+1;if(n(e[T],p.terminalType)){const g={idx:T,def:tt(S),ruleStack:m,occurrenceStack:y};h.push(g)}}else{if(L!==c-1)throw Error("non exhaustive match");l.push({nextTokenType:p.terminalType,nextTokenOccurrence:p.idx,ruleStack:m,occurrenceStack:y}),a=!0}else if(p instanceof pt){const T=et(m);T.push(p.nonTerminalName);const g=et(y);g.push(p.idx);const A={idx:L,def:p.definition.concat(o,tt(S)),ruleStack:T,occurrenceStack:g};h.push(A)}else if(p instanceof lt){const T={idx:L,def:tt(S),ruleStack:m,occurrenceStack:y};h.push(T),h.push(s);const g={idx:L,def:p.definition.concat(tt(S)),ruleStack:m,occurrenceStack:y};h.push(g)}else if(p instanceof Ut){const T=new J({definition:p.definition,idx:p.idx}),g={idx:L,def:p.definition.concat([T],tt(S)),ruleStack:m,occurrenceStack:y};h.push(g)}else if(p instanceof Ft){const T=new V({terminalType:p.separator}),g=new J({definition:[T].concat(p.definition),idx:p.idx}),A={idx:L,def:p.definition.concat([g],tt(S)),ruleStack:m,occurrenceStack:y};h.push(A)}else if(p instanceof _t){const T={idx:L,def:tt(S),ruleStack:m,occurrenceStack:y};h.push(T),h.push(s);const g=new V({terminalType:p.separator}),A=new J({definition:[g].concat(p.definition),idx:p.idx}),v={idx:L,def:p.definition.concat([A],tt(S)),ruleStack:m,occurrenceStack:y};h.push(v)}else if(p instanceof J){const T={idx:L,def:tt(S),ruleStack:m,occurrenceStack:y};h.push(T),h.push(s);const g=new J({definition:p.definition,idx:p.idx}),A={idx:L,def:p.definition.concat([g],tt(S)),ruleStack:m,occurrenceStack:y};h.push(A)}else if(p instanceof Lt)for(let T=p.definition.length-1;T>=0;T--){const g={idx:L,def:p.definition[T].definition.concat(tt(S)),ruleStack:m,occurrenceStack:y};h.push(g),h.push(s)}else if(p instanceof ht)h.push({idx:L,def:p.definition.concat(tt(S)),ruleStack:m,occurrenceStack:y});else{if(!(p instanceof Ee))throw Error("non exhaustive match");h.push(Ic(p,L,m,y))}}return l}function Ic(t,e,n,r){const i=et(n);i.push(t.name);const o=et(r);return o.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:o}}var Y;function Qi(t){if(t instanceof lt||t==="Option")return Y.OPTION;if(t instanceof J||t==="Repetition")return Y.REPETITION;if(t instanceof Ut||t==="RepetitionMandatory")return Y.REPETITION_MANDATORY;if(t instanceof Ft||t==="RepetitionMandatoryWithSeparator")return Y.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof _t||t==="RepetitionWithSeparator")return Y.REPETITION_WITH_SEPARATOR;if(t instanceof Lt||t==="Alternation")return Y.ALTERNATION;throw Error("non exhaustive match")}function Nc(t,e,n,r){const i=t.length,o=Rt(t,s=>Rt(s,a=>a.length===1));if(e)return function(s){const a=b(s,c=>c.GATE);for(let c=0;c<i;c++){const u=t[c],l=u.length,h=a[c];if(h===void 0||h.call(this)!==!1)t:for(let N=0;N<l;N++){const S=u[N],L=S.length;for(let m=0;m<L;m++){const y=this.LA(m+1);if(n(y,S[m])===!1)continue t}return c}}};if(o&&!r){const s=ft(b(t,a=>yt(a)),(a,c,u)=>(M(c,l=>{P(a,l.tokenTypeIdx)||(a[l.tokenTypeIdx]=u),M(l.categoryMatches,h=>{P(a,h)||(a[h]=u)})}),a),{});return function(){const a=this.LA(1);return s[a.tokenTypeIdx]}}return function(){for(let s=0;s<i;s++){const a=t[s],c=a.length;t:for(let u=0;u<c;u++){const l=a[u],h=l.length;for(let N=0;N<h;N++){const S=this.LA(N+1);if(n(S,l[N])===!1)continue t}return s}}}}function yc(t,e,n){const r=Rt(t,o=>o.length===1),i=t.length;if(r&&!n){const o=yt(t);if(o.length===1&&K(o[0].categoryMatches)){const s=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}{const s=ft(o,(a,c,u)=>(a[c.tokenTypeIdx]=!0,M(c.categoryMatches,l=>{a[l]=!0}),a),[]);return function(){const a=this.LA(1);return s[a.tokenTypeIdx]===!0}}}return function(){t:for(let o=0;o<i;o++){const s=t[o],a=s.length;for(let c=0;c<a;c++){const u=this.LA(c+1);if(e(u,s[c])===!1)continue t}return!0}return!1}}(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(Y||(Y={}));class Rc extends Sn{constructor(e,n,r){super(),this.topProd=e,this.targetOccurrence=n,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,n,r,i){return e.idx===this.targetOccurrence&&this.targetProdType===n&&(this.restDef=r.concat(i),!0)}walkOption(e,n,r){this.checkIsTarget(e,Y.OPTION,n,r)||super.walkOption(e,n,r)}walkAtLeastOne(e,n,r){this.checkIsTarget(e,Y.REPETITION_MANDATORY,n,r)||super.walkOption(e,n,r)}walkAtLeastOneSep(e,n,r){this.checkIsTarget(e,Y.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}walkMany(e,n,r){this.checkIsTarget(e,Y.REPETITION,n,r)||super.walkOption(e,n,r)}walkManySep(e,n,r){this.checkIsTarget(e,Y.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}}class ds extends ge{constructor(e,n,r){super(),this.targetOccurrence=e,this.targetProdType=n,this.targetRef=r,this.result=[]}checkIsTarget(e,n){e.idx!==this.targetOccurrence||this.targetProdType!==n||this.targetRef!==void 0&&e!==this.targetRef||(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,Y.OPTION)}visitRepetition(e){this.checkIsTarget(e,Y.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Y.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Y.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Y.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Y.ALTERNATION)}}function Ji(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function Gn(t){let e=[""];for(let n=0;n<t.length;n++){const r=t[n],i=[];for(let o=0;o<e.length;o++){const s=e[o];i.push(s+"_"+r.tokenTypeIdx);for(let a=0;a<r.categoryMatches.length;a++){const c="_"+r.categoryMatches[a];i.push(s+c)}}e=i}return e}function vc(t,e,n){for(let r=0;r<t.length;r++){if(r===n)continue;const i=t[r];for(let o=0;o<e.length;o++)if(i[e[o]]===!0)return!1}return!0}function ps(t,e){const n=b(t,s=>yr([s],1)),r=Ji(n.length),i=b(n,s=>{const a={};return M(s,c=>{M(Gn(c.partialPath),u=>{a[u]=!0})}),a});let o=n;for(let s=1;s<=e;s++){const a=o;o=Ji(a.length);for(let c=0;c<a.length;c++){const u=a[c];for(let l=0;l<u.length;l++){const h=u[l].partialPath,N=u[l].suffixDef,S=Gn(h);if(vc(i,S,c)||K(N)||h.length===e){const L=r[c];if(Or(L,h)===!1){L.push(h);for(let m=0;m<S.length;m++){const y=S[m];i[c][y]=!0}}}else{const L=yr(N,s+1,h);o[c]=o[c].concat(L),M(L,m=>{M(Gn(m.partialPath),y=>{i[c][y]=!0})})}}}}return r}function Rr(t,e,n,r){const i=new ds(t,Y.ALTERNATION,r);return e.accept(i),ps(i.result,n)}function vr(t,e,n,r){const i=new ds(t,n);e.accept(i);const o=i.result,s=new Rc(e,t,n).startWalking();return ps([new ht({definition:o}),new ht({definition:s})],r)}function Or(t,e){t:for(let n=0;n<t.length;n++){const r=t[n];if(r.length===e.length){for(let i=0;i<r.length;i++){const o=e[i],s=r[i];if(o!==s&&s.categoryMatchesMap[o.tokenTypeIdx]===void 0)continue t}return!0}}return!1}function to(t){return Rt(t,e=>Rt(e,n=>Rt(n,r=>K(r.categoryMatches))))}function Oc(t){return`${Ct(t)}_#_${t.idx}_#_${ms(t)}`}function ms(t){return t instanceof V?t.terminalType.name:t instanceof pt?t.nonTerminalName:""}class Sc extends ge{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function Es(t,e,n,r=[]){const i=[],o=rn(e.definition);if(K(o))return[];{const s=t.name;at(o,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:st.LEFT_RECURSION,ruleName:s});const a=gt(un(o,r.concat([t])),c=>{const u=et(r);return u.push(c),Es(t,c,n,u)});return i.concat(a)}}function rn(t){let e=[];if(K(t))return e;const n=Ot(t);if(n instanceof pt)e.push(n.referencedRule);else if(n instanceof ht||n instanceof lt||n instanceof Ut||n instanceof Ft||n instanceof _t||n instanceof J)e=e.concat(rn(n.definition));else if(n instanceof Lt)e=yt(b(n.definition,o=>rn(o.definition)));else if(!(n instanceof V))throw Error("non exhaustive match");const r=ln(n),i=t.length>1;if(r&&i){const o=tt(t);return e.concat(rn(o))}return e}class Sr extends ge{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}class _c extends ge{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}const gs="MismatchedTokenException",Ts="NoViableAltException",As="EarlyExitException",Is="NotAllInputParsedException",Ns=[gs,Ts,As,Is];function Ye(t){return at(Ns,t.name)}Object.freeze(Ns);class Ln extends Error{constructor(e,n){super(e),this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class eo extends Ln{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=gs}}class Lc extends Ln{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=Ts}}class xc extends Ln{constructor(e,n){super(e,n),this.name=Is}}class Cc extends Ln{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=As}}const Kn={},ys="InRuleRecoveryException";class kc extends Error{constructor(e){super(e),this.name=ys}}function bc(t,e,n,r,i,o,s){const a=this.getKeyForAutomaticLookahead(r,i);let c=this.firstAfterRepMap[a];if(c===void 0){const N=this.getCurrRuleFullName();c=new o(this.getGAstProductions()[N],i).startWalking(),this.firstAfterRepMap[a]=c}let u=c.token,l=c.occurrence;const h=c.isEndOfRule;this.RULE_STACK.length===1&&h&&u===void 0&&(u=ne,l=1),u!==void 0&&l!==void 0&&this.shouldInRepetitionRecoveryBeTried(u,l,s)&&this.tryInRepetitionRecovery(t,e,n,u)}const zn=1024,Vn=1280,Xe=1536;function Hn(t,e,n){return n|e|t}class Pc{constructor(e){var n;this.maxLookahead=(n=e?.maxLookahead)!==null&&n!==void 0?n:Kt.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(K(n)){const r=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),o=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...n,...r,...i,...o]}return n}validateNoLeftRecursion(e){return gt(e,n=>Es(n,n,re))}validateEmptyOrAlternatives(e){return gt(e,n=>function(r,i){const o=new Sr;return r.accept(o),gt(o.alternations,s=>gt(Fe(s.definition),(a,c)=>K(fs([a],[],Ce,1))?[{message:i.buildEmptyAlternationError({topLevelRule:r,alternation:s,emptyChoiceIdx:c}),type:st.NONE_LAST_EMPTY_ALT,ruleName:r.name,occurrence:s.idx,alternative:c+1}]:[]))}(n,re))}validateAmbiguousAlternationAlternatives(e,n){return gt(e,r=>function(i,o,s){const a=new Sr;i.accept(a);let c=a.alternations;return c=Je(c,u=>u.ignoreAmbiguities===!0),gt(c,u=>{const l=u.idx,h=u.maxLookahead||o,N=Rr(l,i,h,u),S=function(m,y,p,T){const g=[];return b(ft(m,(A,v,f)=>(y.definition[f].ignoreAmbiguities===!0||M(v,d=>{const I=[f];M(m,(E,R)=>{f!==R&&Or(E,d)&&y.definition[R].ignoreAmbiguities!==!0&&I.push(R)}),I.length>1&&!Or(g,d)&&(g.push(d),A.push({alts:I,path:d}))}),A),[]),A=>{const v=b(A.alts,f=>f+1);return{message:T.buildAlternationAmbiguityError({topLevelRule:p,alternation:y,ambiguityIndices:v,prefixPath:A.path}),type:st.AMBIGUOUS_ALTS,ruleName:p.name,occurrence:y.idx,alternatives:A.alts}})}(N,u,i,s),L=function(m,y,p,T){const g=ft(m,(A,v,f)=>{const d=b(v,I=>({idx:f,path:I}));return A.concat(d)},[]);return Ue(gt(g,A=>{if(y.definition[A.idx].ignoreAmbiguities===!0)return[];const v=A.idx,f=A.path;return b(Et(g,d=>{return y.definition[d.idx].ignoreAmbiguities!==!0&&d.idx<v&&(I=d.path,E=f,I.length<E.length&&Rt(I,(R,U)=>{const x=E[U];return R===x||x.categoryMatchesMap[R.tokenTypeIdx]}));var I,E}),d=>{const I=[d.idx+1,v+1],E=y.idx===0?"":y.idx;return{message:T.buildAlternationPrefixAmbiguityError({topLevelRule:p,alternation:y,ambiguityIndices:I,prefixPath:d.path}),type:st.AMBIGUOUS_PREFIX_ALTS,ruleName:p.name,occurrence:E,alternatives:I}})}))}(N,u,i,s);return S.concat(L)})}(r,n,re))}validateSomeNonEmptyLookaheadPath(e,n){return function(r,i,o){const s=[];return M(r,a=>{const c=new _c;a.accept(c),M(c.allProductions,u=>{const l=Qi(u),h=u.maxLookahead||i;if(K(yt(vr(u.idx,a,l,h)[0]))){const N=o.buildEmptyRepetitionError({topLevelRule:a,repetition:u});s.push({message:N,type:st.NO_NON_EMPTY_LOOKAHEAD,ruleName:a.name})}})}),s}(e,n,re)}buildLookaheadForAlternation(e){return function(n,r,i,o,s,a){const c=Rr(n,r,i);return a(c,o,to(c)?mn:Ce,s)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Nc)}buildLookaheadForOptional(e){return function(n,r,i,o,s,a){const c=vr(n,r,s,i),u=to(c)?mn:Ce;return a(c[0],u,o)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Qi(e.prodType),yc)}}const qe=new class extends ge{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(t){this.dslMethods.option.push(t)}visitRepetitionWithSeparator(t){this.dslMethods.repetitionWithSeparator.push(t)}visitRepetitionMandatory(t){this.dslMethods.repetitionMandatory.push(t)}visitRepetitionMandatoryWithSeparator(t){this.dslMethods.repetitionMandatoryWithSeparator.push(t)}visitRepetition(t){this.dslMethods.repetition.push(t)}visitAlternation(t){this.dslMethods.alternation.push(t)}};function no(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function ro(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function io(t,e){Object.defineProperty(t,"name",{enumerable:!1,configurable:!0,writable:!1,value:e})}function wc(t,e){const n=Nt(t),r=n.length;for(let i=0;i<r;i++){const o=t[n[i]],s=o.length;for(let a=0;a<s;a++){const c=o[a];c.tokenTypeIdx===void 0&&this[c.name](c.children,e)}}}var _r;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(_r||(_r={}));const xn={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(xn);const oo=!0,so=Math.pow(2,8)-1,Rs=D({name:"RECORDING_PHASE_TOKEN",pattern:ot.NA});We([Rs]);const vs=Wr(Rs,`This IToken indicates the Parser is in Recording Phase
|
|
90
90
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(vs);const Mc={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
91
91
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};function Re(t,e,n,r=!1){En(n);const i=pe(this.recordingProdStack),o=Ht(e)?e:e.DEF,s=new t({definition:[],idx:n});return r&&(s.separator=e.SEP),P(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(s),o.call(this),i.definition.push(s),this.recordingProdStack.pop(),xn}function Uc(t,e){En(e);const n=pe(this.recordingProdStack),r=B(t)===!1,i=r===!1?t:t.DEF,o=new Lt({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});P(t,"MAX_LOOKAHEAD")&&(o.maxLookahead=t.MAX_LOOKAHEAD);const s=es(i,a=>Ht(a.GATE));return o.hasPredicates=s,n.definition.push(o),M(i,a=>{const c=new ht({definition:[]});o.definition.push(c),P(a,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:P(a,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),a.ALT.call(this),this.recordingProdStack.pop()}),xn}function ao(t){return t===0?"":`${t}`}function En(t){if(t<0||t>so){const e=new Error(`Invalid DSL Method idx value: <${t}>
|
|
92
|
-
Idx value must be a none negative value smaller than ${so+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}const on=Wr(ne,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(on);const Kt=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:hs,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),
|
|
92
|
+
Idx value must be a none negative value smaller than ${so+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}const on=Wr(ne,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(on);const Kt=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:hs,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Ze=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var st,Yn;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(st||(st={}));class De{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 e;this.selfAnalysisDone=!0;const n=this.className;this.TRACE_INIT("toFastProps",()=>{is(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),M(this.definedRulesNames,i=>{const o=this[i].originalGrammarAction;let s;this.TRACE_INIT(`${i} Rule`,()=>{s=this.topLevelRuleRecord(i,o)}),this.gastProductionsCache[i]=s})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=function(i){const o=mr(i,{errMsgProvider:pc}),s={};return M(i.rules,a=>{s[a.name]=a}),function(a,c){const u=new mc(a,c);return u.resolveRefs(),u.errors}(s,o.errMsgProvider)}({rules:Q(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(K(r)&&this.skipValidations===!1){const s=(o={rules:Q(this.gastProductionsCache),tokenTypes:Q(this.tokensMap),errMsgProvider:re,grammarName:n},function(c,u,l,h){const N=gt(c,y=>function(p,T){const g=new Sc;p.accept(g);const A=g.allProductions;return b(Q(St(Ha(A,Oc),v=>v.length>1)),v=>{const f=Ot(v),d=T.buildDuplicateFoundError(p,v),I=Ct(f),E={message:d,type:st.DUPLICATE_PRODUCTIONS,ruleName:p.name,dslName:I,occurrence:f.idx},R=ms(f);return R&&(E.parameter=R),E})}(y,l)),S=function(y,p,T){const g=[],A=b(p,v=>v.name);return M(y,v=>{const f=v.name;if(at(A,f)){const d=T.buildNamespaceConflictError(v);g.push({message:d,type:st.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:f})}}),g}(c,u,l),L=gt(c,y=>function(p,T){const g=new Sr;return p.accept(g),gt(g.alternations,A=>A.definition.length>255?[{message:T.buildTooManyAlternativesError({topLevelRule:p,alternation:A}),type:st.TOO_MANY_ALTS,ruleName:p.name,occurrence:A.idx}]:[])}(y,l)),m=gt(c,y=>function(p,T,g,A){const v=[];if(ft(T,(f,d)=>d.name===p.name?f+1:f,0)>1){const f=A.buildDuplicateRuleNameError({topLevelRule:p,grammarName:g});v.push({message:f,type:st.DUPLICATE_RULE_NAME,ruleName:p.name})}return v}(y,c,h,l));return N.concat(S,L,m)}((o=mr(o,{errMsgProvider:re})).rules,o.tokenTypes,o.errMsgProvider,o.grammarName)),a=b((i={lookaheadStrategy:this.lookaheadStrategy,rules:Q(this.gastProductionsCache),tokenTypes:Q(this.tokensMap),grammarName:n}).lookaheadStrategy.validate({rules:i.rules,tokenTypes:i.tokenTypes,grammarName:i.grammarName}),c=>Object.assign({type:st.CUSTOM_LOOKAHEAD_VALIDATION},c));this.definitionErrors=this.definitionErrors.concat(s,a)}var i,o}),K(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=function(o){const s={};return M(o,a=>{const c=new rc(a).startWalking();dt(s,c)}),s}(Q(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,o;(o=(i=this.lookaheadStrategy).initialize)===null||o===void 0||o.call(i,{rules:Q(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Q(this.gastProductionsCache))})),!De.DEFER_DEFINITION_ERRORS_HANDLING&&!K(this.definitionErrors))throw e=b(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
|
|
93
93
|
${e.join(`
|
|
94
94
|
-------------------------------
|
|
95
95
|
`)}`)})}constructor(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;const r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(e,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),P(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
96
96
|
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
97
97
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
98
|
-
For further details.`);this.skipValidations=P(n,"skipValidations")?n.skipValidations:Kt.skipValidations}}De.DEFER_DEFINITION_ERRORS_HANDLING=!1,Yn=De,[class{initRecoverable(t){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=P(t,"recoveryEnabled")?t.recoveryEnabled:Kt.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=bc)}getTokenToInsert(t){const e=Wr(t,"",NaN,NaN,NaN,NaN,NaN,NaN);return e.isInsertedInRecovery=!0,e}canTokenTypeBeInsertedInRecovery(t){return!0}canTokenTypeBeDeletedInRecovery(t){return!0}tryInRepetitionRecovery(t,e,n,r){const i=this.findReSyncTokenType(),o=this.exportLexerState(),s=[];let a=!1;const c=this.LA(1);let u=this.LA(1);const l=()=>{const h=this.LA(0),N=this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:c,previous:h,ruleName:this.getCurrRuleFullName()}),S=new eo(N,c,this.LA(0));S.resyncedTokens=Fe(s),this.SAVE_ERROR(S)};for(;!a;){if(this.tokenMatcher(u,r))return void l();if(n.call(this))return l(),void t.apply(this,e);this.tokenMatcher(u,i)?a=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,s))}this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(t,e,n){return n!==!1&&!this.tokenMatcher(this.LA(1),t)&&!this.isBackTracking()&&!this.canPerformInRuleRecovery(t,this.getFollowsForInRuleRecovery(t,e))}getFollowsForInRuleRecovery(t,e){const n=this.getCurrentGrammarPath(t,e);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(t,e){if(this.canRecoverWithSingleTokenInsertion(t,e))return this.getTokenToInsert(t);if(this.canRecoverWithSingleTokenDeletion(t)){const n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new kc("sad sad panda")}canPerformInRuleRecovery(t,e){return this.canRecoverWithSingleTokenInsertion(t,e)||this.canRecoverWithSingleTokenDeletion(t)}canRecoverWithSingleTokenInsertion(t,e){if(!this.canTokenTypeBeInsertedInRecovery(t)||K(e))return!1;const n=this.LA(1);return me(e,r=>this.tokenMatcher(n,r))!==void 0}canRecoverWithSingleTokenDeletion(t){return!!this.canTokenTypeBeDeletedInRecovery(t)&&this.tokenMatcher(this.LA(2),t)}isInCurrentRuleReSyncSet(t){const e=this.getCurrFollowKey();return at(this.getFollowSetFromFollowKey(e),t)}findReSyncTokenType(){const t=this.flattenFollowSet();let e=this.LA(1),n=2;for(;;){const r=me(t,i=>Ce(e,i));if(r!==void 0)return r;e=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Kn;const t=this.getLastExplicitRuleShortName(),e=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(t),idxInCallingRule:e,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){const t=this.RULE_STACK,e=this.RULE_OCCURRENCE_STACK;return b(t,(n,r)=>r===0?Kn:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:e[r],inRule:this.shortRuleNameToFullName(t[r-1])})}flattenFollowSet(){return yt(b(this.buildFullFollowKeyStack(),t=>this.getFollowSetFromFollowKey(t)))}getFollowSetFromFollowKey(t){if(t===Kn)return[ne];const e=t.ruleName+t.idxInCallingRule+os+t.inRule;return this.resyncFollows[e]}addToResyncTokens(t,e){return this.tokenMatcher(t,ne)||e.push(t),e}reSyncTo(t){const e=[];let n=this.LA(1);for(;this.tokenMatcher(n,t)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,e);return Fe(e)}attemptInRepetitionRecovery(t,e,n,r,i,o,s){}getCurrentGrammarPath(t,e){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:et(this.RULE_OCCURRENCE_STACK),lastTok:t,lastTokOccurrence:e}}getHumanReadableRuleStack(){return b(this.RULE_STACK,t=>this.shortRuleNameToFullName(t))}},class{initLooksAhead(t){this.dynamicTokensEnabled=P(t,"dynamicTokensEnabled")?t.dynamicTokensEnabled:Kt.dynamicTokensEnabled,this.maxLookahead=P(t,"maxLookahead")?t.maxLookahead:Kt.maxLookahead,this.lookaheadStrategy=P(t,"lookaheadStrategy")?t.lookaheadStrategy:new Pc({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(t){M(t,e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{const{alternation:n,repetition:r,option:i,repetitionMandatory:o,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:a}=function(c){qe.reset(),c.accept(qe);const u=qe.dslMethods;return qe.reset(),u}(e);M(n,c=>{const u=c.idx===0?"":c.idx;this.TRACE_INIT(`${Ct(c)}${u}`,()=>{const l=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:e,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),h=Hn(this.fullRuleNameToShort[e.name],256,c.idx);this.setLaFuncCache(h,l)})}),M(r,c=>{this.computeLookaheadFunc(e,c.idx,768,"Repetition",c.maxLookahead,Ct(c))}),M(i,c=>{this.computeLookaheadFunc(e,c.idx,512,"Option",c.maxLookahead,Ct(c))}),M(o,c=>{this.computeLookaheadFunc(e,c.idx,zn,"RepetitionMandatory",c.maxLookahead,Ct(c))}),M(s,c=>{this.computeLookaheadFunc(e,c.idx,Xe,"RepetitionMandatoryWithSeparator",c.maxLookahead,Ct(c))}),M(a,c=>{this.computeLookaheadFunc(e,c.idx,Vn,"RepetitionWithSeparator",c.maxLookahead,Ct(c))})})})}computeLookaheadFunc(t,e,n,r,i,o){this.TRACE_INIT(`${o}${e===0?"":e}`,()=>{const s=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:e,rule:t,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r}),a=Hn(this.fullRuleNameToShort[t.name],n,e);this.setLaFuncCache(a,s)})}getKeyForAutomaticLookahead(t,e){return Hn(this.getLastExplicitRuleShortName(),t,e)}getLaFuncFromCache(t){return this.lookAheadFuncsCache.get(t)}setLaFuncCache(t,e){this.lookAheadFuncsCache.set(t,e)}},class{initTreeBuilder(t){if(this.CST_STACK=[],this.outputCst=t.outputCst,this.nodeLocationTracking=P(t,"nodeLocationTracking")?t.nodeLocationTracking:Kt.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ro,this.setNodeLocationFromNode=ro,this.cstPostRule=
|
|
98
|
+
For further details.`);this.skipValidations=P(n,"skipValidations")?n.skipValidations:Kt.skipValidations}}De.DEFER_DEFINITION_ERRORS_HANDLING=!1,Yn=De,[class{initRecoverable(t){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=P(t,"recoveryEnabled")?t.recoveryEnabled:Kt.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=bc)}getTokenToInsert(t){const e=Wr(t,"",NaN,NaN,NaN,NaN,NaN,NaN);return e.isInsertedInRecovery=!0,e}canTokenTypeBeInsertedInRecovery(t){return!0}canTokenTypeBeDeletedInRecovery(t){return!0}tryInRepetitionRecovery(t,e,n,r){const i=this.findReSyncTokenType(),o=this.exportLexerState(),s=[];let a=!1;const c=this.LA(1);let u=this.LA(1);const l=()=>{const h=this.LA(0),N=this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:c,previous:h,ruleName:this.getCurrRuleFullName()}),S=new eo(N,c,this.LA(0));S.resyncedTokens=Fe(s),this.SAVE_ERROR(S)};for(;!a;){if(this.tokenMatcher(u,r))return void l();if(n.call(this))return l(),void t.apply(this,e);this.tokenMatcher(u,i)?a=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,s))}this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(t,e,n){return n!==!1&&!this.tokenMatcher(this.LA(1),t)&&!this.isBackTracking()&&!this.canPerformInRuleRecovery(t,this.getFollowsForInRuleRecovery(t,e))}getFollowsForInRuleRecovery(t,e){const n=this.getCurrentGrammarPath(t,e);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(t,e){if(this.canRecoverWithSingleTokenInsertion(t,e))return this.getTokenToInsert(t);if(this.canRecoverWithSingleTokenDeletion(t)){const n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new kc("sad sad panda")}canPerformInRuleRecovery(t,e){return this.canRecoverWithSingleTokenInsertion(t,e)||this.canRecoverWithSingleTokenDeletion(t)}canRecoverWithSingleTokenInsertion(t,e){if(!this.canTokenTypeBeInsertedInRecovery(t)||K(e))return!1;const n=this.LA(1);return me(e,r=>this.tokenMatcher(n,r))!==void 0}canRecoverWithSingleTokenDeletion(t){return!!this.canTokenTypeBeDeletedInRecovery(t)&&this.tokenMatcher(this.LA(2),t)}isInCurrentRuleReSyncSet(t){const e=this.getCurrFollowKey();return at(this.getFollowSetFromFollowKey(e),t)}findReSyncTokenType(){const t=this.flattenFollowSet();let e=this.LA(1),n=2;for(;;){const r=me(t,i=>Ce(e,i));if(r!==void 0)return r;e=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Kn;const t=this.getLastExplicitRuleShortName(),e=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(t),idxInCallingRule:e,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){const t=this.RULE_STACK,e=this.RULE_OCCURRENCE_STACK;return b(t,(n,r)=>r===0?Kn:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:e[r],inRule:this.shortRuleNameToFullName(t[r-1])})}flattenFollowSet(){return yt(b(this.buildFullFollowKeyStack(),t=>this.getFollowSetFromFollowKey(t)))}getFollowSetFromFollowKey(t){if(t===Kn)return[ne];const e=t.ruleName+t.idxInCallingRule+os+t.inRule;return this.resyncFollows[e]}addToResyncTokens(t,e){return this.tokenMatcher(t,ne)||e.push(t),e}reSyncTo(t){const e=[];let n=this.LA(1);for(;this.tokenMatcher(n,t)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,e);return Fe(e)}attemptInRepetitionRecovery(t,e,n,r,i,o,s){}getCurrentGrammarPath(t,e){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:et(this.RULE_OCCURRENCE_STACK),lastTok:t,lastTokOccurrence:e}}getHumanReadableRuleStack(){return b(this.RULE_STACK,t=>this.shortRuleNameToFullName(t))}},class{initLooksAhead(t){this.dynamicTokensEnabled=P(t,"dynamicTokensEnabled")?t.dynamicTokensEnabled:Kt.dynamicTokensEnabled,this.maxLookahead=P(t,"maxLookahead")?t.maxLookahead:Kt.maxLookahead,this.lookaheadStrategy=P(t,"lookaheadStrategy")?t.lookaheadStrategy:new Pc({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(t){M(t,e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{const{alternation:n,repetition:r,option:i,repetitionMandatory:o,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:a}=function(c){qe.reset(),c.accept(qe);const u=qe.dslMethods;return qe.reset(),u}(e);M(n,c=>{const u=c.idx===0?"":c.idx;this.TRACE_INIT(`${Ct(c)}${u}`,()=>{const l=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:e,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),h=Hn(this.fullRuleNameToShort[e.name],256,c.idx);this.setLaFuncCache(h,l)})}),M(r,c=>{this.computeLookaheadFunc(e,c.idx,768,"Repetition",c.maxLookahead,Ct(c))}),M(i,c=>{this.computeLookaheadFunc(e,c.idx,512,"Option",c.maxLookahead,Ct(c))}),M(o,c=>{this.computeLookaheadFunc(e,c.idx,zn,"RepetitionMandatory",c.maxLookahead,Ct(c))}),M(s,c=>{this.computeLookaheadFunc(e,c.idx,Xe,"RepetitionMandatoryWithSeparator",c.maxLookahead,Ct(c))}),M(a,c=>{this.computeLookaheadFunc(e,c.idx,Vn,"RepetitionWithSeparator",c.maxLookahead,Ct(c))})})})}computeLookaheadFunc(t,e,n,r,i,o){this.TRACE_INIT(`${o}${e===0?"":e}`,()=>{const s=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:e,rule:t,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r}),a=Hn(this.fullRuleNameToShort[t.name],n,e);this.setLaFuncCache(a,s)})}getKeyForAutomaticLookahead(t,e){return Hn(this.getLastExplicitRuleShortName(),t,e)}getLaFuncFromCache(t){return this.lookAheadFuncsCache.get(t)}setLaFuncCache(t,e){this.lookAheadFuncsCache.set(t,e)}},class{initTreeBuilder(t){if(this.CST_STACK=[],this.outputCst=t.outputCst,this.nodeLocationTracking=P(t,"nodeLocationTracking")?t.nodeLocationTracking:Kt.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ro,this.setNodeLocationFromNode=ro,this.cstPostRule=Z,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Z,this.setNodeLocationFromNode=Z,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=no,this.setNodeLocationFromNode=no,this.cstPostRule=Z,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Z,this.setNodeLocationFromNode=Z,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error(`Invalid <nodeLocationTracking> config option: "${t.nodeLocationTracking}"`);this.setNodeLocationFromToken=Z,this.setNodeLocationFromNode=Z,this.cstPostRule=Z,this.setInitialNodeLocation=Z}else this.cstInvocationStateUpdate=Z,this.cstFinallyStateUpdate=Z,this.cstPostTerminal=Z,this.cstPostNonTerminal=Z,this.cstPostRule=Z}setInitialNodeLocationOnlyOffsetRecovery(t){t.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(t){t.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(t){t.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(t){const e=this.LA(1);t.location={startOffset:e.startOffset,startLine:e.startLine,startColumn:e.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(t){const e={name:t,children:Object.create(null)};this.setInitialNodeLocation(e),this.CST_STACK.push(e)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(t){const e=this.LA(0),n=t.location;n.startOffset<=e.startOffset==1?(n.endOffset=e.endOffset,n.endLine=e.endLine,n.endColumn=e.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(t){const e=this.LA(0),n=t.location;n.startOffset<=e.startOffset==1?n.endOffset=e.endOffset:n.startOffset=NaN}cstPostTerminal(t,e){const n=this.CST_STACK[this.CST_STACK.length-1];var r,i,o;i=e,o=t,(r=n).children[o]===void 0?r.children[o]=[i]:r.children[o].push(i),this.setNodeLocationFromToken(n.location,e)}cstPostNonTerminal(t,e){const n=this.CST_STACK[this.CST_STACK.length-1];var r,i,o;i=e,o=t,(r=n).children[i]===void 0?r.children[i]=[o]:r.children[i].push(o),this.setNodeLocationFromNode(n.location,t.location)}getBaseCstVisitorConstructor(){if(Vt(this.baseCstVisitorConstructor)){const t=function(e,n){const r=function(){};return io(r,e+"BaseSemantics"),(r.prototype={visit:function(i,o){if(B(i)&&(i=i[0]),!Vt(i))return this[i.name](i.children,o)},validateVisitor:function(){const i=(o=this,Ue(b(Et(n,s=>Ht(o[s])===!1),s=>({msg:`Missing visitor method: <${s}> on ${o.constructor.name} CST Visitor.`,type:_r.MISSING_METHOD,methodName:s}))));var o;if(!K(i)){const s=b(i,a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
99
99
|
${s.join(`
|
|
100
100
|
|
|
101
101
|
`).replace(/\n/g,`
|
|
@@ -105,20 +105,20 @@ see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleN
|
|
|
105
105
|
Note that the first argument for the parser constructor
|
|
106
106
|
is no longer a Token vector (since v4.0).`);if(typeof t[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|
107
107
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
108
|
-
For Further details.`)}if(B(t))this.tokensMap=ft(t,(r,i)=>(r[i.name]=i,r),{});else if(P(t,"modes")&&Rt(yt(
|
|
109
|
-
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const r=P(n,"resyncEnabled")?n.resyncEnabled:Qe.resyncEnabled,i=P(n,"recoveryValueFunc")?n.recoveryValueFunc:Qe.recoveryValueFunc,o=this.ruleShortNameIdx<<12;let s;return this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=t,this.fullRuleNameToShort[t]=o,s=this.outputCst===!0?function(...a){try{this.ruleInvocationStateUpdate(o,t,this.subruleIdx),e.apply(this,a);const c=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(c),c}catch(c){return this.invokeRuleCatch(c,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...a){try{return this.ruleInvocationStateUpdate(o,t,this.subruleIdx),e.apply(this,a)}catch(c){return this.invokeRuleCatch(c,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(s,{ruleName:t,originalGrammarAction:e})}invokeRuleCatch(t,e,n){const r=this.RULE_STACK.length===1,i=e&&!this.isBackTracking()&&this.recoveryEnabled;if(Ye(t)){const o=t;if(i){const s=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(s)){if(o.resyncedTokens=this.reSyncTo(s),this.outputCst){const a=this.CST_STACK[this.CST_STACK.length-1];return a.recoveredNode=!0,a}return n(t)}if(this.outputCst){const a=this.CST_STACK[this.CST_STACK.length-1];a.recoveredNode=!0,o.partialCstResult=a}throw o}if(r)return this.moveToTerminatedState(),n(t);throw o}throw t}optionInternal(t,e){const n=this.getKeyForAutomaticLookahead(512,e);return this.optionInternalLogic(t,e,n)}optionInternalLogic(t,e,n){let r,i=this.getLaFuncFromCache(n);if(typeof t!="function"){r=t.DEF;const o=t.GATE;if(o!==void 0){const s=i;i=()=>o.call(this)&&s.call(this)}}else r=t;if(i.call(this)===!0)return r.call(this)}atLeastOneInternal(t,e){const n=this.getKeyForAutomaticLookahead(zn,t);return this.atLeastOneInternalLogic(t,e,n)}atLeastOneInternalLogic(t,e,n){let r,i=this.getLaFuncFromCache(n);if(typeof e!="function"){r=e.DEF;const o=e.GATE;if(o!==void 0){const s=i;i=()=>o.call(this)&&s.call(this)}}else r=e;if(i.call(this)!==!0)throw this.raiseEarlyExitException(t,Y.REPETITION_MANDATORY,e.ERR_MSG);{let o=this.doSingleRepetition(r);for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(r)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[t,e],i,zn,t,Ac)}atLeastOneSepFirstInternal(t,e){const n=this.getKeyForAutomaticLookahead(Xe,t);this.atLeastOneSepFirstInternalLogic(t,e,n)}atLeastOneSepFirstInternalLogic(t,e,n){const r=e.DEF,i=e.SEP;if(this.getLaFuncFromCache(n).call(this)!==!0)throw this.raiseEarlyExitException(t,Y.REPETITION_MANDATORY_WITH_SEPARATOR,e.ERR_MSG);{r.call(this);const o=()=>this.tokenMatcher(this.LA(1),i);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,i,o,r,Qi],o,Xe,t,Qi)}}manyInternal(t,e){const n=this.getKeyForAutomaticLookahead(768,t);return this.manyInternalLogic(t,e,n)}manyInternalLogic(t,e,n){let r,i=this.getLaFuncFromCache(n);if(typeof e!="function"){r=e.DEF;const s=e.GATE;if(s!==void 0){const a=i;i=()=>s.call(this)&&a.call(this)}}else r=e;let o=!0;for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[t,e],i,768,t,Tc,o)}manySepFirstInternal(t,e){const n=this.getKeyForAutomaticLookahead(Vn,t);this.manySepFirstInternalLogic(t,e,n)}manySepFirstInternalLogic(t,e,n){const r=e.DEF,i=e.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){r.call(this);const o=()=>this.tokenMatcher(this.LA(1),i);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,i,o,r,qi],o,Vn,t,qi)}}repetitionSepSecondInternal(t,e,n,r,i){for(;n();)this.CONSUME(e),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,e,n,r,i],n,Xe,t,i)}doSingleRepetition(t){const e=this.getLexerPosition();return t.call(this),this.getLexerPosition()>e}orInternal(t,e){const n=this.getKeyForAutomaticLookahead(256,e),r=B(t)?t:t.DEF,i=this.getLaFuncFromCache(n).call(this,r);if(i!==void 0)return r[i].ALT.call(this);this.raiseNoAltException(e,t.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const t=this.LA(1),e=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:t,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new xc(e,t))}}subruleInternal(t,e,n){let r;try{const i=n!==void 0?n.ARGS:void 0;return this.subruleIdx=e,r=t.apply(this,i),this.cstPostNonTerminal(r,n!==void 0&&n.LABEL!==void 0?n.LABEL:t.ruleName),r}catch(i){throw this.subruleInternalError(i,n,t.ruleName)}}subruleInternalError(t,e,n){throw Ye(t)&&t.partialCstResult!==void 0&&(this.cstPostNonTerminal(t.partialCstResult,e!==void 0&&e.LABEL!==void 0?e.LABEL:n),delete t.partialCstResult),t}consumeInternal(t,e,n){let r;try{const i=this.LA(1);this.tokenMatcher(i,t)===!0?(this.consumeToken(),r=i):this.consumeInternalError(t,i,n)}catch(i){r=this.consumeInternalRecovery(t,e,i)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:t.name,r),r}consumeInternalError(t,e,n){let r;const i=this.LA(0);throw r=n!==void 0&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:t,actual:e,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new eo(r,e,i))}consumeInternalRecovery(t,e,n){if(!this.recoveryEnabled||n.name!=="MismatchedTokenException"||this.isBackTracking())throw n;{const r=this.getFollowsForInRuleRecovery(t,e);try{return this.tryInRuleRecovery(t,r)}catch(i){throw i.name===ys?n:i}}}saveRecogState(){const t=this.errors,e=et(this.RULE_STACK);return{errors:t,lexerState:this.exportLexerState(),RULE_STACK:e,CST_STACK:this.CST_STACK}}reloadRecogState(t){this.errors=t.errors,this.importLexerState(t.lexerState),this.RULE_STACK=t.RULE_STACK}ruleInvocationStateUpdate(t,e,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(t),this.cstInvocationStateUpdate(e)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const t=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[t]}shortRuleNameToFullName(t){return this.shortRuleNameToFull[t]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),ne)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}},class{ACTION(t){return t.call(this)}consume(t,e,n){return this.consumeInternal(e,t,n)}subrule(t,e,n){return this.subruleInternal(e,t,n)}option(t,e){return this.optionInternal(e,t)}or(t,e){return this.orInternal(e,t)}many(t,e){return this.manyInternal(t,e)}atLeastOne(t,e){return this.atLeastOneInternal(t,e)}CONSUME(t,e){return this.consumeInternal(t,0,e)}CONSUME1(t,e){return this.consumeInternal(t,1,e)}CONSUME2(t,e){return this.consumeInternal(t,2,e)}CONSUME3(t,e){return this.consumeInternal(t,3,e)}CONSUME4(t,e){return this.consumeInternal(t,4,e)}CONSUME5(t,e){return this.consumeInternal(t,5,e)}CONSUME6(t,e){return this.consumeInternal(t,6,e)}CONSUME7(t,e){return this.consumeInternal(t,7,e)}CONSUME8(t,e){return this.consumeInternal(t,8,e)}CONSUME9(t,e){return this.consumeInternal(t,9,e)}SUBRULE(t,e){return this.subruleInternal(t,0,e)}SUBRULE1(t,e){return this.subruleInternal(t,1,e)}SUBRULE2(t,e){return this.subruleInternal(t,2,e)}SUBRULE3(t,e){return this.subruleInternal(t,3,e)}SUBRULE4(t,e){return this.subruleInternal(t,4,e)}SUBRULE5(t,e){return this.subruleInternal(t,5,e)}SUBRULE6(t,e){return this.subruleInternal(t,6,e)}SUBRULE7(t,e){return this.subruleInternal(t,7,e)}SUBRULE8(t,e){return this.subruleInternal(t,8,e)}SUBRULE9(t,e){return this.subruleInternal(t,9,e)}OPTION(t){return this.optionInternal(t,0)}OPTION1(t){return this.optionInternal(t,1)}OPTION2(t){return this.optionInternal(t,2)}OPTION3(t){return this.optionInternal(t,3)}OPTION4(t){return this.optionInternal(t,4)}OPTION5(t){return this.optionInternal(t,5)}OPTION6(t){return this.optionInternal(t,6)}OPTION7(t){return this.optionInternal(t,7)}OPTION8(t){return this.optionInternal(t,8)}OPTION9(t){return this.optionInternal(t,9)}OR(t){return this.orInternal(t,0)}OR1(t){return this.orInternal(t,1)}OR2(t){return this.orInternal(t,2)}OR3(t){return this.orInternal(t,3)}OR4(t){return this.orInternal(t,4)}OR5(t){return this.orInternal(t,5)}OR6(t){return this.orInternal(t,6)}OR7(t){return this.orInternal(t,7)}OR8(t){return this.orInternal(t,8)}OR9(t){return this.orInternal(t,9)}MANY(t){this.manyInternal(0,t)}MANY1(t){this.manyInternal(1,t)}MANY2(t){this.manyInternal(2,t)}MANY3(t){this.manyInternal(3,t)}MANY4(t){this.manyInternal(4,t)}MANY5(t){this.manyInternal(5,t)}MANY6(t){this.manyInternal(6,t)}MANY7(t){this.manyInternal(7,t)}MANY8(t){this.manyInternal(8,t)}MANY9(t){this.manyInternal(9,t)}MANY_SEP(t){this.manySepFirstInternal(0,t)}MANY_SEP1(t){this.manySepFirstInternal(1,t)}MANY_SEP2(t){this.manySepFirstInternal(2,t)}MANY_SEP3(t){this.manySepFirstInternal(3,t)}MANY_SEP4(t){this.manySepFirstInternal(4,t)}MANY_SEP5(t){this.manySepFirstInternal(5,t)}MANY_SEP6(t){this.manySepFirstInternal(6,t)}MANY_SEP7(t){this.manySepFirstInternal(7,t)}MANY_SEP8(t){this.manySepFirstInternal(8,t)}MANY_SEP9(t){this.manySepFirstInternal(9,t)}AT_LEAST_ONE(t){this.atLeastOneInternal(0,t)}AT_LEAST_ONE1(t){return this.atLeastOneInternal(1,t)}AT_LEAST_ONE2(t){this.atLeastOneInternal(2,t)}AT_LEAST_ONE3(t){this.atLeastOneInternal(3,t)}AT_LEAST_ONE4(t){this.atLeastOneInternal(4,t)}AT_LEAST_ONE5(t){this.atLeastOneInternal(5,t)}AT_LEAST_ONE6(t){this.atLeastOneInternal(6,t)}AT_LEAST_ONE7(t){this.atLeastOneInternal(7,t)}AT_LEAST_ONE8(t){this.atLeastOneInternal(8,t)}AT_LEAST_ONE9(t){this.atLeastOneInternal(9,t)}AT_LEAST_ONE_SEP(t){this.atLeastOneSepFirstInternal(0,t)}AT_LEAST_ONE_SEP1(t){this.atLeastOneSepFirstInternal(1,t)}AT_LEAST_ONE_SEP2(t){this.atLeastOneSepFirstInternal(2,t)}AT_LEAST_ONE_SEP3(t){this.atLeastOneSepFirstInternal(3,t)}AT_LEAST_ONE_SEP4(t){this.atLeastOneSepFirstInternal(4,t)}AT_LEAST_ONE_SEP5(t){this.atLeastOneSepFirstInternal(5,t)}AT_LEAST_ONE_SEP6(t){this.atLeastOneSepFirstInternal(6,t)}AT_LEAST_ONE_SEP7(t){this.atLeastOneSepFirstInternal(7,t)}AT_LEAST_ONE_SEP8(t){this.atLeastOneSepFirstInternal(8,t)}AT_LEAST_ONE_SEP9(t){this.atLeastOneSepFirstInternal(9,t)}RULE(t,e,n=Qe){if(at(this.definedRulesNames,t)){const i={message:re.buildDuplicateRuleNameError({topLevelRule:t,grammarName:this.className}),type:st.DUPLICATE_RULE_NAME,ruleName:t};this.definitionErrors.push(i)}this.definedRulesNames.push(t);const r=this.defineRule(t,e,n);return this[t]=r,r}OVERRIDE_RULE(t,e,n=Qe){const r=function(o,s,a){const c=[];let u;return at(s,o)||(u=`Invalid rule override, rule: ->${o}<- cannot be overridden in the grammar: ->${a}<-as it is not defined in any of the super grammars `,c.push({message:u,type:st.INVALID_RULE_OVERRIDE,ruleName:o})),c}(t,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);const i=this.defineRule(t,e,n);return this[t]=i,i}BACKTRACK(t,e){return function(){this.isBackTrackingStack.push(1);const n=this.saveRecogState();try{return t.apply(this,e),!0}catch(r){if(Ye(r))return!1;throw r}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return b(Z(this.gastProductionsCache),tn)}},class{initErrorHandler(t){this._errors=[],this.errorMessageProvider=P(t,"errorMessageProvider")?t.errorMessageProvider:Kt.errorMessageProvider}SAVE_ERROR(t){if(Ye(t))return t.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:et(this.RULE_OCCURRENCE_STACK)},this._errors.push(t),t;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return et(this._errors)}set errors(t){this._errors=t}raiseEarlyExitException(t,e,n){const r=this.getCurrRuleFullName(),i=vr(t,this.getGAstProductions()[r],e,this.maxLookahead)[0],o=[];for(let a=1;a<=this.maxLookahead;a++)o.push(this.LA(a));const s=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:o,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new Cc(s,this.LA(1),this.LA(0)))}raiseNoAltException(t,e){const n=this.getCurrRuleFullName(),r=Rr(t,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let a=1;a<=this.maxLookahead;a++)i.push(this.LA(a));const o=this.LA(0),s=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:o,customUserDescription:e,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Lc(s,this.LA(1),o))}},class{initContentAssist(){}computeContentAssist(t,e){const n=this.gastProductionsCache[t];if(Vt(n))throw Error(`Rule ->${t}<- does not exist in this grammar.`);return fs([n],e,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(t){const e=Ot(t.ruleStack),n=this.getGAstProductions()[e];return new gc(n,t).startWalking()}},class{initGastRecorder(t){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let t=0;t<10;t++){const e=t>0?t:"";this[`CONSUME${e}`]=function(n,r){return this.consumeInternalRecord(n,t,r)},this[`SUBRULE${e}`]=function(n,r){return this.subruleInternalRecord(n,t,r)},this[`OPTION${e}`]=function(n){return this.optionInternalRecord(n,t)},this[`OR${e}`]=function(n){return this.orInternalRecord(n,t)},this[`MANY${e}`]=function(n){this.manyInternalRecord(t,n)},this[`MANY_SEP${e}`]=function(n){this.manySepFirstInternalRecord(t,n)},this[`AT_LEAST_ONE${e}`]=function(n){this.atLeastOneInternalRecord(t,n)},this[`AT_LEAST_ONE_SEP${e}`]=function(n){this.atLeastOneSepFirstInternalRecord(t,n)}}this.consume=function(t,e,n){return this.consumeInternalRecord(e,t,n)},this.subrule=function(t,e,n){return this.subruleInternalRecord(e,t,n)},this.option=function(t,e){return this.optionInternalRecord(e,t)},this.or=function(t,e){return this.orInternalRecord(e,t)},this.many=function(t,e){this.manyInternalRecord(t,e)},this.atLeastOne=function(t,e){this.atLeastOneInternalRecord(t,e)},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",()=>{const t=this;for(let e=0;e<10;e++){const n=e>0?e:"";delete t[`CONSUME${n}`],delete t[`SUBRULE${n}`],delete t[`OPTION${n}`],delete t[`OR${n}`],delete t[`MANY${n}`],delete t[`MANY_SEP${n}`],delete t[`AT_LEAST_ONE${n}`],delete t[`AT_LEAST_ONE_SEP${n}`]}delete t.consume,delete t.subrule,delete t.option,delete t.or,delete t.many,delete t.atLeastOne,delete t.ACTION,delete t.BACKTRACK,delete t.LA})}ACTION_RECORD(t){}BACKTRACK_RECORD(t,e){return()=>!0}LA_RECORD(t){return on}topLevelRuleRecord(t,e){try{const n=new Ee({definition:[],name:t});return n.name=t,this.recordingProdStack.push(n),e.call(this),this.recordingProdStack.pop(),n}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+`
|
|
108
|
+
For Further details.`)}if(B(t))this.tokensMap=ft(t,(r,i)=>(r[i.name]=i,r),{});else if(P(t,"modes")&&Rt(yt(Q(t.modes)),dc)){const r=Er(yt(Q(t.modes)));this.tokensMap=ft(r,(i,o)=>(i[o.name]=o,i),{})}else{if(!It(t))throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=et(t)}this.tokensMap.EOF=ne;const n=Rt(P(t,"modes")?yt(Q(t.modes)):Q(t),r=>K(r.categoryMatches));this.tokenMatcher=n?mn:Ce,We(Q(this.tokensMap))}defineRule(t,e,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${t}> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
109
|
+
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const r=P(n,"resyncEnabled")?n.resyncEnabled:Ze.resyncEnabled,i=P(n,"recoveryValueFunc")?n.recoveryValueFunc:Ze.recoveryValueFunc,o=this.ruleShortNameIdx<<12;let s;return this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=t,this.fullRuleNameToShort[t]=o,s=this.outputCst===!0?function(...a){try{this.ruleInvocationStateUpdate(o,t,this.subruleIdx),e.apply(this,a);const c=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(c),c}catch(c){return this.invokeRuleCatch(c,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...a){try{return this.ruleInvocationStateUpdate(o,t,this.subruleIdx),e.apply(this,a)}catch(c){return this.invokeRuleCatch(c,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(s,{ruleName:t,originalGrammarAction:e})}invokeRuleCatch(t,e,n){const r=this.RULE_STACK.length===1,i=e&&!this.isBackTracking()&&this.recoveryEnabled;if(Ye(t)){const o=t;if(i){const s=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(s)){if(o.resyncedTokens=this.reSyncTo(s),this.outputCst){const a=this.CST_STACK[this.CST_STACK.length-1];return a.recoveredNode=!0,a}return n(t)}if(this.outputCst){const a=this.CST_STACK[this.CST_STACK.length-1];a.recoveredNode=!0,o.partialCstResult=a}throw o}if(r)return this.moveToTerminatedState(),n(t);throw o}throw t}optionInternal(t,e){const n=this.getKeyForAutomaticLookahead(512,e);return this.optionInternalLogic(t,e,n)}optionInternalLogic(t,e,n){let r,i=this.getLaFuncFromCache(n);if(typeof t!="function"){r=t.DEF;const o=t.GATE;if(o!==void 0){const s=i;i=()=>o.call(this)&&s.call(this)}}else r=t;if(i.call(this)===!0)return r.call(this)}atLeastOneInternal(t,e){const n=this.getKeyForAutomaticLookahead(zn,t);return this.atLeastOneInternalLogic(t,e,n)}atLeastOneInternalLogic(t,e,n){let r,i=this.getLaFuncFromCache(n);if(typeof e!="function"){r=e.DEF;const o=e.GATE;if(o!==void 0){const s=i;i=()=>o.call(this)&&s.call(this)}}else r=e;if(i.call(this)!==!0)throw this.raiseEarlyExitException(t,Y.REPETITION_MANDATORY,e.ERR_MSG);{let o=this.doSingleRepetition(r);for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(r)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[t,e],i,zn,t,Ac)}atLeastOneSepFirstInternal(t,e){const n=this.getKeyForAutomaticLookahead(Xe,t);this.atLeastOneSepFirstInternalLogic(t,e,n)}atLeastOneSepFirstInternalLogic(t,e,n){const r=e.DEF,i=e.SEP;if(this.getLaFuncFromCache(n).call(this)!==!0)throw this.raiseEarlyExitException(t,Y.REPETITION_MANDATORY_WITH_SEPARATOR,e.ERR_MSG);{r.call(this);const o=()=>this.tokenMatcher(this.LA(1),i);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,i,o,r,Zi],o,Xe,t,Zi)}}manyInternal(t,e){const n=this.getKeyForAutomaticLookahead(768,t);return this.manyInternalLogic(t,e,n)}manyInternalLogic(t,e,n){let r,i=this.getLaFuncFromCache(n);if(typeof e!="function"){r=e.DEF;const s=e.GATE;if(s!==void 0){const a=i;i=()=>s.call(this)&&a.call(this)}}else r=e;let o=!0;for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[t,e],i,768,t,Tc,o)}manySepFirstInternal(t,e){const n=this.getKeyForAutomaticLookahead(Vn,t);this.manySepFirstInternalLogic(t,e,n)}manySepFirstInternalLogic(t,e,n){const r=e.DEF,i=e.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){r.call(this);const o=()=>this.tokenMatcher(this.LA(1),i);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,i,o,r,qi],o,Vn,t,qi)}}repetitionSepSecondInternal(t,e,n,r,i){for(;n();)this.CONSUME(e),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,e,n,r,i],n,Xe,t,i)}doSingleRepetition(t){const e=this.getLexerPosition();return t.call(this),this.getLexerPosition()>e}orInternal(t,e){const n=this.getKeyForAutomaticLookahead(256,e),r=B(t)?t:t.DEF,i=this.getLaFuncFromCache(n).call(this,r);if(i!==void 0)return r[i].ALT.call(this);this.raiseNoAltException(e,t.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const t=this.LA(1),e=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:t,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new xc(e,t))}}subruleInternal(t,e,n){let r;try{const i=n!==void 0?n.ARGS:void 0;return this.subruleIdx=e,r=t.apply(this,i),this.cstPostNonTerminal(r,n!==void 0&&n.LABEL!==void 0?n.LABEL:t.ruleName),r}catch(i){throw this.subruleInternalError(i,n,t.ruleName)}}subruleInternalError(t,e,n){throw Ye(t)&&t.partialCstResult!==void 0&&(this.cstPostNonTerminal(t.partialCstResult,e!==void 0&&e.LABEL!==void 0?e.LABEL:n),delete t.partialCstResult),t}consumeInternal(t,e,n){let r;try{const i=this.LA(1);this.tokenMatcher(i,t)===!0?(this.consumeToken(),r=i):this.consumeInternalError(t,i,n)}catch(i){r=this.consumeInternalRecovery(t,e,i)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:t.name,r),r}consumeInternalError(t,e,n){let r;const i=this.LA(0);throw r=n!==void 0&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:t,actual:e,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new eo(r,e,i))}consumeInternalRecovery(t,e,n){if(!this.recoveryEnabled||n.name!=="MismatchedTokenException"||this.isBackTracking())throw n;{const r=this.getFollowsForInRuleRecovery(t,e);try{return this.tryInRuleRecovery(t,r)}catch(i){throw i.name===ys?n:i}}}saveRecogState(){const t=this.errors,e=et(this.RULE_STACK);return{errors:t,lexerState:this.exportLexerState(),RULE_STACK:e,CST_STACK:this.CST_STACK}}reloadRecogState(t){this.errors=t.errors,this.importLexerState(t.lexerState),this.RULE_STACK=t.RULE_STACK}ruleInvocationStateUpdate(t,e,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(t),this.cstInvocationStateUpdate(e)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const t=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[t]}shortRuleNameToFullName(t){return this.shortRuleNameToFull[t]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),ne)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}},class{ACTION(t){return t.call(this)}consume(t,e,n){return this.consumeInternal(e,t,n)}subrule(t,e,n){return this.subruleInternal(e,t,n)}option(t,e){return this.optionInternal(e,t)}or(t,e){return this.orInternal(e,t)}many(t,e){return this.manyInternal(t,e)}atLeastOne(t,e){return this.atLeastOneInternal(t,e)}CONSUME(t,e){return this.consumeInternal(t,0,e)}CONSUME1(t,e){return this.consumeInternal(t,1,e)}CONSUME2(t,e){return this.consumeInternal(t,2,e)}CONSUME3(t,e){return this.consumeInternal(t,3,e)}CONSUME4(t,e){return this.consumeInternal(t,4,e)}CONSUME5(t,e){return this.consumeInternal(t,5,e)}CONSUME6(t,e){return this.consumeInternal(t,6,e)}CONSUME7(t,e){return this.consumeInternal(t,7,e)}CONSUME8(t,e){return this.consumeInternal(t,8,e)}CONSUME9(t,e){return this.consumeInternal(t,9,e)}SUBRULE(t,e){return this.subruleInternal(t,0,e)}SUBRULE1(t,e){return this.subruleInternal(t,1,e)}SUBRULE2(t,e){return this.subruleInternal(t,2,e)}SUBRULE3(t,e){return this.subruleInternal(t,3,e)}SUBRULE4(t,e){return this.subruleInternal(t,4,e)}SUBRULE5(t,e){return this.subruleInternal(t,5,e)}SUBRULE6(t,e){return this.subruleInternal(t,6,e)}SUBRULE7(t,e){return this.subruleInternal(t,7,e)}SUBRULE8(t,e){return this.subruleInternal(t,8,e)}SUBRULE9(t,e){return this.subruleInternal(t,9,e)}OPTION(t){return this.optionInternal(t,0)}OPTION1(t){return this.optionInternal(t,1)}OPTION2(t){return this.optionInternal(t,2)}OPTION3(t){return this.optionInternal(t,3)}OPTION4(t){return this.optionInternal(t,4)}OPTION5(t){return this.optionInternal(t,5)}OPTION6(t){return this.optionInternal(t,6)}OPTION7(t){return this.optionInternal(t,7)}OPTION8(t){return this.optionInternal(t,8)}OPTION9(t){return this.optionInternal(t,9)}OR(t){return this.orInternal(t,0)}OR1(t){return this.orInternal(t,1)}OR2(t){return this.orInternal(t,2)}OR3(t){return this.orInternal(t,3)}OR4(t){return this.orInternal(t,4)}OR5(t){return this.orInternal(t,5)}OR6(t){return this.orInternal(t,6)}OR7(t){return this.orInternal(t,7)}OR8(t){return this.orInternal(t,8)}OR9(t){return this.orInternal(t,9)}MANY(t){this.manyInternal(0,t)}MANY1(t){this.manyInternal(1,t)}MANY2(t){this.manyInternal(2,t)}MANY3(t){this.manyInternal(3,t)}MANY4(t){this.manyInternal(4,t)}MANY5(t){this.manyInternal(5,t)}MANY6(t){this.manyInternal(6,t)}MANY7(t){this.manyInternal(7,t)}MANY8(t){this.manyInternal(8,t)}MANY9(t){this.manyInternal(9,t)}MANY_SEP(t){this.manySepFirstInternal(0,t)}MANY_SEP1(t){this.manySepFirstInternal(1,t)}MANY_SEP2(t){this.manySepFirstInternal(2,t)}MANY_SEP3(t){this.manySepFirstInternal(3,t)}MANY_SEP4(t){this.manySepFirstInternal(4,t)}MANY_SEP5(t){this.manySepFirstInternal(5,t)}MANY_SEP6(t){this.manySepFirstInternal(6,t)}MANY_SEP7(t){this.manySepFirstInternal(7,t)}MANY_SEP8(t){this.manySepFirstInternal(8,t)}MANY_SEP9(t){this.manySepFirstInternal(9,t)}AT_LEAST_ONE(t){this.atLeastOneInternal(0,t)}AT_LEAST_ONE1(t){return this.atLeastOneInternal(1,t)}AT_LEAST_ONE2(t){this.atLeastOneInternal(2,t)}AT_LEAST_ONE3(t){this.atLeastOneInternal(3,t)}AT_LEAST_ONE4(t){this.atLeastOneInternal(4,t)}AT_LEAST_ONE5(t){this.atLeastOneInternal(5,t)}AT_LEAST_ONE6(t){this.atLeastOneInternal(6,t)}AT_LEAST_ONE7(t){this.atLeastOneInternal(7,t)}AT_LEAST_ONE8(t){this.atLeastOneInternal(8,t)}AT_LEAST_ONE9(t){this.atLeastOneInternal(9,t)}AT_LEAST_ONE_SEP(t){this.atLeastOneSepFirstInternal(0,t)}AT_LEAST_ONE_SEP1(t){this.atLeastOneSepFirstInternal(1,t)}AT_LEAST_ONE_SEP2(t){this.atLeastOneSepFirstInternal(2,t)}AT_LEAST_ONE_SEP3(t){this.atLeastOneSepFirstInternal(3,t)}AT_LEAST_ONE_SEP4(t){this.atLeastOneSepFirstInternal(4,t)}AT_LEAST_ONE_SEP5(t){this.atLeastOneSepFirstInternal(5,t)}AT_LEAST_ONE_SEP6(t){this.atLeastOneSepFirstInternal(6,t)}AT_LEAST_ONE_SEP7(t){this.atLeastOneSepFirstInternal(7,t)}AT_LEAST_ONE_SEP8(t){this.atLeastOneSepFirstInternal(8,t)}AT_LEAST_ONE_SEP9(t){this.atLeastOneSepFirstInternal(9,t)}RULE(t,e,n=Ze){if(at(this.definedRulesNames,t)){const i={message:re.buildDuplicateRuleNameError({topLevelRule:t,grammarName:this.className}),type:st.DUPLICATE_RULE_NAME,ruleName:t};this.definitionErrors.push(i)}this.definedRulesNames.push(t);const r=this.defineRule(t,e,n);return this[t]=r,r}OVERRIDE_RULE(t,e,n=Ze){const r=function(o,s,a){const c=[];let u;return at(s,o)||(u=`Invalid rule override, rule: ->${o}<- cannot be overridden in the grammar: ->${a}<-as it is not defined in any of the super grammars `,c.push({message:u,type:st.INVALID_RULE_OVERRIDE,ruleName:o})),c}(t,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);const i=this.defineRule(t,e,n);return this[t]=i,i}BACKTRACK(t,e){return function(){this.isBackTrackingStack.push(1);const n=this.saveRecogState();try{return t.apply(this,e),!0}catch(r){if(Ye(r))return!1;throw r}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return b(Q(this.gastProductionsCache),tn)}},class{initErrorHandler(t){this._errors=[],this.errorMessageProvider=P(t,"errorMessageProvider")?t.errorMessageProvider:Kt.errorMessageProvider}SAVE_ERROR(t){if(Ye(t))return t.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:et(this.RULE_OCCURRENCE_STACK)},this._errors.push(t),t;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return et(this._errors)}set errors(t){this._errors=t}raiseEarlyExitException(t,e,n){const r=this.getCurrRuleFullName(),i=vr(t,this.getGAstProductions()[r],e,this.maxLookahead)[0],o=[];for(let a=1;a<=this.maxLookahead;a++)o.push(this.LA(a));const s=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:o,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new Cc(s,this.LA(1),this.LA(0)))}raiseNoAltException(t,e){const n=this.getCurrRuleFullName(),r=Rr(t,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let a=1;a<=this.maxLookahead;a++)i.push(this.LA(a));const o=this.LA(0),s=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:o,customUserDescription:e,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Lc(s,this.LA(1),o))}},class{initContentAssist(){}computeContentAssist(t,e){const n=this.gastProductionsCache[t];if(Vt(n))throw Error(`Rule ->${t}<- does not exist in this grammar.`);return fs([n],e,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(t){const e=Ot(t.ruleStack),n=this.getGAstProductions()[e];return new gc(n,t).startWalking()}},class{initGastRecorder(t){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let t=0;t<10;t++){const e=t>0?t:"";this[`CONSUME${e}`]=function(n,r){return this.consumeInternalRecord(n,t,r)},this[`SUBRULE${e}`]=function(n,r){return this.subruleInternalRecord(n,t,r)},this[`OPTION${e}`]=function(n){return this.optionInternalRecord(n,t)},this[`OR${e}`]=function(n){return this.orInternalRecord(n,t)},this[`MANY${e}`]=function(n){this.manyInternalRecord(t,n)},this[`MANY_SEP${e}`]=function(n){this.manySepFirstInternalRecord(t,n)},this[`AT_LEAST_ONE${e}`]=function(n){this.atLeastOneInternalRecord(t,n)},this[`AT_LEAST_ONE_SEP${e}`]=function(n){this.atLeastOneSepFirstInternalRecord(t,n)}}this.consume=function(t,e,n){return this.consumeInternalRecord(e,t,n)},this.subrule=function(t,e,n){return this.subruleInternalRecord(e,t,n)},this.option=function(t,e){return this.optionInternalRecord(e,t)},this.or=function(t,e){return this.orInternalRecord(e,t)},this.many=function(t,e){this.manyInternalRecord(t,e)},this.atLeastOne=function(t,e){this.atLeastOneInternalRecord(t,e)},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",()=>{const t=this;for(let e=0;e<10;e++){const n=e>0?e:"";delete t[`CONSUME${n}`],delete t[`SUBRULE${n}`],delete t[`OPTION${n}`],delete t[`OR${n}`],delete t[`MANY${n}`],delete t[`MANY_SEP${n}`],delete t[`AT_LEAST_ONE${n}`],delete t[`AT_LEAST_ONE_SEP${n}`]}delete t.consume,delete t.subrule,delete t.option,delete t.or,delete t.many,delete t.atLeastOne,delete t.ACTION,delete t.BACKTRACK,delete t.LA})}ACTION_RECORD(t){}BACKTRACK_RECORD(t,e){return()=>!0}LA_RECORD(t){return on}topLevelRuleRecord(t,e){try{const n=new Ee({definition:[],name:t});return n.name=t,this.recordingProdStack.push(n),e.call(this),this.recordingProdStack.pop(),n}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+`
|
|
110
110
|
This error was thrown during the "grammar recording phase" For more info see:
|
|
111
111
|
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(t,e){return Re.call(this,lt,t,e)}atLeastOneInternalRecord(t,e){Re.call(this,Ut,e,t)}atLeastOneSepFirstInternalRecord(t,e){Re.call(this,Ft,e,t,oo)}manyInternalRecord(t,e){Re.call(this,J,e,t)}manySepFirstInternalRecord(t,e){Re.call(this,_t,e,t,oo)}orInternalRecord(t,e){return Uc.call(this,t,e)}subruleInternalRecord(t,e,n){if(En(e),!t||P(t,"ruleName")===!1){const s=new Error(`<SUBRULE${ao(e)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(t)}>
|
|
112
112
|
inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}const r=pe(this.recordingProdStack),i=t.ruleName,o=new pt({idx:e,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(o),this.outputCst?Mc:xn}consumeInternalRecord(t,e,n){if(En(e),!us(t)){const o=new Error(`<CONSUME${ao(e)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(t)}>
|
|
113
|
-
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const r=pe(this.recordingProdStack),i=new V({idx:e,terminalType:t,label:n?.LABEL});return r.definition.push(i),vs}},class{initPerformanceTracer(t){if(P(t,"traceInitPerf")){const e=t.traceInitPerf,n=typeof e=="number";this.traceInitMaxIdent=n?e:1/0,this.traceInitPerf=n?e>0:e}else this.traceInitMaxIdent=0,this.traceInitPerf=Kt.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(t,e){if(this.traceInitPerf===!0){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${t}>`);const{time:r,value:i}=rs(e),o=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${n}<-- <${t}> time: ${r}ms`),this.traceInitIndent--,i}return e()}}].forEach(t=>{const e=t.prototype;Object.getOwnPropertyNames(e).forEach(n=>{if(n==="constructor")return;const r=Object.getOwnPropertyDescriptor(e,n);r&&(r.get||r.set)?Object.defineProperty(Yn.prototype,n,r):Yn.prototype[n]=t.prototype[n]})});class Fc extends De{constructor(e,n=Kt){const r=et(n);r.outputCst=!1,super(e,r)}}const Dc=D({name:"WhiteSpace",pattern:/\s+/,group:ot.SKIPPED}),Os=D({name:"String",pattern:/"(""|[^"])*"/}),jc=D({name:"SingleQuotedString",pattern:/'(''|[^'])*'/}),Bc=D({name:"SheetQuoted",pattern:/'((?![\\/[\]*?:]).)+?'!/}),$c=D({name:"FunctionToken",pattern:/[A-Za-z_]+[A-Za-z_0-9.]*\(/}),Ss=D({name:"NamedTableReference",pattern:/[A-Za-z_]+[A-Za-z_0-9.]*\[/}),Wc=D({name:"BracketedString",pattern:/\[([^[\]]*)\]/,longer_alt:[Ss,Os]}),_s=D({name:"LiteralError",pattern:/#PARSE!|#NULL!|#DIV\/0!|#VALUE!|#NUM!|#FIELD!|#N\/A|#GETTING_DATA|#SPILL!|#CONNECT!|#BLOCKED!|#UNKNOWN!|#FIELD!|#CALC!|#BUSY!|#PYTHON!|#TIMEOUT!/}),Ls=D({name:"RefError",pattern:/#REF!|#NAME\?/}),Gc=D({name:"Sheet",pattern:/[A-Za-z_.\d\u007F-\uFFFF]+!/}),Kc=/^[a-zA-Z_][a-zA-Z0-9_.?]*:?/,Cn=D({name:"Name",pattern:{exec:(t,e)=>{try{const n=Kc.exec(t.substring(e));if(n){const r=n[0];if(r.endsWith(":")){const i=r.length;return r[i-2]==="."?[r.substring(0,i-2)]:[r.substring(0,i-1)]}return[r]}}catch(n){console.warn("Error parsing name",n)}return null}},line_breaks:!1,start_chars_hint:(()=>{const t=[];for(let e=65;e<=90;e++)t.push(e);for(let e=97;e<=122;e++)t.push(e);for(let e=48;e<=57;e++)t.push(e);return t})()}),zc=D({name:"Cell",pattern:/[$]?[A-Za-z]{1,3}[$]?[1-9][0-9]*/,longer_alt:Cn}),Vc=D({name:"Column",pattern:/[$]?[A-Za-z]{1,3}/,longer_alt:Cn}),Hc=D({name:"AbsRow",pattern:/[$][0-9]+/,longer_alt:Cn}),Yc=D({name:"NumberToken",pattern:/[0-9]+[.]?[0-9]*([eE][+-][0-9]+)?/}),Xc=D({name:"Boolean",pattern:/TRUE|FALSE/i}),qc=D({name:"Comma",pattern:/,/}),Qc=D({name:"RangeUnion",pattern:/:/}),Zc=D({name:"RangeTrimFull",pattern:/\.:\./}),Jc=D({name:"RangeTrimLeading",pattern:/\.:/}),tu=D({name:"RangeTrimTrailing",pattern:/:\./}),eu=D({name:"Semicolon",pattern:/;/}),nu=D({name:"OpenParen",pattern:/\(/}),ru=D({name:"CloseParen",pattern:/\)/}),iu=D({name:"OpenSquareParen",pattern:/\[/}),ou=D({name:"CloseSquareParen",pattern:/]/});D({name:"exclamationMark",pattern:/!/});const su=D({name:"OpenCurlyParen",pattern:/{/}),au=D({name:"CloseCurlyParen",pattern:/}/}),cu=D({name:"QuoteS",pattern:/'/}),co=D({name:"MulOp",pattern:/\*/}),uu=D({name:"PlusOp",pattern:/\+/}),lu=D({name:"DivOp",pattern:/\//}),hu=D({name:"MinOp",pattern:/-/}),fu=D({name:"ImplicitIntersectOp",pattern:/@/}),du=D({name:"ConcatOp",pattern:/&/}),pu=D({name:"ExOp",pattern:/\^/}),mu=D({name:"PercentOp",pattern:/%/}),xs=D({name:"TableSpecifier",pattern:/#(All|Data|Headers|Totals|This Row)/i}),Eu=D({name:"ArrayAnchorOp",pattern:/#/,longer_alt:[xs,_s,Ls]}),gu=D({name:"GtOp",pattern:/>/}),Tu=D({name:"EqOp",pattern:/=/}),Au=D({name:"LtOp",pattern:/</}),Cs=[Dc,Os,Bc,jc,$c,Ss,Wc,_s,Ls,Gc,zc,Xc,Vc,Hc,xs,Eu,fu,Cn,Yc,qc,Zc,Jc,tu,Qc,eu,nu,ru,iu,ou,su,au,cu,co,uu,lu,hu,du,pu,co,mu,D({name:"NeqOp",pattern:/<>/}),D({name:"GteOp",pattern:/>=/}),D({name:"LteOp",pattern:/<=/}),gu,Tu,Au],Iu=new ot(Cs,{ensureOptimizations:!0}),Gr={};Cs.forEach(t=>{Gr[t.name]=t});const qt={boolean:3,string:2,number:1},Nu=(t,e)=>{let n=t+e;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},yu=(t,e)=>{let n=t-e;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},ks=(t,e)=>{let n=t*e;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},bs=(t,e)=>{if(e===0)return 1/0;let n=t/e;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},Ru=(t,e)=>{const n=t**e;return isFinite(n)?n:Number.NaN},vu=(t="",e="")=>(t===null&&(t=""),e===null&&(e=""),typeof t=="boolean"&&(t=t?"TRUE":"FALSE"),typeof e=="boolean"&&(e=e?"TRUE":"FALSE"),""+t+e),Ou=(t=null,e=null)=>typeof t==typeof e&&t===e,Su=(t=null,e=null)=>typeof t!=typeof e||t!==e,_u=(t=null,e=null)=>{const n=typeof t,r=typeof e;return n===r?t>e:qt[n]>qt[r]},Lu=(t=null,e=null)=>{const n=typeof t,r=typeof e;return n===r?t>=e:qt[n]>=qt[r]},xu=(t=null,e=null)=>{const n=typeof t,r=typeof e;return n===r?t<e:qt[n]<qt[r]},Cu=(t=null,e=null)=>{const n=typeof t,r=typeof e;return n===r?t<=e:qt[n]<=qt[r]},ku={type:_.M.Number,coerce:!0,includeBoolean:!0,includeMistyped:!0,mismatchFill:_.n.BuiltIn.NA},bu={type:_.M.String,coerce:!0,includeMistyped:!0,mismatchFill:_.n.BuiltIn.NA},Ps={type:null,coerce:!0,includeMistyped:!0,mismatchFill:_.n.BuiltIn.NA},le=(t,e,n,r)=>{if(e!==null&&e.colStart!==void 0&&(e=t.getValueAt(e.rowStart,e.colStart)),n!==null&&n.colStart!==void 0&&(n=t.getValueAt(n.rowStart,n.colStart)),typeof e=="number"&&typeof n=="number")return r(e,n);let i,o;return e?.isIRange?i=e:n?.isIRange&&(o=n),i||o?(i||(i=t.getRange(e)),i.broadcast(n,r,ku).fillEmpty(0)):(e=_.Qt(e,_.ht$1(e,!0),_.M.Number,!0,!1),n=_.Qt(n,_.ht$1(n,!0),_.M.Number,!0,!1),e instanceof _.n.Value?e:n instanceof _.n.Value?n:r(e,n))},ce=(t,e,n,r)=>{let i,o;return e!==null&&e.colStart!==void 0&&(e=t.getValueAt(e.rowStart,e.colStart)),n!==null&&n.colStart!==void 0&&(n=t.getValueAt(n.rowStart,n.colStart)),e?.isIRange?(i=e,o=n):n?.isIRange&&(i=n,o=e),i?i.broadcast(o,r,Ps):r(e,n)},uo=(t,e)=>{e==null&&(e=0);let n,r=1;if(t==="+")return e;if(t!=="-")throw new _.n.Value(`Unrecognized prefix: ${t}`);return r=-r,e?.isIRange&&(n=e),n?n.broadcast(r,ks,Ps):typeof(e=_.Qt(e,_.ht$1(e,!0),_.M.Number))!="number"||isNaN(e)?_.n.BuiltIn.Value:e*r},ve=(t,e,n,r)=>{if(!e||(e.isIReferenceRange&&(e=e.getCoords()),e.colStart===void 0)||(n.isIReferenceRange&&(n=n.getCoords()),n.colStart===void 0))return _.n.BuiltIn.Ref;const i=r(e,n);return i?t.getReference(i):_.n.BuiltIn.Null},Pu={"+":(t,e,n)=>le(t,e,n,Nu),"-":(t,e,n)=>le(t,e,n,yu),"*":(t,e,n)=>le(t,e,n,ks),"/":(t,e,n)=>le(t,e,n,bs),"^":(t,e,n)=>le(t,e,n,Ru)," ":(t,e,n,r)=>ve(t,e,n,_.Kt.intersectRanges),":":(t,e,n,r)=>ve(t,e,n,_.Kt.unionRanges),".:.":(t,e,n,r)=>{const i=ve(t,e,n,_.Kt.unionRanges);return t.getFunction("TRIMRANGE").execute(i,3,3)},".:":(t,e,n,r)=>{const i=ve(t,e,n,_.Kt.unionRanges);return t.getFunction("TRIMRANGE").execute(i,1,1)},":.":(t,e,n,r)=>{const i=ve(t,e,n,_.Kt.unionRanges);return t.getFunction("TRIMRANGE").execute(i,2,2)},"&":(t,e,n)=>((r,i,o,s)=>{if(i!==null&&i.colStart!==void 0&&(i=r.getValueAt(i.rowStart,i.colStart)),o!==null&&o.colStart!==void 0&&(o=r.getValueAt(o.rowStart,o.colStart)),typeof i=="string"&&typeof o=="string")return s(i,o);let a,c;return i?.isIRange?a=i:o?.isIRange&&(c=o),a||c?(a||(a=r.getRange(i)),a.broadcast(o,s,bu)):s(i=_.Qt(i,_.ht$1(i,!0),_.M.String),o=_.Qt(o,_.ht$1(o,!0),_.M.String))})(t,e,n,vu),"=":(t,e,n)=>ce(t,e,n,Ou),"<>":(t,e,n)=>ce(t,e,n,Su),">":(t,e,n)=>ce(t,e,n,_u),"<":(t,e,n)=>ce(t,e,n,xu),">=":(t,e,n)=>ce(t,e,n,Lu),"<=":(t,e,n)=>ce(t,e,n,Cu)},wu={"-":(t,e)=>uo("-",e),"+":(t,e)=>uo("+",e),"@":(t,e)=>{if(!e||!e.isIReferenceRange)return e;const n=e.getCoords(),r=e,i=t.getPosition(),o=r.getHeight(),s=r.getWidth();if(s>1&&o>1)return _.n.BuiltIn.Value;if(o>1){const a=i.rowIndex-n.rowStart;if(a>=0&&a<o)return r.getValueAt(a,0)}else{if(!(s>1))return r.getValueAt(0,0);{const a=i.colIndex-n.colStart;if(a>=0&&a<s)return r.getValueAt(0,a)}}return _.n.BuiltIn.Value}},Mu={"%":(t,e)=>le(t,e,100,bs),"#":(t,e)=>t.getSpillAt(e.rowStart,e.colStart)||_.n.BuiltIn.Ref};function lo(t){const e=(t=t.toUpperCase()).length;let n=0;for(let r=0;r<e;r++){const i=t.charCodeAt(r);isNaN(i)||(n+=(i-64)*26**(e-r-1))}return n}function Xn(t){return{type:"cell",value:Object.freeze({colIndex:t.colIndex,rowIndex:t.rowIndex,$colIndex:t.$colIndex||!1,$rowIndex:t.$rowIndex||!1}),inputs:null,isReference:!0}}function ho(t,e){const n=t.startsWith("$");n&&(t=t.substring(1));let r=parseInt(t)-1;return n||r===Number.MIN_SAFE_INTEGER||(r-=e.colIndex),{type:"cell",value:Object.freeze({colIndex:Number.MIN_SAFE_INTEGER,$colIndex:!1,rowIndex:r,$rowIndex:n}),inputs:null,isReference:!0}}function fo(t,e){return{type:"function",value:t=t.toUpperCase(),inputs:e}}function qn(t,e){return{type:"tableReference",value:t,inputs:e}}function Qn(t){return{type:"tableSpecifier",value:t,inputs:null,isReference:!0}}function Lr(t,e,n,r=!1){const i={type:"infix",value:t,inputs:[e,n]};return r&&(i.isReference=!0),i}function Zn(t,e,n=!1){const r={type:"postfix",value:t,inputs:[e]};return n&&(r.isReference=!0),r}function _e(t,e,n=!1){const r={type:"prefix",value:t,inputs:[e]};return n&&(r.isReference=!0),r}function Jn(t){return{type:"named",value:t,inputs:null,isReference:!0}}function po(t){return{type:"number",value:Number(t),isLiteral:!0}}function tr(t){let e=t;const n=t&&t.length>1&&t[0]==='"'&&t[t.length-1]==='"';return n&&(e=t.substring(1,t.length-1)),{type:n?"quotedString":"string",value:e,isLiteral:!0}}function mo(t){return{type:"boolean",value:t==="TRUE"||t.toUpperCase()==="TRUE",isLiteral:!0}}function Eo(t){return{type:"error",value:_.n.getBuiltInByLabel(t.toUpperCase()),isLiteral:!0}}function gn(t){return{type:"error",value:t?_.n.getBuiltInByLabel(t.toUpperCase()):_.n.BuiltIn.Ref,inputs:null,isReference:!0}}function je(t,e){return function n(r,i){const o=r.inputs;let s;if(o){const u=o.length;for(let l=0;l<u;l++){const h=o[l],N=n(h,r);N!==h&&(s||(s=[...o]),s[l]=N)}}const a=s?{...r,inputs:s}:r,c=e(a,i);return c===void 0?a:c}(t,void 0)||this}function sn(t,e){let n=0,r=je(t,g=>{const A={...g};return A.evalIndex=n++,A});const i=new Array(n),o=new Set,s=new Map;let a;const c=new Map,u=[],l=[];r=je(r,(g,A)=>{const v=g.type,f=g.evalIndex;if(i[f]=null,g.isReference){const d=g,I={node:g,index:c.size,op:null,value:null,inputs:null};if(c.set(d,I),v==="cell"){const E=d.value;return E.$colIndex&&(I.hasHorizontalAbs=!0),E.$rowIndex&&(I.hasVerticalAbs=!0),I.value=s.size,s.set(d,s.size),o.add(I),g.refIndex=l.length,void l.push(I.index)}if(v==="infix"||v==="prefix"||v==="postfix"||v==="spill"){const E=d.inputs,R=E.length,U=g.value;I.op=U;const x=new Array(R);I.inputs=x;for(let O=0;O<R;O++){const w=E[O],C=c.get(w);C&&(C.hasHorizontalAbs&&(I.hasHorizontalAbs=!0),C.hasVerticalAbs&&(I.hasVerticalAbs=!0)),x[O]=C?C.index:-1,o.delete(C)}if(o.add(I),ws.includes(U)){const O=E[0],w=!!O&&O.type==="cell",C=E[1],k=!!C&&C.type==="cell";w&&k&&(l.splice(C.refIndex,1),C.refIndex=O.refIndex,g.refIndex=O.refIndex,l[O.refIndex]=I.index)}else U==="#"&&(g.refIndex=E[0].refIndex);return void u.push(g)}if(v==="error"||v==="named"){a||(a=new Map);const E=d.value;let R=a.get(E);return I.op=v,R===void 0&&(R=a.size,a.set(E,R)),I.value=R,o.add(I),g.refIndex=l.length,void l.push(I.index)}v==="tableReference"&&(I.op=v),v==="tableSpecifier"&&(I.op=v),v==="structuredArg"&&(I.op=v)}else if(A&&A.isReference){const d=g,I={node:g,index:c.size,op:"function",value:g.value,inputs:null};c.set(d,I)}if(g.isLiteral)if(v!=="array")i[f]=g.value;else{const d=g.value,I=d.length,E=new Array(I);for(let R=0;R<I;R++){const U=d[R].value,x=U.length,O=new Array(x);for(let w=0;w<x;w++){const C=U[w];let k=C.value;if(C.type==="prefix"){const $=C.value;k=C.inputs[0].value,$==="-"&&(k=-k)}O[w]=k}E[R]=O}i[f]=_.e_(E)}else{if(v!=="empty")return u.push(g),g;i[f]=void 0}});const h=new Array(s.size);s.forEach((g,A)=>{const v=A.value,f=v.colIndex,d=v.rowIndex,I=v.$colIndex,E=v.$rowIndex,R={colStart:f,rowStart:d,colEnd:f,rowEnd:d,$colStart:I,$rowStart:E,$colEnd:I,$rowEnd:E};f===Number.MIN_SAFE_INTEGER&&(R.colEnd=Number.MAX_SAFE_INTEGER),d===Number.MIN_SAFE_INTEGER&&(R.rowEnd=Number.MAX_SAFE_INTEGER),v.sheetName&&(R.sheetName=v.sheetName),h[g]=R});const N=h.length,S=new Array(N);for(let g=0;g<N;g++)S[g]={colStart:0,rowStart:0,colEnd:0,rowEnd:0,sheetName:null};const L=new Array(c.size);let m;c.forEach(g=>{L[g.index]=g}),a&&(m=[],a.forEach((g,A)=>{m.push(A)}));const y=[];o.forEach(g=>{y.push(g.index)});const p=u.length;for(let g=0;g<p;g++){const A=u[g],v=A.type;if(v==="infix"){const f=A.value;A.fn=Pu[f]}else if(v==="prefix"){const f=A.value;A.fn=wu[f]}else if(v==="postfix"){const f=A.value;A.fn=Mu[f]}}const T=function(g){const A=[],v=(I,E)=>{const R={type:I.type,value:I.value};I.evalIndex!==void 0&&(R.evalIndex=I.evalIndex),I.refIndex!==void 0&&(R.refIndex=I.refIndex),E&&(R.ctx=E),A.push(R)},f=(I,E,R,U)=>{if(E==null||A.length>1&&I==="whitespace"&&A[A.length-1].type==="whitespace")return;const x={type:I,value:E};R&&(x.ctx=R),U!==void 0&&(x.evalIndex=U),A.push(x)};(function I(E,R,U){const x=E.evalIndex??U??0,O=E.type,w=(C,k,$)=>{if(!C)return;const X=C.length;for(let W=0;W<X;W++)I(C[W],k,$),W<X-1&&f("comma",",",k)};if(E.isLiteral){if(f("whitespace",E.wsBefore,R),O==="array"){f("type","{",R);const C=E.value,k=C.length;for(let $=0;$<k;$++){const X=C[$],W=X.value,rt=W.length;for(let mt=0;mt<rt;mt++){const xt=W[mt];f("whitespace",xt.wsBefore,R),I(xt,R,x),f("whitespace",xt.wsAfter,R),mt<rt-1&&f("comma",",",R)}$<k-1&&(f("whitespace",X.wsBefore,R),f("comma",";",R),f("whitespace",X.wsAfter,R))}E.error||f("type","}",R)}else O==="quotedString"&&(E={type:O,value:'"'+E.value+'"'}),v(E,R);f("whitespace",E.wsAfter,R)}else if(O==="infix")I(E.inputs[0],R,x),f("whitespace",E.wsBefore,R),v(E,R),f("whitespace",E.wsAfter,R),I(E.inputs[1],R,x);else if(O==="prefix")f("whitespace",E.wsBefore,R),v(E,R),f("whitespace",E.wsAfter,R),I(E.inputs[0],R,x);else if(O==="postfix")I(E.inputs[0],R,x),f("whitespace",E.wsBefore,R),v(E,R),f("whitespace",E.wsAfter,R);else{f("whitespace",E.wsBefore,R);const C=E.inputs;switch(O){case"function":v(E,R);const k={name:String(E.value),argIndex:-1};if(f("paren","(",k,E.evalIndex),C){const X=C.length;for(let W=0;W<X;W++){const rt={...k,argIndex:W};I(C[W],rt,x),W<X-1&&f("comma",",",rt)}}E.error||f("paren",")",k,E.evalIndex);break;case"cell":v(E,R);break;case"paren":f(O,"(",R,x),w(C,R,x),E.error||f(O,")",R,x);break;case"squareParen":f(O,"[",R,x),w(C,R,x),E.error||f(O,"]",R,x);break;case"tableReference":v(E,R);const $={name:String(E.value),argIndex:-1};if(f("paren","[",$),C){const X=C.length;for(let W=0;W<X;W++){const rt={...$,argIndex:W};I(C[W],rt,x),W<X-1&&f("comma",",",rt)}}E.error||f("paren","]",$);break;default:E.value!==void 0&&v(E,R),C&&C.forEach(X=>I(X,R,x))}f("whitespace",E.wsAfter,R)}})(g);const d=A.length;for(let I=0;I<d;I++){const E=A[I];if(E.type==="whitespace"&&E.evalIndex===void 0){const R=A[I+1];R&&R.evalIndex!==void 0&&(E.evalIndex=R.evalIndex)}}return A}(r);return{ast:r,evaluations:i,executions:u,precedentsAbsolute:S,precedentsExecute:L,precedentsNamed:m,precedentsRelative:h,precedentsRoot:y,references:l,tokens:T,error:e}}function go(t,e){let n,r=-1,i="";Number.isSafeInteger(t.previousToken?.startLine)?(r=t.previousToken.startLine,n=t.previousToken.endColumn+1):Number.isSafeInteger(t.token?.startLine)&&(r=t.token.startLine,n=t.token.startColumn),r!==-1?(i+=`
|
|
113
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const r=pe(this.recordingProdStack),i=new V({idx:e,terminalType:t,label:n?.LABEL});return r.definition.push(i),vs}},class{initPerformanceTracer(t){if(P(t,"traceInitPerf")){const e=t.traceInitPerf,n=typeof e=="number";this.traceInitMaxIdent=n?e:1/0,this.traceInitPerf=n?e>0:e}else this.traceInitMaxIdent=0,this.traceInitPerf=Kt.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(t,e){if(this.traceInitPerf===!0){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${t}>`);const{time:r,value:i}=rs(e),o=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${n}<-- <${t}> time: ${r}ms`),this.traceInitIndent--,i}return e()}}].forEach(t=>{const e=t.prototype;Object.getOwnPropertyNames(e).forEach(n=>{if(n==="constructor")return;const r=Object.getOwnPropertyDescriptor(e,n);r&&(r.get||r.set)?Object.defineProperty(Yn.prototype,n,r):Yn.prototype[n]=t.prototype[n]})});class Fc extends De{constructor(e,n=Kt){const r=et(n);r.outputCst=!1,super(e,r)}}const Dc=D({name:"WhiteSpace",pattern:/\s+/,group:ot.SKIPPED}),Os=D({name:"String",pattern:/"(""|[^"])*"/}),jc=D({name:"SingleQuotedString",pattern:/'(''|[^'])*'/}),Bc=D({name:"SheetQuoted",pattern:/'((?![\\/[\]*?:]).)+?'!/}),$c=D({name:"FunctionToken",pattern:/[A-Za-z_]+[A-Za-z_0-9.]*\(/}),Ss=D({name:"NamedTableReference",pattern:/[A-Za-z_]+[A-Za-z_0-9.]*\[/}),Wc=D({name:"BracketedString",pattern:/\[([^[\]]*)\]/,longer_alt:[Ss,Os]}),_s=D({name:"LiteralError",pattern:/#PARSE!|#NULL!|#DIV\/0!|#VALUE!|#NUM!|#FIELD!|#N\/A|#GETTING_DATA|#SPILL!|#CONNECT!|#BLOCKED!|#UNKNOWN!|#FIELD!|#CALC!|#BUSY!|#PYTHON!|#TIMEOUT!/}),Ls=D({name:"RefError",pattern:/#REF!|#NAME\?/}),Gc=D({name:"Sheet",pattern:/[A-Za-z_.\d\u007F-\uFFFF]+!/}),Kc=/^[a-zA-Z_][a-zA-Z0-9_.?]*:?/,Cn=D({name:"Name",pattern:{exec:(t,e)=>{try{const n=Kc.exec(t.substring(e));if(n){const r=n[0];if(r.endsWith(":")){const i=r.length;return r[i-2]==="."?[r.substring(0,i-2)]:[r.substring(0,i-1)]}return[r]}}catch(n){console.warn("Error parsing name",n)}return null}},line_breaks:!1,start_chars_hint:(()=>{const t=[];for(let e=65;e<=90;e++)t.push(e);for(let e=97;e<=122;e++)t.push(e);for(let e=48;e<=57;e++)t.push(e);return t})()}),zc=D({name:"Cell",pattern:/[$]?[A-Za-z]{1,3}[$]?[1-9][0-9]*/,longer_alt:Cn}),Vc=D({name:"Column",pattern:/[$]?[A-Za-z]{1,3}/,longer_alt:Cn}),Hc=D({name:"AbsRow",pattern:/[$][0-9]+/,longer_alt:Cn}),Yc=D({name:"NumberToken",pattern:/[0-9]+[.]?[0-9]*([eE][+-][0-9]+)?/}),Xc=D({name:"Boolean",pattern:/TRUE|FALSE/i}),qc=D({name:"Comma",pattern:/,/}),Zc=D({name:"RangeUnion",pattern:/:/}),Qc=D({name:"RangeTrimFull",pattern:/\.:\./}),Jc=D({name:"RangeTrimLeading",pattern:/\.:/}),tu=D({name:"RangeTrimTrailing",pattern:/:\./}),eu=D({name:"Semicolon",pattern:/;/}),nu=D({name:"OpenParen",pattern:/\(/}),ru=D({name:"CloseParen",pattern:/\)/}),iu=D({name:"OpenSquareParen",pattern:/\[/}),ou=D({name:"CloseSquareParen",pattern:/]/});D({name:"exclamationMark",pattern:/!/});const su=D({name:"OpenCurlyParen",pattern:/{/}),au=D({name:"CloseCurlyParen",pattern:/}/}),cu=D({name:"QuoteS",pattern:/'/}),co=D({name:"MulOp",pattern:/\*/}),uu=D({name:"PlusOp",pattern:/\+/}),lu=D({name:"DivOp",pattern:/\//}),hu=D({name:"MinOp",pattern:/-/}),fu=D({name:"ImplicitIntersectOp",pattern:/@/}),du=D({name:"ConcatOp",pattern:/&/}),pu=D({name:"ExOp",pattern:/\^/}),mu=D({name:"PercentOp",pattern:/%/}),xs=D({name:"TableSpecifier",pattern:/#(All|Data|Headers|Totals|This Row)/i}),Eu=D({name:"ArrayAnchorOp",pattern:/#/,longer_alt:[xs,_s,Ls]}),gu=D({name:"GtOp",pattern:/>/}),Tu=D({name:"EqOp",pattern:/=/}),Au=D({name:"LtOp",pattern:/</}),Cs=[Dc,Os,Bc,jc,$c,Ss,Wc,_s,Ls,Gc,zc,Xc,Vc,Hc,xs,Eu,fu,Cn,Yc,qc,Qc,Jc,tu,Zc,eu,nu,ru,iu,ou,su,au,cu,co,uu,lu,hu,du,pu,co,mu,D({name:"NeqOp",pattern:/<>/}),D({name:"GteOp",pattern:/>=/}),D({name:"LteOp",pattern:/<=/}),gu,Tu,Au],Iu=new ot(Cs,{ensureOptimizations:!0}),Gr={};Cs.forEach(t=>{Gr[t.name]=t});const qt={boolean:3,string:2,number:1},Nu=(t,e)=>{let n=t+e;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},yu=(t,e)=>{let n=t-e;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},ks=(t,e)=>{let n=t*e;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},bs=(t,e)=>{if(e===0)return 1/0;let n=t/e;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},Ru=(t,e)=>{const n=t**e;return isFinite(n)?n:Number.NaN},vu=(t="",e="")=>(t===null&&(t=""),e===null&&(e=""),typeof t=="boolean"&&(t=t?"TRUE":"FALSE"),typeof e=="boolean"&&(e=e?"TRUE":"FALSE"),""+t+e),Ou=(t=null,e=null)=>typeof t==typeof e&&t===e,Su=(t=null,e=null)=>typeof t!=typeof e||t!==e,_u=(t=null,e=null)=>{const n=typeof t,r=typeof e;return n===r?t>e:qt[n]>qt[r]},Lu=(t=null,e=null)=>{const n=typeof t,r=typeof e;return n===r?t>=e:qt[n]>=qt[r]},xu=(t=null,e=null)=>{const n=typeof t,r=typeof e;return n===r?t<e:qt[n]<qt[r]},Cu=(t=null,e=null)=>{const n=typeof t,r=typeof e;return n===r?t<=e:qt[n]<=qt[r]},ku={type:_.M.Number,coerce:!0,includeBoolean:!0,includeMistyped:!0,mismatchFill:_.n.BuiltIn.NA},bu={type:_.M.String,coerce:!0,includeMistyped:!0,mismatchFill:_.n.BuiltIn.NA},Ps={type:null,coerce:!0,includeMistyped:!0,mismatchFill:_.n.BuiltIn.NA},le=(t,e,n,r)=>{if(e!==null&&e.colStart!==void 0&&(e=t.getValueAt(e.rowStart,e.colStart)),n!==null&&n.colStart!==void 0&&(n=t.getValueAt(n.rowStart,n.colStart)),typeof e=="number"&&typeof n=="number")return r(e,n);let i,o;return e?.isIRange?i=e:n?.isIRange&&(o=n),i||o?(i||(i=t.getRange(e)),i.broadcast(n,r,ku).fillEmpty(0)):(e=_.Ye(e,_.ue(e,!0),_.M.Number,!0,!1),n=_.Ye(n,_.ue(n,!0),_.M.Number,!0,!1),e instanceof _.n.Value?e:n instanceof _.n.Value?n:r(e,n))},ce=(t,e,n,r)=>{let i,o;return e!==null&&e.colStart!==void 0&&(e=t.getValueAt(e.rowStart,e.colStart)),n!==null&&n.colStart!==void 0&&(n=t.getValueAt(n.rowStart,n.colStart)),e?.isIRange?(i=e,o=n):n?.isIRange&&(i=n,o=e),i?i.broadcast(o,r,Ps):r(e,n)},uo=(t,e)=>{e==null&&(e=0);let n,r=1;if(t==="+")return e;if(t!=="-")throw new _.n.Value(`Unrecognized prefix: ${t}`);return r=-r,e?.isIRange&&(n=e),n?n.broadcast(r,ks,Ps):typeof(e=_.Ye(e,_.ue(e,!0),_.M.Number))!="number"||isNaN(e)?_.n.BuiltIn.Value:e*r},ve=(t,e,n,r)=>{if(!e||(e.isIReferenceRange&&(e=e.getCoords()),e.colStart===void 0)||(n.isIReferenceRange&&(n=n.getCoords()),n.colStart===void 0))return _.n.BuiltIn.Ref;const i=r(e,n);return i?t.getReference(i):_.n.BuiltIn.Null},Pu={"+":(t,e,n)=>le(t,e,n,Nu),"-":(t,e,n)=>le(t,e,n,yu),"*":(t,e,n)=>le(t,e,n,ks),"/":(t,e,n)=>le(t,e,n,bs),"^":(t,e,n)=>le(t,e,n,Ru)," ":(t,e,n,r)=>ve(t,e,n,_.Kt.intersectRanges),":":(t,e,n,r)=>ve(t,e,n,_.Kt.unionRanges),".:.":(t,e,n,r)=>{const i=ve(t,e,n,_.Kt.unionRanges);return t.getFunction("TRIMRANGE").execute(i,3,3)},".:":(t,e,n,r)=>{const i=ve(t,e,n,_.Kt.unionRanges);return t.getFunction("TRIMRANGE").execute(i,1,1)},":.":(t,e,n,r)=>{const i=ve(t,e,n,_.Kt.unionRanges);return t.getFunction("TRIMRANGE").execute(i,2,2)},"&":(t,e,n)=>((r,i,o,s)=>{if(i!==null&&i.colStart!==void 0&&(i=r.getValueAt(i.rowStart,i.colStart)),o!==null&&o.colStart!==void 0&&(o=r.getValueAt(o.rowStart,o.colStart)),typeof i=="string"&&typeof o=="string")return s(i,o);let a,c;return i?.isIRange?a=i:o?.isIRange&&(c=o),a||c?(a||(a=r.getRange(i)),a.broadcast(o,s,bu)):s(i=_.Ye(i,_.ue(i,!0),_.M.String),o=_.Ye(o,_.ue(o,!0),_.M.String))})(t,e,n,vu),"=":(t,e,n)=>ce(t,e,n,Ou),"<>":(t,e,n)=>ce(t,e,n,Su),">":(t,e,n)=>ce(t,e,n,_u),"<":(t,e,n)=>ce(t,e,n,xu),">=":(t,e,n)=>ce(t,e,n,Lu),"<=":(t,e,n)=>ce(t,e,n,Cu)},wu={"-":(t,e)=>uo("-",e),"+":(t,e)=>uo("+",e),"@":(t,e)=>{if(!e||!e.isIReferenceRange)return e;const n=e.getCoords(),r=e,i=t.getPosition(),o=r.getHeight(),s=r.getWidth();if(s>1&&o>1)return _.n.BuiltIn.Value;if(o>1){const a=i.rowIndex-n.rowStart;if(a>=0&&a<o)return r.getValueAt(a,0)}else{if(!(s>1))return r.getValueAt(0,0);{const a=i.colIndex-n.colStart;if(a>=0&&a<s)return r.getValueAt(0,a)}}return _.n.BuiltIn.Value}},Mu={"%":(t,e)=>le(t,e,100,bs),"#":(t,e)=>t.getSpillAt(e.rowStart,e.colStart)||_.n.BuiltIn.Ref};function lo(t){const e=(t=t.toUpperCase()).length;let n=0;for(let r=0;r<e;r++){const i=t.charCodeAt(r);isNaN(i)||(n+=(i-64)*26**(e-r-1))}return n}function Xn(t){return{type:"cell",value:Object.freeze({colIndex:t.colIndex,rowIndex:t.rowIndex,$colIndex:t.$colIndex||!1,$rowIndex:t.$rowIndex||!1}),inputs:null,isReference:!0}}function ho(t,e){const n=t.startsWith("$");n&&(t=t.substring(1));let r=parseInt(t)-1;return n||r===Number.MIN_SAFE_INTEGER||(r-=e.colIndex),{type:"cell",value:Object.freeze({colIndex:Number.MIN_SAFE_INTEGER,$colIndex:!1,rowIndex:r,$rowIndex:n}),inputs:null,isReference:!0}}function fo(t,e){return{type:"function",value:t=t.toUpperCase(),inputs:e}}function qn(t,e){return{type:"tableReference",value:t,inputs:e}}function Zn(t){return{type:"tableSpecifier",value:t,inputs:null,isReference:!0}}function Lr(t,e,n,r=!1){const i={type:"infix",value:t,inputs:[e,n]};return r&&(i.isReference=!0),i}function Qn(t,e,n=!1){const r={type:"postfix",value:t,inputs:[e]};return n&&(r.isReference=!0),r}function _e(t,e,n=!1){const r={type:"prefix",value:t,inputs:[e]};return n&&(r.isReference=!0),r}function Jn(t){return{type:"named",value:t,inputs:null,isReference:!0}}function po(t){return{type:"number",value:Number(t),isLiteral:!0}}function tr(t){let e=t;const n=t&&t.length>1&&t[0]==='"'&&t[t.length-1]==='"';return n&&(e=t.substring(1,t.length-1)),{type:n?"quotedString":"string",value:e,isLiteral:!0}}function mo(t){return{type:"boolean",value:t==="TRUE"||t.toUpperCase()==="TRUE",isLiteral:!0}}function Eo(t){return{type:"error",value:_.n.getBuiltInByLabel(t.toUpperCase()),isLiteral:!0}}function gn(t){return{type:"error",value:t?_.n.getBuiltInByLabel(t.toUpperCase()):_.n.BuiltIn.Ref,inputs:null,isReference:!0}}function je(t,e){return function n(r,i){const o=r.inputs;let s;if(o){const u=o.length;for(let l=0;l<u;l++){const h=o[l],N=n(h,r);N!==h&&(s||(s=[...o]),s[l]=N)}}const a=s?{...r,inputs:s}:r,c=e(a,i);return c===void 0?a:c}(t,void 0)||this}function sn(t,e){let n=0,r=je(t,g=>{const A={...g};return A.evalIndex=n++,A});const i=new Array(n),o=new Set,s=new Map;let a;const c=new Map,u=[],l=[];r=je(r,(g,A)=>{const v=g.type,f=g.evalIndex;if(i[f]=null,g.isReference){const d=g,I={node:g,index:c.size,op:null,value:null,inputs:null};if(c.set(d,I),v==="cell"){const E=d.value;return E.$colIndex&&(I.hasHorizontalAbs=!0),E.$rowIndex&&(I.hasVerticalAbs=!0),I.value=s.size,s.set(d,s.size),o.add(I),g.refIndex=l.length,void l.push(I.index)}if(v==="infix"||v==="prefix"||v==="postfix"||v==="spill"){const E=d.inputs,R=E.length,U=g.value;I.op=U;const x=new Array(R);I.inputs=x;for(let O=0;O<R;O++){const w=E[O],C=c.get(w);C&&(C.hasHorizontalAbs&&(I.hasHorizontalAbs=!0),C.hasVerticalAbs&&(I.hasVerticalAbs=!0)),x[O]=C?C.index:-1,o.delete(C)}if(o.add(I),ws.includes(U)){const O=E[0],w=!!O&&O.type==="cell",C=E[1],k=!!C&&C.type==="cell";w&&k&&(l.splice(C.refIndex,1),C.refIndex=O.refIndex,g.refIndex=O.refIndex,l[O.refIndex]=I.index)}else U==="#"&&(g.refIndex=E[0].refIndex);return void u.push(g)}if(v==="error"||v==="named"){a||(a=new Map);const E=d.value;let R=a.get(E);return I.op=v,R===void 0&&(R=a.size,a.set(E,R)),I.value=R,o.add(I),g.refIndex=l.length,void l.push(I.index)}v==="tableReference"&&(I.op=v),v==="tableSpecifier"&&(I.op=v),v==="structuredArg"&&(I.op=v)}else if(A&&A.isReference){const d=g,I={node:g,index:c.size,op:"function",value:g.value,inputs:null};c.set(d,I)}if(g.isLiteral)if(v!=="array")i[f]=g.value;else{const d=g.value,I=d.length,E=new Array(I);for(let R=0;R<I;R++){const U=d[R].value,x=U.length,O=new Array(x);for(let w=0;w<x;w++){const C=U[w];let k=C.value;if(C.type==="prefix"){const $=C.value;k=C.inputs[0].value,$==="-"&&(k=-k)}O[w]=k}E[R]=O}i[f]=_.t_(E)}else{if(v!=="empty")return u.push(g),g;i[f]=void 0}});const h=new Array(s.size);s.forEach((g,A)=>{const v=A.value,f=v.colIndex,d=v.rowIndex,I=v.$colIndex,E=v.$rowIndex,R={colStart:f,rowStart:d,colEnd:f,rowEnd:d,$colStart:I,$rowStart:E,$colEnd:I,$rowEnd:E};f===Number.MIN_SAFE_INTEGER&&(R.colEnd=Number.MAX_SAFE_INTEGER),d===Number.MIN_SAFE_INTEGER&&(R.rowEnd=Number.MAX_SAFE_INTEGER),v.sheetName&&(R.sheetName=v.sheetName),h[g]=R});const N=h.length,S=new Array(N);for(let g=0;g<N;g++)S[g]={colStart:0,rowStart:0,colEnd:0,rowEnd:0,sheetName:null};const L=new Array(c.size);let m;c.forEach(g=>{L[g.index]=g}),a&&(m=[],a.forEach((g,A)=>{m.push(A)}));const y=[];o.forEach(g=>{y.push(g.index)});const p=u.length;for(let g=0;g<p;g++){const A=u[g],v=A.type;if(v==="infix"){const f=A.value;A.fn=Pu[f]}else if(v==="prefix"){const f=A.value;A.fn=wu[f]}else if(v==="postfix"){const f=A.value;A.fn=Mu[f]}}const T=function(g){const A=[],v=(I,E)=>{const R={type:I.type,value:I.value};I.evalIndex!==void 0&&(R.evalIndex=I.evalIndex),I.refIndex!==void 0&&(R.refIndex=I.refIndex),E&&(R.ctx=E),A.push(R)},f=(I,E,R,U)=>{if(E==null||A.length>1&&I==="whitespace"&&A[A.length-1].type==="whitespace")return;const x={type:I,value:E};R&&(x.ctx=R),U!==void 0&&(x.evalIndex=U),A.push(x)};(function I(E,R,U){const x=E.evalIndex??U??0,O=E.type,w=(C,k,$)=>{if(!C)return;const X=C.length;for(let W=0;W<X;W++)I(C[W],k,$),W<X-1&&f("comma",",",k)};if(E.isLiteral){if(f("whitespace",E.wsBefore,R),O==="array"){f("type","{",R);const C=E.value,k=C.length;for(let $=0;$<k;$++){const X=C[$],W=X.value,rt=W.length;for(let mt=0;mt<rt;mt++){const xt=W[mt];f("whitespace",xt.wsBefore,R),I(xt,R,x),f("whitespace",xt.wsAfter,R),mt<rt-1&&f("comma",",",R)}$<k-1&&(f("whitespace",X.wsBefore,R),f("comma",";",R),f("whitespace",X.wsAfter,R))}E.error||f("type","}",R)}else O==="quotedString"&&(E={type:O,value:'"'+E.value+'"'}),v(E,R);f("whitespace",E.wsAfter,R)}else if(O==="infix")I(E.inputs[0],R,x),f("whitespace",E.wsBefore,R),v(E,R),f("whitespace",E.wsAfter,R),I(E.inputs[1],R,x);else if(O==="prefix")f("whitespace",E.wsBefore,R),v(E,R),f("whitespace",E.wsAfter,R),I(E.inputs[0],R,x);else if(O==="postfix")I(E.inputs[0],R,x),f("whitespace",E.wsBefore,R),v(E,R),f("whitespace",E.wsAfter,R);else{f("whitespace",E.wsBefore,R);const C=E.inputs;switch(O){case"function":v(E,R);const k={name:String(E.value),argIndex:-1};if(f("paren","(",k,E.evalIndex),C){const X=C.length;for(let W=0;W<X;W++){const rt={...k,argIndex:W};I(C[W],rt,x),W<X-1&&f("comma",",",rt)}}E.error||f("paren",")",k,E.evalIndex);break;case"cell":v(E,R);break;case"paren":f(O,"(",R,x),w(C,R,x),E.error||f(O,")",R,x);break;case"squareParen":f(O,"[",R,x),w(C,R,x),E.error||f(O,"]",R,x);break;case"tableReference":v(E,R);const $={name:String(E.value),argIndex:-1};if(f("paren","[",$),C){const X=C.length;for(let W=0;W<X;W++){const rt={...$,argIndex:W};I(C[W],rt,x),W<X-1&&f("comma",",",rt)}}E.error||f("paren","]",$);break;default:E.value!==void 0&&v(E,R),C&&C.forEach(X=>I(X,R,x))}f("whitespace",E.wsAfter,R)}})(g);const d=A.length;for(let I=0;I<d;I++){const E=A[I];if(E.type==="whitespace"&&E.evalIndex===void 0){const R=A[I+1];R&&R.evalIndex!==void 0&&(E.evalIndex=R.evalIndex)}}return A}(r);return{ast:r,evaluations:i,executions:u,precedentsAbsolute:S,precedentsExecute:L,precedentsNamed:m,precedentsRelative:h,precedentsRoot:y,references:l,tokens:T,error:e}}function go(t,e){let n,r=-1,i="";Number.isSafeInteger(t.previousToken?.startLine)?(r=t.previousToken.startLine,n=t.previousToken.endColumn+1):Number.isSafeInteger(t.token?.startLine)&&(r=t.token.startLine,n=t.token.startColumn),r!==-1?(i+=`
|
|
114
114
|
`+e.split(`
|
|
115
115
|
`)[r-1]+`
|
|
116
116
|
`,i+=Array(n-1).fill(" ").join("")+`^
|
|
117
117
|
`,i+=`Error at position ${r}:${n}
|
|
118
118
|
`+t.message,t.errorLocation={line:r,column:n}):i=e+`
|
|
119
|
-
`+t.message;const o=new _.n.Parse(i);return o.details=t,o}const er=function(t,e){return e.wsBefore&&(t.wsBefore=e.wsBefore),e.wsAfter&&(t.wsAfter=e.wsAfter),e.image&&(t.image=e.image),t},To=Object.freeze([[":",".:.",".:",,":."],["^"],["*","/"],["+","-"],["&"],["<",">","=","<>","<=",">="]]),ws=Object.freeze([":",".:.",".:",,":."]),Uu=Object.freeze([":"," ",".:.",".:",,":."]),Fu=Object.freeze(["@"]),Du=Object.freeze(["#"]),nr=Object.freeze(Uu.concat(Fu).concat(Du)),{String:Ao,SheetQuoted:ju,SingleQuotedString:Bu,FunctionToken:$u,NamedTableReference:Wu,LiteralError:Io,RefError:No,Cell:Gu,Sheet:Ku,Name:yo,NumberToken:Ro,Boolean:vo,Column:zu,AbsRow:Vu,ImplicitIntersectOp:rr,Comma:ue,RangeUnion:Hu,RangeTrimFull:Yu,RangeTrimLeading:Xu,RangeTrimTrailing:qu,Semicolon:Qu,OpenParen:Zu,CloseParen:ir,OpenSquareParen:Oo,CloseSquareParen:So,OpenCurlyParen:Ju,CloseCurlyParen:tl,MulOp:el,PlusOp:or,DivOp:nl,MinOp:sr,ConcatOp:rl,ExOp:il,PercentOp:ol,ArrayAnchorOp:_o,TableSpecifier:sl,BracketedString:Lo,NeqOp:al,GteOp:cl,LteOp:ul,GtOp:ll,EqOp:hl,LtOp:fl}=Gr;class dl extends Fc{constructor(){super(Gr,{nodeLocationTracking:"full",maxLookahead:1,skipValidations:!0,recoveryEnabled:!0}),this.position={colIndex:0,rowIndex:0},this.astErrors=[];const e=this,n=(r,i,o)=>{let s;e.CONSUME(i);const a=e.getLexerPosition();s=e.ACTION(()=>(s={type:r,value:null,inputs:null},this._ensureWhitespace(s,a,!0)));const c=[],u=e.SUBRULE(e.intersectOp);u&&c.push(u);const l=e.SUBRULE(e.group),h=e.OPTION(()=>this.CONSUME(o));return s=e.ACTION(()=>{if(l)for(let N=0;N<l.length;N++)c.push(l[N]);return s&&(h||this._reportError(s,"Missing closing parenthesis",a),s.inputs=c),this._ensureWhitespace(s,e.getLexerPosition(),!1,!0)}),s};e.RULE("infixOp",()=>{const r=[],i=[e.SUBRULE(e.postfixOp)];return e.MANY(()=>{const o=e.OR(e.c1||(e.c1=[{ALT:()=>e.CONSUME(Hu).image},{ALT:()=>e.CONSUME(or).image},{ALT:()=>e.CONSUME(sr).image},{ALT:()=>e.CONSUME(el).image},{ALT:()=>e.CONSUME(nl).image},{ALT:()=>e.CONSUME(il).image},{ALT:()=>e.CONSUME(rl).image},{ALT:()=>e.CONSUME(ll).image},{ALT:()=>e.CONSUME(hl).image},{ALT:()=>e.CONSUME(fl).image},{ALT:()=>e.CONSUME(al).image},{ALT:()=>e.CONSUME(cl).image},{ALT:()=>e.CONSUME(ul).image},{ALT:()=>e.CONSUME(Yu).image},{ALT:()=>e.CONSUME(Xu).image},{ALT:()=>e.CONSUME(qu).image}]));r.push([o,e.getLexerPosition(),nr.includes(o)]),i.push(e.SUBRULE2(e.postfixOp))}),e.ACTION(()=>{let o=r.length;const s=To.length;for(let a=0;o>0&&a<s;a++){const c=To[a];let u=r.length;for(let l=0;l<u;l++){const h=r[l],N=h[0];if(!c.includes(N))continue;let S=Lr(N,i[l],i[l+1],h[2]);S=this._ensureWhitespace(S,h[1]),r.splice(l,1),i.splice(l,2,S),l--,u--,o--}}}),i[0]}),e.RULE("plusMinusOp",()=>e.OR([{ALT:()=>e.CONSUME(or).image},{ALT:()=>e.CONSUME(sr).image}])),e.RULE("postfixOp",()=>{let r=e.SUBRULE(e.prefixOp);const i=[];return e.MANY(()=>{const o=e.OR([{ALT:()=>e.CONSUME(ol).image},{ALT:()=>e.CONSUME(_o).image}]);e.ACTION(()=>{i.push([o,e.getLexerPosition()])})}),e.ACTION(()=>{const o=i.length;if(o!==0)for(let s=0;s<o;s++){const a=i[s],c=a[0],u=a[1],l=nr.includes(c);r=Zn(c,r,l),r=this._ensureWhitespace(r,u)}}),r}),e.RULE("prefixOp",()=>{const r=[];e.MANY(()=>{const o=e.OR([{ALT:()=>e.CONSUME(or).image},{ALT:()=>e.CONSUME(sr).image},{ALT:()=>e.CONSUME(rr).image}]);e.ACTION(()=>{r.push([o,e.getLexerPosition()])})});let i=e.SUBRULE(e.formula);return e.ACTION(()=>{const o=r.length;if(o!==0)for(let s=o-1;s>=0;s--){const a=r[s],c=a[0],u=a[1],l=nr.includes(c);i=_e(c,i,l),i=this._ensureWhitespace(i,u)}}),i}),e.RULE("intersectOp",()=>{const r=[e.SUBRULE(e.infixOp)];return e.MANY(()=>{e.OPTION({GATE:()=>{const i=e.LA(0);return e.LA(1).startOffset>i.endOffset+1},DEF:()=>{r.push(e.SUBRULE3(e.infixOp))}})}),e.ACTION(()=>{for(;r.length>1;){let i=r.length-1;for(let o=0;o<i;o++){const s=r[o],a=r[o+1],c=Lr(" ",s,a,!0);if(delete s.wsAfter,a.wsBefore){const u=a.wsBefore.slice(0,-1),l=u.length;delete a.wsBefore,l>0&&(c.wsBefore=u)}o+1<i&&delete a.wsAfter,r.splice(o,2,c),o--,i--}}}),r[0]}),e.RULE("formula",()=>e.OR9([{ALT:()=>e.SUBRULE(e.referenceWithoutInfix)},{ALT:()=>e.SUBRULE(e.function)},{ALT:()=>e.SUBRULE(e.paren)},{ALT:()=>e.SUBRULE(e.namedTableReference)},{ALT:()=>e.SUBRULE(e.bracketedString)},{ALT:()=>e.SUBRULE(e.squareParen)},{ALT:()=>e.SUBRULE(e.literal)},{ALT:()=>e.SUBRULE(e.literalArray)}])),e.RULE("group",()=>{const r=[];return e.MANY(()=>{e.CONSUME(ue);const i=e.SUBRULE2(e.intersectOp);e.ACTION(()=>{r.push(i)})}),r}),e.RULE("paren",()=>n("paren",Zu,ir)),e.RULE("literalArray",()=>{let r={type:"row",value:[],isLiteral:!0};e.CONSUME(Ju);const i=e.getLexerPosition();let o=e.ACTION(()=>this._ensureWhitespace({type:"array",value:[r],isLiteral:!0},i,!0));const s=e.SUBRULE(e.literalForArray);e.ACTION(()=>{r.value.push(s)}),e.MANY(()=>{const c=e.OR([{ALT:()=>e.CONSUME(ue).image},{ALT:()=>e.CONSUME(Qu).image}]),u=e.SUBRULE2(e.literalForArray);e.ACTION(()=>{c===","||(r={type:"row",value:[],isLiteral:!0},o.value.push(r)),r.value.push(u)})});const a=e.OPTION(()=>this.CONSUME(tl));return o=e.ACTION(()=>(a||this._reportError(o,"Missing closing parenthesis '}'",i),this._ensureWhitespace(o,e.getLexerPosition(),!1,!0))),o}),e.RULE("literalForArray",()=>e.OR([{ALT:()=>{const r=e.OPTION(()=>e.SUBRULE(e.plusMinusOp)),i=e.CONSUME(Ro),o=e.ACTION(()=>this._ensureWhitespace(po(i.image),e.getLexerPosition()));return r?e.ACTION(()=>function(s,a){return{type:"prefix",value:s,inputs:[a]}}(r,o)):o}},{ALT:()=>{const r=e.CONSUME(Ao);return e.ACTION(()=>this._ensureWhitespace(tr(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(vo);return e.ACTION(()=>this._ensureWhitespace(mo(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(Io);return e.ACTION(()=>this._ensureWhitespace(Eo(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(No);return e.ACTION(()=>this._ensureWhitespace(gn(r.image),e.getLexerPosition()))}}])),e.RULE("literal",()=>e.OR([{ALT:()=>{const r=e.CONSUME(Ro);return e.ACTION(()=>this._ensureWhitespace(po(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(Ao);return e.ACTION(()=>this._ensureWhitespace(tr(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(vo);return e.ACTION(()=>this._ensureWhitespace(mo(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(Io);return e.ACTION(()=>this._ensureWhitespace(Eo(r.image),e.getLexerPosition()))}}])),e.RULE("function",()=>{const r=e.CONSUME($u).image.slice(0,-1),i=e.getLexerPosition(),o=e.SUBRULE(e.functionArguments);let s=e.ACTION(()=>this._ensureWhitespace(fo(r,o),i,!0));const a=e.OPTION(()=>this.CONSUME(ir));return s=e.ACTION(()=>(a||this._reportError(s,"Missing closing parenthesis ')'",i),this._ensureWhitespace(s,e.getLexerPosition(),!1,!0))),s}),e.RULE("functionArguments",()=>{const r=[];return e.MANY2(()=>{let i;e.CONSUME2(ue),i=e.ACTION(()=>this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0)),r.push(i)}),e.OPTION(()=>{r.push(e.SUBRULE(e.intersectOp)),e.MANY(()=>{let i;e.CONSUME1(ue),i=e.ACTION(()=>this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0)),r.push(i),e.OPTION3(()=>{r.pop(),r.push(e.SUBRULE2(e.intersectOp))})})}),r}),e.RULE("bracketedString",()=>{const r=e.CONSUME(Lo),i=e.getLexerPosition();return e.ACTION(()=>{const o=r.image;let s=qn("",[Qn(o.substring(1,o.length-1))]);return s=this._ensureWhitespace(s,i,!0,!1),s=this._ensureWhitespace(s,e.getLexerPosition(),!1,!0),s})}),e.RULE("squareParen",()=>{e.CONSUME(Oo);const r=e.getLexerPosition();let i=qn("",[e.SUBRULE(e.structuredArgument)]);const o=e.OPTION(()=>this.CONSUME(So));return e.ACTION(()=>{o||this._reportError(i,"Missing closing parenthesis ']'",r),i=this._ensureWhitespace(i,r,!0,!1),i=this._ensureWhitespace(i,e.getLexerPosition(),!1,!0)}),i}),e.RULE("namedTableReference",()=>{const r=e.CONSUME(Wu).image.slice(0,-1),i=e.getLexerPosition(),o=e.SUBRULE(e.structuredArguments);let s=e.ACTION(()=>this._ensureWhitespace(qn(r,o),i,!0));const a=e.OPTION(()=>this.CONSUME(So));return s=e.ACTION(()=>(a||this._reportError(s,"Missing closing parenthesis ']'",i),this._ensureWhitespace(s,e.getLexerPosition(),!1,!0))),s}),e.RULE("structuredArguments",()=>{const r=[];return e.MANY2(()=>{e.CONSUME2(ue),e.ACTION(()=>{r.push(this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0))})}),e.OPTION(()=>{const i=e.SUBRULE(e.structuredArgument);e.ACTION(()=>{i&&r.push(i)}),e.MANY(()=>{e.CONSUME1(ue),e.OPTION3(()=>{let o=e.SUBRULE2(e.structuredArgument);e.ACTION(()=>{o||(o=this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0)),r.push(o)})})})}),r}),e.RULE("structuredArgument",()=>{const r=e.OPTION(()=>e.CONSUME(rr)),i=e.getLexerPosition(),o=e.OPTION2(()=>this.CONSUME(Oo));let s=e.OR([{ALT:()=>{const a=e.CONSUME(sl);return e.ACTION(()=>this._ensureWhitespace(Qn(a.image),e.getLexerPosition()))}},{ALT:()=>{const a=e.CONSUME(Lo);return e.ACTION(()=>this._ensureWhitespace(Qn(a.image),e.getLexerPosition()))}},{ALT:()=>{const a=e.CONSUME(yo);return e.ACTION(()=>this._ensureWhitespace(Jn(a.image),e.getLexerPosition()))}},{ALT:()=>{const a=e.CONSUME(Bu);return e.ACTION(()=>this._ensureWhitespace(tr(a.image),e.getLexerPosition()))}}]);if(o){const a=e.OPTION3(()=>this.CONSUME(ir));e.ACTION(()=>(a||this._reportError(s,"Missing closing parenthesis ']'",i),this._ensureWhitespace(s,e.getLexerPosition(),!1,!0))),s={type:"structuredArg",value:null,inputs:[s]}}return e.ACTION(()=>{r&&(s=_e(r.image,s,!0),s=this._ensureWhitespace(s,e.getLexerPosition()))}),s}),e.RULE("referenceWithoutInfix",()=>e.OR([{ALT:()=>e.SUBRULE(e.reference)},{ALT:()=>{const r=e.SUBRULE(e.prefixSheetName),i=e.SUBRULE2(e.formula);return e.ACTION(()=>{if((o=i)&&o.isFormulaError)return i;var o;i.ref&&(i.ref.sheet=r)}),i}}])),e.RULE("reference",()=>{const r=e.OPTION4(()=>e.CONSUME(rr));let i=e.OR([{ALT:()=>{const o=e.CONSUME(Gu),s=e.getLexerPosition(),a=e.OPTION(()=>e.CONSUME(_o));return e.ACTION(()=>{const c=this._ensureWhitespace(function(u,l){const h=u.match(/([$]?)([A-Za-z]{1,3})([$]?)([1-9][0-9]*)/);let N=lo(h[2])-1;const S=h[1].length===1;let L=+h[4]-1;const m=h[3].length===1;return S||N===Number.MIN_SAFE_INTEGER||(N-=l.colIndex),m||L===Number.MIN_SAFE_INTEGER||(L-=l.rowIndex),{type:"cell",value:Object.freeze({colIndex:N,rowIndex:L,$colIndex:S,$rowIndex:m}),inputs:null,isReference:!0}}(o.image,e.position),s);return a?this._ensureWhitespace(Zn("#",c,!0),s):c})}},{ALT:()=>{const o=e.CONSUME(yo);return e.ACTION(()=>this._ensureWhitespace(Jn(o.image),e.getLexerPosition()))}},{ALT:()=>{const o=e.CONSUME(zu);return e.ACTION(()=>this._ensureWhitespace(function(s,a){const c=s.startsWith("$");c&&(s=s.substring(1));let u=lo(s)-1;return c||u===Number.MIN_SAFE_INTEGER||(u-=a.colIndex),{type:"cell",value:Object.freeze({colIndex:u,rowIndex:Number.MIN_SAFE_INTEGER,$colIndex:c,$rowIndex:!1}),inputs:null,isReference:!0}}(o.image,e.position),e.getLexerPosition()))}},{ALT:()=>{const o=e.CONSUME(Vu);return e.ACTION(()=>this._ensureWhitespace(ho(o.image,e.position),e.getLexerPosition()))}},{ALT:()=>{const o=e.CONSUME(No);return e.ACTION(()=>this._ensureWhitespace(gn(o.image),e.getLexerPosition()))}}]);return e.ACTION(()=>{r&&(i=_e(r,i,!0),i=this._ensureWhitespace(i,e.getLexerPosition()))}),i}),e.RULE("prefixSheetName",()=>e.OR([{ALT:()=>e.CONSUME(Ku).image.slice(0,-1)},{ALT:()=>e.CONSUME(ju).image.slice(1,-2).replace(/''/g,"'")}])),e.performSelfAnalysis()}_reportError(e,n,r=void 0,i="SyntaxError"){r===void 0&&(r=this.getLexerPosition()),e.error=!0,this.astErrors.push({name:i,message:n,previousToken:this.input[r],ast:e})}_ensureWhitespace(e,n,r=!1,i=!1){if(!e)return console.warn("node is null"),e;const o=this.input,s=o[n];if(e.image||(e.image=s.image),!i){const a=s.startOffset,c=o[n-1],u=c?.endOffset??-1;u+1<a&&(e.wsBefore=" ".repeat(a-u-1))}if(!r){const a=s.endOffset,c=o[n+1],u=c?.startOffset??this.inputTextLength;a+1<u&&(e.wsAfter=" ".repeat(u-a-1))}return e}_createAST(e,n){const r=function(a){const c=Iu.tokenize(a);if(c.errors.length>0){const u=c.errors[0],l=u.line,h=u.column;let N=`
|
|
119
|
+
`+t.message;const o=new _.n.Parse(i);return o.details=t,o}const er=function(t,e){return e.wsBefore&&(t.wsBefore=e.wsBefore),e.wsAfter&&(t.wsAfter=e.wsAfter),e.image&&(t.image=e.image),t},To=Object.freeze([[":",".:.",".:",,":."],["^"],["*","/"],["+","-"],["&"],["<",">","=","<>","<=",">="]]),ws=Object.freeze([":",".:.",".:",,":."]),Uu=Object.freeze([":"," ",".:.",".:",,":."]),Fu=Object.freeze(["@"]),Du=Object.freeze(["#"]),nr=Object.freeze(Uu.concat(Fu).concat(Du)),{String:Ao,SheetQuoted:ju,SingleQuotedString:Bu,FunctionToken:$u,NamedTableReference:Wu,LiteralError:Io,RefError:No,Cell:Gu,Sheet:Ku,Name:yo,NumberToken:Ro,Boolean:vo,Column:zu,AbsRow:Vu,ImplicitIntersectOp:rr,Comma:ue,RangeUnion:Hu,RangeTrimFull:Yu,RangeTrimLeading:Xu,RangeTrimTrailing:qu,Semicolon:Zu,OpenParen:Qu,CloseParen:ir,OpenSquareParen:Oo,CloseSquareParen:So,OpenCurlyParen:Ju,CloseCurlyParen:tl,MulOp:el,PlusOp:or,DivOp:nl,MinOp:sr,ConcatOp:rl,ExOp:il,PercentOp:ol,ArrayAnchorOp:_o,TableSpecifier:sl,BracketedString:Lo,NeqOp:al,GteOp:cl,LteOp:ul,GtOp:ll,EqOp:hl,LtOp:fl}=Gr;class dl extends Fc{constructor(){super(Gr,{nodeLocationTracking:"full",maxLookahead:1,skipValidations:!0,recoveryEnabled:!0}),this.position={colIndex:0,rowIndex:0},this.astErrors=[];const e=this,n=(r,i,o)=>{let s;e.CONSUME(i);const a=e.getLexerPosition();s=e.ACTION(()=>(s={type:r,value:null,inputs:null},this._ensureWhitespace(s,a,!0)));const c=[],u=e.SUBRULE(e.intersectOp);u&&c.push(u);const l=e.SUBRULE(e.group),h=e.OPTION(()=>this.CONSUME(o));return s=e.ACTION(()=>{if(l)for(let N=0;N<l.length;N++)c.push(l[N]);return s&&(h||this._reportError(s,"Missing closing parenthesis",a),s.inputs=c),this._ensureWhitespace(s,e.getLexerPosition(),!1,!0)}),s};e.RULE("infixOp",()=>{const r=[],i=[e.SUBRULE(e.postfixOp)];return e.MANY(()=>{const o=e.OR(e.c1||(e.c1=[{ALT:()=>e.CONSUME(Hu).image},{ALT:()=>e.CONSUME(or).image},{ALT:()=>e.CONSUME(sr).image},{ALT:()=>e.CONSUME(el).image},{ALT:()=>e.CONSUME(nl).image},{ALT:()=>e.CONSUME(il).image},{ALT:()=>e.CONSUME(rl).image},{ALT:()=>e.CONSUME(ll).image},{ALT:()=>e.CONSUME(hl).image},{ALT:()=>e.CONSUME(fl).image},{ALT:()=>e.CONSUME(al).image},{ALT:()=>e.CONSUME(cl).image},{ALT:()=>e.CONSUME(ul).image},{ALT:()=>e.CONSUME(Yu).image},{ALT:()=>e.CONSUME(Xu).image},{ALT:()=>e.CONSUME(qu).image}]));r.push([o,e.getLexerPosition(),nr.includes(o)]),i.push(e.SUBRULE2(e.postfixOp))}),e.ACTION(()=>{let o=r.length;const s=To.length;for(let a=0;o>0&&a<s;a++){const c=To[a];let u=r.length;for(let l=0;l<u;l++){const h=r[l],N=h[0];if(!c.includes(N))continue;let S=Lr(N,i[l],i[l+1],h[2]);S=this._ensureWhitespace(S,h[1]),r.splice(l,1),i.splice(l,2,S),l--,u--,o--}}}),i[0]}),e.RULE("plusMinusOp",()=>e.OR([{ALT:()=>e.CONSUME(or).image},{ALT:()=>e.CONSUME(sr).image}])),e.RULE("postfixOp",()=>{let r=e.SUBRULE(e.prefixOp);const i=[];return e.MANY(()=>{const o=e.OR([{ALT:()=>e.CONSUME(ol).image},{ALT:()=>e.CONSUME(_o).image}]);e.ACTION(()=>{i.push([o,e.getLexerPosition()])})}),e.ACTION(()=>{const o=i.length;if(o!==0)for(let s=0;s<o;s++){const a=i[s],c=a[0],u=a[1],l=nr.includes(c);r=Qn(c,r,l),r=this._ensureWhitespace(r,u)}}),r}),e.RULE("prefixOp",()=>{const r=[];e.MANY(()=>{const o=e.OR([{ALT:()=>e.CONSUME(or).image},{ALT:()=>e.CONSUME(sr).image},{ALT:()=>e.CONSUME(rr).image}]);e.ACTION(()=>{r.push([o,e.getLexerPosition()])})});let i=e.SUBRULE(e.formula);return e.ACTION(()=>{const o=r.length;if(o!==0)for(let s=o-1;s>=0;s--){const a=r[s],c=a[0],u=a[1],l=nr.includes(c);i=_e(c,i,l),i=this._ensureWhitespace(i,u)}}),i}),e.RULE("intersectOp",()=>{const r=[e.SUBRULE(e.infixOp)];return e.MANY(()=>{e.OPTION({GATE:()=>{const i=e.LA(0);return e.LA(1).startOffset>i.endOffset+1},DEF:()=>{r.push(e.SUBRULE3(e.infixOp))}})}),e.ACTION(()=>{for(;r.length>1;){let i=r.length-1;for(let o=0;o<i;o++){const s=r[o],a=r[o+1],c=Lr(" ",s,a,!0);if(delete s.wsAfter,a.wsBefore){const u=a.wsBefore.slice(0,-1),l=u.length;delete a.wsBefore,l>0&&(c.wsBefore=u)}o+1<i&&delete a.wsAfter,r.splice(o,2,c),o--,i--}}}),r[0]}),e.RULE("formula",()=>e.OR9([{ALT:()=>e.SUBRULE(e.referenceWithoutInfix)},{ALT:()=>e.SUBRULE(e.function)},{ALT:()=>e.SUBRULE(e.paren)},{ALT:()=>e.SUBRULE(e.namedTableReference)},{ALT:()=>e.SUBRULE(e.bracketedString)},{ALT:()=>e.SUBRULE(e.squareParen)},{ALT:()=>e.SUBRULE(e.literal)},{ALT:()=>e.SUBRULE(e.literalArray)}])),e.RULE("group",()=>{const r=[];return e.MANY(()=>{e.CONSUME(ue);const i=e.SUBRULE2(e.intersectOp);e.ACTION(()=>{r.push(i)})}),r}),e.RULE("paren",()=>n("paren",Qu,ir)),e.RULE("literalArray",()=>{let r={type:"row",value:[],isLiteral:!0};e.CONSUME(Ju);const i=e.getLexerPosition();let o=e.ACTION(()=>this._ensureWhitespace({type:"array",value:[r],isLiteral:!0},i,!0));const s=e.SUBRULE(e.literalForArray);e.ACTION(()=>{r.value.push(s)}),e.MANY(()=>{const c=e.OR([{ALT:()=>e.CONSUME(ue).image},{ALT:()=>e.CONSUME(Zu).image}]),u=e.SUBRULE2(e.literalForArray);e.ACTION(()=>{c===","||(r={type:"row",value:[],isLiteral:!0},o.value.push(r)),r.value.push(u)})});const a=e.OPTION(()=>this.CONSUME(tl));return o=e.ACTION(()=>(a||this._reportError(o,"Missing closing parenthesis '}'",i),this._ensureWhitespace(o,e.getLexerPosition(),!1,!0))),o}),e.RULE("literalForArray",()=>e.OR([{ALT:()=>{const r=e.OPTION(()=>e.SUBRULE(e.plusMinusOp)),i=e.CONSUME(Ro),o=e.ACTION(()=>this._ensureWhitespace(po(i.image),e.getLexerPosition()));return r?e.ACTION(()=>function(s,a){return{type:"prefix",value:s,inputs:[a]}}(r,o)):o}},{ALT:()=>{const r=e.CONSUME(Ao);return e.ACTION(()=>this._ensureWhitespace(tr(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(vo);return e.ACTION(()=>this._ensureWhitespace(mo(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(Io);return e.ACTION(()=>this._ensureWhitespace(Eo(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(No);return e.ACTION(()=>this._ensureWhitespace(gn(r.image),e.getLexerPosition()))}}])),e.RULE("literal",()=>e.OR([{ALT:()=>{const r=e.CONSUME(Ro);return e.ACTION(()=>this._ensureWhitespace(po(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(Ao);return e.ACTION(()=>this._ensureWhitespace(tr(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(vo);return e.ACTION(()=>this._ensureWhitespace(mo(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(Io);return e.ACTION(()=>this._ensureWhitespace(Eo(r.image),e.getLexerPosition()))}}])),e.RULE("function",()=>{const r=e.CONSUME($u).image.slice(0,-1),i=e.getLexerPosition(),o=e.SUBRULE(e.functionArguments);let s=e.ACTION(()=>this._ensureWhitespace(fo(r,o),i,!0));const a=e.OPTION(()=>this.CONSUME(ir));return s=e.ACTION(()=>(a||this._reportError(s,"Missing closing parenthesis ')'",i),this._ensureWhitespace(s,e.getLexerPosition(),!1,!0))),s}),e.RULE("functionArguments",()=>{const r=[];return e.MANY2(()=>{let i;e.CONSUME2(ue),i=e.ACTION(()=>this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0)),r.push(i)}),e.OPTION(()=>{r.push(e.SUBRULE(e.intersectOp)),e.MANY(()=>{let i;e.CONSUME1(ue),i=e.ACTION(()=>this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0)),r.push(i),e.OPTION3(()=>{r.pop(),r.push(e.SUBRULE2(e.intersectOp))})})}),r}),e.RULE("bracketedString",()=>{const r=e.CONSUME(Lo),i=e.getLexerPosition();return e.ACTION(()=>{const o=r.image;let s=qn("",[Zn(o.substring(1,o.length-1))]);return s=this._ensureWhitespace(s,i,!0,!1),s=this._ensureWhitespace(s,e.getLexerPosition(),!1,!0),s})}),e.RULE("squareParen",()=>{e.CONSUME(Oo);const r=e.getLexerPosition();let i=qn("",[e.SUBRULE(e.structuredArgument)]);const o=e.OPTION(()=>this.CONSUME(So));return e.ACTION(()=>{o||this._reportError(i,"Missing closing parenthesis ']'",r),i=this._ensureWhitespace(i,r,!0,!1),i=this._ensureWhitespace(i,e.getLexerPosition(),!1,!0)}),i}),e.RULE("namedTableReference",()=>{const r=e.CONSUME(Wu).image.slice(0,-1),i=e.getLexerPosition(),o=e.SUBRULE(e.structuredArguments);let s=e.ACTION(()=>this._ensureWhitespace(qn(r,o),i,!0));const a=e.OPTION(()=>this.CONSUME(So));return s=e.ACTION(()=>(a||this._reportError(s,"Missing closing parenthesis ']'",i),this._ensureWhitespace(s,e.getLexerPosition(),!1,!0))),s}),e.RULE("structuredArguments",()=>{const r=[];return e.MANY2(()=>{e.CONSUME2(ue),e.ACTION(()=>{r.push(this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0))})}),e.OPTION(()=>{const i=e.SUBRULE(e.structuredArgument);e.ACTION(()=>{i&&r.push(i)}),e.MANY(()=>{e.CONSUME1(ue),e.OPTION3(()=>{let o=e.SUBRULE2(e.structuredArgument);e.ACTION(()=>{o||(o=this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0)),r.push(o)})})})}),r}),e.RULE("structuredArgument",()=>{const r=e.OPTION(()=>e.CONSUME(rr)),i=e.getLexerPosition(),o=e.OPTION2(()=>this.CONSUME(Oo));let s=e.OR([{ALT:()=>{const a=e.CONSUME(sl);return e.ACTION(()=>this._ensureWhitespace(Zn(a.image),e.getLexerPosition()))}},{ALT:()=>{const a=e.CONSUME(Lo);return e.ACTION(()=>this._ensureWhitespace(Zn(a.image),e.getLexerPosition()))}},{ALT:()=>{const a=e.CONSUME(yo);return e.ACTION(()=>this._ensureWhitespace(Jn(a.image),e.getLexerPosition()))}},{ALT:()=>{const a=e.CONSUME(Bu);return e.ACTION(()=>this._ensureWhitespace(tr(a.image),e.getLexerPosition()))}}]);if(o){const a=e.OPTION3(()=>this.CONSUME(ir));e.ACTION(()=>(a||this._reportError(s,"Missing closing parenthesis ']'",i),this._ensureWhitespace(s,e.getLexerPosition(),!1,!0))),s={type:"structuredArg",value:null,inputs:[s]}}return e.ACTION(()=>{r&&(s=_e(r.image,s,!0),s=this._ensureWhitespace(s,e.getLexerPosition()))}),s}),e.RULE("referenceWithoutInfix",()=>e.OR([{ALT:()=>e.SUBRULE(e.reference)},{ALT:()=>{const r=e.SUBRULE(e.prefixSheetName),i=e.SUBRULE2(e.formula);return e.ACTION(()=>{if((o=i)&&o.isFormulaError)return i;var o;i.ref&&(i.ref.sheet=r)}),i}}])),e.RULE("reference",()=>{const r=e.OPTION4(()=>e.CONSUME(rr));let i=e.OR([{ALT:()=>{const o=e.CONSUME(Gu),s=e.getLexerPosition(),a=e.OPTION(()=>e.CONSUME(_o));return e.ACTION(()=>{const c=this._ensureWhitespace(function(u,l){const h=u.match(/([$]?)([A-Za-z]{1,3})([$]?)([1-9][0-9]*)/);let N=lo(h[2])-1;const S=h[1].length===1;let L=+h[4]-1;const m=h[3].length===1;return S||N===Number.MIN_SAFE_INTEGER||(N-=l.colIndex),m||L===Number.MIN_SAFE_INTEGER||(L-=l.rowIndex),{type:"cell",value:Object.freeze({colIndex:N,rowIndex:L,$colIndex:S,$rowIndex:m}),inputs:null,isReference:!0}}(o.image,e.position),s);return a?this._ensureWhitespace(Qn("#",c,!0),s):c})}},{ALT:()=>{const o=e.CONSUME(yo);return e.ACTION(()=>this._ensureWhitespace(Jn(o.image),e.getLexerPosition()))}},{ALT:()=>{const o=e.CONSUME(zu);return e.ACTION(()=>this._ensureWhitespace(function(s,a){const c=s.startsWith("$");c&&(s=s.substring(1));let u=lo(s)-1;return c||u===Number.MIN_SAFE_INTEGER||(u-=a.colIndex),{type:"cell",value:Object.freeze({colIndex:u,rowIndex:Number.MIN_SAFE_INTEGER,$colIndex:c,$rowIndex:!1}),inputs:null,isReference:!0}}(o.image,e.position),e.getLexerPosition()))}},{ALT:()=>{const o=e.CONSUME(Vu);return e.ACTION(()=>this._ensureWhitespace(ho(o.image,e.position),e.getLexerPosition()))}},{ALT:()=>{const o=e.CONSUME(No);return e.ACTION(()=>this._ensureWhitespace(gn(o.image),e.getLexerPosition()))}}]);return e.ACTION(()=>{r&&(i=_e(r,i,!0),i=this._ensureWhitespace(i,e.getLexerPosition()))}),i}),e.RULE("prefixSheetName",()=>e.OR([{ALT:()=>e.CONSUME(Ku).image.slice(0,-1)},{ALT:()=>e.CONSUME(ju).image.slice(1,-2).replace(/''/g,"'")}])),e.performSelfAnalysis()}_reportError(e,n,r=void 0,i="SyntaxError"){r===void 0&&(r=this.getLexerPosition()),e.error=!0,this.astErrors.push({name:i,message:n,previousToken:this.input[r],ast:e})}_ensureWhitespace(e,n,r=!1,i=!1){if(!e)return console.warn("node is null"),e;const o=this.input,s=o[n];if(e.image||(e.image=s.image),!i){const a=s.startOffset,c=o[n-1],u=c?.endOffset??-1;u+1<a&&(e.wsBefore=" ".repeat(a-u-1))}if(!r){const a=s.endOffset,c=o[n+1],u=c?.startOffset??this.inputTextLength;a+1<u&&(e.wsAfter=" ".repeat(u-a-1))}return e}_createAST(e,n){const r=function(a){const c=Iu.tokenize(a);if(c.errors.length>0){const u=c.errors[0],l=u.line,h=u.column;let N=`
|
|
120
120
|
`+a.split(`
|
|
121
121
|
`)[l-1]+`
|
|
122
122
|
`;throw N+=Array(h-1).fill(" ").join("")+`^
|
|
123
123
|
`,u.message=N+`Error at position ${l}:${h}
|
|
124
|
-
`+u.message,u.errorLocation={line:l,column:h},new _.n.Parse(u.message,{line:l,column:h,offset:u.offset,length:u.length})}return c}(n);let i;if(!r)return i={type:"text",value:n},i;const o=r.tokens;this.input=o,this.inputTextLength=n.length;const s=e.getPosition();return this.position=s,this.astErrors=[],this.reset(),i=this.intersectOp(),i=je(i,(a,c)=>{let u=a.type;if(u==="function"&&a.value&&a.value.toUpperCase().startsWith("_XLFN.")){const l=a.value.substring(6);let h=a.image.substring(6),N=a;l==="ANCHORARRAY"?(N=
|
|
124
|
+
`+u.message,u.errorLocation={line:l,column:h},new _.n.Parse(u.message,{line:l,column:h,offset:u.offset,length:u.length})}return c}(n);let i;if(!r)return i={type:"text",value:n},i;const o=r.tokens;this.input=o,this.inputTextLength=n.length;const s=e.getPosition();return this.position=s,this.astErrors=[],this.reset(),i=this.intersectOp(),i=je(i,(a,c)=>{let u=a.type;if(u==="function"&&a.value&&a.value.toUpperCase().startsWith("_XLFN.")){const l=a.value.substring(6);let h=a.image.substring(6),N=a;l==="ANCHORARRAY"?(N=Qn("#",a.inputs[0],!0),h="#"):l==="SINGLE"?(N=_e("@",a.inputs[0],!0),h="@"):N=fo(l,a.inputs),er(N,a),N.image=h,u=(a=N).type}if(c?.isReference){const l=c.value;if((l===":"||l===".:."||l===".:"||l===":.")&&Number.isInteger(a.value)){const h=c.inputs[0]===a?c.inputs[1]:c.inputs[0];if(h&&Number.isInteger(h.value)){const N=ho(a.image,s);return er(N,a),N}}}else if(u==="cell"){const l=a.value;if(l.rowIndex===Number.MIN_SAFE_INTEGER||l.colIndex>=16384){const h=Jn(a.image);return er(h,a),h}}return a}),i}build(e,n){if(n.length===0)throw Error("Input must not be empty.");let r,i,o;try{r=this._createAST(e,n)}catch(c){o=c instanceof _.n.Parse?c:new _.n.Parse(c.message,c)}const s=this.errors;s.length>0&&(o=go(s[0],n));const a=this.astErrors;return a.length>0&&(o=go(a[0],n)),i=r?sn(r,o):{ast:null,evaluations:_.Yt.EmptyArray,executions:_.Yt.EmptyArray,precedentsAbsolute:_.Yt.EmptyArray,precedentsExecute:_.Yt.EmptyArray,precedentsNamed:null,precedentsRelative:_.Yt.EmptyArray,precedentsRoot:_.Yt.EmptyArray,references:_.Yt.EmptyArray,tokens:_.Yt.EmptyArray,error:o},i}}class be{constructor(e,n){this._options=e,this._compiled=n}getTextAt(e,n,r=!1){return r?_.jw(this._compiled.tokens):_.$w(this._compiled.tokens,e,n)}getTokens(){return this._compiled.tokens}getError(){return this._compiled.error??null}isEquals(e){if(!(e&&e instanceof be))return!1;if(this===e)return!0;const n=this._compiled.tokens,r=e._compiled.tokens;return n.length===r.length&&_.jw(n)===_.jw(r)}getReferences(){const e=this._compiled,n=e.references,r=n.length;if(r===0)return _.Yt.EmptyArray;const i=e.precedentsExecute,o=e.precedentsRelative,s=new Array(r);for(let a=0;a<r;a++){const c=i[n[a]],u=c.inputs;if(u&&u.length===2){const l=o[i[u[0]].value],h=o[i[u[1]].value];s[a]={colStart:l.colStart,rowStart:l.rowStart,colEnd:h.colEnd,rowEnd:h.rowEnd,$colStart:l.$colStart,$rowStart:l.$rowStart,$colEnd:h.$colEnd,$rowEnd:h.$rowEnd,sheetName:l.sheetName}}else if(c.node.type==="cell"){const l=o[c.value];s[a]={...l}}else if(c.op==="named"){const l=e.precedentsNamed;s[a]=l[c.value]}else c.op==="error"&&(s[a]=c.node.value)}return s}setReferenceAt(e,n){const r=this._compiled,i=r.references;if(i.length===0)return _.Yt.EmptyArray;const o=r.precedentsExecute,s=i[e];if(s===void 0)throw new Error(`Invalid reference index: ${e}`);const a=o[s],c=a.node,u=c.inputs??_.Yt.EmptyArray;let l,h,N=!1;n&&(l={colIndex:n.colStart,rowIndex:n.rowStart,$colIndex:n.$colStart??!1,$rowIndex:n.$rowStart??!1},n.sheetName&&(l.sheetName=n.sheetName),N=!_.Kt.isSingleCell(n),N&&(h={colIndex:n.colEnd,rowIndex:n.rowEnd,$colIndex:n.$colEnd??!1,$rowIndex:n.$rowEnd??!1},n.colEnd===Number.MAX_SAFE_INTEGER&&(h.colIndex=Number.MIN_SAFE_INTEGER),n.rowEnd===Number.MAX_SAFE_INTEGER&&(h.rowIndex=Number.MIN_SAFE_INTEGER)));const S=u.length===2;let L=-1,m=-1;if(S)L=u[0].evalIndex,m=u[1].evalIndex;else{if(c.type!=="cell")throw a.op==="named"?new Error("Cannot setReference for a named reference"):new Error(`Invalidate reference index: ${e}`);L=c.evalIndex}const y=this._compiled.ast,p=je(y,A=>{if(!A||!A.isReference)return;const v=A.type;if(!n&&ws.includes(A.value)){const E=u[0],R=u[1];let U=E.evalIndex===L,x=R.evalIndex===m;if(U||x){const O=gn();return O.image="#REF!",O}}if(v!=="cell"&&v!=="error")return;const f=A.evalIndex;let d,I=f===L;if(I||f===m){if(n)if(S===N){let E=I?l:h;d={...A},d.value=E,d.image=null}else d=N?Lr(":",Xn(l),Xn(h),!0):Xn(l);else d=gn(),d.image="#REF!";return d}});if(p===y)return this;const T=sn(p,this._compiled.error),g=this._options;return new be(g,T)}_resolveNamed(e,n,r,i){const o=this._options?.getNamed;if(!o)return _.n.BuiltIn.Name;let s=o?.(e,this._options.getSheetName?.())?.[0];return s?(s.isFormulaError||(s=_.Fy(s,n,r,i)),s):_.n.BuiltIn.Name}getDirectPrecedentsAt(e,n,r=!1,i,o){const s=this._compiled,a=s.precedentsRoot,c=a.length;if(c===0)return _.Yt.EmptyArray;const u=s.precedentsRelative,l=s.precedentsAbsolute,h=u.length;for(let p=0;p<h;p++){const T=u[p];let g=l[p],A=_.Fy(T,e,n,g);l[p]=A}let N=!1;const S=s.precedentsExecute,L=S.length,m=xr;for(let p=0;p<L;p++){const T=S[p],g=T.op;if(!g){const I=l[T.value];m[T.index]=I;continue}if(g==="named"){N=!0,m[T.index]=this._resolveNamed(T.node.value,e,n);continue}if(g==="error"){m[T.index]=T.node.value;continue}if(g==="@"||g==="#"){m[T.index]=m[T.inputs[0]];continue}const A=T.inputs;if(!A)continue;let v=m[A[0]];if(v===void 0){m[T.index]=_.n.BuiltIn.Value;continue}if(v.isFormulaError){m[T.index]=v;continue}let f,d=m[A[1]];d!==void 0?d.isFormulaError?m[T.index]=d:(g===" "?f=_.Kt.intersectRanges(v,d):g!==":"&&g!==".:."&&g!==":."&&g!==".:"||(f=m[T.index]=_.Kt.unionRanges(v,d)),m[T.index]=f??_.n.BuiltIn.Null):m[T.index]=_.n.BuiltIn.Value}const y=new Array(c);for(let p=0;p<c;p++){const T=a[p],g=m[T];if(y[p]=g?.rowStart!==void 0?{...g}:g,i||o){const A=S[T];N&&A.op==="named"?(i&&(i[p]=g.$colStart||g.$colEnd),o&&(o[p]=g.$rowStart||g.$rowEnd)):(i&&(i[p]=A.hasVerticalAbs),o&&(o[p]=A.hasHorizontalAbs))}}return y}evaluate(e,n,r){const i=e.getPosition(),o=i?.rowIndex??0,s=i?.colIndex??0;let a=this._compiled;if(n!==void 0){let f;if(je(a.ast,d=>{d.evalIndex===n&&(f=d)}),!f)throw new Error(`Invalid evalIndex: ${n}`);a=sn(f,a.error)}if(a.error)return a.error;const c=a.evaluations,u=a.executions;let l,h;r||(r=this._resolvePrecedents(e));const N=a.precedentsExecute,S=a.precedentsRelative,L=a.precedentsAbsolute,m=N.length;for(let f=0;f<m;f++){const d=N[f],I=d.op;if(I){if(I==="named"){const E=d.node;let R=this._resolveNamed(d.node.value,o,s);R?.colStart!==void 0&&(R=e.getReference(R)),c[E.evalIndex]=R}else if(I==="error"){const E=d.node;c[E.evalIndex]=d.node.value}}else{const E=S[d.value];let R=L[f];const U=_.Fy(E,o,s,R),x=d.node;c[x.evalIndex]=U}}const y=a.precedentsRoot,p=y.length;if(p!==r.length)return _.n.BuiltIn.Parse;for(let f=0;f<p;f++){const d=N[y[f]].node;let I=r[f];I.isIRange&&d.type==="cell"&&I.size>1&&(I=I.getValueAt(0,0)??null),c[d.evalIndex]=I}let T;const g=f=>{const d=f.inputs,I=d?d.length:0;let E;switch(f.type){case"infix":const R=f.value;let U=c[d[0].evalIndex],x=c[d[1].evalIndex];if(R==="+"&&typeof U=="number"&&typeof x=="number"){const k=U+x;return Math.abs(k)<99e-14?0:k}if(R==="-"&&typeof U=="number"&&typeof x=="number"){const k=U-x;return Math.abs(k)<99e-14?0:k}if(U&&U.isFormulaError)return U;if(x&&x.isFormulaError)return x;const O=f.fn;return E=O?O(e,U,x):_.n.BuiltIn.Value,E=_.Ea(E,null),E;case"function":T||(T=new Array(I)),T.length!==I&&(T.length=I);for(let k=0;k<I;k++)T[k]=c[d[k].evalIndex];return E=this._callFunction(e,f,T),E&&typeof E.then=="function"?E.then(k=>{k=_.Ea(k,e),E instanceof _.n.Known&&(h=E),c[f.evalIndex]=k}).catch(k=>{const $=k instanceof _.n.Known?k:new _.n.Value("Uncaught error",{cause:k});c[f.evalIndex]=$}):E instanceof _.n.Known&&(h=E),E;case"prefix":case"postfix":let w=c[d[0].evalIndex];if(w&&w.isFormulaError)return w;const C=f.fn;return E=C?C(e,w):_.n.BuiltIn.Value,E;case"paren":if(I===1)return c[d[0].evalIndex];{const k=new Array(I);for(let $=0;$<I;$++)k[$]=c[d[$].evalIndex];return k}case"named":return null;case"empty":return}};let A=u.length;for(let f=0;f<A;f++){const d=u[f];if(h)return h;if(l)l=l.then(()=>{const I=g(d);return c[d.evalIndex]=I,I});else{const I=g(d);c[d.evalIndex]=I,I&&typeof I.then=="function"&&(l=I)}}if(l)return l.then(()=>{const f=c[c.length-1];return this._finalizeReturnValue(e,f)});const v=c[c.length-1];return this._finalizeReturnValue(e,v)}_resolvePrecedents(e){const n=e.getPosition(),r=n?.rowIndex??0,i=n?.colIndex??0,o=this.getDirectPrecedentsAt(r,i),s=o.length;let a;if(s>0){a=new Array(s);for(let c=0;c<s;c++){const u=o[c];if(u instanceof _.n.Known)a[c]=u;else if(Array.isArray(u)){const l=new Array(u.length);for(let h=0;h<u.length;h++)l[h]=e.getReference(u[h]);a[c]=l}else a[c]=e.getReference(u)}}else a=_.Yt.EmptyArray;return a}wrapImplicit(e,n,r){const i=this._compiled.ast;if(!i||!i.isReference)return this;if(i.type==="cell")return this;if(i.value==="@")return this;if(!r)return this;const o=_.en(n)+_._n(e);if(r.has(o))return this;const s=sn(_e("@",i,!0),this._compiled.error);return new be(this._options,s)}_callFunction(e,n,r){const i=n?.cacheFn??e.getFunction(n.value);if(!i)return new _.n.Parse;const o=i.isBuiltIn();let s;o?n.cacheFn=i:this._context=e;try{s=i.execute(...r)}catch(a){s=a instanceof _.n.Known?a:new _.n.Value(a.message,{cause:a})}return o||(this._context=null),s===void 0?new _.n.Parse:s}_finalizeReturnValue(e,n){if(n&&n.colStart!==void 0&&(n=e.getValueAt(n.rowStart,n.colStart)),Array.isArray(n))if(n.length===1&&Array.isArray(n[0])&&n[0].length===1)n=n[0][0],Array.isArray(n)&&(n=_.n.BuiltIn.Value);else try{n=e.getRange(n)}catch{n=_.n.BuiltIn.Value}return n?.isIRange?n.size===1?(n=n.getValueAt(0,0,pl),(n=_.Ea(n,e))===null&&(n=0)):n=n.fillEmpty(0):(n=_.Ea(n,e))===null&&(n=0),n}get[Symbol.toStringTag](){return"[FormulaBlock]"}toString(){const e=this._compiled;if(e.error)return e.error.toString();const n=this._context;if(n){const r=n.getPosition();return this.getTextAt(r.rowIndex,r.colIndex)}return _.jw(e.tokens)}}const xr=new Array(20);for(let t=0;t<xr.length;t++)xr[t]={colStart:0,rowStart:0,colEnd:0,rowEnd:0,sheetName:null};const pl={type:null};exports.FormulaParser=class{constructor(t){this._options={getEntireCoords:_.lc,...t},this._astBuilder=new dl}parse(t,e){t.getPosition().sheetName;const n=this._astBuilder.build(t,e);return new be(this._options,n)}eval(t,e){return this.parse(t,e).evaluate(t)}};
|